Public Member Functions | Private Attributes | List of all members
om::ButtonBank Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-30/OnlineMonitoring/viewer/ButtonBank.h"

Inheritance diagram for om::ButtonBank:
om::GUIModelSubscriber

Public Member Functions

 ButtonBank (TGWindow *w)
 
 ~ButtonBank ()
 
void Back ()
 
void Forward ()
 
void Pause ()
 
void Resume ()
 
void Update ()
 
void Histo ()
 
void PrintPlot ()
 
Bool_t HandleTimer (TTimer *t)
 
void GUIModelDataIssue (const GUIModelData &d, unsigned int which)
 
bool GetLock ()
 
void ReleaseLock ()
 

Private Attributes

TGLayoutHints * fLhint
 Layout hints. More...
 
TGPictureButton * fBack
 Move back in plot history. More...
 
TGPictureButton * fForward
 Move forward in plot history. More...
 
TGPictureButton * fUpdate
 Update current plot. More...
 
TGPictureButton * fPause
 Pause automatic updates. More...
 
TGPictureButton * fResume
 Resume automatic updates. More...
 
TGPictureButton * fHisto
 Show histogram of 2D contents. More...
 
TGPictureButton * fPrint
 Print plot to file. More...
 
TTimer * fTimer
 The timer to issue plot auto-refresh. More...
 

Detailed Description

Definition at line 13 of file ButtonBank.h.

Constructor & Destructor Documentation

ButtonBank::ButtonBank ( TGWindow *  w)

Definition at line 14 of file ButtonBank.cxx.

References om::Icons::FastForward(), fBack, fForward, fHisto, fLhint, fPause, fPrint, fResume, fTimer, fUpdate, om::Icons::Histo(), om::GUIModel::Instance(), om::Icons::Pause(), om::Icons::Play(), om::Icons::Print(), om::Icons::Repeat(), and om::Icons::Rewind().

14  :
15  TGCompositeFrame(mf,
18  kHorizontalFrame),
20 {
21  fLhint = new TGLayoutHints(kLHintsLeft, 2, 4);
22 
23  fBack = new TGPictureButton(this, Icons::Rewind());
24  fBack->Connect("Clicked()", "om::ButtonBank", this, "Back()");
25  fBack->SetToolTipText("Move backward in history");
26  fBack->SetState(kButtonDisabled);
27  this->AddFrame(fBack, fLhint);
28 
29  fForward = new TGPictureButton(this, Icons::FastForward());
30  fForward->SetToolTipText("Move forward in history");
31  fForward->Connect("Clicked()", "om::ButtonBank", this, "Forward()");
32  fForward->SetState(kButtonDisabled);
33  this->AddFrame(fForward, fLhint);
34 
35  fResume = new TGPictureButton(this, Icons::Play());
36  fResume->SetToolTipText("Resume automatic plot updates");
37  fResume->Connect("Clicked()", "om::ButtonBank", this, "Resume()");
38  fResume->SetState(kButtonDisabled);
39  this->AddFrame(fResume, fLhint);
40 
41  fPause = new TGPictureButton(this, Icons::Pause());
42  fPause->SetToolTipText("Pause automatic plot updates");
43  fPause->Connect("Clicked()", "om::ButtonBank", this, "Pause()");
44  fPause->SetState(kButtonDisabled);
45  this->AddFrame(fPause, fLhint);
46 
47  fUpdate = new TGPictureButton(this, Icons::Repeat());
48  fUpdate->SetToolTipText("Force plot update now");
49  fUpdate->Connect("Clicked()", "om::ButtonBank", this, "Update()");
50  fUpdate->SetState(kButtonDisabled);
51  this->AddFrame(fUpdate, fLhint);
52 
53  fHisto = new TGPictureButton(this, Icons::Histo());
54  fHisto->SetToolTipText("Show 1D histogram of bin contents");
55  fHisto->Connect("Clicked()", "om::ButtonBank", this, "Histo()");
56  fHisto->SetState(kButtonUp);
57  this->AddFrame(fHisto, fLhint);
58 
59  fPrint = new TGPictureButton(this, Icons::Print());
60  fPrint->SetToolTipText("Print to a file");
61  fPrint->Connect("Clicked()", "om::ButtonBank", this, "PrintPlot()");
62  fPrint->SetState(kButtonUp);
63  this->AddFrame(fPrint, fLhint);
64 
65  this->MapSubwindows();
66  this->Resize();
67  this->MapWindow();
68 
69  fTimer = new TTimer;
70  fTimer->SetObject(this);
71  fTimer->Start(GUIModel::Instance().Data().fPlotViewRefreshRate);
72 }
TGPictureButton * fForward
Move forward in plot history.
Definition: ButtonBank.h:39
GUIModelSubscriber(unsigned int which)
static const unsigned int kCurrentHistogramID
Definition: GUIModelData.h:15
const TGPicture * Print()
Definition: Icons.cxx:91
TGPictureButton * fBack
Move back in plot history.
Definition: ButtonBank.h:38
TTimer * fTimer
The timer to issue plot auto-refresh.
Definition: ButtonBank.h:46
TGPictureButton * fPause
Pause automatic updates.
Definition: ButtonBank.h:41
const TGPicture * Repeat()
Definition: Icons.cxx:71
TGLayoutHints * fLhint
Layout hints.
Definition: ButtonBank.h:37
static GUIModel & Instance()
Definition: GUIModel.cxx:11
const TGPicture * Play()
Definition: Icons.cxx:61
static const unsigned int fButtonBankSizeY
Definition: Layout.h:29
TGPictureButton * fResume
Resume automatic updates.
Definition: ButtonBank.h:42
const TGPicture * FastForward()
Definition: Icons.cxx:41
TGPictureButton * fUpdate
Update current plot.
Definition: ButtonBank.h:40
static const unsigned int kPlotViewRefreshPausedID
Definition: GUIModelData.h:18
const TGPicture * Rewind()
Definition: Icons.cxx:31
TGPictureButton * fHisto
Show histogram of 2D contents.
Definition: ButtonBank.h:43
static const unsigned int fButtonBankSizeX
Definition: Layout.h:28
const TGPicture * Histo()
Definition: Icons.cxx:101
const TGPicture * Pause()
Definition: Icons.cxx:51
TGPictureButton * fPrint
Print plot to file.
Definition: ButtonBank.h:44
ButtonBank::~ButtonBank ( )

