From: isn Date: Tue, 14 Nov 2017 13:24:20 +0000 (+0300) Subject: refs #1329 X-Git-Tag: v2.1~24^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ee4c22ea2d3660cd23181b3d6865868698d2ce0d;p=modules%2Fhydro.git refs #1329 --- diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index f20ed70c..5ad9a3ef 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -225,7 +225,6 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) if( occ_mgr ) occ_mgr->setChainedOperations( true );//TODO: via preferences - foreach( SUIT_ViewWindow* aViewWindow, aViewManager->getViews() ) { OCCViewer_ViewFrame* aViewFrame = dynamic_cast( aViewWindow ); @@ -251,6 +250,7 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) } } + // SUIT_DataBrowser* ob = getApp()->objectBrowser(); // SUIT_AbstractModel* treeModel = dynamic_cast( ob->model() ); // treeModel->setAppropriate( SUIT_DataObject::VisibilityId, Qtx::Toggled ); @@ -896,7 +896,7 @@ 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" ); + addPreference( tr( "PREF_VIEWER_ZOOM_SHUTOFF" ), viewerGroup, LightApp_Preferences::Bool, "HYDRO", "zoom_shutoff" ); int StricklerTableGroup = addPreference( tr( "PREF_GROUP_STRICKLER_TABLE" ), genTab ); int defaultStricklerCoef = addPreference( tr( "PREF_DEFAULT_STRICKLER_COEFFICIENT" ), StricklerTableGroup, @@ -956,37 +956,10 @@ void HYDROGUI_Module::preferencesChanged( const QString& theSection, const QStri getOCCDisplayer()->UpdatePolylines( aViewerId, aType, aSize ); } } - else if (theSection == "HYDRO" && thePref == "automatic_zoom") + else if (theSection == "HYDRO" && thePref == "zoom_shutoff") { - 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); - } - } - } - } + bool aZoomShutoff = resMgr->booleanValue( "HYDRO", "zoom_shutoff" ); + setAutoZoomToAllViewManagers(!aZoomShutoff); } else LightApp_Module::preferencesChanged( theSection, thePref ); @@ -1064,6 +1037,8 @@ void HYDROGUI_Module::update( const int flags ) setUpdateEnabled( true ); + setAutoZoomToAllViewManagers(false); + QApplication::restoreOverrideCursor(); } @@ -1705,7 +1680,6 @@ void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow ) aViewFrame->onTopView(); HYDROGUI_Tool::setOCCActionShown( aViewFrame, OCCViewer_ViewWindow::MaximizedId, false ); - OCCViewer_ViewPort3d* aViewPort = aViewFrame->getViewPort(); if ( aViewPort ) { aViewPort->installEventFilter( this ); @@ -2038,3 +2012,38 @@ void HYDROGUI_Module::onViewActivated( SUIT_ViewManager* theMgr ) myOverview->setMainView( occwnd ); } + +void HYDROGUI_Module::setAutoZoomToAllViewManagers(bool bAutoZoom) +{ + ViewManagerList aViewManagers = getApp()->viewManagers(); + foreach (SUIT_ViewManager* aVMgr, aViewManagers) + setAutoZoom(aVMgr, bAutoZoom); +} + +void HYDROGUI_Module::setAutoZoom(SUIT_ViewManager* aVMgr, bool bAutoZoom) +{ + if (!aVMgr) + return; + QVector aViews = aVMgr->getViews(); + foreach (SUIT_ViewWindow* aView, aViews) + { + if (aView) + { + OCCViewer_ViewFrame* anOCCViewFrame = dynamic_cast( aView ); + if (anOCCViewFrame) + { + anOCCViewFrame->setAutomaticZoom(bAutoZoom); + for (int i = OCCViewer_ViewFrame::MAIN_VIEW; i<=OCCViewer_ViewFrame::TOP_RIGHT; i++) + { + OCCViewer_ViewWindow* aV = anOCCViewFrame->getView(i); + if (aV) + aV->setAutomaticZoom(bAutoZoom); + } + } + OCCViewer_ViewWindow* anOCCViewWindow = dynamic_cast( aView ); + if (anOCCViewWindow) + anOCCViewWindow->setAutomaticZoom(bAutoZoom); + } + } +} + diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index ba0f8ba5..8ecc3090 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -263,7 +263,8 @@ public: protected: CAM_DataModel* createDataModel(); - + void setAutoZoomToAllViewManagers(bool bAutoZoom); + void setAutoZoom(SUIT_ViewManager* aVMgr, bool bAutoZoom); public slots: virtual bool activateModule( SUIT_Study* ); virtual bool deactivateModule( SUIT_Study* ); diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index a2b588fe..da5bed2d 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -283,8 +283,8 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) 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_VIEWER_ZOOM_SHUTOFF + Turn on the conservation of zoom (zoom shutoff) when when front/top/left/etc called PREF_GROUP_STRICKLER_TABLE diff --git a/src/HYDROGUI/resources/LightApp.xml b/src/HYDROGUI/resources/LightApp.xml index e08f4acb..8f8cfad9 100644 --- a/src/HYDROGUI/resources/LightApp.xml +++ b/src/HYDROGUI/resources/LightApp.xml @@ -29,7 +29,7 @@ - +