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

GoToDialog.cxx

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include "EventDisplayBase/GoToDialog.h"
00009 #include <cstdlib>
00010 #include "TGLayout.h"
00011 #include "TGButton.h"
00012 #include "TGLabel.h"
00013 #include "TGTextEntry.h"
00014 #include "EventDisplayBase/evdb.h"
00015 #include "EventDisplayBase/IoModule.h"
00016 #include "EventDataModel/EventHandle.h"
00017 #include "EventDataModel/EventHeader.h"
00018 using namespace evdb;
00019 
00020 ClassImp(evdb::GoToDialog)
00021 
00022 //......................................................................
00023 
00024 static void GetEventNumbers(int& run, int& event) 
00025 {
00026   // Grad the header out of the event
00027   edm::EventHandle& evt  = IoModule::Instance()->GetEvent();
00028   edm::EventHeader& head = evt.Header();
00029   
00030   run   = head.Run();
00031   event = head.Event();
00032 }
00033 
00034 //......................................................................
00035 
00036 GoToDialog::GoToDialog() :
00037   TGTransientFrame(evdb::TopWindow(), evdb::TopWindow(), 500, 30, 0)
00038 {
00039 //======================================================================
00040 // Build the GoTo dialog
00041 //======================================================================
00042   int  run;
00043   int  event;
00044   char runtext[128];
00045   char eventtext[128];
00046   GetEventNumbers(run,event);
00047   sprintf(runtext,  "%d",run);
00048   sprintf(eventtext,"%d",event);
00049 
00050   this->Connect("CloseWindow()", "evdb::GoToDialog", this, "CloseWindow()");
00051 
00052   fF1 = new TGHorizontalFrame(this,60,20);
00053   fL1 = new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2);
00054   
00055   fRunLabel = new TGLabel(fF1, new TGHotString("[Run Event]="));
00056   fF1->AddFrame(fRunLabel, fL1);
00057   
00058   fRunTextEntry = new TGTextEntry(fF1, new TGTextBuffer(128));
00059   fRunTextEntry->SetText(runtext);
00060   fF1->AddFrame(fRunTextEntry, fL1);
00061   fRunTextEntry->Resize(100,20);
00062   fRunTextEntry->Connect("ReturnPressed()","evdb::GoToDialog",this,"DoGo()");
00063 
00064   fEventTextEntry = new TGTextEntry(fF1, new TGTextBuffer(128));
00065   fEventTextEntry->SetText(eventtext);
00066   fF1->AddFrame(fEventTextEntry, fL1);
00067   fEventTextEntry->Resize(100,20);
00068   fEventTextEntry->Connect("ReturnPressed()","evdb::GoToDialog",this,"DoGo()");
00069   
00070   fGoButton = new TGTextButton(fF1,"&Go",1);
00071   fGoButton->Connect("Clicked()", "evdb::GoToDialog", this, "DoGo()");
00072   fF1->AddFrame(fGoButton, fL1);
00073 
00074   fCloseButton = new TGTextButton(fF1,"&Close",1);
00075   fCloseButton->Connect("Clicked()", "evdb::GoToDialog", this, "DoClose()");
00076   fF1->AddFrame(fCloseButton, fL1);
00077 
00078   this->AddFrame(fF1, fL1);
00079 
00080   this->SetWindowName("Go To Event");
00081   this->MapSubwindows();
00082   this->Resize(382,30);
00083   this->MapWindow();
00084 }
00085 
00086 //......................................................................
00087 
00088 void GoToDialog::DoGo() 
00089 {
00090 //======================================================================-
00091 // Actually go to the event number typed
00092 //======================================================================-
00093   int run   = atoi(fRunTextEntry->GetText());
00094   int event = atoi(fEventTextEntry->GetText());
00095 
00096   IoModule::Instance()->GoTo(run,event);
00097 }
00098 
00099 //......................................................................
00100 
00101 GoToDialog::~GoToDialog() 
00102 {
00103   delete fCloseButton;
00104   delete fGoButton;
00105   delete fEventTextEntry;
00106   delete fRunTextEntry;
00107   delete fRunLabel;
00108   delete fL1;
00109   delete fF1;
00110 }
00111 
00112 //......................................................................
00113 
00114 void GoToDialog::CloseWindow() { delete this; }
00115 
00116 //......................................................................
00117 
00118 void GoToDialog::DoClose() { this->SendCloseMessage(); }
00119 

Generated on Mon Dec 1 02:35:18 2008 for NOvA Offline by  doxygen 1.3.9.1