From 3cda938f0c10338be5c09c8dd7226071aa7e0700 Mon Sep 17 00:00:00 2001 From: nemu Date: Wed, 30 Apr 2008 12:27:01 +0000 Subject: [PATCH] better startup list handling --- src/classes/PStartupHandler.cpp | 95 ++++++++++++++++++++------------- src/include/PStartupHandler.h | 2 + src/musrview.cpp | 5 +- 3 files changed, 63 insertions(+), 39 deletions(-) diff --git a/src/classes/PStartupHandler.cpp b/src/classes/PStartupHandler.cpp index 3f6f1c5f..416563ec 100644 --- a/src/classes/PStartupHandler.cpp +++ b/src/classes/PStartupHandler.cpp @@ -84,44 +84,7 @@ void PStartupHandler::OnStartDocument() void PStartupHandler::OnEndDocument() { // check if anything was set, and if not set some default stuff - - // check if any data path is given - if (fDataPathList.size() == 0) { - fDataPathList.push_back(TString("/mnt/data/nemu/his")); - fDataPathList.push_back(TString("/mnt/data/nemu/wkm")); - } - - // check if any markers are given - if (fMarkerList.size() == 0) { - fMarkerList.push_back(24); // open circle - fMarkerList.push_back(25); // open square - fMarkerList.push_back(26); // open triangle - fMarkerList.push_back(27); // open diamond - fMarkerList.push_back(28); // open cross - fMarkerList.push_back(29); // full star - fMarkerList.push_back(30); // open star - fMarkerList.push_back(20); // full circle - fMarkerList.push_back(21); // full square - fMarkerList.push_back(22); // full triangle - fMarkerList.push_back(23); // full down triangle - fMarkerList.push_back(2); // thin cross - fMarkerList.push_back(3); // thin star - fMarkerList.push_back(5); // thin cross 45° rotated - } - - // check if any colors are given - if (fColorList.size() == 0) { - fColorList.push_back(TColor::GetColor(0, 0, 0)); // kBlack - fColorList.push_back(TColor::GetColor(255, 0, 0)); // kRed - fColorList.push_back(TColor::GetColor(0, 255, 0)); // kGreen - fColorList.push_back(TColor::GetColor(0, 0, 255)); // kBlue - fColorList.push_back(TColor::GetColor(255, 0, 255)); // kMagneta - fColorList.push_back(TColor::GetColor(0, 255, 255)); // kCyan - fColorList.push_back(TColor::GetColor(156, 0, 255)); // kViolette-3 - fColorList.push_back(TColor::GetColor(99, 101, 49)); // kYellow-1 - fColorList.push_back(TColor::GetColor(49, 101, 49)); // kGreen-1 - fColorList.push_back(TColor::GetColor(156, 48, 0)); // kOrange-4 - } + CheckLists(); } //-------------------------------------------------------------------------- @@ -318,5 +281,61 @@ void PStartupHandler::OnCdataBlock(const char *str, Int_t len) // nothing to be done for now } +//-------------------------------------------------------------------------- +// CheckLists +//-------------------------------------------------------------------------- +/** + *

+ * + */ +void PStartupHandler::CheckLists() +{ + // check if anything was set, and if not set some default stuff + + // check if any data path is given +cout << endl << ">> check data path list ..."; + if (fDataPathList.size() == 0) { +cout << endl << ">> data path list empty, will set default ones"; + fDataPathList.push_back(TString("/mnt/data/nemu/his")); + fDataPathList.push_back(TString("/mnt/data/nemu/wkm")); + } + + // check if any markers are given +cout << endl << ">> check marker list ..."; + if (fMarkerList.size() == 0) { +cout << endl << ">> marker list empty, will set default ones"; + fMarkerList.push_back(24); // open circle + fMarkerList.push_back(25); // open square + fMarkerList.push_back(26); // open triangle + fMarkerList.push_back(27); // open diamond + fMarkerList.push_back(28); // open cross + fMarkerList.push_back(29); // full star + fMarkerList.push_back(30); // open star + fMarkerList.push_back(20); // full circle + fMarkerList.push_back(21); // full square + fMarkerList.push_back(22); // full triangle + fMarkerList.push_back(23); // full down triangle + fMarkerList.push_back(2); // thin cross + fMarkerList.push_back(3); // thin star + fMarkerList.push_back(5); // thin cross 45° rotated + } + + // check if any colors are given +cout << endl << ">> check color list ..."; + if (fColorList.size() == 0) { +cout << endl << ">> color list empty, will set default ones"; + fColorList.push_back(TColor::GetColor(0, 0, 0)); // kBlack + fColorList.push_back(TColor::GetColor(255, 0, 0)); // kRed + fColorList.push_back(TColor::GetColor(0, 255, 0)); // kGreen + fColorList.push_back(TColor::GetColor(0, 0, 255)); // kBlue + fColorList.push_back(TColor::GetColor(255, 0, 255)); // kMagneta + fColorList.push_back(TColor::GetColor(0, 255, 255)); // kCyan + fColorList.push_back(TColor::GetColor(156, 0, 255)); // kViolette-3 + fColorList.push_back(TColor::GetColor(99, 101, 49)); // kYellow-1 + fColorList.push_back(TColor::GetColor(49, 101, 49)); // kGreen-1 + fColorList.push_back(TColor::GetColor(156, 48, 0)); // kOrange-4 + } +} + // end --------------------------------------------------------------------- diff --git a/src/include/PStartupHandler.h b/src/include/PStartupHandler.h index 97729e1e..b3e0f18b 100644 --- a/src/include/PStartupHandler.h +++ b/src/include/PStartupHandler.h @@ -56,6 +56,8 @@ class PStartupHandler : public TObject, public TQObject virtual void OnFatalError(const char*); // SLOT virtual void OnCdataBlock(const char*, Int_t); // SLOT + virtual void CheckLists(); + virtual const PStringVector GetDataPathList() const { return fDataPathList; } virtual const PIntVector GetMarkerList() const { return fMarkerList; } virtual const PIntVector GetColorList() const { return fColorList; } diff --git a/src/musrview.cpp b/src/musrview.cpp index 168fd4af..ce3e93db 100644 --- a/src/musrview.cpp +++ b/src/musrview.cpp @@ -117,8 +117,9 @@ int main(int argc, char *argv[]) status = saxParser->ParseFile(startup_path_name); // check for parse errors if (status) { // error - cout << endl << "**WARNING** reading/parsing musrfit_startup.xml."; + cout << endl << "**WARNING** reading/parsing musrfit_startup.xml failed."; cout << endl; +/* // clean up if (saxParser) { delete saxParser; @@ -128,7 +129,9 @@ int main(int argc, char *argv[]) delete startupHandler; startupHandler = 0; } +*/ } + startupHandler->CheckLists(); // read msr-file PMsrHandler *msrHandler = new PMsrHandler(argv[1]);