Changeset 1052 for trunk/MagicSoft/Mars/mmain
- Timestamp:
- 11/08/01 10:57:01 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mmain
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmain/MBrowser.cc
r1050 r1052 32 32 #include <TGButton.h> // TGTextButton 33 33 #include <TGMsgBox.h> // TGMsgBox 34 #include <TBrowser.h> // TBrowser 34 35 #include <TGListBox.h> // TGListBox 35 36 #include <TGTextEntry.h> // TGTextEntry … … 48 49 49 50 enum { 51 kFileTBrowser, 50 52 kFileClose, 51 53 kButDirUp, … … 62 64 // 63 65 TGPopupMenu *filemenu = new TGPopupMenu(gClient->GetRoot()); 64 filemenu->AddEntry("Close", kFileClose); 66 filemenu->AddEntry("Open &TBrowser", kFileTBrowser); 67 filemenu->AddSeparator(); 68 filemenu->AddEntry("&Close", kFileClose); 69 filemenu->Associate(this); 65 70 fList->Add(filemenu); 66 71 … … 75 80 76 81 TGMenuBar *menubar = new TGMenuBar(this, 1, 1, kHorizontalFrame); 77 menubar->AddPopup(" File", filemenu, laymenuitem);82 menubar->AddPopup("&File", filemenu, laymenuitem); 78 83 AddFrame(menubar, laymenubar); 79 84 fList->Add(menubar); … … 320 325 ChangeDir(); 321 326 SetWMSizeHints(400, 350, 1000, 1000, 10, 10); // set the smallest and biggest size of the Main frame 327 Move(rand()%100+50, rand()%100+50); 322 328 } 323 329 … … 450 456 } 451 457 458 // -------------------------------------------------------------------------- 459 // 460 // Process events generated by the gui elements in the frame. 461 // 452 462 Bool_t MBrowser::ProcessMessage(Long_t msg, Long_t parm1, Long_t) 453 { 454 // Process events generated by the buttons in the frame.455 456 switch (GET_MSG(msg))457 {458 case kC_TEXTENTRY:459 if (GET_SUBMSG(msg)!=kTE_ENTER) 460 return kTRUE;461 462 SetFileName(fEntry->GetText()); 463 return kTRUE;464 465 case kC_COMMAND:466 switch (GET_SUBMSG(msg))467 {468 case kCM_BUTTON:469 470 switch (parm1)471 {472 case kButDirUp : 473 //474 // goto the parent directory 475 //476 ChangeDir("..");477 478 479 case kButListMode:480 fFileView->SetViewMode(kLVList); 481 fDetail->SetState(kButtonUp) ;482 return kTRUE;483 484 case kButDetailMode:485 fFileView->SetViewMode(kLVDetails);486 fListMode->SetState(kButtonUp);487 return kTRUE;488 } 489 return kTRUE;490 491 case kCM_COMBOBOX:492 //493 // FIXME: Don't add the new entry to the list! 494 // But to do this we need the number of entries in the list.495 //496 if (parm1 != kCBDirectory)497 return kTRUE;498 499 ChangeDir(((TGTreeLBEntry*)fDir->GetSelectedEntry())->GetPath()->GetString());500 return kTRUE; 501 502 case kCM_MENU: 503 if (parm1==kFileClose) 504 CloseWindow(); 505 return kTRUE;506 }507 return kTRUE;508 509 case kC_CONTAINER: 510 switch (GET_SUBMSG(msg))511 {512 513 // case kCT_ITEMCLICK: 514 // printf ("itemclick\n");515 // break;516 517 case kCT_ITEMDBLCLICK: 518 //519 // process the double click in the file view container520 //521 522 if (parm1 != kButton1 || fFileCont->NumSelected() != 1)523 return kTRUE;524 525 //526 // one file selected527 //528 void *dummy = NULL;529 const TGFileItem *item = (TGFileItem *)fFileCont->GetNextSelected(&dummy);530 531 const char *str = item->GetItemName()->GetString();532 533 //534 // if the user choose a directory535 // change to this directory536 //537 if (S_ISDIR(item->GetType()))538 {539 ChangeDir(str);540 return kTRUE;541 }542 543 SetFileName(str);544 return kTRUE;545 }546 }547 return kTRUE;548 } 463 { 464 switch (GET_MSG(msg)) 465 { 466 case kC_TEXTENTRY: 467 if (GET_SUBMSG(msg)!=kTE_ENTER) 468 return kTRUE; 469 470 SetFileName(fEntry->GetText()); 471 return kTRUE; 472 473 case kC_COMMAND: 474 switch (GET_SUBMSG(msg)) 475 { 476 case kCM_MENU: 477 switch (parm1) 478 { 479 case kFileClose: 480 CloseWindow(); 481 return kTRUE; 482 483 case kFileTBrowser: 484 new TBrowser(); 485 return kTRUE; 486 } 487 return kTRUE; 488 489 case kCM_BUTTON: 490 switch (parm1) 491 { 492 case kButDirUp: 493 // 494 // goto the parent directory 495 // 496 ChangeDir(".."); 497 return kTRUE; 498 499 case kButListMode: 500 fFileView->SetViewMode(kLVList); 501 fDetail->SetState(kButtonUp); 502 return kTRUE; 503 504 case kButDetailMode: 505 fFileView->SetViewMode(kLVDetails); 506 fListMode->SetState(kButtonUp); 507 return kTRUE; 508 } 509 return kTRUE; 510 511 case kCM_COMBOBOX: 512 if (parm1 != kCBDirectory) 513 return kTRUE; 514 515 ChangeDir(((TGTreeLBEntry*)fDir->GetSelectedEntry())->GetPath()->GetString()); 516 return kTRUE; 517 } 518 return kTRUE; 519 520 case kC_CONTAINER: 521 switch (GET_SUBMSG(msg)) 522 { 523 524 // case kCT_ITEMCLICK: 525 // printf ("itemclick\n"); 526 // break; 527 528 case kCT_ITEMDBLCLICK: 529 // 530 // process the double click in the file view container 531 // 532 if (parm1 != kButton1 || fFileCont->NumSelected() != 1) 533 return kTRUE; 534 535 // 536 // one file selected 537 // 538 void *dummy = NULL; 539 const TGFileItem *item = (TGFileItem *)fFileCont->GetNextSelected(&dummy); 540 541 const char *str = item->GetItemName()->GetString(); 542 543 // 544 // if the user choose a directory 545 // change to this directory 546 // 547 if (S_ISDIR(item->GetType())) 548 { 549 ChangeDir(str); 550 return kTRUE; 551 } 552 553 SetFileName(str); 554 return kTRUE; 555 } 556 } 557 return kTRUE; 558 } -
trunk/MagicSoft/Mars/mmain/MMars.cc
r1050 r1052 44 44 45 45 enum { 46 M_FILE_EXIT,47 M_FILE_ABOUT,48 49 M_PICTURE_MAGIC,50 M_PICTURE_MARS,51 52 M_BUTTON_EVTDISP,53 M_BUTTON_DATACHECK,54 M_BUTTON_ANALYSE,55 M_BUTTON_MONTECARLO,56 M_BUTTON_CAMDISPLAY46 kFileExit, 47 kFileAbout, 48 49 kPicMagic, 50 kPicMars, 51 52 kButEvtDisplay, 53 kButDataCheck, 54 kButAnalysis, 55 kButMonteCarlo, 56 kButCameraDisplay 57 57 }; 58 58 … … 68 68 69 69 TGPopupMenu *filemenu = new TGPopupMenu(gClient->GetRoot()); 70 filemenu->AddEntry("E xit", M_FILE_EXIT);71 //fFileMenu->Associate(this);70 filemenu->AddEntry("E&xit", kFileExit); 71 filemenu->Associate(this); 72 72 73 73 TGMenuBar *menubar = new TGMenuBar(this, 1, 1, kHorizontalFrame); 74 menubar->AddPopup(" File", filemenu, laymenuitem);74 menubar->AddPopup("&File", filemenu, laymenuitem); 75 75 AddFrame(menubar, laymenubar); 76 76 … … 88 88 fPic2 = gClient->GetPicture("marslogo.xpm"); 89 89 90 TGPictureButton *magic = new TGPictureButton(top, fPic1, M_PICTURE_MAGIC);91 TGPictureButton *mars = new TGPictureButton(top, fPic2, M_PICTURE_MARS);90 TGPictureButton *magic = new TGPictureButton(top, fPic1, kPicMagic); 91 TGPictureButton *mars = new TGPictureButton(top, fPic2, kPicMars); 92 92 93 93 fList->Add(magic); … … 163 163 fList->Add(laybut); 164 164 165 CreateTextButton(tab2, "Event Display", M_BUTTON_EVTDISP, laybut); 166 CreateTextButton(tab2, "Data Check", M_BUTTON_DATACHECK, laybut); 167 CreateTextButton(tab2, "Analysis", M_BUTTON_ANALYSE, laybut); 168 CreateTextButton(tab2, "Monte Carlo", M_BUTTON_MONTECARLO, laybut); 169 CreateTextButton(tab2, "Camera Display", M_BUTTON_CAMDISPLAY, laybut); 170 } 171 172 MMars::MMars(/*const TGWindow *p,*/ UInt_t w, UInt_t h) 173 : TGMainFrame(gClient->GetRoot(), w, h) 174 //: MBrowser (gClient->GetRoot(), gClient->GetRoot(), w, h) 165 CreateTextButton(tab2, "Event Display", kButEvtDisplay, laybut); 166 CreateTextButton(tab2, "Data Check", kButDataCheck, laybut); 167 CreateTextButton(tab2, "Analysis", kButAnalysis, laybut); 168 CreateTextButton(tab2, "Monte Carlo", kButMonteCarlo, laybut); 169 CreateTextButton(tab2, "Camera Display", kButCameraDisplay, laybut); 170 } 171 172 MMars::MMars() 173 : TGMainFrame(gClient->GetRoot(), 330, 400, kVerticalFrame|kFixedSize) 175 174 { 176 175 // … … 212 211 // 213 212 // Map the window, set up the layout, etc. 214 // 215 SetWMSizeHints(330, 410, 330, 410, 10, 10); // set the smallest and biggest size of the Main frame 213 // kFixedSize seems to be ignored 214 // 215 SetWMSizeHints(GetWidth(), GetHeight(), GetWidth(), GetHeight(), 0, 0); // set the smallest and biggest size of the Main frame 216 Move(rand()%100, rand()%100); 216 217 217 218 MapSubwindows(); … … 269 270 { 270 271 271 case M_BUTTON_EVTDISP:272 case kButEvtDisplay: 272 273 new MEvtDisp(this); 273 274 return kTRUE; 274 275 275 case M_BUTTON_DATACHECK:276 case kButDataCheck: 276 277 new MDataCheck(this); 277 278 return kTRUE; 278 279 279 case M_BUTTON_ANALYSE:280 case kButAnalysis: 280 281 new MAnalysis(this); 281 282 return kTRUE; 282 283 283 case M_BUTTON_MONTECARLO:284 case kButMonteCarlo: 284 285 new MMonteCarlo(this); 285 286 return kTRUE; 286 287 287 case M_BUTTON_CAMDISPLAY:288 case kButCameraDisplay: 288 289 new MCameraDisplay(this); 289 290 return kTRUE; 290 291 291 case M_PICTURE_MAGIC:292 case kPicMagic: 292 293 gSystem->Exec("netscape http://hegra1.mppmu.mpg.de/MAGICWeb/ &"); 293 294 return kTRUE; 294 295 295 case M_PICTURE_MARS:296 case kPicMars: 296 297 gSystem->Exec("netscape http://magic.uni-sw.gwdg.de/mars/ &"); 297 298 return kTRUE; … … 299 300 300 301 case kCM_MENU: 301 if (parm1!= M_FILE_EXIT)302 if (parm1!=kFileExit) 302 303 return kTRUE; 303 304 -
trunk/MagicSoft/Mars/mmain/MMars.h
r1016 r1052 33 33 34 34 public: 35 MMars(UInt_t w=400, UInt_t h=500); 36 35 MMars(); 37 36 ~MMars(); 38 37 -
trunk/MagicSoft/Mars/mmain/Makefile
r1018 r1052 47 47 include ../Makefile.rules 48 48 49 clean: rm lib rmcint rmobjs rmcore rmbin49 clean: rmcint rmobjs rmcore rmlib 50 50 51 51 mrproper: clean rmbak
Note:
See TracChangeset
for help on using the changeset viewer.