From: vsv Date: Tue, 11 Mar 2014 14:25:24 +0000 (+0400) Subject: Testing GUI version X-Git-Tag: V_0.1~57^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=54c039ab2b209cf0aa20993ddb4d92ed2848b2f2;p=modules%2Fshaper.git Testing GUI version --- diff --git a/CMakeCommon/FindCAS.cmake b/CMakeCommon/FindCAS.cmake index 110e7c077..ad673e930 100644 --- a/CMakeCommon/FindCAS.cmake +++ b/CMakeCommon/FindCAS.cmake @@ -88,6 +88,9 @@ IF(NOT WIN32) ENDIF() FIND_LIBRARY(CAS_FWOSPlugin FWOSPlugin ) + +MESSAGE(STATUS "FWOS " ${CAS_FWOSPlugin}) + FIND_LIBRARY(CAS_PTKernel PTKernel ) FIND_LIBRARY(CAS_TKAdvTools TKAdvTools ) FIND_LIBRARY(CAS_TKBin TKBin ) diff --git a/CMakeCommon/FindQt5.cmake b/CMakeCommon/FindQt5.cmake index 81ae7b18e..bed3180b2 100644 --- a/CMakeCommon/FindQt5.cmake +++ b/CMakeCommon/FindQt5.cmake @@ -2,8 +2,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) #Append Qt5's install prefix into CMAKE_MODULE_PATH SET(CMAKE_MODULE_PATH "$ENV{QTDIR}" ${CMAKE_MODULE_PATH}) -SET(CMAKE_AUTOMOC ON) - # Widgets finds its own dependencies (QtGui and QtCore). FIND_PACKAGE(Qt5Widgets REQUIRED) FIND_PACKAGE(Qt5LinguistTools REQUIRED) diff --git a/CMakeLists.txt b/CMakeLists.txt index c44ff627d..89da6f727 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,10 @@ PROJECT (NewGEOM) SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH}) -ADD_SUBDIRECTORY (src/ModelAPI) -ADD_SUBDIRECTORY (src/Model) +INCLUDE(Common) +INCLUDE(FindQt5) + +#ADD_SUBDIRECTORY (src/ModelAPI) +#ADD_SUBDIRECTORY (src/Model) ADD_SUBDIRECTORY (src/XGUI) ADD_SUBDIRECTORY (src/GeomModule) \ No newline at end of file diff --git a/env.bat b/env.bat index f9429a84a..087df80ce 100644 --- a/env.bat +++ b/env.bat @@ -32,6 +32,7 @@ set PATH=%CMAKEDIR%\bin;%PATH% @REM ------------------------- @REM CASCADE @SET PATH=%CASROOT%;%CASROOT%\win32\bind;%PATH% +@SET LIB=%CASROOT%\win32\libd;%LIB% @set CSF_GraphicShr=%CASROOT%\win32\bind\TKOpenGl.dll @set CSF_MDTVFontDirectory=%CASROOT%\src\FontMFT @set CSF_LANGUAGE=us diff --git a/src/GeomModule/CMakeLists.txt b/src/GeomModule/CMakeLists.txt new file mode 100644 index 000000000..a27056b6f --- /dev/null +++ b/src/GeomModule/CMakeLists.txt @@ -0,0 +1,45 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) + + +SET(PROJECT_HEADERS + GeomModule_Defs.h + GeomModule.h +) + +SET(PROJECT_SOURCES + GeomModule.cpp +) + +SET(PROJECT_RESOURCES + GeomModule_icons.qrc +) + +SET(TEXT_RESOURCES + GeomModule_msg_en.ts +) + +QT5_ADD_RESOURCES(PROJECT_COMPILED_RESOURCES ${PROJECT_RESOURCES}) +QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES}) + +SOURCE_GROUP ("Generated Files" FILES ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) +SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) + +ADD_DEFINITIONS(-DWIN32 -D_WINDOWS) + +ADD_LIBRARY(GeomModule SHARED + ${PROJECT_SOURCES} + ${PROJECT_HEADERS} + ${PROJECT_COMPILED_RESOURCES} + ${TEXT_RESOURCES} + ${QM_RESOURCES} +) + +ADD_DEPENDENCIES(GeomModule XGUI) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI) + +# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore +TARGET_LINK_LIBRARIES(GeomModule ${Qt5Widgets_LIBRARIES}) + +INSTALL(TARGETS GeomModule DESTINATION bin) +#INSTALL(FILES ${XML_RESOURCES} DESTINATION bin) diff --git a/src/GeomModule/GeomModule.cpp b/src/GeomModule/GeomModule.cpp index de003fd87..37ec7e5b2 100644 --- a/src/GeomModule/GeomModule.cpp +++ b/src/GeomModule/GeomModule.cpp @@ -6,22 +6,15 @@ #include /*!Create and return new instance of XGUI_Module*/ -extern "C" GM_EXPORT XGUI_Module* createModule() +extern "C" GM_EXPORT IModule* createModule(IWorkshop* theWshop) { - return new GeomModule(); + return new GeomModule(theWshop); } -GeomModule::GeomModule() +GeomModule::GeomModule(IWorkshop* theWshop) { - QString aDir = qApp->applicationDirPath(); - QString aXMLFile = aDir + QDir::separator() + "main_menu.xml"; - - QFile aFile(aXMLFile); - if (aFile.open((QIODevice::ReadOnly | QIODevice::Text))) { - QTextStream aTextStream(&aFile); - myMenuXML = aTextStream.readAll(); - } + myWorkshop = theWshop; } @@ -29,7 +22,15 @@ GeomModule::~GeomModule() { } -QString GeomModule::moduleDescription() const + +void GeomModule::createFeatures() { - return myMenuXML; + int aPageId = myWorkshop->addWorkbench("Primitives"); + int aGroupId = myWorkshop->addGroup(aPageId); + int aCommand = myWorkshop->addFeature(aPageId, aGroupId, "Box", "Create Box", QIcon(":icons/box.png"), QKeySequence()); + aCommand = myWorkshop->addFeature(aPageId, aGroupId, "Cylinder", "Create Cylinder", QIcon(":icons/cylinder.png"), QKeySequence()); + aCommand = myWorkshop->addFeature(aPageId, aGroupId, "Disk", "Create Disk", QIcon(":icons/disk.png"), QKeySequence()); + aCommand = myWorkshop->addFeature(aPageId, aGroupId, "Torus", "Create Torus", QIcon(":icons/torus.png"), QKeySequence()); + + aPageId = myWorkshop->addWorkbench("Operations"); } \ No newline at end of file diff --git a/src/GeomModule/GeomModule.h b/src/GeomModule/GeomModule.h index 8ccd09aa8..80c8ae501 100644 --- a/src/GeomModule/GeomModule.h +++ b/src/GeomModule/GeomModule.h @@ -4,18 +4,20 @@ #include "GeomModule_Defs.h" -#include +#include -class GM_EXPORT GeomModule : public XGUI_Module +class GM_EXPORT GeomModule : public IModule { public: - GeomModule(); + GeomModule(IWorkshop* theWshop); virtual ~GeomModule(); - virtual QString moduleDescription() const; + virtual void createFeatures(); private: QString myMenuXML; + + IWorkshop* myWorkshop; }; #endif \ No newline at end of file diff --git a/src/GeomModule/GeomModule_Defs.h b/src/GeomModule/GeomModule_Defs.h index 45697e587..faa697282 100644 --- a/src/GeomModule/GeomModule_Defs.h +++ b/src/GeomModule/GeomModule_Defs.h @@ -3,7 +3,7 @@ #if defined WIN32 -# if defined GM_EXPORTS || defined gm_EXPORTS +# if defined GeomModule_EXPORTS # define GM_EXPORT __declspec( dllexport ) # else # define GM_EXPORT __declspec( dllimport ) diff --git a/src/GeomModule/GeomModule_icons.qrc b/src/GeomModule/GeomModule_icons.qrc new file mode 100644 index 000000000..3f6a8a361 --- /dev/null +++ b/src/GeomModule/GeomModule_icons.qrc @@ -0,0 +1,8 @@ + + + icons/box.png + icons/cylinder.png + icons/disk.png + icons/torus.png + + diff --git a/src/GeomModule/GeomModule_msg_en.ts b/src/GeomModule/GeomModule_msg_en.ts new file mode 100644 index 000000000..4270bb8a8 --- /dev/null +++ b/src/GeomModule/GeomModule_msg_en.ts @@ -0,0 +1,18 @@ + + + + + @default + + + XGUI_Workshop + + HOME_MENU_TITLE + Home + + + NEW_MENU + New + + + diff --git a/src/GeomModule/icons/box.png b/src/GeomModule/icons/box.png new file mode 100644 index 000000000..3047d9212 Binary files /dev/null and b/src/GeomModule/icons/box.png differ diff --git a/src/GeomModule/icons/cylinder.png b/src/GeomModule/icons/cylinder.png new file mode 100644 index 000000000..a00136dab Binary files /dev/null and b/src/GeomModule/icons/cylinder.png differ diff --git a/src/GeomModule/icons/disk.png b/src/GeomModule/icons/disk.png new file mode 100644 index 000000000..8aad056b9 Binary files /dev/null and b/src/GeomModule/icons/disk.png differ diff --git a/src/GeomModule/icons/torus.png b/src/GeomModule/icons/torus.png new file mode 100644 index 000000000..af76fc00c Binary files /dev/null and b/src/GeomModule/icons/torus.png differ diff --git a/src/GeomModule/main_menu.xml b/src/GeomModule/main_menu.xml deleted file mode 100644 index 5a81a5d7e..000000000 --- a/src/GeomModule/main_menu.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index ee41e8cb9..edc7d7e25 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -1,14 +1,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) -INCLUDE(Common) -INCLUDE(FindQt5) +SET(CMAKE_AUTOMOC ON) SET(PROJECT_HEADERS XGUI_Command.h + XGUI_Interfaces.h XGUI_MainMenu.h XGUI_MainWindow.h XGUI_MenuGroupPanel.h - XGUI_Module.h XGUI_Tools.h XGUI_Workbench.h XGUI_Workshop.h diff --git a/src/XGUI/XGUI_Interfaces.h b/src/XGUI/XGUI_Interfaces.h new file mode 100644 index 000000000..12725017c --- /dev/null +++ b/src/XGUI/XGUI_Interfaces.h @@ -0,0 +1,39 @@ + +#ifndef XGUI_Interfaces_H +#define XGUI_Interfaces_H + +#include +#include +#include + +class IWorkshop +{ +public: + virtual int addWorkbench(const QString& theName) = 0; + + virtual int addGroup(int thePageId) = 0; + + virtual int addFeature(int thePageId, int theGroupId, + const QString& theTitle, const QString& theTip, + const QIcon& theIcon, + const QKeySequence& theKeys = QKeySequence()) = 0; +}; + + +class IModule +{ +public: + virtual void createFeatures() = 0; +}; + + +//! This function must return a new module instance. +extern "C" +{ + typedef IModule* (*CREATE_FUNC)(IWorkshop*); +} + +#define CREATE_MODULE "createModule" + + +#endif \ No newline at end of file diff --git a/src/XGUI/XGUI_MainWindow.cpp b/src/XGUI/XGUI_MainWindow.cpp index 3c4e99b49..729f1869b 100644 --- a/src/XGUI/XGUI_MainWindow.cpp +++ b/src/XGUI/XGUI_MainWindow.cpp @@ -11,6 +11,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) : QMainWindow(parent), myObjectBrowser(0) @@ -26,7 +32,7 @@ XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) : myObjectBrowser->setHeaderHidden(true); aDoc->setWidget(myObjectBrowser); addDockWidget(Qt::LeftDockWidgetArea, aDoc); - aDoc->hide(); + //aDoc->hide(); aDoc = new QDockWidget(this); aDoc->setFeatures(QDockWidget::AllDockWidgetFeatures | QDockWidget::DockWidgetVerticalTitleBar); @@ -44,13 +50,14 @@ XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) : aMdiArea->addSubWindow(getSubWindow(), Qt::FramelessWindowHint); fillObjectBrowser(); - + addPropertyPanel(); } QWidget* XGUI_MainWindow::getSubWindow() { QMdiSubWindow* aSub = new QMdiSubWindow(this); + aSub->setGeometry(0,0, 600, 400); QLabel* aLbl = new QLabel(aSub); aLbl->setFrameStyle(QFrame::Sunken); aLbl->setFrameShape(QFrame::Panel); @@ -153,3 +160,82 @@ void XGUI_MainWindow::fillObjectBrowser() aItem->setIcon(0, QIcon(":pictures/features.png")); } } + + +void XGUI_MainWindow::addPropertyPanel() +{ + QDockWidget* aPropPanel = new QDockWidget(this); + aPropPanel->setWindowTitle("Property panel"); + + QWidget* aContent = new QWidget(aPropPanel); + QVBoxLayout* aMainLay = new QVBoxLayout(aContent); + aMainLay->setContentsMargins(3,3,3,3); + aPropPanel->setWidget(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)); + + QGroupBox* aGrpBox1 = new QGroupBox("Point", 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)); + + aLbl = new QLabel(aGrpBox1); + aLbl->setPixmap(QPixmap(":pictures/y_point.png")); + aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1)); + + aLbl = new QLabel(aGrpBox1); + aLbl->setPixmap(QPixmap(":pictures/z_point.png")); + aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1)); + + + aGrpBox1 = new QGroupBox("Normal vector", aContent); + aGrpBox1->setFlat(true); + aFrmLay = new QFormLayout(aGrpBox1); + aFrmLay->setContentsMargins(0, 6, 0, 0); + aMainLay->addWidget(aGrpBox1); + + aLbl = new QLabel(aGrpBox1); + aLbl->setPixmap(QPixmap(":pictures/x_size.png")); + aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1)); + + aLbl = new QLabel(aGrpBox1); + aLbl->setPixmap(QPixmap(":pictures/y_size.png")); + aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1)); + + aLbl = new QLabel(aGrpBox1); + aLbl->setPixmap(QPixmap(":pictures/z_size.png")); + aFrmLay->addRow(aLbl, new QDoubleSpinBox(aGrpBox1)); + + aMainLay->addStretch(1); + + QFrame* aFrm = new QFrame(aContent); + aFrm->setFrameStyle(QFrame::Sunken); + aFrm->setFrameShape(QFrame::Panel); + QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm); + aBtnLay->setContentsMargins(0, 0, 0, 0); + aMainLay->addWidget(aFrm); + + QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm); + aBtn->setFlat(true); + aBtnLay->addWidget(aBtn); + aBtnLay->addStretch(1); + aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm); + aBtn->setFlat(true); + aBtnLay->addWidget(aBtn); + aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm); + aBtn->setFlat(true); + aBtnLay->addWidget(aBtn); + + addDockWidget(Qt::RightDockWidgetArea, aPropPanel); +} \ No newline at end of file diff --git a/src/XGUI/XGUI_MainWindow.h b/src/XGUI/XGUI_MainWindow.h index dfd5703c8..d6590d44a 100644 --- a/src/XGUI/XGUI_MainWindow.h +++ b/src/XGUI/XGUI_MainWindow.h @@ -23,7 +23,9 @@ public: private: //!! For test purposes only QWidget* getSubWindow(); + void fillObjectBrowser(); + void addPropertyPanel(); XGUI_MainMenu* myMenuBar; diff --git a/src/XGUI/XGUI_Module.h b/src/XGUI/XGUI_Module.h deleted file mode 100644 index bac802a69..000000000 --- a/src/XGUI/XGUI_Module.h +++ /dev/null @@ -1,24 +0,0 @@ - -#ifndef XGUI_Module_H -#define XGUI_Module_H - -#include - -class XGUI_Module -{ -public: - //! Returns a string in XML format with definition of the module commands - virtual QString moduleDescription() const = 0; -}; - - -//! This function must return a new module instance. -extern "C" -{ - typedef XGUI_Module* (*CREATE_FUNC)(); -} - -#define CREATE_MODULE "createModule" - - -#endif \ No newline at end of file diff --git a/src/XGUI/XGUI_Workbench.cpp b/src/XGUI/XGUI_Workbench.cpp index 9a539f184..3cecc44b9 100644 --- a/src/XGUI/XGUI_Workbench.cpp +++ b/src/XGUI/XGUI_Workbench.cpp @@ -20,12 +20,14 @@ protected: void CommandsArea::resizeEvent(QResizeEvent* theEvent) { + int x = widget()->x(); QScrollArea::resizeEvent(theEvent); QRect aRect = widget()->childrenRect(); QSize aNewSize = theEvent->size(); if (aRect.width() > aNewSize.width()) aNewSize.setWidth(aRect.width() * 2); widget()->resize(aNewSize); + widget()->move(x, 0); } @@ -62,7 +64,6 @@ XGUI_Workbench::XGUI_Workbench(QWidget *theParent) : myRightButton = new QPushButton(">", this); myRightButton->setMaximumWidth(14); - //myRightButton->setEnabled(false); myRightButton->setVisible(false); connect(myRightButton,SIGNAL(clicked()), this, SLOT(onRightScroll())); aMainLayout->addWidget(myRightButton); @@ -111,8 +112,6 @@ void XGUI_Workbench::resizeEvent(QResizeEvent* theEvent) if (aW < aS.width()) myChildWidget->resize(aS.width(), myChildWidget->height()); - //myLeftButton->setEnabled(isExceedsLeft()); - //myRightButton->setEnabled(isExceedsRight()); myLeftButton->setVisible(isExceedsLeft()); myRightButton->setVisible(isExceedsRight()); } @@ -125,8 +124,6 @@ void XGUI_Workbench::onLeftScroll() myChildWidget->move( myChildWidget->pos().x() + SCROLL_STEP, 0 ); myLeftButton->setVisible(isExceedsLeft()); myRightButton->setVisible(isExceedsRight()); - //myLeftButton->setEnabled(isExceedsLeft()); - //myRightButton->setEnabled(isExceedsRight()); } @@ -135,8 +132,6 @@ void XGUI_Workbench::onRightScroll() if (!isExceedsRight()) return; myChildWidget->move( myChildWidget->pos().x() - SCROLL_STEP, 0 ); - //myLeftButton->setEnabled(isExceedsLeft()); - //myRightButton->setEnabled(isExceedsRight()); myLeftButton->setVisible(isExceedsLeft()); myRightButton->setVisible(isExceedsRight()); } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 2644722fe..810e0344b 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -3,7 +3,6 @@ #include "XGUI_MainMenu.h" #include "XGUI_Command.h" #include "XGUI_Tools.h" -#include "XGUI_Module.h" #include #include @@ -20,10 +19,6 @@ XGUI_Workshop::XGUI_Workshop() : QObject() { myMainWindow = new XGUI_MainWindow(); - - // Set Logo - //XGUI_MainMenu* aMenuBar = myMainWindow->menuBar(); - //aMenuBar->setLogo(QPixmap(":pictures/OCCLogo.png")); } //****************************************************** @@ -35,7 +30,7 @@ XGUI_Workshop::~XGUI_Workshop(void) void XGUI_Workshop::startApplication() { initMenu(); - //loadModules(); + activateModule(); myMainWindow->show(); } @@ -45,17 +40,17 @@ void XGUI_Workshop::initMenu() int aPageId = addWorkbench(tr("HOME_MENU_TITLE")); // File commands group - int aGroupId = addPageGroup(aPageId); + int aGroupId = addGroup(aPageId); XGUI_Command* aCommand; - aCommand = createMenuCommand(aPageId, aGroupId, NEW_CMD, tr("NEW_MENU"), tr("NEW_MENU_TIP"), - QIcon(":pictures/new.png"), QKeySequence::New); - connect(aCommand, SIGNAL(triggered()), this, SLOT(onNew())); + //aCommand = createMenuCommand(aPageId, aGroupId, NEW_CMD, tr("NEW_MENU"), tr("NEW_MENU_TIP"), + // QIcon(":pictures/new.png"), QKeySequence::New); + //connect(aCommand, SIGNAL(triggered()), this, SLOT(onNew())); - aCommand = createMenuCommand(aPageId, aGroupId, OPEN_CMD, tr("OPEN_MENU"), tr("OPEN_MENU_TIP"), - QIcon(":pictures/open.png"), QKeySequence::Open); - connect(aCommand, SIGNAL(triggered()), this, SLOT(onOpen())); + //aCommand = createMenuCommand(aPageId, aGroupId, OPEN_CMD, tr("OPEN_MENU"), tr("OPEN_MENU_TIP"), + // QIcon(":pictures/open.png"), QKeySequence::Open); + //connect(aCommand, SIGNAL(triggered()), this, SLOT(onOpen())); aCommand = createMenuCommand(aPageId, aGroupId, SAVE_CMD, tr("SAVE_MENU"), tr("SAVE_MENU_TIP"), QIcon(":pictures/save.png"), QKeySequence::Save); @@ -67,13 +62,9 @@ void XGUI_Workshop::initMenu() connect(aCommand, SIGNAL(triggered()), this, SLOT(onSaveAs())); aCommand->setEnabled(false); - aCommand = createMenuCommand(aPageId, aGroupId, EXIT_CMD, tr("EXIT_MENU"), tr("EXIT_MENU_TIP"), - QIcon(":pictures/close.png"), QKeySequence::Close); - connect(aCommand, SIGNAL(triggered()), this, SLOT(onExit())); - // Edit commands group - aGroupId = addPageGroup(aPageId); + //aGroupId = addGroup(aPageId); aCommand = createMenuCommand(aPageId, aGroupId, UNDO_CMD, tr("UNDO_MENU"), tr("UNDO_MENU_TIP"), QIcon(":pictures/undo.png"), QKeySequence::Undo); @@ -81,25 +72,29 @@ void XGUI_Workshop::initMenu() aCommand = createMenuCommand(aPageId, aGroupId, REDO_CMD, tr("REDO_MENU"), tr("REDO_MENU_TIP"), QIcon(":pictures/redo.png"), QKeySequence::Redo); - aCommand = createMenuCommand(aPageId, aGroupId, CUT_CMD, tr("CUT_MENU"), tr("CUT_MENU_TIP"), - QIcon(":pictures/cut.png"), QKeySequence::Cut); + //aCommand = createMenuCommand(aPageId, aGroupId, CUT_CMD, tr("CUT_MENU"), tr("CUT_MENU_TIP"), + // QIcon(":pictures/cut.png"), QKeySequence::Cut); - aCommand = createMenuCommand(aPageId, aGroupId, COPY_CMD, tr("COPY_MENU"), tr("COPY_MENU_TIP"), - QIcon(":pictures/copy.png"), QKeySequence::Copy); + //aCommand = createMenuCommand(aPageId, aGroupId, COPY_CMD, tr("COPY_MENU"), tr("COPY_MENU_TIP"), + // QIcon(":pictures/copy.png"), QKeySequence::Copy); - aCommand = createMenuCommand(aPageId, aGroupId, PASTE_CMD, tr("PASTE_MENU"), tr("PASTE_MENU_TIP"), - QIcon(":pictures/paste.png"), QKeySequence::Paste); + //aCommand = createMenuCommand(aPageId, aGroupId, PASTE_CMD, tr("PASTE_MENU"), tr("PASTE_MENU_TIP"), + // QIcon(":pictures/paste.png"), QKeySequence::Paste); + + aCommand = createMenuCommand(aPageId, aGroupId, EXIT_CMD, tr("EXIT_MENU"), tr("EXIT_MENU_TIP"), + QIcon(":pictures/close.png"), QKeySequence::Close); + connect(aCommand, SIGNAL(triggered()), this, SLOT(onExit())); // Tests - aPageId = addWorkbench("Primitives"); - aGroupId = addPageGroup(aPageId); - - aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Box", "Create Box", QIcon(":pictures/box.png")); - aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Cylinder", "Create Cylinder", QIcon(":pictures/cylinder.png")); - aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Disk", "Create Disk", QIcon(":pictures/disk.png")); - aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Torus", "Create Torus", QIcon(":pictures/torus.png")); + //aPageId = addWorkbench("Primitives"); + //aGroupId = addGroup(aPageId); + // + //aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Box", "Create Box", QIcon(":pictures/box.png")); + //aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Cylinder", "Create Cylinder", QIcon(":pictures/cylinder.png")); + //aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Disk", "Create Disk", QIcon(":pictures/disk.png")); + //aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Torus", "Create Torus", QIcon(":pictures/torus.png")); - aPageId = addWorkbench("Operations"); + //aPageId = addWorkbench("Operations"); } @@ -124,7 +119,7 @@ int XGUI_Workshop::addWorkbench(const QString& theName) } //****************************************************** -int XGUI_Workshop::addPageGroup(int thePageId) +int XGUI_Workshop::addGroup(int thePageId) { XGUI_MainMenu* aMenuBar = myMainWindow->menuObject(); return aMenuBar->addGroup(thePageId); @@ -176,7 +171,7 @@ void XGUI_Workshop::onSaveAs() } //****************************************************** -XGUI_Module* XGUI_Workshop::loadModule(const QString& theModule) +IModule* XGUI_Workshop::loadModule(const QString& theModule) { QString libName = library( theModule ); if ( libName.isEmpty() ) @@ -189,7 +184,8 @@ XGUI_Module* XGUI_Workshop::loadModule(const QString& theModule) CREATE_FUNC crtInst = 0; #ifdef WIN32 - HINSTANCE modLib = ::LoadLibrary( (LPTSTR) libName.utf16() ); + + HINSTANCE modLib = ::LoadLibrary( (LPTSTR) qPrintable(libName) ); if ( !modLib ) { LPVOID lpMsgBuf; @@ -224,7 +220,7 @@ XGUI_Module* XGUI_Workshop::loadModule(const QString& theModule) } #endif - XGUI_Module* aModule = crtInst ? crtInst() : 0; + IModule* aModule = crtInst ? crtInst(this) : 0; if ( !err.isEmpty() ) { if ( mainWindow() && mainWindow()->isVisible() ) @@ -236,20 +232,21 @@ XGUI_Module* XGUI_Workshop::loadModule(const QString& theModule) } //****************************************************** -void XGUI_Workshop::loadModules() +bool XGUI_Workshop::activateModule() { // Test of modules loading - QStringList aModules; - aModules << "GeomModule"; - - foreach(QString aName, aModules) { - XGUI_Module* aModule = loadModule(aName); - buildModuleMenu(aModule->moduleDescription()); - } + IModule* aModule = loadModule("GeomModule"); + if (!aModule) + return false; + aModule->createFeatures(); + return true; } //****************************************************** -void XGUI_Workshop::buildModuleMenu(const QString& theXML) +int XGUI_Workshop::addFeature(int thePageId, int theGroupId, + const QString& theTitle, const QString& theTip, + const QIcon& theIcon, + const QKeySequence& theKeys) { - + return (int) createMenuCommand(thePageId, theGroupId, LAST_CMD, theTitle, theTip, theIcon, theKeys); } diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 9b7980196..cfeb70092 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -2,6 +2,8 @@ #ifndef XGUI_WORKSHOP_H #define XGUI_WORKSHOP_H +#include "XGUI_Interfaces.h" + #include #include #include @@ -11,7 +13,7 @@ class XGUI_MainWindow; class XGUI_Command; class XGUI_Module; -class XGUI_Workshop: public QObject +class XGUI_Workshop: public QObject, IWorkshop { Q_OBJECT public: @@ -38,6 +40,14 @@ public: XGUI_MainWindow* mainWindow() const { return myMainWindow; } + virtual int addWorkbench(const QString& theName); + virtual int addGroup(int thePageId); + virtual int addFeature(int thePageId, int theGroupId, + const QString& theTitle, const QString& theTip, + const QIcon& theIcon, + const QKeySequence& theKeys = QKeySequence()); + + public slots: void onNew(); void onOpen(); @@ -48,13 +58,9 @@ public slots: private: void initMenu(); - XGUI_Module* loadModule(const QString& theModule); - void loadModules(); - - void buildModuleMenu(const QString& theXML); + IModule* loadModule(const QString& theModule); + bool activateModule(); - int addWorkbench(const QString& theName); - int addPageGroup(int thePageId); void addCommand(XCommandId theCommandId, int thePageId, int theGroupId, XGUI_Command* theCommand); XGUI_Command* createMenuCommand(int thePageId, int theGroupId, XCommandId theCmdId, const QString& theTitle, const QString& theTip, diff --git a/src/XGUI/XGUI_pictures.qrc b/src/XGUI/XGUI_pictures.qrc index f882c6cf9..ee262ff3f 100644 --- a/src/XGUI/XGUI_pictures.qrc +++ b/src/XGUI/XGUI_pictures.qrc @@ -10,10 +10,7 @@ pictures/redo.png pictures/undo.png - pictures/box.png - pictures/cylinder.png - pictures/disk.png - pictures/torus.png + pictures/ViewPort.png pictures/occ_view_ambient.png @@ -60,5 +57,15 @@ pictures/properties.png pictures/features.png + pictures/x_point.png + pictures/y_point.png + pictures/z_point.png + pictures/x_size.png + pictures/y_size.png + pictures/z_size.png + + pictures/button_cancel.png + pictures/button_help.png + pictures/button_ok.png diff --git a/src/XGUI/pictures/button_cancel.png b/src/XGUI/pictures/button_cancel.png new file mode 100644 index 000000000..e2db55f22 Binary files /dev/null and b/src/XGUI/pictures/button_cancel.png differ diff --git a/src/XGUI/pictures/button_help.png b/src/XGUI/pictures/button_help.png new file mode 100644 index 000000000..91a4d590f Binary files /dev/null and b/src/XGUI/pictures/button_help.png differ diff --git a/src/XGUI/pictures/button_ok.png b/src/XGUI/pictures/button_ok.png new file mode 100644 index 000000000..5b0f6a617 Binary files /dev/null and b/src/XGUI/pictures/button_ok.png differ diff --git a/src/XGUI/pictures/cylinder.png b/src/XGUI/pictures/cylinder.png deleted file mode 100644 index a00136dab..000000000 Binary files a/src/XGUI/pictures/cylinder.png and /dev/null differ diff --git a/src/XGUI/pictures/disk.png b/src/XGUI/pictures/disk.png deleted file mode 100644 index 8aad056b9..000000000 Binary files a/src/XGUI/pictures/disk.png and /dev/null differ diff --git a/src/XGUI/pictures/torus.png b/src/XGUI/pictures/torus.png deleted file mode 100644 index af76fc00c..000000000 Binary files a/src/XGUI/pictures/torus.png and /dev/null differ diff --git a/src/XGUI/pictures/x_point.png b/src/XGUI/pictures/x_point.png new file mode 100644 index 000000000..e6aff9e6d Binary files /dev/null and b/src/XGUI/pictures/x_point.png differ diff --git a/src/XGUI/pictures/x_size.png b/src/XGUI/pictures/x_size.png new file mode 100644 index 000000000..f3ee83127 Binary files /dev/null and b/src/XGUI/pictures/x_size.png differ diff --git a/src/XGUI/pictures/y_point.png b/src/XGUI/pictures/y_point.png new file mode 100644 index 000000000..d9658dd08 Binary files /dev/null and b/src/XGUI/pictures/y_point.png differ diff --git a/src/XGUI/pictures/y_size.png b/src/XGUI/pictures/y_size.png new file mode 100644 index 000000000..9b39fda55 Binary files /dev/null and b/src/XGUI/pictures/y_size.png differ diff --git a/src/XGUI/pictures/z_point.png b/src/XGUI/pictures/z_point.png new file mode 100644 index 000000000..33fe92baa Binary files /dev/null and b/src/XGUI/pictures/z_point.png differ diff --git a/src/XGUI/pictures/z_size.png b/src/XGUI/pictures/z_size.png new file mode 100644 index 000000000..7ac113998 Binary files /dev/null and b/src/XGUI/pictures/z_size.png differ