]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Define abstract module class
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 6 Oct 2014 12:36:13 +0000 (16:36 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 6 Oct 2014 12:36:13 +0000 (16:36 +0400)
24 files changed:
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_IModule.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_IViewer.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_IWorkshop.h
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/NewGeom/CMakeLists.txt
src/NewGeom/NewGeom_Module.h
src/NewGeom/NewGeom_SalomeViewer.cpp
src/NewGeom/NewGeom_SalomeViewer.h
src/PartSet/PartSet_Listener.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_ModuleConnector.h
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_OperationMgr.h
src/XGUI/XGUI_SalomeConnector.h
src/XGUI/XGUI_SalomeViewer.h [deleted file]
src/XGUI/XGUI_ViewerProxy.cpp
src/XGUI/XGUI_ViewerProxy.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index cb84e1693f2969c8cbea67ad741a599552b87b1e..1e49aef443cb866012974e9b8fc553d225b74fc9 100644 (file)
@@ -29,10 +29,12 @@ SET(PROJECT_HEADERS
        ModuleBase_WidgetFileSelector.h
        ModuleBase_DoubleSpinBox.h
        ModuleBase_IPropertyPanel.h
+       ModuleBase_IViewer.h
 )
 
 SET(PROJECT_SOURCES
        ModuleBase_Tools.cpp
+       ModuleBase_IModule.cpp
        ModuleBase_Operation.cpp
        ModuleBase_OperationDescription.cpp
        ModuleBase_ModelWidget.cpp
diff --git a/src/ModuleBase/ModuleBase_IModule.cpp b/src/ModuleBase/ModuleBase_IModule.cpp
new file mode 100644 (file)
index 0000000..c8b347f
--- /dev/null
@@ -0,0 +1,33 @@
+
+#include "ModuleBase_IModule.h"
+#include "ModuleBase_ViewerPrs.h"
+#include "ModuleBase_Operation.h"
+#include "ModuleBase_ISelection.h"
+
+#include <Events_Loop.h>
+
+#include <ModelAPI_Events.h>
+
+#include <Config_PointerMessage.h>
+
+
+void ModuleBase_IModule::launchOperation(const QString& theCmdId)
+{
+  ModuleBase_Operation* anOperation = createOperation(theCmdId.toStdString());
+  ModuleBase_ISelection* aSelection = myWorkshop->selection();
+  // Initialise operation with preliminary selection
+  std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+  std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
+  anOperation->initSelection(aSelected, aHighlighted);
+  sendOperation(anOperation);
+}
+
+
+void ModuleBase_IModule::sendOperation(ModuleBase_Operation* theOperation)
+{
+  static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED);
+  boost::shared_ptr<Config_PointerMessage> aMessage =
+      boost::shared_ptr<Config_PointerMessage>(new Config_PointerMessage(aModuleEvent, this));
+  aMessage->setPointer(theOperation);
+  Events_Loop::loop()->send(aMessage);
+}
index df599f4164206b737eda23c0387b74f14cc1e11b..3bea34002f32817fddaea37358746822060ccc83 100644 (file)
@@ -1,20 +1,30 @@
 #ifndef ModuleBase_IModule_H\r
 #define ModuleBase_IModule_H\r
 \r
+#include "ModuleBase.h"
+#include "ModuleBase_IWorkshop.h"\r
+\r
 #include <QString>\r
 #include <QObject>\r
 \r
+\r
 class QAction;\r
-class XGUI_Workshop;\r
 class Config_WidgetAPI;\r
 class ModuleBase_ModelWidget;\r
+class ModuleBase_Operation;\r
+class ModuleBase_IWorkshop;\r
 \r
 /**\r
  * Interface to a module\r
  */\r
-class ModuleBase_IModule : public QObject\r
+class MODULEBASE_EXPORT ModuleBase_IModule : public QObject\r
 {\r
  public:\r
+\r
+   ModuleBase_IModule(ModuleBase_IWorkshop* theParent): QObject(theParent), myWorkshop(theParent) {}\r
+\r
+  virtual ~ModuleBase_IModule() {}\r
+\r
   /// Reads description of features from XML file \r
   virtual void createFeatures() = 0;\r
 \r
@@ -23,7 +33,7 @@ class ModuleBase_IModule : public QObject
 \r
   /// Creates an operation and send it to loop\r
   /// \param theCmdId the operation name\r
-  virtual void launchOperation(const QString& theCmdId) = 0;\r
+  virtual void launchOperation(const QString& theCmdId);\r
 \r
   /// Called when it is necessary to update a command state (enable or disable it)\r
   //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;\r
@@ -36,15 +46,29 @@ class ModuleBase_IModule : public QObject
     return 0;\r
   }\r
 \r
-  virtual ~ModuleBase_IModule()\r
-  {\r
-  }\r
-  ;\r
+  ModuleBase_IWorkshop* workshop() const { return myWorkshop; }\r
+\r
+ protected:\r
+  /// Sends the operation for launching\r
+  /// \param theOperation the operation\r
+  void sendOperation(ModuleBase_Operation* theOperation);\r
+\r
+  /// Creates a new operation\r
+  /// \param theCmdId the operation name\r
+  /// \param theFeatureKind a kind of feature to get the feature xml description\r
+  virtual ModuleBase_Operation* createOperation(const std::string& theCmdId,\r
+                                        const std::string& theFeatureKind = "") = 0;\r
+\r
+\r
+protected:\r
+\r
+  ModuleBase_IWorkshop* myWorkshop;\r
+\r
 };\r
 \r
 //! This function must return a new module instance.\r
 extern "C" {\r
-typedef ModuleBase_IModule* (*CREATE_FUNC)(XGUI_Workshop*);\r
+typedef ModuleBase_IModule* (*CREATE_FUNC)(ModuleBase_IWorkshop*);\r
 }\r
 \r
 #define CREATE_MODULE "createModule"\r
diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h
new file mode 100644 (file)
index 0000000..6858fbe
--- /dev/null
@@ -0,0 +1,74 @@
+#ifndef ModuleBase_IViewer_H
+#define ModuleBase_IViewer_H
+
+#include "ModuleBase.h"
+#include <QObject>
+#include <AIS_InteractiveContext.hxx>
+#include <V3d_View.hxx>
+
+class QMouseEvent;
+class QKeyEvent;
+class QContextMenuEvent;
+
+/**
+ * A Base object for definition of connector object to
+ * Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
+ */
+class MODULEBASE_EXPORT ModuleBase_IViewer : public QObject
+{
+Q_OBJECT
+ public:
+  ModuleBase_IViewer(QObject* theParent)
+      : QObject(theParent)
+  {
+  }
+
+  //! Returns AIS_InteractiveContext from current OCCViewer
+  virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
+
+  //! Retrurns V3d_Vioewer from current viewer
+  virtual Handle(V3d_Viewer) v3dViewer() const = 0;
+
+  //! Returns Vsd_View object from currently active view window
+  virtual Handle(V3d_View) activeView() const = 0;
+
+  //! Enable or disable selection in the viewer
+  virtual void enableSelection(bool isEnabled) = 0;
+
+  //! Returns true if selection is enabled
+  virtual bool isSelectionEnabled() const = 0;
+
+  //! Enable or disable multiselection in the viewer
+  virtual void enableMultiselection(bool isEnable) = 0;
+
+  //! Returns true if multiselection is enabled
+  virtual bool isMultiSelectionEnabled() const = 0;
+
+  //! Perfroms the fit all for the active view
+  virtual void fitAll() = 0;
+
+  //! Sets the view projection
+  /// \param theX the X projection value
+  /// \param theY the Y projection value
+  /// \param theZ the Z projection value
+  virtual void setViewProjection(double theX, double theY, double theZ) = 0;
+
+
+signals:
+  void lastViewClosed();
+  void tryCloseView();
+  void deleteView();
+  void viewCreated();
+  void mousePress(QMouseEvent* theEvent);
+  void mouseRelease(QMouseEvent* theEvent);
+  void mouseDoubleClick(QMouseEvent* theEvent);
+  void mouseMove(QMouseEvent* theEvent);
+  void keyPress(QKeyEvent* theEvent);
+  void keyRelease(QKeyEvent* theEvent);
+  void activated();
+
+  void selectionChanged();
+  void contextMenuRequested(QContextMenuEvent*);
+};
+
+#endif
index b05e2d62976875af9a6eddeec709a7eefcb5a89a..d4b9265ca1868233629abd8744451fc8eced7f5d 100644 (file)
@@ -9,11 +9,12 @@
 
 #include <ModelAPI_Object.h>
 
-#include <AIS_InteractiveContext.hxx>
-
 #include <QObject>
 
 class ModuleBase_IModule;
