another attempt to get rid of the bugs reported in MUSR-115 (d-f-d, f-d-f issues in the key event handling of musrview

This commit is contained in:
nemu
2010-08-19 13:33:57 +00:00
parent 5b6e04fc97
commit 0d4dc340ad
2 changed files with 17 additions and 2 deletions

View File

@ -721,6 +721,18 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
// handle keys and popup menu entries
enum eKeySwitch {kNotRelevant, kData, kDiffData, kFourier, kDiffFourier, kFourierDiff};
eKeySwitch relevantKeySwitch = kNotRelevant;
static eKeySwitch lastKeySwitch = kNotRelevant;
if ((lastKeySwitch == kFourierDiff) && (x == 'f')) {
cout << "debug> f-d-f doesn't make any sense, will ignore 'f' ..." << endl;
return;
}
if ((lastKeySwitch == kDiffFourier) && (x == 'd')) {
cout << "debug> d-f-d doesn't make any sense, will ignore 'd' ..." << endl;
return;
}
if (x == 'q') { // quit
Done(0);
} else if (x == 'd') { // difference
@ -813,6 +825,8 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
fMainCanvas->Update();
}
lastKeySwitch = relevantKeySwitch;
// call the apropriate functions if necessary
switch (relevantKeySwitch) {
case kData: // show data