X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Workshop.h;h=37c04437fdc18426d5a0527af068e7ae500853ce;hb=52a2aa0728f8694d5774a20bd1eeba8e5e2f8b27;hp=34ce06b91568e4483d9c0d03e458429d644d9bd4;hpb=a2686c838648dcf05659df3c31d9b90aca42b792;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 34ce06b91..37c04437f 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -10,6 +10,8 @@ #include #include +#include + #include #include #include @@ -41,6 +43,7 @@ class Config_PointerMessage; class QWidget; class QDockWidget; +class QMainWindow; class ModelAPI_ObjectUpdatedMessage; class ModelAPI_ObjectDeletedMessage; @@ -149,6 +152,10 @@ Q_OBJECT return myModuleConnector; } + /// Returns a desktop + /// \return a desktop instance + QMainWindow* desktop() const; + //! Returns icon name according to feature static QIcon featureIcon(const FeaturePtr& theFeature); @@ -157,7 +164,16 @@ Q_OBJECT void activatePart(std::shared_ptr theFeature); //! Delete features - void deleteObjects(const QObjectPtrList& theList); + void deleteObjects(); + + //! Returns true if there is at least one selected body/construction/group result + //! \return boolean value + bool canChangeColor() const; + + //! Change color of the features 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); //! Show the given features in 3d Viewer void showObjects(const QObjectPtrList& theList, bool isVisible); @@ -197,6 +213,19 @@ Q_OBJECT */ bool isActiveOperationAborted(); + //! 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 + //! \param theParent a parent widget for the question message box + //! \param theAskAboutDeleteReferences if true, the message box with a list of references to the + //! objects features appear. If the user chose do not continue, the deletion is not performed + //! \return the success of the delete + static bool deleteFeatures(const QObjectPtrList& theList, + std::set theIgnoredFeatures = std::set(), + QWidget* theParent = 0, + const bool theAskAboutDeleteReferences = false); + signals: /// Emitted when selection happens in Salome viewer void salomeViewerSelection(); @@ -210,10 +239,18 @@ signals: //! the application is started void applicationStarted(); + //! Signal to update Undo history list + void updateUndoHistory(const QList&); + //! Signal to update Redo history list + void updateRedoHistory(const QList&); + public slots: /// Update of commands status void updateCommandStatus(); + /// update history list (undo/redo commands) + void updateHistory(); + /// Create a new dokument void onNew(); @@ -230,10 +267,10 @@ signals: void onExit(); /// Undo last command - void onUndo(); + void onUndo(int times = 1); /// Redo previous command - void onRedo(); + void onRedo(int times = 1); /// Rebuild data tree void onRebuild(); @@ -333,14 +370,11 @@ signals: /// \param theOpertion an aborted operation void onOperationAborted(ModuleBase_Operation* theOperation); - /// Process context menu command - /// \param theId id of the command - /// \param isChecked is checked flag + /// Slot, which reacts to the context popup menu call + /// \param theId the data value of the clicked action + /// \param isChecked a state of toggle if the action is checkable void onContextMenuCommand(const QString& theId, bool isChecked); - /// Processing of values changed in model widget - void onWidgetValuesChanged(); - /// Set waiting cursor void onStartWaiting(); @@ -370,7 +404,20 @@ signals: void createDockWidgets(); /// Displaus object and fit all viewer if the object is first (update viewer will not be called) - void displayObject(ObjectPtr theObj); + /// Asks the module whether the object can be displayed + /// \param theObj an object + /// \return true if the object is displayed + bool displayObject(ObjectPtr theObj); + + //! Extends undo/redo toolbutton's with history menu + //! \param theObject - in the OpenParts it is a QToolButton by itself, + //! in salome mode - QAction that creates a button. + //! \param theSignal - void "updateUndoHistory" or "updateRedoHistory" SIGNAL; + //! \param theSlot - onUndo(int) or onRedo(int) SLOT + void addHistoryMenu(QObject* theObject, const char* theSignal, const char* theSlot); + + //! Creates list of actions (commands) by given history list from session + QList processHistoryList(const std::list&) const; private: AppElements_MainWindow* myMainWindow; @@ -394,6 +441,9 @@ private: // Flag to check that part document is in process of activating bool myPartActivating; + + /// The flag is true when we loading a document + bool myIsLoadingData; }; #endif