Salome HOME
Copyright update 2021
[modules/smesh.git] / src / OBJECT / SMESH_ActorProps.cxx
1 // Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include "SMESH_ActorProps.h"
24
25 #include <SUIT_ResourceMgr.h>
26 #include <SUIT_Session.h>
27
28 SMESH_ActorProps* SMESH_ActorProps::props()
29 {
30   static SMESH_ActorProps* g_props = 0;
31   if (!g_props)
32     g_props = new SMESH_ActorProps();
33   return g_props;
34 }
35
36 void SMESH_ActorProps::reset()
37 {
38   props()->initialize();
39 }
40
41 SMESH_ActorProps::SMESH_ActorProps()
42 {
43   initialize();
44 }
45
46 void SMESH_ActorProps::initialize()
47 {
48   SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
49   m_selection_color = mgr->colorValue("SMESH", "selection_object_color", Qt::white);
50   m_highlight_color = mgr->colorValue("SMESH", "highlight_color", Qt::cyan);
51   m_selection_increment = qBound(0, mgr->integerValue("SMESH", "selection_increment", 0), 5);
52   m_controls_increment = qBound(0, mgr->integerValue("SMESH", "controls_increment", 2), 5);
53 }
54
55 QColor SMESH_ActorProps::selectionColor() const
56 {
57   return m_selection_color;
58 }
59
60 QColor SMESH_ActorProps::highlightColor() const
61 {
62   return m_highlight_color;
63 }
64
65 int SMESH_ActorProps::selectionIncrement() const
66 {
67   return m_selection_increment;
68 }
69
70 int SMESH_ActorProps::controlsIncrement() const
71 {
72   return m_controls_increment;
73 }