Changeset 2058 for trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
- Timestamp:
- 05/05/03 10:37:08 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
r2054 r2058 79 79 #include <TG3DLine.h> // TGHorizontal3DLine 80 80 #include <TGButton.h> // TGPictureButton 81 #include <TG ListBox.h> // TGListBox81 #include <TGTextView.h> // TGTextView 82 82 #include <TGStatusBar.h> // TGStatusBar 83 83 #include <TGProgressBar.h> // TGHProgressBar … … 153 153 154 154 // 155 // Log Menu 156 // 157 MGPopupMenu *logmenu = new MGPopupMenu(gClient->GetRoot()); 158 logmenu->AddEntry("&Copy Selected", kLogCopy); 159 logmenu->AddEntry("Clear all", kLogClear); 160 logmenu->AddSeparator(); 161 logmenu->AddEntry("Select All", kLogSelect); 162 /* 163 logmenu->AddSeparator(); 164 logmenu->AddEntry("Search", kLogSearch); 165 */ 166 logmenu->AddSeparator(); 167 logmenu->AddEntry("Save", kLogSave); 168 logmenu->AddEntry("Save append", kLogAppend); 169 logmenu->Associate(this); 170 171 // 155 172 // Menu Bar 156 173 // 157 174 MGMenuBar *menubar = new MGMenuBar(this, 1, 1, kHorizontalFrame); 158 175 menubar->AddPopup("&File", filemenu, NULL); 176 menubar->AddPopup("Lo&g", logmenu, NULL); 177 menubar->AddPopup("&Size", sizemenu, NULL); 159 178 menubar->AddPopup("&Tab", tabmenu, NULL); 160 179 menubar->AddPopup("&Loop", loopmenu, NULL); 161 menubar->AddPopup("&Size", sizemenu, NULL);162 180 menubar->BindKeys(this); 163 181 AddFrame(menubar); … … 180 198 fList->Add(menubar); 181 199 fList->Add(tabmenu); 200 fList->Add(logmenu); 182 201 fList->Add(linesep); 183 202 } … … 220 239 f->AddFrame(mars, lay2); 221 240 } 222 /*223 TGShutter *s = new TGShutter(f);224 fList->Add(s);225 f->AddFrame(s, lay);226 s->AddItem(new TGShutterItem(s, new TGHotString("Hallo1")));227 s->AddItem(new TGShutterItem(s, new TGHotString("Hallo2")));228 */229 241 230 242 // Add date and time … … 261 273 TGCompositeFrame *f = fTab->AddTab("-Logbook-"); 262 274 263 // Create TGListBox(p, id=-1, opt, back) for logging contents 264 fLogBox = new TGListBox(f, -1, kSunkenFrame); 265 //fLogBox->Associate(this); 275 276 fLogBox = new TGTextView(f, 1, 1/*, -1, 0, TGTextView::GetBlackPixel()*/); 277 if (fFont) 278 fLogBox->SetFont(fFont); 279 fLogBox->Associate(this); 266 280 267 281 // Add List box to the tab … … 334 348 } 335 349 336 337 350 // -------------------------------------------------------------------------- 338 351 // … … 343 356 fStatusBar = new TGStatusBar(this, 1, 1); 344 357 345 fStatusBar->SetParts(2); 358 // 359 // 1-a a 360 // 1: ------|---- 361 // 362 // a/(1-a) = (1-a)/1 363 // a^2+a-1 = 0 364 // a = (-1+-sqrt(1+4))/2 = sqrt(5)/2-1/2 = 0.618 365 // 366 Int_t p[2] = {38, 62}; 367 368 fStatusBar->SetParts(p, 2); 346 369 347 370 TGLayoutHints *layb = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 5, 4, 0, 3); … … 399 422 gROOT->GetListOfCleanups()->Add(this); 400 423 424 fFont = gVirtualX->LoadQueryFont("7x13bold"); 401 425 402 426 // … … 452 476 453 477 delete fList; 478 479 if (fFont) 480 gVirtualX->DeleteFont(fFont); 454 481 455 482 gROOT->GetListOfSpecials()->Remove(this); … … 643 670 } 644 671 672 /* 673 if (...) 674 fMenu->AddPopup("&CaOs", fCaOs, NULL); 675 else 676 fMenu->RemovePopup("CaOs"); 677 fMenu->Resize(fMenu->GetDefaultSize()); 678 MapSubwindows(); 679 MapWindow(); 680 */ 681 645 682 // -------------------------------------------------------------------------- 646 683 // … … 728 765 case kSize1280: 729 766 Resize(1280, 980); 767 return kTRUE; 768 769 case kLogClear: 770 fLogBox->Clear(); 771 return kTRUE; 772 case kLogCopy: 773 fLogBox->Copy(); 774 return kTRUE; 775 case kLogSelect: 776 fLogBox->SelectAll(); 777 return kTRUE; 778 case kLogSearch: 779 //virtual Bool_t Search(const char *string, Bool_t direction, Bool_t caseSensitive); 780 return kTRUE; 781 case kLogSave: 782 SetStatusLine1("Saving log..."); 783 SetStatusLine2(""); 784 *fLog << inf << "Saving log... " << flush; 785 if (fLogBox->GetText()->Save("statusdisplay.log")) 786 { 787 *fLog << "done." << endl; 788 SetStatusLine2("done."); 789 } 790 else 791 { 792 *fLog << "failed!" << endl; 793 SetStatusLine2("Failed!"); 794 } 795 return kTRUE; 796 797 case kLogAppend: 798 SetStatusLine1("Appending logg..."); 799 SetStatusLine2(""); 800 *fLog << inf << "Appending log... " << flush; 801 if (fLogBox->GetText()->Append("statusdisplay.log")) 802 { 803 *fLog << "done." << endl; 804 SetStatusLine2("done."); 805 } 806 else 807 { 808 *fLog << "failed!" << endl; 809 SetStatusLine2("Failed!"); 810 } 730 811 return kTRUE; 731 812 … … 795 876 // -------------------------------------------------------------------------- 796 877 // 878 // Process the kC_TEXTVIEW messages 879 // 880 Bool_t MStatusDisplay::ProcessMessageTextview(Long_t submsg, Long_t mp1, Long_t mp2) 881 { 882 // kC_TEXTVIEW, kTXT_ISMARKED, widget id, [true|false] // 883 // kC_TEXTVIEW, kTXT_DATACHANGE, widget id, 0 // 884 // kC_TEXTVIEW, kTXT_CLICK2, widget id, position (y << 16) | x) // 885 // kC_TEXTVIEW, kTXT_CLICK3, widget id, position (y << 16) | x) // 886 // kC_TEXTVIEW, kTXT_F3, widget id, true // 887 // kC_TEXTVIEW, kTXT_OPEN, widget id, 0 // 888 // kC_TEXTVIEW, kTXT_CLOSE, widget id, 0 // 889 // kC_TEXTVIEW, kTXT_SAVE, widget id, 0 // 890 switch (submsg) 891 { 892 case kTXT_ISMARKED: 893 cout << "Textview-IsMarked #" << mp1 << " " << (mp2?"yes":"no") << endl; 894 return kTRUE; 895 896 case kTXT_DATACHANGE: 897 cout << "Textview-DataChange #" << mp1 << endl; 898 return kTRUE; 899 900 case kTXT_CLICK2: 901 cout << "Textview-Click2 #" << mp1 << " x=" << (mp2&0xffff) << " y= " << (mp2>>16) << endl; 902 return kTRUE; 903 904 case kTXT_CLICK3: 905 cout << "Textview-Click3 #" << mp1 << " x=" << (mp2&0xffff) << " y= " << (mp2>>16) << endl; 906 return kTRUE; 907 908 case kTXT_F3: 909 cout << "Textview-F3 #" << mp1 << endl; 910 return kTRUE; 911 912 case kTXT_OPEN: 913 cout << "Textview-Open #" << mp1 << endl; 914 return kTRUE; 915 916 case kTXT_CLOSE: 917 cout << "Textview-Close #" << mp1 << endl; 918 return kTRUE; 919 920 case kTXT_SAVE: 921 cout << "Textview-Save #" << mp1 << endl; 922 return kTRUE; 923 } 924 925 cout << "Textview: " << "Submsg:" << submsg << " Mp1=" << mp1 << " Mp2=" << mp2 << endl; 926 return kTRUE; 927 } 928 929 // -------------------------------------------------------------------------- 930 // 797 931 // Process the messages from the GUI 798 932 // … … 804 938 case kC_COMMAND: 805 939 return ProcessMessageCommand(GET_SUBMSG(msg), mp1, mp2); 940 941 case kC_TEXTVIEW: 942 return ProcessMessageTextview(GET_SUBMSG(msg), mp1, mp2); 806 943 } 807 944 … … 866 1003 fLog->UpdateGui(); 867 1004 1005 /* 868 1006 if (!fLogBox->TestBit(kHasChanged)) 869 1007 return kTRUE; 870 1008 871 fLogBox->MapSubwindows(); 872 fLogBox->Layout(); 873 fLogBox->ResetBit(kHasChanged); 1009 fLogBox->ResetBit(kHasChanged); 1010 */ 874 1011 return kTRUE; 875 1012 }
Note:
See TracChangeset
for help on using the changeset viewer.