]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1457
authorisn <isn@opencascade.com>
Mon, 4 Dec 2017 12:45:27 +0000 (15:45 +0300)
committerisn <isn@opencascade.com>
Mon, 4 Dec 2017 12:45:27 +0000 (15:45 +0300)
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Module.h
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROGUI/resources/LightApp.xml

index 6dd2a91ef1cd4b0d1800042fbddc3817e71a5c0e..de6e90393f6d4b31b017bc02843bfe5aa5d83ca7 100644 (file)
@@ -239,6 +239,8 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
 
   preferencesChanged( "HYDRO", "zoom_shutoff" );
 
+  preferencesChanged( "HYDRO", "chained_panning" );
+
   // Load GEOM data
   SalomeApp_Study* aStudy = 
     dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
@@ -910,6 +912,8 @@ void HYDROGUI_Module::createPreferences()
 
   addPreference( tr( "PREF_VIEWER_ZOOM_SHUTOFF" ), viewerGroup, LightApp_Preferences::Bool, "HYDRO", "zoom_shutoff" );
 
+  addPreference( tr( "PREF_VIEWER_CHAINED_PANNING" ), viewerGroup, LightApp_Preferences::Bool, "HYDRO", "chained_panning" );
+
   int StricklerTableGroup = addPreference( tr( "PREF_GROUP_STRICKLER_TABLE" ), genTab );
   int defaultStricklerCoef = addPreference( tr( "PREF_DEFAULT_STRICKLER_COEFFICIENT" ), StricklerTableGroup,
                                             LightApp_Preferences::DblSpin, "preferences", "default_strickler_coefficient" );
@@ -973,8 +977,21 @@ void HYDROGUI_Module::preferencesChanged( const QString& theSection, const QStri
       bool aZoomShutoff = resMgr->booleanValue( "HYDRO", "zoom_shutoff" );
       setAutoZoomToAllViewManagers(!aZoomShutoff);
     }
+    else if (theSection == "HYDRO" && thePref == "chained_panning")
+    {
+      bool aChainedPan = resMgr->booleanValue( "HYDRO", "chained_panning" );
+      if (!aChainedPan)
+        resetViewState();
+      ViewManagerList aViewManagers = getApp()->viewManagers();
+      foreach (SUIT_ViewManager* aVMgr, aViewManagers)
+      {
+        OCCViewer_ViewManager* anOCCViewMgr = dynamic_cast<OCCViewer_ViewManager*>( aVMgr );
+        if (anOCCViewMgr)
+          anOCCViewMgr->setChainedOperations( aChainedPan );
+      }
+    }
     else
-        LightApp_Module::preferencesChanged( theSection, thePref );
+      LightApp_Module::preferencesChanged( theSection, thePref );
 }
 
 QCursor HYDROGUI_Module::getPrefEditCursor() const
@@ -1051,6 +1068,8 @@ void HYDROGUI_Module::update( const int flags )
 
   preferencesChanged( "HYDRO", "zoom_shutoff" );
 
+  preferencesChanged( "HYDRO", "chained_panning" );
+
   QApplication::restoreOverrideCursor();
 }
 
@@ -1612,7 +1631,7 @@ void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager )
   else if( theViewManager->getType() == OCCViewer_Viewer::Type() )
   {
     OCCViewer_ViewManager* mgr = dynamic_cast<OCCViewer_ViewManager*>( theViewManager );
-    mgr->setChainedOperations( true );//TODO: via preferences
+    //mgr->setChainedOperations( true );
 
     connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
              this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
index 8ecc3090578579e3b14afbb7f86578e2e617ee39..00c87819cb5da34642811bc1494b8f7b0c87a420 100644 (file)
@@ -163,6 +163,8 @@ public:
 
   virtual void                    preferencesChanged( const QString&, const QString& );
 
+  void                            resetViewState();
+
   /** 
    * Set IsToUpdate flag for all presentations of the given object to recompute them during 
    * the next viewer(s) updating.
index dfa569fad0fe543f8b61531e4dc3547869605d74..cb4bb6750ea82426e184eee57cc2bc536dc0b759 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 );
   }
 
index 7af82b32984d8c89a0a0fa5da68986e04cf52562..0ca06e8a1cba01b80176c06d96a63b44cbfe2e48 100644 (file)
@@ -286,6 +286,10 @@ All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
       <source>PREF_VIEWER_ZOOM_SHUTOFF</source>
       <translation>Conservation of zoom when top-view/etc is activated</translation>
     </message>
+    <message>
+      <source>PREF_VIEWER_CHAINED_PANNING</source>
+      <translation>Chained panning</translation>
+    </message>
     <message>
       <source>PREF_GROUP_STRICKLER_TABLE</source>
       <translation>Strickler table</translation>
index 8f8cfad9750dd21225ab1c5cc135a462662655f7..c23856fe6cf8130699df43a0d1767e173be19e8b 100644 (file)
@@ -30,6 +30,7 @@
     <parameter name="version" value="2.0.0"/>
     <parameter value="false" name="auto_fit_all"/>
     <parameter value="true" name="zoom_shutoff"/>
+    <parameter value="true" name="chained_panning"/>
     <parameter name="documentation" value="hydro_help"/>
   </section>
   <section name="hydro_help" >