+class ModuleBase_ISelection;
+class ModuleBase_IViewer;
+class ModuleBase_Operation;
 
 /**
  * Class which provides access to Workshop object serveces
@@ -24,25 +25,27 @@ Q_OBJECT
  public:
   ModuleBase_IWorkshop(QObject* theParent)
       : QObject(theParent)
-  {
-  }
+  {}
 
   virtual ~ModuleBase_IWorkshop()
-  {
-  }
-  ;
-
-  //! Returns AIS_InteractiveContext from current OCCViewer
-  virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
+  {}
 
-  //! Returns list of currently selected data objects
-  virtual QList<ObjectPtr> selectedObjects() const = 0;
+  virtual ModuleBase_ISelection* selection() const = 0;
 
   //! Returns instance of loaded module
   virtual ModuleBase_IModule* module() const = 0;
 
+  //! Returns current viewer
+  virtual ModuleBase_IViewer* viewer() const = 0;
+
+  //! Returns currently active operation
+  virtual ModuleBase_Operation* currentOperation() const = 0;
+
 signals:
   void selectionChanged();
+
+  void operationStarted(ModuleBase_Operation*);
+  void operationStopped(ModuleBase_Operation*);
 };
 
 #endif
index a5e09fea367af384b75ca16d969b2dc54d200216..47471dab3ef16e2046636f43debc39712a180931 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "ModuleBase_WidgetShapeSelector.h"
 #include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_ISelection.h>
 #include "ModuleBase_WidgetValue.h"
 #include <ModuleBase_Tools.h>
 #include "ModuleBase_WidgetValueFeature.h"
@@ -138,7 +139,7 @@ QList<QWidget*> ModuleBase_WidgetShapeSelector::getControls() const
 //********************************************************************
 void ModuleBase_WidgetShapeSelector::onSelectionChanged()
 {
-  QList<ObjectPtr> aObjects = myWorkshop->selectedObjects();
+  QList<ObjectPtr> aObjects = myWorkshop->selection()->selectedObjects();
   if (aObjects.size() > 0) {
     ObjectPtr aObject = aObjects.first();
     if ((!mySelectedObject) && (!aObject))
index 1883fbb61b86da4da9c4618fa4825ca540bd1486..dcc5bdae5f8d38b2d72bec640556f748019309c3 100644 (file)
@@ -30,6 +30,7 @@ SET(PROJECT_LIBRARIES
     Events
     Config
        XGUI
+       ModuleBase
        ${QT_LIBRARIES}
        ${suit}
        ${std}
index aad4775ca0fdb0376fc947cfb7dab3ff6316dbe1..9bda5d276e224f1856bd7ae543a08a5ed26093dd 100644 (file)
@@ -59,7 +59,7 @@ Q_OBJECT
   virtual QStringList nestedActions(const QString& theId) const;
 
   //! Returns interface to Salome viewer
-  virtual XGUI_SalomeViewer* viewer() const
+  virtual ModuleBase_IViewer* viewer() const
   {
     return myProxyViewer;
   }
index 4d4a74ec9a2bc0a4bddedc99e68cb717a014370d..9049d0cf6669f026fe6ec1d02077c8f846bb5a72 100644 (file)
@@ -11,7 +11,7 @@
 #include <QContextMenuEvent>
 
 NewGeom_SalomeViewer::NewGeom_SalomeViewer(QObject* theParent)
-    : XGUI_SalomeViewer(theParent),
+    : ModuleBase_IViewer(theParent),
       mySelector(0)
 {
 }
@@ -150,3 +150,18 @@ void NewGeom_SalomeViewer::fitAll()
     aVFrame->onFitAll();
   }
 }
+
+//**********************************************
+void NewGeom_SalomeViewer::setViewProjection(double theX, double theY, double theZ)
+{
+  SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
+  OCCViewer_ViewFrame* aVFrame = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
+  if (aVFrame) {
+    Handle(V3d_View) aView3d = aVFrame->getViewPort()->getView();
+    if (!aView3d.IsNull()) {
+      aView3d->SetProj(theX, theY, theZ);
+      aView3d->FitAll(0.01, true, true);
+      aView3d->SetZSize(0.);
+    }
+  }
+}
\ No newline at end of file
index 7f638ac86cd3a6eb79d4924336525dda83bb7ad0..29bdd5218be92523f8d6de153d056fbfbded17f1 100644 (file)
@@ -4,7 +4,7 @@
 
 #include "NewGeom.h"
 
-#include <XGUI_SalomeViewer.h>
+#include <ModuleBase_IViewer.h>
 
 class SUIT_ViewWindow;
 class QMouseEvent;
@@ -12,7 +12,7 @@ class QKeyEvent;
 
 class NewGeom_OCCSelector;
 
-class NewGeom_SalomeViewer : public XGUI_SalomeViewer
+class NewGeom_SalomeViewer : public ModuleBase_IViewer
 {
 Q_OBJECT
  public:
@@ -42,6 +42,12 @@ Q_OBJECT
   //! Perfroms the fit all for the active view
   virtual void fitAll();
 
+  //! Sets the view projection
+  /// \param theX the X projection value
+  /// \param theY the Y projection value
+  /// \param theZ the Z projection value
+  virtual void setViewProjection(double theX, double theY, double theZ);
+
   void setSelector(NewGeom_OCCSelector* theSel);
 
   NewGeom_OCCSelector* selector() const
index f66ac66b4d4c9b85bf70c37870dbe73d5b2ecc92..8dd90a84528be2dcc1766afbe94caa9f9267b92c 100644 (file)
@@ -39,12 +39,12 @@ PartSet_Listener::~PartSet_Listener()
 //******************************************************
 void PartSet_Listener::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
 {
-  ModuleBase_Operation* anOperation = myModule->workshop()->operationMgr()->currentOperation();
+  ModuleBase_Operation* anOperation = myModule->xWorkshop()->operationMgr()->currentOperation();
   PartSet_OperationSketchBase* aSketchOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (!aSketchOp)
     return;
 
-  XGUI_Displayer* aDisplayer = myModule->workshop()->displayer();
+  XGUI_Displayer* aDisplayer = myModule->xWorkshop()->displayer();
   QString aType = QString(theMessage->eventID().eventText());
   if (aType == EVENT_OBJECT_CREATED) {
     boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
@@ -52,7 +52,7 @@ void PartSet_Listener::processEvent(const boost::shared_ptr<Events_Message>& the
     std::set<ObjectPtr> aFeatures = aUpdMsg->objects();
 
     PartSet_OperationSketch* aSketchOp = 
-      dynamic_cast<PartSet_OperationSketch*>(myModule->workshop()->operationMgr()->currentOperation());
+      dynamic_cast<PartSet_OperationSketch*>(myModule->xWorkshop()->operationMgr()->currentOperation());
 
     std::set<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
     for (; anIt != aLast; anIt++) {
@@ -65,7 +65,7 @@ void PartSet_Listener::processEvent(const boost::shared_ptr<Events_Message>& the
       // If current operation is Sketch then there is no active sketching operation
       // and possible the object was created by Redo operatgion
       else if (aSketchOp) {
-          XGUI_Displayer* aDisplayer = myModule->workshop()->displayer();
+          XGUI_Displayer* aDisplayer = myModule->xWorkshop()->displayer();
           // Very possible it is not displayed
           aDisplayer->display(aObj, false);
           std::list<int> aModes = aSketchOp->getSelectionModes(aObj);
@@ -83,7 +83,7 @@ void PartSet_Listener::processEvent(const boost::shared_ptr<Events_Message>& the
     for (; anIt != aLast; anIt++) {
       std::string aGroup = *anIt;
       if (aGroup.compare(SketchPlugin_Sketch::ID()) == 0) {  // Update only Sketch group
-        myModule->workshop()->displayer()->eraseDeletedResults();
+        myModule->xWorkshop()->displayer()->eraseDeletedResults();
         myModule->updateCurrentPreview(aGroup);
       }
     }
index 1a26bbeb947409204def09b220bb103cdfda0974..8b45d5e47a7d7a98075fffcd5a556876f817d5ea 100644 (file)
@@ -26,8 +26,6 @@
 #include <XGUI_Viewer.h>
 #include <XGUI_Workshop.h>
 #include <XGUI_OperationMgr.h>
-#include <XGUI_SelectionMgr.h>
-#include <XGUI_Selection.h>
 #include <XGUI_ViewPort.h>
 #include <XGUI_ActionsMgr.h>
 #include <XGUI_ViewerProxy.h>
@@ -42,8 +40,8 @@
 #include <Config_ModuleReader.h>
 #include <Config_WidgetReader.h>
 #include <Events_Loop.h>
-#include <Events_Message.h>
-#include <Events_Error.h>
+//#include <Events_Message.h>
+//#include <Events_Error.h>
 
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_AISObject.h>
 #endif
 
 /*!Create and return new instance of XGUI_Module*/
-extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(XGUI_Workshop* theWshop)
+extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
 {
   return new PartSet_Module(theWshop);
 }
 
