Ignore:
Timestamp:
11/08/01 10:57:01 (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

    r1050 r1052  
    3232#include <TGButton.h>       // TGTextButton
    3333#include <TGMsgBox.h>       // TGMsgBox
     34#include <TBrowser.h>       // TBrowser
    3435#include <TGListBox.h>      // TGListBox
    3536#include <TGTextEntry.h>    // TGTextEntry
     
    4849
    4950enum {
     51    kFileTBrowser,
    5052    kFileClose,
    5153    kButDirUp,
     
    6264    //
    6365    TGPopupMenu *filemenu = new TGPopupMenu(gClient->GetRoot());
    64     filemenu->AddEntry("Close", kFileClose);
     66    filemenu->AddEntry("Open &TBrowser", kFileTBrowser);
     67    filemenu->AddSeparator();
     68    filemenu->AddEntry("&Close", kFileClose);
     69    filemenu->Associate(this);
    6570    fList->Add(filemenu);
    6671
     
    7580
    7681    TGMenuBar *menubar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
    77     menubar->AddPopup("File", filemenu, laymenuitem);
     82    menubar->AddPopup("&File", filemenu, laymenuitem);
    7883    AddFrame(menubar, laymenubar);
    7984    fList->Add(menubar);
     
    320325    ChangeDir();
    321326    SetWMSizeHints(400, 350, 1000, 1000, 10, 10); // set the smallest and biggest size of the Main frame
     327    Move(rand()%100+50, rand()%100+50);
    322328}
    323329
     
    450456}
    451457
     458// --------------------------------------------------------------------------
     459//
     460// Process events generated by the gui elements in the frame.
     461//
    452462Bool_t MBrowser::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
    453 {     
    454   // Process events generated by the buttons in the frame.
    455  
    456   switch (GET_MSG(msg))
    457   {
    458   case kC_TEXTENTRY:
    459       if (GET_SUBMSG(msg)!=kTE_ENTER)
    460           return kTRUE;
    461 
    462       SetFileName(fEntry->GetText());
    463       return kTRUE;
    464 
    465   case kC_COMMAND:
    466       switch (GET_SUBMSG(msg))
    467       {
    468       case kCM_BUTTON:
    469 
    470           switch (parm1)
    471           {
    472           case kButDirUp :
    473               //
    474               //  goto the parent directory
    475               //
    476               ChangeDir("..");
    477               return kTRUE;
    478            
    479             case kButListMode:
    480               fFileView->SetViewMode(kLVList);
    481               fDetail->SetState(kButtonUp) ;
    482               return kTRUE;
    483              
    484           case kButDetailMode:
    485               fFileView->SetViewMode(kLVDetails);
    486               fListMode->SetState(kButtonUp);
    487               return kTRUE;
    488           }
    489           return kTRUE;
    490 
    491       case kCM_COMBOBOX:
    492           //
    493           // FIXME: Don't add the new entry to the list!
    494           // But to do this we need the number of entries in the list.
    495           //
    496           if (parm1 != kCBDirectory)
    497               return kTRUE;
    498 
    499           ChangeDir(((TGTreeLBEntry*)fDir->GetSelectedEntry())->GetPath()->GetString());
    500           return kTRUE;
    501 
    502         case kCM_MENU:
    503           if (parm1==kFileClose)
    504               CloseWindow();
    505           return kTRUE;
    506       }
    507       return kTRUE;
    508      
    509   case kC_CONTAINER:
    510       switch (GET_SUBMSG(msg))
    511       {
    512 
    513           //      case kCT_ITEMCLICK:
    514           //    printf ("itemclick\n");
    515           //      break;
    516 
    517       case kCT_ITEMDBLCLICK:
    518           //
    519           //  process the double click in the file view container
    520           //
    521 
    522           if (parm1 != kButton1 || fFileCont->NumSelected() != 1)
    523               return kTRUE;
    524 
    525           //
    526           //  one file selected
    527           //
    528           void *dummy = NULL;
    529           const TGFileItem *item = (TGFileItem *)fFileCont->GetNextSelected(&dummy);
    530 
    531           const char *str = item->GetItemName()->GetString();
    532 
    533           //
    534           // if the user choose a directory
    535           // change to this directory
    536           //
    537           if (S_ISDIR(item->GetType()))
    538           {
    539               ChangeDir(str);
    540               return kTRUE;
    541           }
    542 
    543           SetFileName(str);
    544           return kTRUE;
    545       }
    546   }
    547   return kTRUE;
    548 } 
     463{
     464    switch (GET_MSG(msg))
     465    {
     466    case kC_TEXTENTRY:
     467        if (GET_SUBMSG(msg)!=kTE_ENTER)
     468            return kTRUE;
     469
     470        SetFileName(fEntry->GetText());
     471        return kTRUE;
     472
     473    case kC_COMMAND:
     474        switch (GET_SUBMSG(msg))
     475        {
     476        case kCM_MENU:
     477            switch (parm1)
     478            {
     479            case kFileClose:
     480                CloseWindow();
     481                return kTRUE;
     482
     483            case kFileTBrowser:
     484                new TBrowser();
     485                return kTRUE;
     486            }
     487            return kTRUE;
     488
     489        case kCM_BUTTON:
     490            switch (parm1)
     491            {
     492            case kButDirUp:
     493                //
     494                //  goto the parent directory
     495                //
     496                ChangeDir("..");
     497                return kTRUE;
     498
     499            case kButListMode:
     500                fFileView->SetViewMode(kLVList);
     501                fDetail->SetState(kButtonUp);
     502                return kTRUE;
     503
     504            case kButDetailMode:
     505                fFileView->SetViewMode(kLVDetails);
     506                fListMode->SetState(kButtonUp);
     507                return kTRUE;
     508            }
     509            return kTRUE;
     510
     511        case kCM_COMBOBOX:
     512            if (parm1 != kCBDirectory)
     513                return kTRUE;
     514
     515            ChangeDir(((TGTreeLBEntry*)fDir->GetSelectedEntry())->GetPath()->GetString());
     516            return kTRUE;
     517        }
     518        return kTRUE;
     519
     520    case kC_CONTAINER:
     521        switch (GET_SUBMSG(msg))
     522        {
     523
     524            //      case kCT_ITEMCLICK:
     525            //  printf ("itemclick\n");
     526            //      break;
     527
     528        case kCT_ITEMDBLCLICK:
     529            //
     530            //  process the double click in the file view container
     531            //
     532            if (parm1 != kButton1 || fFileCont->NumSelected() != 1)
     533                return kTRUE;
     534
     535            //
     536            //  one file selected
     537            //
     538            void *dummy = NULL;
     539            const TGFileItem *item = (TGFileItem *)fFileCont->GetNextSelected(&dummy);
     540
     541            const char *str = item->GetItemName()->GetString();
     542
     543            //
     544            // if the user choose a directory
     545            // change to this directory
     546            //
     547            if (S_ISDIR(item->GetType()))
     548            {
     549                ChangeDir(str);
     550                return kTRUE;
     551            }
     552
     553            SetFileName(str);
     554            return kTRUE;
     555        }
     556    }
     557    return kTRUE;
     558}
  • trunk/MagicSoft/Mars/mmain/MMars.cc

    r1050 r1052  
    4444
    4545enum {
    46     M_FILE_EXIT,
    47     M_FILE_ABOUT,
    48 
    49     M_PICTURE_MAGIC,
    50     M_PICTURE_MARS,
    51 
    52     M_BUTTON_EVTDISP,
    53     M_BUTTON_DATACHECK,
    54     M_BUTTON_ANALYSE,
    55     M_BUTTON_MONTECARLO,
    56     M_BUTTON_CAMDISPLAY
     46    kFileExit,
     47    kFileAbout,
     48
     49    kPicMagic,
     50    kPicMars,
     51
     52    kButEvtDisplay,
     53    kButDataCheck,
     54    kButAnalysis,
     55    kButMonteCarlo,
     56    kButCameraDisplay
    5757};
    5858
     
    6868
    6969    TGPopupMenu *filemenu = new TGPopupMenu(gClient->GetRoot());
    70     filemenu->AddEntry("Exit", M_FILE_EXIT);
    71     //fFileMenu->Associate(this);
     70    filemenu->AddEntry("E&xit", kFileExit);
     71    filemenu->Associate(this);
    7272
    7373    TGMenuBar *menubar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
    74     menubar->AddPopup("File", filemenu, laymenuitem);
     74    menubar->AddPopup("&File", filemenu, laymenuitem);
    7575    AddFrame(menubar, laymenubar);
    7676
     
    8888    fPic2 = gClient->GetPicture("marslogo.xpm");
    8989
    90     TGPictureButton *magic = new TGPictureButton(top, fPic1, M_PICTURE_MAGIC);
    91     TGPictureButton *mars  = new TGPictureButton(top, fPic2, M_PICTURE_MARS);
     90    TGPictureButton *magic = new TGPictureButton(top, fPic1, kPicMagic);
     91    TGPictureButton *mars  = new TGPictureButton(top, fPic2, kPicMars);
    9292
    9393    fList->Add(magic);
     
    163163    fList->Add(laybut);
    164164
    165     CreateTextButton(tab2, "Event Display",  M_BUTTON_EVTDISP,    laybut);
    166     CreateTextButton(tab2, "Data Check",     M_BUTTON_DATACHECK,  laybut);
    167     CreateTextButton(tab2, "Analysis",       M_BUTTON_ANALYSE,    laybut);
    168     CreateTextButton(tab2, "Monte Carlo",    M_BUTTON_MONTECARLO, laybut);
    169     CreateTextButton(tab2, "Camera Display", M_BUTTON_CAMDISPLAY, laybut);
    170 }
    171 
    172 MMars::MMars(/*const TGWindow *p,*/ UInt_t w, UInt_t h)
    173 : TGMainFrame(gClient->GetRoot(), w, h)
    174 //: MBrowser (gClient->GetRoot(), gClient->GetRoot(), w, h)
     165    CreateTextButton(tab2, "Event Display",  kButEvtDisplay,    laybut);
     166    CreateTextButton(tab2, "Data Check",     kButDataCheck,  laybut);
     167    CreateTextButton(tab2, "Analysis",       kButAnalysis,    laybut);
     168    CreateTextButton(tab2, "Monte Carlo",    kButMonteCarlo, laybut);
     169    CreateTextButton(tab2, "Camera Display", kButCameraDisplay, laybut);
     170}
     171
     172MMars::MMars()
     173: TGMainFrame(gClient->GetRoot(), 330, 400, kVerticalFrame|kFixedSize)
    175174{
    176175    //
     
    212211    //
    213212    //   Map the window, set up the layout, etc.
    214     //
    215     SetWMSizeHints(330, 410, 330, 410, 10, 10);  // set the smallest and biggest size of the Main frame
     213    //   kFixedSize seems to be ignored
     214    //
     215    SetWMSizeHints(GetWidth(), GetHeight(), GetWidth(), GetHeight(), 0, 0);  // set the smallest and biggest size of the Main frame
     216    Move(rand()%100, rand()%100);
    216217
    217218    MapSubwindows();
     
    269270            {
    270271
    271             case M_BUTTON_EVTDISP:
     272            case kButEvtDisplay:
    272273                new MEvtDisp(this);
    273274                return kTRUE;
    274275
    275             case M_BUTTON_DATACHECK:
     276            case kButDataCheck:
    276277                new MDataCheck(this);
    277278                return kTRUE;
    278279
    279             case M_BUTTON_ANALYSE:
     280            case kButAnalysis:
    280281                new MAnalysis(this);
    281282                return kTRUE;
    282283
    283             case M_BUTTON_MONTECARLO:
     284            case kButMonteCarlo:
    284285                new MMonteCarlo(this);
    285286                return kTRUE;
    286287
    287             case M_BUTTON_CAMDISPLAY:
     288            case kButCameraDisplay:
    288289                new MCameraDisplay(this);
    289290                return kTRUE;
    290291
    291             case M_PICTURE_MAGIC:
     292            case kPicMagic:
    292293                gSystem->Exec("netscape http://hegra1.mppmu.mpg.de/MAGICWeb/ &");
    293294                return kTRUE;
    294295
    295             case M_PICTURE_MARS:
     296            case kPicMars:
    296297                gSystem->Exec("netscape http://magic.uni-sw.gwdg.de/mars/ &");
    297298                return kTRUE;
     
    299300
    300301        case kCM_MENU:
    301             if (parm1!=M_FILE_EXIT)
     302            if (parm1!=kFileExit)
    302303                return kTRUE;
    303304
  • trunk/MagicSoft/Mars/mmain/MMars.h

    r1016 r1052  
    3333
    3434public:
    35     MMars(UInt_t w=400, UInt_t h=500);
    36 
     35    MMars();
    3736    ~MMars();
    3837
  • trunk/MagicSoft/Mars/mmain/Makefile

    r1018 r1052  
    4747include ../Makefile.rules
    4848
    49 clean:  rmlib rmcint rmobjs rmcore rmbin
     49clean:  rmcint rmobjs rmcore rmlib
    5050
    5151mrproper:       clean rmbak
Note: See TracChangeset for help on using the changeset viewer.