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