Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

enable shift + tab

shun_iwasawabeb3057607b0
diff --git a/toonz/sources/common/tvrender/tpalette.cpp b/toonz/sources/common/tvrender/tpalette.cpp
index dbdf592e8..f3e229ee5 100644
--- a/toonz/sources/common/tvrender/tpalette.cpp
+++ b/toonz/sources/common/tvrender/tpalette.cpp
@@ -1097,9 +1097,16 @@ void TPalette::setShortcutValue(int key, int styleId) {
//-------------------------------------------------------------------
-void TPalette::nextShortcutScope() {
- if ((m_shortcutScopeIndex + 1) * 10 < getPage(0)->getStyleCount())
- m_shortcutScopeIndex += 1;
- else
- m_shortcutScopeIndex = 0;
-}
\ No newline at end of file
+void TPalette::nextShortcutScope(bool invert) {
+ if (invert) {
+ if (m_shortcutScopeIndex > 0)
+ m_shortcutScopeIndex -= 1;
+ else
+ m_shortcutScopeIndex = getPage(0)->getStyleCount() / 10;
+ } else {
+ if ((m_shortcutScopeIndex + 1) * 10 < getPage(0)->getStyleCount())
+ m_shortcutScopeIndex += 1;
+ else
+ m_shortcutScopeIndex = 0;
+ }
+}
diff --git a/toonz/sources/include/tpalette.h b/toonz/sources/include/tpalette.h
index e25b5415b..339186f6c 100644
--- a/toonz/sources/include/tpalette.h
+++ b/toonz/sources/include/tpalette.h
@@ -420,7 +420,7 @@ between RGBA color components.
m_isLocked = lock;
}
- void nextShortcutScope();
+ void nextShortcutScope(bool invert);
public:
// Deprecated functions
diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp
index 6c02e7dfe..1ee465b8a 100644
--- a/toonz/sources/toonz/preferencespopup.cpp
+++ b/toonz/sources/toonz/preferencespopup.cpp
@@ -885,6 +885,8 @@ void PreferencesPopup::onUseNumpadForSwitchingStylesClicked(bool checked) {
}
QAction *tabAction = cm->getActionFromShortcut("Tab");
if (tabAction) actionsList.append(tabAction);
+ tabAction = cm->getActionFromShortcut("Shift+Tab");
+ if (tabAction) actionsList.append(tabAction);
// if there are actions using numpad shortcuts, notify to release them.
if (!actionsList.isEmpty()) {
QString msgStr =
diff --git a/toonz/sources/toonz/sceneviewerevents.cpp b/toonz/sources/toonz/sceneviewerevents.cpp
index 6bed2c5bb..c55a75a00 100644
--- a/toonz/sources/toonz/sceneviewerevents.cpp
+++ b/toonz/sources/toonz/sceneviewerevents.cpp
@@ -775,13 +775,13 @@ void SceneViewer::keyPressEvent(QKeyEvent *event) {
}
event->accept();
return;
- } else if (key == Qt::Key_Tab) {
+ } else if (key == Qt::Key_Tab || key == Qt::Key_Backtab) {
TPaletteHandle *ph =
TApp::instance()->getPaletteController()->getCurrentLevelPalette();
TPalette *palette = ph->getPalette();
if (palette) {
- palette->nextShortcutScope();
+ palette->nextShortcutScope(key == Qt::Key_Backtab);
ph->notifyPaletteChanged();
}
event->accept();
diff --git a/toonz/sources/toonz/shortcutpopup.cpp b/toonz/sources/toonz/shortcutpopup.cpp
index 911a11f85..5e360628d 100644
--- a/toonz/sources/toonz/shortcutpopup.cpp
+++ b/toonz/sources/toonz/shortcutpopup.cpp
@@ -10,6 +10,9 @@
#include "toonzqt/menubarcommand.h"
#include "toonzqt/dvdialog.h"
+// TnzLib includes
+#include "toonz/preferences.h"
+
// Qt includes
#include <QTreeWidgetItem>
#include <QVBoxLayout>
@@ -128,6 +131,14 @@ void ShortcutViewer::keyPressEvent(QKeyEvent *event) {
modifiers = 0;
}
+ // If "Use Numpad and Tab keys for Switching Styles" option is activated,
+ // then prevent to assign such keys
+ if (Preferences::instance()->isUseNumpadForSwitchingStylesEnabled() &&
+ modifiers == 0 && (key >= Qt::Key_0 && key <= Qt::Key_9)) {
+ event->ignore();
+ return;
+ }
+
if (m_action) {
CommandManager *cm = CommandManager::instance();
QKeySequence keySequence(key + modifiers);