Ignore:
Timestamp:
10/20/03 21:32:30 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r2386 r2416  
    7272#include <fstream>          // ofstream, SavePrimitive
    7373
     74#include <TRint.h>          // gApplication, TRint::Class()
    7475#include <TTime.h>          // TTime
    7576#include <TFile.h>          // gFile
     
    370371    gSystem->ProcessEvents();
    371372#else
    372     if (fDisplay)
    373         gSystem->ProcessEvents();
    374     else
    375         if (fProgress)
    376             gClient->ProcessEventsFor(fProgress);
     373    // FIXME: This is a workaround, because TApplication::Run is not thread safe against ProcessEvents
     374    if (gApplication->InheritsFrom(TRint::Class()))
     375    {
     376        if (fDisplay)
     377            gSystem->ProcessEvents();
     378        else
     379            if (fProgress)
     380                gClient->ProcessEventsFor(fProgress);
     381    }
    377382#endif
    378383
     
    469474    {
    470475        fProgress->SetPosition(maxcnt>0 ? TMath::Min(maxcnt, entries) : entries);
     476        // FIXME: This is a workaround, because TApplication::Run is not thread safe against ProcessEvents
     477        if (gApplication->InheritsFrom(TRint::Class()))
     478        {
    471479#if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06)
    472         gSystem->ProcessEvents();
     480            gSystem->ProcessEvents();
    473481#else
    474         gClient->ProcessEventsFor(fDisplay ? fDisplay->GetBar() : fProgress);
     482            gClient->ProcessEventsFor(fDisplay ? fDisplay->GetBar() : fProgress);
    475483#endif
     484        }
    476485    }
    477486
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r2411 r2416  
    114114TObject *MParContainer::Clone(const char *newname) const
    115115{
     116
    116117   MParContainer *named = (MParContainer*)TObject::Clone();
    117118   if (newname && strlen(newname)) named->SetName(newname);
     
    583584    return ((TEnv&)env).GetValue(prefix, dflt);
    584585}
    585 
    586 // --------------------------------------------------------------------------
    587 //
    588 // DrawTS which is a thread safe version of Draw. Draw
    589 // are also overwritten to call DrawTS. Please overwrite
    590 // the TS version of the member function if you want to implement
    591 // Draw for your class. Classes which overwrites Draw instead
    592 // should work well, too, except in multithreaded environments like Mona.
    593 //
    594 // The static version maybe called dor any TObject. For you class it is
    595 // called with a pointer to 'this' object.
    596 //
    597 void MParContainer::DrawTS(TObject *obj, TVirtualPad *pad, Option_t *option)
    598 {
    599     if (!obj)
    600     {
    601         gLog << warn << "MParContainer::DrawTS: obj==NULL" << endl;
    602         return;
    603     }
    604 
    605     if (!pad)
    606         pad = gPad;
    607 
    608     // FIXME: Move MH to mbase
    609     //if (!pad)
    610     //    pad = MakeDefCanvas(this);
    611 
    612     if (!pad)
    613     {
    614         if (!gROOT->GetMakeDefCanvas())
    615             return;
    616         (gROOT->GetMakeDefCanvas())();
    617         pad = gPad;
    618     }
    619 
    620     if (!pad->IsEditable())
    621         return;
    622 
    623     obj->SetBit(kMustCleanup);
    624 
    625     pad->GetListOfPrimitives()->Add(obj, option);
    626     pad->Modified(kTRUE);
    627 }
    628 
    629 // --------------------------------------------------------------------------
    630 //
    631 // DrawCloneTS which is a thread safe version of DrawClone. DrawClone
    632 // are also overwritten to call DrawCloneTS. Please overwrite
    633 // the TS version of the member function if you want to implement
    634 // DrawClone for your class. Classes which overwrites DrawClone instead
    635 // should work well, too, except in multithreaded environments like Mona
    636 //
    637 // The static version maybe called dor any TObject. For you class it is
    638 // called with a pointer to 'this' object.
    639 //
    640 TObject *MParContainer::DrawCloneTS(const TObject *obj, TVirtualPad *pad, Option_t *option)
    641 {
    642     // Draw a clone of this object in the current pad
    643     if (!obj)
    644         return 0;
    645 
    646     TObject *newobj = obj->Clone();
    647     if (!newobj)
    648         return 0;
    649 
    650     /*
    651      gLog << dbg << "MParConatiner::DrawCloneTS - ";
    652      gLog << (int)newobj->InheritsFrom(MParContainer::Class()) << " ";
    653      gLog << pad << endl;
    654      */
    655     if (newobj->InheritsFrom(MParContainer::Class()))
    656         ((MParContainer*)newobj)->DrawTS(pad, strlen(option) ? option : obj->GetDrawOption());
    657     else
    658         DrawTS(newobj, pad, strlen(option) ? option : obj->GetDrawOption());
    659 
    660     return newobj;
    661 }
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r2411 r2416  
    129129    const char *GetEnvValue(const TEnv &env, TString prefix, const char *dflt) const;
    130130
    131     static  void DrawTS(TObject *obj, TVirtualPad *pad=NULL, Option_t *option="");
    132     virtual void DrawTS(TVirtualPad *pad=NULL, Option_t *option="")
    133     {
    134         DrawTS(this, pad, option);
    135     }
    136     void Draw(Option_t *option="") { DrawTS(NULL, option); }
    137 
    138     static  TObject *DrawCloneTS(const TObject *obj, TVirtualPad *pad=NULL, Option_t *option="");
    139     virtual TObject *DrawCloneTS(TVirtualPad *pad=NULL, Option_t *option="") const
    140     {
    141         return DrawCloneTS(this, pad, option);
    142     }
    143     TObject *DrawClone(Option_t *option="") const
    144     {
    145         return DrawCloneTS(NULL, option);
    146     }
    147 
    148131    ClassDef(MParContainer, 0)  //The basis for all parameter containers
    149132};
Note: See TracChangeset for help on using the changeset viewer.