From 796af79e8134a985ea1b3bbf9997797615ad7e16 Mon Sep 17 00:00:00 2001 From: isn Date: Mon, 4 Dec 2017 15:45:27 +0300 Subject: [PATCH] refs #1457 --- src/HYDROGUI/HYDROGUI_Module.cxx | 23 ++++++++++- src/HYDROGUI/HYDROGUI_Module.h | 2 + src/HYDROGUI/HYDROGUI_Operations.cxx | 48 ++++++++++++----------- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 4 ++ src/HYDROGUI/resources/LightApp.xml | 1 + 5 files changed, 54 insertions(+), 24 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 6dd2a91e..de6e9039 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -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( 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( 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( theViewManager ); - mgr->setChainedOperations( true );//TODO: via preferences + //mgr->setChainedOperations( true ); connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) ); diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index 8ecc3090..00c87819 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -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. diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index dfa569fa..cb4bb675 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -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( sender() ); - int anId = actionId( anAction ); - if( anId >= 0 ) + OCCViewer_ViewManager* mgr = dynamic_cast(getApp()->viewManager( OCCViewer_Viewer::Type())); + if( mgr ) { - OCCViewer_ViewManager* mgr = dynamic_cast( - getApp()->viewManager( OCCViewer_Viewer::Type() ) ); - if( mgr ) + foreach( SUIT_ViewWindow* wnd, mgr->getViews() ) { - foreach( SUIT_ViewWindow* wnd, mgr->getViews() ) + OCCViewer_ViewFrame* vf = dynamic_cast( wnd ); + if( vf ) { - OCCViewer_ViewFrame* vf = dynamic_cast( 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( wnd ); - if( ownd ) - ownd->resetState(); + OCCViewer_ViewWindow* iwnd = vf->getView(i); + if( iwnd ) + iwnd->resetState(); } } + else + { + OCCViewer_ViewWindow* ownd = dynamic_cast( wnd ); + if( ownd ) + ownd->resetState(); + } } + } +} + +void HYDROGUI_Module::onOperation() +{ + const QAction* anAction = dynamic_cast( sender() ); + int anId = actionId( anAction ); + if( anId >= 0 ) + { + resetViewState(); startOperation( anId ); } diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 7af82b32..0ca06e8a 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -286,6 +286,10 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) PREF_VIEWER_ZOOM_SHUTOFF Conservation of zoom when top-view/etc is activated + + PREF_VIEWER_CHAINED_PANNING + Chained panning + PREF_GROUP_STRICKLER_TABLE Strickler table diff --git a/src/HYDROGUI/resources/LightApp.xml b/src/HYDROGUI/resources/LightApp.xml index 8f8cfad9..c23856fe 100644 --- a/src/HYDROGUI/resources/LightApp.xml +++ b/src/HYDROGUI/resources/LightApp.xml @@ -30,6 +30,7 @@ +
-- 2.39.2