From: nds Date: Thu, 24 Apr 2014 07:01:58 +0000 (+0400) Subject: refs #30 - Sketch base GUI: create, draw lines X-Git-Tag: V_0.2~128 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=26fd2a83901ae81ce09f2ceb0d078d8bd8a28de4;p=modules%2Fshaper.git refs #30 - Sketch base GUI: create, draw lines Remove updateCommandStatus() after commit(), because it happens in slot onOperationStopped() Add comments for code --- diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 8fb825b5b..d4ae6d502 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -1,5 +1,8 @@ +// File: XGUI_Displayer.cxx +// Created: 20 Apr 2014 +// Author: Natalia ERMOLAEVA + #include "XGUI_Displayer.h" -#include "XGUI_Tools.h" #include "XGUI_Viewer.h" #include @@ -7,34 +10,19 @@ #include #include -/*! - \brief Constructor - */ XGUI_Displayer::XGUI_Displayer(XGUI_Viewer* theViewer) : myViewer(theViewer) { } -/*! - \brief Destructor - */ XGUI_Displayer::~XGUI_Displayer() { } -/*! - * Display the feature - * \param theFeature a feature instance - */ void XGUI_Displayer::Display(boost::shared_ptr theFeature) { } -/*! - * Display the feature and a shape. This shape would be associated to the given feature - * \param theFeature a feature instance - * \param theFeature a shape - */ void XGUI_Displayer::Display(boost::shared_ptr theFeature, const TopoDS_Shape& theShape) { @@ -46,11 +34,6 @@ void XGUI_Displayer::Display(boost::shared_ptr theFeature, aContext->UpdateCurrentViewer(); } -/*! - * Erase the feature and a shape. - * \param theFeature a feature instance - * \param theFeature a shape - */ void XGUI_Displayer::Erase(boost::shared_ptr theFeature, const TopoDS_Shape& theShape) { diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index dc09d99bd..06ebcba1e 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -1,3 +1,7 @@ +// File: XGUI_Displayer.h +// Created: 20 Apr 2014 +// Author: Natalia ERMOLAEVA + #ifndef XGUI_Displayer_H #define XGUI_Displayer_H @@ -13,22 +17,33 @@ class ModelAPI_Feature; /**\class XGUI_Displayer * \ingroup GUI - * \brief Displayer. Provides mechanizm of displa/erase of objects in viewer + * \brief Displayer. Provides mechanizm of display/erase of objects in the viewer */ class XGUI_EXPORT XGUI_Displayer { public: + /// Constructor + /// \param theViewer the viewer XGUI_Displayer(XGUI_Viewer* theViewer); + /// Destructor virtual ~XGUI_Displayer(); + /// Display the feature. Obtain the visualized object from the feature. + /// \param theFeature a feature instance void Display(boost::shared_ptr theFeature); + /// Display the feature and a shape. This shape would be associated to the given feature + /// \param theFeature a feature instance + /// \param theFeature a shape void Display(boost::shared_ptr theFeature, const TopoDS_Shape& theShape); + /// Erase the feature and a shape. + /// \param theFeature a feature instance + /// \param theFeature a shape void Erase(boost::shared_ptr theFeature, const TopoDS_Shape& theShape); protected: - XGUI_Viewer* myViewer; ///< the viewer + XGUI_Viewer* myViewer; ///< the viewer where the objects should be visualized }; #endif diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index bca019e31..aeb0ed3c0 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -1,3 +1,7 @@ +// File: XGUI_OperationMgr.h +// Created: 20 Apr 2014 +// Author: Natalia ERMOLAEVA + #include "XGUI_OperationMgr.h" #include "ModuleBase_Operation.h" @@ -49,15 +53,6 @@ bool XGUI_OperationMgr::canStartOperation(ModuleBase_Operation* theOperation) return aCanStart; } -void XGUI_OperationMgr::commitCurrentOperation() -{ - ModuleBase_Operation* anOperation = currentOperation(); - if (!anOperation) - return; - - anOperation->commit(); -} - 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 b45b84d3c..ef06d7da7 100644 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -1,3 +1,7 @@ +// File: XGUI_OperationMgr.h +// Created: 20 Apr 2014 +// Author: Natalia ERMOLAEVA + #ifndef XGUI_OperationMgr_H #define XGUI_OperationMgr_H @@ -34,16 +38,22 @@ public: /// \return the current operation bool startOperation(ModuleBase_Operation* theOperation); - void commitCurrentOperation(); - signals: + /// Signal about an operation is started. It is emitted after the start() of operation is done. void operationStarted(); + /// 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); protected: + /// Returns whether the operation can be started. Check if there is already started operation and + /// the granted parameter of the launched operation + /// \param theOperation an operation to check bool canStartOperation(ModuleBase_Operation* theOperation); protected slots: + /// 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(); private: diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 6a2bb4f13..a3fefefab 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -158,10 +158,8 @@ void XGUI_Workshop::processEvent(const Event_Message* theMessage) (ModuleBase_PropPanelOperation*)(aPartSetMsg->pointer()); if (myOperationMgr->startOperation(anOperation)) { - if (anOperation->isPerformedImmediately()) { - myOperationMgr->commitCurrentOperation(); - updateCommandStatus(); - } + if (anOperation->isPerformedImmediately()) + anOperation->commit(); } return; } @@ -173,6 +171,7 @@ void XGUI_Workshop::processEvent(const Event_Message* theMessage) } +//****************************************************** void XGUI_Workshop::onOperationStarted() { ModuleBase_PropPanelOperation* aOperation = @@ -192,9 +191,7 @@ void XGUI_Workshop::onOperationStarted() } } -/** - * - */ +//****************************************************** void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) { myMainWindow->hidePropertyPanel(); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 68b961589..1e74363ce 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -75,7 +75,12 @@ protected: void connectWithOperation(ModuleBase_Operation* theOperation); protected slots: + /// SLOT, that is called after the operation is started. Update workshop state according to + /// the started operation, e.g. visualizes the property panel and connect to it. void onOperationStarted(); + /// SLOT, that is called after the operation is stopped. Update workshop state, e.g. + /// hides the property panel and udpate the command status. + /// \param theOpertion a stopped operation void onOperationStopped(ModuleBase_Operation* theOperation); private: