TridPageDisplay Class Reference

#include <TridPageDisplay.h>

Inheritance diagram for TridPageDisplay:
PageDisplay GuiBox GuiCompositeFrameBase GuiBase

List of all members.

Public Member Functions

 TridPageDisplay (TGWindow &parent, Mint *mint)
virtual ~TridPageDisplay ()
virtual TObject * MySpawnSinglePage (const char *name, int width=640, int height=480)
virtual void RemovePage (PageABC *page)
virtual void BuildGUI (const PageDisplayConfig &cfg)
virtual void SetupMenus ()
virtual void SetupButtons ()
virtual void SetAutoRun (Bool_t on=true)
virtual void SetAutoTime (Float_t seconds=10.0)
void AutoTimeEntryHandler ()
void JumpEntryHandler ()
void RunSnarlEntryHandler ()

Public Attributes

SigC::Signal0< void > fNextSignal
SigC::Signal0< void > fNextPassSignal
SigC::Signal0< void > fPrevSignal

Private Member Functions

 ClassDef (TridPageDisplay, 0)

Private Attributes

Float_t fAutoAdvanceTime
GuiTextEntryfAutoTimeEntry
GuiTextEntryfRunEntry
GuiTextEntryfSnarlEntry
GuiTextEntryfJumpEntry
GuiTextButtonfAutoButton

Detailed Description

Definition at line 5 of file TridPageDisplay.h.


Constructor & Destructor Documentation

TridPageDisplay::TridPageDisplay ( TGWindow &  parent,
Mint mint 
)

Definition at line 81 of file TridPageDisplay.cxx.

References Msg::kDebug, and MSG.

00081                                                                :
00082   PageDisplay(parent,mint),
00083   fAutoAdvanceTime(20)
00084 {
00085   MSG("TriD",Msg::kDebug) << "Running TridPageDisplay::Constructor()\n";
00086 } 

TridPageDisplay::~TridPageDisplay ( void   )  [virtual]

Definition at line 88 of file TridPageDisplay.cxx.

00089 {
00090 }


Member Function Documentation

void TridPageDisplay::AutoTimeEntryHandler (  ) 

Definition at line 266 of file TridPageDisplay.cxx.

References fAutoTimeEntry, and SetAutoTime().

Referenced by BuildGUI().

00267 {
00268   const char* txt = fAutoTimeEntry->GetText();
00269   if ( txt != 0 && std::string(txt) != "" ) {
00270     SetAutoTime(atof(txt));
00271   }
00272 }

void TridPageDisplay::BuildGUI ( const PageDisplayConfig cfg  )  [virtual]

Reimplemented from PageDisplay.

Definition at line 92 of file TridPageDisplay.cxx.

References GuiTextEntry::activated, GuiCompositeFrameBase::Add(), AutoTimeEntryHandler(), fAutoAdvanceTime, fAutoTimeEntry, PageDisplay::fBBox, fJumpEntry, Form(), fRunEntry, fSnarlEntry, PageDisplay::fStatusBar, PageDisplay::fTabs, GuiBox::GuiBox(), JumpEntryHandler(), Msg::kDebug, MSG, RunSnarlEntryHandler(), GuiTab::selected, GuiBase::SetLayoutHints(), SetupButtons(), SetupMenus(), and PageDisplay::UpdateTab().

