From: skv Date: Tue, 7 Oct 2014 13:22:52 +0000 (+0400) Subject: Return old 2d mode from setViewer2DMode X-Git-Tag: V7_5_0a1~1^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FSKV_CCreator_from_HYDRO;p=modules%2Fgui.git Return old 2d mode from setViewer2DMode --- diff --git a/src/OCCViewer/OCCViewer_Utilities.cxx b/src/OCCViewer/OCCViewer_Utilities.cxx index 1fe25f4f6..fd9c9242c 100644 --- a/src/OCCViewer/OCCViewer_Utilities.cxx +++ b/src/OCCViewer/OCCViewer_Utilities.cxx @@ -11,16 +11,19 @@ #include -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 ( 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; } diff --git a/src/OCCViewer/OCCViewer_Utilities.h b/src/OCCViewer/OCCViewer_Utilities.h index 8460f3cc1..8319bf74d 100644 --- a/src/OCCViewer/OCCViewer_Utilities.h +++ b/src/OCCViewer/OCCViewer_Utilities.h @@ -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 ); };