From 8910a8295f4c9e2a7a4e3b85b7385bf0b45c5b8c Mon Sep 17 00:00:00 2001 From: nemu Date: Mon, 30 Jun 2008 09:08:31 +0000 Subject: [PATCH] add on last window closed handling --- src/ToDo.txt | 5 +---- src/classes/PMusrCanvas.cpp | 22 ++++++++++++++++++++++ src/include/PMusrCanvas.h | 1 + src/musrview.cpp | 8 +++++++- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/ToDo.txt b/src/ToDo.txt index dd01b502..715ed7f4 100644 --- a/src/ToDo.txt +++ b/src/ToDo.txt @@ -79,9 +79,6 @@ intermediate term: describe new features with examples! * introduce error numbers with corresponding docu/explanation in the latex-docu. * implement RRF stuff -* think about if it is worth to modify wkm in order to read - the new msr-files, so that wkmview can be used for an intermediate - time. --------------------- long term: @@ -90,7 +87,7 @@ long term: * implement ROOT based wkmview, i.e. all the graphical stuff needed including event handler, etc. * implement FFT with msr-interface -* switch from qmake to cmake +* switch from make to cmake --------------------- bugs: diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 95d441ef..6ae69b75 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -34,6 +34,7 @@ using namespace std; #include #include +#include #include "PMusrCanvas.h" @@ -274,12 +275,33 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) TString str((Char_t)x); if (x == 'q') { Done(0); + } else if (x == 'd') { + cout << endl << ">> will show the difference between the theory and the signal, to be implemented yet. fMainCanvas name = " << fMainCanvas->GetName() << endl; + } else if (x == 'f') { + cout << endl << ">> will show the Fourier transform, to be implemented yet." << endl; + } else if (x == 'S') { + cout << endl << ">> will save the shown data into a file, to be implemented yet." << endl; } else { // do all the necessary stuff **TO BE DONE** fMainCanvas->Update(); } } +//-------------------------------------------------------------------------- +// LastCanvasClosed (SLOT) +//-------------------------------------------------------------------------- +/** + *

+ * + */ +void PMusrCanvas::LastCanvasClosed() +{ +// cout << endl << ">> in last canvas closed check ..."; + if (gROOT->GetListOfCanvases()->IsEmpty()) { + Done(0); + } +} + //-------------------------------------------------------------------------- // UpdateParamTheoryPad //-------------------------------------------------------------------------- diff --git a/src/include/PMusrCanvas.h b/src/include/PMusrCanvas.h index 00493c18..8c417edd 100644 --- a/src/include/PMusrCanvas.h +++ b/src/include/PMusrCanvas.h @@ -137,6 +137,7 @@ class PMusrCanvas : public TObject, public TQObject virtual void Done(Int_t status=0); // *SIGNAL* virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected); // SLOT + virtual void LastCanvasClosed(); // SLOT private: Bool_t fValid; diff --git a/src/musrview.cpp b/src/musrview.cpp index 995a1ac4..6905b224 100644 --- a/src/musrview.cpp +++ b/src/musrview.cpp @@ -240,6 +240,9 @@ cout << endl; ok = false; break; } + // connect signal/slot + TQObject::Connect("TCanvas", "Closed()", "PMusrCanvas", musrCanvas, "LastCanvasClosed()"); + // ugly but rootcint cannot handle the spirit-parser framework musrCanvas->SetMsrHandler(msrHandler); musrCanvas->SetRunListCollection(runListCollection); @@ -269,11 +272,14 @@ cout << endl << "clean up canvas vector ..."; for (unsigned int i=0; i> canvasName=" << canvasName; +cout << endl << ">> canvasName=" << canvasName << ", canvasVector[" << i << "]=" << canvasVector[i]; if (gROOT->GetListOfCanvases()->FindObject(canvasName) != 0) { cout << endl << ">> canvasName=" << canvasName << ", found ..."; cout << endl; canvasVector[i]->~PMusrCanvas(); + } else { +cout << endl << ">> canvasName=" << canvasName << ", NOT found ..."; +cout << endl; } } canvasVector.empty();