Salome HOME
Merge remote-tracking branch 'remotes/origin/BR_2017' into HEAD
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Operations.cxx
index 291ec3941e5cd8b6b26ce6257188bab885e8a980..a3631f1a46c2d133331979c07516c6d457b4694b 100644 (file)
@@ -455,36 +455,40 @@ void HYDROGUI_Module::enableLCMActions()
   if ( anAction ) anAction->setEnabled( anEnableTools );
 }
 
-void HYDROGUI_Module::onOperation()
+void HYDROGUI_Module::resetViewState()
 {
-  const QAction* anAction = dynamic_cast<const QAction*>( sender() );
-  int anId = actionId( anAction );
-  if( anId >= 0 )
+  OCCViewer_ViewManager* mgr = dynamic_cast<OCCViewer_ViewManager*>(getApp()->viewManager( OCCViewer_Viewer::Type()));
+  if( mgr )
   {
-    OCCViewer_ViewManager* mgr = dynamic_cast<OCCViewer_ViewManager*>( 
-      getApp()->viewManager( OCCViewer_Viewer::Type() ) );
-    if( mgr )
+    foreach( SUIT_ViewWindow* wnd, mgr->getViews() )
     {
-      foreach( SUIT_ViewWindow* wnd, mgr->getViews() )
+      OCCViewer_ViewFrame* vf = dynamic_cast<OCCViewer_ViewFrame*>( wnd );
+      if( vf )
       {
-        OCCViewer_ViewFrame* vf = dynamic_cast<OCCViewer_ViewFrame*>( wnd );
-        if( vf )
-        {
-          for( int i=OCCViewer_ViewFrame::MAIN_VIEW; i<=OCCViewer_ViewFrame::TOP_RIGHT; i++ )
-          {
-            OCCViewer_ViewWindow* iwnd = vf->getView(i);
-            if( iwnd )
-              iwnd->resetState();
-          }
-        }
-        else
+        for( int i=OCCViewer_ViewFrame::MAIN_VIEW; i<=OCCViewer_ViewFrame::TOP_RIGHT; i++ )
         {
-          OCCViewer_ViewWindow* ownd = dynamic_cast<OCCViewer_ViewWindow*>( wnd );
-          if( ownd )
-            ownd->resetState();
+          OCCViewer_ViewWindow* iwnd = vf->getView(i);
+          if( iwnd )
+            iwnd->resetState();
         }
       }
+      else
+      {
+        OCCViewer_ViewWindow* ownd = dynamic_cast<OCCViewer_ViewWindow*>( wnd );
+        if( ownd )
+          ownd->resetState();
+      }
     }
+  }
+}
+
+void HYDROGUI_Module::onOperation()
+{
+  const QAction* anAction = dynamic_cast<const QAction*>( sender() );
+  int anId = actionId( anAction );
+  if( anId >= 0 )
+  {
+    resetViewState();
     startOperation( anId );
   }