Split some stuff out of the edit tool bar into move and object tool bars. The object tool bar is now located on the left side of the screen as the top one is running out of space.

Wed, 10 Apr 2013 01:51:35 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Wed, 10 Apr 2013 01:51:35 +0300
changeset 87
8dbf0fdf3374
parent 86
d7e02a4315a7
child 88
652028158792

Split some stuff out of the edit tool bar into move and object tool bars. The object tool bar is now located on the left side of the screen as the top one is running out of space.

gui.cpp file | annotate | diff | comparison | revisions
gui.h file | annotate | diff | comparison | revisions
--- a/gui.cpp	Wed Apr 10 01:27:06 2013 +0300
+++ b/gui.cpp	Wed Apr 10 01:51:35 2013 +0300
@@ -183,41 +183,56 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-#define ADD_TOOLBAR_ITEM(BAR, ACT) q##BAR##ToolBar->addAction (ACTION_NAME (ACT));
+#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));
+	addToolBar (g_ToolBarArea, qBar);
+	
+	g_CurrentToolBar = &qBar;
+}
 
 void ForgeWindow::createToolbars () {
-	qFileToolBar = new QToolBar ("File");
-	ADD_TOOLBAR_ITEM (File, newFile)
-	ADD_TOOLBAR_ITEM (File, open)
-	ADD_TOOLBAR_ITEM (File, save)
-	ADD_TOOLBAR_ITEM (File, saveAs)
-	addToolBar (qFileToolBar);
+	initSingleToolBar (qFileToolBar, "File");
+	ADD_TOOLBAR_ITEM (newFile)
+	ADD_TOOLBAR_ITEM (open)
+	ADD_TOOLBAR_ITEM (save)
+	ADD_TOOLBAR_ITEM (saveAs)
+	
+	initSingleToolBar (qInsertToolBar, "Insert");
+	ADD_TOOLBAR_ITEM (newSubfile)
+	ADD_TOOLBAR_ITEM (newLine)
+	ADD_TOOLBAR_ITEM (newTriangle)
+	ADD_TOOLBAR_ITEM (newQuad)
+	ADD_TOOLBAR_ITEM (newCondLine)
+	ADD_TOOLBAR_ITEM (newComment)
+	ADD_TOOLBAR_ITEM (newVertex)
 	
-	qInsertToolBar = new QToolBar ("Insert");
-	ADD_TOOLBAR_ITEM (Insert, newSubfile)
-	ADD_TOOLBAR_ITEM (Insert, newLine)
-	ADD_TOOLBAR_ITEM (Insert, newTriangle)
-	ADD_TOOLBAR_ITEM (Insert, newQuad)
-	ADD_TOOLBAR_ITEM (Insert, newCondLine)
-	ADD_TOOLBAR_ITEM (Insert, newComment)
-	ADD_TOOLBAR_ITEM (Insert, newVertex)
-	addToolBar (qInsertToolBar);
+	initSingleToolBar (qEditToolBar, "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);
 	
-	qEditToolBar = new QToolBar ("Edit");
-	ADD_TOOLBAR_ITEM (Edit, undo)
-	ADD_TOOLBAR_ITEM (Edit, redo)
-	ADD_TOOLBAR_ITEM (Edit, cut)
-	ADD_TOOLBAR_ITEM (Edit, copy)
-	ADD_TOOLBAR_ITEM (Edit, paste)
-	ADD_TOOLBAR_ITEM (Edit, del)
-	ADD_TOOLBAR_ITEM (Edit, moveUp)
-	ADD_TOOLBAR_ITEM (Edit, moveDown)
-	ADD_TOOLBAR_ITEM (Edit, setColor)
-	ADD_TOOLBAR_ITEM (Edit, inlineContents)
-	ADD_TOOLBAR_ITEM (Edit, splitQuads)
-	ADD_TOOLBAR_ITEM (Edit, setContents)
-	ADD_TOOLBAR_ITEM (Edit, makeBorders)
-	addToolBar (qEditToolBar);
+	initSingleToolBar (qMoveToolBar, "Move");
+	ADD_TOOLBAR_ITEM (moveUp)
+	ADD_TOOLBAR_ITEM (moveDown)
+	
+	// ==========================================
+	// Left area toolbars
+	g_ToolBarArea = Qt::LeftToolBarArea;
+	initSingleToolBar (qInsertToolBar, "Objects");
+	ADD_TOOLBAR_ITEM (setColor)
+	ADD_TOOLBAR_ITEM (inlineContents)
+	ADD_TOOLBAR_ITEM (splitQuads)
+	ADD_TOOLBAR_ITEM (setContents)
+	ADD_TOOLBAR_ITEM (makeBorders)
 }
 
 // =============================================================================
--- a/gui.h	Wed Apr 10 01:27:06 2013 +0300
+++ b/gui.h	Wed Apr 10 01:51:35 2013 +0300
@@ -101,6 +101,7 @@
 	QTextEdit* qMessageLog;
 	QMenu* qFileMenu, *qEditMenu, *qInsertMenu, *qHelpMenu;
 	QToolBar* qFileToolBar, *qEditToolBar, *qInsertToolBar;
+	QToolBar* qMoveToolBar, *qObjectToolBar;
 	
 	str zMessageLogHTML;
 	
@@ -115,7 +116,8 @@
 private:
 	void createMenuActions ();
 	void createMenus ();
-    void createToolbars ();
+	void createToolbars ();
+	void initSingleToolBar (QToolBar*& qBar, const char* sName);
 
 private slots:
 	void slot_selectionChanged ();

mercurial