]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Manual merge of John's corrections
authorc vw <dl1ycf@darc.de>
Thu, 25 Nov 2021 13:10:33 +0000 (14:10 +0100)
committerc vw <dl1ycf@darc.de>
Thu, 25 Nov 2021 13:10:33 +0000 (14:10 +0100)
actions.c
toolbar.c

index 936ca8b2b62bff86e97ced84090faebc85de1856..0f8c34b8850e8e1847cf12dbb9dc11ceee0d5f62 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -962,21 +962,29 @@ int process_action(void *data) {
          if(rit_increment<1) rit_increment=100;
          if(rit_increment>100) rit_increment=1;
          break;
-        default:
-          // ignore other types
-          break;
+       default:
+         // ignore other types
+         break;
       }
       g_idle_add(ext_vfo_update,NULL);
       break;
     case RSAT:
       if(a->mode==PRESSED) {
-        sat_mode=RSAT_MODE;
+        if(sat_mode==RSAT_MODE) {
+          sat_mode=SAT_NONE;
+        } else {
+          sat_mode=RSAT_MODE;
+        }
         g_idle_add(ext_vfo_update, NULL);
       }
       break;
     case SAT:
       if(a->mode==PRESSED) {
-        sat_mode=SAT_MODE;
+       if(sat_mode==SAT_MODE) {
+         sat_mode=SAT_NONE;
+        } else {
+         sat_mode=SAT_MODE;
+        }
         g_idle_add(ext_vfo_update, NULL);
       }
       break;
index 1c7c7879e5f0e3e205686d55cbd244fab0eef03d..933f6038e4ef7497b579a8c5fe64bf035cb61849 100644 (file)
--- a/toolbar.c
+++ b/toolbar.c
@@ -113,376 +113,6 @@ void update_toolbar_labels() {
   gtk_button_set_label(GTK_BUTTON(sim_function),ActionTable[toolbar_switches[7].switch_function].button_str);
 }
 
