diff --git a/toonz/sources/toonz/frameheadgadget.cpp b/toonz/sources/toonz/frameheadgadget.cpp index e6ab484..dc318d3 100644 --- a/toonz/sources/toonz/frameheadgadget.cpp +++ b/toonz/sources/toonz/frameheadgadget.cpp @@ -659,3 +659,4 @@ public: enableOnionSkin(checked); } } onionSkinToggle; + diff --git a/toonz/sources/toonz/frameheadgadget.h b/toonz/sources/toonz/frameheadgadget.h index 0fcf9fb..0255bb2 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 { Q_OBJECT diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 67e1716..dca6202 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -1885,6 +1885,8 @@ void MainWindow::defineActions() { createToggle(MI_OnionSkin, tr("Onion Skin"), "", false, RightClickMenuCommandType); + createToggle(MI_ZeroThick, tr("Zero Thick Lines"), "Shift+/", false, + RightClickMenuCommandType); // createRightClickMenuAction(MI_LoadSubSceneFile, tr("Load As // Sub-xsheet"), ""); diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.h index 8daabe2..09c5fb4 100644 --- a/toonz/sources/toonz/menubarcommandids.h +++ b/toonz/sources/toonz/menubarcommandids.h @@ -222,6 +222,7 @@ #define MI_ResetRoomLayout "MI_ResetRoomLayout" #define MI_OnionSkin "MI_OnionSkin" +#define MI_ZeroThick "MI_ZeroThick" //#define MI_LoadResourceFile "MI_LoadResourceFile" #define MI_DuplicateFile "MI_DuplicateFile" diff --git a/toonz/sources/toonz/sceneviewercontextmenu.cpp b/toonz/sources/toonz/sceneviewercontextmenu.cpp index c992e07..6ea36a1 100644 --- a/toonz/sources/toonz/sceneviewercontextmenu.cpp +++ b/toonz/sources/toonz/sceneviewercontextmenu.cpp @@ -25,6 +25,7 @@ #include "toonz/tframehandle.h" #include "toonz/tobjecthandle.h" #include "toonz/tstageobjecttree.h" +#include "toonz/tscenehandle.h" #include "toonz/txshcolumn.h" #include "toonz/tstageobjectspline.h" #include "toonz/tstageobjectid.h" @@ -176,6 +177,10 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent) !parent->isPreviewEnabled()) OnioniSkinMaskGUI::addOnionSkinCommand(this); + // Zero Thick + if (!parent->isPreviewEnabled()) + ZeroThickToggleGui::addZeroThickCommand(this); + // preview if (parent->isPreviewEnabled()) { addSeparator(); @@ -387,3 +392,45 @@ void SceneViewerContextMenu::savePreviewedFrames() { SceneViewer::SUBCAMERA_PREVIEW) ->saveRenderedFrames(); } + + + +class ZeroThickToggle : public MenuItemHandler { +public: + ZeroThickToggle() : MenuItemHandler(MI_ZeroThick) {} + void execute() { + QAction *action = CommandManager::instance()->getAction(MI_ZeroThick); + if (!action) + return; + 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 file diff --git a/toonz/sources/toonz/sceneviewercontextmenu.h b/toonz/sources/toonz/sceneviewercontextmenu.h index 8d58e81..e9ada49 100644 --- a/toonz/sources/toonz/sceneviewercontextmenu.h +++ b/toonz/sources/toonz/sceneviewercontextmenu.h @@ -36,4 +36,18 @@ public slots: void onSetCurrent(); }; +namespace ZeroThickToggleGui { + void addZeroThickCommand(QMenu* menu); + + class ZeroThickToggleHandler : public QObject { + Q_OBJECT + + public slots: + void activate(); + void deactivate(); + }; + + +} //Namespace ZeroThickToggleGui + #endif