LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evdb::ButtonBar Class Reference

#include "ButtonBar.h"

Inheritance diagram for evdb::ButtonBar:

Public Member Functions

 ButtonBar (TGMainFrame *frame)
 
virtual ~ButtonBar ()
 
void PrevEvt ()
 
void NextEvt ()
 
void ReloadEvt ()
 
void AutoAdvance ()
 
void FileList ()
 
void GoTo ()
 
void PrintToFile ()
 
int NoImpl (const char *c)
 
void SetRunEvent (int run, int event)
 
Bool_t HandleTimer (TTimer *t)
 

Private Member Functions

 ClassDef (ButtonBar, 0)
 

Private Attributes

TTimer * fTimer
 Timer to handle auto advancing. More...
 
TGCompositeFrame * fButtonBar
 The top button bar. More...
 
TGLayoutHints * fLayout
 Layout for button bar. More...
 
TGTextButton * fPrevEvt
 Goto to previous event. More...
 
TGTextButton * fNextEvt
 Goto to next event. More...
 
TGTextButton * fAutoAdvance
 Start to auto advance. More...
 
TGTextButton * fReload
 Reload current event. More...
 
TGTextEntry * fCurrentFile
 Currently loaded file. More...
 
TGPictureButton * fFileList
 Access to the list of files attached. More...
 
TGLabel * fRunEvtLabel
 Run/Event number label. More...
 
TGTextEntry * fRunTextEntry
 Run number text entry. More...
 
TGTextEntry * fEventTextEntry
 Event number text entry. More...
 
TGTextButton * fGoTo
 Go To event button. More...
 
TGTextButton * fPrint
 Print button. More...
 

Detailed Description

Definition at line 20 of file ButtonBar.h.

Constructor & Destructor Documentation

evdb::ButtonBar::ButtonBar ( TGMainFrame *  frame)

Definition at line 32 of file ButtonBar.cxx.

References fAutoAdvance, fButtonBar, fCurrentFile, fEventTextEntry, fFileList, fGoTo, fLayout, fNextEvt, fPrevEvt, fPrint, fReload, fRunEvtLabel, fRunTextEntry, norm, and evdb::PicturePool().

