Changeset 2058


Ignore:
Timestamp:
05/05/03 10:37:08 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2057 r2058  
    1 
    2 
    3 
    41                                                 -*-*- END OF LINE -*-*-
     2
     3 2003/05/05: Thomas Bretz
     4 
     5   * mbase/MEvtLoop.cc:
     6     - underline Instatiation Message
     7     - small change to a warning output
     8     
     9   * mbase/MLog.[h,cc]:
     10     - added stuff for underlining
     11     - changed from TGListBox to TGViewText
     12     
     13   * mmain/MStatusDisplay.[h,cc]:
     14     - changed fLogBox from TGListBox to TGViewText
     15     - added menu 'Log'
     16     - changed division of status line to 'Goldener Schnitt'
     17
     18
    519
    620 2003/05/05: Wolfgang Wittek
     
    1024
    1125
     26
    1227 2003/05/02: Thomas Bretz
     28
     29   * Makefile.conf.general, Makefile.conf.linux, Makefile.conf.linux-gnu,
     30     Makefile.conf.osf1, Makefile.conf.osf5.1:
     31     - added MARSDEFINES, MARSFLAGS, MARSLIBS
     32     
     33   * mars.cc:
     34     - replaces HAVE_LOGO by HAVE_XPM
    1335 
     36   * NEWS:
     37     - updated
     38     
     39   * mbase/MLogo.cc:
     40     - replaces marslogo_neu by marslogo
     41     - encapsulated in HAVE_XPM
     42     
     43   * mbase/Makefile:
     44     - added MLogo.cc
     45     
     46   * mmain/MGMenu.cc:
     47     - fixed the 'KeyAutoRepeat' bug
     48
    1449   * manalysis/MCerPhotEvt.[h,cc:
    1550     - added RemoveUnusedPixels
     
    2459   * mbase/MLog.[h,cc]:
    2560     - added flushing and tab conversion to GUI
     61     - added color support
    2662     
    2763   * mbase/MParList.cc:
     
    4480     - added writing C
    4581     - changes SaveAs to non-const (added output to status lines)
     82     - replaced TGLabels by TGStatusBar
    4683
    4784
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r2052 r2058  
    108108    fName = name;
    109109
    110     *fLog << inf << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOTVER << endl;
     110    fLog->Underline();
     111    *fLog << inf << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOTVER << "\033[0m" << endl;
    111112}
    112113
     
    240241            return kTRUE;
    241242        default:
     243            *fLog << warn << "MEvtloop: fDisplay->ChecStatus() has returned unknown status #" << fDisplay->CheckStatus() << "... cleared." << endl;
    242244            fDisplay->ClearStatus();
    243             *fLog << warn << "Display shows unknown status... cleared." << endl;
    244245            break;
    245246        }
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r2054 r2058  
    8080#include <pthread.h>
    8181#endif
    82 #include <TGListBox.h>
     82#include <TGTextView.h>
    8383
    8484#include "MLogManip.h"
     
    133133// which is used for the output (i)
    134134//
    135 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), fGuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)
     135MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), fout(NULL), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)
    136136{
    137137    Init();
     
    143143// ofstream as the default output device
    144144//
    145 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0),  fout(&out), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)
     145MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fout(&out), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)
    146146{
    147147    Init();
     
    151151//
    152152// default constructor which initializes the streamer and sets the given
    153 // TGListBox as the default output device
    154 //
    155 MLog::MLog(TGListBox &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eGui), fGuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(&out), fNumLines(0)
     153// TGTextView as the default output device
     154//
     155MLog::MLog(TGTextView &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eGui), fout(NULL), fOutAllocated(kFALSE), fgui(&out), fNumLines(0)
    156156{
    157157    Init();
     
    164164// or not.
    165165//
    166 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0),  fgui(NULL), fNumLines(0)
     166MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fgui(NULL), fNumLines(0)
    167167{
    168168    Init();
     
    193193    fDebugLevel  = log.fDebugLevel;
    194194    fDevice      = log.fDevice;
     195}
     196
     197void MLog::Underline()
     198{
     199    if (fDevice&eStdout)
     200        cout << kUnderline;
     201
     202    if (fDevice&eStderr)
     203        cerr << kUnderline;
    195204}
    196205
     
    272281}
    273282
     283#include <TVirtualX.h>
    274284void MLog::UpdateGui()
    275285{
     
    279289    // lock mutex
    280290    Lock();
     291
     292    TGText &txt=*fgui->GetText();
    281293
    282294    // copy lines to TGListBox
     
    285297        // Replace all tabs by 7 white spaces
    286298        fGuiLines[i]->ReplaceAll("\t", "       ");
    287         fgui->AddEntry(*fGuiLines[i], fGuiLineId++);
     299        txt.InsText(TGLongPosition(0, txt.RowCount()), *fGuiLines[i]);
    288300        delete fGuiLines[i];
    289301    }
     
    292304    fNumLines=0;
    293305
    294     // cut list box top 1000 lines
    295     fgui->RemoveEntries(0, fGuiLineId-1000);
     306    // cut text box top 1000 lines
     307    while (txt.RowCount()>1000)
     308        txt.DelLine(0);
     309
    296310    // show last entry
    297     fgui->SetTopEntry(fGuiLineId-1);
     311    fgui->Layout();
     312    fgui->SetVsbPosition(txt.RowCount()-1);
     313
    298314    // tell a main loop, that list box contents have changed
    299315    fgui->SetBit(kHasChanged);
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r2054 r2058  
    1818
    1919
    20 class TGListBox;
     20class TGTextView;
    2121
    2222class MLog : public streambuf, public ostream, public TObject
     
    5454    Bool_t fIsNull;           //! Switch output completely off
    5555
    56     Int_t fGuiLineId;         //!
    57 
    58     ofstream  *fout;          //! possible file output stream
    59     Bool_t     fOutAllocated; //! flag if fout is created by MLogging
    60     TGListBox *fgui;          //! Listbox output
     56    ofstream   *fout;          //! possible file output stream
     57    Bool_t      fOutAllocated; //! flag if fout is created by MLogging
     58    TGTextView *fgui;          //! Text View output
    6159
    6260    Bool_t     fIsDirectGui;  //! Pipe text directly to the GUI (for single threaded environments)
     
    8482    MLog(int i=eStdout);
    8583    MLog(ofstream &out);
    86     MLog(TGListBox &out);
     84    MLog(TGTextView &out);
    8785    MLog(const char *fname, int flag=-1);
    8886
     
    9795    void UpdateGui();
    9896
     97    void Underline();
     98
    9999    void SetDebugLevel(int i)           { fDebugLevel  =  i;  }
    100100    int  GetDebugLevel() const          { return fDebugLevel; }
     
    104104    void DisableOutputDevice(Flags_t f) { fDevice     &= ~f;  }
    105105    void operator=(ofstream &out)       { SetOutputFile(out); }
    106     void operator=(TGListBox *out)      { SetOutputGui(out);  }
     106    void operator=(TGTextView *out)     { SetOutputGui(out);  }
    107107
    108108    Bool_t IsOutputDeviceEnabled(int i) const { return fDevice & i; }
    109109
    110     void SetOutputGui(TGListBox *out, int flag=-1)
     110    void SetOutputGui(TGTextView *out, int flag=-1)
    111111    {
    112112        fgui = out;
  • trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc

    r2054 r2058  
    7979#include <TG3DLine.h>             // TGHorizontal3DLine
    8080#include <TGButton.h>             // TGPictureButton
    81 #include <TGListBox.h>            // TGListBox
     81#include <TGTextView.h>           // TGTextView
    8282#include <TGStatusBar.h>          // TGStatusBar
    8383#include <TGProgressBar.h>        // TGHProgressBar
     
    153153
    154154    //
     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    //
    155172    // Menu Bar
    156173    //
    157174    MGMenuBar *menubar = new MGMenuBar(this, 1, 1, kHorizontalFrame);
    158175    menubar->AddPopup("&File", filemenu, NULL);
     176    menubar->AddPopup("Lo&g",  logmenu,  NULL);
     177    menubar->AddPopup("&Size", sizemenu, NULL);
    159178    menubar->AddPopup("&Tab",  tabmenu,  NULL);
    160179    menubar->AddPopup("&Loop", loopmenu, NULL);
    161     menubar->AddPopup("&Size", sizemenu, NULL);
    162180    menubar->BindKeys(this);
    163181    AddFrame(menubar);
     
    180198    fList->Add(menubar);
    181199    fList->Add(tabmenu);
     200    fList->Add(logmenu);
    182201    fList->Add(linesep);
    183202}
     
    220239        f->AddFrame(mars, lay2);
    221240    }
    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      */
    229241
    230242    // Add date and time
     
    261273        TGCompositeFrame *f = fTab->AddTab("-Logbook-");
    262274
    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);
    266280
    267281        // Add List box to the tab
     
    334348}
    335349
    336 
    337350// --------------------------------------------------------------------------
    338351//
     
    343356    fStatusBar = new TGStatusBar(this, 1, 1);
    344357
    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);
    346369
    347370    TGLayoutHints *layb = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 5, 4, 0, 3);
     
    399422    gROOT->GetListOfCleanups()->Add(this);
    400423
     424    fFont = gVirtualX->LoadQueryFont("7x13bold");
    401425
    402426    //
     
    452476
    453477    delete fList;
     478
     479    if (fFont)
     480        gVirtualX->DeleteFont(fFont);
    454481
    455482    gROOT->GetListOfSpecials()->Remove(this);
     
    643670}
    644671
     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
    645682// --------------------------------------------------------------------------
    646683//
     
    728765    case kSize1280:
    729766        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        }
    730811        return kTRUE;
    731812
     
    795876// --------------------------------------------------------------------------
    796877//
     878// Process the kC_TEXTVIEW messages
     879//
     880Bool_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//
    797931// Process the messages from the GUI
    798932//
     
    804938    case kC_COMMAND:
    805939        return ProcessMessageCommand(GET_SUBMSG(msg), mp1, mp2);
     940
     941    case kC_TEXTVIEW:
     942        return ProcessMessageTextview(GET_SUBMSG(msg), mp1, mp2);
    806943    }
    807944
     
    8661003        fLog->UpdateGui();
    8671004
     1005        /*
    8681006        if (!fLogBox->TestBit(kHasChanged))
    8691007            return kTRUE;
    8701008
    871         fLogBox->MapSubwindows();
    872         fLogBox->Layout();
    873         fLogBox->ResetBit(kHasChanged);
     1009            fLogBox->ResetBit(kHasChanged);
     1010            */
    8741011        return kTRUE;
    8751012    }
  • trunk/MagicSoft/Mars/mmain/MStatusDisplay.h

    r2054 r2058  
    2323
    2424class TGTab;
    25 class TGListBox;
     25class TGTextView;
    2626class TGStatusBar;
    2727class TGProgressBar;
     
    3232public:
    3333    typedef enum {
    34         kLoopNone,
    35         kLoopStop,
    36         kFileSave,
    37         kFileSaveAs,
    38         kFileSaveAsPS,
    39         kFileSaveAsRoot,
    40         kFileSaveAsGIF,
    41         kFileSaveAsC,
    42         kFilePrint,
    43         kFilePrinterName,
    44         kTabSave,
    45         kTabSaveAs,
    46         kTabSaveAsPS,
    47         kTabSaveAsRoot,
    48         kTabSaveAsGIF,
    49         kTabSaveAsC,
    50         kTabPrint,
    51         kTabNext,
    52         kTabPrevious,
    53         kSize640,
    54         kSize800,
    55         kSize960,
    56         kSize1024,
    57         kSize1280,
     34        // KFile
     35        kFileSave, kFileSaveAs, kFileSaveAsPS, kFileSaveAsRoot,
     36        kFileSaveAsGIF, kFileSaveAsC, kFilePrint, kFilePrinterName,
    5837        kFileExit,
    59         kPicMagic,
    60         kPicMars
     38        // kLoop
     39        kLoopNone, kLoopStop,
     40        // kTab
     41        kTabSave, kTabSaveAs, kTabSaveAsPS, kTabSaveAsRoot, kTabSaveAsGIF,
     42        kTabSaveAsC, kTabPrint, kTabNext, kTabPrevious,
     43        // kSize
     44        kSize640, kSize800, kSize960, kSize1024, kSize1280,
     45        // kLog
     46        kLogCopy, kLogClear, kLogSelect, kLogSearch, kLogSave, kLogAppend,
     47        // kPic
     48        kPicMagic, kPicMars
    6149    } Status_t;
    6250
     
    7866    Int_t fLogIdx;
    7967    TTimer fLogTimer;
    80     TGListBox *fLogBox;
     68    TGTextView *fLogBox;
     69
     70    FontStruct_t fFont;
    8171
    8272    void AddMenuBar();
     
    9181    Bool_t ProcessMessageCommandMenu(Long_t mp1);
    9282    Bool_t ProcessMessageCommand(Long_t submsg, Long_t mp1, Long_t mp2);
     83    Bool_t ProcessMessageTextview(Long_t submsg, Long_t mp1, Long_t mp2);
    9384    Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
    9485    void   CloseWindow();
Note: See TracChangeset for help on using the changeset viewer.