00093 {
00094     MSG("TriD",Msg::kDebug) << "Running TridPageDisplay::BuildGUI()\n";
00095     // MENU
00096     this->SetupMenus();
00097 
00098     // Boxes:
00099     GuiBox* vbox = manage(new GuiBox(*this,kVerticalFrame));
00100     this->Add(*vbox);
00101 
00102     // RSE
00103     GuiHBox* hbox = manage(new GuiHBox(*vbox));
00104     vbox->Add(*hbox);
00105     GuiLabel* lab;
00106 
00107     lab = manage(new GuiLabel(*hbox,"Advance Time:"));
00108     hbox->Add(*lab);
00109     fAutoTimeEntry = manage(new GuiTextEntry(*hbox,Form("%f.0",fAutoAdvanceTime)));
00110     hbox->Add(*fAutoTimeEntry);
00111     fAutoTimeEntry->activated.connect
00112       (slot(*this,&TridPageDisplay::AutoTimeEntryHandler));
00113 
00114     lab = manage(new GuiLabel(*hbox,"Jump snarls:"));
00115     hbox->Add(*lab);
00116     fJumpEntry = manage(new GuiTextEntry(*hbox,""));
00117     hbox->Add(*fJumpEntry);
00118     fJumpEntry->activated.connect
00119       (slot(*this,&TridPageDisplay::JumpEntryHandler));
00120 
00121     lab = manage(new GuiLabel(*hbox,"Run:"));
00122     hbox->Add(*lab);
00123     fRunEntry = manage(new GuiTextEntry(*hbox,""));
00124     hbox->Add(*fRunEntry);
00125     fRunEntry->activated.connect
00126       (slot(*this,&TridPageDisplay::RunSnarlEntryHandler));
00127 
00128     lab = manage(new GuiLabel(*hbox,"Snarl:"));
00129     hbox->Add(*lab);
00130     fSnarlEntry = manage(new GuiTextEntry(*hbox,""));
00131     hbox->Add(*fSnarlEntry);
00132     fSnarlEntry->activated.connect
00133       (slot(*this,&TridPageDisplay::RunSnarlEntryHandler));
00134     
00135    
00136 
00137     // Button box
00138     fBBox = manage(new GuiBox(*vbox,kHorizontalFrame));
00139     fBBox->SetLayoutHints(kLHintsExpandX);
00140     vbox->Add(*fBBox);
00141     this->SetupButtons();
00142 
00143     // Tabs
00144     fTabs = manage(new GuiTab(*vbox));
00145     vbox->Add(*fTabs);
00146     fTabs->selected.connect(slot(*this,&PageDisplay::UpdateTab));
00147 
00148     // Sliders
00149     //this->SetupSliders();
00150 
00151     // status bar
00152     fStatusBar = manage(new GuiStatusBar(*this));
00153     this->Add(*fStatusBar);
00154 
00155 }

TridPageDisplay::ClassDef ( TridPageDisplay  ,
 
) [private]
void TridPageDisplay::JumpEntryHandler (  ) 

Definition at line 274 of file TridPageDisplay.cxx.

References fJumpEntry, PageDisplay::fMint, Mint::GetJint(), Jint::Next(), and Jint::Prev().

Referenced by BuildGUI().

00275 {
00276   const char* txt = fJumpEntry->GetText();
00277   if ( txt != 0 && std::string(txt) != "" ) {
00278     int jumpi = atoi(fJumpEntry->GetText());
00279     if(jumpi >0)     fMint->GetJint().Next(jumpi);
00280     else if(jumpi<0) fMint->GetJint().Prev(-jumpi);
00281   }
00282 }

TObject * TridPageDisplay::MySpawnSinglePage ( const char *  name,
int  width = 640,
int  height = 480 
) [virtual]

Definition at line 304 of file TridPageDisplay.cxx.

References GuiCompositeFrameBase::Add(), GuiMainWindow::close_window, GuiMainWindow::ConnectClose(), PageProxyBase::Create(), PageDisplay::fMint, Form(), PageDisplay::fSinglePageList, NamedFactory::GetProxy(), GuiBox::GuiBox(), PageABC::Init(), NamedFactory::Instance(), Msg::kDebug, Msg::kWarning, MSG, RemovePage(), root(), GuiMainWindow::ShowAll(), and PageABC::Update().

Referenced by my_add_to_window_menu().

