Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

evdb::JobMenu Class Reference

The job pull dow menu. More...

#include <JobMenu.h>

List of all members.

Public Member Functions

 JobMenu (TGMenuBar *menubar, TGMainFrame *mf)
virtual ~JobMenu ()
void HandleMenu (int menu)
void EditConfig (int cfg)

Private Member Functions

 RQ_OBJECT ("evdb::JobMenu")
int OpenJobXML ()
void BuildConfigMenu ()

Private Attributes

TGMainFrame * fMainFrame
TGPopupMenu * fJobMenu
TGPopupMenu * fConfigMenu
TGLayoutHints * fLayout


Detailed Description

The job pull dow menu.

Definition at line 21 of file JobMenu.h.


Constructor & Destructor Documentation

JobMenu::JobMenu TGMenuBar *  menubar,
TGMainFrame *  mf
 

Definition at line 40 of file JobMenu.cxx.

References BuildConfigMenu(), fConfigMenu, fJobMenu, fLayout, kM_JOB_AUTO_ADVANCE_START, kM_JOB_AUTO_ADVANCE_STOP, and kM_JOB_OPENXML.

00040                                                     :
00041   fMainFrame(mf)
00042 {
00043 //======================================================================
00044 // Build the help menu
00045 //======================================================================
00046   fJobMenu = new TGPopupMenu(gClient->GetRoot());
00047   fLayout  = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
00048   
00049   fConfigMenu = new TGPopupMenu(gClient->GetRoot());
00050   this->BuildConfigMenu();
00051   
00052   // Create the list of functions. Associate each which a command code
00053   fJobMenu->AddEntry("&Open XML",    kM_JOB_OPENXML);
00054   fJobMenu->AddPopup("&Edit Config", fConfigMenu);
00055   fJobMenu->AddEntry("Start Auto Advance", kM_JOB_AUTO_ADVANCE_START);
00056   fJobMenu->AddEntry("Stop Auto Advance",  kM_JOB_AUTO_ADVANCE_STOP);
00057   
00058   fJobMenu->Connect("Activated(Int_t)",
00059                     "evdb::JobMenu",this,"HandleMenu(int)");
00060   
00061   // Attach the menu to the menu bar
00062   menubar->AddPopup("&Job",fJobMenu,fLayout);
00063 }

JobMenu::~JobMenu  )  [virtual]
 

Definition at line 67 of file JobMenu.cxx.

References fJobMenu, and fLayout.

00068 {
00069 //======================================================================
00070 // Delete the help menu
00071 //======================================================================
00072   if (fLayout)  { delete fLayout;  fLayout  = 0; }
00073   if (fJobMenu) { delete fJobMenu; fJobMenu = 0; }
00074 }


Member Function Documentation

void JobMenu::BuildConfigMenu  )  [private]
 

Definition at line 78 of file JobMenu.cxx.

References cfg::Table::ConfigList, fConfigMenu, gsConfig, and cfg::Table::Instance().

Referenced by JobMenu(), and OpenJobXML().

00079 {
00080   // Wipe out the existing menus
00081   for (int i=0;;++i) {
00082     TGMenuEntry* m = fConfigMenu->GetEntry(i);
00083     if (m) fConfigMenu->DeleteEntry(i);
00084     else   break;
00085   }
00086 
00087   // Rebuild the list
00088   int icfg = 0;
00089   cfg::Table::ConfigList& cfglist = cfg::Table::Instance().GetList();
00090   cfg::Table::ConfigList::iterator itr   (cfglist.begin());
00091   cfg::Table::ConfigList::iterator itrEnd(cfglist.end());
00092   for (; itr!=itrEnd; ++itr) {
00093     fConfigMenu->AddEntry((*itr)->GetName(), icfg);
00094     gsConfig[icfg] = (*itr);
00095     ++icfg;
00096   }
00097   fConfigMenu->Connect("Activated(Int_t)",
00098                        "evdb::JobMenu",this,"EditConfig(int)");
00099 }

void JobMenu::EditConfig int  cfg  ) 
 

Definition at line 128 of file JobMenu.cxx.

References fMainFrame, and gsConfig.

Referenced by HandleMenu().

00129 {  
00130   new CfgEdit(gsConfig[i], fMainFrame);
00131 }

void JobMenu::HandleMenu int  menu  ) 
 

Definition at line 103 of file JobMenu.cxx.

References EditConfig(), kM_JOB_AUTO_ADVANCE_START, kM_JOB_AUTO_ADVANCE_STOP, kM_JOB_OPENXML, and OpenJobXML().

00104 {
00105 //======================================================================
00106 // Take care of menu events
00107 //======================================================================
00108   switch(menu) {
00109   case kM_JOB_OPENXML: 
00110     this->OpenJobXML(); 
00111     break;
00112   case kM_JOB_AUTO_ADVANCE_START: 
00113     IoModule::Instance()->StartAutoAdvance();
00114     break;
00115   case kM_JOB_AUTO_ADVANCE_STOP:
00116     IoModule::Instance()->StopAutoAdvance();
00117     break;
00118   default:
00119     // This is bogus, but it works. TODO: Figure out why the fConfigMenu
00120     // signals are misrouted here
00121     this->EditConfig(menu);
00122     break;
00123   }
00124 }

int JobMenu::OpenJobXML  )  [private]
 

Definition at line 135 of file JobMenu.cxx.

References xmli::AddToPath(), BuildConfigMenu(), jobc::Stack::Instance(), xmli::ReadFile(), and cfg::Config::SetEditAllOK().

Referenced by HandleMenu().

00136 {
00137   static TString dir(getenv("SRT_PRIVATE_CONTEXT"));
00138   const char* filetypes[] = {
00139     "XML Files", "*.xml",
00140     0,           0
00141   };
00142   
00143   TGFileInfo finfo;
00144   finfo.fIniDir    = StrDup(dir.Data());
00145   finfo.fFileTypes = filetypes;
00146 
00147   new TGFileDialog(gClient->GetRoot(), 
00148                    gClient->GetRoot(),
00149                    kFDOpen,
00150                    &finfo);
00151   if (finfo.fFilename == 0) return 0;
00152 
00153   // Add this directory to the top of the XML path. Helps get the
00154   // supporting configuration XML loaded
00155   xmli::AddToPath(finfo.fIniDir,-1);
00156 
00157   // Set flags that allows all configurations to be editted
00158   cfg::Config::SetEditAllOK();
00159   
00160   // Load the job xml file
00161   xmli::ReadFile(finfo.fFilename);
00162   jobc::Stack::Instance().PrintAll();
00163 
00164   // Rebuild the menus to relect any new entries
00165   this->BuildConfigMenu();
00166 
00167   // Reload the current event to trigger processing
00168   IoModule::Instance()->Reload();
00169 
00170   return 0;
00171 }

evdb::JobMenu::RQ_OBJECT "evdb::JobMenu"   )  [private]
 


Member Data Documentation

TGPopupMenu* evdb::JobMenu::fConfigMenu [private]
 

Definition at line 39 of file JobMenu.h.

Referenced by BuildConfigMenu(), and JobMenu().

TGPopupMenu* evdb::JobMenu::fJobMenu [private]
 

Definition at line 38 of file JobMenu.h.

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

TGLayoutHints* evdb::JobMenu::fLayout [private]
 

Definition at line 40 of file JobMenu.h.

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

TGMainFrame* evdb::JobMenu::fMainFrame [private]
 

Definition at line 37 of file JobMenu.h.

Referenced by EditConfig().


The documentation for this class was generated from the following files:
Generated on Fri Jul 25 02:05:53 2008 for NOvA Offline by doxygen 1.3.5