Imp: numbering font preferences

This commit is contained in:
vsr 2012-12-29 11:45:10 +00:00
parent 752ad5bd14
commit 577906c7b0
7 changed files with 112 additions and 110 deletions

View File

@ -95,17 +95,9 @@
<parameter name="preview_actor_chunk_size" value="100" /> <parameter name="preview_actor_chunk_size" value="100" />
<parameter name="historical_python_dump" value="true" /> <parameter name="historical_python_dump" value="true" />
<parameter name="numbering_node_color" value="255, 255, 255" /> <parameter name="numbering_node_color" value="255, 255, 255" />
<parameter name="numbering_node_size" value="10" /> <parameter name="numbering_node_font" value="Times,Bold,10" />
<parameter name="numbering_node_font" value="Times" />
<parameter name="numbering_node_bold" value="true" />
<parameter name="numbering_node_italic" value="false" />
<parameter name="numbering_node_shadow" value="false" />
<parameter name="numbering_elem_color" value="0, 255, 0" /> <parameter name="numbering_elem_color" value="0, 255, 0" />
<parameter name="numbering_elem_size" value="12" /> <parameter name="numbering_elem_font" value="Times,Bold,12" />
<parameter name="numbering_elem_font" value="Times" />
<parameter name="numbering_elem_bold" value="true" />
<parameter name="numbering_elem_italic" value="false" />
<parameter name="numbering_elem_shadow" value="false" />
<!-- Input field precisions --> <!-- Input field precisions -->
<parameter name="def_precision" value="3" /> <parameter name="def_precision" value="3" />
<parameter name="length_precision" value="-6" /> <parameter name="length_precision" value="-6" />

View File

@ -152,19 +152,39 @@ SMESH_ActorDef::SMESH_ActorDef()
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1); vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
vtkFloatingPointType aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1); vtkFloatingPointType aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
int aSizeNd = mgr->integerValue( "SMESH", "numbering_node_size", 10 ); SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
SMESH::LabelFont aFamilyNd = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_node_font", 2 ) ); bool aBoldNd = true;
bool aBoldNd = mgr->booleanValue( "SMESH", "numbering_node_bold", true ); bool anItalicNd = false;
bool anItalicNd = mgr->booleanValue( "SMESH", "numbering_node_italic", false ); bool aShadowNd = false;
bool aShadowNd = mgr->booleanValue( "SMESH", "numbering_node_shadow", false ); int aSizeNd = 10;
if ( mgr->hasValue( "SMESH", "numbering_node_font" ) ) {
QFont f = mgr->fontValue( "SMESH", "numbering_node_font" );
if ( f.family() == "Arial" ) aFamilyNd = SMESH::FntArial;
else if ( f.family() == "Courier" ) aFamilyNd = SMESH::FntCourier;
else if ( f.family() == "Times" ) aFamilyNd = SMESH::FntTimes;
aBoldNd = f.bold();
anItalicNd = f.italic();
aShadowNd = f.overline();
aSizeNd = f.pointSize();
}
vtkFloatingPointType anRGBNd[3] = {1,1,1}; vtkFloatingPointType anRGBNd[3] = {1,1,1};
SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) ); SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) );
int aSizeEl = mgr->integerValue( "SMESH", "numbering_elem_size", 12 ); SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
SMESH::LabelFont aFamilyEl = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_elem_font", 2 ) ); bool aBoldEl = true;
bool aBoldEl = mgr->booleanValue( "SMESH", "numbering_elem_bold", true ); bool anItalicEl = false;
bool anItalicEl = mgr->booleanValue( "SMESH", "numbering_elem_italic", false ); bool aShadowEl = false;
bool aShadowEl = mgr->booleanValue( "SMESH", "numbering_elem_shadow", false ); int aSizeEl = 12;
if ( mgr->hasValue( "SMESH", "numbering_elem_font" ) ) {
QFont f = mgr->fontValue( "SMESH", "numbering_elem_font" );
if ( f.family() == "Arial" ) aFamilyEl = SMESH::FntArial;
else if ( f.family() == "Courier" ) aFamilyEl = SMESH::FntCourier;
else if ( f.family() == "Times" ) aFamilyEl = SMESH::FntTimes;
aBoldEl = f.bold();
anItalicEl = f.italic();
aShadowEl = f.overline();
aSizeEl = f.pointSize();
}
vtkFloatingPointType anRGBEl[3] = {0,1,0}; vtkFloatingPointType anRGBEl[3] = {0,1,0};
SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) ); SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) );

