diff --git a/gui.c b/gui.c index 2410306..71eea07 100644 --- a/gui.c +++ b/gui.c @@ -16,34 +16,7 @@ #include #include "gdigi.h" - -void value_changed_cb(GtkSpinButton *spinbutton, void (*callback)(int)) -{ - int val = gtk_spin_button_get_value_as_int(spinbutton); - callback(val); -} - -void value_changed_option_cb(GtkSpinButton *spinbutton, void (*callback)(guint32, int)) -{ - int val = gtk_spin_button_get_value_as_int(spinbutton); - guint32 option = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(spinbutton), "option_id")); - callback(option, val); -} - -void toggled_cb(GtkToggleButton *button, void (*callback)(gboolean)) -{ - gboolean val = gtk_toggle_button_get_active(button); - callback(val); -} - -typedef struct { - char *label; - void (*callback)(int); - void (*callback_with_option)(guint32, int); - gdouble min; - gdouble max; - guint32 option; -} SettingsWidget; +#include "gui.h" static SettingsWidget wah_widgets[] = { {"Wah min", set_wah_min, NULL, 0.0, 99.0}, @@ -389,50 +362,6 @@ static SettingsWidget reverb_emt240_plate_widgets[] = { {"Level", NULL, set_reverb_option, 0.0, 99.0, EMT240_PLATE_LEVEL}, }; -GtkWidget *create_table(SettingsWidget *widgets, gint amt) -{ - GtkWidget *table, *label, *widget; - GtkObject *adj; - int x; - - table = gtk_table_new(2, amt, FALSE); - - for (x = 0; x. */ +typedef struct { + char *label; + void (*callback)(int); + void (*callback_with_option)(guint32, int); + gdouble min; + gdouble max; + guint32 option; +} SettingsWidget; + +typedef struct { + gint id; + gchar *label; + void (*callback)(int); + SettingsWidget *widgets; + gint widgets_amt; + GtkWidget *child; /* child widget - set inside create_widget_container */ +} WidgetContainer; + +typedef struct { + char *label; + gboolean value; + void (*callback)(gboolean); + WidgetContainer *widgets; + gint widgets_amt; +} VBoxWidget; + +typedef struct { + VBoxWidget *widget; + gint amt; +} VBoxes; + void create_window();