OpenToonz - An open-source full-featured 2D animation creation software
C
Right Click menu action
Jeremy Bullockc3ae24862e78
diff --git a/toonz/sources/toonz/frameheadgadget.cpp b/toonz/sources/toonz/frameheadgadget.cppindex 29e3876df..76e525e3d 100644--- a/toonz/sources/toonz/frameheadgadget.cpp+++ b/toonz/sources/toonz/frameheadgadget.cpp@@ -37,12 +37,6 @@ void enableOnionSkin(bool enable = true)osmh->notifyOnionSkinMaskChanged();}-void enableZeroThick(bool enable = true)-{- Preferences::instance()->setShow0ThickLines(enable);- TApp::instance()->getCurrentScene()->notifySceneChanged();-}-bool isOnionSkinEnabled(){TOnionSkinMaskHandle *osmh = TApp::instance()->getCurrentOnionSkin();@@ -703,4 +697,36 @@ public:bool checked = action->isChecked();enableZeroThick(checked);}++ static void enableZeroThick(bool enable = true)+ {+ Preferences::instance()->setShow0ThickLines(enable);+ TApp::instance()->getCurrentScene()->notifySceneChanged();+ }} ZeroThickToggle;+++void ZeroThickToggleGui::addZeroThickCommand(QMenu *menu)+{+ static ZeroThickToggleHandler switcher;+ if (Preferences::instance()->getShow0ThickLines()) {+ QAction *hideZeroThick = menu->addAction(QString(QObject::tr("Hide Zero Thickness Lines")));+ menu->connect(hideZeroThick, SIGNAL(triggered()),+ &switcher, SLOT(deactivate()));+ }+ else {+ QAction *showZeroThick = menu->addAction(QString(QObject::tr("Show Zero Thickness Lines")));+ menu->connect(showZeroThick, SIGNAL(triggered()),+ &switcher, SLOT(activate()));+ }+}++void ZeroThickToggleGui::ZeroThickToggleHandler::activate()+{+ ZeroThickToggle::enableZeroThick(true);+}++void ZeroThickToggleGui::ZeroThickToggleHandler::deactivate()+{+ ZeroThickToggle::enableZeroThick(false);+}\ No newline at end of filediff --git a/toonz/sources/toonz/frameheadgadget.h b/toonz/sources/toonz/frameheadgadget.hindex d3fa7278f..bf6aee254 100644--- a/toonz/sources/toonz/frameheadgadget.h+++ b/toonz/sources/toonz/frameheadgadget.h@@ -11,6 +11,7 @@ class FilmstripFrames;class QEvent;class QColor;class QWidget;+class QMenu;class FrameHeadGadget : public QObject{@@ -84,4 +85,20 @@ public:bool eventFilter(QObject *obj, QEvent *event);};+namespace ZeroThickToggleGui+{+ void addZeroThickCommand(QMenu* menu);++ class ZeroThickToggleHandler : public QObject+ {+ Q_OBJECT++ public slots:+ void activate();+ void deactivate();+ };+++} //Namespace ZeroThickToggleGui+#endifdiff --git a/toonz/sources/toonz/sceneviewercontextmenu.cpp b/toonz/sources/toonz/sceneviewercontextmenu.cppindex b4a02ed8b..8135be3d4 100644--- a/toonz/sources/toonz/sceneviewercontextmenu.cpp+++ b/toonz/sources/toonz/sceneviewercontextmenu.cpp@@ -7,6 +7,7 @@#include "tapp.h"#include "menubarcommandids.h"#include "onionskinmaskgui.h"+#include "frameheadgadget.h"// TnzTools includes#include "tools/toolhandle.h"@@ -158,10 +159,14 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)addAction(action);ret = ret && parent->connect(action, SIGNAL(triggered()), SLOT(setActualPixelSize()));-// onion skin+ // onion skinif (Preferences::instance()->isOnionSkinEnabled() && !parent->isPreviewEnabled())OnioniSkinMaskGUI::addOnionSkinCommand(this);+ // Zero Thick+ if (!parent->isPreviewEnabled())+ ZeroThickToggleGui::addZeroThickCommand(this);+// previewif (parent->isPreviewEnabled()) {addSeparator();