16 #include <TCollection.h>
17 #include <TApplication.h>
18 #include <TEveWindow.h>
26 #include <TGStatusBar.h>
27 #include <KeySymbols.h>
32 #include <TVirtualX.h>
68 FWPack(
const TGWindow *
w) : TGPack(w, 100, 100) {}
76 : TGMainFrame(p, w, h),
85 const unsigned int backgroundColor = 0x2f2f2f;
86 const unsigned int textColor = 0xb3b3b3;
87 gClient->SetStyle(
"classic");
148 previousEvent->
setToolTip(
"Goto previous event");
151 playEventsBack->
setToolTip(
"Play events backwards");
153 TGCompositeFrame *menuTopFrame =
new TGCompositeFrame(
this, 1, 1, kHorizontalFrame, backgroundColor);
155 TGMenuBar *menuBar =
new TGMenuBar(menuTopFrame, this->GetWidth(), 28, kHorizontalFrame);
157 TGPopupMenu *fileMenu =
new TGPopupMenu(gClient->GetRoot());
158 menuBar->AddPopup(
"File", fileMenu,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
165 fileMenu->AddSeparator();
170 TGPopupMenu *partialSaveMenu =
new TGPopupMenu(gClient->GetRoot());
171 fileMenu->AddPopup(
"Advanced Configuration", partialSaveMenu);
176 fileMenu->AddSeparator();
180 fileMenu->AddSeparator();
193 TGPopupMenu *editMenu =
new TGPopupMenu(gClient->GetRoot());
194 menuBar->AddPopup(
"Edit", editMenu,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
200 editMenu->AddSeparator();
206 editMenu->AddSeparator();
215 TGPopupMenu *viewMenu =
new TGPopupMenu(gClient->GetRoot());
216 menuBar->AddPopup(
"View", viewMenu,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
221 viewMenu->AddSeparator();
232 playEventsBack->
createShortcut(kKey_Space,
"CTRL+SHIFT", GetId());
235 TGPopupMenu *windowMenu =
new TGPopupMenu(gClient->GetRoot());
236 menuBar->AddPopup(
"Window", windowMenu,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
246 TGPopupMenu *helpMenu =
new TGPopupMenu(gClient->GetRoot());
247 menuBar->AddPopup(
"Help", helpMenu,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
250 helpMenu->AddSeparator();
254 menuBar->SetBackgroundColor(backgroundColor);
255 TIter
next(menuBar->GetTitles());
257 while ((title = (TGMenuTitle *)
next()))
258 title->SetTextColor(textColor);
260 menuTopFrame->AddFrame(menuBar,
new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
262 AddFrame(menuTopFrame,
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
266 AddFrame(
new TGFrame(
this, 1, 1, kChildFrame, 0x503020),
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
268 m_statBar =
new TGStatusBar(
this, this->GetWidth(), 12);
269 AddFrame(
m_statBar,
new TGLayoutHints(kLHintsBottom | kLHintsExpandX));
271 TGHorizontalFrame *fullbar =
new TGHorizontalFrame(
this, this->GetWidth(), 30, 0, backgroundColor);
276 TGCompositeFrame *controlFrame =
new TGVerticalFrame(fullbar, 10, 20, 0, backgroundColor);
278 TGCompositeFrame *buttonFrame =
new TGHorizontalFrame(controlFrame, 10, 10, 0, backgroundColor);
280 buttonFrame->SetBackgroundPixmap(imgBtn->GetPixmap());
287 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 3, 10, 0));
296 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 3, 10, 0));
303 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 3, 10, 0));
310 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 3, 10, 0));
319 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 3, 10, 0));
325 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 3, 10, 0));
327 controlFrame->AddFrame(buttonFrame,
new TGLayoutHints(kLHintsTop, 10, 0, 0, 0));
331 TGHorizontalFrame *sliderFrame =
new TGHorizontalFrame(controlFrame, 10, 10, 0, backgroundColor);
333 sliderFrame->SetBackgroundPixmap(imgSld->GetPixmap());
336 m_delaySlider =
new TGHSlider(sliderFrame, 109, kSlider1 | kScaleNo);
337 sliderFrame->AddFrame(
m_delaySlider,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 39, 8, 1, 3));
343 controlFrame->AddFrame(sliderFrame,
new TGLayoutHints(kLHintsTop, 10, 0, 0, 0));
345 fullbar->AddFrame(controlFrame,
new TGLayoutHints(kLHintsLeft, 2, 2, 5, 8));
355 TGVerticalFrame *delayFrame =
new TGVerticalFrame(fullbar, 60, 10, 0, backgroundColor);
357 TGLabel *
label =
new TGLabel(delayFrame,
"Delay");
358 label->SetTextJustify(kTextCenterX);
359 label->SetTextColor(0xb3b3b3);
360 label->SetBackgroundColor(backgroundColor);
361 delayFrame->AddFrame(label,
new TGLayoutHints(kLHintsTop | kLHintsCenterX, 0, 0, 22, 0));
363 TGHorizontalFrame *labFixed =
new TGHorizontalFrame(delayFrame, 70, 20, kFixedSize, backgroundColor);
368 labFixed->AddFrame(
m_delayLabel,
new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 0, 0, 0, 0));
369 delayFrame->AddFrame(labFixed,
new TGLayoutHints(kLHintsLeft, 0, 4, 0, 0));
371 fullbar->AddFrame(delayFrame,
new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
378 Int_t entryHeight = 22;
379 TGVerticalFrame *texts =
new TGVerticalFrame(fullbar, 400, 10, 0, backgroundColor);
383 TGPack *
runInfo =
new TGPack(texts, 400, entryHeight, kFixedHeight);
384 runInfo->SetVertical(kFALSE);
385 runInfo->SetUseSplitters(kFALSE);
386 runInfo->SetBackgroundColor(backgroundColor);
388 TGHorizontalFrame *rLeft =
new TGHorizontalFrame(runInfo, 1, entryHeight);
391 rLeft->AddFrame(
m_runEntry,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0, 8, 0, 0));
392 runInfo->AddFrameWithWeight(rLeft,
nullptr, 0.28);
394 TGHorizontalFrame *rMid =
new TGHorizontalFrame(runInfo, 1, entryHeight);
397 rMid->AddFrame(
m_lumiEntry,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0, 8, 0, 0));
398 runInfo->AddFrameWithWeight(rMid,
nullptr, 0.32);
400 TGHorizontalFrame *rRight =
new TGHorizontalFrame(runInfo, 1, entryHeight);
403 rRight->AddFrame(
m_eventEntry,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0));
404 runInfo->AddFrameWithWeight(rRight,
nullptr, 0.4);
406 texts->AddFrame(runInfo,
new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 0, 4));
411 TGHorizontalFrame *filterFrame =
new TGHorizontalFrame(texts, 400, entryHeight, 0, backgroundColor);
431 filterFrame->AddFrame(
m_filterEnableBtn,
new TGLayoutHints(kLHintsLeft, 4, 0, 3, 0));
438 filterFrame->AddFrame(
m_filterShowGUIBtn,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 6, 7, 0, 0));
440 texts->AddFrame(filterFrame,
new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 4, 0));
443 fullbar->AddFrame(texts,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5, 5, 12, 0));
447 TGVerticalFrame *texts2 =
new TGVerticalFrame(fullbar, 200, 44, kFixedSize, backgroundColor);
453 m_timeText->SetBackgroundColor(backgroundColor);
454 texts2->AddFrame(
m_timeText,
new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 0, 1));
456 fullbar->AddFrame(texts2,
new TGLayoutHints(kLHintsLeft, 5, 5, 16, 5));
462 TGVerticalFrame *parentLogoFrame =
new TGVerticalFrame(fullbar, 70, 53, kFixedSize);
463 parentLogoFrame->SetBackgroundColor(backgroundColor);
464 fullbar->AddFrame(parentLogoFrame,
new TGLayoutHints(kLHintsRight | kLHintsCenterY));
466 TGVerticalFrame *logoFrame =
new TGVerticalFrame(parentLogoFrame, 53, 53, kFixedSize);
468 logoFrame->SetBackgroundPixmap(logoImg->GetPixmap());
469 parentLogoFrame->AddFrame(logoFrame,
new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 14, 0, 0));
472 TGCompositeFrame *logoFrame =
new TGCompositeFrame(
this, 61, 23, kFixedSize | kHorizontalFrame, backgroundColor);
479 logoFrame->AddFrame(infoBut);
480 infoBut->Connect(
"Clicked()",
"CmsShowMainFrame",
this,
"showFWorksInfo()");
483 menuTopFrame->AddFrame(logoFrame,
new TGLayoutHints(kLHintsRight | kLHintsBottom, 0, 13, 3, 1));
488 AddFrame(fullbar,
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
511 csArea->SetVertical(kFALSE);
514 csArea->AddFrameWithWeight(cf,
nullptr, 20);
516 TEveCompositeFrameInPack *slot =
new TEveCompositeFrameInPack(csArea,
nullptr, csArea);
517 csArea->AddFrameWithWeight(slot,
nullptr, 80);
518 TEveWindowSlot *ew_slot = TEveWindow::CreateDefaultWindowSlot();
519 ew_slot->PopulateEmptyFrame(slot);
522 AddFrame(csArea,
new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 2));
523 csArea->MapSubwindows();
525 SetWindowName(
"cmsShow");
650 gApplication->Terminate(0);
659 if (event->fType == kGKeyPress) {
661 std::vector<CSGAction *>::const_iterator it_act;
664 for (it_act = alist.begin(); it_act != alist.end(); ++it_act) {
665 keycode = (*it_act)->getKeycode();
666 modcode = (*it_act)->getModcode();
667 if ((event->fCode == (UInt_t)keycode) &&
668 ((event->fState == (UInt_t)modcode) || (event->fState == (UInt_t)(modcode | kKeyMod2Mask)) ||
669 (event->fState == (UInt_t)(modcode | kKeyLockMask)) ||
670 (event->fState == (UInt_t)(modcode | kKeyMod2Mask | kKeyLockMask)))) {
671 (*it_act)->activated.emit();
678 static UInt_t spacecode = gVirtualX->KeysymToKeycode((
int)kKey_Space);
679 if (event->fCode == spacecode && event->fState == 0) {
696 TGHorizontalFrame *
p,
const char *txt, UInt_t bgCol, UInt_t txtCol, Int_t width, Int_t height) {
699 p->SetBackgroundColor(bgCol);
700 TGCompositeFrame *lframe =
new TGHorizontalFrame(p, width, height, kFixedSize, bgCol);
701 TGLabel *
label =
new TGLabel(lframe, txt);
702 label->SetBackgroundColor(bgCol);
703 label->SetTextColor(txtCol);
704 lframe->AddFrame(label,
new TGLayoutHints(kLHintsRight | kLHintsTop, 0, 4));
705 p->AddFrame(lframe,
new TGLayoutHints(kLHintsLeft, 0, 0, 3, 0));
710 InfoFrame(
const TGWindow *
p, UInt_t
w, UInt_t
h, UInt_t
opts) : TGMainFrame(p, w, h, opts) {}
718 UInt_t ww = 280,
hh = 190;
719 int number_of_lines = 0;
722 if (gSystem->Getenv(
"CMSSW_VERSION")) {
723 infoText =
"Version ";
724 infoText += gSystem->Getenv(
"CMSSW_VERSION");
726 number_of_lines += 1;
728 TString infoFileName(
"/data/version.txt");
731 std::ifstream infoFile(infoFileName);
732 while (std::getline(infoFile, line)) {
734 infoText += line.c_str();
739 infoText +=
"\nIt works or we fix it for free!\nhn-cms-visualization@cern.ch\n";
741 hh = 130 + 2 * fontSize * (number_of_lines + 1);
744 m_fworksAbout->SetWMSizeHints(ww, hh, ww, hh, 0, 0);
745 m_fworksAbout->SetBackgroundColor(0x2f2f2f);
747 TGFrame *logoFrame =
new TGFrame(m_fworksAbout, 140, 48, kFixedSize);
749 logoFrame->SetBackgroundPixmap(logoImg->GetPixmap());
750 m_fworksAbout->AddFrame(logoFrame,
new TGLayoutHints(kLHintsTop | kLHintsCenterX, 0, 0, 16, 0));
752 TGLabel *
label =
new TGLabel(m_fworksAbout, infoText);
753 label->SetBackgroundColor(0x2f2f2f);
754 label->SetForegroundColor(0xffffff);
756 FontStruct_t defaultFontStruct = label->GetDefaultFontStruct();
758 TGFontPool *
pool = gClient->GetFontPool();
759 TGFont *defaultFont = pool->GetFont(defaultFontStruct);
760 FontAttributes_t attributes = defaultFont->GetFontAttributes();
761 label->SetTextFont(pool->GetFont(attributes.fFamily, fontSize, attributes.fWeight, attributes.fSlant));
765 m_fworksAbout->AddFrame(label,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 12, 0));
767 TGTextButton *btn =
new TGTextButton(m_fworksAbout,
" OK ");
768 btn->SetBackgroundColor(0x2f2f2f);
769 btn->SetForegroundColor(0xffffff);
770 m_fworksAbout->AddFrame(btn,
new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 0, 12));
771 btn->Connect(
"Clicked()",
"TGMainFrame", m_fworksAbout,
"CloseWindow()");
773 m_fworksAbout->MapSubwindows();
774 m_fworksAbout->Layout();
782 if ((*i)->getKeycode())
783 f->BindKey(
this, (*i)->getKeycode(), (*i)->getModcode());
788 TGFrameElement *fe = (TGFrameElement *)GetList()->Last();
791 TGFrameElementPack *fep;
792 fep = (TGFrameElementPack *)pack->GetList()->At(1);
795 fep = (TGFrameElementPack *)pack->GetList()->At(3);
796 fep->fWeight = 100 -
x;
798 pack->ResizeExistingFrames();
803 TGFrameElement *fe = (TGFrameElement *)GetList()->Last();
804 TGPack *
pack = (TGPack *)(fe->fFrame);
806 TGFrameElementPack *fep = (TGFrameElementPack *)pack->GetList()->At(1);
const std::string sKeyboardShort
TGVerticalFrame * createList(TGCompositeFrame *p)
static const TString & coreIcondir()
const std::string sSavePartialConfig
void CloseWindow() override
FWNumberEntryField * m_lumiEntry
EventNumber_t event() const
void bindCSGActionKeys(const TGMainFrame *f) const
const std::string sShowCommonInsp
virtual void SetUIntNumber(UInt_t n)
FWPack(const TGWindow *w)
InfoFrame(const TGWindow *p, UInt_t w, UInt_t h, UInt_t opts)
const std::string sSavePartialConfigAs
void loadEvent(const edm::EventBase &event)
CSGContinuousAction * playEventsBackwardsAction() const
void createViews(TEveWindowSlot *slot)
virtual void enableActions(bool enable=true)
~CmsShowMainFrame() override
void HandleMenu(Int_t id) override
const std::string sBackgroundColor
const std::string sPlayEvents
FWCustomIconsButton * m_filterEnableBtn
void enableNext(bool enable=true)
const std::string sOpenData
FWIntValueListener * m_delaySliderListener
void enableNavigatorControls()
LuminosityBlockNumber_t luminosityBlock() const
void createCustomIconsButton(TGCompositeFrame *p, const TGPicture *upPic, const TGPicture *downPic, const TGPicture *disabledPic, const TGPicture *upRunningPic, const TGPicture *downRunningPic, TGLayoutHints *l=nullptr, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=0)
const std::string sSaveConfigAs
CSGContinuousAction * m_playEventsBack
const std::string sNextEvent
const std::string sSaveConfig
Bool_t HandleKey(Event_t *event) override
const TGPicture * m_filterIcons[9]
std::vector< CSGAction * > m_actionList
virtual void SetULong64Number(ULong64_t n)
const std::string sAppendData
void setToolTip(const std::string &tip)
virtual Bool_t isEnabled() const
CSGContinuousAction * m_loopAction
TGMainFrame * m_fworksAbout
CSGAction * createNewViewerAction(const std::string &iActionName, bool seaprator)
void CloseWindow() override
FWNumberEntryField * m_eventEntry
void updateStatusBar(const char *status)
uint16_t const *__restrict__ x
const std::string sShowAddCollection
const std::string sGotoLastEvent
TGPopupMenu * m_newViewerMenu
const std::string sExportImage
const std::string sAutoRewind
void createMenuEntry(TGPopupMenu *menu)
const std::string sShowMainViewCtl
FWNumberEntryField * m_runEntry
const std::string sPlayEventsBack
CSGAction * getAction(const std::string &name)
void enableActions(bool enable=true) override
const std::string sShowObjInsp
CSGAction * m_previousEvent
const std::string sGotoFirstEvent
CmsShowMainFrame(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, FWGUIManager *m=nullptr)
const std::string sShowInvMassDialog
void setSummaryViewWeight(float)
const std::string sShowEventDisplayInsp
void enablePrevious(bool enable=true)
const std::string sPreviousEvent
CSGContinuousAction * m_playEvents
std::string getLocalTime(const edm::EventBase &event)
float getSummaryViewWeight() const
const std::vector< CSGAction * > & getListOfActions() const
const std::string sLoadConfig
sigc::signal< void()> activated
FWCustomIconsButton * createCustomIconsButton(TGCompositeFrame *p, const TGPicture *upPic, const TGPicture *downPic, const TGPicture *disabledPic, TGLayoutHints *l=nullptr, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=0)
static std::string const separator(":")
void makeFixedSizeLabel(TGHorizontalFrame *p, const char *txt, UInt_t bgCol, UInt_t txtCol, Int_t width, Int_t height)
void createShortcut(UInt_t key, const char *mod, int windowID)
const std::string sExportAllImages
void enableComplexNavigation(bool enable=true)
TGTextButton * m_filterShowGUIBtn
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const std::string sHelpGL
void setPlayDelayGUI(Float_t val, Bool_t sliderChanged)
const std::string sLoadPartialConfig
CSGContinuousAction * playEventsAction() const
const std::string sSearchFiles