Maybe these are all the buttons I need for daily operations.
#include <gtk/gtk.h>
struct mybutton {
char name[100];
int left_attach;
int right_attach;
int top_attach;
int bottom_attach;
};
void callback( GtkWidget *widget, gpointer data ) {
g_print ("%s was pressed\n", (char *) data);
}
gint delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ) {
gtk_main_quit ();
return(FALSE);
}
int main( int argc, char *argv[] ) {
int nx=20, ny=10;
int nbutton = 25;
struct mybutton mybuttons[100] = {
{"CW", 0, 1, 0, 1},
{"CW-REV", 0, 1, 1, 2},
{"20 wpm", 1, 2, 0, 1},
{"25 wpm", 1, 2, 1, 2},
{"30 wpm", 1, 2, 2, 3},
{"35 wpm", 1, 2, 3, 4},
{"40 wpm", 1, 2, 4, 5},
{"TX OFF", 3, 4, 0, 1},
{"BK-IN", 3, 4, 1, 2},
{"FBK-IN", 3, 4, 2, 3},
{"IF FIL1", 5, 6, 0, 1},
{"IF FIL2", 5, 6, 1, 2},
{"IF FIL3", 5, 6, 2, 3},
{"OFF", 6, 7, 0, 1},
{"PRE-AMP 1", 6, 7, 1, 2},
{"PRE-AMP 2", 6, 7, 2, 3},
{"ATT", 6, 7, 3, 4},
{" 7.003kHz", 8, 9, 0, 1},
{" 7.026kHz", 8, 9, 1, 2},
{"10.118kHz", 8, 9, 2, 3},
{"14.058kHz", 8, 9, 3, 4},
{"18.085kHz", 8, 9, 4, 5},
{"21.058kHz", 8, 9, 5, 6},
{"24.908kHz", 8, 9, 6, 7},
{"28.058kHz", 8, 9, 7, 8},
};
GtkWidget *window;
GtkWidget *button;
GtkWidget *table;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "IC-7410 Rig Control");
gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 20);
table = gtk_table_new(nx, ny, TRUE);
gtk_container_add (GTK_CONTAINER (window), table);
for(int i=0;i<nbutton;i++) {
button = gtk_button_new_with_label (mybuttons[i].name);
gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback),
(gpointer) mybuttons[i].name);
gtk_table_attach_defaults(GTK_TABLE(table), button,
mybuttons[i].left_attach, mybuttons[i].right_attach,
mybuttons[i].top_attach, mybuttons[i].bottom_attach);
gtk_widget_show (button);
}
button = gtk_button_new_with_label ("Quit");
gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (delete_event), NULL);
gtk_table_attach_defaults (GTK_TABLE(table), button, 1, 3, ny-3, ny-1);
gtk_widget_show (button);
gtk_widget_show (table);
gtk_widget_show (window);
gtk_main ();
return 0;
}
I must add some sliders for AF volume, RF power, etc.