CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CmsShowMainFrame.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 // Package: Core
5 // Class : CmsShowMainFrame
6 //
7 // Implementation:
8 // <Notes on implementation>
9 //
10 // Original Author: Chris Jones
11 // Created: Thu May 29 20:58:23 CDT 2008
12 
14 
15 // system include files
16 #include <TCollection.h>
17 #include <TApplication.h>
18 #include <TEveWindow.h>
19 #include <TGClient.h>
20 #include <TGLayout.h>
21 #include <TGButton.h>
22 #include <TGMenu.h>
23 #include <TGLabel.h>
24 #include <TGTab.h>
25 #include <TGPack.h>
26 #include <TGStatusBar.h>
27 #include <KeySymbols.h>
28 #include <TGSlider.h>
29 
30 #include <TSystem.h>
31 #include <TImage.h>
32 // user include files
39 
42 
47 
49 
50 #include <fstream>
51 
52 //
53 // constants, enums and typedefs
54 //
55 
56 //
57 // static data member definitions
58 //
59 
60 
61 // AMT: temprary workaround until TGPack::ResizeExistingFrames() is public
62 class FWPack : public TGPack
63 {
64  friend class CmsShowMainFrame;
65 public:
66  FWPack(const TGWindow* w) : TGPack(w, 100, 100) {}
67  virtual ~FWPack() {}
68 };
69 
70 //
71 // constructors and destructor
72 //
73 CmsShowMainFrame::CmsShowMainFrame(const TGWindow *p,UInt_t w,UInt_t h,FWGUIManager *m) :
74  TGMainFrame(p, w, h),
77  m_runEntry(0),
78  m_lumiEntry(0),
79  m_eventEntry(0),
81  m_manager(m),
82  m_fworksAbout(0)
83 {
84  const unsigned int backgroundColor=0x2f2f2f;
85  const unsigned int textColor= 0xb3b3b3;
86 
87  CSGAction *openData = new CSGAction(this, cmsshow::sOpenData.c_str());
88  CSGAction *appendData = new CSGAction(this, cmsshow::sAppendData.c_str());
89  CSGAction *searchFiles = new CSGAction(this, cmsshow::sSearchFiles.c_str());
90 
91  CSGAction *loadConfig = new CSGAction(this, cmsshow::sLoadConfig.c_str());
92  CSGAction *saveConfig = new CSGAction(this, cmsshow::sSaveConfig.c_str());
93  CSGAction *saveConfigAs = new CSGAction(this, cmsshow::sSaveConfigAs.c_str());
94  CSGAction *exportImage = new CSGAction(this, cmsshow::sExportImage.c_str());
95  CSGAction *exportImages = new CSGAction(this, cmsshow::sExportAllImages.c_str());
96  CSGAction *quit = new CSGAction(this, cmsshow::sQuit.c_str());
97 
98  CSGAction *undo = new CSGAction(this, cmsshow::sUndo.c_str());
99  undo->disable(); //NOTE: All disables happen again later in this routine
100  CSGAction *redo = new CSGAction(this, cmsshow::sRedo.c_str());
101  redo->disable(); //NOTE: All disables happen again later in this routine
102  CSGAction *cut = new CSGAction(this, cmsshow::sCut.c_str());
103  cut->disable(); //NOTE: All disables happen again later in this routine
104  CSGAction *copy = new CSGAction(this, cmsshow::sCopy.c_str());
105  copy->disable(); //NOTE: All disables happen again later in this routine
106  CSGAction *paste = new CSGAction(this, cmsshow::sPaste.c_str());
107  paste->disable();//NOTE: All disables happen again later in this routine
108 
109  CSGAction *goToFirst = new CSGAction(this, cmsshow::sGotoFirstEvent.c_str());
110  CSGAction *goToLast = new CSGAction(this, cmsshow::sGotoLastEvent.c_str());
111 
112  CSGAction *nextEvent = new CSGAction(this, cmsshow::sNextEvent.c_str());
113  CSGAction *previousEvent = new CSGAction(this, cmsshow::sPreviousEvent.c_str());
114 
115  CSGContinuousAction *playEvents = new CSGContinuousAction(this, cmsshow::sPlayEvents.c_str());
116  CSGContinuousAction *playEventsBack = new CSGContinuousAction(this, cmsshow::sPlayEventsBack.c_str());
118 
119  CSGAction *showCommonInsp = new CSGAction(this, cmsshow::sShowCommonInsp.c_str());
120  CSGAction *colorset = new CSGAction(this, cmsshow::sBackgroundColor.c_str());
121 
122  CSGAction *showObjInsp = new CSGAction(this, cmsshow::sShowObjInsp.c_str());
123  CSGAction *showEventDisplayInsp = new CSGAction(this, cmsshow::sShowEventDisplayInsp.c_str());
124  CSGAction *showMainViewCtl = new CSGAction(this, cmsshow::sShowMainViewCtl.c_str());
125  CSGAction *showAddCollection = new CSGAction(this, cmsshow::sShowAddCollection.c_str());
126  CSGAction *showInvMassDialog = new CSGAction(this, cmsshow::sShowInvMassDialog.c_str());
127 
128  CSGAction *help = new CSGAction(this, cmsshow::sHelp.c_str());
129  CSGAction *keyboardShort = new CSGAction(this, cmsshow::sKeyboardShort.c_str());
130  CSGAction *helpGL = new CSGAction(this, cmsshow::sHelpGL.c_str());
131 
132  m_nextEvent = nextEvent;
133  m_previousEvent = previousEvent;
134  m_goToFirst = goToFirst;
135  m_goToLast = goToLast;
136  m_playEvents = playEvents;
137  m_playEventsBack = playEventsBack;
138  m_loopAction = loop;
139 
140  goToFirst->setToolTip("Goto first event");
141  goToLast->setToolTip("Goto last event");
142  previousEvent->setToolTip("Goto previous event");
143  nextEvent->setToolTip("Goto next event");
144  playEvents->setToolTip("Play events");
145  playEventsBack->setToolTip("Play events backwards");
146 
147  TGCompositeFrame *menuTopFrame = new TGCompositeFrame(this, 1, 1, kHorizontalFrame, backgroundColor);
148 
149  TGMenuBar *menuBar = new TGMenuBar(menuTopFrame, this->GetWidth(), 28, kHorizontalFrame);
150 
151  TGPopupMenu *fileMenu = new TGPopupMenu(gClient->GetRoot());
152  menuBar->AddPopup("File", fileMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
153 
154  openData->createMenuEntry(fileMenu);
155  appendData->createMenuEntry(fileMenu);
156  searchFiles->createMenuEntry(fileMenu);
157  //searchFiles->disable();
158  loadConfig->createMenuEntry(fileMenu);
159  saveConfig->createMenuEntry(fileMenu);
160  saveConfigAs->createMenuEntry(fileMenu);
161  fileMenu->AddSeparator();
162 
163  exportImage->createMenuEntry(fileMenu);
164  exportImages->createMenuEntry(fileMenu);
165  fileMenu->AddSeparator();
166 
167  quit->createMenuEntry(fileMenu);
168 
169  openData->createShortcut(kKey_O, "CTRL", GetId());
170  loadConfig->createShortcut(kKey_L, "CTRL", GetId());
171  saveConfig->createShortcut(kKey_S, "CTRL", GetId());
172  saveConfigAs->createShortcut(kKey_S, "CTRL+SHIFT", GetId());
173  exportImage->createShortcut(kKey_P, "CTRL", GetId());
174  exportImages->createShortcut(kKey_P, "CTRL+SHIFT", GetId());
175  quit->createShortcut(kKey_Q, "CTRL", GetId());
176 
177  TGPopupMenu *editMenu = new TGPopupMenu(gClient->GetRoot());
178  menuBar->AddPopup("Edit", editMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
179 
180  showCommonInsp->createMenuEntry(editMenu);
181  showCommonInsp->createShortcut(kKey_A, "CTRL+SHIFT", GetId());
182  colorset->createMenuEntry(editMenu);
183  colorset->createShortcut(kKey_B, "CTRL", GetId());
184  editMenu->AddSeparator();
185 
186  undo->createMenuEntry(editMenu);
187  undo->createShortcut(kKey_Z, "CTRL", GetId());
188  redo->createMenuEntry(editMenu);
189  redo->createShortcut(kKey_Z, "CTRL+SHIFT", GetId());
190  editMenu->AddSeparator();
191 
192  cut->createMenuEntry(editMenu);
193  cut->createShortcut(kKey_X, "CTRL", GetId());
194  copy->createMenuEntry(editMenu);
195  copy->createShortcut(kKey_C, "CTRL", GetId());
196  paste->createMenuEntry(editMenu);
197  paste->createShortcut(kKey_V, "CTRL", GetId());
198 
199  TGPopupMenu *viewMenu = new TGPopupMenu(gClient->GetRoot());
200  menuBar->AddPopup("View", viewMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
201 
202  m_newViewerMenu = new TGPopupMenu(gClient->GetRoot());
203  viewMenu->AddPopup("New Viewer", m_newViewerMenu);
204 
205  viewMenu->AddSeparator();
206 
207  nextEvent->createMenuEntry(viewMenu);
208  nextEvent->createShortcut(kKey_Right, "CTRL", GetId());
209  previousEvent->createMenuEntry(viewMenu);
210  previousEvent->createShortcut(kKey_Left, "CTRL", GetId());
211  goToFirst->createMenuEntry(viewMenu);
212  goToLast->createMenuEntry(viewMenu);
213  playEvents->createMenuEntry(viewMenu);
214  playEvents->createShortcut(kKey_Space, "CTRL", GetId());
215  playEventsBack->createMenuEntry(viewMenu);
216  playEventsBack->createShortcut(kKey_Space, "CTRL+SHIFT", GetId());
217  loop->createMenuEntry(viewMenu);
218 
219  TGPopupMenu* windowMenu = new TGPopupMenu(gClient->GetRoot());
220  menuBar->AddPopup("Window", windowMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
221 
222  showCommonInsp->createMenuEntry(windowMenu);
223  showObjInsp->createMenuEntry(windowMenu);
224  showEventDisplayInsp->createShortcut(kKey_I, "CTRL", GetId());
225  showEventDisplayInsp->createMenuEntry(windowMenu);
226  showAddCollection->createMenuEntry(windowMenu);
227  showMainViewCtl->createMenuEntry(windowMenu);
228  showInvMassDialog->createMenuEntry(windowMenu);
229 
230  TGPopupMenu *helpMenu = new TGPopupMenu(gClient->GetRoot());
231  menuBar->AddPopup("Help", helpMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
232  help->createMenuEntry(helpMenu);
233  keyboardShort->createMenuEntry(helpMenu);
234  helpMenu->AddSeparator();
235  helpGL->createMenuEntry(helpMenu);
236 
237  // colors
238  menuBar->SetBackgroundColor(backgroundColor);
239  TIter next(menuBar->GetTitles());
240  TGMenuTitle *title;
241  while ((title = (TGMenuTitle *)next()))
242  title->SetTextColor(textColor);
243 
244  menuTopFrame->AddFrame(menuBar, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
245  AddFrame(menuTopFrame, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
246 
247  // !!!! MT Line separating menu from other window components.
248  // I would even remove it and squeeze the navigation buttons up.
249  AddFrame(new TGFrame(this, 1, 1, kChildFrame, 0x503020),
250  new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
251 
252  m_statBar = new TGStatusBar(this, this->GetWidth(), 12);
253  AddFrame(m_statBar, new TGLayoutHints(kLHintsBottom | kLHintsExpandX));
254 
255  TGHorizontalFrame *fullbar = new TGHorizontalFrame(this, this->GetWidth(), 30,0, backgroundColor);
256 
257  /**************************************************************************/
258  // controls
259 
260  TGCompositeFrame* controlFrame = new TGVerticalFrame(fullbar, 10, 20, 0, backgroundColor);
261 
262  TGCompositeFrame* buttonFrame = new TGHorizontalFrame(controlFrame, 10, 10, 0, backgroundColor);
263  TImage *imgBtn = TImage::Open(FWCheckBoxIcon::coreIcondir()+"slider-bg-up.png");
264  buttonFrame->SetBackgroundPixmap(imgBtn->GetPixmap());
265 
266 
267  goToFirst->createCustomIconsButton(buttonFrame,
268  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotofirst.png"),
269  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotofirst-over.png"),
270  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotofirst-disabled.png"),
271  new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 4, 3, 10, 0));
272 
273  playEventsBack->createCustomIconsButton(buttonFrame,
274  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-backward.png"),
275  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-backward-over.png"),
276  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-backward-disabled.png"),
277  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-pause.png"),
278  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-pause-over.png"),
279  new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
280 
281  previousEvent->createCustomIconsButton(buttonFrame,
282  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepback.png"),
283  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepback-over.png"),
284  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepback-disabled.png"),
285  new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
286 
287  nextEvent->createCustomIconsButton(buttonFrame,
288  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepforward.png"),
289  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepforward-over.png"),
290  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepforward-disabled.png"),
291  new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
292 
293 
294  playEvents->createCustomIconsButton(buttonFrame,
295  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-forward.png"),
296  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-forward-over.png"),
297  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-forward-disabled.png"),
298  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-pause.png"),
299  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-pause-over.png"),
300  new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
301 
302  goToLast->createCustomIconsButton(buttonFrame,
303  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotolast.png"),
304  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotolast-over.png"),
305  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotolast-disabled.png"),
306  new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
307 
308  controlFrame->AddFrame(buttonFrame, new TGLayoutHints(kLHintsTop, 10, 0, 0, 0));
309 
310  /**************************************************************************/
311 
312  TGHorizontalFrame* sliderFrame = new TGHorizontalFrame(controlFrame, 10, 10, 0, backgroundColor);
313  TImage *imgSld = TImage::Open(FWCheckBoxIcon::coreIcondir()+"slider-bg-down.png");
314  sliderFrame->SetBackgroundPixmap(imgSld->GetPixmap());
315  TString sldBtn = FWCheckBoxIcon::coreIcondir() +"slider-button.png";
316 
317  m_delaySlider = new TGHSlider(sliderFrame, 109, kSlider1 | kScaleNo);
318  sliderFrame->AddFrame(m_delaySlider, new TGLayoutHints(kLHintsTop | kLHintsLeft, 39, 8, 1, 3));
319  m_delaySlider->SetRange(0, 10000);
320  m_delaySlider->SetPosition(0);
321  m_delaySlider->SetBackgroundColor(0x1a1a1a);
322  m_delaySlider->ChangeSliderPic(sldBtn);
323 
324  controlFrame->AddFrame(sliderFrame, new TGLayoutHints(kLHintsTop, 10, 0, 0, 0));
325 
326  fullbar->AddFrame(controlFrame, new TGLayoutHints(kLHintsLeft, 2, 2, 5, 8));
327 
329  TQObject::Connect(m_delaySlider, "PositionChanged(Int_t)", "FWIntValueListenerBase", m_delaySliderListener, "setValue(Int_t)");
330 
331  //==============================================================================
332 
333  // delay label
334  {
335  TGVerticalFrame* delayFrame = new TGVerticalFrame(fullbar, 60, 10, 0, backgroundColor);
336 
337  TGLabel *label = new TGLabel(delayFrame, "Delay");
338  label->SetTextJustify(kTextCenterX);
339  label->SetTextColor(0xb3b3b3);
340  label->SetBackgroundColor(backgroundColor);
341  delayFrame->AddFrame(label, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 0, 0, 22, 0));
342 
343  TGHorizontalFrame *labFixed = new TGHorizontalFrame(delayFrame, 70, 20, kFixedSize, backgroundColor);
344  m_delayLabel = new TGLabel(labFixed, "0.0s");
345  m_delayLabel->SetBackgroundColor(backgroundColor);
346  m_delayLabel->SetTextJustify(kTextCenterX);
347  m_delayLabel->SetTextColor(0xffffff);
348  labFixed->AddFrame(m_delayLabel, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 0, 0, 0, 0));
349  delayFrame->AddFrame(labFixed, new TGLayoutHints(kLHintsLeft, 0, 4, 0, 0));
350 
351  fullbar->AddFrame(delayFrame, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
352  }
353 
354  //==============================================================================
355 
356  // text/num entries
357 
358  Int_t entryHeight = 22;
359  TGVerticalFrame *texts = new TGVerticalFrame(fullbar, 400, 10, 0, backgroundColor);
360 
361  // upper row
362  {
363  TGPack *runInfo = new TGPack(texts, 400, entryHeight, kFixedHeight);
364  runInfo->SetVertical(kFALSE);
365  runInfo->SetUseSplitters(kFALSE);
366  runInfo->SetBackgroundColor(backgroundColor);
367 
368  TGHorizontalFrame *rLeft = new TGHorizontalFrame(runInfo, 1, entryHeight);
369  makeFixedSizeLabel(rLeft, "Run", backgroundColor, 0xffffff, 26, entryHeight);
370  m_runEntry = new FWNumberEntryField(rLeft, -1, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
371  rLeft->AddFrame(m_runEntry, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0,8,0,0));
372  runInfo->AddFrameWithWeight(rLeft, 0, 0.28);
373 
374  TGHorizontalFrame *rMid = new TGHorizontalFrame(runInfo, 1, entryHeight);
375  makeFixedSizeLabel(rMid, "Lumi", backgroundColor, 0xffffff, 36, entryHeight);
376  m_lumiEntry = new FWNumberEntryField(rMid, -1, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
377  rMid->AddFrame(m_lumiEntry, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0,8,0,0));
378  runInfo->AddFrameWithWeight(rMid, 0, 0.32);
379 
380  TGHorizontalFrame *rRight = new TGHorizontalFrame(runInfo, 1, entryHeight);
381  makeFixedSizeLabel(rRight, "Event", backgroundColor, 0xffffff, 42, entryHeight);
382  m_eventEntry = new FWNumberEntryField(rRight, -1, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
383  rRight->AddFrame(m_eventEntry, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0,0,0,0));
384  runInfo->AddFrameWithWeight(rRight, 0, 0.4);
385 
386  texts->AddFrame(runInfo, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,0,4));
387  }
388 
389  // lower row
390  {
391  TGHorizontalFrame *filterFrame = new TGHorizontalFrame(texts, 400, entryHeight, 0, backgroundColor);
392 
393  // filter state Off
394  m_filterIcons[0] = fClient->GetPicture("unchecked_t.xpm");
395  m_filterIcons[1] = fClient->GetPicture("unchecked_t.xpm");
396  m_filterIcons[2] = fClient->GetPicture("unchecked_dis_t.xpm");
397 
398  // filter state On
399  m_filterIcons[3] = fClient->GetPicture("checked_t.xpm");
400  m_filterIcons[4] = fClient->GetPicture("checked_t.xpm");
401  m_filterIcons[5] = fClient->GetPicture("checked_dis_t.xpm");
402 
403  // filter withdrawn
404  m_filterIcons[6] = fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-ltgraybg.png");
405  m_filterIcons[7] = fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-ltgraybg-over.png");
406  m_filterIcons[8] = fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-ltgraybg.png");
407 
409  m_filterEnableBtn->SetBackgroundColor(backgroundColor);
410  m_filterEnableBtn->SetToolTipText("Enable/disable event filtering");
411  filterFrame->AddFrame(m_filterEnableBtn, new TGLayoutHints(kLHintsLeft, 4,0,3,0));
412 
413  m_filterShowGUIBtn = new TGTextButton(filterFrame,"Event filtering is OFF");
414  m_filterShowGUIBtn->ChangeOptions(kRaisedFrame);
415  m_filterShowGUIBtn->SetBackgroundColor(backgroundColor);
416  m_filterShowGUIBtn->SetTextColor(0xFFFFFF);
417  m_filterShowGUIBtn->SetToolTipText("Edit filters");
418  filterFrame->AddFrame(m_filterShowGUIBtn, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 6,7,0,0));
419 
420  texts->AddFrame(filterFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,4,0));
421  }
422 
423  fullbar->AddFrame(texts, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5, 5, 12, 0));
424 
425  //==============================================================================
426 
427  TGVerticalFrame *texts2 = new TGVerticalFrame(fullbar, 200, 44, kFixedSize, backgroundColor);
428 
429  // time
430  m_timeText = new TGLabel(texts2, "...");
431  m_timeText->SetTextJustify(kTextLeft);
432  m_timeText->SetTextColor(0xffffff);
433  m_timeText->SetBackgroundColor(backgroundColor);
434  texts2->AddFrame(m_timeText, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,0,1));
435 
436  fullbar->AddFrame(texts2, new TGLayoutHints(kLHintsLeft, 5, 5, 16, 5));
437 
438  //==============================================================================
439 
440  // logo
441  {
442  TGVerticalFrame* parentLogoFrame = new TGVerticalFrame(fullbar, 70, 53, kFixedSize);
443  parentLogoFrame->SetBackgroundColor(backgroundColor);
444  fullbar->AddFrame(parentLogoFrame, new TGLayoutHints(kLHintsRight | kLHintsCenterY));
445 
446  TGVerticalFrame* logoFrame = new TGVerticalFrame(parentLogoFrame, 53, 53, kFixedSize);
447  TImage *logoImg = TImage::Open(FWCheckBoxIcon::coreIcondir() + "CMSRedOnBlackThick.png");
448  logoFrame->SetBackgroundPixmap(logoImg->GetPixmap());
449  parentLogoFrame->AddFrame(logoFrame, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 14, 0, 0));
450  }
451  {
452  TGCompositeFrame *logoFrame = new TGCompositeFrame(this, 61, 23, kFixedSize | kHorizontalFrame, backgroundColor);
453  FWCustomIconsButton *infoBut =
454  new FWCustomIconsButton(logoFrame, fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"fireworksSmallGray.png"),
455  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"fireworksSmallGray-green.png"),
456  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"fireworksSmallGray-red.png"),
457  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"fireworksSmallGray-red.png"));
458  logoFrame->AddFrame(infoBut);
459  infoBut->Connect("Clicked()", "CmsShowMainFrame", this, "showFWorksInfo()");
460  //TImage *logoImg = TImage::Open( FWCheckBoxIcon::coreIcondir() + "fireworksSmallGray.png");
461  //logoFrame->SetBackgroundPixmap(logoImg->GetPixmap());
462  menuTopFrame->AddFrame(logoFrame, new TGLayoutHints(kLHintsRight | kLHintsBottom, 0, 13, 3, 1));
463  }
464 
465  //==============================================================================
466 
467  AddFrame(fullbar, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
468 
469  //Start disabled
470  goToFirst->disable();
471  goToLast->disable();
472  previousEvent->disable();
473  nextEvent->disable();
474  playEvents->disable();
475  playEventsBack->disable();
476  loop->disable();
477 
478  //NOTE: There appears to be a bug in ROOT such that creating a menu item and setting it as
479  // disabled immediately is ignored. Therefore we have to wait till here to actually get ROOT
480  // to disable these menu items
481  undo->disable();
482  redo->disable();
483  cut->disable();
484  copy->disable();
485  paste->disable();
486 
487  //==============================================================================
488 
489  FWPack *csArea = new FWPack(this);
490  csArea->SetVertical(kFALSE);
491 
492  TGCompositeFrame *cf = m_manager->createList(csArea);
493  csArea->AddFrameWithWeight(cf, 0, 20);
494 
495  TEveCompositeFrameInPack *slot = new TEveCompositeFrameInPack(csArea, 0, csArea);
496  csArea->AddFrameWithWeight(slot, 0, 80);
497  TEveWindowSlot *ew_slot = TEveWindow::CreateDefaultWindowSlot();
498  ew_slot->PopulateEmptyFrame(slot);
499  m_manager->createViews(ew_slot);
500 
501  AddFrame(csArea,new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 2));
502  csArea->MapSubwindows();
503 
504  SetWindowName("cmsShow");
505 }
506 
507 // CmsShowMainFrame::CmsShowMainFrame(const CmsShowMainFrame& rhs)
508 // {
509 // // do actual copying here;
510 // }
511 
513  Cleanup();
514 }
515 
516 //
517 // assignment operators
518 //
519 // const CmsShowMainFrame& CmsShowMainFrame::operator=(const CmsShowMainFrame& rhs)
520 // {
521 // //An exception safe implementation is
522 // CmsShowMainFrame temp(rhs);
523 // swap(rhs);
524 //
525 // return *this;
526 // }
527 
528 //
529 // member functions
530 //
531 
532 CSGAction*
533 CmsShowMainFrame::createNewViewerAction(const std::string& iActionName, bool separator)
534 {
535  CSGAction* action(new CSGAction(this, iActionName.c_str()));
537  if (separator) m_newViewerMenu->AddSeparator();
538  return action;
539 }
540 
542 {
543  m_runEntry ->SetUIntNumber(event.id().run());
545  m_eventEntry->SetUIntNumber(event.id().event());
546 
547  m_timeText->SetText( fireworks::getLocalTime( event ).c_str() );
548 }
549 
551 {
552  m_nextEvent->enable();
554  m_goToFirst->enable();
555  m_goToLast->enable();
556  m_playEvents->enable();
558  m_loopAction->enable();
559 }
560 
562 {
564 }
565 
568 }
569 
570 void
572 {
574 
575  m_runEntry->SetEnabled(enable);
576  m_lumiEntry->SetEnabled(enable);
577  m_eventEntry->SetEnabled(enable);
578  m_filterEnableBtn->SetEnabled(enable);
579  m_filterShowGUIBtn->SetEnabled(enable);
580 }
581 
582 void
584 {
585  if (m_previousEvent != 0) {
586  if (enable) {
588  m_goToFirst->enable();
590  } else {
592  m_goToFirst->disable();
595  }
596  }
597 }
598 
599 void
601 {
602  if (m_nextEvent != 0) {
603  if (enable) {
604  m_nextEvent->enable();
605  m_goToLast->enable();
606  m_playEvents->enable();
607  } else {
608  m_nextEvent->disable();
609  m_goToLast->disable();
611  m_playEvents->stop();
612  }
613  }
614 }
615 
619 void
621 {
622  if (enable)
623  m_goToLast->enable();
624  else
625  m_goToLast->disable();
626 }
627 
628 bool
630 {
631  return m_nextEvent->isEnabled();
632 }
633 
634 bool
636 {
637  return m_previousEvent->isEnabled();
638 }
639 
641  m_statBar->SetText(status, 0);
642  //force the status bar to update its image
643  gClient->ProcessEventsFor(m_statBar);
644 }
645 
647 {
648  m_statBar->SetText("", 0);
649  //don't process immediately since we want this on the event queue
650  // since results of the last action may still be happening
651 }
652 
654  switch(id) {
655  case 1:
656  {
657  gApplication->Terminate(0);
658  }
659  break;
660  default:
661  fwLog(fwlog::kInfo) << "Invalid menu id\n";
662  break;
663  }
664 }
665 
667  if (event->fType == kGKeyPress) {
668  const std::vector<CSGAction*>& alist = getListOfActions();
669  std::vector<CSGAction*>::const_iterator it_act;
670  Int_t keycode;
671  Int_t modcode;
672  for (it_act = alist.begin(); it_act != alist.end(); ++it_act) {
673  keycode = (*it_act)->getKeycode();
674  modcode = (*it_act)->getModcode();
675  if ((event->fCode == (UInt_t)keycode) &&
676  ((event->fState == (UInt_t)modcode) ||
677  (event->fState == (UInt_t)(modcode | kKeyMod2Mask)) ||
678  (event->fState == (UInt_t)(modcode | kKeyLockMask)) ||
679  (event->fState == (UInt_t)(modcode | kKeyMod2Mask | kKeyLockMask)))) {
680  (*it_act)->activated.emit();
681  // return kTRUE;
682  return false;
683  }
684  }
685  }
686  return kFALSE;
687 }
688 
689 void
690 CmsShowMainFrame::setPlayDelayGUI(Float_t val, Bool_t sliderChanged)
691 {
692  m_delayLabel->SetText(Form("%.1fs", val));
693  if (sliderChanged)
694  m_delaySlider->SetPosition(Int_t(val*1000));
695 }
696 
697 void
698 CmsShowMainFrame::makeFixedSizeLabel(TGHorizontalFrame* p, const char* txt,
699  UInt_t bgCol, UInt_t txtCol,
700  Int_t width, Int_t height)
701 {
702  // Utility function.
703 
704 
705  p->SetBackgroundColor(bgCol);
706  TGCompositeFrame *lframe = new TGHorizontalFrame(p, width, height, kFixedSize, bgCol);
707  TGLabel* label = new TGLabel(lframe, txt);
708  label->SetBackgroundColor(bgCol);
709  label->SetTextColor(txtCol);
710  lframe->AddFrame(label, new TGLayoutHints(kLHintsRight | kLHintsTop, 0, 4));
711  p->AddFrame(lframe, new TGLayoutHints(kLHintsLeft, 0, 0, 3, 0));
712 }
713 
714 class InfoFrame : public TGMainFrame {
715 public:
716  InfoFrame(const TGWindow* p, UInt_t w, UInt_t h, UInt_t opts) : TGMainFrame(p, w, h, opts) {}
717  virtual ~InfoFrame() {}
718 
719  virtual void CloseWindow() override
720  {
721  UnmapWindow();
722  }
723 };
724 
725 void
727 {
728  if (m_fworksAbout == 0)
729  {
730  UInt_t ww = 280, hh = 190;
731  int number_of_lines = 0;
732  int fontSize = 8;
733  TString infoText;
734  if (gSystem->Getenv("CMSSW_VERSION"))
735  {
736  infoText = "Version ";
737  infoText += gSystem->Getenv("CMSSW_VERSION");
738  infoText +="\n";
739  number_of_lines += 1;
740  }
741  else
742  {
743  TString infoFileName("/data/version.txt");
744  fireworks::setPath(infoFileName);
746  std::ifstream infoFile(infoFileName);
747  while (std::getline(infoFile, line))
748  {
749  ++number_of_lines;
750  infoText += line.c_str();
751  infoText += "\n";
752  }
753  infoFile.close();
754  }
755  infoText += "\nIt works or we fix it for free!\nhn-cms-visualization@cern.ch\n";
756 
757  hh = 130 + 2* fontSize*(number_of_lines + 1);
758 
759  m_fworksAbout = new InfoFrame(gClient->GetRoot(), ww, hh, kVerticalFrame | kFixedSize);
760  m_fworksAbout->SetWMSizeHints(ww, hh, ww, hh, 0, 0);
761  m_fworksAbout->SetBackgroundColor(0x2f2f2f);
762 
763  TGFrame* logoFrame = new TGFrame(m_fworksAbout, 140, 48, kFixedSize);
764  TImage *logoImg = TImage::Open(FWCheckBoxIcon::coreIcondir()+"logo-fireworks.png");
765  logoFrame->SetBackgroundPixmap(logoImg->GetPixmap());
766  m_fworksAbout->AddFrame(logoFrame, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 0, 0, 16, 0));
767 
768  TGLabel* label = new TGLabel(m_fworksAbout, infoText);
769  label->SetBackgroundColor(0x2f2f2f);
770  label->SetForegroundColor(0xffffff);
771 
772  FontStruct_t defaultFontStruct = label->GetDefaultFontStruct();
773  try
774  {
775  TGFontPool *pool = gClient->GetFontPool();
776  TGFont* defaultFont = pool->GetFont(defaultFontStruct);
777  FontAttributes_t attributes = defaultFont->GetFontAttributes();
778  label->SetTextFont(pool->GetFont(attributes.fFamily, fontSize,
779  attributes.fWeight, attributes.fSlant));
780  }
781  catch(...)
782  {
783  }
784 
785  m_fworksAbout->AddFrame(label, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 12, 0));
786 
787  TGTextButton* btn = new TGTextButton(m_fworksAbout, " OK ");
788  btn->SetBackgroundColor(0x2f2f2f);
789  btn->SetForegroundColor(0xffffff);
790  m_fworksAbout->AddFrame(btn, new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 0, 12));
791  btn->Connect("Clicked()", "TGMainFrame", m_fworksAbout, "CloseWindow()");
792 
793  m_fworksAbout->MapSubwindows();
794  m_fworksAbout->Layout();
795  }
796 
797  m_fworksAbout->MapRaised();
798 }
799 
800 
801 void
802 CmsShowMainFrame::bindCSGActionKeys(const TGMainFrame* f) const
803 {
804  for (std::vector<CSGAction*>::const_iterator i = m_actionList.begin(); i != m_actionList.end(); ++i)
805  {
806  if ((*i)-> getKeycode())
807  f->BindKey(this, (*i)->getKeycode(), (*i)->getModcode());
808  }
809 }
810 
811 void
813 {
814 
815  TGFrameElement* fe = (TGFrameElement*) GetList()->Last();
816  FWPack* pack = (FWPack*)(fe->fFrame);
817 
818  TGFrameElementPack* fep;
819  fep = (TGFrameElementPack*)pack->GetList()->At(1);
820  fep->fWeight = x;
821 
822  fep = (TGFrameElementPack*)pack->GetList()->At(3);
823  fep->fWeight = 100 -x;
824 
825  pack->ResizeExistingFrames();
826  pack->Layout();
827 }
828 
829 float
831 {
832  TGFrameElement* fe = (TGFrameElement*)GetList()->Last();
833  TGPack* pack = (TGPack*)(fe->fFrame);
834 
835  TGFrameElementPack* fep = (TGFrameElementPack*)pack->GetList()->At(1);
836  return fep->fWeight;
837 
838 }
const std::string sKeyboardShort
Definition: ActionsList.cc:40
TGVerticalFrame * createList(TGCompositeFrame *p)
RunNumber_t run() const
Definition: EventID.h:42
static const TString & coreIcondir()
FWNumberEntryField * m_lumiEntry
EventNumber_t event() const
Definition: EventID.h:44
int i
Definition: DBlmapReader.cc:9
void bindCSGActionKeys(const TGMainFrame *f) const
const std::string sShowCommonInsp
Definition: ActionsList.cc:24
virtual void SetUIntNumber(UInt_t n)
FWPack(const TGWindow *w)
const std::string sHelp
Definition: ActionsList.cc:39
const std::string sCut
Definition: ActionsList.cc:29
InfoFrame(const TGWindow *p, UInt_t w, UInt_t h, UInt_t opts)
void loadEvent(const edm::EventBase &event)
void createViews(TEveWindowSlot *slot)
virtual void enableActions(bool enable=true)
void enable()
Definition: CSGAction.cc:284
const std::string sBackgroundColor
Definition: ActionsList.cc:25
const std::string sPlayEvents
Definition: ActionsList.cc:7
sigc::signal< void > activated
Definition: CSGAction.h:88
FWGUIManager * m_manager
FWCustomIconsButton * m_filterEnableBtn
int loop
CMSSW
void enableNext(bool enable=true)
const std::string sOpenData
Definition: ActionsList.cc:12
virtual void CloseWindow() override
FWIntValueListener * m_delaySliderListener
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
const std::string sRedo
Definition: ActionsList.cc:28
const std::string sSaveConfigAs
Definition: ActionsList.cc:18
void disable()
Definition: CSGAction.cc:289
CSGContinuousAction * m_playEventsBack
CSGAction * m_nextEvent
const std::string sNextEvent
Definition: ActionsList.cc:5
TGSlider * m_delaySlider
virtual ~InfoFrame()
const std::string sSaveConfig
Definition: ActionsList.cc:17
const TGPicture * m_filterIcons[9]
void createCustomIconsButton(TGCompositeFrame *p, const TGPicture *upPic, const TGPicture *downPic, const TGPicture *disabledPic, const TGPicture *upRunningPic, const TGPicture *downRunningPic, TGLayoutHints *l=0, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=0)
std::vector< CSGAction * > m_actionList
const std::string sAppendData
Definition: ActionsList.cc:13
void setToolTip(const std::string &tip)
Definition: CSGAction.cc:116
virtual Bool_t isEnabled() const
Definition: CSGAction.cc:308
CSGContinuousAction * m_loopAction
TGMainFrame * m_fworksAbout
CSGAction * createNewViewerAction(const std::string &iActionName, bool seaprator)
FWNumberEntryField * m_eventEntry
virtual ~CmsShowMainFrame()
list attributes
Definition: asciidump.py:415
void updateStatusBar(const char *status)
const std::string sShowAddCollection
Definition: ActionsList.cc:36
double f[11][100]
const std::string sGotoLastEvent
Definition: ActionsList.cc:4
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
TGPopupMenu * m_newViewerMenu
const std::string sExportImage
Definition: ActionsList.cc:19
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const std::string sAutoRewind
Definition: ActionsList.cc:10
void createMenuEntry(TGPopupMenu *menu)
Definition: CSGAction.cc:213
Bool_t HandleKey(Event_t *event)
const std::string sShowMainViewCtl
Definition: ActionsList.cc:35
FWNumberEntryField * m_runEntry
const std::string sPlayEventsBack
Definition: ActionsList.cc:8
CSGAction * getAction(const std::string &name)
virtual void enableActions(bool enable=true)
const std::string sShowObjInsp
Definition: ActionsList.cc:33
FWCustomIconsButton * createCustomIconsButton(TGCompositeFrame *p, const TGPicture *upPic, const TGPicture *downPic, const TGPicture *disabledPic, TGLayoutHints *l=0, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=0)
Definition: CSGAction.cc:162
CSGAction * m_previousEvent
#define fwLog(_level_)
Definition: fwLog.h:50
const std::string sGotoFirstEvent
Definition: ActionsList.cc:3
const std::string sCopy
Definition: ActionsList.cc:30
CSGAction * m_goToLast
virtual void CloseWindow()
const std::string sShowInvMassDialog
Definition: ActionsList.cc:37
void setSummaryViewWeight(float)
const std::string sShowEventDisplayInsp
Definition: ActionsList.cc:34
void enablePrevious(bool enable=true)
const std::string sPreviousEvent
Definition: ActionsList.cc:6
CSGContinuousAction * m_playEvents
edm::EventID id() const
Definition: EventBase.h:56
std::string getLocalTime(const edm::EventBase &event)
float getSummaryViewWeight() const
const std::vector< CSGAction * > & getListOfActions() const
CSGAction * m_goToFirst
const std::string sLoadConfig
Definition: ActionsList.cc:16
virtual void HandleMenu(Int_t id)
void makeFixedSizeLabel(TGHorizontalFrame *p, const char *txt, UInt_t bgCol, UInt_t txtCol, Int_t width, Int_t height)
T w() const
virtual ~FWPack()
void createShortcut(UInt_t key, const char *mod, int windowID)
Definition: CSGAction.cc:182
const std::string sExportAllImages
Definition: ActionsList.cc:20
const std::string sPaste
Definition: ActionsList.cc:31
Definition: DDAxes.h:10
void enableComplexNavigation(bool enable=true)
const std::string sQuit
Definition: ActionsList.cc:22
tuple status
Definition: ntuplemaker.py:245
TGTextButton * m_filterShowGUIBtn
CmsShowMainFrame(const TGWindow *p=0, UInt_t w=1, UInt_t h=1, FWGUIManager *m=0)
const std::string sHelpGL
Definition: ActionsList.cc:41
void setPlayDelayGUI(Float_t val, Bool_t sliderChanged)
const std::string sUndo
Definition: ActionsList.cc:27
void setPath(TString &v)
Definition: fwPaths.cc:15
TGStatusBar * m_statBar
const std::string sSearchFiles
Definition: ActionsList.cc:14