From 38f43a17b769df1f5c35b4065e730baa1bab3998 Mon Sep 17 00:00:00 2001 From: Rodney Date: Nov 07 2019 14:12:43 +0000 Subject: Merge pull request #2087 from manongjohn/hide_tools Disable or Hide unusable tools --- diff --git a/toonz/sources/include/tools/tool.h b/toonz/sources/include/tools/tool.h index 91e4bdd..36cdb45 100644 --- a/toonz/sources/include/tools/tool.h +++ b/toonz/sources/include/tools/tool.h @@ -502,6 +502,8 @@ transformation. QString updateEnabled(); //!< Sets the tool's \a enability and returns a //! reason in case the tool was disabled. + QString updateEnabled(int rowIndex, int columnIndex); + bool isColumnLocked(int columnIndex) const; void resetInputMethod(); //!< Resets Input Context (IME) diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index 4634d28..55c7555 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -404,6 +404,9 @@ public: void enableCursorOutline(bool on); bool isCursorOutlineEnabled() const { return m_cursorOutlineEnabled; } + void setLevelBasedToolsDisplay(int displayType); + int getLevelBasedToolsDisplay() const { return m_levelBasedToolsDisplay; } + // Xsheet tab void setXsheetStep(int step); //!< Sets the step used for the next/prev //! step commands. @@ -739,6 +742,8 @@ private: bool m_showXsheetCameraColumn = true; + int m_levelBasedToolsDisplay; + private: Preferences(); ~Preferences(); diff --git a/toonz/sources/tnztools/tool.cpp b/toonz/sources/tnztools/tool.cpp index 0205480..6a98bba 100644 --- a/toonz/sources/tnztools/tool.cpp +++ b/toonz/sources/tnztools/tool.cpp @@ -776,6 +776,13 @@ bool TTool::isColumnLocked(int columnIndex) const { //----------------------------------------------------------------------------- QString TTool::updateEnabled() { + int rowIndex = m_application->getCurrentFrame()->getFrame(); + int columnIndex = m_application->getCurrentColumn()->getColumnIndex(); + + return updateEnabled(rowIndex, columnIndex); +} + +QString TTool::updateEnabled(int rowIndex, int columnIndex) { // Disable every tool during playback if (m_application->getCurrentFrame()->isPlaying()) return (enable(false), QString()); @@ -789,14 +796,22 @@ QString TTool::updateEnabled() { // Retrieve vars and view modes TXsheet *xsh = m_application->getCurrentXsheet()->getXsheet(); - int rowIndex = m_application->getCurrentFrame()->getFrame(); - int columnIndex = m_application->getCurrentColumn()->getColumnIndex(); TXshColumn *column = (columnIndex >= 0) ? xsh->getColumn(columnIndex) : 0; TXshLevel *xl = m_application->getCurrentLevel()->getLevel(); TXshSimpleLevel *sl = xl ? xl->getSimpleLevel() : 0; int levelType = sl ? sl->getType() : NO_XSHLEVEL; + // If not in Level editor, let's use our current cell from the xsheet to + // find the nearest level before it + if (levelType == NO_XSHLEVEL && + !m_application->getCurrentFrame()->isEditingLevel()) { + TXshCell cell = xsh->getCell(rowIndex, columnIndex); + xl = cell.isEmpty() ? 0 : (TXshLevel *)(&cell.m_level); + sl = cell.isEmpty() ? 0 : cell.getSimpleLevel(); + levelType = cell.isEmpty() ? NO_XSHLEVEL : cell.m_level->getType(); + } + if (Preferences::instance()->isAutoCreateEnabled() && Preferences::instance()->isAnimationSheetEnabled()) { // If not in Level editor, let's use our current cell from the xsheet to diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 9870183..b4e07b8 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1280,6 +1280,14 @@ void PreferencesPopup::onShowXsheetCameraColumnChanged(int index) { TApp::instance()->getCurrentScene()->notifyPreferenceChanged("XsheetCamera"); } +//----------------------------------------------------------------------------- + +void PreferencesPopup::onLevelBasedToolsDisplayChanged(int index) { + m_pref->setLevelBasedToolsDisplay(index); + TApp::instance()->getCurrentScene()->notifyPreferenceChanged( + "ToolbarDisplay"); +} + //********************************************************************************** // PrefencesPopup's constructor //********************************************************************************** @@ -1512,6 +1520,13 @@ PreferencesPopup::PreferencesPopup() CheckBox *cursorOutlineCB = new CheckBox(tr("Show Cursor Size Outlines"), this); + QStringList leveBasedToolsDisplayTypes; + leveBasedToolsDisplayTypes << tr("Default") + << tr("Enable Tools For Level Only") + << tr("Show Tools For Level Only"); + m_levelBasedToolsDisplayCB = new QComboBox(this); + m_levelBasedToolsDisplayCB->addItems(leveBasedToolsDisplayTypes); + //--- Xsheet ------------------------------ categoryList->addItem(tr("Xsheet")); @@ -1916,6 +1931,9 @@ PreferencesPopup::PreferencesPopup() m_cursorBrushStyle->findData(m_pref->getCursorBrushStyle())); cursorOutlineCB->setChecked(m_pref->isCursorOutlineEnabled()); + m_levelBasedToolsDisplayCB->setCurrentIndex( + m_pref->getLevelBasedToolsDisplay()); + //--- Xsheet ------------------------------ xsheetAutopanDuringPlaybackCB->setChecked(m_pref->isXsheetAutopanEnabled()); m_cellsDragBehaviour->addItem(tr("Cells Only")); @@ -2519,6 +2537,10 @@ PreferencesPopup::PreferencesPopup() cursorStyleGroupBox->setLayout(cursorStylesLay); } ToolsTopLay->addWidget(cursorStyleGroupBox, 3, 0, 1, 3); + + ToolsTopLay->addWidget(new QLabel(tr("Toolbar Display Behaviour:")), 4, + 0, Qt::AlignRight | Qt::AlignVCenter); + ToolsTopLay->addWidget(m_levelBasedToolsDisplayCB, 4, 1); } toolsFrameLay->addLayout(ToolsTopLay, 0); @@ -3021,6 +3043,9 @@ PreferencesPopup::PreferencesPopup() this, SLOT(onCursorBrushStyleChanged(int))); ret = ret && connect(cursorOutlineCB, SIGNAL(stateChanged(int)), this, SLOT(onCursorOutlineChanged(int))); + ret = ret && + connect(m_levelBasedToolsDisplayCB, SIGNAL(currentIndexChanged(int)), + SLOT(onLevelBasedToolsDisplayChanged(int))); //--- Xsheet ---------------------- ret = ret && connect(xsheetAutopanDuringPlaybackCB, SIGNAL(stateChanged(int)), diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h index db5047d..ff316f8 100644 --- a/toonz/sources/toonz/preferencespopup.h +++ b/toonz/sources/toonz/preferencespopup.h @@ -57,7 +57,8 @@ private: *m_columnIconOm, *m_unitOm, *m_cameraUnitOm, *m_importPolicy, *m_vectorSnappingTargetCB, *m_dropdownShortcutsCycleOptionsCB, *m_guidedDrawingStyle, *m_functionEditorToggle, *m_cursorBrushType, - *m_cursorBrushStyle, *m_xsheetLayout, *m_interfaceFontStyle; + *m_cursorBrushStyle, *m_xsheetLayout, *m_interfaceFontStyle, + *m_levelBasedToolsDisplayCB; QFontComboBox *m_interfaceFont; @@ -226,6 +227,7 @@ private slots: void onRasterBackgroundColorChanged(const TPixel32 &, bool isDragging); void onBackupKeepCountChanged(); void onShowXsheetCameraColumnChanged(int index); + void onLevelBasedToolsDisplayChanged(int); }; //********************************************************************************** diff --git a/toonz/sources/toonz/toolbar.cpp b/toonz/sources/toonz/toolbar.cpp index d79eda9..dbd6b40 100755 --- a/toonz/sources/toonz/toolbar.cpp +++ b/toonz/sources/toonz/toolbar.cpp @@ -10,6 +10,16 @@ #include "toonzqt/menubarcommand.h" #include "menubarcommandids.h" +#include "toonz/txshleveltypes.h" +#include "toonz/txshlevelhandle.h" +#include "toonz/tframehandle.h" +#include "toonz/txsheethandle.h" +#include "toonz/txshcell.h" +#include "toonz/txshsimplelevel.h" +#include "toonz/tcolumnhandle.h" +#include "toonz/preferences.h" +#include "toonz/tscenehandle.h" + // TnzBase includes #include "tenv.h" @@ -17,9 +27,33 @@ #include #include #include +#include TEnv::IntVar ShowAllToolsToggle("ShowAllToolsToggle", 0); +namespace { +struct { + const char *toolName; + bool collapsable; + QAction *action; +} buttonLayout[] = {{T_Edit, false, 0}, {T_Selection, false, 0}, + {"Separator_1", false, 0}, {T_Brush, false, 0}, + {T_Geometric, false, 0}, {T_Type, true, 0}, + {T_Fill, false, 0}, {T_PaintBrush, false, 0}, + {"Separator_2", false, 0}, {T_Eraser, false, 0}, + {T_Tape, false, 0}, {T_Finger, false, 0}, + {"Separator_3", false, 0}, {T_StylePicker, false, 0}, + {T_RGBPicker, false, 0}, {T_Ruler, false, 0}, + {"Separator_4", false, 0}, {T_ControlPointEditor, false, 0}, + {T_Pinch, true, 0}, {T_Pump, true, 0}, + {T_Magnet, true, 0}, {T_Bender, true, 0}, + {T_Iron, true, 0}, {T_Cutter, true, 0}, + {"Separator_5", false, 0}, {T_Skeleton, true, 0}, + {T_Tracker, true, 0}, {T_Hook, true, 0}, + {T_Plastic, true, 0}, {"Separator_6", false, 0}, + {T_Zoom, false, 0}, {T_Rotate, true, 0}, + {T_Hand, false, 0}, {0, false, 0}}; +} //============================================================================= // Toolbar //----------------------------------------------------------------------------- @@ -38,139 +72,144 @@ Toolbar::Toolbar(QWidget *parent, bool isVertical) setIconSize(QSize(23, 23)); setToolButtonStyle(Qt::ToolButtonIconOnly); - bool actionAdded = addAction(CommandManager::instance()->getAction(T_Edit)); - actionAdded = addAction(CommandManager::instance()->getAction(T_Selection)) || - actionAdded; - if (actionAdded) addSeparator(); - actionAdded = false; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Brush)) || actionAdded; - actionAdded = addAction(CommandManager::instance()->getAction(T_Geometric)) || - actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Type)) || actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Fill)) || actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_PaintBrush)) || - actionAdded; - if (actionAdded) addSeparator(); - actionAdded = false; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Eraser)) || actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Tape)) || actionAdded; - actionAdded = addAction(CommandManager::instance()->getAction(T_Finger)); - if (actionAdded) addSeparator(); - actionAdded = false; - actionAdded = - addAction(CommandManager::instance()->getAction(T_StylePicker)) || - actionAdded; - actionAdded = addAction(CommandManager::instance()->getAction(T_RGBPicker)) || - actionAdded; - actionAdded = addAction(CommandManager::instance()->getAction(T_Ruler)); - if (actionAdded) addSeparator(); - actionAdded = false; - actionAdded = - addAction(CommandManager::instance()->getAction(T_ControlPointEditor)) || - actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Pinch)) || actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Pump)) || actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Magnet)) || actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Bender)) || actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Iron)) || actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Cutter)) || actionAdded; - if (actionAdded) m_sep1 = addSeparator(); - actionAdded = false; - actionAdded = addAction(CommandManager::instance()->getAction(T_Skeleton)) || - actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Hook)) || actionAdded; - actionAdded = addAction(CommandManager::instance()->getAction(T_Tracker)) || - actionAdded; - actionAdded = addAction(CommandManager::instance()->getAction(T_Plastic)) || - actionAdded; - if (actionAdded) m_sep2 = addSeparator(); - actionAdded = false; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Zoom)) || actionAdded; - if (actionAdded) - CommandManager::instance()->getAction(T_Zoom)->setChecked(true); - actionAdded = - addAction(CommandManager::instance()->getAction(T_Rotate)) || actionAdded; - actionAdded = - addAction(CommandManager::instance()->getAction(T_Hand)) || actionAdded; - m_expandButton = new QToolButton(this); m_expandButton->setObjectName("expandButton"); m_expandButton->setCheckable(true); m_expandButton->setChecked(m_isExpanded); m_expandButton->setArrowType((isVertical) ? Qt::DownArrow : Qt::RightArrow); - addWidget(m_expandButton); - - // toolbar is expanded or shrinked according to env at the beginning - updateToolbar(); + m_expandAction = addWidget(m_expandButton); connect(m_expandButton, SIGNAL(toggled(bool)), this, SLOT(setIsExpanded(bool))); + + updateToolbar(); } //----------------------------------------------------------------------------- /*! Layout the tool buttons according to the state of the expandButton */ void Toolbar::updateToolbar() { - if (m_isExpanded) { - insertAction(CommandManager::instance()->getAction(T_Fill), - CommandManager::instance()->getAction(T_Type)); - insertAction(CommandManager::instance()->getAction(T_Hand), - CommandManager::instance()->getAction(T_Rotate)); - insertAction(m_sep2, CommandManager::instance()->getAction(T_Plastic)); - insertAction(CommandManager::instance()->getAction(T_Plastic), - CommandManager::instance()->getAction(T_Hook)); - insertAction(CommandManager::instance()->getAction(T_Hook), - CommandManager::instance()->getAction(T_Tracker)); - insertAction(CommandManager::instance()->getAction(T_Tracker), - CommandManager::instance()->getAction(T_Skeleton)); - insertAction(CommandManager::instance()->getAction(T_Skeleton), m_sep1); - insertAction(m_sep1, CommandManager::instance()->getAction(T_Cutter)); - insertAction(CommandManager::instance()->getAction(T_Cutter), - CommandManager::instance()->getAction(T_Iron)); - insertAction(CommandManager::instance()->getAction(T_Iron), - CommandManager::instance()->getAction(T_Bender)); - insertAction(CommandManager::instance()->getAction(T_Bender), - CommandManager::instance()->getAction(T_Magnet)); - insertAction(CommandManager::instance()->getAction(T_Magnet), - CommandManager::instance()->getAction(T_Pump)); - insertAction(CommandManager::instance()->getAction(T_Pump), - CommandManager::instance()->getAction(T_Pinch)); + TApp *app = TApp::instance(); + TFrameHandle *frameHandle = app->getCurrentFrame(); + + if (frameHandle->isPlaying()) return; + + TXshLevelHandle *currlevel = app->getCurrentLevel(); + TXshLevel *level = currlevel ? currlevel->getLevel() : 0; + int levelType = level ? level->getType() : NO_XSHLEVEL; + + TColumnHandle *colHandle = app->getCurrentColumn(); + int colIndex = colHandle->getColumnIndex(); + + int rowIndex = frameHandle->getFrameIndex(); + + if (Preferences::instance()->isAutoCreateEnabled() && + Preferences::instance()->isAnimationSheetEnabled()) { + // If in an empty cell, find most recent level + if (levelType == NO_XSHLEVEL) { + TXsheetHandle *xshHandle = app->getCurrentXsheet(); + TXsheet *xsh = xshHandle->getXsheet(); + + if (colIndex >= 0 && !xsh->isColumnEmpty(colIndex)) { + int r0, r1; + xsh->getCellRange(colIndex, r0, r1); + if (0 <= r0 && r0 <= r1) { + // level type depends on previous occupied cell + for (int r = min(r1, rowIndex); r >= r0; r--) { + TXshCell cell = xsh->getCell(r, colIndex); + if (cell.isEmpty()) continue; + levelType = cell.m_level->getType(); + rowIndex = r; + break; + } + + if (levelType == NO_XSHLEVEL) { + TXshCell cell = xsh->getCell(r0, colIndex); + levelType = cell.m_level->getType(); + rowIndex = r0; + } + } + } + } + } + + m_toolbarLevel = levelType; + + TTool::ToolTargetType targetType = TTool::NoTarget; + + switch (m_toolbarLevel) { + case OVL_XSHLEVEL: + targetType = TTool::RasterImage; + break; + case TZP_XSHLEVEL: + targetType = TTool::ToonzImage; + break; + case PLI_XSHLEVEL: + default: + targetType = TTool::VectorImage; + break; + case MESH_XSHLEVEL: + targetType = TTool::MeshImage; + break; + } + + // Hide action for now + for (int idx = 0; buttonLayout[idx].toolName; idx++) { + if (buttonLayout[idx].action) removeAction(buttonLayout[idx].action); + } + + removeAction(m_expandAction); + + int levelBasedDisplay = Preferences::instance()->getLevelBasedToolsDisplay(); + + bool actionEnabled = false; + ToolHandle *toolHandle = TApp::instance()->getCurrentTool(); + for (int idx = 0; buttonLayout[idx].toolName; idx++) { + TTool *tool = TTool::getTool(buttonLayout[idx].toolName, targetType); + if (tool) tool->updateEnabled(rowIndex, colIndex); + bool isSeparator = !strncmp(buttonLayout[idx].toolName, "Separator", 9); + bool enable = + !levelBasedDisplay ? true : (!tool ? actionEnabled : tool->isEnabled()); + + // Plastic tool should always be available so you can create a mesh + if (!enable && !strncmp(buttonLayout[idx].toolName, T_Plastic, 9) && + (m_toolbarLevel & LEVELCOLUMN_XSHLEVEL)) + enable = true; + + if (!buttonLayout[idx].action) { + if (isSeparator) + buttonLayout[idx].action = addSeparator(); + else + buttonLayout[idx].action = + CommandManager::instance()->getAction(buttonLayout[idx].toolName); + } + + if (!m_isExpanded && buttonLayout[idx].collapsable) continue; + + if (levelBasedDisplay != 2) + buttonLayout[idx].action->setEnabled(enable); + else if (!enable) + continue; + + actionEnabled = addAction(buttonLayout[idx].action) || actionEnabled; + + if (isSeparator) actionEnabled = false; + } + + addAction(m_expandAction); + + if (m_isExpanded) { m_expandButton->setArrowType( (orientation() == Qt::Vertical) ? Qt::UpArrow : Qt::LeftArrow); - + m_expandButton->setToolTip(tr("Collapse toolbar")); } else { - removeAction(CommandManager::instance()->getAction(T_Type)); - removeAction(CommandManager::instance()->getAction(T_Pinch)); - removeAction(CommandManager::instance()->getAction(T_Pump)); - removeAction(CommandManager::instance()->getAction(T_Magnet)); - removeAction(CommandManager::instance()->getAction(T_Bender)); - removeAction(CommandManager::instance()->getAction(T_Iron)); - removeAction(CommandManager::instance()->getAction(T_Cutter)); - removeAction(CommandManager::instance()->getAction(T_Skeleton)); - removeAction(CommandManager::instance()->getAction(T_Tracker)); - removeAction(CommandManager::instance()->getAction(T_Hook)); - removeAction(CommandManager::instance()->getAction(T_Plastic)); - removeAction(CommandManager::instance()->getAction(T_Rotate)); - removeAction(m_sep1); m_expandButton->setArrowType( (orientation() == Qt::Vertical) ? Qt::DownArrow : Qt::RightArrow); + m_expandButton->setToolTip(tr("Expand toolbar")); } + update(); } @@ -197,15 +236,50 @@ bool Toolbar::addAction(QAction *act) { //----------------------------------------------------------------------------- void Toolbar::showEvent(QShowEvent *e) { + TColumnHandle *columnHandle = TApp::instance()->getCurrentColumn(); + connect(columnHandle, SIGNAL(columnIndexSwitched()), this, + SLOT(updateToolbar())); + + TFrameHandle *frameHandle = TApp::instance()->getCurrentFrame(); + connect(frameHandle, SIGNAL(frameSwitched()), this, SLOT(updateToolbar())); + connect(frameHandle, SIGNAL(frameTypeChanged()), this, SLOT(updateToolbar())); + + TXsheetHandle *xsheetHandle = TApp::instance()->getCurrentXsheet(); + connect(xsheetHandle, SIGNAL(xsheetChanged()), this, SLOT(updateToolbar())); + connect(TApp::instance()->getCurrentTool(), SIGNAL(toolSwitched()), SLOT(onToolChanged())); + + TXshLevelHandle *levelHandle = TApp::instance()->getCurrentLevel(); + connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, + SLOT(updateToolbar())); + + connect(TApp::instance()->getCurrentScene(), + SIGNAL(preferenceChanged(const QString &)), this, + SLOT(onPreferenceChanged(const QString &))); } //----------------------------------------------------------------------------- void Toolbar::hideEvent(QHideEvent *e) { + disconnect(TApp::instance()->getCurrentLevel(), 0, this, 0); disconnect(TApp::instance()->getCurrentTool(), SIGNAL(toolSwitched()), this, SLOT(onToolChanged())); + + disconnect(TApp::instance()->getCurrentColumn(), + SIGNAL(columnIndexSwitched()), this, SLOT(updateToolbar())); + + disconnect(TApp::instance()->getCurrentFrame(), SIGNAL(frameSwitched()), this, + SLOT(updateToolbar())); + disconnect(TApp::instance()->getCurrentFrame(), SIGNAL(frameTypeChanged()), + this, SLOT(updateToolbar())); + + disconnect(TApp::instance()->getCurrentXsheet(), SIGNAL(xsheetChanged()), + this, SLOT(updateToolbar())); + + disconnect(TApp::instance()->getCurrentScene(), + SIGNAL(preferenceChanged(const QString &)), this, + SLOT(onPreferenceChanged(const QString &))); } //----------------------------------------------------------------------------- @@ -219,6 +293,12 @@ void Toolbar::onToolChanged() { act->setChecked(true); } +//----------------------------------------------------------------------------- + +void Toolbar::onPreferenceChanged(const QString &prefName) { + if (prefName == "ToolbarDisplay" || prefName.isEmpty()) updateToolbar(); +} + //============================================================================= OpenFloatingPanel openToolbarPane(MI_OpenToolbar, "ToolBar", ""); diff --git a/toonz/sources/toonz/toolbar.h b/toonz/sources/toonz/toolbar.h index 2ce8844..ff2803b 100755 --- a/toonz/sources/toonz/toolbar.h +++ b/toonz/sources/toonz/toolbar.h @@ -10,11 +10,11 @@ class QToolButton; class Toolbar final : public QToolBar { Q_OBJECT + std::map m_toolbarList; QToolButton *m_expandButton; - QAction *m_sep1, *m_sep2; + QAction *m_expandAction; bool m_isExpanded; - - void updateToolbar(); + int m_toolbarLevel; public: Toolbar(QWidget *parent, bool isVertical = true); @@ -28,7 +28,9 @@ protected: protected slots: void onToolChanged(); + void onPreferenceChanged(const QString &prefName); void setIsExpanded(bool expand); + void updateToolbar(); }; #endif // TOOLBAR_H diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 095deba..bcda2ce 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -349,7 +349,8 @@ Preferences::Preferences() , m_useOnionColorsForShiftAndTraceGhosts(true) , m_rasterBackgroundColor(TPixel::White) , m_backupKeepCount(1) - , m_showXsheetCameraColumn(true) { + , m_showXsheetCameraColumn(true) + , m_levelBasedToolsDisplay(0) { TCamera camera; m_defLevelType = TZP_XSHLEVEL; m_defLevelWidth = camera.getSize().lx; @@ -731,6 +732,8 @@ Preferences::Preferences() TImageWriter::setBackgroundColor(m_rasterBackgroundColor); getValue(*m_settings, "showXsheetCameraColumn", m_showXsheetCameraColumn); + + getValue(*m_settings, "levelBasedToolsDisplay", m_levelBasedToolsDisplay); } //----------------------------------------------------------------- @@ -1792,3 +1795,8 @@ void Preferences::enableXsheetCameraColumn(bool on) { m_showXsheetCameraColumn = on; m_settings->setValue("showXsheetCameraColumn", on ? "1" : "0"); } + +void Preferences::setLevelBasedToolsDisplay(int displayType) { + m_levelBasedToolsDisplay = displayType; + m_settings->setValue("levelBasedToolsDisplay", displayType); +} \ No newline at end of file