Salome HOME
Issue #1860: fix end lines with spaces
[modules/shaper.git] / src / XGUI / XGUI_Workshop.h
index edf22c262b2130362ce5034dc673a4397269464a..9d67d191ec84944b7384f3addbbcaaecda90d759 100755 (executable)
@@ -47,7 +47,7 @@ class QDockWidget;
 class QMainWindow;
 
 class QAction;
-
+class Config_DataModelReader;
 
 /**\class XGUI_Workshop
  * \ingroup GUI
@@ -58,7 +58,7 @@ class XGUI_EXPORT XGUI_Workshop : public QObject
 Q_OBJECT
  public:
   /// Constructor
-  /// \param theConnector a Salome connector object. 
+  /// \param theConnector a Salome connector object.
   /// Used only if the workshop is launched in Salome environment
   XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
   virtual ~XGUI_Workshop();
@@ -176,7 +176,7 @@ Q_OBJECT
   void deleteObjects();
 
   //! Searches for selected features unused in other (not selected) features. If one or several
-  //! selected features are found, a warning message proposes to delete them. It contains 
+  //! selected features are found, a warning message proposes to delete them. It contains
   //! the list of features to be deleted.
   void cleanHistory();
 
@@ -196,11 +196,20 @@ Q_OBJECT
   //! \return boolean value
   bool canChangeColor() const;
 
-  //! Change color of the features if it is possible
+  //! Change color of the results if it is possible
   //! The operation is available for construction, body and group results
   //! theObjects a list of selected objects
   void changeColor(const QObjectPtrList& theObjects);
 
+  //! Returns true if there is at least one selected body/construction/group result
+  //! \return boolean value
+  bool canChangeDeflection() const;
+
+  //! Change deflection of the results if it is possible
+  //! The operation is available for construction, body and group results
+  //! theObjects a list of selected objects
+  void changeDeflection(const QObjectPtrList& theObjects);
+
   //! Show the given features in 3d Viewer
   void showObjects(const QObjectPtrList& theList, bool isVisible);
 
@@ -246,12 +255,16 @@ Q_OBJECT
    */
   bool abortAllOperations();
 
+  /// Updates workshop state according to the started operation, e.g. visualizes the property panel
+  /// and connect to it.
+  /// \param theOpertion a started operation
+  void operationStarted(ModuleBase_Operation* theOperation);
+
+
   //! Delete features. Delete the referenced features. There can be a question with a list of
   //! referenced objects.
-  //! \param theList an objects to be deleted
-  //! \param theIgnoredFeatures a list of features to be ignored during delete
-  bool deleteFeatures(const QObjectPtrList& theFeatures,
-                      const std::set<FeaturePtr>& theIgnoredFeatures = std::set<FeaturePtr>());
+  //! \param theFeatures a list of objects to be deleted
+  bool deleteFeatures(const QObjectPtrList& theFeatures);
 
   /// Deactivates the object, if it is active and the module returns that the activation
   /// of selection for the object is not possible currently(the current operation uses it)
@@ -263,42 +276,58 @@ Q_OBJECT
   /// \param theFeature a feature
   bool isFeatureOfNested(const FeaturePtr& theFeature);
 
+  //! Shows the message in the status bar
+  //! \param theMessage a message
+  void setStatusBarMessage(const QString& theMessage);
+
   /// Has to be called in order to display objects with visibility status = true
   void synchronizeViewer();
 
-  /// Has to be called in order to display objects from a cpecifed group with visibility status = true
+  /// Has to be called in order to display objects from a specifed group
+  /// with visibility status = true
   /// \param theDoc the document for objects synchronisation
   /// \param theGroup the group name
   /// \param theUpdateViewer update viewer flag
-  void synchronizeGroupInViewer(const DocumentPtr& theDoc, const std::string& theGroup, bool theUpdateViewer);
+  void synchronizeGroupInViewer(const DocumentPtr& theDoc,
+                                const std::string& theGroup,
+                                bool theUpdateViewer);
 
   /// Update the property panel content by the XML description of the operation and set the panel
   /// into the operation
   /// \param theOperation an operation
-  void setPropertyPanel(ModuleBase_Operation* theOperation);
+  void fillPropertyPanel(ModuleBase_Operation* theOperation);
 
   /// Connects or disconnects to the value changed signal of the property panel widgets
   /// \param isToConnect a boolean value whether connect or disconnect
   void connectToPropertyPanel(const bool isToConnect);
 
   /// Returns defailt selection mode in 3d viewer
-  int viewerSelectionMode() const { return myViewerSelMode; }
+  QIntList viewerSelectionModes() const { return myViewerSelMode; }
 
   /// Highlights result objects in Object Browser according to
   /// features found in the given list
   void highlightResults(const QObjectPtrList& theObjects);
 
