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

The job pull dow menu. More...

#include "JobMenu.h"

Public Member Functions

 JobMenu (TGMenuBar *menubar, TGMainFrame *mf)
 
virtual ~JobMenu ()
 
void SetWorkers (const std::vector< std::string > &w)
 
void SetServices (const std::vector< std::string > &w)
 
void HandleMenu (int menu)
 
void EditConfig (int cfg)
 
void EditService (int cfg)
 

Private Member Functions

int OpenJob ()
 
void ResetJob ()
 

Private Attributes

TGPopupMenu * fJobMenu
 The file menu. More...
 
TGPopupMenu * fConfigMenu
 The module configuration menu. More...
 
TGPopupMenu * fServiceMenu
 The user service configuration menu. More...
 
TGLayoutHints * fLayout
 How to layout the menu. More...
 

Detailed Description

The job pull dow menu.

Definition at line 22 of file JobMenu.h.

Constructor & Destructor Documentation

evdb::JobMenu::JobMenu ( TGMenuBar *  menubar,
TGMainFrame *  mf 
)

Definition at line 35 of file JobMenu.cxx.

References fConfigMenu, fJobMenu, fLayout, fServiceMenu, evdb::kM_JOB_OPENXML, and evdb::kM_JOB_RESETJOB.

37  {
38  //======================================================================
39  // Build the help menu
40  //======================================================================
41  fJobMenu = new TGPopupMenu(gClient->GetRoot());
42  fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
43 
44  fConfigMenu = new TGPopupMenu();
45  fServiceMenu = new TGPopupMenu();
46 
47  // Create the list of functions. Associate each which a command code
48  fJobMenu->AddEntry("&Load job", kM_JOB_OPENXML);
49  fJobMenu->AddEntry("&Reset Job", kM_JOB_RESETJOB);
50  fJobMenu->AddSeparator();
51  fJobMenu->AddPopup("&Configure Module", fConfigMenu);
52  fJobMenu->AddSeparator();
53  fJobMenu->AddPopup("&Configure Service", fServiceMenu);
54 
55  // Connect only the fJobMenu - the other pop-ups that are embedded in
56  // it do not get their own signals for some reason known only to the
57  // ROOT developers
58  fJobMenu->Connect("Activated(Int_t)",
59  "evdb::JobMenu",
60  this,
61  "HandleMenu(int)");
62 
63  // Attach the menu to the menu bar
64  menubar->AddPopup("&Job",fJobMenu,fLayout);
65  }
TGPopupMenu * fJobMenu
The file menu.
Definition: JobMenu.h:43
TGPopupMenu * fConfigMenu
The module configuration menu.
Definition: JobMenu.h:44
TGLayoutHints * fLayout
How to layout the menu.
Definition: JobMenu.h:46
TGPopupMenu * fServiceMenu
The user service configuration menu.
Definition: JobMenu.h:45
evdb::JobMenu::~JobMenu ( )
virtual

Definition at line 69 of file JobMenu.cxx.

References fJobMenu, and fLayout.

70  {
71  //======================================================================
72  // Delete the job menu
73  //======================================================================
74  if (fLayout) { delete fLayout; fLayout = 0; }
75  if (fJobMenu) { delete fJobMenu; fJobMenu = 0; }
76  }
TGPopupMenu * fJobMenu
The file menu.
Definition: JobMenu.h:43
TGLayoutHints * fLayout
How to layout the menu.
Definition: JobMenu.h:46

Member Function Documentation

void evdb::JobMenu::EditConfig ( int  cfg)

Definition at line 136 of file JobMenu.cxx.

Referenced by HandleMenu().

137  {
138  // make sure to subtract off the offset used to distinguish between
139  // module and service configs
140  // art::ServiceHandle<evdb::EventDisplay> evd;
141  // evd->EditWorkerParameterSet(i-kM_JOB_EDITCONFIG);
142  }
void evdb::JobMenu::EditService ( int  cfg)

Definition at line 146 of file JobMenu.cxx.

Referenced by HandleMenu().

147  {
148  // make sure to subtract off the offset used to distinguish between
149  // module and service configs
150  // art::ServiceHandle<evdb::EventDisplay> evd;
151  // evd->EditServiceParameterSet(i-kM_JOB_EDITSERVICE);
152  }
void evdb::JobMenu::HandleMenu ( int  menu)

Definition at line 114 of file JobMenu.cxx.

References EditConfig(), EditService(), evdb::kM_JOB_EDITCONFIG, evdb::kM_JOB_EDITSERVICE, evdb::kM_JOB_OPENXML, evdb::kM_JOB_RESETJOB, OpenJob(), and ResetJob().