00305 {
00306     MSG("TriD",Msg::kDebug) << "TridPageDisplay::SpawnSinglePage\n";
00307     PageProxyBase* ppb = dynamic_cast<PageProxyBase*>
00308         (NamedFactory::Instance("Page").GetProxy(name));
00309     if (!ppb) {
00310         MSG("TriD",Msg::kWarning) << "Can't get page named: \"" << name << "\"\n";
00311         return 0;
00312     }
00313     PageABC* page = ppb->Create();
00314     fSinglePageList.push_back(page);
00315 
00316     MSG("TriD",Msg::kDebug) << "Adding page @ " << page << endl;
00317     // Load the geometry info, if any.
00318     Int_t x,y;
00319     UInt_t w = width;
00320     UInt_t h = height;
00321     TEnv env(".tridrc");  
00322     TString newname(name);
00323     newname.ReplaceAll(" ","_");
00324     const char* value = env.GetValue(Form("Trid.WindowGeom.%s",newname.Data()),
00325                                      "");
00326     MSG("TriD",Msg::kDebug) << "Looking for " << newname << "  got " << value << endl;
00327     if(strlen(value)>0) {
00328       sscanf(value,"%ux%u+%d+%d",&w,&h,&x,&y);      
00329     }
00330 
00331     MSG("TriD",Msg::kDebug) << "Making gui window with dimensions " << w << "  " << h << endl;
00332     GuiMainWindow* gmw = new GuiMainWindow(w,h);
00333     gmw->SetWindowName(name);
00334     GuiBox* box = manage(new GuiBox(*gmw, kVerticalFrame));
00335     gmw->Add(*box);
00336     
00337 
00338     gmw->ShowAll();
00339 
00340     // Locate the outermost part of the window.
00341     Window_t wind = (Window_t)((gmw->GetId()));
00342     Window_t root = (Window_t)gClient->GetRoot()->GetId();
00343     Window_t frame = wind;
00344     Window_t parent = wind;
00345     while( (parent != root) && (parent) ) {
00346       frame = parent;
00347       parent = gVirtualX->GetParent(parent);
00348     }
00349     WindowAttributes_t attr;
00350     gVirtualX->GetWindowAttributes(frame,attr);
00351     x = attr.fX;
00352     y = attr.fY;
00353     w = attr.fWidth;
00354     h = attr.fHeight;
00355     
00356     if(strlen(value)>0) {
00357       sscanf(value,"%ux%u+%d+%d",&w,&h,&x,&y);      
00358       MSG("TriD",Msg::kDebug) << "----> Got Value " << value << endl;
00359       gVirtualX->MoveResizeWindow(frame,x,y,w,h);
00360     }
00361 
00362     MSG("TriD",Msg::kDebug) << "Restoring geometry " << Form("Trid.WindowGeom.%s",newname.Data())
00363                             << endl;
00364 
00365     TObject* obj = page->Init(fMint,this,*box);
00366     //gmw->ShowAll();
00367 
00368     gmw->close_window.connect(bind(slot_class(*this,&TridPageDisplay::RemovePage),page));
00369     gmw->ConnectClose(true);
00370 
00371     page->Update();
00372 
00373     return obj;
00374 }

void TridPageDisplay::RemovePage ( PageABC page  )  [virtual]

Definition at line 376 of file TridPageDisplay.cxx.

References PageDisplay::fPageList, PageDisplay::fSinglePageList, it, Msg::kDebug, and MSG.

Referenced by MySpawnSinglePage().

00377 {
00378   MSG("TriD",Msg::kDebug) << "TridPageDisplay::RemovePage() called " << page << "\n";
00379   if(!page) return;
00380 
00381   for( PageList_t::iterator it = fPageList.begin(); it != fPageList.end(); it++) {
00382     if(*it == page) {
00383       MSG("TriD",Msg::kDebug) << "Deleteing page.\n";
00384       fPageList.erase(it,it+1);
00385       delete page;      
00386       return;
00387     }
00388   }
00389   for( PageList_t::iterator it = fSinglePageList.begin(); it != fSinglePageList.end(); it++) {
00390     if(*it == page) {
00391       MSG("TriD",Msg::kDebug) << "Deleteing page.\n";
00392       fSinglePageList.erase(it,it+1);
00393       delete page;      
00394       return;
00395     }
00396   }
00397  
00398 }

void TridPageDisplay::RunSnarlEntryHandler (  ) 

Definition at line 284 of file TridPageDisplay.cxx.

References PageDisplay::fMint, fRunEntry, fSnarlEntry, Mint::GetJint(), Jint::GoTo(), and run().

Referenced by BuildGUI().

