From b1385bc3e5450b67037e26372b1c033c8e131af4 Mon Sep 17 00:00:00 2001 From: isn Date: Wed, 8 Nov 2017 13:21:47 +0300 Subject: [PATCH] refs #1329 preference only --- src/HYDROGUI/HYDROGUI_Module.cxx | 34 +++++++++++++++++++++++ src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 4 +++ src/HYDROGUI/resources/LightApp.xml | 1 + 3 files changed, 39 insertions(+) diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 36d652a7..9b9f9e5e 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -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 aViews = aVMgr->getViews(); + foreach (SUIT_ViewWindow* aView, aViews) + { + if (aView) + { + OCCViewer_ViewFrame* anOCCViewFrame = dynamic_cast( 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( aView ); + if (anOCCViewWindow) + anOCCViewWindow->setAutomaticZoom(true); + } + } + } + } + } else LightApp_Module::preferencesChanged( theSection, thePref ); } diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 35ff9864..adb545a0 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -278,6 +278,10 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) PREF_VIEWER_AUTO_FITALL Make automatic fit all after show object operation + + PREF_VIEWER_AUTOMATIC_ZOOM + Turn on the automatic fit-all operation when front/top/left/etc called + PREF_GROUP_STRICKLER_TABLE Strickler table diff --git a/src/HYDROGUI/resources/LightApp.xml b/src/HYDROGUI/resources/LightApp.xml index 4189d413..020ae866 100644 --- a/src/HYDROGUI/resources/LightApp.xml +++ b/src/HYDROGUI/resources/LightApp.xml @@ -29,6 +29,7 @@ +
-- 2.39.2