diff --git a/stuff/profiles/layouts/rooms/Default/menubar_template.xml b/stuff/profiles/layouts/rooms/Default/menubar_template.xml index 86114c8..271c58b 100644 --- a/stuff/profiles/layouts/rooms/Default/menubar_template.xml +++ b/stuff/profiles/layouts/rooms/Default/menubar_template.xml @@ -75,6 +75,8 @@ MI_BringForward MI_SendBack MI_SendBackward + + MI_TouchGestureControl MI_DefineScanner diff --git a/stuff/profiles/layouts/rooms/StudioGhibli/room3_menubar.xml b/stuff/profiles/layouts/rooms/StudioGhibli/room3_menubar.xml index b090854..5c74149 100644 --- a/stuff/profiles/layouts/rooms/StudioGhibli/room3_menubar.xml +++ b/stuff/profiles/layouts/rooms/StudioGhibli/room3_menubar.xml @@ -74,6 +74,8 @@ MI_ResetShift MI_RasterizePli + + MI_TouchGestureControl MI_Undo diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index f93750a..801ca00 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -361,9 +361,6 @@ public: return m_downArrowInLevelStripCreatesNewFrame; } - void setTouchGestureControl(bool on); - bool getTouchGestureControl() { return m_touchGestureControlEnabled; } - // Tools Tab void setDropdownShortcutsCycleOptions(bool on); bool getDropdownShortcutsCycleOptions() { @@ -655,8 +652,6 @@ private: bool m_currentTimelineEnabled; - bool m_touchGestureControlEnabled; - private: Preferences(); ~Preferences(); diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 40f334d..5adf58e 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -86,6 +86,13 @@ TEnv::IntVar DockingCheckToggleAction("DockingCheckToggleAction", 0); TEnv::IntVar ShiftTraceToggleAction("ShiftTraceToggleAction", 0); TEnv::IntVar EditShiftToggleAction("EditShiftToggleAction", 0); TEnv::IntVar NoShiftToggleAction("NoShiftToggleAction", 0); +// 11/30/2017 disable touch control by default in osx +// as there seems to be a malfunction with trackpad +#ifdef MACOSX +TEnv::IntVar TouchGestureControl("TouchGestureControl", 0); +#else +TEnv::IntVar TouchGestureControl("TouchGestureControl", 1); +#endif //============================================================================= namespace { @@ -1294,6 +1301,8 @@ void MainWindow::onMenuCheckboxChanged() { EditShiftToggleAction = isChecked; else if (cm->getAction(MI_NoShift) == action) NoShiftToggleAction = isChecked; + else if (cm->getAction(MI_TouchGestureControl) == action) + TouchGestureControl = isChecked; } //----------------------------------------------------------------------------- @@ -1704,6 +1713,10 @@ void MainWindow::defineActions() { createMenuEditAction(MI_ExitGroup, tr("&Exit Group"), ""); createMenuEditAction(MI_RemoveEndpoints, tr("&Remove Vector Overflow"), ""); + createToggle(MI_TouchGestureControl, tr("&Touch Gesture Control"), "", + TouchGestureControl ? 1 : 0, MenuEditCommandType) + ->setEnabled(true); + createMenuScanCleanupAction(MI_DefineScanner, tr("&Define Scanner..."), ""); createMenuScanCleanupAction(MI_ScanSettings, tr("&Scan Settings..."), ""); createMenuScanCleanupAction(MI_Scan, tr("&Scan"), ""); @@ -2373,9 +2386,9 @@ RecentFiles::~RecentFiles() {} void RecentFiles::addFilePath(QString path, FileType fileType) { QList files = - (fileType == Scene) ? m_recentScenes : (fileType == Level) - ? m_recentLevels - : m_recentFlipbookImages; + (fileType == Scene) + ? m_recentScenes + : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages; int i; for (i = 0; i < files.size(); i++) if (files.at(i) == path) files.removeAt(i); @@ -2500,9 +2513,9 @@ void RecentFiles::saveRecentFiles() { QList RecentFiles::getFilesNameList(FileType fileType) { QList files = - (fileType == Scene) ? m_recentScenes : (fileType == Level) - ? m_recentLevels - : m_recentFlipbookImages; + (fileType == Scene) + ? m_recentScenes + : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages; QList names; int i; for (i = 0; i < files.size(); i++) { @@ -2529,9 +2542,9 @@ void RecentFiles::refreshRecentFilesMenu(FileType fileType) { menu->setEnabled(false); else { CommandId clearActionId = - (fileType == Scene) ? MI_ClearRecentScene : (fileType == Level) - ? MI_ClearRecentLevel - : MI_ClearRecentImage; + (fileType == Scene) + ? MI_ClearRecentScene + : (fileType == Level) ? MI_ClearRecentLevel : MI_ClearRecentImage; menu->setActions(names); menu->addSeparator(); QAction *clearAction = CommandManager::instance()->getAction(clearActionId); diff --git a/toonz/sources/toonz/menubar.cpp b/toonz/sources/toonz/menubar.cpp index 71ddccb..dae7d12 100644 --- a/toonz/sources/toonz/menubar.cpp +++ b/toonz/sources/toonz/menubar.cpp @@ -1152,6 +1152,10 @@ QMenuBar *StackedMenuBar::createFullMenuBar() { addMenuItem(editMenu, MI_BringForward); addMenuItem(editMenu, MI_SendBack); addMenuItem(editMenu, MI_SendBackward); + + editMenu->addSeparator(); + addMenuItem(editMenu, MI_TouchGestureControl); + // Menu' SCAN CLEANUP #ifdef LINETEST QMenu *scanCleanupMenu = addMenu(tr("Scan")); diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.h index 7e56d69..f2502ea 100644 --- a/toonz/sources/toonz/menubarcommandids.h +++ b/toonz/sources/toonz/menubarcommandids.h @@ -328,4 +328,6 @@ #define MI_AudioRecording "MI_AudioRecording" #define MI_LipSyncPopup "MI_LipSyncPopup" #define MI_AutoInputCellNumber "MI_AutoInputCellNumber" +#define MI_TouchGestureControl "MI_TouchGestureControl" + #endif diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 3920008..6c3314a 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -527,12 +527,6 @@ void PreferencesPopup::onDownArrowInLevelStripCreatesNewFrame(int index) { //----------------------------------------------------------------------------- -void PreferencesPopup::onTouchGestureControlChanged(int index) { - m_pref->setTouchGestureControl(index == Qt::Checked); -} - -//----------------------------------------------------------------------------- - void PreferencesPopup::onSubsceneFolderChanged(int index) { m_pref->enableSubsceneFolder(index == Qt::Checked); } @@ -1349,8 +1343,6 @@ PreferencesPopup::PreferencesPopup() tr("Use higher DPI for calculations - Slower but more accurate"), this); m_downArrowInLevelStripCreatesNewFrame = new CheckBox( tr("Down arrow at end of level strip creates a new frame"), this); - CheckBox *touchGestureControlCB = - new CheckBox(tr("Enable Touch Gesture Control on Viewer"), this); //--- Tools ------------------------------- categoryList->addItem(tr("Tools")); @@ -1655,7 +1647,6 @@ PreferencesPopup::PreferencesPopup() m_pref->getUseHigherDpiOnVectorSimplify()); m_downArrowInLevelStripCreatesNewFrame->setChecked( m_pref->getDownArrowLevelStripNewFrame()); - touchGestureControlCB->setChecked(m_pref->getTouchGestureControl()); m_newLevelToCameraSizeCB->setChecked( m_pref->isNewLevelSizeToCameraSizeEnabled()); QStringList scanLevelTypes; @@ -2190,8 +2181,6 @@ PreferencesPopup::PreferencesPopup() Qt::AlignLeft | Qt::AlignVCenter); drawingFrameLay->addWidget(m_downArrowInLevelStripCreatesNewFrame, 0, Qt::AlignLeft | Qt::AlignVCenter); - drawingFrameLay->addWidget(touchGestureControlCB, 0, - Qt::AlignLeft | Qt::AlignVCenter); QGroupBox *replaceVectorGroupBox = new QGroupBox( tr("Replace Vectors with Simplified Vectors Command"), this); QVBoxLayout *replaceVectorsLay = new QVBoxLayout(); @@ -2649,8 +2638,6 @@ PreferencesPopup::PreferencesPopup() ret = ret && connect(m_downArrowInLevelStripCreatesNewFrame, SIGNAL(stateChanged(int)), SLOT(onDownArrowInLevelStripCreatesNewFrame(int))); - ret = ret && connect(touchGestureControlCB, SIGNAL(stateChanged(int)), - SLOT(onTouchGestureControlChanged(int))); ret = ret && connect(m_newLevelToCameraSizeCB, SIGNAL(clicked(bool)), SLOT(onNewLevelToCameraSizeChanged(bool))); diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h index 58e308b..231b107 100644 --- a/toonz/sources/toonz/preferencespopup.h +++ b/toonz/sources/toonz/preferencespopup.h @@ -145,7 +145,6 @@ private slots: void onFitToFlipbook(int); void onDropdownShortcutsCycleOptionsChanged(int); void onDownArrowInLevelStripCreatesNewFrame(int); - void onTouchGestureControlChanged(int); void onAddLevelFormat(); void onRemoveLevelFormat(); void onEditLevelFormat(); diff --git a/toonz/sources/toonz/sceneviewerevents.cpp b/toonz/sources/toonz/sceneviewerevents.cpp index 5abee1c..0364666 100644 --- a/toonz/sources/toonz/sceneviewerevents.cpp +++ b/toonz/sources/toonz/sceneviewerevents.cpp @@ -927,7 +927,9 @@ void SceneViewer::touchEvent(QTouchEvent *e, int type) { //----------------------------------------------------------------------------- bool SceneViewer::event(QEvent *e) { - if (Preferences::instance()->getTouchGestureControl()) { + if (CommandManager::instance() + ->getAction(MI_TouchGestureControl) + ->isChecked()) { if (e->type() == QEvent::Gesture) { gestureEvent(static_cast(e)); return true; diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 6072e3d..34d6874 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -292,13 +292,6 @@ Preferences::Preferences() , m_keepFillOnVectorSimplify(true) , m_useHigherDpiOnVectorSimplify(false) , m_downArrowInLevelStripCreatesNewFrame(false) -// 11/30/2017 disable touch control by default in osx -// as there seems to be a malfunction with trackpad -#ifdef MACOSX - , m_touchGestureControlEnabled(false) -#else - , m_touchGestureControlEnabled(true) -#endif , m_viewerBGColor(128, 128, 128, 255) , m_previewBGColor(64, 64, 64, 255) , m_chessboardColor1(180, 180, 180) @@ -585,8 +578,6 @@ Preferences::Preferences() getValue(*m_settings, "keepFillOnVectorSimplify", m_keepFillOnVectorSimplify); getValue(*m_settings, "downArrowInLevelStripCreatesNewFrame", m_downArrowInLevelStripCreatesNewFrame); - getValue(*m_settings, "touchGestureControlEnabled", - m_touchGestureControlEnabled); getValue(*m_settings, "DragCellsBehaviour", m_dragCellsBehaviour); getValue(*m_settings, "LineTestFpsCapture", m_lineTestFpsCapture); @@ -1361,13 +1352,6 @@ void Preferences::setDownArrowLevelStripNewFrame(bool on) { //----------------------------------------------------------------- -void Preferences::setTouchGestureControl(bool on) { - m_touchGestureControlEnabled = on; - m_settings->setValue("touchGestureControlEnabled", on ? "1" : "0"); -} - -//----------------------------------------------------------------- - void Preferences::enableLevelsBackup(bool enabled) { m_levelsBackupEnabled = enabled; m_settings->setValue("levelsBackupEnabled", enabled ? "1" : "0");