From: vsv Date: Mon, 6 Oct 2014 12:36:13 +0000 (+0400) Subject: Define abstract module class X-Git-Tag: V_0.5~115 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e30796dab1aa68c01201b2b89d4292d3fcbbc4d4;p=modules%2Fshaper.git Define abstract module class --- diff --git a/src/ModuleBase/CMakeLists.txt b/src/ModuleBase/CMakeLists.txt index cb84e1693..1e49aef44 100644 --- a/src/ModuleBase/CMakeLists.txt +++ b/src/ModuleBase/CMakeLists.txt @@ -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 index 000000000..c8b347f76 --- /dev/null +++ b/src/ModuleBase/ModuleBase_IModule.cpp @@ -0,0 +1,33 @@ + +#include "ModuleBase_IModule.h" +#include "ModuleBase_ViewerPrs.h" +#include "ModuleBase_Operation.h" +#include "ModuleBase_ISelection.h" + +#include + +#include + +#include + + +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 aSelected = aSelection->getSelected(); + std::list 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 aMessage = + boost::shared_ptr(new Config_PointerMessage(aModuleEvent, this)); + aMessage->setPointer(theOperation); + Events_Loop::loop()->send(aMessage); +} diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index df599f416..3bea34002 100644 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -1,20 +1,30 @@ #ifndef ModuleBase_IModule_H #define ModuleBase_IModule_H +#include "ModuleBase.h" +#include "ModuleBase_IWorkshop.h" + #include #include + class QAction; -class XGUI_Workshop; class Config_WidgetAPI; class ModuleBase_ModelWidget; +class ModuleBase_Operation; +class ModuleBase_IWorkshop; /** * Interface to a module */ -class ModuleBase_IModule : public QObject +class MODULEBASE_EXPORT ModuleBase_IModule : public QObject { public: + + ModuleBase_IModule(ModuleBase_IWorkshop* theParent): QObject(theParent), myWorkshop(theParent) {} + + virtual ~ModuleBase_IModule() {} + /// Reads description of features from XML file virtual void createFeatures() = 0; @@ -23,7 +33,7 @@ class ModuleBase_IModule : public QObject /// Creates an operation and send it to loop /// \param theCmdId the operation name - virtual void launchOperation(const QString& theCmdId) = 0; + 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 = 0; @@ -36,15 +46,29 @@ class ModuleBase_IModule : public QObject return 0; } - virtual ~ModuleBase_IModule() - { - } - ; + ModuleBase_IWorkshop* workshop() const { return myWorkshop; } + + protected: + /// Sends the operation for launching + /// \param theOperation the operation + void sendOperation(ModuleBase_Operation* theOperation); + + /// Creates a new operation + /// \param theCmdId the operation name + /// \param theFeatureKind a kind of feature to get the feature xml description + virtual ModuleBase_Operation* createOperation(const std::string& theCmdId, + const std::string& theFeatureKind = "") = 0; + + +protected: + + ModuleBase_IWorkshop* myWorkshop; + }; //! This function must return a new module instance. extern "C" { -typedef ModuleBase_IModule* (*CREATE_FUNC)(XGUI_Workshop*); +typedef ModuleBase_IModule* (*CREATE_FUNC)(ModuleBase_IWorkshop*); } #define CREATE_MODULE "createModule" diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h new file mode 100644 index 000000000..6858fbefc --- /dev/null +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -0,0 +1,74 @@ +#ifndef ModuleBase_IViewer_H +#define ModuleBase_IViewer_H + +#include "ModuleBase.h" +#include +#include +#include + +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 diff --git a/src/ModuleBase/ModuleBase_IWorkshop.h b/src/ModuleBase/ModuleBase_IWorkshop.h index b05e2d629..d4b9265ca 100644 --- a/src/ModuleBase/ModuleBase_IWorkshop.h +++ b/src/ModuleBase/ModuleBase_IWorkshop.h @@ -9,11 +9,12 @@ #include -#include - #include 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 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 diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index a5e09fea3..47471dab3 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -4,6 +4,7 @@ #include "ModuleBase_WidgetShapeSelector.h" #include +#include #include "ModuleBase_WidgetValue.h" #include #include "ModuleBase_WidgetValueFeature.h" @@ -138,7 +139,7 @@ QList ModuleBase_WidgetShapeSelector::getControls() const //******************************************************************** void ModuleBase_WidgetShapeSelector::onSelectionChanged() { - QList aObjects = myWorkshop->selectedObjects(); + QList aObjects = myWorkshop->selection()->selectedObjects(); if (aObjects.size() > 0) { ObjectPtr aObject = aObjects.first(); if ((!mySelectedObject) && (!aObject)) diff --git a/src/NewGeom/CMakeLists.txt b/src/NewGeom/CMakeLists.txt index 1883fbb61..dcc5bdae5 100644 --- a/src/NewGeom/CMakeLists.txt +++ b/src/NewGeom/CMakeLists.txt @@ -30,6 +30,7 @@ SET(PROJECT_LIBRARIES Events Config XGUI + ModuleBase ${QT_LIBRARIES} ${suit} ${std} diff --git a/src/NewGeom/NewGeom_Module.h b/src/NewGeom/NewGeom_Module.h index aad4775ca..9bda5d276 100644 --- a/src/NewGeom/NewGeom_Module.h +++ b/src/NewGeom/NewGeom_Module.h @@ -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; } diff --git a/src/NewGeom/NewGeom_SalomeViewer.cpp b/src/NewGeom/NewGeom_SalomeViewer.cpp index 4d4a74ec9..9049d0cf6 100644 --- a/src/NewGeom/NewGeom_SalomeViewer.cpp +++ b/src/NewGeom/NewGeom_SalomeViewer.cpp @@ -11,7 +11,7 @@ #include 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(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 diff --git a/src/NewGeom/NewGeom_SalomeViewer.h b/src/NewGeom/NewGeom_SalomeViewer.h index 7f638ac86..29bdd5218 100644 --- a/src/NewGeom/NewGeom_SalomeViewer.h +++ b/src/NewGeom/NewGeom_SalomeViewer.h @@ -4,7 +4,7 @@ #include "NewGeom.h" -#include +#include 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 diff --git a/src/PartSet/PartSet_Listener.cpp b/src/PartSet/PartSet_Listener.cpp index f66ac66b4..8dd90a845 100644 --- a/src/PartSet/PartSet_Listener.cpp +++ b/src/PartSet/PartSet_Listener.cpp @@ -39,12 +39,12 @@ PartSet_Listener::~PartSet_Listener() //****************************************************** void PartSet_Listener::processEvent(const boost::shared_ptr& theMessage) { - ModuleBase_Operation* anOperation = myModule->workshop()->operationMgr()->currentOperation(); + ModuleBase_Operation* anOperation = myModule->xWorkshop()->operationMgr()->currentOperation(); PartSet_OperationSketchBase* aSketchOp = dynamic_cast(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 aUpdMsg = @@ -52,7 +52,7 @@ void PartSet_Listener::processEvent(const boost::shared_ptr& the std::set aFeatures = aUpdMsg->objects(); PartSet_OperationSketch* aSketchOp = - dynamic_cast(myModule->workshop()->operationMgr()->currentOperation()); + dynamic_cast(myModule->xWorkshop()->operationMgr()->currentOperation()); std::set::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); for (; anIt != aLast; anIt++) { @@ -65,7 +65,7 @@ void PartSet_Listener::processEvent(const boost::shared_ptr& 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 aModes = aSketchOp->getSelectionModes(aObj); @@ -83,7 +83,7 @@ void PartSet_Listener::processEvent(const boost::shared_ptr& 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); } } diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 1a26bbeb9..8b45d5e47 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -26,8 +26,6 @@ #include #include #include -#include -#include #include #include #include @@ -42,8 +40,8 @@ #include #include #include -#include -#include +//#include +//#include #include #include @@ -64,24 +62,24 @@ #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(anOperation); - //if (aPreviewOp) { - XGUI_Selection* aSelection = myWorkshop->selector()->selection(); - // Initialise operation with preliminary selection - std::list aSelected = aSelection->getSelected(); - std::list 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(anOperation); +// //if (aPreviewOp) { +// XGUI_Selection* aSelection = myWorkshop->selector()->selection(); +// // Initialise operation with preliminary selection +// std::list aSelected = aSelection->getSelected(); +// std::list 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(aOperation); + PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(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(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 aResults = aFeature->results(); std::list::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 aFeatures = myWorkshop->selector()->selection()->selectedObjects(); + QList aFeatures = workshop()->selection()->selectedObjects(); if (theId == "EDIT_CMD" && (aFeatures.size() > 0)) { FeaturePtr aFeature = boost::dynamic_pointer_cast(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(myWorkshop - ->operationMgr()->currentOperation()); + XGUI_Workshop* aXWshp = xWorkshop(); + PartSet_OperationSketchBase* aPreviewOp = + dynamic_cast(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 aSelected = aSelection->getSelected(); std::list aHighlighted = aSelection->getHighlighted(); @@ -228,11 +221,11 @@ void PartSet_Module::onMousePressed(QMouseEvent* theEvent) void PartSet_Module::onMouseReleased(QMouseEvent* theEvent) { - PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(myWorkshop - ->operationMgr()->currentOperation()); + PartSet_OperationSketchBase* aPreviewOp = + dynamic_cast(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 aSelected = aSelection->getSelected(); std::list aHighlighted = aSelection->getHighlighted(); @@ -243,8 +236,8 @@ void PartSet_Module::onMouseReleased(QMouseEvent* theEvent) void PartSet_Module::onMouseMoved(QMouseEvent* theEvent) { - PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(myWorkshop - ->operationMgr()->currentOperation()); + PartSet_OperationSketchBase* aPreviewOp = + dynamic_cast(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(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(myWorkshop - ->operationMgr()->currentOperation()); + PartSet_OperationSketchBase* aPreviewOp = + dynamic_cast(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 aSelected = aSelection->getSelected(); std::list 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 aSelected = aSelection->getSelected(); std::list 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 aResults = aFeature->results(); std::list::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& 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& 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& theFeatures, const void PartSet_Module::onSetSelection(const QList& 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(aCurOperation); if (aPrevOp) { std::list aList = aPrevOp->subFeatures(); - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer* aDisplayer = xWorkshop()->displayer(); std::list aModes = aPrevOp->getSelectionModes(aPrevOp->feature()); std::list::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(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(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 aMessage = - boost::shared_ptr(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 aMessage = +// boost::shared_ptr(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(anOperation); if (aPreviewOp) { - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + XGUI_Displayer* aDisplayer = xWorkshop()->displayer(); std::list 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 aResults = aFeature->results(); std::list::const_iterator aIt; @@ -557,8 +541,8 @@ void PartSet_Module::onStorePoint2D(ObjectPtr theFeature, const std::string& the { FeaturePtr aFeature = boost::dynamic_pointer_cast(theFeature); - PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(myWorkshop - ->operationMgr()->currentOperation()); + PartSet_OperationSketchBase* aPreviewOp = + dynamic_cast(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(workshop()); + if (aConnector) { + return aConnector->workshop(); + } + return 0; +} \ No newline at end of file diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 803015f38..d06985307 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -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& 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 myFeaturesInFiles; diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index 2582013d5..0a07539a4 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -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 diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index 7e9694ebb..4c36e61d1 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -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 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(); } diff --git a/src/XGUI/XGUI_ModuleConnector.h b/src/XGUI/XGUI_ModuleConnector.h index 3423a55f0..c78c1d82a 100644 --- a/src/XGUI/XGUI_ModuleConnector.h +++ b/src/XGUI/XGUI_ModuleConnector.h @@ -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 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; }; diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 6f014ad8a..33a411c0b 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -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(sender()); + emit operationStarted(aSenderOperation); +} + void XGUI_OperationMgr::onOperationStopped() { ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h index 95d5affb1..25a155617 100644 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -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 Operations; ///< definition for a list of operations diff --git a/src/XGUI/XGUI_SalomeConnector.h b/src/XGUI/XGUI_SalomeConnector.h index 0055714b7..e4a0276db 100644 --- a/src/XGUI/XGUI_SalomeConnector.h +++ b/src/XGUI/XGUI_SalomeConnector.h @@ -7,7 +7,7 @@ #include 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 index 1b3de1d1f..000000000 --- a/src/XGUI/XGUI_SalomeViewer.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef XGUI_SALOMEVIEWER_H -#define XGUI_SALOMEVIEWER_H - -#include "XGUI.h" - -#include -#include -#include - -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 diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index ad1685d52..fee0419dd 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -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())); diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 6bc769cdd..9c39bdf20 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -2,7 +2,7 @@ #define XGUI_VIEWERPROXY_H #include "XGUI.h" -#include "XGUI_SalomeViewer.h" +#include 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(); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 6507c3557..f2e9b9be3 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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 #include #include +#include #include #include @@ -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(); } diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 5a557db2b..d5159189a 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -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