001 #include "FMExportButton.h"
002
003 #ifdef WIN32
004 #include <Riostream.h>
005 #else
006 #include <iostream.h>
007 #endif
008
009 #include <TCanvas.h>
010 #include <TGFileDialog.h>
011
012 #include "IDetectorView.h"
013
014 using std::cout;
015 using std::endl;
016
017 FMExportButton::FMExportButton(IDisplayFrame* parentFrame):
018 m_parentFrame(parentFrame)
019 {
020 TGVerticalFrame* fToolFrame = m_parentFrame->modulesFrame();
021 TGHorizontalFrame *fExportButtonFrame = new TGHorizontalFrame(fToolFrame,0,0, kHorizontalFrame);
022
023 TGTextButton* fSaveAsButton = new TGTextButton(fExportButtonFrame, "&Save As");
024 fExportButtonFrame->AddFrame(fSaveAsButton, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 2, 2, 2, 2));
025 fSaveAsButton->Connect("Clicked()", "FMExportButton", this, "OnSaveAs()");
026
027 TGTextButton* fPrintButton = new TGTextButton(fExportButtonFrame, "&Print");
028 fExportButtonFrame->AddFrame(fPrintButton, new TGLayoutHints(kLHintsLeft | kLHintsTop| kLHintsExpandX, 2, 2, 2, 2));
029 fPrintButton->Connect("Clicked()", "FMExportButton", this, "OnPrint()");
030
031 fToolFrame->AddFrame(fExportButtonFrame, new TGLayoutHints(kLHintsLeft | kLHintsBottom | kLHintsExpandX));
032 }
033
034 FMExportButton::~FMExportButton(void) {
035
036 }
037
038 void FMExportButton::OnSaveAs()
039 {
040 const char *ed_filetypes[] = {
041
042 "Encapsulated PostScript","*.eps",
043 "GIF","*.gif",
044 "ROOT macros","*.C",
045 "All files", "*",
046 0, 0
047 };
048
049 TCanvas* pCanvas = (TCanvas*) m_parentFrame->detectorView()->canvas();
050
051 TGFileInfo fi;
052 fi.fFileTypes = ed_filetypes;
053
054 new TGFileDialog(gClient->GetDefaultRoot(), 0, kFDSave, &fi);
055 if (fi.fFilename && strlen(fi.fFilename)) {
056 std::string strfilename = fi.fFilename;
057 pCanvas->SaveAs(strfilename.c_str());
058 cout<<"Canvas saved as "<< strfilename.c_str() <<endl;
059 }
060 }
061
062 void FMExportButton::OnPrint()
063 {
064 cout<<"FMExportButton::OnPrint() not implemented yet"<<endl;
065 }
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|