32  :
33  fTimer(0)
34  {
35  fButtonBar = new TGCompositeFrame(frame, 60, 20,
36  kSunkenFrame|kHorizontalFrame);
37  fLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 0);
38 
39  // Previous event button
40  fPrevEvt = new TGTextButton(fButtonBar, "<- Previous", 150);
41  fPrevEvt->SetToolTipText("Go to previous event");
42  fPrevEvt->Connect("Clicked()", "evdb::ButtonBar", this, "PrevEvt()");
43  fButtonBar->AddFrame(fPrevEvt,
44  new TGLayoutHints(kLHintsTop | kLHintsLeft,
45  2, 0, 2, 2));
46 
47  // Next event button
48  fNextEvt = new TGTextButton(fButtonBar, "Next ----->", 150);
49  fNextEvt->SetToolTipText("Go to next event");
50  fNextEvt->Connect("Clicked()", "evdb::ButtonBar", this, "NextEvt()");
51  fButtonBar->AddFrame(fNextEvt,
52  new TGLayoutHints(kLHintsTop | kLHintsLeft,
53  2, 0, 2, 2));
54 
55  // Auto advance button
56  fAutoAdvance = new TGTextButton(fButtonBar, ">", 150);
57  fAutoAdvance->SetToolTipText("Start auto advance");
58  fAutoAdvance->Connect("Clicked()", "evdb::ButtonBar", this, "AutoAdvance()");
59  fButtonBar->AddFrame(fAutoAdvance,
60  new TGLayoutHints(kLHintsTop | kLHintsLeft,
61  2, 0, 2, 2));
62 
63  // Reload button
64  fReload = new TGTextButton(fButtonBar, "Reload", 150);
65  fReload->SetToolTipText("Reload current event");
66  fReload->Connect("Clicked()", "evdb::ButtonBar", this, "ReloadEvt()");
67  fButtonBar->AddFrame(fReload,
68  new TGLayoutHints(kLHintsTop | kLHintsLeft,
69  2, 0, 2, 2));
70 
71  fCurrentFile = new TGTextEntry(fButtonBar, new TGTextBuffer(256));
72  fCurrentFile->SetToolTipText("Name of current file");
73  fCurrentFile->Resize(400, fCurrentFile->GetDefaultHeight());
74  fButtonBar->AddFrame(fCurrentFile,
75  new TGLayoutHints(kLHintsTop | kLHintsLeft,
76  8, 2, 2, 2));
77 
78  // Button to list attached files
79  const TGPicture* p = evdb::PicturePool()->GetPicture("arrow_down.xpm");
80  GContext_t norm = TGPictureButton::GetDefaultGC()();
81  fFileList = new TGPictureButton(fButtonBar, p, -1, norm, kRaisedFrame);
82  fFileList->SetToolTipText("List files");
83  fFileList->Connect("Clicked()", "evdb::ButtonBar", this, "FileList()");
84  fButtonBar->AddFrame(fFileList,
85  new TGLayoutHints(kLHintsCenterY,
86  2, 0, 2, 2));
87 
88  // Print button
89  fPrint = new TGTextButton(fButtonBar, "Print", 150);
90  fPrint->SetToolTipText("Print display to a file");
91  fPrint->Connect("Clicked()", "evdb::ButtonBar", this, "PrintToFile()");
92  fButtonBar->AddFrame(fPrint,
93  new TGLayoutHints(kLHintsTop|kLHintsRight,
94  2, 0, 2, 2));
95 
96  // Go To button
97  fGoTo = new TGTextButton(fButtonBar, "Go");
98  fGoTo->SetToolTipText("Go to event");
99  fGoTo->Connect("Clicked()", "evdb::ButtonBar", this, "GoTo()");
100  fButtonBar->AddFrame(fGoTo, new TGLayoutHints(kLHintsTop|kLHintsRight, 2, 0, 2, 2));
101 
102  // Go to event text entry
103  fEventTextEntry = new TGTextEntry(fButtonBar, new TGTextBuffer(128));
104  fEventTextEntry->Connect("ReturnPressed()","evdb::ButtonBar",this,"GoTo()");
105  fEventTextEntry->Resize(75,20);
106  fButtonBar->AddFrame(fEventTextEntry, new TGLayoutHints(kLHintsTop|kLHintsRight,2,0,2,2));
107 
108  fRunTextEntry = new TGTextEntry(fButtonBar, new TGTextBuffer(128));
109  fRunTextEntry->Connect("ReturnPressed()","evdb::ButtonBar",this,"GoTo()");
110  fRunTextEntry->Resize(50,20);
111  fButtonBar->AddFrame(fRunTextEntry, new TGLayoutHints(kLHintsCenterY|kLHintsRight,2,0,2,2));
112 
113  fRunEvtLabel = new TGLabel(fButtonBar, new TGHotString("[Run/Event]="));
114  fButtonBar->AddFrame(fRunEvtLabel, new TGLayoutHints(kLHintsCenterY|kLHintsRight,2,0,2,2));
115 
116  // Add button bar to frame
117  frame->AddFrame(fButtonBar, fLayout);
118  }
TGTextButton * fNextEvt
Goto to next event.
Definition: ButtonBar.h:48
TGPictureButton * fFileList
Access to the list of files attached.
Definition: ButtonBar.h:52
TGCompositeFrame * fButtonBar
The top button bar.
Definition: ButtonBar.h:45
TGTextButton * fPrint
Print button.
Definition: ButtonBar.h:59
TGLayoutHints * fLayout
Layout for button bar.
Definition: ButtonBar.h:46
TGTextButton * fPrevEvt
Goto to previous event.
Definition: ButtonBar.h:47
TGTextButton * fAutoAdvance
Start to auto advance.
Definition: ButtonBar.h:49
TGTextButton * fGoTo
Go To event button.
Definition: ButtonBar.h:58
TTimer * fTimer
Timer to handle auto advancing.
Definition: ButtonBar.h:42
Float_t norm
TGTextButton * fReload
Reload current event.
Definition: ButtonBar.h:50
TGPicturePool * PicturePool()
Definition: evdb.cxx:16
TGTextEntry * fEventTextEntry
Event number text entry.
Definition: ButtonBar.h:56
TGTextEntry * fRunTextEntry
Run number text entry.
Definition: ButtonBar.h:55
TGLabel * fRunEvtLabel
Run/Event number label.
Definition: ButtonBar.h:54
TGTextEntry * fCurrentFile
Currently loaded file.
Definition: ButtonBar.h:51
evdb::ButtonBar::~ButtonBar ( )
virtual

Definition at line 122 of file ButtonBar.cxx.

References fButtonBar, fCurrentFile, fEventTextEntry, fFileList, fGoTo, fLayout, fNextEvt, fPrevEvt, fPrint, fReload, fRunEvtLabel, fRunTextEntry, and fTimer.

