#include <CmsShowCommonPopup.h>
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 () |
Private Member Functions | |
CmsShowCommonPopup (const CmsShowCommonPopup &) | |
void | makeSetter (TGCompositeFrame *frame, FWParameterBase *param) |
const CmsShowCommonPopup & | operator= (const CmsShowCommonPopup &) |
Private Attributes | |
TGTextButton * | m_backgroundButton |
FWColorSelect * | m_colorSelectWidget [kFWGeomColorSize] |
CmsShowCommon * | m_common |
TGTextButton * | m_gammaButton |
TGHSlider * | m_gammaSlider |
std::vector< boost::shared_ptr < FWParameterSetterBase > > | m_setters |
Definition at line 24 of file CmsShowCommonPopup.h.
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().
: TGTransientFrame(gClient->GetDefaultRoot(),p,w,h), m_common(model), m_backgroundButton(0), m_gammaSlider(0), m_gammaButton(0) { SetCleanup(kDeepCleanup); TGGC *fTextGC; const TGFont *font = gClient->GetFont("-adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-iso8859-1"); if (!font) font = gClient->GetResourcePool()->GetDefaultFont(); GCValues_t gval; gval.fMask = kGCBackground | kGCFont | kGCForeground; gval.fFont = font->GetFontHandle(); fTextGC = gClient->GetGC(&gval, kTRUE); TGCompositeFrame* vf2 = new TGVerticalFrame(this); AddFrame(vf2, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2)); //============================================================================== // scales // { TGLabel* xx = new TGLabel(vf2, "GlobalScales ", fTextGC->GetGC()); vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft ,2,2,4,4)); } FWViewEnergyScaleEditor* scaleEditor = new FWViewEnergyScaleEditor(m_common->m_energyScale.get(), vf2); vf2->AddFrame(scaleEditor); //============================================================================== // Projections // vf2->AddFrame(new TGHorizontal3DLine(vf2), new TGLayoutHints(kLHintsExpandX,4 ,8, 3, 3)); { TGLabel* xx = new TGLabel(vf2, "Projections ", fTextGC->GetGC()); vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft ,2,2,4,4)); } vf2->AddFrame(new TGLabel(vf2, "Track behaviour when crossing y=0 in RhoZ-view:"), new TGLayoutHints(kLHintsLeft ,2,2,0,0)); makeSetter(vf2, &m_common->m_trackBreak); makeSetter(vf2, &m_common->m_drawBreakPoints); //============================================================================== // brigtness // vf2->AddFrame(new TGHorizontal3DLine(vf2), new TGLayoutHints(kLHintsExpandX ,4 ,8, 8, 2)); { TGLabel* xx = new TGLabel(vf2, "General Colors ", fTextGC->GetGC()); vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft,2,2,4,4)); } m_backgroundButton = new TGTextButton(vf2, "Black/White Background"); vf2->AddFrame(m_backgroundButton); makeSetter(vf2, &m_common->m_gamma); //============================================================================== // geom colors // { TGLabel* xx = new TGLabel(vf2, "DetectorColors ", fTextGC->GetGC()); vf2->AddFrame(xx, new TGLayoutHints(kLHintsLeft,2,2,8,0)); } TGFont* smallFont = 0; FontStruct_t defaultFontStruct = m_backgroundButton->GetDefaultFontStruct(); try { TGFontPool *pool = gClient->GetFontPool(); TGFont* defaultFont = pool->GetFont(defaultFontStruct); FontAttributes_t attributes = defaultFont->GetFontAttributes(); smallFont = pool->GetFont(attributes.fFamily, 8, attributes.fWeight, attributes.fSlant); } catch(...) { // Ignore exceptions. } TGHSlider* transpWidget2D = 0; TGHSlider* transpWidget3D = 0; TGCompositeFrame* top = new TGVerticalFrame(vf2); vf2->AddFrame(top, new TGLayoutHints(kLHintsNormal, 2, 2, 2, 0)); { TGHorizontalFrame* hf = new TGHorizontalFrame(top); hf->AddFrame(new TGLabel(hf, "Tansparency 2D:"), new TGLayoutHints(kLHintsBottom, 2, 2, 3, 3)); transpWidget2D = new TGHSlider(hf, 100, kSlider1); hf->AddFrame( transpWidget2D); top->AddFrame(hf,new TGLayoutHints( kLHintsNormal, 0, 0, 2, 2)); } { TGHorizontalFrame* hf = new TGHorizontalFrame(top); hf->AddFrame(new TGLabel(hf, "Tansparency 3D:") , new TGLayoutHints(kLHintsBottom,2, 2, 2, 2 )); transpWidget3D = new TGHSlider(hf, 100, kSlider1); hf->AddFrame( transpWidget3D); top->AddFrame(hf, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 10)); } std::string names[kFWGeomColorSize]; names[kFWPixelBarrelColorIndex ] = "Pixel Barrel"; names[kFWPixelEndcapColorIndex ] = "Pixel Endcap" ; names[kFWTrackerBarrelColorIndex ] = "Tracker Barrel"; names[kFWTrackerEndcapColorIndex ] = "Tracker Endcap"; names[kFWMuonBarrelLineColorIndex] = "Muon Barrel"; names[kFWMuonEndcapLineColorIndex] = "Muon Endcap"; int i = 0; for (int k = 0; k < 3; ++k) { TGHorizontalFrame* hf = new TGHorizontalFrame(top); top->AddFrame(hf); for (int j = 0 ; j < 2; ++j) { m_colorSelectWidget[i] = new FWColorSelect(hf, names[i].c_str(), 0, m_common->colorManager(), i); hf->AddFrame(m_colorSelectWidget[i]); m_colorSelectWidget[i]->SetColorByIndex(m_common->colorManager()->geomColor(FWGeomColorIndex(i)) ,kFALSE); m_colorSelectWidget[i]->Connect("ColorChosen(Color_t)", "CmsShowCommonPopup", this, "changeGeomColor(Color_t)"); TGFrame* lf = new TGHorizontalFrame(hf, 100, 16, kFixedSize); TGLabel* label = new TGLabel(lf, m_colorSelectWidget[i]->label().c_str()); label->SetTextFont(smallFont); hf->AddFrame(lf, new TGLayoutHints(kLHintsLeft |kLHintsCenterY , 0, 0, 0,0)); ++i; } } //============================================================================== m_backgroundButton->Connect("Clicked()", "CmsShowCommonPopup", this, "switchBackground()"); transpWidget2D->SetRange(0, 100); transpWidget2D->SetPosition(m_common->colorManager()->geomTransparency(true)); transpWidget2D->Connect("PositionChanged(Int_t)", "CmsShowCommonPopup", this, "changeGeomTransparency2D(Int_t)"); transpWidget3D->SetRange(0, 100); transpWidget3D->SetPosition(m_common->colorManager()->geomTransparency(false)); transpWidget3D->Connect("PositionChanged(Int_t)", "CmsShowCommonPopup", this, "changeGeomTransparency3D(Int_t)"); SetWindowName("Common Preferences"); MapSubwindows(); Resize(GetDefaultSize()); Layout(); CenterOnParent(kTRUE, TGTransientFrame::kTopRight); }
CmsShowCommonPopup::~CmsShowCommonPopup | ( | ) | [virtual] |
Definition at line 166 of file CmsShowCommonPopup.cc.
{ }
CmsShowCommonPopup::CmsShowCommonPopup | ( | const CmsShowCommonPopup & | ) | [private] |
void CmsShowCommonPopup::changeGeomColor | ( | Color_t | iColor | ) |
Definition at line 178 of file CmsShowCommonPopup.cc.
References m_common, and CmsShowCommon::setGeomColor().
{ TGColorSelect *cs = (TGColorSelect *) gTQSender; FWGeomColorIndex cidx = FWGeomColorIndex(cs->WidgetId()); m_common->setGeomColor(cidx, iColor); }
void CmsShowCommonPopup::changeGeomTransparency2D | ( | int | iTransp | ) |
Definition at line 186 of file CmsShowCommonPopup.cc.
References m_common, and CmsShowCommon::setGeomTransparency().
{ m_common->setGeomTransparency(iTransp, true); }
void CmsShowCommonPopup::changeGeomTransparency3D | ( | int | iTransp | ) |
Definition at line 192 of file CmsShowCommonPopup.cc.
References m_common, and CmsShowCommon::setGeomTransparency().
{ m_common->setGeomTransparency(iTransp, false); }
CmsShowCommonPopup::ClassDef | ( | CmsShowCommonPopup | , |
0 | |||
) |
virtual void CmsShowCommonPopup::CloseWindow | ( | ) | [inline, virtual] |
Definition at line 32 of file CmsShowCommonPopup.h.
{ 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().
{ for (int i = 0 ; i < kFWGeomColorSize; ++i) m_colorSelectWidget[i]->SetColorByIndex(m_common->colorManager()->geomColor(FWGeomColorIndex(i)), kFALSE); }
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().
{ boost::shared_ptr<FWParameterSetterBase> ptr( FWParameterSetterBase::makeSetterFor(param) ); ptr->attach(param, this); TGFrame* pframe = ptr->build(frame); frame->AddFrame(pframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 2,2)); m_setters.push_back(ptr); }
const CmsShowCommonPopup& CmsShowCommonPopup::operator= | ( | const CmsShowCommonPopup & | ) | [private] |
void CmsShowCommonPopup::switchBackground | ( | ) |
Definition at line 171 of file CmsShowCommonPopup.cc.
References m_common, and CmsShowCommon::switchBackground().
{ m_common->switchBackground(); }
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] |
Definition at line 49 of file CmsShowCommonPopup.h.
Referenced by changeGeomColor(), changeGeomTransparency2D(), changeGeomTransparency3D(), CmsShowCommonPopup(), colorSetChanged(), and switchBackground().
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().