static void gimp_grid_editor_constructed (GObject *object) { GimpGridEditor *editor = GIMP_GRID_EDITOR (object); GtkWidget *frame; GtkWidget *hbox; GtkWidget *table; GtkWidget *style; GtkWidget *color_button; GtkWidget *sizeentry; if (G_OBJECT_CLASS (parent_class)->constructed) G_OBJECT_CLASS (parent_class)->constructed (object); g_assert (editor->grid != NULL); frame = gimp_frame_new (_("Appearance")); gtk_box_pack_start (GTK_BOX (editor), frame, FALSE, FALSE, 0); gtk_widget_show (frame); table = gtk_table_new (3, 2, 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); style = gimp_prop_enum_combo_box_new (G_OBJECT (editor->grid), "style", GIMP_GRID_DOTS, GIMP_GRID_SOLID); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Line _style:"), 0.0, 0.5, style, 1, FALSE); color_button = gimp_prop_color_button_new (G_OBJECT (editor->grid), "fgcolor", _("Change grid foreground color"), GRID_EDITOR_COLOR_BUTTON_WIDTH, GRID_EDITOR_COLOR_BUTTON_HEIGHT, GIMP_COLOR_AREA_FLAT); gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button), editor->context); gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, _("_Foreground color:"), 0.0, 0.5, color_button, 1, TRUE); color_button = gimp_prop_color_button_new (G_OBJECT (editor->grid), "bgcolor", _("Change grid background color"), GRID_EDITOR_COLOR_BUTTON_WIDTH, GRID_EDITOR_COLOR_BUTTON_HEIGHT, GIMP_COLOR_AREA_FLAT); gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button), editor->context); gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, _("_Background color:"), 0.0, 0.5, color_button, 1, TRUE); gtk_widget_show (table); frame = gimp_frame_new (_("Spacing")); gtk_box_pack_start (GTK_BOX (editor), frame, FALSE, FALSE, 0); gtk_widget_show (frame); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add (GTK_CONTAINER (frame), hbox); sizeentry = gimp_prop_coordinates_new (G_OBJECT (editor->grid), "xspacing", "yspacing", "spacing-unit", "%a", GIMP_SIZE_ENTRY_UPDATE_SIZE, editor->xresolution, editor->yresolution, TRUE); gtk_table_set_col_spacings (GTK_TABLE (sizeentry), 2); gtk_table_set_row_spacings (GTK_TABLE (sizeentry), 2); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), _("Width"), 0, 1, 0.0); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), _("Height"), 0, 2, 0.0); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), _("Pixels"), 1, 4, 0.0); gtk_box_pack_start (GTK_BOX (hbox), sizeentry, FALSE, FALSE, 0); gtk_widget_show (sizeentry); gtk_widget_show (hbox); frame = gimp_frame_new (_("Offset")); gtk_box_pack_start (GTK_BOX (editor), frame, FALSE, FALSE, 0); gtk_widget_show (frame); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add (GTK_CONTAINER (frame), hbox); sizeentry = gimp_prop_coordinates_new (G_OBJECT (editor->grid), "xoffset", "yoffset", "offset-unit", "%a", GIMP_SIZE_ENTRY_UPDATE_SIZE, editor->xresolution, editor->yresolution, TRUE); gtk_table_set_col_spacings (GTK_TABLE (sizeentry), 2); gtk_table_set_row_spacings (GTK_TABLE (sizeentry), 2); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), _("Width"), 0, 1, 0.0); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), _("Height"), 0, 2, 0.0); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), _("Pixels"), 1, 4, 0.0); gtk_box_pack_start (GTK_BOX (hbox), sizeentry, FALSE, FALSE, 0); gtk_widget_show (sizeentry); gtk_widget_show (hbox); }
static gboolean mblur_dialog (gint32 image_ID, GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *frame; GtkWidget *table; GtkWidget *entry; GtkWidget *spinbutton; GtkWidget *label; GtkWidget *button; GtkObject *adj; gdouble xres, yres; gboolean run; gimp_ui_init (PLUG_IN_BINARY, FALSE); dialog = gimp_dialog_new (_("Motion Blur"), 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_drawable_preview_new (drawable, NULL); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (mblur), drawable); hbox = gtk_hbox_new (FALSE, 12); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); frame = gimp_int_radio_group_new (TRUE, _("Blur Type"), G_CALLBACK (mblur_radio_button_update), &mbvals.mblur_type, mbvals.mblur_type, _("_Linear"), MBLUR_LINEAR, NULL, _("_Radial"), MBLUR_RADIAL, NULL, _("_Zoom"), MBLUR_ZOOM, NULL, NULL); gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); center = gimp_frame_new (_("Blur Center")); gtk_box_pack_start (GTK_BOX (hbox), center, FALSE, FALSE, 0); gtk_widget_show (center); vbox = gtk_vbox_new (FALSE, 12); gtk_container_add (GTK_CONTAINER (center), vbox); gtk_widget_show (vbox); gimp_image_get_resolution (image_ID, &xres, &yres); entry = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a", TRUE, FALSE, FALSE, 5, GIMP_SIZE_ENTRY_UPDATE_SIZE); gtk_table_set_row_spacings (GTK_TABLE (entry), 2); gtk_table_set_col_spacing (GTK_TABLE (entry), 0, 6); gtk_table_set_col_spacing (GTK_TABLE (entry), 2, 6); gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0); gtk_widget_show (entry); g_signal_connect (entry, "value-changed", G_CALLBACK (mblur_center_update), NULL); g_signal_connect_swapped (entry, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); spinbutton = gimp_spin_button_new (&adj, 1, 0, 1, 1, 10, 1, 1, 2); gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry), GTK_SPIN_BUTTON (spinbutton), NULL); gtk_table_attach_defaults (GTK_TABLE (entry), spinbutton, 1, 2, 0, 1); gtk_widget_show (spinbutton); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, xres, TRUE); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 0, mbvals.center_x); label = gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry), _("_X:"), 0, 0, 0.0); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 1, yres, TRUE); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 1, mbvals.center_y); label = gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry), _("_Y:"), 1, 0, 0.0); button = gtk_check_button_new_with_mnemonic (_("Blur _outward")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), mbvals.blur_outward); gtk_box_pack_start (GTK_BOX (main_vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "toggled", G_CALLBACK (gimp_toggle_button_update), &mbvals.blur_outward); g_signal_connect_swapped (button, "toggled", G_CALLBACK (gimp_preview_invalidate), preview); dir_button = button; frame = gimp_frame_new (_("Blur Parameters")); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); table = gtk_table_new (2, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_container_add (GTK_CONTAINER (frame), table); gtk_widget_show (table); length = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, _("L_ength:"), 150, 3, mbvals.length, 1.0, MBLUR_LENGTH_MAX, 1.0, 8.0, 0, TRUE, 0, 0, NULL, NULL); g_signal_connect (length, "value-changed", G_CALLBACK (gimp_int_adjustment_update), &mbvals.length); g_signal_connect_swapped (length, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); angle = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, _("_Angle:"), 150, 3, mbvals.angle, 0.0, 360.0, 1.0, 15.0, 0, TRUE, 0, 0, NULL, NULL); g_signal_connect (angle, "value-changed", G_CALLBACK (gimp_int_adjustment_update), &mbvals.angle); g_signal_connect_swapped (angle, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); mblur_set_sensitivity (); gtk_widget_show (dialog); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }
static gint dialog (gint32 image_ID, GimpDrawable *drawable) { GtkWidget *dlg; GtkWidget *main_vbox; GtkWidget *vbox; GtkSizeGroup *group; GtkWidget *label; GtkWidget *preview; GtkWidget *button; GtkWidget *width; GtkWidget *space; GtkWidget *offset; GtkWidget *chain_button; GtkWidget *table; GimpUnit unit; gdouble xres; gdouble yres; gboolean run; g_return_val_if_fail (main_dialog == NULL, FALSE); gimp_ui_init (PLUG_IN_BINARY, TRUE); main_dialog = dlg = gimp_dialog_new (_("Grid"), 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 (dlg), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dlg)); /* Get the image resolution and unit */ gimp_image_get_resolution (image_ID, &xres, &yres); unit = gimp_image_get_unit (image_ID); 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 (dlg))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); preview = gimp_drawable_preview_new (drawable, NULL); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect (preview, "invalidated", G_CALLBACK (update_preview), drawable); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); /* The width entries */ width = gimp_size_entry_new (3, /* number_of_fields */ unit, /* unit */ "%a", /* unit_format */ TRUE, /* menu_show_pixels */ TRUE, /* menu_show_percent */ FALSE, /* show_refval */ SPIN_BUTTON_WIDTH, /* spinbutton_usize */ GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */ gtk_box_pack_start (GTK_BOX (vbox), width, FALSE, FALSE, 0); gtk_widget_show (width); /* set the unit back to pixels, since most times we will want pixels */ gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (width), GIMP_UNIT_PIXEL); /* set the resolution to the image resolution */ gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (width), 0, xres, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (width), 1, yres, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (width), 2, xres, TRUE); /* set the size (in pixels) that will be treated as 0% and 100% */ gimp_size_entry_set_size (GIMP_SIZE_ENTRY (width), 0, 0.0, drawable->height); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (width), 1, 0.0, drawable->width); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (width), 2, 0.0, drawable->width); /* set upper and lower limits (in pixels) */ gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (width), 0, 0.0, drawable->height); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (width), 1, 0.0, drawable->width); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (width), 2, 0.0, MAX (drawable->width, drawable->height)); gtk_table_set_row_spacing (GTK_TABLE (width), 0, 6); gtk_table_set_col_spacings (GTK_TABLE (width), 6); gtk_table_set_col_spacing (GTK_TABLE (width), 2, 12); /* initialize the values */ gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (width), 0, grid_cfg.hwidth); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (width), 1, grid_cfg.vwidth); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (width), 2, grid_cfg.iwidth); /* attach labels */ gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (width), _("Horizontal\nLines"), 0, 1, 0.0); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (width), _("Vertical\nLines"), 0, 2, 0.0); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (width), _("Intersection"), 0, 3, 0.0); label = gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (width), _("Width:"), 1, 0, 0.0); group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_size_group_add_widget (group, label); g_object_unref (group); /* put a chain_button under the size_entries */ chain_button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM); if (grid_cfg.hwidth == grid_cfg.vwidth) gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), TRUE); gtk_table_attach_defaults (GTK_TABLE (width), chain_button, 1, 3, 2, 3); gtk_widget_show (chain_button); /* connect to the 'value-changed' signal because we have to take care * of keeping the entries in sync when the chainbutton is active */ g_signal_connect (width, "value-changed", G_CALLBACK (entry_callback), chain_button); g_signal_connect_swapped (width, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); /* The spacing entries */ space = gimp_size_entry_new (3, /* number_of_fields */ unit, /* unit */ "%a", /* unit_format */ TRUE, /* menu_show_pixels */ TRUE, /* menu_show_percent */ FALSE, /* show_refval */ SPIN_BUTTON_WIDTH, /* spinbutton_usize */ GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */ gtk_box_pack_start (GTK_BOX (vbox), space, FALSE, FALSE, 0); gtk_widget_show (space); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (space), GIMP_UNIT_PIXEL); /* set the resolution to the image resolution */ gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (space), 0, xres, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (space), 1, yres, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (space), 2, xres, TRUE); /* set the size (in pixels) that will be treated as 0% and 100% */ gimp_size_entry_set_size (GIMP_SIZE_ENTRY (space), 0, 0.0, drawable->height); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (space), 1, 0.0, drawable->width); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (space), 2, 0.0, drawable->width); /* set upper and lower limits (in pixels) */ gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (space), 0, 1.0, drawable->height); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (space), 1, 1.0, drawable->width); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (space), 2, 0.0, MAX (drawable->width, drawable->height)); gtk_table_set_col_spacings (GTK_TABLE (space), 6); gtk_table_set_col_spacing (GTK_TABLE (space), 2, 12); /* initialize the values */ gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (space), 0, grid_cfg.hspace); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (space), 1, grid_cfg.vspace); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (space), 2, grid_cfg.ispace); /* attach labels */ label = gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (space), _("Spacing:"), 1, 0, 0.0); gtk_size_group_add_widget (group, label); /* put a chain_button under the spacing_entries */ chain_button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM); if (grid_cfg.hspace == grid_cfg.vspace) gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), TRUE); gtk_table_attach_defaults (GTK_TABLE (space), chain_button, 1, 3, 2, 3); gtk_widget_show (chain_button); /* connect to the 'value-changed' and "unit-changed" signals because * we have to take care of keeping the entries in sync when the * chainbutton is active */ g_signal_connect (space, "value-changed", G_CALLBACK (entry_callback), chain_button); g_signal_connect (space, "unit-changed", G_CALLBACK (entry_callback), chain_button); g_signal_connect_swapped (space, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); /* The offset entries */ offset = gimp_size_entry_new (3, /* number_of_fields */ unit, /* unit */ "%a", /* unit_format */ TRUE, /* menu_show_pixels */ TRUE, /* menu_show_percent */ FALSE, /* show_refval */ SPIN_BUTTON_WIDTH, /* spinbutton_usize */ GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */ gtk_box_pack_start (GTK_BOX (vbox), offset, FALSE, FALSE, 0); gtk_widget_show (offset); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (offset), GIMP_UNIT_PIXEL); /* set the resolution to the image resolution */ gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (offset), 0, xres, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (offset), 1, yres, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (offset), 2, xres, TRUE); /* set the size (in pixels) that will be treated as 0% and 100% */ gimp_size_entry_set_size (GIMP_SIZE_ENTRY (offset), 0, 0.0, drawable->height); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (offset), 1, 0.0, drawable->width); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (offset), 2, 0.0, drawable->width); /* set upper and lower limits (in pixels) */ gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (offset), 0, 0.0, drawable->height); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (offset), 1, 0.0, drawable->width); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (offset), 2, 0.0, MAX (drawable->width, drawable->height)); gtk_table_set_col_spacings (GTK_TABLE (offset), 6); gtk_table_set_col_spacing (GTK_TABLE (offset), 2, 12); /* initialize the values */ gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (offset), 0, grid_cfg.hoffset); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (offset), 1, grid_cfg.voffset); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (offset), 2, grid_cfg.ioffset); /* attach labels */ label = gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (offset), _("Offset:"), 1, 0, 0.0); gtk_size_group_add_widget (group, label); /* this is a weird hack: we put a table into the offset table */ table = gtk_table_new (3, 3, FALSE); gtk_table_attach_defaults (GTK_TABLE (offset), table, 1, 4, 2, 3); gtk_table_set_row_spacing (GTK_TABLE (table), 0, 10); gtk_table_set_col_spacing (GTK_TABLE (table), 1, 12); /* put a chain_button under the offset_entries */ chain_button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM); if (grid_cfg.hoffset == grid_cfg.voffset) gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), TRUE); gtk_table_attach_defaults (GTK_TABLE (table), chain_button, 0, 2, 0, 1); gtk_widget_show (chain_button); /* connect to the 'value-changed' and "unit-changed" signals because * we have to take care of keeping the entries in sync when the * chainbutton is active */ g_signal_connect (offset, "value-changed", G_CALLBACK (entry_callback), chain_button); g_signal_connect (offset, "unit-changed", G_CALLBACK (entry_callback), chain_button); g_signal_connect_swapped (offset, "value-changed", G_CALLBACK (gimp_preview_invalidate), preview); /* put a chain_button under the color_buttons */ chain_button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM); if (gimp_rgba_distance (&grid_cfg.hcolor, &grid_cfg.vcolor) < 0.0001) gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), TRUE); gtk_table_attach_defaults (GTK_TABLE (table), chain_button, 0, 2, 2, 3); gtk_widget_show (chain_button); /* attach color selectors */ hcolor_button = gimp_color_button_new (_("Horizontal Color"), COLOR_BUTTON_WIDTH, 16, &grid_cfg.hcolor, GIMP_COLOR_AREA_SMALL_CHECKS); gimp_color_button_set_update (GIMP_COLOR_BUTTON (hcolor_button), TRUE); gtk_table_attach_defaults (GTK_TABLE (table), hcolor_button, 0, 1, 1, 2); gtk_widget_show (hcolor_button); g_signal_connect (hcolor_button, "color-changed", G_CALLBACK (gimp_color_button_get_color), &grid_cfg.hcolor); g_signal_connect (hcolor_button, "color-changed", G_CALLBACK (color_callback), chain_button); g_signal_connect_swapped (hcolor_button, "color-changed", G_CALLBACK (gimp_preview_invalidate), preview); vcolor_button = gimp_color_button_new (_("Vertical Color"), COLOR_BUTTON_WIDTH, 16, &grid_cfg.vcolor, GIMP_COLOR_AREA_SMALL_CHECKS); gimp_color_button_set_update (GIMP_COLOR_BUTTON (vcolor_button), TRUE); gtk_table_attach_defaults (GTK_TABLE (table), vcolor_button, 1, 2, 1, 2); gtk_widget_show (vcolor_button); g_signal_connect (vcolor_button, "color-changed", G_CALLBACK (gimp_color_button_get_color), &grid_cfg.vcolor); g_signal_connect (vcolor_button, "color-changed", G_CALLBACK (color_callback), chain_button); g_signal_connect_swapped (vcolor_button, "color-changed", G_CALLBACK (gimp_preview_invalidate), preview); button = gimp_color_button_new (_("Intersection Color"), COLOR_BUTTON_WIDTH, 16, &grid_cfg.icolor, GIMP_COLOR_AREA_SMALL_CHECKS); gimp_color_button_set_update (GIMP_COLOR_BUTTON (button), TRUE); gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 1, 2); gtk_widget_show (button); g_signal_connect (button, "color-changed", G_CALLBACK (gimp_color_button_get_color), &grid_cfg.icolor); g_signal_connect_swapped (button, "color-changed", G_CALLBACK (gimp_preview_invalidate), preview); gtk_widget_show (table); gtk_widget_show (dlg); g_object_set_data (G_OBJECT (dlg), "width", width); g_object_set_data (G_OBJECT (dlg), "space", space); g_object_set_data (G_OBJECT (dlg), "offset", offset); run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK); if (run) update_values (); gtk_widget_destroy (dlg); return run; }
static gboolean shift_dialog (gint32 image_ID, GimpDrawable *drawable) { GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *preview; GtkWidget *frame; GtkWidget *size_entry; GtkWidget *vertical; GtkWidget *horizontal; GimpUnit unit; gdouble xres; gdouble yres; gboolean run; gimp_ui_init (PLUG_IN_BINARY, FALSE); dialog = gimp_dialog_new (_("Shift"), 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_drawable_preview_new (drawable, NULL); gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0); gtk_widget_show (preview); g_signal_connect_swapped (preview, "invalidated", G_CALLBACK (shift), drawable); frame = gimp_int_radio_group_new (FALSE, NULL, G_CALLBACK (gimp_radio_button_update), &shvals.orientation, shvals.orientation, _("Shift _horizontally"), HORIZONTAL, &horizontal, _("Shift _vertically"), VERTICAL, &vertical, NULL); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); g_signal_connect_swapped (horizontal, "toggled", G_CALLBACK (gimp_preview_invalidate), preview); g_signal_connect_swapped (vertical, "toggled", G_CALLBACK (gimp_preview_invalidate), preview); /* Get the image resolution and unit */ gimp_image_get_resolution (image_ID, &xres, &yres); unit = gimp_image_get_unit (image_ID); size_entry = gimp_size_entry_new (1, unit, "%a", TRUE, FALSE, FALSE, SPIN_BUTTON_WIDTH, GIMP_SIZE_ENTRY_UPDATE_SIZE); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_entry), GIMP_UNIT_PIXEL); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_entry), 0, xres, TRUE); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_entry), 0, 1.0, 200.0); gtk_table_set_col_spacing (GTK_TABLE (size_entry), 0, 4); gtk_table_set_col_spacing (GTK_TABLE (size_entry), 2, 12); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_entry), 0, (gdouble) shvals.shift_amount); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (size_entry), _("Shift _amount:"), 1, 0, 0.0); g_signal_connect (size_entry, "value-changed", G_CALLBACK (shift_amount_callback), preview); gtk_box_pack_start (GTK_BOX (main_vbox), size_entry, FALSE, FALSE, 0); gtk_widget_show (size_entry); gtk_widget_show (dialog); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); gtk_widget_destroy (dialog); return run; }
/** * gimp_coordinates_new: * @unit: The initial unit of the #GimpUnitMenu. * @unit_format: A printf-like unit-format string as is used with * gimp_unit_menu_new(). * @menu_show_pixels: %TRUE if the #GimpUnitMenu should contain an item * for GIMP_UNIT_PIXEL. * @menu_show_percent: %TRUE if the #GimpUnitMenu should contain an item * for GIMP_UNIT_PERCENT. * @spinbutton_width: The horizontal size of the #GimpSizeEntry's * #GtkSpinButton's. * @update_policy: The update policy for the #GimpSizeEntry. * @chainbutton_active: %TRUE if the attached #GimpChainButton should be * active. * @chain_constrains_ratio: %TRUE if the chainbutton should constrain the * fields' aspect ratio. If %FALSE, the values will * be constrained. * @xlabel: The label for the X coordinate. * @x: The initial value of the X coordinate. * @xres: The horizontal resolution in DPI. * @lower_boundary_x: The lower boundary of the X coordinate. * @upper_boundary_x: The upper boundary of the X coordinate. * @xsize_0: The X value which will be treated as 0%. * @xsize_100: The X value which will be treated as 100%. * @ylabel: The label for the Y coordinate. * @y: The initial value of the Y coordinate. * @yres: The vertical resolution in DPI. * @lower_boundary_y: The lower boundary of the Y coordinate. * @upper_boundary_y: The upper boundary of the Y coordinate. * @ysize_0: The Y value which will be treated as 0%. * @ysize_100: The Y value which will be treated as 100%. * * Convenience function that creates a #GimpSizeEntry with two fields for x/y * coordinates/sizes with a #GimpChainButton attached to constrain either the * two fields' values or the ratio between them. * * Returns: The new #GimpSizeEntry. **/ GtkWidget * gimp_coordinates_new (GimpUnit unit, const gchar *unit_format, gboolean menu_show_pixels, gboolean menu_show_percent, gint spinbutton_width, GimpSizeEntryUpdatePolicy update_policy, gboolean chainbutton_active, gboolean chain_constrains_ratio, const gchar *xlabel, gdouble x, gdouble xres, gdouble lower_boundary_x, gdouble upper_boundary_x, gdouble xsize_0, /* % */ gdouble xsize_100, /* % */ const gchar *ylabel, gdouble y, gdouble yres, gdouble lower_boundary_y, gdouble upper_boundary_y, gdouble ysize_0, /* % */ gdouble ysize_100 /* % */) { GimpCoordinatesData *data; GtkObject *adjustment; GtkWidget *spinbutton; GtkWidget *sizeentry; GtkWidget *chainbutton; spinbutton = gimp_spin_button_new (&adjustment, 1, 0, 1, 1, 10, 0, 1, 2); if (spinbutton_width > 0) { if (spinbutton_width < 17) gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), spinbutton_width); else gtk_widget_set_size_request (spinbutton, spinbutton_width, -1); } sizeentry = gimp_size_entry_new (1, unit, unit_format, menu_show_pixels, menu_show_percent, FALSE, spinbutton_width, update_policy); gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 0, 4); gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 2, 4); gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry), GTK_SPIN_BUTTON (spinbutton), NULL); gtk_table_attach_defaults (GTK_TABLE (sizeentry), spinbutton, 1, 2, 0, 1); gtk_widget_show (spinbutton); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), (update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION) || (menu_show_pixels == FALSE) ? GIMP_UNIT_INCH : GIMP_UNIT_PIXEL); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0, xres, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1, yres, TRUE); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0, lower_boundary_x, upper_boundary_x); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1, lower_boundary_y, upper_boundary_y); if (menu_show_percent) { gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 0, xsize_0, xsize_100); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 1, ysize_0, ysize_100); } gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, x); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, y); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), xlabel, 0, 0, 0.0); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), ylabel, 1, 0, 0.0); chainbutton = gimp_chain_button_new (GIMP_CHAIN_RIGHT); if (chainbutton_active) gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chainbutton), TRUE); gtk_table_attach (GTK_TABLE (sizeentry), chainbutton, 2, 3, 0, 2, GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (chainbutton); data = g_slice_new (GimpCoordinatesData); data->chainbutton = GIMP_CHAIN_BUTTON (chainbutton); data->chain_constrains_ratio = chain_constrains_ratio; data->orig_x = x; data->orig_y = y; data->last_x = x; data->last_y = y; g_object_set_data_full (G_OBJECT (sizeentry), "coordinates-data", data, (GDestroyNotify) gimp_coordinates_data_free); g_signal_connect (sizeentry, "value-changed", G_CALLBACK (gimp_coordinates_callback), data); g_object_set_data (G_OBJECT (sizeentry), "chainbutton", chainbutton); g_signal_connect (chainbutton, "toggled", G_CALLBACK (gimp_coordinates_chainbutton_toggled), sizeentry); return sizeentry; }
static GtkWidget * print_size_frame (PrintData *data, GtkSizeGroup *label_group, GtkSizeGroup *entry_group) { GtkWidget *entry; GtkWidget *height; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *chain; GtkWidget *frame; GtkWidget *label; GtkObject *adj; gdouble image_width; gdouble image_height; image_width = (info.image_width * gimp_unit_get_factor (data->unit) / data->xres); image_height = (info.image_height * gimp_unit_get_factor (data->unit) / data->yres); frame = gimp_frame_new (_("Size")); vbox = gtk_vbox_new (FALSE, 6); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); /* the print size entry */ hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); entry = gimp_size_entry_new (1, data->unit, "%p", FALSE, FALSE, FALSE, SB_WIDTH, GIMP_SIZE_ENTRY_UPDATE_SIZE); gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); gtk_widget_show (entry); info.size_entry = GIMP_SIZE_ENTRY (entry); gtk_table_set_row_spacings (GTK_TABLE (entry), 2); gtk_table_set_col_spacing (GTK_TABLE (entry), 0, 6); gtk_table_set_col_spacing (GTK_TABLE (entry), 2, 6); height = gimp_spin_button_new (&adj, 1, 1, 1, 1, 10, 0, 1, 2); gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry), GTK_SPIN_BUTTON (height), NULL); gtk_table_attach_defaults (GTK_TABLE (entry), height, 1, 2, 0, 1); gtk_widget_show (height); gtk_size_group_add_widget (entry_group, height); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry), _("_Width:"), 0, 0, 0.0); label = gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry), _("_Height:"), 1, 0, 0.0); gtk_size_group_add_widget (label_group, label); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, data->xres, FALSE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 1, data->yres, FALSE); gimp_size_entry_set_value (GIMP_SIZE_ENTRY (entry), 0, image_width); gimp_size_entry_set_value (GIMP_SIZE_ENTRY (entry), 1, image_height); /* the resolution entry */ hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); entry = gimp_size_entry_new (1, data->image_unit, _("pixels/%a"), FALSE, FALSE, FALSE, SB_WIDTH, GIMP_SIZE_ENTRY_UPDATE_RESOLUTION); gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); gtk_widget_show (entry); info.resolution_entry = GIMP_SIZE_ENTRY (entry); gtk_table_set_row_spacings (GTK_TABLE (entry), 2); gtk_table_set_col_spacing (GTK_TABLE (entry), 0, 6); gtk_table_set_col_spacing (GTK_TABLE (entry), 2, 6); height = gimp_spin_button_new (&adj, 1, 1, 1, 1, 10, 0, 1, 2); gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry), GTK_SPIN_BUTTON (height), NULL); gtk_table_attach_defaults (GTK_TABLE (entry), height, 1, 2, 0, 1); gtk_widget_show (height); gtk_size_group_add_widget (entry_group, height); label = gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry), _("_X resolution:"), 0, 0, 0.0); gtk_size_group_add_widget (label_group, label); label = gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry), _("_Y resolution:"), 1, 0, 0.0); gtk_size_group_add_widget (label_group, label); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (entry), 0, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (entry), 1, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 0, data->xres); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 1, data->yres); chain = gimp_chain_button_new (GIMP_CHAIN_RIGHT); gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain), TRUE); gtk_table_attach (GTK_TABLE (entry), chain, 2, 3, 0, 2, GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (chain); info.chain = GIMP_CHAIN_BUTTON (chain); g_signal_connect (info.resolution_entry, "value-changed", G_CALLBACK (print_size_info_resolution_changed), NULL); g_signal_connect (info.size_entry, "unit-changed", G_CALLBACK (print_size_info_unit_changed), NULL); return frame; }
GtkWidget * offset_dialog_new (GimpDrawable *drawable, GimpContext *context, GtkWidget *parent) { GimpItem *item; OffsetDialog *dialog; GtkWidget *main_vbox; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *button; GtkWidget *spinbutton; GtkWidget *frame; GtkWidget *radio_button; GtkAdjustment *adjustment; gdouble xres; gdouble yres; const gchar *title = NULL; g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); dialog = g_slice_new0 (OffsetDialog); dialog->context = context; dialog->fill_type = gimp_drawable_has_alpha (drawable) | WRAP_AROUND; item = GIMP_ITEM (drawable); dialog->image = gimp_item_get_image (item); gimp_image_get_resolution (dialog->image, &xres, &yres); if (GIMP_IS_LAYER (drawable)) title = _("Offset Layer"); else if (GIMP_IS_LAYER_MASK (drawable)) title = _("Offset Layer Mask"); else if (GIMP_IS_CHANNEL (drawable)) title = _("Offset Channel"); else g_warning ("%s: unexpected drawable type", G_STRFUNC); dialog->dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (drawable), context, _("Offset"), "gimp-drawable-offset", GIMP_STOCK_TOOL_MOVE, title, parent, gimp_standard_help_func, GIMP_HELP_LAYER_OFFSET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, /* offset, used as a verb */ _("_Offset"), GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog->dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE); g_object_weak_ref (G_OBJECT (dialog->dialog), (GWeakNotify) offset_dialog_free, dialog); g_signal_connect (dialog->dialog, "response", G_CALLBACK (offset_response), 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->dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); /* The offset frame */ frame = gimp_frame_new (_("Offset")); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); adjustment = (GtkAdjustment *) gtk_adjustment_new (1, 1, 1, 1, 10, 0); spinbutton = gtk_spin_button_new (adjustment, 1.0, 2); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE); gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10); dialog->off_se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a", TRUE, TRUE, FALSE, 10, GIMP_SIZE_ENTRY_UPDATE_SIZE); gtk_table_set_col_spacing (GTK_TABLE (dialog->off_se), 0, 4); gtk_table_set_col_spacing (GTK_TABLE (dialog->off_se), 1, 4); gtk_table_set_row_spacing (GTK_TABLE (dialog->off_se), 0, 2); gimp_size_entry_add_field (GIMP_SIZE_ENTRY (dialog->off_se), GTK_SPIN_BUTTON (spinbutton), NULL); gtk_table_attach_defaults (GTK_TABLE (dialog->off_se), spinbutton, 1, 2, 0, 1); gtk_widget_show (spinbutton); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (dialog->off_se), _("_X:"), 0, 0, 0.0); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (dialog->off_se), _("_Y:"), 1, 0, 0.0); gtk_box_pack_start (GTK_BOX (vbox), dialog->off_se, FALSE, FALSE, 0); gtk_widget_show (dialog->off_se); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (dialog->off_se), GIMP_UNIT_PIXEL); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (dialog->off_se), 0, xres, FALSE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (dialog->off_se), 1, yres, FALSE); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (dialog->off_se), 0, - gimp_item_get_width (item), gimp_item_get_width (item)); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (dialog->off_se), 1, - gimp_item_get_height (item), gimp_item_get_height (item)); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (dialog->off_se), 0, 0, gimp_item_get_width (item)); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (dialog->off_se), 1, 0, gimp_item_get_height (item)); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dialog->off_se), 0, 0); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dialog->off_se), 1, 0); button = gtk_button_new_with_mnemonic (_("By width/_2, height/2")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (offset_half_xy_callback), dialog); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); button = gtk_button_new_with_mnemonic ("By _width/2"); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (offset_half_x_callback), dialog); button = gtk_button_new_with_mnemonic ("By _height/2"); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (offset_half_y_callback), dialog); /* The edge behavior frame */ frame = gimp_int_radio_group_new (TRUE, _("Edge Behavior"), G_CALLBACK (gimp_radio_button_update), &dialog->fill_type, dialog->fill_type, _("W_rap around"), WRAP_AROUND, NULL, _("Fill with _background color"), GIMP_OFFSET_BACKGROUND, NULL, _("Make _transparent"), GIMP_OFFSET_TRANSPARENT, &radio_button, NULL); if (! gimp_drawable_has_alpha (drawable)) gtk_widget_set_sensitive (radio_button, FALSE); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); return dialog->dialog; }