+  /// Highlights feature objects in Object Browser according to
+  /// features found in the given list
+  void highlightFeature(const QObjectPtrList& theObjects);
+
+  /// Returns Data Model XML reader which contains information about
+  /// Data structure configuration
+  const Config_DataModelReader* dataModelXMLReader() const { return myDataModelXMLReader; }
+
   /// A constant string used for "Move to end" command definition
   /// It is used for specific processing of Undo/Redo for this command.
   static QString MOVE_TO_END_COMMAND;
 
+  //! Closes all in the current session and load the directory
+  //! \param theDirectory a path to directory
+  void openDirectory(const QString& theDirectory);
+
 signals:
   /// Emitted when selection happens in Salome viewer
   void salomeViewerSelection();
 
-  /// Emitted when error in application happens
-  void errorOccurred(const QString&);
-
   //! the signal about the workshop actions states are updated.
   void commandStatusUpdated();
 
@@ -341,6 +370,9 @@ signals:
   /// differs in the new state of paged container
   void onValuesChanged();
 
+  /// Listens the corresponded signal of model widget and updates Apply button state by feature
+  void onWidgetObjectUpdated();
+
   /// Show property panel
   void showPropertyPanel();
 
@@ -380,39 +412,6 @@ signals:
   /// \param theOperation an operation
    void setGrantedFeatures(ModuleBase_Operation* theOperation);
 
-  //! Find all referenced features. Return direct and indirect lists of referenced object
-  //! \param theList an objects to be checked
-  //! \param aDirectRefFeatures a list of direct reference features
-  //! \param aIndirectRefFeatures a list of features which depend on the feature through others
-  void findReferences(const QObjectPtrList& theList,
-                      std::set<FeaturePtr>& aDirectRefFeatures,
-                      std::set<FeaturePtr>& aIndirectRefFeatures);
-
-  //! Shows a dialog box about references. Ask whether they should be also removed.
-  //! \param theList an objects to be checked
-  //! \param aDirectRefFeatures a list of direct reference features
-  //! \param aIndirectRefFeatures a list of features which depend on the feature through others
-  //! \param theParent a parent widget for the question message box
-  //! \param doDeleteReferences if there are parameters between features, ask if they should be
-  //! replaced to their meaning without corresponded features remove
-  //! \return true if in message box answer is Yes
-  bool isDeleteFeatureWithReferences(const QObjectPtrList& theList,
-                                     const std::set<FeaturePtr>& aDirectRefFeatures,
-                                     const std::set<FeaturePtr>& aIndirectRefFeatures,
-                                     QWidget* theParent,
-                                     bool& doDeleteReferences);
-
-  //! \param theIgnoredFeatures a list of features to be ignored during delete
-  //! \param theList an objects to be checked
-  //! \param aDirectRefFeatures a list of direct reference features
-  //! \param aIndirectRefFeatures a list of features which depend on the feature through others
-  //! \param doDeleteReferences flag if referenced features should be removed also
-  bool deleteFeaturesInternal(const QObjectPtrList& theList,
-                              const std::set<FeaturePtr>& aDirectRefFeatures,
-                              const std::set<FeaturePtr>& aIndirectRefFeatures,
-                              const std::set<FeaturePtr>& theIgnoredFeatures,
-                              const bool doDeleteReferences = true);
-
 private:
   /// Display all results
   //void displayAllResults();
@@ -428,7 +427,7 @@ private:
   /// 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.
   /// \param theOpertion a started operation
-  void onOperationStarted(ModuleBase_Operation* theOperation);
+  // void onOperationStarted(ModuleBase_Operation* theOperation);
 
   /// SLOT, that is called after the operation is resumed. Update workshop state according to
   /// the started operation, e.g. visualizes the property panel and connect to it.
@@ -496,15 +495,6 @@ private:
   //! \param theSlot - onUndo(int) or onRedo(int) SLOT
   void addHistoryMenu(QObject* theObject, const char* theSignal, const char* theSlot);
 
-
-  /// Calls removeFeature of the document for each object in the list
-  //! \param theList an objects to be deleted
-  //! \param theIgnoredFeatures a list of features to be ignored during delete
-  //! \param theActionId an action command key to find context menu object types enabled for remove
-  bool removeFeatures(const QObjectPtrList& theList,
-                      const std::set<FeaturePtr>& theIgnoredFeatures,
-                      const QString& theActionId);
-
   //! Creates list of actions (commands) by given history list from session
   QList<ActionInfo> processHistoryList(const std::list<std::string>&) const;
 
@@ -531,7 +521,9 @@ private:
 
   QString myCurrentDir;
 
-  int myViewerSelMode;
+  QIntList myViewerSelMode;
+
+  Config_DataModelReader* myDataModelXMLReader;
 };
 
 #endif