Changeset 7001 for trunk/MagicSoft
- Timestamp:
- 05/09/05 10:15:41 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 6 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7000 r7001 21 21 22 22 -*-*- END OF LINE -*-*- 23 2005/05/09 Thomas Bretz 24 25 * callisto.cc, ganymed.cc, mars.cc, merpp.cc, readdaq.cc, 26 readraw.cc, showplot.cc, sinope.cc, sponde.cc, star.cc: 27 - changed order of initialization such that a real NULL 28 output is possible 29 - changed TApplication name from upper to lower case 30 - in some applications replaced manual setup of gLog with 31 gLog.Setup 32 33 * showlog.cc: 34 - improved alorithm 35 36 * showplot.cc: 37 - implemented Print options 38 39 * mbase/MLog.[h,cc]: 40 - fixed a bug which caused output in NULL output 41 - added Getter IsNullOutput 42 43 * mbase/MStatusDisplay.[h,cc]: 44 - implemented PDF and SVG printing 45 - moved "Save As Something" to new submenu 46 - fixed and improved printing 47 - implemented PrintDialog for printing 48 - implemented printing of log (untested) 49 - allow saving by extension (line Print() in root): SaveAs 50 51 * mfileio/MWriteRootFile.h: 52 - replaced BIT(17) by BIT(23) to improve compatibility with 53 root 4.04/00 and upcomming versions 54 55 * mhflux/Makefile, mjobs/MJCut.cc: 56 - replaced MTheta by MThetaSq to get rid of a problem 57 with the automatic naming of the binning (BinningTheta) 58 59 * mhist/MHCamera.[h,cc]: 60 - fixed a workaround (it has been fixed in root 4.04/00) 61 - allow setting the palette through the Draw-option. This allows 62 storage of the palette 63 - removed fColor. The palette is now diretly set though gStyle in 64 Paint 65 66 * mjobs/MJOptimize.cc: 67 - restore null output correctly after eventloop 68 69 * mjobs/MJSpectrum.cc: 70 - renamed Hist and HistOff to HistE and HistEOff 71 - added binnings M3Long and Conc1 72 73 23 74 24 75 2005/05/06 Thomas Bretz -
trunk/MagicSoft/Mars/NEWS
r6989 r7001 51 51 this variable (one is already existing: MHTheta, which is now the 52 52 default in ganymed). It is setup through ganymed.rc 53 54 - Improved support for printing in status display: 55 + A default can now be set in .rootrc (for more details see 56 MStatusDisplay::PrintPS) 57 + A print dialog is opened so that printer and command line 58 can be canged 59 60 - improved showplot 61 + The new graphics formats have been implemented 62 (pdf, svg, png, jpg and xpm) 63 + Implemented an interface for printing. Because you can change 64 the printing command from the command line you can use all 65 the nice postscript tool. To print a booklet for example call: 66 showplot -b --print --print-cmd="cat %f" filename.root | lpr 67 showplot -b --print --print-cmd="psbook %f | psnup -2 | lpr" filename.root 68 showplot -b --null --print --print-cmd="psbook %f" filename.root > book.ps 69 70 - The storage of the palette in MHCamera is now possible 53 71 54 72 -
trunk/MagicSoft/Mars/callisto.cc
r6979 r7001 142 142 int main(int argc, char **argv) 143 143 { 144 // 145 // Evaluate arguments 146 // 147 MArgs arg(argc, argv, kTRUE); 148 gLog.Setup(arg); 149 144 150 StartUpMessage(); 145 146 //147 // Evaluate arguments148 //149 MArgs arg(argc, argv, kTRUE);150 151 151 152 if (arg.HasOnly("-V") || arg.HasOnly("--version")) … … 157 158 return 2; 158 159 } 159 160 gLog.Setup(arg);161 160 162 161 const TString kConfig = arg.GetStringAndRemove("--config=", "callisto.rc"); … … 322 321 MParContainer::Class()->IgnoreTObjectStreamer(); 323 322 324 TApplication app(" Callisto", &argc, argv);323 TApplication app("callisto", &argc, argv); 325 324 if (!gROOT->IsBatch() && !gClient || gROOT->IsBatch() && !kBatch) 326 325 { -
trunk/MagicSoft/Mars/ganymed.cc
r6979 r7001 89 89 int main(int argc, char **argv) 90 90 { 91 // 92 // Evaluate arguments 93 // 94 MArgs arg(argc, argv, kTRUE); 95 gLog.Setup(arg); 96 91 97 StartUpMessage(); 92 93 //94 // Evaluate arguments95 //96 MArgs arg(argc, argv, kTRUE);97 98 98 99 if (arg.HasOnly("-V") || arg.HasOnly("--version")) … … 104 105 return 2; 105 106 } 106 107 gLog.Setup(arg);108 107 109 108 const TString kConfig = arg.GetStringAndRemove("--config=", "ganymed.rc"); … … 204 203 MParContainer::Class()->IgnoreTObjectStreamer(); 205 204 206 TApplication app(" Ganymed", &argc, argv);205 TApplication app("ganymed", &argc, argv); 207 206 if (!gROOT->IsBatch() && !gClient || gROOT->IsBatch() && !kBatch) 208 207 { -
trunk/MagicSoft/Mars/mars.cc
r6888 r7001 69 69 gLog << "Sorry the usage is:" << endl; 70 70 gLog << " mars [-h] [-?] [-a0] [-vn]" << endl << endl; 71 gLog << " -a0: Do not use Ansii codes." << endl; 72 gLog << " -vn: Verbosity level n [default=2]" << endl; 71 gLog.Usage(); 73 72 gLog << " -?/-h: This help" << endl << endl; 74 73 } … … 76 75 int main(int argc, char **argv) 77 76 { 78 StartUpMessage();79 80 77 // 81 78 // Evaluate arguments 82 79 // 83 MArgs arg(argc, argv); 80 MArgs arg(argc, argv, kTRUE); 81 gLog.Setup(arg); 82 83 StartUpMessage(); 84 84 85 85 if (arg.HasOption("-?") || arg.HasOption("-h")) … … 88 88 return 2; 89 89 } 90 91 //92 // Set verbosity to highest level.93 //94 gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);95 96 if (arg.HasOption("-a") && arg.GetIntAndRemove("-a")==0)97 gLog.SetNoColors();98 90 99 91 #ifdef HAVE_XPM … … 105 97 // initialise ROOT 106 98 // 107 TApplication app(" Mars", &argc, argv);99 TApplication app("mars", &argc, argv); 108 100 if (gROOT->IsBatch() || !gClient) 109 101 { -
trunk/MagicSoft/Mars/mbase/MLog.cc
r5820 r7001 134 134 #endif 135 135 const char *const MLog::kBlue = "\033[34m"; 136 const char *const MLog::kUnderline = "\033[4m"; ;137 const char *const MLog::kBlink = "\033[5m"; ;138 const char *const MLog::kBright = "\033[1m"; ;139 const char *const MLog::kDark = "\033[2m"; ;136 const char *const MLog::kUnderline = "\033[4m"; 137 const char *const MLog::kBlink = "\033[5m"; 138 const char *const MLog::kBright = "\033[1m"; 139 const char *const MLog::kDark = "\033[2m"; 140 140 141 141 // … … 488 488 if (fDevice&eStdout) 489 489 { 490 if (! TestBit(eNoColors))490 if (!fIsNull && !TestBit(eNoColors)) 491 491 cout << kReset; 492 492 cout.flush(); -
trunk/MagicSoft/Mars/mbase/MLog.h
r5720 r7001 129 129 void operator=(TGTextView *out) { SetOutputGui(out); } 130 130 131 Bool_t IsNullOutput() const { return fIsNull; } 131 132 Bool_t IsOutputDeviceEnabled(int i) const { return fDevice & i; } 132 133 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r7000 r7001 33 33 // To write gif files of C-Macros use SaveAsGif()/SaveAsPNG() or SaveAsC(). 34 34 // Direct printing to the default printer (via lpr) can be done by 35 // Print ToLpr().35 // PrintPS(). 36 36 // 37 37 // It has also to half status lines which can be used to display the status … … 64 64 65 65 #include <TH1.h> // TH1::AddDirectory 66 #include <TPDF.h> // TPDF 67 #include <TSVG.h> // TSVG 66 68 #include <TEnv.h> // TEnv 67 69 #include <TLine.h> // TLine … … 74 76 #include <TDatime.h> // TDatime 75 77 #include <TRandom.h> // TRandom 78 #include <TRegexp.h> // TRegexp 76 79 #include <TThread.h> // TThread::Self() 77 80 #include <TBrowser.h> // TBrowser … … 80 83 #include <TMethodCall.h> // TMethodCall 81 84 82 //#include <TRint.h> // gApplication, TRint::Class()83 85 #include <TInterpreter.h> // gInterpreter 84 86 … … 92 94 #include <TGFileDialog.h> // TGFileDialog 93 95 #include <TGProgressBar.h> // TGHProgressBar 96 #include <TGTextEditDialogs.h> // TGPrintDialog 94 97 #include <TRootEmbeddedCanvas.h> // TRootEmbeddedCanvas 95 98 … … 245 248 // 246 249 MGPopupMenu *filemenu = new MGPopupMenu(gClient->GetRoot()); 247 // filemenu->AddEntry("Save &As...", kFileSaveAs); 248 filemenu->AddEntry("New Can&vas", kFileCanvas); 249 filemenu->AddEntry("New &Browser", kFileBrowser); 250 filemenu->AddEntry("New &Canvas", kFileCanvas); 251 filemenu->AddEntry("New &Browser", kFileBrowser); 250 252 filemenu->AddSeparator(); 251 filemenu->AddEntry("Save status.&ps", kFileSaveAsPS); 252 filemenu->AddEntry("Save status.&png", kFileSaveAsPNG); 253 filemenu->AddEntry("Save status.&gif", kFileSaveAsGIF); 254 filemenu->AddEntry("Save status.&jpg", kFileSaveAsJPG); 255 filemenu->AddEntry("Save status.&xpm", kFileSaveAsXPM); 256 filemenu->AddEntry("Save status.&C", kFileSaveAsC); 257 filemenu->AddEntry("Save status.&root", kFileSaveAsRoot); 253 254 const TString fname(MString::Form("Save %s.", gROOT->GetName())); 255 MGPopupMenu *savemenu = new MGPopupMenu(gClient->GetRoot()); 256 savemenu->AddEntry(MString::Form("%s&ps", fname.Data()), kFileSaveAsPS); 257 savemenu->AddEntry(MString::Form("%sp&df", fname.Data()), kFileSaveAsPDF); 258 savemenu->AddEntry(MString::Form("%s&svg", fname.Data()), kFileSaveAsSVG); 259 savemenu->AddSeparator(); 260 savemenu->AddEntry(MString::Form("%sp&ng", fname.Data()), kFileSaveAsPNG); 261 savemenu->AddEntry(MString::Form("%s&gif", fname.Data()), kFileSaveAsGIF); 262 savemenu->AddEntry(MString::Form("%s&jpg", fname.Data()), kFileSaveAsJPG); 263 savemenu->AddEntry(MString::Form("%s&xpm", fname.Data()), kFileSaveAsXPM); 264 //savemenu->AddEntry("Save status.x&cf", kFileSaveAsXCF); 265 //savemenu->AddEntry("Save status.&tiff", kFileSaveAsTIFF); 266 //savemenu->AddEntry("Save status.&bmp", kFileSaveAsBMP); 267 savemenu->AddSeparator(); 268 savemenu->AddEntry(MString::Form("%s&C", fname.Data()), kFileSaveAsC); 269 savemenu->AddEntry(MString::Form("%s&root", fname.Data()), kFileSaveAsRoot); 270 savemenu->Associate(this); 271 272 filemenu->AddEntry("&Open...", kFileOpen); 273 filemenu->AddPopup("&Save", savemenu); 274 filemenu->AddEntry("Save &As...", kFileSaveAs); 258 275 filemenu->AddSeparator(); 259 filemenu->AddEntry("&Open...", kFileOpen); 260 filemenu->AddEntry("Save &As...", kFileSaveAs); 276 filemenu->AddEntry("&Reset", kFileReset); 261 277 filemenu->AddSeparator(); 262 filemenu->AddEntry(" Re&set", kFileReset);278 filemenu->AddEntry("&Print", kFilePrint); 263 279 filemenu->AddSeparator(); 264 filemenu->AddEntry("Print with &lpr", kFilePrint); 265 //filemenu->AddEntry("Set printer &name", kFilePrinterName); 266 filemenu->AddSeparator(); 267 filemenu->AddEntry("C&lose", kFileClose); 268 filemenu->AddEntry("E&xit", kFileExit); 280 filemenu->AddEntry("C&lose", kFileClose); 281 filemenu->AddEntry("E&xit", kFileExit); 269 282 filemenu->Associate(this); 270 283 … … 273 286 // 274 287 MGPopupMenu *tabmenu = new MGPopupMenu(gClient->GetRoot()); 275 tabmenu->AddEntry("Next [&+]", 276 tabmenu->AddEntry("Previous [&-]", 288 tabmenu->AddEntry("Next [&+]", kTabNext); 289 tabmenu->AddEntry("Previous [&-]", kTabPrevious); 277 290 tabmenu->AddSeparator(); 278 tabmenu->AddEntry("Save tab-i.&ps", kTabSaveAsPS); 279 tabmenu->AddEntry("Save tab-i.&png", kTabSaveAsPNG); 280 tabmenu->AddEntry("Save tab-i.&gif", kTabSaveAsGIF); 281 tabmenu->AddEntry("Save tab-i.&jpg", kTabSaveAsJPG); 282 tabmenu->AddEntry("Save tab-i.&xpm", kTabSaveAsXPM); 283 tabmenu->AddEntry("Save tab-i.&C", kTabSaveAsC); 284 tabmenu->AddEntry("Save tab-i.&root", kTabSaveAsRoot); 291 292 const TString fname2(MString::Form("Save %s-i.", gROOT->GetName())); 293 MGPopupMenu *savemenu2 = new MGPopupMenu(gClient->GetRoot()); 294 savemenu2->AddEntry(MString::Form("%s&ps", fname2.Data()), kTabSaveAsPS); 295 savemenu2->AddEntry(MString::Form("%sp&df", fname2.Data()), kTabSaveAsPDF); 296 savemenu2->AddEntry(MString::Form("%s&svg", fname2.Data()), kTabSaveAsSVG); 297 savemenu2->AddSeparator(); 298 savemenu2->AddEntry(MString::Form("%sp&ng", fname2.Data()), kTabSaveAsPNG); 299 savemenu2->AddEntry(MString::Form("%s&gif", fname2.Data()), kTabSaveAsGIF); 300 savemenu2->AddEntry(MString::Form("%s&jpg", fname2.Data()), kTabSaveAsJPG); 301 savemenu2->AddEntry(MString::Form("%s&xpm", fname2.Data()), kTabSaveAsXPM); 302 //savemenu->AddEntry("Save status.x&cf", kFileSaveAsXCF); 303 //savemenu->AddEntry("Save status.&tiff", kFileSaveAsTIFF); 304 //savemenu->AddEntry("Save status.&bmp", kFileSaveAsBMP); 305 savemenu2->AddSeparator(); 306 savemenu2->AddEntry(MString::Form("%s&C", fname2.Data()), kTabSaveAsC); 307 savemenu2->AddEntry(MString::Form("%s&root", fname2.Data()), kTabSaveAsRoot); 308 savemenu2->Associate(this); 309 310 tabmenu->AddPopup("&Save", savemenu2); 311 tabmenu->AddEntry("Save tab &As...", kTabSaveAs); 285 312 tabmenu->AddSeparator(); 286 tabmenu->AddEntry(" Save tab &As...", kTabSaveAs);313 tabmenu->AddEntry("&Remove", kTabRemove); 287 314 tabmenu->AddSeparator(); 288 tabmenu->AddEntry("Re&move", kTabRemove); 289 tabmenu->AddSeparator(); 290 tabmenu->AddEntry("Print with &lpr", kTabPrint); 315 tabmenu->AddEntry("&Print", kTabPrint); 291 316 tabmenu->Associate(this); 292 317 … … 326 351 logmenu->AddEntry("&Save", kLogSave); 327 352 logmenu->AddEntry("Save &append", kLogAppend); 353 logmenu->AddSeparator(); 354 logmenu->AddEntry("&Print", kLogPrint); 328 355 logmenu->Associate(this); 329 356 … … 355 382 // Add everything to autodel list 356 383 // 384 fList->Add(savemenu); 385 fList->Add(savemenu2); 357 386 fList->Add(filemenu); 358 387 fList->Add(loopmenu); … … 1085 1114 } 1086 1115 1116 TString MStatusDisplay::PrintDialog(TString &p, TString &c, TString &t, const char *ext) 1117 { 1118 // If not in batch mode open a user dialog 1119 if (!gROOT->IsBatch()) 1120 { 1121 char *cprinter = StrDup(p); 1122 char *ccmd = StrDup(c); 1123 1124 Int_t rc=0; 1125 new TGPrintDialog(fClient->GetRoot(), this, 400, 150, &cprinter, &ccmd, &rc); 1126 if (rc) 1127 { 1128 p = cprinter; // default has been changed 1129 c = ccmd; 1130 } 1131 1132 delete [] cprinter; 1133 delete [] ccmd; 1134 1135 if (!rc) 1136 return ""; 1137 } 1138 1139 1140 if (c.Contains("%f") && ext) 1141 { 1142 // Get temporary file name 1143 TString name = "mars"; 1144 1145 FILE *f = gSystem->TempFileName(name, t); 1146 if (!f) 1147 { 1148 *fLog << warn << "MStatusDisplay::PrintDialog: Couldn't create temporary file in " << t << endl; 1149 SetStatusLine2("failed!"); 1150 return ""; 1151 } 1152 fclose(f); 1153 1154 // remove temp file 1155 gSystem->Unlink(name); 1156 name += "."; 1157 name += ext; 1158 1159 t = name; 1160 } 1161 1162 // compile command 1163 TString cmd(c); 1164 1165 // if sprinter.IsNull we assume that everything around %p can 1166 // be omitted and the program uses some kind of default 1167 if (p.IsNull()) 1168 { 1169 TString sub; 1170 while (1) 1171 { 1172 sub = TString(cmd(TRegexp(" .*%p.* "))).Strip(TString::kBoth); 1173 if (sub.IsNull()) 1174 break; 1175 1176 cmd.ReplaceAll(sub, ""); 1177 } 1178 } 1179 1180 cmd.ReplaceAll("%p", p); 1181 cmd.ReplaceAll("%f", t); 1182 1183 return cmd; 1184 } 1185 1087 1186 // -------------------------------------------------------------------------- 1088 1187 // 1089 1188 // Saves the given canvas (pad) or all pads (num<0) as a temporary 1090 // postscript file and prints it using 'lpr'. If a printer name is set 1091 // via SetPrinter 'lpr -Pname' is used. 1092 // 1093 Int_t MStatusDisplay::PrintToLpr(Int_t num) 1094 { 1095 TString name = "mars"; 1096 1097 for (int i=0; i<6; i++) 1098 name += (char)(gRandom->Uniform(25)+65); 1099 1100 name += ".ps"; 1101 1102 const Int_t pages = SaveAsPS(num, name); 1103 1189 // postscript file and prints it. 1190 // 1191 // The default command line c is: lpr -P%p %f 1192 // %p: printer name 1193 // %f: temporary file name 1194 // 1195 // The default printer name p is: <empty> 1196 // 1197 // Both can be changed in .rootrc by: 1198 // PrintPS.Printer 1199 // PrintPS.Command 1200 // 1201 // Ant the location of the temporary file t can by changed by 1202 // Print.Directory 1203 // the default is the system default directory (normally /tmp) 1204 // 1205 Int_t MStatusDisplay::PrintPS(Int_t num, const char *p, const char *c, const char *t) 1206 { 1207 static TString sprinter = gEnv->GetValue("PrintPS.Printer", p&&*p?p:""); 1208 static TString scmd = gEnv->GetValue("PrintPS.Command", c&&*c?c:"lpr -P%p %f"); 1209 1210 TString tmp = gEnv->GetValue("Print.Directory", t&&*t?t:gSystem->TempDirectory()); 1211 1212 TString cmd = PrintDialog(sprinter, scmd, tmp, "ps"); 1213 if (cmd.IsNull()) 1214 return 0; 1215 1216 // set status lines 1104 1217 SetStatusLine1("Printing..."); 1105 1218 SetStatusLine2(""); 1106 1219 1220 // print to temporary file 1221 const Int_t pages = SaveAsPS(num, tmp); 1222 1223 // check 1107 1224 if (!pages) 1108 1225 { 1109 *fLog << warn << "MStatusDisplay::Print ToLpr: Sorry, couldn't save file as temporary postscript!" << endl;1226 *fLog << warn << "MStatusDisplay::Print: Sorry, couldn't save file as temporary postscript!" << endl; 1110 1227 SetStatusLine2("Failed!"); 1111 1228 return 0; 1112 1229 } 1113 1230 1114 TString cmd="lpr "; 1115 if (!fPrinter.IsNull()) 1116 { 1117 cmd += "-P"; 1118 cmd += fPrinter; 1119 cmd += " "; 1120 } 1121 cmd += name; 1122 1231 // execute command 1232 *fLog << dbg << "Executing: " << cmd << endl; 1123 1233 gSystem->Exec(cmd); 1124 gSystem->Unlink(name); 1234 1235 // remove temporary file 1236 gSystem->Unlink(tmp); 1125 1237 1126 1238 SetStatusLine2(MString::Form("Done (%dpage(s))", pages)); … … 1226 1338 } 1227 1339 1340 Bool_t MStatusDisplay::SaveLogAsPS(const char *n) const 1341 { 1342 TString name(n); 1343 AddExtension(name, "ps"); 1344 1345 // Code taken from TGTextEdit::Print 1346 const TString pipe = MString::Form("a2ps -o%s", name.Data()); 1347 FILE *p = gSystem->OpenPipe(pipe, "w"); 1348 if (!p) 1349 { 1350 *fLog << err << "ERROR - Couldn't open pipe " << pipe << endl; 1351 return kFALSE; 1352 } 1353 1354 TGText *text = fLogBox->GetText(); 1355 1356 char *buf1, *buf2; 1357 Long_t len; 1358 ULong_t i = 0; 1359 TGLongPosition pos; 1360 1361 pos.fX = pos.fY = 0; 1362 while (pos.fY < text->RowCount()) 1363 { 1364 len = text->GetLineLength(pos.fY); 1365 buf1 = text->GetLine(pos, len); 1366 buf2 = new char[len + 2]; 1367 strncpy(buf2, buf1, (UInt_t)len); 1368 buf2[len] = '\n'; 1369 buf2[len+1] = '\0'; 1370 while (buf2[i] != '\0') { 1371 if (buf2[i] == '\t') { 1372 ULong_t j = i+1; 1373 while (buf2[j] == 16 && buf2[j] != '\0') 1374 j++; 1375 strcpy(buf2+i+1, buf2+j); 1376 } 1377 i++; 1378 } 1379 fwrite(buf2, sizeof(char), strlen(buf2)+1, p); 1380 1381 delete [] buf1; 1382 delete [] buf2; 1383 pos.fY++; 1384 } 1385 gSystem->ClosePipe(p); 1386 return kTRUE; 1387 } 1388 1389 // -------------------------------------------------------------------------- 1390 // 1391 // Print the log text. 1392 // 1393 // The default command line c is: a2ps -P%p 1394 // %p: printer name 1395 // 1396 // The default printer name p is: <empty> 1397 // 1398 // Both can be changed in .rootrc by: 1399 // PrintText.Printer 1400 // PrintText.Command 1401 // 1402 Bool_t MStatusDisplay::PrintLog(const char *p, const char *c) 1403 { 1404 static TString sprinter = gEnv->GetValue("PrintText.Printer", p&&*p?p:""); 1405 static TString scmd = gEnv->GetValue("PrintText.Command", c&&*c?c:"a2ps -P%p"); 1406 1407 TString tmp; 1408 TString cmd = PrintDialog(sprinter, scmd, tmp); 1409 if (cmd.IsNull()) 1410 return kFALSE; 1411 1412 // set status lines 1413 SetStatusLine1("Printing..."); 1414 SetStatusLine2(""); 1415 1416 // print to temporary file 1417 if (!SaveLogAsPS(cmd)) 1418 { 1419 *fLog << warn << "MStatusDisplay::PrintLog: Sorry, couldn't create postscript!" << endl; 1420 SetStatusLine2("Failed!"); 1421 return kFALSE; 1422 } 1423 1424 // execute command 1425 *fLog << dbg << "Executing: " << cmd << endl; 1426 gSystem->Exec(cmd); 1427 1428 SetStatusLine2("Done."); 1429 1430 return kTRUE; 1431 } 1432 1228 1433 // -------------------------------------------------------------------------- 1229 1434 // … … 1267 1472 return kTRUE; 1268 1473 1474 case kFileSaveAsPDF: 1475 SaveAsPDF(); 1476 return kTRUE; 1477 1478 case kFileSaveAsSVG: 1479 SaveAsSVG(); 1480 return kTRUE; 1481 1269 1482 case kFileSaveAsPNG: 1270 1483 SaveAsPNG(); … … 1283 1496 return kTRUE; 1284 1497 1498 //case kFileSaveAsXCF: 1499 // SaveAsXCF(); 1500 // return kTRUE; 1501 1502 //case kFileSaveAsTIFF: 1503 // SaveAsTIFF(); 1504 // return kTRUE; 1505 1506 //case kFileSaveAsBMP: 1507 // SaveAsBMP(); 1508 // return kTRUE; 1509 1285 1510 case kFileSaveAsC: 1286 1511 SaveAsC(); … … 1292 1517 1293 1518 case kFilePrint: 1294 Print ToLpr();1519 PrintPS(); 1295 1520 return kTRUE; 1296 1521 … … 1303 1528 return kTRUE; 1304 1529 1530 case kTabSaveAsPDF: 1531 SaveAsPDF(fTab->GetCurrent()); 1532 return kTRUE; 1533 1534 case kTabSaveAsSVG: 1535 SaveAsSVG(fTab->GetCurrent()); 1536 return kTRUE; 1537 1305 1538 case kTabSaveAsPNG: 1306 1539 SaveAsPNG(fTab->GetCurrent()); … … 1319 1552 return kTRUE; 1320 1553 1554 //case kTabSaveAsXCF: 1555 // SaveAsXCF(fTab->GetCurrent()); 1556 // return kTRUE; 1557 1558 //case kTabSaveAsBMP: 1559 // SaveAsBMP(fTab->GetCurrent()); 1560 // return kTRUE; 1561 1562 //case kTabSaveAsTIFF: 1563 // SaveAsTIFF(fTab->GetCurrent()); 1564 // return kTRUE; 1565 1321 1566 case kTabSaveAsC: 1322 1567 SaveAsC(fTab->GetCurrent()); … … 1328 1573 1329 1574 case kTabPrint: 1330 Print ToLpr(fTab->GetCurrent());1575 PrintPS(fTab->GetCurrent()); 1331 1576 return kTRUE; 1332 1577 … … 1386 1631 SetStatusLine2(""); 1387 1632 *fLog << inf << "Saving log... " << flush; 1388 if (fLogBox->GetText()->Save( "statusdisplay.log"))1633 if (fLogBox->GetText()->Save(MString::Form("%s.log", gROOT->GetName()))) 1389 1634 { 1390 1635 *fLog << "done." << endl; … … 1402 1647 SetStatusLine2(""); 1403 1648 *fLog << inf << "Appending log... " << flush; 1404 if (fLogBox->GetText()->Append( "statusdisplay.log"))1649 if (fLogBox->GetText()->Append(MString::Form("%s.log", gROOT->GetName()))) 1405 1650 { 1406 1651 *fLog << "done." << endl; … … 1412 1657 SetStatusLine2("Failed!"); 1413 1658 } 1659 return kTRUE; 1660 1661 case kLogPrint: 1662 PrintLog(); 1414 1663 return kTRUE; 1415 1664 #ifdef DEBUG … … 1973 2222 if (name.IsNull()) 1974 2223 { 1975 name = "status";2224 name = gROOT->GetName(); 1976 2225 if (num>0) 1977 2226 { … … 2042 2291 gSystem->Unlink(name); 2043 2292 gSystem->Rename(name+".$$$", name); 2044 /* 2045 // 2046 // Old style algorithm. Shifts blocks inside a single file --- SLOW! 2047 // 2048 const Int_t l = newstr.Length(); 2049 2050 Long_t t[4]; // { id, size, flags, modtime } 2051 gSystem->GetPathInfo(name, t, t+1, t+2, t+3); 2052 2053 char *c[2] = { new char[l], new char[l] }; 2054 2055 fstream f(name, ios::in|ios::out); 2056 2057 TString str; 2058 f >> str >> c[0][0]; // Read "%!PS-Adobe-2.0\n" (Mini Header) 2059 f.read(c[0], l); 2060 f.seekp(-l, ios::cur); 2061 f.write(newstr, l); 2062 2063 int i=0; 2064 while (1) 2065 { 2066 f.read(c[(i+1)%2], l); 2067 f.seekp(-l, ios::cur); 2068 2069 if (f) 2070 { 2071 f.write(c[i%2],l); 2072 i++; 2073 i%=2; 2074 continue; 2075 } 2076 2077 const Int_t ssz = str.Length()+1; // Length of Mini-Header 2078 const Int_t block = t[1]-ssz; // Length of block to be shifted 2079 const Int_t size = block%l; // Reminder 2080 const Int_t pos = (block/l)*l + ssz + 1; // Position to start writing 2081 2082 f.clear(); 2083 f.seekp(pos); 2084 f.write(c[i%2], l); 2085 f.write(c[(i+1)%2], size); 2086 break; 2087 } 2088 2089 delete c[1]; 2090 delete c[0]; 2091 */ 2092 } 2093 2094 // -------------------------------------------------------------------------- 2095 // 2096 // In case of num<0 all tabs are written into the PS file. If num>0 2293 } 2294 2295 void MStatusDisplay::PSToolsRange(TVirtualPS &vps, Float_t psw, Float_t psh) const 2296 { 2297 if (vps.InheritsFrom(TPostScript::Class())) 2298 static_cast<TPostScript&>(vps).Range(psw, psh); 2299 // if (vps.InheritsFrom(TPDF::Class())) 2300 // static_cast<TPDF&>(vps).Range(psw/2, psh/2); 2301 // if (vps.InheritsFrom(TSVG::Class())) 2302 // static_cast<TSVG&>(vps).Range(psw, psh); 2303 } 2304 2305 void MStatusDisplay::PSToolsTextNDC(TVirtualPS &vps, Double_t u, Double_t v, const char *string) const 2306 { 2307 if (vps.InheritsFrom(TPostScript::Class())) 2308 static_cast<TPostScript&>(vps).TextNDC(u, v, string); 2309 // if (vps.InheritsFrom(TPDF::Class())) 2310 // static_cast<TPDF&>(vps).TextNDC(u, v, string); 2311 // if (vps.InheritsFrom(TSVG::Class())) 2312 // static_cast<TSVG&>(vps).TextNDC(u, v, string); 2313 } 2314 2315 // -------------------------------------------------------------------------- 2316 // 2317 // Write some VGF (vector graphics format). Currently PS, PDF and SVG 2318 // is available. Specified by ext. 2319 // 2320 // In case of num<0 all tabs are written into the VGF file. If num>0 2097 2321 // the canvas in the corresponding tab is written to the file. 2098 2322 // Name is the name of the file (with or without extension). … … 2100 2324 // Returns the number of pages written. 2101 2325 // 2102 // To write all tabs you can also use SaveAs PS(name)2326 // To write all tabs you can also use SaveAsVGF(name, ext) 2103 2327 // 2104 2328 // If the third argument is given a bottom line is drawn with the text … … 2106 2330 // fTitle (SetTitle) is not empty. 2107 2331 // 2108 Int_t MStatusDisplay::SaveAs PS(Int_t num, TString name, const TString addon)2109 { 2110 SetStatusLine1( "Writing Postscript file...");2332 Int_t MStatusDisplay::SaveAsVGF(Int_t num, TString name, const TString addon, const TString ext) 2333 { 2334 SetStatusLine1(Form("Writing %s file...",ext.Data())); 2111 2335 SetStatusLine2(""); 2112 2336 … … 2117 2341 } 2118 2342 2119 AddExtension(name, "ps", num);2343 AddExtension(name, ext, num); 2120 2344 2121 2345 if (num<0) 2122 *fLog << inf << "Open ps-File: " << name << endl;2346 *fLog << inf << "Open " << ext << "-File: " << name << endl; 2123 2347 2124 2348 TPad *padsav = (TPad*)gPad; … … 2127 2351 TDatime d; 2128 2352 2129 TPostScript ps(name, 112); 2130 ps.SetBit(TPad::kPrintingPS); 2131 ps.PrintFast(13, "/nan {1} def "); 2132 2133 gVirtualPS = &ps; 2353 Int_t type = -1; 2354 2355 TVirtualPS *ps =0; 2356 if (!ext.CompareTo("ps", TString::kIgnoreCase)) 2357 { 2358 ps = new TPostScript(name, 112); 2359 type = 1; 2360 } 2361 if (!ext.CompareTo("pdf", TString::kIgnoreCase)) 2362 { 2363 ps = new TPDF(name, 112); 2364 type = 2; 2365 } 2366 if (!ext.CompareTo("svg", TString::kIgnoreCase)) 2367 { 2368 ps = new TSVG(name, 112); 2369 type = 3; 2370 } 2371 2372 if (!ps) 2373 { 2374 *fLog << err << "Extension " << ext << " unknown..." << endl; 2375 SetStatusLine2("Failed!"); 2376 return 0; 2377 } 2378 2379 ps->SetBit(TPad::kPrintingPS); 2380 if (type==1) 2381 ps->PrintFast(13, "/nan {1} def "); 2382 2383 gVirtualPS = ps; 2134 2384 2135 2385 // … … 2170 2420 // has the same Aspect Ratio than on the screen. 2171 2421 // 2172 ps.NewPage(); 2422 if (i>from) 2423 ps->NewPage(); 2173 2424 2174 2425 // … … 2176 2427 // such that the page title can be set above the canvas... 2177 2428 // 2178 Float_t psw = 28.0; // A4 - width (29.7)2429 Float_t psw = 28.0; // A4 - width (29.7) 2179 2430 Float_t psh = 21.0; // A4 - height (21.0) 2180 2431 … … 2187 2438 psh = ch/cw*psw; 2188 2439 2189 ps.Range(psw, psh); // A42440 PSToolsRange(*ps, psw, psh); 2190 2441 2191 2442 // … … 2219 2470 // Print overlaying text (NDC = %) 2220 2471 // 2221 ps .SetTextColor(kBlack);2222 ps .SetTextSize(0.015);2223 ps .SetTextFont(22);2224 ps .SetTextAlign(11); // left top2225 ps.TextNDC(0, 1.015, TString(" ")+n->GetName());2226 ps .SetTextAlign(21); // cent top2227 ps.TextNDC(0.5, 1.015, TString("MARS - Magic Analysis and Reconstruction Software - ")+d.AsString());2228 ps .SetTextAlign(31); // right top2229 ps.TextNDC(1, 1.015, MString::Form("Page No.%i (%i) ", page++, i));2472 ps->SetTextColor(kBlack); 2473 ps->SetTextSize(0.015); 2474 ps->SetTextFont(22); 2475 ps->SetTextAlign(11); // left top 2476 PSToolsTextNDC(*ps, 0, 1.015, TString(" ")+n->GetName()); 2477 ps->SetTextAlign(21); // cent top 2478 PSToolsTextNDC(*ps, 0.5, 1.015, TString("MARS - Magic Analysis and Reconstruction Software - ")+d.AsString()); 2479 ps->SetTextAlign(31); // right top 2480 PSToolsTextNDC(*ps, 1, 1.015, MString::Form("Page No.%i (%i) ", page++, i)); 2230 2481 line.PaintLineNDC(0, 1.01, 1, 1.01); 2231 2482 … … 2234 2485 { 2235 2486 line.PaintLineNDC(0, -0.00, 1, -0.00); 2236 ps .SetTextAlign(11); // left top2237 ps.TextNDC(0, -0.015, TString(" ")+txt);2238 ps .SetTextAlign(31); // right top2239 ps.TextNDC(1, -0.015, "(c) 2000-2004, Thomas Bretz ");2487 ps->SetTextAlign(11); // left top 2488 PSToolsTextNDC(*ps, 0, -0.015, TString(" ")+txt); 2489 ps->SetTextAlign(31); // right top 2490 PSToolsTextNDC(*ps, 1, -0.015, "(c) 2000-2005, Thomas Bretz "); 2240 2491 } 2241 2492 … … 2250 2501 l.Delete(); 2251 2502 2252 ps.Close(); 2253 2254 SetStatusLine2("Updating header of PS file..."); 2255 2256 if (num<0) 2257 *fLog << " - Updating header of PS file... " << flush; 2258 UpdatePSHeader(name); 2259 if (num<0) 2260 *fLog << inf << "done." << endl; 2503 ps->Close(); 2504 delete ps; 2505 2506 if (type==1) 2507 { 2508 SetStatusLine2("Updating header of PS file..."); 2509 2510 if (num<0) 2511 *fLog << " - Updating header of PS file... " << flush; 2512 UpdatePSHeader(name); 2513 if (num<0) 2514 *fLog << inf << "done." << endl; 2515 } 2261 2516 2262 2517 gVirtualPS = psave; … … 2274 2529 Bool_t MStatusDisplay::SaveAsImage(Int_t num, TString name, TImage::EImageFileTypes type) 2275 2530 { 2531 //#if ROOT_VERSION_CODE < ROOT_VERSION(4,04,00) 2276 2532 if (gROOT->IsBatch()) 2277 2533 { … … 2280 2536 return 0; 2281 2537 } 2282 //SetStatusLine1("Writing GIF file..."); 2538 //#endif 2539 2283 2540 SetStatusLine1("Writing image file... <please be patient>"); 2284 2541 SetStatusLine2(""); … … 2306 2563 ext = AddExtension(name, "jpg", num); 2307 2564 break; 2308 // case TImage::kXcf: 2309 // ext = AddExtension(name, "xcf", num); 2565 case TImage::kGif: 2566 ext = AddExtension(name, "gif", num); 2567 break; 2568 // case TImage::kTiff: 2569 // ext = AddExtension(name, "tiff", num); 2310 2570 // break; 2311 2571 // case TImage::kPpm: … … 2315 2575 // ext = AddExtension(name, "pnm", num); 2316 2576 // break; 2317 // case TImage::kBmp:2318 // ext = AddExtension(name, "bmp", num);2319 // break;2320 2577 // case TImage::kIco: 2321 2578 // ext = AddExtension(name, "ico", num); … … 2324 2581 // ext = AddExtension(name, "cur", num); 2325 2582 // break; 2326 case TImage::kGif:2327 ext = AddExtension(name, "gif", num);2328 break;2329 // case TImage::k Tiff:2330 // ext = AddExtension(name, " tif", num);2583 // case TImage::kBmp: 2584 // ext = AddExtension(name, "bmp", num); 2585 // break; 2586 // case TImage::kXcf: 2587 // ext = AddExtension(name, "xcf", num); 2331 2588 // break; 2332 2589 // case TImage::kXbm: … … 2397 2654 *fLog << "..." << flush; 2398 2655 2656 #if ROOT_VERSION_CODE < ROOT_VERSION(4,04,00) 2399 2657 c->Draw(); 2658 2400 2659 if (type==TImage::kGif) 2401 2660 c->SaveAs(writename); // FIXME: Seems not to work well in TImage! (root 3.10/02) … … 2407 2666 delete img; 2408 2667 } 2409 2668 #else 2669 c->Print(writename); 2670 #endif 2410 2671 if (num<0) 2411 2672 *fLog << "done." << endl; … … 2535 2796 // -------------------------------------------------------------------------- 2536 2797 // 2798 // Determin File type to save file as by extension. Allowed extensions are: 2799 // root, ps, pdf, svg, gif, png, jpg, xpm, C 2800 // 2801 // returns -1 if file type is unknown. Otherwise return value of SaveAs* 2802 // 2803 Int_t MStatusDisplay::SaveAs(Int_t num, TString name) 2804 { 2805 if (name.EndsWith(".root")) return SaveAsRoot(num, name); 2806 if (name.EndsWith(".ps")) return SaveAsPS(num, name); 2807 if (name.EndsWith(".pdf")) return SaveAsPDF(num, name); 2808 if (name.EndsWith(".svg")) return SaveAsSVG(num, name); 2809 if (name.EndsWith(".gif")) return SaveAsGIF(num, name); 2810 if (name.EndsWith(".png")) return SaveAsPNG(num, name); 2811 if (name.EndsWith(".jpg")) return SaveAsJPG(num, name); 2812 if (name.EndsWith(".xpm")) return SaveAsXPM(num, name); 2813 if (name.EndsWith(".C")) return SaveAsC(num, name); 2814 return -1; 2815 } 2816 2817 // -------------------------------------------------------------------------- 2818 // 2537 2819 // Opens a save as dialog 2538 2820 // … … 2542 2824 { 2543 2825 "PostScript", "*.ps", 2826 "Acrobat pdf", "*.pdf", 2827 "SVG vector", "*.svg", 2544 2828 "Gif files", "*.gif", 2829 "Png files", "*.png", 2830 "Gif files", "*.gif", 2831 "Jpeg files", "*.jpeg", 2832 "Xpm files", "*.xpm", 2545 2833 "Macro files", "*.C", 2546 2834 "ROOT files", "*.root", … … 2563 2851 dir = fi.fIniDir; 2564 2852 2565 const TString name(fi.fFilename); 2566 2567 if (name.EndsWith(".root")) return SaveAsRoot(num, name); 2568 if (name.EndsWith(".ps")) return SaveAsPS(num, name); 2569 if (name.EndsWith(".gif")) return SaveAsGIF(num, name); 2570 if (name.EndsWith(".C")) return SaveAsC(num, name); 2853 const Int_t rc = SaveAs(num, fi.fFilename); 2854 if (rc>=0) 2855 return rc; 2571 2856 2572 2857 Warning("MStatusDisplay::SaveAs", "Unknown Extension: %s", fi.fFilename); -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
r6978 r7001 26 26 class TMutex; 27 27 class TCanvas; 28 class TVirtualPS; 28 29 29 30 class TGTab; … … 42 43 typedef enum { 43 44 // kFile 44 kFileBrowser, kFileCanvas, kFileOpen, kFileSave, kFileSaveAs, kFileSaveAsPS, 45 kFileSaveAsRoot, kFileSaveAsPNG, kFileSaveAsGIF, kFileSaveAsJPG, 46 kFileSaveAsXPM, kFileSaveAsC, kFilePrint, kFilePrinterName, 45 kFileBrowser, kFileCanvas, kFileOpen, kFileSave, kFileSaveAs, 46 kFileSaveAsPS, kFileSaveAsPDF, kFileSaveAsSVG, kFileSaveAsRoot, 47 kFileSaveAsPNG, kFileSaveAsGIF, kFileSaveAsJPG, kFileSaveAsXPM, 48 /*kFileSaveAsBMP, kFileSaveAsXCF, kFileSaveAsTIFF,*/ 49 kFileSaveAsC, kFilePrint, kFilePrinterName, 47 50 kFileClose, kFileExit, kFileReset, 48 51 // kLoop 49 52 kLoopNone, kLoopStop, 50 53 // kTab 51 kTabSave, kTabSaveAs, kTabSaveAsPS, kTabSaveAsRoot, kTabSaveAsPNG, 52 kTabSaveAsGIF, kTabSaveAsJPG, kTabSaveAsXPM, kTabSaveAsC, 54 kTabSave, kTabSaveAs, kTabSaveAsPS, kTabSaveAsPDF, kTabSaveAsSVG, 55 kTabSaveAsRoot, kTabSaveAsPNG, kTabSaveAsGIF, kTabSaveAsJPG, 56 kTabSaveAsXPM, /*kTabSaveAsBMP, kTabSaveAsXCF, kTabSaveAsTIFF,*/ 57 kTabSaveAsC, 53 58 kTabPrint, kTabNext, kTabPrevious, kTabRemove, 54 59 // kSize … … 57 62 // kLog 58 63 kLogCopy, kLogClear, kLogSelect, kLogFind, kLogSave, kLogAppend, 64 kLogPrint, 59 65 // kPic 60 66 kPicMagic, kPicMars, … … 91 97 92 98 Status_t fStatus; 93 94 TString fPrinter;95 99 96 100 Int_t fLogIdx; … … 134 138 Bool_t Display(const TObjArray &list, const char *tab=0); 135 139 136 const TString &AddExtension(TString &name, const TString &ext, Int_t num ) const;140 const TString &AddExtension(TString &name, const TString &ext, Int_t num=-1) const; 137 141 138 142 void UpdatePSHeader(const TString &name) const; … … 144 148 145 149 Bool_t SaveAsImage(Int_t num, TString name, TImage::EImageFileTypes type); 150 Int_t SaveAsVGF(Int_t num, TString name, const TString addon, const TString ext); 151 152 void PSToolsRange(TVirtualPS &vps, Float_t w, Float_t h) const; 153 void PSToolsTextNDC(TVirtualPS &vps, Double_t u, Double_t v, const char *string) const; 154 TString PrintDialog(TString &p, TString &c, TString &t, const char *ext=0); 155 146 156 147 157 public: … … 161 171 void SetStatusLine2(const char *txt) { SetStatusLine(txt, 1); } 162 172 void SetStatusLine2(const MParContainer &cont); 163 164 void SetPrinter(const TString &lpr) { fPrinter = lpr; }165 173 166 174 virtual void SetName(const char *name) { fName = name; } … … 198 206 void SetNoContextMenu(Bool_t flag=kTRUE); 199 207 200 Int_t SaveAsPS(TString name="", const TString addon="") { return SaveAsPS(-1, name, addon); } 201 Bool_t SaveAsPNG(TString name="") { return SaveAsPNG(-1, name); } 202 Bool_t SaveAsGIF(TString name="") { return SaveAsGIF(-1, name); } 203 Bool_t SaveAsXPM(TString name="") { return SaveAsXPM(-1, name); } 204 Bool_t SaveAsJPG(TString name="") { return SaveAsJPG(-1, name); } 205 Bool_t SaveAsC(TString name="") { return SaveAsC(-1, name); } 208 Int_t SaveAsPS(TString name="", const TString addon="") { return SaveAsVGF(-1, name, addon, "ps"); } 209 Int_t SaveAsPDF(TString name="", const TString addon="") { return SaveAsVGF(-1, name, addon, "pdf"); } 210 Int_t SaveAsSVG(TString name="", const TString addon="") { return SaveAsVGF(-1, name, addon, "svg"); } 211 Bool_t SaveAsPNG(TString name="") { return SaveAsPNG(-1, name); } 212 Bool_t SaveAsGIF(TString name="") { return SaveAsGIF(-1, name); } 213 Bool_t SaveAsXPM(TString name="") { return SaveAsXPM(-1, name); } 214 Bool_t SaveAsJPG(TString name="") { return SaveAsJPG(-1, name); } 215 //Bool_t SaveAsTIFF(TString name="") { return SaveAsTIFF(-1, name); } 216 //Bool_t SaveAsXCF(TString name="") { return SaveAsXCF(-1, name); } 217 //Bool_t SaveAsBMP(TString name="") { return SaveAsBMP(-1, name); } 218 Bool_t SaveAsC(TString name="") { return SaveAsC(-1, name); } 206 219 Int_t SaveAsRoot(TString name="") { return SaveAsRoot(-1, name); } 207 Int_t PrintToLpr() { return PrintToLpr(-1); } 208 209 Int_t SaveAsPS(Int_t num, TString name="", const TString addon=""); 210 Bool_t SaveAsPNG(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kPng); } 211 Bool_t SaveAsGIF(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kGif); } 212 Bool_t SaveAsXPM(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kXpm); } 213 Bool_t SaveAsJPG(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kJpeg); } 220 Int_t SaveAs(TString name) { return SaveAs(-1, name); } 221 Int_t PrintPS() { return PrintPS(-1); } 222 223 Int_t SaveAsPS(Int_t num, TString name="", const TString addon="") { return SaveAsVGF(num, name, addon, "ps"); } 224 Int_t SaveAsPDF(Int_t num, TString name="", const TString addon="") { return SaveAsVGF(num, name, addon, "pdf"); } 225 Int_t SaveAsSVG(Int_t num, TString name="", const TString addon="") { return SaveAsVGF(num, name, addon, "svg"); } 226 Bool_t SaveAsPNG(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kPng); } 227 Bool_t SaveAsGIF(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kGif); } 228 Bool_t SaveAsXPM(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kXpm); } 229 Bool_t SaveAsJPG(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kJpeg); } 230 //Bool_t SaveAsTIFF(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kTiff); } 231 //Bool_t SaveAsXCF(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kXcf); } 232 //Bool_t SaveAsBMP(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kBmp); } 214 233 Bool_t SaveAsC(Int_t num, TString name=""); 215 234 Int_t SaveAsRoot(Int_t num, TString name=""); 216 Int_t PrintToLpr(Int_t num); 235 Int_t SaveAs(Int_t num, TString name); 236 Int_t PrintPS(Int_t num, const char *p=0, const char *cmd=0, const char *tmp=0); 237 Bool_t PrintLog(const char *p=0, const char *c=0); 238 Bool_t SaveLogAsPS(const char *name) const; 217 239 218 240 Int_t SaveAs(Int_t num=-1); -
trunk/MagicSoft/Mars/merpp.cc
r6888 r7001 145 145 int main(const int argc, char **argv) 146 146 { 147 // 148 // Evaluate arguments 149 // 150 MArgs arg(argc, argv); 151 gLog.Setup(arg); 152 147 153 StartUpMessage(); 148 149 //150 // Evaluate arguments151 //152 MArgs arg(argc, argv);153 154 154 155 if (arg.HasOnly("-V") || arg.HasOnly("--version")) … … 160 161 return 2; 161 162 } 162 163 gLog.Setup(arg);164 163 165 164 const Int_t kComprlvl = arg.GetIntAndRemove("-c", 2); -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
r7000 r7001 89 89 // TBranchElement::kDeleteObject = BIT(16) 90 90 // TTree::kFriendLock = BIT(17) 91 kIsNewTree = BIT( 17)91 kIsNewTree = BIT(23) 92 92 }; 93 93 -
trunk/MagicSoft/Mars/mhflux/FluxLinkDef.h
r6989 r7001 8 8 9 9 #pragma link C++ class MHAlpha+; 10 #pragma link C++ class MHTheta +;10 #pragma link C++ class MHThetaSq+; 11 11 #pragma link C++ class MHEnergyEst+; 12 12 #pragma link C++ class MHFalseSource+; 13 13 #pragma link C++ class MHEffectiveOnTime+; 14 14 #pragma link C++ class MHCollectionArea+; 15 #pragma link C++ class MMatrixHist+; 16 #pragma link C++ class MMatrixUnfold+; 17 #pragma link C++ class MUnfoldBert+; 15 18 16 19 #endif -
trunk/MagicSoft/Mars/mhflux/Makefile
r6989 r7001 27 27 MHEnergyEst.cc \ 28 28 MHAlpha.cc \ 29 MHTheta .cc \29 MHThetaSq.cc \ 30 30 MHEnergyEst.cc \ 31 MUnfolding.cc \ 31 32 MHEffectiveOnTime.cc \ 32 33 MHCollectionArea.cc \ -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r6926 r7001 107 107 TVirtualPad *save = gPad; 108 108 gPad = 0; 109 /* 109 110 #if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06) 110 111 SetPalette(1, 0); 111 #else 112 #endif 113 */ 114 /* 115 #if ROOT_VERSION_CODE < ROOT_VERSION(4,04,00) 112 116 SetPrettyPalette(); 117 #elese 113 118 // WORAROUND - FIXME: Calling it many times becomes slower and slower 114 //SetInvDeepBlueSeaPalette();119 SetInvDeepBlueSeaPalette(); 115 120 #endif 121 */ 116 122 gPad = save; 117 123 } … … 121 127 // Default Constructor. To be used by the root system ONLY. 122 128 // 123 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), f Colors(kItemsLegend), fAbberation(0)129 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fAbberation(0) 124 130 { 125 131 Init(); … … 133 139 // 134 140 MHCamera::MHCamera(const MGeomCam &geom, const char *name, const char *title) 135 : fGeomCam(NULL), f Colors(kItemsLegend), fAbberation(0)141 : fGeomCam(NULL), fAbberation(0) 136 142 { 137 143 //fGeomCam = (MGeomCam*)geom.Clone(); … … 463 469 // GeMinimum() ((val-min)/(max-min)) 464 470 // 'proj' Display the y-projection of the histogram 471 // 'pal0' Use Pretty palette 472 // 'pal1' Use Deep Blue Sea palette 473 // 'pal2' Use Inverse Depp Blue Sea palette 465 474 // 'same' Draw trandparent pixels on top of an existing pad. This 466 475 // makes it possible to draw the camera image on top of an … … 970 979 { 971 980 opt.ReplaceAll("hist", ""); 981 opt.ReplaceAll("box", ""); 982 opt.ReplaceAll("pixelindex", ""); 983 opt.ReplaceAll("sectorindex", ""); 984 opt.ReplaceAll("content", ""); 985 opt.ReplaceAll("proj", ""); 986 opt.ReplaceAll("pal0", ""); 987 opt.ReplaceAll("pal1", ""); 988 opt.ReplaceAll("pal2", ""); 972 989 TH1D::Paint(opt); 973 990 return; … … 1007 1024 } 1008 1025 1026 const Bool_t pal1 = opt.Contains("pal1"); 1027 const Bool_t pal2 = opt.Contains("pal2"); 1028 1029 if (!pal1 && !pal2) 1030 SetPrettyPalette(); 1031 1032 if (pal1) 1033 SetDeepBlueSeaPalette(); 1034 1035 if (pal2) 1036 SetInvDeepBlueSeaPalette(); 1037 1009 1038 // Update Contents of the pixels and paint legend 1010 1039 Update(gPad->GetLogy(), hasbox, hascol, hassame); … … 1021 1050 } 1022 1051 1052 void MHCamera::SetDrawOption(Option_t *option) 1053 { 1054 // This is a workaround. For some reason MHCamera is 1055 // stored in a TObjLink instead of a TObjOptLink 1056 if (!option || !gPad) 1057 return; 1058 1059 TListIter next(gPad->GetListOfPrimitives()); 1060 delete gPad->FindObject("Tframe"); 1061 TObject *obj; 1062 while ((obj = next())) 1063 if (obj == this && (TString)next.GetOption()!=(TString)option) 1064 { 1065 gPad->GetListOfPrimitives()->Remove(this); 1066 gPad->GetListOfPrimitives()->AddFirst(this, option); 1067 return; 1068 } 1069 } 1070 1023 1071 // ------------------------------------------------------------------------ 1024 1072 // … … 1053 1101 else 1054 1102 gStyle->SetPalette(ncolors, colors); 1055 1056 fColors.Set(kItemsLegend);1057 for (int i=0; i<kItemsLegend; i++)1058 fColors[i] = gStyle->GetColorPalette(i);1059 1103 } 1060 1104 … … 1068 1112 void MHCamera::SetPrettyPalette() 1069 1113 { 1070 if (!TString(GetDrawOption()).Contains("hist", TString::kIgnoreCase)) 1114 TString opt(GetDrawOption()); 1115 1116 if (!opt.Contains("hist", TString::kIgnoreCase)) 1071 1117 SetPalette(1, 0); 1118 1119 opt.ReplaceAll("pal1", ""); 1120 opt.ReplaceAll("pal2", ""); 1121 1122 SetDrawOption(opt); 1072 1123 } 1073 1124 … … 1080 1131 void MHCamera::SetDeepBlueSeaPalette() 1081 1132 { 1082 if (!TString(GetDrawOption()).Contains("hist", TString::kIgnoreCase)) 1133 TString opt(GetDrawOption()); 1134 1135 if (!opt.Contains("hist", TString::kIgnoreCase)) 1083 1136 SetPalette(51, 0); 1137 1138 opt.ReplaceAll("pal1", ""); 1139 opt.ReplaceAll("pal2", ""); 1140 opt += "pal1"; 1141 1142 SetDrawOption(opt); 1084 1143 } 1085 1144 … … 1092 1151 void MHCamera::SetInvDeepBlueSeaPalette() 1093 1152 { 1094 if (!TString(GetDrawOption()).Contains("hist", TString::kIgnoreCase)) 1153 TString opt(GetDrawOption()); 1154 1155 if (!opt.Contains("hist", TString::kIgnoreCase)) 1095 1156 SetPalette(52, 0); 1157 1158 opt.ReplaceAll("pal1", ""); 1159 opt.ReplaceAll("pal2", ""); 1160 opt += "pal2"; 1161 1162 SetDrawOption(opt); 1096 1163 } 1097 1164 … … 1515 1582 1516 1583 if (val >= max) 1517 return fColors[maxcolidx];1584 return gStyle->GetColorPalette(maxcolidx); 1518 1585 1519 1586 if (val <= min) 1520 return fColors[0];1587 return gStyle->GetColorPalette(0); 1521 1588 1522 1589 // … … 1530 1597 1531 1598 const Int_t colidx = (Int_t)(ratio*maxcolidx + .5); 1532 return fColors[colidx];1599 return gStyle->GetColorPalette(colidx); 1533 1600 } 1534 1601 … … 1612 1679 for (Int_t i=0; i<kItemsLegend; i++) 1613 1680 { 1614 newbox.SetFillColor( fColors[i]);1681 newbox.SetFillColor(gStyle->GetColorPalette(i)); 1615 1682 newbox.PaintBox(range, H*(i*h-1)-offset, range+w, H*((i+1)*h-1)-offset); 1616 1683 } -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r6855 r7001 48 48 TArrayI fBinEntries; // number of entries per bin 49 49 50 TArrayI fColors; //! Color conversion table51 50 TList *fNotify; //! 52 51 … … 214 213 char *GetObjectInfo(Int_t px, Int_t py) const; 215 214 void ExecuteEvent(Int_t event, Int_t px, Int_t py); 215 void SetDrawOption(Option_t *option); //*MENU* 216 216 217 217 void SetPalette(Int_t ncolors, Int_t *colors); … … 222 222 223 223 void SetAutoScale() { fMinimum = fMaximum = -1111; } // *MENU* 224 void DisplayAsHistogram() { SetDrawOption("histEP"); } // *MENU*225 void DisplayAsCamera() { SetDrawOption(""); } // *MENU*226 224 227 225 void SetFreezed(Bool_t f=kTRUE) { f ? SetBit(kFreezed) : ResetBit(kFreezed); } // *TOGGLE* *GETTER=IsFreezed -
trunk/MagicSoft/Mars/mjobs/MJCut.cc
r6993 r7001 78 78 : fStoreSummary(kFALSE), fStoreResult(kTRUE), fWriteOnly(kFALSE), 79 79 fIsWobble(kFALSE), fIsMonteCarlo(kFALSE), fFullDisplay(kFALSE), 80 fNameHist("MHTheta "), fCalcHadronness(0)80 fNameHist("MHThetaSq"), fCalcHadronness(0) 81 81 { 82 82 fName = name ? name : "MJCut"; … … 428 428 MBinning bins7("BinningDist"); 429 429 MBinning bins8("BinningMaxDist"); 430 MBinning bins9("BinningM3Long"); 431 MBinning bins0("BinningConc1"); 430 432 plist.AddToList(&bins1); 431 433 plist.AddToList(&bins2); … … 436 438 plist.AddToList(&bins7); 437 439 plist.AddToList(&bins8); 440 plist.AddToList(&bins9); 441 plist.AddToList(&bins0); 438 442 439 443 // -------------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mjobs/MJOptimize.cc
r6978 r7001 181 181 eval->SetVal(0); 182 182 183 const Bool_t isnull = gLog.IsNullOutput(); 183 184 if (fDebug<3) 184 185 gLog.SetNullOutput(kTRUE); … … 190 191 191 192 if (fDebug<3) 192 gLog.SetNullOutput( kFALSE);193 gLog.SetNullOutput(isnull); 193 194 194 195 const Double_t f = eval->GetVal(); -
trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc
r6994 r7001 178 178 return -1; 179 179 180 TObject *hist = arr.FindObjectInCanvas("Hist", "MHAlpha", "Hist"); 181 cout << "HIST: " << hist << endl; 182 if (hist) 183 cout << "TYPE: " << hist->ClassName() << endl; 184 arr.Print(); 185 180 186 vstime->Copy(h1); 181 187 size->Copy(h2); … … 344 350 taskenv1.SetDefault(fEstimateEnergy ? fEstimateEnergy : &est); 345 351 346 MFillH fill1("Hist Off [MHAlpha]", "MHillasSrc", "FillHistOff");347 MFillH fill2("Hist On [MHAlpha]", "MHillasSrc", "FillHistOn");352 MFillH fill1("HistEOff [MHAlpha]", "MHillasSrc", "FillHistEOff"); 353 MFillH fill2("HistE [MHAlpha]", "MHillasSrc", "FillHistE"); 348 354 349 355 MFDataMember f0("DataType.fVal", '<', 0.5, "FilterOffData"); … … 382 388 } 383 389 384 const MHAlpha *halpha = (MHAlpha *)plist.FindObject("Hist On");390 const MHAlpha *halpha = (MHAlpha *)plist.FindObject("HistE"); 385 391 if (!halpha) 386 392 { 387 *fLog << err << GetDescriptor() << ": Hist On[MHAlpha] not found... abort." << endl;393 *fLog << err << GetDescriptor() << ": HistE [MHAlpha] not found... abort." << endl; 388 394 return kFALSE; 389 395 } … … 597 603 *fLog << inf << "Reading from file: " << fPathIn << endl; 598 604 599 cout << "Opening..." << endl;600 605 TFile file(fPathIn, "READ"); 601 606 if (!file.IsOpen()) … … 605 610 } 606 611 607 cout << "Reading..." << endl;608 612 file.cd(); 609 613 MStatusArray arr; … … 614 618 } 615 619 616 cout << "Searching..." << endl;617 618 620 TH1 *excess = (TH1D*)arr.FindObjectInCanvas("Excess", "TH1D", "Hist"); 619 621 if (!excess) 620 622 return kFALSE; 621 622 cout << "Displaying..." << endl;623 623 624 624 // ------------------- Plot excess versus size ------------------- … … 638 638 // Don't do this on the original object! 639 639 excess->SetStats(kFALSE); 640 641 cout << "ExcessSize..." << endl;642 640 643 641 TObject *o=0; … … 656 654 } 657 655 658 cout << "Dist..." << endl;659 660 656 // -------------- Comparison of Image Parameters -------------- 661 657 c.cd(2); 662 658 PlotSame(arr, plist, "Dist", "HilSrc", "MHHilSrcMCPost"); 663 659 664 cout << "Length..." << endl;665 666 660 c.cd(3); 667 661 PlotSame(arr, plist, "Length", "PostCut", "MHHillasMCPost"); 668 662 669 cout << "M3l..." << endl;670 671 663 c.cd(4); 672 664 PlotSame(arr, plist, "M3l", "HilExt", "MHHilExtMCPost"); 673 665 674 cout << "Conc1..." << endl;675 676 666 c.cd(5); 677 667 PlotSame(arr, plist, "Conc1", "NewPar", "MHNewParMCPost"); 678 679 cout << "Width..." << endl;680 668 681 669 c.cd(6); … … 710 698 MBinning bins7("BinningDist"); 711 699 MBinning bins8("BinningMaxDist"); 700 MBinning bins9("BinningM3Long"); 701 MBinning bins0("BinningConc1"); 712 702 713 703 MAlphaFitter fit; … … 722 712 plist.AddToList(&bins7); 723 713 plist.AddToList(&bins8); 714 plist.AddToList(&bins9); 715 plist.AddToList(&bins0); 724 716 plist.AddToList(&fit); 725 717 -
trunk/MagicSoft/Mars/readdaq.cc
r6888 r7001 51 51 gLog << " readdaq [-h] [-?] [-vn] [-dec] [-a0] inputfile[.raw]" << endl << endl; 52 52 gLog << " input file: Magic DAQ binary file." << endl; 53 gLog << " -a0: Do not use Ansii codes." << endl; 54 gLog << " -vn: Verbosity level n [default=2]" << endl; 53 gLog.Usage(); 55 54 gLog << " -d1: print data in decimal values" << endl; 56 55 gLog << " -c1: print MRawCrateArray data" << endl; … … 60 59 int main(int argc, char **argv) 61 60 { 62 StartUpMessage();63 64 61 // 65 62 // Evaluate arguments 66 63 // 67 64 MArgs arg(argc, argv); 65 gLog.Setup(arg); 66 67 StartUpMessage(); 68 68 69 69 if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help")) … … 76 76 // Set verbosity to highest level. 77 77 // 78 gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);79 80 if (arg.HasOption("-a") && arg.GetIntAndRemove("-a")==0)81 gLog.SetNoColors();82 83 78 const bool kDecimal = arg.HasOption("-d") && arg.GetIntAndRemove("-d")==1; 84 79 const bool kPrintArray = arg.HasOption("-c") && arg.GetIntAndRemove("-c")==1; -
trunk/MagicSoft/Mars/readraw.cc
r6888 r7001 54 54 gLog << " readraw [-h] [-?] [-vn] [-dec] [-a0] inputfile[.root]" << endl << endl; 55 55 gLog << " input file: Magic DAQ binary file." << endl; 56 gLog << " -vn: Verbosity level n [default=2]" << endl;56 gLog.Usage(); 57 57 gLog << " -d, --dec: print data in decimal values" << endl; 58 58 gLog << " -a, --no-colors: Do not use Ansii color codes" << endl; … … 71 71 int main(int argc, char **argv) 72 72 { 73 StartUpMessage();74 75 73 // Evaluate arguments 76 74 MArgs arg(argc, argv); 75 gLog.Setup(arg); 76 77 StartUpMessage(); 77 78 78 79 // check for the right usage of the program … … 83 84 return 2; 84 85 } 85 86 // Set verbosity87 gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);88 89 // Set color usage90 if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a"))91 gLog.SetNoColors();92 86 93 87 // Set usage of decimal values -
trunk/MagicSoft/Mars/showlog.cc
r6949 r7001 100 100 s.ReplaceAll("", "\033"); 101 101 102 // Check whether it is an empty line103 if (s=="\033[0m")102 const char *end = s.Data()+s.Length(); 103 for (const char *c=s.Data(); c<end; c++) 104 104 { 105 gLog << endl; 106 continue; 107 } 105 char *to = NULL; 106 Int_t n = -1; 108 107 109 while (!s.IsNull())110 {111 Ssiz_t pos = s.First("\033["); 112 if ( pos<0)108 if (c+1<end-1 && *c=='\033' && *(c+1)=='[') 109 n = strtol(c+2, &to, 10); 110 111 if (to==NULL || *to!='m') 113 112 { 114 gLog << s;115 break;113 gLog << *c; 114 continue; 116 115 } 117 116 118 gLog << s(0, pos);119 s.Remove(0, pos+1); 120 if (s.BeginsWith("0m") && s.Length()>3)117 c = to; 118 119 switch (n) 121 120 { 122 gLog << all; 123 s.Remove(0, 2); 121 case 0: 122 if (c<end-1) 123 gLog << flush << all; 124 continue; 125 case 31: 126 gLog << flush << err; 127 continue; 128 case 32: 129 gLog << flush << inf; 130 continue; 131 case 33: 132 gLog << flush << warn; 133 continue; 134 case 34: 135 gLog << flush << dbg; 124 136 continue; 125 137 } 126 if (s.BeginsWith("31m")) 127 { 128 gLog << err; 129 s.Remove(0, 3); 130 continue; 131 } 132 if (s.BeginsWith("32m")) 133 { 134 gLog << inf; 135 s.Remove(0, 3); 136 continue; 137 } 138 if (s.BeginsWith("33m")) 139 { 140 gLog << warn; 141 s.Remove(0, 3); 142 continue; 143 } 144 if (s.BeginsWith("34m")) 145 { 146 gLog << dbg; 147 s.Remove(0, 3); 148 continue; 149 } 150 gLog << "\033["; 138 gLog << flush << "\033[" << n << "m"; 151 139 } 152 gLog << endl ;140 gLog << endl << all; 153 141 } 154 142 -
trunk/MagicSoft/Mars/showplot.cc
r6888 r7001 37 37 gLog << " -q Quit when job is finished" << endl; 38 38 gLog << endl; 39 gLog << " Output Options: "<< endl; 39 gLog << " General Output Options: "<< endl; 40 gLog << " --print[=printer] Print to printer" << endl; 40 41 gLog << " --save-as-ps[=filename] Save plots as postscript" << endl; 42 gLog << " --save-as-pdf[=filename] Save plots as pdf-file" << endl; 43 gLog << " --save-as-svg[=filename] Save plots as svg-file" << endl; 44 gLog << " --save-as-root[=filename] Save plots as root file" << endl; 45 gLog << " --save-as-C[=filename] Save plots as root scripts" << endl; 46 gLog << " --tab=num Save only tab number num" << endl << endl; 47 gLog << " Print only options:" << endl; 48 gLog << " --print-cmd='lpr -P%p %f' Set the printer command" << endl; 49 gLog << " --print-dir=/tmp Set the printing temp directory" << endl << endl; 50 gLog << " GUI only options:" << endl; 41 51 gLog << " --save-as-gif[=filename] Save plots as gif files" << endl; 42 gLog << " --save-as-C[=filename] Save plots as root scripts" << endl; 43 gLog << " --tab=num Save only tab number num" << endl; 52 gLog << " --save-as-jpg[=filename] Save plots as jpg files" << endl; 53 gLog << " --save-as-xpm[=filename] Save plots as xpm files" << endl; 54 gLog << " --save-as-png[=filename] Save plots as png files" << endl; 44 55 gLog << endl; 45 56 gLog << " --version, -V Show startup message with version number" << endl; … … 49 60 gLog << " Use showplot to display a MStatusArray in an MStatusDisplay." << endl; 50 61 gLog << " MStatusArrays are typically written by programs showing data" << endl; 51 gLog << " check plots, like callisto." << endl; 62 gLog << " check plots, like callisto." << endl << endl; 63 gLog << "Printing:" << endl; 64 gLog << " For more details see MStatusDisplay::PrintPS" << endl << endl; 65 gLog << "Examples:" << endl; 66 gLog << " showplot filename.root" << endl; 67 gLog << " showplot -b --null --print --print-cmd='psnup -2 %f' filename.root | lpr" << endl; 68 gLog << " showplot -b --print --print-cmd='psbook %f | psnup -2 | lpr' filename.root" << endl; 69 gLog << " showplot -b --print --print-cmd='cat %f' filename.root > filename.ps" << endl; 70 gLog << " showplot -b --save-as-ps filename.root" << endl; 71 gLog << " showplot -q --save-as-gif=tab5.gif --tab=5 filename.root" << endl; 72 gLog << " showplot -b --save-as-ps --print=lp2 filename.root" << endl; 52 73 gLog << endl; 53 74 } … … 55 76 int main(int argc, char **argv) 56 77 { 78 // 79 // Evaluate arguments 80 // 81 MArgs arg(argc, argv, kTRUE); 82 gLog.Setup(arg); 83 57 84 StartUpMessage(); 58 59 //60 // Evaluate arguments61 //62 MArgs arg(argc, argv, kTRUE);63 85 64 86 if (arg.HasOnly("-V") || arg.HasOnly("--version")) … … 71 93 } 72 94 73 gLog.Setup(arg); 74 75 const Bool_t kQuit = arg.HasOnlyAndRemove("-q"); 76 const Bool_t kBatch = arg.HasOnlyAndRemove("-b"); 77 78 const Int_t kTab = arg.GetIntAndRemove("--tab=", -1); 79 80 const Bool_t kSaveAsPs = arg.HasOnlyAndRemove("--save-as-ps") || arg.Has("--save-as-ps="); 81 const Bool_t kSaveAsGif = arg.HasOnlyAndRemove("--save-as-gif") || arg.Has("--save-as-gif="); 82 const Bool_t kSaveAsC = arg.HasOnlyAndRemove("--save-as-C") || arg.Has("--save-as-C="); 83 84 TString kNamePs = arg.GetStringAndRemove("--save-as-ps="); 85 TString kNameGif = arg.GetStringAndRemove("--save-as-gif="); 86 TString kNameC = arg.GetStringAndRemove("--save-as-C="); 95 const Bool_t kQuit = arg.HasOnlyAndRemove("-q"); 96 const Bool_t kBatch = arg.HasOnlyAndRemove("-b"); 97 98 const Int_t kTab = arg.GetIntAndRemove("--tab=", -1); 99 100 const Bool_t kPrint = arg.HasOnlyAndRemove("--print") || arg.Has("--print="); 101 const Bool_t kSaveAsPs = arg.HasOnlyAndRemove("--save-as-ps") || arg.Has("--save-as-ps="); 102 const Bool_t kSaveAsPdf = arg.HasOnlyAndRemove("--save-as-pdf") || arg.Has("--save-as-pdf="); 103 const Bool_t kSaveAsSvg = arg.HasOnlyAndRemove("--save-as-svg") || arg.Has("--save-as-svg="); 104 const Bool_t kSaveAsGif = arg.HasOnlyAndRemove("--save-as-gif") || arg.Has("--save-as-gif="); 105 const Bool_t kSaveAsJpg = arg.HasOnlyAndRemove("--save-as-jpg") || arg.Has("--save-as-jpg="); 106 const Bool_t kSaveAsXpm = arg.HasOnlyAndRemove("--save-as-xpm") || arg.Has("--save-as-xpm="); 107 const Bool_t kSaveAsPng = arg.HasOnlyAndRemove("--save-as-png") || arg.Has("--save-as-png="); 108 const Bool_t kSaveAsRoot = arg.HasOnlyAndRemove("--save-as-root") || arg.Has("--save-as-root="); 109 const Bool_t kSaveAsC = arg.HasOnlyAndRemove("--save-as-C") || arg.Has("--save-as-C="); 110 111 TString kNamePrint = arg.GetStringAndRemove("--print="); 112 TString kPrintCmd = arg.GetStringAndRemove("--print-cmd="); 113 TString kPrintDir = arg.GetStringAndRemove("--print-dir="); 114 TString kNamePs = arg.GetStringAndRemove("--save-as-ps="); 115 TString kNamePdf = arg.GetStringAndRemove("--save-as-pdf="); 116 TString kNameSvg = arg.GetStringAndRemove("--save-as-svg="); 117 TString kNameGif = arg.GetStringAndRemove("--save-as-gif="); 118 TString kNameJpg = arg.GetStringAndRemove("--save-as-jpg="); 119 TString kNameXpm = arg.GetStringAndRemove("--save-as-xpm="); 120 TString kNamePng = arg.GetStringAndRemove("--save-as-png="); 121 TString kNameRoot = arg.GetStringAndRemove("--save-as-root="); 122 TString kNameC = arg.GetStringAndRemove("--save-as-C="); 87 123 88 124 … … 90 126 // check for the right usage of the program 91 127 // 128 if (arg.GetNumOptions()>0) 129 { 130 gLog << err << "Unknown commandline options..." << endl; 131 arg.Print("options"); 132 gLog << endl; 133 return 3; 134 } 92 135 if (arg.GetNumArguments()!=1) 93 136 { … … 96 139 } 97 140 98 TApplication app(" Showplot", &argc, argv);141 TApplication app("showplot", &argc, argv); 99 142 if (!gROOT->IsBatch() && !gClient || gROOT->IsBatch() && !kBatch) 100 143 { … … 108 151 const TString kInput = arg.GetArgumentStr(0); 109 152 110 if (kNamePs.IsNull() && kSaveAsPs)153 if (kNamePs.IsNull() && kSaveAsPs) 111 154 kNamePs = kInput; 112 if (kNameGif.IsNull() && kSaveAsGif) 155 if (kNamePdf.IsNull() && kSaveAsPdf) 156 kNamePdf = kInput; 157 if (kNameSvg.IsNull() && kSaveAsSvg) 158 kNameSvg = kInput; 159 if (kNameGif.IsNull() && kSaveAsGif) 113 160 kNameGif = kInput; 114 if (kNameC.IsNull() && kSaveAsC) 161 if (kNameJpg.IsNull() && kSaveAsJpg) 162 kNameJpg = kInput; 163 if (kNameXpm.IsNull() && kSaveAsXpm) 164 kNameXpm = kInput; 165 if (kNamePng.IsNull() && kSaveAsPng) 166 kNamePng = kInput; 167 if (kNameRoot.IsNull() && kSaveAsRoot) 168 kNameRoot = kInput; 169 if (kNameC.IsNull() && kSaveAsC) 115 170 kNameC = kInput; 116 171 … … 124 179 d->Open(kInput); 125 180 181 if (kPrint) 182 d->PrintPS(kTab, kNamePrint, kPrintCmd, kPrintDir); 126 183 if (kSaveAsPs) 127 d->SaveAsPS(kTab, kNamePs); 184 d->SaveAsPS(kTab, kNamePs); 185 if (kSaveAsPdf) 186 d->SaveAsPDF(kTab, kNamePdf); 187 if (kSaveAsSvg) 188 d->SaveAsSVG(kTab, kNameSvg); 128 189 if (kSaveAsGif) 129 d->SaveAsGIF(kTab, kNameGif); 190 d->SaveAsGIF(kTab, kNameGif); 191 if (kSaveAsJpg) 192 d->SaveAsJPG(kTab, kNameJpg); 193 if (kSaveAsXpm) 194 d->SaveAsXPM(kTab, kNameXpm); 195 if (kSaveAsPng) 196 d->SaveAsPNG(kTab, kNamePng); 197 if (kSaveAsRoot) 198 d->SaveAsRoot(kTab, kNameRoot); 130 199 if (kSaveAsC) 131 d->SaveAsC(kTab, kNameC);200 d->SaveAsC(kTab, kNameC); 132 201 133 202 if (kBatch || kQuit) -
trunk/MagicSoft/Mars/sinope.cc
r6906 r7001 249 249 int main(int argc, char **argv) 250 250 { 251 // 252 // Evaluate arguments 253 // 254 MArgs arg(argc, argv, kTRUE); 255 gLog.Setup(arg); 256 251 257 StartUpMessage(); 252 253 //254 // Evaluate arguments255 //256 MArgs arg(argc, argv, kTRUE);257 258 258 259 if (arg.HasOnly("-V") || arg.HasOnly("--version")) … … 264 265 return 2; 265 266 } 266 267 gLog.Setup(arg);268 267 269 268 //const TString kConfig = arg.GetStringAndRemove("--config=", "callisto.rc"); … … 379 378 MParContainer::Class()->IgnoreTObjectStreamer(); 380 379 381 TApplication app(" Sinope", &argc, argv);380 TApplication app("sinope", &argc, argv); 382 381 if (!gROOT->IsBatch() && !gClient || gROOT->IsBatch() && !kBatch) 383 382 { -
trunk/MagicSoft/Mars/sponde.cc
r6977 r7001 89 89 int main(int argc, char **argv) 90 90 { 91 // 92 // Evaluate arguments 93 // 94 MArgs arg(argc, argv, kTRUE); 95 gLog.Setup(arg); 96 91 97 StartUpMessage(); 92 93 //94 // Evaluate arguments95 //96 MArgs arg(argc, argv, kTRUE);97 98 98 99 if (arg.HasOnly("-V") || arg.HasOnly("--version")) … … 104 105 return 2; 105 106 } 106 107 gLog.Setup(arg);108 107 109 108 const TString kConfig = arg.GetStringAndRemove("--config=", "sponde.rc"); … … 184 183 MParContainer::Class()->IgnoreTObjectStreamer(); 185 184 186 TApplication app(" Sponde", &argc, argv);185 TApplication app("sponde", &argc, argv); 187 186 if (!gROOT->IsBatch() && !gClient || gROOT->IsBatch() && !kBatch) 188 187 { -
trunk/MagicSoft/Mars/star.cc
r6993 r7001 91 91 int main(int argc, char **argv) 92 92 { 93 // 94 // Evaluate arguments 95 // 96 MArgs arg(argc, argv, kTRUE); 97 gLog.Setup(arg); 98 93 99 StartUpMessage(); 94 95 //96 // Evaluate arguments97 //98 MArgs arg(argc, argv, kTRUE);99 100 100 101 if (arg.HasOnly("-V") || arg.HasOnly("--version")) … … 106 107 return 2; 107 108 } 108 109 gLog.Setup(arg);110 109 111 110 const TString kConfig = arg.GetStringAndRemove("--config=", "star.rc"); … … 193 192 MParContainer::Class()->IgnoreTObjectStreamer(); 194 193 195 TApplication app(" Star", &argc, argv);194 TApplication app("star", &argc, argv); 196 195 if (!gROOT->IsBatch() && !gClient || gROOT->IsBatch() && !kBatch) 197 196 {
Note:
See TracChangeset
for help on using the changeset viewer.