static void gimp_shear_tool_dialog (GimpTransformTool *tr_tool) { GimpShearTool *shear = GIMP_SHEAR_TOOL (tr_tool); GtkWidget *vbox; GtkWidget *scale; vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (tr_tool->gui)), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); shear->x_adj = (GtkAdjustment *) gtk_adjustment_new (0, -65536, 65536, 1, 10, 0); scale = gimp_spin_scale_new (shear->x_adj, _("Shear magnitude _X"), 0); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), -1000, 1000); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); g_signal_connect (shear->x_adj, "value-changed", G_CALLBACK (shear_x_mag_changed), tr_tool); shear->y_adj = (GtkAdjustment *) gtk_adjustment_new (0, -65536, 65536, 1, 10, 0); scale = gimp_spin_scale_new (shear->y_adj, _("Shear magnitude _Y"), 0); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), -1000, 1000); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); g_signal_connect (shear->y_adj, "value-changed", G_CALLBACK (shear_y_mag_changed), tr_tool); }
static void create_levels_scale (GObject *config, const gchar *property_name, const gchar *left, const gchar *right, GtkWidget *table, gint col) { GtkWidget *label; GtkWidget *scale; label = gtk_label_new (left); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 0, 1, col, col + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show (label); scale = gimp_prop_spin_scale_new (config, property_name, NULL, 0.01, 0.1, 0); gimp_spin_scale_set_label (GIMP_SPIN_SCALE (scale), NULL); gimp_prop_widget_set_factor (scale, 100.0, 0.0, 0.0, 1); gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, col, col + 1); gtk_widget_show (scale); label = gtk_label_new (right); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 2, 3, col, col + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show (label); }
static void gimp_posterize_tool_dialog (GimpImageMapTool *image_map_tool) { GtkWidget *main_vbox; GtkWidget *scale; main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool); scale = gimp_prop_spin_scale_new (image_map_tool->config, "levels", _("Posterize _levels"), 1.0, 10.0, 0); gimp_spin_scale_set_gamma (GIMP_SPIN_SCALE (scale), 1.5); gtk_box_pack_start (GTK_BOX (main_vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); }
GtkWidget * gimp_seamless_clone_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *scale; scale = gimp_prop_spin_scale_new (config, "max-refine-scale", _("Refinement scale"), 1.0, 10.0, 0); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 0.0, 50.0); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); return vbox; }
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 *hbox; GtkWidget *menu; GtkWidget *label; GtkWidget *scale; GType tool_type; tool_type = tool_options->tool_info->tool_type; /* the paint mode menu */ 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 (_("Mode:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); menu = gimp_prop_paint_mode_menu_new (config, "paint-mode", TRUE, FALSE); gtk_box_pack_start (GTK_BOX (hbox), menu, TRUE, TRUE, 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_SMUDGE_TOOL) { gtk_widget_set_sensitive (menu, FALSE); gtk_widget_set_sensitive (label, FALSE); } /* the opacity scale */ scale = gimp_prop_opacity_spin_scale_new (config, "opacity", _("Opacity")); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* 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"), 0.01, 1.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_stock_button_new (GIMP_STOCK_RESET, NULL); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_image_set_from_stock (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.01, 0.1, 2); gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0); gtk_widget_show (scale); button = gimp_stock_button_new (GIMP_STOCK_RESET, NULL); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_image_set_from_stock (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_stock_button_new (GIMP_STOCK_RESET, NULL); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_image_set_from_stock (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 *label; 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 */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (inner_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Repeat:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); combo = gimp_prop_enum_combo_box_new (config, "fade-repeat", 0, 0); gtk_box_pack_start (GTK_BOX (hbox), 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_warp_options_gui (GimpToolOptions *tool_options) { GimpWarpOptions *options = GIMP_WARP_OPTIONS (tool_options); GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *frame; GtkWidget *anim_vbox; GtkWidget *combo; GtkWidget *scale; combo = gimp_prop_enum_combo_box_new (config, "behavior", 0, 0); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); gtk_widget_show (combo); scale = gimp_prop_spin_scale_new (config, "effect-strength", _("Strength"), 1, 10, 1); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 100.0); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); scale = gimp_prop_spin_scale_new (config, "effect-size", _("Size"), 0.01, 1.0, 2); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 1000.0); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); scale = gimp_prop_spin_scale_new (config, "effect-hardness", _("Hardness"), 0.01, 1.0, 2); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 0.0, 1.0); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* the animation frame */ frame = gimp_frame_new (_("Animate")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); anim_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_container_add (GTK_CONTAINER (frame), anim_vbox); gtk_widget_show (anim_vbox); scale = gimp_prop_spin_scale_new (config, "n-animation-frames", _("Frames"), 1.0, 10.0, 0); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 3.0, 100.0); gtk_box_pack_start (GTK_BOX (anim_vbox), scale, FALSE, FALSE, 0); gtk_widget_show (scale); options->animate_button = gtk_button_new_with_label (_("Create Animation")); gtk_widget_set_sensitive (options->animate_button, FALSE); gtk_box_pack_start (GTK_BOX (anim_vbox), options->animate_button, FALSE, FALSE, 0); gtk_widget_show (options->animate_button); g_object_add_weak_pointer (G_OBJECT (options->animate_button), (gpointer) &options->animate_button); return vbox; }
static void gimp_brush_editor_init (GimpBrushEditor *editor) { GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor); GtkWidget *frame; GtkWidget *hbox; GtkWidget *label; GtkWidget *box; GtkWidget *scale; frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (editor), frame, TRUE, TRUE, 0); gtk_widget_show (frame); data_editor->view = gimp_view_new_full_by_types (NULL, GIMP_TYPE_VIEW, GIMP_TYPE_BRUSH, BRUSH_VIEW_SIZE, BRUSH_VIEW_SIZE, 0, FALSE, FALSE, TRUE); gtk_widget_set_size_request (data_editor->view, -1, BRUSH_VIEW_SIZE); gimp_view_set_expand (GIMP_VIEW (data_editor->view), TRUE); gtk_container_add (GTK_CONTAINER (frame), data_editor->view); gtk_widget_show (data_editor->view); editor->shape_group = NULL; editor->options_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_box_pack_start (GTK_BOX (editor), editor->options_box, FALSE, FALSE, 0); gtk_widget_show (editor->options_box); /* Stock Box for the brush shape */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (editor->options_box), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Shape:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); box = gimp_enum_stock_box_new (GIMP_TYPE_BRUSH_GENERATED_SHAPE, "gimp-shape", GTK_ICON_SIZE_MENU, G_CALLBACK (gimp_brush_editor_update_shape), editor, &editor->shape_group); gtk_box_pack_start (GTK_BOX (hbox), box, FALSE, FALSE, 0); gtk_widget_show (box); /* brush radius scale */ editor->radius_data = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.1, 1000.0, 0.1, 1.0, 0.0)); scale = gimp_spin_scale_new (editor->radius_data, _("Radius"), 1); gtk_box_pack_start (GTK_BOX (editor->options_box), scale, FALSE, FALSE, 0); gtk_widget_show (scale); g_signal_connect (editor->radius_data, "value-changed", G_CALLBACK (gimp_brush_editor_update_brush), editor); /* number of spikes */ editor->spikes_data = GTK_ADJUSTMENT (gtk_adjustment_new (2.0, 2.0, 20.0, 1.0, 1.0, 0.0)); scale = gimp_spin_scale_new (editor->spikes_data, _("Spikes"), 0); gtk_box_pack_start (GTK_BOX (editor->options_box), scale, FALSE, FALSE, 0); gtk_widget_show (scale); g_signal_connect (editor->spikes_data, "value-changed", G_CALLBACK (gimp_brush_editor_update_brush), editor); /* brush hardness scale */ editor->hardness_data = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.1, 0.0)); scale = gimp_spin_scale_new (editor->hardness_data, _("Hardness"), 2); gtk_box_pack_start (GTK_BOX (editor->options_box), scale, FALSE, FALSE, 0); gtk_widget_show (scale); g_signal_connect (editor->hardness_data, "value-changed", G_CALLBACK (gimp_brush_editor_update_brush), editor); /* brush aspect ratio scale */ editor->aspect_ratio_data = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 1.0, 20.0, 0.1, 1.0, 0.0)); scale = gimp_spin_scale_new (editor->aspect_ratio_data, _("Aspect ratio"), 1); gtk_box_pack_start (GTK_BOX (editor->options_box), scale, FALSE, FALSE, 0); gtk_widget_show (scale); g_signal_connect (editor->aspect_ratio_data,"value-changed", G_CALLBACK (gimp_brush_editor_update_brush), editor); /* brush angle scale */ editor->angle_data = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 180.0, 0.1, 1.0, 0.0)); scale = gimp_spin_scale_new (editor->angle_data, _("Angle"), 1); gtk_box_pack_start (GTK_BOX (editor->options_box), scale, FALSE, FALSE, 0); gtk_widget_show (scale); g_signal_connect (editor->angle_data, "value-changed", G_CALLBACK (gimp_brush_editor_update_brush), editor); /* brush spacing */ editor->spacing_data = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 1.0, 5000.0, 1.0, 10.0, 0.0)); scale = gimp_spin_scale_new (editor->spacing_data, _("Spacing"), 1); gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 200.0); gtk_box_pack_start (GTK_BOX (editor->options_box), scale, FALSE, FALSE, 0); gtk_widget_show (scale); gimp_help_set_help_data (scale, _("Percentage of width of brush"), NULL); g_signal_connect (editor->spacing_data, "value-changed", G_CALLBACK (gimp_brush_editor_update_brush), editor); }
/** * 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; }
GtkWidget * gimp_foreground_select_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_selection_options_gui (tool_options); GtkWidget *hbox; GtkWidget *button; GtkWidget *frame; GtkWidget *scale; GtkWidget *combo; GtkWidget *table; gchar *title; gint row = 0; GimpForegroundSelectOptions *options = GIMP_FOREGROUND_SELECT_OPTIONS (config); frame = gimp_prop_enum_radio_frame_new (config, "draw-mode", title, 0,0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); /* stroke width */ scale = gimp_prop_spin_scale_new (config, "stroke-width", _("Stroke width"), 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_stock_button_new (GIMP_STOCK_RESET, NULL); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_image_set_from_stock (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_foreground_select_options_gui_reset_stroke_width), tool_options); gimp_help_set_help_data (button, _("Reset stroke width native size"), NULL); /* mask color */ frame = gimp_frame_new (_("Preview color:")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); combo = gimp_prop_enum_combo_box_new (config, "mask-color", GIMP_RED_CHANNEL, GIMP_GRAY_CHANNEL); gtk_container_add (GTK_CONTAINER (frame), combo); gtk_widget_show (combo); /* engine */ frame = gimp_frame_new (_("Engine:")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); combo = gimp_prop_enum_combo_box_new (config, "engine", 0, 0); gtk_container_add (GTK_CONTAINER (frame), combo); gtk_widget_show (combo); /* parameters */ table = gtk_table_new (3, 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 (vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); options->dynamic_widgets.levels = gimp_prop_scale_entry_new (config, "levels", GTK_TABLE (table), 0, row++, "Levels", 1, 1, 0, FALSE, 0, 0); options->dynamic_widgets.active_levels = gimp_prop_scale_entry_new (config, "active-levels", GTK_TABLE (table), 0, row++, "Act. Levels", 1, 1, 0, FALSE, 0, 0); options->dynamic_widgets.iterations = gimp_prop_scale_entry_new (config, "iterations", GTK_TABLE (table), 0, row++, "Iterations", 1, 1, 0, FALSE, 0, 0); g_signal_connect_object (config, "notify::engine", G_CALLBACK (gimp_foreground_select_notify_engine), NULL, 0); gimp_foreground_select_notify_engine(tool_options,NULL,NULL); return vbox; }