OpenToonz - An open-source full-featured 2D animation creation software
C
small fixes and change default shortcuts
shun_iwasawa7d08f6e97e57
diff --git a/stuff/profiles/layouts/shortcuts/defopentoonz.ini b/stuff/profiles/layouts/shortcuts/defopentoonz.iniindex ebb88c626..27ec3123e 100644--- a/stuff/profiles/layouts/shortcuts/defopentoonz.ini+++ b/stuff/profiles/layouts/shortcuts/defopentoonz.ini@@ -188,7 +188,7 @@ MI_NextDrawing=.MI_NextFrame=Shift+.MI_NextStep=MI_NoShift=-MI_OpacityCheck=1+MI_OpacityCheck=Alt+1MI_OpenBatchServers=MI_OpenChild=MI_OpenCleanupSettings=@@ -359,8 +359,8 @@ T_Tape=TT_Tracker=T_Type=YT_Zoom=Shift+Space-T_ZoomFit=9-T_ZoomReset=0+T_ZoomFit=Alt+9+T_ZoomReset=Alt+0T_Zoomin=+T_Zoomout=-MI_LoadRecentImage=diff --git a/stuff/profiles/layouts/shortcuts/otharmony.ini b/stuff/profiles/layouts/shortcuts/otharmony.iniindex 846417219..3675e6d6d 100644--- a/stuff/profiles/layouts/shortcuts/otharmony.ini+++ b/stuff/profiles/layouts/shortcuts/otharmony.ini@@ -54,8 +54,8 @@ T_Tape=Alt+CT_Type=Alt+9T_Zoom=Alt+ZT_ZoomReset=-T_Zoomin=2-T_Zoomout=1+T_Zoomin=Alt+2+T_Zoomout=Alt+1A_DecreaseBrushHardness=A_DecreaseMaxBrushThickness=A_DecreaseMinBrushThickness=@@ -143,7 +143,7 @@ MI_CloneChild=MI_CloneLevel=MI_ClonePreview=MI_CloseChild=-MI_Collapse=0+MI_Collapse=Alt+0MI_CollectAssets=MI_CompareToSnapshot=MI_ConvertFileWithInput=diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txtindex 1d2b21d39..c6849a189 100644--- a/toonz/sources/toonz/CMakeLists.txt+++ b/toonz/sources/toonz/CMakeLists.txt@@ -142,7 +142,7 @@ set(MOC_HEADERScleanupsettingspane.hpenciltestpopup.hlocatorpopup.h- styleshortcutselectivepanel.h+ styleshortcutswitchablepanel.h# Tracker filedummyprocessor.hmetnum.h@@ -303,7 +303,7 @@ set(SOURCEScleanupsettingspane.cpppenciltestpopup.cpplocatorpopup.cpp- styleshortcutselectivepanel.cpp+ styleshortcutswitchablepanel.cpp# Tracker filedummyprocessor.cppmetnum.cppdiff --git a/toonz/sources/toonz/comboviewerpane.cpp b/toonz/sources/toonz/comboviewerpane.cppindex 325f01aab..c59200561 100644--- a/toonz/sources/toonz/comboviewerpane.cpp+++ b/toonz/sources/toonz/comboviewerpane.cpp@@ -86,7 +86,7 @@ ComboViewerPanel::ComboViewerPanel(QWidget *parent, Qt::WindowFlags flags)#elseComboViewerPanel::ComboViewerPanel(QWidget *parent, Qt::WFlags flags)#endif- : StyleShortcutSelectivePanel(parent) {+ : StyleShortcutSwitchablePanel(parent) {TApp *app = TApp::instance();QFrame *hbox = new QFrame(this);@@ -103,7 +103,7 @@ ComboViewerPanel::ComboViewerPanel(QWidget *parent, Qt::WFlags flags)ImageUtils::FullScreenWidget *fsWidget =new ImageUtils::FullScreenWidget(this);fsWidget->setWidget(m_sceneViewer = new SceneViewer(fsWidget));- m_sceneViewer->setIsStyleShortcutSelective();+ m_sceneViewer->setIsStyleShortcutSwitchable();#if defined(Q_OS_WIN) && (QT_VERSION >= 0x050500) && (QT_VERSION < 0x050600)// Workaround for QTBUG-48288@@ -341,7 +341,7 @@ ComboViewerPanel::~ComboViewerPanel() {//-----------------------------------------------------------------------------void ComboViewerPanel::showEvent(QShowEvent *event) {- StyleShortcutSelectivePanel::showEvent(event);+ StyleShortcutSwitchablePanel::showEvent(event);TApp *app = TApp::instance();TFrameHandle *frameHandle = app->getCurrentFrame();TSceneHandle *sceneHandle = app->getCurrentScene();@@ -406,7 +406,7 @@ void ComboViewerPanel::showEvent(QShowEvent *event) {//-----------------------------------------------------------------------------void ComboViewerPanel::hideEvent(QHideEvent *event) {- StyleShortcutSelectivePanel::hideEvent(event);+ StyleShortcutSwitchablePanel::hideEvent(event);TApp *app = TApp::instance();disconnect(app->getCurrentScene());disconnect(app->getCurrentLevel());@@ -791,5 +791,5 @@ void ComboViewerPanel::onPreferenceChanged(const QString &prefName) {prefName.isEmpty())m_flipConsole->onPreferenceChanged();- StyleShortcutSelectivePanel::onPreferenceChanged(prefName);+ StyleShortcutSwitchablePanel::onPreferenceChanged(prefName);}diff --git a/toonz/sources/toonz/comboviewerpane.h b/toonz/sources/toonz/comboviewerpane.hindex e8368300e..d7f2ea05b 100644--- a/toonz/sources/toonz/comboviewerpane.h+++ b/toonz/sources/toonz/comboviewerpane.h@@ -3,7 +3,7 @@#ifndef COMBOVIEWER_PANE_INCLUDED#define COMBOVIEWER_PANE_INCLUDED-#include "styleshortcutselectivepanel.h"+#include "styleshortcutswitchablepanel.h"#include "sceneviewer.h"#include "toonzqt/intfield.h"#include "toonzqt/keyframenavigator.h"@@ -37,7 +37,7 @@ enum CV_Parts {};//------------------------------------------------------------------------------class ComboViewerPanel final : public StyleShortcutSelectivePanel,+class ComboViewerPanel final : public StyleShortcutSwitchablePanel,public FlipConsoleOwner {Q_OBJECTdiff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cppindex afca0114e..23c7403a3 100644--- a/toonz/sources/toonz/mainwindow.cpp+++ b/toonz/sources/toonz/mainwindow.cpp@@ -1689,7 +1689,7 @@ void MainWindow::defineActions() {MenuScanCleanupCommandType);CameraTestCheck::instance()->setToggle(toggle);- createToggle(MI_OpacityCheck, tr("&Opacity Check"), "1", false,+ createToggle(MI_OpacityCheck, tr("&Opacity Check"), "Alt+1", false,MenuScanCleanupCommandType);createMenuScanCleanupAction(MI_Cleanup, tr("&Cleanup"), "");@@ -2047,8 +2047,8 @@ void MainWindow::defineActions() {createViewerAction(V_ZoomIn, tr("Zoom In"), "+");createViewerAction(V_ZoomOut, tr("Zoom Out"), "-");- createViewerAction(V_ZoomReset, tr("Reset View"), "0");- createViewerAction(V_ZoomFit, tr("Fit to Window"), "9");+ createViewerAction(V_ZoomReset, tr("Reset View"), "Alt+0");+ createViewerAction(V_ZoomFit, tr("Fit to Window"), "Alt+9");createViewerAction(V_ActualPixelSize, tr("Actual Pixel Size"), "N");createViewerAction(V_ShowHideFullScreen, tr("Show//Hide Full Screen"),"Alt+F");diff --git a/toonz/sources/toonz/sceneviewer.h b/toonz/sources/toonz/sceneviewer.hindex 1362f661e..10276dc4b 100644--- a/toonz/sources/toonz/sceneviewer.h+++ b/toonz/sources/toonz/sceneviewer.h@@ -138,7 +138,7 @@ class SceneViewer final : public QGLWidget,LocatorPopup *m_locator;bool m_isLocator;- bool m_isStyleShortcutSelective;+ bool m_isStyleShortcutSwitchable;// iwsw commented out temporarily// Ghibli3DLutUtil * m_ghibli3DLutUtil;@@ -236,7 +236,7 @@ public:void setFocus(Qt::FocusReason reason) { QWidget::setFocus(reason); };void setIsLocator() { m_isLocator = true; }- void setIsStyleShortcutSelective() { m_isStyleShortcutSelective = true; }+ void setIsStyleShortcutSwitchable() { m_isStyleShortcutSwitchable = true; }public:// SceneViewer's gadget public functionsdiff --git a/toonz/sources/toonz/sceneviewerevents.cpp b/toonz/sources/toonz/sceneviewerevents.cppindex c7270fd47..fbaea5ea6 100644--- a/toonz/sources/toonz/sceneviewerevents.cpp+++ b/toonz/sources/toonz/sceneviewerevents.cpp@@ -775,10 +775,11 @@ void SceneViewer::keyPressEvent(QKeyEvent *event) {// If this object is child of Viewer or ComboViewer// (m_isStyleShortcutSelective = true),// then consider about shortcut for the current style selection.- if (m_isStyleShortcutSelective &&+ if (m_isStyleShortcutSwitchable &&Preferences::instance()->isUseNumpadForSwitchingStylesEnabled() &&- (!isTextToolActive) && ((Qt::Key_0 <= key && key <= Qt::Key_9) ||- key == Qt::Key_Tab || key == Qt::Key_Backtab)) {+ (!isTextToolActive) && event->modifiers() == Qt::NoModifier &&+ ((Qt::Key_0 <= key && key <= Qt::Key_9) || key == Qt::Key_Tab ||+ key == Qt::Key_Backtab)) {event->ignore();return;}diff --git a/toonz/sources/toonz/styleshortcutselectivepanel.cpp b/toonz/sources/toonz/styleshortcutswitchablepanel.cppsimilarity index 88%rename from toonz/sources/toonz/styleshortcutselectivepanel.cpprename to toonz/sources/toonz/styleshortcutswitchablepanel.cppindex 57b1fab6f..4b8ada43a 100644--- a/toonz/sources/toonz/styleshortcutselectivepanel.cpp+++ b/toonz/sources/toonz/styleshortcutswitchablepanel.cpp@@ -1,4 +1,4 @@-#include "styleshortcutselectivepanel.h"+#include "styleshortcutswitchablepanel.h"// TnzLib includes#include "toonz/tscenehandle.h"@@ -21,12 +21,12 @@//------------------------------------------------------------------------------void StyleShortcutSelectivePanel::keyPressEvent(QKeyEvent *event) {+void StyleShortcutSwitchablePanel::keyPressEvent(QKeyEvent *event) {if (!Preferences::instance()->isUseNumpadForSwitchingStylesEnabled()) return;TTool *tool = TApp::instance()->getCurrentTool()->getTool();if (!tool) return;if (tool->getName() == T_Type && tool->isActive()) return;-+ if (event->modifiers() != Qt::NoModifier) return;int key = event->key();if (Qt::Key_0 <= key && key <= Qt::Key_9) {TPaletteHandle *ph =@@ -58,7 +58,7 @@ void StyleShortcutSelectivePanel::keyPressEvent(QKeyEvent *event) {//------------------------------------------------------------------------------void StyleShortcutSelectivePanel::showEvent(QShowEvent *event) {+void StyleShortcutSwitchablePanel::showEvent(QShowEvent *event) {TPanel::showEvent(event);bool ret = connect(TApp::instance()->getCurrentScene(),SIGNAL(preferenceChanged(const QString &)), this,@@ -69,7 +69,7 @@ void StyleShortcutSelectivePanel::showEvent(QShowEvent *event) {//------------------------------------------------------------------------------void StyleShortcutSelectivePanel::hideEvent(QHideEvent *event) {+void StyleShortcutSwitchablePanel::hideEvent(QHideEvent *event) {TPanel::hideEvent(event);disconnect(TApp::instance()->getCurrentScene(),SIGNAL(preferenceChanged(const QString &)), this,@@ -78,14 +78,15 @@ void StyleShortcutSelectivePanel::hideEvent(QHideEvent *event) {//------------------------------------------------------------------------------void StyleShortcutSelectivePanel::onPreferenceChanged(const QString &prefName) {+void StyleShortcutSwitchablePanel::onPreferenceChanged(+ const QString &prefName) {if (prefName == "NumpadForSwitchingStyles" || prefName.isEmpty())updateTabFocus();}//------------------------------------------------------------------------------void StyleShortcutSelectivePanel::updateTabFocus() {+void StyleShortcutSwitchablePanel::updateTabFocus() {QList<QWidget *> widgets = findChildren<QWidget *>();if (Preferences::instance()->isUseNumpadForSwitchingStylesEnabled()) {// disable tab focusdiff --git a/toonz/sources/toonz/styleshortcutselectivepanel.h b/toonz/sources/toonz/styleshortcutswitchablepanel.hsimilarity index 70%rename from toonz/sources/toonz/styleshortcutselectivepanel.hrename to toonz/sources/toonz/styleshortcutswitchablepanel.hindex cacf5ce09..ce689331f 100644--- a/toonz/sources/toonz/styleshortcutselectivepanel.h+++ b/toonz/sources/toonz/styleshortcutswitchablepanel.h@@ -1,26 +1,27 @@#pragma once-#ifndef STYLE_SHORTCUT_SELECTIVE_PANEL_H-#define STYLE_SHORTCUT_SELECTIVE_PANEL_H+#ifndef STYLE_SHORTCUT_SWITCHABLE_PANEL_H+#define STYLE_SHORTCUT_SWITCHABLE_PANEL_H#include "pane.h"//=============================================================================-// StyleShortcutSelectivePanel+// StyleShortcutSwitchablePanel//------------------------------------------------------------------------------// StyleShortcutSelectivePanel class is inherited by panels which can select-// the current style by 0-9 number keys if the Preferences option+// StyleShortcutSwitchablePanel class is subclass of TPanel and+// inherited by panels which can select the current style by 0-9+// number keys if the Preferences option// "Use Numpad and Tab keys for Switching Styles" is active.// Currently inherited by ComboViewer, Viewer and Palette//------------------------------------------------------------------------------class StyleShortcutSelectivePanel : public TPanel {+class StyleShortcutSwitchablePanel : public TPanel {Q_OBJECTQHash<QWidget *, Qt::FocusPolicy> m_childrenFocusPolicies;public:- StyleShortcutSelectivePanel(+ StyleShortcutSwitchablePanel(QWidget *parent = 0, Qt::WindowFlags flags = 0,TDockWidget::Orientation orientation = TDockWidget::vertical): TPanel(parent, flags, orientation) {}diff --git a/toonz/sources/toonz/tpanels.cpp b/toonz/sources/toonz/tpanels.cppindex 70dc4b138..8ed579594 100644--- a/toonz/sources/toonz/tpanels.cpp+++ b/toonz/sources/toonz/tpanels.cpp@@ -403,7 +403,7 @@ public://-----------------------------------------------------------------------------PaletteViewerPanel::PaletteViewerPanel(QWidget *parent)- : StyleShortcutSelectivePanel(parent) {+ : StyleShortcutSwitchablePanel(parent) {m_paletteHandle = new TPaletteHandle();connect(m_paletteHandle, SIGNAL(colorStyleSwitched()),SLOT(onColorStyleSwitched()));diff --git a/toonz/sources/toonz/tpanels.h b/toonz/sources/toonz/tpanels.hindex c0ff58b6f..d6501d8d3 100644--- a/toonz/sources/toonz/tpanels.h+++ b/toonz/sources/toonz/tpanels.h@@ -4,7 +4,7 @@#define TPANELS_INCLUDED#include "pane.h"-#include "styleshortcutselectivepanel.h"+#include "styleshortcutswitchablepanel.h"#include "tpalette.h"#include "trenderer.h"@@ -28,7 +28,7 @@ class ToolOptions;// PaletteViewerPanel//----------------------------------------------------------class PaletteViewerPanel final : public StyleShortcutSelectivePanel {+class PaletteViewerPanel final : public StyleShortcutSwitchablePanel {Q_OBJECTTPaletteHandle *m_paletteHandle;diff --git a/toonz/sources/toonz/viewerpane.cpp b/toonz/sources/toonz/viewerpane.cppindex 68356e1dd..ef676e7f9 100644--- a/toonz/sources/toonz/viewerpane.cpp+++ b/toonz/sources/toonz/viewerpane.cpp@@ -77,7 +77,7 @@ SceneViewerPanel::SceneViewerPanel(QWidget *parent, Qt::WindowFlags flags)#elseSceneViewerPanel::SceneViewerPanel(QWidget *parent, Qt::WFlags flags)#endif- : StyleShortcutSelectivePanel(parent) {+ : StyleShortcutSwitchablePanel(parent) {QFrame *hbox = new QFrame(this);hbox->setFrameStyle(QFrame::StyledPanel);hbox->setObjectName("ViewerPanel");@@ -94,7 +94,7 @@ SceneViewerPanel::SceneViewerPanel(QWidget *parent, Qt::WFlags flags)new ImageUtils::FullScreenWidget(viewer);fsWidget->setWidget(m_sceneViewer = new SceneViewer(fsWidget));- m_sceneViewer->setIsStyleShortcutSelective();+ m_sceneViewer->setIsStyleShortcutSwitchable();bool ret = true;ret = ret && connect(m_sceneViewer, SIGNAL(onZoomChanged()),@@ -222,7 +222,7 @@ SceneViewerPanel::~SceneViewerPanel() {}//-----------------------------------------------------------------------------void SceneViewerPanel::showEvent(QShowEvent *event) {- StyleShortcutSelectivePanel::showEvent(event);+ StyleShortcutSwitchablePanel::showEvent(event);TApp *app = TApp::instance();TFrameHandle *frameHandle = app->getCurrentFrame();TSceneHandle *sceneHandle = app->getCurrentScene();@@ -271,7 +271,7 @@ void SceneViewerPanel::showEvent(QShowEvent *event) {//-----------------------------------------------------------------------------void SceneViewerPanel::hideEvent(QHideEvent *event) {- StyleShortcutSelectivePanel::hideEvent(event);+ StyleShortcutSwitchablePanel::hideEvent(event);TApp *app = TApp::instance();TFrameHandle *frameHandle = app->getCurrentFrame();TSceneHandle *sceneHandle = app->getCurrentScene();@@ -644,7 +644,7 @@ void SceneViewerPanel::onPreferenceChanged(const QString &prefName) {prefName.isEmpty())m_flipConsole->onPreferenceChanged();- StyleShortcutSelectivePanel::onPreferenceChanged(prefName);+ StyleShortcutSwitchablePanel::onPreferenceChanged(prefName);}//-----------------------------------------------------------------------------diff --git a/toonz/sources/toonz/viewerpane.h b/toonz/sources/toonz/viewerpane.hindex e75eaca67..699873fbc 100644--- a/toonz/sources/toonz/viewerpane.h+++ b/toonz/sources/toonz/viewerpane.h@@ -3,7 +3,7 @@#ifndef VIEWER_PANE_INCLUDED#define VIEWER_PANE_INCLUDED-#include "styleshortcutselectivepanel.h"+#include "styleshortcutswitchablepanel.h"#include "sceneviewer.h"#include "toonzqt/intfield.h"#include "toonzqt/keyframenavigator.h"@@ -25,7 +25,7 @@ class Ruler;class FlipConsole;class TXshLevel;-class SceneViewerPanel final : public StyleShortcutSelectivePanel,+class SceneViewerPanel final : public StyleShortcutSwitchablePanel,public FlipConsoleOwner {Q_OBJECTdiff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cppindex 588792ee6..b325637d5 100644--- a/toonz/sources/toonzlib/preferences.cpp+++ b/toonz/sources/toonzlib/preferences.cpp@@ -296,7 +296,7 @@ Preferences::Preferences(), m_precompute(true), m_ffmpegTimeout(30), m_shortcutPreset("defopentoonz")- , m_useNumpadForSwitchingStyles(false) {+ , m_useNumpadForSwitchingStyles(true) {TCamera camera;m_defLevelType = PLI_XSHLEVEL;m_defLevelWidth = camera.getSize().lx;