]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #30 - Sketch base GUI: create, draw lines
authornds <natalia.donis@opencascade.com>
Thu, 24 Apr 2014 07:01:58 +0000 (11:01 +0400)
committernds <natalia.donis@opencascade.com>
Thu, 24 Apr 2014 07:01:58 +0000 (11:01 +0400)
Remove updateCommandStatus() after commit(), because it happens in slot onOperationStopped()
Add comments for code

src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_OperationMgr.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index 8fb825b5bd30d03e02fb398fc82a8d14f012de68..d4ae6d5027f297a4579b557e6a812596d3a96cb0 100644 (file)
@@ -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 <ModelAPI_Document.h>
 #include <AIS_InteractiveContext.hxx>
 #include <AIS_Shape.hxx>
 
-/*!
- \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<ModelAPI_Feature> 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<ModelAPI_Feature> theFeature,
                              const TopoDS_Shape& theShape)
 {
@@ -46,11 +34,6 @@ void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> 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<ModelAPI_Feature> theFeature,
                            const TopoDS_Shape& theShape)
 {
index dc09d99bd06da1a1cedfb6852e0327aad04a4c52..06ebcba1ef5f9ba567a5324d15e299be37dd7b89 100644 (file)
@@ -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<ModelAPI_Feature> 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<ModelAPI_Feature> 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<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
 
 protected:
-  XGUI_Viewer* myViewer; ///< the viewer
+  XGUI_Viewer* myViewer; ///< the viewer where the objects should be visualized
 };
 
 #endif
index bca019e31da01b8eea4ad02e56cd8d7a0e266416..aeb0ed3c06533a771a44873994117795ae04193f 100644 (file)
@@ -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<ModuleBase_Operation*>(sender());
index b45b84d3c9163162024cf75c94bcec9a411301fd..ef06d7da70ecb43514771aded8985b5825d71edb 100644 (file)
@@ -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:
index 6a2bb4f1351910562d560f91089b20432b4beaea..a3fefefab770997e5d3f51e63c5edc939fa56af6 100644 (file)
@@ -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();
index 68b961589f764b4fda42a4c246b24f6c18ca8b26..1e74363ce04130329676a26e7a2c6d279887f012 100644 (file)
@@ -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: