test
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 CmsShowCommon::colorManager(), FWColorManager::geomColor(), FWColorManager::geomTransparency(), getColorSetColors(), i, j, relval_steps::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(), cscdqm::h::names, edmIntegrityCheck::pool, FWColorSelect::SetColorByIndex(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 224 of file CmsShowCommonPopup.cc.

225 {
226 }
CmsShowCommonPopup::CmsShowCommonPopup ( const CmsShowCommonPopup )
private

Member Function Documentation

void CmsShowCommonPopup::changeGeomColor ( Color_t  iColor)

Definition at line 236 of file CmsShowCommonPopup.cc.

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

237 {
238  TGColorSelect *cs = (TGColorSelect *) gTQSender;
239  FWGeomColorIndex cidx = FWGeomColorIndex(cs->WidgetId());
240  m_common->setGeomColor(cidx, iColor);
241 }
auto_ptr< ClusterSequence > cs
FWGeomColorIndex
CmsShowCommon * m_common
void setGeomColor(FWGeomColorIndex, Color_t)
void CmsShowCommonPopup::changeGeomTransparency2D ( int  iTransp)

Definition at line 263 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::setGeomTransparency().

264 {
265  m_common->setGeomTransparency(iTransp, true);
266 }
void setGeomTransparency(int val, bool projected)
CmsShowCommon * m_common
void CmsShowCommonPopup::changeGeomTransparency3D ( int  iTransp)

Definition at line 269 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::setGeomTransparency().

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

Definition at line 245 of file CmsShowCommonPopup.cc.

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

246 {
247  TGColorSelect *cs = (TGColorSelect *) gTQSender;
248 
249  //printf("~~~~~ changeSelectionColorSet sel[%d] idx[%d]\n", cs->WidgetId(), idx);
250  for (TEveElement::List_i it = gEve->GetViewers()->BeginChildren(); it != gEve->GetViewers()->EndChildren(); ++it)
251  {
252  TGLViewer* v = ((TEveViewer*)(*it))->GetGLViewer();
253 
254  TGLColorSet& colorset = m_common->colorManager()->isColorSetDark() ? v->RefDarkColorSet():v->RefLightColorSet();
255  colorset.Selection(cs->WidgetId()).SetColor(idx);
256  colorset.Selection(cs->WidgetId()+1).SetColor(idx); // implied selected/higlighted
257 
258  }
259 }
auto_ptr< ClusterSequence > cs
const FWColorManager * colorManager() const
Bool_t isColorSetDark() const
CmsShowCommon * m_common
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
CmsShowCommonPopup::ClassDef ( CmsShowCommonPopup  ,
 
)
virtual void CmsShowCommonPopup::CloseWindow ( )
inlinevirtual

Definition at line 33 of file CmsShowCommonPopup.h.

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

Definition at line 277 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().

278 {
279  for (int i = 0 ; i < kFWGeomColorSize; ++i)
280  m_colorSelectWidget[i]->SetColorByIndex(m_common->colorManager()->geomColor(FWGeomColorIndex(i)), kFALSE);
281 
282  int hci, sci;
283  getColorSetColors(hci, sci);
284  //printf("=============== colorSetChanged() dark ? [%d] %d %d \n",m_common->colorManager()->isColorSetDark(), hci, sci);
287 }
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 289 of file CmsShowCommonPopup.cc.

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

Referenced by CmsShowCommonPopup(), and colorSetChanged().

290 {
291  TGLColorSet& colorset = m_common->colorManager()->isColorSetDark() ?
293  {
294  TGLColor& glc = colorset.Selection(3);
295  hci = TColor::GetColor(glc.GetRed(), glc.GetGreen(), glc.GetBlue());
296  // printf("getSHcolors HIGH %d %d %d , [%d]\n", glc.GetRed(), glc.GetGreen(), glc.GetBlue(), hci);
297  }
298  {
299  TGLColor& glc = colorset.Selection(1);
300  sci = TColor::GetColor(glc.GetRed(), glc.GetGreen(), glc.GetBlue());
301  // printf("getSHcolors SEL %d %d %d , [%d]\n", glc.GetRed(), glc.GetGreen(), glc.GetBlue(), sci);
302  }
303 }
TGLColorSet m_lightColorSet
Definition: CmsShowCommon.h:96
const FWColorManager * colorManager() const
Bool_t isColorSetDark() const
CmsShowCommon * m_common
globcontrol glc
Definition: vlib.cc:6
TGLColorSet m_darkColorSet
Definition: CmsShowCommon.h:97
void CmsShowCommonPopup::makeSetter ( TGCompositeFrame *  frame,
FWParameterBase param 
)
private

Definition at line 306 of file CmsShowCommonPopup.cc.

References m_setters, and FWParameterSetterBase::makeSetterFor().

Referenced by CmsShowCommonPopup().

307 {
308  boost::shared_ptr<FWParameterSetterBase> ptr( FWParameterSetterBase::makeSetterFor(param) );
309  ptr->attach(param, this);
310 
311  TGFrame* pframe = ptr->build(frame);
312  frame->AddFrame(pframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 2,2));
313 
314  m_setters.push_back(ptr);
315 }
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 229 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::switchBackground().

230 {
232 }
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().