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