CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CmsShowCommonPopup Class Reference

#include <CmsShowCommonPopup.h>

Inheritance diagram for CmsShowCommonPopup:
FWParameterSetterEditorBase

Public Member Functions

void changeGeomColor (Color_t)
 
void changeGeomTransparency2D (int)
 
void changeGeomTransparency3D (int)
 
void changeSelectionColorSet (Color_t)
 
 ClassDef (CmsShowCommonPopup, 0)
 
virtual void CloseWindow ()
 
 CmsShowCommonPopup (CmsShowCommon *, const TGWindow *p=0, UInt_t w=1, UInt_t h=1)
 
void colorSetChanged ()
 
void switchBackground ()
 
virtual ~CmsShowCommonPopup ()
 
- Public Member Functions inherited from FWParameterSetterEditorBase
 FWParameterSetterEditorBase ()
 
virtual void updateEditor ()
 
virtual ~FWParameterSetterEditorBase ()
 

Private Member Functions

 CmsShowCommonPopup (const CmsShowCommonPopup &)
 
void getColorSetColors (int &hci, int &sci)
 
void makeSetter (TGCompositeFrame *frame, FWParameterBase *param)
 
const CmsShowCommonPopupoperator= (const CmsShowCommonPopup &)
 

Private Attributes

TGTextButton * m_backgroundButton
 
FWColorSelectm_colorRnrCtxHighlightWidget
 
FWColorSelectm_colorRnrCtxSelectWidget
 
FWColorSelectm_colorSelectWidget [kFWGeomColorSize]
 
CmsShowCommonm_common
 
TGTextButton * m_gammaButton
 
TGHSlider * m_gammaSlider
 
std::vector< boost::shared_ptr
< FWParameterSetterBase > > 
m_setters
 

Detailed Description

Definition at line 24 of file CmsShowCommonPopup.h.

Constructor & Destructor Documentation

CmsShowCommonPopup::CmsShowCommonPopup ( CmsShowCommon model,
const TGWindow *  p = 0,
UInt_t  w = 1,
UInt_t  h = 1 
)

Definition at line 32 of file CmsShowCommonPopup.cc.

References asciidump::attributes, CmsShowCommon::colorManager(), FWColorManager::geomColor(), FWColorManager::geomTransparency(), getColorSetColors(), i, j, gen::k, kFWGeomColorSize, kFWMuonBarrelLineColorIndex, kFWMuonEndcapLineColorIndex, kFWPixelBarrelColorIndex, kFWPixelEndcapColorIndex, kFWTrackerBarrelColorIndex, kFWTrackerEndcapColorIndex, diffTwoXMLs::label, m_backgroundButton, m_colorRnrCtxHighlightWidget, m_colorRnrCtxSelectWidget, m_colorSelectWidget, m_common, CmsShowCommon::m_drawBreakPoints, CmsShowCommon::m_energyScale, CmsShowCommon::m_gamma, CmsShowCommon::m_trackBreak, makeSetter(), h::names, fetchall_from_DQM_v2::pool, and FWColorSelect::SetColorByIndex().

