X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_ActorUtils.cxx;h=feee143db948dd0510aa8ec57b3d4ee291f974a1;hp=05aa47c5938ead514f8aa70b367ee3a8d72c099b;hb=9a358116f4ee87b52d3d86752c4fb6b3f814a69f;hpb=4401d3e8dbd023980ca2bd56a1dcb1e12dbd194a diff --git a/src/OBJECT/SMESH_ActorUtils.cxx b/src/OBJECT/SMESH_ActorUtils.cxx index 05aa47c59..feee143db 100644 --- a/src/OBJECT/SMESH_ActorUtils.cxx +++ b/src/OBJECT/SMESH_ActorUtils.cxx @@ -20,8 +20,9 @@ #include "SMESH_ActorUtils.h" -#include "SUIT_ResourceMgr.h" +#include "SUIT_Tools.h" #include "SUIT_Session.h" +#include "SUIT_ResourceMgr.h" #include "utilities.h" @@ -42,10 +43,10 @@ namespace SMESH{ float val = theDefault; if( pos>=0 ) { - QString val = theValue.right( theValue.length()-pos-1 ), + QString name = theValue.right( theValue.length()-pos-1 ), sect = theValue.left( pos ); - if( !val.isEmpty() && !sect.isEmpty() ) - val = GetFloat( val, sect, theDefault ); + if( !name.isEmpty() && !sect.isEmpty() ) + val = GetFloat( name, sect, theDefault ); } return val; } @@ -70,4 +71,31 @@ namespace SMESH{ aWriter->Delete(); } + QColor GetColor( const QString& theSect, const QString& theName, const QColor& def ) + { + QColor c = def; + SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); + if ( mgr ) + c = mgr->colorValue( theSect, theName, def ); + return c; + } + + void GetColor( const QString& theSect, const QString& theName, int& r, int& g, int& b, const QColor& def ) + { + QColor c = def; + SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); + if ( mgr ) + c = mgr->colorValue( theSect, theName, def ); + + SUIT_Tools::rgbSet( SUIT_Tools::rgbSet( c ), r, g, b ); + } + + void GetColor( const QString& theSect, const QString& theName, float& r, float& g, float& b, const QColor& def ) + { + int ir( 0 ), ig( 0 ), ib( 0 ); + GetColor( theSect, theName, ir, ig, ib, def ); + r = ir / 255.; + g = ig / 255.; + b = ib / 255.; + } }