Changeset 667 for trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc
- Timestamp:
- 03/02/01 13:43:09 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc
r665 r667 23 23 } ; 24 24 25 MGDisplayAdc::MGDisplayAdc ( MHistosAdc * Histos,25 MGDisplayAdc::MGDisplayAdc ( MHistosAdc *histos, 26 26 const TGWindow *p, const TGWindow *main, 27 27 UInt_t w, UInt_t h, … … 29 29 : TGTransientFrame(p, main, w, h, options ) 30 30 { 31 // default constructor 32 // 33 fHists = Histos ; 31 // 32 // default constructor 33 // 34 35 // 36 // NEVER try to delete them in the destructor! 37 // 38 fHists = histos ; 39 40 // 41 // the top frame for the list and some buttons and the Canvas 42 // 43 fFrameTop = new TGHorizontalFrame (this, 60,20, kFitWidth ) ; 44 45 // 46 // left part of top frame 47 // 48 fFT1 = new TGVerticalFrame (fFrameTop, 80,300, kFitWidth ) ; 49 50 fHistoList = new TGListBox ( fFT1, M_LIST_HISTO ) ; 51 fHistoList->Associate( this ) ; 52 fFT1->AddFrame ( fHistoList, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 10 ) ) ; 34 53 35 // the top frame for the list and some buttons and the Canvas 54 fHistoList->Resize(80, 405 ) ; 55 56 fFrameTop->AddFrame (fFT1, new TGLayoutHints ( kLHintsTop , 10, 10, 10, 10 ) ) ; 57 58 // 59 // middle part of top frame 60 // 61 fFT2 = new TGVerticalFrame (fFrameTop, 80,20, kFitWidth ) ; 62 63 fButtonPrev = new TGTextButton ( fFT2, "Prev Histo", M_BUTTON_PREV ) ; 64 fButtonPrev->Associate (this) ; 65 fFT2->AddFrame ( fButtonPrev, new TGLayoutHints (kLHintsLeft | kLHintsTop,10, 10, 0, 10 ) ) ; 66 67 68 fVslider1 = new TGVSlider (fFT2, 250, kSlider1 | kScaleBoth, M_VSId1); 69 70 fVslider1->Associate(this); 71 fVslider1->SetRange(0, 576); 72 fFT2->AddFrame(fVslider1); 73 74 fButtonNext = new TGTextButton ( fFT2, "Next Histo", M_BUTTON_NEXT ) ; 75 fButtonNext->Associate (this) ; 76 fFT2->AddFrame ( fButtonNext, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 77 78 fFrameTop->AddFrame (fFT2, new TGLayoutHints ( kLHintsTop , 10, 10, 10, 10 ) ) ; 79 80 // 81 // Radio buttons, used to select the high, low anh high/low display 82 // 83 fRadio[0] = new TGRadioButton(fFT2, "&High Gain", M_RADIO_HIGH); 84 fFT2->AddFrame ( fRadio[0], new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 85 fRadio[0]->Associate(this); 86 fRadio[0]->SetState(kButtonDown); 87 fHistoLock = kFALSE; 88 fHistoType=1; 89 90 fRadio[1] = new TGRadioButton(fFT2, "&Low Gain", M_RADIO_LOW); 91 fFT2->AddFrame ( fRadio[1], new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 92 fRadio[1]->Associate(this); 93 94 fRadio[2] = new TGRadioButton(fFT2, "H&igh/Low Gain", M_RADIO_LH); 95 fFT2->AddFrame ( fRadio[2], new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 96 fRadio[2]->Associate(this); 97 98 // 99 // right part of top frame 100 // 101 fFT3 = new TGVerticalFrame (fFrameTop, 60, 60, kFitWidth ) ; 102 103 fECanv = new TRootEmbeddedCanvas("fECanv", fFT3, 400, 400 ) ; 104 105 fFT3->AddFrame( fECanv, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10 ) ) ; 106 107 // 108 //the button for reseting the histogram 109 // 110 fButtonReset = new TGTextButton ( fFT3, "Reset histo", M_BUTTON_RESET ) ; 111 fButtonReset->Associate (this) ; 112 fFT3->AddFrame ( fButtonReset, new TGLayoutHints (kLHintsCenterX | kLHintsTop,10, 10, 0, 10 ) ) ; 113 114 fCanv = fECanv->GetCanvas() ; 115 116 fFrameTop->AddFrame (fFT3, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10 ) ) ; 117 118 AddFrame ( fFrameTop, new TGLayoutHints ( kLHintsTop | kLHintsExpandX , 10, 10, 10, 10 ) ) ; 119 120 // 121 // the low frame for the control buttons 122 // 123 fFrameLow = new TGHorizontalFrame (this, 60,20, kFixedWidth ) ; 124 125 fButtonSave = new TGTextButton ( fFrameLow, "Save", M_BUTTON_SAVE ) ; 126 fButtonSave->Associate (this) ; 127 fFrameLow->AddFrame ( fButtonSave, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 128 129 fButtonPrint = new TGTextButton ( fFrameLow, "Print", M_BUTTON_PRINT ) ; 130 fButtonPrint->Associate (this) ; 131 fFrameLow->AddFrame ( fButtonPrint, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 132 133 fButtonPrintAll = new TGTextButton ( fFrameLow, "PrintAll", M_BUTTON_PRINTALL ) ; 134 fButtonPrintAll->Associate (this) ; 135 fFrameLow->AddFrame ( fButtonPrintAll, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 36 136 37 fFrameTop = new TGHorizontalFrame (this, 60,20, kFitWidth ) ; 38 39 40 // left part of top frame 41 fFT1 = new TGVerticalFrame (fFrameTop, 80,300, kFitWidth ) ; 42 43 fHistoList = new TGListBox ( fFT1, M_LIST_HISTO ) ; 44 fHistoList->Associate( this ) ; 45 fFT1->AddFrame ( fHistoList, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 10 ) ) ; 137 fButtonClose = new TGTextButton ( fFrameLow, "Close", M_BUTTON_CLOSE ) ; 138 fButtonClose->Associate (this) ; 139 fFrameLow->AddFrame ( fButtonClose, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 140 AddFrame ( fFrameLow, new TGLayoutHints ( kLHintsBottom | kLHintsExpandX , 10, 10, 10, 10 ) ) ; 46 141 47 fHistoList->Resize(80, 405 ) ; 48 49 50 fFrameTop->AddFrame (fFT1, new TGLayoutHints ( kLHintsTop , 10, 10, 10, 10 ) ) ; 51 52 // middle part of top frame 53 // 54 55 fFT2 = new TGVerticalFrame (fFrameTop, 80,20, kFitWidth ) ; 56 57 fButtonPrev = new TGTextButton ( fFT2, "Prev Histo", M_BUTTON_PREV ) ; 58 fButtonPrev->Associate (this) ; 59 fFT2->AddFrame ( fButtonPrev, new TGLayoutHints (kLHintsLeft | kLHintsTop,10, 10, 0, 10 ) ) ; 60 61 62 fVslider1 = new TGVSlider (fFT2, 250, kSlider1 | kScaleBoth, M_VSId1); 63 64 fVslider1->Associate(this); 65 fVslider1->SetRange(0, 576); 66 fFT2->AddFrame(fVslider1); 67 68 fButtonNext = new TGTextButton ( fFT2, "Next Histo", M_BUTTON_NEXT ) ; 69 fButtonNext->Associate (this) ; 70 fFT2->AddFrame ( fButtonNext, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 71 72 fFrameTop->AddFrame (fFT2, new TGLayoutHints ( kLHintsTop , 10, 10, 10, 10 ) ) ; 73 74 75 76 // Radio buttons, used to select the high, low anh high/low display 77 78 fRadio[0] = new TGRadioButton(fFT2, "&High Gain", M_RADIO_HIGH); 79 fFT2->AddFrame ( fRadio[0], new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 80 fRadio[0]->Associate(this); 81 fRadio[0]->SetState(kButtonDown); 82 fHistoLock = kFALSE; 83 fHistoType=1; 84 85 fRadio[1] = new TGRadioButton(fFT2, "&Low Gain", M_RADIO_LOW); 86 fFT2->AddFrame ( fRadio[1], new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 87 fRadio[1]->Associate(this); 88 89 fRadio[2] = new TGRadioButton(fFT2, "H&igh/Low Gain", M_RADIO_LH); 90 fFT2->AddFrame ( fRadio[2], new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 91 fRadio[2]->Associate(this); 92 93 94 95 // right part of top frame 96 // 97 fFT3 = new TGVerticalFrame (fFrameTop, 60, 60, kFitWidth ) ; 98 142 // 143 // 144 // 145 BuildHistoList() ; 146 147 MapSubwindows(); 148 149 Layout(); 150 151 SetWindowName("ADC Spectra"); 152 SetIconName("ADC Spectra"); 153 154 // 155 // Here the initial display is set to hitogram 0 156 // 157 fHistoList->Select(1, kTRUE); 158 DrawSelectedHi() ; 159 SetSelectedTopEntry(); 160 fCanv->Modified() ; 161 fCanv->Update() ; 162 SetSelectedPos(); 163 164 MapWindow(); 165 SetWMSizeHints(550, 550, 1000, 1000, 1, 1); 166 } 167 168 MGDisplayAdc::~MGDisplayAdc () 169 { 170 delete fButtonSave ; 171 delete fButtonPrint ; 172 delete fButtonPrintAll ; 173 delete fButtonClose ; 99 174 100 101 fECanv = new TRootEmbeddedCanvas("fECanv", fFT3, 400, 400 ) ; 102 103 fFT3->AddFrame( fECanv, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10 ) ) ; 104 105 106 //the button for reseting the histogram 107 fButtonReset = new TGTextButton ( fFT3, "Reset histo", M_BUTTON_RESET ) ; 108 fButtonReset->Associate (this) ; 109 fFT3->AddFrame ( fButtonReset, new TGLayoutHints (kLHintsCenterX | kLHintsTop,10, 10, 0, 10 ) ) ; 110 // 111 112 113 114 fCanv = fECanv->GetCanvas() ; 115 116 fFrameTop->AddFrame (fFT3, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10 ) ) ; 117 118 AddFrame ( fFrameTop, new TGLayoutHints ( kLHintsTop | kLHintsExpandX , 10, 10, 10, 10 ) ) ; 119 120 121 // fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 122 // 123 // the low frame for the control buttons 124 // 125 fFrameLow = new TGHorizontalFrame (this, 60,20, kFixedWidth ) ; 126 127 fButtonSave = new TGTextButton ( fFrameLow, "Save", M_BUTTON_SAVE ) ; 128 fButtonSave->Associate (this) ; 129 fFrameLow->AddFrame ( fButtonSave, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 130 131 fButtonPrint = new TGTextButton ( fFrameLow, "Print", M_BUTTON_PRINT ) ; 132 fButtonPrint->Associate (this) ; 133 fFrameLow->AddFrame ( fButtonPrint, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 134 135 fButtonPrintAll = new TGTextButton ( fFrameLow, "PrintAll", M_BUTTON_PRINTALL ) ; 136 fButtonPrintAll->Associate (this) ; 137 fFrameLow->AddFrame ( fButtonPrintAll, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 138 139 140 141 fButtonClose = new TGTextButton ( fFrameLow, "Close", M_BUTTON_CLOSE ) ; 142 fButtonClose->Associate (this) ; 143 fFrameLow->AddFrame ( fButtonClose, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 144 AddFrame ( fFrameLow, new TGLayoutHints ( kLHintsBottom | kLHintsExpandX , 10, 10, 10, 10 ) ) ; 145 146 // 147 // 148 // 149 BuildHistoList() ; 150 151 MapSubwindows(); 152 153 Layout(); 154 155 SetWindowName("ADC Spectra"); 156 SetIconName("ADC Spectra"); 157 158 //Here the initial display is set to hitogram 0 159 160 fHistoList->Select(1, kTRUE); 161 DrawSelectedHi() ; 162 SetSelectedTopEntry(); 163 fCanv->Modified() ; 164 fCanv->Update() ; 165 SetSelectedPos(); 166 167 MapWindow(); 168 SetWMSizeHints(550, 550, 1000, 1000, 1, 1); 169 170 } 171 172 // ====================================================================== 173 // ====================================================================== 174 // 175 // 176 177 MGDisplayAdc::~MGDisplayAdc () 178 { 179 180 181 delete fButtonSave ; 182 delete fButtonPrint ; 183 delete fButtonPrintAll ; 184 delete fButtonClose ; 185 186 delete fButtonPrev; 187 delete fButtonNext ; 188 delete fButtonReset ; 189 190 delete fVslider1; 191 delete fECanv ; 192 193 194 delete fHists; 195 delete fHistoList ; 196 delete fRadio[2]; 197 delete fRadio[1]; 198 delete fRadio[0]; 199 delete fFT1 ; 200 delete fFT2 ; 201 delete fFT3 ; 202 delete fFrameLow ; 203 delete fFrameTop ; 175 delete fButtonPrev; 176 delete fButtonNext ; 177 delete fButtonReset ; 178 179 delete fVslider1; 180 delete fECanv ; 181 182 delete fHistoList ; 183 delete fRadio[2]; 184 delete fRadio[1]; 185 delete fRadio[0]; 186 delete fFT1 ; 187 delete fFT2 ; 188 delete fFT3 ; 189 delete fFrameLow ; 190 delete fFrameTop ; 204 191 } 205 192 … … 297 284 // 298 285 case M_BUTTON_PREV: 299 if (GetSelected()-1 != 0) 286 case M_BUTTON_NEXT: 287 if ((parm1==M_BUTTON_PREV && GetSelected()-1 > 0) || 288 (parm2==M_BUTTON_NEXT && GetSelected()-1 < 576)) 300 289 { 301 290 if (fHistoLock == kTRUE ) … … 312 301 SelectSelected(); 313 302 DrawSelectedHi() ; 314 }315 316 SetSelectedTopEntry();317 fCanv->Modified() ;318 fCanv->Update() ;319 SetSelectedPos();320 }321 if (fRadio[1]->GetState() != kButtonDown)322 break;323 324 fRadio[0]->SetState(kButtonDown);325 fRadio[1]->SetState(kButtonUp);326 327 break;328 329 //The same as above, but for next histogram330 case M_BUTTON_NEXT:331 if (GetSelected()-1 != 576)332 {333 if (fHistoLock == kTRUE )334 {335 fCanvas->cd(1);336 SelectSelected();337 DrawSelectedHi() ;338 fCanvas->cd(2);339 DrawSelectedLo() ;340 }341 else342 {343 fCanv->cd();344 SelectSelected();345 DrawSelectedHi() ;346 303 347 304 } … … 357 314 fRadio[0]->SetState(kButtonDown); 358 315 fRadio[1]->SetState(kButtonUp); 359 360 316 break; 361 317 … … 370 326 { 371 327 case M_RADIO_HIGH: 372 fRadio[1]->SetState(kButtonUp); 373 fRadio[2]->SetState(kButtonUp); 328 case M_RADIO_LOW: 329 if (parm1 == M_RADIO_HIGH) 330 { 331 fRadio[1]->SetState(kButtonUp); 332 fRadio[2]->SetState(kButtonUp); 333 fHistoType=1; 334 } 335 else 336 { 337 fRadio[0]->SetState(kButtonUp); 338 fRadio[2]->SetState(kButtonUp); 339 fHistoType = 2; 340 } 374 341 fHistoLock = kFALSE; 375 fHistoType=1; 342 376 343 fCanv->cd(); 377 344 SelectSelected(); 378 DrawSelectedHi() ; 345 parm1 == M_RADIO_HIGH ? DrawSelectedHi() : DrawSelectedLo(); 346 379 347 SetSelectedTopEntry(); 380 348 fCanv->Modified() ; … … 383 351 break; 384 352 385 case M_RADIO_LOW:386 fRadio[0]->SetState(kButtonUp);387 fRadio[2]->SetState(kButtonUp);388 fCanv->cd();389 fHistoLock = kFALSE;390 fHistoType = 2;391 392 SelectSelected();393 DrawSelectedLo() ;394 SetSelectedTopEntry();395 396 fCanv->Modified() ;397 fCanv->Update() ;398 SetSelectedPos();399 break;400 401 353 case M_RADIO_LH: 402 354 fRadio[0]->SetState(kButtonUp);
Note:
See TracChangeset
for help on using the changeset viewer.