View File

@ -4885,32 +4885,13 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( shrink, "max", 100 ); setPreferenceProperty( shrink, "max", 100 );
int numGroup = addPreference( tr( "PREF_GROUP_NUMBERING" ), meshTab ); int numGroup = addPreference( tr( "PREF_GROUP_NUMBERING" ), meshTab );
setPreferenceProperty( numGroup, "columns", 6 ); setPreferenceProperty( numGroup, "columns", 2 );
QStringList fonts;
fonts << tr( "SMESH_ARIAL" ) << tr( "SMESH_COURIER" ) << tr( "SMESH_TIMES" );
indices.clear(); indices << 0 << 1 << 2;
// ...
addPreference( tr( "PREF_NUMBERING_NODE" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_node_color" ); addPreference( tr( "PREF_NUMBERING_NODE" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_node_color" );
int NumNodeSize = addPreference( tr( "PREF_NUMBERING_SIZE" ), numGroup, LightApp_Preferences::IntSpin, "SMESH", "numbering_node_size" ); addVtkFontPref( tr( "PREF_NUMBERING_FONT" ), numGroup, "numbering_node_font", true );
setPreferenceProperty( NumNodeSize, "min", 1 );
setPreferenceProperty( NumNodeSize, "max", 100 );
int NumFontNode = addPreference( tr( "PREF_NUMBERING_FONT" ), numGroup, LightApp_Preferences::Selector, "SMESH", "numbering_node_font" );
setPreferenceProperty( NumFontNode, "strings", fonts );
setPreferenceProperty( NumFontNode, "indexes", indices );
addPreference( tr( "PREF_NUMBERING_BOLD" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_node_bold" );
addPreference( tr( "PREF_NUMBERING_ITALIC" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_node_italic" );
addPreference( tr( "PREF_NUMBERING_SHADOW" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_node_shadow" );
// ...
addPreference( tr( "PREF_NUMBERING_ELEM" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_elem_color" ); addPreference( tr( "PREF_NUMBERING_ELEM" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_elem_color" );
int NumElemSize = addPreference( tr( "PREF_NUMBERING_SIZE" ), numGroup, LightApp_Preferences::IntSpin, "SMESH", "numbering_elem_size" ); addVtkFontPref( tr( "PREF_NUMBERING_FONT" ), numGroup, "numbering_elem_font", true );
setPreferenceProperty( NumElemSize, "min", 1 );
setPreferenceProperty( NumElemSize, "max", 100 );
int NumFontElem = addPreference( tr( "PREF_NUMBERING_FONT" ), numGroup, LightApp_Preferences::Selector, "SMESH", "numbering_elem_font" );
setPreferenceProperty( NumFontElem, "strings", fonts );
setPreferenceProperty( NumFontElem, "indexes", indices );
addPreference( tr( "PREF_NUMBERING_BOLD" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_elem_bold" );
addPreference( tr( "PREF_NUMBERING_ITALIC" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_elem_italic" );
addPreference( tr( "PREF_NUMBERING_SHADOW" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_elem_shadow" );
int orientGroup = addPreference( tr( "PREF_GROUP_FACES_ORIENTATION" ), meshTab ); int orientGroup = addPreference( tr( "PREF_GROUP_FACES_ORIENTATION" ), meshTab );
setPreferenceProperty( orientGroup, "columns", 1 ); setPreferenceProperty( orientGroup, "columns", 1 );
@ -5098,14 +5079,10 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
QString val = aResourceMgr->stringValue( "SMESH", name ); QString val = aResourceMgr->stringValue( "SMESH", name );
myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() ); myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() );
} }
else if(name == QString("numbering_node_color") || name == QString("numbering_node_size") || else if ( name == QString( "numbering_node_color" ) || name == QString( "numbering_node_font" ) ) {
name == QString("numbering_node_font") || name == QString("numbering_node_bold") ||
name == QString("numbering_node_italic") || name == QString("numbering_node_shadow") ) {
SMESH::UpdateFontProp( this ); SMESH::UpdateFontProp( this );
} }
else if(name == QString("numbering_elem_color") || name == QString("numbering_elem_size") || else if ( name == QString( "numbering_elem_color" ) || name == QString( "numbering_elem_font" ) ) {
name == QString("numbering_elem_font") || name == QString("numbering_elem_bold") ||
name == QString("numbering_elem_italic") || name == QString("numbering_elem_shadow") ) {
SMESH::UpdateFontProp( this ); SMESH::UpdateFontProp( this );
} }
@ -6375,7 +6352,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
\param param parameter \param param parameter
\return identifier of preferences \return identifier of preferences
*/ */
int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param ) int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param, const bool needSize )
{ {
int tfont = addPreference( label, pId, LightApp_Preferences::Font, "SMESH", param ); int tfont = addPreference( label, pId, LightApp_Preferences::Font, "SMESH", param );
@ -6389,6 +6366,7 @@ int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString
setPreferenceProperty( tfont, "fonts", fam ); setPreferenceProperty( tfont, "fonts", fam );
int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow; int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
if ( needSize ) f = f | QtxFontEdit::Size;
setPreferenceProperty( tfont, "features", f ); setPreferenceProperty( tfont, "features", f );
return tfont; return tfont;

View File

@ -200,9 +200,10 @@ protected:
private: private:
void OnEditDelete(); void OnEditDelete();
int addVtkFontPref( const QString& label, int addVtkFontPref( const QString&,
const int pId, const int,
const QString& param ); const QString&,
const bool = false);
void connectView( const SUIT_ViewWindow* ); void connectView( const SUIT_ViewWindow* );

View File

@ -963,19 +963,42 @@ namespace SMESH
// //
vtkFloatingPointType anRGBNd[3] = {1,1,1}; vtkFloatingPointType anRGBNd[3] = {1,1,1};
SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) ); SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) );
int aSizeNd = mgr->integerValue( "SMESH", "numbering_node_size", 10 ); int aSizeNd = 10;
SMESH::LabelFont aFamilyNd = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_node_font", 2 ) ); SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
bool aBoldNd = mgr->booleanValue( "SMESH", "numbering_node_bold", true ); bool aBoldNd = true;
bool anItalicNd = mgr->booleanValue( "SMESH", "numbering_node_italic", false ); bool anItalicNd = false;
bool aShadowNd = mgr->booleanValue( "SMESH", "numbering_node_shadow", false ); bool aShadowNd = false;
if ( mgr->hasValue( "SMESH", "numbering_node_font" ) ) {
QFont f = mgr->fontValue( "SMESH", "numbering_node_font" );
if ( f.family() == "Arial" ) aFamilyNd = SMESH::FntArial;
else if ( f.family() == "Courier" ) aFamilyNd = SMESH::FntCourier;
else if ( f.family() == "Times" ) aFamilyNd = SMESH::FntTimes;
aBoldNd = f.bold();
anItalicNd = f.italic();
aShadowNd = f.overline();
aSizeNd = f.pointSize();
}
// //
vtkFloatingPointType anRGBEl[3] = {0,1,0}; vtkFloatingPointType anRGBEl[3] = {0,1,0};
SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) ); SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) );
int aSizeEl = mgr->integerValue( "SMESH", "numbering_elem_size", 12 ); int aSizeEl = 12;
SMESH::LabelFont aFamilyEl = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_elem_font", 2 ) ); SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
bool aBoldEl = mgr->booleanValue( "SMESH", "numbering_elem_bold", true ); bool aBoldEl = true;
bool anItalicEl = mgr->booleanValue( "SMESH", "numbering_elem_italic", false ); bool anItalicEl = false;
bool aShadowEl = mgr->booleanValue( "SMESH", "numbering_elem_shadow", false ); bool aShadowEl = false;
if ( mgr->hasValue( "SMESH", "numbering_elem_font" ) ) {
QFont f = mgr->fontValue( "SMESH", "numbering_elem_font" );
if ( f.family() == "Arial" ) aFamilyEl = SMESH::FntArial;
else if ( f.family() == "Courier" ) aFamilyEl = SMESH::FntCourier;
else if ( f.family() == "Times" ) aFamilyEl = SMESH::FntTimes;
aBoldEl = f.bold();
anItalicEl = f.italic();
aShadowEl = f.overline();
aSizeEl = f.pointSize();
}
// //
ViewManagerList vmList; ViewManagerList vmList;
app->viewManagers( SVTK_Viewer::Type(), vmList ); app->viewManagers( SVTK_Viewer::Type(), vmList );

View File

@ -2232,38 +2232,10 @@ Check algorithm documentation for supported geometry</translation>
<source>PREF_NUMBERING_ELEM</source> <source>PREF_NUMBERING_ELEM</source>
<translation>Edges: Color</translation> <translation>Edges: Color</translation>
</message> </message>
<message>
<source>PREF_NUMBERING_SIZE</source>
<translation>Size</translation>
</message>
<message> <message>
<source>PREF_NUMBERING_FONT</source> <source>PREF_NUMBERING_FONT</source>
<translation>Font</translation> <translation>Font</translation>
</message> </message>
<message>
<source>SMESH_ARIAL</source>
<translation>Arial</translation>
</message>
<message>
<source>SMESH_COURIER</source>
<translation>Courier</translation>
</message>
<message>
<source>SMESH_TIMES</source>
<translation>Times</translation>
</message>
<message>
<source>PREF_NUMBERING_BOLD</source>
<translation>Bold</translation>
</message>
<message>
<source>PREF_NUMBERING_ITALIC</source>
<translation>Italic</translation>
</message>
<message>
<source>PREF_NUMBERING_SHADOW</source>
<translation>Shadow</translation>
</message>
<message> <message>
<source>SMESH_PREFERENCES_SCALARBAR</source> <source>SMESH_PREFERENCES_SCALARBAR</source>
<translation>Scalar Bar Preferences</translation> <translation>Scalar Bar Preferences</translation>

View File

@ -2192,6 +2192,22 @@ Référez-vous à la documentation sur l&apos;algorithme et la géométrie suppo
<source>SMESH_PRECISION</source> <source>SMESH_PRECISION</source>
<translation>Précision</translation> <translation>Précision</translation>
</message> </message>
<message>
<source>PREF_GROUP_NUMBERING</source>
<translation type="unfinished">Numbering</translation>
</message>
<message>
<source>PREF_NUMBERING_NODE</source>
<translation type="unfinished">Nodes: Color</translation>
</message>
<message>
<source>PREF_NUMBERING_ELEM</source>
<translation type="unfinished">Edges: Color</translation>
</message>
<message>
<source>PREF_NUMBERING_FONT</source>
<translation>Police</translation>
</message>
<message> <message>
<source>SMESH_PREFERENCES_SCALARBAR</source> <source>SMESH_PREFERENCES_SCALARBAR</source>
<translation>Préférences de la barre d&apos;échelle</translation> <translation>Préférences de la barre d&apos;échelle</translation>