Definition at line 140 of file ButtonBank.cxx.

References fBack, fForward, fPause, fResume, fTimer, and fUpdate.

141 {
142  if(fBack) { delete fBack; fBack = 0; }
143  if(fForward) { delete fForward; fForward = 0; }
144  if(fUpdate) { delete fUpdate; fUpdate = 0; }
145  if(fPause) { delete fPause; fPause = 0; }
146  if(fResume) { delete fResume; fResume = 0; }
147  if(fTimer) { delete fTimer; fTimer = 0; }
148 }
TGPictureButton * fForward
Move forward in plot history.
Definition: ButtonBank.h:39
TGPictureButton * fBack
Move back in plot history.
Definition: ButtonBank.h:38
TTimer * fTimer
The timer to issue plot auto-refresh.
Definition: ButtonBank.h:46
TGPictureButton * fPause
Pause automatic updates.
Definition: ButtonBank.h:41
TGPictureButton * fResume
Resume automatic updates.
Definition: ButtonBank.h:42
TGPictureButton * fUpdate
Update current plot.
Definition: ButtonBank.h:40

Member Function Documentation

void ButtonBank::Back ( )

Definition at line 76 of file ButtonBank.cxx.

References om::GUIModel::HistogramBack(), and om::GUIModel::Instance().

77 {
79 }
static GUIModel & Instance()
Definition: GUIModel.cxx:11
void HistogramBack()
Definition: GUIModel.cxx:113
void ButtonBank::Forward ( )

Definition at line 83 of file ButtonBank.cxx.

References om::GUIModel::HistogramForward(), and om::GUIModel::Instance().

84 {
86 }
static GUIModel & Instance()
Definition: GUIModel.cxx:11
void HistogramForward()
Definition: GUIModel.cxx:121
bool GUIModelSubscriber::GetLock ( )
inherited

Definition at line 24 of file GUIModelSubscriber.cxx.

References gsLock, MECModelEnuComparisons::i, and kSleep.

