#include <PrintDialog.h>
Public Member Functions | |
| PrintDialog () | |
| ~PrintDialog () | |
| void | CloseWindow () |
| void | Print () |
| void | Cancel () |
Private Attributes | |
| TGCompositeFrame * | fPrintFrame [10] |
| TGCheckButton * | fPrintableCB [10] |
| TGTextEntry * | fFilename [10] |
| TGCheckButton * | fDoEPS [10] |
| TGCheckButton * | fDoPS [10] |
| TGCheckButton * | fDoGIF [10] |
| TGCheckButton * | fDoJPG [10] |
| TGCompositeFrame * | fButtonFrame |
| TGTextButton * | fPrintButton |
| TGTextButton * | fCancelButton |
| TGLayoutHints * | fL1 |
| TGLayoutHints * | fL2 |
| int | fNprintable |
| std::string | fPrintTag [10] |
| Printable * | fPrintable [10] |
|
|
Definition at line 32 of file PrintDialog.cxx. References edm::EventHeader::Event(), fButtonFrame, fCancelButton, fDoEPS, fDoGIF, fDoJPG, fDoPS, fFilename, fL1, fL2, fNprintable, fPrintable, fPrintableCB, fPrintButton, fPrintFrame, fPrintTag, gsFormatSelection, gsPrintableSelection, edm::EventHeader::Run(), and evdb::TopWindow().
00032 : 00033 TGTransientFrame(evdb::TopWindow(),evdb::TopWindow(),500,300,0), 00034 fNprintable(0) 00035 { 00036 fL1 = new TGLayoutHints(kLHintsLeft|kLHintsTop|kLHintsExpandX, 2, 2, 2, 2); 00037 fL2 = new TGLayoutHints(kLHintsLeft|kLHintsTop, 2, 2, 2, 2); 00038 00039 // Add list of printable object to dialog box. Make a check box for 00040 // each one: 00041 // 00042 // Description | Filename Format 00043 // ----------------| ------------------------------------------------- 00044 // [*] Main window | evd.main.001234.000123456 [ ].eps [ ].ps [*].gif 00045 // [*] TPC display | evd.tpc.001234.000123456 [ ].eps [ ].ps [*].gif 00046 // 00047 int wPrintable = 50; // Width of description field 00048 int wFilename = 200; // Width of filename field 00049 int wCheckBox = 100; // Width of check boxes 00050 int h = 20; // Height of fields 00051 int i = 0; // Counter 00052 std::map<std::string,Printable*>& 00053 printables = Printable::GetPrintables(); 00054 std::map<std::string,Printable*>::iterator itr(printables.begin()); 00055 std::map<std::string,Printable*>::iterator itrEnd(printables.end()); 00056 for (; itr!=itrEnd; ++itr) { 00057 fPrintTag[i] = itr->first; 00058 fPrintable[i] = itr->second; 00059 fPrintFrame[i] = new TGHorizontalFrame(this,20,20); 00060 00061 std::string ptag; 00062 std::string base; 00063 std::string filename; 00064 base = "evd."; 00065 base += itr->second->PrintTag(); 00066 00067 char runevt[128]; 00068 edm::EventHeader& head = IoModule::Instance()->GetEvent().Header(); 00069 sprintf(runevt,".%.5d.%.9d",head.Run(),head.Event()); 00070 base += runevt; 00071 00072 // Title of the printable object 00073 fPrintableCB[i] = new TGCheckButton(fPrintFrame[i], itr->first.c_str()); 00074 fPrintableCB[i]->Resize(wPrintable, h); 00075 fPrintFrame[i]->AddFrame(fPrintableCB[i], fL1); 00076 if (gsPrintableSelection[fPrintTag[i]]) { 00077 fPrintableCB[i]->SetState(kButtonDown); 00078 } 00079 00080 // Base file name to use during print 00081 fFilename[i] = new TGTextEntry(fPrintFrame[i], new TGTextBuffer(256)); 00082 fFilename[i]->SetToolTipText("Base file name for print"); 00083 fFilename[i]->SetText(base.c_str()); 00084 fFilename[i]->Resize(wFilename,h); 00085 fPrintFrame[i]->AddFrame(fFilename[i], fL2); 00086 00087 // PS check box 00088 fDoPS[i] = new TGCheckButton(fPrintFrame[i], ".ps"); 00089 fDoPS[i]->Resize(wCheckBox,h); 00090 fPrintFrame[i]->AddFrame(fDoPS[i], fL2); 00091 ptag = fPrintTag[i]; ptag += ".ps"; 00092 if (gsFormatSelection[ptag]) fDoPS[i]->SetState(kButtonDown); 00093 00094 // EPS check box 00095 fDoEPS[i] = new TGCheckButton(fPrintFrame[i], ".eps"); 00096 fDoEPS[i]->Resize(wCheckBox,h); 00097 fPrintFrame[i]->AddFrame(fDoEPS[i], fL2); 00098 ptag = fPrintTag[i]; ptag += ".eps"; 00099 if (gsFormatSelection[ptag]) fDoEPS[i]->SetState(kButtonDown); 00100 00101 // GIF check box 00102 fDoGIF[i] = new TGCheckButton(fPrintFrame[i], ".gif"); 00103 fDoGIF[i]->Resize(wCheckBox,h); 00104 fPrintFrame[i]->AddFrame(fDoGIF[i], fL2); 00105 ptag = fPrintTag[i]; ptag += ".gif"; 00106 if (gsFormatSelection[ptag]) fDoGIF[i]->SetState(kButtonDown); 00107 00108 // JPG check box 00109 fDoJPG[i] = new TGCheckButton(fPrintFrame[i], ".jpg"); 00110 fDoJPG[i]->Resize(wCheckBox,h); 00111 fPrintFrame[i]->AddFrame(fDoJPG[i], fL2); 00112 ptag = fPrintTag[i]; ptag += ".jpg"; 00113 if (gsFormatSelection[ptag]) fDoJPG[i]->SetState(kButtonDown); 00114 00115 ++i; 00116 } 00117 fNprintable = i; 00118 00119 // Build the button frame along the bottom 00120 fButtonFrame = new TGHorizontalFrame(this,20,20); 00121 00122 fPrintButton = new TGTextButton(fButtonFrame,"&Print",150); 00123 fPrintButton->Connect("Clicked", "evdb::PrintDialog", this, "Print()"); 00124 fButtonFrame->AddFrame(fPrintButton, 00125 new TGLayoutHints(kLHintsLeft,4,4,4,4)); 00126 00127 fCancelButton = new TGTextButton(fButtonFrame,"&Cancel",150); 00128 fCancelButton->Connect("Clicked", "evdb::PrintDialog", this, "Cancel()"); 00129 fButtonFrame->AddFrame(fCancelButton, 00130 new TGLayoutHints(kLHintsRight,4,4,4,4)); 00131 00132 // Layout the main frame 00133 for (int i=0; i<fNprintable; ++i) this->AddFrame(fPrintFrame[i],fL1); 00134 this->AddFrame(fButtonFrame); 00135 this->MapSubwindows(); 00136 this->Resize(500, fNprintable*(h+8)+38); 00137 00138 this->SetWindowName("Print Dialog"); 00139 this->MapWindow(); 00140 00141 this->Connect("CloseWindow","evdb::PrintDialog",this,"CloseWindow()"); 00142 } |
|
|
Definition at line 150 of file PrintDialog.cxx. References fButtonFrame, fCancelButton, fDoEPS, fDoGIF, fDoJPG, fDoPS, fFilename, fL1, fL2, fNprintable, fPrintableCB, fPrintButton, and fPrintFrame.
00151 {
00152 for (int i=0; i<fNprintable; ++i) {
00153 delete fDoJPG[i];
00154 delete fDoGIF[i];
00155 delete fDoEPS[i];
00156 delete fDoPS[i];
00157 delete fFilename[i];
00158 delete fPrintableCB[i];
00159 delete fPrintFrame[i];
00160 }
00161 delete fPrintButton;
00162 delete fCancelButton;
00163 delete fButtonFrame;
00164 delete fL1;
00165 delete fL2;
00166 }
|
|
|
Definition at line 170 of file PrintDialog.cxx. Referenced by Print().
00170 { this->SendCloseMessage(); }
|
|
|
Definition at line 146 of file PrintDialog.cxx.
00146 { delete this; }
|
|
|
Definition at line 174 of file PrintDialog.cxx. References Cancel(), fDoEPS, fDoGIF, fDoJPG, fDoPS, fFilename, fNprintable, fPrintable, fPrintableCB, fPrintTag, gsFormatSelection, gsPrintableSelection, and evdb::Printable::Print().
00175 {
00176 int nFormats = 4;
00177 std::string format[4] = { ".ps", ".eps", ".gif", ".jpg" };
00178 bool doPrint[4];
00179
00180 for (int i=0; i<fNprintable; ++i) {
00181 bool printMe = (fPrintableCB[i]->GetState() == kButtonDown);
00182
00183 // Remember which printables are selected for use next time
00184 gsPrintableSelection[fPrintTag[i]] = printMe;
00185
00186 // Handle the print
00187 if (printMe) {
00188 std::string base = fFilename[i]->GetText();
00189
00190 doPrint[0] = (fDoPS[i]->GetState() == kButtonDown);
00191 doPrint[1] = (fDoEPS[i]->GetState() == kButtonDown);
00192 doPrint[2] = (fDoGIF[i]->GetState() == kButtonDown);
00193 doPrint[3] = (fDoJPG[i]->GetState() == kButtonDown);
00194 for (int j=0; j<nFormats; ++j) {
00195 // Printable tag (with format) and file name
00196 std::string ftag(fPrintTag[i]); ftag += format[j];
00197 std::string f(base); f += format[j];
00198
00199 // Remember format choices for next time
00200 gsFormatSelection[ftag] = doPrint[j];
00201
00202 // Actually do the print
00203 if (doPrint[j]) {
00204 fPrintable[i]->Print(f.c_str());
00205 }
00206
00207 } // Loop on formats
00208 } // If printable is checked
00209 } // Loop on printables
00210
00211 // Done printing. Cancel the window
00212 this->Cancel();
00213 }
|
|
|
Definition at line 42 of file PrintDialog.h. Referenced by PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 44 of file PrintDialog.h. Referenced by PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 37 of file PrintDialog.h. Referenced by Print(), PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 39 of file PrintDialog.h. Referenced by Print(), PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 40 of file PrintDialog.h. Referenced by Print(), PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 38 of file PrintDialog.h. Referenced by Print(), PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 36 of file PrintDialog.h. Referenced by Print(), PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 46 of file PrintDialog.h. Referenced by PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 47 of file PrintDialog.h. Referenced by PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 49 of file PrintDialog.h. Referenced by Print(), PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 51 of file PrintDialog.h. Referenced by Print(), and PrintDialog(). |
|
|
Definition at line 35 of file PrintDialog.h. Referenced by Print(), PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 43 of file PrintDialog.h. Referenced by PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 34 of file PrintDialog.h. Referenced by PrintDialog(), and ~PrintDialog(). |
|
|
Definition at line 50 of file PrintDialog.h. Referenced by Print(), and PrintDialog(). |
1.3.5