Wed, 10 Apr 2013 02:22:35 +0300
Allow the user to alter the tool bar icon size
gui.cpp | file | annotate | diff | comparison | revisions | |
gui.h | file | annotate | diff | comparison | revisions | |
ldtypes.cpp | file | annotate | diff | comparison | revisions | |
zz_configDialog.cpp | file | annotate | diff | comparison | revisions | |
zz_configDialog.h | file | annotate | diff | comparison | revisions |
--- a/gui.cpp Wed Apr 10 01:51:35 2013 +0300 +++ b/gui.cpp Wed Apr 10 02:22:35 2013 +0300 @@ -59,7 +59,9 @@ EXTERN_ACTION (redo) vector<actionmeta> g_ActionMeta; + cfg (bool, lv_colorize, true); +cfg (int, gui_toolbar_iconsize, 24); // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -183,26 +185,26 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -#define ADD_TOOLBAR_ITEM(ACT) (*g_CurrentToolBar)->addAction (ACTION_NAME (ACT)); -static QToolBar** g_CurrentToolBar; +#define ADD_TOOLBAR_ITEM(ACT) g_CurrentToolBar->addAction (ACTION_NAME (ACT)); +static QToolBar* g_CurrentToolBar; static Qt::ToolBarArea g_ToolBarArea = Qt::TopToolBarArea; -void ForgeWindow::initSingleToolBar (QToolBar*& qBar, const char* sName) { - qBar = new QToolBar (sName); - qBar->setIconSize (QSize (24, 24)); +void ForgeWindow::initSingleToolBar (const char* sName) { + QToolBar* qBar = new QToolBar (sName); addToolBar (g_ToolBarArea, qBar); + qaToolBars.push_back (qBar); - g_CurrentToolBar = &qBar; + g_CurrentToolBar = qBar; } void ForgeWindow::createToolbars () { - initSingleToolBar (qFileToolBar, "File"); + initSingleToolBar ("File"); ADD_TOOLBAR_ITEM (newFile) ADD_TOOLBAR_ITEM (open) ADD_TOOLBAR_ITEM (save) ADD_TOOLBAR_ITEM (saveAs) - initSingleToolBar (qInsertToolBar, "Insert"); + initSingleToolBar ("Insert"); ADD_TOOLBAR_ITEM (newSubfile) ADD_TOOLBAR_ITEM (newLine) ADD_TOOLBAR_ITEM (newTriangle) @@ -211,28 +213,35 @@ ADD_TOOLBAR_ITEM (newComment) ADD_TOOLBAR_ITEM (newVertex) - initSingleToolBar (qEditToolBar, "Edit"); + initSingleToolBar ("Edit"); ADD_TOOLBAR_ITEM (undo) ADD_TOOLBAR_ITEM (redo) ADD_TOOLBAR_ITEM (cut) ADD_TOOLBAR_ITEM (copy) ADD_TOOLBAR_ITEM (paste) ADD_TOOLBAR_ITEM (del) - addToolBar (qEditToolBar); - initSingleToolBar (qMoveToolBar, "Move"); + initSingleToolBar ("Move"); ADD_TOOLBAR_ITEM (moveUp) ADD_TOOLBAR_ITEM (moveDown) // ========================================== // Left area toolbars g_ToolBarArea = Qt::LeftToolBarArea; - initSingleToolBar (qInsertToolBar, "Objects"); + initSingleToolBar ("Objects"); ADD_TOOLBAR_ITEM (setColor) ADD_TOOLBAR_ITEM (inlineContents) ADD_TOOLBAR_ITEM (splitQuads) ADD_TOOLBAR_ITEM (setContents) ADD_TOOLBAR_ITEM (makeBorders) + + updateToolBars (); +} + +void ForgeWindow::updateToolBars () { + for (QToolBar* qBar : qaToolBars) { + qBar->setIconSize (QSize (gui_toolbar_iconsize, gui_toolbar_iconsize)); + } } // =============================================================================
--- a/gui.h Wed Apr 10 01:51:35 2013 +0300 +++ b/gui.h Wed Apr 10 02:22:35 2013 +0300 @@ -100,8 +100,7 @@ QTreeWidget* qObjList; QTextEdit* qMessageLog; QMenu* qFileMenu, *qEditMenu, *qInsertMenu, *qHelpMenu; - QToolBar* qFileToolBar, *qEditToolBar, *qInsertToolBar; - QToolBar* qMoveToolBar, *qObjectToolBar; + std::vector<QToolBar*> qaToolBars; str zMessageLogHTML; @@ -112,12 +111,13 @@ std::vector<LDObject*> getSelectedObjects (); ulong getInsertionPoint (); void deleteSelection (); + void updateToolBars (); private: void createMenuActions (); void createMenus (); void createToolbars (); - void initSingleToolBar (QToolBar*& qBar, const char* sName); + void initSingleToolBar (const char* sName); private slots: void slot_selectionChanged ();
--- a/ldtypes.cpp Wed Apr 10 01:51:35 2013 +0300 +++ b/ldtypes.cpp Wed Apr 10 02:22:35 2013 +0300 @@ -180,10 +180,10 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= const char* LDBFC::saStatements[] = { + "CERTIFY CCW", "CCW", + "CERTIFY CW", "CW", - "CERTIFY CCW", - "CERTIFY CW", "NOCERTIFY", "INVERTNEXT", };
--- a/zz_configDialog.cpp Wed Apr 10 01:51:35 2013 +0300 +++ b/zz_configDialog.cpp Wed Apr 10 02:22:35 2013 +0300 @@ -34,6 +34,7 @@ extern_cfg (bool, gl_colorbfc); extern_cfg (float, gl_maincolor_alpha); extern_cfg (int, gl_linethickness); +extern_cfg (int, gui_toolbar_iconsize); ConfigDialog* g_ConfigDialog = nullptr; @@ -105,6 +106,11 @@ makeSlider (qGLLineThickness, 1, 8, gl_linethickness); // ========================================================================= + // Tool bar icon size slider + qToolBarIconSizeLabel = new QLabel ("Toolbar icon size:"); + makeSlider (qToolBarIconSize, 1, 5, (gui_toolbar_iconsize - 12) / 4); + + // ========================================================================= // List view colorizer and BFC red/green view checkboxes qLVColorize = new QCheckBox ("Colorize polygons in list view"); INIT_CHECKBOX (qLVColorize, lv_colorize) @@ -127,8 +133,11 @@ layout->addWidget (qGLForegroundAlphaLabel, 2, 2); layout->addWidget (qGLForegroundAlpha, 2, 3); - layout->addWidget (qLVColorize, 3, 0, 1, 2); - layout->addWidget (qGLColorBFC, 3, 2, 1, 2); + layout->addWidget (qToolBarIconSizeLabel, 3, 0); + layout->addWidget (qToolBarIconSize, 3, 1); + + layout->addWidget (qLVColorize, 4, 0, 1, 2); + layout->addWidget (qGLColorBFC, 4, 2, 1, 2); qMainTab->setLayout (layout); // Add the tab to the manager @@ -332,6 +341,7 @@ gl_maincolor_alpha = ((double)dlg.qGLForegroundAlpha->value ()) / 10.0f; gl_linethickness = dlg.qGLLineThickness->value (); + gui_toolbar_iconsize = (dlg.qToolBarIconSize->value () * 4) + 12; // Save the config config::save (); @@ -341,6 +351,7 @@ window->R->setBackground (); window->refresh (); + window->updateToolBars (); } }
--- a/zz_configDialog.h Wed Apr 10 01:51:35 2013 +0300 +++ b/zz_configDialog.h Wed Apr 10 02:22:35 2013 +0300 @@ -36,12 +36,12 @@ // Main tab widgets QLabel* qLDrawPathLabel; QLabel* qGLBackgroundLabel, *qGLForegroundLabel, *qGLForegroundAlphaLabel; - QLabel* qGLLineThicknessLabel; + QLabel* qGLLineThicknessLabel, *qToolBarIconSizeLabel; QLineEdit* qLDrawPath; QPushButton* qLDrawPathFindButton; QPushButton* qGLBackgroundButton, *qGLForegroundButton; QCheckBox* qLVColorize, *qGLColorBFC; - QSlider* qGLForegroundAlpha, *qGLLineThickness; + QSlider* qGLForegroundAlpha, *qGLLineThickness, *qToolBarIconSize; // ========================================================================= // Shortcuts tab