From e38e79d2e238fe5dbcfb26724e5fd60017e908f0 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 25 Jul 2005 04:37:30 +0000 Subject: [PATCH] after preferences changing the application updates scalar bar properties for all actors --- src/SMESHGUI/SMESHGUI.cxx | 46 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index f6ee30e07..02c61acc2 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -3267,8 +3267,16 @@ void SMESHGUI::createPreferences() int wv = addPreference( tr( "SMESH_WIDTH" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_width" ); int hv = addPreference( tr( "SMESH_HEIGHT" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_height" ); setPreferenceProperty( xv, "step", 0.1 ); + setPreferenceProperty( xv, "min", 0.0 ); + setPreferenceProperty( xv, "max", 1.0 ); setPreferenceProperty( yv, "step", 0.1 ); + setPreferenceProperty( yv, "min", 0.0 ); + setPreferenceProperty( yv, "max", 1.0 ); setPreferenceProperty( wv, "step", 0.1 ); + setPreferenceProperty( wv, "min", 0.0 ); + setPreferenceProperty( wv, "max", 1.0 ); + setPreferenceProperty( hv, "min", 0.0 ); + setPreferenceProperty( hv, "max", 1.0 ); setPreferenceProperty( hv, "step", 0.1 ); int posHSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_HORIZONTAL" ), sbarTab ); @@ -3276,12 +3284,48 @@ void SMESHGUI::createPreferences() int yh = addPreference( tr( "SMESH_Y_SCALARBAR" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_y" ); int wh = addPreference( tr( "SMESH_WIDTH" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_width" ); int hh = addPreference( tr( "SMESH_HEIGHT" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_height" ); + setPreferenceProperty( xv, "min", 0.0 ); + setPreferenceProperty( xv, "max", 1.0 ); + setPreferenceProperty( xv, "step", 0.1 ); + setPreferenceProperty( xh, "min", 0.0 ); + setPreferenceProperty( xh, "max", 1.0 ); setPreferenceProperty( xh, "step", 0.1 ); + setPreferenceProperty( yh, "min", 0.0 ); + setPreferenceProperty( yh, "max", 1.0 ); setPreferenceProperty( yh, "step", 0.1 ); + setPreferenceProperty( wh, "min", 0.0 ); + setPreferenceProperty( wh, "max", 1.0 ); setPreferenceProperty( wh, "step", 0.1 ); + setPreferenceProperty( hh, "min", 0.0 ); + setPreferenceProperty( hh, "max", 1.0 ); setPreferenceProperty( hh, "step", 0.1 ); } -void SMESHGUI::preferencesChanged( const QString&, const QString& ) +void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) { + if( sect=="SMESH" ) + { + if( name=="scalar_bar_num_colors" || name=="scalar_bar_num_labels" || name=="scalar_bar_orientation" || + name=="scalar_bar_vertical_x" || name=="scalar_bar_vertical_y" || name=="scalar_bar_vertical_width" || + name=="scalar_bar_vertical_height" || name=="scalar_bar_horizontal_x" || name=="scalar_bar_horizontal_y" || + name=="scalar_bar_horizontal_width" || name=="scalar_bar_horizontal_height" ) + { + SVTK_ViewWindow* wnd = SMESH::GetViewWindow( this ); + if( !wnd ) + return; + + vtkRenderer* r = wnd->getRenderer(); + if( !r ) + return; + + vtkActorCollection* actors = r->GetActors(); + if( !actors ) + return; + + actors->InitTraversal(); + while( vtkActor* a = actors->GetNextActor() ) + if( SMESH_Actor* sa = dynamic_cast( a ) ) + sa->UpdateScalarBar(); + } + } } -- 2.39.2