Changeset 1086 for trunk/MagicSoft/Mars/mmain
- Timestamp:
- 11/16/01 15:59:05 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mmain
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmain/MAnalysis.cc
r1082 r1086 31 31 #include <TGTextEntry.h> // TGNumberEntry 32 32 33 #include "MGList.h" 33 34 #include "MImgCleanStd.h" // MImgCleanStd 34 35 … … 36 37 37 38 enum { 38 kButHillas 39 kButHillas = 0x100 39 40 }; 40 41 -
trunk/MagicSoft/Mars/mmain/MBrowser.cc
r1082 r1086 26 26 #include "MBrowser.h" 27 27 28 #include <iostream.h> 29 #include <sys/stat.h> // S_ISDIR 30 28 31 #include <TSystem.h> // gSystem 29 32 30 33 #include <TGTab.h> // TGTab 31 34 #include <TGMenu.h> // TGPopupMenu 35 #include <TG3DLine.h> // TGHorizontal3DLine 32 36 #include <TGButton.h> // TGTextButton 33 37 #include <TGMsgBox.h> // TGMsgBox 34 38 #include <TBrowser.h> // TBrowser 35 #include <TGListBox.h> // TGListBox36 39 #include <TGTextEntry.h> // TGTextEntry 37 40 #include <TGFSComboBox.h> // TGFSComboBox, TGFSLboxEntry … … 39 42 #include <TGFSContainer.h> // TGFileContainer 40 43 41 #include <TG3DLine.h> // TGHorizontal3DLine 42 // use TGSplitter.h for root<3.00 43 44 #include <sys/stat.h> // S_ISDIR 45 46 #include <iostream.h> 44 #include "MGList.h" 47 45 48 46 ClassImp(MBrowser); … … 55 53 kButDetailMode, 56 54 kCBDirectory, 55 kCBFilter, 57 56 kTEFileName 58 57 }; … … 116 115 // Create Dir-Listbox and buttons in first frame 117 116 // 118 fDir = new TGFSComboBox(frame, kCBDirectory);119 fDir->Resize(350, 20);117 TGFSComboBox *dir = new TGFSComboBox(frame, kCBDirectory); 118 dir->SetHeight(fEntry->GetHeight()); 120 119 121 120 // 122 121 // Get the three picturs from the system (must be deleted by FreePicture) 123 122 // 124 fPic1 = fClient->GetPicture("tb_uplevel.xpm");125 fPic2 = fClient->GetPicture("tb_list.xpm");126 fPic3 = fClient->GetPicture("tb_details.xpm");123 const TGPicture *pic1 = fList->GetPicture("tb_uplevel.xpm"); 124 const TGPicture *pic2 = fList->GetPicture("tb_list.xpm"); 125 const TGPicture *pic3 = fList->GetPicture("tb_details.xpm"); 127 126 128 127 // 129 128 // Create the corresponding picture buttons 130 129 // 131 fCdup = new TGPictureButton(frame, fPic1, kButDirUp);132 fListMode = new TGPictureButton(frame, fPic2, kButListMode);133 fDetail = new TGPictureButton(frame, fPic3, kButDetailMode);130 TGPictureButton *cdup = new TGPictureButton(frame, pic1, kButDirUp); 131 TGPictureButton *list = new TGPictureButton(frame, pic2, kButListMode); 132 TGPictureButton *detail = new TGPictureButton(frame, pic3, kButDetailMode); 134 133 135 134 // 136 135 // setup the buttons 137 136 // 138 fCdup->SetToolTipText("One Level up!");139 fListMode->SetToolTipText("List Mode");140 fDetail->SetToolTipText("Details Mode");141 142 fListMode->SetState(kButtonUp);143 fDetail->SetState(kButtonEngaged);144 145 fListMode->AllowStayDown(kTRUE);146 fDetail->AllowStayDown(kTRUE);137 cdup ->SetToolTipText("One Level up!"); 138 list ->SetToolTipText("List Mode"); 139 detail->SetToolTipText("Details Mode"); 140 141 list ->SetState(kButtonUp); 142 detail->SetState(kButtonEngaged); 143 144 list ->AllowStayDown(kTRUE); 145 detail->AllowStayDown(kTRUE); 147 146 148 147 // 149 148 // send messages to 'this' object 150 149 // 151 fDir->Associate(this);152 fCdup->Associate(this);153 fDetail->Associate(this);154 fListMode->Associate(this);150 dir ->Associate(this); 151 cdup ->Associate(this); 152 detail->Associate(this); 153 list ->Associate(this); 155 154 156 155 // 157 156 // Add to list for 'automatic' deletion 158 157 // 159 fList->Add( fDir);160 fList->Add( fCdup);161 fList->Add( fListMode);162 fList->Add( fDetail);158 fList->Add(dir); 159 fList->Add(cdup); 160 fList->Add(list); 161 fList->Add(detail); 163 162 164 163 // … … 175 174 fList->Add(layout); 176 175 177 frame->AddFrame( fDir,laydir);178 frame->AddFrame( fListMode,layout);179 frame->AddFrame( fDetail,layout);180 frame->AddFrame( fCdup,layout);176 frame->AddFrame(dir, laydir); 177 frame->AddFrame(list, layout); 178 frame->AddFrame(detail, layout); 179 frame->AddFrame(cdup, layout); 181 180 } 182 181 … … 198 197 fFileView->SetViewMode(kLVDetails); 199 198 200 fFileCont->SetFilter("* ");199 fFileCont->SetFilter("*.root"); 201 200 fFileCont->Associate(this); 202 201 fFileCont->Sort(kSortByName); … … 210 209 void MBrowser::CreateTab1() 211 210 { 211 static const char *filters[] = 212 { 213 "*.root <root-files>", 214 "* <All Files>", 215 NULL 216 }; 217 212 218 TGCompositeFrame *frame = CreateNewTab("Input File"); 213 219 … … 215 221 // Create three frames for the first tab 216 222 // 217 TGHorizontalFrame *tab1a = new TGHorizontalFrame(frame, 100, 100); 218 TGHorizontalFrame *tab1b = new TGHorizontalFrame(frame, 100, 100); 219 TGVerticalFrame *tab2 = new TGVerticalFrame (frame, 100, 100); 220 221 TGLayoutHints *laytab1 = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 10, 10, 10); 222 TGLayoutHints *laytab2 = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 10, 10, 10, 10); 223 TGLayoutHints *layentry = new TGLayoutHints(kLHintsNormal|kLHintsExpandX); //, 5, 5, 5); 224 225 frame->AddFrame(tab1a, laytab1); 226 frame->AddFrame(tab1b, laytab1); 227 frame->AddFrame(tab2, laytab2); 228 229 fEntry = new TGTextEntry(tab1a, "", kTEFileName); 230 fEntry->Resize(350, 20); 223 TGHorizontalFrame *tab1 = new TGHorizontalFrame(frame, 100, 100); 224 TGVerticalFrame *tab2 = new TGVerticalFrame (frame, 100, 100); 225 226 TGLayoutHints *laytab1 = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 10, 10, 10); 227 TGLayoutHints *laytab2 = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 10, 10, 10, 10); 228 TGLayoutHints *layfilter = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 10, 10, 10); 229 230 fEntry = new TGTextEntry(frame, "", kTEFileName); 231 231 fEntry->Associate(this); 232 tab1a->AddFrame(fEntry, layentry); 233 234 CreateDirListMenu(tab1b); 232 233 TGComboBox *filter = new TGComboBox(frame, kCBFilter); 234 filter->SetHeight(fEntry->GetHeight()); 235 filter->Associate(this); 236 for (int i=0; filters[i]; i++) 237 filter->AddEntry(filters[i], i); 238 filter->Select(0); 239 240 frame->AddFrame(fEntry, laytab1); 241 frame->AddFrame(tab1, laytab1); 242 frame->AddFrame(filter, layfilter); 243 frame->AddFrame(tab2, laytab2); 244 245 CreateDirListMenu(tab1); 235 246 CreateDirListBox(tab2); 236 247 237 248 fList->Add(laytab1); 238 249 fList->Add(laytab2); 239 fList->Add(tab1a); 240 fList->Add(tab1b); 250 fList->Add(tab1); 241 251 fList->Add(tab2); 242 fList->Add(lay entry);252 fList->Add(layfilter); 243 253 fList->Add(fEntry); 254 fList->Add(filter); 244 255 } 245 256 … … 279 290 fInputFile[0] = '\0'; 280 291 281 fList = new TList;292 fList = new MGList; 282 293 fList->SetOwner(); 283 294 … … 331 342 MBrowser::~MBrowser() 332 343 { 333 fClient->FreePicture(fPic1);334 fClient->FreePicture(fPic2);335 fClient->FreePicture(fPic3);336 337 344 delete fList; 338 345 } … … 412 419 413 420 const char *dir = fFileCont->GetDirectory(); 414 fDir->Update(dir); 421 422 TGFSComboBox *cbox = (TGFSComboBox*)fList->FindWidget(kCBDirectory); 423 if (cbox) 424 cbox->Update(dir); 415 425 } 416 426 … … 454 464 *slash = '\0'; 455 465 ChangeDir(fname); 466 } 467 468 void MBrowser::SetDir() 469 { 470 TGFSComboBox *cbox = (TGFSComboBox*)fList->FindWidget(kCBDirectory); 471 if(!cbox) 472 return; 473 474 const TGTreeLBEntry *entry = (TGTreeLBEntry*)cbox->GetSelectedEntry(); 475 476 ChangeDir(entry->GetPath()->GetString()); 477 } 478 479 void MBrowser::SetFilter() 480 { 481 // 482 // Try to get widget from list 483 // 484 TGComboBox *filter = (TGComboBox*)fList->FindWidget(kCBFilter); 485 if (!filter) 486 return; 487 488 // 489 // Get the selected text from the list box 490 // 491 const TGTextLBEntry *selected = (TGTextLBEntry*)filter->GetListBox()->GetSelectedEntry(); 492 493 const char *txt = StrDup(selected->GetText()->GetString()); 494 495 // 496 // find filter and remove leading spaces 497 // 498 char *lt = strchr(txt, '<'); 499 if (lt) 500 { 501 do *lt-- = '\0'; 502 while (lt>txt && *lt==' '); 503 504 // 505 // Set new filter and refresh the file container 506 // 507 fFileCont->SetFilter(txt); 508 fFileCont->DisplayDirectory(); 509 } 510 511 delete [] txt; 512 } 513 514 void MBrowser::SetViewMode(const Int_t mode) 515 { 516 fFileView->SetViewMode(mode ? kLVList : kLVDetails); 517 518 TGButton *but = (TGButton*)fList->FindWidget(mode); 519 if(!but) 520 return; 521 522 but->SetState(kButtonUp); 456 523 } 457 524 … … 498 565 499 566 case kButListMode: 500 fFileView->SetViewMode(kLVList);501 fDetail->SetState(kButtonUp);502 return kTRUE;503 504 567 case kButDetailMode: 505 fFileView->SetViewMode(kLVDetails); 506 fListMode->SetState(kButtonUp); 568 SetViewMode(parm1); 507 569 return kTRUE; 508 570 } … … 510 572 511 573 case kCM_COMBOBOX: 512 if (parm1 != kCBDirectory) 513 return kTRUE; 514 515 ChangeDir(((TGTreeLBEntry*)fDir->GetSelectedEntry())->GetPath()->GetString()); 574 switch (parm1) 575 { 576 case kCBDirectory: 577 SetDir(); 578 return kTRUE; 579 case kCBFilter: 580 SetFilter(); 581 return kTRUE; 582 } 516 583 return kTRUE; 517 584 } -
trunk/MagicSoft/Mars/mmain/MBrowser.h
r1050 r1086 10 10 #endif 11 11 12 class TList;12 class MGList; 13 13 class TGTab; 14 14 class TGListView; … … 24 24 TGTab *fTabs; 25 25 26 TGFSComboBox *fDir;27 26 TGTextEntry *fEntry; 28 29 TGPictureButton *fCdup;30 TGPictureButton *fListMode;31 TGPictureButton *fDetail;32 27 33 28 TGFileContainer *fFileCont; 34 29 TGListView *fFileView; 35 36 const TGPicture *fPic1;37 const TGPicture *fPic2;38 const TGPicture *fPic3;39 30 40 31 void CreateMenuBar(); … … 47 38 void SetFileName(const char *name); 48 39 40 void SetFilter(); 41 void SetDir(); 42 void SetViewMode(const Int_t mode); 43 49 44 protected: 50 TList *fList;45 MGList *fList; 51 46 Char_t fInputFile[256]; 52 47 -
trunk/MagicSoft/Mars/mmain/MCameraDisplay.cc
r1082 r1086 28 28 #include <TGButton.h> // TGTextButton 29 29 30 #include "MGList.h" 30 31 #include "MGCamDisplay.h" 31 32 … … 33 34 34 35 enum { 35 M_BUTTON_DISP36 kButDisplay = 0x100 36 37 }; 37 38 … … 46 47 : MBrowser(main, p, w, h) 47 48 { 48 TGTextButton *disp = new TGTextButton(fTop2, "Display Events", M_BUTTON_DISP);49 TGTextButton *disp = new TGTextButton(fTop2, "Display Events", kButDisplay); 49 50 fList->Add(disp); 50 51 … … 79 80 switch (parm1) 80 81 { 81 case M_BUTTON_DISP:82 case kButDisplay: 82 83 if (!InputFileSelected()) 83 84 { … … 88 89 switch (parm1) 89 90 { 90 case M_BUTTON_DISP:91 case kButDisplay: 91 92 new MGCamDisplay(fInputFile, 92 93 fClient->GetRoot(), this, 600, 500); -
trunk/MagicSoft/Mars/mmain/MDataCheck.cc
r1082 r1086 28 28 #include <TGButton.h> // TGTextButton 29 29 30 #include "MGList.h" 31 #include "MFillH.h" 30 32 #include "MParList.h" 31 33 #include "MTaskList.h" 32 34 #include "MEvtLoop.h" 33 35 #include "MReadTree.h" 34 #include "MFillH.h"35 36 #include "MGDisplayAdc.h" 36 37 … … 40 41 41 42 enum { 42 kButPedAdc ,43 kButEvtAdc ,44 kButPedTdc ,45 kButEvtTdc 43 kButPedAdc = 0x100, 44 kButEvtAdc = 0x101, 45 kButPedTdc = 0x102, 46 kButEvtTdc = 0x103 46 47 }; 47 48 -
trunk/MagicSoft/Mars/mmain/MEvtDisp.cc
r1082 r1086 28 28 #include <TGButton.h> // TGTextButton 29 29 30 #include "MGList.h" 30 31 #include "MGFadcDisp.h" 31 32 … … 33 34 34 35 enum { 35 M_BUT_DISP1_EVT,36 M_BUT_DISP1_PED,37 M_BUT_DISP1_CAL36 kButDispEvt = 0x100, 37 kButDispPedestal = 0x101, 38 kButDispCalibration = 0x102 38 39 }; 39 40 … … 42 43 : MBrowser(main, p, w, h) 43 44 { 44 TGTextButton *fadcevt = new TGTextButton(fTop1, "FADC Disp for Events", M_BUT_DISP1_EVT);45 TGTextButton *fadcped = new TGTextButton(fTop1, "FADC Disp for PedEvts", M_BUT_DISP1_PED);46 TGTextButton *fadccal = new TGTextButton(fTop1, "FADC Disp for CalEvts", M_BUT_DISP1_CAL);45 TGTextButton *fadcevt = new TGTextButton(fTop1, "FADC Disp for Events", kButDispEvt); 46 TGTextButton *fadcped = new TGTextButton(fTop1, "FADC Disp for PedEvts", kButDispPedestal); 47 TGTextButton *fadccal = new TGTextButton(fTop1, "FADC Disp for CalEvts", kButDispCalibration); 47 48 48 49 fadcevt->Associate(this); … … 82 83 switch (parm1) 83 84 { 84 case M_BUT_DISP1_EVT:85 case M_BUT_DISP1_PED:86 case M_BUT_DISP1_CAL:85 case kButDispEvt: 86 case kButDispPedestal: 87 case kButDispCalibration: 87 88 if (!InputFileSelected()) 88 89 { … … 93 94 switch (parm1) 94 95 { 95 case M_BUT_DISP1_EVT:96 case kButDispEvt: 96 97 new MGFadcDisp(fInputFile, "Events", 97 98 fClient->GetRoot(), this, 600, 500); 98 99 return kTRUE; 99 100 100 case M_BUT_DISP1_PED:101 case kButDispPedestal: 101 102 new MGFadcDisp(fInputFile , "PedEvts", 102 103 fClient->GetRoot(), this, 600, 500); 103 104 return kTRUE; 104 105 105 case M_BUT_DISP1_CAL:106 case kButDispCalibration: 106 107 new MGFadcDisp(fInputFile , "CalEvts", 107 108 fClient->GetRoot(), this, 600, 500); -
trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc
r1082 r1086 35 35 #include <TGButtonGroup.h> // TGVButtonGroup 36 36 37 #include "MGList.h" 38 37 39 ClassImp(MMonteCarlo) 38 40 39 41 enum { 40 M_BUTTON_COLAREA,41 M_BUTTON_RATE,42 M_BUTTON_THRESHOLD42 kButCollArea = 0x100, 43 kButTrigRate = 0x101, 44 kButThreshold = 0x102 43 45 }; 44 46 45 47 void MMonteCarlo::AddButtons() 46 48 { 47 TGTextButton *carea = new TGTextButton(fTop2, "Collection Area", M_BUTTON_COLAREA);48 TGTextButton *trate = new TGTextButton(fTop2, "Trigger Rate", M_BUTTON_RATE);49 TGTextButton *thold = new TGTextButton(fTop2, "Threshold", M_BUTTON_THRESHOLD);49 TGTextButton *carea = new TGTextButton(fTop2, "Collection Area", kButCollArea); 50 TGTextButton *trate = new TGTextButton(fTop2, "Trigger Rate", kButTrigRate); 51 TGTextButton *thold = new TGTextButton(fTop2, "Threshold", kButThreshold); 50 52 51 53 fList->Add(carea); … … 492 494 switch (parm1) 493 495 { 494 case M_BUTTON_COLAREA:496 case kButCollArea: 495 497 CalculateCollectionArea(); 496 498 return kTRUE; 497 499 498 case M_BUTTON_RATE:500 case kButTrigRate: 499 501 CalculateTriggerRate(); 500 502 return kTRUE; 501 503 502 case M_BUTTON_THRESHOLD:504 case kButThreshold: 503 505 CalculateThreshold(); 504 506 return kTRUE;
Note:
See TracChangeset
for help on using the changeset viewer.