diff --git a/toonz/sources/include/tools/toolhandle.h b/toonz/sources/include/tools/toolhandle.h index 4bdf60b..427c211 100644 --- a/toonz/sources/include/tools/toolhandle.h +++ b/toonz/sources/include/tools/toolhandle.h @@ -63,7 +63,7 @@ public: /*! Notify tool parameters change (out of toolOption bar).*/ void notifyToolChanged() { emit toolChanged(); } - + void notifyToolOptionsBoxChanged() { emit toolOptionsBoxChanged(); } void notifyToolCursorTypeChanged() { emit toolCursorTypeChanged(); } void notifyToolComboBoxListChanged(std::string id) { @@ -74,6 +74,7 @@ signals: void toolComboBoxListChanged(std::string); void toolSwitched(); void toolChanged(); + void toolOptionsBoxChanged(); void toolEditingFinished(); // used for changing the tool cursor when the options changed with short cut // keys assigned for tool options. diff --git a/toonz/sources/include/tools/tooloptions.h b/toonz/sources/include/tools/tooloptions.h index c66e360..a4f712b 100644 --- a/toonz/sources/include/tools/tooloptions.h +++ b/toonz/sources/include/tools/tooloptions.h @@ -776,7 +776,6 @@ public: class DVAPI ToolOptions final : public QFrame { Q_OBJECT - int m_width, m_height; std::map m_panels; QWidget *m_panel; @@ -793,6 +792,7 @@ protected: public slots: void onToolSwitched(); + void onToolOptionsBoxChanged(); void onToolChanged(); void onStageObjectChange(); diff --git a/toonz/sources/tnztools/editassistantstool.cpp b/toonz/sources/tnztools/editassistantstool.cpp index baa9f06..93b56ac 100644 --- a/toonz/sources/tnztools/editassistantstool.cpp +++ b/toonz/sources/tnztools/editassistantstool.cpp @@ -319,7 +319,7 @@ protected: public: void updateOptionsBox() - { /* getApplication()->getCurrentTool()->notifyToolOptionsBoxChanged(); */ } + { getApplication()->getCurrentTool()->notifyToolOptionsBoxChanged(); } void resetCurrentPoint(bool updateOptionsBox = true) { close(); diff --git a/toonz/sources/tnztools/tooloptions.cpp b/toonz/sources/tnztools/tooloptions.cpp index c392c85..2ca4b7c 100644 --- a/toonz/sources/tnztools/tooloptions.cpp +++ b/toonz/sources/tnztools/tooloptions.cpp @@ -2849,6 +2849,7 @@ void ToolOptions::showEvent(QShowEvent *) { if (currTool) { onToolSwitched(); connect(currTool, SIGNAL(toolSwitched()), SLOT(onToolSwitched())); + connect(currTool, SIGNAL(toolOptionsBoxChanged()), SLOT(onToolOptionsBoxChanged())); connect(currTool, SIGNAL(toolChanged()), SLOT(onToolChanged())); } @@ -2883,6 +2884,19 @@ void ToolOptions::hideEvent(QShowEvent *) { //----------------------------------------------------------------------------- +void ToolOptions::onToolOptionsBoxChanged() { + TTool *tool = TTool::getApplication()->getCurrentTool()->getTool(); + std::map::iterator it = m_panels.find(tool); + if (it != m_panels.end()) { + ToolOptionsBox *panel = it->second; + m_panels.erase(it); + layout()->removeWidget(panel); + } + onToolSwitched(); +} + +//----------------------------------------------------------------------------- + void ToolOptions::onToolSwitched() { if (m_panel) m_panel->hide(); m_panel = 0;