39
32
#include "core/gimptoolinfo.h"
40
33
#include "core/gimpunit.h"
42
#include "paint/gimpbrushcore.h"
43
35
#include "paint/gimppaintcore.h"
44
36
#include "paint/gimppaintoptions.h"
46
38
#include "widgets/gimpdevices.h"
39
#include "widgets/gimpwidgets-utils.h"
48
41
#include "display/gimpdisplay.h"
49
42
#include "display/gimpdisplayshell.h"
50
#include "display/gimpstatusbar.h"
52
44
#include "gimpcoloroptions.h"
53
#include "gimpcolorpickertool.h"
54
45
#include "gimppainttool.h"
55
46
#include "gimptoolcontrol.h"
56
47
#include "tools-utils.h"
58
49
#include "gimp-intl.h"
61
#define TARGET_SIZE 15
62
#define STATUSBAR_SIZE 128
65
static void gimp_paint_tool_class_init (GimpPaintToolClass *klass);
66
static void gimp_paint_tool_init (GimpPaintTool *paint_tool);
68
static GObject * gimp_paint_tool_constructor (GType type,
52
#define HANDLE_SIZE 15
53
#define STATUSBAR_SIZE 200
56
static GObject * gimp_paint_tool_constructor (GType type,
70
58
GObjectConstructParam *params);
71
static void gimp_paint_tool_finalize (GObject *object);
73
static void gimp_paint_tool_control (GimpTool *tool,
74
GimpToolAction action,
76
static void gimp_paint_tool_button_press (GimpTool *tool,
79
GdkModifierType state,
81
static void gimp_paint_tool_button_release (GimpTool *tool,
84
GdkModifierType state,
86
static void gimp_paint_tool_motion (GimpTool *tool,
89
GdkModifierType state,
91
static void gimp_paint_tool_modifier_key (GimpTool *tool,
94
GdkModifierType state,
96
static void gimp_paint_tool_oper_update (GimpTool *tool,
98
GdkModifierType state,
100
static void gimp_paint_tool_cursor_update (GimpTool *tool,
102
GdkModifierType state,
105
static void gimp_paint_tool_draw (GimpDrawTool *draw_tool);
107
static void gimp_paint_tool_color_picked (GimpColorTool *color_tool,
108
GimpColorPickState pick_state,
109
GimpImageType sample_type,
113
static void gimp_paint_tool_set_brush (GimpBrushCore *brush_core,
115
GimpPaintTool *paint_tool);
116
static void gimp_paint_tool_set_brush_after(GimpBrushCore *brush_core,
118
GimpPaintTool *paint_tool);
119
static void gimp_paint_tool_notify_brush (GimpDisplayConfig *config,
121
GimpPaintTool *paint_tool);
124
static GimpColorToolClass *parent_class = NULL;
128
gimp_paint_tool_get_type (void)
130
static GType tool_type = 0;
134
static const GTypeInfo tool_info =
136
sizeof (GimpPaintToolClass),
137
(GBaseInitFunc) NULL,
138
(GBaseFinalizeFunc) NULL,
139
(GClassInitFunc) gimp_paint_tool_class_init,
140
NULL, /* class_finalize */
141
NULL, /* class_data */
142
sizeof (GimpPaintTool),
144
(GInstanceInitFunc) gimp_paint_tool_init,
147
tool_type = g_type_register_static (GIMP_TYPE_COLOR_TOOL,
59
static void gimp_paint_tool_finalize (GObject *object);
61
static void gimp_paint_tool_control (GimpTool *tool,
62
GimpToolAction action,
63
GimpDisplay *display);
64
static void gimp_paint_tool_button_press (GimpTool *tool,
67
GdkModifierType state,
68
GimpDisplay *display);
69
static void gimp_paint_tool_button_release (GimpTool *tool,
72
GdkModifierType state,
73
GimpButtonReleaseType release_type,
74
GimpDisplay *display);
75
static void gimp_paint_tool_motion (GimpTool *tool,
78
GdkModifierType state,
79
GimpDisplay *display);
80
static void gimp_paint_tool_modifier_key (GimpTool *tool,
83
GdkModifierType state,
84
GimpDisplay *display);
85
static void gimp_paint_tool_oper_update (GimpTool *tool,
87
GdkModifierType state,
89
GimpDisplay *display);
91
static void gimp_paint_tool_draw (GimpDrawTool *draw_tool);
94
G_DEFINE_TYPE (GimpPaintTool, gimp_paint_tool, GIMP_TYPE_COLOR_TOOL)
96
#define parent_class gimp_paint_tool_parent_class
156
100
gimp_paint_tool_class_init (GimpPaintToolClass *klass)
158
GObjectClass *object_class = G_OBJECT_CLASS (klass);
159
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
160
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
161
GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass);
163
parent_class = g_type_class_peek_parent (klass);
102
GObjectClass *object_class = G_OBJECT_CLASS (klass);
103
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
104
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
165
106
object_class->constructor = gimp_paint_tool_constructor;
166
107
object_class->finalize = gimp_paint_tool_finalize;
184
122
GimpTool *tool = GIMP_TOOL (paint_tool);
186
124
gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_EXACT);
125
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
126
gimp_tool_control_set_action_value_1 (tool->control,
127
"context/context-opacity-set");
188
129
paint_tool->pick_colors = FALSE;
189
130
paint_tool->draw_line = FALSE;
191
paint_tool->show_cursor = TRUE;
192
paint_tool->draw_brush = TRUE;
193
paint_tool->brush_x = 0.0;
194
paint_tool->brush_y = 0.0;
132
paint_tool->status = _("Click to paint");
133
paint_tool->status_line = _("Click to draw the line");
134
paint_tool->status_ctrl = _("%s to pick a color");
196
136
paint_tool->core = NULL;
211
152
paint_tool = GIMP_PAINT_TOOL (object);
213
154
g_assert (GIMP_IS_TOOL_INFO (tool->tool_info));
215
paint_tool->show_cursor =
216
GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_paint_tool_cursor;
217
paint_tool->draw_brush =
218
GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_brush_outline;
220
g_signal_connect_object (tool->tool_info->gimp->config,
221
"notify::show-paint-tool-cursor",
222
G_CALLBACK (gimp_paint_tool_notify_brush),
224
g_signal_connect_object (tool->tool_info->gimp->config,
225
"notify::show-brush-outline",
226
G_CALLBACK (gimp_paint_tool_notify_brush),
229
paint_tool->core = g_object_new (tool->tool_info->paint_info->paint_type,
155
g_assert (GIMP_IS_PAINT_INFO (tool->tool_info->paint_info));
157
paint_info = tool->tool_info->paint_info;
159
g_assert (g_type_is_a (paint_info->paint_type, GIMP_TYPE_PAINT_CORE));
161
paint_tool->core = g_object_new (paint_info->paint_type,
162
"undo-desc", paint_info->blurb,
232
if (GIMP_IS_BRUSH_CORE (paint_tool->core))
234
g_signal_connect (paint_tool->core, "set-brush",
235
G_CALLBACK (gimp_paint_tool_set_brush),
237
g_signal_connect_after (paint_tool->core, "set-brush",
238
G_CALLBACK (gimp_paint_tool_set_brush_after),
277
200
GIMP_COLOR_TOOL (tool)->pick_mode = mode;
282
204
gimp_paint_tool_control (GimpTool *tool,
283
GimpToolAction action,
205
GimpToolAction action,
206
GimpDisplay *display)
286
208
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
287
209
GimpDrawable *drawable;
289
drawable = gimp_image_active_drawable (gdisp->gimage);
211
drawable = gimp_image_active_drawable (display->image);
215
case GIMP_TOOL_ACTION_PAUSE:
216
case GIMP_TOOL_ACTION_RESUME:
219
case GIMP_TOOL_ACTION_HALT:
294
220
gimp_paint_core_paint (paint_tool->core,
296
GIMP_PAINT_OPTIONS (tool->tool_info->tool_options),
222
GIMP_PAINT_TOOL_GET_OPTIONS (tool),
297
223
GIMP_PAINT_STATE_FINISH, 0);
298
224
gimp_paint_core_cleanup (paint_tool->core);
301
/* evil hack i'm thinking about... --mitch */
303
/* HALT means the current display is going to go away (TM),
304
* so try to find another display of the same image to make
305
* straight line drawing continue to work...
310
for (list = display_list; list; list = g_slist_next (list))
312
GimpDisplay *tmp_disp;
314
tmp_disp = (GimpDisplay *) list->data;
316
if (tmp_disp != gdisp && tmp_disp->gimage == gdisp->gimage)
318
tool->gdisp = tmp_disp;
330
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
228
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
367
265
gimp_paint_tool_button_press (GimpTool *tool,
368
266
GimpCoords *coords,
370
GdkModifierType state,
268
GdkModifierType state,
269
GimpDisplay *display)
373
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
374
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
375
GimpPaintOptions *paint_options;
271
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
272
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
273
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
274
GimpPaintCore *core = paint_tool->core;
377
275
GimpDrawable *drawable;
378
276
GdkDisplay *gdk_display;
379
277
GimpCoords curr_coords;
380
278
gint off_x, off_y;
382
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
384
core = paint_tool->core;
386
drawable = gimp_image_active_drawable (gdisp->gimage);
279
GError *error = NULL;
281
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
283
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
288
drawable = gimp_image_active_drawable (display->image);
388
290
curr_coords = *coords;
310
tool->display = display;
411
gdk_display = gtk_widget_get_display (gdisp->shell);
313
gdk_display = gtk_widget_get_display (display->shell);
413
core->use_pressure = (gimp_devices_get_current (gdisp->gimage->gimp) !=
315
core->use_pressure = (gimp_devices_get_current (display->image->gimp) !=
414
316
gdk_display_get_core_pointer (gdk_display));
416
if (! gimp_paint_core_start (core, drawable, paint_options, &curr_coords))
318
if (! gimp_paint_core_start (core, drawable, paint_options, &curr_coords,
321
gimp_tool_message (tool, display, error->message);
322
g_clear_error (&error);
419
if ((gdisp != tool->gdisp) || ! paint_tool->draw_line)
326
if ((display != tool->display) || ! paint_tool->draw_line)
421
328
/* if this is a new image, reinit the core vals */
440
347
gimp_paint_tool_round_line (core, hard, state);
443
/* let the parent class activate the tool */
444
GIMP_TOOL_CLASS (parent_class)->button_press (tool,
445
coords, time, state, gdisp);
447
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
350
/* chain up to activate the tool */
351
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
450
354
/* pause the current selection */
451
gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE);
355
gimp_image_selection_control (display->image, GIMP_SELECTION_PAUSE);
453
357
/* Let the specific painting function initialize itself */
454
358
gimp_paint_core_paint (core, drawable, paint_options,
465
369
GIMP_PAINT_STATE_MOTION, time);
468
gimp_projection_flush_now (gdisp->gimage->projection);
469
gimp_display_flush_now (gdisp);
372
gimp_projection_flush_now (display->image->projection);
373
gimp_display_flush_now (display);
471
gimp_draw_tool_start (draw_tool, gdisp);
375
gimp_draw_tool_start (draw_tool, display);
475
gimp_paint_tool_button_release (GimpTool *tool,
478
GdkModifierType state,
379
gimp_paint_tool_button_release (GimpTool *tool,
382
GdkModifierType state,
383
GimpButtonReleaseType release_type,
384
GimpDisplay *display)
481
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
482
GimpPaintOptions *paint_options;
386
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
387
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
388
GimpPaintCore *core = paint_tool->core;
484
389
GimpDrawable *drawable;
486
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
488
core = paint_tool->core;
490
drawable = gimp_image_active_drawable (gdisp->gimage);
391
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
393
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time,
399
drawable = gimp_image_active_drawable (display->image);
492
401
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
496
405
GIMP_PAINT_STATE_FINISH, time);
498
407
/* resume the current selection */
499
gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_RESUME);
408
gimp_image_selection_control (display->image, GIMP_SELECTION_RESUME);
501
410
/* chain up to halt the tool */
502
GIMP_TOOL_CLASS (parent_class)->button_release (tool,
503
coords, time, state, gdisp);
411
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
412
release_type, display);
505
if (state & GDK_BUTTON3_MASK)
414
if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
506
415
gimp_paint_core_cancel (core, drawable);
508
417
gimp_paint_core_finish (core, drawable);
510
gimp_image_flush (gdisp->gimage);
419
gimp_image_flush (display->image);
512
421
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
516
425
gimp_paint_tool_motion (GimpTool *tool,
517
426
GimpCoords *coords,
519
GdkModifierType state,
428
GdkModifierType state,
429
GimpDisplay *display)
522
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
523
GimpPaintOptions *paint_options;
431
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
432
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
433
GimpPaintCore *core = paint_tool->core;
525
434
GimpDrawable *drawable;
526
435
gint off_x, off_y;
528
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
530
core = paint_tool->core;
532
drawable = gimp_image_active_drawable (gdisp->gimage);
437
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
439
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state,
444
drawable = gimp_image_active_drawable (display->image);
534
446
core->cur_coords = *coords;
538
450
core->cur_coords.x -= off_x;
539
451
core->cur_coords.y -= off_y;
541
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, gdisp);
543
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
453
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state,
546
456
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
548
458
gimp_paint_core_interpolate (core, drawable, paint_options, time);
550
gimp_projection_flush_now (gdisp->gimage->projection);
551
gimp_display_flush_now (gdisp);
553
paint_tool->brush_x = coords->x;
554
paint_tool->brush_y = coords->y;
460
gimp_projection_flush_now (display->image->projection);
461
gimp_display_flush_now (display);
556
463
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
590
491
gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
591
492
GIMP_COLOR_OPTIONS (info->tool_options));
494
switch (GIMP_COLOR_TOOL (tool)->pick_mode)
496
case GIMP_COLOR_PICK_MODE_FOREGROUND:
497
gimp_tool_push_status (tool, display,
498
_("Click in any image to pick the "
499
"foreground color"));
502
case GIMP_COLOR_PICK_MODE_BACKGROUND:
503
gimp_tool_push_status (tool, display,
504
_("Click in any image to pick the "
505
"background color"));
596
515
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
597
gimp_color_tool_disable (GIMP_COLOR_TOOL (tool));
517
gimp_tool_pop_status (tool, display);
518
gimp_color_tool_disable (GIMP_COLOR_TOOL (tool));
603
525
gimp_paint_tool_oper_update (GimpTool *tool,
604
526
GimpCoords *coords,
605
527
GdkModifierType state,
529
GimpDisplay *display)
608
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
609
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
610
GimpPaintOptions *paint_options;
612
GimpDisplayShell *shell;
531
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
532
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
533
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
534
GimpPaintCore *core = paint_tool->core;
535
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
613
536
GimpDrawable *drawable;
615
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
617
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (draw_tool)))
538
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
619
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, gdisp);
540
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state,
623
core = paint_tool->core;
625
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
627
545
if (gimp_draw_tool_is_active (draw_tool))
628
546
gimp_draw_tool_stop (draw_tool);
630
gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
631
g_type_name (G_TYPE_FROM_INSTANCE (tool)));
548
gimp_tool_pop_status (tool, display);
634
tool->gdisp != gdisp &&
635
tool->gdisp->gimage == gdisp->gimage)
551
tool->display != display &&
552
tool->display->image == display->image)
637
554
/* if this is a different display, but the same image, HACK around
638
555
* in tool internals AFTER stopping the current draw_tool, so
672
589
dx = core->cur_coords.x - core->last_coords.x;
673
590
dy = core->cur_coords.y - core->last_coords.y;
592
status_help = gimp_suggest_modifiers (paint_tool->status_line,
593
GDK_CONTROL_MASK & ~state,
595
_("%s for constrained angles"),
675
598
/* show distance in statusbar */
676
599
if (shell->unit == GIMP_UNIT_PIXEL)
678
601
dist = sqrt (SQR (dx) + SQR (dy));
680
g_snprintf (status_str, sizeof (status_str), "%.1f %s",
603
gimp_tool_push_status (tool, display, "%.1f %s. %s",
604
dist, _("pixels"), status_help);
685
GimpImage *image = gdisp->gimage;
608
GimpImage *image = display->image;
686
609
gchar format_str[64];
688
g_snprintf (format_str, sizeof (format_str), "%%.%df %s",
611
g_snprintf (format_str, sizeof (format_str), "%%.%df %s. %%s",
689
612
_gimp_unit_get_digits (image->gimp, shell->unit),
690
613
_gimp_unit_get_symbol (image->gimp, shell->unit));
693
616
sqrt (SQR (dx / image->xresolution) +
694
617
SQR (dy / image->yresolution)));
696
g_snprintf (status_str, sizeof (status_str), format_str, dist);
619
gimp_tool_push_status (tool, display, format_str,
699
gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar),
700
g_type_name (G_TYPE_FROM_INSTANCE (tool)),
623
g_free (status_help);
703
625
paint_tool->draw_line = TRUE;
630
GdkModifierType modifiers = 0;
632
/* HACK: A paint tool may set status_ctrl to NULL to indicate that
633
* it ignores the Ctrl modifier (temporarily or permanently), so
634
* it should not be suggested. This is different from how
635
* gimp_suggest_modifiers() would interpret this parameter.
637
if (paint_tool->status_ctrl != NULL)
638
modifiers |= GDK_CONTROL_MASK;
640
/* suggest drawing lines only after the first point is set
642
if (display == tool->display)
643
modifiers |= GDK_SHIFT_MASK;
645
status = gimp_suggest_modifiers (paint_tool->status,
647
_("%s for a straight line"),
648
paint_tool->status_ctrl,
650
gimp_tool_push_status (tool, display, status);
707
653
paint_tool->draw_line = FALSE;
710
paint_tool->brush_x = coords->x;
711
paint_tool->brush_y = coords->y;
713
if (GIMP_IS_BRUSH_CORE (core))
715
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (core);
718
brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
720
if (brush_core->main_brush != brush)
721
gimp_brush_core_set_brush (brush_core, brush);
724
gimp_draw_tool_start (draw_tool, gdisp);
656
gimp_draw_tool_start (draw_tool, display);
727
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, gdisp);
659
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
766
699
core->cur_coords.y,
770
if (paint_tool->draw_brush && GIMP_IS_BRUSH_CORE (core))
772
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (core);
774
if (! brush_core->brush_bound_segs)
777
PixelRegion PR = { 0, };
779
mask = gimp_brush_get_mask (brush_core->main_brush);
781
PR.data = temp_buf_data (mask);
786
PR.bytes = mask->bytes;
787
PR.rowstride = PR.w * PR.bytes;
789
brush_core->brush_bound_segs =
790
find_mask_boundary (&PR, &brush_core->n_brush_bound_segs,
796
brush_core->brush_bound_width = mask->width;
797
brush_core->brush_bound_height = mask->height;
800
if (brush_core->brush_bound_segs)
802
GimpTool *tool = GIMP_TOOL (draw_tool);
803
GimpPaintOptions *paint_options;
804
gdouble brush_x, brush_y;
806
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
808
brush_x = (paint_tool->brush_x -
809
((gdouble) brush_core->brush_bound_width / 2.0));
810
brush_y = (paint_tool->brush_y -
811
((gdouble) brush_core->brush_bound_height / 2.0));
813
if (gimp_paint_options_get_brush_mode (paint_options) == GIMP_BRUSH_HARD)
815
#define EPSILON 0.000001
817
/* Add EPSILON before rounding since e.g.
818
* (5.0 - 0.5) may end up at (4.499999999....)
819
* due to floating point fnords
821
brush_x = RINT (brush_x + EPSILON);
822
brush_y = RINT (brush_y + EPSILON);
827
gimp_draw_tool_draw_boundary (draw_tool,
828
brush_core->brush_bound_segs,
829
brush_core->n_brush_bound_segs,
837
704
GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
841
gimp_paint_tool_cursor_update (GimpTool *tool,
843
GdkModifierType state,
846
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
848
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)) &&
849
! paint_tool->show_cursor)
851
gimp_tool_set_cursor (tool, gdisp,
853
GIMP_TOOL_CURSOR_NONE,
854
GIMP_CURSOR_MODIFIER_NONE);
859
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
863
gimp_paint_tool_color_picked (GimpColorTool *color_tool,
864
GimpColorPickState pick_state,
865
GimpImageType sample_type,
869
GimpTool *tool = GIMP_TOOL (color_tool);
873
GimpContext *context;
875
context = gimp_get_user_context (tool->gdisp->gimage->gimp);
877
switch (color_tool->pick_mode)
879
case GIMP_COLOR_PICK_MODE_NONE:
882
case GIMP_COLOR_PICK_MODE_FOREGROUND:
883
gimp_context_set_foreground (context, color);
886
case GIMP_COLOR_PICK_MODE_BACKGROUND:
887
gimp_context_set_background (context, color);
894
gimp_paint_tool_set_brush (GimpBrushCore *brush_core,
896
GimpPaintTool *paint_tool)
898
gimp_draw_tool_pause (GIMP_DRAW_TOOL (paint_tool));
902
gimp_paint_tool_set_brush_after (GimpBrushCore *brush_core,
904
GimpPaintTool *paint_tool)
906
gimp_draw_tool_resume (GIMP_DRAW_TOOL (paint_tool));
910
gimp_paint_tool_notify_brush (GimpDisplayConfig *config,
912
GimpPaintTool *paint_tool)
914
gimp_draw_tool_pause (GIMP_DRAW_TOOL (paint_tool));
916
paint_tool->show_cursor = config->show_paint_tool_cursor;
917
paint_tool->draw_brush = config->show_brush_outline;
919
gimp_draw_tool_resume (GIMP_DRAW_TOOL (paint_tool));