-static void close_cb(GtkWidget *widget, gpointer data) {
-  gtk_widget_destroy(last_dialog);
-  last_dialog=NULL;
-}
-
-void band_cb(GtkWidget *widget, gpointer data) {
-  start_band();
-}
-
-void bandstack_cb(GtkWidget *widget, gpointer data) {
-  start_bandstack();
-}
-
-void mode_cb(GtkWidget *widget, gpointer data) {
-  start_mode();
-}
-
-void filter_cb(GtkWidget *widget, gpointer data) {
-  start_filter();
-}
-
-void agc_cb(GtkWidget *widget, gpointer data) {
-  start_agc();
-}
-
-void noise_cb(GtkWidget *widget, gpointer data) {
-  start_noise();
-}
-
-void ctun_cb (GtkWidget *widget, gpointer data) {
-  int id=active_receiver->id;
-#ifdef CLIENT_SERVER
-  if(radio_is_remote) {
-    send_ctun(client_socket,id,vfo[id].ctun==1?0:1);
-  } else {
-#endif
-    vfo[id].ctun=vfo[id].ctun==1?0:1;
-    if(!vfo[id].ctun) {
-      vfo[id].offset=0;
-    }
-    vfo[id].ctun_frequency=vfo[id].frequency;
-    set_offset(active_receiver,vfo[id].offset);
-    g_idle_add(ext_vfo_update,NULL);
-#ifdef CLIENT_SERVER
-  }
-#endif
-}
-
-static void atob_cb (GtkWidget *widget, gpointer data) {
-#ifdef CLIENT_SERVER
-  if(radio_is_remote) {
-    send_vfo(client_socket,VFO_A_TO_B);
-  } else {
-#endif
-    vfo_a_to_b();
-#ifdef CLIENT_SERVER
-  }
-#endif
-}
-
-static void btoa_cb (GtkWidget *widget, gpointer data) {
-#ifdef CLIENT_SERVER
-  if(radio_is_remote) {
-    send_vfo(client_socket,VFO_B_TO_A);
-  } else {
-#endif
-    vfo_b_to_a();
-#ifdef CLIENT_SERVER
-  }
-#endif
-}
-
-static void aswapb_cb (GtkWidget *widget, gpointer data) {
-#ifdef CLIENT_SERVER
-  if(radio_is_remote) {
-    send_vfo(client_socket,VFO_A_SWAP_B);
-  } else {
-#endif
-    vfo_a_swap_b();
-#ifdef CLIENT_SERVER
-  }
-#endif
-}
-
-static void split_cb (GtkWidget *widget, gpointer data) {
-#ifdef CLIENT_SERVER
-  if(radio_is_remote) {
-    send_split(client_socket,split==1?0:1);
-  } else {
-#endif
-    g_idle_add(ext_split_toggle,NULL);
-#ifdef CLIENT_SERVER
-  }
-#endif
-}
-
-static void duplex_cb (GtkWidget *widget, gpointer data) {
-  if(can_transmit && !isTransmitting()) {
-#ifdef CLIENT_SERVER
-    if(radio_is_remote) {
-      send_dup(client_socket,duplex==1?0:1);
-    } else {
-#endif
-      duplex=(duplex==1)?0:1;
-      g_idle_add(ext_set_duplex,NULL);
-#ifdef CLIENT_SERVER
-    }
-#endif
-  }
-}
-
-static void sat_cb (GtkWidget *widget, gpointer data) {
-  int temp;
-  if(can_transmit) {
-    if(sat_mode==SAT_MODE) {
-      temp=SAT_NONE;
-    } else {
-      temp=SAT_MODE;
-    }
-#ifdef CLIENT_SERVER
-    if(radio_is_remote) {
-      send_sat(client_socket,temp);
-    } else {
-#endif
-      sat_mode=temp;
-      g_idle_add(ext_vfo_update,NULL);
-#ifdef CLIENT_SERVER
-    }
-#endif
-  }
-}
-
-static void rsat_cb (GtkWidget *widget, gpointer data) {
-  int temp;
-  if(can_transmit) {
-    if(sat_mode==RSAT_MODE) {
-      temp=SAT_NONE;
-    } else {
-      temp=RSAT_MODE;
-    }
-#ifdef CLIENT_SERVER
-    if(radio_is_remote) {
-      send_sat(client_socket,temp);
-    } else {
-#endif
-      sat_mode=temp;
-      g_idle_add(ext_vfo_update,NULL);
-#ifdef CLIENT_SERVER
-    }
-#endif
-  }
-}
-
-static void rit_enable_cb(GtkWidget *widget, gpointer data) {
-#ifdef CLIENT_SERVER
-  if(radio_is_remote) {
-    send_rit_update(client_socket,active_receiver->id);
-  } else {
-#endif
-    vfo_rit_update(active_receiver->id);
-#ifdef CLIENT_SERVER
-  }
-#endif
-}
-
-static void rit_cb(GtkWidget *widget, gpointer data) {
-  int i=GPOINTER_TO_INT(data);
-#ifdef CLIENT_SERVER
-  if(radio_is_remote) {
-    send_rit(client_socket,active_receiver->id,i);
-  } else {
-#endif
-    vfo_rit(active_receiver->id,i);
-    if(i<0) {
-      rit_minus_timer=g_timeout_add(200,rit_timer_cb,GINT_TO_POINTER(i));
-    } else {
-      rit_plus_timer=g_timeout_add(200,rit_timer_cb,GINT_TO_POINTER(i));
-    }
-#ifdef CLIENT_SERVER
-  }
-#endif
-}
-
-static void rit_clear_cb(GtkWidget *widget, gpointer data) {
-#ifdef CLIENT_SERVER
-  if(radio_is_remote) {
-    send_rit_clear(client_socket,active_receiver->id);
-  } else {
-#endif
-    vfo_rit_clear(active_receiver->id);
-#ifdef CLIENT_SERVER
-  }
-#endif
-}
-
-static void xit_enable_cb(GtkWidget *widget, gpointer data) {
-  if(can_transmit) {
-    transmitter->xit_enabled=transmitter->xit_enabled==1?0:1;
-    if(protocol==NEW_PROTOCOL) {
-      schedule_high_priority();
-    }
-    g_idle_add(ext_vfo_update,NULL);
-  }
-}
-
-static void xit_cb(GtkWidget *widget, gpointer data) {
-  if(can_transmit) {
-    int i=GPOINTER_TO_INT(data);
-    transmitter->xit+=i*rit_increment;
-    if(transmitter->xit>10000) transmitter->xit=10000;
-    if(transmitter->xit<-10000) transmitter->xit=-10000;
-    if(protocol==NEW_PROTOCOL) {
-      schedule_high_priority();
-    }
-    g_idle_add(ext_vfo_update,NULL);
-    if(i<0) {
-      xit_minus_timer=g_timeout_add(200,xit_timer_cb,GINT_TO_POINTER(i));
-    } else {
-      xit_plus_timer=g_timeout_add(200,xit_timer_cb,GINT_TO_POINTER(i));
-    }
-  }
-}
-
-static void xit_clear_cb(GtkWidget *widget, gpointer data) {
-  if(can_transmit) {
-    transmitter->xit=0;
-    g_idle_add(ext_vfo_update,NULL);
-  }
-}
-
-static void freq_cb(GtkWidget *widget, gpointer data) {
-  start_vfo(active_receiver->id);
-}
-
-static void mem_cb(GtkWidget *widget, gpointer data) {
-  start_store();
-}
-
-static void vox_cb(GtkWidget *widget, gpointer data) {
-  vox_enabled=vox_enabled==1?0:1;
-  g_idle_add(ext_vfo_update,NULL);
-}
-
-static void stop() {
-  if(protocol==ORIGINAL_PROTOCOL) {
-    old_protocol_stop();
-  } else {
-    new_protocol_stop();
-  }
-#ifdef GPIO
-  gpio_close();
-#endif
-#ifdef WIRIINGPI
-  gpio_close();
-#endif
-}
-
-static void yes_cb(GtkWidget *widget, gpointer data) {
-  stop();
-  _exit(0);
-}
-
-static void halt_cb(GtkWidget *widget, gpointer data) {
-  stop();
-  int rc=system("shutdown -h -P now");
-  _exit(0);
-}
-
-static void exit_cb(GtkWidget *widget, gpointer data) {
-
-  radioSaveState();
-
-  GtkWidget *dialog=gtk_dialog_new_with_buttons("Exit",GTK_WINDOW(parent_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
-
-  GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
-  GtkWidget *grid=gtk_grid_new();
-
-  gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
-  gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
-
-  GtkWidget *label=gtk_label_new("Exit?");
-  //gtk_widget_override_font(label, pango_font_description_from_string("Arial 18"));
-  gtk_widget_show(label);
-  gtk_grid_attach(GTK_GRID(grid),label,1,0,1,1);
-
-  GtkWidget *b_yes=gtk_button_new_with_label("Yes");
-  //gtk_widget_override_font(b_yes, pango_font_description_from_string("Arial 18"));
-  gtk_widget_show(b_yes);
-  gtk_grid_attach(GTK_GRID(grid),b_yes,0,1,1,1);
-  g_signal_connect(b_yes,"pressed",G_CALLBACK(yes_cb),NULL);
-
-  GtkWidget *b_halt=gtk_button_new_with_label("Halt System");
-  //gtk_widget_override_font(b_halt, pango_font_description_from_string("Arial 18"));
-  gtk_widget_show(b_halt);
-  gtk_grid_attach(GTK_GRID(grid),b_halt,2,1,1,1);
-  g_signal_connect(b_halt,"pressed",G_CALLBACK(halt_cb),NULL);
-
-  gtk_container_add(GTK_CONTAINER(content),grid);
-  GtkWidget *close_button=gtk_dialog_add_button(GTK_DIALOG(dialog),"Cancel",GTK_RESPONSE_OK);
-  //gtk_widget_override_font(close_button, pango_font_description_from_string("Arial 18"));
-  gtk_widget_show_all(dialog);
-
-  g_signal_connect_swapped (dialog,
-                           "response",
-                           G_CALLBACK (gtk_widget_destroy),
-                           dialog);
-
-  gtk_dialog_run(GTK_DIALOG(dialog));
-
-}
-
-void lock_cb(GtkWidget *widget, gpointer data) {
-#ifdef CLIENT_SERVER
-  if(radio_is_remote) {
-    send_lock(client_socket,locked==1?0:1);
-  } else {
-#endif
-    locked=locked==1?0:1;
-    g_idle_add(ext_vfo_update,NULL);
-#ifdef CLIENT_SERVER
-  }
-#endif
-}
-
-void mox_cb(GtkWidget *widget, gpointer data) {
-
-  if(getTune()==1) {
-    setTune(0);
-  }
-  if(getMox()==1) {
-    setMox(0);
-  } else if(canTransmit() || tx_out_of_band) {
-    setMox(1);
-  } else {
-    transmitter_set_out_of_band(transmitter);
-  }
-  g_idle_add(ext_vfo_update,NULL);
-}
-
-void mox_update(int state) {
-//fprintf(stderr,"mox_update: state=%d\n",state);
-  if(getTune()==1) {
-    setTune(0);
-  }
-  if(state) {
-    if(canTransmit() || tx_out_of_band) {
-      setMox(state);
-    } else {
-      transmitter_set_out_of_band(transmitter);
-    }
-  } else {
-    setMox(state);
-  }
-  g_idle_add(ext_vfo_update,NULL);
-}
-
-void tune_cb(GtkWidget *widget, gpointer data) {
-  if(getMox()==1) {
-    setMox(0);
-  }
-  if(getTune()==1) {
-    setTune(0);
-  } else if(canTransmit() || tx_out_of_band) {
-    setTune(1);
-  } else {
-    transmitter_set_out_of_band(transmitter);
-  }
-  g_idle_add(ext_vfo_update,NULL);
-}
-
 void tune_update(int state) {
   if(getMox()==1) {
     setMox(0);
@@ -502,6 +132,7 @@ void tune_update(int state) {
 
 void switch_pressed_cb(GtkWidget *widget, gpointer data) {
   gint i=GPOINTER_TO_INT(data);
+fprintf(stderr,"%s: %d action=%d\n",__FUNCTION__,i,toolbar_switches[i].switch_function);
   PROCESS_ACTION *a=g_new(PROCESS_ACTION,1);
   a->action=toolbar_switches[i].switch_function;
   a->mode=PRESSED;
@@ -510,6 +141,7 @@ void switch_pressed_cb(GtkWidget *widget, gpointer data) {
 
 void switch_released_cb(GtkWidget *widget, gpointer data) {
   gint i=GPOINTER_TO_INT(data);
+fprintf(stderr,"%s: %d action=%d\n",__FUNCTION__,i,toolbar_switches[i].switch_function);
   PROCESS_ACTION *a=g_new(PROCESS_ACTION,1);
   a->action=toolbar_switches[i].switch_function;
   a->mode=RELEASED;