diff --git a/images/Arrowhead-Right-32.png b/images/Arrowhead-Right-32.png new file mode 100644 index 00000000..42dd282b Binary files /dev/null and b/images/Arrowhead-Right-32.png differ diff --git a/images/Document-New-128.png b/images/Document-New-128.png new file mode 100644 index 00000000..7225b928 Binary files /dev/null and b/images/Document-New-128.png differ diff --git a/images/Open-128.png b/images/Open-128.png new file mode 100644 index 00000000..c552c697 Binary files /dev/null and b/images/Open-128.png differ diff --git a/images/Save-128.png b/images/Save-128.png new file mode 100644 index 00000000..f56c70b1 Binary files /dev/null and b/images/Save-128.png differ diff --git a/images/axes.png b/images/axes.png new file mode 100644 index 00000000..e7cb8e1f Binary files /dev/null and b/images/axes.png differ diff --git a/images/back.png b/images/back.png new file mode 100644 index 00000000..35d26464 Binary files /dev/null and b/images/back.png differ diff --git a/bottom.png b/images/bottom.png similarity index 100% rename from bottom.png rename to images/bottom.png diff --git a/images/down.png b/images/down.png new file mode 100644 index 00000000..149ccb5e Binary files /dev/null and b/images/down.png differ diff --git a/images/front.png b/images/front.png new file mode 100644 index 00000000..5e791c04 Binary files /dev/null and b/images/front.png differ diff --git a/images/grid.png b/images/grid.png new file mode 100644 index 00000000..1b300627 Binary files /dev/null and b/images/grid.png differ diff --git a/left.png b/images/left.png similarity index 100% rename from left.png rename to images/left.png diff --git a/images/openscad.png b/images/openscad.png new file mode 100644 index 00000000..11f807eb Binary files /dev/null and b/images/openscad.png differ diff --git a/images/right.png b/images/right.png new file mode 100644 index 00000000..0635ca38 Binary files /dev/null and b/images/right.png differ diff --git a/images/up.png b/images/up.png new file mode 100644 index 00000000..ec525008 Binary files /dev/null and b/images/up.png differ diff --git a/openscad.pro b/openscad.pro index 2051914f..d43fd5fd 100644 --- a/openscad.pro +++ b/openscad.pro @@ -307,7 +307,7 @@ src/FontCache.h \ \ src/AutoUpdater.h \ src/legacyeditor.h \ - src/scadlexer.h + src/toolbar.h SOURCES += src/version_check.cc \ src/ProgressWidget.cc \ @@ -362,9 +362,9 @@ SOURCES += src/version_check.cc \ src/ModuleCache.cc \ src/GeometryCache.cc \ src/Tree.cc \ -src/DrawingCallback.cc \ -src/FreetypeRenderer.cc \ -src/FontCache.cc \ + src/DrawingCallback.cc \ + src/FreetypeRenderer.cc \ + src/FontCache.cc \ \ src/rendersettings.cc \ src/highlighter.cc \ @@ -395,7 +395,7 @@ src/FontCache.cc \ src/mainwin.cc \ src/FontListDialog.cc \ src/legacyeditor.cc \ - src/scadlexer.cpp + src/toolbar.cpp # ClipperLib SOURCES += src/polyclipping/clipper.cpp diff --git a/openscad.qrc b/openscad.qrc index 6a578f9d..2f7aa662 100644 --- a/openscad.qrc +++ b/openscad.qrc @@ -8,19 +8,19 @@ icons/prefsUpdate.png icons/flattr.png src/AboutDialog.html - Arrowhead-Right-32.png - axes.png - back.png - bottom.png - Document-New-128.png - down.png - front.png - grid.png - left.png - Open-128.png - openscad.png - right.png - Save-128.png - up.png + images/Arrowhead-Right-32.png + images/axes.png + images/back.png + images/Document-New-128.png + images/down.png + images/front.png + images/grid.png + images/Open-128.png + images/openscad.png + images/right.png + images/Save-128.png + images/up.png + images/bottom.png + images/left.png diff --git a/src/MainWindow.h b/src/MainWindow.h index 84e5d5f3..4175ff08 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -8,6 +8,7 @@ #include "Tree.h" #include "memory.h" #include "editor.h" +#include "toolbar.h" #include #include #include @@ -110,6 +111,7 @@ private: void setDockWidgetTitle(QDockWidget *dockWidget, QString prefix, bool topLevel); EditorInterface *editor; + ToolBar *toolBar; class QMessageBox *openglbox; class FontListDialog *font_list_dialog; diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 2c952a38..9f4016e1 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -440,30 +440,6 @@ - - - toolBar - - - TopToolBarArea - - - false - - - - - - - - - - - - - - - diff --git a/src/mainwin.cc b/src/mainwin.cc index 80cadb93..1124c5c8 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -269,8 +269,9 @@ MainWindow::MainWindow(const QString &filename) connect(this->appActionUpdateCheck, SIGNAL(triggered()), this, SLOT(actionUpdateCheck())); #endif #endif + // File menu - connect(this->fileActionNew, SIGNAL(triggered()), this, SLOT(actionNew())); + connect(this->fileActionNew, SIGNAL(triggered()), this, SLOT(actionNew())); connect(this->fileActionOpen, SIGNAL(triggered()), this, SLOT(actionOpen())); connect(this->fileActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); connect(this->fileActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); @@ -445,7 +446,24 @@ MainWindow::MainWindow(const QString &filename) connect(this->replaceAllButton, SIGNAL(clicked()), this, SLOT(replaceAll())); connect(this->replaceInputField, SIGNAL(returnPressed()), this->replaceButton, SLOT(animateClick())); - toolBar->setStyleSheet("QToolBar{background-color:black;}"); + + //Toolbar + toolBar = new ToolBar(this); + verticalLayout_2->addWidget(toolBar); + connect(toolBar->buttonNew, SIGNAL(clicked()), this, SLOT(actionNew())); + connect(toolBar->buttonOpen, SIGNAL(clicked()), this, SLOT(actionOpen())); + connect(toolBar->buttonSave, SIGNAL(clicked()), this, SLOT(actionSave())); + connect(toolBar->buttonRender, SIGNAL(clicked()), this, SLOT(actionRender())); + connect(toolBar->buttonTop, SIGNAL(clicked()), this, SLOT(viewAngleTop())); + connect(toolBar->buttonBottom, SIGNAL(clicked()), this, SLOT(viewAngleBottom())); + connect(toolBar->buttonLeft, SIGNAL(clicked()), this, SLOT(viewAngleLeft())); + connect(toolBar->buttonRight, SIGNAL(clicked()), this, SLOT(viewAngleRight())); + connect(toolBar->buttonFront, SIGNAL(clicked()), this, SLOT(viewAngleFront())); + connect(toolBar->buttonBack, SIGNAL(clicked()), this, SLOT(viewAngleBack())); + + toolBar->setStyleSheet("QToolBar{background-color:black;}" + "QToolButton:hover{background-color:green;}"); + // make sure it looks nice.. QSettings settings; QByteArray windowState = settings.value("window/state", QByteArray()).toByteArray(); diff --git a/src/toolbar.cpp b/src/toolbar.cpp new file mode 100644 index 00000000..061a09c2 --- /dev/null +++ b/src/toolbar.cpp @@ -0,0 +1,48 @@ +#include "toolbar.h" + +ToolBar::ToolBar(QWidget *parent) : + QToolBar(parent) +{ + buttonNew = new QToolButton; + buttonNew->setIcon(QIcon("://images/Document-New-128.png")); + + buttonOpen = new QToolButton; + buttonOpen->setIcon(QIcon("://images/Open-128.png")); + + buttonSave = new QToolButton; + buttonSave->setIcon(QIcon("://images/Save-128.png")); + + buttonRender = new QToolButton; + buttonRender->setIcon(QIcon("://images/Arrowhead-Right-32.png")); + + buttonTop = new QToolButton; + buttonTop->setIcon(QIcon("://images/up.png")); + + buttonBottom = new QToolButton; + buttonBottom->setIcon(QIcon("://images/bottom.png")); + + buttonLeft = new QToolButton; + buttonLeft->setIcon(QIcon("://images/left.png")); + + buttonRight = new QToolButton; + buttonRight->setIcon(QIcon("://images/right.png")); + + buttonFront = new QToolButton; + buttonFront->setIcon(QIcon("://images/front.png")); + + buttonBack = new QToolButton; + buttonBack->setIcon(QIcon("://images/back.png")); + + this->addWidget(buttonNew); + this->addWidget(buttonOpen); + this->addWidget(buttonSave); + this->addWidget(buttonRender); + this->addSeparator(); + this->addWidget(buttonTop); + this->addWidget(buttonBottom); + this->addWidget(buttonLeft); + this->addWidget(buttonRight); + this->addWidget(buttonFront); + this->addWidget(buttonBack); + +} diff --git a/src/toolbar.h b/src/toolbar.h new file mode 100644 index 00000000..a743d6ff --- /dev/null +++ b/src/toolbar.h @@ -0,0 +1,21 @@ +#ifndef TOOLBAR_H +#define TOOLBAR_H + +#include +#include +class ToolBar : public QToolBar +{ + Q_OBJECT +public: + explicit ToolBar(QWidget *parent = 0); + QToolButton *buttonNew, *buttonOpen, *buttonSave, *buttonRender; + QToolButton *buttonTop, *buttonBottom, *buttonLeft, *buttonRight; + QToolButton *buttonFront, *buttonBack; + +signals: + +public slots: + +}; + +#endif // TOOLBAR_H