123  {
124  if (fTimer) { delete fTimer; fTimer = 0; }
125 
127  delete fRunTextEntry; fRunTextEntry =0;
128  delete fRunEvtLabel; fRunEvtLabel =0;
129  delete fPrint; fPrint =0;
130  delete fGoTo; fGoTo =0;
131  delete fFileList; fFileList =0;
132  delete fCurrentFile; fCurrentFile =0;
133  delete fReload; fReload =0;
134  delete fNextEvt; fNextEvt =0;
135  delete fPrevEvt; fPrevEvt =0;
136  delete fLayout; fLayout =0;
137  delete fButtonBar; fButtonBar =0;
138  }
TGTextButton * fNextEvt
Goto to next event.
Definition: ButtonBar.h:48
TGPictureButton * fFileList
Access to the list of files attached.
Definition: ButtonBar.h:52
TGCompositeFrame * fButtonBar
The top button bar.
Definition: ButtonBar.h:45
TGTextButton * fPrint
Print button.
Definition: ButtonBar.h:59
TGLayoutHints * fLayout
Layout for button bar.
Definition: ButtonBar.h:46
TGTextButton * fPrevEvt
Goto to previous event.
Definition: ButtonBar.h:47
TGTextButton * fGoTo
Go To event button.
Definition: ButtonBar.h:58
TTimer * fTimer
Timer to handle auto advancing.
Definition: ButtonBar.h:42
TGTextButton * fReload
Reload current event.
Definition: ButtonBar.h:50
TGTextEntry * fEventTextEntry
Event number text entry.
Definition: ButtonBar.h:56
TGTextEntry * fRunTextEntry
Run number text entry.
Definition: ButtonBar.h:55
TGTextEntry * fCurrentFile
Currently loaded file.
Definition: ButtonBar.h:51
TGLabel * fRunEvtLabel
Run/Event number label.
Definition: ButtonBar.h:54

Member Function Documentation

void evdb::ButtonBar::AutoAdvance ( )

Definition at line 171 of file ButtonBar.cxx.

References fAutoAdvance, evdb::EventDisplay::fAutoAdvanceInterval, and fTimer.

172  {
173  if (fTimer==0) {
174  //
175  // Start the auto-advance feature
176  //
177  fAutoAdvance->SetText("X");
178  fTimer = new TTimer;
179  fTimer->SetObject(this);
180 
182  fTimer->Start(evd->fAutoAdvanceInterval);
183  }
184  else {
185  //
186  // Stop the auto-advance
187  //
188  fAutoAdvance->SetText(">");
189  fTimer->Stop();
190  delete fTimer;
191  fTimer = 0;
192  }
193  }
unsigned int fAutoAdvanceInterval
Wait time in milliseconds.
Definition: EventDisplay.h:45
TGTextButton * fAutoAdvance
Start to auto advance.
Definition: ButtonBar.h:49
LArSoft includes.
TTimer * fTimer
Timer to handle auto advancing.
Definition: ButtonBar.h:42
evdb::ButtonBar::ClassDef ( ButtonBar  ,
 
)
private
void evdb::ButtonBar::FileList ( )

Definition at line 204 of file ButtonBar.cxx.

205  {
206  // int i;
207  // const char* f;
208  // for (i=0; (f=IoModule::Instance()->FileName(i)); ++i) {
209  // std::cerr << f << std::endl;
210  // }
211  }
void evdb::ButtonBar::GoTo ( )

Definition at line 219 of file ButtonBar.cxx.

References tca::evt, fEventTextEntry, fRunTextEntry, evdb::kGOTO_EVENT, evdb::NavState::Set(), and evdb::NavState::SetTarget().

220  {
221  int run = atoi(fRunTextEntry ->GetText());
222  int evt = atoi(fEventTextEntry->GetText());
223  NavState::SetTarget(run, evt);
225  }
static void Set(int which)
Definition: NavState.cxx:24
static void SetTarget(int run, int event)
Definition: NavState.cxx:39
TCEvent evt
Definition: DataStructs.cxx:8
TGTextEntry * fEventTextEntry
Event number text entry.
Definition: ButtonBar.h:56
TGTextEntry * fRunTextEntry
Run number text entry.
Definition: ButtonBar.h:55
Bool_t evdb::ButtonBar::HandleTimer ( TTimer *  t)

The timer sets the pace for the auto advance feature

Definition at line 159 of file ButtonBar.cxx.

References evdb::EventDisplay::fAutoAdvanceInterval, and NextEvt().

160  {
161  this->NextEvt();
162 
164  t->SetTime(evd->fAutoAdvanceInterval);
165 
166  return kTRUE;
167  }
unsigned int fAutoAdvanceInterval
Wait time in milliseconds.
Definition: EventDisplay.h:45
LArSoft includes.
void evdb::ButtonBar::NextEvt ( )

Definition at line 149 of file ButtonBar.cxx.

References evdb::kNEXT_EVENT, and evdb::NavState::Set().

Referenced by HandleTimer().

150  {
152  }
static void Set(int which)
Definition: NavState.cxx:24
int evdb::ButtonBar::NoImpl ( const char *  c)

Definition at line 242 of file ButtonBar.cxx.

References fButtonBar, and evdb::TopWindow().

