diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index da1d7e4..9f0fab1 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -340,6 +340,9 @@ public: bool useCtrlAltToResizeBrushEnabled() const { return getBoolValue(useCtrlAltToResizeBrush); } + int getTempToolSwitchTimer() const { + return getIntValue(tempToolSwitchTimer); + } // Xsheet tab QString getXsheetLayoutPreference() const { diff --git a/toonz/sources/include/toonz/preferencesitemids.h b/toonz/sources/include/toonz/preferencesitemids.h index 07dffcd..d826461 100644 --- a/toonz/sources/include/toonz/preferencesitemids.h +++ b/toonz/sources/include/toonz/preferencesitemids.h @@ -107,6 +107,7 @@ enum PreferencesItemId { cursorOutlineEnabled, levelBasedToolsDisplay, useCtrlAltToResizeBrush, + tempToolSwitchTimer, //---------- // Xsheet diff --git a/toonz/sources/tnztools/toolhandle.cpp b/toonz/sources/tnztools/toolhandle.cpp index 06ba72b..8ce17b1 100644 --- a/toonz/sources/tnztools/toolhandle.cpp +++ b/toonz/sources/tnztools/toolhandle.cpp @@ -7,6 +7,7 @@ #include "timage.h" //#include "tapp.h" #include "toonzqt/menubarcommand.h" +#include "toonz/preferences.h" #include #include #include @@ -72,7 +73,8 @@ void ToolHandle::storeTool() { void ToolHandle::restoreTool() { // qDebug() << m_storedToolTime.elapsed(); if (m_storedToolName != m_toolName && m_storedToolName != "" && - m_storedToolTime.elapsed() > 500) { + m_storedToolTime.elapsed() > + Preferences::instance()->getTempToolSwitchTimer()) { setTool(m_storedToolName); } } diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 11a9147..38347ce 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1121,6 +1121,8 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) { {cursorOutlineEnabled, tr("Show Cursor Size Outlines")}, {levelBasedToolsDisplay, tr("Toolbar Display Behaviour:")}, {useCtrlAltToResizeBrush, tr("Use %1 to Resize Brush").arg(CtrlAltStr())}, + {tempToolSwitchTimer, + tr("Switch Tool Temporarily Keypress Length (ms):")}, // Xsheet {xsheetLayoutPreference, tr("Column Header Layout*:")}, @@ -1753,6 +1755,7 @@ QWidget* PreferencesPopup::createToolsPage() { insertUI(levelBasedToolsDisplay, lay, getComboItemList(levelBasedToolsDisplay)); insertUI(useCtrlAltToResizeBrush, lay); + insertUI(tempToolSwitchTimer, lay); lay->setRowStretch(lay->rowCount(), 1); widget->setLayout(lay); diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 65d711c..f40142a 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -492,6 +492,8 @@ void Preferences::definePreferenceItems() { 0); // Default define(useCtrlAltToResizeBrush, "useCtrlAltToResizeBrush", QMetaType::Bool, true); + define(tempToolSwitchTimer, "tempToolSwitchTimer", QMetaType::Int, 500, 1, + std::numeric_limits::max()); // Xsheet define(xsheetLayoutPreference, "xsheetLayoutPreference", QMetaType::QString,