]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Testing GUI version
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 11 Mar 2014 14:25:24 +0000 (18:25 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 11 Mar 2014 14:25:24 +0000 (18:25 +0400)
36 files changed:
CMakeCommon/FindCAS.cmake
CMakeCommon/FindQt5.cmake
CMakeLists.txt
env.bat
src/GeomModule/CMakeLists.txt [new file with mode: 0644]
src/GeomModule/GeomModule.cpp
src/GeomModule/GeomModule.h
src/GeomModule/GeomModule_Defs.h
src/GeomModule/GeomModule_icons.qrc [new file with mode: 0644]
src/GeomModule/GeomModule_msg_en.ts [new file with mode: 0644]
src/GeomModule/icons/box.png [new file with mode: 0644]
src/GeomModule/icons/cylinder.png [new file with mode: 0644]
src/GeomModule/icons/disk.png [new file with mode: 0644]
src/GeomModule/icons/torus.png [new file with mode: 0644]
src/GeomModule/main_menu.xml [deleted file]
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_Interfaces.h [new file with mode: 0644]
src/XGUI/XGUI_MainWindow.cpp
src/XGUI/XGUI_MainWindow.h
src/XGUI/XGUI_Module.h [deleted file]
src/XGUI/XGUI_Workbench.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h
src/XGUI/XGUI_pictures.qrc
src/XGUI/pictures/button_cancel.png [new file with mode: 0644]
src/XGUI/pictures/button_help.png [new file with mode: 0644]
src/XGUI/pictures/button_ok.png [new file with mode: 0644]
src/XGUI/pictures/cylinder.png [deleted file]
src/XGUI/pictures/disk.png [deleted file]
src/XGUI/pictures/torus.png [deleted file]
src/XGUI/pictures/x_point.png [new file with mode: 0644]
src/XGUI/pictures/x_size.png [new file with mode: 0644]
src/XGUI/pictures/y_point.png [new file with mode: 0644]
src/XGUI/pictures/y_size.png [new file with mode: 0644]
src/XGUI/pictures/z_point.png [new file with mode: 0644]
src/XGUI/pictures/z_size.png [new file with mode: 0644]

index 110e7c077b39709c083c644edc641946688893e0..ad673e930a8e810ea14804dae0da750bcfc4ce61 100644 (file)
@@ -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 )
index 81ae7b18eb0526e72d165ea4d3cfa825ab7cb0be..bed3180b21de30ba59427498f13ca4a19203f7c1 100644 (file)
@@ -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)
index c44ff627d7ab6571bcd022c6650048dcddb34270..89da6f7270803a7c9e4ec24819432133448ad19e 100644 (file)
@@ -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 f9429a84af4e360b07db5ac1fd354335661c2b73..087df80ce760e9009ae56346ee6364396c13d2a7 100644 (file)
--- 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 (file)
index 0000000..a27056b
--- /dev/null
@@ -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)
index de003fd87715a8e729e59addff70769060a788e1..37ec7e5b2361162ebdbbc94a43638a6a283a388d 100644 (file)
@@ -6,22 +6,15 @@
 #include <QTextStream>
 
 /*!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
index 8ccd09aa8bf87a1204ae1d812bc17e3984838270..80c8ae5015f1874120294e4bd0f2ed18dd274abb 100644 (file)
@@ -4,18 +4,20 @@
 
 #include "GeomModule_Defs.h"
 
-#include <XGUI_Module.h>
+#include <XGUI_Interfaces.h>
 
-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
index 45697e58793f3dd3b05caf60415bafc27b8ad15f..faa697282da70699bba8e7fbc9de2b1b2e063ff0 100644 (file)
@@ -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 (file)
index 0000000..3f6a8a3
--- /dev/null
@@ -0,0 +1,8 @@
+ <!DOCTYPE RCC><RCC version="1.0">
+ <qresource>
+     <file>icons/box.png</file>
+     <file>icons/cylinder.png</file>
+     <file>icons/disk.png</file>
+     <file>icons/torus.png</file>
+ </qresource>
+ </RCC>
diff --git a/src/GeomModule/GeomModule_msg_en.ts b/src/GeomModule/GeomModule_msg_en.ts
new file mode 100644 (file)
index 0000000..4270bb8
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+<context>
+    <name>@default</name>
+</context>
+<context>
+    <name>XGUI_Workshop</name>
+    <message>
+        <source>HOME_MENU_TITLE</source>
+        <translation>Home</translation>
+    </message>
+    <message>
+        <source>NEW_MENU</source>
+        <translation>New</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/GeomModule/icons/box.png b/src/GeomModule/icons/box.png
new file mode 100644 (file)
index 0000000..3047d92
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 (file)
index 0000000..a00136d
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 (file)
index 0000000..8aad056
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 (file)
index 0000000..af76fc0
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 (file)
index 5a81a5d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<main_menu>
-    <workbench name="Primitives">
-        <group>
-            <operation
-                name="box_operation"
-                icon=":icons/box.png"
-                title="OPERATION_BOX_MENU"
-                tooltip="OPERATION_BOX_TIP"
-            />
-        </group>
-    </workbench>
-</main_menu>
index ee41e8cb90dd4f6b7a88359071370a0ac99f2b21..edc7d7e2568fc22d38a21244480def233b742053 100644 (file)
@@ -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 (file)
index 0000000..1272501
--- /dev/null
@@ -0,0 +1,39 @@
+
+#ifndef XGUI_Interfaces_H
+#define XGUI_Interfaces_H
+
+#include <QString>
+#include <QIcon>
+#include <QKeySequence>
+
+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
index 3c4e99b49d3dd5caea59bbf1a34e48150f6cae46..729f1869bcc76703835c51436da5703481cb1a41 100644 (file)
 #include <QToolButton>
 #include <QAction>
 #include <QTreeWidgetItem>
+#include <QLayout>
+#include <QLineEdit>
+#include <QGroupBox>
+#include <QFormLayout>
+#include <QDoubleSpinBox>
+#include <QPushButton>
 
 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
index dfd5703c8ab60d13eae0751b16384b8c9a1c50cd..d6590d44a1e95d6f24ec5c71982a1a62d5b22b6f 100644 (file)
@@ -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 (file)
index bac802a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-
-#ifndef XGUI_Module_H
-#define XGUI_Module_H
-
-#include <QString>
-
-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
index 9a539f1849354ad573462cadcab828389c221a32..3cecc44b9cb091fa5187392bdf9fda7dd502620e 100644 (file)
@@ -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());
 }
index 2644722fe2da739429dac687306f8abb092b28ec..810e0344bc6b142ab5291c0556332c6f361afd20 100644 (file)
@@ -3,7 +3,6 @@
 #include "XGUI_MainMenu.h"
 #include "XGUI_Command.h"
 #include "XGUI_Tools.h"
-#include "XGUI_Module.h"
 
 #include <QApplication>
 #include <QFileDialog>
@@ -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);
 }
index 9b7980196d9aea866d19d82a88ec041112980f76..cfeb70092b332d850e2a3d293001bcad3441ae3c 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef XGUI_WORKSHOP_H
 #define XGUI_WORKSHOP_H
 
+#include "XGUI_Interfaces.h"
+
 #include <QObject>
 #include <QMap>
 #include <QIcon>
@@ -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, 
index f882c6cf976d069296eec202489fc70b8495ce02..ee262ff3f8beb71e3bd5febe337026ba1a8d22e0 100644 (file)
      <file>pictures/redo.png</file>
      <file>pictures/undo.png</file>
      <!--For test purposes-->
-     <file>pictures/box.png</file>
-     <file>pictures/cylinder.png</file>
-     <file>pictures/disk.png</file>
-     <file>pictures/torus.png</file>
+
      <file>pictures/ViewPort.png</file>
      
      <file>pictures/occ_view_ambient.png</file>
      <file>pictures/properties.png</file>
      <file>pictures/features.png</file>
      
+     <file>pictures/x_point.png</file>
+     <file>pictures/y_point.png</file>
+     <file>pictures/z_point.png</file>
+     <file>pictures/x_size.png</file>
+     <file>pictures/y_size.png</file>
+     <file>pictures/z_size.png</file>
+
+     <file>pictures/button_cancel.png</file>
+     <file>pictures/button_help.png</file>
+     <file>pictures/button_ok.png</file>
  </qresource>
  </RCC>
diff --git a/src/XGUI/pictures/button_cancel.png b/src/XGUI/pictures/button_cancel.png
new file mode 100644 (file)
index 0000000..e2db55f
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 (file)
index 0000000..91a4d59
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 (file)
index 0000000..5b0f6a6
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 (file)
index a00136d..0000000
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 (file)
index 8aad056..0000000
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 (file)
index af76fc0..0000000
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 (file)
index 0000000..e6aff9e
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 (file)
index 0000000..f3ee831
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 (file)
index 0000000..d9658dd
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 (file)
index 0000000..9b39fda
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 (file)
index 0000000..33fe92b
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 (file)
index 0000000..7ac1139
Binary files /dev/null and b/src/XGUI/pictures/z_size.png differ