BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesAboutHelp.cxx
Go to the documentation of this file.
1//
2// BesAboutHelp.cxx
3//
4
5static char* rcsname = "$Name: BesVisClient-00-05-00 $";
6static char* rcsdate = "$Date: 2022/03/04 04:06:25 $";
7
8#include "BesAboutHelp.h"
9#include <iostream>
10
11#include <TASImage.h>
12#include <TEnv.h>
13#include <TGButton.h>
14#include <TGClient.h>
15#include <TGIcon.h>
16#include <TGLabel.h>
17#include <TGLayout.h>
18#include <TGListBox.h>
19#include <TGPicture.h>
20#include <TGTab.h>
21#include <TList.h>
22#include <TString.h>
23#include <TVirtualX.h>
24#include <stdio.h>
25#include <stdlib.h>
26using namespace std;
27
28// #ifndef __CINT__
30 // #endif
31
32 //_________________________________________________________________
33 // BesAboutHelp
34 // Information about Bes Vis Info
35 //
36 //
37 BesAboutHelp::BesAboutHelp( const TGWindow* p, const TGWindow* main )
38 : TGTransientFrame( p, main, 360, 750 ) {
39 //
40 // BesAboutHelp normal constructor
41
42 fWidgets = new TList();
43
44 this->SetBackgroundPixmap( GetPic( "AboutBckgnd.gif" ) );
45
46 // Create title frame
47 fTitleFrame = new TGHorizontalFrame( this, 10, 10 );
48 fTitleFrame->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
49
50 // Add icon
51 // const TGPicture *icon = fClient->GetPicture("mb_asterisk_s.xpm");
52 // fIcon = new TGIcon(fTitleFrame, icon, icon->GetWidth(), icon->GetHeight());
53 // fLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 5);
54 // fWidgets->Add(fLayout);
55 // fTitleFrame->AddFrame(fIcon, fLayout);
56
57 // Create title
58 FontStruct_t titlefont;
59 titlefont = gClient->GetFontByName(
60 gEnv->GetValue( "Gui.BoldFont", "-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1" ) );
61
62 GCValues_t gval;
63 gval.fMask = kGCFont;
64 gval.fFont = gVirtualX->GetFontHandle( titlefont );
65 GContext_t titlegc = gVirtualX->CreateGC( gClient->GetRoot()->GetId(), &gval );
66
67 TString title( "BesVis " );
68 title.Append(
69 TString( TString( rcsname ).Strip( TString::kBoth, '$' ) ).Remove( 0, 5 ).Data() );
70 fTitle = new TGLabel( fTitleFrame, title.Data(), titlegc );
71 fLayout = new TGLayoutHints( kLHintsLeft | kLHintsCenterY, 10, 5, 5, 5 );
72 fWidgets->Add( fLayout );
73 // fTitleFrame->AddFrame(fTitle, fLayout);
74
75 fLayout = new TGLayoutHints( kLHintsTop | kLHintsLeft, 0, 0, 75, 0 );
76 fWidgets->Add( fLayout );
77 AddFrame( fTitleFrame, fLayout );
78
79 // Create tabs
80 fMain = new TGTab( this, 300, 650 );
81 fMain->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
82
83 TGCompositeFrame* tf;
84
85 // About
86 tf = fMain->AddTab( "About" );
87 tf->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
88
89 fAbout = new TGVerticalFrame( tf, 200, 750 );
90 fAbout->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
91 fLayout = new TGLayoutHints( kLHintsExpandX | kLHintsCenterY );
92 fWidgets->Add( fLayout );
93 tf->AddFrame( fAbout, fLayout );
94
95 fDescription1 = new TGLabel( fAbout, "BESIII Visualizaion Software" );
96 fDescription1->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
97 fLayout = new TGLayoutHints( kLHintsCenterX | kLHintsCenterY );
98 fWidgets->Add( fLayout );
99 fAbout->AddFrame( fDescription1, fLayout );
100
101 TString date(
102 ( TString( TString( rcsdate ).Strip( TString::kBoth, '$' ) ).Remove( 0, 5 ) ).Data() );
103 fDescription2 = new TGLabel( fAbout, "" /*date.Data()*/ );
104 fDescription2->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
105 fLayout = new TGLayoutHints( kLHintsCenterX | kLHintsCenterY );
106 fWidgets->Add( fLayout );
107
108 fAbout->AddFrame( fDescription2, fLayout );
109 fDescription3 = new TGLabel( fAbout, "Developed by Zhengyun YOU in Peking University" );
110 fDescription3->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
111 fLayout = new TGLayoutHints( kLHintsCenterX | kLHintsCenterY );
112 fWidgets->Add( fLayout );
113 fAbout->AddFrame( fDescription3, fLayout );
114
115 fDescription4 = new TGLabel( fAbout, "Emai: youzy@hep.pku.cn" );
116 fDescription4->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
117 fLayout = new TGLayoutHints( kLHintsCenterX | kLHintsCenterY );
118 fWidgets->Add( fLayout );
119 fAbout->AddFrame( fDescription4, fLayout );
120
121 // Version
122 tf = fMain->AddTab( "Version" );
123 tf->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
124
125 fVersion = new TGListBox( tf );
126 fVersion->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
127
128 fLayout = new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2 );
129 fWidgets->Add( fLayout );
130 tf->AddFrame( fVersion, fLayout );
131
132 fVersion->AddEntry( "2005-12-23", 0 );
133 fVersion->AddEntry( " V 1.0.0", 0 );
134 // Long Peixun's update: Add about information
135 fVersion->AddEntry( "2018-4-28", 0 );
136 fVersion->AddEntry( " V 2.0.0.B, contains MRPC", 0 );
137 fVersion->AddEntry( "", 0 );
138 // for (Int_t iEntry = 0; iEntry < fVersion->GetNumberOfEntries(); iEntry++) {
139 // fVersion->GetEntry(iEntry)->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
140 // }
141 fVersion->Resize( 80, 80 );
142
143 for ( Int_t iTab = 0; iTab < fMain->GetNumberOfTabs(); iTab++ )
144 { fMain->GetTabTab( iTab )->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) ); }
145
146 fLayout = new TGLayoutHints( kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5 );
147 fWidgets->Add( fLayout );
148 AddFrame( fMain, fLayout );
149
150 // Create bottom frame
151 fBottomFrame = new TGHorizontalFrame( this, 10, 10 );
152 fBottomFrame->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
153
154 // Close button
155 fCloseBtn = new TGTextButton( fBottomFrame, " &Close ", 1 );
156 fCloseBtn->Associate( this );
157 fCloseBtn->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
158 fLayout = new TGLayoutHints( kLHintsRight | kLHintsCenterY, 2, 2, 2, 2 );
159 fWidgets->Add( fLayout );
160 fBottomFrame->AddFrame( fCloseBtn, fLayout );
161
162 fLayout = new TGLayoutHints( kLHintsBottom | kLHintsExpandX, 5, 5, 0, 5 );
163 fWidgets->Add( fLayout );
164 AddFrame( fBottomFrame, fLayout );
165
166 // Palette
167 tf = fMain->AddTab( "Palette" );
168 tf->SetBackgroundPixmap( GetPic( "AboutGrey.gif" ) );
169
170 fMdcPaletteFrame = new TGVerticalFrame( tf, 200, 700 );
171 fMdcPaletteFrame->SetBackgroundPixmap( GetPic( "MdcPalette.gif" ) );
172 fLayout = new TGLayoutHints( kLHintsExpandX | kLHintsCenterY );
173 fWidgets->Add( fLayout );
174 //// Create Mdc Palette frame
175 // fMdcPaletteFrame = new TGHorizontalFrame(this, 10, 10);
176 // fMdcPaletteFrame->SetBackgroundPixmap(GetPic("MdcPalette.gif"));
177 // fLayout = new TGLayoutHints(kLHintsRight | kLHintsCenterY, 2, 2, 2, 2);
178 // fWidgets->Add(fLayout);
179 // fBottomFrame->AddFrame(fMdcPaletteFrame, fLayout);
180
181 // fLayout = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 5, 5, 0, 5);
182
183 // Widget layout
184 SetWindowName( "About BesVis" );
185 MapSubwindows();
186
187 // position relative to the parent's window
188 Int_t ax, ay;
189 Window_t wdum;
190 gVirtualX->TranslateCoordinates( main->GetId(), GetParent()->GetId(),
191 (Int_t)( ( (TGFrame*)main )->GetWidth() - fWidth ) >> 1,
192 (Int_t)( ( (TGFrame*)main )->GetHeight() - fHeight ) >> 1,
193 ax, ay, wdum );
194 Move( ax, ay );
195 SetWMPosition( ax, ay );
196
197 Resize( GetDefaultSize() );
198 Resize( 360, 750 );
199 MapWindow();
200}
201
202//_________________________________________________________________
203
205 //
206 // BesAboutHelp default destructor
207
208 fWidgets->Delete();
209 delete fWidgets;
210
211 delete fCloseBtn;
212 delete fTitle;
213 // delete fIcon;
214 delete fMain;
215 delete fAbout;
216 delete fVersion;
217 delete fDescription1;
218 delete fDescription2;
219 delete fDescription3;
220 delete fDescription4;
221 delete fTitleFrame;
222 delete fBottomFrame;
223}
224
225//_________________________________________________________________
226
227Bool_t BesAboutHelp::ProcessMessage( Long_t msg, Long_t parm, Long_t ) {
228 //
229 // Handle message send to the BesAboutHelp object
230 switch ( GET_MSG( msg ) )
231 {
232 case kC_COMMAND:
233 switch ( GET_SUBMSG( msg ) )
234 {
235 case kCM_BUTTON: delete this; break;
236 default: break;
237 }
238 break;
239 default: break;
240 }
241 return kTRUE;
242}
243
244Pixmap_t BesAboutHelp::GetPic( const char* file ) {
245 TString filePath = TString( getenv( "BESVISLIBROOT" ) );
246 filePath += "/icons/";
247 filePath += file;
248
249 TASImage asImage( filePath );
250 Pixmap_t pic = asImage.GetPixmap();
251 // asImage->Draw();
252 return pic;
253}
ClassImp(BesAboutHelp) BesAboutHelp
char * file
Definition DQA_TO_DB.cxx:16
titledef title[20]
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm, Long_t)
BesAboutHelp(const TGWindow *p, const TGWindow *main)
virtual ~BesAboutHelp()
virtual Pixmap_t GetPic(const char *file)