From 9c85f7bc91a1a21055aa3f57dde643cdb7064bd9 Mon Sep 17 00:00:00 2001 From: c vw Date: Wed, 21 Jul 2021 10:00:50 +0200 Subject: [PATCH] Removed enum in sliders.h, consistently use members from "action" enum --- sliders.c | 82 +++++++++++++++++++++++++++---------------------------- sliders.h | 19 ------------- zoompan.c | 12 ++++---- 3 files changed, 47 insertions(+), 66 deletions(-) diff --git a/sliders.c b/sliders.c index b1e85db..24ee99b 100644 --- a/sliders.c +++ b/sliders.c @@ -67,7 +67,7 @@ static int height; static GtkWidget *sliders; gint scale_timer; -int scale_status=NO_FUNCTION; +int scale_status=NO_ACTION; int scale_rx=0; GtkWidget *scale_dialog; @@ -133,7 +133,7 @@ int sliders_active_receiver_changed(void *data) { int scale_timeout_cb(gpointer data) { gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; return FALSE; } @@ -162,13 +162,13 @@ void set_attenuation_value(double value) { } } else { if(scale_status!=ATTENUATION) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { char title[64]; if (have_rx_gain) { sprintf(title,"RX GAIN - ADC-%d (dB)",active_receiver->adc); @@ -296,13 +296,13 @@ void set_agc_gain(int rx,double value) { gtk_range_set_value (GTK_RANGE(agc_scale),receiver[rx]->agc_gain); } else { if(scale_status!=AGC_GAIN || scale_rx!=rx) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=AGC_GAIN; scale_rx=rx; char title[64]; @@ -355,13 +355,13 @@ void set_af_gain(int rx,double value) { gtk_range_set_value (GTK_RANGE(af_gain_scale),receiver[rx]->volume*100.0); } else { if(scale_status!=AF_GAIN || scale_rx!=rx) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=AF_GAIN; scale_rx=rx; char title[64]; @@ -415,13 +415,13 @@ void set_rf_gain(int rx,double value) { gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[receiver[rx]->id].gain); } else { if(scale_status!=RF_GAIN || scale_rx!=rx) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=RF_GAIN; scale_rx=rx; char title[64]; @@ -449,13 +449,13 @@ void set_rf_gain(int rx,double value) { void set_filter_width(int rx,int width) { g_print("%s\n",__FUNCTION__); if(scale_status!=IF_WIDTH || scale_rx!=rx) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=IF_WIDTH; scale_rx=rx; char title[64]; @@ -480,13 +480,13 @@ void set_filter_width(int rx,int width) { void set_filter_shift(int rx,int shift) { g_print("%s\n",__FUNCTION__); if(scale_status!=IF_SHIFT || scale_rx!=rx) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=IF_SHIFT; scale_rx=rx; char title[64]; @@ -526,13 +526,13 @@ void set_mic_gain(double value) { gtk_range_set_value (GTK_RANGE(mic_gain_scale),mic_gain); } else { if(scale_status!=MIC_GAIN) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=MIC_GAIN; scale_dialog=gtk_dialog_new_with_buttons("Mic Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL); GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog)); @@ -560,13 +560,13 @@ void set_linein_gain(int value) { gtk_range_set_value (GTK_RANGE(mic_gain_scale),linein_gain); } else { if(scale_status!=LINEIN_GAIN) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=LINEIN_GAIN; scale_dialog=gtk_dialog_new_with_buttons("Linein Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL); GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog)); @@ -599,13 +599,13 @@ void set_drive(double value) { gtk_range_set_value (GTK_RANGE(drive_scale),value); } else { if(scale_status!=DRIVE) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=DRIVE; scale_dialog=gtk_dialog_new_with_buttons("Drive",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL); GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog)); @@ -684,13 +684,13 @@ void set_squelch() { } else { #endif if(scale_status!=SQUELCH) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=SQUELCH; char title[64]; sprintf(title,"Squelch RX %d (Hz)",active_receiver->id); @@ -724,13 +724,13 @@ void set_compression(TRANSMITTER* tx) { } else { #endif if(scale_status!=COMPRESSION) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=COMPRESSION; scale_dialog=gtk_dialog_new_with_buttons("COMP",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL); GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog)); @@ -755,13 +755,13 @@ void set_compression(TRANSMITTER* tx) { void show_diversity_gain() { g_print("%s\n",__FUNCTION__); if(scale_status!=DIV_GAIN) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=DIV_GAIN; scale_dialog=gtk_dialog_new_with_buttons("Diversity Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL); GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog)); @@ -783,13 +783,13 @@ void show_diversity_gain() { void show_diversity_phase() { g_print("%s\n",__FUNCTION__); if(scale_status!=DIV_PHASE) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=DIV_PHASE; scale_dialog=gtk_dialog_new_with_buttons("Diversity Phase",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL); GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog)); diff --git a/sliders.h b/sliders.h index c532bdb..877abf6 100644 --- a/sliders.h +++ b/sliders.h @@ -22,25 +22,6 @@ #include "receiver.h" #include "transmitter.h" -enum { - NO_FUNCTION=0, - SLIDER_AF_GAIN, - SLIDER_RF_GAIN, - SLIDER_MIC_GAIN, - SLIDER_LINEIN_GAIN, - SLIDER_AGC_GAIN, - SLIDER_DRIVE, - SLIDER_ATTENUATION, - SLIDER_SQUELCH, - SLIDER_COMP, - SLIDER_FILTER_WIDTH, - SLIDER_FILTER_SHIFT, - SLIDER_DIVERSITY_GAIN, - SLIDER_DIVERSITY_PHASE, - SLIDER_ZOOM, - SLIDER_PAN -}; - extern gint scale_timer; extern gint scale_status; extern gint scale_rx; diff --git a/zoompan.c b/zoompan.c index b9bfe0f..0e18ead 100644 --- a/zoompan.c +++ b/zoompan.c @@ -103,14 +103,14 @@ void set_zoom(int rx,double value) { gtk_range_set_value (GTK_RANGE(zoom_scale),receiver[rx]->zoom); } else { if(scale_status!=ZOOM || scale_rx!=rx) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } receiver_change_zoom(active_receiver,value); - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=ZOOM; scale_rx=rx; char title[64]; @@ -175,14 +175,14 @@ g_print("set_pan: %f\n",value); gtk_range_set_value (GTK_RANGE(pan_scale),receiver[rx]->pan); } else { if(scale_status!=PAN || scale_rx!=rx) { - if(scale_status!=NO_FUNCTION) { + if(scale_status!=NO_ACTION) { g_source_remove(scale_timer); gtk_widget_destroy(scale_dialog); - scale_status=NO_FUNCTION; + scale_status=NO_ACTION; } } receiver_change_pan(active_receiver,value); - if(scale_status==NO_FUNCTION) { + if(scale_status==NO_ACTION) { scale_status=PAN; scale_rx=rx; char title[64]; -- 2.45.2