00285 {
00286   if (!fMint) return;
00287 
00288   string run = fRunEntry->GetText();
00289   string snarl = fSnarlEntry->GetText();
00290   
00291   if (run == "" || snarl == "" || run == " " || snarl == " ") {
00292     cerr << "Both run and snarl must be set to jump to record\n";
00293     return;
00294   }
00295 
00296   int runi = atoi(run.c_str());
00297   int snarli = atoi(snarl.c_str());
00298   
00299   fMint->GetJint().GoTo(runi,snarli);
00300 }

void TridPageDisplay::SetAutoRun ( Bool_t  on = true  )  [virtual]

Definition at line 243 of file TridPageDisplay.cxx.

References fAutoAdvanceTime, fAutoButton, AutoEventTimer::fAutoNextDelay, and gAutoTimer.

Referenced by toggle_free_run().

00244 {
00245   if(on) {
00246     
00247     fAutoButton->SetText("Stop Auto");
00248     gAutoTimer.fAutoNextDelay = fAutoAdvanceTime;
00249     gAutoTimer.Start((Long_t)(gAutoTimer.fAutoNextDelay*1000.),true);
00250     gAutoTimer.TurnOn();
00251   } else {
00252     fAutoButton->SetText("Start Auto");
00253     gAutoTimer.TurnOff();
00254   }
00255 }

void TridPageDisplay::SetAutoTime ( Float_t  seconds = 10.0  )  [virtual]

Definition at line 258 of file TridPageDisplay.cxx.

References fAutoAdvanceTime, AutoEventTimer::fAutoNextDelay, fAutoTimeEntry, Form(), and gAutoTimer.

Referenced by AutoTimeEntryHandler().

00259 {
00260   fAutoAdvanceTime = t;
00261   fAutoTimeEntry->SetText(Form("%.1f",t));
00262   gAutoTimer.fAutoNextDelay = t;
00263 }

void TridPageDisplay::SetupButtons (  )  [virtual]

Reimplemented from PageDisplay.

Definition at line 212 of file TridPageDisplay.cxx.

References PageDisplay::AddButton(), PageDisplay::AutoZoom(), GuiButtonBase::clicked, fAutoButton, fNextSignal, fPrevSignal, PageDisplay::FullZoom(), and toggle_free_run().

Referenced by BuildGUI().

00213 {
00214     GuiTextButton* but;
00215 
00216     but = this->AddButton("Start Auto");
00217     but->clicked.connect(bind(slot(toggle_free_run),this,but));
00218     fAutoButton = but;
00219 
00220    // but = this->AddButton("Next Pass ->");
00221     //but->clicked.connect(fNextPassSignal);
00222 
00223     but = this->AddButton("Next -->");
00224     but->clicked.connect(fNextSignal);
00225 
00226     but = this->AddButton("<-- Prev");
00227     but->clicked.connect(fPrevSignal);
00228 
00229     but = this->AddButton("Zoom Auto");
00230     but->clicked.connect(slot(*this,&PageDisplay::AutoZoom));
00231     
00232     but = this->AddButton("Zoom Full");
00233     but->clicked.connect(slot(*this,&PageDisplay::FullZoom));
00234 
00235     //but = this->AddButton("Zoom Undo");
00236     //but->clicked.connect(slot(*this,&PageDisplay::Unzoom));
00237 
00238     //but = this->AddButton("Zoom Redo");
00239     //but->clicked.connect(slot(*this,&PageDisplay::Rezoom));
00240 
00241 }

void TridPageDisplay::SetupMenus (  )  [virtual]

Reimplemented from PageDisplay.

Definition at line 171 of file TridPageDisplay.cxx.

References GuiCompositeFrameBase::Add(), GuiMenu::Add(), GuiMenuBar::AddMenu(), PageDisplay::AutoZoom(), PageDisplay::close_window, die_die_die(), PageDisplay::DrawGeometry(), PageDisplay::fMenuBar, PageDisplay::FullZoom(), PageProxyBase::GetRegisteredNames(), Msg::kDebug, PageDisplay::LoadLib(), PageDisplay::MakeDigitText(), PageDisplay::MakeMCText(), PageDisplay::MakeMCTree(), PageDisplay::MakePmtPixels(), PageDisplay::MakeTimeHist(), MSG, my_add_to_window_menu(), PageDisplay::OpenFile(), PageProxyBase::page_added, Lit::Print(), PageDisplay::Rezoom(), and PageDisplay::Unzoom().

