Skip to content

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

C

Schematic navigation enhancement

manongjohna99cb64467b6
diff --git a/toonz/sources/include/toonzqt/schematicviewer.h b/toonz/sources/include/toonzqt/schematicviewer.h
index 5a221f57e..4d0d47e89 100644
--- a/toonz/sources/include/toonzqt/schematicviewer.h
+++ b/toonz/sources/include/toonzqt/schematicviewer.h
@@ -12,6 +12,7 @@
// Qt includes
#include <QGraphicsScene>
#include <QGraphicsView>
+#include <QTouchDevice>
// STD includes
#include <set>
@@ -49,8 +50,13 @@ class TApplication;
class QToolBar;
class QToolButton;
class QAction;
+class QTouchEvent;
+class QGestureEvent;
//====================================================
+namespace {
+enum CursorMode { Select, Zoom, Hand };
+}
//==================================================================
//
@@ -100,14 +106,37 @@ protected slots:
class DVAPI SchematicSceneViewer final : public QGraphicsView {
Q_OBJECT
+ bool m_tabletEvent, m_tabletMove;
+ enum TabletState {
+ None = 0,
+ Touched,
+ StartStroke, // this state is to detect the first call
+ // of TabletMove just after TabletPress
+ OnStroke,
+ Released
+ } m_tabletState = None;
+
+ bool m_touchActive = false;
+
+ bool m_gestureActive = false;
+ QTouchDevice::DeviceType m_touchDevice = QTouchDevice::TouchScreen;
+ bool m_zooming = false;
+ bool m_panning = false;
+ double m_scaleFactor; // used for zoom gesture
+
+ CursorMode m_cursorMode;
+
public:
SchematicSceneViewer(QWidget *parent);
~SchematicSceneViewer();
void zoomQt(bool zoomin, bool resetZoom);
+ void panQt(QPoint currWinPos);
QPointF getOldScenePos() { return m_oldScenePos; }
+ void setCursorMode(CursorMode mode);
+
protected:
void mousePressEvent(QMouseEvent *me) override;
void mouseMoveEvent(QMouseEvent *me) override;
@@ -115,6 +144,12 @@ protected:
void keyPressEvent(QKeyEvent *ke) override;
void wheelEvent(QWheelEvent *me) override;
void showEvent(QShowEvent *se) override;
+ void mouseDoubleClickEvent(QMouseEvent *event);
+
+ void touchEvent(QTouchEvent *e, int type);
+ void gestureEvent(QGestureEvent *e);
+
+ bool event(QEvent *event) override;
protected slots:
@@ -127,6 +162,7 @@ private:
Qt::MouseButton m_buttonState;
QPoint m_oldWinPos;
QPointF m_oldScenePos;
+ QPoint m_prevWinPos;
bool m_firstShowing;
private:
@@ -151,6 +187,8 @@ public:
bool isStageSchematicViewed();
void setStageSchematicViewed(bool isStageSchematic);
+ void setCursorMode(CursorMode mode);
+
public slots:
void updateSchematic();
@@ -171,6 +209,10 @@ protected slots:
void updateScenes();
void changeNodeSize();
+ void selectModeEnabled();
+ void zoomModeEnabled();
+ void handModeEnabled();
+
private:
SchematicSceneViewer *m_viewer;
StageSchematicScene *m_stageScene;
@@ -181,10 +223,12 @@ private:
QToolBar *m_stageToolbar, *m_commonToolbar, *m_fxToolbar, *m_swapToolbar;
QAction *m_fitSchematic, *m_centerOn, *m_reorder, *m_normalize, *m_nodeSize,
- *m_changeScene;
+ *m_changeScene, *m_selectMode, *m_zoomMode, *m_handMode;
bool m_fullSchematic, m_maximizedNode;
+ SchematicViewer::CursorMode m_cursorMode;
+
private:
void createToolbars();
void createActions();
diff --git a/toonz/sources/toonzqt/Resources/schematic_hand_mode_off.svg b/toonz/sources/toonzqt/Resources/schematic_hand_mode_off.svg
new file mode 100644
index 000000000..b4a7ce16d
--- /dev/null
+++ b/toonz/sources/toonzqt/Resources/schematic_hand_mode_off.svg
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG Version: 3.0.0 Build 76) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+ <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+ <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+ <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+ <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+ <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+ <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+ <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+ <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg
+ xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="387 313" i:rulerOrigin="0 0" i:pageBounds="0 600 800 0"
+ xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="26" height="26"
+ viewBox="0 0 26 26" overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+ <metadata>
+ <variableSets xmlns="&ns_vars;">
+ <variableSet varSetName="binding1" locked="none">
+ <variables></variables>
+ <v:sampleDataSets xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+ </variableSet>
+ </variableSets>
+ <sfw xmlns="&ns_sfw;">
+ <slices></slices>
+ <sliceSourceBounds y="287" x="387" width="26" height="26" bottomLeftOrigin="true"></sliceSourceBounds>
+ </sfw>
+ </metadata>
+ <g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+ <path i:knockout="Off" fill="none" d="M26,26H0V0h26V26z"/>
+ <linearGradient id="XMLID_1_" gradientUnits="userSpaceOnUse" x1="12.8428" y1="21.0635" x2="16.2913" y2="23.4143">
+ <stop offset="0" style="stop-color:#FCFCFC"/>
+ <stop offset="0.2637" style="stop-color:#F7F7F7"/>
+ <stop offset="0.5769" style="stop-color:#E9E9E9"/>
+ <stop offset="0.9139" style="stop-color:#D1D1D1"/>
+ <stop offset="1" style="stop-color:#CACACA"/>
+ <a:midPointStop offset="0" style="stop-color:#FCFCFC"/>
+ <a:midPointStop offset="0.6712" style="stop-color:#FCFCFC"/>
+ <a:midPointStop offset="1" style="stop-color:#CACACA"/>
+ </linearGradient>
+ <path i:knockout="Off" fill="url(#XMLID_1_)" d="M10.118,20.936c-0.096,0.617-0.169,1.898,0.105,2.48
+ c0.223,0.471,2.073,0.998,3.019,1.077c1.376,0.112,5.112,0.206,5.507-1.298c0.228-0.867,0.229-2.189-0.178-2.364"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" stroke-width="0.9755" d="M10.118,20.936
+ c-0.096,0.617-0.169,1.898,0.105,2.48c0.223,0.471,2.073,0.998,3.019,1.077c1.376,0.112,5.112,0.206,5.507-1.298
+ c0.228-0.867,0.229-2.189-0.178-2.364"/>
+ <radialGradient id="XMLID_2_" cx="15.5244" cy="16.2549" r="7.4315" fx="15.5244" fy="16.2549" gradientUnits="userSpaceOnUse">
+ <stop offset="0" style="stop-color:#FCFCFC"/>
+ <stop offset="0.2637" style="stop-color:#F7F7F7"/>
+ <stop offset="0.5769" style="stop-color:#E9E9E9"/>
+ <stop offset="0.9139" style="stop-color:#D1D1D1"/>
+ <stop offset="1" style="stop-color:#CACACA"/>
+ <a:midPointStop offset="0" style="stop-color:#FCFCFC"/>
+ <a:midPointStop offset="0.6712" style="stop-color:#FCFCFC"/>
+ <a:midPointStop offset="1" style="stop-color:#CACACA"/>
+ </radialGradient>
+ <path i:knockout="Off" fill="url(#XMLID_2_)" d="M7.36,18.402c-1.337-1.748-3.572-2.541-4.136-3.955
+ c-0.475-1.197,0.11-2.612,1.667-2c0.969,0.381,2.746,1.333,3.611,1.929c1.283-0.501,0.741-1.74,0.261-3.076
+ C8.14,9.561,7.567,8.166,7.302,5.533C7.176,4.299,7.238,3.153,8.795,3.27c0.755,0.057,1.147,0.578,1.582,1.736
+ c0.424,1.131,0.727,2.736,0.861,3.292c0.165,0.691,0.681,2.84,1.199,2.965c0.517,0.124,0.233-3.929,0.043-5.833
+ c-0.087-0.85-0.398-3.376,1.514-3.323c1.5,0.042,1.871,3.635,1.953,4.78c0.095,1.293,0.025,4.015,0.627,4.297
+ c0.603,0.283,1.215-2.621,1.488-3.761c0.258-1.066,0.179-1.989,1.09-2.773c0.628-0.539,1.718,0.235,1.914,1.815
+ c0.272,2.19-0.992,5.749-1.024,6.585c-0.042,1.018,0.217,2.363,0.184,3.274c-0.072,1.785-0.719,3.124-1.175,3.73
+ c-0.452,0.609-2.667,1.33-3.99,1.369c-1.477,0.044-2.904-0.258-3.743-0.399C9.355,20.693,8.105,19.372,7.36,18.402z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" stroke-width="0.9755" d="M7.36,18.402c-1.337-1.748-3.572-2.541-4.136-3.955
+ c-0.475-1.197,0.11-2.612,1.667-2c0.969,0.381,2.746,1.333,3.611,1.929c1.283-0.501,0.741-1.74,0.261-3.076
+ C8.14,9.561,7.567,8.166,7.302,5.533C7.176,4.299,7.238,3.153,8.795,3.27c0.755,0.057,1.147,0.578,1.582,1.736
+ c0.424,1.131,0.727,2.736,0.861,3.292c0.165,0.691,0.681,2.84,1.199,2.965c0.517,0.124,0.233-3.929,0.043-5.833
+ c-0.087-0.85-0.398-3.376,1.514-3.323c1.5,0.042,1.871,3.635,1.953,4.78c0.095,1.293,0.025,4.015,0.627,4.297
+ c0.603,0.283,1.215-2.621,1.488-3.761c0.258-1.066,0.179-1.989,1.09-2.773c0.628-0.539,1.718,0.235,1.914,1.815
+ c0.272,2.19-0.992,5.749-1.024,6.585c-0.042,1.018,0.217,2.363,0.184,3.274c-0.072,1.785-0.719,3.124-1.175,3.73
+ c-0.452,0.609-2.667,1.33-3.99,1.369c-1.477,0.044-2.904-0.258-3.743-0.399C9.355,20.693,8.105,19.372,7.36,18.402z"/>
+ </g>
+</svg>
diff --git a/toonz/sources/toonzqt/Resources/schematic_hand_mode_on.svg b/toonz/sources/toonzqt/Resources/schematic_hand_mode_on.svg
new file mode 100644
index 000000000..286ecfb44
--- /dev/null
+++ b/toonz/sources/toonzqt/Resources/schematic_hand_mode_on.svg
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG Version: 3.0.0 Build 76) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+ <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+ <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+ <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+ <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+ <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+ <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+ <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+ <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg
+ xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="387 313" i:rulerOrigin="0 0" i:pageBounds="0 600 800 0"
+ xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="26" height="26"
+ viewBox="0 0 26 26" overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+ <metadata>
+ <variableSets xmlns="&ns_vars;">
+ <variableSet varSetName="binding1" locked="none">
+ <variables></variables>
+ <v:sampleDataSets xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+ </variableSet>
+ </variableSets>
+ <sfw xmlns="&ns_sfw;">
+ <slices></slices>
+ <sliceSourceBounds y="287" x="387" width="26" height="26" bottomLeftOrigin="true"></sliceSourceBounds>
+ </sfw>
+ </metadata>
+ <g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+ <path i:knockout="Off" fill="none" d="M26,26H0V0h26V26z"/>
+ <linearGradient id="XMLID_1_" gradientUnits="userSpaceOnUse" x1="12.8428" y1="21.0635" x2="16.2913" y2="23.4143">
+ <stop offset="0" style="stop-color:#FFFFE8"/>
+ <stop offset="0.156" style="stop-color:#FEFDE3"/>
+ <stop offset="0.3413" style="stop-color:#FCF7D5"/>
+ <stop offset="0.5415" style="stop-color:#F9EDBD"/>
+ <stop offset="0.7523" style="stop-color:#F4DF9B"/>
+ <stop offset="0.9692" style="stop-color:#EECD71"/>
+ <stop offset="1" style="stop-color:#EDCA6A"/>
+ <a:midPointStop offset="0" style="stop-color:#FFFFE8"/>
+ <a:midPointStop offset="0.6712" style="stop-color:#FFFFE8"/>
+ <a:midPointStop offset="1" style="stop-color:#EDCA6A"/>
+ </linearGradient>
+ <path i:knockout="Off" fill="url(#XMLID_1_)" d="M10.118,20.936c-0.096,0.617-0.169,1.898,0.105,2.48
+ c0.223,0.471,2.073,0.998,3.019,1.077c1.376,0.112,5.112,0.206,5.507-1.298c0.228-0.867,0.229-2.189-0.178-2.364"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" stroke-width="0.9755" d="M10.118,20.936
+ c-0.096,0.617-0.169,1.898,0.105,2.48c0.223,0.471,2.073,0.998,3.019,1.077c1.376,0.112,5.112,0.206,5.507-1.298
+ c0.228-0.867,0.229-2.189-0.178-2.364"/>
+ <radialGradient id="XMLID_2_" cx="15.5244" cy="16.2549" r="7.4315" fx="15.5244" fy="16.2549" gradientUnits="userSpaceOnUse">
+ <stop offset="0" style="stop-color:#FFFFE8"/>
+ <stop offset="0.156" style="stop-color:#FEFDE3"/>
+ <stop offset="0.3413" style="stop-color:#FCF7D5"/>
+ <stop offset="0.5415" style="stop-color:#F9EDBD"/>
+ <stop offset="0.7523" style="stop-color:#F4DF9B"/>
+ <stop offset="0.9692" style="stop-color:#EECD71"/>
+ <stop offset="1" style="stop-color:#EDCA6A"/>
+ <a:midPointStop offset="0" style="stop-color:#FFFFE8"/>
+ <a:midPointStop offset="0.6712" style="stop-color:#FFFFE8"/>
+ <a:midPointStop offset="1" style="stop-color:#EDCA6A"/>
+ </radialGradient>
+ <path i:knockout="Off" fill="url(#XMLID_2_)" d="M7.36,18.402c-1.337-1.748-3.572-2.541-4.136-3.955
+ c-0.475-1.197,0.11-2.612,1.667-2c0.969,0.381,2.746,1.333,3.611,1.929c1.283-0.501,0.741-1.74,0.261-3.076
+ C8.14,9.561,7.567,8.166,7.302,5.533C7.176,4.299,7.238,3.153,8.795,3.27c0.755,0.057,1.147,0.578,1.582,1.736
+ c0.424,1.131,0.727,2.736,0.861,3.292c0.165,0.691,0.681,2.84,1.199,2.965c0.517,0.124,0.233-3.929,0.043-5.833
+ c-0.087-0.85-0.398-3.376,1.514-3.323c1.5,0.042,1.871,3.635,1.953,4.78c0.095,1.293,0.025,4.015,0.627,4.297
+ c0.603,0.283,1.215-2.621,1.488-3.761c0.258-1.066,0.179-1.989,1.09-2.773c0.628-0.539,1.718,0.235,1.914,1.815
+ c0.272,2.19-0.992,5.749-1.024,6.585c-0.042,1.018,0.217,2.363,0.184,3.274c-0.072,1.785-0.719,3.124-1.175,3.73
+ c-0.452,0.609-2.667,1.33-3.99,1.369c-1.477,0.044-2.904-0.258-3.743-0.399C9.355,20.693,8.105,19.372,7.36,18.402z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" stroke-width="0.9755" d="M7.36,18.402c-1.337-1.748-3.572-2.541-4.136-3.955
+ c-0.475-1.197,0.11-2.612,1.667-2c0.969,0.381,2.746,1.333,3.611,1.929c1.283-0.501,0.741-1.74,0.261-3.076
+ C8.14,9.561,7.567,8.166,7.302,5.533C7.176,4.299,7.238,3.153,8.795,3.27c0.755,0.057,1.147,0.578,1.582,1.736
+ c0.424,1.131,0.727,2.736,0.861,3.292c0.165,0.691,0.681,2.84,1.199,2.965c0.517,0.124,0.233-3.929,0.043-5.833
+ c-0.087-0.85-0.398-3.376,1.514-3.323c1.5,0.042,1.871,3.635,1.953,4.78c0.095,1.293,0.025,4.015,0.627,4.297
+ c0.603,0.283,1.215-2.621,1.488-3.761c0.258-1.066,0.179-1.989,1.09-2.773c0.628-0.539,1.718,0.235,1.914,1.815
+ c0.272,2.19-0.992,5.749-1.024,6.585c-0.042,1.018,0.217,2.363,0.184,3.274c-0.072,1.785-0.719,3.124-1.175,3.73
+ c-0.452,0.609-2.667,1.33-3.99,1.369c-1.477,0.044-2.904-0.258-3.743-0.399C9.355,20.693,8.105,19.372,7.36,18.402z"/>
+ </g>
+</svg>
diff --git a/toonz/sources/toonzqt/Resources/schematic_selection_mode_off.svg b/toonz/sources/toonzqt/Resources/schematic_selection_mode_off.svg
new file mode 100644
index 000000000..d4ef8187a
--- /dev/null
+++ b/toonz/sources/toonzqt/Resources/schematic_selection_mode_off.svg
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG Version: 3.0.0 Build 76) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+ <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+ <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+ <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+ <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+ <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+ <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+ <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+ <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg
+ xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="387 312" i:rulerOrigin="0 0" i:pageBounds="0 600 800 0"
+ xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="26" height="26"
+ viewBox="0 0 26 26" overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+ <metadata>
+ <variableSets xmlns="&ns_vars;">
+ <variableSet varSetName="binding1" locked="none">
+ <variables></variables>
+ <v:sampleDataSets xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+ </variableSet>
+ </variableSets>
+ <sfw xmlns="&ns_sfw;">
+ <slices></slices>
+ <sliceSourceBounds y="286" x="387" width="26" height="26" bottomLeftOrigin="true"></sliceSourceBounds>
+ </sfw>
+ </metadata>
+ <g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+ <path i:knockout="Off" fill="none" d="M26,26H0V0h26V26z"/>
+ <path i:knockout="Off" fill="#E6E6E6" stroke="#000000" stroke-linejoin="round" d="M20.349,13.496L7.404,3.219l2.43,16.347
+ l3.018-3.66l3.521,6.098l2.818-1.627l-3.521-6.098L20.349,13.496z"/>
+ </g>
+</svg>
diff --git a/toonz/sources/toonzqt/Resources/schematic_selection_mode_on.svg b/toonz/sources/toonzqt/Resources/schematic_selection_mode_on.svg
new file mode 100644
index 000000000..aa441b289
--- /dev/null
+++ b/toonz/sources/toonzqt/Resources/schematic_selection_mode_on.svg
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG Version: 3.0.0 Build 76) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+ <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+ <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+ <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+ <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+ <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+ <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+ <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+ <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg
+ xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="387 312" i:rulerOrigin="0 0" i:pageBounds="0 600 800 0"
+ xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="26" height="26"
+ viewBox="0 0 26 26" overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+ <metadata>
+ <variableSets xmlns="&ns_vars;">
+ <variableSet varSetName="binding1" locked="none">
+ <variables></variables>
+ <v:sampleDataSets xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+ </variableSet>
+ </variableSets>
+ <sfw xmlns="&ns_sfw;">
+ <slices></slices>
+ <sliceSourceBounds y="286" x="387" width="26" height="26" bottomLeftOrigin="true"></sliceSourceBounds>
+ </sfw>
+ </metadata>
+ <g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+ <path i:knockout="Off" fill="none" d="M26,26H0V0h26V26z"/>
+ <path i:knockout="Off" fill="#AED400" stroke="#000000" stroke-linejoin="round" d="M20.349,13.496L7.404,3.219l2.43,16.347
+ l3.018-3.66l3.521,6.098l2.818-1.627l-3.521-6.098L20.349,13.496z"/>
+ </g>
+</svg>
diff --git a/toonz/sources/toonzqt/Resources/schematic_zoom_mode_off.svg b/toonz/sources/toonzqt/Resources/schematic_zoom_mode_off.svg
new file mode 100644
index 000000000..3b640966d
--- /dev/null
+++ b/toonz/sources/toonzqt/Resources/schematic_zoom_mode_off.svg
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG Version: 3.0.0 Build 76) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+ <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+ <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+ <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+ <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+ <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+ <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+ <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+ <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg
+ xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="387 312" i:rulerOrigin="0 0" i:pageBounds="0 600 800 0"
+ xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="26" height="26"
+ viewBox="0 0 26 26" overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+ <metadata>
+ <variableSets xmlns="&ns_vars;">
+ <variableSet varSetName="binding1" locked="none">
+ <variables></variables>
+ <v:sampleDataSets xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+ </variableSet>
+ </variableSets>
+ <sfw xmlns="&ns_sfw;">
+ <slices></slices>
+ <sliceSourceBounds y="286" x="387" width="26" height="26" bottomLeftOrigin="true"></sliceSourceBounds>
+ </sfw>
+ </metadata>
+ <g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+ <path i:knockout="Off" fill="none" d="M26,26H0V0h26V26z"/>
+ <path i:knockout="Off" fill="#E6E6E6" d="M14.832,4.173c2.163,2.884,1.581,6.976-1.305,9.14c-2.883,2.166-6.975,1.582-9.14-1.302
+ C2.224,9.127,2.806,5.035,5.69,2.871C8.574,0.705,12.666,1.289,14.832,4.173z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M14.832,4.173c2.163,2.884,1.581,6.976-1.305,9.14
+ c-2.883,2.166-6.975,1.582-9.14-1.302C2.224,9.127,2.806,5.035,5.69,2.871C8.574,0.705,12.666,1.289,14.832,4.173z"/>
+ <path i:knockout="Off" d="M16.719,15.497l-1.985,1.489l-2.039-2.717l1.985-1.489L16.719,15.497z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M16.719,15.497l-1.985,1.489l-2.039-2.717l1.985-1.489L16.719,15.497z"/>
+ <path i:knockout="Off" fill="#9E9E9E" d="M21.787,21.475l-2.73,2.045l-5.195-6.916l2.73-2.045L21.787,21.475z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M21.787,21.475l-2.73,2.045l-5.195-6.916l2.73-2.045L21.787,21.475z"/>
+ <path i:knockout="Off" fill="#FFFFFF" d="M5.902,5.655c-1.224,1.704-0.508,5.593,1.971,6.871C7.591,10.57,7.942,9.232,8.521,7.481
+ c0.523-1.587,1.87-4.076,1.87-4.076S7.755,3.075,5.902,5.655z"/>
+ <path i:knockout="Off" fill="#FFFFFF" d="M13.743,9.626c-0.505,1.517-1.546,2.539-2.325,2.285
+ c-0.78-0.256-1.003-1.691-0.499-3.209c0.503-1.517,1.545-2.538,2.322-2.284C14.024,6.673,14.246,8.108,13.743,9.626z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M13.897,13.827c-2.883,2.164-7.345,1.067-9.51-1.816"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M14.832,4.173c2.163,2.884,1.951,7.489-0.935,9.654"/>
+ </g>
+</svg>
diff --git a/toonz/sources/toonzqt/Resources/schematic_zoom_mode_on.svg b/toonz/sources/toonzqt/Resources/schematic_zoom_mode_on.svg
new file mode 100644
index 000000000..2b98d536f
--- /dev/null
+++ b/toonz/sources/toonzqt/Resources/schematic_zoom_mode_on.svg
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG Version: 3.0.0 Build 76) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+ <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+ <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+ <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+ <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+ <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+ <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+ <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+ <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg
+ xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="387 312" i:rulerOrigin="0 0" i:pageBounds="0 600 800 0"
+ xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="26" height="26"
+ viewBox="0 0 26 26" overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+ <metadata>
+ <variableSets xmlns="&ns_vars;">
+ <variableSet varSetName="binding1" locked="none">
+ <variables></variables>
+ <v:sampleDataSets xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+ </variableSet>
+ </variableSets>
+ <sfw xmlns="&ns_sfw;">
+ <slices></slices>
+ <sliceSourceBounds y="286" x="387" width="26" height="26" bottomLeftOrigin="true"></sliceSourceBounds>
+ </sfw>
+ </metadata>
+ <g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+ <path i:knockout="Off" fill="none" d="M26,26H0V0h26V26z"/>
+ <path i:knockout="Off" fill="#C2E6FF" d="M14.832,4.173c2.163,2.884,1.581,6.976-1.305,9.14c-2.883,2.166-6.975,1.582-9.14-1.302
+ C2.224,9.127,2.806,5.035,5.69,2.871C8.574,0.705,12.666,1.289,14.832,4.173z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M14.832,4.173c2.163,2.884,1.581,6.976-1.305,9.14
+ c-2.883,2.166-6.975,1.582-9.14-1.302C2.224,9.127,2.806,5.035,5.69,2.871C8.574,0.705,12.666,1.289,14.832,4.173z"/>
+ <path i:knockout="Off" d="M16.719,15.497l-1.985,1.489l-2.039-2.717l1.985-1.489L16.719,15.497z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M16.719,15.497l-1.985,1.489l-2.039-2.717l1.985-1.489L16.719,15.497z"/>
+ <path i:knockout="Off" fill="#3F81E1" d="M21.787,21.475l-2.73,2.045l-5.195-6.916l2.73-2.045L21.787,21.475z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M21.787,21.475l-2.73,2.045l-5.195-6.916l2.73-2.045L21.787,21.475z"/>
+ <path i:knockout="Off" fill="#FFFFFF" d="M5.902,5.655c-1.224,1.704-0.508,5.593,1.971,6.871C7.591,10.57,7.942,9.232,8.521,7.481
+ c0.523-1.587,1.87-4.076,1.87-4.076S7.755,3.075,5.902,5.655z"/>
+ <path i:knockout="Off" fill="#FFFFFF" d="M13.743,9.626c-0.505,1.517-1.546,2.539-2.325,2.285
+ c-0.78-0.256-1.003-1.691-0.499-3.209c0.503-1.517,1.545-2.538,2.322-2.284C14.024,6.673,14.246,8.108,13.743,9.626z"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M13.897,13.827c-2.883,2.164-7.345,1.067-9.51-1.816"/>
+ <path i:knockout="Off" fill="none" stroke="#000000" d="M14.832,4.173c2.163,2.884,1.951,7.489-0.935,9.654"/>
+ </g>
+</svg>
diff --git a/toonz/sources/toonzqt/schematicviewer.cpp b/toonz/sources/toonzqt/schematicviewer.cpp
index 36c030b32..a9077c39f 100644
--- a/toonz/sources/toonzqt/schematicviewer.cpp
+++ b/toonz/sources/toonzqt/schematicviewer.cpp
@@ -28,6 +28,8 @@
#include "toonz/tapplication.h"
#include "toonz/tscenehandle.h"
+#include "../toonz/menubarcommandids.h"
+
// Qt includes
#include <QGraphicsSceneMouseEvent>
#include <QMouseEvent>
@@ -39,6 +41,7 @@
#include <QAction>
#include <QMainWindow>
#include <QVBoxLayout>
+#include <QGestureEvent>
// STD includes
#include "assert.h"
@@ -196,6 +199,11 @@ SchematicSceneViewer::SchematicSceneViewer(QWidget *parent)
setInteractive(true);
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
show();
+
+ setAttribute(Qt::WA_AcceptTouchEvents);
+ grabGesture(Qt::SwipeGesture);
+ grabGesture(Qt::PanGesture);
+ grabGesture(Qt::PinchGesture);
}
//------------------------------------------------------------------
@@ -207,9 +215,23 @@ SchematicSceneViewer::~SchematicSceneViewer() {}
/*! Reimplemets the QGraphicsView::mousePressEvent()
*/
void SchematicSceneViewer::mousePressEvent(QMouseEvent *me) {
+ if (m_gestureActive && m_touchDevice == QTouchDevice::TouchScreen) {
+ return;
+ }
+
m_buttonState = me->button();
- m_oldWinPos = me->pos();
- m_oldScenePos = mapToScene(m_oldWinPos);
+ m_oldWinPos = m_prevWinPos = me->pos();
+ m_oldScenePos = mapToScene(m_oldWinPos);
+
+ if (m_buttonState == Qt::LeftButton) {
+ if (m_cursorMode == CursorMode::Zoom) {
+ m_zooming = true;
+ return;
+ } else if (m_cursorMode == CursorMode::Hand) {
+ m_panning = true;
+ return;
+ }
+ }
bool drawRect = true;
QList<QGraphicsItem *> pointedItems = items(me->pos());
@@ -233,22 +255,24 @@ void SchematicSceneViewer::mousePressEvent(QMouseEvent *me) {
/*! Reimplemets the QGraphicsView::mouseMoveEvent()
*/
void SchematicSceneViewer::mouseMoveEvent(QMouseEvent *me) {
+ if (m_gestureActive && m_touchDevice == QTouchDevice::TouchScreen) {
+ return;
+ }
+
QPoint currWinPos = me->pos();
QPointF currScenePos = mapToScene(currWinPos);
- if (m_buttonState == Qt::MidButton) {
- // Panning
- setInteractive(false);
- // I need to disable QGraphicsView event handling to avoid the generation of
- // 'virtual' mouseMoveEvent
- QPointF delta = currScenePos - m_oldScenePos;
- translate(delta.x(), delta.y());
- currScenePos = mapToScene(currWinPos);
- // translate has changed the matrix affecting the mapToScene() method. I
- // have to recompute currScenePos
- setInteractive(true);
+ if ((m_cursorMode == CursorMode::Hand && m_panning) ||
+ m_buttonState == Qt::MidButton) {
+ panQt(currWinPos);
+ } else if (m_cursorMode == CursorMode::Zoom && m_zooming) {
+ int deltaY = (m_prevWinPos.y() - me->pos().y()) * 10;
+ double factorY = exp(deltaY * 0.001);
+ changeScale(m_oldWinPos, factorY);
+ m_prevWinPos = me->pos();
+ } else {
+ m_oldWinPos = currWinPos;
+ m_oldScenePos = currScenePos;
}
- m_oldWinPos = currWinPos;
- m_oldScenePos = currScenePos;
QGraphicsView::mouseMoveEvent(me);
}
@@ -257,6 +281,18 @@ void SchematicSceneViewer::mouseMoveEvent(QMouseEvent *me) {
/*! Reimplemets the QGraphicsView::mouseReleaseEvent()
*/
void SchematicSceneViewer::mouseReleaseEvent(QMouseEvent *me) {
+ // for touchscreens but not touchpads...
+ if (m_gestureActive && m_touchDevice == QTouchDevice::TouchScreen) {
+ m_gestureActive = false;
+ m_zooming = false;
+ m_panning = false;
+ m_scaleFactor = 0.0;
+ return;
+ }
+
+ m_zooming = false;
+ m_panning = false;
+
m_buttonState = Qt::NoButton;
QGraphicsView::mouseReleaseEvent(me);
setDragMode(QGraphicsView::NoDrag);
@@ -265,6 +301,16 @@ void SchematicSceneViewer::mouseReleaseEvent(QMouseEvent *me) {
//------------------------------------------------------------------
+void SchematicSceneViewer::mouseDoubleClickEvent(QMouseEvent *event) {
+ if (m_gestureActive && m_touchDevice == QTouchDevice::TouchScreen) {
+ fitScene();
+ m_gestureActive = false;
+ return;
+ }
+ QGraphicsView::mouseDoubleClickEvent(event);
+}
+//------------------------------------------------------------------
+
void SchematicSceneViewer::keyPressEvent(QKeyEvent *ke) {
ke->ignore();
QGraphicsView::keyPressEvent(ke);
@@ -419,6 +465,22 @@ void SchematicSceneViewer::normalizeScene() {
}
//------------------------------------------------------------------
+void SchematicSceneViewer::panQt(QPoint currWinPos) {
+ QPointF currScenePos = mapToScene(currWinPos);
+
+ setInteractive(false);
+ // I need to disable QGraphicsView event handling to avoid the generation of
+ // 'virtual' mouseMoveEvent
+ QPointF deltaPoint = currScenePos - m_oldScenePos;
+ translate(deltaPoint.x(), deltaPoint.y());
+ currScenePos = mapToScene(currWinPos);
+ // translate has changed the matrix affecting the mapToScene() method. I
+ // have to recompute currScenePos
+ setInteractive(true);
+
+ m_oldWinPos = currWinPos;
+ m_oldScenePos = currScenePos;
+}
void SchematicSceneViewer::showEvent(QShowEvent *se) {
QGraphicsView::showEvent(se);
@@ -430,6 +492,139 @@ void SchematicSceneViewer::showEvent(QShowEvent *se) {
}
}
+//------------------------------------------------------------------
+void SchematicSceneViewer::touchEvent(QTouchEvent *e, int type) {
+ if (type == QEvent::TouchBegin) {
+ m_touchActive = true;
+ m_oldWinPos = e->touchPoints().at(0).pos().toPoint();
+ m_oldScenePos = mapToScene(m_oldWinPos);
+ // obtain device type
+ m_touchDevice = e->device()->type();
+ } else if (m_touchActive) {
+ // touchpads must have 2 finger panning for tools and navigation to be
+ // functional
+ // on other devices, 1 finger panning is preferred
+ if ((e->touchPoints().count() == 2 &&
+ m_touchDevice == QTouchDevice::TouchPad) ||
+ (e->touchPoints().count() == 1 &&
+ m_touchDevice == QTouchDevice::TouchScreen)) {
+ QTouchEvent::TouchPoint currPos = e->touchPoints().at(0);
+ QPoint currWinPos = currPos.pos().toPoint();
+ if (!m_panning) {
+ QPointF deltaPoint = currWinPos - m_oldWinPos;
+ // minimize accidental and jerky zooming/rotating during 2 finger
+ // panning
+ if ((deltaPoint.manhattanLength() > 100) && !m_zooming) {
+ m_panning = true;
+ }
+ }
+ if (m_panning) {
+ m_oldWinPos = currPos.lastPos().toPoint();
+ m_oldScenePos = mapToScene(m_oldWinPos);
+ panQt(currWinPos);
+ }
+ }
+ }
+ if (type == QEvent::TouchEnd || type == QEvent::TouchCancel) {
+ m_touchActive = false;
+ m_panning = false;
+ }
+ e->accept();
+}
+
+//------------------------------------------------------------------
+
+void SchematicSceneViewer::gestureEvent(QGestureEvent *e) {
+ m_gestureActive = false;
+ if (QGesture *swipe = e->gesture(Qt::SwipeGesture)) {
+ m_gestureActive = true;
+ } else if (QGesture *pan = e->gesture(Qt::PanGesture)) {
+ m_gestureActive = true;
+ }
+ if (QGesture *pinch = e->gesture(Qt::PinchGesture)) {
+ QPinchGesture *gesture = static_cast<QPinchGesture *>(pinch);
+ QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
+ QPoint currCenter = gesture->centerPoint().toPoint();
+ QPoint currWinCenter = mapFromGlobal(currCenter);
+
+ if (gesture->state() == Qt::GestureStarted) {
+ m_oldWinPos = m_prevWinPos = currWinCenter;
+ m_oldScenePos = mapToScene(m_oldWinPos);
+ m_gestureActive = true;
+ } else if (gesture->state() == Qt::GestureFinished) {
+ m_oldWinPos = m_prevWinPos = currWinCenter;
+ m_oldScenePos = mapToScene(m_oldWinPos);
+ m_gestureActive = false;
+ m_zooming = false;
+ m_scaleFactor = 0.0;
+ } else {
+ if (changeFlags & QPinchGesture::ScaleFactorChanged) {
+ double scaleFactor = gesture->scaleFactor();
+ // the scale factor makes for too sensitive scaling
+ // divide the change in half
+ if (scaleFactor > 1) {
+ double decimalValue = scaleFactor - 1;
+ decimalValue /= 1.5;
+ scaleFactor = 1 + decimalValue;
+ } else if (scaleFactor < 1) {
+ double decimalValue = 1 - scaleFactor;
+ decimalValue /= 1.5;
+ scaleFactor = 1 - decimalValue;
+ }
+
+ if (!m_zooming) {
+ double delta = scaleFactor - 1;
+ m_scaleFactor += delta;
+ if (m_scaleFactor > .2 || m_scaleFactor < -.2) {
+ m_zooming = true;
+ }
+ }
+ if (m_zooming) {
+ changeScale(m_oldWinPos, scaleFactor);
+ m_prevWinPos = currWinCenter;
+ }
+ m_gestureActive = true;
+ }
+
+ if (changeFlags & QPinchGesture::CenterPointChanged) {
+ QPointF deltaPoint =
+ gesture->centerPoint() - gesture->lastCenterPoint();
+ if (deltaPoint.manhattanLength() > 1) {
+ // panQt(currWinCenter);
+ }
+ m_gestureActive = true;
+ }
+ }
+ }
+ e->accept();
+}
+
+//------------------------------------------------------------------
+
+bool SchematicSceneViewer::event(QEvent *e) {
+ if (CommandManager::instance()
+ ->getAction(MI_TouchGestureControl)
+ ->isChecked()) {
+ 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;
+ }
+ }
+ return QGraphicsView::event(e);
+}
+
+//------------------------------------------------------------------
+
+void SchematicSceneViewer::setCursorMode(CursorMode cursorMode) {
+ m_cursorMode = cursorMode;
+}
+
//==================================================================
//
// SchematicViewer
@@ -440,7 +635,8 @@ SchematicViewer::SchematicViewer(QWidget *parent)
: QWidget(parent)
, m_fullSchematic(true)
, m_maximizedNode(false)
- , m_sceneHandle(0) {
+ , m_sceneHandle(0)
+ , m_cursorMode(CursorMode::Select) {
m_viewer = new SchematicSceneViewer(this);
m_stageScene = new StageSchematicScene(this);
m_fxScene = new FxSchematicScene(this);
@@ -598,6 +794,24 @@ void SchematicViewer::createActions() {
m_commonToolbar);
connect(m_nodeSize, SIGNAL(triggered()), this, SLOT(changeNodeSize()));
+ QIcon selectModeIcon = createQIconOnOff("schematic_selection_mode", false);
+ m_selectMode =
+ new QAction(selectModeIcon, tr("&Selection Mode"), m_commonToolbar);
+ m_selectMode->setCheckable(true);
+ connect(m_selectMode, SIGNAL(triggered()), this, SLOT(selectModeEnabled()));
+
+ QIcon zoomModeIcon = createQIconOnOff("schematic_zoom_mode", false);
+ m_zoomMode = new QAction(zoomModeIcon, tr("&Zoom Mode"), m_commonToolbar);
+ m_zoomMode->setCheckable(true);
+ connect(m_zoomMode, SIGNAL(triggered()), this, SLOT(zoomModeEnabled()));
+
+ QIcon handModeIcon = createQIconOnOff("schematic_hand_mode", false);
+ m_handMode = new QAction(handModeIcon, tr("&Hand Mode"), m_commonToolbar);
+ m_handMode->setCheckable(true);
+ connect(m_handMode, SIGNAL(triggered()), this, SLOT(handModeEnabled()));
+
+ setCursorMode(m_cursorMode);
+
if (m_fullSchematic) {
// AddPegbar
addPegbar = new QAction(tr("&New Pegbar"), m_stageToolbar);
@@ -661,6 +875,10 @@ void SchematicViewer::createActions() {
m_commonToolbar->addAction(m_reorder);
m_commonToolbar->addAction(m_centerOn);
m_commonToolbar->addAction(m_fitSchematic);
+ m_commonToolbar->addSeparator();
+ m_commonToolbar->addAction(m_handMode);
+ m_commonToolbar->addAction(m_zoomMode);
+ m_commonToolbar->addAction(m_selectMode);
if (m_fullSchematic) {
m_stageToolbar->addSeparator();
@@ -804,3 +1022,26 @@ void SchematicViewer::changeNodeSize() {
: tr("&Maximize Nodes"));
m_nodeSize->setText(label);
}
+
+//------------------------------------------------------------------
+
+void SchematicViewer::setCursorMode(CursorMode cursorMode) {
+ m_cursorMode = cursorMode;
+ m_viewer->setCursorMode(m_cursorMode);
+
+ m_selectMode->setChecked((m_cursorMode == CursorMode::Select));
+ m_zoomMode->setChecked((m_cursorMode == CursorMode::Zoom));
+ m_handMode->setChecked((m_cursorMode == CursorMode::Hand));
+}
+
+//------------------------------------------------------------------
+
+void SchematicViewer::selectModeEnabled() { setCursorMode(CursorMode::Select); }
+
+//------------------------------------------------------------------
+
+void SchematicViewer::zoomModeEnabled() { setCursorMode(CursorMode::Zoom); }
+
+//------------------------------------------------------------------
+
+void SchematicViewer::handModeEnabled() { setCursorMode(CursorMode::Hand); }
diff --git a/toonz/sources/toonzqt/toonzqt.qrc b/toonz/sources/toonzqt/toonzqt.qrc
index a2d03afe2..055d02873 100644
--- a/toonz/sources/toonzqt/toonzqt.qrc
+++ b/toonz/sources/toonzqt/toonzqt.qrc
@@ -313,5 +313,11 @@
<file>Resources/switchport_off.svg</file>
<file>Resources/switchport_over.svg</file>
<file>Resources/plus.svg</file>
+ <file>Resources/schematic_selection_mode_on.svg</file>
+ <file>Resources/schematic_selection_mode_off.svg</file>
+ <file>Resources/schematic_zoom_mode_on.svg</file>
+ <file>Resources/schematic_zoom_mode_off.svg</file>
+ <file>Resources/schematic_hand_mode_on.svg</file>
+ <file>Resources/schematic_hand_mode_off.svg</file>
</qresource>
</RCC>