From a3dbf9db14835c906f00ea87c0f77dfec646684a Mon Sep 17 00:00:00 2001 From: asv Date: Wed, 22 Jun 2005 06:29:29 +0000 Subject: [PATCH] Bug fixes. --- src/GEOMGUI/GEOM_Displayer.cxx | 11 +++---- src/GEOMGUI/GEOM_msg_en.po | 21 +++++++++++++ src/GEOMGUI/GeometryGUI.cxx | 36 +++++++++++++++++++++++ src/GEOMGUI/GeometryGUI.h | 3 ++ src/GEOMToolsGUI/GEOMToolsGUI_NameDlg.cxx | 7 +++-- 5 files changed, 68 insertions(+), 10 deletions(-) diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index dbc26153b..b0a3ead21 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -221,11 +222,9 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* study ) /* Shading Color */ SUIT_Session* session = SUIT_Session::session(); SUIT_ResourceMgr* resMgr = session->resourceMgr(); - QColor col = resMgr->colorValue( "Geometry", "SettingsShadingColor", QColor( "goldenrod" ) ); -// TO DO: make some utility method to convert QColor into Quantity_Color -// myShadingColor = SUIT_Tools::color( col ); - myShadingColor = Quantity_NOC_RED; + QColor col = resMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ); + myShadingColor = SalomeApp_Tools::color( col ); myColor = -1; // This color is used for shape displaying. If it is equal -1 then @@ -576,15 +575,13 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) AISShape->SetShadingColor( myShadingColor ); if ( HasColor() ) { + AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); if ( myShape.ShapeType() == TopAbs_VERTEX ) { - AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); anAspect->SetColor( (Quantity_NameOfColor)GetColor() ); AISShape->Attributes()->SetPointAspect( anAspect ); } - else - AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); } if ( HasWidth() ) diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 430772f20..de7d79c71 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -2875,3 +2875,24 @@ msgstr "Name: " msgid "GEOM_ERR_GET_ENGINE" msgstr "Failed to obtain GEOM Engine component. Reload Geometry module and try again." + +msgid "PREF_GROUP_OCCVIEWER" +msgstr "OCC Viewer 3d" + +msgid "PREF_GROUP_GENERAL" +msgstr "General" + +msgid "PREF_ISOS_U" +msgstr "Number of isolines along U" + +msgid "PREF_ISOS_V" +msgstr "Number of isolines along V" + +msgid "PREF_SHADING_COLOR" +msgstr "Default shading color" + +msgid "PREF_STEP_VALUE" +msgstr "Step value for spin boxes" + +msgid "PREF_TAB_SETTINGS" +msgstr "Settings" diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 0062e3f06..2c5a356e7 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -1478,3 +1479,38 @@ void GeometryGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QSt title = QString( obj->GetName().c_str() ); } } + +void GeometryGUI::createPreferences() +{ + int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) ); + + int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId ); + addPreference( tr( "PREF_SHADING_COLOR" ), genGroup, + SalomeApp_Preferences::Color, "Geometry", "shading_color" ); + //addPreference( tr( "PREF_STEP_VALUE" ), genGroup, + // SalomeApp_Preferences::IntSpin, "GEOM", "SettingsGeomStep" ); + + int occGroup = addPreference( tr( "PREF_GROUP_OCCVIEWER" ), tabId ); + setPreferenceProperty( occGroup, "columns", 1 ); + addPreference( tr( "PREF_ISOS_U" ), occGroup, + SalomeApp_Preferences::IntSpin, "Geometry", "isos_u" ); + addPreference( tr( "PREF_ISOS_V" ), occGroup, + SalomeApp_Preferences::IntSpin, "Geometry", "isos_v" ); +} + +void GeometryGUI::preferencesChanged( const QString& section, const QString& param ) +{ + //printf( "\n-------------> %s , %s\n", section.latin1(), param.latin1() ); + if ( section == QString( "Geometry" ) && + ( param == QString( "isos_u" ) || param == QString( "isos_v" ) ) ) + { + QPtrList lst; + application()->viewManagers( OCCViewer_Viewer::Type(), lst ); + const int u = application()->resourceMgr()->integerValue( section, "isos_u" ); + const int v = application()->resourceMgr()->integerValue( section, "isos_v" ); + for ( QPtrListIterator it( lst ); it.current(); ++it ) + { + ((OCCViewer_Viewer*)it.current())->setIsos( u, v ); + } + } +} diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 2303a2760..36d10bbdc 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -107,6 +107,9 @@ public: virtual void viewManagers( QStringList& ) const; virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); + virtual void createPreferences(); + virtual void preferencesChanged( const QString&, const QString& ); + public slots: virtual bool deactivateModule( SUIT_Study* ); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NameDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_NameDlg.cxx index 2bcb291c6..f4ac68984 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NameDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NameDlg.cxx @@ -63,14 +63,15 @@ GEOMToolsGUI_NameDlg::GEOMToolsGUI_NameDlg( QWidget* parent ) GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 ); myButtonOk = new QPushButton( GroupButtons, "buttonOk" ); - myButtonOk->setText( tr( "BUT_OK" ) ); - myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE ); + myButtonOk->setText( tr( "GEOM_BUT_OK" ) ); + myButtonOk->setAutoDefault( TRUE ); + myButtonOk->setDefault( TRUE ); GroupButtonsLayout->addWidget( myButtonOk ); GroupButtonsLayout->addStretch(); myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - myButtonCancel->setText( tr( "BUT_CANCEL" ) ); + myButtonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ); myButtonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( myButtonCancel ); /***************************************************************/ -- 2.39.2