GtkWidget * stroke_dialog_new (GimpItem *item, GimpContext *context, const gchar *title, const gchar *stock_id, const gchar *help_id, GtkWidget *parent) { GimpStrokeOptions *options; GimpStrokeOptions *saved_options; GimpImage *image; GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *radio_box; GtkWidget *cairo_radio; GtkWidget *paint_radio; GSList *group; GtkWidget *frame; g_return_val_if_fail (GIMP_IS_ITEM (item), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (stock_id != NULL, NULL); g_return_val_if_fail (help_id != NULL, NULL); g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL); image = gimp_item_get_image (item); options = gimp_stroke_options_new (context->gimp, context, TRUE); saved_options = g_object_get_data (G_OBJECT (context->gimp), "saved-stroke-options"); if (saved_options) gimp_config_sync (G_OBJECT (saved_options), G_OBJECT (options), 0); dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (item), context, title, "gimp-stroke-options", stock_id, _("Choose Stroke Style"), parent, gimp_standard_help_func, help_id, GIMP_STOCK_RESET, RESPONSE_RESET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, stock_id, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), RESPONSE_RESET, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); g_signal_connect (dialog, "response", G_CALLBACK (stroke_dialog_response), dialog); g_object_set_data (G_OBJECT (dialog), "gimp-item", item); g_object_set_data_full (G_OBJECT (dialog), "gimp-stroke-options", options, (GDestroyNotify) g_object_unref); 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); radio_box = gimp_prop_enum_radio_box_new (G_OBJECT (options), "method", -1, -1); group = gtk_radio_button_get_group (g_object_get_data (G_OBJECT (radio_box), "radio-button")); cairo_radio = g_object_ref (group->next->data); gtk_container_remove (GTK_CONTAINER (radio_box), cairo_radio); paint_radio = g_object_ref (group->data); gtk_container_remove (GTK_CONTAINER (radio_box), paint_radio); g_object_ref_sink (radio_box); g_object_unref (radio_box); { PangoFontDescription *font_desc; font_desc = pango_font_description_new (); pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD); gtk_widget_modify_font (gtk_bin_get_child (GTK_BIN (cairo_radio)), font_desc); gtk_widget_modify_font (gtk_bin_get_child (GTK_BIN (paint_radio)), font_desc); pango_font_description_free (font_desc); } /* the stroke frame */ frame = gimp_frame_new (NULL); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); gtk_frame_set_label_widget (GTK_FRAME (frame), cairo_radio); g_object_unref (cairo_radio); { GtkWidget *stroke_editor; gdouble xres; gdouble yres; gimp_image_get_resolution (image, &xres, &yres); stroke_editor = gimp_stroke_editor_new (options, yres, FALSE); gtk_container_add (GTK_CONTAINER (frame), stroke_editor); gtk_widget_show (stroke_editor); g_object_bind_property (cairo_radio, "active", stroke_editor, "sensitive", G_BINDING_SYNC_CREATE); } /* the paint tool frame */ frame = gimp_frame_new (NULL); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); gtk_frame_set_label_widget (GTK_FRAME (frame), paint_radio); g_object_unref (paint_radio); { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *label; GtkWidget *combo; GtkWidget *button; vbox = gtk_vbox_new (FALSE, 6); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); g_object_bind_property (paint_radio, "active", vbox, "sensitive", G_BINDING_SYNC_CREATE); hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Paint tool:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); combo = gimp_container_combo_box_new (image->gimp->paint_info_list, GIMP_CONTEXT (options), 16, 0); gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0); gtk_widget_show (combo); g_object_set_data (G_OBJECT (dialog), "gimp-tool-menu", combo); button = gimp_prop_check_button_new (G_OBJECT (options), "emulate-brush-dynamics", _("_Emulate brush dynamics")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); } return dialog; }
GtkWidget * gimp_blend_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_paint_options_gui (tool_options); GtkWidget *vbox2; GtkWidget *frame; GtkWidget *scale; GtkWidget *combo; GtkWidget *button; /* the gradient */ button = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (tool_options), _("Gradient"), 2, "gradient-view-type", "gradient-view-size", "gradient-reverse", "gimp-gradient-editor"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); /* the gradient type menu */ combo = gimp_prop_enum_combo_box_new (config, "gradient-type", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Shape")); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (combo), "gimp-gradient"); gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); gtk_widget_show (combo); /* the repeat option */ combo = gimp_prop_enum_combo_box_new (config, "gradient-repeat", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Repeat")); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); gtk_widget_show (combo); g_signal_connect (config, "notify::gradient-type", G_CALLBACK (blend_options_gradient_type_notify), combo); /* the offset scale */ scale = gimp_prop_spin_scale_new (config, "offset", _("Offset"), 1.0, 10.0, 1); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* the dither toggle */ button = gimp_prop_check_button_new (config, "dither", _("Dithering")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); /* supersampling options */ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); frame = gimp_prop_expanding_frame_new (config, "supersample", _("Adaptive supersampling"), vbox2, NULL); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* max depth scale */ scale = gimp_prop_spin_scale_new (config, "supersample-depth", _("Max depth"), 1.0, 1.0, 0); gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* threshold scale */ scale = gimp_prop_spin_scale_new (config, "supersample-threshold", _("Threshold"), 0.01, 0.1, 2); gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0); gtk_widget_show (scale); return vbox; }
/** * gimp_transform_options_gui: * @tool_options: a #GimpToolOptions * * Build the Transform Tool Options. * * Return value: a container holding the transform tool options **/ GtkWidget * gimp_transform_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *hbox; GtkWidget *box; GtkWidget *label; GtkWidget *frame; GtkWidget *combo; GtkWidget *scale; GtkWidget *grid_box; const gchar *constrain_name = NULL; const gchar *constrain_label = NULL; const gchar *constrain_tip = NULL; hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Transform:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); box = gimp_prop_enum_icon_box_new (config, "type", "gimp", 0, 0); gtk_box_pack_start (GTK_BOX (hbox), box, FALSE, FALSE, 0); gtk_widget_show (box); frame = gimp_prop_enum_radio_frame_new (config, "direction", _("Direction"), 0, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the interpolation menu */ combo = gimp_prop_enum_combo_box_new (config, "interpolation", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Interpolation")); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); gtk_widget_show (combo); /* the clipping menu */ combo = gimp_prop_enum_combo_box_new (config, "clip", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Clipping")); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); gtk_widget_show (combo); /* the preview frame */ scale = gimp_prop_spin_scale_new (config, "preview-opacity", _("Image opacity"), 0.01, 0.1, 0); gimp_prop_widget_set_factor (scale, 100.0, 0.0, 0.0, 1); frame = gimp_prop_expanding_frame_new (config, "show-preview", _("Show image preview"), scale, NULL); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the guides frame */ frame = gimp_frame_new (NULL); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the guides type menu */ combo = gimp_prop_enum_combo_box_new (config, "grid-type", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Guides")); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_frame_set_label_widget (GTK_FRAME (frame), combo); gtk_widget_show (combo); /* the grid density scale */ scale = gimp_prop_spin_scale_new (config, "grid-size", NULL, 1.8, 8.0, 0); gimp_spin_scale_set_label (GIMP_SPIN_SCALE (scale), NULL); gtk_container_add (GTK_CONTAINER (frame), scale); g_object_bind_property_full (config, "grid-type", scale, "visible", G_BINDING_SYNC_CREATE, gimp_transform_options_sync_grid, NULL, NULL, NULL); if (tool_options->tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL) { constrain_name = "constrain-rotate"; constrain_label = _("15 degrees (%s)"); constrain_tip = _("Limit rotation steps to 15 degrees"); } else if (tool_options->tool_info->tool_type == GIMP_TYPE_SCALE_TOOL) { constrain_name = "constrain-scale"; constrain_label = _("Keep aspect (%s)"); constrain_tip = _("Keep the original aspect ratio"); } //TODO: check that the selection tools use the gimp_get_*_mask() functions for constrain/etc or change to what they use else if (tool_options->tool_info->tool_type == GIMP_TYPE_UNIFIED_TRANSFORM_TOOL) { GdkModifierType shift = gimp_get_extend_selection_mask (); GdkModifierType ctrl = gimp_get_constrain_behavior_mask (); struct { GdkModifierType mod; gchar *name; gchar *desc; gchar *tip; } opt_list[] = { { shift, NULL, "Constrain (%s)" }, { shift, "constrain-move", "Move", "Constrain movement to 45 degree angles from center (%s)" }, { shift, "constrain-scale", "Scale", "Maintain aspect ratio when scaling (%s)" }, { shift, "constrain-rotate", "Rotate", "Constrain rotation to 15 degree increments (%s)" }, { shift, "constrain-shear", "Shear", "Shear along edge direction only (%s)" }, { shift, "constrain-perspective", "Perspective", "Constrain perspective handles to move along edges and diagonal (%s)" }, { ctrl, NULL, "From pivot (%s)" }, { ctrl, "frompivot-scale", "Scale", "Scale from pivot point (%s)" }, { ctrl, "frompivot-shear", "Shear", "Shear opposite edge by same amount (%s)" }, { ctrl, "frompivot-perspective", "Perspective", "Maintain position of pivot while changing perspective (%s)" }, { 0, NULL, "Pivot" }, { shift, "cornersnap", "Snap (%s)", "Snap pivot to corners and center (%s)" }, { 0, "fixedpivot", "Lock", "Lock pivot position to canvas" }, }; GtkWidget *button; gchar *label; gint i; frame = NULL; for (i = 0; i < G_N_ELEMENTS (opt_list); i++) { if (!opt_list[i].name && !opt_list[i].desc) { frame = NULL; continue; } label = g_strdup_printf (opt_list[i].desc, gimp_get_mod_string (opt_list[i].mod)); if (opt_list[i].name) { button = gimp_prop_check_button_new (config, opt_list[i].name, label); gtk_box_pack_start (GTK_BOX (frame ? grid_box : vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_free (label); label = g_strdup_printf (opt_list[i].tip, gimp_get_mod_string (opt_list[i].mod)); gimp_help_set_help_data (button, label, NULL); } else { frame = gimp_frame_new (label); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); grid_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_container_add (GTK_CONTAINER (frame), grid_box); gtk_widget_show (grid_box); } g_free (label); } } if (constrain_label) { GtkWidget *button; gchar *label; GdkModifierType constrain_mask; constrain_mask = gimp_get_extend_selection_mask (); label = g_strdup_printf (constrain_label, gimp_get_mod_string (constrain_mask)); button = gimp_prop_check_button_new (config, constrain_name, label); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); gimp_help_set_help_data (button, constrain_tip, NULL); g_free (label); } return vbox; }
static gboolean gimp_image_map_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool); GimpToolInfo *tool_info = tool->tool_info; GimpImage *image = gimp_display_get_image (display); GimpDrawable *drawable = gimp_image_get_active_drawable (image); GimpDisplayShell *shell = gimp_display_get_shell (display); if (! drawable) return FALSE; if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable))) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("Cannot modify the pixels of layer groups.")); return FALSE; } if (gimp_item_is_content_locked (GIMP_ITEM (drawable))) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("The active layer's pixels are locked.")); return FALSE; } if (! gimp_item_is_visible (GIMP_ITEM (drawable))) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("The active layer is not visible.")); return FALSE; } if (im_tool->active_picker) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (im_tool->active_picker), FALSE); /* set display so the dialog can be hidden on display destruction */ tool->display = display; if (im_tool->config) gimp_config_reset (GIMP_CONFIG (im_tool->config)); if (! im_tool->gui) { GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (im_tool); GtkWidget *vbox; GtkWidget *hbox; GtkWidget *toggle; gchar *operation_name; /* disabled for at least GIMP 2.8 */ im_tool->overlay = FALSE; im_tool->gui = gimp_tool_gui_new (tool_info, im_tool->title, im_tool->description, im_tool->icon_name, im_tool->help_id, gtk_widget_get_screen (GTK_WIDGET (shell)), gimp_widget_get_monitor (GTK_WIDGET (shell)), im_tool->overlay, GIMP_STOCK_RESET, RESPONSE_RESET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gimp_tool_gui_set_default_response (im_tool->gui, GTK_RESPONSE_OK); gimp_tool_gui_set_alternative_button_order (im_tool->gui, RESPONSE_RESET, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); vbox = gimp_tool_gui_get_vbox (im_tool->gui); g_signal_connect_object (im_tool->gui, "response", G_CALLBACK (gimp_image_map_tool_response), G_OBJECT (im_tool), 0); if (im_tool->config && klass->settings_name) { GType type = G_TYPE_FROM_INSTANCE (im_tool->config); GimpContainer *settings; GFile *settings_file; GFile *default_folder; GtkWidget *settings_ui; settings = gimp_gegl_config_get_container (type); if (! gimp_list_get_sort_func (GIMP_LIST (settings))) gimp_list_set_sort_func (GIMP_LIST (settings), (GCompareFunc) gimp_settings_compare); settings_file = gimp_tool_info_get_options_file (tool_info, ".settings"); default_folder = gimp_directory_file (klass->settings_name, NULL); settings_ui = klass->get_settings_ui (im_tool, settings, settings_file, klass->import_dialog_title, klass->export_dialog_title, im_tool->help_id, default_folder, &im_tool->settings_box); g_object_unref (default_folder); g_object_unref (settings_file); gtk_box_pack_start (GTK_BOX (vbox), settings_ui, FALSE, FALSE, 0); gtk_widget_show (settings_ui); } /* The gamma hack toggle */ toggle = gtk_check_button_new_with_label ("Gamma hack (temp hack, please ignore)"); gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gamma_hack), im_tool); /* The preview and split view toggles */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options), "preview", NULL); gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0); gtk_widget_show (toggle); toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options), "preview-split", NULL); gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0); gtk_widget_show (toggle); g_object_bind_property (G_OBJECT (tool_info->tool_options), "preview", toggle, "sensitive", G_BINDING_SYNC_CREATE); /* The area combo */ gegl_node_get (im_tool->operation, "operation", &operation_name, NULL); im_tool->region_combo = gimp_prop_enum_combo_box_new (G_OBJECT (tool_info->tool_options), "region", 0, 0); gtk_box_pack_end (GTK_BOX (vbox), im_tool->region_combo, FALSE, FALSE, 0); if (operation_name && gegl_operation_get_key (operation_name, "position-dependent")) { gtk_widget_show (im_tool->region_combo); } g_free (operation_name); /* Fill in subclass widgets */ gimp_image_map_tool_dialog (im_tool); } else { gimp_tool_gui_set_title (im_tool->gui, im_tool->title); gimp_tool_gui_set_description (im_tool->gui, im_tool->description); gimp_tool_gui_set_icon_name (im_tool->gui, im_tool->icon_name); gimp_tool_gui_set_help_id (im_tool->gui, im_tool->help_id); } gimp_tool_gui_set_shell (im_tool->gui, shell); gimp_tool_gui_set_viewable (im_tool->gui, GIMP_VIEWABLE (drawable)); gimp_tool_gui_show (im_tool->gui); im_tool->drawable = drawable; gimp_image_map_tool_create_map (im_tool); gimp_image_map_tool_preview (im_tool); return TRUE; }
GtkWidget * gimp_paint_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GimpPaintOptions *options = GIMP_PAINT_OPTIONS (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *menu; GtkWidget *scale; GType tool_type; tool_type = tool_options->tool_info->tool_type; /* the paint mode menu */ menu = gimp_prop_paint_mode_menu_new (config, "paint-mode", TRUE, FALSE); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (menu), _("Mode")); g_object_set (menu, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_box_pack_start (GTK_BOX (vbox), menu, FALSE, FALSE, 0); gtk_widget_show (menu); if (tool_type == GIMP_TYPE_ERASER_TOOL || tool_type == GIMP_TYPE_CONVOLVE_TOOL || tool_type == GIMP_TYPE_DODGE_BURN_TOOL || tool_type == GIMP_TYPE_HEAL_TOOL || tool_type == GIMP_TYPE_SMUDGE_TOOL) { gtk_widget_set_sensitive (menu, FALSE); } /* the opacity scale */ scale = gimp_prop_spin_scale_new (config, "opacity", _("Opacity"), 0.01, 0.1, 0); gimp_prop_widget_set_factor (scale, 100.0, 0.0, 0.0, 1); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* temp debug foo */ if (g_type_is_a (tool_type, GIMP_TYPE_PAINT_TOOL)) { GtkWidget *button; button = gimp_prop_check_button_new (config, "use-applicator", "Use GimpApplicator"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); } /* the brush */ if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL)) { GtkWidget *button; GtkWidget *hbox; GtkWidget *frame; button = gimp_prop_brush_box_new (NULL, GIMP_CONTEXT (tool_options), _("Brush"), 2, "brush-view-type", "brush-view-size", "gimp-brush-editor"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); scale = gimp_prop_spin_scale_new (config, "brush-size", _("Size"), 1.0, 10.0, 2); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 1000.0); gimp_spin_scale_set_gamma (GIMP_SPIN_SCALE (scale), 1.7); gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0); gtk_widget_show (scale); button = gimp_icon_button_new (GIMP_STOCK_RESET, NULL); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_image_set_from_icon_name (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))), GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (gimp_paint_options_gui_reset_size), options); gimp_help_set_help_data (button, _("Reset size to brush's native size"), NULL); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); scale = gimp_prop_spin_scale_new (config, "brush-aspect-ratio", _("Aspect Ratio"), 0.1, 1.0, 2); gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0); gtk_widget_show (scale); button = gimp_icon_button_new (GIMP_STOCK_RESET, NULL); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_image_set_from_icon_name (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))), GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (gimp_paint_options_gui_reset_aspect_ratio), options); gimp_help_set_help_data (button, _("Reset aspect ratio to brush's native"), NULL); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); scale = gimp_prop_spin_scale_new (config, "brush-angle", _("Angle"), 1.0, 5.0, 2); gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0); gtk_widget_show (scale); button = gimp_icon_button_new (GIMP_STOCK_RESET, NULL); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_image_set_from_icon_name (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))), GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (gimp_paint_options_gui_reset_angle), options); gimp_help_set_help_data (button, _("Reset angle to zero"), NULL); button = gimp_prop_dynamics_box_new (NULL, GIMP_CONTEXT (tool_options), _("Dynamics"), 2, "dynamics-view-type", "dynamics-view-size", "gimp-dynamics-editor"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); frame = dynamics_options_gui (options, tool_type); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); frame = jitter_options_gui (options, tool_type); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); } /* the "smooth stroke" options */ if (g_type_is_a (tool_type, GIMP_TYPE_PAINT_TOOL)) { GtkWidget *frame; frame = smoothing_options_gui (options, tool_type); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); } /* the "incremental" toggle */ if (tool_type == GIMP_TYPE_PENCIL_TOOL || tool_type == GIMP_TYPE_PAINTBRUSH_TOOL || tool_type == GIMP_TYPE_ERASER_TOOL) { GtkWidget *button; button = gimp_prop_enum_check_button_new (config, "application-mode", _("Incremental"), GIMP_PAINT_CONSTANT, GIMP_PAINT_INCREMENTAL); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); } /* the "hard edge" toggle */ if (tool_type == GIMP_TYPE_ERASER_TOOL || tool_type == GIMP_TYPE_CLONE_TOOL || tool_type == GIMP_TYPE_HEAL_TOOL || tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL || tool_type == GIMP_TYPE_CONVOLVE_TOOL || tool_type == GIMP_TYPE_DODGE_BURN_TOOL || tool_type == GIMP_TYPE_SMUDGE_TOOL) { GtkWidget *button; button = gimp_prop_check_button_new (config, "hard", _("Hard edge")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); } return vbox; }
static GtkWidget * dynamics_options_gui (GimpPaintOptions *paint_options, GType tool_type) { GObject *config = G_OBJECT (paint_options); GtkWidget *frame; GtkWidget *inner_frame; GtkWidget *scale; GtkWidget *menu; GtkWidget *combo; GtkWidget *checkbox; GtkWidget *vbox; GtkWidget *inner_vbox; GtkWidget *hbox; GtkWidget *box; frame = gimp_prop_expander_new (config, "dynamics-expanded", _("Dynamics Options")); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); inner_frame = gimp_frame_new (_("Fade Options")); gtk_box_pack_start (GTK_BOX (vbox), inner_frame, FALSE, FALSE, 0); gtk_widget_show (inner_frame); inner_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_container_add (GTK_CONTAINER (inner_frame), inner_vbox); gtk_widget_show (inner_vbox); /* the fade-out scale & unitmenu */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (inner_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); scale = gimp_prop_spin_scale_new (config, "fade-length", _("Fade length"), 1.0, 50.0, 0); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 1000.0); gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0); gtk_widget_show (scale); menu = gimp_prop_unit_combo_box_new (config, "fade-unit"); gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0); gtk_widget_show (menu); #if 0 /* FIXME pixel digits */ g_object_set_data (G_OBJECT (menu), "set_digits", spinbutton); gimp_unit_menu_set_pixel_digits (GIMP_UNIT_MENU (menu), 0); #endif /* the repeat type */ combo = gimp_prop_enum_combo_box_new (config, "fade-repeat", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Repeat")); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_box_pack_start (GTK_BOX (inner_vbox), combo, TRUE, TRUE, 0); gtk_widget_show (combo); checkbox = gimp_prop_check_button_new (config, "fade-reverse", _("Reverse")); gtk_box_pack_start (GTK_BOX (inner_vbox), checkbox, FALSE, FALSE, 0); gtk_widget_show (checkbox); /* Color UI */ if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL)) { inner_frame = gimp_frame_new (_("Color Options")); gtk_box_pack_start (GTK_BOX (vbox), inner_frame, FALSE, FALSE, 0); gtk_widget_show (inner_frame); box = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (config), _("Gradient"), 2, "gradient-view-type", "gradient-view-size", "gradient-reverse", "gimp-gradient-editor"); gtk_container_add (GTK_CONTAINER (inner_frame), box); gtk_widget_show (box); } return frame; }
GtkWidget * gimp_text_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GimpTextOptions *options = GIMP_TEXT_OPTIONS (tool_options); GtkWidget *main_vbox = gimp_tool_options_gui (tool_options); GtkWidget *table; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *button; GtkWidget *entry; GtkWidget *box; GtkWidget *spinbutton; GtkWidget *combo; GtkSizeGroup *size_group; gint row = 0; hbox = gimp_prop_font_box_new (NULL, GIMP_CONTEXT (tool_options), _("Font"), 2, "font-view-type", "font-view-size"); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); table = gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 2); gtk_table_set_row_spacings (GTK_TABLE (table), 2); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); entry = gimp_prop_size_entry_new (config, "font-size", FALSE, "font-size-unit", "%p", GIMP_SIZE_ENTRY_UPDATE_SIZE, 72.0); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Size:"), 0.0, 0.5, entry, 2, FALSE); options->size_entry = entry; vbox = gtk_vbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); button = gimp_prop_check_button_new (config, "use-editor", _("Use editor")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); button = gimp_prop_check_button_new (config, "antialias", _("Antialiasing")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); table = gtk_table_new (6, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 2); gtk_table_set_row_spacings (GTK_TABLE (table), 2); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); row = 0; size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); button = gimp_prop_enum_combo_box_new (config, "hint-style", -1, -1); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Hinting:"), 0.0, 0.5, button, 1, TRUE); gtk_size_group_add_widget (size_group, button); button = gimp_prop_color_button_new (config, "foreground", _("Text Color"), 40, 24, GIMP_COLOR_AREA_FLAT); gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), GIMP_CONTEXT (options)); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Color:"), 0.0, 0.5, button, 1, TRUE); gtk_size_group_add_widget (size_group, button); box = gimp_prop_enum_stock_box_new (config, "justify", "gtk-justify", 0, 0); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Justify:"), 0.0, 0.5, box, 2, TRUE); gtk_size_group_add_widget (size_group, box); g_object_unref (size_group); spinbutton = gimp_prop_spin_button_new (config, "indent", 1.0, 10.0, 1); gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5); gimp_table_attach_stock (GTK_TABLE (table), row++, GTK_STOCK_INDENT, spinbutton, 1, TRUE); spinbutton = gimp_prop_spin_button_new (config, "line-spacing", 1.0, 10.0, 1); gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5); gimp_table_attach_stock (GTK_TABLE (table), row++, GIMP_STOCK_LINE_SPACING, spinbutton, 1, TRUE); spinbutton = gimp_prop_spin_button_new (config, "letter-spacing", 1.0, 10.0, 1); gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5); gimp_table_attach_stock (GTK_TABLE (table), row++, GIMP_STOCK_LETTER_SPACING, spinbutton, 1, TRUE); combo = gimp_prop_enum_combo_box_new (config, "box-mode", 0, 0); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Box:"), 0.0, 0.5, combo, 1, TRUE); /* Only add the language entry if the iso-codes package is available. */ #ifdef HAVE_ISO_CODES { GtkWidget *label; vbox = gtk_vbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Language:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); entry = gimp_prop_language_entry_new (config, "language"); gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0); gtk_widget_show (entry); } #endif return main_vbox; }