Salome HOME
Implement folder operations for sub document
[modules/shaper.git] / src / XGUI / XGUI_Workshop.h
index fea7600a04992929202324f2de8801d765861425..8a96cfa803fd838891e70dad003e90cf6974a787 100755 (executable)
@@ -1,4 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
 
 #ifndef XGUI_WORKSHOP_H
 #define XGUI_WORKSHOP_H
@@ -58,7 +76,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 +194,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();
 
@@ -193,14 +211,25 @@ Q_OBJECT
   bool canBeShaded(const ObjectPtr& theObject) const;
 
   //! Returns true if there is at least one selected body/construction/group result
+  //! \param theActionName text of the checked action
   //! \return boolean value
-  bool canChangeColor() const;
+  bool canChangeProperty(const QString& theActionName) 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);
 
+  //! 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);
+
+  //! Change transparency of the results if it is possible
+  //! The operation is available for construction, body and group results
+  //! theObjects a list of selected objects
+  void changeTransparency(const QObjectPtrList& theObjects);
+
   //! Show the given features in 3d Viewer
   void showObjects(const QObjectPtrList& theList, bool isVisible);
 
@@ -246,6 +275,12 @@ 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 theFeatures a list of objects to be deleted
@@ -268,16 +303,19 @@ Q_OBJECT
   /// 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
@@ -294,7 +332,7 @@ Q_OBJECT
   /// features found in the given list
   void highlightFeature(const QObjectPtrList& theObjects);
 
-  /// Returns Data Model XML reader which contains information about 
+  /// Returns Data Model XML reader which contains information about
   /// Data structure configuration
   const Config_DataModelReader* dataModelXMLReader() const { return myDataModelXMLReader; }
 
@@ -302,6 +340,10 @@ Q_OBJECT
   /// 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();
@@ -383,6 +425,11 @@ signals:
   /// Activates/deactivates the trihedron in the viewer AIS context
   void onTrihedronVisibilityChanged(bool theState);
 
+  /// Apply the current transparency value if preview in transparency dialog is switched on
+  void onTransparencyValueChanged();
+
+  /// Switch on/off preview of transparency change
+  void onPreviewStateChanged();
 
  protected:
   /// Sets the granted operations for the parameter operation. Firstly, it finds the nested features
@@ -401,11 +448,20 @@ private:
   /// Display results from a group
   void displayGroupResults(DocumentPtr theDoc, std::string theGroup);
 
+  /// Insert folder object before currently selected feature
+  void insertFeatureFolder();
+
+  /// Insert an object to a folder above or below
+  void insertToFolder(bool isBefore);
+
+  /// Insert an object to a folder above or below
+  void moveOutFolder(bool isBefore);
+
  private 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.
   /// \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.