/* Main GUI window and common routines */ #include #include #include #include #include #include #include #include #include #define nPanels 4 GtkWidget *main_win=NULL; typedef void (* gui_panel) (GtkWidget *box); /* Read panel configuration */ void gui_cfg_panel_read(char *cfg_section,const char *labels[], GtkAdjustment *adj[],int adj_def[],int nLevels, GtkToggleButton *enabled){ int i; cfg_init(CFG_READ,cfg_section); for (i=0;iactive); for(i=0;ivalue); cfg_done(); } /* some toggle button was pressed */ void gui_fx_toggle(GtkWidget *widget,gpointer value){ defx_param((int)value>>16,0,GTK_TOGGLE_BUTTON (widget)->active); } /* Create toggle button */ GtkToggleButton *gui_toggle(GtkWidget *parent, int id){ GtkWidget *but; but=gtk_toggle_button_new_with_label("ON"); gtk_signal_connect(GTK_OBJECT(but),"toggled", GTK_SIGNAL_FUNC(gui_fx_toggle),(gpointer)(id<<16)); gtk_box_pack_start(GTK_BOX(parent),but,FALSE,TRUE,0); gtk_widget_show(but); return GTK_TOGGLE_BUTTON(but); } /* Create Label */ void gui_label(GtkWidget *box,const gchar *lbl){ GtkWidget *title; title = gtk_label_new(lbl); gtk_box_pack_start(GTK_BOX(box),title,FALSE,FALSE,0); gtk_widget_show(title); } /* Some parameter (Adjustment) has changed */ void gui_fx_param(GtkAdjustment *adj, gpointer value){ defx_param((int)value>>16,(int)value & 15,(gint)adj->value); } /* Create Adjustment controls */ void gui_levels(GtkWidget *box,int nLevels,const gchar *labels[], int id, GtkAdjustment *Adj[]){ GtkWidget *vbox, *hbox, *level, *label; GtkObject *adj; int i; hbox=gtk_hbox_new(TRUE,nLevels); gtk_box_pack_start(GTK_BOX(box),hbox,FALSE,FALSE,0); for(i=0;i