00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "FWCore/Common/interface/EventBase.h"
00015
00016
00017 #include <TCollection.h>
00018 #include <TApplication.h>
00019 #include <TEveWindow.h>
00020 #include <TGClient.h>
00021 #include <TGLayout.h>
00022 #include <TGButton.h>
00023 #include <TGMenu.h>
00024 #include <TGLabel.h>
00025 #include <TGTab.h>
00026 #include <TGPack.h>
00027 #include <TGStatusBar.h>
00028 #include <KeySymbols.h>
00029 #include <TGSlider.h>
00030
00031 #include <TSystem.h>
00032 #include <TImage.h>
00033
00034 #include "DataFormats/Provenance/interface/EventID.h"
00035 #include "Fireworks/Core/interface/CSGAction.h"
00036 #include "Fireworks/Core/interface/CSGContinuousAction.h"
00037 #include "Fireworks/Core/interface/CmsShowMainFrame.h"
00038 #include "Fireworks/Core/interface/ActionsList.h"
00039 #include "Fireworks/Core/interface/BuilderUtils.h"
00040
00041 #include "Fireworks/Core/interface/FWGUIManager.h"
00042 #include "Fireworks/Core/interface/FWCustomIconsButton.h"
00043
00044 #include "Fireworks/Core/interface/FWIntValueListener.h"
00045 #include "Fireworks/Core/interface/fwLog.h"
00046 #include "Fireworks/Core/src/FWCheckBoxIcon.h"
00047 #include "Fireworks/Core/src/FWNumberEntry.h"
00048
00049 #include <fstream>
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 CmsShowMainFrame::CmsShowMainFrame(const TGWindow *p,UInt_t w,UInt_t h,FWGUIManager *m) :
00064 TGMainFrame(p, w, h),
00065 m_filterEnableBtn(),
00066 m_filterShowGUIBtn(),
00067 m_runEntry(0),
00068 m_lumiEntry(0),
00069 m_eventEntry(0),
00070 m_delaySliderListener(0),
00071 m_manager(m),
00072 m_fworksAbout(0)
00073 {
00074 const unsigned int backgroundColor=0x2f2f2f;
00075 const unsigned int textColor= 0xb3b3b3;
00076
00077 CSGAction *openData = new CSGAction(this, cmsshow::sOpenData.c_str());
00078 CSGAction *appendData = new CSGAction(this, cmsshow::sAppendData.c_str());
00079 CSGAction *searchFiles = new CSGAction(this, cmsshow::sSearchFiles.c_str());
00080
00081 CSGAction *loadConfig = new CSGAction(this, cmsshow::sLoadConfig.c_str());
00082 CSGAction *saveConfig = new CSGAction(this, cmsshow::sSaveConfig.c_str());
00083 CSGAction *saveConfigAs = new CSGAction(this, cmsshow::sSaveConfigAs.c_str());
00084 CSGAction *exportImage = new CSGAction(this, cmsshow::sExportImage.c_str());
00085 CSGAction *exportImages = new CSGAction(this, cmsshow::sExportAllImages.c_str());
00086 CSGAction *quit = new CSGAction(this, cmsshow::sQuit.c_str());
00087
00088 CSGAction *undo = new CSGAction(this, cmsshow::sUndo.c_str());
00089 undo->disable();
00090 CSGAction *redo = new CSGAction(this, cmsshow::sRedo.c_str());
00091 redo->disable();
00092 CSGAction *cut = new CSGAction(this, cmsshow::sCut.c_str());
00093 cut->disable();
00094 CSGAction *copy = new CSGAction(this, cmsshow::sCopy.c_str());
00095 copy->disable();
00096 CSGAction *paste = new CSGAction(this, cmsshow::sPaste.c_str());
00097 paste->disable();
00098
00099 CSGAction *goToFirst = new CSGAction(this, cmsshow::sGotoFirstEvent.c_str());
00100 CSGAction *goToLast = new CSGAction(this, cmsshow::sGotoLastEvent.c_str());
00101
00102 CSGAction *nextEvent = new CSGAction(this, cmsshow::sNextEvent.c_str());
00103 CSGAction *previousEvent = new CSGAction(this, cmsshow::sPreviousEvent.c_str());
00104
00105 CSGContinuousAction *playEvents = new CSGContinuousAction(this, cmsshow::sPlayEvents.c_str());
00106 CSGContinuousAction *playEventsBack = new CSGContinuousAction(this, cmsshow::sPlayEventsBack.c_str());
00107 CSGContinuousAction *loop = new CSGContinuousAction(this, cmsshow::sAutoRewind.c_str());
00108
00109 CSGAction *showCommonInsp = new CSGAction(this, cmsshow::sShowCommonInsp.c_str());
00110 CSGAction *colorset = new CSGAction(this, cmsshow::sBackgroundColor.c_str());
00111
00112 CSGAction *showObjInsp = new CSGAction(this, cmsshow::sShowObjInsp.c_str());
00113 CSGAction *showEventDisplayInsp = new CSGAction(this, cmsshow::sShowEventDisplayInsp.c_str());
00114 CSGAction *showMainViewCtl = new CSGAction(this, cmsshow::sShowMainViewCtl.c_str());
00115 CSGAction *showAddCollection = new CSGAction(this, cmsshow::sShowAddCollection.c_str());
00116 CSGAction *showInvMassDialog = new CSGAction(this, cmsshow::sShowInvMassDialog.c_str());
00117 CSGAction *showGeometryTable = new CSGAction(this, cmsshow::sShowGeometryTable.c_str());
00118
00119 CSGAction *help = new CSGAction(this, cmsshow::sHelp.c_str());
00120 CSGAction *keyboardShort = new CSGAction(this, cmsshow::sKeyboardShort.c_str());
00121 CSGAction *helpGL = new CSGAction(this, cmsshow::sHelpGL.c_str());
00122
00123 m_nextEvent = nextEvent;
00124 m_previousEvent = previousEvent;
00125 m_goToFirst = goToFirst;
00126 m_goToLast = goToLast;
00127 m_playEvents = playEvents;
00128 m_playEventsBack = playEventsBack;
00129 m_loopAction = loop;
00130
00131 goToFirst->setToolTip("Goto first event");
00132 goToLast->setToolTip("Goto last event");
00133 previousEvent->setToolTip("Goto previous event");
00134 nextEvent->setToolTip("Goto next event");
00135 playEvents->setToolTip("Play events");
00136 playEventsBack->setToolTip("Play events backwards");
00137
00138 TGCompositeFrame *menuTopFrame = new TGCompositeFrame(this, 1, 1, kHorizontalFrame, backgroundColor);
00139
00140 TGMenuBar *menuBar = new TGMenuBar(menuTopFrame, this->GetWidth(), 28, kHorizontalFrame);
00141
00142 TGPopupMenu *fileMenu = new TGPopupMenu(gClient->GetRoot());
00143 menuBar->AddPopup("File", fileMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
00144
00145 openData->createMenuEntry(fileMenu);
00146 appendData->createMenuEntry(fileMenu);
00147 searchFiles->createMenuEntry(fileMenu);
00148
00149 loadConfig->createMenuEntry(fileMenu);
00150 saveConfig->createMenuEntry(fileMenu);
00151 saveConfigAs->createMenuEntry(fileMenu);
00152 fileMenu->AddSeparator();
00153
00154 exportImage->createMenuEntry(fileMenu);
00155 exportImages->createMenuEntry(fileMenu);
00156 fileMenu->AddSeparator();
00157
00158 quit->createMenuEntry(fileMenu);
00159
00160 openData->createShortcut(kKey_O, "CTRL", GetId());
00161 loadConfig->createShortcut(kKey_L, "CTRL", GetId());
00162 saveConfig->createShortcut(kKey_S, "CTRL", GetId());
00163 saveConfigAs->createShortcut(kKey_S, "CTRL+SHIFT", GetId());
00164 exportImage->createShortcut(kKey_P, "CTRL", GetId());
00165 exportImages->createShortcut(kKey_P, "CTRL+SHIFT", GetId());
00166 quit->createShortcut(kKey_Q, "CTRL", GetId());
00167
00168 TGPopupMenu *editMenu = new TGPopupMenu(gClient->GetRoot());
00169 menuBar->AddPopup("Edit", editMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
00170
00171 showCommonInsp->createMenuEntry(editMenu);
00172 showCommonInsp->createShortcut(kKey_A, "CTRL", GetId());
00173 colorset->createMenuEntry(editMenu);
00174 colorset->createShortcut(kKey_B, "CTRL", GetId());
00175 editMenu->AddSeparator();
00176
00177 undo->createMenuEntry(editMenu);
00178 undo->createShortcut(kKey_Z, "CTRL", GetId());
00179 redo->createMenuEntry(editMenu);
00180 redo->createShortcut(kKey_Z, "CTRL+SHIFT", GetId());
00181 editMenu->AddSeparator();
00182
00183 cut->createMenuEntry(editMenu);
00184 cut->createShortcut(kKey_X, "CTRL", GetId());
00185 copy->createMenuEntry(editMenu);
00186 copy->createShortcut(kKey_C, "CTRL", GetId());
00187 paste->createMenuEntry(editMenu);
00188 paste->createShortcut(kKey_V, "CTRL", GetId());
00189
00190 TGPopupMenu *viewMenu = new TGPopupMenu(gClient->GetRoot());
00191 menuBar->AddPopup("View", viewMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
00192
00193 m_newViewerMenu = new TGPopupMenu(gClient->GetRoot());
00194 viewMenu->AddPopup("New Viewer", m_newViewerMenu);
00195
00196 viewMenu->AddSeparator();
00197
00198 nextEvent->createMenuEntry(viewMenu);
00199 nextEvent->createShortcut(kKey_Right, "CTRL", GetId());
00200 previousEvent->createMenuEntry(viewMenu);
00201 previousEvent->createShortcut(kKey_Left, "CTRL", GetId());
00202 goToFirst->createMenuEntry(viewMenu);
00203 goToLast->createMenuEntry(viewMenu);
00204 playEvents->createMenuEntry(viewMenu);
00205 playEvents->createShortcut(kKey_Space, "CTRL", GetId());
00206 playEventsBack->createMenuEntry(viewMenu);
00207 playEventsBack->createShortcut(kKey_Space, "CTRL+SHIFT", GetId());
00208 loop->createMenuEntry(viewMenu);
00209
00210 TGPopupMenu* windowMenu = new TGPopupMenu(gClient->GetRoot());
00211 menuBar->AddPopup("Window", windowMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
00212
00213 showCommonInsp->createShortcut(kKey_A, "CTRL", GetId());
00214 showCommonInsp->createMenuEntry(windowMenu);
00215 showObjInsp->createMenuEntry(windowMenu);
00216 showEventDisplayInsp->createShortcut(kKey_I, "CTRL", GetId());
00217 showEventDisplayInsp->createMenuEntry(windowMenu);
00218 showAddCollection->createMenuEntry(windowMenu);
00219 showMainViewCtl->createMenuEntry(windowMenu);
00220 showInvMassDialog->createMenuEntry(windowMenu);
00221
00222 TGPopupMenu *geoMenu = new TGPopupMenu(gClient->GetRoot());
00223 menuBar->AddPopup("Geomtery", geoMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
00224 showGeometryTable->createMenuEntry(geoMenu);
00225
00226 TGPopupMenu *helpMenu = new TGPopupMenu(gClient->GetRoot());
00227 menuBar->AddPopup("Help", helpMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0));
00228 help->createMenuEntry(helpMenu);
00229 keyboardShort->createMenuEntry(helpMenu);
00230 helpMenu->AddSeparator();
00231 helpGL->createMenuEntry(helpMenu);
00232
00233
00234 menuBar->SetBackgroundColor(backgroundColor);
00235 TIter next(menuBar->GetTitles());
00236 TGMenuTitle *title;
00237 while ((title = (TGMenuTitle *)next()))
00238 title->SetTextColor(textColor);
00239
00240 menuTopFrame->AddFrame(menuBar, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
00241 AddFrame(menuTopFrame, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
00242
00243
00244
00245 AddFrame(new TGFrame(this, 1, 1, kChildFrame, 0x503020),
00246 new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
00247
00248 m_statBar = new TGStatusBar(this, this->GetWidth(), 12);
00249 AddFrame(m_statBar, new TGLayoutHints(kLHintsBottom | kLHintsExpandX));
00250
00251 TGHorizontalFrame *fullbar = new TGHorizontalFrame(this, this->GetWidth(), 30,0, backgroundColor);
00252
00253
00254
00255
00256 TGCompositeFrame* controlFrame = new TGVerticalFrame(fullbar, 10, 20, 0, backgroundColor);
00257
00258 TGCompositeFrame* buttonFrame = new TGHorizontalFrame(controlFrame, 10, 10, 0, backgroundColor);
00259 TImage *imgBtn = TImage::Open(FWCheckBoxIcon::coreIcondir()+"slider-bg-up.png");
00260 buttonFrame->SetBackgroundPixmap(imgBtn->GetPixmap());
00261
00262
00263 goToFirst->createCustomIconsButton(buttonFrame,
00264 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotofirst.png"),
00265 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotofirst-over.png"),
00266 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotofirst-disabled.png"),
00267 new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 4, 3, 10, 0));
00268
00269 playEventsBack->createCustomIconsButton(buttonFrame,
00270 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-backward.png"),
00271 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-backward-over.png"),
00272 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-backward-disabled.png"),
00273 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-pause.png"),
00274 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-pause-over.png"),
00275 new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
00276
00277 previousEvent->createCustomIconsButton(buttonFrame,
00278 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepback.png"),
00279 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepback-over.png"),
00280 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepback-disabled.png"),
00281 new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
00282
00283 nextEvent->createCustomIconsButton(buttonFrame,
00284 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepforward.png"),
00285 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepforward-over.png"),
00286 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-stepforward-disabled.png"),
00287 new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
00288
00289
00290 playEvents->createCustomIconsButton(buttonFrame,
00291 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-forward.png"),
00292 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-forward-over.png"),
00293 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-forward-disabled.png"),
00294 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-pause.png"),
00295 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-pause-over.png"),
00296 new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
00297
00298 goToLast->createCustomIconsButton(buttonFrame,
00299 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotolast.png"),
00300 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotolast-over.png"),
00301 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"button-gotolast-disabled.png"),
00302 new TGLayoutHints(kLHintsCenterY| kLHintsLeft, 2, 3, 10, 0));
00303
00304 controlFrame->AddFrame(buttonFrame, new TGLayoutHints(kLHintsTop, 10, 0, 0, 0));
00305
00306
00307
00308 TGHorizontalFrame* sliderFrame = new TGHorizontalFrame(controlFrame, 10, 10, 0, backgroundColor);
00309 TImage *imgSld = TImage::Open(FWCheckBoxIcon::coreIcondir()+"slider-bg-down.png");
00310 sliderFrame->SetBackgroundPixmap(imgSld->GetPixmap());
00311 TString sldBtn = FWCheckBoxIcon::coreIcondir() +"slider-button.png";
00312
00313 m_delaySlider = new TGHSlider(sliderFrame, 109, kSlider1 | kScaleNo);
00314 sliderFrame->AddFrame(m_delaySlider, new TGLayoutHints(kLHintsTop | kLHintsLeft, 39, 8, 1, 3));
00315 m_delaySlider->SetRange(0, 10000);
00316 m_delaySlider->SetPosition(0);
00317 m_delaySlider->SetBackgroundColor(0x1a1a1a);
00318 m_delaySlider->ChangeSliderPic(sldBtn);
00319
00320 controlFrame->AddFrame(sliderFrame, new TGLayoutHints(kLHintsTop, 10, 0, 0, 0));
00321
00322 fullbar->AddFrame(controlFrame, new TGLayoutHints(kLHintsLeft, 2, 2, 5, 8));
00323
00324 m_delaySliderListener = new FWIntValueListener();
00325 TQObject::Connect(m_delaySlider, "PositionChanged(Int_t)", "FWIntValueListenerBase", m_delaySliderListener, "setValue(Int_t)");
00326
00327
00328
00329
00330 {
00331 TGVerticalFrame* delayFrame = new TGVerticalFrame(fullbar, 60, 10, 0, backgroundColor);
00332
00333 TGLabel *label = new TGLabel(delayFrame, "Delay");
00334 label->SetTextJustify(kTextCenterX);
00335 label->SetTextColor(0xb3b3b3);
00336 label->SetBackgroundColor(backgroundColor);
00337 delayFrame->AddFrame(label, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 0, 0, 22, 0));
00338
00339 TGHorizontalFrame *labFixed = new TGHorizontalFrame(delayFrame, 70, 20, kFixedSize, backgroundColor);
00340 m_delayLabel = new TGLabel(labFixed, "0.0s");
00341 m_delayLabel->SetBackgroundColor(backgroundColor);
00342 m_delayLabel->SetTextJustify(kTextCenterX);
00343 m_delayLabel->SetTextColor(0xffffff);
00344 labFixed->AddFrame(m_delayLabel, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 0, 0, 0, 0));
00345 delayFrame->AddFrame(labFixed, new TGLayoutHints(kLHintsLeft, 0, 4, 0, 0));
00346
00347 fullbar->AddFrame(delayFrame, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
00348 }
00349
00350
00351
00352
00353
00354 Int_t entryHeight = 22;
00355 TGVerticalFrame *texts = new TGVerticalFrame(fullbar, 400, 10, 0, backgroundColor);
00356
00357
00358 {
00359 TGPack *runInfo = new TGPack(texts, 400, entryHeight, kFixedHeight);
00360 runInfo->SetVertical(kFALSE);
00361 runInfo->SetUseSplitters(kFALSE);
00362 runInfo->SetBackgroundColor(backgroundColor);
00363
00364 TGHorizontalFrame *rLeft = new TGHorizontalFrame(runInfo, 1, entryHeight);
00365 makeFixedSizeLabel(rLeft, "Run", backgroundColor, 0xffffff, 26, entryHeight);
00366 m_runEntry = new FWNumberEntryField(rLeft, -1, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
00367 rLeft->AddFrame(m_runEntry, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0,8,0,0));
00368 runInfo->AddFrameWithWeight(rLeft, 0, 0.28);
00369
00370 TGHorizontalFrame *rMid = new TGHorizontalFrame(runInfo, 1, entryHeight);
00371 makeFixedSizeLabel(rMid, "Lumi", backgroundColor, 0xffffff, 36, entryHeight);
00372 m_lumiEntry = new FWNumberEntryField(rMid, -1, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
00373 rMid->AddFrame(m_lumiEntry, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0,8,0,0));
00374 runInfo->AddFrameWithWeight(rMid, 0, 0.32);
00375
00376 TGHorizontalFrame *rRight = new TGHorizontalFrame(runInfo, 1, entryHeight);
00377 makeFixedSizeLabel(rRight, "Event", backgroundColor, 0xffffff, 42, entryHeight);
00378 m_eventEntry = new FWNumberEntryField(rRight, -1, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
00379 rRight->AddFrame(m_eventEntry, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0,0,0,0));
00380 runInfo->AddFrameWithWeight(rRight, 0, 0.4);
00381
00382 texts->AddFrame(runInfo, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,0,4));
00383 }
00384
00385
00386 {
00387 TGHorizontalFrame *filterFrame = new TGHorizontalFrame(texts, 400, entryHeight, 0, backgroundColor);
00388
00389
00390 m_filterIcons[0] = fClient->GetPicture("unchecked_t.xpm");
00391 m_filterIcons[1] = fClient->GetPicture("unchecked_t.xpm");
00392 m_filterIcons[2] = fClient->GetPicture("unchecked_dis_t.xpm");
00393
00394
00395 m_filterIcons[3] = fClient->GetPicture("checked_t.xpm");
00396 m_filterIcons[4] = fClient->GetPicture("checked_t.xpm");
00397 m_filterIcons[5] = fClient->GetPicture("checked_dis_t.xpm");
00398
00399
00400 m_filterIcons[6] = fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-ltgraybg.png");
00401 m_filterIcons[7] = fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-ltgraybg-over.png");
00402 m_filterIcons[8] = fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-ltgraybg.png");
00403
00404 m_filterEnableBtn = new FWCustomIconsButton(filterFrame, m_filterIcons[0], m_filterIcons[1], m_filterIcons[2]);
00405 m_filterEnableBtn->SetBackgroundColor(backgroundColor);
00406 m_filterEnableBtn->SetToolTipText("Enable/disable event filtering");
00407 filterFrame->AddFrame(m_filterEnableBtn, new TGLayoutHints(kLHintsLeft, 4,0,3,0));
00408
00409 m_filterShowGUIBtn = new TGTextButton(filterFrame,"Event filtering is OFF");
00410 m_filterShowGUIBtn->ChangeOptions(kRaisedFrame);
00411 m_filterShowGUIBtn->SetBackgroundColor(backgroundColor);
00412 m_filterShowGUIBtn->SetTextColor(0xFFFFFF);
00413 m_filterShowGUIBtn->SetToolTipText("Edit filters");
00414 filterFrame->AddFrame(m_filterShowGUIBtn, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 6,7,0,0));
00415
00416 texts->AddFrame(filterFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,4,0));
00417 }
00418
00419 fullbar->AddFrame(texts, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5, 5, 12, 0));
00420
00421
00422
00423 TGVerticalFrame *texts2 = new TGVerticalFrame(fullbar, 200, 44, kFixedSize, backgroundColor);
00424
00425
00426 m_timeText = new TGLabel(texts2, "...");
00427 m_timeText->SetTextJustify(kTextLeft);
00428 m_timeText->SetTextColor(0xffffff);
00429 m_timeText->SetBackgroundColor(backgroundColor);
00430 texts2->AddFrame(m_timeText, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,0,1));
00431
00432 fullbar->AddFrame(texts2, new TGLayoutHints(kLHintsLeft, 5, 5, 16, 5));
00433
00434
00435
00436
00437 {
00438 TGVerticalFrame* parentLogoFrame = new TGVerticalFrame(fullbar, 70, 53, kFixedSize);
00439 parentLogoFrame->SetBackgroundColor(backgroundColor);
00440 fullbar->AddFrame(parentLogoFrame, new TGLayoutHints(kLHintsRight | kLHintsCenterY));
00441
00442 TGVerticalFrame* logoFrame = new TGVerticalFrame(parentLogoFrame, 53, 53, kFixedSize);
00443 TImage *logoImg = TImage::Open(FWCheckBoxIcon::coreIcondir() + "CMSRedOnBlackThick.png");
00444 logoFrame->SetBackgroundPixmap(logoImg->GetPixmap());
00445 parentLogoFrame->AddFrame(logoFrame, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 14, 0, 0));
00446 }
00447 {
00448 TGCompositeFrame *logoFrame = new TGCompositeFrame(this, 61, 23, kFixedSize | kHorizontalFrame, backgroundColor);
00449 FWCustomIconsButton *infoBut =
00450 new FWCustomIconsButton(logoFrame, fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"fireworksSmallGray.png"),
00451 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"fireworksSmallGray-green.png"),
00452 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"fireworksSmallGray-red.png"),
00453 fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"fireworksSmallGray-red.png"));
00454 logoFrame->AddFrame(infoBut);
00455 infoBut->Connect("Clicked()", "CmsShowMainFrame", this, "showFWorksInfo()");
00456
00457
00458 menuTopFrame->AddFrame(logoFrame, new TGLayoutHints(kLHintsRight | kLHintsBottom, 0, 13, 3, 1));
00459 }
00460
00461
00462
00463 AddFrame(fullbar, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
00464
00465
00466 goToFirst->disable();
00467 goToLast->disable();
00468 previousEvent->disable();
00469 nextEvent->disable();
00470 playEvents->disable();
00471 playEventsBack->disable();
00472 loop->disable();
00473
00474
00475
00476
00477 undo->disable();
00478 redo->disable();
00479 cut->disable();
00480 copy->disable();
00481 paste->disable();
00482
00483
00484
00485 TGPack *csArea = new TGPack(this, this->GetWidth(), this->GetHeight()-42);
00486 csArea->SetVertical(kFALSE);
00487
00488 TGCompositeFrame *cf = m_manager->createList(csArea);
00489 csArea->AddFrameWithWeight(cf, 0, 20);
00490
00491 TEveCompositeFrameInPack *slot = new TEveCompositeFrameInPack(csArea, 0, csArea);
00492 csArea->AddFrameWithWeight(slot, 0, 80);
00493 TEveWindowSlot *ew_slot = TEveWindow::CreateDefaultWindowSlot();
00494 ew_slot->PopulateEmptyFrame(slot);
00495 m_manager->createViews(ew_slot);
00496
00497 AddFrame(csArea,new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 2));
00498 csArea->MapSubwindows();
00499
00500 SetWindowName("cmsShow");
00501 }
00502
00503
00504
00505
00506
00507
00508 CmsShowMainFrame::~CmsShowMainFrame() {
00509 Cleanup();
00510 }
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528 CSGAction*
00529 CmsShowMainFrame::createNewViewerAction(const std::string& iActionName, bool separator)
00530 {
00531 CSGAction* action(new CSGAction(this, iActionName.c_str()));
00532 action->createMenuEntry(m_newViewerMenu);
00533 if (separator) m_newViewerMenu->AddSeparator();
00534 return action;
00535 }
00536
00537 void CmsShowMainFrame::loadEvent(const edm::EventBase& event)
00538 {
00539 m_runEntry ->SetUIntNumber(event.id().run());
00540 m_lumiEntry ->SetUIntNumber(event.id().luminosityBlock());
00541 m_eventEntry->SetUIntNumber(event.id().event());
00542
00543 m_timeText->SetText( fireworks::getLocalTime( event ).c_str() );
00544 }
00545
00546 void CmsShowMainFrame::enableNavigatorControls()
00547 {
00548 m_nextEvent->enable();
00549 m_previousEvent->enable();
00550 m_goToFirst->enable();
00551 m_goToLast->enable();
00552 m_playEvents->enable();
00553 m_playEventsBack->enable();
00554 m_loopAction->enable();
00555 }
00556
00557 void CmsShowMainFrame::CloseWindow()
00558 {
00559 getAction(cmsshow::sQuit)->activated();
00560 }
00561
00562 void CmsShowMainFrame::quit() {
00563 getAction(cmsshow::sQuit)->activated();
00564 }
00565
00566 void
00567 CmsShowMainFrame::enableActions(bool enable)
00568 {
00569 CSGActionSupervisor::enableActions(enable);
00570
00571 m_runEntry->SetEnabled(enable);
00572 m_lumiEntry->SetEnabled(enable);
00573 m_eventEntry->SetEnabled(enable);
00574 m_filterEnableBtn->SetEnabled(enable);
00575 m_filterShowGUIBtn->SetEnabled(enable);
00576 }
00577
00578 void
00579 CmsShowMainFrame::enablePrevious(bool enable)
00580 {
00581 if (m_previousEvent != 0) {
00582 if (enable) {
00583 m_previousEvent->enable();
00584 m_goToFirst->enable();
00585 m_playEventsBack->enable();
00586 } else {
00587 m_previousEvent->disable();
00588 m_goToFirst->disable();
00589 m_playEventsBack->disable();
00590 m_playEventsBack->stop();
00591 }
00592 }
00593 }
00594
00595 void
00596 CmsShowMainFrame::enableNext(bool enable)
00597 {
00598 if (m_nextEvent != 0) {
00599 if (enable) {
00600 m_nextEvent->enable();
00601 m_goToLast->enable();
00602 m_playEvents->enable();
00603 } else {
00604 m_nextEvent->disable();
00605 m_goToLast->disable();
00606 m_playEvents->disable();
00607 m_playEvents->stop();
00608 }
00609 }
00610 }
00611
00615 void
00616 CmsShowMainFrame::enableComplexNavigation(bool enable)
00617 {
00618 if (enable)
00619 m_goToLast->enable();
00620 else
00621 m_goToLast->disable();
00622 }
00623
00624 bool
00625 CmsShowMainFrame::nextIsEnabled()
00626 {
00627 return m_nextEvent->isEnabled();
00628 }
00629
00630 bool
00631 CmsShowMainFrame::previousIsEnabled()
00632 {
00633 return m_previousEvent->isEnabled();
00634 }
00635
00636 void CmsShowMainFrame::updateStatusBar(const char* status) {
00637 m_statBar->SetText(status, 0);
00638
00639 gClient->ProcessEventsFor(m_statBar);
00640 }
00641
00642 void CmsShowMainFrame::clearStatusBar()
00643 {
00644 m_statBar->SetText("", 0);
00645
00646
00647 }
00648
00649 void CmsShowMainFrame::HandleMenu(Int_t id) {
00650 switch(id) {
00651 case 1:
00652 {
00653 gApplication->Terminate(0);
00654 }
00655 break;
00656 default:
00657 fwLog(fwlog::kInfo) << "Invalid menu id\n";
00658 break;
00659 }
00660 }
00661
00662 Bool_t CmsShowMainFrame::HandleKey(Event_t *event) {
00663 if (event->fType == kGKeyPress) {
00664 const std::vector<CSGAction*>& alist = getListOfActions();
00665 std::vector<CSGAction*>::const_iterator it_act;
00666 Int_t keycode;
00667 Int_t modcode;
00668 for (it_act = alist.begin(); it_act != alist.end(); ++it_act) {
00669 keycode = (*it_act)->getKeycode();
00670 modcode = (*it_act)->getModcode();
00671 if ((event->fCode == (UInt_t)keycode) &&
00672 ((event->fState == (UInt_t)modcode) ||
00673 (event->fState == (UInt_t)(modcode | kKeyMod2Mask)) ||
00674 (event->fState == (UInt_t)(modcode | kKeyLockMask)) ||
00675 (event->fState == (UInt_t)(modcode | kKeyMod2Mask | kKeyLockMask)))) {
00676 (*it_act)->activated.emit();
00677 return kTRUE;
00678 }
00679 }
00680 }
00681 return kFALSE;
00682 }
00683
00684 void
00685 CmsShowMainFrame::setPlayDelayGUI(Float_t val, Bool_t sliderChanged)
00686 {
00687 m_delayLabel->SetText(Form("%.1fs", val));
00688 if (sliderChanged)
00689 m_delaySlider->SetPosition(Int_t(val*1000));
00690 }
00691
00692 void
00693 CmsShowMainFrame::makeFixedSizeLabel(TGHorizontalFrame* p, const char* txt,
00694 UInt_t bgCol, UInt_t txtCol,
00695 Int_t width, Int_t height)
00696 {
00697
00698
00699
00700 p->SetBackgroundColor(bgCol);
00701 TGCompositeFrame *lframe = new TGHorizontalFrame(p, width, height, kFixedSize, bgCol);
00702 TGLabel* label = new TGLabel(lframe, txt);
00703 label->SetBackgroundColor(bgCol);
00704 label->SetTextColor(txtCol);
00705 lframe->AddFrame(label, new TGLayoutHints(kLHintsRight | kLHintsTop, 0, 4));
00706 p->AddFrame(lframe, new TGLayoutHints(kLHintsLeft, 0, 0, 3, 0));
00707 }
00708
00709 class InfoFrame : public TGMainFrame {
00710 public:
00711 InfoFrame(const TGWindow* p, UInt_t w, UInt_t h, UInt_t opts) : TGMainFrame(p, w, h, opts) {}
00712 virtual ~InfoFrame() {}
00713
00714 virtual void CloseWindow()
00715 {
00716 UnmapWindow();
00717 }
00718 };
00719
00720 void
00721 CmsShowMainFrame::showFWorksInfo()
00722 {
00723 if (m_fworksAbout == 0)
00724 {
00725 TString infoFileName("$(CMSSW_BASE)/src/Fireworks/Core/data/version.txt");
00726 gSystem->ExpandPathName(infoFileName);
00727
00728 ifstream infoFile(infoFileName);
00729 TString infoText;
00730 infoText.ReadFile(infoFile);
00731 infoFile.close();
00732
00733 const UInt_t ww = 280, hh = 180;
00734
00735 m_fworksAbout = new InfoFrame(gClient->GetRoot(), ww, hh, kVerticalFrame | kFixedSize);
00736 m_fworksAbout->SetWMSizeHints(ww, hh, ww, hh, 0, 0);
00737 m_fworksAbout->SetBackgroundColor(0x2f2f2f);
00738
00739 TGFrame* logoFrame = new TGFrame(m_fworksAbout, 140, 48, kFixedSize);
00740 TImage *logoImg = TImage::Open(FWCheckBoxIcon::coreIcondir()+"logo-fireworks.png");
00741 logoFrame->SetBackgroundPixmap(logoImg->GetPixmap());
00742 m_fworksAbout->AddFrame(logoFrame, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 0, 0, 16, 0));
00743
00744 TGLabel* label = new TGLabel(m_fworksAbout, infoText);
00745 label->SetBackgroundColor(0x2f2f2f);
00746 label->SetForegroundColor(0xffffff);
00747 m_fworksAbout->AddFrame(label, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY));
00748
00749 TGTextButton* btn = new TGTextButton(m_fworksAbout, " OK ");
00750 btn->SetBackgroundColor(0x2f2f2f);
00751 btn->SetForegroundColor(0xffffff);
00752 m_fworksAbout->AddFrame(btn, new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 0, 12));
00753 btn->Connect("Clicked()", "TGMainFrame", m_fworksAbout, "CloseWindow()");
00754
00755 m_fworksAbout->MapSubwindows();
00756 m_fworksAbout->Layout();
00757 }
00758
00759 m_fworksAbout->MapRaised();
00760 }
00761
00762
00763 void
00764 CmsShowMainFrame::bindCSGActionKeys(const TGMainFrame* f) const
00765 {
00766 for (std::vector<CSGAction*>::const_iterator i = m_actionList.begin(); i != m_actionList.end(); ++i)
00767 {
00768 if ((*i)-> getKeycode())
00769 f->BindKey(this, (*i)->getKeycode(), (*i)->getModcode());
00770 }
00771 }