void on_maxy_changed (GtkEditable *editable, gpointer user_data) { GtkWidget *curve = lookup_widget(app,"curve"); gfloat minx, maxx, miny, maxy; minx = gtk_spin_button_get_value_as_float (lookup_widget(app,"minx")); maxx = gtk_spin_button_get_value_as_float (lookup_widget(app,"maxx")); miny = gtk_spin_button_get_value_as_float (lookup_widget(app,"miny")); maxy = gtk_spin_button_get_value_as_float (lookup_widget(app,"maxy")); gtk_curve_set_range (curve,minx,maxx,miny,maxy); }
/* Sets the minimum and maximum x & y values of the curve. * The curve is also reset with a call to gtk_curve_reset(). */ int clip_GTK_CURVESETRANGE(ClipMachine * cm) { C_widget *ccur = _fetch_cw_arg(cm); gfloat min_x = _clip_parnd(cm,2); gfloat max_x = _clip_parnd(cm,3); gfloat min_y = _clip_parnd(cm,4); gfloat max_y = _clip_parnd(cm,5); CHECKCWID(ccur,GTK_CURVE); CHECKOPT(2,NUMERIC_t); CHECKOPT(3,NUMERIC_t); CHECKOPT(4,NUMERIC_t); CHECKOPT(5,NUMERIC_t); gtk_curve_set_range(GTK_CURVE(ccur->widget),min_x,max_x,min_y,max_y); return 0; err: return 1; }
// // Video is in YV12 Colorspace // // uint8_t DIA_getEqualizer(EqualizerParam *param, AVDMGenericVideoStream *in) { int ret; uint32_t l,f; uint32_t max=in->getInfo()->nb_frames; incoming=in; // Allocate space for green-ised video w=in->getInfo()->width; h=in->getInfo()->height; rgbConv=new ColYuvRgb(w,h); rgbConv->reset(w,h); histogram=new uint32_t [256*128]; histogramout=new uint32_t [256*128]; imgdst=new ADMImage(w,h); imgsrc=new ADMImage(w,h); imgdisplay=new ADMImage(w,h); if(curframe<max) max=curframe; ADM_assert(in->getFrameNumberNoAlloc(max, &l, imgsrc,&f)); memcpy(imgdisplay->data+w*h,imgsrc->data+w*h,(w*h)>>1); // init local equalizer memcpy(scaler,param->_scaler,sizeof(scaler)); dialog=create_dialog1(); gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog), A_RESET, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, GTK_RESPONSE_APPLY, -1); gtk_register_dialog(dialog); gtk_widget_set_usize(WID(drawingarea_histin), 256,128); gtk_widget_set_usize(WID(drawingarea_histout), 256,128); float zoom = UI_calcZoomToFitScreen(GTK_WINDOW(dialog), WID(drawingarea1), w, h); zoomW = w * zoom; zoomH = h * zoom; rgbbuffer=new uint32_t[zoomW*zoomH]; gtk_widget_set_usize(WID(drawingarea1), zoomW, zoomH); if (zoom < 1) { UI_centreCanvasWindow((GtkWindow*)dialog, WID(drawingarea1), zoomW, zoomH); resizer = new ADMImageResizer(w, h, zoomW, zoomH, PIX_FMT_YUV420P, PIX_FMT_RGB32); } upload(); gtk_signal_connect(GTK_OBJECT(WID(drawingarea1)), "expose_event", GTK_SIGNAL_FUNC(draw), NULL); gtk_signal_connect(GTK_OBJECT(WID(gui_scale)), "value_changed",GTK_SIGNAL_FUNC(frame_changed), NULL); // gtk_signal_connect(GTK_OBJECT(WID(curve1)), "curve-type-changed",GTK_SIGNAL_FUNC(spinner), NULL); /* */ GtkWidget *curve=WID(curve1); gtk_curve_set_range (GTK_CURVE(curve),0,255.,0.,255.); gtk_widget_show(dialog); upload(); compute_histogram(); spinner(); ret=0; int response; _again: while( (response=gtk_dialog_run(GTK_DIALOG(dialog)))==GTK_RESPONSE_APPLY) { spinner(); } if(response==A_RESET) { gfloat duo[2]={0,255.}; gtk_curve_set_curve_type(GTK_CURVE(WID(curve1)),GTK_CURVE_TYPE_SPLINE); gtk_curve_reset(GTK_CURVE(WID(curve1))); goto _again; } if(response==GTK_RESPONSE_OK) { printf("Accepting new values\n"); memcpy(param->_scaler,scaler,sizeof(scaler)); ret=1; } gtk_unregister_dialog(dialog); gtk_widget_destroy(dialog); delete imgdst; delete imgsrc; delete imgdisplay; delete [] rgbbuffer; delete [] histogram; delete [] histogramout; delete rgbConv; if (resizer) { delete resizer; resizer=NULL; } rgbConv=NULL; histogram=NULL; histogramout=NULL; rgbbuffer=NULL; imgdst=NULL; imgsrc=NULL; dialog=NULL; imgdisplay=NULL; return ret; }
GtkWidget* create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *drawingarea1; GtkWidget *gui_scale; GtkWidget *hbox1; GtkWidget *curve1; GtkWidget *vbox2; GtkWidget *drawingarea_histin; GtkWidget *drawingarea_histout; GtkWidget *dialog_action_area1; GtkWidget *button1; GtkWidget *button2; GtkWidget *button3; GtkWidget *button4; dialog1 = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Equalizer")); gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); drawingarea1 = gtk_drawing_area_new (); gtk_widget_show (drawingarea1); gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, TRUE, TRUE, 0); gui_scale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 10, 10))); gtk_widget_show (gui_scale); gtk_box_pack_start (GTK_BOX (vbox1), gui_scale, TRUE, TRUE, 0); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); curve1 = gtk_curve_new (); gtk_widget_show (curve1); gtk_box_pack_start (GTK_BOX (hbox1), curve1, TRUE, TRUE, 0); gtk_curve_set_range (GTK_CURVE (curve1), 0, 1, 0, 1); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0); drawingarea_histin = gtk_drawing_area_new (); gtk_widget_show (drawingarea_histin); gtk_box_pack_start (GTK_BOX (vbox2), drawingarea_histin, TRUE, TRUE, 0); drawingarea_histout = gtk_drawing_area_new (); gtk_widget_show (drawingarea_histout); gtk_box_pack_start (GTK_BOX (vbox2), drawingarea_histout, TRUE, TRUE, 0); dialog_action_area1 = GTK_DIALOG (dialog1)->action_area; gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); button1 = gtk_button_new_from_stock ("gtk-clear"); gtk_widget_show (button1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), button1, A_RESET); GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT); button2 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (button2); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), button2, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); button3 = gtk_button_new_from_stock ("gtk-apply"); gtk_widget_show (button3); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), button3, GTK_RESPONSE_APPLY); GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT); button4 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (button4); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), button4, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (button4, GTK_CAN_DEFAULT); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1"); GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1"); GLADE_HOOKUP_OBJECT (dialog1, gui_scale, "gui_scale"); GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (dialog1, curve1, "curve1"); GLADE_HOOKUP_OBJECT (dialog1, vbox2, "vbox2"); GLADE_HOOKUP_OBJECT (dialog1, drawingarea_histin, "drawingarea_histin"); GLADE_HOOKUP_OBJECT (dialog1, drawingarea_histout, "drawingarea_histout"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, button1, "button1"); GLADE_HOOKUP_OBJECT (dialog1, button2, "button2"); GLADE_HOOKUP_OBJECT (dialog1, button3, "button3"); GLADE_HOOKUP_OBJECT (dialog1, button4, "button4"); return dialog1; }
GtkWidget* create_app (void) { GtkWidget *app; GtkWidget *dock1; GtkWidget *toolbar1; GtkWidget *tmp_toolbar_icon; GtkWidget *button_new; GtkWidget *button_open; GtkWidget *button_save; GtkWidget *button_save_as; GtkWidget *hexentry; GtkWidget *button_upload; GtkWidget *radiobutton_spline; GtkWidget *radiobutton_linear; GtkWidget *radiobutton_free; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *vbox2; GtkWidget *table1; GtkWidget *label1; GtkWidget *label2; GtkWidget *label3; GtkWidget *label4; GtkWidget *label5; GtkWidget *label6; GtkObject *minx_adj; GtkWidget *minx; GtkWidget *type; GList *type_items = NULL; GtkWidget *typeentry; GtkObject *maxx_adj; GtkWidget *maxx; GtkObject *miny_adj; GtkWidget *miny; GtkObject *maxy_adj; GtkWidget *maxy; GtkObject *count_adj; GtkWidget *count; GtkWidget *label10; GtkWidget *label11; GtkWidget *label12; GtkObject *scale_adj; GtkWidget *scale; GtkObject *base_adj; GtkWidget *base; GtkWidget *label13; GtkWidget *scrolledwindow1; GtkWidget *clist; GtkWidget *label8; GtkWidget *label9; GtkWidget *toolbar2; GtkWidget *list_open; GtkWidget *list_save; GtkWidget *list_add; GtkWidget *list_remove; GtkWidget *list_use; GtkWidget *curve; GtkWidget *appbar1; app = gnome_app_new ("Curvegen", _("PSXDEV Curve Generator")); gtk_object_set_data (GTK_OBJECT (app), "app", app); dock1 = GNOME_APP (app)->dock; gtk_widget_ref (dock1); gtk_object_set_data_full (GTK_OBJECT (app), "dock1", dock1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (dock1); gnome_app_create_menus (GNOME_APP (app), menubar1_uiinfo); gtk_widget_ref (menubar1_uiinfo[0].widget); gtk_object_set_data_full (GTK_OBJECT (app), "file1", menubar1_uiinfo[0].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (file1_menu_uiinfo[0].widget); gtk_object_set_data_full (GTK_OBJECT (app), "exit1", file1_menu_uiinfo[0].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (menubar1_uiinfo[1].widget); gtk_object_set_data_full (GTK_OBJECT (app), "help1", menubar1_uiinfo[1].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (help1_menu_uiinfo[0].widget); gtk_object_set_data_full (GTK_OBJECT (app), "about1", help1_menu_uiinfo[0].widget, (GtkDestroyNotify) gtk_widget_unref); toolbar1 = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); gtk_widget_ref (toolbar1); gtk_object_set_data_full (GTK_OBJECT (app), "toolbar1", toolbar1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (toolbar1); gnome_app_add_toolbar (GNOME_APP (app), GTK_TOOLBAR (toolbar1), "toolbar1", GNOME_DOCK_ITEM_BEH_EXCLUSIVE, GNOME_DOCK_TOP, 1, 0, 0); gtk_container_set_border_width (GTK_CONTAINER (toolbar1), 1); gtk_toolbar_set_space_size (GTK_TOOLBAR (toolbar1), 16); gtk_toolbar_set_space_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_SPACE_LINE); gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar1), GTK_RELIEF_NONE); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_NEW); button_new = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("New"), _("New File"), NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (button_new); gtk_object_set_data_full (GTK_OBJECT (app), "button_new", button_new, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (button_new); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_OPEN); button_open = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("Open"), _("Open File"), NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (button_open); gtk_object_set_data_full (GTK_OBJECT (app), "button_open", button_open, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (button_open); gtk_widget_set_sensitive (button_open, FALSE); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_SAVE); button_save = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("Save"), _("Save File"), NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (button_save); gtk_object_set_data_full (GTK_OBJECT (app), "button_save", button_save, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (button_save); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_SAVE_AS); button_save_as = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("Save As"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (button_save_as); gtk_object_set_data_full (GTK_OBJECT (app), "button_save_as", button_save_as, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (button_save_as); hexentry = gtk_entry_new (); gtk_widget_ref (hexentry); gtk_object_set_data_full (GTK_OBJECT (app), "hexentry", hexentry, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hexentry); gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar1), hexentry, _("Address of curve in PlayStation memory..."), NULL); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_MAIL_FWD); button_upload = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("Upload"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (button_upload); gtk_object_set_data_full (GTK_OBJECT (app), "button_upload", button_upload, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (button_upload); gtk_toolbar_append_space (GTK_TOOLBAR (toolbar1)); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_CONVERT); radiobutton_spline = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_CHILD_RADIOBUTTON, NULL, _("SPLINE"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (radiobutton_spline); gtk_object_set_data_full (GTK_OBJECT (app), "radiobutton_spline", radiobutton_spline, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (radiobutton_spline); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radiobutton_spline), FALSE); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_CONVERT); radiobutton_linear = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_CHILD_RADIOBUTTON, radiobutton_spline, _("LINEAR"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (radiobutton_linear); gtk_object_set_data_full (GTK_OBJECT (app), "radiobutton_linear", radiobutton_linear, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (radiobutton_linear); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radiobutton_linear), FALSE); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_CONVERT); radiobutton_free = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_CHILD_RADIOBUTTON, radiobutton_spline, _("FREE"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (radiobutton_free); gtk_object_set_data_full (GTK_OBJECT (app), "radiobutton_free", radiobutton_free, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (radiobutton_free); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radiobutton_free), FALSE); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_ref (vbox1); gtk_object_set_data_full (GTK_OBJECT (app), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox1); gnome_app_set_contents (GNOME_APP (app), vbox1); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_ref (hbox1); gtk_object_set_data_full (GTK_OBJECT (app), "hbox1", hbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_ref (vbox2); gtk_object_set_data_full (GTK_OBJECT (app), "vbox2", vbox2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox2); gtk_box_pack_start (GTK_BOX (hbox1), vbox2, FALSE, TRUE, 0); table1 = gtk_table_new (10, 2, FALSE); gtk_widget_ref (table1); gtk_object_set_data_full (GTK_OBJECT (app), "table1", table1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (vbox2), table1, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (table1), 4); gtk_table_set_row_spacings (GTK_TABLE (table1), 1); gtk_table_set_col_spacings (GTK_TABLE (table1), 2); label1 = gtk_label_new (_("Min X")); gtk_widget_ref (label1); gtk_object_set_data_full (GTK_OBJECT (app), "label1", label1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label1); gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label1), 7.45058e-09, 0.5); label2 = gtk_label_new (_("Max X")); gtk_widget_ref (label2); gtk_object_set_data_full (GTK_OBJECT (app), "label2", label2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label2); gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label2), 7.45058e-09, 0.5); label3 = gtk_label_new (_("Min Y")); gtk_widget_ref (label3); gtk_object_set_data_full (GTK_OBJECT (app), "label3", label3, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label3); gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label3), 7.45058e-09, 0.5); label4 = gtk_label_new (_("Max Y")); gtk_widget_ref (label4); gtk_object_set_data_full (GTK_OBJECT (app), "label4", label4, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label4); gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label4), 7.45058e-09, 0.5); label5 = gtk_label_new (_("Count")); gtk_widget_ref (label5); gtk_object_set_data_full (GTK_OBJECT (app), "label5", label5, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label5); gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 8, 9, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5); label6 = gtk_label_new (_("Type")); gtk_widget_ref (label6); gtk_object_set_data_full (GTK_OBJECT (app), "label6", label6, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label6); gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 9, 10, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); minx_adj = gtk_adjustment_new (0, -1e+13, 1e+13, 1, 10, 10); minx = gtk_spin_button_new (GTK_ADJUSTMENT (minx_adj), 1, 4); gtk_widget_ref (minx); gtk_object_set_data_full (GTK_OBJECT (app), "minx", minx, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (minx); gtk_table_attach (GTK_TABLE (table1), minx, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (minx), TRUE); type = gtk_combo_new (); gtk_widget_ref (type); gtk_object_set_data_full (GTK_OBJECT (app), "type", type, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (type); gtk_table_attach (GTK_TABLE (table1), type, 1, 2, 9, 10, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_combo_set_value_in_list (GTK_COMBO (type), TRUE, FALSE); gtk_combo_set_use_arrows_always (GTK_COMBO (type), TRUE); type_items = g_list_append (type_items, _("u_char")); type_items = g_list_append (type_items, _("char")); type_items = g_list_append (type_items, _("u_short")); type_items = g_list_append (type_items, _("short")); type_items = g_list_append (type_items, _("u_long")); type_items = g_list_append (type_items, _("long")); type_items = g_list_append (type_items, _("float")); type_items = g_list_append (type_items, _("double")); type_items = g_list_append (type_items, _("fixed (4+12)")); gtk_combo_set_popdown_strings (GTK_COMBO (type), type_items); g_list_free (type_items); typeentry = GTK_COMBO (type)->entry; gtk_widget_ref (typeentry); gtk_object_set_data_full (GTK_OBJECT (app), "typeentry", typeentry, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (typeentry); gtk_entry_set_editable (GTK_ENTRY (typeentry), FALSE); gtk_entry_set_text (GTK_ENTRY (typeentry), _("u_char")); maxx_adj = gtk_adjustment_new (1, -1e+13, 1e+13, 1, 10, 10); maxx = gtk_spin_button_new (GTK_ADJUSTMENT (maxx_adj), 1, 4); gtk_widget_ref (maxx); gtk_object_set_data_full (GTK_OBJECT (app), "maxx", maxx, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (maxx); gtk_table_attach (GTK_TABLE (table1), maxx, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (maxx), TRUE); miny_adj = gtk_adjustment_new (0, -1e+13, 1e+13, 1, 10, 10); miny = gtk_spin_button_new (GTK_ADJUSTMENT (miny_adj), 1, 4); gtk_widget_ref (miny); gtk_object_set_data_full (GTK_OBJECT (app), "miny", miny, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (miny); gtk_table_attach (GTK_TABLE (table1), miny, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (miny), TRUE); maxy_adj = gtk_adjustment_new (1, -1e+13, 1e+13, 1, 10, 10); maxy = gtk_spin_button_new (GTK_ADJUSTMENT (maxy_adj), 1, 4); gtk_widget_ref (maxy); gtk_object_set_data_full (GTK_OBJECT (app), "maxy", maxy, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (maxy); gtk_table_attach (GTK_TABLE (table1), maxy, 1, 2, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (maxy), TRUE); count_adj = gtk_adjustment_new (1, 1, 1e+22, 1, 10, 10); count = gtk_spin_button_new (GTK_ADJUSTMENT (count_adj), 1, 0); gtk_widget_ref (count); gtk_object_set_data_full (GTK_OBJECT (app), "count", count, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (count); gtk_table_attach (GTK_TABLE (table1), count, 1, 2, 8, 9, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label10 = gtk_label_new (_("Curve Interval:")); gtk_widget_ref (label10); gtk_object_set_data_full (GTK_OBJECT (app), "label10", label10, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label10); gtk_table_attach (GTK_TABLE (table1), label10, 0, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label10), 7.45058e-09, 0.5); label11 = gtk_label_new (_("Datatype:")); gtk_widget_ref (label11); gtk_object_set_data_full (GTK_OBJECT (app), "label11", label11, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label11); gtk_table_attach (GTK_TABLE (table1), label11, 0, 2, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label11), 7.45058e-09, 0.5); label12 = gtk_label_new (_("Scale")); gtk_widget_ref (label12); gtk_object_set_data_full (GTK_OBJECT (app), "label12", label12, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label12); gtk_table_attach (GTK_TABLE (table1), label12, 0, 1, 6, 7, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5); scale_adj = gtk_adjustment_new (1, 1, 1e+22, 1, 10, 10); scale = gtk_spin_button_new (GTK_ADJUSTMENT (scale_adj), 1, 0); gtk_widget_ref (scale); gtk_object_set_data_full (GTK_OBJECT (app), "scale", scale, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (scale); gtk_table_attach (GTK_TABLE (table1), scale, 1, 2, 6, 7, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); base_adj = gtk_adjustment_new (0, 0, 1e+22, 1, 10, 10); base = gtk_spin_button_new (GTK_ADJUSTMENT (base_adj), 1, 0); gtk_widget_ref (base); gtk_object_set_data_full (GTK_OBJECT (app), "base", base, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (base); gtk_table_attach (GTK_TABLE (table1), base, 1, 2, 7, 8, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label13 = gtk_label_new (_("Base")); gtk_widget_ref (label13); gtk_object_set_data_full (GTK_OBJECT (app), "label13", label13, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label13); gtk_table_attach (GTK_TABLE (table1), label13, 0, 1, 7, 8, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5); scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_ref (scrolledwindow1); gtk_object_set_data_full (GTK_OBJECT (app), "scrolledwindow1", scrolledwindow1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (scrolledwindow1); gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow1, TRUE, TRUE, 0); gtk_widget_set_sensitive (scrolledwindow1, FALSE); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); clist = gtk_clist_new (2); gtk_widget_ref (clist); gtk_object_set_data_full (GTK_OBJECT (app), "clist", clist, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (clist); gtk_container_add (GTK_CONTAINER (scrolledwindow1), clist); gtk_clist_set_column_width (GTK_CLIST (clist), 0, 28); gtk_clist_set_column_width (GTK_CLIST (clist), 1, 80); gtk_clist_column_titles_show (GTK_CLIST (clist)); label8 = gtk_label_new (_("Type")); gtk_widget_ref (label8); gtk_object_set_data_full (GTK_OBJECT (app), "label8", label8, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label8); gtk_clist_set_column_widget (GTK_CLIST (clist), 0, label8); label9 = gtk_label_new (_("Name")); gtk_widget_ref (label9); gtk_object_set_data_full (GTK_OBJECT (app), "label9", label9, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label9); gtk_clist_set_column_widget (GTK_CLIST (clist), 1, label9); toolbar2 = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); gtk_widget_ref (toolbar2); gtk_object_set_data_full (GTK_OBJECT (app), "toolbar2", toolbar2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (toolbar2); gtk_box_pack_start (GTK_BOX (vbox2), toolbar2, FALSE, FALSE, 0); gtk_widget_set_sensitive (toolbar2, FALSE); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_OPEN); list_open = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar2), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("Open"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (list_open); gtk_object_set_data_full (GTK_OBJECT (app), "list_open", list_open, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (list_open); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_SAVE); list_save = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar2), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("Save"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (list_save); gtk_object_set_data_full (GTK_OBJECT (app), "list_save", list_save, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (list_save); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_ADD); list_add = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar2), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("Add"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (list_add); gtk_object_set_data_full (GTK_OBJECT (app), "list_add", list_add, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (list_add); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_REMOVE); list_remove = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar2), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("Remove"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (list_remove); gtk_object_set_data_full (GTK_OBJECT (app), "list_remove", list_remove, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (list_remove); tmp_toolbar_icon = gnome_stock_pixmap_widget (app, GNOME_STOCK_PIXMAP_EXEC); list_use = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar2), GTK_TOOLBAR_CHILD_BUTTON, NULL, _("Use"), NULL, NULL, tmp_toolbar_icon, NULL, NULL); gtk_widget_ref (list_use); gtk_object_set_data_full (GTK_OBJECT (app), "list_use", list_use, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (list_use); curve = gtk_curve_new (); gtk_widget_ref (curve); gtk_object_set_data_full (GTK_OBJECT (app), "curve", curve, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (curve); gtk_box_pack_start (GTK_BOX (hbox1), curve, TRUE, TRUE, 0); gtk_widget_set_usize (curve, 256, 256); gtk_curve_set_range (GTK_CURVE (curve), 0, 1, 0, 1); appbar1 = gnome_appbar_new (FALSE, TRUE, GNOME_PREFERENCES_NEVER); gtk_widget_ref (appbar1); gtk_object_set_data_full (GTK_OBJECT (app), "appbar1", appbar1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (appbar1); gnome_app_set_statusbar (GNOME_APP (app), appbar1); gtk_signal_connect (GTK_OBJECT (app), "delete_event", GTK_SIGNAL_FUNC (on_app_delete_event), NULL); gtk_signal_connect (GTK_OBJECT (button_new), "clicked", GTK_SIGNAL_FUNC (on_button_new_clicked), NULL); gtk_signal_connect (GTK_OBJECT (button_open), "clicked", GTK_SIGNAL_FUNC (on_button_open_clicked), NULL); gtk_signal_connect (GTK_OBJECT (button_save), "clicked", GTK_SIGNAL_FUNC (on_button_save_clicked), NULL); gtk_signal_connect (GTK_OBJECT (button_save_as), "clicked", GTK_SIGNAL_FUNC (on_button_save_as_clicked), NULL); gtk_signal_connect (GTK_OBJECT (button_upload), "clicked", GTK_SIGNAL_FUNC (on_button_upload_clicked), NULL); gtk_signal_connect (GTK_OBJECT (radiobutton_spline), "clicked", GTK_SIGNAL_FUNC (on_radiobutton_spline_clicked), NULL); gtk_signal_connect (GTK_OBJECT (radiobutton_linear), "clicked", GTK_SIGNAL_FUNC (on_radiobutton_linear_clicked), NULL); gtk_signal_connect (GTK_OBJECT (radiobutton_free), "clicked", GTK_SIGNAL_FUNC (on_radiobutton_free_clicked), NULL); gtk_signal_connect (GTK_OBJECT (minx), "changed", GTK_SIGNAL_FUNC (on_minx_changed), NULL); gtk_signal_connect (GTK_OBJECT (maxx), "changed", GTK_SIGNAL_FUNC (on_maxx_changed), NULL); gtk_signal_connect (GTK_OBJECT (miny), "changed", GTK_SIGNAL_FUNC (on_miny_changed), NULL); gtk_signal_connect (GTK_OBJECT (maxy), "changed", GTK_SIGNAL_FUNC (on_maxy_changed), NULL); gtk_signal_connect (GTK_OBJECT (list_open), "clicked", GTK_SIGNAL_FUNC (on_list_open_clicked), NULL); gtk_signal_connect (GTK_OBJECT (list_save), "clicked", GTK_SIGNAL_FUNC (on_list_save_clicked), NULL); gtk_signal_connect (GTK_OBJECT (list_add), "clicked", GTK_SIGNAL_FUNC (on_list_add_clicked), NULL); gtk_signal_connect (GTK_OBJECT (list_remove), "clicked", GTK_SIGNAL_FUNC (on_list_remove_clicked), NULL); gtk_signal_connect (GTK_OBJECT (list_use), "clicked", GTK_SIGNAL_FUNC (on_list_use_clicked), NULL); return app; }
GtkWidget* create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *hbox2; GtkWidget *curve1; GtkWidget *vseparator1; GtkWidget *vbox3; GtkWidget *drawingarea_histin; GtkWidget *drawingarea_histout; GtkWidget *hbox1; GtkWidget *buttonReset; GtkWidget *buttonCancel; GtkWidget *buttonApply; GtkWidget *button3; GtkWidget *gui_scale; GtkWidget *drawingarea1; GtkWidget *dialog_action_area1; dialog1 = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Equalizer")); gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox1), hbox2, TRUE, TRUE, 0); curve1 = gtk_curve_new (); gtk_widget_show (curve1); gtk_box_pack_start (GTK_BOX (hbox2), curve1, FALSE, FALSE, 0); gtk_curve_set_range (GTK_CURVE (curve1), 0, 1, 0, 1); vseparator1 = gtk_vseparator_new (); gtk_widget_show (vseparator1); gtk_box_pack_start (GTK_BOX (hbox2), vseparator1, FALSE, FALSE, 0); vbox3 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox3); gtk_box_pack_start (GTK_BOX (hbox2), vbox3, TRUE, TRUE, 0); drawingarea_histin = gtk_drawing_area_new (); gtk_widget_show (drawingarea_histin); gtk_box_pack_start (GTK_BOX (vbox3), drawingarea_histin, TRUE, TRUE, 0); gtk_widget_set_size_request (drawingarea_histin, 10, -1); drawingarea_histout = gtk_drawing_area_new (); gtk_widget_show (drawingarea_histout); gtk_box_pack_start (GTK_BOX (vbox3), drawingarea_histout, TRUE, TRUE, 0); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); buttonReset = gtk_button_new_from_stock ("gtk-clear"); gtk_widget_show (buttonReset); gtk_box_pack_start (GTK_BOX (hbox1), buttonReset, FALSE, FALSE, 0); buttonCancel = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (buttonCancel); gtk_box_pack_start (GTK_BOX (hbox1), buttonCancel, FALSE, FALSE, 0); buttonApply = gtk_button_new_from_stock ("gtk-apply"); gtk_widget_show (buttonApply); gtk_box_pack_start (GTK_BOX (hbox1), buttonApply, FALSE, FALSE, 0); button3 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (button3); gtk_box_pack_start (GTK_BOX (hbox1), button3, FALSE, FALSE, 0); gui_scale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 10, 10))); gtk_widget_show (gui_scale); gtk_box_pack_start (GTK_BOX (vbox1), gui_scale, TRUE, TRUE, 0); drawingarea1 = gtk_drawing_area_new (); gtk_widget_show (drawingarea1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), drawingarea1, TRUE, TRUE, 0); gtk_widget_set_size_request (drawingarea1, 100, 100); dialog_action_area1 = GTK_DIALOG (dialog1)->action_area; gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1"); GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (dialog1, hbox2, "hbox2"); GLADE_HOOKUP_OBJECT (dialog1, curve1, "curve1"); GLADE_HOOKUP_OBJECT (dialog1, vseparator1, "vseparator1"); GLADE_HOOKUP_OBJECT (dialog1, vbox3, "vbox3"); GLADE_HOOKUP_OBJECT (dialog1, drawingarea_histin, "drawingarea_histin"); GLADE_HOOKUP_OBJECT (dialog1, drawingarea_histout, "drawingarea_histout"); GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (dialog1, buttonReset, "buttonReset"); GLADE_HOOKUP_OBJECT (dialog1, buttonCancel, "buttonCancel"); GLADE_HOOKUP_OBJECT (dialog1, buttonApply, "buttonApply"); GLADE_HOOKUP_OBJECT (dialog1, button3, "button3"); GLADE_HOOKUP_OBJECT (dialog1, gui_scale, "gui_scale"); GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); //gtk_widget_grab_default (buttonApply); return dialog1; }
void reset_curve( GtkWidget *curve ) { gtk_curve_reset(GTK_CURVE(curve)); gtk_curve_set_range( GTK_CURVE(curve), 0.0, 1.0, 0.0, 1.0 ); }