32  :
33  TGTransientFrame(gClient->GetDefaultRoot(),p,w,h),
34  m_common(model),
36  m_gammaSlider(0),
37  m_gammaButton(0),
40 {
41  SetCleanup(kDeepCleanup);
42 
43  TGGC *fTextGC;
44  const TGFont *font = gClient->GetFont("-adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-iso8859-1");
45  if (!font)
46  font = gClient->GetResourcePool()->GetDefaultFont();
47  GCValues_t gval;
48  gval.fMask = kGCBackground | kGCFont | kGCForeground;
49  gval.fFont = font->GetFontHandle();
50  fTextGC = gClient->GetGC(&gval, kTRUE);
51 
52 
53  TGFont* smallFont = 0;
54  FontStruct_t defaultFontStruct = m_backgroundButton->GetDefaultFontStruct();
55  try
56  {
57  TGFontPool *pool = gClient->GetFontPool();
58  TGFont* defaultFont = pool->GetFont(defaultFontStruct);
59  FontAttributes_t attributes = defaultFont->GetFontAttributes();
60  smallFont = pool->GetFont(attributes.fFamily, 8, attributes.fWeight, attributes.fSlant);
61  }
62  catch(...)
63  {
64  // Ignore exceptions.
65  }
66 
67  TGCompositeFrame* vf2 = new TGVerticalFrame(this);
68  AddFrame(vf2, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
69  //==============================================================================
70  // scales
71  //
72  {
73  TGLabel* xx = new TGLabel(vf2, "GlobalScales ", fTextGC->GetGC());
74  vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft ,2,2,4,4));
75  }
77  vf2->AddFrame(scaleEditor);
78  //==============================================================================
79  // Projections
80  //
81  vf2->AddFrame(new TGHorizontal3DLine(vf2), new TGLayoutHints(kLHintsExpandX,4 ,8, 3, 3));
82  {
83  TGLabel* xx = new TGLabel(vf2, "Projections ", fTextGC->GetGC());
84  vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft ,2,2,4,4));
85  }
86  vf2->AddFrame(new TGLabel(vf2, "Track behaviour when crossing y=0 in RhoZ-view:"), new TGLayoutHints(kLHintsLeft ,2,2,0,0));
89 
90  //==============================================================================
91  // general colors
92  //
93 
94  vf2->AddFrame(new TGHorizontal3DLine(vf2), new TGLayoutHints(kLHintsExpandX ,4 ,8, 8, 2));
95  {
96  TGLabel* xx = new TGLabel(vf2, "General Colors ", fTextGC->GetGC());
97  vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft,2,2,4,4));
98  }
99  m_backgroundButton = new TGTextButton(vf2, "Black/White Background");
100  vf2->AddFrame(m_backgroundButton);
101  makeSetter(vf2, &m_common->m_gamma);
102 
103  // rnrCtx colorset
104  {
105  int hci, sci;
106  getColorSetColors(hci, sci);
107  TGHorizontalFrame* top = new TGHorizontalFrame(vf2);
108  vf2->AddFrame(top);
109  {
110  TGHorizontalFrame* hf = new TGHorizontalFrame(top);
111  top->AddFrame(hf);
112 
113  m_colorRnrCtxHighlightWidget = new FWColorSelect(hf, "highlight", 0, m_common->colorManager(), 3);
114  hf->AddFrame(m_colorRnrCtxHighlightWidget);
116  m_colorRnrCtxHighlightWidget->Connect("ColorChosen(Color_t)", "CmsShowCommonPopup", this, "changeSelectionColorSet(Color_t)");
117 
118  TGFrame* lf = new TGHorizontalFrame(hf, 100, 16, kFixedSize);
119  TGLabel* label = new TGLabel(lf, "Higlight");
120  label->SetTextFont(smallFont);
121  hf->AddFrame(lf, new TGLayoutHints(kLHintsLeft |kLHintsCenterY , 0, 0, 0,0));
122  }
123 
124  {
125  TGHorizontalFrame* hf = new TGHorizontalFrame(top);
126  top->AddFrame(hf);
127 
128  m_colorRnrCtxSelectWidget = new FWColorSelect(hf, "selectioyn", 0, m_common->colorManager(), 1);
129  hf->AddFrame(m_colorRnrCtxSelectWidget);
131  m_colorRnrCtxSelectWidget->Connect("ColorChosen(Color_t)", "CmsShowCommonPopup", this, "changeSelectionColorSet(Color_t)");
132 
133  TGFrame* lf = new TGHorizontalFrame(hf, 100, 16, kFixedSize);
134  TGLabel* label = new TGLabel(lf, "Selection");
135  label->SetTextFont(smallFont);
136  hf->AddFrame(lf, new TGLayoutHints(kLHintsLeft |kLHintsCenterY , 0, 0, 0,0));
137  }
138  }
139 
140  vf2->AddFrame(new TGHorizontal3DLine(vf2), new TGLayoutHints(kLHintsExpandX ,4 ,8, 8, 2));
141 
142  //==============================================================================
143  // geom colors
144  //
145 
146  {
147  TGLabel* xx = new TGLabel(vf2, "DetectorColors ", fTextGC->GetGC());
148  vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft,2,2,8,0));
149  }
150 
151  TGHSlider* transpWidget2D = 0;
152  TGHSlider* transpWidget3D = 0;
153  TGCompositeFrame* top = new TGVerticalFrame(vf2);
154  vf2->AddFrame(top, new TGLayoutHints(kLHintsNormal, 2, 2, 2, 0));
155 
156  {
157  TGHorizontalFrame* hf = new TGHorizontalFrame(top);
158  hf->AddFrame(new TGLabel(hf, "Tansparency 2D:"), new TGLayoutHints(kLHintsBottom, 2, 2, 3, 3));
159  transpWidget2D = new TGHSlider(hf, 100, kSlider1);
160  hf->AddFrame( transpWidget2D);
161  top->AddFrame(hf,new TGLayoutHints( kLHintsNormal, 0, 0, 2, 2));
162  }
163  {
164  TGHorizontalFrame* hf = new TGHorizontalFrame(top);
165  hf->AddFrame(new TGLabel(hf, "Tansparency 3D:") , new TGLayoutHints(kLHintsBottom,2, 2, 2, 2 ));
166  transpWidget3D = new TGHSlider(hf, 100, kSlider1);
167  hf->AddFrame( transpWidget3D);
168  top->AddFrame(hf, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 10));
169  }
170  std::string names[kFWGeomColorSize];
171  names[kFWPixelBarrelColorIndex ] = "Pixel Barrel";
172  names[kFWPixelEndcapColorIndex ] = "Pixel Endcap" ;
173  names[kFWTrackerBarrelColorIndex ] = "Tracker Barrel";
174  names[kFWTrackerEndcapColorIndex ] = "Tracker Endcap";
175  names[kFWMuonBarrelLineColorIndex] = "Muon Barrel";
176  names[kFWMuonEndcapLineColorIndex] = "Muon Endcap";
177  int i = 0;
178  for (int k = 0; k < 3; ++k)
179  {
180  TGHorizontalFrame* hf = new TGHorizontalFrame(top);
181  top->AddFrame(hf);
182 
183  for (int j = 0 ; j < 2; ++j)
184  {
185  m_colorSelectWidget[i] = new FWColorSelect(hf, names[i].c_str(), 0, m_common->colorManager(), i);
186  hf->AddFrame(m_colorSelectWidget[i]);
188  m_colorSelectWidget[i]->Connect("ColorChosen(Color_t)", "CmsShowCommonPopup", this, "changeGeomColor(Color_t)");
189 
190  TGFrame* lf = new TGHorizontalFrame(hf, 100, 16, kFixedSize);
191  TGLabel* label = new TGLabel(lf, m_colorSelectWidget[i]->label().c_str());
192  label->SetTextFont(smallFont);
193  hf->AddFrame(lf, new TGLayoutHints(kLHintsLeft |kLHintsCenterY , 0, 0, 0,0));
194 
195  ++i;
196  }
197  }
198  //==============================================================================
199 
200  m_backgroundButton->Connect("Clicked()", "CmsShowCommonPopup", this, "switchBackground()");
201 
202  transpWidget2D->SetRange(0, 100);
203  transpWidget2D->SetPosition(m_common->colorManager()->geomTransparency(true));
204  transpWidget2D->Connect("PositionChanged(Int_t)", "CmsShowCommonPopup", this, "changeGeomTransparency2D(Int_t)");
205 
206  transpWidget3D->SetRange(0, 100);
207  transpWidget3D->SetPosition(m_common->colorManager()->geomTransparency(false));
208  transpWidget3D->Connect("PositionChanged(Int_t)", "CmsShowCommonPopup", this, "changeGeomTransparency3D(Int_t)");
209 
210  SetWindowName("Common Preferences");
211  MapSubwindows();
212  Resize(GetDefaultSize());
213  Layout();
214  CenterOnParent(kTRUE, TGTransientFrame::kTopRight);
215 }
int i
Definition: DBlmapReader.cc:9
FWColorSelect * m_colorSelectWidget[kFWGeomColorSize]
Color_t geomTransparency(bool projected) const
void SetColorByIndex(Color_t iColor)
FWBoolParameter m_drawBreakPoints
Definition: CmsShowCommon.h:82
void makeSetter(TGCompositeFrame *frame, FWParameterBase *param)
FWGeomColorIndex
TGTextButton * m_gammaButton
const FWColorManager * colorManager() const
TGTextButton * m_backgroundButton
FWLongParameter m_gamma
Definition: CmsShowCommon.h:86
list attributes
Definition: asciidump.py:415
void getColorSetColors(int &hci, int &sci)
int j
Definition: DBlmapReader.cc:9
CmsShowCommon * m_common
int k[5][pyjets_maxn]
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::auto_ptr< FWViewEnergyScale > m_energyScale
Definition: CmsShowCommon.h:94
FWColorSelect * m_colorRnrCtxHighlightWidget
FWColorSelect * m_colorRnrCtxSelectWidget
FWEnumParameter m_trackBreak
Definition: CmsShowCommon.h:81
Color_t geomColor(FWGeomColorIndex) const
static const HistoName names[]
T w() const
CmsShowCommonPopup::~CmsShowCommonPopup ( )
virtual

Definition at line 219 of file CmsShowCommonPopup.cc.

220 {
221 }
CmsShowCommonPopup::CmsShowCommonPopup ( const CmsShowCommonPopup )
private

Member Function Documentation

void CmsShowCommonPopup::changeGeomColor ( Color_t  iColor)

Definition at line 231 of file CmsShowCommonPopup.cc.

References fwrapper::cs, m_common, and CmsShowCommon::setGeomColor().

232 {
233  TGColorSelect *cs = (TGColorSelect *) gTQSender;
234  FWGeomColorIndex cidx = FWGeomColorIndex(cs->WidgetId());
235  m_common->setGeomColor(cidx, iColor);
236 }
auto_ptr< ClusterSequence > cs
FWGeomColorIndex
CmsShowCommon * m_common
void setGeomColor(FWGeomColorIndex, Color_t)
void CmsShowCommonPopup::changeGeomTransparency2D ( int  iTransp)

Definition at line 258 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::setGeomTransparency().

259 {
260  m_common->setGeomTransparency(iTransp, true);
261 }
void setGeomTransparency(int val, bool projected)
CmsShowCommon * m_common
void CmsShowCommonPopup::changeGeomTransparency3D ( int  iTransp)

Definition at line 264 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::setGeomTransparency().

265 {
266  m_common->setGeomTransparency(iTransp, false);
267 }
void setGeomTransparency(int val, bool projected)
CmsShowCommon * m_common
void CmsShowCommonPopup::changeSelectionColorSet ( Color_t  idx)

