From 5a58b99e28112d611868e9ad745dc184aab78817 Mon Sep 17 00:00:00 2001 From: nemu Date: Mon, 15 Dec 2008 14:02:38 +0000 Subject: [PATCH] improved menu handling for Fourier --- src/classes/PMsrHandler.cpp | 2 ++ src/classes/PMusrCanvas.cpp | 38 +++++++++++++++++++++++++++++++------ src/include/PMusrCanvas.h | 11 +++++++---- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index a0123467..5b3198fe 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -275,6 +275,7 @@ int PMsrHandler::ReadMsrFile() // } // cout << endl; +/* cout << endl << ">> FOURIER Block:"; cout << endl << ">> Fourier Block Present : " << fFourier.fFourierBlockPresent; cout << endl << ">> Fourier Units : " << fFourier.fUnits; @@ -285,6 +286,7 @@ cout << endl << ">> Phase : " << fFourier.fPhase; cout << endl << ">> Range for Freq. Corrections : " << fFourier.fRangeForPhaseCorrection[0] << ", " << fFourier.fRangeForPhaseCorrection[1]; cout << endl << ">> Plot Range : " << fFourier.fPlotRange[0] << ", " << fFourier.fPlotRange[1]; cout << endl; +*/ return result; } diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index ac1ed967..8a60649a 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -210,10 +210,14 @@ void PMusrCanvas::InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, In fPopupFourier = new TGPopupMenu(); fPopupMain->AddPopup("&Fourier", fPopupFourier); - fPopupFourier->AddEntry("Real", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL); - fPopupFourier->AddEntry("Imag", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG); - fPopupFourier->AddEntry("Power", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR); - fPopupFourier->AddEntry("Phase", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE); + fPopupFourier->AddEntry("Show Real", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL); + fPopupFourier->AddEntry("Show Imag", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG); + fPopupFourier->AddEntry("Show Real+Imag", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL_AND_IMAG); + fPopupFourier->AddEntry("Show Power", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR); + fPopupFourier->AddEntry("Show Phase", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE); + fPopupFourier->AddSeparator(); + fPopupFourier->AddEntry("Phase +", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS); + fPopupFourier->AddEntry("Phase -", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS); fPopupMain->AddEntry("&Difference", P_MENU_ID_DIFFERENCE+P_MENU_PLOT_OFFSET*fPlotNumber); fPopupMain->AddSeparator(); @@ -324,8 +328,10 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) HandleDifference(); } 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 if (x == '+') { + cout << endl << ">> if Fourier is shown, will add +1° to the Fourier." << endl; + } else if (x == '-') { + cout << endl << ">> if Fourier is shown, will add -1° to the Fourier." << endl; } else { // do all the necessary stuff **TO BE DONE** fMainCanvas->Update(); @@ -342,14 +348,34 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) void PMusrCanvas::HandleMenuPopup(Int_t id) { if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL) { + fPopupFourier->UnCheckEntries(); + fPopupFourier->CheckEntry(id); cout << endl << ">> will handle Real Part Fourier ..." << endl; } else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG) { + fPopupFourier->UnCheckEntries(); + fPopupFourier->CheckEntry(id); cout << endl << ">> will handle Imaginary Part Fourier ..." << endl; + } else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL_AND_IMAG) { + fPopupFourier->UnCheckEntries(); + fPopupFourier->CheckEntry(id); + cout << endl << ">> will handle Real+Imaginary Part Fourier ..." << endl; } else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR) { + fPopupFourier->UnCheckEntries(); + fPopupFourier->CheckEntry(id); cout << endl << ">> will handle Power Fourier ..." << endl; } else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE) { + fPopupFourier->UnCheckEntries(); + fPopupFourier->CheckEntry(id); cout << endl << ">> will handle Phase Fourier ..." << endl; + } else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS) { + cout << endl << ">> will add +1° Phase to the Fourier ..." << endl; + } else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS) { + cout << endl << ">> will add -1° Phase to the Fourier ..." << endl; } else if (id == P_MENU_ID_DIFFERENCE+P_MENU_PLOT_OFFSET*fPlotNumber) { + if (fPopupMain->IsEntryChecked(id)) + fPopupMain->UnCheckEntry(id); + else + fPopupMain->CheckEntry(id); HandleDifference(); } else if (id == P_MENU_ID_SAVE_DATA+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_SAVE_ASCII) { SaveDataAscii(); diff --git a/src/include/PMusrCanvas.h b/src/include/PMusrCanvas.h index f5cde4f2..520d8103 100644 --- a/src/include/PMusrCanvas.h +++ b/src/include/PMusrCanvas.h @@ -68,10 +68,13 @@ #define P_MENU_PLOT_OFFSET 1000 -#define P_MENU_ID_FOURIER_REAL 100 -#define P_MENU_ID_FOURIER_IMAG 101 -#define P_MENU_ID_FOURIER_PWR 102 -#define P_MENU_ID_FOURIER_PHASE 103 +#define P_MENU_ID_FOURIER_REAL 100 +#define P_MENU_ID_FOURIER_IMAG 101 +#define P_MENU_ID_FOURIER_REAL_AND_IMAG 102 +#define P_MENU_ID_FOURIER_PWR 103 +#define P_MENU_ID_FOURIER_PHASE 104 +#define P_MENU_ID_FOURIER_PHASE_PLUS 105 +#define P_MENU_ID_FOURIER_PHASE_MINUS 106 #define P_MENU_ID_SAVE_ASCII 200 #define P_MENU_ID_SAVE_DB 201