Referenced by om::CaptionBox::GUIModelDataIssue(), om::HistogramInfo::GUIModelDataIssue(), GUIModelDataIssue(), om::HistogramBrowser::GUIModelDataIssue(), om::PlotViewer::GUIModelDataIssue(), and om::WatchListBox::GUIModelDataIssue().

25 {
26  unsigned int i;
27  const unsigned int kSleep = 1000; // 1 msec
28  const unsigned int kCount = 10000; // 10k tries at 1 msec = 10 seconds
29  for (i=0; i<kCount; ++i) {
30  if (gsLock==false) {
31  gsLock = true;
32  return true;
33  }
34  usleep(kSleep);
35  }
36  return false;
37 }
static bool gsLock
static const unsigned int kSleep
Definition: IPC.cxx:21
void ButtonBank::GUIModelDataIssue ( const GUIModelData d,
unsigned int  which 
)
virtual

Complete the GUIModelDataSubscriber interface

Implements om::GUIModelSubscriber.

Definition at line 152 of file ButtonBank.cxx.

References om::CurrentHistogram::BackwardOK(), fBack, om::GUIModelData::fCurrentHistogram, fForward, om::CurrentHistogram::ForwardOK(), fPause, om::GUIModelData::fPlotViewRefreshPaused, fResume, fUpdate, om::GUIModelSubscriber::GetLock(), om::kCurrentHistogramID, om::kPlotViewRefreshPausedID, om::GUIModelSubscriber::ReleaseLock(), and om::CurrentHistogram::ReloadOK().

154 {
155  if (this->GetLock()==false) return;
156 
157  if ((which & kCurrentHistogramID)!=0) {
158  bool back_ok = d.fCurrentHistogram.BackwardOK();
159  bool back_en = (fBack->GetState()!=kButtonDisabled);
160  if ( back_ok && !back_en) fBack->SetState(kButtonUp);
161  if (!back_ok && back_en) fBack->SetState(kButtonDisabled);
162 
163  bool forward_ok = d.fCurrentHistogram.ForwardOK();
164  bool forward_en = (fForward->GetState()!=kButtonDisabled);
165  if ( forward_ok && !forward_en) fForward->SetState(kButtonUp);
166  if (!forward_ok && forward_en) fForward->SetState(kButtonDisabled);
167 
168  bool update_ok = d.fCurrentHistogram.ReloadOK();
169  bool update_en = (fUpdate->GetState()!=kButtonDisabled);
170  if ( update_ok && !update_en) fUpdate->SetState(kButtonUp);
171  if (!update_ok && update_en) fUpdate->SetState(kButtonDisabled);
172  }
173  if ((which | kPlotViewRefreshPausedID)!=0) {
174  bool paused = d.fPlotViewRefreshPaused;
175  bool pause_en = (fPause-> GetState()!=kButtonDisabled);
176  bool resume_en = (fResume->GetState()!=kButtonDisabled);
177  if ( paused && pause_en) fPause-> SetState(kButtonDisabled);
178  if (!paused && !pause_en) fPause-> SetState(kButtonUp);
179  if ( paused && !resume_en) fResume->SetState(kButtonUp);
180  if (!paused && resume_en) fResume->SetState(kButtonDisabled);
181  }
182 
183  this->ReleaseLock();
184 }
TGPictureButton * fForward
Move forward in plot history.
Definition: ButtonBank.h:39
static const unsigned int kCurrentHistogramID
Definition: GUIModelData.h:15
TGPictureButton * fBack
Move back in plot history.
Definition: ButtonBank.h:38
TGPictureButton * fPause
Pause automatic updates.
Definition: ButtonBank.h:41
bool fPlotViewRefreshPaused
Definition: GUIModelData.h:39
TGPictureButton * fResume
Resume automatic updates.
Definition: ButtonBank.h:42
TGPictureButton * fUpdate
Update current plot.
Definition: ButtonBank.h:40
static const unsigned int kPlotViewRefreshPausedID
Definition: GUIModelData.h:18
CurrentHistogram fCurrentHistogram
Definition: GUIModelData.h:37
Bool_t ButtonBank::HandleTimer ( TTimer *  t)

Definition at line 126 of file ButtonBank.cxx.

References fTimer, om::GUIModel::Instance(), and Update().