Definition at line 240 of file CmsShowCommonPopup.cc.

References CmsShowCommon::colorManager(), fwrapper::cs, FWColorManager::isColorSetDark(), m_common, and v.

241 {
242  TGColorSelect *cs = (TGColorSelect *) gTQSender;
243 
244  //printf("~~~~~ changeSelectionColorSet sel[%d] idx[%d]\n", cs->WidgetId(), idx);
245  for (TEveElement::List_i it = gEve->GetViewers()->BeginChildren(); it != gEve->GetViewers()->EndChildren(); ++it)
246  {
247  TGLViewer* v = ((TEveViewer*)(*it))->GetGLViewer();
248 
249  TGLColorSet& colorset = m_common->colorManager()->isColorSetDark() ? v->RefDarkColorSet():v->RefLightColorSet();
250  colorset.Selection(cs->WidgetId()).SetColor(idx);
251  colorset.Selection(cs->WidgetId()+1).SetColor(idx); // implied selected/higlighted
252 
253  }
254 }
auto_ptr< ClusterSequence > cs
const FWColorManager * colorManager() const
Bool_t isColorSetDark() const
CmsShowCommon * m_common
mathSSE::Vec4< T > v
CmsShowCommonPopup::ClassDef ( CmsShowCommonPopup  ,
 
)
virtual void CmsShowCommonPopup::CloseWindow ( )
inlinevirtual

Definition at line 33 of file CmsShowCommonPopup.h.

33 { UnmapWindow(); }
void CmsShowCommonPopup::colorSetChanged ( )

Definition at line 272 of file CmsShowCommonPopup.cc.

References CmsShowCommon::colorManager(), FWColorManager::geomColor(), getColorSetColors(), i, kFWGeomColorSize, m_colorRnrCtxHighlightWidget, m_colorRnrCtxSelectWidget, m_colorSelectWidget, m_common, and FWColorSelect::SetColorByIndex().

Referenced by FWGUIManager::finishUpColorChange().

273 {
274  for (int i = 0 ; i < kFWGeomColorSize; ++i)
275  m_colorSelectWidget[i]->SetColorByIndex(m_common->colorManager()->geomColor(FWGeomColorIndex(i)), kFALSE);
276 
277  int hci, sci;
278  getColorSetColors(hci, sci);
279  //printf("=============== colorSetChanged() dark ? [%d] %d %d \n",m_common->colorManager()->isColorSetDark(), hci, sci);
282 }
int i
Definition: DBlmapReader.cc:9
FWColorSelect * m_colorSelectWidget[kFWGeomColorSize]
void SetColorByIndex(Color_t iColor)
FWGeomColorIndex
const FWColorManager * colorManager() const
void getColorSetColors(int &hci, int &sci)
CmsShowCommon * m_common
FWColorSelect * m_colorRnrCtxHighlightWidget
FWColorSelect * m_colorRnrCtxSelectWidget
Color_t geomColor(FWGeomColorIndex) const
void CmsShowCommonPopup::getColorSetColors ( int &  hci,
int &  sci 
)
private

