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

PageDisplay.cxx

Go to the documentation of this file.
00001 #include "PageDisplay.h"
00002 #include "PageDisplayConfig.h"
00003 #include "PageProxy.h"
00004 #include "PageABC.h"
00005 #include "RunSnarlEntry.h"
00006 #include "TimeHist.h"
00007 #include "DigitText.h"
00008 #include "MCText.h"
00009 #include "MCTree.h"
00010 #include "MCVectors.h"
00011 #include "PmtPixels.h"
00012 #include "Mint.h"
00013 #include "ZoomPad.h"
00014 #include "RegistryGui.h"
00015 #include "RegistryDialog.h"
00016 
00017 #include <Midad/Gui/GuiMenu.h>
00018 #include <Midad/Gui/GuiBox.h>
00019 #include <Midad/Gui/GuiStatusBar.h>
00020 #include <Midad/Gui/GuiTab.h>
00021 #include <Midad/Gui/GuiFrame.h>
00022 #include <Midad/Gui/GuiButton.h>
00023 #include <Midad/Gui/GuiMainWindow.h>
00024 #include <Midad/Gui/GuiTextView.h>
00025 #include <Midad/Gui/GuiTextEntry.h>
00026 #include <Midad/Gui/GuiTree.h>
00027 #include <Midad/Gui/GuiSlider.h>
00028 #include <Midad/Gui/GuiCanvas.h>
00029 #include <Midad/Gui/GuiScrolled.h>
00030 
00031 #include <JobControl/JobC.h>
00032 
00033 #include <TCanvas.h>
00034 #include <TGFileDialog.h>
00035 #include <TROOT.h>
00036 #include <TSystem.h>
00037 
00038 #include <sigc++/sigc++.h>
00039 #include <sigc++/class_slot.h>
00040 #include <sigc++/retype_return.h>
00041 using namespace SigC;
00042 
00043 #include <cstdlib>
00044 #include <iostream>
00045 #include <vector>
00046 using namespace std;
00047 
00048 static void die_die_die(PageDisplay* pd)
00049 {
00050     if (pd) delete pd;
00051     gROOT->ProcessLine(".q");   // whatever
00052 }
00053 
00054 
00055 ClassImp(PageDisplay)
00056 
00057 PageDisplay::PageDisplay(TGWindow& parent, Mint* mint)
00058     : GuiBox(parent,kVerticalFrame,100,100)
00059     , fMint(mint)
00060     , fMenuBar(0)
00061     , fRSEntry(0)
00062     , fBBox(0)
00063     , fTabs(0)
00064     , fStatusBar(0)
00065     , fTimeSlider(0)
00066     , fTimeHist(0) // no delete
00067     , fPmtPixels(0)
00068     , fDigitText(0)
00069     , fMCText(0)
00070     , fMCTree(0)
00071     , fMCVectors(0)
00072 {
00073 }
00074 
00075 
00076 
00077 PageDisplay::~PageDisplay()
00078 {
00079     cerr << "PageDisplay::~PageDisplay()\n";
00080     int siz = fPageList.size();
00081     for (int ind = 0; ind < siz; ++ind)  
00082         delete(fPageList[ind]);
00083     siz = fSinglePageList.size();
00084     for (int ind = 0; ind < siz; ++ind)  
00085         delete(fSinglePageList[ind]);
00086 }
00087 
00088 void PageDisplay::BuildGUI(const PageDisplayConfig& cfg)
00089 {
00090 
00091     // MENU
00092     this->SetupMenus();
00093 
00094     // RSE
00095     if (cfg.use_run_snarl_entry) {
00096         fRSEntry = manage(new RunSnarlEntry(*this));
00097         this->Add(*fRSEntry);
00098     }
00099     
00100     GuiBox* hbox = manage(new GuiBox(*this,kHorizontalFrame));
00101     this->Add(*hbox);
00102 
00103     // Button box
00104     fBBox = manage(new GuiBox(*hbox,kVerticalFrame));
00105     fBBox->SetLayoutHints(kLHintsExpandY);
00106     hbox->Add(*fBBox);
00107     this->SetupButtons();
00108 
00109     // Tabs
00110     fTabs = manage(new GuiTab(*hbox));
00111     hbox->Add(*fTabs);
00112     fTabs->selected.connect(slot(*this,&PageDisplay::UpdateTab));
00113 
00114     // Sliders
00115     this->SetupSliders();
00116 
00117     // status bar
00118     fStatusBar = manage(new GuiStatusBar(*this));
00119     this->Add(*fStatusBar);
00120 
00121 }
00122 
00123 static void add_to_page_menu(const char* name, GuiMenu* menu, PageDisplay* pd, bool tf)
00124 {
00125     // This kludge is used to keep UserDisplay out of the menus.
00126     // UserDisplay is not a complete display and is intended to be
00127     // created and filled from a macro.
00128     if (string("UserCanvas") == name) return;
00129 
00130     menu->Add(name,retype_return<void>(bind(slot(*pd,&PageDisplay::AddPage),name,tf)));
00131 }
00132 
00133 
00134 void PageDisplay::SetupMenus()
00135 {
00136     fMenuBar = manage(new GuiMenuBar(*this));
00137     this->Add(*fMenuBar);
00138 
00139     GuiMenu* file_menu = manage(new GuiMenu);
00140     fMenuBar->AddMenu(*file_menu,"File");
00141     file_menu->Add("Open...",slot(*this,&PageDisplay::OpenFile));
00142     file_menu->Add("Load Lib...",slot(*this,&PageDisplay::LoadLib));
00143     file_menu->Add("Print...",slot(*this,&PageDisplay::PrintDisplay));
00144     file_menu->Add("Close",close_window.slot());
00145     file_menu->Add("Quit",bind(slot(die_die_die),this));
00146 
00147     GuiMenu* pages_menu = manage(new GuiMenu);
00148     fMenuBar->AddMenu(*pages_menu,"Pages");
00149     
00150     GuiMenu* add_pages_menu = manage(new GuiMenu);
00151     pages_menu->Add("Add page",*add_pages_menu);
00152     GuiMenu* spawn_pages_menu = manage(new GuiMenu);
00153     pages_menu->Add("Spawn page",*spawn_pages_menu);
00154 
00155     vector<const char*> page_names = PageProxyBase::GetRegisteredNames();
00156     for (unsigned int ind = 0; ind < page_names.size(); ++ind) {
00157         add_to_page_menu(page_names[ind],add_pages_menu,this,true);
00158         add_to_page_menu(page_names[ind],spawn_pages_menu,this,false);
00159     }
00160     PageProxyBase::page_added.connect(bind(bind(bind(slot(add_to_page_menu),true),this),add_pages_menu));
00161     PageProxyBase::page_added.connect(bind(bind(bind(slot(add_to_page_menu),false),this),spawn_pages_menu));
00162     pages_menu->Add(0);
00163 
00164     GuiMenu* view_menu = manage(new GuiMenu);
00165     fMenuBar->AddMenu(*view_menu,"Views");
00166     view_menu->Add("3D Geometry",slot(*this,&PageDisplay::DrawGeometry));    
00167     view_menu->Add("Digit text",slot(*this,&PageDisplay::MakeDigitText));
00168     view_menu->Add("Time hist",slot(*this,&PageDisplay::MakeTimeHist));
00169     view_menu->Add("Pmt Pixels",slot(*this,&PageDisplay::MakePmtPixels));
00170     view_menu->Add("MC text",slot(*this,&PageDisplay::MakeMCText));
00171     view_menu->Add("MC tree",slot(*this,&PageDisplay::MakeMCTree));
00172     view_menu->Add("MC vectors",slot(*this,&PageDisplay::MakeMCVectors));
00173 
00174     GuiMenu* settings_menu = manage(new GuiMenu);
00175     fMenuBar->AddMenu(*settings_menu,"Settings");
00176     settings_menu->Add("Candidate Names",slot(*this,&PageDisplay::CandidateNames));
00177 
00178     GuiMenu* zoom_menu = manage(new GuiMenu);
00179     fMenuBar->AddMenu(*zoom_menu,"Zoom");
00180     zoom_menu->Add("Undo",slot(*this,&PageDisplay::Unzoom));
00181     zoom_menu->Add("Redo",slot(*this,&PageDisplay::Rezoom));
00182     zoom_menu->Add("Auto",slot(*this,&PageDisplay::AutoZoom));
00183     zoom_menu->Add("Full",slot(*this,&PageDisplay::FullZoom));
00184 }
00185 
00186 GuiMenuBar& PageDisplay::GetMenuBar()
00187 {
00188     assert(fMenuBar);
00189     return *fMenuBar;
00190 }
00191 static void handle_free_run(PageDisplay* pd, GuiTextButton* but)
00192 {
00193     TString label = but->GetString();
00194     if (label == "Free Running") {
00195         label = "Stop Running";
00196         but->SetText(label);
00197         pd->GetMint()->SetFreeRunning(true);
00198     }
00199     else {
00200         label = "Free Running";
00201         but->SetText(label);
00202         pd->GetMint()->SetFreeRunning(false);
00203     }
00204 }
00205 static void handle_pause_entry(PageDisplay* pd, GuiTextEntry* ent)
00206 {
00207     Long_t ms = atoi(ent->GetText());
00208     pd->GetMint()->SetPause(ms);
00209 }
00210 void PageDisplay::SetupButtons()
00211 {
00212     GuiTextButton* but;
00213     GuiTextEntry* ent;
00214 
00215     but = this->AddButton("Next -->");
00216     but->clicked.connect(slot_class(*fMint,&Mint::Next));
00217 
00218     but = this->AddButton("<-- Prev");
00219     but->clicked.connect(slot_class(*fMint,&Mint::Prev));
00220 
00221     but = this->AddButton("NextPass -->");
00222     but->clicked.connect(slot_class(*fMint,&Mint::NextPass));
00223 
00224     but = this->AddButton("Free Running");
00225     but->clicked.connect(bind(slot(handle_free_run),this,but));
00226 
00227     ent = this->AddEntry("0");
00228     ent->activated.connect(bind(slot(handle_pause_entry),this,ent));
00229 
00230 }
00231 
00232 void PageDisplay::SetupSliders()
00233 {
00234     fTimeSlider = manage(new GuiSlider(*this,kHorizontalFrame));
00235     this->Add(*fTimeSlider);
00236     fTimeSlider->UseRange(fMint->GetTimeRange());
00237     fTimeSlider->UseExtrema(fMint->GetTimeExtrema());
00238 }
00239 GuiSlider& PageDisplay::GetTimeSlider()
00240 {
00241     assert(fTimeSlider);
00242     return *fTimeSlider;
00243 }
00244 
00245 GuiTextButton* PageDisplay::AddButton(const char* text)
00246 {
00247     GuiMainWindow* mw = fBBox->GetMainWindow();
00248     if (!mw) { 
00249         cerr << "PageDisplay::AddButton: can't get main window\n";
00250         return 0;
00251     }
00252     int width = mw->GetWidth();
00253     int height = mw->GetHeight();
00254 
00255     GuiTextButton* b = manage(new GuiTextButton(*fBBox,text));
00256     b->SetLayoutHints(kLHintsExpandX);
00257     fBBox->Add(*b);
00258     fButtonMap[text] = b;
00259     
00260     mw->ShowAll();
00261     mw->Resize(width,height);
00262     return b;
00263 }
00264 GuiTextButton* PageDisplay::GetButton(const char* text)
00265 {
00266     ButtonMap_t::iterator mit = fButtonMap.find(text);
00267     if (mit == fButtonMap.end()) return 0;
00268     return mit->second;
00269 }
00270 GuiTextEntry* PageDisplay::AddEntry(const char* init_text)
00271 {
00272     GuiMainWindow* mw = fBBox->GetMainWindow();
00273     if (!mw) { 
00274         cerr << "PageDisplay::AddButton: can't get main window\n";
00275         return 0;
00276     }
00277     int width = mw->GetWidth();
00278     int height = mw->GetHeight();
00279 
00280     GuiTextEntry* e = manage(new GuiTextEntry(*fBBox,init_text));
00281     e->SetLayoutHints(kLHintsExpandX);
00282     fBBox->Add(*e);
00283     
00284     mw->ShowAll();
00285     mw->Resize(width,height);
00286     return e;
00287 }
00288 
00289 TObject* PageDisplay::AddPage(const char* name, bool in_a_tab /*=true*/)
00290 {
00291     PageProxyBase* ppb = dynamic_cast<PageProxyBase*>
00292         (NamedFactory::Instance("Page").GetProxy(name));
00293     if (!ppb) {
00294         cerr << "Can't get page named: \"" << name << "\"\n";
00295         return 0;
00296     }
00297     if (in_a_tab) {
00298         PageABC* page = ppb->Create();
00299         GuiFrame* frame = fTabs->Add(name);
00300         GuiBox* box = manage(new GuiBox(*frame->GetFrame(), kVerticalFrame));
00301         frame->Add(*box);
00302 
00303         TObject* obj = page->Init(fMint,this,*box);
00304 
00305         fPageList.push_back(page);
00306         GuiMainWindow* mw = fTabs->GetMainWindow();
00307         assert(mw);
00308         mw->ShowAll();
00309         return obj;
00310     }
00311     else {
00312         using namespace SigC;
00313         int width=this->GetWidth(), height=this->GetHeight();
00314 
00315         GuiMainWindow* gmw = new GuiMainWindow(width-1,height-1);
00316         gmw->SetWindowName("PageDisplay");
00317         
00318         PageDisplay* pd = new PageDisplay(*gmw,fMint);
00319         gmw->Add(*pd);
00320         pd->close_window.connect(slot(*gmw,&GuiMainWindow::SendCloseMessage));
00321 
00322         return pd->AddPage(name,true);
00323     }
00324 }
00325 
00326 TObject* PageDisplay::SpawnSinglePage(const char* name, int width, int height)
00327 {
00328     PageProxyBase* ppb = dynamic_cast<PageProxyBase*>
00329         (NamedFactory::Instance("Page").GetProxy(name));
00330     if (!ppb) {
00331         cerr << "Can't get page named: \"" << name << "\"\n";
00332         return 0;
00333     }
00334     PageABC* page = ppb->Create();
00335     fSinglePageList.push_back(page);
00336 
00337     GuiMainWindow* gmw = new GuiMainWindow(width-1,height-1);
00338     gmw->SetWindowName(name);
00339     GuiBox* box = manage(new GuiBox(*gmw, kVerticalFrame));
00340     gmw->Add(*box);
00341     TObject* obj = page->Init(fMint,this,*box);
00342     gmw->ShowAll();
00343     return obj;
00344 }
00345 
00346 
00347 void PageDisplay::StatusBar(const char* msg)
00348 {
00349 //    cerr << "Status bar: \"" << msg << "\"\n";
00350     if (msg) fStatusBar->SetText(msg);
00351     else fStatusBar->SetText("");
00352 }
00353 void PageDisplay::ProcessEvents()
00354 {
00355     fClient->HandleInput();
00356 }
00357 void PageDisplay::ClearDisplay()
00358 {
00359     int siz = fPageList.size();
00360     for (int ind = 0; ind < siz; ++ind)  
00361         fPageList[ind]->Clear();
00362     siz = fSinglePageList.size();
00363     for (int ind = 0; ind < siz; ++ind)  
00364         fSinglePageList[ind]->Clear();
00365 }
00366 void PageDisplay::UpdateDisplay()
00367 {
00368     if (! fMint->GetDetector()) return;
00369 
00370     if (fRSEntry) fRSEntry->Update(fMint);
00371 
00372     if(fTabs) this->UpdateTab(fTabs->GetCurrent());
00373     for (unsigned int ind = 0; ind < fSinglePageList.size(); ++ind) {
00374         fSinglePageList[ind]->Update();
00375     }
00376     
00377     if (fTimeHist) fTimeHist->Refresh();
00378     if (fPmtPixels) fPmtPixels->Refresh();
00379     if (fMCText) fMCText->Update(fMint);
00380     if (fMCTree) fMCTree->Update(fMint);
00381     if (fMCVectors) fMCVectors->Update(fMint);
00382 }
00383 
00384 void PageDisplay::UpdateTab(int tab_id)
00385 {
00386     if (tab_id < 0 || tab_id >= (int)fPageList.size()) return;
00387     fPageList[tab_id]->Update();
00388 }
00389 
00390 void PageDisplay::Unzoom()
00391 {
00392   if(fTabs) {
00393     int cur = fTabs->GetCurrent();
00394     if (cur<0) return;
00395     fPageList[cur]->Unzoom();
00396   }
00397   for (unsigned int ind = 0; ind < fSinglePageList.size(); ++ind) {
00398     fSinglePageList[ind]->Unzoom();
00399   }
00400 }
00401 
00402 void PageDisplay::Rezoom()
00403 {
00404   if(fTabs) {
00405     int cur = fTabs->GetCurrent();
00406     if (cur<0) return;
00407     fPageList[cur]->Rezoom();
00408   }
00409   for (unsigned int ind = 0; ind < fSinglePageList.size(); ++ind) {
00410     fSinglePageList[ind]->Rezoom();
00411   }
00412 }
00413 
00414 void PageDisplay::FullZoom()
00415 {
00416   if(fTabs) {
00417     int cur = fTabs->GetCurrent();
00418     if (cur<0) return;
00419     fPageList[cur]->FullZoom();
00420   }
00421   for (unsigned int ind = 0; ind < fSinglePageList.size(); ++ind) {
00422     fSinglePageList[ind]->FullZoom();
00423   }
00424 }
00425 
00426 void PageDisplay::AutoZoom()
00427 {
00428   if(fTabs) {
00429     int cur = fTabs->GetCurrent();
00430     if (cur<0) return;
00431     fPageList[cur]->AutoZoom();
00432   }
00433   for (unsigned int ind = 0; ind < fSinglePageList.size(); ++ind) {
00434     fSinglePageList[ind]->AutoZoom();
00435   }
00436 }
00437 
00438 void PageDisplay::OpenFile() 
00439 {
00440     GuiMainWindow* gmw = this->GetMainWindow();
00441     if (!gmw) {
00442         cerr << "PageDisplay::OpenFile no main window\n";
00443         return;
00444     }
00445 
00446     const char* filetypes[] = { "Data files", "*.root",
00447                                 "All files",    "*",
00448                                 0,              0 };
00449     static TString dir(".");
00450     TGFileInfo fi;
00451     fi.fFileTypes = filetypes;
00452     fi.fIniDir = StrDup(dir);
00453     new TGFileDialog(gClient->GetRoot(), gmw, kFDOpen, &fi);
00454     dir = fi.fIniDir;
00455 
00456     cerr << "dir: " << dir << " file: " << fi.fFilename << endl;
00457 
00458     if (!fi.fFilename) {
00459         cerr << "open file aborted\n";
00460         return;
00461     }
00462 
00463     fMint->GetJobC().Input.AddFile(fi.fFilename);
00464 
00465 }
00466 void PageDisplay::LoadLib() 
00467 {
00468     GuiMainWindow* gmw = this->GetMainWindow();
00469     if (!gmw) {
00470         cerr << "PageDisplay::LoadLib no main window\n";
00471         return;
00472     }
00473 
00474     const char* filetypes[] = { "Library files", "*.so",
00475                                 "All files",    "*",
00476                                 0,              0 };
00477 
00478     // Use SRT_PUBLIC_CONTEXT/lib/SRT_SUBDIR as starting dir
00479     const char* spc = gSystem->Getenv("SRT_PUBLIC_CONTEXT");
00480     const char* ssd = gSystem->Getenv("SRT_SUBDIR");
00481     static TString dir = (spc&&ssd) ? Form("%s/lib/%s",spc,ssd) : ".";
00482         
00483     TGFileInfo fi;
00484     fi.fFileTypes = filetypes;
00485     fi.fIniDir = StrDup(dir);
00486     new TGFileDialog(gClient->GetRoot(), gmw, kFDOpen, &fi);
00487     dir = fi.fIniDir;
00488 
00489     cerr << "dir: " << dir << " file: " << fi.fFilename << endl;
00490 
00491     if (!fi.fFilename) {
00492         cerr << "open file aborted\n";
00493         return;
00494     }
00495 
00496     gSystem->Load(fi.fFilename);
00497 }
00498 
00499 void PageDisplay::PrintDisplay() 
00500 {
00501   if(fTabs) this->PrintTab(fTabs->GetCurrent());
00502   for (unsigned int ind = 0; ind < fSinglePageList.size(); ++ind) {
00503     fSinglePageList[ind]->Print();
00504   }
00505 }
00506 void PageDisplay::PrintTab(int tab_id) const
00507 {
00508     if (tab_id < 0 || tab_id >= (int)fPageList.size()) return;
00509     fPageList[tab_id]->Print();
00510 }
00511 
00512 DigitText* PageDisplay::GetDigitText()
00513 {
00514     return fDigitText;
00515 }
00516 
00517 void PageDisplay::DrawGeometry()
00518 {
00519     UgliGeomHandle ugh = fMint->GetUgliGeomHandle();
00520     ugh.Draw();
00521 }
00522 
00523 
00524 template<class TYPE> void killer(TYPE* obj) { delete obj; }
00525 
00526 void PageDisplay::MakeDigitText()
00527 {
00528     if (fDigitText) return;
00529 
00530     GuiMainWindow* gmw = new GuiMainWindow(300,300); // no delete
00531     GuiTextView* gtv = manage(new GuiTextView(*gmw,300,300)); // no delete
00532     gmw->Add(*gtv);
00533 
00534     fDigitText = new DigitText(gtv);
00535     gmw->close_window.connect(bind(slot(&killer<DigitText>),fDigitText));
00536 
00537     gmw->ShowAll();
00538     gmw->ConnectClose();
00539 }
00540 void PageDisplay::MakeMCText()
00541 {
00542     if (fMCText) return;
00543 
00544     GuiMainWindow* gmw = new GuiMainWindow(300,300); // no delete
00545     GuiTextView* gtv = manage(new GuiTextView(*gmw,300,300)); // no delete
00546     gmw->Add(*gtv);
00547 
00548     fMCText = manage(new MCText(gtv));
00549     gmw->close_window.connect(bind(slot(&killer<MCText>),fMCText));
00550 
00551     gmw->ShowAll();
00552     gmw->ConnectClose();
00553     fMCText->Update(fMint);
00554 }
00555 void PageDisplay::MakeMCTree()
00556 {
00557     if (fMCTree) return;
00558 
00559     GuiMainWindow* gmw = new GuiMainWindow(200,400); // no delete
00560 
00561     GuiScrolled* scrolled = manage(new GuiScrolled(*gmw));
00562     scrolled->SetLayoutHints(kLHintsExpandX | kLHintsExpandY);
00563     gmw->Add(*scrolled);
00564 
00565     GuiTree* gt = manage(new GuiTree(*scrolled->GetViewPort()));
00566     scrolled->Add(*gt);
00567     gt->SetCanvas(scrolled);
00568 
00569     fMCTree = manage(new MCTree(gt));
00570     gmw->close_window.connect(bind(slot(&killer<MCTree>),fMCTree));
00571 
00572     gmw->ShowAll();
00573     gmw->ConnectClose();
00574     fMCTree->Update(fMint);
00575 }
00576 void PageDisplay::MakeMCVectors()
00577 {
00578     if (fMCVectors) return;
00579 
00580     GuiMainWindow* gmw = new GuiMainWindow(300,300); // no delete
00581 
00582     GuiCanvas* can = manage(new GuiCanvas(*gmw,300,300));
00583     can->SetLayoutHints(kLHintsExpandX|kLHintsExpandY);
00584     gmw->Add(*can);
00585 
00586     can->GetCanvas()->cd();
00587     fMCVectors = new MCVectors(0,0,1,1);
00588 
00589     gmw->close_window.connect(bind(slot(&killer<MCTree>),fMCTree));
00590 
00591     gmw->ShowAll();
00592     gmw->ConnectClose();
00593     fMCVectors->Update(fMint);
00594 }
00595 
00596 void PageDisplay::MakePmtPixels()
00597 {
00598     if (fPmtPixels) return;
00599     const int hsiz = 200;
00600     GuiMainWindow* gmw = new GuiMainWindow(hsiz,hsiz); // no delete
00601     GuiCanvas* gc = manage(new GuiCanvas(*gmw,hsiz,hsiz));
00602     gmw->Add(*gc);
00603     fPmtPixels = new PmtPixels(0,0,1,1);
00604     gc->GetCanvas()->cd();
00605     fPmtPixels->Draw();
00606     fPmtPixels->SetMint(fMint);
00607     gc->GetCanvas()->cd();
00608     gmw->ShowAll();
00609     gmw->ConnectClose();
00610     fPmtPixels->Refresh();
00611 }
00612 
00613 void PageDisplay::MakeTimeHist()
00614 {
00615     if (fTimeHist) return;
00616 
00617     const int hsiz = 200;
00618     GuiMainWindow* gmw = new GuiMainWindow(hsiz,hsiz); // no delete
00619     GuiCanvas* gc = manage(new GuiCanvas(*gmw,hsiz,hsiz));
00620     gmw->Add(*gc);
00621 
00622     TCanvas* canvas = gc->GetCanvas();
00623     canvas->cd();
00624 
00625     fTimeHist = new TimeHist();
00626     fTimeHist->SetMint(fMint);
00627     fTimeHist->Draw();
00628 
00629     gPad = 0;
00630 
00631     gmw->ShowAll();
00632     gmw->ConnectClose();
00633     fTimeHist->Refresh();
00634 }
00635 
00636 void apply_reg_gui(PageDisplay* pd, RegistryGui* rg)
00637 {
00638     Registry& reg = pd->GetMint()->GetCandidateLookup();
00639     reg = rg->GetRegistry();
00640     pd->ClearDisplay();
00641     pd->UpdateDisplay();
00642 }
00643 
00644 void PageDisplay::CandidateNames()
00645 {
00646     RegistryDialog rd;
00647     rd.fRegistryGui->SetRegistry(fMint->GetCandidateLookup());
00648     rd.fOkay->clicked.connect(bind(slot(apply_reg_gui),this,rd.fRegistryGui));
00649     rd.fApply->clicked.connect(bind(slot(apply_reg_gui),this,rd.fRegistryGui));
00650     rd.Spawn();
00651 }
00652 
00653 void PageDisplay::UpdateGui()
00654 {
00655     GuiMainWindow* gmw = this->GetMainWindow();
00656     assert(gmw);
00657     gmw->Layout();
00658 }

Generated on Mon Nov 23 05:27:55 2009 for loon by  doxygen 1.3.9.1