]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Return old 2d mode from setViewer2DMode SKV_CCreator_from_HYDRO
authorskv <skv@opencascade.com>
Tue, 7 Oct 2014 13:22:52 +0000 (17:22 +0400)
committerskv <skv@opencascade.com>
Tue, 7 Oct 2014 13:22:52 +0000 (17:22 +0400)
src/OCCViewer/OCCViewer_Utilities.cxx
src/OCCViewer/OCCViewer_Utilities.h

index 1fe25f4f6b95a338b0e5dfa8019055d71e7af69a..fd9c9242c9f19df55ae21e925b6bad7d61e87c97 100644 (file)
 
 #include <QAction>
 
-void OCCViewer_Utilities::setViewer2DMode( OCCViewer_Viewer* theViewer,
+OCCViewer_ViewWindow::Mode2dType OCCViewer_Utilities::setViewer2DMode
+                                         ( OCCViewer_Viewer* theViewer,
                                            const OCCViewer_ViewWindow::Mode2dType& theMode )
 {
+  OCCViewer_ViewWindow::Mode2dType anOldMode = OCCViewer_ViewWindow::No2dMode;
   OCCViewer_ViewFrame* aFrame = dynamic_cast<OCCViewer_ViewFrame*>
                                      ( theViewer->getViewManager()->getActiveView() );
   OCCViewer_ViewWindow* aView = aFrame ? aFrame->getView( OCCViewer_ViewFrame::MAIN_VIEW ) : 0;
   if ( !aView )
-    return;
+    return anOldMode;
 
   // set a view mode
+  anOldMode = aView->get2dMode();
   aView->set2dMode( theMode );
   bool is2dMode = theMode != OCCViewer_ViewWindow::No2dMode;
 
@@ -61,4 +64,6 @@ void OCCViewer_Utilities::setViewer2DMode( OCCViewer_Viewer* theViewer,
         break;
     }
   }
+
+  return anOldMode;
 }
index 8460f3cc17b007244daea5eac63788cec1b3f683..8319bf74d6ba155eb120c045a1c4ccc9a9af0575 100644 (file)
@@ -18,8 +18,10 @@ public:
    * Set 2D mode for the viewer. Hide or show 3D actions.
    * \param theViewer an OCC viewer
    * \param theMode OCC view window mode
+   * \return the old 2d mode.
    */
-  static void setViewer2DMode( OCCViewer_Viewer* theViewer,
+  static OCCViewer_ViewWindow::Mode2dType
+              setViewer2DMode( OCCViewer_Viewer* theViewer,
                                const OCCViewer_ViewWindow::Mode2dType& theMode );
 
 };