From 54c039ab2b209cf0aa20993ddb4d92ed2848b2f2 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 11 Mar 2014 18:25:24 +0400 Subject: [PATCH] Testing GUI version --- CMakeCommon/FindCAS.cmake | 3 + CMakeCommon/FindQt5.cmake | 2 - CMakeLists.txt | 7 +- env.bat | 1 + src/GeomModule/CMakeLists.txt | 45 +++++++++ src/GeomModule/GeomModule.cpp | 27 +++--- src/GeomModule/GeomModule.h | 10 +- src/GeomModule/GeomModule_Defs.h | 2 +- src/GeomModule/GeomModule_icons.qrc | 8 ++ src/GeomModule/GeomModule_msg_en.ts | 18 ++++ src/GeomModule/icons/box.png | Bin 0 -> 931 bytes .../icons}/cylinder.png | Bin .../pictures => GeomModule/icons}/disk.png | Bin .../pictures => GeomModule/icons}/torus.png | Bin src/GeomModule/main_menu.xml | 13 --- src/XGUI/CMakeLists.txt | 5 +- src/XGUI/XGUI_Interfaces.h | 39 ++++++++ src/XGUI/XGUI_MainWindow.cpp | 90 +++++++++++++++++- src/XGUI/XGUI_MainWindow.h | 2 + src/XGUI/XGUI_Module.h | 24 ----- src/XGUI/XGUI_Workbench.cpp | 9 +- src/XGUI/XGUI_Workshop.cpp | 89 +++++++++-------- src/XGUI/XGUI_Workshop.h | 20 ++-- src/XGUI/XGUI_pictures.qrc | 15 ++- src/XGUI/pictures/button_cancel.png | Bin 0 -> 792 bytes src/XGUI/pictures/button_help.png | Bin 0 -> 322 bytes src/XGUI/pictures/button_ok.png | Bin 0 -> 883 bytes src/XGUI/pictures/x_point.png | Bin 0 -> 396 bytes src/XGUI/pictures/x_size.png | Bin 0 -> 381 bytes src/XGUI/pictures/y_point.png | Bin 0 -> 362 bytes src/XGUI/pictures/y_size.png | Bin 0 -> 511 bytes src/XGUI/pictures/z_point.png | Bin 0 -> 368 bytes src/XGUI/pictures/z_size.png | Bin 0 -> 355 bytes 33 files changed, 301 insertions(+), 128 deletions(-) create mode 100644 src/GeomModule/CMakeLists.txt create mode 100644 src/GeomModule/GeomModule_icons.qrc create mode 100644 src/GeomModule/GeomModule_msg_en.ts create mode 100644 src/GeomModule/icons/box.png rename src/{XGUI/pictures => GeomModule/icons}/cylinder.png (100%) rename src/{XGUI/pictures => GeomModule/icons}/disk.png (100%) rename src/{XGUI/pictures => GeomModule/icons}/torus.png (100%) delete mode 100644 src/GeomModule/main_menu.xml create mode 100644 src/XGUI/XGUI_Interfaces.h delete mode 100644 src/XGUI/XGUI_Module.h create mode 100644 src/XGUI/pictures/button_cancel.png create mode 100644 src/XGUI/pictures/button_help.png create mode 100644 src/XGUI/pictures/button_ok.png create mode 100644 src/XGUI/pictures/x_point.png create mode 100644 src/XGUI/pictures/x_size.png create mode 100644 src/XGUI/pictures/y_point.png create mode 100644 src/XGUI/pictures/y_size.png create mode 100644 src/XGUI/pictures/z_point.png create mode 100644 src/XGUI/pictures/z_size.png 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 0000000000000000000000000000000000000000..3047d921234a9c96d98dd0aedbc595d060d76aa8 GIT binary patch literal 931 zcmV;U16=%xP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<8A(JzRCwBA{Qv(y12q9a0IJ3v1ppX?p%HpikMAH3 zIw>U%g%0_UA@9&c00M{!*|5aK#Q&=9xeUL4 z|AlD!3Dg9{Uw|6F{e&3s^~Y}@|2Mc5J69>cFc z|G){Ri~!e{eAT2fJ=tTL6P;_Hu^b-@m|&Pyu2dfB*s;=WA|L4yia2SFBi2vow7Y6g36=1{u{QQa%WB>sK zHt^@qpA7n8P2lkQ33TDd5APU$GjcKf0DAp5kPmhpG%@@Es@dJ<#qj3`(6C?MfChd; zF%Tetzy^X`_XFy^AHN{s^qUdrkv~_b-Nje}17D2oOMU z7ybfj{`DK^LLdf3${*%`7=|%0{D)#7`5%~!{{01GWB?FAOt5ePMaHkc|G-`XC5?ao zF%1K;|3ky_KhUNB{{F^rAwU3u4Fm-`*bpcNvH$m}hJgS9gzz%Z ztG|KX26_1>FdP{f{=mZvY#=D701f=}^E)JRetZT-%6G7#$N(UKzy^Yn!PlR^!4U&a z)Zf1`{QdkM>@A3S|G;4e^5WlL5Cgt_cn)?YdKdx(5ZFLan)~t{Xgg5x_m3|am|55v zAi0|n;yOqyfKoLmnxU5b2g))s+}S@5#5({p5FmiS27)sAZ(zFm_Wn80Fjj`&-#&u9 z0**yU;DNmljs&O|{{p>>WEd#Bya3Sv0mK5a>_5ZTw@(zIoRRvNjv}m002ovPDHLk FV1i0inA-pV literal 0 HcmV?d00001 diff --git a/src/XGUI/pictures/cylinder.png b/src/GeomModule/icons/cylinder.png similarity index 100% rename from src/XGUI/pictures/cylinder.png rename to src/GeomModule/icons/cylinder.png diff --git a/src/XGUI/pictures/disk.png b/src/GeomModule/icons/disk.png similarity index 100% rename from src/XGUI/pictures/disk.png rename to src/GeomModule/icons/disk.png diff --git a/src/XGUI/pictures/torus.png b/src/GeomModule/icons/torus.png similarity index 100% rename from src/XGUI/pictures/torus.png rename to src/GeomModule/icons/torus.png 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 0000000000000000000000000000000000000000..e2db55f22d6752e10a57f07e286081ebebacfea5 GIT binary patch literal 792 zcmV+z1LypSP)AsU_?Zci9d!A_6x~Insr^bw(It`ecQh8*8@Fx_eq|^b9kOS$wyR`|06NPhocs8 zU?v>-=-EnfdDG!10kVJ}=mfmL3x4C3JD#r5^Se7=<^gXYh=3bt;e*loYJQ%@zqp#o zc)ieEZw~|j12}i_vg*D#!8fNTYH-)p(SZRifR{fXpPVOOg5)8_Pfax}pxL$sOiaI_ z9663WbAXxGGQR;QY}-bF{nj_X{Nr6+f*aSdgArUWy~x7#3tYQ*U;M!9W0N|Xd56Y> zdw6NVP@4PMEslKs#fSj7!@bq{RDZ|F(lUi+9ee>|JyA+;y-hurBRMxmp;CdWNzChE zEgUAbv5jI00Q-_DfCrBwQLTgC1pOJbJebx(GO4#fZ-Z7r7eRrwu3!}WegvSSe~?;s zg&54uc6CmaclX!;Ty0b?pa&4c#fOgla1%y+p#)Z=f~-xR;Wr)XE6PJrdB<@ zkX^(65AWw<3BGfCZc8qEVwk5llHC!E4clf5C;=vLa<_ciGWRF}HJ|~Mfr?dU+T}WK zwsR5K0^D`Sq1rBg5bskfzs`!nAt2Vip96}O9S)jR-j65r$IZL|SSUu*ZczvKR4}MU zA;+G=VV*iLHje+;F`frfK+$f}Su8OX4QUMmEk`k$jYjm7Pd{sRn(48RUTuLs23_h7>hH;3oe{xsP*g;=fdj*7t_=_KYN7DNh9L(*MX+IPs+eE= zDxM&f=%ZXQal{bBz)%Dm!3LQf+RwS^Q`pLYql&h1ISRI;>9a!ve49Rq1EL~0BK!+x WVm^3T=Dr&M0000q|Kvf$(T^vI!{EtowuW%rg#hx$F!+eebM%TlkDL?zA1!PHH^f^@Yzo zP37j!k(>2|ncsBo-gVa5W!$^u?HUE5Z+y(Y@pBK( ze&4ETGv8l3)kES!LGbP1E*8aqKDQh9e4g@1e~Qx0yAS@e?{nUz{`Fqxj#JsP(m=;E Nc)I$ztaD0e0sssqb!q?r literal 0 HcmV?d00001 diff --git a/src/XGUI/pictures/button_ok.png b/src/XGUI/pictures/button_ok.png new file mode 100644 index 0000000000000000000000000000000000000000..5b0f6a6174f67879d89b8c970d88734cd6f9f844 GIT binary patch literal 883 zcmV-(1C0EMP)wF51aIxG|t0o~WeTux?(*f!J?S`!vJrWM3^ z)v?u>(g^>@;xO#mkNlu=e*%b!BkO=S9U%&s|{QUTj4;ur+Qxv`b{1=&{q{_{@=tdkKKPJjPv{N-R+ z=H{q0b!wOgrI|?`QkZ(!{_7i9LV-VtRJx`%DQ2F^23wD{DqBhIRk` zF);r5{m+$GoMl&Put7+Jt2=`@4-Z4{!AlI=w!d7({+qd+0V(7F0suh(zW)OTFd63V z^!sFSNlF9<4gMd;*WzU&Dh*+FS2`3*A~OK^{__Bz$W0R(*Uum z?9l=80a*nF0_+3*1ONs71^@>82>=H93IGBCK>)u00}wAF|NZm@`|<(rTQ4UU0WcOM z00aL60Pp?k0KeVV0IsF+;Q#FbO$G-6;062!00#UB00{XE00{OE015OE00M|vNJE=} z^$*A6FQ5Ne@vDAS;$dfD`1Jo3!|5mY7`86`{^s{nmH;M>-&g)K|ATm%5g73x%=8b8 z0Ro7L;}<&v=RdZejL-PCo<9Aa;W^_ShKsN6GwfXY>&vg(Trted45#rWFn|DJV*bm{ z0Ky#q*cZJ%!~O8Y?dJ?fS26$kepw(JsCg%$6bcYP%o1uwz$j&AU}9wa&h(8#?9FW+ ziyzl{>lm2-O#9FFhv6UdZ-)OYzzhWT0wab200G2EX?6w(FaS`kAv2YZ@FM^K002ov JPDHLkV1n^7jC=q9 literal 0 HcmV?d00001 diff --git a/src/XGUI/pictures/x_point.png b/src/XGUI/pictures/x_point.png new file mode 100644 index 0000000000000000000000000000000000000000..e6aff9e6d6d7f1bd6ebac75f52e122ee674e9a2a GIT binary patch literal 396 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjEa{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{^MbQ4*Y=R#Ki=l*$m0n3-3i=jR%tP-d)Ws%L2E{@KZ#fq{|3 z)5S5w!+Yx`Z{9-=BCQV-n;WeTFtB;tSiFGG!;OJW-~b=5gu+2)?Qc2(3__=DUv8Ou z+~4WMh95!C3aa%)Vy>6gw%``DW7)Z?ckS9Fvx89uT4{J2j7~5Fi`z;K48vfaYd(PQ}h=9m=t*9+WEgKYr zGUMxxf44s%@N(vN?tOJOO^FA0n@y2F{B^Z_gn>`Rb&1+n)fIbq|Kvi!%T^vI^yx&gRDB5Ho;`*O2=KzylLgHJN9ED@^ZfUO3l|6Xr-XYc* z2L*fnJ5G@K{Gp>}tMNQn-9K z%PwX)uyy^K1%KAWOr3MCiJzrXgH>SdiMz*5QEcS7q%*UB!9rD&EiG+j6+4-y X6zVCdzYxd=`kTSi)z4*}Q$iB}j^UIe literal 0 HcmV?d00001 diff --git a/src/XGUI/pictures/y_point.png b/src/XGUI/pictures/y_point.png new file mode 100644 index 0000000000000000000000000000000000000000..d9658dd082f84623a7528b1da6a634e5b3d6bd7e GIT binary patch literal 362 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjEa{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{^MbQ4*Y=R#Ki=l*$m0n3-3i=jR%tP-d)Ws%L2E{@KYKsOp)g zi(`m~_tgt~c@G%~v?X5Nz#zSWfm`9?W{yehCzv{BWlq?{ENaUte1PMbpW(;*(wwgD zjvqBnP5)fm70dB(xxto}g{nN#adM`!m?gwAezKnpH;|di9sejM)rjr6kwo96MYAI~ z&Q5bW?ZaK>bl?8c{0lpI+7^c_;QrjyZlD|BzOcUNq>*HEu_O=o&rMQ5-8pAs)D}$xEpcjJgW{)mQr=hC(iz$` zV$X8!_dg)OdwnshY~B0@#b5uMW*Te}z9X$=oHBWWN2bPDNB8 zb~7$DE-^7j^FlWO00DbRL_t(YOTCgiO9Md^g(toOHt7Vd1hKZUv$hL@m7t*QMtp%< zS;R)L7Hll+L<>O>1Y1S15-cqAABc@$C&I4ZUG63(o0-g-H3vR+_RhWMWM^XjqG;Ka zqKa9EN7ffw&R3WZ!)8}P!istRw~#O}WjH6~J@*iP{S+Kx{zk|(&zIan5_9-~D*^(@ z=T4fCN38R#`Zi(?Ej6(soLB3)F zdbOod4A1B?7Vj?eS@?t-IE5AXhE;7z3xhL=LwH)vMHrP~9**D=ULk}NnAWyNvGIkG zgsg$pJQ4jxC_%rN!VXBtvAk=!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{^MbQ4*Y=R#Ki=l*$m0n3-3i=jR%tP-d)Ws%L2E{@KYKsOpWU zi(`m~_tr}Xc@G)zv_33IWHfsr<8fzZgQSszxPz@RuaNbZBWykl$}G}elP&7ILzcGt zAK09HSxc{FgBDNrp$%$0+;Mg~ub3s$GJf!Xm6quH)Tm!*ICIOvoh)sOEneuEIc;8h zAvIK7rsdziPJgH8LK1zCm}F<@RdlT4z7qLja?E6(TMuHG4*OW0Syab-_|Tz;T!&{F ztl>P|Q=a>=YG2eFbAvfg?)rUs^z)~mEnC~!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{^MbQ4*Y=R#Ki=l*$m0n3-3i=jR%tP-d)Ws%L2E{@KYKsOr9_ zi(`m~_uHv^c@G%~wC1PXAbo(P=fUH9FJ&w{RVUBy ztGU#zUuS2p?IptXaFSk(p#Q|JZi#X?VlKxyGwp23Tcmz$A$w%@lt2fbyBy1XbHtLl zJw7dG44Usca~AW1$dzY!53qj|d|TqkV52=%m62b1{jL)S=1e^`sexy9bnk{c)e^Rw znXd>evFrG-V?pwZ#-of5?}`H#XNPgU*sCdbX1$O>tFFRHu?Z<653;NZ9lr;xTM}0H xBR^33qf~b9BE}shpO*g(T(>BEeZ9&u{h0r=Y@W=Skq`7LgQu&X%Q~loCIF;Xh0_24 literal 0 HcmV?d00001 -- 2.39.2