Changeset 2054 for trunk


Ignore:
Timestamp:
05/02/03 12:46:43 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Makefile.conf.general

    r1965 r2054  
    1212#
    1313
    14 DEFINES   = -D__MARS__ -DMARSVER=\"\<cvs\>\" -DROOTVER=\"$(ROOTVER)\" $(ARCHDEF)
     14#
     15# You can use this flags to further costumize compilation:
     16#   export MARSDEFINES="-DHAVE_DARKBACKGROUND -DHAVE_XPM"
     17#   export MARSFLAGS=
     18#   export MARSLIBS="-lX11 -lXpm -L/usr/X11R6/lib"
     19#
     20DEFINES   = -DMARSVER=\"\<cvs\>\" -D__MARS__ -DROOTVER=\"$(ROOTVER)\" $(ARCHDEF) $(MARSDEFINES)
    1521
    1622CXXFLAGS  = $(ROOTCFLAGS) $(INCLUDES) $(OPTIM) $(DEBUG) $(DEFINES)
    17 CFLAGS    = $(CXXFLAGS)
     23CFLAGS    = $(CXXFLAGS) $(MARSFLAGS)
    1824FFLAGS    = $(CXXFLAGS)
    1925
  • trunk/MagicSoft/Mars/Makefile.conf.linux

    r1880 r2054  
    2121#
    2222OPTIM    = -O5 -Wall -fnonnull-objects -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual
    23 DEBUG    =
     23DEBUG    = 
    2424ARCHDEF  = -D__LINUX__
    2525
     
    2727# For producing gmon.out use    '-pg'
    2828
    29 MARS_LIB = -Llib $(SUBDIRS:%=-l%)
     29MARS_LIB = -Llib $(SUBDIRS:%=-l%) $(MARSLIBS)
    3030INCLUDES = -I. $(SUBDIRS:%=-I%)
    3131
  • trunk/MagicSoft/Mars/Makefile.conf.linux-gnu

    r1172 r2054  
    2424ARCHDEF  = -D__LINUX__
    2525
     26# To be tested:
     27# OPTIM    = -pipe 
     28# OPTIM2   = -fomit-frame-pointer -ffast-math -march=i686 -mcpu=i686
     29
    2630# For debugging information use '-g'
    2731# For producing gmon.out use    '-pg'
    2832
    29 MARS_LIB = -Llib $(SUBDIRS:%=-l%)
     33MARS_LIB = -Llib $(SUBDIRS:%=-l%)  $(MARSLIBS)
    3034INCLUDES = -I. $(SUBDIRS:%=-I%)
    3135
  • trunk/MagicSoft/Mars/Makefile.conf.osf1

    r1752 r2054  
    2727ARCHDEF  = -D__OSF__
    2828
    29 MARS_LIB = -Llib $(SUBDIRS/*/-l&)
     29MARS_LIB = -Llib $(SUBDIRS/*/-l&)  $(MARSLIBS)
    3030INCLUDES = -I. $(SUBDIRS/*/-I&)
    3131
  • trunk/MagicSoft/Mars/Makefile.conf.osf5.1

    r1579 r2054  
    2727ARCHDEF  = -D__OSF__
    2828
    29 MARS_LIB = -Llib $(SUBDIRS/*/-l&)
     29MARS_LIB = -Llib $(SUBDIRS/*/-l&)  $(MARSLIBS)
    3030INCLUDES = -I. $(SUBDIRS/*/-I&)
    3131
  • trunk/MagicSoft/Mars/NEWS

    r2015 r2054  
    5656
    5757   - added (event-)weights to fill histograms
     58
     59   - colors in logging output to screen
    5860
    5961
  • trunk/MagicSoft/Mars/mars.cc

    r1965 r2054  
    1111#include "MParContainer.h"
    1212
    13 //#define HAVE_LOGO 1
    14 #ifdef HAVE_LOGO
     13#ifdef HAVE_XPM
    1514#include "MLogo.h"
    1615#endif
     
    2827{
    2928    gLog << "Sorry the usage is:" << endl;
    30     gLog << "   mars [-vn]" << endl << endl;
     29    gLog << "   mars [-v#]" << endl << endl;
    3130    gLog << "     -v0: verbosity level: as less as possible" << endl;
    3231    gLog << "     -v1: errors only"                          << endl;
     
    3736int main(int argc, char **argv)
    3837{
    39 #ifdef HAVE_LOGO
     38#ifdef HAVE_XPM
    4039    MLogo logo;
    4140    logo.Popup();
     
    106105    TApplication app("MarsApp", &argc, argv);
    107106
    108 #ifdef HAVE_LOGO
     107#ifdef HAVE_XPM
    109108    logo.Popdown();
    110109#endif
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r2052 r2054  
    8989// check for TObjectWarning, TObject::Info, gErrorIgnoreLevel
    9090
     91const char MLog::kESC = '\033'; // (char)27
     92const char *const MLog::kEsc       = "\033[";
     93const char *const MLog::kReset     = "\033[0m";
     94const char *const MLog::kRed       = "\033[31m";
     95const char *const MLog::kGreen     = "\033[32m";
     96#ifdef HAVE_DARKBACKGROUND
     97const char *const MLog::kYellow    = "\033[33m\033[1m";
     98#else
     99const char *const MLog::kYellow    = "\033[33m";
     100#endif
     101const char *const MLog::kUnderline = "\033[4m";;
     102const char *const MLog::kBlink     = "\033[5m";;
     103const char *const MLog::kBright    = "\033[1m";;
     104const char *const MLog::kDark      = "\033[2m";;
     105
    91106//
    92107// This is the definition of the global log facility
     
    180195}
    181196
     197void MLog::Output(ostream &out, int len)
     198{
     199    if (!TestBit(eNoColors))
     200        switch (fOutputLevel)
     201        {
     202        case 0:  out << MLog::kReset;   break;  // all
     203        case 1:  out << MLog::kRed;     break;  // err
     204        case 2:  out << MLog::kYellow;  break;  // warn
     205        case 3:  out << MLog::kGreen;   break;  // inf
     206        }
     207
     208    // Check for EOL
     209    const Bool_t endline = fBase[len-1]=='\n';
     210    // output text to screen (without trailing '\0' or '\n')
     211    out << TString(fBase, len-1);
     212    // reset colors if working with colors
     213    if (!TestBit(eNoColors))
     214        out << kReset;
     215    // output EOL of check found EOL
     216    if (endline)
     217        out << '\n';
     218    out.flush();
     219}
     220
    182221// --------------------------------------------------------------------------
    183222//
     
    198237
    199238    if (fDevice&eStdout)
    200         cout.write(fBase, len);
     239        Output(cout, len);
    201240
    202241    if (fDevice&eStderr)
    203         cerr.write(fBase, len);
     242        Output(cerr, len);
    204243
    205244    if (fDevice&eFile && fout)
     
    289328
    290329    if (fDevice&eStdout)
     330    {
     331        cout << kReset;
    291332        cout.flush();
     333    }
    292334
    293335    if (fDevice&eStderr)
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r2052 r2054  
    2323{
    2424public:
    25     typedef enum _flags { eStdout = 0x1, eStderr = 0x2, eFile = 0x4, eGui = 0x8 } Flags_t;
     25    typedef enum _flags {
     26        eStdout   = 0x001,
     27        eStderr   = 0x002,
     28        eFile     = 0x004,
     29        eGui      = 0x008,
     30        eNoColors = 0x400  //BIT(15)
     31    } Flags_t;
    2632
    2733private:
     34    static const char kESC;
     35    static const char *const kEsc;
     36    static const char *const kReset;
     37    static const char *const kRed;
     38    static const char *const kGreen;
     39    static const char *const kYellow;
     40    static const char *const kUnderline;
     41    static const char *const kBlink;
     42    static const char *const kBright;
     43    static const char *const kDark;
     44
    2845    char        fBuffer;      //!
    2946    char        fBase[bsz+1]; //! Buffer to store the data in
     
    4663    TString  **fGuiLines;     //! Lines to pipe to gui
    4764    Int_t      fNumLines;     //!
    48 //    Bool_t     fGuiLineFlushed;
    49     TString    fGuiLine;  //!
     65    TString    fGuiLine;      //!
    5066
    5167#ifdef _REENTRANT
     
    6379    void ReallocateFile(const char *f);
    6480    void CheckFlag(Flags_t chk, int flag);
     81    void Output(ostream &out, int len);
    6582
    6683public:
     
    143160    void SetNullOutput(Bool_t n=kTRUE) { fIsNull = n; }
    144161
     162    void SetNoColors(Bool_t flag=kTRUE) { flag ? SetBit(eNoColors) : ResetBit(eNoColors); }
     163
    145164    ClassDef(MLog, 0) // This is what we call 'The logging system'
    146165};
  • trunk/MagicSoft/Mars/mbase/MLogo.cc

    r1337 r2054  
    3232//                                                                          //
    3333//////////////////////////////////////////////////////////////////////////////
     34#ifdef HAVE_XPM
    3435#include "MLogo.h"
    3536
     
    123124                                      mag1, &logo, 0, &attr);
    124125#else
    125 #include "../marslogo_neu.xpm"
     126#include "../marslogo.xpm"
    126127    int ret = XpmCreatePixmapFromData(fDisplay, fLogoWindow,
    127                                       marslogo_neu_xpm, &logo, 0, &attr);
     128                                      marslogo, &logo, 0, &attr);
    128129#endif
    129130    XpmFreeAttributes(&attr);
     
    206207    }
    207208}
     209#endif
  • trunk/MagicSoft/Mars/mbase/MLogo.h

    r1337 r2054  
    11#ifndef MARS_MLogo
    22#define MARS_MLogo
     3
     4#ifdef HAVE_XPM
    35
    46#ifndef __CINT__
     
    3133};
    3234
    33 #endif
    34 
    35 #endif
     35#endif // __CINT__
     36#endif // HAVE_XPM
     37#endif // MARS_MLogo
  • trunk/MagicSoft/Mars/mbase/Makefile

    r1715 r2054  
    5050           MContinue.cc \
    5151           MPrint.cc \
     52           MLogo.cc \
    5253           MLogManip.cc
    5354
  • trunk/MagicSoft/Mars/mmain/MGMenu.cc

    r1968 r2054  
    213213        // was pressed close the popup.
    214214        //
    215         if (!rc || event->fCode==9/*ESC*/)
    216         {
    217             f.SetState(kFALSE);
    218             gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);  // ungrab pointer
    219             fCurrent = 0;
    220         }
    221 
     215        if (rc && event->fCode!=9/*ESC*/)
     216            return kTRUE;
     217
     218        f.SetState(kFALSE);
     219        gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);  // ungrab pointer
     220        gVirtualX->SetKeyAutoRepeat(kTRUE); // set in TGMainFrame::HandleKey
     221        fCurrent = 0;
    222222        return kTRUE;
    223223    }
  • trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc

    r2053 r2054  
    8080#include <TGButton.h>             // TGPictureButton
    8181#include <TGListBox.h>            // TGListBox
     82#include <TGStatusBar.h>          // TGStatusBar
    8283#include <TGProgressBar.h>        // TGHProgressBar
    8384
     
    219220        f->AddFrame(mars, lay2);
    220221    }
     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     */
    221229
    222230    // Add date and time
     
    304312
    305313    // Add fTab to Frame
    306     TGLayoutHints *laytabs = new TGLayoutHints(kLHintsNormal|kLHintsExpandX|kLHintsExpandY, 5, 6, 5);
     314    TGLayoutHints *laytabs = new TGLayoutHints(kLHintsNormal|kLHintsExpandX|kLHintsExpandY, 5, 5, 5);
    307315    AddFrame(fTab, laytabs);
    308316
     
    317325void MStatusDisplay::AddProgressBar()
    318326{
    319     TGLayoutHints *laybar=new TGLayoutHints(kLHintsExpandX, 5, 6, 5, 5);
     327    TGLayoutHints *laybar=new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5);
    320328    fList->Add(laybar);
    321329
     
    329337// --------------------------------------------------------------------------
    330338//
    331 // Adds the status lines to the GUI
    332 //
    333 void MStatusDisplay::AddStatusLines()
    334 {
    335     TGHorizontalFrame *hf = new TGHorizontalFrame(this, 1, 1);
    336 
    337     TGCompositeFrame *f = new TGCompositeFrame(hf, 1, 1, kSunkenFrame);
    338 
    339     fLine1 = new TGLabel(f, "");
    340 
    341     TGLayoutHints *lay = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 0, 5);
    342     f->AddFrame(fLine1, lay);
    343     hf->AddFrame(f, lay);
    344 
    345     fList->Add(f);
    346     fList->Add(fLine1);
    347     fList->Add(lay);
    348 
    349     f = new TGCompositeFrame(hf, 1, 1, kSunkenFrame);
    350 
    351     fLine2 = new TGLabel(f, "");
    352     f->AddFrame(fLine2, lay);
    353     hf->AddFrame(f, lay);
    354 
    355     TGLayoutHints *layf = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 5, 0, 0, 3);
    356     AddFrame(hf, layf);
    357 
    358     fList->Add(layf);
    359     fList->Add(f);
    360     fList->Add(fLine2);
    361     fList->Add(hf);
     339// Adds the status bar to the GUI
     340//
     341void MStatusDisplay::AddStatusBar()
     342{
     343    fStatusBar = new TGStatusBar(this, 1, 1);
     344
     345    fStatusBar->SetParts(2);
     346
     347    TGLayoutHints *layb = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 5, 4, 0, 3);
     348    AddFrame(fStatusBar, layb);
     349
     350    fList->Add(fStatusBar);
     351    fList->Add(layb);
    362352}
    363353
     
    368358void MStatusDisplay::SetStatusLine1(const char *txt)
    369359{
    370     fLine1->SetText(txt);
    371     gClient->ProcessEventsFor(fLine1);
     360    fStatusBar->SetText(txt, 0);
     361    gClient->ProcessEventsFor(fStatusBar);
    372362}
    373363
     
    378368void MStatusDisplay::SetStatusLine2(const char *txt)
    379369{
    380     fLine2->SetText(txt);
    381     gClient->ProcessEventsFor(fLine2);
     370    fStatusBar->SetText(txt, 1);
     371    gClient->ProcessEventsFor(fStatusBar);
    382372}
    383373
     
    404394//
    405395MStatusDisplay::MStatusDisplay(Long_t t)
    406 : TGMainFrame(gClient->GetRoot(), 1, 1), fTimer(this, t, kTRUE), fLog(&gLog), fLogIdx(-1), fLogTimer(this, 250, kTRUE), fLogBox(NULL)
     396: TGMainFrame(gClient->GetRoot(), 1, 1), fTimer(this, t, kTRUE), fStatus(kLoopNone), fLog(&gLog), fLogIdx(-1), fLogTimer(this, 250, kTRUE), fLogBox(NULL)
    407397{
    408398    gROOT->GetListOfSpecials()->Add(this);
     399    gROOT->GetListOfCleanups()->Add(this);
     400
    409401
    410402    //
     
    434426    AddTabs();
    435427    AddProgressBar();
    436     AddStatusLines();
     428    AddStatusBar();
    437429
    438430    //
     
    447439    MapWindow();
    448440
    449     //lient->ProcessEventsFor(this);
    450441    gSystem->ProcessEvents();
    451 
    452     //TSeqCollection   *GetListOfCleanups() const   {return fCleanups;}
    453 
    454442}
    455443
     
    466454
    467455    gROOT->GetListOfSpecials()->Remove(this);
     456    gROOT->GetListOfCleanups()->Remove(this);
    468457}
    469458
  • trunk/MagicSoft/Mars/mmain/MStatusDisplay.h

    r2052 r2054  
    2323
    2424class TGTab;
    25 class TGLabel;
    2625class TGListBox;
     26class TGStatusBar;
    2727class TGProgressBar;
    2828class TGHProgressBar;
     
    6969    TTimer fTimer;
    7070
    71     TGLabel *fLine1;
    72     TGLabel *fLine2;
     71    TGStatusBar *fStatusBar;
    7372
    7473    Status_t fStatus;
     
    8685    void AddLogTab();
    8786    void AddTabs();
    88     void AddStatusLines();
     87    void AddStatusBar();
    8988
    9089    TCanvas *GetCanvas(TGCompositeFrame *f) const;
Note: See TracChangeset for help on using the changeset viewer.