Mercurial > hg > fxanalyse
diff FXAnalyse.c @ 34:1e4b8ba97faf
Cleanup code handling dedrifing options
This removes some code that does not make much sense to me.
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Wed, 03 Oct 2012 12:56:22 +0200 |
parents | 09ed37e1da04 |
children | 914e0f16b19a |
line wrap: on
line diff
--- a/FXAnalyse.c Wed Oct 03 12:53:54 2012 +0200 +++ b/FXAnalyse.c Wed Oct 03 12:56:22 2012 +0200 @@ -2462,63 +2462,27 @@ int CVICALLBACK CB_OnCROX (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { - bool BoxChecked = FALSE; - double ActualFrequ=0.0; - - switch (event) - { + switch (event) { case EVENT_COMMIT: - - if (control== PANEL_CHECKBOX_CORRFREQU) - { - GetCtrlVal(MainPanel, PANEL_CHECKBOX_CORRFREQU, &BoxChecked) ; - if (BoxChecked) { - FrequCorrec=TRUE ; - } - else {FrequCorrec=FALSE ;} - - } - - if (control== PANEL_CHECKBOX_KEEP) - { - GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEP, &BoxChecked) ; - if (BoxChecked) { - KeepFrequ=TRUE ; - } - else {KeepFrequ=FALSE ;} - - } - + switch (control) { + + case PANEL_CHECKBOX_CORRFREQU: + // enable frequency correction + GetCtrlVal(MainPanel, PANEL_CHECKBOX_CORRFREQU, &FrequCorrec); + break; - if (control== PANEL_CHECKBOX_KEEPSLOPE) - { - GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEPSLOPE, &BoxChecked) ; - if (BoxChecked) { - KeepSlope=TRUE ; - if (SlopeMeasuring==FALSE && OnSlopeCancelling==FALSE) - { - ActualFrequ = DDSFox_ReadFreq(&DDS1xAD9956); - DDSFox_Set(&DDS1xAD9956, ActualFrequ, SlopeMath2); - OnSlopeCancelling=TRUE; - - - } - } - else {KeepSlope=FALSE ; - if (SlopeMeasuring==FALSE && OnSlopeCancelling==TRUE) - { - ActualFrequ=DDSFox_ReadFreq(&DDS1xAD9956); - DDSFox_Set(&DDS1xAD9956, ActualFrequ, 0.0); - OnSlopeCancelling=FALSE; - } - - } - + case PANEL_CHECKBOX_KEEP: + // keep current dedrifting frequency when dedrifting is disabled + GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEP, &KeepFrequ); + break; + + case PANEL_CHECKBOX_KEEPSLOPE: + // keep current dedrifting slope when dedrifting is disabled + GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEPSLOPE, &KeepSlope); + break; } - break; - - } + } return 0; }