]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Command New Document provided
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 10 Apr 2014 11:18:19 +0000 (15:18 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 10 Apr 2014 11:18:19 +0000 (15:18 +0400)
src/XGUI/XGUI_MainWindow.cpp
src/XGUI/XGUI_MenuGroupPanel.h
src/XGUI/XGUI_ObjectsBrowser.h
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_SelectionMgr.h
src/XGUI/XGUI_Viewer.cpp
src/XGUI/XGUI_Viewer.h
src/XGUI/XGUI_Workshop.cpp

index 99d2422e9c32dced0a0ce88ac985f384998ed7f5..25ea218c9519b3771d8e7507805341737061f50f 100644 (file)
@@ -121,7 +121,7 @@ void XGUI_MainWindow::createDockWidgets()
   myPropertyPanelDock = createPropertyPanel();
   addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanelDock);
   hidePropertyPanel(); //<! Invisible by default
-
+  hideObjectBrowser();
   tabifyDockWidget(aObjDock, myPropertyPanelDock);
 }
 
@@ -171,9 +171,6 @@ QDockWidget* XGUI_MainWindow::createObjectBrowser()
   aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
   aObjDock->setWindowTitle(tr("Object browser"));
   myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
-  //myObjectBrowser->setColumnCount(1);
-  //myObjectBrowser->setHeaderHidden(true);
   aObjDock->setWidget(myObjectBrowser);
-//  fillObjectBrowser();
   return aObjDock;
 }
index 7f9f575957ec787affe1179db817d64ef0c84770..58fd7a7975550847c69a2e14110e38ca98a49c73 100644 (file)
@@ -7,12 +7,17 @@
 class XGUI_Command;
 class QGridLayout;
 
+/**\class XGUI_MenuGroupPanel
+ * \ingroup GUI
+ * \brief Represents a one group in a page of main menu (workbench)
+ */
 class XGUI_MenuGroupPanel: public QWidget
 {
 Q_OBJECT
 public:
   explicit XGUI_MenuGroupPanel(QWidget *parent = 0);
 
+  //! Adding a new feature (Command) in the group
   XGUI_Command* addFeature(const QString& theId, const QString& theTitle, const QString& theTip,
                            const QIcon& theIcon, const QKeySequence& theKeys = QKeySequence());
 
index dff46d5aeb5ae6a7948adcf2842321041b8bb6b5..0d1043c0f3f3734b3cee40abb3165529f24fdf61 100644 (file)
@@ -8,27 +8,37 @@
 
 class XGUI_DocumentDataModel;
 
-class XGUI_ObjectsBrowser : public QTreeView
+/**\class XGUI_ObjectsBrowser
+ * \ingroup GUI
+ * \brief Object browser window object. Represents data tree of current data structure
+ */
+ class XGUI_ObjectsBrowser : public QTreeView
 {
   Q_OBJECT
 public:
   XGUI_ObjectsBrowser(QWidget* theParent);
   virtual ~XGUI_ObjectsBrowser();
 
+  //! Returns Model which provides access to data objects
   XGUI_DocumentDataModel* dataModel() const { return myDocModel; }
 
+  //! Returns list of currently selected features
   QFeatureList selectedData() const { return mySelectedData; }
 
 signals:
+  //! Emited when selection is changed
   void selectionChanged();
 
 
 private slots:
+  //! Called when selection in Data Tree is changed
   void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
 
 private:
+  //! Internal model
   XGUI_DocumentDataModel* myDocModel;
 
+  //! List of currently selected data
   QFeatureList mySelectedData;
 };
 
index 9d1d1e72490207b1b9a426b368d3ce2dc5532704..c4c09491de67d2fe34635116cb1ee8888ef4fc70 100644 (file)
@@ -33,7 +33,9 @@ void XGUI_SelectionMgr::onSelectionChanged()
     FeaturePtr aFeature = mySelectedData.first();
 
     std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
-    aMgr->setCurrentDocument(aFeature->data()->docRef("PartDocument")->value());
+    std::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aFeature->data()->docRef("PartDocument");
+    if (aDocRef)
+      aMgr->setCurrentDocument(aDocRef->value());
   }
 
   emit selectionChanged();
index 5f50ca3d81d6b344652d236061b903a54aa73ffa..58af58ea0515878ba974481329f58e539ec0a8f4 100644 (file)
@@ -6,6 +6,11 @@
 
 class XGUI_Workshop;
 
+/**\class XGUI_SelectionMgr
+ * \ingroup GUI
+ * \brief Selection manager. Provides selection event on selection in 
+ * Object Browser and Viewer
+ */
 class XGUI_SelectionMgr : public QObject
 {
   Q_OBJECT
@@ -13,10 +18,11 @@ public:
   XGUI_SelectionMgr(XGUI_Workshop* theParent);
   virtual ~XGUI_SelectionMgr();
 
+  //! Returns list of currently selected objects
   QFeatureList selectedData() const { return mySelectedData; }
 
-
 signals:
+  //! Emited when selection in a one of viewers was changed
   void selectionChanged();
 
 public slots:
@@ -25,6 +31,7 @@ public slots:
 private:
   XGUI_Workshop* myWorkshop;
 
+  //! List of selected features
   QFeatureList mySelectedData;
 };
 
index 6bec77168952fad966741f91e2c8b30c31822bb9..6added867d745cb571e124b72d7c6b6dda85b06f 100644 (file)
@@ -227,7 +227,7 @@ bool XGUI_Viewer::isTrihedronVisible() const
  \param on - new state
  */
 
