void GeomModule::createFeatures()
{
- IWorkbench* aPage = myWorkshop->addWorkbench("Primitives");
+ IWorkbench* aPage = myWorkshop->addWorkbench("Home");
IMenuGroup* aGroup = aPage->addGroup();
IFeatureMenu* aCommand = aGroup->addFeature("new_part", "Part", "Creates a new part", QIcon(":pictures/part_ico.png"));
aGroup = aPage->addGroup();
aCommand = aGroup->addFeature("extrusion", "Extrusion", "Make extrusion", QIcon(":icons/extrusion.png"));
+ aCommand = aGroup->addFeature("revolution", "Revolution", "Make revolution", QIcon(":icons/revol.png"));
aCommand = aGroup->addFeature("cut", "Cut", "Make cut", QIcon(":icons/cut.png"));
aCommand = aGroup->addFeature("fusion", "Fusion", "Make fusion", QIcon(":icons/fusion.png"));
- aCommand = aGroup->addFeature("revolution", "Revolution", "Make revolution", QIcon(":icons/revol.png"));
aCommand = aGroup->addFeature("common", "Common", "Make common", QIcon(":icons/common.png"));
//aGroup = aPage->addGroup();
aCommand = aGroup->addFeature("import", "Import", "Make import", QIcon(":icons/import.png"));
+
+ aPage = myWorkshop->addWorkbench("Sketch");
+ aPage = myWorkshop->addWorkbench("Properties");
}
\ No newline at end of file
XGUI_Tools.h
XGUI_Workbench.h
XGUI_Workshop.h
+ XGUI_ViewWindow.h
)
SET(PROJECT_AUTOMOC
XGUI_Tools.cpp
XGUI_Workbench.cpp
XGUI_Workshop.cpp
+ XGUI_ViewWindow.cpp
)
SET(PROJECT_RESOURCES
#include "XGUI_MainWindow.h"
#include "XGUI_MainMenu.h"
+#include "XGUI_ViewWindow.h"
#include <QMdiArea>
#include <QTreeWidget>
#include <QDockWidget>
#include <QTextEdit>
-#include <QMdiSubWindow>
#include <QLabel>
#include <QToolBar>
#include <QToolButton>
-#include <QAction>
#include <QTreeWidgetItem>
#include <QLayout>
#include <QLineEdit>
#include <QDoubleSpinBox>
#include <QPushButton>
#include <QScrollArea>
+#include <QComboBox>
XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) :
QMainWindow(parent), myObjectBrowser(0)
{
- //menuBar();
myMenuBar = new XGUI_MainMenu(this);
QDockWidget* aDoc = new QDockWidget(this);
QMdiArea* aMdiArea = new QMdiArea(this);
setCentralWidget(aMdiArea);
- aMdiArea->addSubWindow(getSubWindow(), Qt::FramelessWindowHint);
+ aMdiArea->addSubWindow(new XGUI_ViewWindow(), Qt::FramelessWindowHint);
fillObjectBrowser();
addPropertyPanel();
}
-
-QWidget* XGUI_MainWindow::getSubWindow()
-{
- QMdiSubWindow* aSub = new QMdiSubWindow(this);
- QLabel* aLbl = new QLabel(aSub);
- aLbl->setFrameStyle(QFrame::Sunken);
- aLbl->setFrameShape(QFrame::Panel);
- aLbl->setPixmap(QPixmap(":pictures/ViewPort.png"));
- aLbl->setScaledContents(true);
- aSub->setWidget(aLbl);
-
- QStringList aPictures;
- aPictures<<":pictures/occ_view_camera_dump.png"<<":pictures/occ_view_style_switch.png";
- aPictures<<":pictures/occ_view_triedre.png"<<":pictures/occ_view_fitall.png";
- aPictures<<":pictures/occ_view_fitarea.png"<<":pictures/occ_view_zoom.png";
- aPictures<<":pictures/occ_view_pan.png"<<":pictures/occ_view_glpan.png";
- aPictures<<":pictures/occ_view_rotate.png"<<":pictures/occ_view_front.png";
- aPictures<<":pictures/occ_view_back.png"<<":pictures/occ_view_left.png";
- aPictures<<":pictures/occ_view_right.png"<<":pictures/occ_view_top.png";
- aPictures<<":pictures/occ_view_bottom.png"<<":pictures/occ_view_clone.png";
-
- QToolBar* aBar = new QToolBar(aSub);
- aBar->setGeometry(0,0,500,30);
-
- QAction* aBtn;
- foreach(QString aName, aPictures) {
- aBtn = new QAction(aBar);
- aBtn->setIcon(QIcon(aName));
- aBar->addAction(aBtn);
- }
-
- aBar = new QToolBar(aSub);
- aBar->setGeometry(615,0,100,25);
- QStringList aWndIcons;
- aWndIcons<<":pictures/wnd_minimize.png"<<":pictures/wnd_maximize.png"<<":pictures/wnd_close.png";
- foreach(QString aName, aWndIcons) {
- aBtn = new QAction(aBar);
- aBtn->setIcon(QIcon(aName));
- aBar->addAction(aBtn);
- }
-
- return aSub;
-}
-
-
XGUI_MainWindow::~XGUI_MainWindow(void)
{
}
void XGUI_MainWindow::addPropertyPanel()
{
QDockWidget* aPropPanel = new QDockWidget(this);
- aPropPanel->setWindowTitle("Property panel");
+ aPropPanel->setWindowTitle("Point");
QWidget* aContent = new QWidget(aPropPanel);
QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
aMainLay->setContentsMargins(3,3,3,3);
aPropPanel->setWidget(aContent);
- QWidget* aNameWgt = new QWidget(aContent);
+ /*QWidget* aNameWgt = new QWidget(aContent);
QHBoxLayout* aNameLay = new QHBoxLayout(aNameWgt);
aNameLay->setContentsMargins(0,0,0,0);
aMainLay->addWidget(aNameWgt);
aNameLay->addWidget(new QLabel("Name", aNameWgt));
- aNameLay->addWidget(new QLineEdit(aNameWgt));
+ aNameLay->addWidget(new QLineEdit(aNameWgt));*/
- QGroupBox* aGrpBox1 = new QGroupBox("Point", aContent);
- aGrpBox1->setFlat(true);
+ QComboBox* aCombo = new QComboBox(aContent);
+ aCombo->addItem("By coordinates");
+ aMainLay->addWidget(aCombo);
+
+ QWidget* aGrpBox1 = new QWidget(aContent);
+ //aGrpBox1->setFlat(true);
QFormLayout* aFrmLay = new QFormLayout(aGrpBox1);
aFrmLay->setContentsMargins(0, 6, 0, 0);
aMainLay->addWidget(aGrpBox1);
+
QLabel* aLbl = new QLabel(aGrpBox1);
aLbl->setPixmap(QPixmap(":pictures/x_point.png"));
aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));
aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));
- aGrpBox1 = new QGroupBox("Normal vector", aContent);
+/* aGrpBox1 = new QGroupBox("Normal vector", aContent);
aGrpBox1->setFlat(true);
aFrmLay = new QFormLayout(aGrpBox1);
aFrmLay->setContentsMargins(0, 6, 0, 0);
aLbl = new QLabel(aGrpBox1);
aLbl->setPixmap(QPixmap(":pictures/z_size.png"));
- aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));
+ aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1));*/
aMainLay->addStretch(1);
aBtn->setFlat(true);
aBtnLay->addWidget(aBtn);
aBtnLay->addStretch(1);
- aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
+ aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
aBtn->setFlat(true);
aBtnLay->addWidget(aBtn);
- aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
+ aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
aBtn->setFlat(true);
aBtnLay->addWidget(aBtn);
private:
//!! For test purposes only
- QWidget* getSubWindow();
+ //QWidget* getSubWindow();
void fillObjectBrowser();
void addPropertyPanel();
--- /dev/null
+#include "XGUI_ViewWindow.h"
+
+
+#include <QLayout>
+#include <QLabel>
+#include <QToolBar>
+#include <QAction>
+#include <QResizeEvent>
+#include <QApplication>
+
+#define BORDER_SIZE 2
+
+XGUI_ViewWindow::XGUI_ViewWindow()
+{
+ setMouseTracking(true);
+ QVBoxLayout* aLay = new QVBoxLayout(this);
+ aLay->setContentsMargins(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE,BORDER_SIZE);
+ myViewPort = new QLabel(this);
+ aLay->addWidget(myViewPort);
+ myViewPort->setFrameStyle(QFrame::Raised);
+ myViewPort->setCursor(Qt::ArrowCursor);
+ myViewPort->setFrameShape(QFrame::Panel);
+ myViewPort->setPixmap(QPixmap(":pictures/ViewPort.png"));
+ myViewPort->setScaledContents(true);
+
+ myPicture = new QLabel(this);
+ aLay->addWidget(myPicture);
+ myPicture->hide();
+
+ QStringList aPictures;
+ aPictures<<":pictures/occ_view_camera_dump.png"<<":pictures/occ_view_style_switch.png";
+ aPictures<<":pictures/occ_view_triedre.png"<<":pictures/occ_view_fitall.png";
+ aPictures<<":pictures/occ_view_fitarea.png"<<":pictures/occ_view_zoom.png";
+ aPictures<<":pictures/occ_view_pan.png"<<":pictures/occ_view_glpan.png";
+ aPictures<<":pictures/occ_view_rotate.png"<<":pictures/occ_view_front.png";
+ aPictures<<":pictures/occ_view_back.png"<<":pictures/occ_view_left.png";
+ aPictures<<":pictures/occ_view_right.png"<<":pictures/occ_view_top.png";
+ aPictures<<":pictures/occ_view_bottom.png"<<":pictures/occ_view_clone.png";
+
+ QStringList aTitles;
+ aTitles << "Dump view" << "Mouse style switch" << "Show trihedron" << "Fit all";
+ aTitles << "Fit area" << "Zoom" << "Panning" << "Global panning" << "Rotate";
+ aTitles << "Front" << "Back" << "Left" << "Right" << "Top" << "Bottom" << "Clone view";
+
+ aViewBar = new QToolBar(this);
+ //aViewBar->move(BORDER_SIZE, BORDER_SIZE);
+
+ QAction* aBtn;
+ for (int i = 0; i < aTitles.length(); i++) {
+ aBtn = new QAction(QIcon(aPictures.at(i)), aTitles.at(i), aViewBar);
+ aViewBar->addAction(aBtn);
+ }
+
+ aWindowBar = new QToolBar(this);
+ //aWindowBar->move(615,0);
+
+ aBtn = new QAction(aWindowBar);
+ aBtn->setIcon(QIcon(":pictures/wnd_minimize.png"));
+ aWindowBar->addAction(aBtn);
+ connect(aBtn, SIGNAL(triggered()), SLOT(onMinimize()));
+ connect(aBtn, SIGNAL(triggered()), SLOT(showMinimized()));
+
+ aBtn = new QAction(aWindowBar);
+ aBtn->setIcon(QIcon(":pictures/wnd_maximize.png"));
+ aWindowBar->addAction(aBtn);
+ connect(aBtn, SIGNAL(triggered()), SLOT(showMaximized()));
+
+ aBtn = new QAction(aWindowBar);
+ aBtn->setIcon(QIcon(":pictures/wnd_close.png"));
+ aWindowBar->addAction(aBtn);
+ connect(aBtn, SIGNAL(triggered()), SLOT(onClose()));
+
+ aViewBar->hide();
+ aWindowBar->hide();
+}
+
+
+XGUI_ViewWindow::~XGUI_ViewWindow()
+{
+}
+
+
+void XGUI_ViewWindow::resizeEvent(QResizeEvent* theEvent)
+{
+ QSize aSize = theEvent->size();
+ QSize aWndBarSize = aWindowBar->sizeHint();
+ QSize aViewBarSize = aViewBar->sizeHint();
+
+ aWindowBar->move(aSize.width() - aWndBarSize.width() - BORDER_SIZE, BORDER_SIZE);
+ aViewBar->setGeometry(BORDER_SIZE, BORDER_SIZE, aSize.width() - aWndBarSize.width(), aViewBarSize.height());
+}
+
+
+void XGUI_ViewWindow::changeEvent(QEvent* theEvent)
+{
+
+ if (theEvent->type() == QEvent::WindowStateChange) {
+ if (isMinimized()) {
+ parentWidget()->setGeometry(0, 0, 110, 80);
+ myViewPort->hide();
+ aViewBar->hide();
+ aWindowBar->hide();
+ myPicture->show();
+ } else {
+ myViewPort->show();
+ myPicture->hide();
+ }
+ } else
+ QWidget::changeEvent(theEvent);
+}
+
+void XGUI_ViewWindow::onClose()
+{
+ if (parentWidget())
+ parentWidget()->close();
+
+}
+
+void XGUI_ViewWindow::enterEvent(QEvent* theEvent)
+{
+ if (!isMinimized())
+ aViewBar->show();
+ aWindowBar->show();
+}
+
+void XGUI_ViewWindow::leaveEvent(QEvent* theEvent)
+{
+ aViewBar->hide();
+ aWindowBar->hide();
+}
+
+
+void XGUI_ViewWindow::onMinimize()
+{
+ QPixmap aPMap = grab();
+ myPicture->setPixmap(aPMap.scaled(110, 80));
+}
\ No newline at end of file
--- /dev/null
+#ifndef XGUI_ViewWindow_H
+#define XGUI_ViewWindow_H
+
+#include <QWidget>
+
+class QLabel;
+class QToolBar;
+
+class XGUI_ViewWindow : public QWidget
+{
+ Q_OBJECT
+public:
+ XGUI_ViewWindow();
+ virtual ~XGUI_ViewWindow();
+
+protected:
+ virtual void resizeEvent(QResizeEvent* theEvent);
+
+ virtual void changeEvent(QEvent* theEvent);
+
+ virtual void enterEvent(QEvent* theEvent);
+ virtual void leaveEvent(QEvent* theEvent);
+
+private slots:
+ void onClose();
+ void onMinimize();
+
+private:
+
+ QLabel* myPicture;
+ QLabel* myViewPort;
+ QToolBar* aViewBar;
+ QToolBar* aWindowBar;
+};
+
+#endif
\ No newline at end of file
//******************************************************
void XGUI_Workshop::initMenu()
{
- IWorkbench* aPage = addWorkbench(tr("HOME_MENU_TITLE"));
+ IWorkbench* aPage = addWorkbench(tr("GEN_MENU_TITLE"));
// File commands group
IMenuGroup* aGroup = aPage->addGroup();
IFeatureMenu* aCommand;
- aCommand = aGroup->addFeature("NEW_CMD", tr("NEW_MENU"), tr("NEW_MENU_TIP"),
- QIcon(":pictures/new.png"), QKeySequence::New);
- aCommand->connectTo(this, SLOT(onNew()));
-
- aCommand = aGroup->addFeature("OPEN_CMD", tr("OPEN_MENU"), tr("OPEN_MENU_TIP"),
- QIcon(":pictures/open.png"), QKeySequence::Open);
- aCommand->connectTo(this, SLOT(onOpen()));
-
aCommand = aGroup->addFeature("SAVE_CMD", tr("SAVE_MENU"), tr("SAVE_MENU_TIP"),
QIcon(":pictures/save.png"), QKeySequence::Save);
aCommand->connectTo(this, SLOT(onSave()));
- aCommand->disable();
-
-
- aCommand = aGroup->addFeature("SAVEAS_CMD", tr("SAVEAS_MENU"), tr("SAVEAS_MENU_TIP"),
- QIcon(":pictures/save.png"));
- aCommand->connectTo(this, SLOT(onSaveAs()));
- aCommand->disable();
-
- // Edit commands group
- //aGroup = aPage->addGroup();
+ //aCommand->disable();
aCommand = aGroup->addFeature("UNDO_CMD", tr("UNDO_MENU"), tr("UNDO_MENU_TIP"),
QIcon(":pictures/undo.png"), QKeySequence::Undo);
aCommand = aGroup->addFeature("REBUILD_CMD", tr("REBUILD_MENU"), tr("REBUILD_MENU_TIP"),
QIcon(":pictures/rebuild.png"));
+ aCommand = aGroup->addFeature("SAVEAS_CMD", tr("SAVEAS_MENU"), tr("SAVEAS_MENU_TIP"),
+ QIcon(":pictures/save.png"));
+ aCommand->connectTo(this, SLOT(onSaveAs()));
+ //aCommand->disable();
+
+ aCommand = aGroup->addFeature("OPEN_CMD", tr("OPEN_MENU"), tr("OPEN_MENU_TIP"),
+ QIcon(":pictures/open.png"), QKeySequence::Open);
+ aCommand->connectTo(this, SLOT(onOpen()));
+
+
+ aCommand = aGroup->addFeature("NEW_CMD", tr("NEW_MENU"), tr("NEW_MENU_TIP"),
+ QIcon(":pictures/new.png"), QKeySequence::New);
+ aCommand->connectTo(this, SLOT(onNew()));
+
aCommand = aGroup->addFeature("EXIT_CMD", tr("EXIT_MENU"), tr("EXIT_MENU_TIP"),
QIcon(":pictures/close.png"), QKeySequence::Close);
aCommand->connectTo(this, SLOT(onExit()));
<context>
<name>XGUI_Workshop</name>
<message>
- <source>HOME_MENU_TITLE</source>
- <translation>Home</translation>
+ <source>GEN_MENU_TITLE</source>
+ <translation>General</translation>
</message>
<message>
<source>NEW_MENU</source>