Ignore:
Timestamp:
04/30/02 12:00:44 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mgui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.cc

    r1268 r1325  
    2727//
    2828MCamDisplay::MCamDisplay(MGeomCam *geom)
    29     : fAutoScale(kTRUE), fMinPhe(-2), fMaxPhe(50), fW(0), fH(0), fDrawingPad(NULL)
    30 {
    31     fGeomCam = geom; // FIXME: Clone doesn't work! (MGeomCam*)geom->Clone();
     29    : fAutoScale(kTRUE), fMinPhe(-2), fMaxPhe(50), fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)
     30{
     31    fGeomCam = (MGeomCam*)geom; // FIXME: Clone doesn't work! (MGeomCam*)geom->Clone();
    3232
    3333    //
     
    5353    // set the color palette for the TBox elements
    5454    //
     55#if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06)
    5556    gStyle->SetPalette(1, 0);
     57#else
     58    gStyle->SetPalette(51, 0);
     59#endif
    5660
    5761    //
     
    8185MCamDisplay::~MCamDisplay()
    8286{
     87    fPixels->Delete();
     88    fLegend->Delete();
     89    fLegText->Delete();
     90
    8391    delete fPixels;
    8492    delete fLegend;
    8593    delete fLegText;
    8694
    87     delete fGeomCam;
     95    // delete fGeomCam;
     96
     97    if (fIsAllocated)
     98        delete fDrawingPad;
    8899}
    89100
     
    157168    // gPad->SetFixedAspectRatio()
    158169
     170    if (fDrawingPad)
     171        return;
     172
    159173    //
    160174    // if no canvas is yet existing to draw into, create a new one
    161175    //
    162176    if (!gPad)
     177    {
    163178        fDrawingPad = new TCanvas("CamDisplay", "Magic Camera Display", 0, 0, 750, 600);
     179        fIsAllocated = kTRUE;
     180    }
    164181    else
     182    {
    165183        fDrawingPad = gPad;
     184        fIsAllocated = kFALSE;
     185    }
    166186
    167187    fDrawingPad->SetBorderMode(0);
     
    176196    // Setup the correct environment
    177197    //
     198#if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06)
    178199    gStyle->SetPalette(1, 0);
     200#else
     201    gStyle->SetPalette(51, 0);
     202#endif
    179203
    180204    gPad->SetFillColor(22);
     
    220244void MCamDisplay::DrawPhotNum(const MCerPhotEvt *event)
    221245{
     246    if (!event)
     247        return;
     248
    222249    if (!fDrawingPad)
    223250        Draw();
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.h

    r1203 r1325  
    3838    UInt_t         fH;           // Height of canvas
    3939    TVirtualPad   *fDrawingPad;  // pad in which we are drawing
     40    Bool_t         fIsAllocated;
    4041
    4142    TBox  *GetBox(Int_t i)  { return (TBox*) fLegend->At(i); }
Note: See TracChangeset for help on using the changeset viewer.