1 /* GIMP - The GNU Image Manipulation Program
2 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18 #include "config.h"
19
20 #include <gegl.h>
21 #include <gtk/gtk.h>
22
23 #include "libgimpwidgets/gimpwidgets.h"
24
25 #include "tools-types.h"
26
27 #include "paint/gimpsourceoptions.h"
28
29 #include "widgets/gimphelp-ids.h"
30
31 #include "gimphealtool.h"
32 #include "gimppaintoptions-gui.h"
33 #include "gimptoolcontrol.h"
34
35 #include "gimp-intl.h"
36
37
38 static GtkWidget * gimp_heal_options_gui (GimpToolOptions *tool_options);
39
40
G_DEFINE_TYPE(GimpHealTool,gimp_heal_tool,GIMP_TYPE_SOURCE_TOOL)41 G_DEFINE_TYPE (GimpHealTool, gimp_heal_tool, GIMP_TYPE_SOURCE_TOOL)
42
43
44 void
45 gimp_heal_tool_register (GimpToolRegisterCallback callback,
46 gpointer data)
47 {
48 (* callback) (GIMP_TYPE_HEAL_TOOL,
49 GIMP_TYPE_SOURCE_OPTIONS,
50 gimp_heal_options_gui,
51 GIMP_PAINT_OPTIONS_CONTEXT_MASK,
52 "gimp-heal-tool",
53 _("Healing"),
54 _("Healing Tool: Heal image irregularities"),
55 N_("_Heal"),
56 "H",
57 NULL,
58 GIMP_HELP_TOOL_HEAL,
59 GIMP_ICON_TOOL_HEAL,
60 data);
61 }
62
63 static void
gimp_heal_tool_class_init(GimpHealToolClass * klass)64 gimp_heal_tool_class_init (GimpHealToolClass *klass)
65 {
66 }
67
68 static void
gimp_heal_tool_init(GimpHealTool * heal)69 gimp_heal_tool_init (GimpHealTool *heal)
70 {
71 GimpTool *tool = GIMP_TOOL (heal);
72 GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
73 GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
74
75 gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_HEAL);
76
77 paint_tool->status = _("Click to heal");
78 paint_tool->status_ctrl = _("%s to set a new heal source");
79
80 source_tool->status_paint = _("Click to heal");
81 /* Translators: the translation of "Click" must be the first word */
82 source_tool->status_set_source = _("Click to set a new heal source");
83 source_tool->status_set_source_ctrl = _("%s to set a new heal source");
84 }
85
86
87 /* tool options stuff */
88
89 static GtkWidget *
gimp_heal_options_gui(GimpToolOptions * tool_options)90 gimp_heal_options_gui (GimpToolOptions *tool_options)
91 {
92 GObject *config = G_OBJECT (tool_options);
93 GtkWidget *vbox = gimp_paint_options_gui (tool_options);
94 GtkWidget *button;
95 GtkWidget *combo;
96
97 /* the sample merged checkbox */
98 button = gimp_prop_check_button_new (config, "sample-merged",
99 _("Sample merged"));
100 gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
101 gtk_widget_show (button);
102
103 /* the alignment combo */
104 combo = gimp_prop_enum_combo_box_new (config, "align-mode", 0, 0);
105 gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Alignment"));
106 g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
107 gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
108 gtk_widget_show (combo);
109
110 return vbox;
111 }
112