Salome HOME
0013557: field values display
authorsln <sln@opencascade.com>
Tue, 9 Dec 2008 12:21:13 +0000 (12:21 +0000)
committersln <sln@opencascade.com>
Tue, 9 Dec 2008 12:21:13 +0000 (12:21 +0000)
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.

src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI.h
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx

index 277671a6056b1025cee986bcd9b793c306c266e9..aa9d98862c2a49215f1f99c5e85cc022b8fee1d4 100644 (file)
@@ -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;
+}
+
+
+
+
+
+
index 59d134e9e0778fc8aa7b08c79ddba55b639a0b47..be529a91b688fb85f0b85661243c3c6e50f4da3c 100644 (file)
@@ -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;
index b30ce298275912c493753ee7e6dc70a494701d4c..c6d9f6e6f6140f8c7abf7b84ee60fc7924d2e184 100644 (file)
@@ -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);