00001 // ============================================================================ 00002 // $Id: TRecordDisplayPreference.hh,v 1.1 2004/03/01 02:36:25 goiwai Exp $ 00003 // $Name: CLDAQ-1-12-00 $ 00004 // $Log: TRecordDisplayPreference.hh,v $ 00005 // Revision 1.1 2004/03/01 02:36:25 goiwai 00006 // RecordDisplay用のクラス群を置きました. 00007 // お蔵入りになってたものに手直しを加えたものですが, 00008 // まだ不充分な点も在ります.徐々に修正していきたいと思います. 00009 // DataRecordオブジェクトを表示するためのツール群なのでRecordDisplayと呼 00010 // んでいます,多分にオフライン要素が強いです. 00011 // オンラインよりにしたものを後でEventDisplay(Eventを表示)としてコミット 00012 // します. 00013 // 00014 // ============================================================================ 00015 #ifdef __CLDAQ_ROOT_USE 00016 #ifndef CLDAQ__TRECORDDISPLAYPREFERENCE_HH 00017 #define CLDAQ__TRECORDDISPLAYPREFERENCE_HH 00018 00019 #include <TROOT.h> 00020 #include <TStyle.h> 00021 #include <TGLayout.h> 00022 #include "Tglobals.h" 00023 #include "TInputObjectStream.hh" 00024 00025 class TApplication; 00026 class TInputObjectStream; 00027 class TGLayoutHints; 00028 class TStyle; 00029 00030 // Setとコンストラクタにポインタを渡すときは常に new してわたすこと 00031 00032 class TRecordDisplayPreference 00033 { 00034 00035 private: 00036 static TRecordDisplayPreference* thePreference; 00037 static TInputObjectStream* theStream; 00038 00039 Tint theUpdateCycle; 00040 Tint theSleepTime; 00041 Tbool theTerminateAtLast; 00042 Tbool theSaveRootAtLast; 00043 Tbool theSavePsAtLast; 00044 Tbool theSaveGifAtLast; 00045 Tstring theEndOfRecordID; 00046 Tstring theRootOfFileName; 00047 Tint theDefaultNumberOfBins; 00048 Tdouble theDefaultMinimumX; 00049 Tdouble theDefaultMaximumX; 00050 Tstring theStyleName; 00051 TGLayoutHints* theCanvasLayoutHint; 00052 TGLayoutHints* theTabLayoutHint; 00053 TGLayoutHints* thePopupMenuLayoutHint; 00054 TGLayoutHints* theMenuBarLayoutHint; 00055 00058 00059 public: 00060 TRecordDisplayPreference( TInputObjectStream* stream = 0, const Tstring& style = "" ); 00061 ~TRecordDisplayPreference(); 00062 00063 public: 00064 Tvoid GuessRootOfFileName(); 00065 Tstring RootFile(); 00066 00067 public: 00068 static TRecordDisplayPreference* GetPreference(); 00069 static TInputObjectStream* GetStream(); 00070 static Tvoid SetStream( TInputObjectStream* stream ); 00071 00072 public: 00073 TApplication* GetApplication() const; 00074 Tint GetUpdateCycle() const; 00075 Tint GetSleepTime() const; 00076 Tbool TerminateAtLast() const; 00077 Tbool SaveRootAtLast() const; 00078 Tbool SavePsAtLast() const; 00079 Tbool SaveGifAtLast() const; 00080 const Tstring& GetRootOfFileName() const; 00081 Tint GetDefaultNumberOfBins() const; 00082 Tdouble GetDefaultMinimumX() const; 00083 Tdouble GetDefaultMaximumX() const; 00084 Tstring GetStyleName() const; 00085 TGLayoutHints* GetCanvasLayoutHint() const; 00086 TGLayoutHints* GetTabLayoutHint() const; 00087 TGLayoutHints* GetPopupMenuLayoutHint() const; 00088 TGLayoutHints* GetMenuBarLayoutHint() const; 00089 Tvoid SetUpdateCycle( Tint cycle ); 00090 Tvoid SetSleepTime( Tint time ); 00091 Tvoid SetTerminateAtLast( Tbool val ); 00092 Tvoid SetSaveRootAtLast( Tbool val ); 00093 Tvoid SetSavePsAtLast( Tbool val ); 00094 Tvoid SetSaveGifAtLast( Tbool val ); 00095 Tvoid SetRootOfFileName( const Tstring& filebody ); 00096 Tvoid SetDefaultNumberOfBins( Tint nbin ); 00097 Tvoid SetDefaultMinimumX( Tdouble xmin ); 00098 Tvoid SetDefaultMaximumX( Tdouble xmax ); 00099 Tvoid SetStyleName( const Tstring& style ); 00100 Tvoid SetCanvasLayoutHint( TGLayoutHints* layout ); 00101 Tvoid SetTabLayoutHint( TGLayoutHints* layout ); 00102 Tvoid SetPopupMenuLayoutHint( TGLayoutHints* layout ); 00103 Tvoid SetMenuBarLayoutHint( TGLayoutHints* layout ); 00104 const Tstring& GetEndOfRecordID() const; 00105 Tvoid SetEndOfRecordID( const Tstring& id ); 00106 00107 }; 00108 00109 inline TRecordDisplayPreference* TRecordDisplayPreference::GetPreference() 00110 { 00111 if ( !thePreference ) { 00112 thePreference = new TRecordDisplayPreference(); 00113 } 00114 return thePreference; 00115 } 00116 00117 inline TInputObjectStream* TRecordDisplayPreference::GetStream() 00118 { 00119 return theStream; 00120 } 00121 00122 inline Tvoid TRecordDisplayPreference::SetStream( TInputObjectStream* stream ) 00123 { 00124 if ( thePreference->theStream ) { 00125 delete thePreference->theStream; 00126 thePreference->theStream = 0; 00127 } 00128 thePreference->theStream = stream; 00129 thePreference->GuessRootOfFileName(); 00130 return; 00131 } 00132 00133 inline Tint TRecordDisplayPreference::GetUpdateCycle() const 00134 { 00135 return theUpdateCycle; 00136 } 00137 00138 inline Tint TRecordDisplayPreference::GetSleepTime() const 00139 { 00140 return theSleepTime; 00141 } 00142 00143 inline Tbool TRecordDisplayPreference::TerminateAtLast() const 00144 { 00145 return theTerminateAtLast; 00146 } 00147 00148 inline Tbool TRecordDisplayPreference::SaveRootAtLast() const 00149 { 00150 return theSaveRootAtLast; 00151 } 00152 00153 inline Tbool TRecordDisplayPreference::SavePsAtLast() const 00154 { 00155 return theSavePsAtLast; 00156 } 00157 00158 inline Tbool TRecordDisplayPreference::SaveGifAtLast() const 00159 { 00160 return theSaveGifAtLast; 00161 } 00162 00163 inline const Tstring& TRecordDisplayPreference::GetRootOfFileName() const 00164 { 00165 return theRootOfFileName; 00166 } 00167 00168 inline Tint TRecordDisplayPreference::GetDefaultNumberOfBins() const 00169 { 00170 return theDefaultNumberOfBins; 00171 } 00172 00173 inline Tdouble TRecordDisplayPreference::GetDefaultMinimumX() const 00174 { 00175 return theDefaultMinimumX; 00176 } 00177 00178 inline Tdouble TRecordDisplayPreference::GetDefaultMaximumX() const 00179 { 00180 return theDefaultMaximumX; 00181 } 00182 00183 inline Tstring TRecordDisplayPreference::GetStyleName() const 00184 { 00185 return theStyleName; 00186 } 00187 00188 inline TGLayoutHints* TRecordDisplayPreference::GetCanvasLayoutHint() const 00189 { 00190 return theCanvasLayoutHint; 00191 } 00192 00193 inline TGLayoutHints* TRecordDisplayPreference::GetTabLayoutHint() const 00194 { 00195 return theTabLayoutHint; 00196 } 00197 00198 inline TGLayoutHints* TRecordDisplayPreference::GetPopupMenuLayoutHint() const 00199 { 00200 return thePopupMenuLayoutHint; 00201 } 00202 00203 inline TGLayoutHints* TRecordDisplayPreference::GetMenuBarLayoutHint() const 00204 { 00205 return theMenuBarLayoutHint; 00206 } 00207 00208 inline Tvoid TRecordDisplayPreference::SetUpdateCycle( Tint cycle ) 00209 { 00210 theUpdateCycle = cycle; 00211 return; 00212 } 00213 00214 inline Tvoid TRecordDisplayPreference::SetSleepTime( Tint time ) 00215 { 00216 theSleepTime = time; 00217 return; 00218 } 00219 00220 inline Tvoid TRecordDisplayPreference::SetTerminateAtLast( Tbool val ) 00221 { 00222 theTerminateAtLast = val; 00223 return; 00224 } 00225 00226 inline Tvoid TRecordDisplayPreference::SetSaveRootAtLast( Tbool val ) 00227 { 00228 theSaveRootAtLast = val; 00229 return; 00230 } 00231 00232 inline Tvoid TRecordDisplayPreference::SetSavePsAtLast( Tbool val ) 00233 { 00234 theSavePsAtLast = val; 00235 return; 00236 } 00237 00238 inline Tvoid TRecordDisplayPreference::SetSaveGifAtLast( Tbool val ) 00239 { 00240 theSaveGifAtLast = val; 00241 return; 00242 } 00243 00244 inline Tvoid TRecordDisplayPreference::SetRootOfFileName( const Tstring& filebody ) 00245 { 00246 theRootOfFileName = filebody; 00247 return; 00248 } 00249 00250 inline Tvoid TRecordDisplayPreference::SetDefaultNumberOfBins( Tint nbin ) 00251 { 00252 theDefaultNumberOfBins = nbin; 00253 return; 00254 } 00255 00256 inline Tvoid TRecordDisplayPreference::SetDefaultMinimumX( Tdouble xmin ) 00257 { 00258 theDefaultMinimumX = xmin; 00259 return; 00260 } 00261 00262 inline Tvoid TRecordDisplayPreference::SetDefaultMaximumX( Tdouble xmax ) 00263 { 00264 theDefaultMaximumX = xmax; 00265 return; 00266 } 00267 00268 inline Tvoid TRecordDisplayPreference::SetStyleName( const Tstring& style ) 00269 { 00270 TStyle* st = gROOT -> GetStyle( theStyleName.c_str() ); 00271 if ( st ) { 00272 st -> cd(); 00273 } else { 00274 theStyleName = Tproject; 00275 } 00276 return; 00277 } 00278 00279 inline Tvoid TRecordDisplayPreference::SetCanvasLayoutHint( TGLayoutHints* layout ) 00280 { 00281 if ( theCanvasLayoutHint ) { 00282 delete theCanvasLayoutHint; 00283 theCanvasLayoutHint = 0; 00284 } 00285 theCanvasLayoutHint = layout; 00286 return; 00287 } 00288 00289 inline Tvoid TRecordDisplayPreference::SetTabLayoutHint( TGLayoutHints* layout ) 00290 { 00291 if ( theTabLayoutHint ) { 00292 delete theTabLayoutHint; 00293 theTabLayoutHint = 0; 00294 } 00295 theTabLayoutHint = layout; 00296 return; 00297 } 00298 00299 inline Tvoid TRecordDisplayPreference::SetPopupMenuLayoutHint( TGLayoutHints* layout ) 00300 { 00301 if ( thePopupMenuLayoutHint ) { 00302 delete thePopupMenuLayoutHint; 00303 thePopupMenuLayoutHint = 0; 00304 } 00305 thePopupMenuLayoutHint = layout; 00306 return; 00307 } 00308 00309 inline Tvoid TRecordDisplayPreference::SetMenuBarLayoutHint( TGLayoutHints* layout ) 00310 { 00311 if ( theMenuBarLayoutHint ) { 00312 delete theMenuBarLayoutHint; 00313 theMenuBarLayoutHint = 0; 00314 } 00315 theMenuBarLayoutHint = layout; 00316 return; 00317 } 00318 00319 inline const Tstring& TRecordDisplayPreference::GetEndOfRecordID() const 00320 { 00321 return theEndOfRecordID; 00322 } 00323 00324 inline Tvoid TRecordDisplayPreference::SetEndOfRecordID( const Tstring& id ) 00325 { 00326 theEndOfRecordID = id; 00327 return; 00328 } 00329 00330 #endif 00331 #endif