mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 09:20:34 +05:00
Imp: numbering font preferences
This commit is contained in:
parent
752ad5bd14
commit
577906c7b0
@ -95,17 +95,9 @@
|
||||
<parameter name="preview_actor_chunk_size" value="100" />
|
||||
<parameter name="historical_python_dump" value="true" />
|
||||
<parameter name="numbering_node_color" value="255, 255, 255" />
|
||||
<parameter name="numbering_node_size" value="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_node_font" value="Times,Bold,10" />
|
||||
<parameter name="numbering_elem_color" value="0, 255, 0" />
|
||||
<parameter name="numbering_elem_size" value="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" />
|
||||
<parameter name="numbering_elem_font" value="Times,Bold,12" />
|
||||
<!-- Input field precisions -->
|
||||
<parameter name="def_precision" value="3" />
|
||||
<parameter name="length_precision" value="-6" />
|
||||
|
@ -152,19 +152,39 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
|
||||
vtkFloatingPointType aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
|
||||
|
||||
int aSizeNd = mgr->integerValue( "SMESH", "numbering_node_size", 10 );
|
||||
SMESH::LabelFont aFamilyNd = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_node_font", 2 ) );
|
||||
bool aBoldNd = mgr->booleanValue( "SMESH", "numbering_node_bold", true );
|
||||
bool anItalicNd = mgr->booleanValue( "SMESH", "numbering_node_italic", false );
|
||||
bool aShadowNd = mgr->booleanValue( "SMESH", "numbering_node_shadow", false );
|
||||
SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
|
||||
bool aBoldNd = true;
|
||||
bool anItalicNd = false;
|
||||
bool aShadowNd = 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};
|
||||
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::LabelFont)( mgr->integerValue( "SMESH", "numbering_elem_font", 2 ) );
|
||||
bool aBoldEl = mgr->booleanValue( "SMESH", "numbering_elem_bold", true );
|
||||
bool anItalicEl = mgr->booleanValue( "SMESH", "numbering_elem_italic", false );
|
||||
bool aShadowEl = mgr->booleanValue( "SMESH", "numbering_elem_shadow", false );
|
||||
SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
|
||||
bool aBoldEl = true;
|
||||
bool anItalicEl = false;
|
||||
bool aShadowEl = 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};
|
||||
SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) );
|
||||
|
||||
|
@ -4885,32 +4885,13 @@ void SMESHGUI::createPreferences()
|
||||
setPreferenceProperty( shrink, "max", 100 );
|
||||
|
||||
int numGroup = addPreference( tr( "PREF_GROUP_NUMBERING" ), meshTab );
|
||||
setPreferenceProperty( numGroup, "columns", 6 );
|
||||
QStringList fonts;
|
||||
fonts << tr( "SMESH_ARIAL" ) << tr( "SMESH_COURIER" ) << tr( "SMESH_TIMES" );
|
||||
indices.clear(); indices << 0 << 1 << 2;
|
||||
// ...
|
||||
setPreferenceProperty( numGroup, "columns", 2 );
|
||||
|
||||
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" );
|
||||
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" );
|
||||
// ...
|
||||
addVtkFontPref( tr( "PREF_NUMBERING_FONT" ), numGroup, "numbering_node_font", true );
|
||||
|
||||
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" );
|
||||
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" );
|
||||
addVtkFontPref( tr( "PREF_NUMBERING_FONT" ), numGroup, "numbering_elem_font", true );
|
||||
|
||||
int orientGroup = addPreference( tr( "PREF_GROUP_FACES_ORIENTATION" ), meshTab );
|
||||
setPreferenceProperty( orientGroup, "columns", 1 );
|
||||
@ -5098,14 +5079,10 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
|
||||
QString val = aResourceMgr->stringValue( "SMESH", name );
|
||||
myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() );
|
||||
}
|
||||
else if(name == QString("numbering_node_color") || name == QString("numbering_node_size") ||
|
||||
name == QString("numbering_node_font") || name == QString("numbering_node_bold") ||
|
||||
name == QString("numbering_node_italic") || name == QString("numbering_node_shadow") ) {
|
||||
SMESH::UpdateFontProp( this );
|
||||
else if ( name == QString( "numbering_node_color" ) || name == QString( "numbering_node_font" ) ) {
|
||||
SMESH::UpdateFontProp( this );
|
||||
}
|
||||
else if(name == QString("numbering_elem_color") || name == QString("numbering_elem_size") ||
|
||||
name == QString("numbering_elem_font") || name == QString("numbering_elem_bold") ||
|
||||
name == QString("numbering_elem_italic") || name == QString("numbering_elem_shadow") ) {
|
||||
else if ( name == QString( "numbering_elem_color" ) || name == QString( "numbering_elem_font" ) ) {
|
||||
SMESH::UpdateFontProp( this );
|
||||
}
|
||||
|
||||
@ -6375,7 +6352,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
|
||||
\param param parameter
|
||||
\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 );
|
||||
|
||||
@ -6389,6 +6366,7 @@ int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString
|
||||
setPreferenceProperty( tfont, "fonts", fam );
|
||||
|
||||
int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
|
||||
if ( needSize ) f = f | QtxFontEdit::Size;
|
||||
setPreferenceProperty( tfont, "features", f );
|
||||
|
||||
return tfont;
|
||||
|
@ -200,9 +200,10 @@ protected:
|
||||
|
||||
private:
|
||||
void OnEditDelete();
|
||||
int addVtkFontPref( const QString& label,
|
||||
const int pId,
|
||||
const QString& param );
|
||||
int addVtkFontPref( const QString&,
|
||||
const int,
|
||||
const QString&,
|
||||
const bool = false);
|
||||
|
||||
void connectView( const SUIT_ViewWindow* );
|
||||
|
||||
|
@ -963,42 +963,65 @@ namespace SMESH
|
||||
//
|
||||
vtkFloatingPointType anRGBNd[3] = {1,1,1};
|
||||
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 );
|
||||
SMESH::LabelFont aFamilyNd = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_node_font", 2 ) );
|
||||
bool aBoldNd = mgr->booleanValue( "SMESH", "numbering_node_bold", true );
|
||||
bool anItalicNd = mgr->booleanValue( "SMESH", "numbering_node_italic", false );
|
||||
bool aShadowNd = mgr->booleanValue( "SMESH", "numbering_node_shadow", false );
|
||||
int aSizeNd = 10;
|
||||
SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
|
||||
bool aBoldNd = true;
|
||||
bool anItalicNd = 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};
|
||||
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 );
|
||||
SMESH::LabelFont aFamilyEl = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_elem_font", 2 ) );
|
||||
bool aBoldEl = mgr->booleanValue( "SMESH", "numbering_elem_bold", true );
|
||||
bool anItalicEl = mgr->booleanValue( "SMESH", "numbering_elem_italic", false );
|
||||
bool aShadowEl = mgr->booleanValue( "SMESH", "numbering_elem_shadow", false );
|
||||
int aSizeEl = 12;
|
||||
SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
|
||||
bool aBoldEl = true;
|
||||
bool anItalicEl = 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;
|
||||
app->viewManagers( SVTK_Viewer::Type(), vmList );
|
||||
foreach ( SUIT_ViewManager* vm, vmList ) {
|
||||
QVector<SUIT_ViewWindow*> views = vm->getViews();
|
||||
foreach ( SUIT_ViewWindow* vw, views ) {
|
||||
// update VTK viewer properties
|
||||
if ( SVTK_ViewWindow* aVtkView = GetVtkViewWindow( vw ) ) {
|
||||
// update actors
|
||||
vtkRenderer* aRenderer = aVtkView->getRenderer();
|
||||
VTK::ActorCollectionCopy aCopy( aRenderer->GetActors() );
|
||||
vtkActorCollection* aCollection = aCopy.GetActors();
|
||||
aCollection->InitTraversal();
|
||||
while ( vtkActor* anAct = aCollection->GetNextActor() ) {
|
||||
if ( SMESH_NodeLabelActor* anActor = dynamic_cast< SMESH_NodeLabelActor* >( anAct ) ) {
|
||||
anActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
|
||||
}
|
||||
else if ( SMESH_CellLabelActor* anActor = dynamic_cast< SMESH_CellLabelActor* >( anAct ) ) {
|
||||
anActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
|
||||
}
|
||||
}
|
||||
aVtkView->Repaint( false );
|
||||
}
|
||||
// update VTK viewer properties
|
||||
if ( SVTK_ViewWindow* aVtkView = GetVtkViewWindow( vw ) ) {
|
||||
// update actors
|
||||
vtkRenderer* aRenderer = aVtkView->getRenderer();
|
||||
VTK::ActorCollectionCopy aCopy( aRenderer->GetActors() );
|
||||
vtkActorCollection* aCollection = aCopy.GetActors();
|
||||
aCollection->InitTraversal();
|
||||
while ( vtkActor* anAct = aCollection->GetNextActor() ) {
|
||||
if ( SMESH_NodeLabelActor* anActor = dynamic_cast< SMESH_NodeLabelActor* >( anAct ) ) {
|
||||
anActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
|
||||
}
|
||||
else if ( SMESH_CellLabelActor* anActor = dynamic_cast< SMESH_CellLabelActor* >( anAct ) ) {
|
||||
anActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
|
||||
}
|
||||
}
|
||||
aVtkView->Repaint( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2232,38 +2232,10 @@ Check algorithm documentation for supported geometry</translation>
|
||||
<source>PREF_NUMBERING_ELEM</source>
|
||||
<translation>Edges: Color</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_NUMBERING_SIZE</source>
|
||||
<translation>Size</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_NUMBERING_FONT</source>
|
||||
<translation>Font</translation>
|
||||
</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>
|
||||
<source>SMESH_PREFERENCES_SCALARBAR</source>
|
||||
<translation>Scalar Bar Preferences</translation>
|
||||
|
@ -2192,6 +2192,22 @@ Référez-vous à la documentation sur l'algorithme et la géométrie suppo
|
||||
<source>SMESH_PRECISION</source>
|
||||
<translation>Précision</translation>
|
||||
</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>
|
||||
<source>SMESH_PREFERENCES_SCALARBAR</source>
|
||||
<translation>Préférences de la barre d'échelle</translation>
|
||||
|
Loading…
Reference in New Issue
Block a user