Changeset 2069 for trunk


Ignore:
Timestamp:
05/05/03 17:15:15 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/gui/MGCosy.cc

    r2068 r2069  
    5858    kPB_ResetBending,
    5959    kPB_CALIBSE,
    60     kCB_PredefPos
    61 
     60    kCB_PredefPos,
     61
     62    // kLog
     63    kLogCopy, kLogClear, kLogSelect, kLogSearch, kLogSave, kLogAppend
    6264};
    6365
    6466void MGCosy::CreateMenu()
    6567{
    66     fLayMenuBar  = new TGLayoutHints (kLHintsNormal | kLHintsExpandX);
    67     fLayMenuItem = new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0);
     68    TGLayoutHints *laymenubar  = new TGLayoutHints (kLHintsNormal | kLHintsExpandX);
     69    TGLayoutHints *laymenuitem = new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0);
     70    fList->Add(laymenubar);
     71    fList->Add(laymenuitem);
    6872
    6973    //
    7074    //  crate the menu bar
    7175    //
    72     TGPopupMenu *fFileMenu = new TGPopupMenu(gClient->GetRoot());
    73     fFileMenu->AddEntry("Set Aspect", IDM_ASPECT);
    74     fFileMenu->AddEntry("Exit", IDM_EXIT);
    75     fFileMenu->Associate(this);
    76     fList->Add(fFileMenu);
     76    TGPopupMenu *filemenu = new TGPopupMenu(gClient->GetRoot());
     77    filemenu->AddEntry("Set Aspect", IDM_ASPECT);
     78    filemenu->AddEntry("Exit", IDM_EXIT);
     79    filemenu->Associate(this);
     80    fList->Add(filemenu);
     81
     82    //
     83    // Log Menu
     84    //
     85    TGPopupMenu *logmenu = new TGPopupMenu(gClient->GetRoot());
     86    logmenu->AddEntry("&Copy Selected", kLogCopy);
     87    logmenu->AddEntry("Clear all",      kLogClear);
     88    logmenu->AddSeparator();
     89    logmenu->AddEntry("Select All",     kLogSelect);
     90    /*
     91     logmenu->AddSeparator();
     92     logmenu->AddEntry("Search",         kLogSearch);
     93     */
     94    logmenu->AddSeparator();
     95    logmenu->AddEntry("Save",           kLogSave);
     96    logmenu->AddEntry("Save append",    kLogAppend);
     97    logmenu->Associate(this);
    7798
    7899    //
    79100    //  the button messages are handled by main frame (this)
    80101    //
    81     TGMenuBar *fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
    82     fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem);
    83     AddFrame(fMenuBar, fLayMenuBar);
    84     fList->Add(fMenuBar);
     102    TGMenuBar *menubar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
     103    menubar->AddPopup("File", filemenu, laymenuitem);
     104    menubar->AddPopup("Lo&g", logmenu,  laymenuitem);
     105    AddFrame(menubar, laymenubar);
     106    fList->Add(menubar);
    85107
    86108    //
    87109    //  Seperator beyond menubar
    88110    //
    89 
    90     TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
    91     AddFrame(fLineSep, fLayMenuBar);
    92     fList->Add(fLineSep);
     111    TGHorizontal3DLine *linesep = new TGHorizontal3DLine(this);
     112    AddFrame(linesep, laymenubar);
     113    fList->Add(linesep);
    93114}
    94115
     
    746767#ifdef DEBUG
    747768    cout << "MGCosy::~MGCosy called." << endl;
    748 #endif
    749     delete fLayMenuBar;
    750     delete fLayMenuItem;
    751 #ifdef DEBUG
    752     cout << "Deleting MGCosy::fList" << endl;
    753769#endif
    754770    delete fList;
     
    12981314                return kTRUE;
    12991315            case IDM_ASPECT:
    1300                 Int_t w = GetWidth();
    1301                 Int_t h = GetHeight();
    1302                 if (w>940*h/660)
    1303                     w = 940*h/660;
     1316                {
     1317                    Int_t w = GetWidth();
     1318                    Int_t h = GetHeight();
     1319                    if (w>940*h/660)
     1320                        w = 940*h/660;
     1321                    else
     1322                        h = 660*w/940;
     1323                    Resize(w, h);
     1324                }
     1325                return kTRUE;
     1326            case kLogClear:
     1327                fLog->Clear();
     1328                return kTRUE;
     1329            case kLogCopy:
     1330                fLog->Copy();
     1331                return kTRUE;
     1332            case kLogSelect:
     1333                fLog->SelectAll();
     1334                return kTRUE;
     1335            case kLogSearch:
     1336                //virtual Bool_t Search(const char *string, Bool_t direction, Bool_t caseSensitive);
     1337                return kTRUE;
     1338            case kLogSave:
     1339                cout << "Saving log... " << flush;
     1340                if (fLog->GetText()->Save("cosylog.txt"))
     1341                    cout << "done." << endl;
    13041342                else
    1305                     h = 660*w/940;
    1306                 Resize(w, h);
     1343                    cout << "failed!" << endl;
     1344                return kTRUE;
     1345
     1346            case kLogAppend:
     1347                cout << "Appending log... " << flush;
     1348                if (fLog->GetText()->Append("cosylog.txt"))
     1349                    cout << "done." << endl;
     1350                else
     1351                    cout << "failed!" << endl;
    13071352                return kTRUE;
    13081353            }
  • trunk/MagicSoft/Cosy/gui/MGCosy.h

    r2068 r2069  
    4444    // Create a main frame with a number of different buttons.
    4545    //
    46     TGLayoutHints *fLayMenuBar;
    47     TGLayoutHints *fLayMenuItem;
    48 
    4946    MGList        *fList;
    5047
Note: See TracChangeset for help on using the changeset viewer.