13 #include <TApplication.h>
17 #include <TGFileDialog.h>
18 #include <TGPicture.h>
19 #include <TGTextEntry.h>
20 #include <TRootEmbeddedCanvas.h>
23 #include "ImageExportCuts.xpm"
24 #include "ImageGoToPlots.xpm"
25 #include "ImageNameLarge.xpm"
26 #include "ImageNewWindow.xpm"
27 #include "ImagePlotsList.xpm"
28 #include "ImageQuit.xpm"
29 #include "ImageSaveCanvas.xpm"
30 #include "ImageSetupWindow.xpm"
40 TGHorizontalFrame(p, w, h),
43 SetCleanup(kDeepCleanup);
45 fNameButton =
new TGPictureButton(
this, gClient->GetPicturePool()->GetPicture(
"NameLarge", (
char**)ImageNameLarge));
46 AddFrame(
fNameButton,
new TGLayoutHints(kLHintsCenterY, 0, 0, 0, 0));
48 fNameButton->Connect(
"Clicked()",
"QGCanvasWindowButtonsFrame",
this,
"HandleNameButton()");
51 AddFrame(
fNameEntryBox,
new TGLayoutHints(kLHintsCenterY, 0, 15, 0, 0));
53 fNameEntryBox->SetToolTipText(
"Enter a new name for the window and press Return. Leave blank to cancel.");
54 fNameEntryBox->Connect(
"ReturnPressed()",
"QGCanvasWindowButtonsFrame",
this,
"HandleNameEntryBox()");
56 fSetupWindowButton =
new TGPictureButton(
this, gClient->GetPicturePool()->GetPicture(
"SetupWindow", (
char**)ImageSetupWindow));
58 fSetupWindowButton->SetToolTipText(
"Go to the setup window to open and close files or save the session");
59 fSetupWindowButton->Connect(
"Clicked()",
"QGCanvasWindowButtonsFrame",
this,
"HandleSetupWindowButton()");
61 fSaveCanvasButton =
new TGPictureButton(
this, gClient->GetPicturePool()->GetPicture(
"SaveCanvas", (
char**)ImageSaveCanvas));
64 fSaveCanvasButton->Connect(
"Clicked()",
"QGCanvasWindowButtonsFrame",
this,
"HandleSaveCanvasButton()");
66 fPlotsListButton =
new TGPictureButton(
this, gClient->GetPicturePool()->GetPicture(
"PlotsList", (
char**)ImagePlotsList));
69 fPlotsListButton->Connect(
"Clicked()",
"QGCanvasWindowButtonsFrame",
this,
"HandlePlotsListButton()");
71 fNewWindowButton =
new TGPictureButton(
this, gClient->GetPicturePool()->GetPicture(
"NewWindow", (
char**)ImageNewWindow));
74 fNewWindowButton->Connect(
"Clicked()",
"QGCanvasWindowButtonsFrame",
this,
"HandleNewWindowButton()");
76 fExportCutsButton =
new TGPictureButton(
this, gClient->GetPicturePool()->GetPicture(
"ExportCuts", (
char**)ImageExportCuts));
79 fExportCutsButton->Connect(
"Clicked()",
"QGCanvasWindowButtonsFrame",
this,
"HandleExportCutsButton()");
81 fGoToPlotsButton =
new TGPictureButton(
this, gClient->GetPicturePool()->GetPicture(
"GoToPlots", (
char**)ImageGoToPlots));
84 fGoToPlotsButton->Connect(
"Clicked()",
"QGCanvasWindowButtonsFrame",
this,
"HandleGoToPlotsButton()");
86 fQuitButton =
new TGPictureButton(
this, gClient->GetPicturePool()->GetPicture(
"Quit", (
char**)ImageQuit));
87 AddFrame(
fQuitButton,
new TGLayoutHints(kLHintsCenterY, 0, 0, 0, 0));
89 fQuitButton->Connect(
"Clicked()",
"QGCanvasWindowButtonsFrame",
this,
"HandleQuitButton()");
145 gApplication->Terminate(0);
151 TString dir(canvasDirectory.c_str());
153 fi.fIniDir = StrDup(dir);
154 const char *fileTypes[] = {
"Encapsulated Postscript" ,
"*.eps",
155 "Portable Document Format" ,
"*.pdf",
156 "Portable Network Graphics" ,
"*.png",
157 "ROOT Macro" ,
"*.C",
158 "Scalable Vector Graphics" ,
"*.svg",
160 fi.fFileTypes = fileTypes;
161 new TGFileDialog(gClient->GetRoot(), 0, kFDSave, &fi);
163 TString filename(fi.fFilename);
164 TString extension(fi.fFileTypes[fi.fFileTypeIdx+1]);
165 extension.Remove(TString::kLeading,
'*');
166 if (!filename.EndsWith(extension)) {
167 filename.Append(extension);
170 string currentDirectory = fi.fIniDir;
171 if (currentDirectory != canvasDirectory) {
Window containing a ROOT canvas.
void DisplayPlotFrame()
Display the plot frame.
QGPlotFrame * GetPlotFrame()
Get pointer to the plot frame.
void DisplaySetupFrame()
Display the setup frame.
Window used to manage writing cuts to a file.
const std::string & GetSaveCanvasDirectory()
Get save canvas directory.
void SetSaveCanvasDirectory(const std::string &directory)
Set save canvas directory.
static QGDefaultsHandler * Instance()
Singleton.
TRootEmbeddedCanvas * GetEmbeddedCanvas()
Get pointer to canvas.
static void ShowPlotsList()
Show plots list.
static void UpdateWindowDropDownBoxes()
Update window drop down boxes.
virtual void SetWindowName(const char *name=0)
Set name of window.
std::string Resize(const std::string &s, size_t len)
resize a string to len, adding spaces if necessary