Changeset 1172 for trunk/MagicSoft/Mars/mmain
- Timestamp:
- 01/14/02 17:34:02 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mmain
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmain/MBrowser.cc
r1108 r1172 280 280 main?main:gClient->GetRoot(), w, h) 281 281 { 282 fInputFile[0] = '\0';283 284 282 fList = new MGList; 285 283 fList->SetOwner(); … … 382 380 // Checks if there is a selected input root file 383 381 // 384 return fInputFile[0]!='\0';382 return !fInputFile.IsNull(); //[0]!='\0'; 385 383 } 386 384 … … 417 415 } 418 416 419 void MBrowser::SetFileName(const char *name) 420 { 421 // 422 // determine the file type by extensions 423 // 424 const char *ext=strrchr(name, '.'); 425 426 Bool_t failed = kFALSE; 427 428 if (!ext) 429 failed = kTRUE; 430 else 431 if (strcasecmp(ext, ".root")) 432 failed = kTRUE; 433 434 char *fname=NULL; 435 if (!failed) 417 void MBrowser::SetFileName(TString name) 418 { 419 if (name[0]!='/') 436 420 { 437 const char *dir = fFileCont->GetDirectory(); 438 439 fname = Form("%s/%s", dir, name); 440 441 failed = gSystem->AccessPathName(fname, kFileExists); 421 name.Insert(0, "/"); 422 name.Insert(0, fFileCont->GetDirectory()); 442 423 } 443 424 444 if (!failed) 445 strcpy(fInputFile, fname); 446 else 447 fname = Form(fInputFile); 448 449 char *slash = strrchr(fname, '/'); 450 451 fEntry->SetText(slash ? slash+1 : ""); 452 453 if (!slash) 425 if (gSystem->AccessPathName(name, kFileExists)) 454 426 return; 455 427 456 *slash = '\0'; 457 ChangeDir(fname); 428 if (name.EndsWith(".root", TString::kIgnoreCase)) 429 fInputFile = name; 430 431 fEntry->SetText(gSystem->BaseName(name)); 432 433 ChangeDir(gSystem->DirName(name)); 458 434 } 459 435 … … 483 459 const TGTextLBEntry *selected = (TGTextLBEntry*)filter->GetListBox()->GetSelectedEntry(); 484 460 485 const char *txt = StrDup(selected->GetText()->GetString());486 487 461 // 488 462 // find filter and remove leading spaces 489 463 // 490 char *lt = strchr(txt, '<'); 491 if (lt) 492 { 493 do *lt-- = '\0'; 494 while (lt>txt && *lt==' '); 495 496 // 497 // Set new filter and refresh the file container 498 // 499 fFileCont->SetFilter(txt); 500 fFileCont->DisplayDirectory(); 501 } 502 503 delete [] txt; 464 TString txt = selected->GetText()->GetString(); 465 if (txt.First('<') < 0) 466 return; 467 468 // 469 // Set new filter and refresh the file container 470 // 471 txt.Remove(txt.First('<')); 472 473 TString ftxt = txt.Strip(); 474 fFileCont->SetFilter(ftxt); 475 fFileCont->DisplayDirectory(); 504 476 } 505 477 -
trunk/MagicSoft/Mars/mmain/MBrowser.h
r1086 r1172 36 36 void CreateDirListBox(TGCompositeFrame *frame); 37 37 38 void SetFileName( const char *name);38 void SetFileName(TString name); 39 39 40 40 void SetFilter(); … … 44 44 protected: 45 45 MGList *fList; 46 Char_t fInputFile[256];46 TString fInputFile; 47 47 48 48 TGCompositeFrame *CreateNewTab(const char *name); -
trunk/MagicSoft/Mars/mmain/MDataCheck.cc
r1086 r1172 97 97 // histograms. 98 98 // 99 void MDataCheck::ViewAdcSpectra( Char_t *inputfile,Char_t *treeName)99 void MDataCheck::ViewAdcSpectra(const Char_t *inputfile, const Char_t *treeName) 100 100 { 101 101 // -
trunk/MagicSoft/Mars/mmain/MDataCheck.h
r1016 r1172 9 9 { 10 10 private: 11 void ViewAdcSpectra( Char_t *inputfile,Char_t *treeName);11 void ViewAdcSpectra(const Char_t *inputfile, const Char_t *treeName); 12 12 13 13 public:
Note:
See TracChangeset
for help on using the changeset viewer.