127 {
128 
129  if(GUIModel::Instance().Data().fPlotViewRefreshPaused == true) return true;
130 
131  this->Update();
132  fTimer->SetTime(GUIModel::Instance().Data().fPlotViewRefreshRate);
133 
134  return true;
135 
136 }
TTimer * fTimer
The timer to issue plot auto-refresh.
Definition: ButtonBank.h:46
static GUIModel & Instance()
Definition: GUIModel.cxx:11
void ButtonBank::Histo ( )

Definition at line 104 of file ButtonBank.cxx.

References om::GUIModel::DrawContentProjection(), fHisto, and om::GUIModel::Instance().

105 {
107  fHisto->SetState(kButtonUp);
108 }
static GUIModel & Instance()
Definition: GUIModel.cxx:11
void DrawContentProjection()
Definition: GUIModel.cxx:203
TGPictureButton * fHisto
Show histogram of 2D contents.
Definition: ButtonBank.h:43
void ButtonBank::Pause ( )

Definition at line 90 of file ButtonBank.cxx.

References om::GUIModel::Instance(), and om::GUIModel::SetPlotViewRefreshPaused().

91 {
93 }
static GUIModel & Instance()
Definition: GUIModel.cxx:11
void SetPlotViewRefreshPaused(bool paused)
Definition: GUIModel.cxx:137
void ButtonBank::PrintPlot ( )

Definition at line 112 of file ButtonBank.cxx.

References om::GUIModel::Instance(), and om::GUIModel::SendPrint().

113 {
115 }
static GUIModel & Instance()
Definition: GUIModel.cxx:11
void SendPrint()
Definition: GUIModel.cxx:196
void GUIModelSubscriber::ReleaseLock ( )
inherited
void ButtonBank::Resume ( )

Definition at line 97 of file ButtonBank.cxx.

References om::GUIModel::Instance(), and om::GUIModel::SetPlotViewRefreshPaused().

98 {
100 }
static GUIModel & Instance()
Definition: GUIModel.cxx:11
void SetPlotViewRefreshPaused(bool paused)
Definition: GUIModel.cxx:137
void ButtonBank::Update ( )

Definition at line 119 of file ButtonBank.cxx.

References om::GUIModel::Instance(), and om::GUIModel::SendUpdates().

Referenced by progbar.ProgressBar::Finish(), HandleTimer(), and progbar.ProgressBar::Start().

120 {
122 }
void SendUpdates() const
Definition: GUIModel.cxx:217
static GUIModel & Instance()
Definition: GUIModel.cxx:11

Member Data Documentation

TGPictureButton* om::ButtonBank::fBack
private

Move back in plot history.

Definition at line 38 of file ButtonBank.h.

Referenced by ButtonBank(), GUIModelDataIssue(), and ~ButtonBank().

TGPictureButton* om::ButtonBank::fForward
private

Move forward in plot history.

Definition at line 39 of file ButtonBank.h.

Referenced by ButtonBank(), GUIModelDataIssue(), and ~ButtonBank().

TGPictureButton* om::ButtonBank::fHisto
private

Show histogram of 2D contents.

Definition at line 43 of file ButtonBank.h.

Referenced by ButtonBank(), and Histo().

TGLayoutHints* om::ButtonBank::fLhint
private

Layout hints.

Definition at line 37 of file ButtonBank.h.

Referenced by ButtonBank().

TGPictureButton* om::ButtonBank::fPause
private

Pause automatic updates.

Definition at line 41 of file ButtonBank.h.

Referenced by ButtonBank(), GUIModelDataIssue(), and ~ButtonBank().

TGPictureButton* om::ButtonBank::fPrint
private

Print plot to file.

Definition at line 44 of file ButtonBank.h.

Referenced by ButtonBank().

TGPictureButton* om::ButtonBank::fResume
private

Resume automatic updates.

Definition at line 42 of file ButtonBank.h.

Referenced by ButtonBank(), GUIModelDataIssue(), and ~ButtonBank().

TTimer* om::ButtonBank::fTimer
private

The timer to issue plot auto-refresh.

Definition at line 46 of file ButtonBank.h.

Referenced by ButtonBank(), HandleTimer(), and ~ButtonBank().

TGPictureButton* om::ButtonBank::fUpdate
private

Update current plot.

Definition at line 40 of file ButtonBank.h.

Referenced by ButtonBank(), GUIModelDataIssue(), and ~ButtonBank().


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