Changeset 665 for trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc
- Timestamp:
- 03/02/01 12:09:07 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc
r466 r665 1 1 #include "MGDisplayAdc.h" 2 2 3 #include <TGListBox.h> // TGListBox4 3 #include <TGButton.h> // TGTextButton 5 #include <TGSlider.h> // TGVSlider6 4 #include <TCanvas.h> // TCanvas.h 7 5 #include <TGMsgBox.h> // TGMsgBox 8 6 #include <TRootEmbeddedCanvas.h> // TRootEmbeddedCanvas 9 10 #include "MHistosAdc.h"11 7 12 8 enum ComIdentDisplayAdc { … … 163 159 164 160 fHistoList->Select(1, kTRUE); 165 fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ;166 fHistoList->SetTopEntry(fHistoList->GetSelected());161 DrawSelectedHi() ; 162 SetSelectedTopEntry(); 167 163 fCanv->Modified() ; 168 169 fVslider1->SetPosition( fHistoList->GetSelected()-1);164 fCanv->Update() ; 165 SetSelectedPos(); 170 166 171 172 167 MapWindow(); 173 168 SetWMSizeHints(550, 550, 1000, 1000, 1, 1); … … 207 202 delete fFrameLow ; 208 203 delete fFrameTop ; 209 210 211 204 } 212 205 … … 233 226 234 227 Bool_t MGDisplayAdc::BuildHistoList(Int_t type ) 235 { 236 // looks in the container of the AdcSpectra and reads in the 237 // Histogramms in there. 238 // 239 // In the class MHistosAdc are in fact two lists. One for the high and 240 // one for the low gain. Here we will use only the high gain list!!! 241 // With some special options (settings in the gui) we will also be able 242 // to plot the low gain 243 // 244 for ( Int_t i=0 ; i < fHists->GetHighEntries(); i++ ) { 245 fHistoList->AddEntry(fHists->GetHighList()->At(i)->GetName(), i+1) ; 246 247 } 248 249 fHistoList->MapSubwindows() ; 250 fHistoList->Layout() ; 251 return (kTRUE) ; 228 { 229 // 230 // looks in the container of the AdcSpectra and reads in the 231 // Histogramms in there. 232 // 233 // In the class MHistosAdc are in fact two lists. One for the high and 234 // one for the low gain. Here we will use only the high gain list!!! 235 // With some special options (settings in the gui) we will also be able 236 // to plot the low gain 237 // 238 239 const Int_t nhi = fHists->GetHiEntries(); 240 for ( Int_t i=0 ; i < nhi; i++ ) { 241 fHistoList->AddEntry(fHists->GetHistHi(i)->GetName(), i+1) ; 242 } 243 244 fHistoList->MapSubwindows() ; 245 fHistoList->Layout() ; 246 return kTRUE ; 252 247 } 253 248 … … 257 252 Bool_t MGDisplayAdc::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 258 253 { 259 260 // Process events generated by the buttons in the frame. 261 // 262 Int_t buttons = 4, retval = 0 ; 263 //Char_t wort[100] ; 264 //Char_t extens[5] ; 265 //Char_t command[110] ; 266 267 //TGFileItem *item ; // to process items in the file view container 268 //void *np = NULL ; // null pointer 269 270 switch (GET_MSG(msg)) 271 { 272 case kC_COMMAND: 273 switch (GET_SUBMSG(msg)) 274 { 275 case kCM_BUTTON: 276 277 switch (parm1) 278 { 254 // 255 // Process events generated by the buttons in the frame. 256 // 257 Int_t buttons = 4, retval = 0 ; 258 //Char_t wort[100] ; 259 //Char_t extens[5] ; 260 //Char_t command[110] ; 261 262 //TGFileItem *item ; // to process items in the file view container 263 //void *np = NULL ; // null pointer 264 265 switch (GET_MSG(msg)) 266 { 267 case kC_COMMAND: 268 switch (GET_SUBMSG(msg)) 269 { 270 case kCM_BUTTON: 271 272 switch (parm1) 273 { 274 case M_BUTTON_SAVE: 275 new TGMsgBox(fClient->GetRoot(), this, 276 "WARNING!", 277 "Not implemented yet.", 278 kMBIconExclamation, buttons, &retval); 279 break ; 280 281 case M_BUTTON_PRINT: 282 break; 283 284 case M_BUTTON_RESET: 285 new TGMsgBox(fClient->GetRoot(), this, 286 "WARNING!", 287 "Not implemented yet.", 288 kMBIconExclamation, buttons, &retval); 289 break; 290 291 case M_BUTTON_CLOSE: 292 CloseWindow() ; 293 break ; 294 295 // The selection for "Next Histogram". 296 // There is also a link for the sicronisation with the slider 297 // 298 case M_BUTTON_PREV: 299 if (GetSelected()-1 != 0) 300 { 301 if (fHistoLock == kTRUE ) 302 { 303 fCanvas->cd(1); 304 SelectSelected(); 305 DrawSelectedHi() ; 306 fCanvas->cd(2); 307 DrawSelectedLo() ; 308 } 309 else 310 { 311 fCanv->cd(); 312 SelectSelected(); 313 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 histogram 330 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 else 342 { 343 fCanv->cd(); 344 SelectSelected(); 345 DrawSelectedHi() ; 346 347 } 348 SetSelectedTopEntry(); 349 fCanv->Modified() ; 350 fCanv->Update() ; 351 SetSelectedPos(); 352 353 } 354 if (fRadio[1]->GetState() != kButtonDown) 355 break; 356 357 fRadio[0]->SetState(kButtonDown); 358 fRadio[1]->SetState(kButtonUp); 359 360 break; 361 362 default: 363 break ; 364 } 365 break; 366 367 case kCM_RADIOBUTTON: 368 369 switch(parm1) 370 { 371 case M_RADIO_HIGH: 372 fRadio[1]->SetState(kButtonUp); 373 fRadio[2]->SetState(kButtonUp); 374 fHistoLock = kFALSE; 375 fHistoType=1; 376 fCanv->cd(); 377 SelectSelected(); 378 DrawSelectedHi() ; 379 SetSelectedTopEntry(); 380 fCanv->Modified() ; 381 fCanv->Update() ; 382 SetSelectedPos(); 383 break; 279 384 280 case M_BUTTON_SAVE: 281 new TGMsgBox(fClient->GetRoot(), this, 282 "WARNING!", 283 "Not implemented yet.", 284 kMBIconExclamation, buttons, &retval); 285 286 break ; 287 288 case M_BUTTON_PRINT: 289 break; 290 291 case M_BUTTON_RESET: 292 new TGMsgBox(fClient->GetRoot(), this, 293 "WARNING!", 294 "Not implemented yet.", 295 kMBIconExclamation, buttons, &retval); 296 297 break; 298 299 300 case M_BUTTON_CLOSE: 301 CloseWindow() ; 302 break ; 303 304 // The selection for "Next Histogram". 305 // There is also a link for the sicronisation with the slider 306 // 307 case M_BUTTON_PREV: 308 309 if (!( fHistoList->GetSelected()-1 ) == 0) 310 { 311 if (fHistoLock == kTRUE ) 312 { 313 fCanvas->cd(1); 314 fHistoList->Select(fHistoList->GetSelected()-1, kTRUE); 315 fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 316 fCanvas->cd(2); 317 fHists->GetLowList()->At( fHistoList->GetSelected()-1)->Draw() ; 318 } 319 else 320 { 321 fCanv->cd(); 322 fHistoList->Select(fHistoList->GetSelected()-1, kTRUE); 323 fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 324 } 325 326 fHistoList->SetTopEntry(fHistoList->GetSelected()); 327 fCanv->Modified() ; 328 fCanv->Update() ; 329 fVslider1->SetPosition( fHistoList->GetSelected()-1); 330 } 331 if ((fRadio[1]->GetState()) == kButtonDown) 332 { 333 fRadio[0]->SetState(kButtonDown); 334 fRadio[1]->SetState(kButtonUp); 335 } 336 337 338 break; 339 340 //The same as above, but for next histogram 341 342 case M_BUTTON_NEXT: 343 344 if (!((fHistoList->GetSelected()-1)==576)) 345 346 { 347 if (fHistoLock == kTRUE ) 348 { 349 fCanvas->cd(1); 350 fHistoList->Select(fHistoList->GetSelected()+1, kTRUE); 351 fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 352 fCanvas->cd(2); 353 fHists->GetLowList()->At( fHistoList->GetSelected()-1)->Draw() ; 354 } 355 else 356 { 357 fCanv->cd(); 358 fHistoList->Select(fHistoList->GetSelected()+1, kTRUE); 359 fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 360 361 } 362 fHistoList->SetTopEntry(fHistoList->GetSelected()); 363 fCanv->Modified() ; 364 fCanv->Update() ; 365 fVslider1->SetPosition( fHistoList->GetSelected()-1); 366 367 } 368 if ((fRadio[1]->GetState()) == kButtonDown) 369 { 370 fRadio[0]->SetState(kButtonDown); 371 fRadio[1]->SetState(kButtonUp); 372 } 373 break; 374 default: 375 break ; 376 } 377 378 case kCM_MENU: 379 switch (parm1) 380 { 381 } 382 break ; 383 384 default: 385 break ; 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 case M_RADIO_LH: 402 fRadio[0]->SetState(kButtonUp); 403 fRadio[1]->SetState(kButtonUp); 404 405 if (fHistoLock == kFALSE) 406 { 407 fCanvas = fECanv->GetCanvas(); 408 fCanvas->Divide(1,2, 0, 0 ,0); 409 410 fCanv->Modified() ; 411 fCanv->Update() ; 412 fHistoLock = kTRUE; 413 fHistoType = 3; 414 } 415 416 fCanvas->cd(1); 417 418 SelectSelected(); 419 DrawSelectedHi() ; 420 SetSelectedTopEntry(); 421 422 fCanvas->cd(2); 423 SelectSelected(); 424 DrawSelectedLo() ; 425 SetSelectedTopEntry(); 426 427 fCanv->Modified() ; 428 fCanv->Update(); 429 430 default: 431 break; 432 } 433 break; 434 } 386 435 387 388 389 case kCM_RADIOBUTTON: 390 391 switch(parm1) 392 { 393 case M_RADIO_HIGH: 394 fRadio[1]->SetState(kButtonUp); 395 fRadio[2]->SetState(kButtonUp); 396 fHistoLock = kFALSE; 397 fHistoType=1; 398 fCanv->cd(); 399 fHistoList->Select(fHistoList->GetSelected(), kTRUE); 400 fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 401 fHistoList->SetTopEntry(fHistoList->GetSelected()); 402 fCanv->Modified() ; 403 fCanv->Update() ; 404 fVslider1->SetPosition( fHistoList->GetSelected()-1); 405 406 407 break; 408 409 case M_RADIO_LOW: 410 fRadio[0]->SetState(kButtonUp); 411 fRadio[2]->SetState(kButtonUp); 412 fCanv->cd(); 413 fHistoLock = kFALSE; 414 fHistoType = 2; 415 416 fHistoList->Select(fHistoList->GetSelected(), kTRUE); 417 fHists->GetLowList()->At( fHistoList->GetSelected()-1)->Draw() ; 418 fHistoList->SetTopEntry(fHistoList->GetSelected()); 419 420 fCanv->Modified() ; 421 fCanv->Update() ; 422 fVslider1->SetPosition( fHistoList->GetSelected()-1); 423 424 break; 425 case M_RADIO_LH: 426 fRadio[0]->SetState(kButtonUp); 427 fRadio[1]->SetState(kButtonUp); 428 429 if (fHistoLock == kFALSE) 430 { 431 fCanvas = fECanv->GetCanvas(); 432 fCanvas->Divide(1,2, 0, 0 ,0); 433 434 fCanv->Modified() ; 435 fCanv->Update() ; 436 fHistoLock = kTRUE; 437 fHistoType = 3; 438 439 } 440 441 fCanvas->cd(1); 442 443 fHistoList->Select(fHistoList->GetSelected(), kTRUE); 444 fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 445 fHistoList->SetTopEntry(fHistoList->GetSelected()); 446 447 448 449 450 fCanvas->cd(2); 451 fHistoList->Select(fHistoList->GetSelected(), kTRUE); 452 fHists->GetLowList()->At( fHistoList->GetSelected()-1)->Draw() ; 453 fHistoList->SetTopEntry(fHistoList->GetSelected()); 454 455 456 457 fCanv->Modified() ; 458 fCanv->Update(); 459 460 default: 461 break; 462 } 463 break; 464 465 466 } 467 468 case kCM_LISTBOX: 469 switch (GET_SUBMSG(msg)) 470 { 471 case M_LIST_HISTO: 472 473 if (fHistoLock == kTRUE ) 474 { 475 fCanvas->cd(1); 476 fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 477 fCanvas->cd(2); 478 fHists->GetLowList()->At( fHistoList->GetSelected()-1)->Draw() ; 479 480 } 481 else 482 { 483 484 fCanv->cd() ; 485 486 fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 487 488 } 489 fCanv->Modified() ; 490 fCanv->Update() ; 491 fVslider1->SetPosition( fHistoList->GetSelected()-1); 492 493 494 495 default: 496 break ; 497 } 498 499 500 case kC_CONTAINER: 501 switch (GET_SUBMSG(msg)) 502 { 503 504 case kCT_ITEMDBLCLICK: 505 506 break; 507 508 default: 509 break ; 510 } 511 512 513 514 default: 515 break; 516 517 case kC_VSLIDER: 518 switch(GET_SUBMSG(msg)) 519 { 520 case kSL_POS: 521 { 522 switch(parm1) 523 { 524 case M_VSId1: 525 526 // Check for the slider movement and sicronise with TGListBox 527 if ((parm2 >= 0) && (parm2) <= 576) 528 { 529 530 if (fHistoLock==kTRUE) 531 { 532 fCanvas->cd(1) ; 533 fHists->GetHighList()->At(parm2)->Draw() ; 534 fHistoList->Select(parm2+1, kTRUE); 535 536 fCanvas->cd(2) ; 537 fHists->GetLowList()->At(parm2)->Draw() ; 538 fHistoList->Select(parm2+1, kTRUE); 539 fHistoList->SetTopEntry(fHistoList->GetSelected()); 540 541 } 542 543 else 544 { 545 fCanv->cd() ; 546 fHists->GetHighList()->At(parm2)->Draw() ; 547 fHistoList->Select(parm2+1, kTRUE); 548 549 fHistoList->SetTopEntry(fHistoList->GetSelected()); 550 551 } 552 fCanv->Modified() ; 553 fCanv->Update() ; 554 555 if ((fRadio[1]->GetState()) == kButtonDown) 556 { 557 fRadio[0]->SetState(kButtonDown); 558 fRadio[1]->SetState(kButtonUp); 559 } 560 561 562 } 563 break; 564 } 565 break; 566 } 567 break; 568 } 569 break; 570 571 } 572 return kTRUE; 573 } 436 case kCM_LISTBOX: 437 if (GET_SUBMSG(msg) != M_LIST_HISTO) 438 break; 439 440 if (fHistoLock == kTRUE ) 441 { 442 fCanvas->cd(1); 443 DrawSelectedHi() ; 444 fCanvas->cd(2); 445 DrawSelectedLo() ; 446 } 447 else 448 { 449 fCanv->cd() ; 450 DrawSelectedHi() ; 451 } 452 fCanv->Modified() ; 453 fCanv->Update() ; 454 SetSelectedPos(); 455 break ; 456 457 /* 458 case kC_CONTAINER: 459 switch (GET_SUBMSG(msg)) 460 { 461 462 case kCT_ITEMDBLCLICK: 463 break; 464 465 default: 466 break ; 467 } 468 */ 469 470 case kC_VSLIDER: 471 if (GET_SUBMSG(msg)!=kSL_POS || parm1!=M_VSId1) 472 break; 473 474 // Check for the slider movement and sicronise with TGListBox 475 if (parm2<0 || parm2>576) 476 break; 477 478 if (fHistoLock==kTRUE) 479 { 480 fCanvas->cd(1) ; 481 DrawHi(parm2) ; 482 fHistoList->Select(parm2+1, kTRUE); 483 484 fCanvas->cd(2) ; 485 DrawLo(parm2) ; 486 } 487 else 488 { 489 fCanv->cd() ; 490 DrawHi(parm2) ; 491 } 492 493 fHistoList->Select(parm2+1, kTRUE); 494 SetSelectedTopEntry(); 495 496 fCanv->Modified() ; 497 fCanv->Update() ; 498 499 if (fRadio[1]->GetState() != kButtonDown) 500 break; 501 502 fRadio[0]->SetState(kButtonDown); 503 fRadio[1]->SetState(kButtonUp); 504 505 break; 506 507 } 508 return kTRUE; 509 }
Note:
See TracChangeset
for help on using the changeset viewer.