]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1329 preference only
authorisn <isn@opencascade.com>
Wed, 8 Nov 2017 10:21:47 +0000 (13:21 +0300)
committerisn <isn@opencascade.com>
Wed, 8 Nov 2017 12:09:23 +0000 (15:09 +0300)
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROGUI/resources/LightApp.xml

index 36d652a722076189f98e2562b997ffe162475ec6..9b9f9e5e1bd8beb2fe7dd27c1f6cc5b2ccdecc42 100644 (file)
@@ -875,6 +875,8 @@ void HYDROGUI_Module::createPreferences()
   addPreference( tr( "PREF_VIEWER_AUTO_FITALL" ), viewerGroup,
                  LightApp_Preferences::Bool, "HYDRO", "auto_fit_all" );
 
+  addPreference( tr( "PREF_VIEWER_AUTOMATIC_ZOOM" ), viewerGroup, LightApp_Preferences::Bool, "HYDRO", "automatic_zoom" );
+
   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" );
@@ -933,6 +935,38 @@ void HYDROGUI_Module::preferencesChanged( const QString& theSection, const QStri
           getOCCDisplayer()->UpdatePolylines( aViewerId, aType, aSize );
       }
     }
+    else if (theSection == "HYDRO" && thePref == "automatic_zoom")
+    {
+      bool anAutoZoom = resMgr->booleanValue( "HYDRO", "automatic_zoom" );
+      ViewManagerList aViewManagers = getApp()->viewManagers();
+      foreach (SUIT_ViewManager* aVMgr, aViewManagers)
+      {
+        if (aVMgr)
+        {
+          QVector<SUIT_ViewWindow*> aViews = aVMgr->getViews();
+          foreach (SUIT_ViewWindow* aView, aViews)
+          {
+            if (aView)
+            {
+              OCCViewer_ViewFrame* anOCCViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aView );
+              if (anOCCViewFrame)
+              {
+                anOCCViewFrame->setAutomaticZoom(anAutoZoom);
+                for (int i = OCCViewer_ViewFrame::MAIN_VIEW; i<=OCCViewer_ViewFrame::TOP_RIGHT; i++)
+                {
+                  OCCViewer_ViewWindow* aV = anOCCViewFrame->getView(i);
+                  if (aV)
+                    aV->setAutomaticZoom(anAutoZoom);
+                }
+              }
+              OCCViewer_ViewWindow* anOCCViewWindow = dynamic_cast<OCCViewer_ViewWindow*>( aView );
+              if (anOCCViewWindow)
+                anOCCViewWindow->setAutomaticZoom(true);
+            }
+          }
+        }
+      }
+    }
     else
         LightApp_Module::preferencesChanged( theSection, thePref );
 }
index 35ff9864d9b6aa96dae0b8329392db1b0896b4ec..adb545a0cf0e0d2971317d4fc44967e0608ac39d 100644 (file)
@@ -278,6 +278,10 @@ All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
       <source>PREF_VIEWER_AUTO_FITALL</source>
       <translation>Make automatic fit all after show object operation</translation>
     </message>
+    <message>
+      <source>PREF_VIEWER_AUTOMATIC_ZOOM</source>
+      <translation>Turn on the automatic fit-all operation when front/top/left/etc called</translation>
+    </message>
     <message>
       <source>PREF_GROUP_STRICKLER_TABLE</source>
       <translation>Strickler table</translation>
index 4189d413e06e80461d439c3506066b0a41f57208..020ae866064d3fb4fee6d0c324f08940c2451033 100644 (file)
@@ -29,6 +29,7 @@
     <parameter value="0" name="parameter_test" />
     <parameter name="version" value="2.0.0"/>
     <parameter value="false" name="auto_fit_all"/>
+    <parameter value="false" name="automatic_zoom"/>
     <parameter name="documentation" value="hydro_help"/>
   </section>
   <section name="hydro_help" >