#include "TridSetup.h"#include "TridPageDisplay.h"#include "TridControl.h"#include <TEnv.h>#include <TSystem.h>#include "Midad/Gui/GuiMainWindow.h"#include "MessageService/MsgService.h"#include "sigc++/sigc++.h"#include "sigc++/class_slot.h"#include "sigc++/slot.h"Go to the source code of this file.
Functions | |
| CVSID ("$Id: TridSetup.cxx,v 1.12 2007/06/06 05:16:49 rhatcher Exp $") | |
| void | SaveControlWindow (TEnv &env) |
| void | RestoreControlWindow (TEnv &env) |
| void | TridSetup (JobC &jc) |
Variables | |
| Mint * | gMint = NULL |
| PageDisplay * | gPageDisplay = NULL |
| GuiMainWindow * | gPageDisplayWindow = NULL |
|
||||||||||||
|
|
|
|
Definition at line 73 of file TridSetup.cxx. References Form(), gPageDisplayWindow, and MSG. Referenced by TridSetup(). 00074 {
00075 MSG("TriD",Msg::kDebug) << "Calling RestoreControlWindow()" << endl;
00076 // This bit of code picks up and moves the main window
00077 // to where it's been defined to be by the user.
00078 // Move the window appropriately.
00079 if(gPageDisplayWindow==NULL) {
00080 MSG("TriD",Msg::kWarning) << "Trid control window doesn't exist!" << endl;
00081 return;
00082 }
00083 Int_t x,y;
00084 UInt_t w,h;
00085 TString newname(gPageDisplayWindow->GetWindowName());
00086 newname.ReplaceAll(" ","_");
00087 const char* value = env.GetValue(Form("Trid.WindowGeom.%s",newname.Data()),"");
00088
00089 if(strlen(value)>0) {
00090 // Locate the outermost part of the window.
00091 Window_t wind = (Window_t)((gPageDisplayWindow->GetId()));
00092 Window_t frame = wind;
00093 // Makes it not work.
00094 //Window_t root = (Window_t)gClient->GetRoot()->GetId();
00095 //Window_t parent = wind;
00096 //while( (parent != root) && (parent) ) {
00097 // frame = parent;
00098 // parent = gVirtualX->GetParent(parent);
00099 //}
00100 WindowAttributes_t attr;
00101 gVirtualX->GetWindowAttributes(frame,attr);
00102 x = attr.fX;
00103 y = attr.fY;
00104 w = attr.fWidth;
00105 h = attr.fHeight;
00106
00107 sscanf(value,"%ux%u+%d+%d",&w,&h,&x,&y);
00108 MSG("TriD",Msg::kDebug) << "----> Got Value " << value << endl;
00109 if(w<20) w = 100;
00110 if(h<20) h = 100;
00111 gVirtualX->MoveResizeWindow(frame,x,y,w,h);
00112 }
00113
00114 }
|
|
|
Definition at line 29 of file TridSetup.cxx. References Form(), gPageDisplayWindow, and MSG. Referenced by TridSetup(). 00030 {
00031 MSG("TriD",Msg::kDebug) << "Calling SaveControlWindow()" << endl;
00032
00033 if(gPageDisplayWindow==NULL) {
00034 MSG("TriD",Msg::kWarning) << "Trid control window doesn't exist!" << endl;
00035 return;
00036 }
00037 // This bit of code saves the control window info to a file.
00038 TString newname(gPageDisplayWindow->GetWindowName());
00039 newname.ReplaceAll(" ","_");
00040
00041 Int_t x,y;
00042 UInt_t w,h;
00043
00044 Window_t wind = (Window_t)(gVirtualX->GetParent(gPageDisplayWindow->GetId()));
00045 Window_t frame = wind;
00046 // This is what makes it not work. No idea why.
00047 //Window_t root = (Window_t)gClient->GetRoot()->GetId();
00048 //Window_t parent = wind;
00049 //while( (parent != root) && (parent) ) {
00050 // frame = parent;
00051 // parent = gVirtualX->GetParent(parent);
00052 // }
00053 WindowAttributes_t attr;
00054 gVirtualX->GetWindowAttributes(frame,attr);
00055 x = attr.fX;
00056 y = attr.fY;
00057 w = attr.fWidth;
00058 h = attr.fHeight;
00059 //cout << "XWinAttributes (frame)" << attr.fX << " " << attr.fY << endl;
00060
00061 env.SetValue(
00062 Form("Trid.WindowGeom.%s",newname.Data()),
00063 Form("%dx%d+%d+%d",w,h,x,y),
00064 kEnvChange);
00065 MSG("TriD",Msg::kDebug)
00066 << "Setting env variable: "
00067 << Form("Trid.WindowGeom.%s",newname.Data())
00068 << "\t=\t"
00069 << Form("%dx%d+%d+%d",w,h,x,y)
00070 << endl;
00071 }
|
|
|
Global function to set up TriD. Does all the hard work for you. Definition at line 117 of file TridSetup.cxx. References GuiCompositeFrameBase::Add(), PageDisplay::AddPage(), PageDisplay::close_window, GuiMainWindow::ConnectClose(), TridPageDisplay::fNextPassSignal, TridPageDisplay::fNextSignal, TridPageDisplay::fPrevSignal, TridControl::fSignal_RestoreWindowGeometry, TridControl::fSignal_SaveWindowGeometry, PageDisplay::FullZoom(), Mint::GetJint(), gMint, gPageDisplay, gPageDisplayWindow, gSystem(), PageDisplay::Init(), TridControl::Instance(), jc, Jint::mom_modified, RestoreControlWindow(), TridControl::RestoreWindowGeometries(), SaveControlWindow(), GuiMainWindow::ShowAll(), and tc. 00118 {
00119 // Create a mint.
00120 if(gMint) delete gMint;
00121 gMint = new Mint(jc);
00122
00123 // Create a window.
00124 if(gPageDisplayWindow) delete gPageDisplayWindow;
00125 gPageDisplayWindow = new GuiMainWindow(500,400);
00126 gPageDisplayWindow->SetWindowName("TriD Minos Event Display");
00127
00128
00129 // Put a page display in it.
00130 if(gPageDisplay) delete gPageDisplay;
00131 TridPageDisplay* pd = new TridPageDisplay(*gPageDisplayWindow, gMint);
00132 gPageDisplay = pd;
00133
00134
00135 // Set up the hooks.
00136 pd->Init();
00137 pd->close_window.connect(slot(*gPageDisplayWindow,&GuiMainWindow::SendCloseMessage));
00138 //pd->fNextSignal.connect(SigC::slot(&DoNext));
00139 //pd->fNextSignal.connect(SigC::slot(&DoPrev));
00140 pd->fNextSignal. connect(SigC::slot_class(*gMint,&Mint::Next));
00141 pd->fNextPassSignal.connect(SigC::slot_class(*gMint,&Mint::NextPass));
00142 pd->fPrevSignal. connect(SigC::slot_class(*gMint,&Mint::Prev));
00143
00144 // Important only for Brett's stuff:
00145 //gMint->GetJint().mom_modified.connect(slot(*gMint,&GMint::NewMom));
00146
00147 // General:
00148 gMint->GetJint().mom_modified.connect(slot_class(*(PageDisplay*)pd,
00149 &PageDisplay::ClearDisplay));
00150 gMint->GetJint().mom_modified.connect(slot_class(*(PageDisplay*)pd,
00151 &PageDisplay::UpdateDisplay));
00152
00153 pd->AddPage("EventInfoPage",true);
00154 pd->AddPage("SelectionInfoPage",true);
00155
00156
00157 // Blit the window.
00158 gPageDisplayWindow->Add(*pd);
00159 gPageDisplayWindow->ShowAll();
00160 gPageDisplayWindow->ConnectClose(true);
00161
00162 //
00163 // Next, spawn pages according to the defaults we know.
00164 //
00165 const char* filename = gSystem->Getenv("TRID_CONFIG_FILE");
00166 if(filename ==0) filename = ".tridrc";
00167
00168 TEnv env(filename);
00169 const char* windowlist = env.GetValue("Trid.DefaultWindows","");
00170 // split the line.
00171 char windownames[10][100];
00172 int num = sscanf(windowlist,"%99s %99s %99s %99s %99s %99s %99s %99s %99s %99s",
00173 windownames[0],windownames[1],
00174 windownames[2],windownames[3],
00175 windownames[4],windownames[5],
00176 windownames[6],windownames[7],
00177 windownames[8],windownames[9]);
00178 for(int i=0;i<num;i++) {
00179 pd->MySpawnSinglePage(windownames[i]);
00180 }
00181
00182
00183 //
00184 // Finally, tell all the windows to move themselves to the correct
00185 // locations to make it pretty.
00186 //
00187 static SigC::Ptr<TridControl> tc = TridControl::Instance(pd);
00188
00189 //... including the control window.
00190 tc->fSignal_SaveWindowGeometry.connect (SigC::slot(&SaveControlWindow));
00191 tc->fSignal_RestoreWindowGeometry.connect(SigC::slot(&RestoreControlWindow));
00192
00193 // Do the restoration.
00194 tc->RestoreWindowGeometries();
00195 RestoreControlWindow(env);
00196
00197 // Zoom to default position
00198 pd->FullZoom();
00199 }
|
|
|
Definition at line 20 of file TridSetup.cxx. |
|
|
Definition at line 23 of file TridSetup.cxx. Referenced by TridSetup(). |
|
|
Definition at line 26 of file TridSetup.cxx. Referenced by RestoreControlWindow(), SaveControlWindow(), and TridSetup(). |
1.3.9.1