| 1 | /* ======================================================================== *\ | 
|---|
| 2 | ! | 
|---|
| 3 | ! * | 
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction | 
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful | 
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. | 
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY. | 
|---|
| 8 | ! * | 
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its | 
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee, | 
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and | 
|---|
| 12 | ! * that both that copyright notice and this permission notice appear | 
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express | 
|---|
| 14 | ! * or implied warranty. | 
|---|
| 15 | ! * | 
|---|
| 16 | ! | 
|---|
| 17 | ! | 
|---|
| 18 | !   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> | 
|---|
| 19 | !   Author(s): Harald Kornmayer 1/2001 | 
|---|
| 20 | ! | 
|---|
| 21 | !   Copyright: MAGIC Software Development, 2000-2004 | 
|---|
| 22 | ! | 
|---|
| 23 | ! | 
|---|
| 24 | \* ======================================================================== */ | 
|---|
| 25 |  | 
|---|
| 26 | #include "MCameraDisplay.h" | 
|---|
| 27 |  | 
|---|
| 28 | #include <TGButton.h>  // TGTextButton | 
|---|
| 29 |  | 
|---|
| 30 | #include "MGList.h" | 
|---|
| 31 | #include "MEventDisplay.h" | 
|---|
| 32 |  | 
|---|
| 33 | ClassImp(MCameraDisplay); | 
|---|
| 34 |  | 
|---|
| 35 | enum { | 
|---|
| 36 | kButDisplay = 0x100 | 
|---|
| 37 | }; | 
|---|
| 38 |  | 
|---|
| 39 | // -------------------------------------------------------------------------- | 
|---|
| 40 | // | 
|---|
| 41 | //  Create the 'Data Check' GUI Controls (Window) on the screen. To use it | 
|---|
| 42 | //  from within the interpreter you can call a Standard Version with | 
|---|
| 43 | //  'new MCameraDisplay()' | 
|---|
| 44 | // | 
|---|
| 45 | MCameraDisplay::MCameraDisplay(/*const TGWindow *main,*/ const TGWindow *p, | 
|---|
| 46 | const UInt_t w, const UInt_t h) | 
|---|
| 47 | : MBrowser(/*main,*/ p, w, h) | 
|---|
| 48 | { | 
|---|
| 49 | TGTextButton *disp = new TGTextButton(fTop2, "Display Events", kButDisplay); | 
|---|
| 50 | fList->Add(disp); | 
|---|
| 51 |  | 
|---|
| 52 | disp->Associate(this); | 
|---|
| 53 |  | 
|---|
| 54 | TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsLeft, 10, 10, 5, 5); | 
|---|
| 55 | fList->Add(laybut); | 
|---|
| 56 |  | 
|---|
| 57 | fTop2->AddFrame(disp, laybut); | 
|---|
| 58 |  | 
|---|
| 59 | /* | 
|---|
| 60 | const TGPicture *pic2 = fList->GetPicture("marslogo.xpm"); | 
|---|
| 61 | if (pic2) | 
|---|
| 62 | { | 
|---|
| 63 | TGPictureButton *mars  = new TGPictureButton(fTop2, pic2, -1); | 
|---|
| 64 | fList->Add(mars); | 
|---|
| 65 | TGLayoutHints *lay2 = new TGLayoutHints(kLHintsRight, 10, 10, 10, 10); | 
|---|
| 66 | fList->Add(lay2); | 
|---|
| 67 | fTop2->AddFrame(mars,  lay2); | 
|---|
| 68 | } | 
|---|
| 69 | */ | 
|---|
| 70 | MapSubwindows(); | 
|---|
| 71 |  | 
|---|
| 72 | Layout(); | 
|---|
| 73 |  | 
|---|
| 74 | SetWindowName("Camera Display Window"); | 
|---|
| 75 | SetIconName("Camera Dsiplay"); | 
|---|
| 76 |  | 
|---|
| 77 | MapWindow(); | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | // -------------------------------------------------------------------------- | 
|---|
| 81 | // | 
|---|
| 82 | //  Process the GUI control events (here: mainly button clicks) | 
|---|
| 83 | // | 
|---|
| 84 | Bool_t MCameraDisplay::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) | 
|---|
| 85 | { | 
|---|
| 86 | // Process events generated by the buttons in the frame. | 
|---|
| 87 |  | 
|---|
| 88 | if (GET_MSG(msg)!=kC_COMMAND || GET_SUBMSG(msg)!=kCM_BUTTON) | 
|---|
| 89 | return MBrowser::ProcessMessage(msg, parm1, parm2); | 
|---|
| 90 |  | 
|---|
| 91 | switch (parm1) | 
|---|
| 92 | { | 
|---|
| 93 | case kButDisplay: | 
|---|
| 94 | if (!InputFileSelected()) | 
|---|
| 95 | { | 
|---|
| 96 | DisplError("No Input (root) File selected!"); | 
|---|
| 97 | return kTRUE; | 
|---|
| 98 | } | 
|---|
| 99 |  | 
|---|
| 100 | switch (parm1) | 
|---|
| 101 | { | 
|---|
| 102 | case kButDisplay: | 
|---|
| 103 | new MEventDisplay(fInputFile); | 
|---|
| 104 | return kTRUE; | 
|---|
| 105 | } | 
|---|
| 106 | return kTRUE; | 
|---|
| 107 | } | 
|---|
| 108 |  | 
|---|
| 109 | return MBrowser::ProcessMessage(msg, parm1, parm2); | 
|---|
| 110 | } | 
|---|