Skip to content

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

C

touch control optional

shun_iwasawa72bd2b11c8aa
diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h
index 801ca0006..f93750a4d 100644
--- a/toonz/sources/include/toonz/preferences.h
+++ b/toonz/sources/include/toonz/preferences.h
@@ -361,6 +361,9 @@ public:
return m_downArrowInLevelStripCreatesNewFrame;
}
+ void setTouchGestureControl(bool on);
+ bool getTouchGestureControl() { return m_touchGestureControlEnabled; }
+
// Tools Tab
void setDropdownShortcutsCycleOptions(bool on);
bool getDropdownShortcutsCycleOptions() {
@@ -652,6 +655,8 @@ private:
bool m_currentTimelineEnabled;
+ bool m_touchGestureControlEnabled;
+
private:
Preferences();
~Preferences();
diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp
index 6c3314a52..39200081f 100644
--- a/toonz/sources/toonz/preferencespopup.cpp
+++ b/toonz/sources/toonz/preferencespopup.cpp
@@ -527,6 +527,12 @@ 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);
}
@@ -1343,6 +1349,8 @@ 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"));
@@ -1647,6 +1655,7 @@ PreferencesPopup::PreferencesPopup()
m_pref->getUseHigherDpiOnVectorSimplify());
m_downArrowInLevelStripCreatesNewFrame->setChecked(
m_pref->getDownArrowLevelStripNewFrame());
+ touchGestureControlCB->setChecked(m_pref->getTouchGestureControl());
m_newLevelToCameraSizeCB->setChecked(
m_pref->isNewLevelSizeToCameraSizeEnabled());
QStringList scanLevelTypes;
@@ -2181,6 +2190,8 @@ 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();
@@ -2638,6 +2649,8 @@ 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 231b1077e..58e308bd7 100644
--- a/toonz/sources/toonz/preferencespopup.h
+++ b/toonz/sources/toonz/preferencespopup.h
@@ -145,6 +145,7 @@ 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 b53947db4..5abee1c29 100644
--- a/toonz/sources/toonz/sceneviewerevents.cpp
+++ b/toonz/sources/toonz/sceneviewerevents.cpp
@@ -927,15 +927,17 @@ void SceneViewer::touchEvent(QTouchEvent *e, int type) {
//-----------------------------------------------------------------------------
bool SceneViewer::event(QEvent *e) {
- if (e->type() == QEvent::Gesture) {
- gestureEvent(static_cast<QGestureEvent *>(e));
- return true;
- }
- if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchEnd ||
- e->type() == QEvent::TouchCancel || e->type() == QEvent::TouchUpdate) {
- touchEvent(static_cast<QTouchEvent *>(e), e->type());
- m_gestureActive = true;
- return true;
+ if (Preferences::instance()->getTouchGestureControl()) {
+ if (e->type() == QEvent::Gesture) {
+ gestureEvent(static_cast<QGestureEvent *>(e));
+ return true;
+ }
+ if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchEnd ||
+ e->type() == QEvent::TouchCancel || e->type() == QEvent::TouchUpdate) {
+ touchEvent(static_cast<QTouchEvent *>(e), e->type());
+ m_gestureActive = true;
+ return true;
+ }
}
if (e->type() == QEvent::ShortcutOverride || e->type() == QEvent::KeyPress) {
if (!((QKeyEvent *)e)->isAutoRepeat()) {
diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp
index 34d68741d..6072e3def 100644
--- a/toonz/sources/toonzlib/preferences.cpp
+++ b/toonz/sources/toonzlib/preferences.cpp
@@ -292,6 +292,13 @@ 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)
@@ -578,6 +585,8 @@ 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);
@@ -1352,6 +1361,13 @@ 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");