CMS 3D CMS Logo

FWColorManager.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_FWColorManager_h
2 #define Fireworks_Core_FWColorManager_h
3 // -*- C++ -*-
4 //
5 // Package: Core
6 // Class : FWColorManager
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Tue Mar 24 10:07:58 CET 2009
19 //
20 
21 // system include files
22 #include <vector>
23 #include "sigc++/signal.h"
24 #include "Rtypes.h"
25 
26 // user include files
27 
28 // forward declarations
30 class TGLViewer;
31 
33 {
44 };
45 
46 
48 {
49 public:
51 
53  virtual ~FWColorManager();
54 
55  void initialize();
56 
57  // ---------- const member functions ---------------------
58  Color_t background() const {return m_background;}
59  Color_t foreground() const {return m_foreground;}
60  Bool_t isColorSetDark() const {return m_background == kBlackIndex;}
61  Bool_t isColorSetLight() const {return m_background == kWhiteIndex;}
62 
66 
67  void fillLimitedColors(std::vector<Color_t>& cv) const;
68 
69  //help with backward compatibility with old config files
70  Color_t oldColorToIndex(Color_t, int version) const;
71 
72  bool colorHasIndex(Color_t) const;
73 
74  Color_t geomColor(FWGeomColorIndex) const;
75 
76  enum BackgroundColorIndex { kWhiteIndex = kWhite, kBlackIndex = kBlack };
77 
79  EPalette getPalette() const { return m_paletteId; }
80 
81  // ---------- static member functions --------------------
82 
83  static Bool_t setColorSetViewer(TGLViewer*, Color_t);
84 
85  static Color_t getDefaultStartColorIndex();
86 
87  // ---------- member functions ---------------------------
88 
89  void defaultBrightness();
90  void setBrightness(int);
91  int brightness ();
94  void switchBackground();
95 
96  void setPalette(long long);
97 
98  void setGeomColor(FWGeomColorIndex, Color_t);
99  void setGeomTransparency(Color_t idx, bool projectedType);
100  Color_t geomTransparency(bool projected) const { return projected ? m_geomTransparency2D : m_geomTransparency3D; }
101 
102  void setDefaultGeomColors();
103  void propagatePaletteChanges() const;
104  mutable sigc::signal<void> colorsHaveChanged_;
105  mutable sigc::signal<void> geomColorsHaveChanged_;
106  mutable sigc::signal<void, bool> geomTransparencyHaveChanged_;
107 
108  //called after all the slots attached to colorsHaveChanged_ are done
109  mutable sigc::signal<void> colorsHaveChangedFinished_;
110 
111 private:
112  FWColorManager(const FWColorManager&) = delete; // stop default
113 
114  const FWColorManager& operator=(const FWColorManager&) = delete; // stop default
115  void updateColors();
116  void initColorTable();
117 
118  // ---------- member data --------------------------------
120 
121  Float_t m_gammaOff;
122 
123  Color_t m_background;
124  Color_t m_foreground;
126 
129 
133 
134  static const Color_t s_defaultStartColorIndex;
135 };
136 
137 
138 #endif
Bool_t isColorSetLight() const
sigc::signal< void > geomColorsHaveChanged_
void setDefaultGeomColors()
Color_t background() const
int offsetOfLimitedColors() const
Color_t geomTransparency(bool projected) const
FWGeomColorIndex
static Color_t getDefaultStartColorIndex()
void fillLimitedColors(std::vector< Color_t > &cv) const
Color_t oldColorToIndex(Color_t, int version) const
cv
Definition: cuy.py:364
int borderOfLimitedColors() const
sigc::signal< void, bool > geomTransparencyHaveChanged_
Bool_t isColorSetDark() const
bool colorHasIndex(Color_t) const
void setGeomColor(FWGeomColorIndex, Color_t)
void setBackgroundColorIndex(BackgroundColorIndex)
virtual ~FWColorManager()
void setGeomTransparency(Color_t idx, bool projectedType)
EPalette m_paletteId
Char_t m_geomTransparency2D
FWModelChangeManager * m_changeManager
void setPalette(long long)
sigc::signal< void > colorsHaveChangedFinished_
Char_t m_geomTransparency3D
void defaultBrightness()
Color_t m_numColorIndices
Color_t m_foreground
BackgroundColorIndex backgroundColorIndex() const
Color_t m_geomColor[kFWGeomColorSize]
void setBrightness(int)
static const Color_t s_defaultStartColorIndex
const FWColorManager & operator=(const FWColorManager &)=delete
void setBackgroundAndBrightness(BackgroundColorIndex, int)
void propagatePaletteChanges() const
Color_t foreground() const
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
FWColorManager(FWModelChangeManager *)
Color_t m_startColorIndex
sigc::signal< void > colorsHaveChanged_
Color_t m_background
Color_t geomColor(FWGeomColorIndex) const
EPalette getPalette() const
int numberOfLimitedColors() const