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 #include "config.h"
19
20 #include <gegl.h>
21 #include <gtk/gtk.h>
22
23 #include "tools-types.h"
24
25 #include "gimptoolcontrol.h"
26
27
28 static void gimp_tool_control_finalize (GObject *object);
29
30
G_DEFINE_TYPE(GimpToolControl,gimp_tool_control,GIMP_TYPE_OBJECT)31 G_DEFINE_TYPE (GimpToolControl, gimp_tool_control, GIMP_TYPE_OBJECT)
32
33 #define parent_class gimp_tool_control_parent_class
34
35
36 static void
37 gimp_tool_control_class_init (GimpToolControlClass *klass)
38 {
39 GObjectClass *object_class = G_OBJECT_CLASS (klass);
40
41 object_class->finalize = gimp_tool_control_finalize;
42 }
43
44 static void
gimp_tool_control_init(GimpToolControl * control)45 gimp_tool_control_init (GimpToolControl *control)
46 {
47 control->active = FALSE;
48 control->paused_count = 0;
49
50 control->preserve = TRUE;
51 control->scroll_lock = FALSE;
52 control->handle_empty_image = FALSE;
53
54 control->dirty_mask = GIMP_DIRTY_NONE;
55 control->dirty_action = GIMP_TOOL_ACTION_HALT;
56 control->motion_mode = GIMP_MOTION_MODE_COMPRESS;
57
58 control->auto_snap_to = TRUE;
59 control->snap_offset_x = 0;
60 control->snap_offset_y = 0;
61 control->snap_width = 0;
62 control->snap_height = 0;
63
64 control->precision = GIMP_CURSOR_PRECISION_PIXEL_CENTER;
65
66 control->toggled = FALSE;
67
68 control->wants_click = FALSE;
69 control->wants_double_click = FALSE;
70 control->wants_triple_click = FALSE;
71 control->wants_all_key_events = FALSE;
72
73 control->active_modifiers = GIMP_TOOL_ACTIVE_MODIFIERS_OFF;
74
75 control->cursor = GIMP_CURSOR_MOUSE;
76 control->tool_cursor = GIMP_TOOL_CURSOR_NONE;
77 control->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE;
78
79 control->toggle_cursor = -1;
80 control->toggle_tool_cursor = -1;
81 control->toggle_cursor_modifier = -1;
82 }
83
84 static void
gimp_tool_control_finalize(GObject * object)85 gimp_tool_control_finalize (GObject *object)
86 {
87 GimpToolControl *control = GIMP_TOOL_CONTROL (object);
88
89 g_slist_free (control->preserve_stack);
90
91 g_free (control->action_opacity);
92 g_free (control->action_size);
93 g_free (control->action_aspect);
94 g_free (control->action_angle);
95 g_free (control->action_spacing);
96 g_free (control->action_hardness);
97 g_free (control->action_force);
98 g_free (control->action_object_1);
99 g_free (control->action_object_2);
100
101 G_OBJECT_CLASS (parent_class)->finalize (object);
102 }
103
104
105 /* public functions */
106
107 void
gimp_tool_control_activate(GimpToolControl * control)108 gimp_tool_control_activate (GimpToolControl *control)
109 {
110 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
111 g_return_if_fail (control->active == FALSE);
112
113 control->active = TRUE;
114 }
115
116 void
gimp_tool_control_halt(GimpToolControl * control)117 gimp_tool_control_halt (GimpToolControl *control)
118 {
119 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
120 g_return_if_fail (control->active == TRUE);
121
122 control->active = FALSE;
123 }
124
125 gboolean
gimp_tool_control_is_active(GimpToolControl * control)126 gimp_tool_control_is_active (GimpToolControl *control)
127 {
128 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
129
130 return control->active;
131 }
132
133 void
gimp_tool_control_pause(GimpToolControl * control)134 gimp_tool_control_pause (GimpToolControl *control)
135 {
136 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
137
138 control->paused_count++;
139 }
140
141 void
gimp_tool_control_resume(GimpToolControl * control)142 gimp_tool_control_resume (GimpToolControl *control)
143 {
144 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
145 g_return_if_fail (control->paused_count > 0);
146
147 control->paused_count--;
148 }
149
150 gboolean
gimp_tool_control_is_paused(GimpToolControl * control)151 gimp_tool_control_is_paused (GimpToolControl *control)
152 {
153 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
154
155 return control->paused_count > 0;
156 }
157
158 void
gimp_tool_control_set_preserve(GimpToolControl * control,gboolean preserve)159 gimp_tool_control_set_preserve (GimpToolControl *control,
160 gboolean preserve)
161 {
162 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
163
164 control->preserve = preserve ? TRUE : FALSE;
165 }
166
167 gboolean
gimp_tool_control_get_preserve(GimpToolControl * control)168 gimp_tool_control_get_preserve (GimpToolControl *control)
169 {
170 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
171
172 return control->preserve;
173 }
174
175 void
gimp_tool_control_push_preserve(GimpToolControl * control,gboolean preserve)176 gimp_tool_control_push_preserve (GimpToolControl *control,
177 gboolean preserve)
178 {
179 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
180
181 control->preserve_stack =
182 g_slist_prepend (control->preserve_stack,
183 GINT_TO_POINTER (control->preserve));
184
185 control->preserve = preserve ? TRUE : FALSE;
186 }
187
188 void
gimp_tool_control_pop_preserve(GimpToolControl * control)189 gimp_tool_control_pop_preserve (GimpToolControl *control)
190 {
191 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
192 g_return_if_fail (control->preserve_stack != NULL);
193
194 control->preserve = GPOINTER_TO_INT (control->preserve_stack->data);
195
196 control->preserve_stack = g_slist_delete_link (control->preserve_stack,
197 control->preserve_stack);
198 }
199
200 void
gimp_tool_control_set_scroll_lock(GimpToolControl * control,gboolean scroll_lock)201 gimp_tool_control_set_scroll_lock (GimpToolControl *control,
202 gboolean scroll_lock)
203 {
204 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
205
206 control->scroll_lock = scroll_lock ? TRUE : FALSE;
207 }
208
209 gboolean
gimp_tool_control_get_scroll_lock(GimpToolControl * control)210 gimp_tool_control_get_scroll_lock (GimpToolControl *control)
211 {
212 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
213
214 return control->scroll_lock;
215 }
216
217 void
gimp_tool_control_set_handle_empty_image(GimpToolControl * control,gboolean handle_empty)218 gimp_tool_control_set_handle_empty_image (GimpToolControl *control,
219 gboolean handle_empty)
220 {
221 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
222
223 control->handle_empty_image = handle_empty ? TRUE : FALSE;
224 }
225
226 gboolean
gimp_tool_control_get_handle_empty_image(GimpToolControl * control)227 gimp_tool_control_get_handle_empty_image (GimpToolControl *control)
228 {
229 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
230
231 return control->handle_empty_image;
232 }
233
234 void
gimp_tool_control_set_dirty_mask(GimpToolControl * control,GimpDirtyMask dirty_mask)235 gimp_tool_control_set_dirty_mask (GimpToolControl *control,
236 GimpDirtyMask dirty_mask)
237 {
238 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
239
240 control->dirty_mask = dirty_mask;
241 }
242
243 GimpDirtyMask
gimp_tool_control_get_dirty_mask(GimpToolControl * control)244 gimp_tool_control_get_dirty_mask (GimpToolControl *control)
245 {
246 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), GIMP_DIRTY_NONE);
247
248 return control->dirty_mask;
249 }
250
251 void
gimp_tool_control_set_dirty_action(GimpToolControl * control,GimpToolAction action)252 gimp_tool_control_set_dirty_action (GimpToolControl *control,
253 GimpToolAction action)
254 {
255 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
256
257 control->dirty_action = action;
258 }
259
260 GimpToolAction
gimp_tool_control_get_dirty_action(GimpToolControl * control)261 gimp_tool_control_get_dirty_action (GimpToolControl *control)
262 {
263 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), GIMP_TOOL_ACTION_HALT);
264
265 return control->dirty_action;
266 }
267
268 void
gimp_tool_control_set_motion_mode(GimpToolControl * control,GimpMotionMode motion_mode)269 gimp_tool_control_set_motion_mode (GimpToolControl *control,
270 GimpMotionMode motion_mode)
271 {
272 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
273
274 control->motion_mode = motion_mode;
275 }
276
277 GimpMotionMode
gimp_tool_control_get_motion_mode(GimpToolControl * control)278 gimp_tool_control_get_motion_mode (GimpToolControl *control)
279 {
280 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), GIMP_MOTION_MODE_EXACT);
281
282 return control->motion_mode;
283 }
284
285 void
gimp_tool_control_set_snap_to(GimpToolControl * control,gboolean snap_to)286 gimp_tool_control_set_snap_to (GimpToolControl *control,
287 gboolean snap_to)
288 {
289 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
290
291 control->auto_snap_to = snap_to ? TRUE : FALSE;
292 }
293
294 gboolean
gimp_tool_control_get_snap_to(GimpToolControl * control)295 gimp_tool_control_get_snap_to (GimpToolControl *control)
296 {
297 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
298
299 return control->auto_snap_to;
300 }
301
302 void
gimp_tool_control_set_wants_click(GimpToolControl * control,gboolean wants_click)303 gimp_tool_control_set_wants_click (GimpToolControl *control,
304 gboolean wants_click)
305 {
306 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
307
308 control->wants_click = wants_click ? TRUE : FALSE;
309 }
310
311 gboolean
gimp_tool_control_get_wants_click(GimpToolControl * control)312 gimp_tool_control_get_wants_click (GimpToolControl *control)
313 {
314 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
315
316 return control->wants_click;
317 }
318
319 void
gimp_tool_control_set_wants_double_click(GimpToolControl * control,gboolean wants_double_click)320 gimp_tool_control_set_wants_double_click (GimpToolControl *control,
321 gboolean wants_double_click)
322 {
323 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
324
325 control->wants_double_click = wants_double_click ? TRUE : FALSE;
326 }
327
328 gboolean
gimp_tool_control_get_wants_double_click(GimpToolControl * control)329 gimp_tool_control_get_wants_double_click (GimpToolControl *control)
330 {
331 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
332
333 return control->wants_double_click;
334 }
335
336 void
gimp_tool_control_set_wants_triple_click(GimpToolControl * control,gboolean wants_triple_click)337 gimp_tool_control_set_wants_triple_click (GimpToolControl *control,
338 gboolean wants_triple_click)
339 {
340 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
341
342 control->wants_triple_click = wants_triple_click ? TRUE : FALSE;
343 }
344
345 gboolean
gimp_tool_control_get_wants_triple_click(GimpToolControl * control)346 gimp_tool_control_get_wants_triple_click (GimpToolControl *control)
347 {
348 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
349
350 return control->wants_triple_click;
351 }
352
353 void
gimp_tool_control_set_wants_all_key_events(GimpToolControl * control,gboolean wants_key_events)354 gimp_tool_control_set_wants_all_key_events (GimpToolControl *control,
355 gboolean wants_key_events)
356 {
357 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
358
359 control->wants_all_key_events = wants_key_events ? TRUE : FALSE;
360 }
361
362 gboolean
gimp_tool_control_get_wants_all_key_events(GimpToolControl * control)363 gimp_tool_control_get_wants_all_key_events (GimpToolControl *control)
364 {
365 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
366
367 return control->wants_all_key_events;
368 }
369
370 void
gimp_tool_control_set_active_modifiers(GimpToolControl * control,GimpToolActiveModifiers active_modifiers)371 gimp_tool_control_set_active_modifiers (GimpToolControl *control,
372 GimpToolActiveModifiers active_modifiers)
373 {
374 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
375
376 control->active_modifiers = active_modifiers;
377 }
378
379 GimpToolActiveModifiers
gimp_tool_control_get_active_modifiers(GimpToolControl * control)380 gimp_tool_control_get_active_modifiers (GimpToolControl *control)
381 {
382 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control),
383 GIMP_TOOL_ACTIVE_MODIFIERS_OFF);
384
385 return control->active_modifiers;
386 }
387
388 void
gimp_tool_control_set_snap_offsets(GimpToolControl * control,gint offset_x,gint offset_y,gint width,gint height)389 gimp_tool_control_set_snap_offsets (GimpToolControl *control,
390 gint offset_x,
391 gint offset_y,
392 gint width,
393 gint height)
394 {
395 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
396
397 control->snap_offset_x = offset_x;
398 control->snap_offset_y = offset_y;
399 control->snap_width = width;
400 control->snap_height = height;
401 }
402
403 void
gimp_tool_control_get_snap_offsets(GimpToolControl * control,gint * offset_x,gint * offset_y,gint * width,gint * height)404 gimp_tool_control_get_snap_offsets (GimpToolControl *control,
405 gint *offset_x,
406 gint *offset_y,
407 gint *width,
408 gint *height)
409 {
410 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
411
412 if (offset_x) *offset_x = control->snap_offset_x;
413 if (offset_y) *offset_y = control->snap_offset_y;
414 if (width) *width = control->snap_width;
415 if (height) *height = control->snap_height;
416 }
417
418 void
gimp_tool_control_set_precision(GimpToolControl * control,GimpCursorPrecision precision)419 gimp_tool_control_set_precision (GimpToolControl *control,
420 GimpCursorPrecision precision)
421 {
422 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
423
424 control->precision = precision;
425 }
426
427 GimpCursorPrecision
gimp_tool_control_get_precision(GimpToolControl * control)428 gimp_tool_control_get_precision (GimpToolControl *control)
429 {
430 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control),
431 GIMP_CURSOR_PRECISION_PIXEL_CENTER);
432
433 return control->precision;
434 }
435
436 void
gimp_tool_control_set_toggled(GimpToolControl * control,gboolean toggled)437 gimp_tool_control_set_toggled (GimpToolControl *control,
438 gboolean toggled)
439 {
440 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
441
442 control->toggled = toggled ? TRUE : FALSE;
443 }
444
445 gboolean
gimp_tool_control_get_toggled(GimpToolControl * control)446 gimp_tool_control_get_toggled (GimpToolControl *control)
447 {
448 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
449
450 return control->toggled;
451 }
452
453 void
gimp_tool_control_set_cursor(GimpToolControl * control,GimpCursorType cursor)454 gimp_tool_control_set_cursor (GimpToolControl *control,
455 GimpCursorType cursor)
456 {
457 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
458
459 control->cursor = cursor;
460 }
461
462 void
gimp_tool_control_set_tool_cursor(GimpToolControl * control,GimpToolCursorType cursor)463 gimp_tool_control_set_tool_cursor (GimpToolControl *control,
464 GimpToolCursorType cursor)
465 {
466 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
467
468 control->tool_cursor = cursor;
469 }
470
471 void
gimp_tool_control_set_cursor_modifier(GimpToolControl * control,GimpCursorModifier modifier)472 gimp_tool_control_set_cursor_modifier (GimpToolControl *control,
473 GimpCursorModifier modifier)
474 {
475 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
476
477 control->cursor_modifier = modifier;
478 }
479
480 void
gimp_tool_control_set_toggle_cursor(GimpToolControl * control,GimpCursorType cursor)481 gimp_tool_control_set_toggle_cursor (GimpToolControl *control,
482 GimpCursorType cursor)
483 {
484 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
485
486 control->toggle_cursor = cursor;
487 }
488
489 void
gimp_tool_control_set_toggle_tool_cursor(GimpToolControl * control,GimpToolCursorType cursor)490 gimp_tool_control_set_toggle_tool_cursor (GimpToolControl *control,
491 GimpToolCursorType cursor)
492 {
493 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
494
495 control->toggle_tool_cursor = cursor;
496 }
497
498 void
gimp_tool_control_set_toggle_cursor_modifier(GimpToolControl * control,GimpCursorModifier modifier)499 gimp_tool_control_set_toggle_cursor_modifier (GimpToolControl *control,
500 GimpCursorModifier modifier)
501 {
502 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
503
504 control->toggle_cursor_modifier = modifier;
505 }
506
507 GimpCursorType
gimp_tool_control_get_cursor(GimpToolControl * control)508 gimp_tool_control_get_cursor (GimpToolControl *control)
509 {
510 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
511
512 if (control->toggled && control->toggle_cursor != -1)
513 return control->toggle_cursor;
514
515 return control->cursor;
516 }
517
518 GimpToolCursorType
gimp_tool_control_get_tool_cursor(GimpToolControl * control)519 gimp_tool_control_get_tool_cursor (GimpToolControl *control)
520 {
521 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
522
523 if (control->toggled && control->toggle_tool_cursor != -1)
524 return control->toggle_tool_cursor;
525
526 return control->tool_cursor;
527 }
528
529 GimpCursorModifier
gimp_tool_control_get_cursor_modifier(GimpToolControl * control)530 gimp_tool_control_get_cursor_modifier (GimpToolControl *control)
531 {
532 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
533
534 if (control->toggled && control->toggle_cursor_modifier != -1)
535 return control->toggle_cursor_modifier;
536
537 return control->cursor_modifier;
538 }
539
540 void
gimp_tool_control_set_action_opacity(GimpToolControl * control,const gchar * action)541 gimp_tool_control_set_action_opacity (GimpToolControl *control,
542 const gchar *action)
543 {
544 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
545
546 if (action != control->action_opacity)
547 {
548 g_free (control->action_opacity);
549 control->action_opacity = g_strdup (action);
550 }
551 }
552
553 const gchar *
gimp_tool_control_get_action_opacity(GimpToolControl * control)554 gimp_tool_control_get_action_opacity (GimpToolControl *control)
555 {
556 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
557
558 return control->action_opacity;
559 }
560
561 void
gimp_tool_control_set_action_size(GimpToolControl * control,const gchar * action)562 gimp_tool_control_set_action_size (GimpToolControl *control,
563 const gchar *action)
564 {
565 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
566
567 if (action != control->action_size)
568 {
569 g_free (control->action_size);
570 control->action_size = g_strdup (action);
571 }
572 }
573
574 const gchar *
gimp_tool_control_get_action_size(GimpToolControl * control)575 gimp_tool_control_get_action_size (GimpToolControl *control)
576 {
577 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
578
579 return control->action_size;
580 }
581
582 void
gimp_tool_control_set_action_aspect(GimpToolControl * control,const gchar * action)583 gimp_tool_control_set_action_aspect (GimpToolControl *control,
584 const gchar *action)
585 {
586 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
587
588 if (action != control->action_aspect)
589 {
590 g_free (control->action_aspect);
591 control->action_aspect = g_strdup (action);
592 }
593 }
594
595 const gchar *
gimp_tool_control_get_action_aspect(GimpToolControl * control)596 gimp_tool_control_get_action_aspect (GimpToolControl *control)
597 {
598 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
599
600 return control->action_aspect;
601 }
602
603 void
gimp_tool_control_set_action_angle(GimpToolControl * control,const gchar * action)604 gimp_tool_control_set_action_angle (GimpToolControl *control,
605 const gchar *action)
606 {
607 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
608
609 if (action != control->action_angle)
610 {
611 g_free (control->action_angle);
612 control->action_angle = g_strdup (action);
613 }
614 }
615
616 const gchar *
gimp_tool_control_get_action_angle(GimpToolControl * control)617 gimp_tool_control_get_action_angle (GimpToolControl *control)
618 {
619 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
620
621 return control->action_angle;
622 }
623
624 void
gimp_tool_control_set_action_spacing(GimpToolControl * control,const gchar * action)625 gimp_tool_control_set_action_spacing (GimpToolControl *control,
626 const gchar *action)
627 {
628 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
629
630 if (action != control->action_spacing)
631 {
632 g_free (control->action_spacing);
633 control->action_spacing = g_strdup (action);
634 }
635 }
636
637 const gchar *
gimp_tool_control_get_action_spacing(GimpToolControl * control)638 gimp_tool_control_get_action_spacing (GimpToolControl *control)
639 {
640 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
641
642 return control->action_spacing;
643 }
644
645 void
gimp_tool_control_set_action_hardness(GimpToolControl * control,const gchar * action)646 gimp_tool_control_set_action_hardness (GimpToolControl *control,
647 const gchar *action)
648 {
649 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
650
651 if (action != control->action_hardness)
652 {
653 g_free (control->action_hardness);
654 control->action_hardness = g_strdup (action);
655 }
656 }
657
658 const gchar *
gimp_tool_control_get_action_hardness(GimpToolControl * control)659 gimp_tool_control_get_action_hardness (GimpToolControl *control)
660 {
661 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
662
663 return control->action_hardness;
664 }
665
666 void
gimp_tool_control_set_action_force(GimpToolControl * control,const gchar * action)667 gimp_tool_control_set_action_force (GimpToolControl *control,
668 const gchar *action)
669 {
670 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
671
672 if (action != control->action_force)
673 {
674 g_free (control->action_force);
675 control->action_force = g_strdup (action);
676 }
677 }
678
679 const gchar *
gimp_tool_control_get_action_force(GimpToolControl * control)680 gimp_tool_control_get_action_force (GimpToolControl *control)
681 {
682 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
683
684 return control->action_force;
685 }
686
687 void
gimp_tool_control_set_action_object_1(GimpToolControl * control,const gchar * action)688 gimp_tool_control_set_action_object_1 (GimpToolControl *control,
689 const gchar *action)
690 {
691 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
692
693 if (action != control->action_object_1)
694 {
695 g_free (control->action_object_1);
696 control->action_object_1 = g_strdup (action);
697 }
698 }
699
700 const gchar *
gimp_tool_control_get_action_object_1(GimpToolControl * control)701 gimp_tool_control_get_action_object_1 (GimpToolControl *control)
702 {
703 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
704
705 return control->action_object_1;
706 }
707
708 void
gimp_tool_control_set_action_object_2(GimpToolControl * control,const gchar * action)709 gimp_tool_control_set_action_object_2 (GimpToolControl *control,
710 const gchar *action)
711 {
712 g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
713
714 if (action != control->action_object_2)
715 {
716 g_free (control->action_object_2);
717 control->action_object_2 = g_strdup (action);
718 }
719 }
720
721 const gchar *
gimp_tool_control_get_action_object_2(GimpToolControl * control)722 gimp_tool_control_get_action_object_2 (GimpToolControl *control)
723 {
724 g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
725
726 return control->action_object_2;
727 }
728