00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef __CLDAQ_ROOT_USE
00025 #include "TRecordDisplayPreference.hh"
00026 #include "TInputObjectFile.hh"
00027 #include "TFileProperty.hh"
00028
00029 TRecordDisplayPreference* TRecordDisplayPreference::thePreference = 0;
00030 TInputObjectStream* TRecordDisplayPreference::theStream = 0;
00031
00032 static const Tint _nbin = 512;
00033 static const Tdouble _xmin = 0.0;
00034 static const Tdouble _xmax = 4096.0;
00035
00036 TRecordDisplayPreference::TRecordDisplayPreference( TInputObjectStream* stream, const Tstring& style )
00037 : theUpdateCycle( 1 ),
00038 theSleepTime( -1 ),
00039 theTerminateAtLast( Tfalse ),
00040 theSaveRootAtLast( Ttrue ),
00041 theSavePsAtLast( Tfalse ),
00042 theSaveGifAtLast( Tfalse ),
00043 theEndOfRecordID(),
00044 theRootOfFileName(),
00045 theDefaultNumberOfBins( _nbin ),
00046 theDefaultMinimumX( _xmin ),
00047 theDefaultMaximumX( _xmax ),
00048 theStyleName( style ),
00049 theCanvasLayoutHint( 0 ),
00050 theTabLayoutHint( 0 ),
00051 thePopupMenuLayoutHint( 0 ),
00052 theMenuBarLayoutHint( 0 )
00053 {
00054 if ( thePreference ) {
00055 Tcout << "Preference constructed twice." << Tendl;
00056 exit( EXIT_SUCCESS );
00057 }
00058 thePreference = this;
00059 theStream = stream;
00060
00061 TStyle* st = gROOT -> GetStyle( theStyleName.c_str() );
00062 if ( st ) {
00063 st -> cd();
00064 } else {
00065 theStyleName = Tproject;
00066 }
00067
00068 theCanvasLayoutHint =
00069 new TGLayoutHints( kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY, 0, 0, 0, 0 );
00070 theTabLayoutHint =
00071 new TGLayoutHints( kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY, 10, 10, 10, 10 );
00072 thePopupMenuLayoutHint = new TGLayoutHints(kLHintsTop|kLHintsLeft,0,4);
00073 theMenuBarLayoutHint = new TGLayoutHints( kLHintsTop|kLHintsLeft|kLHintsExpandX );
00074
00075 }
00076
00077 TRecordDisplayPreference::~TRecordDisplayPreference()
00078 {
00079 delete theCanvasLayoutHint;
00080 delete theTabLayoutHint;
00081 delete thePopupMenuLayoutHint;
00082 delete theMenuBarLayoutHint;
00083
00084 if ( theStream ) {
00085 delete theStream;
00086 theStream = 0;
00087 }
00088
00089 if ( thePreference ) {
00090 thePreference = 0;
00091 }
00092 }
00093
00094 Tvoid TRecordDisplayPreference::GuessRootOfFileName()
00095 {
00096 if ( theStream && theStream -> GetStreamType() == tFileStream ) {
00097 Tstring drec = ( (TInputObjectFile*)theStream ) -> GetFileName();
00098 TFileProperty pty( drec );
00099 theRootOfFileName = pty.GetFileRootName();
00100 } else {
00101 theRootOfFileName = Tproject;
00102 }
00103 return;
00104 }
00105
00106 Tstring TRecordDisplayPreference::RootFile()
00107 {
00108 GuessRootOfFileName();
00109 Tstring filename = theRootOfFileName + ".root";
00110 return filename;
00111 }
00112
00113 #endif
00114
00115 #ifdef __CLDAQ_ROOT_DLL
00116 ClassImp(TRecordDisplayPreference)
00117 #endif