From: sln Date: Tue, 9 Dec 2008 12:21:13 +0000 (+0000) Subject: 0013557: field values display X-Git-Tag: Phase8_Part1_16122008~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=75d312c76504f18dd3af446add9bb0dbd5c882e3;p=modules%2Fsmesh.git 0013557: field values display All related controls for font definition in SMESH and VISU modules have been updated in accordance in changes in QtxFontEdit and related preferences functionality. QtxFontEdit class and related controls in preferences has been updated in order to support custom fonts instead of system fonts only. For example VTK viewer uses only three fonts Arial, Courier and Times. As result there is no point in providing control with system fonts for VTK viewer. Also ?S? button has been added in QtxFontEdit in order to provide ?Shadow? style of VTK font. ?1underline? property of QFont is replaced with ?overline? property in order to store ?Shadow? status of font to avoid conflict simultaneous usage of ?U? and ?S? button. --- diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 277671a60..aa9d98862 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1875,11 +1875,18 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) } break; } - + case 810: // Union Groups case 811: // Intersect groups case 812: // Cut groups { + if ( !vtkwnd ) + { + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); + break; + } + if ( checkLock( aStudy ) ) break; @@ -2932,8 +2939,6 @@ void SMESHGUI::initialize( CAM_Application* app ) // popup for object browser createPopupItem( 150, OB, mesh, "&& selcount=1 && isImported" ); // FILE INFORMATION - createPopupItem( 703, OB, mesh, "&& isComputable"); // CREATE_SUBMESH - createPopupItem( 703, OB, subMesh, "&& isComputable" ); // CREATE_SUBMESH createPopupItem( 704, OB, mesh, "&& isComputable"); // EDIT_MESHSUBMESH createPopupItem( 704, OB, subMesh, "&& isComputable" ); // EDIT_MESHSUBMESH createPopupItem( 803, OB, group ); // EDIT_GROUP @@ -3462,23 +3467,11 @@ void SMESHGUI::createPreferences() int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab ); setPreferenceProperty( fontGr, "columns", 2 ); - int tfont = addPreference( tr( "SMESH_TITLE" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_title_font" ); + addVtkFontPref( tr( "SMESH_TITLE" ), fontGr, "scalar_bar_title_font" ); addPreference( tr( "PREF_TITLE_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" ); - int lfont = addPreference( tr( "SMESH_LABELS" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_label_font" ); - addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" ); - QStringList fam; - fam.append( tr( "SMESH_FONT_ARIAL" ) ); - fam.append( tr( "SMESH_FONT_COURIER" ) ); - fam.append( tr( "SMESH_FONT_TIMES" ) ); - int wflag = ( QtxFontEdit::Family | QtxFontEdit::Scripting ); - - setPreferenceProperty( tfont, "families", fam ); - setPreferenceProperty( tfont, "system", false ); - setPreferenceProperty( tfont, "widget_flags", wflag ); - setPreferenceProperty( lfont, "families", fam ); - setPreferenceProperty( lfont, "system", false ); - setPreferenceProperty( lfont, "widget_flags", wflag ); + addVtkFontPref( tr( "SMESH_LABELS" ), fontGr, "scalar_bar_label_font" ); + addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" ); int colorsLabelsGr = addPreference( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), sbarTab ); setPreferenceProperty( colorsLabelsGr, "columns", 2 ); @@ -4188,3 +4181,35 @@ void SMESHGUI::restoreVisualParameters (int savePoint) } } } + +/*! + \brief Adds preferences for dfont of VTK viewer + \param label label + \param pIf group identifier + \param param parameter + \return identifier of preferences +*/ +int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param ) +{ + int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param ); + + setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom ); + + QStringList fam; + fam.append( tr( "SMESH_FONT_ARIAL" ) ); + fam.append( tr( "SMESH_FONT_COURIER" ) ); + fam.append( tr( "SMESH_FONT_TIMES" ) ); + + setPreferenceProperty( tfont, "fonts", fam ); + + int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow; + setPreferenceProperty( tfont, "features", f ); + + return tfont; +} + + + + + + diff --git a/src/SMESHGUI/SMESHGUI.h b/src/SMESHGUI/SMESHGUI.h index 59d134e9e..be529a91b 100644 --- a/src/SMESHGUI/SMESHGUI.h +++ b/src/SMESHGUI/SMESHGUI.h @@ -149,6 +149,9 @@ protected: private: void OnEditDelete(); + int addVtkFontPref( const QString& label, + const int pId, + const QString& param ); private : static SMESH::SMESH_Gen_var myComponentSMESH; diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx index b30ce2982..c6d9f6e6f 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -314,7 +314,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* myTitleBoldCheck->setChecked ( f.bold() ); myTitleItalicCheck->setChecked( f.italic() ); - myTitleShadowCheck->setChecked( f.underline() ); + myTitleShadowCheck->setChecked( f.overline() ); } QColor labelColor = mgr->colorValue("SMESH", "scalar_bar_label_color", @@ -332,7 +332,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* myLabelsBoldCheck ->setChecked( f.bold() ); myLabelsItalicCheck->setChecked( f.italic() ); - myLabelsShadowCheck->setChecked( f.underline() ); + myLabelsShadowCheck->setChecked( f.overline() ); } int aNbColors = mgr->integerValue("SMESH", "scalar_bar_num_colors", 64);