From dfc254257bbd26107bc9b6937d49d9c3000bef99 Mon Sep 17 00:00:00 2001
From: Chef <chwu@eduroam-ipv4-5-0694.triple-a.uni-kl.de>
Date: Tue, 14 Apr 2020 19:25:20 +0200
Subject: [PATCH] CW: define "var1" and "var2" values such that they are the
 filter width. Now, e.g. switching between "var1" and "250" makes no noticable
 audio difference if the "var1" value is 250.

---
 filter_menu.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/filter_menu.c b/filter_menu.c
index 3cd5711..a518f77 100644
--- a/filter_menu.c
+++ b/filter_menu.c
@@ -101,7 +101,8 @@ static void var_spin_low_cb (GtkWidget *widget, gpointer data) {
 
   filter->low=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
   if(vfo[id].mode==modeCWL || vfo[id].mode==modeCWU) {
-    filter->high=filter->low;
+    // Note that a 250 Hz filter has high=low=125 in CW
+    filter->high=filter->low=filter->low/2;
   }
   if(f==vfo[id].filter) {
     vfo_filter_changed(f);
@@ -218,7 +219,14 @@ void filter_menu(GtkWidget *parent) {
       g_signal_connect(b,"pressed",G_CALLBACK(filter_select_cb),(gpointer)(long)i);
 
       GtkWidget *var1_spin_low=gtk_spin_button_new_with_range(-8000.0,+8000.0,1.0);
-      gtk_spin_button_set_value(GTK_SPIN_BUTTON(var1_spin_low),(double)band_filter->low);
+      //
+      // in CW, filter_low is HALF of the filter width
+      //
+      if(vfo[active_receiver->id].mode==modeCWL || vfo[active_receiver->id].mode==modeCWU) {
+        gtk_spin_button_set_value(GTK_SPIN_BUTTON(var1_spin_low),(double)band_filter->low * 2.0);
+      } else {
+        gtk_spin_button_set_value(GTK_SPIN_BUTTON(var1_spin_low),(double)band_filter->low);
+      }
       gtk_grid_attach(GTK_GRID(grid),var1_spin_low,1,row,1,1);
       g_signal_connect(var1_spin_low,"value-changed",G_CALLBACK(var_spin_low_cb),(gpointer)(long)i);
 
@@ -243,7 +251,14 @@ void filter_menu(GtkWidget *parent) {
       g_signal_connect(b,"pressed",G_CALLBACK(filter_select_cb),(gpointer)(long)i);
       
       GtkWidget *var2_spin_low=gtk_spin_button_new_with_range(-8000.0,+8000.0,1.0);
-      gtk_spin_button_set_value(GTK_SPIN_BUTTON(var2_spin_low),(double)band_filter->low);
+      //
+      // in CW, filter_low is HALF of the filter width
+      //
+      if(vfo[active_receiver->id].mode==modeCWL || vfo[active_receiver->id].mode==modeCWU) {
+        gtk_spin_button_set_value(GTK_SPIN_BUTTON(var2_spin_low),(double)band_filter->low * 2.0);
+      } else {
+        gtk_spin_button_set_value(GTK_SPIN_BUTTON(var2_spin_low),(double)band_filter->low);
+      }
       gtk_grid_attach(GTK_GRID(grid),var2_spin_low,1,row,1,1);
       g_signal_connect(var2_spin_low,"value-changed",G_CALLBACK(var_spin_low_cb),(gpointer)(long)i);
 
-- 
2.45.2