add on last window closed handling

This commit is contained in:
nemu 2008-06-30 09:08:31 +00:00
parent e04a34ad72
commit 8910a8295f
4 changed files with 31 additions and 5 deletions

View File

@ -79,9 +79,6 @@ intermediate term:
describe new features with examples! describe new features with examples!
* introduce error numbers with corresponding docu/explanation in the latex-docu. * introduce error numbers with corresponding docu/explanation in the latex-docu.
* implement RRF stuff * 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: long term:
@ -90,7 +87,7 @@ long term:
* implement ROOT based wkmview, i.e. all the graphical stuff needed * implement ROOT based wkmview, i.e. all the graphical stuff needed
including event handler, etc. including event handler, etc.
* implement FFT with msr-interface * implement FFT with msr-interface
* switch from qmake to cmake * switch from make to cmake
--------------------- ---------------------
bugs: bugs:

View File

@ -34,6 +34,7 @@ using namespace std;
#include <TColor.h> #include <TColor.h>
#include <TRandom.h> #include <TRandom.h>
#include <TROOT.h>
#include "PMusrCanvas.h" #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); TString str((Char_t)x);
if (x == 'q') { if (x == 'q') {
Done(0); 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 { } else {
// do all the necessary stuff **TO BE DONE** // do all the necessary stuff **TO BE DONE**
fMainCanvas->Update(); fMainCanvas->Update();
} }
} }
//--------------------------------------------------------------------------
// LastCanvasClosed (SLOT)
//--------------------------------------------------------------------------
/**
* <p>
*
*/
void PMusrCanvas::LastCanvasClosed()
{
// cout << endl << ">> in last canvas closed check ...";
if (gROOT->GetListOfCanvases()->IsEmpty()) {
Done(0);
}
}
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// UpdateParamTheoryPad // UpdateParamTheoryPad
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View File

@ -137,6 +137,7 @@ class PMusrCanvas : public TObject, public TQObject
virtual void Done(Int_t status=0); // *SIGNAL* 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 HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected); // SLOT
virtual void LastCanvasClosed(); // SLOT
private: private:
Bool_t fValid; Bool_t fValid;

View File

@ -240,6 +240,9 @@ cout << endl;
ok = false; ok = false;
break; break;
} }
// connect signal/slot
TQObject::Connect("TCanvas", "Closed()", "PMusrCanvas", musrCanvas, "LastCanvasClosed()");
// ugly but rootcint cannot handle the spirit-parser framework // ugly but rootcint cannot handle the spirit-parser framework
musrCanvas->SetMsrHandler(msrHandler); musrCanvas->SetMsrHandler(msrHandler);
musrCanvas->SetRunListCollection(runListCollection); musrCanvas->SetRunListCollection(runListCollection);
@ -269,11 +272,14 @@ cout << endl << "clean up canvas vector ...";
for (unsigned int i=0; i<canvasVector.size(); i++) { for (unsigned int i=0; i<canvasVector.size(); i++) {
// check if canvas is still there before calling the destructor **TO BE DONE** // check if canvas is still there before calling the destructor **TO BE DONE**
sprintf(canvasName, "fMainCanvas%d", i); sprintf(canvasName, "fMainCanvas%d", i);
cout << endl << ">> canvasName=" << canvasName; cout << endl << ">> canvasName=" << canvasName << ", canvasVector[" << i << "]=" << canvasVector[i];
if (gROOT->GetListOfCanvases()->FindObject(canvasName) != 0) { if (gROOT->GetListOfCanvases()->FindObject(canvasName) != 0) {
cout << endl << ">> canvasName=" << canvasName << ", found ..."; cout << endl << ">> canvasName=" << canvasName << ", found ...";
cout << endl; cout << endl;
canvasVector[i]->~PMusrCanvas(); canvasVector[i]->~PMusrCanvas();
} else {
cout << endl << ">> canvasName=" << canvasName << ", NOT found ...";
cout << endl;
} }
} }
canvasVector.empty(); canvasVector.empty();