115  {
116  //======================================================================
117  // Take care of menu events
118  //======================================================================
119  switch(menu) {
120  case kM_JOB_OPENXML:
121  this->OpenJob();
122  break;
123  case kM_JOB_RESETJOB:
124  this->ResetJob();
125  break;
126  default:
127  if(menu >= kM_JOB_EDITCONFIG &&
128  menu < kM_JOB_EDITSERVICE) this->EditConfig(menu);
129  else if(menu >= kM_JOB_EDITSERVICE) this->EditService(menu);
130  break;
131  }
132  }
void EditConfig(int cfg)
Definition: JobMenu.cxx:136
void ResetJob()
Definition: JobMenu.cxx:183
void EditService(int cfg)
Definition: JobMenu.cxx:146
int OpenJob()
Definition: JobMenu.cxx:156
int evdb::JobMenu::OpenJob ( )
private

Definition at line 156 of file JobMenu.cxx.

References dir.

Referenced by HandleMenu().

157  {
158  // not every experiment uses SRT, so be sure to have
159  // a non-SRT option for the directory
160  static TString dir("./");
161  char* dirchar = getenv("SRT_PRIVATE_CONTEXT");
162  if(dirchar) dir = dirchar;
163  const char* filetypes[] = {
164  "Configuration Files", "*.fcl",
165  0, 0
166  };
167 
168  TGFileInfo finfo;
169  finfo.fIniDir = StrDup(dir.Data());
170  finfo.fFileTypes = filetypes;
171 
172  new TGFileDialog(gClient->GetRoot(),
173  gClient->GetRoot(),
174  kFDOpen,
175  &finfo);
176  if (finfo.fFilename == 0) return 0;
177 
178  return 0;
179  }
TDirectory * dir
Definition: macro.C:5
void evdb::JobMenu::ResetJob ( )
private

Definition at line 183 of file JobMenu.cxx.

Referenced by HandleMenu().

184  {
185  // jobc::Stack::Instance().CleanUp();
186  }
void evdb::JobMenu::SetServices ( const std::vector< std::string > &  w)

Definition at line 97 of file JobMenu.cxx.

References fConfigMenu, fServiceMenu, and evdb::kM_JOB_EDITSERVICE.

98  {
99  // Wipe out the existing menus and lists
100  for (unsigned int i=0;;++i) {
101  TGMenuEntry* m = fConfigMenu->GetEntry(i);
102  if (m) fConfigMenu->DeleteEntry(i);
103  else break;
104  }
105 
106  // Rebuild the list
107  for (unsigned int i=0; i<w.size(); ++i) {
108  fServiceMenu->AddEntry(w[i].c_str(), kM_JOB_EDITSERVICE+i);
109  }
110  }
TGPopupMenu * fConfigMenu
The module configuration menu.
Definition: JobMenu.h:44
TGPopupMenu * fServiceMenu
The user service configuration menu.
Definition: JobMenu.h:45
void evdb::JobMenu::SetWorkers ( const std::vector< std::string > &  w)

Definition at line 80 of file JobMenu.cxx.

References fConfigMenu, and evdb::kM_JOB_EDITCONFIG.

81  {
82  // Wipe out the existing menus and lists
83  for (unsigned int i=0;;++i) {
84  TGMenuEntry* m = fConfigMenu->GetEntry(i);
85  if (m) fConfigMenu->DeleteEntry(i);
86  else break;
87  }
88 
89  // Rebuild the list
90  for (unsigned int i=0; i<w.size(); ++i) {
91  fConfigMenu->AddEntry(w[i].c_str(), kM_JOB_EDITCONFIG+i);
92  }
93  }
TGPopupMenu * fConfigMenu
The module configuration menu.
Definition: JobMenu.h:44

Member Data Documentation

TGPopupMenu* evdb::JobMenu::fConfigMenu
private

The module configuration menu.

Definition at line 44 of file JobMenu.h.

Referenced by JobMenu(), SetServices(), and SetWorkers().

TGPopupMenu* evdb::JobMenu::fJobMenu
private

The file menu.

Definition at line 43 of file JobMenu.h.

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

TGLayoutHints* evdb::JobMenu::fLayout
private

How to layout the menu.

Definition at line 46 of file JobMenu.h.

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

TGPopupMenu* evdb::JobMenu::fServiceMenu
private

The user service configuration menu.

Definition at line 45 of file JobMenu.h.

Referenced by JobMenu(), and SetServices().


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