filter.c \
main.c \
menu.c \
+new_menu.c \
+exit_menu.c \
+general_menu.c \
+audio_menu.c \
+ant_menu.c \
+display_menu.c \
+dsp_menu.c \
+pa_menu.c \
+cw_menu.c \
+oc_menu.c \
+freedv_menu.c \
+rit.c \
meter.c \
mode.c \
old_discovery.c \
discovered.h \
filter.h \
menu.h \
+new_menu.h \
+exit_menu.h \
+general_menu.h \
+audio_menu.h \
+ant_menu.h \
+display_menu.h \
+dsp_menu.h \
+pa_menu.h \
+cw_menu.h \
+oc_menu.h \
+freedv_menu.h \
+rit.h \
meter.h \
mode.h \
old_discovery.h \
version.o \
main.o \
menu.o \
+new_menu.o \
+exit_menu.o \
+general_menu.o \
+audio_menu.o \
+ant_menu.o \
+display_menu.o \
+dsp_menu.o \
+pa_menu.o \
+cw_menu.o \
+oc_menu.o \
+freedv_menu.o \
+rit.o \
meter.o \
mode.o \
old_discovery.o \
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "ant_menu.h"
+#include "band.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static void rx_ant_cb(GtkWidget *widget, gpointer data) {
+ int b=((int)data)>>4;
+ int ant=((int)data)&0xF;
+ BAND *band=band_get_band(b);
+ band->alexRxAntenna=ant;
+ set_alex_rx_antenna(ant);
+}
+
+static void rx_lime_ant_cb(GtkWidget *widget, gpointer data) {
+ int ant=((int)data)&0xF;
+ BAND *band=band_get_current_band();
+ band->alexRxAntenna=ant;
+ set_alex_rx_antenna(ant);
+}
+
+static void tx_ant_cb(GtkWidget *widget, gpointer data) {
+ int b=((int)data)>>4;
+ int ant=((int)data)&0xF;
+ BAND *band=band_get_band(b);
+ band->alexTxAntenna=ant;
+ set_alex_tx_antenna(ant);
+}
+
+void ant_menu(GtkWidget *parent) {
+ int i;
+
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close ANT");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+ GtkWidget *rx_ant_label=gtk_label_new("Receive");
+ //gtk_widget_override_font(rx_ant_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(rx_ant_label);
+ gtk_grid_attach(GTK_GRID(grid),rx_ant_label,0,1,1,1);
+
+ GtkWidget *rx1_label=gtk_label_new("1");
+ //gtk_widget_override_font(rx1_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(rx1_label);
+ gtk_grid_attach(GTK_GRID(grid),rx1_label,1,1,1,1);
+
+ GtkWidget *rx2_label=gtk_label_new("2");
+ //gtk_widget_override_font(rx2_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(rx2_label);
+ gtk_grid_attach(GTK_GRID(grid),rx2_label,2,2,1,1);
+
+ GtkWidget *rx3_label=gtk_label_new("3");
+ //gtk_widget_override_font(rx3_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(rx3_label);
+ gtk_grid_attach(GTK_GRID(grid),rx3_label,3,1,1,1);
+
+ GtkWidget *ext1_label=gtk_label_new("EXT1");
+ //gtk_widget_override_font(ext1_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(ext1_label);
+ gtk_grid_attach(GTK_GRID(grid),ext1_label,4,1,1,1);
+
+ GtkWidget *ext2_label=gtk_label_new("EXT2");
+ //gtk_widget_override_font(ext2_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(ext2_label);
+ gtk_grid_attach(GTK_GRID(grid),ext2_label,5,1,1,1);
+
+ GtkWidget *xvtr_label=gtk_label_new("XVTR");
+ //gtk_widget_override_font(xvtr_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(xvtr_label);
+ gtk_grid_attach(GTK_GRID(grid),xvtr_label,6,1,1,1);
+
+ GtkWidget *tx_ant_label=gtk_label_new("Transmit");
+ //gtk_widget_override_font(tx_ant_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(tx_ant_label);
+ gtk_grid_attach(GTK_GRID(grid),tx_ant_label,7,1,1,1);
+
+ GtkWidget *tx1_label=gtk_label_new("1");
+ //gtk_widget_override_font(tx1_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(tx1_label);
+ gtk_grid_attach(GTK_GRID(grid),tx1_label,8,1,1,1);
+
+ GtkWidget *tx2_label=gtk_label_new("2");
+ //gtk_widget_override_font(tx2_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(tx2_label);
+ gtk_grid_attach(GTK_GRID(grid),tx2_label,9,1,1,1);
+
+ GtkWidget *tx3_label=gtk_label_new("3");
+ //gtk_widget_override_font(tx3_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(tx3_label);
+ gtk_grid_attach(GTK_GRID(grid),tx3_label,10,1,1,1);
+
+ for(i=0;i<HAM_BANDS;i++) {
+ BAND *band=band_get_band(i);
+
+ GtkWidget *band_label=gtk_label_new(band->title);
+ //gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(band_label);
+ gtk_grid_attach(GTK_GRID(grid),band_label,0,i+2,1,1);
+
+ GtkWidget *rx1_b=gtk_radio_button_new(NULL);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx1_b), band->alexRxAntenna==0);
+ gtk_widget_show(rx1_b);
+ gtk_grid_attach(GTK_GRID(grid),rx1_b,1,i+2,1,1);
+ g_signal_connect(rx1_b,"pressed",G_CALLBACK(rx_ant_cb),(gpointer)((i<<4)+0));
+
+ GtkWidget *rx2_b=gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(rx1_b));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx2_b), band->alexRxAntenna==1);
+ gtk_widget_show(rx2_b);
+ gtk_grid_attach(GTK_GRID(grid),rx2_b,2,i+2,1,1);
+ g_signal_connect(rx2_b,"pressed",G_CALLBACK(rx_ant_cb),(gpointer)((i<<4)+1));
+
+ GtkWidget *rx3_b=gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(rx2_b));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx3_b), band->alexRxAntenna==2);
+ gtk_widget_show(rx3_b);
+ gtk_grid_attach(GTK_GRID(grid),rx3_b,3,i+2,1,1);
+ g_signal_connect(rx3_b,"pressed",G_CALLBACK(rx_ant_cb),(gpointer)((i<<4)+2));
+
+ GtkWidget *ext1_b=gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(rx3_b));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ext1_b), band->alexRxAntenna==3);
+ gtk_widget_show(ext1_b);
+ gtk_grid_attach(GTK_GRID(grid),ext1_b,4,i+2,1,1);
+ g_signal_connect(ext1_b,"pressed",G_CALLBACK(rx_ant_cb),(gpointer)((i<<4)+3));
+
+ GtkWidget *ext2_b=gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(ext1_b));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ext2_b), band->alexRxAntenna==4);
+ gtk_widget_show(ext2_b);
+ gtk_grid_attach(GTK_GRID(grid),ext2_b,5,i+2,1,1);
+ g_signal_connect(ext2_b,"pressed",G_CALLBACK(rx_ant_cb),(gpointer)((i<<4)+4));
+
+ GtkWidget *xvtr_b=gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(ext2_b));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (xvtr_b), band->alexRxAntenna==5);
+ gtk_widget_show(xvtr_b);
+ gtk_grid_attach(GTK_GRID(grid),xvtr_b,6,i+2,1,1);
+ g_signal_connect(xvtr_b,"pressed",G_CALLBACK(rx_ant_cb),(gpointer)((i<<4)+5));
+
+ GtkWidget *ant_band_label=gtk_label_new(band->title);
+ //gtk_widget_override_font(ant_band_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(ant_band_label);
+ gtk_grid_attach(GTK_GRID(grid),ant_band_label,7,i+2,1,1);
+
+ GtkWidget *tx1_b=gtk_radio_button_new(NULL);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tx1_b), band->alexTxAntenna==0);
+ gtk_widget_show(tx1_b);
+ gtk_grid_attach(GTK_GRID(grid),tx1_b,8,i+2,1,1);
+
+ GtkWidget *tx2_b=gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(tx1_b));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tx2_b), band->alexTxAntenna==1);
+ gtk_widget_show(tx2_b);
+ gtk_grid_attach(GTK_GRID(grid),tx2_b,9,i+2,1,1);
+ g_signal_connect(tx2_b,"pressed",G_CALLBACK(tx_ant_cb),(gpointer)((i<<4)+1));
+
+ GtkWidget *tx3_b=gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(tx2_b));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tx3_b), band->alexTxAntenna==2);
+ gtk_widget_show(tx3_b);
+ gtk_grid_attach(GTK_GRID(grid),tx3_b,10,i+2,1,1);
+ g_signal_connect(tx3_b,"pressed",G_CALLBACK(tx_ant_cb),(gpointer)((i<<4)+2));
+
+ }
+ }
+
+#ifdef LIMESDR
+ if(protocol==LIMESDR_PROTOCOL) {
+ BAND *band=band_get_current_band();
+
+ GtkWidget *rx1_none=gtk_radio_button_new_with_label(NULL,"RX 1: NONE");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx1_none), band->alexRxAntenna==0);
+ gtk_widget_show(rx1_none);
+ gtk_grid_attach(GTK_GRID(grid),rx1_none,0,1,1,1);
+ g_signal_connect(rx1_none,"pressed",G_CALLBACK(rx_lime_ant_cb),(gpointer)0);
+
+ GtkWidget *rx1_lnah=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(rx1_none),"RX1: LNAH");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx1_lnah), band->alexRxAntenna==1);
+ gtk_widget_show(rx1_lnah);
+ gtk_grid_attach(GTK_GRID(grid),rx1_lnah,0,2,1,1);
+ g_signal_connect(rx1_lnah,"pressed",G_CALLBACK(rx_lime_ant_cb),(gpointer)+1);
+
+ GtkWidget *rx1_lnal=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(rx1_lnah),"RX1: LNAL");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx1_lnal), band->alexRxAntenna==2);
+ gtk_widget_show(rx1_lnal);
+ gtk_grid_attach(GTK_GRID(grid),rx1_lnal,0,3,1,1);
+ g_signal_connect(rx1_lnal,"pressed",G_CALLBACK(rx_lime_ant_cb),(gpointer)2);
+
+ GtkWidget *rx1_lnaw=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(rx1_lnal),"RX1: LNAW");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx1_lnaw), band->alexRxAntenna==3);
+ gtk_widget_show(rx1_lnaw);
+ gtk_grid_attach(GTK_GRID(grid),rx1_lnaw,0,4,1,1);
+ g_signal_connect(rx1_lnaw,"pressed",G_CALLBACK(rx_lime_ant_cb),(gpointer)3);
+ }
+#endif
+
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+void ant_menu(GtkWidget *parent);
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "audio_menu.h"
+#include "audio.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static void linein_cb(GtkWidget *widget, gpointer data) {
+ mic_linein=mic_linein==1?0:1;
+}
+
+static void micboost_cb(GtkWidget *widget, gpointer data) {
+ mic_boost=mic_boost==1?0:1;
+}
+
+static void local_audio_cb(GtkWidget *widget, gpointer data) {
+ if(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ if(audio_open_output()==0) {
+ local_audio=1;
+ } else {
+ local_audio=0;
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+ }
+ } else {
+ if(local_audio) {
+ local_audio=0;
+ audio_close_output();
+ }
+ }
+}
+
+static void local_output_changed_cb(GtkWidget *widget, gpointer data) {
+ n_selected_output_device=(int)(long)data;
+
+ if(local_audio) {
+ audio_close_output();
+ if(audio_open_output()==0) {
+ local_audio=1;
+ }
+ }
+}
+
+static void local_microphone_cb(GtkWidget *widget, gpointer data) {
+fprintf(stderr,"local_microphone_cb: %d\n",local_microphone);
+ if(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ if(audio_open_input()==0) {
+ local_microphone=1;
+ } else {
+ local_microphone=0;
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+ }
+ } else {
+ if(local_microphone) {
+ local_microphone=0;
+ audio_close_input();
+ }
+ }
+}
+
+static void local_input_changed_cb(GtkWidget *widget, gpointer data) {
+ n_selected_input_device=(int)(long)data;
+fprintf(stderr,"local_input_changed_cb: %d selected=%d\n",local_microphone,n_selected_input_device);
+ if(local_microphone) {
+ audio_close_input();
+ if(audio_open_input()==0) {
+ local_microphone=1;
+ } else {
+ local_microphone=0;
+ }
+ }
+}
+
+
+void audio_menu(GtkWidget *parent) {
+ int i;
+
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ //gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close Audio");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+
+ if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+ GtkWidget *linein_b=gtk_check_button_new_with_label("Mic Line In");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (linein_b), mic_linein);
+ gtk_widget_show(linein_b);
+ gtk_grid_attach(GTK_GRID(grid),linein_b,0,1,1,1);
+ g_signal_connect(linein_b,"toggled",G_CALLBACK(linein_cb),NULL);
+
+ GtkWidget *micboost_b=gtk_check_button_new_with_label("Mic Boost");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (micboost_b), mic_boost);
+ gtk_widget_show(micboost_b);
+ gtk_grid_attach(GTK_GRID(grid),micboost_b,0,2,1,1);
+ g_signal_connect(micboost_b,"toggled",G_CALLBACK(micboost_cb),NULL);
+ }
+
+
+ if(n_output_devices>0) {
+ GtkWidget *local_audio_b=gtk_check_button_new_with_label("Local Audio");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (local_audio_b), local_audio);
+ gtk_widget_show(local_audio_b);
+ gtk_grid_attach(GTK_GRID(grid),local_audio_b,1,1,1,1);
+ g_signal_connect(local_audio_b,"toggled",G_CALLBACK(local_audio_cb),NULL);
+
+ if(n_selected_output_device==-1) n_selected_output_device=0;
+
+ for(i=0;i<n_output_devices;i++) {
+ GtkWidget *output;
+ if(i==0) {
+ output=gtk_radio_button_new_with_label(NULL,output_devices[i]);
+ } else {
+ output=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(output),output_devices[i]);
+ }
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (output), n_selected_output_device==i);
+ gtk_widget_show(output);
+ gtk_grid_attach(GTK_GRID(grid),output,1,i+2,1,1);
+ g_signal_connect(output,"pressed",G_CALLBACK(local_output_changed_cb),(gpointer *)i);
+ }
+ }
+
+ if(n_input_devices>0) {
+ GtkWidget *local_microphone_b=gtk_check_button_new_with_label("Microphone Audio");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (local_microphone_b), local_microphone);
+ gtk_widget_show(local_microphone_b);
+ gtk_grid_attach(GTK_GRID(grid),local_microphone_b,2,1,1,1);
+ g_signal_connect(local_microphone_b,"toggled",G_CALLBACK(local_microphone_cb),NULL);
+
+ if(n_selected_input_device==-1) n_selected_input_device=0;
+
+ for(i=0;i<n_input_devices;i++) {
+ GtkWidget *input;
+ if(i==0) {
+ input=gtk_radio_button_new_with_label(NULL,input_devices[i]);
+ } else {
+ input=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(input),input_devices[i]);
+ }
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (input), n_selected_input_device==i);
+ gtk_widget_show(input);
+ gtk_grid_attach(GTK_GRID(grid),input,2,i+2,1,1);
+ g_signal_connect(input,"pressed",G_CALLBACK(local_input_changed_cb),(gpointer *)i);
+ }
+ }
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+extern void audio_menu(GtkWidget *parent);
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "pa_menu.h"
+#include "band.h"
+#include "bandstack.h"
+#include "filter.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static void cw_keyer_internal_cb(GtkWidget *widget, gpointer data) {
+ cw_keyer_internal=cw_keyer_internal==1?0:1;
+ cw_changed();
+}
+
+static void cw_keyer_speed_value_changed_cb(GtkWidget *widget, gpointer data) {
+ cw_keyer_speed=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ cw_changed();
+}
+
+static void cw_breakin_cb(GtkWidget *widget, gpointer data) {
+ cw_breakin=cw_breakin==1?0:1;
+ cw_changed();
+}
+
+static void cw_keyer_hang_time_value_changed_cb(GtkWidget *widget, gpointer data) {
+ cw_keyer_hang_time=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ cw_changed();
+}
+
+static void cw_keyer_weight_value_changed_cb(GtkWidget *widget, gpointer data) {
+ cw_keyer_weight=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ cw_changed();
+}
+
+static void cw_keys_reversed_cb(GtkWidget *widget, gpointer data) {
+ cw_keys_reversed=cw_keys_reversed==1?0:1;
+ cw_changed();
+}
+
+static void cw_keyer_mode_cb(GtkWidget *widget, gpointer data) {
+ cw_keyer_mode=(int)data;
+ cw_changed();
+}
+
+static void cw_keyer_sidetone_level_value_changed_cb(GtkWidget *widget, gpointer data) {
+ cw_keyer_sidetone_volume=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ cw_changed();
+}
+
+static void cw_keyer_sidetone_frequency_value_changed_cb(GtkWidget *widget, gpointer data) {
+ cw_keyer_sidetone_frequency=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ if(mode==modeCWL || mode==modeCWU) {
+ BANDSTACK_ENTRY *entry=bandstack_entry_get_current();
+ FILTER* band_filters=filters[entry->mode];
+ FILTER* band_filter=&band_filters[entry->filter];
+ setFilter(band_filter->low,band_filter->high);
+ }
+ cw_changed();
+}
+
+void cw_menu(GtkWidget *parent) {
+ int i;
+
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close CW");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ GtkWidget *cw_speed_label=gtk_label_new("CW Speed (WPM)");
+ //gtk_widget_override_font(cw_speed_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(cw_speed_label);
+ gtk_grid_attach(GTK_GRID(grid),cw_speed_label,0,1,1,1);
+
+ GtkWidget *cw_keyer_speed_b=gtk_spin_button_new_with_range(1.0,60.0,1.0);
+ //gtk_widget_override_font(cw_keyer_speed_b, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(cw_keyer_speed_b),(double)cw_keyer_speed);
+ gtk_widget_show(cw_keyer_speed_b);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_speed_b,1,1,1,1);
+ g_signal_connect(cw_keyer_speed_b,"value_changed",G_CALLBACK(cw_keyer_speed_value_changed_cb),NULL);
+
+ GtkWidget *cw_breakin_b=gtk_check_button_new_with_label("CW Break In - Delay (ms)");
+ //gtk_widget_override_font(cw_breakin_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw_breakin_b), cw_breakin);
+ gtk_widget_show(cw_breakin_b);
+ gtk_grid_attach(GTK_GRID(grid),cw_breakin_b,0,2,1,1);
+ g_signal_connect(cw_breakin_b,"toggled",G_CALLBACK(cw_breakin_cb),NULL);
+
+ GtkWidget *cw_keyer_hang_time_b=gtk_spin_button_new_with_range(0.0,1000.0,1.0);
+ //gtk_widget_override_font(cw_keyer_hang_time_b, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(cw_keyer_hang_time_b),(double)cw_keyer_hang_time);
+ gtk_widget_show(cw_keyer_hang_time_b);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_hang_time_b,1,2,1,1);
+ g_signal_connect(cw_keyer_hang_time_b,"value_changed",G_CALLBACK(cw_keyer_hang_time_value_changed_cb),NULL);
+
+ GtkWidget *cw_keyer_straight=gtk_radio_button_new_with_label(NULL,"CW KEYER STRAIGHT");
+ //gtk_widget_override_font(cw_keyer_straight, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw_keyer_straight), cw_keyer_mode==KEYER_STRAIGHT);
+ gtk_widget_show(cw_keyer_straight);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_straight,0,3,1,1);
+ g_signal_connect(cw_keyer_straight,"pressed",G_CALLBACK(cw_keyer_mode_cb),(gpointer *)KEYER_STRAIGHT);
+
+ GtkWidget *cw_keyer_mode_a=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(cw_keyer_straight),"CW KEYER MODE A");
+ //gtk_widget_override_font(cw_keyer_mode_a, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw_keyer_mode_a), cw_keyer_mode==KEYER_MODE_A);
+ gtk_widget_show(cw_keyer_mode_a);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_mode_a,0,4,1,1);
+ g_signal_connect(cw_keyer_mode_a,"pressed",G_CALLBACK(cw_keyer_mode_cb),(gpointer *)KEYER_MODE_A);
+
+ GtkWidget *cw_keyer_mode_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(cw_keyer_mode_a),"CW KEYER MODE B");
+ //gtk_widget_override_font(cw_keyer_mode_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw_keyer_mode_b), cw_keyer_mode==KEYER_MODE_B);
+ gtk_widget_show(cw_keyer_mode_b);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_mode_b,0,5,1,1);
+ g_signal_connect(cw_keyer_mode_b,"pressed",G_CALLBACK(cw_keyer_mode_cb),(gpointer *)KEYER_MODE_B);
+
+ GtkWidget *cw_keys_reversed_b=gtk_check_button_new_with_label("Keys reversed");
+ //gtk_widget_override_font(cw_keys_reversed_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw_keys_reversed_b), cw_keys_reversed);
+ gtk_widget_show(cw_keys_reversed_b);
+ gtk_grid_attach(GTK_GRID(grid),cw_keys_reversed_b,0,6,1,1);
+
+ GtkWidget *cw_keyer_sidetone_level_label=gtk_label_new("Sidetone Level:");
+ //gtk_widget_override_font(cw_keyer_sidetone_level_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(cw_keyer_sidetone_level_label);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_sidetone_level_label,0,7,1,1);
+
+ GtkWidget *cw_keyer_sidetone_level_b=gtk_spin_button_new_with_range(1.0,protocol==NEW_PROTOCOL?255.0:127.0,1.0);
+ //gtk_widget_override_font(cw_keyer_sidetone_level_b, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(cw_keyer_sidetone_level_b),(double)cw_keyer_sidetone_volume);
+ gtk_widget_show(cw_keyer_sidetone_level_b);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_sidetone_level_b,1,7,1,1);
+ g_signal_connect(cw_keyer_sidetone_level_b,"value_changed",G_CALLBACK(cw_keyer_sidetone_level_value_changed_cb),NULL);
+
+ GtkWidget *cw_keyer_sidetone_frequency_label=gtk_label_new("Sidetone Freq:");
+ //gtk_widget_override_font(cw_keyer_sidetone_frequency_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(cw_keyer_sidetone_frequency_label);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_sidetone_frequency_label,0,8,1,1);
+
+ GtkWidget *cw_keyer_sidetone_frequency_b=gtk_spin_button_new_with_range(100.0,1000.0,1.0);
+ //gtk_widget_override_font(cw_keyer_sidetone_frequency_b, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(cw_keyer_sidetone_frequency_b),(double)cw_keyer_sidetone_frequency);
+ gtk_widget_show(cw_keyer_sidetone_frequency_b);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_sidetone_frequency_b,1,8,1,1);
+ g_signal_connect(cw_keyer_sidetone_frequency_b,"value_changed",G_CALLBACK(cw_keyer_sidetone_frequency_value_changed_cb),NULL);
+
+ GtkWidget *cw_keyer_weight_label=gtk_label_new("Weight:");
+ //gtk_widget_override_font(cw_keyer_weight_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(cw_keyer_weight_label);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_weight_label,0,9,1,1);
+
+ GtkWidget *cw_keyer_weight_b=gtk_spin_button_new_with_range(0.0,100.0,1.0);
+ //gtk_widget_override_font(cw_keyer_weight_b, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(cw_keyer_weight_b),(double)cw_keyer_weight);
+ gtk_widget_show(cw_keyer_weight_b);
+ gtk_grid_attach(GTK_GRID(grid),cw_keyer_weight_b,1,9,1,1);
+ g_signal_connect(cw_keyer_weight_b,"value_changed",G_CALLBACK(cw_keyer_weight_value_changed_cb),NULL);
+
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+extern void cw_menu(GtkWidget *parent);
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "display_menu.h"
+#include "channel.h"
+#include "radio.h"
+#include "wdsp.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static void detector_mode_cb(GtkWidget *widget, gpointer data) {
+ display_detector_mode=(int)data;
+ SetDisplayDetectorMode(CHANNEL_RX0, 0, display_detector_mode);
+}
+
+static void average_mode_cb(GtkWidget *widget, gpointer data) {
+ display_average_mode=(int)data;
+ SetDisplayAverageMode(CHANNEL_RX0, 0, display_average_mode);
+}
+
+static void time_value_changed_cb(GtkWidget *widget, gpointer data) {
+ display_average_time=gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
+ calculate_display_average();
+ //SetDisplayAvBackmult(CHANNEL_RX0, 0, display_avb);
+ //SetDisplayNumAverage(CHANNEL_RX0, 0, display_average);
+}
+
+static void filled_cb(GtkWidget *widget, gpointer data) {
+ display_filled=display_filled==1?0:1;
+}
+
+static void frames_per_second_value_changed_cb(GtkWidget *widget, gpointer data) {
+ updates_per_second=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ calculate_display_average();
+}
+
+static void panadapter_high_value_changed_cb(GtkWidget *widget, gpointer data) {
+ panadapter_high=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+}
+
+static void panadapter_low_value_changed_cb(GtkWidget *widget, gpointer data) {
+ panadapter_low=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+}
+
+static void waterfall_high_value_changed_cb(GtkWidget *widget, gpointer data) {
+ waterfall_high=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+}
+
+static void waterfall_low_value_changed_cb(GtkWidget *widget, gpointer data) {
+ waterfall_low=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+}
+
+static void waterfall_automatic_cb(GtkWidget *widget, gpointer data) {
+ waterfall_automatic=waterfall_automatic==1?0:1;
+}
+
+static void display_panadapter_cb(GtkWidget *widget, gpointer data) {
+ display_panadapter=display_panadapter==1?0:1;
+ reconfigure_display();
+}
+
+static void display_waterfall_cb(GtkWidget *widget, gpointer data) {
+ display_waterfall=display_waterfall==1?0:1;
+ reconfigure_display();
+}
+
+static void display_sliders_cb(GtkWidget *widget, gpointer data) {
+ display_sliders=display_sliders==1?0:1;
+ reconfigure_display();
+}
+
+static void display_toolbar_cb(GtkWidget *widget, gpointer data) {
+ display_toolbar=display_toolbar==1?0:1;
+ reconfigure_display();
+}
+
+static void toolbar_dialog_buttons_cb(GtkWidget *widget, gpointer data) {
+ toolbar_dialog_buttons=toolbar_dialog_buttons==1?0:1;
+ update_toolbar_labels();
+}
+
+void display_menu(GtkWidget *parent) {
+ int i;
+
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close Display");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ GtkWidget *filled_b=gtk_check_button_new_with_label("Fill Panadapter");
+ //gtk_widget_override_font(filled_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (filled_b), display_filled);
+ gtk_widget_show(filled_b);
+ gtk_grid_attach(GTK_GRID(grid),filled_b,0,1,1,1);
+ g_signal_connect(filled_b,"toggled",G_CALLBACK(filled_cb),NULL);
+
+ GtkWidget *frames_per_second_label=gtk_label_new("Frames Per Second: ");
+ //gtk_widget_override_font(frames_per_second_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(frames_per_second_label);
+ gtk_grid_attach(GTK_GRID(grid),frames_per_second_label,0,2,1,1);
+
+ GtkWidget *frames_per_second_r=gtk_spin_button_new_with_range(1.0,100.0,1.0);
+ //gtk_widget_override_font(frames_per_second_r, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(frames_per_second_r),(double)updates_per_second);
+ gtk_widget_show(frames_per_second_r);
+ gtk_grid_attach(GTK_GRID(grid),frames_per_second_r,1,2,1,1);
+ g_signal_connect(frames_per_second_r,"value_changed",G_CALLBACK(frames_per_second_value_changed_cb),NULL);
+
+
+ GtkWidget *panadapter_high_label=gtk_label_new("Panadapter High: ");
+ //gtk_widget_override_font(panadapter_high_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(panadapter_high_label);
+ gtk_grid_attach(GTK_GRID(grid),panadapter_high_label,0,3,1,1);
+
+ GtkWidget *panadapter_high_r=gtk_spin_button_new_with_range(-220.0,100.0,1.0);
+ //gtk_widget_override_font(panadapter_high_r, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(panadapter_high_r),(double)panadapter_high);
+ gtk_widget_show(panadapter_high_r);
+ gtk_grid_attach(GTK_GRID(grid),panadapter_high_r,1,3,1,1);
+ g_signal_connect(panadapter_high_r,"value_changed",G_CALLBACK(panadapter_high_value_changed_cb),NULL);
+
+ GtkWidget *panadapter_low_label=gtk_label_new("Panadapter Low: ");
+ //gtk_widget_override_font(panadapter_low_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(panadapter_low_label);
+ gtk_grid_attach(GTK_GRID(grid),panadapter_low_label,0,4,1,1);
+
+ GtkWidget *panadapter_low_r=gtk_spin_button_new_with_range(-220.0,100.0,1.0);
+ //gtk_widget_override_font(panadapter_low_r, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(panadapter_low_r),(double)panadapter_low);
+ gtk_widget_show(panadapter_low_r);
+ gtk_grid_attach(GTK_GRID(grid),panadapter_low_r,1,4,1,1);
+ g_signal_connect(panadapter_low_r,"value_changed",G_CALLBACK(panadapter_low_value_changed_cb),NULL);
+
+ GtkWidget *waterfall_automatic_label=gtk_label_new("Waterfall Automatic: ");
+ //gtk_widget_override_font(waterfall_automatic_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(waterfall_automatic_label);
+ gtk_grid_attach(GTK_GRID(grid),waterfall_automatic_label,0,5,1,1);
+
+ GtkWidget *waterfall_automatic_b=gtk_check_button_new();
+ //gtk_widget_override_font(waterfall_automatic_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (waterfall_automatic_b), waterfall_automatic);
+ gtk_widget_show(waterfall_automatic_b);
+ gtk_grid_attach(GTK_GRID(grid),waterfall_automatic_b,1,5,1,1);
+ g_signal_connect(waterfall_automatic_b,"toggled",G_CALLBACK(waterfall_automatic_cb),NULL);
+
+ GtkWidget *waterfall_high_label=gtk_label_new("Waterfall High: ");
+ //gtk_widget_override_font(waterfall_high_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(waterfall_high_label);
+ gtk_grid_attach(GTK_GRID(grid),waterfall_high_label,0,6,1,1);
+
+ GtkWidget *waterfall_high_r=gtk_spin_button_new_with_range(-220.0,100.0,1.0);
+ //gtk_widget_override_font(waterfall_high_r, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(waterfall_high_r),(double)waterfall_high);
+ gtk_widget_show(waterfall_high_r);
+ gtk_grid_attach(GTK_GRID(grid),waterfall_high_r,1,6,1,1);
+ g_signal_connect(waterfall_high_r,"value_changed",G_CALLBACK(waterfall_high_value_changed_cb),NULL);
+
+ GtkWidget *waterfall_low_label=gtk_label_new("Waterfall Low: ");
+ //gtk_widget_override_font(waterfall_low_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(waterfall_low_label);
+ gtk_grid_attach(GTK_GRID(grid),waterfall_low_label,0,7,1,1);
+
+ GtkWidget *waterfall_low_r=gtk_spin_button_new_with_range(-220.0,100.0,1.0);
+ //gtk_widget_override_font(waterfall_low_r, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(waterfall_low_r),(double)waterfall_low);
+ gtk_widget_show(waterfall_low_r);
+ gtk_grid_attach(GTK_GRID(grid),waterfall_low_r,1,7,1,1);
+ g_signal_connect(waterfall_low_r,"value_changed",G_CALLBACK(waterfall_low_value_changed_cb),NULL);
+
+ GtkWidget *detector_mode_label=gtk_label_new("Detector: ");
+ //gtk_widget_override_font(detector_mode_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(detector_mode_label);
+ gtk_grid_attach(GTK_GRID(grid),detector_mode_label,2,1,1,1);
+
+ GtkWidget *detector_mode_peak=gtk_radio_button_new_with_label(NULL,"Peak");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (detector_mode_peak), display_detector_mode==DETECTOR_MODE_PEAK);
+ gtk_widget_show(detector_mode_peak);
+ gtk_grid_attach(GTK_GRID(grid),detector_mode_peak,2,2,1,1);
+ g_signal_connect(detector_mode_peak,"pressed",G_CALLBACK(detector_mode_cb),(gpointer *)DETECTOR_MODE_PEAK);
+
+ GtkWidget *detector_mode_rosenfell=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(detector_mode_peak),"Rosenfell");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (detector_mode_rosenfell), display_detector_mode==DETECTOR_MODE_ROSENFELL);
+ gtk_widget_show(detector_mode_rosenfell);
+ gtk_grid_attach(GTK_GRID(grid),detector_mode_rosenfell,2,3,1,1);
+ g_signal_connect(detector_mode_rosenfell,"pressed",G_CALLBACK(detector_mode_cb),(gpointer *)DETECTOR_MODE_ROSENFELL);
+
+ GtkWidget *detector_mode_average=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(detector_mode_rosenfell),"Average");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (detector_mode_average), display_detector_mode==DETECTOR_MODE_AVERAGE);
+ gtk_widget_show(detector_mode_average);
+ gtk_grid_attach(GTK_GRID(grid),detector_mode_average,2,4,1,1);
+ g_signal_connect(detector_mode_average,"pressed",G_CALLBACK(detector_mode_cb),(gpointer *)DETECTOR_MODE_AVERAGE);
+
+ GtkWidget *detector_mode_sample=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(detector_mode_average),"Sample");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (detector_mode_sample), display_detector_mode==DETECTOR_MODE_SAMPLE);
+ gtk_widget_show(detector_mode_sample);
+ gtk_grid_attach(GTK_GRID(grid),detector_mode_sample,2,5,1,1);
+ g_signal_connect(detector_mode_sample,"pressed",G_CALLBACK(detector_mode_cb),(gpointer *)DETECTOR_MODE_SAMPLE);
+
+
+
+ GtkWidget *average_mode_label=gtk_label_new("Averaging: ");
+ //gtk_widget_override_font(average_mode_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(average_mode_label);
+ gtk_grid_attach(GTK_GRID(grid),average_mode_label,3,1,1,1);
+
+ GtkWidget *average_mode_none=gtk_radio_button_new_with_label(NULL,"None");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (average_mode_none), display_detector_mode==AVERAGE_MODE_NONE);
+ gtk_widget_show(average_mode_none);
+ gtk_grid_attach(GTK_GRID(grid),average_mode_none,3,2,1,1);
+ g_signal_connect(average_mode_none,"pressed",G_CALLBACK(average_mode_cb),(gpointer *)AVERAGE_MODE_NONE);
+
+ GtkWidget *average_mode_recursive=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(average_mode_none),"Recursive");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (average_mode_recursive), display_average_mode==AVERAGE_MODE_RECURSIVE);
+ gtk_widget_show(average_mode_recursive);
+ gtk_grid_attach(GTK_GRID(grid),average_mode_recursive,3,3,1,1);
+ g_signal_connect(average_mode_recursive,"pressed",G_CALLBACK(average_mode_cb),(gpointer *)AVERAGE_MODE_RECURSIVE);
+
+ GtkWidget *average_mode_time_window=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(average_mode_recursive),"Time Window");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (average_mode_time_window), display_average_mode==AVERAGE_MODE_TIME_WINDOW);
+ gtk_widget_show(average_mode_time_window);
+ gtk_grid_attach(GTK_GRID(grid),average_mode_time_window,3,4,1,1);
+ g_signal_connect(average_mode_time_window,"pressed",G_CALLBACK(average_mode_cb),(gpointer *)AVERAGE_MODE_TIME_WINDOW);
+
+ GtkWidget *average_mode_log_recursive=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(average_mode_time_window),"Log Recursive");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (average_mode_log_recursive), display_average_mode==AVERAGE_MODE_LOG_RECURSIVE);
+ gtk_widget_show(average_mode_log_recursive);
+ gtk_grid_attach(GTK_GRID(grid),average_mode_log_recursive,3,5,1,1);
+ g_signal_connect(average_mode_log_recursive,"pressed",G_CALLBACK(average_mode_cb),(gpointer *)AVERAGE_MODE_LOG_RECURSIVE);
+
+
+ GtkWidget *time_label=gtk_label_new("Time (ms): ");
+ //gtk_widget_override_font(average_mode_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(time_label);
+ gtk_grid_attach(GTK_GRID(grid),time_label,3,6,1,1);
+
+ GtkWidget *time_r=gtk_spin_button_new_with_range(1.0,9999.0,1.0);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(time_r),(double)display_average_time);
+ gtk_widget_show(time_r);
+ gtk_grid_attach(GTK_GRID(grid),time_r,4,6,1,1);
+ g_signal_connect(time_r,"value_changed",G_CALLBACK(time_value_changed_cb),NULL);
+
+ GtkWidget *b_display_panadapter=gtk_check_button_new_with_label("Display Panadapter");
+ //gtk_widget_override_font(b_display_panadapter, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_display_panadapter), display_panadapter);
+ gtk_widget_show(b_display_panadapter);
+ gtk_grid_attach(GTK_GRID(grid),b_display_panadapter,0,8,1,1);
+ g_signal_connect(b_display_panadapter,"toggled",G_CALLBACK(display_panadapter_cb),(gpointer *)NULL);
+
+ GtkWidget *b_display_waterfall=gtk_check_button_new_with_label("Display Waterfall");
+ //gtk_widget_override_font(b_display_waterfall, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_display_waterfall), display_waterfall);
+ gtk_widget_show(b_display_waterfall);
+ gtk_grid_attach(GTK_GRID(grid),b_display_waterfall,1,8,1,1);
+ g_signal_connect(b_display_waterfall,"toggled",G_CALLBACK(display_waterfall_cb),(gpointer *)NULL);
+
+ GtkWidget *b_display_sliders=gtk_check_button_new_with_label("Display Sliders");
+ //gtk_widget_override_font(b_display_sliders, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_display_sliders), display_sliders);
+ gtk_widget_show(b_display_sliders);
+ gtk_grid_attach(GTK_GRID(grid),b_display_sliders,2,8,1,1);
+ g_signal_connect(b_display_sliders,"toggled",G_CALLBACK(display_sliders_cb),(gpointer *)NULL);
+
+ GtkWidget *b_display_toolbar=gtk_check_button_new_with_label("Display Toolbar");
+ //gtk_widget_override_font(b_display_toolbar, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_display_toolbar), display_toolbar);
+ gtk_widget_show(b_display_toolbar);
+ gtk_grid_attach(GTK_GRID(grid),b_display_toolbar,3,8,1,1);
+ g_signal_connect(b_display_toolbar,"toggled",G_CALLBACK(display_toolbar_cb),(gpointer *)NULL);
+
+ GtkWidget *b_toolbar_dialog_buttons=gtk_check_button_new_with_label("Buttons Display Dialog");
+ //gtk_widget_override_font(b_toolbar_dialog_buttons, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_toolbar_dialog_buttons), toolbar_dialog_buttons);
+ gtk_widget_show(b_toolbar_dialog_buttons);
+ gtk_grid_attach(GTK_GRID(grid),b_toolbar_dialog_buttons,0,9,1,1);
+ g_signal_connect(b_toolbar_dialog_buttons,"toggled",G_CALLBACK(toolbar_dialog_buttons_cb),(gpointer *)NULL);
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+extern void display_menu(GtkWidget *parent);
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "dsp_menu.h"
+#include "agc.h"
+#include "channel.h"
+#include "radio.h"
+#include "wdsp.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static void agc_hang_threshold_value_changed_cb(GtkWidget *widget, gpointer data) {
+ agc_hang_threshold=(int)gtk_range_get_value(GTK_RANGE(widget));
+ if(agc==AGC_LONG || agc==AGC_SLOW) {
+ SetRXAAGCHangThreshold(CHANNEL_RX0, (int)agc_hang_threshold);
+ }
+}
+
+static void pre_post_agc_cb(GtkWidget *widget, gpointer data) {
+ nr_agc=(int)data;
+ SetRXAEMNRPosition(CHANNEL_RX0, nr_agc);
+
+}
+
+static void nr2_gain_cb(GtkWidget *widget, gpointer data) {
+ nr2_gain_method==(int)data;
+ SetRXAEMNRgainMethod(CHANNEL_RX0, nr2_gain_method);
+}
+
+static void nr2_npe_method_cb(GtkWidget *widget, gpointer data) {
+ nr2_npe_method=(int)data;
+ SetRXAEMNRnpeMethod(CHANNEL_RX0, nr2_npe_method);
+}
+
+static void ae_cb(GtkWidget *widget, gpointer data) {
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+ nr2_ae=1;
+ } else {
+ nr2_ae=0;
+ }
+ SetRXAEMNRaeRun(CHANNEL_RX0, nr2_ae);
+}
+
+void dsp_menu(GtkWidget *parent) {
+ int i;
+
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close DSP");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ GtkWidget *agc_hang_threshold_label=gtk_label_new("AGC Hang Threshold:");
+ gtk_widget_show(agc_hang_threshold_label);
+ gtk_grid_attach(GTK_GRID(grid),agc_hang_threshold_label,0,1,1,1);
+ GtkWidget *agc_hang_threshold_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0.0, 100.0, 1.0);
+ gtk_range_set_value (GTK_RANGE(agc_hang_threshold_scale),agc_hang_threshold);
+ gtk_widget_show(agc_hang_threshold_scale);
+ gtk_grid_attach(GTK_GRID(grid),agc_hang_threshold_scale,1,1,2,1);
+ g_signal_connect(G_OBJECT(agc_hang_threshold_scale),"value_changed",G_CALLBACK(agc_hang_threshold_value_changed_cb),NULL);
+
+ GtkWidget *pre_post_agc_label=gtk_label_new("NR/NR2/ANF");
+ //gtk_widget_override_font(pre_post_agc_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(pre_post_agc_label);
+ gtk_grid_attach(GTK_GRID(grid),pre_post_agc_label,0,2,1,1);
+
+ GtkWidget *pre_agc_b=gtk_radio_button_new_with_label(NULL,"Pre AGC");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pre_agc_b),nr_agc==0);
+ gtk_widget_show(pre_agc_b);
+ gtk_grid_attach(GTK_GRID(grid),pre_agc_b,1,2,1,1);
+ g_signal_connect(pre_agc_b,"pressed",G_CALLBACK(pre_post_agc_cb),(gpointer *)0);
+
+ GtkWidget *post_agc_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pre_agc_b),"Post AGC");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (post_agc_b), nr_agc==1);
+ gtk_widget_show(post_agc_b);
+ gtk_grid_attach(GTK_GRID(grid),post_agc_b,2,2,1,1);
+ g_signal_connect(post_agc_b,"pressed",G_CALLBACK(pre_post_agc_cb),(gpointer *)1);
+
+ GtkWidget *nr2_gain_label=gtk_label_new("NR2 Gain Method");
+ //gtk_widget_override_font(nr2_gain_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(nr2_gain_label);
+ gtk_grid_attach(GTK_GRID(grid),nr2_gain_label,0,3,1,1);
+
+ GtkWidget *linear_b=gtk_radio_button_new_with_label(NULL,"Linear");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (linear_b),nr2_gain_method==0);
+ gtk_widget_show(linear_b);
+ gtk_grid_attach(GTK_GRID(grid),linear_b,1,3,1,1);
+ g_signal_connect(linear_b,"pressed",G_CALLBACK(nr2_gain_cb),(gpointer *)0);
+
+ GtkWidget *log_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(linear_b),"Log");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (log_b), nr2_gain_method==1);
+ gtk_widget_show(log_b);
+ gtk_grid_attach(GTK_GRID(grid),log_b,2,3,1,1);
+ g_signal_connect(log_b,"pressed",G_CALLBACK(nr2_gain_cb),(gpointer *)1);
+
+ GtkWidget *gamma_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(log_b),"Gamma");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gamma_b), nr2_gain_method==2);
+ gtk_widget_show(gamma_b);
+ gtk_grid_attach(GTK_GRID(grid),gamma_b,3,3,1,1);
+ g_signal_connect(gamma_b,"pressed",G_CALLBACK(nr2_gain_cb),(gpointer *)2);
+
+ GtkWidget *nr2_npe_method_label=gtk_label_new("NR2 NPE Method");
+ //gtk_widget_override_font(nr2_npe_method_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(nr2_npe_method_label);
+ gtk_grid_attach(GTK_GRID(grid),nr2_npe_method_label,0,4,1,1);
+
+ GtkWidget *osms_b=gtk_radio_button_new_with_label(NULL,"OSMS");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (osms_b),nr2_npe_method==0);
+ gtk_widget_show(osms_b);
+ gtk_grid_attach(GTK_GRID(grid),osms_b,1,4,1,1);
+ g_signal_connect(osms_b,"pressed",G_CALLBACK(nr2_npe_method_cb),(gpointer *)0);
+
+ GtkWidget *mmse_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(osms_b),"MMSE");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mmse_b), nr2_npe_method==1);
+ gtk_widget_show(mmse_b);
+ gtk_grid_attach(GTK_GRID(grid),mmse_b,2,4,1,1);
+ g_signal_connect(mmse_b,"pressed",G_CALLBACK(nr2_npe_method_cb),(gpointer *)1);
+
+ GtkWidget *ae_b=gtk_check_button_new_with_label("NR2 AE Filter");
+ //gtk_widget_override_font(ae_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ae_b), nr2_ae);
+ gtk_widget_show(ae_b);
+ gtk_grid_attach(GTK_GRID(grid),ae_b,0,5,1,1);
+ g_signal_connect(ae_b,"toggled",G_CALLBACK(ae_cb),NULL);
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+void dsp_menu(GtkWidget *parent);
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "exit_menu.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static gboolean exit_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+#ifdef GPIO
+ gpio_close();
+#endif
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ old_protocol_stop();
+ break;
+ case NEW_PROTOCOL:
+ new_protocol_stop();
+ break;
+#ifdef LIMESDR
+ case LIMESDR_PROTOCOL:
+ lime_protocol_stop();
+ break;
+#endif
+ }
+ radioSaveState();
+ _exit(0);
+}
+
+static gboolean reboot_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+#ifdef GPIO
+ gpio_close();
+#endif
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ old_protocol_stop();
+ break;
+ case NEW_PROTOCOL:
+ new_protocol_stop();
+ break;
+#ifdef LIMESDR
+ case LIMESDR_PROTOCOL:
+ lime_protocol_stop();
+ break;
+#endif
+ }
+ radioSaveState();
+ system("reboot");
+ _exit(0);
+}
+
+static gboolean shutdown_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+#ifdef GPIO
+ gpio_close();
+#endif
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ old_protocol_stop();
+ break;
+ case NEW_PROTOCOL:
+ new_protocol_stop();
+ break;
+#ifdef LIMESDR
+ case LIMESDR_PROTOCOL:
+ lime_protocol_stop();
+ break;
+#endif
+ }
+ radioSaveState();
+ system("shutdown -h -P now");
+ _exit(0);
+}
+
+
+void exit_menu(GtkWidget *parent) {
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ GtkWidget *exit_b=gtk_button_new_with_label("Exit");
+ g_signal_connect (exit_b, "pressed", G_CALLBACK(exit_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),exit_b,0,1,1,1);
+
+ GtkWidget *reboot_b=gtk_button_new_with_label("Reboot");
+ g_signal_connect (reboot_b, "pressed", G_CALLBACK(reboot_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),reboot_b,1,1,1,1);
+
+ GtkWidget *shutdown_b=gtk_button_new_with_label("Shutdown");
+ g_signal_connect (shutdown_b, "pressed", G_CALLBACK(shutdown_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),shutdown_b,2,1,1,1);
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+extern void exit_menu(GtkWidget *parent);
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "freedv_menu.h"
+#include "freedv.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static void freedv_text_changed_cb(GtkWidget *widget, gpointer data) {
+ strcpy(freedv_tx_text_data,gtk_entry_get_text(GTK_ENTRY(widget)));
+}
+
+void freedv_menu(GtkWidget *parent) {
+ int i,j;
+
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close FreeDV");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ GtkWidget *freedv_text_label=gtk_label_new("FreeDV Text Message: ");
+ gtk_grid_attach(GTK_GRID(grid),freedv_text_label,0,1,1,1);
+
+ GtkWidget *freedv_text=gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(freedv_text),freedv_tx_text_data);
+ gtk_grid_attach(GTK_GRID(grid),freedv_text,0,2,2,1);
+ g_signal_connect(freedv_text,"changed",G_CALLBACK(freedv_text_changed_cb),NULL);
+
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+extern void freedv_menu(GtkWidget *parent);
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "general_menu.h"
+#include "band.h"
+#include "filter.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static void vfo_divisor_value_changed_cb(GtkWidget *widget, gpointer data) {
+ vfo_encoder_divisor=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+}
+
+static void toolbar_dialog_buttons_cb(GtkWidget *widget, gpointer data) {
+ toolbar_dialog_buttons=toolbar_dialog_buttons==1?0:1;
+ update_toolbar_labels();
+}
+
+static void ptt_cb(GtkWidget *widget, gpointer data) {
+ mic_ptt_enabled=mic_ptt_enabled==1?0:1;
+}
+
+static void ptt_ring_cb(GtkWidget *widget, gpointer data) {
+ mic_ptt_tip_bias_ring=0;
+}
+
+static void ptt_tip_cb(GtkWidget *widget, gpointer data) {
+ mic_ptt_tip_bias_ring=1;
+}
+
+static void bias_cb(GtkWidget *widget, gpointer data) {
+ mic_bias_enabled=mic_bias_enabled==1?0:1;
+}
+
+static void apollo_cb(GtkWidget *widget, gpointer data);
+
+static void alex_cb(GtkWidget *widget, gpointer data) {
+ if(filter_board==ALEX) {
+ filter_board=NONE;
+ } else if(filter_board==NONE) {
+ filter_board=ALEX;
+ } else if(filter_board==APOLLO) {
+ GtkWidget *w=(GtkWidget *)data;
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), FALSE);
+ filter_board=ALEX;
+ }
+
+ if(protocol==NEW_PROTOCOL) {
+ filter_board_changed();
+ }
+
+ if(filter_board==ALEX) {
+ BAND *band=band_get_current_band();
+ BANDSTACK_ENTRY* entry=bandstack_entry_get_current();
+ setFrequency(entry->frequencyA);
+ setMode(entry->mode);
+ FILTER* band_filters=filters[entry->mode];
+ FILTER* band_filter=&band_filters[entry->filter];
+ setFilter(band_filter->low,band_filter->high);
+ set_alex_rx_antenna(band->alexRxAntenna);
+ set_alex_tx_antenna(band->alexTxAntenna);
+ set_alex_attenuation(band->alexAttenuation);
+ }
+}
+
+static void apollo_cb(GtkWidget *widget, gpointer data) {
+ if(filter_board==APOLLO) {
+ filter_board=NONE;
+ } else if(filter_board==NONE) {
+ filter_board=APOLLO;
+ } else if(filter_board==ALEX) {
+ GtkWidget *w=(GtkWidget *)data;
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), FALSE);
+ filter_board=APOLLO;
+ }
+ if(protocol==NEW_PROTOCOL) {
+ filter_board_changed();
+ }
+
+ if(filter_board==APOLLO) {
+ BAND *band=band_get_current_band();
+ BANDSTACK_ENTRY* entry=bandstack_entry_get_current();
+ setFrequency(entry->frequencyA);
+ setMode(entry->mode);
+ FILTER* band_filters=filters[entry->mode];
+ FILTER* band_filter=&band_filters[entry->filter];
+ setFilter(band_filter->low,band_filter->high);
+ }
+}
+/*
+static void apollo_tuner_cb(GtkWidget *widget, gpointer data) {
+ apollo_tuner=apollo_tuner==1?0:1;
+ if(protocol==NEW_PROTOCOL) {
+ tuner_changed();
+ }
+}
+
+static void pa_cb(GtkWidget *widget, gpointer data) {
+ pa=pa==1?0:1;
+ if(protocol==NEW_PROTOCOL) {
+ pa_changed();
+ }
+}
+*/
+
+static void rx_dither_cb(GtkWidget *widget, gpointer data) {
+ rx_dither=rx_dither==1?0:1;
+ if(protocol==NEW_PROTOCOL) {
+ }
+}
+
+static void rx_random_cb(GtkWidget *widget, gpointer data) {
+ rx_random=rx_random==1?0:1;
+ if(protocol==NEW_PROTOCOL) {
+ }
+}
+
+static void rx_preamp_cb(GtkWidget *widget, gpointer data) {
+ rx_preamp=rx_preamp==1?0:1;
+ if(protocol==NEW_PROTOCOL) {
+ }
+}
+
+static void sample_rate_cb(GtkWidget *widget, gpointer data) {
+ if(protocol==ORIGINAL_PROTOCOL) {
+ old_protocol_new_sample_rate((int)data);
+ } else {
+ new_protocol_new_sample_rate((int)data);
+ }
+}
+
+void general_menu(GtkWidget *parent) {
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ //gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close General");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ GtkWidget *vfo_divisor_label=gtk_label_new("VFO Encoder Divisor: ");
+ gtk_grid_attach(GTK_GRID(grid),vfo_divisor_label,4,1,1,1);
+
+ GtkWidget *vfo_divisor=gtk_spin_button_new_with_range(1.0,60.0,1.0);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(vfo_divisor),(double)vfo_encoder_divisor);
+ gtk_grid_attach(GTK_GRID(grid),vfo_divisor,4,2,1,1);
+ g_signal_connect(vfo_divisor,"value_changed",G_CALLBACK(vfo_divisor_value_changed_cb),NULL);
+
+ if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+ GtkWidget *rx_dither_b=gtk_check_button_new_with_label("Dither");
+ //gtk_widget_override_font(rx_dither_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx_dither_b), rx_dither);
+ gtk_grid_attach(GTK_GRID(grid),rx_dither_b,1,4,1,1);
+ g_signal_connect(rx_dither_b,"toggled",G_CALLBACK(rx_dither_cb),NULL);
+
+ GtkWidget *rx_random_b=gtk_check_button_new_with_label("Random");
+ //gtk_widget_override_font(rx_random_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx_random_b), rx_random);
+ gtk_grid_attach(GTK_GRID(grid),rx_random_b,1,5,1,1);
+ g_signal_connect(rx_random_b,"toggled",G_CALLBACK(rx_random_cb),NULL);
+
+ if((protocol==NEW_PROTOCOL && device==NEW_DEVICE_ORION) ||
+ (protocol==NEW_PROTOCOL && device==NEW_DEVICE_ORION2) ||
+ (protocol==ORIGINAL_PROTOCOL && device==DEVICE_ORION)) {
+
+ GtkWidget *ptt_ring_b=gtk_radio_button_new_with_label(NULL,"PTT On Ring, Mic and Bias on Tip");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ptt_ring_b), mic_ptt_tip_bias_ring==0);
+ gtk_grid_attach(GTK_GRID(grid),ptt_ring_b,3,1,1,1);
+ g_signal_connect(ptt_ring_b,"pressed",G_CALLBACK(ptt_ring_cb),NULL);
+
+ GtkWidget *ptt_tip_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(ptt_ring_b),"PTT On Tip, Mic and Bias on Ring");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ptt_tip_b), mic_ptt_tip_bias_ring==1);
+ gtk_grid_attach(GTK_GRID(grid),ptt_tip_b,3,2,1,1);
+ g_signal_connect(ptt_tip_b,"pressed",G_CALLBACK(ptt_tip_cb),NULL);
+
+ GtkWidget *ptt_b=gtk_check_button_new_with_label("PTT Enabled");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ptt_b), mic_ptt_enabled);
+ gtk_grid_attach(GTK_GRID(grid),ptt_b,3,3,1,1);
+ g_signal_connect(ptt_b,"toggled",G_CALLBACK(ptt_cb),NULL);
+
+ GtkWidget *bias_b=gtk_check_button_new_with_label("BIAS Enabled");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bias_b), mic_bias_enabled);
+ gtk_grid_attach(GTK_GRID(grid),bias_b,3,4,1,1);
+ g_signal_connect(bias_b,"toggled",G_CALLBACK(bias_cb),NULL);
+ }
+
+ GtkWidget *alex_b=gtk_check_button_new_with_label("ALEX");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alex_b), filter_board==ALEX);
+ gtk_grid_attach(GTK_GRID(grid),alex_b,1,1,1,1);
+
+ GtkWidget *apollo_b=gtk_check_button_new_with_label("APOLLO");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (apollo_b), filter_board==APOLLO);
+ gtk_grid_attach(GTK_GRID(grid),apollo_b,1,2,1,1);
+
+ g_signal_connect(alex_b,"toggled",G_CALLBACK(alex_cb),apollo_b);
+ g_signal_connect(apollo_b,"toggled",G_CALLBACK(apollo_cb),alex_b);
+
+ }
+
+ GtkWidget *sample_rate_label=gtk_label_new("Sample Rate:");
+ gtk_grid_attach(GTK_GRID(grid),sample_rate_label,0,1,1,1);
+
+ if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+ GtkWidget *sample_rate_48=gtk_radio_button_new_with_label(NULL,"48000");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_48), sample_rate==48000);
+ gtk_grid_attach(GTK_GRID(grid),sample_rate_48,0,2,1,1);
+ g_signal_connect(sample_rate_48,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)48000);
+
+ GtkWidget *sample_rate_96=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_48),"96000");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_96), sample_rate==96000);
+ gtk_grid_attach(GTK_GRID(grid),sample_rate_96,0,3,1,1);
+ g_signal_connect(sample_rate_96,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)96000);
+
+ GtkWidget *sample_rate_192=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_96),"192000");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_192), sample_rate==192000);
+ gtk_grid_attach(GTK_GRID(grid),sample_rate_192,0,4,1,1);
+ g_signal_connect(sample_rate_192,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)192000);
+
+ GtkWidget *sample_rate_384=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_192),"384000");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_384), sample_rate==384000);
+ gtk_grid_attach(GTK_GRID(grid),sample_rate_384,0,5,1,1);
+ g_signal_connect(sample_rate_384,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)384000);
+
+ if(protocol==NEW_PROTOCOL) {
+ GtkWidget *sample_rate_768=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_384),"768000");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_768), sample_rate==768000);
+ gtk_grid_attach(GTK_GRID(grid),sample_rate_768,0,6,1,1);
+ g_signal_connect(sample_rate_768,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)768000);
+
+ GtkWidget *sample_rate_1536=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_768),"1536000");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_1536), sample_rate==1536000);
+ gtk_grid_attach(GTK_GRID(grid),sample_rate_1536,0,7,1,1);
+ g_signal_connect(sample_rate_1536,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)1536000);
+
+#ifdef raspberrypi
+ gtk_widget_set_sensitive(sample_rate_768,FALSE);
+ gtk_widget_set_sensitive(sample_rate_1536,FALSE);
+#endif
+ }
+
+ }
+
+#ifdef LIMESDR
+ if(protocol==LIMESDR_PROTOCOL) {
+ GtkWidget *sample_rate_1M=gtk_radio_button_new_with_label(NULL,"1000000");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_1M), sample_rate==1000000);
+ gtk_grid_attach(GTK_GRID(grid),sample_rate_1M,0,2,1,1);
+ g_signal_connect(sample_rate_1M,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)1000000);
+
+ GtkWidget *sample_rate_2M=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_1M),"2000000");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_2M), sample_rate==2000000);
+ gtk_grid_attach(GTK_GRID(grid),sample_rate_2M,0,3,1,1);
+ g_signal_connect(sample_rate_2M,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)2000000);
+
+ }
+#endif
+
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+extern void general_menu(GtkWidget *parent);
#endif
#include "wdsp.h"
#include "vfo.h"
-#include "menu.h"
+//#include "menu.h"
+#include "new_menu.h"
+#include "rit.h"
#include "meter.h"
#include "panadapter.h"
#include "splash.h"
#define MENU_HEIGHT VFO_HEIGHT
//#define MENU_WIDTH ((display_width/32)*3)
#define MENU_WIDTH ((display_width/32)*8)
+#define RIT_WIDTH ((MENU_WIDTH/3)*2)
#define METER_HEIGHT VFO_HEIGHT
//#define METER_WIDTH ((display_width/32)*13)
#define METER_WIDTH ((display_width/32)*8)
static GtkWidget *grid;
static GtkWidget *fixed;
static GtkWidget *vfo;
+static GtkWidget *rit_control;
static GtkWidget *menu;
static GtkWidget *meter;
static GtkWidget *sliders;
GtkWidget *grid=gtk_grid_new();
gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+ gtk_grid_set_row_spacing (GTK_GRID(grid),10);
int i;
char version[16];
gtk_fixed_put(GTK_FIXED(fixed),vfo,0,0);
+
+ rit_control = rit_init(RIT_WIDTH,MENU_HEIGHT,window);
+ gtk_fixed_put(GTK_FIXED(fixed),rit_control,VFO_WIDTH,y);
+
fprintf(stderr,"menu_height=%d\n",MENU_HEIGHT);
- menu = menu_init(MENU_WIDTH,MENU_HEIGHT,window);
- gtk_fixed_put(GTK_FIXED(fixed),menu,VFO_WIDTH,y);
+ //menu = menu_init(MENU_WIDTH,MENU_HEIGHT,window);
+ menu = new_menu_init(MENU_WIDTH-RIT_WIDTH,MENU_HEIGHT,window);
+ gtk_fixed_put(GTK_FIXED(fixed),menu,VFO_WIDTH+((MENU_WIDTH/3)*2),y);
fprintf(stderr,"meter_height=%d\n",METER_HEIGHT);
meter = meter_init(METER_WIDTH,METER_HEIGHT,window);
gpointer data)
{
GtkWidget *dialog=gtk_dialog_new_with_buttons("Meter",GTK_WINDOW(parent_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
+ //gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
GtkWidget *grid=gtk_grid_new();
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "exit_menu.h"
+#include "general_menu.h"
+#include "audio_menu.h"
+#include "ant_menu.h"
+#include "display_menu.h"
+#include "dsp_menu.h"
+#include "pa_menu.h"
+#include "oc_menu.h"
+#include "freedv_menu.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+GtkWidget *sub_menu=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ }
+}
+
+static gboolean exit_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ exit_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean general_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ general_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean audio_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ audio_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean ant_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ ant_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean display_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ display_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean dsp_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ dsp_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean pa_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ pa_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean cw_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ cw_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean oc_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ oc_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean freedv_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ freedv_menu(parent_window);
+ return TRUE;
+}
+
+static gboolean new_menu_pressed_event_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer data)
+{
+ int i, j, id;
+
+
+ if(dialog==NULL) {
+
+ if(sub_menu!=NULL) {
+ gtk_widget_destroy(sub_menu);
+ sub_menu=NULL;
+ }
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close Menu");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,2,1);
+
+ GtkWidget *exit_b=gtk_button_new_with_label("Exit piHPSDR");
+ g_signal_connect (exit_b, "pressed", G_CALLBACK(exit_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),exit_b,3,0,2,1);
+
+ GtkWidget *general_b=gtk_button_new_with_label("General");
+ g_signal_connect (general_b, "pressed", G_CALLBACK(general_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),general_b,0,1,1,1);
+
+ GtkWidget *audio_b=gtk_button_new_with_label("Audio");
+ g_signal_connect (audio_b, "pressed", G_CALLBACK(audio_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),audio_b,1,1,1,1);
+
+ GtkWidget *ant_b=gtk_button_new_with_label("Ant");
+ g_signal_connect (ant_b, "pressed", G_CALLBACK(ant_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),ant_b,2,1,1,1);
+
+ GtkWidget *display_b=gtk_button_new_with_label("Display");
+ g_signal_connect (display_b, "pressed", G_CALLBACK(display_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),display_b,3,1,1,1);
+
+ GtkWidget *dsp_b=gtk_button_new_with_label("DSP");
+ g_signal_connect (dsp_b, "pressed", G_CALLBACK(dsp_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),dsp_b,4,1,1,1);
+
+ GtkWidget *pa_b=gtk_button_new_with_label("PA");
+ g_signal_connect (pa_b, "pressed", G_CALLBACK(pa_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),pa_b,0,2,1,1);
+
+ GtkWidget *cw_b=gtk_button_new_with_label("CW");
+ g_signal_connect (cw_b, "pressed", G_CALLBACK(cw_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),cw_b,1,2,1,1);
+
+ GtkWidget *oc_b=gtk_button_new_with_label("OC");
+ g_signal_connect (oc_b, "pressed", G_CALLBACK(oc_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),oc_b,2,2,1,1);
+
+ GtkWidget *freedv_b=gtk_button_new_with_label("FreeDV");
+ g_signal_connect (freedv_b, "pressed", G_CALLBACK(freedv_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),freedv_b,3,2,1,1);
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ gtk_widget_show_all(dialog);
+
+ } else {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ }
+
+ return TRUE;
+}
+
+GtkWidget* new_menu_init(int width,int height,GtkWidget *parent) {
+
+ parent_window=parent;
+
+ menu_b=gtk_button_new_with_label("Menu");
+ gtk_widget_override_font(menu_b, pango_font_description_from_string("FreeMono Bold 10"));
+ gtk_widget_set_size_request (menu_b, width, height);
+ g_signal_connect (menu_b, "pressed", G_CALLBACK(new_menu_pressed_event_cb), NULL);
+ gtk_widget_show(menu_b);
+
+ return menu_b;
+}
--- /dev/null
+GtkWidget *sub_menu;
+
+GtkWidget* new_menu_init(int width,int height,GtkWidget *parent);
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "oc_menu.h"
+#include "band.h"
+#include "bandstack.h"
+#include "filter.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static void oc_rx_cb(GtkWidget *widget, gpointer data) {
+ int b=((int)data)>>4;
+ int oc=((int)data)&0xF;
+ BAND *band=band_get_band(b);
+ int mask=0x01<<oc;
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+ band->OCrx|=mask;
+ } else {
+ band->OCrx&=~mask;
+ }
+}
+
+static void oc_tx_cb(GtkWidget *widget, gpointer data) {
+ int b=((int)data)>>4;
+ int oc=((int)data)&0xF;
+ BAND *band=band_get_band(b);
+ int mask=0x01<<oc;
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+ band->OCtx|=mask;
+ } else {
+ band->OCtx&=~mask;
+ }
+}
+
+static void oc_tune_cb(GtkWidget *widget, gpointer data) {
+ int oc=((int)data)&0xF;
+ int mask=0x01<<oc;
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+ OCtune|=mask;
+ } else {
+ OCtune&=~mask;
+ }
+}
+
+static void oc_full_tune_time_cb(GtkWidget *widget, gpointer data) {
+ OCfull_tune_time=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+}
+
+static void oc_memory_tune_time_cb(GtkWidget *widget, gpointer data) {
+ OCmemory_tune_time=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+}
+
+void oc_menu(GtkWidget *parent) {
+ int i,j;
+
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close OC");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ GtkWidget *band_title=gtk_label_new("Band");
+ //gtk_widget_override_font(band_title, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(band_title);
+ gtk_grid_attach(GTK_GRID(grid),band_title,0,1,1,1);
+
+ GtkWidget *rx_title=gtk_label_new("Rx");
+ //gtk_widget_override_font(rx_title, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(rx_title);
+ gtk_grid_attach(GTK_GRID(grid),rx_title,4,1,1,1);
+
+ GtkWidget *tx_title=gtk_label_new("Tx");
+ //gtk_widget_override_font(tx_title, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(tx_title);
+ gtk_grid_attach(GTK_GRID(grid),tx_title,11,1,1,1);
+
+ GtkWidget *tune_title=gtk_label_new("Tune (ORed with TX)");
+ //gtk_widget_override_font(tune_title, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(tune_title);
+ gtk_grid_attach(GTK_GRID(grid),tune_title,18,1,2,1);
+
+ for(i=1;i<8;i++) {
+ char oc_id[8];
+ sprintf(oc_id,"%d",i);
+ GtkWidget *oc_rx_title=gtk_label_new(oc_id);
+ //gtk_widget_override_font(oc_rx_title, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(oc_rx_title);
+ gtk_grid_attach(GTK_GRID(grid),oc_rx_title,i,2,1,1);
+ GtkWidget *oc_tx_title=gtk_label_new(oc_id);
+ //gtk_widget_override_font(oc_tx_title, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(oc_tx_title);
+ gtk_grid_attach(GTK_GRID(grid),oc_tx_title,i+7,2,1,1);
+ }
+
+ for(i=0;i<HAM_BANDS;i++) {
+ BAND *band=band_get_band(i);
+
+ GtkWidget *band_label=gtk_label_new(band->title);
+ //gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(band_label);
+ gtk_grid_attach(GTK_GRID(grid),band_label,0,i+3,1,1);
+
+ int mask;
+ for(j=1;j<8;j++) {
+ mask=0x01<<j;
+ GtkWidget *oc_rx_b=gtk_check_button_new();
+ //gtk_widget_override_font(oc_rx_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (oc_rx_b), (band->OCrx&mask)==mask);
+ gtk_widget_show(oc_rx_b);
+ gtk_grid_attach(GTK_GRID(grid),oc_rx_b,j,i+3,1,1);
+ g_signal_connect(oc_rx_b,"toggled",G_CALLBACK(oc_rx_cb),(gpointer)(j+(i<<4)));
+
+ GtkWidget *oc_tx_b=gtk_check_button_new();
+ //gtk_widget_override_font(oc_tx_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (oc_tx_b), (band->OCtx&mask)==mask);
+ gtk_widget_show(oc_tx_b);
+ gtk_grid_attach(GTK_GRID(grid),oc_tx_b,j+7,i+3,1,1);
+ g_signal_connect(oc_tx_b,"toggled",G_CALLBACK(oc_tx_cb),(gpointer)(j+(i<<4)));
+
+ }
+ }
+
+ int mask;
+ for(j=1;j<8;j++) {
+ char oc_id[8];
+ sprintf(oc_id,"%d",j);
+ GtkWidget *oc_tune_title=gtk_label_new(oc_id);
+ //gtk_widget_override_font(oc_tune_title, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(oc_tune_title);
+ gtk_grid_attach(GTK_GRID(grid),oc_tune_title,18,j+1,1,1);
+
+ mask=0x01<<j;
+ GtkWidget *oc_tune_b=gtk_check_button_new();
+ //gtk_widget_override_font(oc_tune_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (oc_tune_b), (OCtune&mask)==mask);
+ gtk_widget_show(oc_tune_b);
+ gtk_grid_attach(GTK_GRID(grid),oc_tune_b,19,j+1,1,1);
+ g_signal_connect(oc_tune_b,"toggled",G_CALLBACK(oc_tune_cb),(gpointer)j);
+ }
+
+ GtkWidget *oc_full_tune_time_title=gtk_label_new("Full Tune(ms):");
+ //gtk_widget_override_font(oc_full_tune_time_title, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(oc_full_tune_time_title);
+ gtk_grid_attach(GTK_GRID(grid),oc_full_tune_time_title,18,j+1,2,1);
+ j++;
+
+ GtkWidget *oc_full_tune_time_b=gtk_spin_button_new_with_range(0.0,9999.0,1.0);
+ //gtk_widget_override_font(oc_full_tune_time_b, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(oc_full_tune_time_b),(double)OCfull_tune_time);
+ gtk_widget_show(oc_full_tune_time_b);
+ gtk_grid_attach(GTK_GRID(grid),oc_full_tune_time_b,18,j+1,2,1);
+ g_signal_connect(oc_full_tune_time_b,"value_changed",G_CALLBACK(oc_full_tune_time_cb),NULL);
+ j++;
+
+ GtkWidget *oc_memory_tune_time_title=gtk_label_new("Memory Tune(ms):");
+ //gtk_widget_override_font(oc_memory_tune_time_title, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(oc_memory_tune_time_title);
+ gtk_grid_attach(GTK_GRID(grid),oc_memory_tune_time_title,18,j+1,2,1);
+ j++;
+
+ GtkWidget *oc_memory_tune_time_b=gtk_spin_button_new_with_range(0.0,9999.0,1.0);
+ //gtk_widget_override_font(oc_memory_tune_time_b, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(oc_memory_tune_time_b),(double)OCmemory_tune_time);
+ gtk_widget_show(oc_memory_tune_time_b);
+ gtk_grid_attach(GTK_GRID(grid),oc_memory_tune_time_b,18,j+1,2,1);
+ g_signal_connect(oc_memory_tune_time_b,"value_changed",G_CALLBACK(oc_memory_tune_time_cb),NULL);
+ j++;
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+extern void oc_menu(GtkWidget *parent);
} else {
power=drive_level;
}
+fprintf(stderr,"power=%d\n",power);
}
output_buffer[C0]=0x12;
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "pa_menu.h"
+#include "band.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+}
+
+static void pa_value_changed_cb(GtkWidget *widget, gpointer data) {
+ BAND *band=(BAND *)data;
+ band->pa_calibration=gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
+ calcDriveLevel();
+ calcTuneDriveLevel();
+}
+
+static void tx_out_of_band_cb(GtkWidget *widget, gpointer data) {
+ tx_out_of_band=tx_out_of_band==1?0:1;
+}
+
+void pa_menu(GtkWidget *parent) {
+ int i;
+
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close PA Gain(dB)");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ for(i=0;i<HAM_BANDS;i++) {
+ BAND *band=band_get_band(i);
+
+ GtkWidget *band_label=gtk_label_new(band->title);
+ //gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(band_label);
+ gtk_grid_attach(GTK_GRID(grid),band_label,(i/6)*2,(i%6)+1,1,1);
+
+ GtkWidget *pa_r=gtk_spin_button_new_with_range(38.8,100.0,0.1);
+ //gtk_widget_override_font(pa_r, pango_font_description_from_string("Arial 18"));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(pa_r),(double)band->pa_calibration);
+ gtk_widget_show(pa_r);
+ gtk_grid_attach(GTK_GRID(grid),pa_r,((i/6)*2)+1,(i%6)+1,1,1);
+ g_signal_connect(pa_r,"value_changed",G_CALLBACK(pa_value_changed_cb),band);
+ }
+
+ GtkWidget *tx_out_of_band_b=gtk_check_button_new_with_label("Transmit out of band");
+ //gtk_widget_override_font(tx_out_of_band_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tx_out_of_band_b), tx_out_of_band);
+ gtk_widget_show(tx_out_of_band_b);
+ gtk_grid_attach(GTK_GRID(grid),tx_out_of_band_b,0,7,4,1);
+ g_signal_connect(tx_out_of_band_b,"toggled",G_CALLBACK(tx_out_of_band_cb),NULL);
+
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+extern void pa_menu(GtkWidget *parent);
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "radio.h"
+#include "rit.h"
+#include "vfo.h"
+
+static GtkWidget *parent_window;
+
+static GtkWidget *h_box;
+static GtkWidget *v_box_1;
+static GtkWidget *v_box_2;
+static GtkWidget *ctun_b;
+static GtkWidget *rit_b;
+static GtkWidget *rit_plus_b;
+static GtkWidget *rit_minus_b;
+static gint rit_timer;
+
+static gboolean rit_enabled=FALSE;
+
+static void set_button_text_color(GtkWidget *widget,char *color) {
+ GtkStyleContext *style_context;
+ GtkCssProvider *provider = gtk_css_provider_new ();
+ gchar tmp[64];
+ style_context = gtk_widget_get_style_context(widget);
+ gtk_style_context_add_provider(style_context, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_snprintf(tmp, sizeof tmp, "GtkButton, GtkLabel { color: %s; }", color);
+ gtk_css_provider_load_from_data(GTK_CSS_PROVIDER(provider), tmp, -1, NULL);
+ g_object_unref (provider);
+}
+
+static gboolean ctun_pressed_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ ctun=ctun==1?0:1;
+
+ if(ctun) {
+ set_button_text_color(ctun_b,"red");
+ } else {
+ set_button_text_color(ctun_b,"black");
+ if(ddsOffset!=0) {
+ ddsOffset=0;
+ wdsp_set_offset(ddsOffset);
+ vfo_update(NULL);
+ }
+ }
+ return TRUE;
+}
+
+static gboolean rit_timer_cb(gpointer data) {
+ if((GtkWidget*)data==rit_plus_b) {
+ rit++;
+ } else {
+ rit--;
+ }
+ if(rit>1000) rit=1000;
+ if(rit<-1000) rit=-1000;
+ vfo_update(NULL);
+ return TRUE;
+}
+
+static gboolean rit_pressed_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(rit_enabled) {
+ rit_enabled=FALSE;
+ set_button_text_color(rit_b,"black");
+ rit=0;
+ gtk_widget_set_sensitive(rit_plus_b,FALSE);
+ gtk_widget_set_sensitive(rit_minus_b,FALSE);
+ } else {
+ rit_enabled=TRUE;
+ set_button_text_color(rit_b,"red");
+ gtk_widget_set_sensitive(rit_plus_b,TRUE);
+ gtk_widget_set_sensitive(rit_minus_b,TRUE);
+ }
+ vfo_update(NULL);
+}
+
+static gboolean rit_step_pressed_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(widget==rit_plus_b) {
+ rit++;
+ } else {
+ rit--;
+ }
+ if(rit>1000) rit=1000;
+ if(rit<-1000) rit=-1000;
+ vfo_update(NULL);
+ rit_timer=g_timeout_add(200,rit_timer_cb,widget);
+ return TRUE;
+}
+
+
+static gboolean rit_step_released_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ g_source_remove(rit_timer);
+ return TRUE;
+}
+
+
+GtkWidget* rit_init(int width,int height,GtkWidget *parent) {
+
+ GdkRGBA black;
+ black.red=0.0;
+ black.green=0.0;
+ black.blue=0.0;
+ black.alpha=0.0;
+
+ fprintf(stderr,"rit_init: width=%d height=%d\n",width,height);
+
+ parent_window=parent;
+
+ h_box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
+ gtk_widget_set_size_request (h_box, width, height);
+ gtk_widget_override_background_color(h_box, GTK_STATE_NORMAL, &black);
+
+ v_box_2=gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
+ gtk_widget_override_background_color(v_box_2, GTK_STATE_NORMAL, &black);
+
+ rit_plus_b=gtk_button_new_with_label("RIT+");
+ gtk_widget_override_font(rit_plus_b, pango_font_description_from_string("FreeMono Bold 10"));
+ g_signal_connect (rit_plus_b, "pressed", G_CALLBACK(rit_step_pressed_event_cb), NULL);
+ g_signal_connect (rit_plus_b, "released", G_CALLBACK(rit_step_released_event_cb), NULL);
+ gtk_box_pack_start (GTK_BOX(v_box_2),rit_plus_b,TRUE,TRUE,0);
+
+ rit_minus_b=gtk_button_new_with_label("RIT-");
+ gtk_widget_override_font(rit_minus_b, pango_font_description_from_string("FreeMono Bold 10"));
+ g_signal_connect (rit_minus_b, "pressed", G_CALLBACK(rit_step_pressed_event_cb), NULL);
+ g_signal_connect (rit_minus_b, "released", G_CALLBACK(rit_step_released_event_cb), NULL);
+ gtk_box_pack_start (GTK_BOX(v_box_2),rit_minus_b,TRUE,TRUE,0);
+
+ gtk_widget_set_sensitive(rit_plus_b,FALSE);
+ gtk_widget_set_sensitive(rit_minus_b,FALSE);
+
+ gtk_box_pack_start (GTK_BOX(h_box),v_box_2,TRUE,TRUE,0);
+
+ v_box_1=gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
+ gtk_widget_override_background_color(v_box_1, GTK_STATE_NORMAL, &black);
+
+ ctun_b=gtk_button_new_with_label("CTUN");
+ gtk_widget_override_font(ctun_b, pango_font_description_from_string("FreeMono Bold 10"));
+ g_signal_connect (ctun_b, "pressed", G_CALLBACK(ctun_pressed_event_cb), NULL);
+ gtk_box_pack_start (GTK_BOX(v_box_1),ctun_b,TRUE,TRUE,0);
+
+ rit_b=gtk_button_new_with_label("RIT");
+ gtk_widget_override_font(rit_b, pango_font_description_from_string("FreeMono Bold 10"));
+ g_signal_connect (rit_b, "pressed", G_CALLBACK(rit_pressed_event_cb), NULL);
+ gtk_box_pack_start (GTK_BOX(v_box_1),rit_b,TRUE,TRUE,0);
+
+ gtk_box_pack_start (GTK_BOX(h_box),v_box_1,TRUE,TRUE,0);
+
+ gtk_widget_show_all(h_box);
+
+ return h_box;
+}
--- /dev/null
+/* Copyright (C)
+* 2015 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+extern GtkWidget* rit_init(int width,int height,GtkWidget *parent);