243  {
244  std::string s;
245  s = "Sorry action '"; s += method; s+= "' is not implemented.\n";
246  new TGMsgBox(evdb::TopWindow(), fButtonBar,
247  "No implementation",s.c_str(),kMBIconExclamation);
248  return 0;
249  }
TGCompositeFrame * fButtonBar
The top button bar.
Definition: ButtonBar.h:45
const TGWindow * TopWindow()
Definition: evdb.cxx:12
void evdb::ButtonBar::PrevEvt ( )

Definition at line 142 of file ButtonBar.cxx.

References evdb::kPREV_EVENT, and evdb::NavState::Set().

143  {
145  }
static void Set(int which)
Definition: NavState.cxx:24
void evdb::ButtonBar::PrintToFile ( )

Definition at line 215 of file ButtonBar.cxx.

void evdb::ButtonBar::ReloadEvt ( )

Definition at line 197 of file ButtonBar.cxx.

References evdb::kRELOAD_EVENT, and evdb::NavState::Set().

198  {
200  }
static void Set(int which)
Definition: NavState.cxx:24
void evdb::ButtonBar::SetRunEvent ( int  run,
int  event 
)

Definition at line 229 of file ButtonBar.cxx.

References fEventTextEntry, and fRunTextEntry.

Referenced by evdb::DisplayWindow::SetRunEvent().

230  {
231  char runtxt[128];
232  char evttxt[128];
233 
234  sprintf(runtxt,"%d",run);
235  sprintf(evttxt,"%d",evt);
236  fRunTextEntry ->SetText(runtxt);
237  fEventTextEntry->SetText(evttxt);
238  }
TCEvent evt
Definition: DataStructs.cxx:8
TGTextEntry * fEventTextEntry
Event number text entry.
Definition: ButtonBar.h:56
TGTextEntry * fRunTextEntry
Run number text entry.
Definition: ButtonBar.h:55

Member Data Documentation

TGTextButton* evdb::ButtonBar::fAutoAdvance
private

Start to auto advance.

Definition at line 49 of file ButtonBar.h.

Referenced by AutoAdvance(), and ButtonBar().

TGCompositeFrame* evdb::ButtonBar::fButtonBar
private

The top button bar.

Definition at line 45 of file ButtonBar.h.

Referenced by ButtonBar(), NoImpl(), and ~ButtonBar().

TGTextEntry* evdb::ButtonBar::fCurrentFile
private

Currently loaded file.

Definition at line 51 of file ButtonBar.h.

Referenced by ButtonBar(), and ~ButtonBar().

TGTextEntry* evdb::ButtonBar::fEventTextEntry
private

Event number text entry.

Definition at line 56 of file ButtonBar.h.

Referenced by ButtonBar(), GoTo(), SetRunEvent(), and ~ButtonBar().

TGPictureButton* evdb::ButtonBar::fFileList
private

Access to the list of files attached.

Definition at line 52 of file ButtonBar.h.

Referenced by ButtonBar(), and ~ButtonBar().

TGTextButton* evdb::ButtonBar::fGoTo
private

Go To event button.

Definition at line 58 of file ButtonBar.h.

Referenced by ButtonBar(), and ~ButtonBar().

TGLayoutHints* evdb::ButtonBar::fLayout
private

Layout for button bar.

Definition at line 46 of file ButtonBar.h.

Referenced by ButtonBar(), and ~ButtonBar().

TGTextButton* evdb::ButtonBar::fNextEvt
private

Goto to next event.

Definition at line 48 of file ButtonBar.h.

Referenced by ButtonBar(), and ~ButtonBar().

TGTextButton* evdb::ButtonBar::fPrevEvt
private

Goto to previous event.

Definition at line 47 of file ButtonBar.h.

Referenced by ButtonBar(), and ~ButtonBar().

TGTextButton* evdb::ButtonBar::fPrint
private

Print button.

Definition at line 59 of file ButtonBar.h.

Referenced by ButtonBar(), and ~ButtonBar().

TGTextButton* evdb::ButtonBar::fReload
private

Reload current event.

Definition at line 50 of file ButtonBar.h.

Referenced by ButtonBar(), and ~ButtonBar().

TGLabel* evdb::ButtonBar::fRunEvtLabel
private

Run/Event number label.

Definition at line 54 of file ButtonBar.h.

Referenced by ButtonBar(), and ~ButtonBar().

TGTextEntry* evdb::ButtonBar::fRunTextEntry
private

Run number text entry.

Definition at line 55 of file ButtonBar.h.

Referenced by ButtonBar(), GoTo(), SetRunEvent(), and ~ButtonBar().

TTimer* evdb::ButtonBar::fTimer
private

Timer to handle auto advancing.

Definition at line 42 of file ButtonBar.h.

Referenced by AutoAdvance(), and ~ButtonBar().


The documentation for this class was generated from the following files: