- Timestamp:
- 09/28/01 15:52:10 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r956 r958 22 22 - removed output stuff from PostProcessing 23 23 24 * meventdisp/MGFadcDisp.[h,cc] :24 * meventdisp/MGFadcDisp.[h,cc], mdatacheck/MGDisplayAdc.[h,cc]: 25 25 - reorganized code (constructor) 26 26 - reorganized deletion of gui objects -
trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc
r749 r958 26 26 #include "MGDisplayAdc.h" 27 27 28 #include <iostream.h> // cout for debugging 29 28 30 #include <TGButton.h> // TGTextButton 29 31 #include <TCanvas.h> // TCanvas.h 30 32 #include <TGMsgBox.h> // TGMsgBox 33 #include <TGListBox.h> // TGListBox 34 #include <TGSlider.h> // TGVSlider 35 #include <TGButtonGroup.h> // TGVButtonGroup 31 36 #include <TRootEmbeddedCanvas.h> // TRootEmbeddedCanvas 32 37 33 enum ComIdentDisplayAdc { 34 M_BUTTON_SAVE, 35 M_BUTTON_PRINT, 36 M_BUTTON_PRINTALL, 37 M_BUTTON_CLOSE , 38 39 M_BUTTON_PREV, 40 M_BUTTON_NEXT, 41 42 M_LIST_HISTO, 43 M_RADIO_HIGH, 44 M_RADIO_LOW, 45 M_RADIO_LH, 46 M_BUTTON_RESET, 47 M_VSId1 48 } ; 49 50 MGDisplayAdc::MGDisplayAdc ( MHFadcCam *histos, 51 const TGWindow *p, const TGWindow *main, 52 UInt_t w, UInt_t h, 53 UInt_t options) 54 : TGTransientFrame(p, main, w, h, options ) 55 { 56 // 57 // default constructor 58 // 59 60 // 61 // NEVER try to delete them in the destructor! 62 // 63 fHists = histos ; 64 65 // 66 // the top frame for the list and some buttons and the Canvas 67 // 68 fFrameTop = new TGHorizontalFrame (this, 60,20, kFitWidth ) ; 69 70 // 71 // left part of top frame 72 // 73 fFT1 = new TGVerticalFrame (fFrameTop, 80,300, kFitWidth ) ; 74 75 fHistoList = new TGListBox ( fFT1, M_LIST_HISTO ) ; 76 fHistoList->Associate( this ) ; 77 fFT1->AddFrame ( fHistoList, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 10 ) ) ; 78 79 fHistoList->Resize(80, 405 ) ; 80 81 fFrameTop->AddFrame (fFT1, new TGLayoutHints ( kLHintsTop , 10, 10, 10, 10 ) ) ; 38 #include "MHFadcCam.h" 39 40 enum ComIdentDisplayAdc 41 { 42 M_BUTTON_SAVE, 43 M_BUTTON_PRINT, 44 M_BUTTON_PRINTALL, 45 M_BUTTON_CLOSE, 46 47 M_BUTTON_PREV, 48 M_BUTTON_NEXT, 49 50 M_LIST_HISTO, 51 M_RADIO_HI, 52 M_RADIO_LO, 53 M_RADIO_LH, 54 M_BUTTON_RESET, 55 M_VSId1 56 }; 57 58 void MGDisplayAdc::AddFrameTop(TGHorizontalFrame *frame) 59 { 60 // 61 // left part of top frame 62 // 63 TGVerticalFrame *left = new TGVerticalFrame(frame, 80, 300, kFitWidth); 64 fList->Add(left); 65 66 fHistoList = new TGListBox (left, M_LIST_HISTO); 67 fHistoList->Associate(this); 68 fHistoList->Resize(80, 405); 69 70 fList->Add(fHistoList); 71 72 TGLayoutHints *laylist = new TGLayoutHints(kLHintsNormal, 10, 10, 10, 10); 73 fList->Add(laylist); 74 75 left->AddFrame(fHistoList, laylist); 82 76 83 77 // 84 78 // middle part of top frame 85 79 // 86 fFT2 = new TGVerticalFrame (fFrameTop, 80,20, kFitWidth ) ; 87 88 fButtonPrev = new TGTextButton ( fFT2, "Prev Histo", M_BUTTON_PREV ) ; 89 fButtonPrev->Associate (this) ; 90 fFT2->AddFrame ( fButtonPrev, new TGLayoutHints (kLHintsLeft | kLHintsTop,10, 10, 0, 10 ) ) ; 91 92 93 fVslider1 = new TGVSlider (fFT2, 250, kSlider1 | kScaleBoth, M_VSId1); 94 95 fVslider1->Associate(this); 96 fVslider1->SetRange(0, 576); 97 fFT2->AddFrame(fVslider1); 98 99 fButtonNext = new TGTextButton ( fFT2, "Next Histo", M_BUTTON_NEXT ) ; 100 fButtonNext->Associate (this) ; 101 fFT2->AddFrame ( fButtonNext, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 102 103 fFrameTop->AddFrame (fFT2, new TGLayoutHints ( kLHintsTop , 10, 10, 10, 10 ) ) ; 104 105 // 106 // Radio buttons, used to select the high, low anh high/low display 107 // 108 fRadio[0] = new TGRadioButton(fFT2, "&High Gain", M_RADIO_HIGH); 109 fFT2->AddFrame ( fRadio[0], new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 110 fRadio[0]->Associate(this); 111 fRadio[0]->SetState(kButtonDown); 112 fHistoLock = kFALSE; 113 fHistoType=1; 114 115 fRadio[1] = new TGRadioButton(fFT2, "&Low Gain", M_RADIO_LOW); 116 fFT2->AddFrame ( fRadio[1], new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 117 fRadio[1]->Associate(this); 118 119 fRadio[2] = new TGRadioButton(fFT2, "H&igh/Low Gain", M_RADIO_LH); 120 fFT2->AddFrame ( fRadio[2], new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) ) ; 121 fRadio[2]->Associate(this); 80 TGVerticalFrame *mid = new TGVerticalFrame(frame, 80, 20, kFitWidth); 81 fList->Add(mid); 82 83 // --- 84 85 TGTextButton *prev = new TGTextButton(mid, "Prev Histo", M_BUTTON_PREV); 86 TGTextButton *next = new TGTextButton(mid, "Next Histo", M_BUTTON_NEXT); 87 prev->Associate(this); 88 next->Associate(this); 89 90 fList->Add(prev); 91 fList->Add(next); 92 93 // --- 94 95 fSlider = new TGVSlider(mid, 250, kSlider1|kScaleBoth, M_VSId1); 96 fSlider->Associate(this); 97 fSlider->SetRange(1, 577); 98 99 fList->Add(fSlider); 100 101 // --- 102 103 TGVButtonGroup *group = new TGVButtonGroup(mid); 104 fList->Add(group); 105 106 TGRadioButton *radio1 = new TGRadioButton(group, "&High Gain", M_RADIO_HI); 107 TGRadioButton *radio2 = new TGRadioButton(group, "&Low Gain", M_RADIO_LO); 108 TGRadioButton *radio3 = new TGRadioButton(group, "H&igh/Low Gain", M_RADIO_LH); 109 110 /* FIXME: 111 112 ~TGRadioButton calls TGRadioButton::TGFrame::GetMainFrame 113 which calles fParent->GetFrame() 114 115 fList->Add(radio1); 116 fList->Add(radio2); 117 fList->Add(radio3); 118 */ 119 120 radio1->SetState(kButtonDown); 121 122 radio1->Associate(this); 123 radio2->Associate(this); 124 radio3->Associate(this); 125 126 // --- 127 128 TGLayoutHints *laybut1 = new TGLayoutHints(kLHintsNormal, 10, 10, 0, 10); 129 TGLayoutHints *laybut2 = new TGLayoutHints(kLHintsNormal, 10, 10, 10, 5); 130 131 fList->Add(laybut1); 132 fList->Add(laybut2); 133 134 mid->AddFrame(prev, laybut1); 135 mid->AddFrame(fSlider); 136 mid->AddFrame(next, laybut2); 137 mid->AddFrame(group, laybut2); 122 138 123 139 // 124 140 // right part of top frame 125 141 // 126 fFT3 = new TGVerticalFrame (fFrameTop, 60, 60, kFitWidth ) ; 127 128 fECanv = new TRootEmbeddedCanvas("fECanv", fFT3, 400, 400 ) ; 129 130 fFT3->AddFrame( fECanv, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10 ) ) ; 131 132 // 133 //the button for reseting the histogram 134 // 135 fButtonReset = new TGTextButton ( fFT3, "Reset histo", M_BUTTON_RESET ) ; 136 fButtonReset->Associate (this) ; 137 fFT3->AddFrame ( fButtonReset, new TGLayoutHints (kLHintsCenterX | kLHintsTop,10, 10, 0, 10 ) ) ; 138 139 fCanv = fECanv->GetCanvas() ; 140 141 fFrameTop->AddFrame (fFT3, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10 ) ) ; 142 143 AddFrame ( fFrameTop, new TGLayoutHints ( kLHintsTop | kLHintsExpandX , 10, 10, 10, 10 ) ) ; 144 142 TGVerticalFrame *right = new TGVerticalFrame(frame, 60, 60, kFitWidth); 143 fList->Add(right); 144 145 TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas("fECanv", right, 800, 400); 146 fList->Add(canvas); 147 148 TGLayoutHints *laycanv = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY, 10, 10, 10, 10); 149 fList->Add(laycanv); 150 151 right->AddFrame(canvas, laycanv); 152 153 154 TGTextButton *reset = new TGTextButton(right, "Reset histo", M_BUTTON_RESET); 155 reset->Associate(this); 156 fList->Add(reset); 157 158 TGLayoutHints *layreset = new TGLayoutHints(kLHintsCenterX|kLHintsTop,10, 10, 0, 10); 159 fList->Add(layreset); 160 161 right->AddFrame(reset, layreset); 162 163 // --- 164 165 fCanvas = canvas->GetCanvas(); 166 167 // 168 // layout the three subframes 169 // 170 TGLayoutHints *layframe1 = new TGLayoutHints(kLHintsTop, 10, 10, 10, 10); 171 TGLayoutHints *layframe2 = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY, 10, 10, 10, 10); 172 fList->Add(layframe1); 173 fList->Add(layframe2); 174 175 frame->AddFrame(left, layframe1); 176 frame->AddFrame(mid, layframe1); 177 frame->AddFrame(right, layframe2); 178 } 179 180 void MGDisplayAdc::AddFrameLow(TGHorizontalFrame *frame) 181 { 145 182 // 146 183 // the low frame for the control buttons 147 184 // 148 fFrameLow = new TGHorizontalFrame (this, 60,20, kFixedWidth ) ; 149 150 fButtonSave = new TGTextButton ( fFrameLow, "Save", M_BUTTON_SAVE ) ; 151 fButtonSave->Associate (this) ; 152 fFrameLow->AddFrame ( fButtonSave, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 153 154 fButtonPrint = new TGTextButton ( fFrameLow, "Print", M_BUTTON_PRINT ) ; 155 fButtonPrint->Associate (this) ; 156 fFrameLow->AddFrame ( fButtonPrint, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 157 158 fButtonPrintAll = new TGTextButton ( fFrameLow, "PrintAll", M_BUTTON_PRINTALL ) ; 159 fButtonPrintAll->Associate (this) ; 160 fFrameLow->AddFrame ( fButtonPrintAll, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 161 162 fButtonClose = new TGTextButton ( fFrameLow, "Close", M_BUTTON_CLOSE ) ; 163 fButtonClose->Associate (this) ; 164 fFrameLow->AddFrame ( fButtonClose, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) ) ; 165 AddFrame ( fFrameLow, new TGLayoutHints ( kLHintsBottom | kLHintsExpandX , 10, 10, 10, 10 ) ) ; 166 167 // 168 // 169 // 170 BuildHistoList() ; 171 185 TGTextButton *but1 = new TGTextButton(frame, "Save", M_BUTTON_SAVE); 186 TGTextButton *but2 = new TGTextButton(frame, "Print", M_BUTTON_PRINT); 187 TGTextButton *but3 = new TGTextButton(frame, "PrintAll", M_BUTTON_PRINTALL); 188 TGTextButton *but4 = new TGTextButton(frame, "Close", M_BUTTON_CLOSE); 189 190 but1->Associate(this); 191 but2->Associate(this); 192 but3->Associate(this); 193 but4->Associate(this); 194 195 fList->Add(but1); 196 fList->Add(but2); 197 fList->Add(but3); 198 fList->Add(but4); 199 200 TGLayoutHints *laybut = new TGLayoutHints(kLHintsNormal, 10, 10, 5, 5); 201 fList->Add(laybut); 202 203 frame->AddFrame(but1, laybut); 204 frame->AddFrame(but2, laybut); 205 frame->AddFrame(but3, laybut); 206 frame->AddFrame(but4, laybut); 207 } 208 209 MGDisplayAdc::MGDisplayAdc(MHFadcCam *histos, 210 const TGWindow *p, const TGWindow *main, 211 UInt_t w, UInt_t h, 212 UInt_t options) 213 : TGTransientFrame(p, main, w, h, options), fHists(histos), fHistoType(M_RADIO_HI) 214 { 215 fList = new TList; 216 fList->SetOwner(); 217 218 // 219 // Create the to frames 220 // 221 TGHorizontalFrame *frametop = new TGHorizontalFrame(this, 60, 20, kFitWidth); 222 TGHorizontalFrame *framelow = new TGHorizontalFrame(this, 60, 20, kFixedWidth); 223 224 // 225 // Add frames to 'autodel' 226 // 227 fList->Add(frametop); 228 fList->Add(framelow); 229 230 // 231 // Add the gui elements to the two frames 232 // 233 AddFrameTop(frametop); 234 AddFrameLow(framelow); 235 236 // 237 // layout the two frames in this frame 238 // 239 TGLayoutHints *laytop = new TGLayoutHints(kLHintsTop|kLHintsExpandX, 10, 10, 10, 10); 240 TGLayoutHints *laylow = new TGLayoutHints(kLHintsBottom|kLHintsExpandX, 10, 10, 10, 10); 241 242 AddFrame(frametop, laytop); 243 AddFrame(framelow, laylow); 244 245 // 246 // Setup interieur 247 // 248 BuildHistoList(); 249 250 // 251 // Here the initial display is set to hitogram 0 252 // 253 fHistoList->Select(1); 254 UpdateHist(); 255 256 // 257 // Setup frame 258 // 172 259 MapSubwindows(); 173 260 … … 176 263 SetWindowName("ADC Spectra"); 177 264 SetIconName("ADC Spectra"); 178 179 //180 // Here the initial display is set to hitogram 0181 //182 fHistoList->Select(1, kTRUE);183 DrawSelectedHi() ;184 SetSelectedTopEntry();185 fCanv->Modified() ;186 fCanv->Update() ;187 SetSelectedPos();188 265 189 266 MapWindow(); … … 191 268 } 192 269 193 MGDisplayAdc::~MGDisplayAdc 270 MGDisplayAdc::~MGDisplayAdc() 194 271 { 195 delete fButtonSave ; 196 delete fButtonPrint ; 197 delete fButtonPrintAll ; 198 delete fButtonClose ; 199 200 delete fButtonPrev; 201 delete fButtonNext ; 202 delete fButtonReset ; 203 204 delete fVslider1; 205 delete fECanv ; 206 207 delete fHistoList ; 208 delete fRadio[2]; 209 delete fRadio[1]; 210 delete fRadio[0]; 211 delete fFT1 ; 212 delete fFT2 ; 213 delete fFT3 ; 214 delete fFrameLow ; 215 delete fFrameTop ; 272 delete fList; 216 273 } 274 275 // ====================================================================== 276 277 void MGDisplayAdc::CloseWindow() 278 { 279 // Got close message for this MainFrame. Calls parent CloseWindow() 280 // (which destroys the window) and terminate the application. 281 // The close message is generated by the window manager when its close 282 // window menu item is selected. 283 // 284 delete this; 285 } 286 287 217 288 218 289 // ====================================================================== 219 290 // ====================================================================== 220 291 221 void MGDisplayAdc::CloseWindow() 222 { 223 // Got close message for this MainFrame. Calls parent CloseWindow() 224 // (which destroys the window) and terminate the application. 225 // The close message is generated by the window manager when its close 226 // window menu item is selected. 227 // 228 delete this ; 229 // TGTransientFrame::CloseWindow(); 230 // TGMainFrame::CloseWindow(); 231 // gROOT->GetApplication()->Terminate(0) ; 232 } 233 234 235 236 // ====================================================================== 237 // ====================================================================== 238 239 Bool_t MGDisplayAdc::BuildHistoList(Int_t type ) 292 Bool_t MGDisplayAdc::BuildHistoList() 240 293 { 241 294 // … … 248 301 // to plot the low gain 249 302 // 250 251 303 const Int_t nhi = fHists->GetEntries(); 252 for ( Int_t i=0 ; i < nhi; i++ ) {253 fHistoList->AddEntry(fHists->GetHistHi(i)->GetName(), i+1) 254 } 255 256 fHistoList-> MapSubwindows();257 fHistoList->Layout() ; 258 return kTRUE 304 for (Int_t i=0 ; i<nhi; i++) 305 fHistoList->AddEntry(fHists->GetHistHi(i)->GetName(), i+1); 306 307 fHistoList->MapSubwindows(); 308 fHistoList->Layout(); 309 310 return kTRUE; 259 311 } 260 312 261 313 // ====================================================================== 262 314 // ====================================================================== 315 void MGDisplayAdc::UpdateHist() 316 { 317 const Int_t selected = fHistoList->GetSelected(); 318 319 fHistoList->Select(selected); // ??? 320 321 fCanvas->Clear(); 322 323 switch (fHistoType) 324 { 325 case M_RADIO_HI: 326 case M_RADIO_LO: 327 fCanvas->Divide(1, 1); 328 329 fCanvas->cd(); 330 if (fHistoType==M_RADIO_HI) 331 fHists->DrawHi(selected-1); 332 else 333 fHists->DrawLo(selected-1); 334 break; 335 336 case M_RADIO_LH: 337 fCanvas->Divide(1, 2); 338 339 fCanvas->cd(1); 340 fHists->DrawHi(selected-1); 341 342 fCanvas->cd(2); 343 fHists->DrawLo(selected-1); 344 break; 345 } 346 347 fHistoList->SetTopEntry(selected); 348 349 fCanvas->Modified(); 350 fCanvas->Update(); 351 352 fSlider->SetPosition(selected); 353 } 263 354 264 355 Bool_t MGDisplayAdc::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) … … 267 358 // Process events generated by the buttons in the frame. 268 359 // 269 Int_t buttons = 4, retval = 0 ;270 //Char_t wort[100] ;271 //Char_t extens[5] ;272 //Char_t command[110] ;273 274 //TGFileItem *item ; // to process items in the file view container275 //void *np = NULL ; // null pointer276 277 360 switch (GET_MSG(msg)) 278 361 { … … 281 364 { 282 365 case kCM_BUTTON: 283 284 366 switch (parm1) 285 367 { 286 368 case M_BUTTON_SAVE: 287 new TGMsgBox(fClient->GetRoot(), this, 288 "WARNING!", 289 "Not implemented yet.", 290 kMBIconExclamation, buttons, &retval); 291 break ; 369 cout << "Sorry, not yet implemented!" << endl; 370 return kTRUE; 292 371 293 372 case M_BUTTON_PRINT: 294 break; 373 cout << "Sorry, not yet implemented!" << endl; 374 return kTRUE; 295 375 296 376 case M_BUTTON_RESET: 297 new TGMsgBox(fClient->GetRoot(), this, 298 "WARNING!", 299 "Not implemented yet.", 300 kMBIconExclamation, buttons, &retval); 301 break; 377 cout << "Sorry, not yet implemented!" << endl; 378 return kTRUE; 302 379 303 380 case M_BUTTON_CLOSE: 304 CloseWindow() ; 305 break ; 306 307 // The selection for "Next Histogram". 308 // There is also a link for the sicronisation with the slider 309 // 381 CloseWindow(); 382 return kTRUE; 383 310 384 case M_BUTTON_PREV: 311 385 case M_BUTTON_NEXT: 312 if ((parm1==M_BUTTON_PREV && GetSelected()-1 > 0) ||313 (parm2==M_BUTTON_NEXT && GetSelected()-1 < 576))314 386 { 315 if (fHistoLock == kTRUE ) 316 { 317 fCanvas->cd(1); 318 SelectSelected(); 319 DrawSelectedHi() ; 320 fCanvas->cd(2); 321 DrawSelectedLo() ; 322 } 323 else 324 { 325 fCanv->cd(); 326 SelectSelected(); 327 DrawSelectedHi() ; 328 329 } 330 SetSelectedTopEntry(); 331 fCanv->Modified() ; 332 fCanv->Update() ; 333 SetSelectedPos(); 334 387 const Int_t selected = fHistoList->GetSelected(); 388 389 if ((parm1==M_BUTTON_PREV && selected==1) || 390 (parm1==M_BUTTON_NEXT && selected==577)) 391 return kTRUE; 392 393 fHistoList->Select(parm1==M_BUTTON_PREV ? selected-1 : selected+1); 394 UpdateHist(); 335 395 } 336 if (fRadio[1]->GetState() != kButtonDown) 337 break; 338 339 fRadio[0]->SetState(kButtonDown); 340 fRadio[1]->SetState(kButtonUp); 341 break; 342 343 default: 344 break ; 396 return kTRUE; 345 397 } 346 break;398 return kTRUE; 347 399 348 400 case kCM_RADIOBUTTON: 349 350 401 switch(parm1) 351 402 { 352 case M_RADIO_HIGH: 353 case M_RADIO_LOW: 354 if (parm1 == M_RADIO_HIGH) 355 { 356 fRadio[1]->SetState(kButtonUp); 357 fRadio[2]->SetState(kButtonUp); 358 fHistoType=1; 359 } 360 else 361 { 362 fRadio[0]->SetState(kButtonUp); 363 fRadio[2]->SetState(kButtonUp); 364 fHistoType = 2; 365 } 366 fHistoLock = kFALSE; 367 368 fCanv->cd(); 369 SelectSelected(); 370 parm1 == M_RADIO_HIGH ? DrawSelectedHi() : DrawSelectedLo(); 371 372 SetSelectedTopEntry(); 373 fCanv->Modified() ; 374 fCanv->Update() ; 375 SetSelectedPos(); 376 break; 377 403 case M_RADIO_HI: 404 case M_RADIO_LO: 378 405 case M_RADIO_LH: 379 fRadio[0]->SetState(kButtonUp); 380 fRadio[1]->SetState(kButtonUp); 381 382 if (fHistoLock == kFALSE) 383 { 384 fCanvas = fECanv->GetCanvas(); 385 fCanvas->Divide(1,2, 0, 0 ,0); 386 387 fCanv->Modified() ; 388 fCanv->Update() ; 389 fHistoLock = kTRUE; 390 fHistoType = 3; 391 } 392 393 fCanvas->cd(1); 394 395 SelectSelected(); 396 DrawSelectedHi() ; 397 SetSelectedTopEntry(); 398 399 fCanvas->cd(2); 400 SelectSelected(); 401 DrawSelectedLo() ; 402 SetSelectedTopEntry(); 403 404 fCanv->Modified() ; 405 fCanv->Update(); 406 407 default: 408 break; 406 fHistoType = parm1; 407 UpdateHist(); 408 return kTRUE; 409 409 } 410 break;410 return kTRUE; 411 411 } 412 412 413 413 case kCM_LISTBOX: 414 if (GET_SUBMSG(msg) != M_LIST_HISTO) 415 break; 416 417 if (fHistoLock == kTRUE ) 418 { 419 fCanvas->cd(1); 420 DrawSelectedHi() ; 421 fCanvas->cd(2); 422 DrawSelectedLo() ; 423 } 424 else 425 { 426 fCanv->cd() ; 427 DrawSelectedHi() ; 428 } 429 fCanv->Modified() ; 430 fCanv->Update() ; 431 SetSelectedPos(); 432 break ; 433 434 /* 435 case kC_CONTAINER: 436 switch (GET_SUBMSG(msg)) 437 { 438 439 case kCT_ITEMDBLCLICK: 440 break; 441 442 default: 443 break ; 444 } 445 */ 414 if (GET_SUBMSG(msg) == M_LIST_HISTO) 415 UpdateHist(); 416 417 return kTRUE; 446 418 447 419 case kC_VSLIDER: 448 420 if (GET_SUBMSG(msg)!=kSL_POS || parm1!=M_VSId1) 449 break;421 return kTRUE; 450 422 451 423 // Check for the slider movement and sicronise with TGListBox 452 if (parm2<0 || parm2>576) 453 break; 454 455 if (fHistoLock==kTRUE) 456 { 457 fCanvas->cd(1) ; 458 DrawHi(parm2) ; 459 fHistoList->Select(parm2+1, kTRUE); 460 461 fCanvas->cd(2) ; 462 DrawLo(parm2) ; 463 } 464 else 465 { 466 fCanv->cd() ; 467 DrawHi(parm2) ; 468 } 469 470 fHistoList->Select(parm2+1, kTRUE); 471 SetSelectedTopEntry(); 472 473 fCanv->Modified() ; 474 fCanv->Update() ; 475 476 if (fRadio[1]->GetState() != kButtonDown) 477 break; 478 479 fRadio[0]->SetState(kButtonDown); 480 fRadio[1]->SetState(kButtonUp); 481 482 break; 483 424 if (parm2<1 || parm2>577) 425 return kTRUE; 426 427 fHistoList->Select(parm2); 428 UpdateHist(); 429 return kTRUE; 484 430 } 431 485 432 return kTRUE; 486 433 } -
trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.h
r698 r958 5 5 #include <TGFrame.h> // TGTransientFrame 6 6 #endif 7 #ifndef ROOT_TGListBox8 #include <TGListBox.h> // TGListBox9 #endif10 #ifndef ROOT_TGSlider11 #include <TGSlider.h> // TGVSlider12 #endif13 7 14 #ifndef MHFADCCAM_H 15 #include "MHFadcCam.h" 16 #endif 8 class TList; 9 class TCanvas; 17 10 11 class MHFadcCam; 12 13 class TGVSlider; 14 class TGListBox; 18 15 class TGTextButton; 16 class TGRadioButton; 19 17 class TRootEmbeddedCanvas; 20 class TCanvas;21 class TGRadioButton;22 18 23 class MGDisplayAdc : public TGTransientFrame { 24 private: 25 26 MHFadcCam *fHists; // Pointer to Container with the histograms 27 28 // Create a main frame with a number of different buttons. 29 // 30 TGCompositeFrame *fFrameTop ; // top part of the main window 31 TGCompositeFrame *fFrameLow ; // low part of the main window 32 33 TGVerticalFrame *fFT1, *fFT2, *fFT3 ; 34 35 TGListBox *fHistoList ; 36 TGTextButton *fButtonPrev, *fButtonNext , *fButtonReset ; 37 38 TRootEmbeddedCanvas *fECanv , *fECanvLow; 19 class MGDisplayAdc : public TGTransientFrame 20 { 21 private: 22 MHFadcCam *fHists; // Pointer to Container with the histograms 39 23 40 TGTextButton *fButtonSave, *fButtonPrint, *fButtonPrintAll, *fButtonClose ; 41 42 TCanvas *fCanv ; 43 44 45 //for sliders 46 47 TGVSlider *fVslider1; 48 49 void DrawHi(Int_t i) { fHists->DrawHi(i); } 50 void DrawLo(Int_t i) { fHists->DrawLo(i); } 51 void DrawSelectedHi() { DrawHi( GetSelected()-1) ; } 52 void DrawSelectedLo() { DrawLo( GetSelected()-1) ; } 53 Int_t GetSelected() { return fHistoList->GetSelected(); } 54 void SelectSelected() { fHistoList->Select(GetSelected()-1, kTRUE); } 55 void SetSelectedTopEntry() { fHistoList->SetTopEntry(GetSelected()); } 56 void SetSelectedPos() { fVslider1->SetPosition( GetSelected()-1); } 57 58 public: 59 60 //for radio buttons 24 TList *fList; 25 TCanvas *fCanvas; 26 TGVSlider *fSlider; 27 TGListBox *fHistoList; 61 28 62 TGRadioButton *fRadio[3];29 Int_t fHistoType; 63 30 64 65 Int_t fHistoType; 66 Bool_t fHistoLock; 67 // 68 69 70 TGPicture *fPicture; 71 TCanvas *fCanvas; 72 73 MGDisplayAdc(MHFadcCam *fHists , 74 const TGWindow *p, const TGWindow *main, 75 UInt_t w, UInt_t h, 76 UInt_t options = kMainFrame | kVerticalFrame ) ; 77 78 ~MGDisplayAdc(); 79 80 void CloseWindow() ; 81 82 83 Bool_t BuildHistoList(Int_t type=1) ; 84 85 Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); 86 87 } ; 31 void AddFrameTop(TGHorizontalFrame *frame); 32 void AddFrameLow(TGHorizontalFrame *frame); 33 34 // 35 // Create a main frame with a number of different buttons. 36 // 37 void UpdateHist(); 38 Bool_t BuildHistoList(); 39 40 public: 41 42 MGDisplayAdc(MHFadcCam *fHists , 43 const TGWindow *p, const TGWindow *main, 44 UInt_t w, UInt_t h, 45 UInt_t options = kMainFrame | kVerticalFrame ); 46 47 ~MGDisplayAdc(); 48 49 void CloseWindow(); 50 51 Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); 52 }; 88 53 89 54 #endif
Note:
See TracChangeset
for help on using the changeset viewer.