/* * Create dialog for red eye removal */ static gboolean dialog (gint32 image_id, GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *preview; GtkWidget *table; GtkWidget *main_vbox; GtkObject *adj; gboolean run = FALSE; gimp_ui_init (PLUG_IN_BINARY, TRUE); dialog = gimp_dialog_new (_("Red Eye Removal"), PLUG_IN_ROLE, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); preview = gimp_zoom_preview_new (drawable); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); table = gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); adj = gimp_scale_entry_new (GTK_TABLE (table), 1, 0, _("_Threshold:"), SCALE_WIDTH, 0, threshold, 0, 100, 1, 5, 0, TRUE, 0, 100, _("Threshold for the red eye color to remove."), NULL); if (gimp_selection_is_empty (gimp_item_get_image (drawable->drawable_id))) { GtkWidget *hints = gimp_hint_box_new (_("Manually selecting the eyes may " "improve the results.")); gtk_box_pack_end (GTK_BOX (main_vbox), hints, FALSE, FALSE, 0); gtk_widget_show (hints); } g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (remove_redeye_preview), drawable); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_int_adjustment_update), &threshold); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); gtk_widget_show (dialog); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }
static gint alienmap2_dialog (void) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *top_table; GtkWidget *frame; GtkWidget *toggle; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *table; GtkObject *adj; gboolean run; gimp_ui_init (PLUG_IN_BINARY, TRUE); dialog = gimp_dialog_new (_("Alien Map"), PLUG_IN_ROLE, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); preview = gimp_zoom_preview_new (drawable); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (dialog_update_preview), drawable); top_table = gtk_table_new (2, 2, FALSE); gtk_table_set_col_spacings (GTK_TABLE (top_table), 12); gtk_table_set_row_spacings (GTK_TABLE (top_table), 12); gtk_box_pack_start (GTK_BOX (main_vbox), top_table, FALSE, FALSE, 0); gtk_widget_show (top_table); /* Controls */ table = gtk_table_new (6, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 4); gtk_table_attach (GTK_TABLE (top_table), table, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0); gtk_widget_show (table); entry_freq_rh = adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, NULL, SCALE_WIDTH, ENTRY_WIDTH, wvals.redfrequency, 0, 20.0, 0.1, 1, 2, TRUE, 0, 0, _("Number of cycles covering full value range"), NULL); label_freq_rh = GIMP_SCALE_ENTRY_LABEL (adj); g_signal_connect (adj, "value-changed", G_CALLBACK (dialog_scale_update), &wvals.redfrequency); entry_phase_rh = adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, NULL, SCALE_WIDTH, ENTRY_WIDTH, wvals.redangle, 0, 360.0, 1, 15, 2, TRUE, 0, 0, _("Phase angle, range 0-360"), NULL); label_phase_rh = GIMP_SCALE_ENTRY_LABEL (adj); g_signal_connect (adj, "value-changed", G_CALLBACK (dialog_scale_update), &wvals.redangle); entry_freq_gs = adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2, NULL, SCALE_WIDTH, ENTRY_WIDTH, wvals.greenfrequency, 0, 20.0, 0.1, 1, 2, TRUE, 0, 0, _("Number of cycles covering full value range"), NULL); label_freq_gs = GIMP_SCALE_ENTRY_LABEL (adj); g_signal_connect (adj, "value-changed", G_CALLBACK (dialog_scale_update), &wvals.greenfrequency); entry_phase_gs = adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 3, NULL, SCALE_WIDTH, ENTRY_WIDTH, wvals.redangle, 0, 360.0, 1, 15, 2, TRUE, 0, 0, _("Phase angle, range 0-360"), NULL); label_phase_gs = GIMP_SCALE_ENTRY_LABEL (adj); g_signal_connect (adj, "value-changed", G_CALLBACK (dialog_scale_update), &wvals.greenangle); entry_freq_bl = adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 4, NULL, SCALE_WIDTH, ENTRY_WIDTH, wvals.bluefrequency, 0, 20.0, 0.1, 1, 2, TRUE, 0, 0, _("Number of cycles covering full value range"), NULL); label_freq_bl = GIMP_SCALE_ENTRY_LABEL (adj); g_signal_connect (adj, "value-changed", G_CALLBACK (dialog_scale_update), &wvals.bluefrequency); entry_phase_bl = adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 5, NULL, SCALE_WIDTH, ENTRY_WIDTH, wvals.blueangle, 0, 360.0, 1, 15, 2, TRUE, 0, 0, _("Phase angle, range 0-360"), NULL); label_phase_bl = GIMP_SCALE_ENTRY_LABEL (adj); g_signal_connect (adj, "value-changed", G_CALLBACK (dialog_scale_update), &wvals.blueangle); /* Mode toggle box */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_table_attach (GTK_TABLE (top_table), hbox, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_widget_show (hbox); frame = gimp_int_radio_group_new (TRUE, _("Mode"), G_CALLBACK (alienmap2_radio_update), &wvals.colormodel, wvals.colormodel, _("_RGB color model"), RGB_MODEL, NULL, _("_HSL color model"), HSL_MODEL, NULL, NULL); gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); toggle_modify_rh = toggle = gtk_check_button_new_with_mnemonic (NULL); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), wvals.redmode); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (alienmap2_toggle_update), &wvals.redmode); toggle_modify_gs = toggle = gtk_check_button_new_with_mnemonic (NULL); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), wvals.greenmode); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (alienmap2_toggle_update), &wvals.greenmode); toggle_modify_bl = toggle = gtk_check_button_new_with_mnemonic (NULL); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), wvals.bluemode); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (alienmap2_toggle_update), &wvals.bluemode); gtk_widget_show (frame); gtk_widget_show (dialog); alienmap2_get_label_size (); alienmap2_set_labels (); alienmap2_set_sensitive (); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }
static gboolean colorify_dialog (GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *preview; GtkWidget *label; GtkWidget *button; GtkWidget *table; GtkWidget *color_area; gint i; gboolean run; gimp_ui_init (PLUG_IN_BINARY, TRUE); dialog = gimp_dialog_new (_("Colorify"), PLUG_IN_BINARY, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_vbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox); gtk_widget_show (main_vbox); preview = gimp_zoom_preview_new (drawable); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (colorify), drawable); table = gtk_table_new (2, 7, TRUE); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); label = gtk_label_new (_("Custom color:")); gtk_table_attach (GTK_TABLE (table), label, 4, 6, 0, 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); custom_color_button = gimp_color_button_new (_("Colorify Custom Color"), COLOR_SIZE, COLOR_SIZE, &cvals.color, GIMP_COLOR_AREA_FLAT); g_signal_connect (custom_color_button, "color-changed", G_CALLBACK (gimp_color_button_get_color), &cvals.color); g_signal_connect_swapped (custom_color_button, "color-changed", G_CALLBACK (gimp_preview_invalidate), preview); gtk_table_attach (GTK_TABLE (table), custom_color_button, 6, 7, 0, 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (custom_color_button); for (i = 0; i < 7; i++) { button = gtk_button_new (); color_area = gimp_color_area_new (&button_color[i], GIMP_COLOR_AREA_FLAT, GDK_BUTTON2_MASK); gtk_widget_set_size_request (GTK_WIDGET (color_area), COLOR_SIZE, COLOR_SIZE); gtk_container_add (GTK_CONTAINER (button), color_area); g_signal_connect (button, "clicked", G_CALLBACK (predefined_color_callback), &button_color[i]); gtk_widget_show (color_area); gtk_table_attach (GTK_TABLE (table), button, i, i + 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (button); } gtk_widget_show (dialog); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }
static gboolean polarize_dialog (GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *preview; GtkWidget *table; GtkWidget *hbox; GtkWidget *toggle; GtkObject *adj; gboolean run; gimp_ui_init (PLUG_IN_BINARY, TRUE); dialog = gimp_dialog_new (_("Polar Coordinates"), PLUG_IN_BINARY, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_vbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox); gtk_widget_show (main_vbox); /* Preview */ preview = gimp_zoom_preview_new (drawable); gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (dialog_update_preview), drawable); /* Controls */ table = gtk_table_new (2, 3, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, _("Circle _depth in percent:"), SCALE_WIDTH, 0, pcvals.circle, 0.0, 100.0, 1.0, 10.0, 2, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &pcvals.circle); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, _("Offset _angle:"), SCALE_WIDTH, 0, pcvals.angle, 0.0, 359.0, 1.0, 15.0, 2, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &pcvals.angle); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); /* togglebuttons for backwards, top, polar->rectangular */ hbox = gtk_hbox_new (TRUE, 6); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); toggle = gtk_check_button_new_with_mnemonic (_("_Map backwards")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), pcvals.backwards); gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0); gtk_widget_show (toggle); gimp_help_set_help_data (toggle, _("If checked the mapping will begin at the right " "side, as opposed to beginning at the left."), NULL); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &pcvals.backwards); g_signal_connect_swapped (toggle, "toggled", G_CALLBACK (gimp_preview_invalidate), preview); toggle = gtk_check_button_new_with_mnemonic (_("Map from _top")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), pcvals.inverse); gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0); gtk_widget_show (toggle); gimp_help_set_help_data (toggle, _("If unchecked the mapping will put the bottom " "row in the middle and the top row on the " "outside. If checked it will be the opposite."), NULL); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &pcvals.inverse); g_signal_connect_swapped (toggle, "toggled", G_CALLBACK (gimp_preview_invalidate), preview); toggle = gtk_check_button_new_with_mnemonic (_("To _polar")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), pcvals.polrec); gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0); gtk_widget_show (toggle); gimp_help_set_help_data (toggle, _("If unchecked the image will be circularly " "mapped onto a rectangle. If checked the image " "will be mapped onto a circle."), NULL); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &pcvals.polrec); g_signal_connect_swapped (toggle, "toggled", G_CALLBACK (gimp_preview_invalidate), preview); gtk_widget_show (hbox); /* Done */ gtk_widget_show (dialog); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }
static gboolean waves_dialog (GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *frame; GtkWidget *smear; GtkWidget *blacken; GtkWidget *table; GtkWidget *preview; GtkWidget *toggle; GtkObject *adj; gboolean run; gimp_ui_init (PLUG_IN_BINARY, TRUE); dialog = gimp_dialog_new (_("Waves"), PLUG_IN_ROLE, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_vbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); preview = gimp_zoom_preview_new (drawable); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (waves_preview), drawable); frame = gimp_int_radio_group_new (TRUE, _("Mode"), G_CALLBACK (gimp_radio_button_update), &wvals.type, wvals.type, _("_Smear"), MODE_SMEAR, &smear, _("_Blacken"), MODE_BLACKEN, &blacken, NULL); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); g_signal_connect_swapped (smear, "toggled", G_CALLBACK (gimp_preview_invalidate), preview); g_signal_connect_swapped (blacken, "toggled", G_CALLBACK (gimp_preview_invalidate), preview); toggle = gtk_check_button_new_with_mnemonic ( _("_Reflective")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), wvals.reflective); gtk_box_pack_start (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &wvals.reflective); g_signal_connect_swapped (toggle, "toggled", G_CALLBACK (gimp_preview_invalidate), preview); table = gtk_table_new (3, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, _("_Amplitude:"), 140, 6, wvals.amplitude, 0.0, 101.0, 1.0, 5.0, 2, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &wvals.amplitude); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, _("_Phase:"), 140, 6, wvals.phase, 0.0, 360.0, 2.0, 5.0, 2, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &wvals.phase); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2, _("_Wavelength:"), 140, 6, wvals.wavelength, 0.1, 50.0, 1.0, 5.0, 2, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &wvals.wavelength); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); gtk_widget_show (dialog); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }
static gboolean lens_dialog (GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *table; GtkWidget *preview; GtkObject *adj; gint row = 0; gboolean run = FALSE; gimp_ui_init (PLUG_IN_BINARY, FALSE); dialog = gimp_dialog_new (_("Lens Distortion"), PLUG_IN_ROLE, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GIMP_STOCK_RESET, RESPONSE_RESET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), RESPONSE_RESET, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); preview = gimp_zoom_preview_new (drawable); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (lens_distort_preview), drawable); table = gtk_table_new (6, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++, _("_Main:"), 120, 6, vals.square_a, -100.0, 100.0, 0.1, 1.0, 3, TRUE, 0, 0, NULL, NULL); adjustments = g_slist_append (adjustments, adj); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &vals.square_a); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++, _("_Edge:"), 120, 6, vals.quad_a, -100.0, 100.0, 0.1, 1.0, 3, TRUE, 0, 0, NULL, NULL); adjustments = g_slist_append (adjustments, adj); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &vals.quad_a); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++, _("_Zoom:"), 120, 6, vals.scale_a, -100.0, 100.0, 0.1, 1.0, 3, TRUE, 0, 0, NULL, NULL); adjustments = g_slist_append (adjustments, adj); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &vals.scale_a); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++, _("_Brighten:"), 120, 6, vals.brighten, -100.0, 100.0, 0.1, 1.0, 3, TRUE, 0, 0, NULL, NULL); adjustments = g_slist_append (adjustments, adj); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &vals.brighten); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++, _("_X shift:"), 120, 6, vals.centre_x, -100.0, 100.0, 0.1, 1.0, 3, TRUE, 0, 0, NULL, NULL); adjustments = g_slist_append (adjustments, adj); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &vals.centre_x); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++, _("_Y shift:"), 120, 6, vals.centre_y, -100.0, 100.0, 0.1, 1.0, 3, TRUE, 0, 0, NULL, NULL); adjustments = g_slist_append (adjustments, adj); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &vals.centre_y); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); g_signal_connect (dialog, "response", G_CALLBACK (lens_response), &run); g_signal_connect (dialog, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show (dialog); gtk_main (); g_slist_free (adjustments); adjustments = NULL; return run; }
static gboolean retinex_dialog (GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *preview; GtkWidget *table; GtkWidget *combo; GtkObject *adj; gboolean run; gimp_ui_init (PLUG_IN_BINARY, FALSE); dialog = gimp_dialog_new (_("Retinex Image Enhancement"), PLUG_IN_BINARY, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_vbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); preview = gimp_zoom_preview_new (drawable); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (retinex), drawable); table = gtk_table_new (4, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); combo = gimp_int_combo_box_new (_("Uniform"), filter_uniform, _("Low"), filter_low, _("High"), filter_high, NULL); gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), rvals.scales_mode, G_CALLBACK (gimp_int_combo_box_get_active), &rvals.scales_mode); g_signal_connect_swapped (combo, "changed", G_CALLBACK (gimp_preview_invalidate), preview); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("_Level:"), 0.0, 0.5, combo, 2, FALSE); gtk_widget_show (combo); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, _("_Scale:"), SCALE_WIDTH, ENTRY_WIDTH, rvals.scale, MIN_GAUSSIAN_SCALE, MAX_GAUSSIAN_SCALE, 1, 1, 0, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_int_adjustment_update), &rvals.scale); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2, _("Scale _division:"), SCALE_WIDTH, ENTRY_WIDTH, rvals.nscales, 0, MAX_RETINEX_SCALES, 1, 1, 0, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_int_adjustment_update), &rvals.nscales); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 3, _("Dy_namic:"), SCALE_WIDTH, ENTRY_WIDTH, rvals.cvar, 0, 4, 0.1, 0.1, 1, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_float_adjustment_update), &rvals.cvar); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); gtk_widget_show (dialog); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }
static gboolean nova_dialog (GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *preview; GtkWidget *frame; GtkWidget *table; GtkWidget *button; GtkObject *adj; gboolean run; gimp_ui_init (PLUG_IN_BINARY, TRUE); dialog = gimp_dialog_new (_("Supernova"), PLUG_IN_ROLE, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); preview = gimp_zoom_preview_new (drawable); gtk_widget_add_events (GIMP_PREVIEW (preview)->area, GDK_BUTTON_PRESS_MASK | GDK_BUTTON1_MOTION_MASK); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (nova), drawable); frame = nova_center_create (drawable, GIMP_PREVIEW (preview)); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); table = gtk_table_new (4, 3, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); /* Color */ if (gimp_drawable_is_rgb (drawable->drawable_id)) { button = gimp_color_button_new (_("Supernova Color Picker"), SCALE_WIDTH - 8, 16, &pvals.color, GIMP_COLOR_AREA_FLAT); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Co_lor:"), 0.0, 0.5, button, 1, TRUE); g_signal_connect (button, "color-changed", G_CALLBACK (gimp_color_button_get_color), &pvals.color); g_signal_connect_swapped (button, "color-changed", G_CALLBACK (gimp_preview_invalidate), preview); } /* Radius */ adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, _("_Radius:"), SCALE_WIDTH, 8, pvals.radius, 1, 100, 1, 10, 0, FALSE, 1, GIMP_MAX_IMAGE_SIZE, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_int_adjustment_update), &pvals.radius); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); /* Number of spokes */ adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2, _("_Spokes:"), SCALE_WIDTH, 8, pvals.nspoke, 1, 1024, 1, 16, 0, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_int_adjustment_update), &pvals.nspoke); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); /* Randomness of hue */ if (gimp_drawable_is_rgb (drawable->drawable_id)) { adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 3, _("R_andom hue:"), SCALE_WIDTH, 8, pvals.randomhue, 0, 360, 1, 15, 0, TRUE, 0, 0, NULL, NULL); g_signal_connect (adj, "value-changed", G_CALLBACK (gimp_int_adjustment_update), &pvals.randomhue); g_signal_connect_swapped (adj, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); } gtk_widget_show (dialog); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }
static gboolean cm_dialog (CmParamsType *mix, GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *vbox; GtkWidget *frame; GtkWidget *hbox; GtkWidget *button; GtkWidget *label; GtkWidget *image; GtkWidget *table; gdouble red_value, green_value, blue_value; gboolean run; gimp_ui_init (PLUG_IN_BINARY, FALSE); /* get values */ if (mix->monochrome) { red_value = mix->black.red_gain * 100; green_value = mix->black.green_gain * 100; blue_value = mix->black.blue_gain * 100; } else { switch (mix->output_channel) { case CM_RED_CHANNEL: red_value = mix->red.red_gain * 100; green_value = mix->red.green_gain * 100; blue_value = mix->red.blue_gain * 100; break; case CM_GREEN_CHANNEL: red_value = mix->green.red_gain * 100; green_value = mix->green.green_gain * 100; blue_value = mix->green.blue_gain * 100; break; case CM_BLUE_CHANNEL: red_value = mix->blue.red_gain * 100; green_value = mix->blue.green_gain * 100; blue_value = mix->blue.blue_gain * 100; break; default: g_assert_not_reached (); red_value = green_value = blue_value = 0.0; break; } } dialog = gimp_dialog_new (_("Channel Mixer"), PLUG_IN_ROLE, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_vbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); preview = gimp_zoom_preview_new (drawable); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (cm_preview), mix); frame = gimp_frame_new (NULL); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); hbox = gtk_hbox_new (FALSE, 6); gtk_frame_set_label_widget (GTK_FRAME (frame), hbox); gtk_widget_show (hbox); label = gtk_label_new_with_mnemonic (_("O_utput channel:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); mix->combo = g_object_new (GIMP_TYPE_INT_COMBO_BOX, NULL); gimp_int_combo_box_append (GIMP_INT_COMBO_BOX (mix->combo), GIMP_INT_STORE_VALUE, CM_RED_CHANNEL, GIMP_INT_STORE_LABEL, _("Red"), GIMP_INT_STORE_STOCK_ID, GIMP_STOCK_CHANNEL_RED, -1); gimp_int_combo_box_append (GIMP_INT_COMBO_BOX (mix->combo), GIMP_INT_STORE_VALUE, CM_GREEN_CHANNEL, GIMP_INT_STORE_LABEL, _("Green"), GIMP_INT_STORE_STOCK_ID, GIMP_STOCK_CHANNEL_GREEN, -1); gimp_int_combo_box_append (GIMP_INT_COMBO_BOX (mix->combo), GIMP_INT_STORE_VALUE, CM_BLUE_CHANNEL, GIMP_INT_STORE_LABEL, _("Blue"), GIMP_INT_STORE_STOCK_ID, GIMP_STOCK_CHANNEL_BLUE, -1); gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (mix->combo), mix->output_channel); g_signal_connect (mix->combo, "changed", G_CALLBACK (cm_combo_callback), mix); gtk_box_pack_start (GTK_BOX (hbox), mix->combo, TRUE, TRUE, 0); gtk_widget_show (mix->combo); if (mix->monochrome) gtk_widget_set_sensitive (mix->combo, FALSE); gtk_label_set_mnemonic_widget (GTK_LABEL (label), mix->combo); /*........................................................... */ table = gtk_table_new (3, 4, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_container_add (GTK_CONTAINER (frame), table); gtk_widget_show (table); image = gtk_image_new_from_stock (GIMP_STOCK_CHANNEL_RED, GTK_ICON_SIZE_BUTTON); gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (image); mix->red_data = GTK_ADJUSTMENT (gimp_scale_entry_new (GTK_TABLE (table), 1, 0, _("_Red:"), 150, -1, red_value, -200.0, 200.0, 1.0, 10.0, 1, TRUE, 0.0, 0.0, NULL, NULL)); g_signal_connect (mix->red_data, "value-changed", G_CALLBACK (cm_red_scale_callback), mix); image = gtk_image_new_from_stock (GIMP_STOCK_CHANNEL_GREEN, GTK_ICON_SIZE_BUTTON); gtk_table_attach (GTK_TABLE (table), image, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (image); mix->green_data = GTK_ADJUSTMENT (gimp_scale_entry_new (GTK_TABLE (table), 1, 1, _("_Green:"), 150, -1, green_value, -200.0, 200.0, 1.0, 10.0, 1, TRUE, 0.0, 0.0, NULL, NULL)); g_signal_connect (mix->green_data, "value-changed", G_CALLBACK (cm_green_scale_callback), mix); image = gtk_image_new_from_stock (GIMP_STOCK_CHANNEL_BLUE, GTK_ICON_SIZE_BUTTON); gtk_table_attach (GTK_TABLE (table), image, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (image); mix->blue_data = GTK_ADJUSTMENT (gimp_scale_entry_new (GTK_TABLE (table), 1, 2, _("_Blue:"), 150, -1, blue_value, -200.0, 200.0, 1.0, 10.0, 1, TRUE, 0.0, 0.0, NULL, NULL)); g_signal_connect (mix->blue_data, "value-changed", G_CALLBACK (cm_blue_scale_callback), mix); vbox = gtk_vbox_new (6, FALSE); gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); /* The monochrome toggle */ mix->monochrome_toggle = gtk_check_button_new_with_mnemonic (_("_Monochrome")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mix->monochrome_toggle), mix->monochrome); gtk_box_pack_start (GTK_BOX (vbox), mix->monochrome_toggle, FALSE, FALSE, 0); gtk_widget_show (mix->monochrome_toggle); g_signal_connect (mix->monochrome_toggle, "toggled", G_CALLBACK (cm_monochrome_callback), mix); /* The preserve luminosity toggle */ mix->preserve_luminosity_toggle = gtk_check_button_new_with_mnemonic (_("Preserve _luminosity")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mix->preserve_luminosity_toggle), mix->preserve_luminosity); gtk_box_pack_start (GTK_BOX (vbox), mix->preserve_luminosity_toggle, FALSE, FALSE, 0); gtk_widget_show (mix->preserve_luminosity_toggle); g_signal_connect (mix->preserve_luminosity_toggle, "toggled", G_CALLBACK (cm_preserve_luminosity_callback), mix); /*........................................................... */ /* Horizontal box for file i/o */ hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_end (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); button = gtk_button_new_from_stock (GTK_STOCK_OPEN); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (cm_load_file_callback), mix); button = gtk_button_new_from_stock (GTK_STOCK_SAVE); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (cm_save_file_callback), mix); button = gtk_button_new_from_stock (GIMP_STOCK_RESET); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (cm_reset_callback), mix); gtk_widget_show (dialog); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }