Ignore:
Timestamp:
01/14/02 17:34:02 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mmain
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mmain/MBrowser.cc

    r1108 r1172  
    280280                   main?main:gClient->GetRoot(), w, h)
    281281{
    282     fInputFile[0] = '\0';
    283 
    284282    fList = new MGList;
    285283    fList->SetOwner();
     
    382380    // Checks if there is a selected input root file
    383381    //
    384     return fInputFile[0]!='\0';
     382    return !fInputFile.IsNull(); //[0]!='\0';
    385383}
    386384
     
    417415}
    418416
    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)
     417void MBrowser::SetFileName(TString name)
     418{
     419    if (name[0]!='/')
    436420    {
    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());
    442423    }
    443424
    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))
    454426        return;
    455427
    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));
    458434}
    459435
     
    483459    const TGTextLBEntry *selected = (TGTextLBEntry*)filter->GetListBox()->GetSelectedEntry();
    484460
    485     const char *txt = StrDup(selected->GetText()->GetString());
    486 
    487461    //
    488462    // find filter and remove leading spaces
    489463    //
    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();
    504476}
    505477
  • trunk/MagicSoft/Mars/mmain/MBrowser.h

    r1086 r1172  
    3636    void CreateDirListBox(TGCompositeFrame *frame);
    3737
    38     void SetFileName(const char *name);
     38    void SetFileName(TString name);
    3939
    4040    void SetFilter();
     
    4444protected:
    4545    MGList *fList;
    46     Char_t  fInputFile[256];
     46    TString fInputFile;
    4747
    4848    TGCompositeFrame *CreateNewTab(const char *name);
  • trunk/MagicSoft/Mars/mmain/MDataCheck.cc

    r1086 r1172  
    9797//  histograms.
    9898//
    99 void MDataCheck::ViewAdcSpectra(Char_t *inputfile, Char_t *treeName)
     99void MDataCheck::ViewAdcSpectra(const Char_t *inputfile, const Char_t *treeName)
    100100{
    101101    //
  • trunk/MagicSoft/Mars/mmain/MDataCheck.h

    r1016 r1172  
    99{
    1010private:
    11     void ViewAdcSpectra(Char_t *inputfile, Char_t *treeName);
     11    void ViewAdcSpectra(const Char_t *inputfile, const Char_t *treeName);
    1212
    1313public:
Note: See TracChangeset for help on using the changeset viewer.