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)
 
 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 makeSetter (TGCompositeFrame *frame, FWParameterBase *param)
 
const CmsShowCommonPopupoperator= (const CmsShowCommonPopup &)
 

Private Attributes

TGTextButton * m_backgroundButton
 
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 21 of file CmsShowCommonPopup.cc.

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

21  :
22  TGTransientFrame(gClient->GetDefaultRoot(),p,w,h),
23  m_common(model),
25  m_gammaSlider(0),
26  m_gammaButton(0)
27 {
28  SetCleanup(kDeepCleanup);
29 
30  TGGC *fTextGC;
31  const TGFont *font = gClient->GetFont("-adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-iso8859-1");
32  if (!font)
33  font = gClient->GetResourcePool()->GetDefaultFont();
34  GCValues_t gval;
35  gval.fMask = kGCBackground | kGCFont | kGCForeground;
36  gval.fFont = font->GetFontHandle();
37  fTextGC = gClient->GetGC(&gval, kTRUE);
38 
39  TGCompositeFrame* vf2 = new TGVerticalFrame(this);
40  AddFrame(vf2, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
41  //==============================================================================
42  // scales
43  //
44  {
45  TGLabel* xx = new TGLabel(vf2, "GlobalScales ", fTextGC->GetGC());
46  vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft ,2,2,4,4));
47  }
49  vf2->AddFrame(scaleEditor);
50  //==============================================================================
51  // Projections
52  //
53  vf2->AddFrame(new TGHorizontal3DLine(vf2), new TGLayoutHints(kLHintsExpandX,4 ,8, 3, 3));
54  {
55  TGLabel* xx = new TGLabel(vf2, "Projections ", fTextGC->GetGC());
56  vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft ,2,2,4,4));
57  }
58  vf2->AddFrame(new TGLabel(vf2, "Track behaviour when crossing y=0 in RhoZ-view:"), new TGLayoutHints(kLHintsLeft ,2,2,0,0));
61 
62  //==============================================================================
63  // brigtness
64  //
65 
66  vf2->AddFrame(new TGHorizontal3DLine(vf2), new TGLayoutHints(kLHintsExpandX ,4 ,8, 8, 2));
67  {
68  TGLabel* xx = new TGLabel(vf2, "General Colors ", fTextGC->GetGC());
69  vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft,2,2,4,4));
70  }
71  m_backgroundButton = new TGTextButton(vf2, "Black/White Background");
72  vf2->AddFrame(m_backgroundButton);
73  makeSetter(vf2, &m_common->m_gamma);
74 
75 
76  //==============================================================================
77  // geom colors
78  //
79 
80  {
81  TGLabel* xx = new TGLabel(vf2, "DetectorColors ", fTextGC->GetGC());
82  vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft,2,2,8,0));
83  }
84 
85  TGFont* smallFont = 0;
86  FontStruct_t defaultFontStruct = m_backgroundButton->GetDefaultFontStruct();
87  try
88  {
89  TGFontPool *pool = gClient->GetFontPool();
90  TGFont* defaultFont = pool->GetFont(defaultFontStruct);
91  FontAttributes_t attributes = defaultFont->GetFontAttributes();
92  smallFont = pool->GetFont(attributes.fFamily, 8, attributes.fWeight, attributes.fSlant);
93  }
94  catch(...)
95  {
96  // Ignore exceptions.
97  }
98 
99 
100  TGHSlider* transpWidget2D = 0;
101  TGHSlider* transpWidget3D = 0;
102  TGCompositeFrame* top = new TGVerticalFrame(vf2);
103  vf2->AddFrame(top, new TGLayoutHints(kLHintsNormal, 2, 2, 2, 0));
104 
105  {
106  TGHorizontalFrame* hf = new TGHorizontalFrame(top);
107  hf->AddFrame(new TGLabel(hf, "Tansparency 2D:"), new TGLayoutHints(kLHintsBottom, 2, 2, 3, 3));
108  transpWidget2D = new TGHSlider(hf, 100, kSlider1);
109  hf->AddFrame( transpWidget2D);
110  top->AddFrame(hf,new TGLayoutHints( kLHintsNormal, 0, 0, 2, 2));
111  }
112  {
113  TGHorizontalFrame* hf = new TGHorizontalFrame(top);
114  hf->AddFrame(new TGLabel(hf, "Tansparency 3D:") , new TGLayoutHints(kLHintsBottom,2, 2, 2, 2 ));
115  transpWidget3D = new TGHSlider(hf, 100, kSlider1);
116  hf->AddFrame( transpWidget3D);
117  top->AddFrame(hf, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 10));
118  }
119  std::string names[kFWGeomColorSize];
120  names[kFWPixelBarrelColorIndex ] = "Pixel Barrel";
121  names[kFWPixelEndcapColorIndex ] = "Pixel Endcap" ;
122  names[kFWTrackerBarrelColorIndex ] = "Tracker Barrel";
123  names[kFWTrackerEndcapColorIndex ] = "Tracker Endcap";
124  names[kFWMuonBarrelLineColorIndex] = "Muon Barrel";
125  names[kFWMuonEndcapLineColorIndex] = "Muon Endcap";
126  int i = 0;
127  for (int k = 0; k < 3; ++k)
128  {
129  TGHorizontalFrame* hf = new TGHorizontalFrame(top);
130  top->AddFrame(hf);
131 
132  for (int j = 0 ; j < 2; ++j)
133  {
134  m_colorSelectWidget[i] = new FWColorSelect(hf, names[i].c_str(), 0, m_common->colorManager(), i);
135  hf->AddFrame(m_colorSelectWidget[i]);
137  m_colorSelectWidget[i]->Connect("ColorChosen(Color_t)", "CmsShowCommonPopup", this, "changeGeomColor(Color_t)");
138 
139  TGFrame* lf = new TGHorizontalFrame(hf, 100, 16, kFixedSize);
140  TGLabel* label = new TGLabel(lf, m_colorSelectWidget[i]->label().c_str());
141  label->SetTextFont(smallFont);
142  hf->AddFrame(lf, new TGLayoutHints(kLHintsLeft |kLHintsCenterY , 0, 0, 0,0));
143 
144  ++i;
145  }
146  }
147  //==============================================================================
148 
149  m_backgroundButton->Connect("Clicked()", "CmsShowCommonPopup", this, "switchBackground()");
150 
151  transpWidget2D->SetRange(0, 100);
152  transpWidget2D->SetPosition(m_common->colorManager()->geomTransparency(true));
153  transpWidget2D->Connect("PositionChanged(Int_t)", "CmsShowCommonPopup", this, "changeGeomTransparency2D(Int_t)");
154 
155  transpWidget3D->SetRange(0, 100);
156  transpWidget3D->SetPosition(m_common->colorManager()->geomTransparency(false));
157  transpWidget3D->Connect("PositionChanged(Int_t)", "CmsShowCommonPopup", this, "changeGeomTransparency3D(Int_t)");
158 
159  SetWindowName("Common Preferences");
160  MapSubwindows();
161  Resize(GetDefaultSize());
162  Layout();
163  CenterOnParent(kTRUE, TGTransientFrame::kTopRight);
164 }
int i
Definition: DBlmapReader.cc:9
FWColorSelect * m_colorSelectWidget[kFWGeomColorSize]
const std::string & label
Definition: MVAComputer.cc:186
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
int j
Definition: DBlmapReader.cc:9
CmsShowCommon * m_common
int k[5][pyjets_maxn]
std::auto_ptr< FWViewEnergyScale > m_energyScale
Definition: CmsShowCommon.h:94
FWEnumParameter m_trackBreak
Definition: CmsShowCommon.h:81
Color_t geomColor(FWGeomColorIndex) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static const HistoName names[]
CmsShowCommonPopup::~CmsShowCommonPopup ( )
virtual

