From: stv Date: Fri, 15 May 2015 11:18:41 +0000 (+0300) Subject: refs #512: Control of automatic fit all X-Git-Tag: v1.4.1~21^2~3^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=819f0fabad37fd01b6bbc3ab3e34193a5c071c5a;p=modules%2Fhydro.git refs #512: Control of automatic fit all --- diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 87014307..4ba884b4 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -734,11 +734,15 @@ void HYDROGUI_Module::createPreferences() setPreferenceProperty( typeOfCursor, "indexes", aCursorTypeIndicesList ); setPreferenceProperty( typeOfCursor, "icons", aCursorTypeIconsList ); + + int viewerGroup = addPreference( tr( "PREF_GROUP_VIEWER" ), genTab ); + addPreference( tr( "PREF_VIEWER_AUTO_FITALL" ), viewerGroup, + LightApp_Preferences::Bool, "HYDRO", "auto_fit_all" ); } void HYDROGUI_Module::update( const int flags ) { - if( !isUpdateEnabled() ) + if ( !isUpdateEnabled() ) return; QApplication::setOverrideCursor( Qt::WaitCursor ); @@ -751,6 +755,12 @@ void HYDROGUI_Module::update( const int flags ) QStringList aSelectedEntries = storeSelection(); bool aDoFitAll = flags & UF_FitAll; + if ( aDoFitAll ) + { + SUIT_ResourceMgr* aResMgr = getApp()->resourceMgr(); + aDoFitAll = aResMgr->booleanValue( "HYDRO", "auto_fit_all", false ); + } + if( ( flags & UF_Viewer ) ) updateViewer( getDisplayer(), flags & UF_GV_Init, flags & UF_GV_Forced, aDoFitAll ); @@ -950,12 +960,14 @@ void HYDROGUI_Module::setObjectVisible( const int theViewId, anObjectState.Visibility = theState; HYDROGUI_DataObject* hydroObject = getDataModel()->getDataObject( theObject ); - - SUIT_AbstractModel* treeModel = dynamic_cast( getApp()->objectBrowser()->model() ); - QString id = hydroObject->text( hydroObject->customData( Qtx::IdType ).toInt() ); - Qtx::VisibilityState visState = treeModel->visibilityState( id ); - if ( visState != Qtx::UnpresentableState ) - treeModel->setVisibilityState( id, theState ? Qtx::ShownState : Qtx::HiddenState ); + if ( hydroObject ) + { + SUIT_AbstractModel* treeModel = dynamic_cast( getApp()->objectBrowser()->model() ); + QString id = hydroObject->text( hydroObject->customData( Qtx::IdType ).toInt() ); + Qtx::VisibilityState visState = treeModel->visibilityState( id ); + if ( visState != Qtx::UnpresentableState ) + treeModel->setVisibilityState( id, theState ? Qtx::ShownState : Qtx::HiddenState ); + } } } @@ -1666,5 +1678,5 @@ void HYDROGUI_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn setObjectVisible( HYDROGUI_Tool::GetActiveViewId( this ), hydroObject->modelObject(), vis ); - update( UF_OCCViewer | UF_FitAll ); + update( UF_OCCViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) ); } diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 86277845..8d45f408 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -237,6 +237,14 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) PREF_TYPE_OF_CURSOR Type + + PREF_GROUP_VIEWER + Viewer + + + PREF_VIEWER_AUTO_FITALL + Make automatic fit all after show object operation + diff --git a/src/HYDROGUI/resources/LightApp.xml b/src/HYDROGUI/resources/LightApp.xml index 2b595df6..dbd15586 100644 --- a/src/HYDROGUI/resources/LightApp.xml +++ b/src/HYDROGUI/resources/LightApp.xml @@ -28,6 +28,7 @@ +