Changeset 947 for trunk


Ignore:
Timestamp:
09/26/01 12:22:51 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r946 r947  
    11                                                                  -*-*- END -*-*-
     2
     3 2001/09/26: Thomas Bretz
     4
     5   * mmain/MMars.[cc,h], mmain/MBrowser.[cc,h], MDataCheck.[cc,h],
     6     mmain/MEvtDisp.[cc,h], mmain/MMonteCarlo.[cc,h]:
     7     - reorganized code (constructor)
     8     - reorganized deletion of gui objects
     9     - fixed many, many memory leaks
     10     - small changes in layout
     11
     12
    213
    314 2001/09/25: Thomas Bretz
  • trunk/MagicSoft/Mars/mmain/MBrowser.cc

    r945 r947  
    3636#include <TGFSContainer.h>  // TGFileContainer
    3737
     38#include <TG3DLine.h>       // TGHorizontal3DLine
     39                            // use TGSplitter.h for root<3.00
     40
    3841#include <sys/stat.h>       // S_ISDIR
    3942
     
    236239    CreateMenuBar();
    237240
     241    TGLayoutHints *laylinesep  = new TGLayoutHints(kLHintsTop|kLHintsExpandX);
     242    fList->Add(laylinesep);
     243
     244    TGHorizontal3DLine *linesep = new TGHorizontal3DLine(this);
     245    fList->Add(linesep);
     246    AddFrame(linesep, laylinesep);
     247
     248
    238249    //
    239250    // ---- Create the top window with a lot of buttons ----
     
    242253    fList->Add(frametop);
    243254    AddFrame(frametop);
     255
     256    linesep = new TGHorizontal3DLine(this);
     257    fList->Add(linesep);
     258    AddFrame(linesep, laylinesep);
    244259
    245260    //
  • trunk/MagicSoft/Mars/mmain/MBrowser.h

    r945 r947  
    1010#endif
    1111
    12 class TGMenuBar;
    13 class TGPopupMenu;
    14 class TGTab;
     12class TList;
     13class TGListView;
    1514class TGComboBox;
    16 class TGTextButton;
    17 class TGListBox;
    1815class TGPictureButton;
    1916class TGFileContainer;
    20 class TGListView;
    21 class TList;
    2217
    2318class MBrowser : public TGTransientFrame
    2419{
    2520private:
    26 
    27     //
    28     // Create a main frame with a number of different buttons.
    29     //
    30 
    31     //
    32     //   the things in the file selector
    33     //
    3421    TGComboBox        *fDir;
    3522
     
    4027    TGFileContainer   *fFileCont;
    4128    TGListView        *fFileView;
    42 
    43 
    44     TList             *fList;
    45 
    46     //     some icons and pictures often used
    4729
    4830    const TGPicture   *fPic1;
     
    5840
    5941protected:
    60     Char_t fInputFile[256];
     42    TList  *fList;
     43    Char_t  fInputFile[256];
    6144
    6245    void DisplError(const char *txt);
     
    7457               const UInt_t w=500, const UInt_t h=500) ;
    7558
    76      ~MBrowser();
     59     virtual ~MBrowser();
    7760
    7861     void   CloseWindow();
  • trunk/MagicSoft/Mars/mmain/MDataCheck.cc

    r749 r947  
    4141: MBrowser(main, p, w, h)
    4242{
     43    TGTextButton *pedadc = new TGTextButton(fTop2, "ADC Spectra of Pedestals", M_BUTTON_PEDADC);
     44    TGTextButton *cradc  = new TGTextButton(fTop2, "ADC Specta of Cosmics",    M_BUTTON_CRADC);
     45    TGTextButton *pedtdc = new TGTextButton(fTop3, "TDC Spectra of Pedestals", M_BUTTON_PEDTDC);
     46    TGTextButton *crtdc  = new TGTextButton(fTop3, "TDC Specta of Cosmics",    M_BUTTON_CRTDC);
    4347
    44     fButPedADC = new TGTextButton(fTop2, "ADC Spectra of Pedestals", M_BUTTON_PEDADC );
    45     fButPedADC->Associate(this) ;
    46     fTop2->AddFrame (fButPedADC, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
     48    pedadc->Associate(this);
     49    cradc ->Associate(this);
     50    pedtdc->Associate(this);
     51    crtdc ->Associate(this);
    4752
    48     fButCrADC = new TGTextButton(fTop2, "ADC Specta of Cosmics", M_BUTTON_CRADC );
    49     fButCrADC->Associate(this) ;
    50     fTop2->AddFrame (fButCrADC, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
     53    fList->Add(pedadc);
     54    fList->Add(cradc);
     55    fList->Add(pedtdc);
     56    fList->Add(crtdc);
    5157
    52     fButPedTDC = new TGTextButton(fTop3, "TDC Spectra of Pedestals", M_BUTTON_PEDTDC );
    53     fButPedTDC->Associate(this) ;
    54     fTop3->AddFrame (fButPedTDC, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
     58    TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsLeft, 10, 10, 5, 5);
     59    fList->Add(laybut);
    5560
    56     fButCrTDC = new TGTextButton(fTop3, "TDC Specta of Cosmics", M_BUTTON_CRTDC );
    57     fButCrTDC->Associate(this) ;
    58     fTop3->AddFrame (fButCrTDC, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
     61    fTop2->AddFrame(pedadc, laybut);
     62    fTop2->AddFrame(cradc,  laybut);
     63
     64    fTop3->AddFrame(pedtdc, laybut);
     65    fTop3->AddFrame(crtdc,  laybut);
    5966
    6067    MapSubwindows();
     
    6875}
    6976
    70 MDataCheck::~MDataCheck()
    71 {
    72     delete fButPedADC;
    73     delete fButCrADC;
    74     delete fButPedTDC;
    75     delete fButCrTDC;
    76 }
    77 
    7877// ======================================================================
    7978
    8079Bool_t MDataCheck::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
    81 {     
    82   // Process events generated by the buttons in the frame.
    83  
     80{
     81    // Process events generated by the buttons in the frame.
     82
    8483    if (GET_MSG(msg)!=kC_COMMAND || GET_SUBMSG(msg)!=kCM_BUTTON)
    8584        return MBrowser::ProcessMessage(msg, parm1, parm2);
     
    9291    case M_BUTTON_CRTDC:
    9392        if (!InputFileSelected())
    94         {     
     93        {
    9594            DisplError("No Input (root) File selected!");
    9695            return kTRUE;
     
    10099        {
    101100        case M_BUTTON_PEDADC:
    102             fViewAdc.AdcSpectra(fInputFile, "PedEvents" ) ;
     101            fViewAdc.AdcSpectra(fInputFile, "PedEvents");
    103102            return kTRUE;
    104103
    105104        case M_BUTTON_CRADC:
    106             fViewAdc.AdcSpectra(fInputFile, "Events" ) ;
     105            fViewAdc.AdcSpectra(fInputFile, "Events");
    107106            return kTRUE;
    108107
     
    118117
    119118    return MBrowser::ProcessMessage(msg, parm1, parm2);
    120 } 
     119}
  • trunk/MagicSoft/Mars/mmain/MDataCheck.h

    r765 r947  
    66#endif
    77
    8 #ifndef ROOT_TGFrame
    9 #include <TGFrame.h>
     8#ifndef MBROWSER_H
     9#include "MBrowser.h"
    1010#endif
    1111
     
    1414#endif
    1515
    16 #ifndef MBROWSER_H
    17 #include "MBrowser.h"
    18 #endif
    19 
    20 class TGTextButton;
    21 
    2216class MDataCheck : public MBrowser
    2317{
    2418private:
    25 
    2619    MViewAdcSpectra fViewAdc;
    27 
    28     TGTextButton   *fButPedADC;
    29     TGTextButton   *fButPedTDC;
    30     TGTextButton   *fButCrADC;
    31     TGTextButton   *fButCrTDC;
    3220
    3321public:
    3422    MDataCheck(const TGWindow *main=NULL, const TGWindow *p=NULL,
    3523                    const UInt_t w=500, const UInt_t h=500) ;
    36 
    37     ~MDataCheck();
    3824
    3925    Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
  • trunk/MagicSoft/Mars/mmain/MEvtDisp.cc

    r860 r947  
    3939
    4040MEvtDisp::MEvtDisp(const TGWindow *main, const TGWindow *p,
    41                                  const UInt_t w, const UInt_t h)
     41                   const UInt_t w, const UInt_t h)
    4242: MBrowser(main, p, w, h)
    4343{
     44    TGTextButton *fadcevt = new TGTextButton(fTop1, "FADC Disp for Events",  M_BUT_DISP1_EVT);
     45    TGTextButton *fadcped = new TGTextButton(fTop1, "FADC Disp for PedEvts", M_BUT_DISP1_PED);
     46    TGTextButton *fadccal = new TGTextButton(fTop1, "FADC Disp for CalEvts", M_BUT_DISP1_CAL);
    4447
    45     fButFadcDispEvts = new TGTextButton(fTop1, "FADC Disp for Events", M_BUT_DISP1_EVT );
    46     fButFadcDispEvts->Associate(this) ;
    47     fTop1->AddFrame (fButFadcDispEvts, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
     48    fadcevt->Associate(this);
     49    fadcped->Associate(this);
     50    fadccal->Associate(this);
    4851
    49     fButFadcDispPed  = new TGTextButton(fTop1, "FADC Disp for PedEvts", M_BUT_DISP1_PED );
    50     fButFadcDispPed->Associate(this) ;
    51     fTop1->AddFrame (fButFadcDispPed, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
     52    fList->Add(fadcevt);
     53    fList->Add(fadcped);
     54    fList->Add(fadccal);
    5255
    53     fButFadcDispCal  = new TGTextButton(fTop1, "FADC Disp for CalEvts", M_BUT_DISP1_CAL );
    54     fButFadcDispCal->Associate(this) ;
    55     fTop1->AddFrame (fButFadcDispCal, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
     56    TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsLeft, 10, 10, 5, 5);
     57    fList->Add(laybut);
     58
     59    fTop1->AddFrame(fadcevt, laybut);
     60    fTop1->AddFrame(fadcped, laybut);
     61    fTop1->AddFrame(fadccal, laybut);
    5662
    5763    MapSubwindows();
     
    6369
    6470    MapWindow();
    65 }
    66 
    67 MEvtDisp::~MEvtDisp()
    68 {
    69     delete fButFadcDispCal;
    70     delete fButFadcDispPed;
    71     delete fButFadcDispEvts;
    7271}
    7372
     
    10099
    101100        case M_BUT_DISP1_PED:
    102             new MGFadcDisp( fInputFile , "PedEvts",
    103                             fClient->GetRoot(), this, 600, 500 ) ;
     101            new MGFadcDisp(fInputFile , "PedEvts",
     102                           fClient->GetRoot(), this, 600, 500);
    104103            return kTRUE;
    105104
    106105        case M_BUT_DISP1_CAL:
    107             new MGFadcDisp( fInputFile , "CalEvts",
    108                             fClient->GetRoot(), this, 600, 500 ) ;
     106            new MGFadcDisp(fInputFile , "CalEvts",
     107                           fClient->GetRoot(), this, 600, 500);
    109108            return kTRUE;
    110109        }
  • trunk/MagicSoft/Mars/mmain/MEvtDisp.h

    r714 r947  
    66#endif
    77
    8 #ifndef ROOT_TGFrame
    9 #include <TGFrame.h>
    10 #endif
    11 
    128#ifndef MBROWSER_H
    139#include "MBrowser.h"
    1410#endif
    1511
    16 class TGTextButton;
    17 
    1812class MEvtDisp : public MBrowser
    1913{
    20 private:
    21  
    22   TGTextButton *fButFadcDispEvts;
    23   TGTextButton *fButFadcDispPed;
    24   TGTextButton *fButFadcDispCal;
    25 
    2614public:
    2715    MEvtDisp(const TGWindow *main=NULL, const TGWindow *p=NULL,
    28                     const UInt_t w=500, const UInt_t h=500) ;
    29 
    30     ~MEvtDisp();
     16             const UInt_t w=500, const UInt_t h=500) ;
    3117
    3218    Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
  • trunk/MagicSoft/Mars/mmain/MMars.cc

    r946 r947  
    103103
    104104    top->AddFrame(magic, lay1);
    105     top->AddFrame(mars,  lay1);
     105    top->AddFrame(mars,  lay2);
    106106}
    107107
     
    188188    CreateBottomFrame(low);
    189189
    190     AddFrame(top,     new TGLayoutHints(kLHintsTop|kLHintsExpandX));
    191     AddFrame(linesep, new TGLayoutHints(kLHintsTop|kLHintsExpandX));
    192     AddFrame(low,     new TGLayoutHints(kLHintsTop|kLHintsExpandX));
     190    TGLayoutHints *layout = new TGLayoutHints(kLHintsTop|kLHintsExpandX);
     191    fList->Add(layout);
     192
     193    AddFrame(top,     layout);
     194    AddFrame(linesep, layout);
     195    AddFrame(low,     layout);
    193196
    194197    //
    195198    //   Map the window, set up the layout, etc.
    196199    //
    197     SetWMSizeHints(400, 650, 1000, 1000, 10, 10 ) ;  // set the smallest and biggest size of the Main frame
     200    SetWMSizeHints(400, 380, 400, 380, 10, 10);  // set the smallest and biggest size of the Main frame
    198201
    199202    MapSubwindows();
  • trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc

    r749 r947  
    3434};
    3535
    36 MMonteCarlo::MMonteCarlo(const TGWindow *main, const TGWindow *p, 
    37                                    const UInt_t w, const UInt_t h )
    38     : MBrowser(p, main, w, h)
     36MMonteCarlo::MMonteCarlo(const TGWindow *main, const TGWindow *p,
     37                         const UInt_t w, const UInt_t h)
     38: MBrowser(main, p, w, h)
    3939{
     40    TGTextButton *action = new TGTextButton(fTop1, "ACTION", M_BUTTON_ACTION);
     41    fList->Add(action);
     42    action->Associate(this);
    4043
    41     fButAction = new TGTextButton(fTop1, "ACTION", M_BUTTON_ACTION );
    42     fButAction->Associate(this) ;
    43     fTop1->AddFrame (fButAction, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
     44    TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsLeft, 10, 10, 5, 5);
     45    fList->Add(laybut);
     46
     47    fTop1->AddFrame(action, laybut);
    4448
    4549    MapSubwindows();
     
    5256    MapWindow();
    5357}
    54 
    55 MMonteCarlo::~MMonteCarlo()
    56 {
    57     delete fButAction;
    58 }
    5958
    6059// ======================================================================
  • trunk/MagicSoft/Mars/mmain/MMonteCarlo.h

    r765 r947  
    66#endif
    77
    8 #ifndef ROOT_TGFrame
    9 #include <TGFrame.h>
    10 #endif
    118#ifndef MBROWSER_H
    129#include "MBrowser.h"
    1310#endif
    1411
    15 class TGTextButton;
    16 
    1712class MMonteCarlo : public MBrowser
    1813{
    19 private:
    20 
    21     TGTextButton *fButAction;
    22 
    2314public:
    2415    MMonteCarlo(const TGWindow *main=NULL, const TGWindow *p=NULL,
    25                      const UInt_t w=500, const UInt_t h=500) ;
    26 
    27     ~MMonteCarlo();
     16                const UInt_t w=500, const UInt_t h=500);
    2817
    2918    Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
Note: See TracChangeset for help on using the changeset viewer.