Definition at line 166 of file CmsShowCommonPopup.cc.

167 {
168 }
CmsShowCommonPopup::CmsShowCommonPopup ( const CmsShowCommonPopup )
private

Member Function Documentation

void CmsShowCommonPopup::changeGeomColor ( Color_t  iColor)

Definition at line 178 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::setGeomColor().

179 {
180  TGColorSelect *cs = (TGColorSelect *) gTQSender;
181  FWGeomColorIndex cidx = FWGeomColorIndex(cs->WidgetId());
182  m_common->setGeomColor(cidx, iColor);
183 }
FWGeomColorIndex
CmsShowCommon * m_common
void setGeomColor(FWGeomColorIndex, Color_t)
void CmsShowCommonPopup::changeGeomTransparency2D ( int  iTransp)

Definition at line 186 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::setGeomTransparency().

187 {
188  m_common->setGeomTransparency(iTransp, true);
189 }
void setGeomTransparency(int val, bool projected)
CmsShowCommon * m_common
void CmsShowCommonPopup::changeGeomTransparency3D ( int  iTransp)

Definition at line 192 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::setGeomTransparency().

193 {
194  m_common->setGeomTransparency(iTransp, false);
195 }
void setGeomTransparency(int val, bool projected)
CmsShowCommon * m_common
CmsShowCommonPopup::ClassDef ( CmsShowCommonPopup  ,
 
)
virtual void CmsShowCommonPopup::CloseWindow ( )
inlinevirtual