-PartSet_Module::PartSet_Module(XGUI_Workshop* theWshop)
+PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
+  : ModuleBase_IModule(theWshop)
 {
-  myWorkshop = theWshop;
+  //myWorkshop = theWshop;
   myListener = new PartSet_Listener(this);
 
-  XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
+  connect(myWorkshop, SIGNAL(operationStarted(ModuleBase_Operation*)), 
+    this, SLOT(onOperationStarted(ModuleBase_Operation*)));
 
-  connect(anOperationMgr, SIGNAL(operationStarted()), this, SLOT(onOperationStarted()));
-
-  connect(anOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), this,
+  connect(myWorkshop, SIGNAL(operationStopped(ModuleBase_Operation*)), this,
           SLOT(onOperationStopped(ModuleBase_Operation*)));
 
-  XGUI_ContextMenuMgr* aContextMenuMgr = myWorkshop->contextMenuMgr();
+  XGUI_ContextMenuMgr* aContextMenuMgr = xWorkshop()->contextMenuMgr();
   connect(aContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
           SLOT(onContextMenuCommand(const QString&, bool)));
 
@@ -101,11 +99,6 @@ PartSet_Module::~PartSet_Module()
 {
 }
 
-XGUI_Workshop* PartSet_Module::workshop() const
-{
-  return myWorkshop;
-}
-
 void PartSet_Module::createFeatures()
 {
   //Registering of validators
@@ -149,31 +142,30 @@ void PartSet_Module::onFeatureTriggered()
   launchOperation(aCmd->data().toString());
 }
 
-void PartSet_Module::launchOperation(const QString& theCmdId)
-{
-  ModuleBase_Operation* anOperation = createOperation(theCmdId.toStdString());
-  //PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
-  //if (aPreviewOp) {
-    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
-    // Initialise operation with preliminary selection
-    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
-    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
-    anOperation->initSelection(aSelected, aHighlighted);
-  //}
-  sendOperation(anOperation);
-}
+//void PartSet_Module::launchOperation(const QString& theCmdId)
+//{
+//  ModuleBase_Operation* anOperation = createOperation(theCmdId.toStdString());
+//  //PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+//  //if (aPreviewOp) {
+//    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+//    // Initialise operation with preliminary selection
+//    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+//    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
+//    anOperation->initSelection(aSelected, aHighlighted);
+//  //}
+//  sendOperation(anOperation);
+//}
 
-void PartSet_Module::onOperationStarted()
+void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation)
 {
-  ModuleBase_Operation* aOperation = myWorkshop->operationMgr()->currentOperation();
-
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(aOperation);
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(theOperation);
   if (aPreviewOp) {
-    XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
+    XGUI_Workshop* aXWshp = xWorkshop();
+    XGUI_PropertyPanel* aPropPanel = aXWshp->propertyPanel();
     connect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)), this,
             SLOT(onStorePoint2D(ObjectPtr, const std::string&)), Qt::UniqueConnection);
 
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    XGUI_Displayer* aDisplayer = aXWshp->displayer();
     aDisplayer->openLocalContext();
     aDisplayer->deactivateObjectsOutOfContext();
   }