Definition at line 284 of file CmsShowCommonPopup.cc.

References CmsShowCommon::colorManager(), glc, FWColorManager::isColorSetDark(), and m_common.

Referenced by CmsShowCommonPopup(), and colorSetChanged().

285 {
286  TGLColorSet& colorset = m_common->colorManager()->isColorSetDark() ? gEve->GetDefaultGLViewer()->RefDarkColorSet():
287  gEve->GetDefaultGLViewer()->RefLightColorSet();
288  {
289  TGLColor& glc = colorset.Selection(3);
290  hci = TColor::GetColor(glc.GetRed(), glc.GetGreen(), glc.GetBlue());
291  // printf("getSHcolors HIGH %d %d %d , [%d]\n", glc.GetRed(), glc.GetGreen(), glc.GetBlue(), hci);
292  }{
293  TGLColor& glc = colorset.Selection(1);
294  sci = TColor::GetColor(glc.GetRed(), glc.GetGreen(), glc.GetBlue());
295  // printf("getSHcolors SEL %d %d %d , [%d]\n", glc.GetRed(), glc.GetGreen(), glc.GetBlue(), sci);
296  }
297 }
const FWColorManager * colorManager() const
Bool_t isColorSetDark() const
CmsShowCommon * m_common
globcontrol glc
Definition: vlib.cc:6
void CmsShowCommonPopup::makeSetter ( TGCompositeFrame *  frame,
FWParameterBase param 
)
private

Definition at line 300 of file CmsShowCommonPopup.cc.

References m_setters, and FWParameterSetterBase::makeSetterFor().

Referenced by CmsShowCommonPopup().

301 {
302  boost::shared_ptr<FWParameterSetterBase> ptr( FWParameterSetterBase::makeSetterFor(param) );
303  ptr->attach(param, this);
304 
305  TGFrame* pframe = ptr->build(frame);
306  frame->AddFrame(pframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 2,2));
307 
308  m_setters.push_back(ptr);
309 }
static boost::shared_ptr< FWParameterSetterBase > makeSetterFor(FWParameterBase *)
std::vector< boost::shared_ptr< FWParameterSetterBase > > m_setters
const CmsShowCommonPopup& CmsShowCommonPopup::operator= ( const CmsShowCommonPopup )
private
void CmsShowCommonPopup::switchBackground ( )

Definition at line 224 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::switchBackground().

225 {
227 }
CmsShowCommon * m_common
void switchBackground()

Member Data Documentation

TGTextButton* CmsShowCommonPopup::m_backgroundButton
private

Definition at line 54 of file CmsShowCommonPopup.h.

Referenced by CmsShowCommonPopup().

FWColorSelect* CmsShowCommonPopup::m_colorRnrCtxHighlightWidget
private

Definition at line 60 of file CmsShowCommonPopup.h.

Referenced by CmsShowCommonPopup(), and colorSetChanged().

FWColorSelect* CmsShowCommonPopup::m_colorRnrCtxSelectWidget
private

Definition at line 61 of file CmsShowCommonPopup.h.

Referenced by CmsShowCommonPopup(), and colorSetChanged().

FWColorSelect* CmsShowCommonPopup::m_colorSelectWidget[kFWGeomColorSize]
private

Definition at line 59 of file CmsShowCommonPopup.h.

Referenced by CmsShowCommonPopup(), and colorSetChanged().

CmsShowCommon* CmsShowCommonPopup::m_common
private
TGTextButton* CmsShowCommonPopup::m_gammaButton
private

Definition at line 56 of file CmsShowCommonPopup.h.

TGHSlider* CmsShowCommonPopup::m_gammaSlider
private

Definition at line 55 of file CmsShowCommonPopup.h.

std::vector<boost::shared_ptr<FWParameterSetterBase> > CmsShowCommonPopup::m_setters
private

Definition at line 62 of file CmsShowCommonPopup.h.

Referenced by makeSetter().