Referenced by BuildGUI().

00172 {
00173     MSG("TriD",Msg::kDebug) << "Running TridPageDisplay::SetupMenus()\n";
00174     fMenuBar = manage(new GuiMenuBar(*this));
00175     this->Add(*fMenuBar);
00176 
00177     GuiMenu* file_menu = manage(new GuiMenu);
00178     fMenuBar->AddMenu(*file_menu,"File");
00179     file_menu->Add("Open...",slot(*this,&PageDisplay::OpenFile));
00180     file_menu->Add("Load Lib...",slot(*this,&PageDisplay::LoadLib));
00181     file_menu->Add("Print...",bind(slot(*this,&PageDisplay::Print),""));
00182     file_menu->Add("Close",close_window.slot());
00183     file_menu->Add("Quit",slot(die_die_die));
00184 
00185     GuiMenu* pages_menu = manage(new GuiMenu);
00186     fMenuBar->AddMenu(*pages_menu,"Windows");
00187     
00188     vector<const char*> page_names = PageProxyBase::GetRegisteredNames();
00189     for (unsigned int ind = 0; ind < page_names.size(); ++ind) {
00190         my_add_to_window_menu(page_names[ind],pages_menu,this);
00191     }
00192     PageProxyBase::page_added.connect(bind(bind(slot(my_add_to_window_menu),this),pages_menu));
00193     pages_menu->Add(0);
00194 
00195     GuiMenu* view_menu = manage(new GuiMenu);
00196     fMenuBar->AddMenu(*view_menu,"Views");
00197     view_menu->Add("3D Geometry",slot(*this,&PageDisplay::DrawGeometry));    
00198     view_menu->Add("Digit text",slot(*this,&PageDisplay::MakeDigitText));
00199     view_menu->Add("Time hist",slot(*this,&PageDisplay::MakeTimeHist));
00200     view_menu->Add("Pmt Pixels",slot(*this,&PageDisplay::MakePmtPixels));
00201     view_menu->Add("MC text",slot(*this,&PageDisplay::MakeMCText));
00202     view_menu->Add("MC tree",slot(*this,&PageDisplay::MakeMCTree));
00203 
00204     GuiMenu* zoom_menu = manage(new GuiMenu);
00205     fMenuBar->AddMenu(*zoom_menu,"Zoom");
00206     zoom_menu->Add("Undo",slot(*this,&PageDisplay::Unzoom));
00207     zoom_menu->Add("Redo",slot(*this,&PageDisplay::Rezoom));
00208     zoom_menu->Add("Auto",slot(*this,&PageDisplay::AutoZoom));
00209     zoom_menu->Add("Full",slot(*this,&PageDisplay::FullZoom));
00210 }


Member Data Documentation

Definition at line 31 of file TridPageDisplay.h.

Referenced by BuildGUI(), SetAutoRun(), and SetAutoTime().

Definition at line 34 of file TridPageDisplay.h.

Referenced by SetAutoRun(), and SetupButtons().

Definition at line 32 of file TridPageDisplay.h.

Referenced by AutoTimeEntryHandler(), BuildGUI(), and SetAutoTime().

Definition at line 33 of file TridPageDisplay.h.

Referenced by BuildGUI(), and JumpEntryHandler().

SigC::Signal0<void> TridPageDisplay::fNextPassSignal

Definition at line 16 of file TridPageDisplay.h.

Referenced by TridSetup().

SigC::Signal0<void> TridPageDisplay::fNextSignal

Definition at line 15 of file TridPageDisplay.h.

Referenced by SetupButtons(), and TridSetup().

SigC::Signal0<void> TridPageDisplay::fPrevSignal

Definition at line 17 of file TridPageDisplay.h.

Referenced by SetupButtons(), and TridSetup().

Definition at line 33 of file TridPageDisplay.h.

Referenced by BuildGUI(), and RunSnarlEntryHandler().

Definition at line 33 of file TridPageDisplay.h.

Referenced by BuildGUI(), and RunSnarlEntryHandler().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1