-void XGUI_Viewer::setTrihedronShown(const bool on)
+void XGUI_Viewer::setTrihedronShown(bool on)
 {
   if (myTrihedron.IsNull())
     return;
index 654221a595bd99b13f7b0c5c8bff3e3f1ee13e9d..6afdf36ec93065c94aee4c2434cc7ce554c86aff 100644 (file)
@@ -17,6 +17,11 @@ class XGUI_ViewWindow;
 class QMouseEvent;
 class QKeyEvent;
 
+/**\class XGUI_Viewer
+ * \ingroup GUI
+ * \brief Represents a 3d viewer. The viewer manages 3d scene and a set of view windows
+ * when each of view window is a one point of view on this scene.
+ */
 class XGUI_Viewer: public QObject
 {
 Q_OBJECT
@@ -26,38 +31,56 @@ public:
   XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true);
   ~XGUI_Viewer();
 
+  //! Creates a new view window
   QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
 
+  //! Return pointer on a main window - parent of the Viewer
   XGUI_MainWindow* mainWindow() const
   {
     return myMainWindow;
   }
 
+  //! Returns OCCT object which manages 3d scene
   Handle(V3d_Viewer) v3dViewer() const
   {
     return myV3dViewer;
   }
 
+  //! Returns OCCT object which manages displaying and selection in 3d scene
   Handle(AIS_InteractiveContext) AISContext() const
   {
     return myAISContext;
   }
 
+  //! Trihedron 3d object shown in the viewer
   Handle(AIS_Trihedron) trihedron() const
   {
     return myTrihedron;
   }
 
+  //! On/Off visibility of the trihedron object
   void toggleTrihedron();
+
+  //! Returns true if trihedron is visible
   bool isTrihedronVisible() const;
-  void setTrihedronShown(const bool on);
+
+  //! Returns true if trihedron is visible
+  void setTrihedronShown(bool on);
+
+  //! Returns trihedron size
   double trihedronSize() const;
+
+  //! Sets trihedron size
   void setTrihedronSize(const double sz, bool isRelative);
+
   bool trihedronRelative() const
   {
     return myIsRelative;
   }
+  //! Update trihedron
   void updateTrihedron();
+
+  //! Compute trihedron size dependent on 3d scene size
   bool computeTrihedronSize(double& theNewSize, double& theSize);
 
   static void setHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
@@ -75,28 +98,28 @@ public:
   static InteractionStyle2ButtonsMap myButtonMap;
 
 signals:
-    void lastViewClosed();
-    void tryCloseView(XGUI_ViewWindow* theWindow);
-    void deleteView(XGUI_ViewWindow* theWindow);
-    void viewCreated(XGUI_ViewWindow* theWindow);
-    void mousePress(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
-    void mouseRelease(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
-    void mouseDoubleClick(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
-    void mouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
-    void keyPress(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
-    void keyRelease(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
-    void activated(XGUI_ViewWindow* theWindow);
+  void lastViewClosed();
+  void tryCloseView(XGUI_ViewWindow* theWindow);
+  void deleteView(XGUI_ViewWindow* theWindow);
+  void viewCreated(XGUI_ViewWindow* theWindow);
+  void mousePress(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+  void mouseRelease(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+  void mouseDoubleClick(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+  void mouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+  void keyPress(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
+  void keyRelease(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
+  void activated(XGUI_ViewWindow* theWindow);
 
 private slots:
-    void onViewClosed(QMdiSubWindow*);
-    //void onViewMapped();
-    void onWindowActivated(QMdiSubWindow*);
+  void onViewClosed(QMdiSubWindow*);
+  //void onViewMapped();
+  void onWindowActivated(QMdiSubWindow*);
 
 private:
-    void addView(QMdiSubWindow* theView);
+  void addView(QMdiSubWindow* theView);
 
-    /*! Removes the View from internal Views list.*/
-    void removeView(QMdiSubWindow* theView);
+  /*! Removes the View from internal Views list.*/
+  void removeView(QMdiSubWindow* theView);
 
 private:
   XGUI_MainWindow* myMainWindow;
index e5552b506793d76400f266c4de951d2269b37119..682a4eea7e39f8d89545a22924117ccfc07d51c8 100644 (file)
@@ -65,21 +65,18 @@ void XGUI_Workshop::startApplication()
   aLoop->registerListener(this, aPartSetId);
   activateModule();
   myMainWindow->show();
-  QMdiSubWindow* aWnd = myMainWindow->viewer()->createView();
-  aWnd->showMaximized();
-  myMainWindow->showPythonConsole();
 
   // Testing of document creation
-  std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
-  std::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
-  std::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
-  aPart->execute();
-  aMgr->setCurrentDocument(aPart->data()->docRef("PartDocument")->value());
-  std::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
-  aPoint2 = aMgr->rootDocument()->addFeature("Point");
-
-  aPart = aMgr->rootDocument()->addFeature("Part");
-  aPart->execute();
+  //std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+  //std::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
+  //std::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
+  //aPart->execute();
+  //aMgr->setCurrentDocument(aPart->data()->docRef("PartDocument")->value());
+  //std::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
+  //aPoint2 = aMgr->rootDocument()->addFeature("Point");
+
+  //aPart = aMgr->rootDocument()->addFeature("Part");
+  //aPart->execute();
 }
 
 //******************************************************
@@ -249,7 +246,12 @@ void XGUI_Workshop::onExit()
 //******************************************************
 void XGUI_Workshop::onNew()
 {
+  QApplication::setOverrideCursor(Qt::WaitCursor);
   myMainWindow->showObjectBrowser();
+  myMainWindow->showPythonConsole();
+  QMdiSubWindow* aWnd = myMainWindow->viewer()->createView();
+  aWnd->showMaximized();
+  QApplication::restoreOverrideCursor();
 }
 
 //******************************************************