From 71ce9822c82cf5ad47d10e5bdfb87813ac61e706 Mon Sep 17 00:00:00 2001 From: ouv Date: Fri, 30 Sep 2005 12:26:45 +0000 Subject: [PATCH] Preferences for Gauss Points dialog --- src/VISUGUI/VISUM_msg_en.po | 40 +++++++++++++- src/VISUGUI/VisuGUI_GaussPointsDlg.cxx | 43 ++++++--------- src/VISUGUI/VisuGUI_GaussPointsDlg.h | 10 ++-- src/VISUGUI/VisuGUI_Module.cxx | 75 ++++++++++++++++++++++++-- src/VISUGUI/VisuGUI_Module.h | 9 ++++ 5 files changed, 140 insertions(+), 37 deletions(-) diff --git a/src/VISUGUI/VISUM_msg_en.po b/src/VISUGUI/VISUM_msg_en.po index a0f94524..9b575835 100644 --- a/src/VISUGUI/VISUM_msg_en.po +++ b/src/VISUGUI/VISUM_msg_en.po @@ -12,9 +12,47 @@ msgstr "Gauss" msgid "VisuGUI_Module::MEN_GAUSS_NEW_VIEWER" msgstr "Points view" -msgid "VisuGUI_Module::VISU_GAUSS_PREF_TAB_TLT" + + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_TAB_TTL" msgstr "Gauss Points" +msgid "VisuGUI_Module::VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" +msgstr "Primitive" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_CLAMP" +msgstr "Maximum Size (Clamp)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAIN_TEXTURE" +msgstr "Main Texture (16x16)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_ALPHA_TEXTURE" +msgstr "Alpha Channel Texture (16x16)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_ALPHA_THRESHOLD" +msgstr "Alpha Channel Threshold" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_SIZE_GROUP_TTL" +msgstr "Size" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_MIN_SIZE" +msgstr "Range value for min size (%)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAX_SIZE" +msgstr "Range value for max size (%)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAGNIFICATION" +msgstr "Magnification (%)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_INCREMENT" +msgstr "Increment" + + + + +msgid "VisuGUI_Module::VISU_MOUSE_PREF_TAB_TLT" +msgstr "Spacemouse" + msgid "VisuGUI_Module::VISU_MOUSE_PREF_GROUP_TLT" msgstr "Mouse" diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index ec9cd58e..88095ca0 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -776,7 +776,6 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool QLabel* aClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), PrimitiveGroup ); myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, PrimitiveGroup ); myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myClampSpinBox->setValue( 200.0 ); PrimitiveGroupLayout->addWidget( aClampLabel, 1, 0 ); PrimitiveGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); @@ -809,7 +808,6 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool QLabel* aAlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), PrimitiveGroup ); myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, PrimitiveGroup ); myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myAlphaThresholdSpinBox->setValue( 0.0 ); PrimitiveGroupLayout->addWidget( aAlphaThresholdLabel, 4, 0 ); PrimitiveGroupLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 ); @@ -829,7 +827,6 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool mySizeLabel = new QLabel( tr( "SIZE" ), SizeGroup ); mySizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); mySizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - //mySizeSpinBox->setValue( 10 ); SizeGroupLayout->addWidget( mySizeLabel, 0, 0 ); SizeGroupLayout->addWidget( mySizeSpinBox, 0, 1 ); @@ -838,7 +835,6 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool myMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), SizeGroup ); myMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); myMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - //myMinSizeSpinBox->setValue( 10 ); SizeGroupLayout->addWidget( myMinSizeLabel, 1, 0 ); SizeGroupLayout->addWidget( myMinSizeSpinBox, 1, 1 ); @@ -847,7 +843,6 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool myMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), SizeGroup ); myMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); myMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - //myMaxSizeSpinBox->setValue( 33 ); SizeGroupLayout->addWidget( myMaxSizeLabel, 1, 2 ); SizeGroupLayout->addWidget( myMaxSizeSpinBox, 1, 3 ); @@ -856,7 +851,6 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool QLabel* aMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), SizeGroup ); myMagnificationSpinBox = new QtxDblSpinBox( 10, 1000, 10, SizeGroup ); myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - //myMagnificationSpinBox->setValue( 100 ); SizeGroupLayout->addWidget( aMagnificationLabel, 2, 0 ); SizeGroupLayout->addWidget( myMagnificationSpinBox, 2, 1 ); @@ -865,7 +859,6 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool QLabel* aIncrementLabel = new QLabel( tr( "INCREMENT" ), SizeGroup ); myIncrementSpinBox = new QtxDblSpinBox( 5, 50, 5, SizeGroup ); myIncrementSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - //myIncrementSpinBox->setValue( 10 ); SizeGroupLayout->addWidget( aIncrementLabel, 2, 2 ); SizeGroupLayout->addWidget( myIncrementSpinBox, 2, 3 ); @@ -884,8 +877,6 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool myColorLabel = new QLabel( tr( "COLOR" ), ColorGroup ); myColorButton = new QPushButton( ColorGroup ); - myColorButton->setPaletteBackgroundColor( Qt::blue ); - myColorButton->setPaletteForegroundColor( Qt::blue ); ColorGroupLayout->addWidget( myColorLabel, 0, 0 ); ColorGroupLayout->addWidget( myColorButton, 0, 1 ); @@ -937,7 +928,7 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs ) { - bool isResults = thePrs->IsColored(); + bool isResults = thePrs->GetIsColored(); myResultsButton->setChecked( isResults ); myGeometryButton->setChecked( !isResults ); @@ -952,48 +943,48 @@ void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs ) myColorButton->setPaletteBackgroundColor( thePrs->GetColor() ); - myClampSpinBox->setMaxValue( thePrs->GetGaussPointsPL()->GetMaximumSupportedSize() ); - myClampSpinBox->setValue( thePrs->GetGaussPointsPL()->GetClamp() ); + myClampSpinBox->setMaxValue( thePrs->GetMaximumSupportedSize() ); + myClampSpinBox->setValue( thePrs->GetClamp() ); - mySizeSpinBox->setValue( thePrs->GetGaussPointsPL()->GetRelativeSize() * 100.0 ); - myMinSizeSpinBox->setValue( thePrs->GetGaussPointsPL()->GetRelativeMinSize() * 100.0 ); - myMaxSizeSpinBox->setValue( thePrs->GetGaussPointsPL()->GetRelativeMaxSize() * 100.0 ); + mySizeSpinBox->setValue( thePrs->GetConstSize() ); + myMinSizeSpinBox->setValue( thePrs->GetMinSize() ); + myMaxSizeSpinBox->setValue( thePrs->GetMaxSize() ); - myMagnificationSpinBox->setValue( thePrs->GetGaussPointsPL()->GetMagnification() * 100.0 ); - myIncrementSpinBox->setValue( thePrs->GetGaussPointsPL()->GetMagnificationIncrement() * 100.0 ); + myMagnificationSpinBox->setValue( thePrs->GetMagnification() ); + myIncrementSpinBox->setValue( thePrs->GetMagnificationIncrement() ); myMainTextureLineEdit->setText( thePrs->GetMainTexture().section( '/', -1 ) ); myAlphaTextureLineEdit->setText( thePrs->GetAlphaTexture().section( '/', -1 ) ); - myAlphaThresholdSpinBox->setValue( thePrs->GetGaussPointsPL()->GetAlphaThreshold() ); + myAlphaThresholdSpinBox->setValue( thePrs->GetAlphaThreshold() ); myScalarPane->initFromPrsObject(thePrs); } int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs ) { - thePrs->GetGaussPointsPL()->SetClamp( myClampSpinBox->value() ); + thePrs->SetClamp( myClampSpinBox->value() ); bool isResults = myResultsButton->isChecked(); if( isResults ) { - thePrs->GetGaussPointsPL()->SetRelativeMinSize( myMinSizeSpinBox->value() / 100.0 ); - thePrs->GetGaussPointsPL()->SetRelativeMaxSize( myMaxSizeSpinBox->value() / 100.0 ); + thePrs->SetMinSize( myMinSizeSpinBox->value() ); + thePrs->SetMaxSize( myMaxSizeSpinBox->value() ); } else { - thePrs->GetGaussPointsPL()->SetRelativeSize( mySizeSpinBox->value() / 100.0 ); + thePrs->SetConstSize( mySizeSpinBox->value() ); thePrs->SetColor( myColorButton->paletteBackgroundColor() ); } - thePrs->ShowColored( isResults ); + thePrs->SetIsColored( isResults ); - thePrs->GetGaussPointsPL()->SetMagnification( myMagnificationSpinBox->value() / 100.0 ); - thePrs->GetGaussPointsPL()->SetMagnificationIncrement( myIncrementSpinBox->value() / 100.0 ); + thePrs->SetMagnification( myMagnificationSpinBox->value() ); + thePrs->SetMagnificationIncrement( myIncrementSpinBox->value() ); myMainTexture = myMainTexture.isNull() ? thePrs->GetMainTexture() : myMainTexture; myAlphaTexture = myAlphaTexture.isNull() ? thePrs->GetAlphaTexture() : myAlphaTexture; thePrs->SetTextures( myMainTexture, myAlphaTexture ); - thePrs->GetGaussPointsPL()->SetAlphaThreshold( myAlphaThresholdSpinBox->value() ); + thePrs->SetAlphaThreshold( myAlphaThresholdSpinBox->value() ); return myScalarPane->storeToPrsObject(thePrs); } diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index a34cd1e1..bd8faff9 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -126,8 +126,8 @@ public: VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule, bool SetPref = FALSE); ~VisuGUI_GaussPointsDlg() {}; - void initFromPrsObject(VISU::GaussPoints_i* thePrs); - int storeToPrsObject(VISU::GaussPoints_i* thePrs); + void initFromPrsObject(VISU::GaussPoints_i* thePrs); + int storeToPrsObject(VISU::GaussPoints_i* thePrs); protected slots: void accept(); @@ -137,10 +137,10 @@ protected slots: void onColorButtonPressed(); private: - VisuGUI_GaussScalarBarPane* myScalarPane; + VisuGUI_GaussScalarBarPane* myScalarPane; - QString myMainTexture; - QString myAlphaTexture; + QString myMainTexture; + QString myAlphaTexture; QtxDblSpinBox* myClampSpinBox; diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 29c6dfa1..d0f9a359 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -314,15 +314,78 @@ VisuGUI_Module myViewerMap.erase(theViewManager); } + +//--------------------------------------------------------------- void VisuGUI_Module ::createPreferences() { VisuGUI::createPreferences(); - int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TLT" ) ); + createGaussPointsPreferences(); + createSpaceMousePreferences(); +} + + +//--------------------------------------------------------------- +void +VisuGUI_Module +::createGaussPointsPreferences() +{ + int resultsTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) ); + int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), resultsTab ); + setPreferenceProperty( primitiveGr, "columns", 1 ); + + int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr, + SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_clamp" ); + setPreferenceProperty( clampPref, "min", 1 ); + setPreferenceProperty( clampPref, "max", 512 ); + + int mainTexturePref = addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr, + SalomeApp_Preferences::File, "VISU", "point_sprite_main_texture" ); + + int alphaTexturePref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr, + SalomeApp_Preferences::File, "VISU", "point_sprite_alpha_texture" ); + + int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr, + SalomeApp_Preferences::DblSpin, "VISU", "point_sprite_alpha_threshold" ); + setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); + setPreferenceProperty( alphaThresholdPref, "max", 1.0 ); + setPreferenceProperty( alphaThresholdPref, "step", 0.1 ); + + int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), resultsTab ); + setPreferenceProperty( sizeGr, "columns", 2 ); + + int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr, + SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_min_size" ); + setPreferenceProperty( minSizePref, "min", 1 ); + setPreferenceProperty( minSizePref, "max", 100 ); + + int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr, + SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_max_size" ); + setPreferenceProperty( maxSizePref, "min", 1 ); + setPreferenceProperty( maxSizePref, "max", 100 ); + + int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr, + SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_magnification" ); + setPreferenceProperty( magnificationPref, "min", 10 ); + setPreferenceProperty( magnificationPref, "max", 1000 ); + + int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), sizeGr, + SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_increment" ); + setPreferenceProperty( incrementPref, "min", 1 ); + setPreferenceProperty( incrementPref, "max", 100 ); +} + - int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), gaussTab ); +//--------------------------------------------------------------- +void +VisuGUI_Module +::createSpaceMousePreferences() +{ + int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) ); + + int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab ); int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr, SalomeApp_Preferences::Selector, "VISU", "mouse_behaviour" ); QStringList values; values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) ); @@ -333,11 +396,11 @@ VisuGUI_Module setPreferenceProperty( mousePref, "strings", values ); setPreferenceProperty( mousePref, "indexes", indices ); - int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), gaussTab ); + int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab ); int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr, SalomeApp_Preferences::IntSpin, "VISU", "speed_increment" ); setPreferenceProperty( keybrdPref, "max", 1000 ); - int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), gaussTab ); + int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab ); setPreferenceProperty( spacemouseGr, "columns", 1 ); int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr, SalomeApp_Preferences::Selector, "VISU", "spacemouse_func1_btn" ); //decrease_speed_increment int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr, SalomeApp_Preferences::Selector, "VISU", "spacemouse_func2_btn" ); //increase_speed_increment @@ -379,11 +442,13 @@ VisuGUI_Module setPreferenceProperty( spacemousePref5, "strings", values ); setPreferenceProperty( spacemousePref5, "indexes", indices ); - int cameraGr = addPreference( tr( "VISU_CAMERA_PREF_GROUP_TTL" ), gaussTab ); + int cameraGr = addPreference( tr( "VISU_CAMERA_PREF_GROUP_TTL" ), mouseTab ); int cameraPref = addPreference( tr( "VISU_CAMERA_MOVE_PREF" ), cameraGr, SalomeApp_Preferences::IntSpin, "VISU", "camera_movement_steps" ); setPreferenceProperty( cameraPref, "max", 1000 ); } + +//--------------------------------------------------------------- void VisuGUI_Module ::OnCreateGaussPoints() diff --git a/src/VISUGUI/VisuGUI_Module.h b/src/VISUGUI/VisuGUI_Module.h index 3bb7787f..28ce2b18 100644 --- a/src/VISUGUI/VisuGUI_Module.h +++ b/src/VISUGUI/VisuGUI_Module.h @@ -85,6 +85,15 @@ public slots: bool activateModule( SUIT_Study* ); +protected: + virtual + void + createSpaceMousePreferences(); + + virtual + void + createGaussPointsPreferences(); + protected slots: SUIT_ViewManager* onCreateViewManager(); -- 2.39.2