@@ -183,15 +175,16 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
 {
   if (!theOperation)
     return;
+  XGUI_Workshop* aXWshp = xWorkshop();
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(theOperation);
   if (aPreviewOp) {
-    XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
+    XGUI_PropertyPanel* aPropPanel = aXWshp->propertyPanel();
     //disconnect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)),
     //           this, SLOT(onStorePoint2D(ObjectPtr, const std::string&)));
   } else {
     // Activate results of current feature for selection
     FeaturePtr aFeature = theOperation->feature();
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    XGUI_Displayer* aDisplayer = aXWshp->displayer();
     std::list<ResultPtr> aResults = aFeature->results();
     std::list<ResultPtr>::const_iterator aIt;
     for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
@@ -202,7 +195,7 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
 
 void PartSet_Module::onContextMenuCommand(const QString& theId, bool isChecked)
 {
-  QList<ObjectPtr> aFeatures = myWorkshop->selector()->selection()->selectedObjects();
+  QList<ObjectPtr> aFeatures = workshop()->selection()->selectedObjects();
   if (theId == "EDIT_CMD" && (aFeatures.size() > 0)) {
     FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aFeatures.first());
     if (aFeature)
@@ -212,12 +205,12 @@ void PartSet_Module::onContextMenuCommand(const QString& theId, bool isChecked)
 
 void PartSet_Module::onMousePressed(QMouseEvent* theEvent)
 {
-
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
-      ->operationMgr()->currentOperation());
+  XGUI_Workshop* aXWshp = xWorkshop();
+  PartSet_OperationSketchBase* aPreviewOp = 
+    dynamic_cast<PartSet_OperationSketchBase*>(workshop()->currentOperation());
   Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
   if (aPreviewOp && (!aView.IsNull())) {
-    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+    ModuleBase_ISelection* aSelection = workshop()->selection();
     // Initialise operation with preliminary selection
     std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
     std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
@@ -228,11 +221,11 @@ void PartSet_Module::onMousePressed(QMouseEvent* theEvent)
 
 void PartSet_Module::onMouseReleased(QMouseEvent* theEvent)
 {
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
-      ->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = 
+    dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
   Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
   if (aPreviewOp && (!aView.IsNull())) {
-    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+    ModuleBase_ISelection* aSelection = workshop()->selection();
     // Initialise operation with preliminary selection
     std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
     std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
@@ -243,8 +236,8 @@ void PartSet_Module::onMouseReleased(QMouseEvent* theEvent)
 
 void PartSet_Module::onMouseMoved(QMouseEvent* theEvent)
 {
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
-      ->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = 
+    dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
   Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
   if (aPreviewOp && (!aView.IsNull()))
     aPreviewOp->mouseMoved(theEvent, aView);
@@ -252,7 +245,7 @@ void PartSet_Module::onMouseMoved(QMouseEvent* theEvent)
 
 void PartSet_Module::onKeyRelease(QKeyEvent* theEvent)
 {
-  ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
+  ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp) {
     aPreviewOp->keyReleased(theEvent->key());
@@ -261,11 +254,11 @@ void PartSet_Module::onKeyRelease(QKeyEvent* theEvent)
 
 void PartSet_Module::onMouseDoubleClick(QMouseEvent* theEvent)
 {
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
-      ->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = 
+    dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
   Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
   if (aPreviewOp && (!aView.IsNull())) {
-    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+    ModuleBase_ISelection* aSelection = workshop()->selection();
     // Initialise operation with preliminary selection
     std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
     std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
@@ -277,7 +270,7 @@ void PartSet_Module::onPlaneSelected(double theX, double theY, double theZ)
 {
   //erasePlanes();
   myWorkshop->viewer()->setViewProjection(theX, theY, theZ);
 myWorkshop->actionsMgr()->update();
xWorkshop()->actionsMgr()->update();
 
   //PartSet_TestOCC::testSelection(myWorkshop);
 }
@@ -302,7 +295,7 @@ void PartSet_Module::onRestartOperation(std::string theName, ObjectPtr theObject
     else {
       anOperation->setFeature(aFeature);
     }
-    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+    ModuleBase_ISelection* aSelection = workshop()->selection();
     // Initialise operation with preliminary selection
     std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
     std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
@@ -310,7 +303,7 @@ void PartSet_Module::onRestartOperation(std::string theName, ObjectPtr theObject
   } else if (aFeature) {
     anOperation->setFeature(aFeature);
     //Deactivate result of current feature in order to avoid its selection
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    XGUI_Displayer* aDisplayer = xWorkshop()->displayer();
     std::list<ResultPtr> aResults = aFeature->results();
     std::list<ResultPtr>::const_iterator aIt;
     for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
@@ -318,18 +311,18 @@ void PartSet_Module::onRestartOperation(std::string theName, ObjectPtr theObject
     }
   }
   sendOperation(anOperation);
-  myWorkshop->actionsMgr()->updateCheckState();
+  xWorkshop()->actionsMgr()->updateCheckState();
 }
 
 void PartSet_Module::onMultiSelectionEnabled(bool theEnabled)
 {
-  XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
+  ModuleBase_IViewer* aViewer = myWorkshop->viewer();
   aViewer->enableMultiselection(theEnabled);
 }
 
 void PartSet_Module::onStopSelection(const QList<ObjectPtr>& theFeatures, const bool isStop)
 {
-  XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+  XGUI_Displayer* aDisplayer = xWorkshop()->displayer();
   if (!isStop) {
     foreach(ObjectPtr aObject, theFeatures)
     {
@@ -338,7 +331,7 @@ void PartSet_Module::onStopSelection(const QList<ObjectPtr>& theFeatures, const
   }
   aDisplayer->stopSelection(theFeatures, isStop, false);
 
-  XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
+  ModuleBase_IViewer* aViewer = myWorkshop->viewer();
   aViewer->enableSelection(!isStop);
 
   aDisplayer->updateViewer();
@@ -346,14 +339,14 @@ void PartSet_Module::onStopSelection(const QList<ObjectPtr>& theFeatures, const
 
 void PartSet_Module::onSetSelection(const QList<ObjectPtr>& theFeatures)
 {
-  XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+  XGUI_Displayer* aDisplayer = xWorkshop()->displayer();
   aDisplayer->setSelected(theFeatures, false);
   aDisplayer->updateViewer();
 }
 
 void PartSet_Module::onCloseLocalContext()
 {
-  XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+  XGUI_Displayer* aDisplayer = xWorkshop()->displayer();
   aDisplayer->deactivateObjectsOutOfContext();
   aDisplayer->closeLocalContexts();
 }
@@ -361,11 +354,11 @@ void PartSet_Module::onCloseLocalContext()
 void PartSet_Module::onFeatureConstructed(ObjectPtr theFeature, int theMode)
 {
   bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
-  ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
+  ModuleBase_Operation* aCurOperation = myWorkshop->currentOperation();
   PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
   if (aPrevOp) {
     std::list<FeaturePtr> aList = aPrevOp->subFeatures();
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    XGUI_Displayer* aDisplayer = xWorkshop()->displayer();
     std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
     std::list<FeaturePtr>::iterator aSFIt;
     for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) {
@@ -395,7 +388,7 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
   if (theCmdId == PartSet_OperationSketch::Type()) {
     anOperation = new PartSet_OperationSketch(theCmdId.c_str(), this);
   } else {
-    ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
+    ModuleBase_Operation* aCurOperation = myWorkshop->currentOperation();
     FeaturePtr aSketch;
     PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
     if (aPrevOp) {
@@ -423,18 +416,9 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
   std::string aXmlCfg = aWdgReader.featureWidgetCfg(aFeatureKind);
   std::string aDescription = aWdgReader.featureDescription(aFeatureKind);
 
-  //QString aXmlRepr = QString::fromStdString(aXmlCfg);
-  //ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(),
-  //                                                             myWorkshop->moduleConnector());
-  //QWidget* aContent = myWorkshop->propertyPanel()->contentWidget();
-  //qDeleteAll(aContent->children());
-  //aFactory.createWidget(aContent);
-
   anOperation->getDescription()->setDescription(QString::fromStdString(aDescription));
   anOperation->getDescription()->setXmlRepresentation(QString::fromStdString(aXmlCfg));
 
-  //anOperation->setModelWidgets(aXmlRepr.toStdString(), aFactory.getModelWidgets());
-
   // connect the operation
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp) {
@@ -463,21 +447,21 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
   return anOperation;
 }
 
-void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
-{
-  static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED);
-  boost::shared_ptr<Config_PointerMessage> aMessage =
-      boost::shared_ptr<Config_PointerMessage>(new Config_PointerMessage(aModuleEvent, this));
-  aMessage->setPointer(theOperation);
-  Events_Loop::loop()->send(aMessage);
-}
+//void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
+//{
+//  static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED);
+//  boost::shared_ptr<Config_PointerMessage> aMessage =
+//      boost::shared_ptr<Config_PointerMessage>(new Config_PointerMessage(aModuleEvent, this));
+//  aMessage->setPointer(theOperation);
+//  Events_Loop::loop()->send(aMessage);
+//}
 
 void PartSet_Module::activateFeature(ObjectPtr theFeature, const bool isUpdateViewer)
 {
-  ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
+  ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp) {
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    XGUI_Displayer* aDisplayer = xWorkshop()->displayer();
     std::list<int> aModes = aPreviewOp->getSelectionModes(theFeature);
     aDisplayer->activateInLocalContext(theFeature, aModes, isUpdateViewer);
 
@@ -494,7 +478,7 @@ void PartSet_Module::activateFeature(ObjectPtr theFeature, const bool isUpdateVi
 
 void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
 {
-  ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
+  ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
   if (!anOperation)
     return;
 
@@ -506,7 +490,7 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
   if (!aFeature || aFeature->getKind() != theCmdId)
     return;
 
-  XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+  XGUI_Displayer* aDisplayer = xWorkshop()->displayer();
   // Hide result of sketch
   std::list<ResultPtr> aResults = aFeature->results();
   std::list<ResultPtr>::const_iterator aIt;
@@ -557,8 +541,8 @@ void PartSet_Module::onStorePoint2D(ObjectPtr theFeature, const std::string& the
 {
   FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
 
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
-      ->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = 
+    dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
   if (!aPreviewOp)
     return;
 
@@ -575,9 +559,19 @@ QWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget*
 {
   if (theType == "sketch-start-label") {
     PartSet_WidgetSketchLabel* aWgt = new PartSet_WidgetSketchLabel(theParent, theWidgetApi, "");
-    aWgt->setOperationsMgr(myWorkshop->operationMgr());
+    aWgt->setOperationsMgr(xWorkshop()->operationMgr());
     theModelWidgets.append(aWgt);
     return aWgt->getControl();
   } else
     return 0;
 }
+
+
+XGUI_Workshop* PartSet_Module::xWorkshop() const
+{
+  XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
+  if (aConnector) {
+    return aConnector->workshop();
+  }
+  return 0;
+}
\ No newline at end of file
index 803015f38786d38701b1e26281598b8d4c960464..d0698530717639ee7386beb0b993802fa3cd6525 100644 (file)
@@ -20,6 +20,7 @@ class QKeyEvent;
 class PartSet_Listener;
 class ModelAPI_Feature;
 class XGUI_ViewerPrs;
+class XGUI_Workshop;
 class ModuleBase_Operation;
 class GeomAPI_AISObject;
 
@@ -28,13 +29,9 @@ class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule
 Q_OBJECT
 
  public:
-  PartSet_Module(XGUI_Workshop* theWshop);
+  PartSet_Module(ModuleBase_IWorkshop* theWshop);
   virtual ~PartSet_Module();
 
-  /// Returns the module workshop
-  /// \returns a workshop instance
-  XGUI_Workshop* workshop() const;
-
   /// Reads description of features from XML file 
   virtual void createFeatures();
 
@@ -45,17 +42,7 @@ Q_OBJECT
 
   /// Creates an operation and send it to loop
   /// \param theCmdId the operation name
-  virtual void launchOperation(const QString& theCmdId);
-
-  /// Called when it is necessary to update a command state (enable or disable it)
-  //virtual bool isFeatureEnabled(const QString& theCmdId) const;
-
-  /// Displays or erase the current operation preview, if it has it.
-  /// \param theFeature the feature instance to be displayed
-  /// \param isDisplay the state whether the presentation should be displayed or erased
-  /// \param isUpdateViewer the flag whether the viewer should be updated
-  //void visualizePreview(FeaturePtr theFeature, bool isDisplay,
-  //                      const bool isUpdateViewer = true);
+  //virtual void launchOperation(const QString& theCmdId);
 
   /// Activates the feature in the displayer
   /// \param theFeature the feature instance to be displayed
@@ -71,10 +58,12 @@ Q_OBJECT
                                       Config_WidgetAPI* theWidgetApi,
                                       QList<ModuleBase_ModelWidget*>& theModelWidgets);
 
+  XGUI_Workshop* xWorkshop() const;
+
  public slots:
   void onFeatureTriggered();
   /// SLOT, that is called after the operation is started. Connect on the focus activated signal
-  void onOperationStarted();
+  void onOperationStarted(ModuleBase_Operation* theOperation);
   /// SLOT, that is called after the operation is stopped. Switched off the modfications performed
   /// by the operation start
   void onOperationStopped(ModuleBase_Operation* theOperation);
@@ -145,16 +134,13 @@ Q_OBJECT
   ModuleBase_Operation* createOperation(const std::string& theCmdId,
                                         const std::string& theFeatureKind = "");
 
-  /// Sends the operation
-  /// \param theOperation the operation
-  void sendOperation(ModuleBase_Operation* theOperation);
 
  protected:
   //! Edits the feature
   void editFeature(FeaturePtr theFeature);
 
  private:
-  XGUI_Workshop* myWorkshop;
+  //XGUI_Workshop* myWorkshop;
   PartSet_Listener* myListener;
 
   std::map<std::string, std::string> myFeaturesInFiles;
index 2582013d59e19019d40c13f7e711a90ee34f1da9..0a07539a44b075b2805d7a9701310ff92948d9a2 100644 (file)
@@ -25,7 +25,6 @@ SET(PROJECT_HEADERS
     XGUI_SalomeConnector.h
     XGUI_ActionsMgr.h
     XGUI_ErrorDialog.h
-    XGUI_SalomeViewer.h
     XGUI_ViewerProxy.h
     XGUI_PropertyPanel.h
     XGUI_ContextMenuMgr.h
index 7e9694ebbbf1e74df9747fb2d0649abd067afe15..4c36e61d17bc916dd5ea553bbdce976d4f074841 100644 (file)
@@ -7,6 +7,7 @@
 #include "XGUI_ViewerProxy.h"
 #include "XGUI_SelectionMgr.h"
 #include "XGUI_Selection.h"
+#include "XGUI_OperationMgr.h"
 
 XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop)
     : ModuleBase_IWorkshop(theWorkshop),
@@ -14,23 +15,35 @@ XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop)
 {
   XGUI_SelectionMgr* aSelector = myWorkshop->selector();
   connect(aSelector, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
+  
+  XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
+
+  connect(anOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)), 
+    this, SIGNAL(operationStarted(ModuleBase_Operation*)));
+  connect(anOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), 
+    this, SIGNAL(operationStopped(ModuleBase_Operation*)));
 }
 
 XGUI_ModuleConnector::~XGUI_ModuleConnector()
 {
 }
 
-Handle(AIS_InteractiveContext) XGUI_ModuleConnector::AISContext() const
+ModuleBase_ISelection* XGUI_ModuleConnector::selection() const
 {
-  return myWorkshop->viewer()->AISContext();
+  return myWorkshop->selector()->selection();
 }
 
-QList<ObjectPtr> XGUI_ModuleConnector::selectedObjects() const
+ModuleBase_IModule* XGUI_ModuleConnector::module() const
 {
-  return myWorkshop->selector()->selection()->selectedObjects();
+  return myWorkshop->module();
 }
 
-ModuleBase_IModule* XGUI_ModuleConnector::module() const
+ModuleBase_IViewer* XGUI_ModuleConnector::viewer() const
 {
-  return myWorkshop->module();
+  return myWorkshop->viewer();
+}
+
+ModuleBase_Operation* XGUI_ModuleConnector::currentOperation() const
+{
+  return myWorkshop->operationMgr()->currentOperation();
 }
index 3423a55f0cf733c1779a075b64e44a4e03b59c87..c78c1d82a20ea8353cb79a3321b35e62261de3b7 100644 (file)
@@ -24,15 +24,20 @@ Q_OBJECT
 
   virtual ~XGUI_ModuleConnector();
 
-  //! Returns AIS_InteractiveContext from current OCCViewer
-  virtual Handle(AIS_InteractiveContext) AISContext() const;
-
   //! Returns list of currently selected data objects
-  virtual QList<ObjectPtr> selectedObjects() const;
+  virtual ModuleBase_ISelection* selection() const;
 
   //! Returns instance of loaded module
   virtual ModuleBase_IModule* module() const;
 
+  //! Returns current viewer
+  virtual ModuleBase_IViewer* viewer() const;
+
+  //! Returns currently active operation
+  virtual ModuleBase_Operation* currentOperation() const;
+
+  XGUI_Workshop* workshop() const { return myWorkshop; }
+
  private:
   XGUI_Workshop* myWorkshop;
 };
index 6f014ad8a55bd2ac51e6c7eb2dfbd7303016f83b..33a411c0b37e71c5543947846c338dbaa24be69e 100644 (file)
@@ -83,7 +83,7 @@ bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation)
   myOperations.append(theOperation);
 
   connect(theOperation, SIGNAL(stopped()), this, SLOT(onOperationStopped()));
-  connect(theOperation, SIGNAL(started()), this, SIGNAL(operationStarted()));
+  connect(theOperation, SIGNAL(started()), this, SLOT(onOperationStarted()));
   connect(theOperation, SIGNAL(resumed()), this, SIGNAL(operationResumed()));
 
   theOperation->start();
@@ -185,6 +185,12 @@ bool XGUI_OperationMgr::canAbortOperation()
   return true;
 }
 
+void XGUI_OperationMgr::onOperationStarted()
+{
+  ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
+  emit operationStarted(aSenderOperation);
+}
+
 void XGUI_OperationMgr::onOperationStopped()
 {
   ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
index 95d5affb1ae7482a4c7e7303577c84cc1075aa51..25a155617e1558996221e6e5c00facc2a590b954 100644 (file)
@@ -70,7 +70,7 @@ Q_OBJECT
 
 signals:
   /// Signal about an operation is started. It is emitted after the start() of operation is done.
-  void operationStarted();
+  void operationStarted(ModuleBase_Operation* theOperation);
   /// Signal about an operation is stopped. It is emitted after the stop() of operation is done.
   /// \param theOperation a stopped operation
   void operationStopped(ModuleBase_Operation* theOperation);
@@ -109,6 +109,7 @@ signals:
   /// Slot that is called by an operation stop. Removes the stopped operation form the stack.
   /// If there is a suspended operation, restart it.
   void onOperationStopped();
+  void onOperationStarted();
 
  private:
   typedef QList<ModuleBase_Operation*> Operations;  ///< definition for a list of operations
index 0055714b73e4078e6898804484a0bd727e4d6ad9..e4a0276dbf2f728bb19a93653407966d8a26a7c8 100644 (file)
@@ -7,7 +7,7 @@
 #include <QStringList>
 
 class QMainWindow;
-class XGUI_SalomeViewer;
+class ModuleBase_IViewer;
 
 /**
  * An interface which provides a connection of XGUI functionality 
@@ -68,7 +68,7 @@ class XGUI_EXPORT XGUI_SalomeConnector
   virtual QStringList nestedActions(const QString& theId) const = 0;
 
   //! Returns interface to Salome viewer
-  virtual XGUI_SalomeViewer* viewer() const = 0;
+  virtual ModuleBase_IViewer* viewer() const = 0;
 
   virtual void createPreferences() = 0;
 };
diff --git a/src/XGUI/XGUI_SalomeViewer.h b/src/XGUI/XGUI_SalomeViewer.h
deleted file mode 100644 (file)
index 1b3de1d..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef XGUI_SALOMEVIEWER_H
-#define XGUI_SALOMEVIEWER_H
-
-#include "XGUI.h"
-
-#include <QObject>
-#include <AIS_InteractiveContext.hxx>
-#include <V3d_View.hxx>
-
-class QMouseEvent;
-class QKeyEvent;
-class QContextMenuEvent;
-
-/**
- * A Base object for definition of connector object to
- * Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
- */
-class XGUI_EXPORT XGUI_SalomeViewer : public QObject
-{
-Q_OBJECT
- public:
-  XGUI_SalomeViewer(QObject* theParent)
-      : QObject(theParent)
-  {
-  }
-
-  //! Returns AIS_InteractiveContext from current OCCViewer
-  virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
-
-  //! Retrurns V3d_Vioewer from current viewer
-  virtual Handle(V3d_Viewer) v3dViewer() const = 0;
-
-  //! Returns Vsd_View object from currently active view window
-  virtual Handle(V3d_View) activeView() const = 0;
-
-  //! Enable or disable selection in the viewer
-  virtual void enableSelection(bool isEnabled) = 0;
-
-  //! Returns true if selection is enabled
-  virtual bool isSelectionEnabled() const = 0;
-
-  //! Enable or disable multiselection in the viewer
-  virtual void enableMultiselection(bool isEnable) = 0;
-
-  //! Returns true if multiselection is enabled
-  virtual bool isMultiSelectionEnabled() const = 0;
-
-  //! Perfroms the fit all for the active view
-  virtual void fitAll() = 0;
-
-signals:
-  void lastViewClosed();
-  void tryCloseView();
-  void deleteView();
-  void viewCreated();
-  void mousePress(QMouseEvent* theEvent);
-  void mouseRelease(QMouseEvent* theEvent);
-  void mouseDoubleClick(QMouseEvent* theEvent);
-  void mouseMove(QMouseEvent* theEvent);
-  void keyPress(QKeyEvent* theEvent);
-  void keyRelease(QKeyEvent* theEvent);
-  void activated();
-
-  void selectionChanged();
-  void contextMenuRequested(QContextMenuEvent*);
-};
-
-#endif
index ad1685d524130ac6a234703cbb5276c8f7aacf9e..fee0419ddd6dfb31fbd19fce786d7fceee121325 100644 (file)
@@ -7,7 +7,7 @@
 #include "XGUI_SalomeConnector.h"
 
 XGUI_ViewerProxy::XGUI_ViewerProxy(XGUI_Workshop* theParent)
-    : XGUI_SalomeViewer(theParent),
+    : ModuleBase_IViewer(theParent),
       myWorkshop(theParent)
 {
 }
@@ -65,7 +65,7 @@ void XGUI_ViewerProxy::fitAll()
 void XGUI_ViewerProxy::connectToViewer()
 {
   if (myWorkshop->isSalomeMode()) {
-    XGUI_SalomeViewer* aViewer = myWorkshop->salomeConnector()->viewer();
+    ModuleBase_IViewer* aViewer = myWorkshop->salomeConnector()->viewer();
 
     connect(aViewer, SIGNAL(lastViewClosed()), this, SIGNAL(lastViewClosed()));
     connect(aViewer, SIGNAL(tryCloseView()), this, SIGNAL(tryCloseView()));
index 6bc769cdd196369ad6665a20152102e94170fdb9..9c39bdf20c9ef3549f8404b1fa614986e448bfcf 100644 (file)
@@ -2,7 +2,7 @@
 #define XGUI_VIEWERPROXY_H
 
 #include "XGUI.h"
-#include "XGUI_SalomeViewer.h"
+#include <ModuleBase_IViewer.h>
 
 class XGUI_Workshop;
 class XGUI_ViewWindow;
@@ -13,7 +13,7 @@ class XGUI_ViewWindow;
  * It is reccomennded to use this class in operation for accessing to viewer 
  * functionality instead of direct access to a viewer
  */
-class XGUI_EXPORT XGUI_ViewerProxy : public XGUI_SalomeViewer
+class XGUI_EXPORT XGUI_ViewerProxy : public ModuleBase_IViewer
 {
 Q_OBJECT
  public:
@@ -44,10 +44,10 @@ Q_OBJECT
   /// \param theX the X projection value
   /// \param theY the Y projection value
   /// \param theZ the Z projection value
-  void setViewProjection(double theX, double theY, double theZ);
+  virtual void setViewProjection(double theX, double theY, double theZ);
 
   //! Sets the view fitted all
-  void fitAll();
+  virtual void fitAll();
 
   /// Connects to a viewer according to current environment
   void connectToViewer();
index 6507c3557c4f4ffd26c5584d8807a725c52cc6af..f2e9b9be3e68ca0fb7448a033f7fe05c45e2f95a 100644 (file)
@@ -14,7 +14,6 @@
 #include "XGUI_Displayer.h"
 #include "XGUI_OperationMgr.h"
 #include "XGUI_SalomeConnector.h"
-#include "XGUI_SalomeViewer.h"
 #include "XGUI_ActionsMgr.h"
 #include "XGUI_ErrorDialog.h"
 #include "XGUI_ViewerProxy.h"
@@ -46,6 +45,7 @@
 #include <ModuleBase_SelectionValidator.h>
 #include <ModuleBase_WidgetFactory.h>
 #include <ModuleBase_Tools.h>
+#include <ModuleBase_IViewer.h>
 
 #include <Config_Common.h>
 #include <Config_FeatureMessage.h>
@@ -113,7 +113,8 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
 
   myModuleConnector = new XGUI_ModuleConnector(this);
 
-  connect(myOperationMgr, SIGNAL(operationStarted()), SLOT(onOperationStarted()));
+  connect(myOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)), 
+          SLOT(onOperationStarted()));
   connect(myOperationMgr, SIGNAL(operationResumed()), SLOT(onOperationStarted()));
   connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
           SLOT(onOperationStopped(ModuleBase_Operation*)));
@@ -882,7 +883,7 @@ ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
   }
 #endif
 
-  ModuleBase_IModule* aModule = crtInst ? crtInst(this) : 0;
+  ModuleBase_IModule* aModule = crtInst ? crtInst(myModuleConnector) : 0;
 
   if (!err.isEmpty()) {
     if (mainWindow()) {
@@ -1079,7 +1080,7 @@ void XGUI_Workshop::salomeViewerSelectionChanged()
 }
 
 //**************************************************************
-XGUI_SalomeViewer* XGUI_Workshop::salomeViewer() const
+ModuleBase_IViewer* XGUI_Workshop::salomeViewer() const
 {
   return mySalomeConnector->viewer();
 }
index 5a557db2bc5ddeb883d478c46bdbf98291ec483a..d5159189aec9465cd207beae2dd10569b5746560 100644 (file)
@@ -31,6 +31,7 @@ class XGUI_ModuleConnector;
 
 class ModuleBase_Operation;
 class ModuleBase_IModule;
+class ModuleBase_IViewer;
 
 class Config_FeatureMessage;
 class Config_PointerMessage;
@@ -113,7 +114,7 @@ Q_OBJECT
   }
 
   //! Provides an object which provides interface to Salome Viewer
-  XGUI_SalomeViewer* salomeViewer() const;
+  ModuleBase_IViewer* salomeViewer() const;
 
   //! Returns true if the application works as SALOME module
   bool isSalomeMode() const