1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "paint/gimpcloneoptions.h"
#include "widgets/gimpviewablebox.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpcloneoptions-gui.h"
#include "gimppaintoptions-gui.h"
#include "gimp-intl.h"
static gboolean
gimp_clone_options_sync_source (GBinding *binding,
const GValue *source_value,
GValue *target_value,
gpointer user_data)
{
GimpCloneType type = g_value_get_enum (source_value);
g_value_set_boolean (target_value,
type == GPOINTER_TO_INT (user_data));
return TRUE;
}
GtkWidget *
gimp_clone_options_gui (GimpToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox = gimp_paint_options_gui (tool_options);
GtkWidget *frame;
GtkWidget *combo;
GtkWidget *source_vbox;
GtkWidget *button;
GtkWidget *hbox;
/* the source frame */
frame = gimp_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
/* the source type menu */
combo = gimp_prop_enum_combo_box_new (config, "clone-type", 0, 0);
gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Source"));
g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_frame_set_label_widget (GTK_FRAME (frame), combo);
gtk_widget_show (combo);
source_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (frame), source_vbox);
gtk_widget_show (source_vbox);
button = gimp_prop_check_button_new (config, "sample-merged", NULL);
gtk_box_pack_start (GTK_BOX (source_vbox), button, FALSE, FALSE, 0);
g_object_bind_property_full (config, "clone-type",
button, "visible",
G_BINDING_SYNC_CREATE,
gimp_clone_options_sync_source,
NULL,
GINT_TO_POINTER (GIMP_CLONE_IMAGE), NULL);
hbox = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options),
NULL, 2,
"pattern-view-type", "pattern-view-size");
gtk_box_pack_start (GTK_BOX (source_vbox), hbox, FALSE, FALSE, 0);
g_object_bind_property_full (config, "clone-type",
hbox, "visible",
G_BINDING_SYNC_CREATE,
gimp_clone_options_sync_source,
NULL,
GINT_TO_POINTER (GIMP_CLONE_PATTERN), NULL);
combo = gimp_prop_enum_combo_box_new (config, "align-mode", 0, 0);
gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Alignment"));
g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
gtk_widget_show (combo);
return vbox;
}
|