diff --git a/stuff/profiles/layouts/rooms/Default/room1.ini b/stuff/profiles/layouts/rooms/Default/room1.ini index 8abbfaa..aec7553 100644 --- a/stuff/profiles/layouts/rooms/Default/room1.ini +++ b/stuff/profiles/layouts/rooms/Default/room1.ini @@ -5,7 +5,7 @@ pane_1\name=FilmStrip pane_1\geometry=@Rect(1168 34 342 514) pane_2\name=LevelPalette pane_2\geometry=@Rect(421 706 739 290) -pane_2\viewtype=0 +pane_2\viewtype=2 pane_3\name=StyleEditor pane_3\geometry=@Rect(1168 556 342 440) pane_4\name=SceneViewer diff --git a/stuff/profiles/layouts/rooms/Default/room3.ini b/stuff/profiles/layouts/rooms/Default/room3.ini index 93fd5b2..7d56a5a 100644 --- a/stuff/profiles/layouts/rooms/Default/room3.ini +++ b/stuff/profiles/layouts/rooms/Default/room3.ini @@ -9,7 +9,7 @@ pane_3\name=ToolOptions pane_3\geometry=@Rect(0 0 1920 26) pane_4\name=LevelPalette pane_4\geometry=@Rect(1131 34 398 217) -pane_4\viewtype=0 +pane_4\viewtype=2 pane_5\name=StyleEditor pane_5\geometry=@Rect(1131 259 398 737) hierarchy="-1 1 [ 3 [ 1 0 [ 4 5 ] 2 ] ] " diff --git a/stuff/profiles/layouts/rooms/Default/room5.ini b/stuff/profiles/layouts/rooms/Default/room5.ini index 2b25991..d21f88d 100644 --- a/stuff/profiles/layouts/rooms/Default/room5.ini +++ b/stuff/profiles/layouts/rooms/Default/room5.ini @@ -11,7 +11,7 @@ pane_4\name=Xsheet pane_4\geometry=@Rect(43 646 1181 350) pane_5\name=LevelPalette pane_5\geometry=@Rect(1232 320 688 130) -pane_5\viewtype=0 +pane_5\viewtype=2 pane_6\name=StyleEditor pane_6\geometry=@Rect(1232 458 688 538) pane_7\name=StudioPalette diff --git a/stuff/profiles/layouts/rooms/Default/room9.ini b/stuff/profiles/layouts/rooms/Default/room9.ini index 9f9cd43..a1bf55f 100644 --- a/stuff/profiles/layouts/rooms/Default/room9.ini +++ b/stuff/profiles/layouts/rooms/Default/room9.ini @@ -20,4 +20,4 @@ pane_5\name=ToolOptions pane_5\geometry=@Rect(0 0 1920 26) pane_6\name=LevelPalette pane_6\geometry=@Rect(0 521 238 190) -pane_6\viewtype=0 +pane_6\viewtype=2 diff --git a/toonz/sources/include/tcommon.h b/toonz/sources/include/tcommon.h index 8a4e1f8..a5dec3d 100644 --- a/toonz/sources/include/tcommon.h +++ b/toonz/sources/include/tcommon.h @@ -176,7 +176,6 @@ inline std::ostream &operator<<(std::ostream &out, const std::string &s) { #define tArrayCount(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0])) -const std::string mySettingsFileName = "mysettings.ini"; const std::string styleNameEasyInputWordsFileName = "stylename_easyinput.ini"; #endif //__T_COMMON_INCLUDED diff --git a/toonz/sources/include/toonzqt/paletteviewergui.h b/toonz/sources/include/toonzqt/paletteviewergui.h index e853458..5e03c6d 100644 --- a/toonz/sources/include/toonzqt/paletteviewergui.h +++ b/toonz/sources/include/toonzqt/paletteviewergui.h @@ -50,22 +50,6 @@ class StyleNameEditor; namespace PaletteViewerGUI { -// class for managing the palette's default style chip size -class DVAPI ChipSizeManager { -public: - int chipSize_Palette; - int chipSize_Cleanup; - int chipSize_Studio; - static ChipSizeManager *instance() { - static ChipSizeManager _instance; - return &_instance; - } - -private: - ChipSizeManager() - : chipSize_Palette(2), chipSize_Cleanup(2), chipSize_Studio(2) {} -}; - enum PaletteViewType //! Possible palette contents of a Palette Viewer. { LEVEL_PALETTE, //!< Content palette is from a level. CLEANUP_PALETTE, //!< Content palette is from cleanup settings. diff --git a/toonz/sources/include/toonzqt/studiopaletteviewer.h b/toonz/sources/include/toonzqt/studiopaletteviewer.h index 14460d5..c8fdf64 100644 --- a/toonz/sources/include/toonzqt/studiopaletteviewer.h +++ b/toonz/sources/include/toonzqt/studiopaletteviewer.h @@ -26,7 +26,7 @@ class TFrameHandle; class PalettesScanPopup; class TXsheetHandle; class TXshLevelHandle; - +class PaletteViewer; //============================================================================= //! The StudioPaletteTreeViewer class provides an object to view and manage //! palettes files. @@ -207,6 +207,7 @@ class DVAPI StudioPaletteViewer final : public QSplitter { Q_OBJECT StudioPaletteTreeViewer *m_studioPaletteTreeViewer; + PaletteViewer *m_studioPaletteViewer; public: StudioPaletteViewer(QWidget *parent, TPaletteHandle *studioPaletteHandle, @@ -217,6 +218,9 @@ public: /*! In order to save current palette from the tool button in the PageViewer.*/ TFilePath getCurrentItemPath(); + + int getViewMode() const; + void setViewMode(int mode); }; #endif // STUDIOPALETTEVIEWER_H diff --git a/toonz/sources/toonz/comboviewerpane.cpp b/toonz/sources/toonz/comboviewerpane.cpp index 72ecb7f..f0c4a5d 100644 --- a/toonz/sources/toonz/comboviewerpane.cpp +++ b/toonz/sources/toonz/comboviewerpane.cpp @@ -85,12 +85,11 @@ ComboViewerPanel::ComboViewerPanel(QWidget *parent, Qt::WindowFlags flags) #else ComboViewerPanel::ComboViewerPanel(QWidget *parent, Qt::WFlags flags) #endif - : StyleShortcutSwitchablePanel(parent) { + : QFrame(parent) { TApp *app = TApp::instance(); - QFrame *hbox = new QFrame(this); - hbox->setFrameStyle(QFrame::StyledPanel); - hbox->setObjectName("ComboViewerPanel"); + setFrameStyle(QFrame::StyledPanel); + setObjectName("ComboViewerPanel"); // ToolBar m_toolbar = new Toolbar(this, false); @@ -151,8 +150,7 @@ ComboViewerPanel::ComboViewerPanel(QWidget *parent, Qt::WFlags flags) new FlipConsole(mainLayout, buttons, false, m_keyFrameButton, "SceneViewerConsole", this, true); } - hbox->setLayout(mainLayout); - setWidget(hbox); + setLayout(mainLayout); m_flipConsole->enableButton(FlipConsole::eMatte, false, false); m_flipConsole->enableButton(FlipConsole::eSave, false, false); @@ -192,22 +190,17 @@ ComboViewerPanel::ComboViewerPanel(QWidget *parent, Qt::WFlags flags) SLOT(update())); ret = ret && connect(app->getCurrentScene(), SIGNAL(sceneSwitched()), this, SLOT(onSceneSwitched())); - ret = ret && connect(m_toolOptions, SIGNAL(newPanelCreated()), this, - SLOT(updateTabFocus())); assert(ret); m_flipConsole->setChecked(FlipConsole::eSound, true); m_playSound = m_flipConsole->isChecked(FlipConsole::eSound); - // note: initializeTitleBar() refers to m_sceneViewer - initializeTitleBar(getTitleBar()); - // initial state of the parts - m_visibleFlag[CVPARTS_TOOLBAR] = true; - m_visibleFlag[CVPARTS_TOOLOPTIONS] = true; - m_visibleFlag[CVPARTS_FLIPCONSOLE] = true; + m_visiblePartsFlag = CVPARTS_ALL; updateShowHide(); + + setFocusProxy(m_sceneViewer); } //----------------------------------------------------------------------------- @@ -216,11 +209,11 @@ ComboViewerPanel::ComboViewerPanel(QWidget *parent, Qt::WFlags flags) void ComboViewerPanel::updateShowHide() { // toolbar - m_toolbar->setVisible(m_visibleFlag[CVPARTS_TOOLBAR]); + m_toolbar->setVisible(m_visiblePartsFlag & CVPARTS_TOOLBAR); // tool options bar - m_toolOptions->setVisible(m_visibleFlag[CVPARTS_TOOLOPTIONS]); + m_toolOptions->setVisible(m_visiblePartsFlag & CVPARTS_TOOLOPTIONS); // flip console - m_flipConsole->showHideAllParts(m_visibleFlag[CVPARTS_FLIPCONSOLE]); + m_flipConsole->showHideAllParts(m_visiblePartsFlag & CVPARTS_FLIPCONSOLE); update(); } @@ -244,16 +237,16 @@ void ComboViewerPanel::addShowHideContextMenu(QMenu *menu) { QAction *flipConsoleSHAct = showHideMenu->addAction(tr("Console")); toolbarSHAct->setCheckable(true); - toolbarSHAct->setChecked(m_visibleFlag[CVPARTS_TOOLBAR]); - toolbarSHAct->setData((int)CVPARTS_TOOLBAR); + toolbarSHAct->setChecked(m_visiblePartsFlag & CVPARTS_TOOLBAR); + toolbarSHAct->setData((UINT)CVPARTS_TOOLBAR); toolOptionsSHAct->setCheckable(true); - toolOptionsSHAct->setChecked(m_visibleFlag[CVPARTS_TOOLOPTIONS]); - toolOptionsSHAct->setData((int)CVPARTS_TOOLOPTIONS); + toolOptionsSHAct->setChecked(m_visiblePartsFlag & CVPARTS_TOOLOPTIONS); + toolOptionsSHAct->setData((UINT)CVPARTS_TOOLOPTIONS); flipConsoleSHAct->setCheckable(true); - flipConsoleSHAct->setChecked(m_visibleFlag[CVPARTS_FLIPCONSOLE]); - flipConsoleSHAct->setData((int)CVPARTS_FLIPCONSOLE); + flipConsoleSHAct->setChecked(m_visiblePartsFlag & CVPARTS_FLIPCONSOLE); + flipConsoleSHAct->setData((UINT)CVPARTS_FLIPCONSOLE); QActionGroup *showHideActGroup = new QActionGroup(this); showHideActGroup->setExclusive(false); @@ -280,13 +273,10 @@ void ComboViewerPanel::addShowHideContextMenu(QMenu *menu) { */ void ComboViewerPanel::onShowHideActionTriggered(QAction *act) { - CV_Parts parts = (CV_Parts)act->data().toInt(); - assert(parts < CVPARTS_COUNT); + CV_Parts part = (CV_Parts)act->data().toUInt(); + assert(part < CVPARTS_End); - if (m_visibleFlag[parts]) - m_visibleFlag[parts] = false; - else - m_visibleFlag[parts] = true; + m_visiblePartsFlag ^= part; updateShowHide(); } @@ -335,15 +325,11 @@ void ComboViewerPanel::onDrawFrame( //----------------------------------------------------------------------------- -ComboViewerPanel::~ComboViewerPanel() { - if (TApp::instance()->getInknPaintViewerPanel() == this) - TApp::instance()->setInknPaintViewerPanel(0); -} +ComboViewerPanel::~ComboViewerPanel() {} //----------------------------------------------------------------------------- void ComboViewerPanel::showEvent(QShowEvent *event) { - StyleShortcutSwitchablePanel::showEvent(event); TApp *app = TApp::instance(); TFrameHandle *frameHandle = app->getCurrentFrame(); TSceneHandle *sceneHandle = app->getCurrentScene(); @@ -373,6 +359,10 @@ void ComboViewerPanel::showEvent(QShowEvent *event) { */ ret = ret && connect(sceneHandle, SIGNAL(nameSceneChanged()), this, SLOT(changeWindowTitle())); + ret = + ret && connect(sceneHandle, SIGNAL(preferenceChanged(const QString &)), + m_flipConsole, SLOT(onPreferenceChanged(const QString &))); + ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), this, SLOT(changeWindowTitle())); ret = ret && connect(frameHandle, SIGNAL(frameSwitched()), this, @@ -400,6 +390,7 @@ void ComboViewerPanel::showEvent(QShowEvent *event) { assert(ret); m_flipConsole->setActive(true); + m_flipConsole->onPreferenceChanged(""); // refresh onSceneChanged(); @@ -409,7 +400,6 @@ void ComboViewerPanel::showEvent(QShowEvent *event) { //----------------------------------------------------------------------------- void ComboViewerPanel::hideEvent(QHideEvent *event) { - StyleShortcutSwitchablePanel::hideEvent(event); TApp *app = TApp::instance(); disconnect(app->getCurrentFrame(), 0, this, 0); disconnect(app->getCurrentScene(), 0, this, 0); @@ -419,6 +409,8 @@ void ComboViewerPanel::hideEvent(QHideEvent *event) { disconnect(app->getCurrentTool(), SIGNAL(toolSwitched()), m_sceneViewer, SLOT(onToolSwitched())); + disconnect(app->getCurrentScene(), SIGNAL(preferenceChanged(const QString &)), + m_flipConsole, SLOT(onPreferenceChanged(const QString &))); m_flipConsole->setActive(false); } @@ -436,9 +428,9 @@ void ComboViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) { // buttons for show / hide toggle for the field guide and the safe area TPanelTitleBarButtonForSafeArea *safeAreaButton = - new TPanelTitleBarButtonForSafeArea(titleBar, ":Resources/pane_safe_off.svg", - ":Resources/pane_safe_over.svg", - ":Resources/pane_safe_on.svg"); + new TPanelTitleBarButtonForSafeArea( + titleBar, ":Resources/pane_safe_off.svg", + ":Resources/pane_safe_over.svg", ":Resources/pane_safe_on.svg"); safeAreaButton->setToolTip(tr("Safe Area (Right Click to Select)")); titleBar->add(QPoint(x, 0), safeAreaButton); ret = ret && connect(safeAreaButton, SIGNAL(toggled(bool)), @@ -507,8 +499,8 @@ void ComboViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) { // preview toggles m_previewButton = new TPanelTitleBarButton( - titleBar, ":Resources/pane_preview_off.svg", ":Resources/pane_preview_over.svg", - ":Resources/pane_preview_on.svg"); + titleBar, ":Resources/pane_preview_off.svg", + ":Resources/pane_preview_over.svg", ":Resources/pane_preview_on.svg"); x += 10 + iconWidth; titleBar->add(QPoint(x, 0), m_previewButton); m_previewButton->setToolTip(tr("Preview")); @@ -616,6 +608,7 @@ void ComboViewerPanel::changeWindowTitle() { TApp *app = TApp::instance(); ToonzScene *scene = app->getCurrentScene()->getScene(); if (!scene) return; + if (!parentWidget()) return; int frame = app->getCurrentFrame()->getFrame(); // put the titlebar texts in this string @@ -637,7 +630,7 @@ void ComboViewerPanel::changeWindowTitle() { !m_sceneViewer->is3DView()) { name = name + tr(" (Flipped)"); } - setWindowTitle(name); + parentWidget()->setWindowTitle(name); return; } TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); @@ -647,7 +640,7 @@ void ComboViewerPanel::changeWindowTitle() { !m_sceneViewer->is3DView()) { name = name + tr(" (Flipped)"); } - setWindowTitle(name); + parentWidget()->setWindowTitle(name); return; } assert(cell.m_level.getPointer()); @@ -676,7 +669,7 @@ void ComboViewerPanel::changeWindowTitle() { && !CameraTestCheck::instance() // camera test mode must be OFF // neither - ->isEnabled() && + ->isEnabled() && !m_sceneViewer->is3DView()) { TAffine aff = m_sceneViewer->getViewMatrix(); if (m_sceneViewer->getIsFlippedX()) aff = aff * TScale(-1, 1); @@ -712,7 +705,7 @@ void ComboViewerPanel::changeWindowTitle() { !m_sceneViewer->is3DView()) { name = name + tr(" (Flipped)"); } - setWindowTitle(name); + parentWidget()->setWindowTitle(name); } //----------------------------------------------------------------------------- @@ -821,13 +814,6 @@ void ComboViewerPanel::onFrameTypeChanged() { //----------------------------------------------------------------------------- -void ComboViewerPanel::onPreferenceChanged(const QString &prefName) { - m_flipConsole->onPreferenceChanged(prefName); - StyleShortcutSwitchablePanel::onPreferenceChanged(prefName); -} - -//----------------------------------------------------------------------------- - void ComboViewerPanel::playAudioFrame(int frame) { if (m_first) { m_first = false; @@ -860,8 +846,8 @@ bool ComboViewerPanel::hasSoundtrack() { } TXsheetHandle *xsheetHandle = TApp::instance()->getCurrentXsheet(); TXsheet::SoundProperties *prop = new TXsheet::SoundProperties(); - if(!m_sceneViewer->isPreviewEnabled()) prop->m_isPreview = true; - m_sound = xsheetHandle->getXsheet()->makeSound(prop); + if (!m_sceneViewer->isPreviewEnabled()) prop->m_isPreview = true; + m_sound = xsheetHandle->getXsheet()->makeSound(prop); if (m_sound == NULL) { m_hasSoundtrack = false; return false; @@ -875,4 +861,21 @@ void ComboViewerPanel::onButtonPressed(FlipConsole::EGadget button) { if (button == FlipConsole::eSound) { m_playSound = !m_playSound; } +} + +//----------------------------------------------------------------------------- + +void ComboViewerPanel::setVisiblePartsFlag(UINT flag) { + m_visiblePartsFlag = flag; + updateShowHide(); +} + +// SaveLoadQSettings +void ComboViewerPanel::save(QSettings &settings) const { + settings.setValue("visibleParts", m_visiblePartsFlag); +} + +void ComboViewerPanel::load(QSettings &settings) { + m_visiblePartsFlag = settings.value("visibleParts", CVPARTS_ALL).toUInt(); + updateShowHide(); } \ No newline at end of file diff --git a/toonz/sources/toonz/comboviewerpane.h b/toonz/sources/toonz/comboviewerpane.h index b12bef6..614e8f6 100644 --- a/toonz/sources/toonz/comboviewerpane.h +++ b/toonz/sources/toonz/comboviewerpane.h @@ -3,12 +3,14 @@ #ifndef COMBOVIEWER_PANE_INCLUDED #define COMBOVIEWER_PANE_INCLUDED -#include "styleshortcutswitchablepanel.h" #include "sceneviewer.h" #include "toonzqt/intfield.h" #include "toonzqt/keyframenavigator.h" #include "toonzqt/flipconsoleowner.h" +#include "saveloadqsettings.h" + +#include class QPoint; class QToolBar; @@ -30,15 +32,19 @@ class ToolOptions; // ComboViewerPanel //----------------------------------------------------------------------------- enum CV_Parts { - CVPARTS_TOOLBAR = 0, - CVPARTS_TOOLOPTIONS, - CVPARTS_FLIPCONSOLE, - CVPARTS_COUNT + CVPARTS_None = 0, + CVPARTS_TOOLBAR = 0x1, + CVPARTS_TOOLOPTIONS = 0x2, + CVPARTS_FLIPCONSOLE = 0x4, + CVPARTS_End = 0x8, + CVPARTS_ALL = CVPARTS_TOOLBAR | CVPARTS_TOOLOPTIONS | CVPARTS_FLIPCONSOLE }; + //----------------------------------------------------------------------------- -class ComboViewerPanel final : public StyleShortcutSwitchablePanel, - public FlipConsoleOwner { +class ComboViewerPanel final : public QFrame, + public FlipConsoleOwner, + public SaveLoadQSettings { Q_OBJECT SceneViewer *m_sceneViewer; @@ -50,7 +56,7 @@ class ComboViewerPanel final : public StyleShortcutSwitchablePanel, ToolOptions *m_toolOptions; Ruler *m_vRuler; Ruler *m_hRuler; - bool m_visibleFlag[CVPARTS_COUNT]; + UINT m_visiblePartsFlag; bool m_onionSkinActive = false; bool m_playSound = true; bool m_hasSoundtrack = false; @@ -73,37 +79,36 @@ public: ~ComboViewerPanel(); SceneViewer *getSceneViewer() { return m_sceneViewer; } + ToolOptions *getToolOptions() { return m_toolOptions; } - // toggle show/hide of the widgets according to m_visibleFlag + // toggle show/hide of the widgets according to m_visiblePartsFlag + void setVisiblePartsFlag(UINT flag); void updateShowHide(); void addShowHideContextMenu(QMenu *); - void setShowHideFlag(CV_Parts parts, bool visible) { - m_visibleFlag[parts] = visible; - } - bool getShowHideFlag(CV_Parts parts) { return m_visibleFlag[parts]; } - // reimplementation of TPanel::widgetInThisPanelIsFocused - bool widgetInThisPanelIsFocused() override { - return m_sceneViewer->hasFocus(); - } void onDrawFrame(int frame, const ImagePainter::VisualSettings &settings) override; + void onEnterPanel() { + m_sceneViewer->setFocus(Qt::OtherFocusReason); + // activate shortcut key for this flipconsole + m_flipConsole->makeCurrent(); + } + void onLeavePanel() { m_sceneViewer->clearFocus(); } + + // SaveLoadQSettings + virtual void save(QSettings &settings) const override; + virtual void load(QSettings &settings) override; + + void initializeTitleBar(TPanelTitleBar *titleBar); + protected: void showEvent(QShowEvent *) override; void hideEvent(QHideEvent *) override; - void initializeTitleBar(TPanelTitleBar *titleBar); void createFrameToolBar(); void createPlayToolBar(); void addColorMaskButton(QWidget *parent, const char *iconSVGName, int id); void contextMenuEvent(QContextMenuEvent *event) override; - // reimplementation of TPanel::widgetFocusOnEnter - void widgetFocusOnEnter() override { - m_sceneViewer->setFocus(Qt::OtherFocusReason); - // activate shortcut key for this flipconsole - m_flipConsole->makeCurrent(); - }; - void widgetClearFocusOnLeave() override { m_sceneViewer->clearFocus(); }; void playAudioFrame(int frame); bool hasSoundtrack(); @@ -127,8 +132,6 @@ protected slots: void onSceneSwitched(); void enableFullPreview(bool enabled); void enableSubCameraPreview(bool enabled); - - void onPreferenceChanged(const QString &prefName) override; }; #endif diff --git a/toonz/sources/toonz/filmstrip.cpp b/toonz/sources/toonz/filmstrip.cpp index 7081364..301b8c5 100644 --- a/toonz/sources/toonz/filmstrip.cpp +++ b/toonz/sources/toonz/filmstrip.cpp @@ -112,7 +112,6 @@ FilmstripFrames::FilmstripFrames(QScrollArea *parent, Qt::WFlags flags) , m_dragSelectionStartIndex(-1) , m_dragSelectionEndIndex(-1) , m_timerId(0) - , m_isGhibli(false) , m_selecting(false) , m_dragDropArmed(false) , m_readOnly(false) { @@ -132,10 +131,7 @@ FilmstripFrames::FilmstripFrames(QScrollArea *parent, Qt::WFlags flags) m_selection->setView(this); setMouseTracking(true); - std::string room = - Preferences::instance()->getCurrentRoomChoice().toStdString(); - m_isGhibli = room == "StudioGhibli"; - m_viewer = NULL; + m_viewer = NULL; } //----------------------------------------------------------------------------- @@ -357,26 +353,33 @@ void FilmstripFrames::showEvent(QShowEvent *) { // cambiamenti al livello TXshLevelHandle *levelHandle = app->getCurrentLevel(); - connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, - SLOT(onLevelSwitched(TXshLevel *))); - connect(levelHandle, SIGNAL(xshLevelChanged()), this, SLOT(onLevelChanged())); - connect(levelHandle, SIGNAL(xshLevelViewChanged()), this, - SLOT(onLevelChanged())); + bool ret = true; + ret = ret && connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, + SLOT(onLevelSwitched(TXshLevel *))); + ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), this, + SLOT(onLevelChanged())); + ret = ret && connect(levelHandle, SIGNAL(xshLevelViewChanged()), this, + SLOT(onLevelChanged())); // al frame corrente - connect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, - SLOT(onFrameSwitched())); - connect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, - SLOT(update())); + ret = ret && connect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, + SLOT(onFrameSwitched())); + ret = ret && connect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, + SLOT(update())); // iconcine - connect(IconGenerator::instance(), SIGNAL(iconGenerated()), this, - SLOT(update())); + ret = ret && connect(IconGenerator::instance(), SIGNAL(iconGenerated()), this, + SLOT(update())); // onion skin - connect(app->getCurrentOnionSkin(), SIGNAL(onionSkinMaskChanged()), this, - SLOT(update())); + ret = ret && connect(app->getCurrentOnionSkin(), + SIGNAL(onionSkinMaskChanged()), this, SLOT(update())); + // active viewer change + ret = ret && + connect(app, SIGNAL(activeViewerChanged()), this, SLOT(getViewer())); + + assert(ret); getViewer(); } @@ -402,9 +405,13 @@ void FilmstripFrames::hideEvent(QHideEvent *) { disconnect(app->getCurrentOnionSkin(), SIGNAL(onionSkinMaskChanged()), this, SLOT(update())); + // active viewer change + disconnect(app, SIGNAL(activeViewerChanged()), this, SLOT(getViewer())); + if (m_viewer) { disconnect(m_viewer, SIGNAL(onZoomChanged()), this, SLOT(update())); disconnect(m_viewer, SIGNAL(refreshNavi()), this, SLOT(update())); + m_viewer = nullptr; } } @@ -419,16 +426,13 @@ void FilmstripFrames::getViewer() { } viewerChanged = true; } - ComboViewerPanel *inknPaintViewerPanel = - TApp::instance()->getInknPaintViewerPanel(); - if (m_isGhibli && inknPaintViewerPanel) { - m_viewer = inknPaintViewerPanel->getSceneViewer(); - } else { - m_viewer = TApp::instance()->getActiveViewer(); - } + + m_viewer = TApp::instance()->getActiveViewer(); + if (m_viewer && viewerChanged) { connect(m_viewer, SIGNAL(onZoomChanged()), this, SLOT(update())); connect(m_viewer, SIGNAL(refreshNavi()), this, SLOT(update())); + update(); } } @@ -738,7 +742,7 @@ void FilmstripFrames::mousePressEvent(QMouseEvent *event) { if (fid.getNumber() >= 0 && fid == getCurrentFrameId() && (sl->getType() == TZP_XSHLEVEL || sl->getType() == OVL_XSHLEVEL) && m_viewer && m_viewer->isVisible() && actualIconClicked && - (m_isGhibli != (event->button() == Qt::MiddleButton))) { + event->button() == Qt::MiddleButton) { m_isNavigatorPanning = true; execNavigatorPan(event->pos()); QApplication::setOverrideCursor(Qt::ClosedHandCursor); diff --git a/toonz/sources/toonz/filmstrip.h b/toonz/sources/toonz/filmstrip.h index 469e12e..e72d5a4 100644 --- a/toonz/sources/toonz/filmstrip.h +++ b/toonz/sources/toonz/filmstrip.h @@ -131,7 +131,6 @@ protected: void stopAutoPanning(); void timerEvent(QTimerEvent *) override; TFrameId getCurrentFrameId(); - void getViewer(); void contextMenuEvent(QContextMenuEvent *event) override; void startDragDrop(); @@ -145,6 +144,7 @@ protected slots: void onLevelChanged(); void onLevelSwitched(TXshLevel *); void onFrameSwitched(); + void getViewer(); private: // QSS Properties @@ -166,7 +166,6 @@ private: FilmstripFrameHeadGadget *m_frameHeadGadget; InbetweenDialog *m_inbetweenDialog; SceneViewer *m_viewer; - bool m_isGhibli = false; bool m_justStartedSelection = false; int m_indexForResetSelection = -1; bool m_allowResetSelection = false; diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index d13c141..aecd8af 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -348,10 +348,6 @@ void Room::load(const TFilePath &fp) { dynamic_cast(pane->widget())->setPoolIndex(index); } - /*-- もしRoomにComboViewerがロードされたら、centralWidgetとして登録する --*/ - if (paneObjectName == "ComboViewer") - setCentralViewerPanel(qobject_cast(pane)); - settings.endGroup(); } @@ -549,20 +545,6 @@ void MainWindow::refreshWriteSettings() { writeSettings(); } //----------------------------------------------------------------------------- void MainWindow::readSettings(const QString &argumentLayoutFileName) { - TFilePath fp(ToonzFolder::getMyModuleDir() + TFilePath(mySettingsFileName)); - QSettings mySettings(toQString(fp), QSettings::IniFormat); - /*-- Palette-PageViewerのチップサイズのロード --*/ - mySettings.beginGroup("PaletteChipSizes"); - { - PaletteViewerGUI::ChipSizeManager::instance()->chipSize_Palette = - mySettings.value("PaletteViewer", 2).toInt(); - PaletteViewerGUI::ChipSizeManager::instance()->chipSize_Cleanup = - mySettings.value("CleanupSettings", 0).toInt(); - PaletteViewerGUI::ChipSizeManager::instance()->chipSize_Studio = - mySettings.value("StudioPalette", 1).toInt(); - } - mySettings.endGroup(); - QTabBar *roomTabWidget = m_topBar->getRoomTabWidget(); /*-- Pageを追加すると同時にMenubarを追加する --*/ @@ -656,7 +638,7 @@ void MainWindow::readSettings(const QString &argumentLayoutFileName) { writeRoomList(rooms); // Imposto la stanza corrente - fp = ToonzFolder::getRoomsFile(currentRoomFileName); + TFilePath fp = ToonzFolder::getRoomsFile(currentRoomFileName); Tifstream is(fp); std::string currentRoomName; is >> currentRoomName; @@ -673,38 +655,6 @@ void MainWindow::readSettings(const QString &argumentLayoutFileName) { } RecentFiles::instance()->loadRecentFiles(); - - QStringList roomNames; - roomNames << "InknPaint" - << "Cleanup" - << "PltEdit" - << "Schematic" - << "QAR"; - /*--- ComboViewerのパーツのShow/Hideの再現 ---*/ - mySettings.beginGroup("ComboViewerPartsVisible"); - { - for (int r = 0; r < roomNames.size(); r++) { - QString tmpRoomName = roomNames.at(r); - Room *tmpRoom = getRoomByName(tmpRoomName); - if (tmpRoom) { - ComboViewerPanel *cvp = tmpRoom->getCentralViewerPanel(); - if (cvp) { - if (r == 0) // InknPaintRoom - TApp::instance()->setInknPaintViewerPanel(cvp); - mySettings.beginGroup(tmpRoomName); - cvp->setShowHideFlag(CVPARTS_TOOLBAR, - mySettings.value("Toolbar", true).toBool()); - cvp->setShowHideFlag(CVPARTS_TOOLOPTIONS, - mySettings.value("ToolOptions", true).toBool()); - cvp->setShowHideFlag(CVPARTS_FLIPCONSOLE, - mySettings.value("Console", true).toBool()); - cvp->updateShowHide(); - mySettings.endGroup(); - } - } - } - } - mySettings.endGroup(); } //----------------------------------------------------------------------------- @@ -748,56 +698,6 @@ void MainWindow::writeSettings() { QSettings settings(toQString(fp), QSettings::IniFormat); settings.setValue("MainWindowGeometry", saveGeometry()); - - // Recent Files - // RecentFiles::instance()->saveRecentFiles(); - - fp = ToonzFolder::getMyModuleDir() + TFilePath(mySettingsFileName); - QSettings mySettings(toQString(fp), QSettings::IniFormat); - - /*--- Palette-PageViewerのチップサイズの保存 ---*/ - mySettings.beginGroup("PaletteChipSizes"); - { - mySettings.setValue( - "PaletteViewer", - PaletteViewerGUI::ChipSizeManager::instance()->chipSize_Palette); - mySettings.setValue( - "CleanupSettings", - PaletteViewerGUI::ChipSizeManager::instance()->chipSize_Cleanup); - mySettings.setValue( - "StudioPalette", - PaletteViewerGUI::ChipSizeManager::instance()->chipSize_Studio); - } - mySettings.endGroup(); - - QStringList roomNames; - roomNames << "InknPaint" - << "Cleanup" - << "PltEdit" - << "Schematic" - << "QAR"; - /*--- ComboViewerのパーツのShow/Hideの保存 ---*/ - mySettings.beginGroup("ComboViewerPartsVisible"); - { - for (int r = 0; r < roomNames.size(); r++) { - QString tmpRoomName = roomNames.at(r); - Room *tmpRoom = getRoomByName(tmpRoomName); - if (tmpRoom) { - ComboViewerPanel *cvp = tmpRoom->getCentralViewerPanel(); - if (cvp) { - mySettings.beginGroup(tmpRoomName); - mySettings.setValue("Toolbar", cvp->getShowHideFlag(CVPARTS_TOOLBAR)); - mySettings.setValue("ToolOptions", - cvp->getShowHideFlag(CVPARTS_TOOLOPTIONS)); - mySettings.setValue("Console", - cvp->getShowHideFlag(CVPARTS_FLIPCONSOLE)); - cvp->updateShowHide(); - mySettings.endGroup(); - } - } - } - } - mySettings.endGroup(); } //----------------------------------------------------------------------------- @@ -817,15 +717,9 @@ Room *MainWindow::createCleanupRoom() { cleanupRoom->addDockWidget(viewer); layout->dockItem(viewer); ComboViewerPanel *cvp = qobject_cast(viewer); - if (cvp) { - /*- UI隠す -*/ - cvp->setShowHideFlag(CVPARTS_TOOLBAR, false); - cvp->setShowHideFlag(CVPARTS_TOOLOPTIONS, false); - cvp->setShowHideFlag(CVPARTS_FLIPCONSOLE, false); - cvp->updateShowHide(); - - cleanupRoom->setCentralViewerPanel(cvp); - } + if (cvp) + // hide all parts + cvp->setVisiblePartsFlag(CVPARTS_None); } // CleanupSettings @@ -864,11 +758,7 @@ Room *MainWindow::createPltEditRoom() { layout->dockItem(viewer); ComboViewerPanel *cvp = qobject_cast(viewer); - if (cvp) { - cvp->setShowHideFlag(CVPARTS_FLIPCONSOLE, false); - cvp->updateShowHide(); - pltEditRoom->setCentralViewerPanel(cvp); - } + if (cvp) cvp->setVisiblePartsFlag(CVPARTS_TOOLBAR | CVPARTS_TOOLOPTIONS); } // Palette @@ -920,12 +810,6 @@ Room *MainWindow::createInknPaintRoom() { if (viewer) { inknPaintRoom->addDockWidget(viewer); layout->dockItem(viewer); - - ComboViewerPanel *cvp = qobject_cast(viewer); - if (cvp) { - inknPaintRoom->setCentralViewerPanel(cvp); - TApp::instance()->setInknPaintViewerPanel(cvp); - } } // Palette @@ -1959,15 +1843,17 @@ void MainWindow::defineActions() { MenuViewCommandType); createToggle(MI_ACheck, tr("&Gap Check"), "", ACheckToggleAction ? 1 : 0, MenuViewCommandType); - QAction* shiftTraceAction = createToggle(MI_ShiftTrace, tr("Shift and Trace"), "", false, - MenuViewCommandType); + QAction *shiftTraceAction = createToggle(MI_ShiftTrace, tr("Shift and Trace"), + "", false, MenuViewCommandType); shiftTraceAction->setIcon(QIcon(":Resources/shift_and_trace.svg")); - shiftTraceAction = createToggle(MI_EditShift, tr("Edit Shift"), "", false, MenuViewCommandType); + shiftTraceAction = createToggle(MI_EditShift, tr("Edit Shift"), "", false, + MenuViewCommandType); shiftTraceAction->setIcon(QIcon(":Resources/shift_and_trace_edit.svg")); createToggle(MI_NoShift, tr("No Shift"), "", false, MenuViewCommandType); CommandManager::instance()->enable(MI_EditShift, false); CommandManager::instance()->enable(MI_NoShift, false); - shiftTraceAction = createAction(MI_ResetShift, tr("Reset Shift"), "", MenuViewCommandType); + shiftTraceAction = + createAction(MI_ResetShift, tr("Reset Shift"), "", MenuViewCommandType); shiftTraceAction->setIcon(QIcon(":Resources/shift_and_trace_reset.svg")); if (QGLPixelBuffer::hasOpenGLPbuffers()) diff --git a/toonz/sources/toonz/mainwindow.h b/toonz/sources/toonz/mainwindow.h index 1c07330..bf11637 100644 --- a/toonz/sources/toonz/mainwindow.h +++ b/toonz/sources/toonz/mainwindow.h @@ -30,18 +30,13 @@ class Room final : public TMainWindow { TFilePath m_path; QString m_name; - /*-- - * Room毎にComboViewerの初期状態をLoadするため、MainWindowからComboViewerにアクセスできるようにする。 - * --*/ - ComboViewerPanel *m_centralViewer; - public: #if QT_VERSION >= 0x050500 Room(QWidget *parent = 0, Qt::WindowFlags flags = 0) #else Room(QWidget *parent = 0, Qt::WFlags flags = 0) #endif - : TMainWindow(parent, flags), m_centralViewer(0) { + : TMainWindow(parent, flags) { } ~Room() {} @@ -52,11 +47,6 @@ public: QString getName() const { return m_name; } void setName(QString name) { m_name = name; } - ComboViewerPanel *getCentralViewerPanel() const { return m_centralViewer; } - void setCentralViewerPanel(ComboViewerPanel *cvp) { - if (!m_centralViewer) m_centralViewer = cvp; - } - void save(); void load(const TFilePath &fp); }; diff --git a/toonz/sources/toonz/sceneviewerevents.cpp b/toonz/sources/toonz/sceneviewerevents.cpp index e92f90d..e9196d2 100644 --- a/toonz/sources/toonz/sceneviewerevents.cpp +++ b/toonz/sources/toonz/sceneviewerevents.cpp @@ -1096,19 +1096,21 @@ bool SceneViewer::event(QEvent *e) { break; } */ - if (CommandManager::instance() + if (e->type() == QEvent::Gesture && + CommandManager::instance() ->getAction(MI_TouchGestureControl) ->isChecked()) { - if (e->type() == QEvent::Gesture) { - gestureEvent(static_cast(e)); - return true; - } - if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchEnd || - e->type() == QEvent::TouchCancel || e->type() == QEvent::TouchUpdate) { - touchEvent(static_cast(e), e->type()); - m_gestureActive = true; - return true; - } + gestureEvent(static_cast(e)); + return true; + } + if ((e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchEnd || + e->type() == QEvent::TouchCancel || e->type() == QEvent::TouchUpdate) && + CommandManager::instance() + ->getAction(MI_TouchGestureControl) + ->isChecked()) { + touchEvent(static_cast(e), e->type()); + m_gestureActive = true; + return true; } if (e->type() == QEvent::ShortcutOverride || e->type() == QEvent::KeyPress) { if (!((QKeyEvent *)e)->isAutoRepeat()) { @@ -1474,8 +1476,8 @@ void SceneViewer::onContextMenu(const QPoint &pos, const QPoint &globalPos) { menu->addLevelCommands(columnIndices); - ComboViewerPanel *cvp = qobject_cast( - parentWidget()->parentWidget()->parentWidget()); + ComboViewerPanel *cvp = + qobject_cast(parentWidget()->parentWidget()); if (cvp) { menu->addSeparator(); cvp->addShowHideContextMenu(menu); diff --git a/toonz/sources/toonz/tapp.h b/toonz/sources/toonz/tapp.h index 2779ee0..ae97c52 100644 --- a/toonz/sources/toonz/tapp.h +++ b/toonz/sources/toonz/tapp.h @@ -81,9 +81,6 @@ class TApp final : public QObject, QMainWindow *m_mainWindow; - // keep a pointer of the inknpaint viewer in order to enable navigator pan in - // the filmstrip - ComboViewerPanel *m_inknPaintViewerPanel; SceneViewer *m_activeViewer; XsheetViewer *m_xsheetViewer; @@ -190,16 +187,11 @@ public: QString getCurrentRoomName() const; - // keep a pointer of the inknpaint viewer in order to enable navigator pan in - // the filmstrip - void setInknPaintViewerPanel(ComboViewerPanel *panel) { - m_inknPaintViewerPanel = panel; + void setActiveViewer(SceneViewer *viewer) { + if (m_activeViewer == viewer) return; + m_activeViewer = viewer; + emit activeViewerChanged(); } - ComboViewerPanel *getInknPaintViewerPanel() const { - return m_inknPaintViewerPanel; - } - - void setActiveViewer(SceneViewer *viewer) { m_activeViewer = viewer; } SceneViewer *getActiveViewer() const { return m_activeViewer; } @@ -254,6 +246,9 @@ signals: // NOTE: For now QEvent::TabletLeaveProximity is NOT detected on Windows. See // QTBUG-53628. void tabletLeft(); + + void + activeViewerChanged(); // TODO: put widgets-related stuffs in some new handle }; #endif // TAPP_H diff --git a/toonz/sources/toonz/tpanels.cpp b/toonz/sources/toonz/tpanels.cpp index 6092c3c..0f77011 100644 --- a/toonz/sources/toonz/tpanels.cpp +++ b/toonz/sources/toonz/tpanels.cpp @@ -626,6 +626,17 @@ void StudioPaletteViewerPanel::onPaletteSwitched() { m_studioPaletteHandle); } +//----------------------------------------------------------------------------- + +void StudioPaletteViewerPanel::setViewType(int viewType) { + m_studioPaletteViewer->setViewMode(viewType); +} +//----------------------------------------------------------------------------- + +int StudioPaletteViewerPanel::getViewType() { + return m_studioPaletteViewer->getViewMode(); +} + //============================================================================= // StudioPaletteViewerFactory //----------------------------------------------------------------------------- @@ -1264,21 +1275,43 @@ OpenFloatingPanel openLineTestCaptureCommand(MI_OpenLineTestCapture, // ComboViewer : Viewer + Toolbar + Tool Options //----------------------------------------------------------------------------- +ComboViewerPanelContainer::ComboViewerPanelContainer(QWidget *parent) + : StyleShortcutSwitchablePanel(parent) { + m_comboViewer = new ComboViewerPanel(parent); + setFocusProxy(m_comboViewer); + setWidget(m_comboViewer); + + m_comboViewer->initializeTitleBar(getTitleBar()); + bool ret = connect(m_comboViewer->getToolOptions(), SIGNAL(newPanelCreated()), + this, SLOT(updateTabFocus())); + assert(ret); +} +// reimplementation of TPanel::widgetInThisPanelIsFocused +bool ComboViewerPanelContainer::widgetInThisPanelIsFocused() { + return m_comboViewer->hasFocus(); +} +// reimplementation of TPanel::widgetFocusOnEnter +void ComboViewerPanelContainer::widgetFocusOnEnter() { + m_comboViewer->onEnterPanel(); +} +void ComboViewerPanelContainer::widgetClearFocusOnLeave() { + m_comboViewer->onLeavePanel(); +} + +//----------------------------------------------------------------------------- + class ComboViewerFactory final : public TPanelFactory { public: ComboViewerFactory() : TPanelFactory("ComboViewer") {} TPanel *createPanel(QWidget *parent) override { - ComboViewerPanel *panel = new ComboViewerPanel(parent); + ComboViewerPanelContainer *panel = new ComboViewerPanelContainer(parent); panel->setObjectName(getPanelType()); panel->setWindowTitle(QObject::tr("Combo Viewer")); panel->resize(700, 600); return panel; } - void initialize(TPanel *panel) override { - assert(0); - panel->setWidget(new ComboViewerPanel(panel)); - } -} ghibliViewerFactory; + void initialize(TPanel *panel) override { assert(0); } +} comboViewerFactory; //============================================================================= OpenFloatingPanel openComboViewerCommand(MI_OpenComboViewer, "ComboViewer", diff --git a/toonz/sources/toonz/tpanels.h b/toonz/sources/toonz/tpanels.h index db50598..2a0498a 100644 --- a/toonz/sources/toonz/tpanels.h +++ b/toonz/sources/toonz/tpanels.h @@ -24,6 +24,7 @@ class SchematicViewer; class FunctionViewer; class FlipBook; class ToolOptions; +class ComboViewerPanel; //========================================================= // PaletteViewerPanel //--------------------------------------------------------- @@ -69,6 +70,9 @@ class StudioPaletteViewerPanel final : public TPanel { public: StudioPaletteViewerPanel(QWidget *parent); + void setViewType(int viewType) override; + int getViewType() override; + protected: bool isActivatableOnEnter() override { return true; } protected slots: @@ -244,4 +248,23 @@ protected slots: void onMinimizeButtonToggled(bool); }; +//========================================================= +// ComboViewerPanel +//--------------------------------------------------------- + +class ComboViewerPanelContainer final : public StyleShortcutSwitchablePanel { + Q_OBJECT + ComboViewerPanel *m_comboViewer; + +public: + ComboViewerPanelContainer(QWidget *parent); + // reimplementation of TPanel::widgetInThisPanelIsFocused + bool widgetInThisPanelIsFocused() override; + +protected: + // reimplementation of TPanel::widgetFocusOnEnter + void widgetFocusOnEnter() override; + void widgetClearFocusOnLeave() override; +}; + #endif diff --git a/toonz/sources/toonzqt/functionpanel.cpp b/toonz/sources/toonzqt/functionpanel.cpp index b6ee8a2..85535d5 100644 --- a/toonz/sources/toonzqt/functionpanel.cpp +++ b/toonz/sources/toonzqt/functionpanel.cpp @@ -263,13 +263,11 @@ FunctionPanel::FunctionPanel(QWidget *parent, bool isFloating) if (m_isFloating) { // load the dialog size - TFilePath fp(ToonzFolder::getMyModuleDir() + TFilePath(mySettingsFileName)); - QSettings mySettings(toQString(fp), QSettings::IniFormat); + TFilePath fp(ToonzFolder::getMyModuleDir() + TFilePath("popups.ini")); + QSettings settings(toQString(fp), QSettings::IniFormat); - mySettings.beginGroup("Dialogs"); setGeometry( - mySettings.value("FunctionCurves", QRect(500, 500, 400, 300)).toRect()); - mySettings.endGroup(); + settings.value("FunctionCurves", QRect(500, 500, 400, 300)).toRect()); } } @@ -278,12 +276,10 @@ FunctionPanel::FunctionPanel(QWidget *parent, bool isFloating) FunctionPanel::~FunctionPanel() { if (m_isFloating) { // save the dialog size - TFilePath fp(ToonzFolder::getMyModuleDir() + TFilePath(mySettingsFileName)); - QSettings mySettings(toQString(fp), QSettings::IniFormat); + TFilePath fp(ToonzFolder::getMyModuleDir() + TFilePath("popups.ini")); + QSettings settings(toQString(fp), QSettings::IniFormat); - mySettings.beginGroup("Dialogs"); - mySettings.setValue("FunctionCurves", geometry()); - mySettings.endGroup(); + settings.setValue("FunctionCurves", geometry()); } delete m_dragTool; diff --git a/toonz/sources/toonzqt/functionsheet.cpp b/toonz/sources/toonzqt/functionsheet.cpp index caf0544..3b50a52 100644 --- a/toonz/sources/toonzqt/functionsheet.cpp +++ b/toonz/sources/toonzqt/functionsheet.cpp @@ -977,14 +977,11 @@ FunctionSheet::FunctionSheet(QWidget *parent, bool isFloating) if (m_isFloating) { // load the dialog size - TFilePath fp(ToonzFolder::getMyModuleDir() + TFilePath(mySettingsFileName)); - QSettings mySettings(toQString(fp), QSettings::IniFormat); - - mySettings.beginGroup("Dialogs"); - setGeometry( - mySettings.value("FunctionSpreadsheet", QRect(500, 500, 400, 300)) - .toRect()); - mySettings.endGroup(); + TFilePath fp(ToonzFolder::getMyModuleDir() + TFilePath("popups.ini")); + QSettings settings(toQString(fp), QSettings::IniFormat); + + setGeometry(settings.value("FunctionSpreadsheet", QRect(500, 500, 400, 300)) + .toRect()); } } @@ -992,12 +989,10 @@ FunctionSheet::FunctionSheet(QWidget *parent, bool isFloating) FunctionSheet::~FunctionSheet() { if (m_isFloating) { - TFilePath fp(ToonzFolder::getMyModuleDir() + TFilePath(mySettingsFileName)); - QSettings mySettings(toQString(fp), QSettings::IniFormat); + TFilePath fp(ToonzFolder::getMyModuleDir() + TFilePath("popups.ini")); + QSettings settings(toQString(fp), QSettings::IniFormat); - mySettings.beginGroup("Dialogs"); - mySettings.setValue("FunctionSpreadsheet", geometry()); - mySettings.endGroup(); + settings.setValue("FunctionSpreadsheet", geometry()); } } diff --git a/toonz/sources/toonzqt/paletteviewergui.cpp b/toonz/sources/toonzqt/paletteviewergui.cpp index f85439e..2bb782a 100644 --- a/toonz/sources/toonzqt/paletteviewergui.cpp +++ b/toonz/sources/toonzqt/paletteviewergui.cpp @@ -138,16 +138,16 @@ PageViewer::PageViewer(QWidget *parent, PaletteViewType viewType, ViewMode defaultChipSize; switch (m_viewType) { case LEVEL_PALETTE: - defaultChipSize = (ViewMode)ChipSizeManager::instance()->chipSize_Palette; + defaultChipSize = LargeChips; break; case CLEANUP_PALETTE: - defaultChipSize = (ViewMode)ChipSizeManager::instance()->chipSize_Cleanup; + defaultChipSize = SmallChips; break; case STUDIO_PALETTE: - defaultChipSize = (ViewMode)ChipSizeManager::instance()->chipSize_Studio; + defaultChipSize = MediumChips; break; default: - defaultChipSize = (ViewMode)2; + defaultChipSize = LargeChips; break; } setViewMode(defaultChipSize); @@ -246,21 +246,6 @@ void PageViewer::setViewMode(ViewMode viewMode) { m_viewMode = viewMode; computeSize(); update(); - - // keep new view mode for reproducing the same mode when a new palette is made - switch (m_viewType) { - case LEVEL_PALETTE: - ChipSizeManager::instance()->chipSize_Palette = (int)m_viewMode; - break; - case CLEANUP_PALETTE: - ChipSizeManager::instance()->chipSize_Cleanup = (int)m_viewMode; - break; - case STUDIO_PALETTE: - ChipSizeManager::instance()->chipSize_Studio = (int)m_viewMode; - break; - default: - break; - } } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzqt/studiopaletteviewer.cpp b/toonz/sources/toonzqt/studiopaletteviewer.cpp index a033f05..25f1419 100644 --- a/toonz/sources/toonzqt/studiopaletteviewer.cpp +++ b/toonz/sources/toonzqt/studiopaletteviewer.cpp @@ -1191,17 +1191,17 @@ StudioPaletteViewer::StudioPaletteViewer(QWidget *parent, treeWidget->setLayout(treeVLayout); // Second Splitter Widget - PaletteViewer *studioPaletteViewer = + m_studioPaletteViewer = new PaletteViewer(this, PaletteViewerGUI::STUDIO_PALETTE); - studioPaletteViewer->setObjectName("PaletteViewerInStudioPalette"); - studioPaletteViewer->setXsheetHandle(xsheetHandle); - studioPaletteViewer->setPaletteHandle(studioPaletteHandle); - studioPaletteViewer->setFrameHandle(frameHandle); + m_studioPaletteViewer->setObjectName("PaletteViewerInStudioPalette"); + m_studioPaletteViewer->setXsheetHandle(xsheetHandle); + m_studioPaletteViewer->setPaletteHandle(studioPaletteHandle); + m_studioPaletteViewer->setFrameHandle(frameHandle); addWidget(treeWidget); - addWidget(studioPaletteViewer); + addWidget(m_studioPaletteViewer); - setFocusProxy(studioPaletteViewer); + setFocusProxy(m_studioPaletteViewer); } //----------------------------------------------------------------------------- @@ -1214,3 +1214,16 @@ StudioPaletteViewer::~StudioPaletteViewer() {} TFilePath StudioPaletteViewer::getCurrentItemPath() { return m_studioPaletteTreeViewer->getCurrentItemPath(); } + +//----------------------------------------------------------------------------- + +int StudioPaletteViewer::getViewMode() const { + return m_studioPaletteViewer->getViewMode(); +} + +//----------------------------------------------------------------------------- + +void StudioPaletteViewer::setViewMode(int mode) { + m_studioPaletteViewer->setViewMode( + (PaletteViewerGUI::PageViewer::ViewMode)mode); +} \ No newline at end of file