Definition at line 32 of file CmsShowCommonPopup.h.

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

Definition at line 200 of file CmsShowCommonPopup.cc.

References CmsShowCommon::colorManager(), FWColorManager::geomColor(), i, kFWGeomColorSize, m_colorSelectWidget, and m_common.

Referenced by FWGUIManager::finishUpColorChange().

201 {
202  for (int i = 0 ; i < kFWGeomColorSize; ++i)
203  m_colorSelectWidget[i]->SetColorByIndex(m_common->colorManager()->geomColor(FWGeomColorIndex(i)), kFALSE);
204 
205 }
int i
Definition: DBlmapReader.cc:9
FWColorSelect * m_colorSelectWidget[kFWGeomColorSize]
FWGeomColorIndex
const FWColorManager * colorManager() const
CmsShowCommon * m_common
Color_t geomColor(FWGeomColorIndex) const
void CmsShowCommonPopup::makeSetter ( TGCompositeFrame *  frame,
FWParameterBase param 
)
private

Definition at line 209 of file CmsShowCommonPopup.cc.

References m_setters, and FWParameterSetterBase::makeSetterFor().

Referenced by CmsShowCommonPopup().

210 {
211  boost::shared_ptr<FWParameterSetterBase> ptr( FWParameterSetterBase::makeSetterFor(param) );
212  ptr->attach(param, this);
213 
214  TGFrame* pframe = ptr->build(frame);
215  frame->AddFrame(pframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 2,2));
216 
217  m_setters.push_back(ptr);
218 }
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 171 of file CmsShowCommonPopup.cc.

References m_common, and CmsShowCommon::switchBackground().

172 {
174 }
CmsShowCommon * m_common
void switchBackground()

Member Data Documentation

TGTextButton* CmsShowCommonPopup::m_backgroundButton
private

Definition at line 51 of file CmsShowCommonPopup.h.

Referenced by CmsShowCommonPopup().

FWColorSelect* CmsShowCommonPopup::m_colorSelectWidget[kFWGeomColorSize]
private

Definition at line 56 of file CmsShowCommonPopup.h.

Referenced by CmsShowCommonPopup(), and colorSetChanged().

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

Definition at line 53 of file CmsShowCommonPopup.h.

TGHSlider* CmsShowCommonPopup::m_gammaSlider
private

Definition at line 52 of file CmsShowCommonPopup.h.

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

Definition at line 57 of file CmsShowCommonPopup.h.

Referenced by makeSetter().