preferencesChanged( "HYDRO", "zoom_shutoff" );
+ preferencesChanged( "HYDRO", "chained_panning" );
+
// Load GEOM data
SalomeApp_Study* aStudy =
dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
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" );
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
preferencesChanged( "HYDRO", "zoom_shutoff" );
+ preferencesChanged( "HYDRO", "chained_panning" );
+
QApplication::restoreOverrideCursor();
}
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* ) ) );
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 );
}