static void gimp_color_balance_tool_reset (GimpImageMapTool *im_tool) { GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool); GimpTransferMode range = cb_tool->config->range; g_object_freeze_notify (im_tool->config); if (im_tool->default_config) { gimp_config_copy (GIMP_CONFIG (im_tool->default_config), GIMP_CONFIG (im_tool->config), 0); } else { gimp_config_reset (GIMP_CONFIG (im_tool->config)); } g_object_set (cb_tool->config, "range", range, NULL); g_object_thaw_notify (im_tool->config); }
static gboolean gimp_colorize_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (tool); GimpDrawable *drawable = gimp_image_get_active_drawable (display->image); if (! drawable) return FALSE; if (! gimp_drawable_is_rgb (drawable)) { g_set_error (error, 0, 0, _("Colorize operates only on RGB color layers.")); return FALSE; } gimp_config_reset (GIMP_CONFIG (col_tool->config)); GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error); gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool)); return TRUE; }
static gboolean gimp_posterize_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpPosterizeTool *posterize_tool = GIMP_POSTERIZE_TOOL (tool); GimpImage *image = gimp_display_get_image (display); GimpDrawable *drawable; drawable = gimp_image_get_active_drawable (image); if (! drawable) return FALSE; if (gimp_drawable_is_indexed (drawable)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("Posterize does not operate on indexed layers.")); return FALSE; } gimp_config_reset (GIMP_CONFIG (posterize_tool->config)); if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error)) { return FALSE; } gtk_adjustment_set_value (posterize_tool->levels_data, posterize_tool->config->levels); gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (posterize_tool)); return TRUE; }
void gimp_curves_config_reset_channel (GimpCurvesConfig *config) { g_return_if_fail (GIMP_IS_CURVES_CONFIG (config)); gimp_config_reset (GIMP_CONFIG (config->curve[config->channel])); }
static gboolean gimp_desaturate_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (tool); GimpDrawable *drawable; drawable = gimp_image_get_active_drawable (display->image); if (! drawable) return FALSE; if (! gimp_drawable_is_rgb (drawable)) { g_set_error (error, 0, 0, _("Desaturate does only operate on RGB layers.")); return FALSE; } gimp_config_reset (GIMP_CONFIG (desaturate_tool->config)); GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error); gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (desaturate_tool->button), desaturate_tool->config->mode); gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (desaturate_tool)); return TRUE; }
static void gimp_hue_saturation_tool_reset (GimpImageMapTool *image_map_tool) { GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool); GimpHueRange range = hs_tool->config->range; g_object_freeze_notify (image_map_tool->config); if (image_map_tool->default_config) { gimp_config_copy (GIMP_CONFIG (image_map_tool->default_config), GIMP_CONFIG (image_map_tool->config), 0); } else { gimp_config_reset (GIMP_CONFIG (image_map_tool->config)); } g_object_set (hs_tool->config, "range", range, NULL); g_object_thaw_notify (image_map_tool->config); }
static gboolean gimp_threshold_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (tool); GimpImage *image = gimp_display_get_image (display); GimpDrawable *drawable = gimp_image_get_active_drawable (image); if (! drawable) return FALSE; gimp_config_reset (GIMP_CONFIG (t_tool->config)); if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error)) { return FALSE; } gimp_drawable_calculate_histogram (drawable, t_tool->histogram); gimp_histogram_view_set_histogram (t_tool->histogram_box->view, t_tool->histogram); gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (t_tool)); return TRUE; }
static void gimp_levels_tool_reset (GimpImageMapTool *image_map_tool) { GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool); GimpHistogramChannel channel = tool->config->channel; g_object_freeze_notify (image_map_tool->config); if (image_map_tool->default_config) { gimp_config_copy (GIMP_CONFIG (image_map_tool->default_config), GIMP_CONFIG (image_map_tool->config), 0); } else { gimp_config_reset (GIMP_CONFIG (image_map_tool->config)); } g_object_set (tool->config, "channel", channel, NULL); g_object_thaw_notify (image_map_tool->config); }
static void gimp_operation_tool_reset (GimpImageMapTool *image_map_tool) { GimpOperationTool *tool = GIMP_OPERATION_TOOL (image_map_tool); if (tool->config) gimp_config_reset (GIMP_CONFIG (tool->config)); }
static void gimp_gegl_tool_reset (GimpImageMapTool *image_map_tool) { GimpGeglTool *tool = GIMP_GEGL_TOOL (image_map_tool); if (tool->config) gimp_config_reset (GIMP_CONFIG (tool->config)); }
void tool_options_reset_cmd_callback (GtkAction *action, gpointer data) { GimpEditor *editor = GIMP_EDITOR (data); GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp); GimpToolInfo *tool_info = gimp_context_get_tool (context); gimp_config_reset (GIMP_CONFIG (tool_info->tool_options)); }
void tool_options_reset_all_cmd_callback (GtkAction *action, gpointer data) { GimpEditor *editor = GIMP_EDITOR (data); GtkWidget *dialog; dialog = gimp_message_dialog_new (_("Reset All Tool Options"), GIMP_STOCK_QUESTION, GTK_WIDGET (editor), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, gimp_standard_help_func, NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GIMP_STOCK_RESET, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); g_signal_connect_object (gtk_widget_get_toplevel (GTK_WIDGET (editor)), "unmap", G_CALLBACK (gtk_widget_destroy), dialog, G_CONNECT_SWAPPED); gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box, _("Do you really want to reset all " "tool options to default values?")); if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK) { Gimp *gimp = gimp_editor_get_ui_manager (editor)->gimp; GList *list; for (list = gimp_get_tool_info_iter (gimp); list; list = g_list_next (list)) { GimpToolInfo *tool_info = list->data; gimp_config_reset (GIMP_CONFIG (tool_info->tool_options)); } } gtk_widget_destroy (dialog); }
static void gimp_image_map_tool_real_reset (GimpImageMapTool *im_tool) { if (im_tool->config) { if (im_tool->default_config) { gimp_config_copy (GIMP_CONFIG (im_tool->default_config), GIMP_CONFIG (im_tool->config), 0); } else { gimp_config_reset (GIMP_CONFIG (im_tool->config)); } } }
static void gimp_curves_config_init (GimpCurvesConfig *self) { GimpHistogramChannel channel; for (channel = GIMP_HISTOGRAM_VALUE; channel <= GIMP_HISTOGRAM_ALPHA; channel++) { self->curve[channel] = GIMP_CURVE (gimp_curve_new ("curves config")); g_signal_connect_object (self->curve[channel], "dirty", G_CALLBACK (gimp_curves_config_curve_dirty), self, 0); } gimp_config_reset (GIMP_CONFIG (self)); }
static void gimp_brightness_contrast_tool_button_release (GimpTool *tool, const GimpCoords *coords, guint32 time, GdkModifierType state, GimpButtonReleaseType release_type, GimpDisplay *display) { GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool); GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool); gimp_tool_control_halt (tool->control); if (bc_tool->dx == 0 && bc_tool->dy == 0) return; if (release_type == GIMP_BUTTON_RELEASE_CANCEL) gimp_config_reset (GIMP_CONFIG (bc_tool->config)); gimp_image_map_tool_preview (im_tool); }
static void gimp_image_map_tool_reset (GimpImageMapTool *tool) { if (GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->reset) { GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->reset (tool); } else if (tool->config) { if (tool->default_config) { gimp_config_copy (GIMP_CONFIG (tool->default_config), GIMP_CONFIG (tool->config), 0); } else { gimp_config_reset (GIMP_CONFIG (tool->config)); } } }
static gboolean gimp_levels_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpLevelsTool *l_tool = GIMP_LEVELS_TOOL (tool); GimpImage *image = gimp_display_get_image (display); GimpDrawable *drawable = gimp_image_get_active_drawable (image); if (! drawable) return FALSE; if (gimp_drawable_is_indexed (drawable)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("Levels does not operate on indexed layers.")); return FALSE; } gimp_config_reset (GIMP_CONFIG (l_tool->config)); if (l_tool->active_picker) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l_tool->active_picker), FALSE); if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error)) { return FALSE; } gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (l_tool->channel_menu), levels_menu_sensitivity, drawable, NULL); gimp_drawable_calculate_histogram (drawable, l_tool->histogram); gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (l_tool->histogram_view), l_tool->histogram); return TRUE; }
static gboolean gimp_curves_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool); GimpDrawable *drawable = gimp_image_get_active_drawable (display->image); GimpHistogram *histogram; if (! drawable) return FALSE; if (gimp_drawable_is_indexed (drawable)) { g_set_error (error, 0, 0, _("Curves does not operate on indexed layers.")); return FALSE; } gimp_config_reset (GIMP_CONFIG (c_tool->config)); GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error); /* always pick colors */ gimp_color_tool_enable (GIMP_COLOR_TOOL (tool), GIMP_COLOR_TOOL_GET_OPTIONS (tool)); gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (c_tool->channel_menu), curves_menu_sensitivity, drawable, NULL); histogram = gimp_histogram_new (); gimp_drawable_calculate_histogram (drawable, histogram); gimp_histogram_view_set_background (GIMP_HISTOGRAM_VIEW (c_tool->graph), histogram); gimp_histogram_unref (histogram); return TRUE; }
static gboolean gimp_color_balance_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (tool); GimpImage *image = gimp_display_get_image (display); GimpDrawable *drawable = gimp_image_get_active_drawable (image); if (! drawable) return FALSE; if (! gimp_drawable_is_rgb (drawable)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("Color Balance operates only on RGB color layers.")); return FALSE; } gimp_config_reset (GIMP_CONFIG (cb_tool->config)); return GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error); }
static gboolean gimp_hue_saturation_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (tool); GimpImage *image = gimp_display_get_image (display); GimpDrawable *drawable = gimp_image_get_active_drawable (image); if (! drawable) return FALSE; if (! gimp_drawable_is_rgb (drawable)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("Hue-Saturation operates only on RGB color layers.")); return FALSE; } gimp_config_reset (GIMP_CONFIG (hs_tool->config)); return GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error); }
static gboolean gimp_brightness_contrast_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool); GimpImage *image = gimp_display_get_image (display); GimpDrawable *drawable = gimp_image_get_active_drawable (image); if (! drawable) return FALSE; if (gimp_drawable_is_indexed (drawable)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("Brightness-Contrast does not operate " "on indexed layers.")); return FALSE; } gimp_config_reset (GIMP_CONFIG (bc_tool->config)); return GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error); }
static gboolean gimp_gegl_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpGeglTool *g_tool = GIMP_GEGL_TOOL (tool); GimpImage *image = gimp_display_get_image (display); GimpDrawable *drawable = gimp_image_get_active_drawable (image); if (! drawable) return FALSE; if (gimp_drawable_is_indexed (drawable)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("GEGL operations do not operate on indexed layers.")); return FALSE; } if (g_tool->config) gimp_config_reset (GIMP_CONFIG (g_tool->config)); return GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error); }
static void gimp_levels_config_init (GimpLevelsConfig *self) { gimp_config_reset (GIMP_CONFIG (self)); }
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; }
void gimp_tools_restore (Gimp *gimp) { GimpContainer *gimp_list; GimpObject *object; GFile *file; GList *list; GError *error = NULL; g_return_if_fail (GIMP_IS_GIMP (gimp)); gimp_list = gimp_list_new (GIMP_TYPE_TOOL_INFO, FALSE); file = gimp_directory_file ("toolrc", NULL); if (gimp->be_verbose) g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); if (gimp_config_deserialize_gfile (GIMP_CONFIG (gimp_list), file, NULL, NULL)) { gint n = gimp_container_get_n_children (gimp->tool_info_list); gint i; gimp_list_reverse (GIMP_LIST (gimp_list)); for (list = GIMP_LIST (gimp_list)->list, i = 0; list; list = g_list_next (list), i++) { const gchar *name; name = gimp_object_get_name (list->data); object = gimp_container_get_child_by_name (gimp->tool_info_list, name); if (object) { g_object_set (object, "visible", GIMP_TOOL_INFO (list->data)->visible, NULL); gimp_container_reorder (gimp->tool_info_list, object, MIN (i, n - 1)); } } } g_object_unref (file); g_object_unref (gimp_list); /* make the generic operation tool invisible by default */ object = gimp_container_get_child_by_name (gimp->tool_info_list, "gimp-operation-tool"); if (object) g_object_set (object, "visible", FALSE, NULL); for (list = gimp_get_tool_info_iter (gimp); list; list = g_list_next (list)) { GimpToolInfo *tool_info = GIMP_TOOL_INFO (list->data); /* get default values from prefs (see bug #120832) */ gimp_config_reset (GIMP_CONFIG (tool_info->tool_options)); } if (! gimp_contexts_load (gimp, &error)) { gimp_message_literal (gimp, NULL, GIMP_MESSAGE_WARNING, error->message); g_clear_error (&error); } /* make sure there is always a tool active, so broken config files * can't leave us with no initial tool */ if (! gimp_context_get_tool (gimp_get_user_context (gimp))) { gimp_context_set_tool (gimp_get_user_context (gimp), gimp_get_tool_info_iter (gimp)->data); } for (list = gimp_get_tool_info_iter (gimp); list; list = g_list_next (list)) { GimpToolInfo *tool_info = GIMP_TOOL_INFO (list->data); GimpToolOptionsGUIFunc options_gui_func; GtkWidget *options_gui; /* copy all context properties except those the tool actually * uses, because the subsequent deserialize() on the tool * options will only set the properties that were set to * non-default values at the time of saving, and we want to * keep these default values as if they have been saved. * (see bug #541586). */ gimp_context_copy_properties (gimp_get_user_context (gimp), GIMP_CONTEXT (tool_info->tool_options), GIMP_CONTEXT_PROP_MASK_ALL &~ (tool_info->context_props | GIMP_CONTEXT_PROP_MASK_TOOL | GIMP_CONTEXT_PROP_MASK_PAINT_INFO)); gimp_tool_options_deserialize (tool_info->tool_options, NULL); options_gui_func = g_object_get_data (G_OBJECT (tool_info), "gimp-tool-options-gui-func"); if (options_gui_func) { options_gui = (* options_gui_func) (tool_info->tool_options); } else { GtkWidget *label; options_gui = gimp_tool_options_gui (tool_info->tool_options); label = gtk_label_new (_("This tool has\nno options.")); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); gimp_label_set_attributes (GTK_LABEL (label), PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC, -1); gtk_box_pack_start (GTK_BOX (options_gui), label, FALSE, FALSE, 6); gtk_widget_show (label); } gimp_tools_set_tool_options_gui (tool_info->tool_options, g_object_ref_sink (options_gui)); } }
static void gimp_hue_saturation_config_init (GimpHueSaturationConfig *self) { gimp_config_reset (GIMP_CONFIG (self)); }
static void gimp_color_balance_config_init (GimpColorBalanceConfig *self) { gimp_config_reset (GIMP_CONFIG (self)); }
static void stroke_dialog_response (GtkWidget *widget, gint response_id, GtkWidget *dialog) { GimpStrokeDesc *desc; GimpItem *item; GimpImage *image; GimpContext *context; item = g_object_get_data (G_OBJECT (dialog), "gimp-item"); desc = g_object_get_data (G_OBJECT (dialog), "gimp-stroke-desc"); image = gimp_item_get_image (item); context = GIMP_VIEWABLE_DIALOG (dialog)->context; switch (response_id) { case RESPONSE_RESET: { GimpToolInfo *tool_info = gimp_context_get_tool (context); GtkWidget *combo = g_object_get_data (G_OBJECT (dialog), "gimp-tool-menu");; gimp_config_reset (GIMP_CONFIG (desc)); gimp_container_view_select_item (GIMP_CONTAINER_VIEW (combo), GIMP_VIEWABLE (tool_info->paint_info)); } break; case GTK_RESPONSE_OK: { GimpDrawable *drawable = gimp_image_get_active_drawable (image); GimpStrokeDesc *saved_desc; GError *error = NULL; if (! drawable) { gimp_message (context->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, _("There is no active layer or channel " "to stroke to.")); return; } saved_desc = g_object_get_data (G_OBJECT (context->gimp), "saved-stroke-desc"); if (saved_desc) g_object_ref (saved_desc); else saved_desc = gimp_stroke_desc_new (context->gimp, context); gimp_config_sync (G_OBJECT (desc), G_OBJECT (saved_desc), 0); g_object_set_data_full (G_OBJECT (context->gimp), "saved-stroke-desc", saved_desc, (GDestroyNotify) g_object_unref); if (! gimp_item_stroke (item, drawable, context, desc, FALSE, NULL, &error)) { gimp_message (context->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, "%s", error ? error->message : "NULL"); g_clear_error (&error); return; } gimp_image_flush (image); } /* fallthrough */ default: gtk_widget_destroy (dialog); break; } }