# HG changeset patch # User Daniele Nicolodi # Date 1349261782 -7200 # Node ID 1e4b8ba97faf7a291d0193b01923c1e92dc1d64d # Parent 09ed37e1da04dc212612b48c9720b17ce47d1b28 Cleanup code handling dedrifing options This removes some code that does not make much sense to me. diff -r 09ed37e1da04 -r 1e4b8ba97faf FXAnalyse.c --- 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; }