1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis and others
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 #ifndef __GIMP_TOOL_CONTROL_H__
19 #define __GIMP_TOOL_CONTROL_H__
20 
21 
22 #include "core/gimpobject.h"
23 
24 
25 #define GIMP_TYPE_TOOL_CONTROL            (gimp_tool_control_get_type ())
26 #define GIMP_TOOL_CONTROL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TOOL_CONTROL, GimpToolControl))
27 #define GIMP_TOOL_CONTROL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TOOL_CONTROL, GimpToolControlClass))
28 #define GIMP_IS_TOOL_CONTROL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_TOOL_CONTROL))
29 #define GIMP_IS_TOOL_CONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TOOL_CONTROL))
30 #define GIMP_TOOL_CONTROL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TOOL_CONTROL, GimpToolControlClass))
31 
32 
33 typedef struct _GimpToolControlClass GimpToolControlClass;
34 
35 
36 struct _GimpToolControl
37 {
38   GimpObject           parent_instance;
39 
40   gboolean             active;             /*  state of tool activity          */
41   gint                 paused_count;       /*  paused control count            */
42 
43   gboolean             preserve;           /*  Preserve this tool across       *
44                                             *  drawable changes                */
45   GSList              *preserve_stack;     /*  for push/pop preserve           */
46 
47   gboolean             scroll_lock;        /*  allow scrolling or not          */
48   gboolean             handle_empty_image; /*  invoke the tool on images       *
49                                             *  without active drawable         */
50   GimpDirtyMask        dirty_mask;         /*  if preserve is FALSE, stop      *
51                                             *  the tool on these events        */
52   GimpToolAction       dirty_action;       /*  use this action to stop the     *
53                                             *  tool when one of the dirty      *
54                                             *  events occurs                   */
55   GimpMotionMode       motion_mode;        /*  how to process motion events    *
56                                             *  before they go to the tool      */
57   gboolean             auto_snap_to;       /*  snap to guides automatically    */
58   gint                 snap_offset_x;
59   gint                 snap_offset_y;
60   gint                 snap_width;
61   gint                 snap_height;
62 
63   GimpCursorPrecision  precision;
64 
65   gboolean             wants_click;        /*  wants click detection           */
66   gboolean             wants_double_click;
67   gboolean             wants_triple_click;
68   gboolean             wants_all_key_events;
69 
70   GimpToolActiveModifiers  active_modifiers;
71 
72   gboolean             toggled;
73 
74   GimpCursorType       cursor;
75   GimpToolCursorType   tool_cursor;
76   GimpCursorModifier   cursor_modifier;
77 
78   GimpCursorType       toggle_cursor;
79   GimpToolCursorType   toggle_tool_cursor;
80   GimpCursorModifier   toggle_cursor_modifier;
81 
82   gchar               *action_opacity;
83   gchar               *action_size;
84   gchar               *action_aspect;
85   gchar               *action_angle;
86   gchar               *action_spacing;
87   gchar               *action_hardness;
88   gchar               *action_force;
89   gchar               *action_object_1;
90   gchar               *action_object_2;
91 };
92 
93 struct _GimpToolControlClass
94 {
95   GimpObjectClass parent_class;
96 };
97 
98 
99 GType          gimp_tool_control_get_type           (void) G_GNUC_CONST;
100 
101 void           gimp_tool_control_activate           (GimpToolControl *control);
102 void           gimp_tool_control_halt               (GimpToolControl *control);
103 gboolean       gimp_tool_control_is_active          (GimpToolControl *control);
104 
105 void           gimp_tool_control_pause              (GimpToolControl *control);
106 void           gimp_tool_control_resume             (GimpToolControl *control);
107 gboolean       gimp_tool_control_is_paused          (GimpToolControl *control);
108 
109 void           gimp_tool_control_set_preserve       (GimpToolControl *control,
110                                                      gboolean         preserve);
111 gboolean       gimp_tool_control_get_preserve       (GimpToolControl *control);
112 
113 void           gimp_tool_control_push_preserve      (GimpToolControl *control,
114                                                      gboolean         preserve);
115 void           gimp_tool_control_pop_preserve       (GimpToolControl *control);
116 
117 void           gimp_tool_control_set_scroll_lock    (GimpToolControl *control,
118                                                      gboolean         scroll_lock);
119 gboolean       gimp_tool_control_get_scroll_lock    (GimpToolControl *control);
120 
121 void           gimp_tool_control_set_handle_empty_image
122                                                     (GimpToolControl *control,
123                                                      gboolean         handle_empty);
124 gboolean       gimp_tool_control_get_handle_empty_image
125                                                     (GimpToolControl *control);
126 
127 void           gimp_tool_control_set_dirty_mask     (GimpToolControl *control,
128                                                      GimpDirtyMask    dirty_mask);
129 GimpDirtyMask  gimp_tool_control_get_dirty_mask     (GimpToolControl *control);
130 
131 void           gimp_tool_control_set_dirty_action   (GimpToolControl *control,
132                                                      GimpToolAction   action);
133 GimpToolAction gimp_tool_control_get_dirty_action   (GimpToolControl *control);
134 
135 void           gimp_tool_control_set_motion_mode    (GimpToolControl *control,
136                                                      GimpMotionMode   motion_mode);
137 GimpMotionMode gimp_tool_control_get_motion_mode    (GimpToolControl *control);
138 
139 void           gimp_tool_control_set_snap_to        (GimpToolControl *control,
140                                                      gboolean         snap_to);
141 gboolean       gimp_tool_control_get_snap_to        (GimpToolControl *control);
142 
143 void           gimp_tool_control_set_wants_click    (GimpToolControl *control,
144                                                      gboolean         wants_click);
145 gboolean       gimp_tool_control_get_wants_click    (GimpToolControl *control);
146 
147 void           gimp_tool_control_set_wants_double_click
148                                                     (GimpToolControl *control,
149                                                      gboolean         wants_double_click);
150 gboolean       gimp_tool_control_get_wants_double_click
151                                                     (GimpToolControl *control);
152 
153 void           gimp_tool_control_set_wants_triple_click
154                                                     (GimpToolControl *control,
155                                                      gboolean         wants_double_click);
156 gboolean       gimp_tool_control_get_wants_triple_click
157                                                     (GimpToolControl *control);
158 
159 void           gimp_tool_control_set_wants_all_key_events
160                                                     (GimpToolControl *control,
161                                                      gboolean         wants_key_events);
162 gboolean       gimp_tool_control_get_wants_all_key_events
163                                                     (GimpToolControl *control);
164 
165 void           gimp_tool_control_set_active_modifiers
166                                                     (GimpToolControl *control,
167                                                      GimpToolActiveModifiers  active_modifiers);
168 GimpToolActiveModifiers
169                gimp_tool_control_get_active_modifiers
170                                                     (GimpToolControl *control);
171 
172 void           gimp_tool_control_set_snap_offsets   (GimpToolControl *control,
173                                                      gint             offset_x,
174                                                      gint             offset_y,
175                                                      gint             width,
176                                                      gint             height);
177 void           gimp_tool_control_get_snap_offsets   (GimpToolControl *control,
178                                                      gint            *offset_x,
179                                                      gint            *offset_y,
180                                                      gint            *width,
181                                                      gint            *height);
182 
183 void           gimp_tool_control_set_precision      (GimpToolControl *control,
184                                                      GimpCursorPrecision  precision);
185 GimpCursorPrecision
186                gimp_tool_control_get_precision      (GimpToolControl *control);
187 
188 void           gimp_tool_control_set_toggled        (GimpToolControl *control,
189                                                      gboolean         toggled);
190 gboolean       gimp_tool_control_get_toggled        (GimpToolControl *control);
191 
192 void           gimp_tool_control_set_cursor         (GimpToolControl *control,
193                                                      GimpCursorType   cursor);
194 void           gimp_tool_control_set_tool_cursor    (GimpToolControl *control,
195                                                      GimpToolCursorType  cursor);
196 void           gimp_tool_control_set_cursor_modifier
197                                                     (GimpToolControl *control,
198                                                      GimpCursorModifier  modifier);
199 void           gimp_tool_control_set_toggle_cursor  (GimpToolControl *control,
200                                                      GimpCursorType   cursor);
201 void           gimp_tool_control_set_toggle_tool_cursor
202                                                     (GimpToolControl *control,
203                                                      GimpToolCursorType  cursor);
204 void           gimp_tool_control_set_toggle_cursor_modifier
205                                                     (GimpToolControl *control,
206                                                      GimpCursorModifier  modifier);
207 
208 GimpCursorType
209               gimp_tool_control_get_cursor          (GimpToolControl *control);
210 
211 GimpToolCursorType
212               gimp_tool_control_get_tool_cursor     (GimpToolControl *control);
213 
214 GimpCursorModifier
215               gimp_tool_control_get_cursor_modifier (GimpToolControl *control);
216 
217 void          gimp_tool_control_set_action_opacity  (GimpToolControl *control,
218                                                      const gchar     *action);
219 const gchar * gimp_tool_control_get_action_opacity  (GimpToolControl *control);
220 
221 void          gimp_tool_control_set_action_size     (GimpToolControl *control,
222                                                      const gchar     *action);
223 const gchar * gimp_tool_control_get_action_size     (GimpToolControl *control);
224 
225 void          gimp_tool_control_set_action_aspect   (GimpToolControl *control,
226                                                      const gchar     *action);
227 const gchar * gimp_tool_control_get_action_aspect   (GimpToolControl *control);
228 
229 void          gimp_tool_control_set_action_angle    (GimpToolControl *control,
230                                                      const gchar     *action);
231 const gchar * gimp_tool_control_get_action_angle    (GimpToolControl *control);
232 
233 void          gimp_tool_control_set_action_spacing  (GimpToolControl *control,
234                                                      const gchar     *action);
235 const gchar * gimp_tool_control_get_action_spacing  (GimpToolControl *control);
236 
237 void          gimp_tool_control_set_action_hardness (GimpToolControl *control,
238                                                      const gchar     *action);
239 const gchar * gimp_tool_control_get_action_hardness (GimpToolControl *control);
240 
241 void          gimp_tool_control_set_action_force    (GimpToolControl *control,
242                                                      const gchar     *action);
243 const gchar * gimp_tool_control_get_action_force    (GimpToolControl *control);
244 
245 void          gimp_tool_control_set_action_object_1 (GimpToolControl *control,
246                                                      const gchar     *action);
247 const gchar * gimp_tool_control_get_action_object_1 (GimpToolControl *control);
248 
249 void          gimp_tool_control_set_action_object_2 (GimpToolControl *control,
250                                                      const gchar     *action);
251 const gchar * gimp_tool_control_get_action_object_2 (GimpToolControl *control);
252 
253 
254 #endif /* __GIMP_TOOL_CONTROL_H__ */
255