Skip to content

Commit eba2dff

Browse files
committed
BUG: Prevent UI clicks when analysis is running
1 parent 60875bd commit eba2dff

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/fretalon/melinator/inc/MGUIMainMelinator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ class MGUIMainMelinator : public TGMainFrame
163163
unsigned int m_ActiveLineFit;
164164
//! The active results view
165165
bool m_ActiveResultIsEnergy;
166+
//! True if any analysis is ongoing
167+
bool m_AnalysisRunning;
166168

167169
//! The label of the main histogram
168170
TGLabel* m_MainHistogramLabel;

src/fretalon/melinator/src/MGUIMainMelinator.cxx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ MGUIMainMelinator::MGUIMainMelinator(MInterfaceMelinator* Interface,
8787
m_ActiveCollection = 0;
8888
m_ActiveLineFit = 0;
8989
m_ActiveResultIsEnergy = true;
90+
m_AnalysisRunning = false;
9091
}
9192

9293

@@ -793,6 +794,13 @@ bool MGUIMainMelinator::ProcessMessage(long Message, long Parameter1, long Param
793794

794795
bool Status = true;
795796

797+
// Protection against reentering running analysis:
798+
if (m_AnalysisRunning == true) {
799+
mout<<"Please wait until the current analysis is done"<<endl;
800+
return true;
801+
}
802+
m_AnalysisRunning = true;
803+
796804
switch (GET_MSG(Message)) {
797805
case kC_COMMAND:
798806
switch (GET_SUBMSG(Message)) {
@@ -946,6 +954,8 @@ bool MGUIMainMelinator::ProcessMessage(long Message, long Parameter1, long Param
946954
break;
947955
}
948956

957+
m_AnalysisRunning = false;
958+
949959
return Status;
950960
}
951961

@@ -1030,7 +1040,7 @@ bool MGUIMainMelinator::OnExit()
10301040

10311041
//! Switch the histogram binning mode
10321042
bool MGUIMainMelinator::OnSwitchHistogramBinningMode(unsigned int ID)
1033-
{
1043+
{
10341044
if (ID == MMelinator::c_HistogramBinningModeFixedNumberOfBins) {
10351045
m_HistogramBinningModeValueLabel->SetText(" bins");
10361046
} else if (ID == MMelinator::c_HistogramBinningModeFixedCountsPerBin) {
@@ -1054,7 +1064,7 @@ bool MGUIMainMelinator::OnSwitchHistogramBinningMode(unsigned int ID)
10541064

10551065
//! Switch the histogram binning mode
10561066
bool MGUIMainMelinator::OnSwitchPeakParametrizationMode(unsigned int ID)
1057-
{
1067+
{
10581068
if (ID == MCalibrateEnergyFindLines::c_PeakParametrizationMethodBayesianBlockPeak) {
10591069
m_PeakParametrizationOptions->RemoveAll(); // Deletes everyting too
10601070
} else if (ID == MCalibrateEnergyFindLines::c_PeakParametrizationMethodSmoothedPeak) {

0 commit comments

Comments
 (0)