Changeset 2069 for trunk/MagicSoft/Cosy
- Timestamp:
- 05/05/03 17:15:15 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r2068 r2069 58 58 kPB_ResetBending, 59 59 kPB_CALIBSE, 60 kCB_PredefPos 61 60 kCB_PredefPos, 61 62 // kLog 63 kLogCopy, kLogClear, kLogSelect, kLogSearch, kLogSave, kLogAppend 62 64 }; 63 65 64 66 void MGCosy::CreateMenu() 65 67 { 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); 68 72 69 73 // 70 74 // crate the menu bar 71 75 // 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); 77 98 78 99 // 79 100 // the button messages are handled by main frame (this) 80 101 // 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); 85 107 86 108 // 87 109 // Seperator beyond menubar 88 110 // 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); 93 114 } 94 115 … … 746 767 #ifdef DEBUG 747 768 cout << "MGCosy::~MGCosy called." << endl; 748 #endif749 delete fLayMenuBar;750 delete fLayMenuItem;751 #ifdef DEBUG752 cout << "Deleting MGCosy::fList" << endl;753 769 #endif 754 770 delete fList; … … 1298 1314 return kTRUE; 1299 1315 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; 1304 1342 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; 1307 1352 return kTRUE; 1308 1353 } -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r2068 r2069 44 44 // Create a main frame with a number of different buttons. 45 45 // 46 TGLayoutHints *fLayMenuBar;47 TGLayoutHints *fLayMenuItem;48 49 46 MGList *fList; 50 47
Note:
See TracChangeset
for help on using the changeset viewer.