2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* 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 2 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, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2002-05-03 20:45:22 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2003-08-20 01:20:05 +08:00
|
|
|
#include "config/gimpdisplayconfig.h"
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "core/gimp.h"
|
2003-08-20 02:04:40 +08:00
|
|
|
#include "core/gimpbrush.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2001-12-02 05:02:34 +08:00
|
|
|
#include "core/gimptoolinfo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2004-05-26 04:41:09 +08:00
|
|
|
#include "paint/gimpbrushcore.h"
|
2003-02-05 22:39:40 +08:00
|
|
|
#include "paint/gimppaintoptions.h"
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
#include "gimpbrushtool.h"
|
2003-04-16 00:05:52 +08:00
|
|
|
#include "gimptoolcontrol.h"
|
2001-03-08 09:07:03 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
static GObject * gimp_brush_tool_constructor (GType type,
|
2003-08-31 00:41:35 +08:00
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params);
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
static void gimp_brush_tool_motion (GimpTool *tool,
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
2004-06-05 07:08:29 +08:00
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display);
|
2006-08-16 05:46:22 +08:00
|
|
|
static void gimp_brush_tool_oper_update (GimpTool *tool,
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpCoords *coords,
|
2004-06-05 07:08:29 +08:00
|
|
|
GdkModifierType state,
|
2006-03-25 22:23:09 +08:00
|
|
|
gboolean proximity,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display);
|
2006-08-16 05:46:22 +08:00
|
|
|
static void gimp_brush_tool_cursor_update (GimpTool *tool,
|
2004-06-05 07:08:29 +08:00
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display);
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
static void gimp_brush_tool_draw (GimpDrawTool *draw_tool);
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
static void gimp_brush_tool_brush_changed (GimpContext *context,
|
2006-05-07 05:10:32 +08:00
|
|
|
GimpBrush *brush,
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool);
|
2006-11-16 23:11:27 +08:00
|
|
|
static void gimp_brush_tool_brush_scaled (GimpPaintOptions *options,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpBrushTool *brush_tool);
|
2006-08-16 05:46:22 +08:00
|
|
|
static void gimp_brush_tool_set_brush (GimpBrushCore *brush_core,
|
2004-06-23 20:19:28 +08:00
|
|
|
GimpBrush *brush,
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool);
|
|
|
|
static void gimp_brush_tool_set_brush_after(GimpBrushCore *brush_core,
|
2004-06-23 20:19:28 +08:00
|
|
|
GimpBrush *brush,
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool);
|
|
|
|
static void gimp_brush_tool_notify_brush (GimpDisplayConfig *config,
|
2003-08-20 01:20:05 +08:00
|
|
|
GParamSpec *pspec,
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool);
|
2003-08-20 01:20:05 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
G_DEFINE_TYPE (GimpBrushTool, gimp_brush_tool, GIMP_TYPE_PAINT_TOOL)
|
2001-02-28 03:18:01 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
#define parent_class gimp_brush_tool_parent_class
|
2001-02-27 13:21:12 +08:00
|
|
|
|
|
|
|
|
2001-02-28 03:18:01 +08:00
|
|
|
static void
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_class_init (GimpBrushToolClass *klass)
|
2001-02-27 13:21:12 +08:00
|
|
|
{
|
2006-05-28 22:13:44 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
2001-02-28 03:18:01 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
object_class->constructor = gimp_brush_tool_constructor;
|
2002-02-13 22:50:37 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
tool_class->motion = gimp_brush_tool_motion;
|
|
|
|
tool_class->oper_update = gimp_brush_tool_oper_update;
|
|
|
|
tool_class->cursor_update = gimp_brush_tool_cursor_update;
|
2001-02-28 03:18:01 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
draw_tool_class->draw = gimp_brush_tool_draw;
|
2001-02-27 13:21:12 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-28 03:18:01 +08:00
|
|
|
static void
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_init (GimpBrushTool *brush_tool)
|
2001-02-28 03:18:01 +08:00
|
|
|
{
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (brush_tool);
|
2002-02-05 19:35:03 +08:00
|
|
|
|
2006-11-17 21:06:00 +08:00
|
|
|
gimp_tool_control_set_action_value_2 (tool->control,
|
|
|
|
"tools/tools-paint-brush-scale-set");
|
2005-03-05 03:05:40 +08:00
|
|
|
gimp_tool_control_set_action_value_3 (tool->control,
|
|
|
|
"context/context-brush-aspect-set");
|
|
|
|
gimp_tool_control_set_action_value_4 (tool->control,
|
|
|
|
"context/context-brush-angle-set");
|
|
|
|
gimp_tool_control_set_action_object_1 (tool->control,
|
|
|
|
"context/context-brush-select-set");
|
2002-06-17 01:13:39 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
brush_tool->show_cursor = TRUE;
|
|
|
|
brush_tool->draw_brush = TRUE;
|
|
|
|
brush_tool->brush_x = 0.0;
|
|
|
|
brush_tool->brush_y = 0.0;
|
2003-08-31 00:41:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GObject *
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_constructor (GType type,
|
2003-08-31 00:41:35 +08:00
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params)
|
|
|
|
{
|
|
|
|
GObject *object;
|
|
|
|
GimpTool *tool;
|
|
|
|
GimpPaintTool *paint_tool;
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool;
|
2003-08-31 00:41:35 +08:00
|
|
|
|
|
|
|
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
|
|
|
|
|
|
|
tool = GIMP_TOOL (object);
|
|
|
|
paint_tool = GIMP_PAINT_TOOL (object);
|
2006-08-16 05:46:22 +08:00
|
|
|
brush_tool = GIMP_BRUSH_TOOL (object);
|
2003-08-31 00:41:35 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
g_assert (GIMP_IS_BRUSH_CORE (paint_tool->core));
|
2003-08-31 00:41:35 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
brush_tool->show_cursor =
|
2004-06-05 07:08:29 +08:00
|
|
|
GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_paint_tool_cursor;
|
2006-08-16 05:46:22 +08:00
|
|
|
brush_tool->draw_brush =
|
2003-08-31 00:41:35 +08:00
|
|
|
GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_brush_outline;
|
2003-08-20 01:20:05 +08:00
|
|
|
|
2004-06-05 07:08:29 +08:00
|
|
|
g_signal_connect_object (tool->tool_info->gimp->config,
|
|
|
|
"notify::show-paint-tool-cursor",
|
2006-08-16 05:46:22 +08:00
|
|
|
G_CALLBACK (gimp_brush_tool_notify_brush),
|
|
|
|
brush_tool, 0);
|
2003-08-31 00:41:35 +08:00
|
|
|
g_signal_connect_object (tool->tool_info->gimp->config,
|
|
|
|
"notify::show-brush-outline",
|
2006-08-16 05:46:22 +08:00
|
|
|
G_CALLBACK (gimp_brush_tool_notify_brush),
|
|
|
|
brush_tool, 0);
|
2003-08-31 00:41:35 +08:00
|
|
|
|
2006-09-06 02:25:31 +08:00
|
|
|
g_signal_connect_object (gimp_tool_get_options (tool), "brush-changed",
|
2006-08-16 05:46:22 +08:00
|
|
|
G_CALLBACK (gimp_brush_tool_brush_changed),
|
|
|
|
brush_tool, 0);
|
2006-11-16 23:11:27 +08:00
|
|
|
g_signal_connect_object (gimp_tool_get_options (tool), "notify::brush-scale",
|
|
|
|
G_CALLBACK (gimp_brush_tool_brush_scaled),
|
|
|
|
brush_tool, 0);
|
2003-08-31 00:41:35 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
g_signal_connect (paint_tool->core, "set-brush",
|
|
|
|
G_CALLBACK (gimp_brush_tool_set_brush),
|
|
|
|
brush_tool);
|
|
|
|
g_signal_connect_after (paint_tool->core, "set-brush",
|
|
|
|
G_CALLBACK (gimp_brush_tool_set_brush_after),
|
|
|
|
brush_tool);
|
2004-06-23 20:19:28 +08:00
|
|
|
|
2003-08-31 00:41:35 +08:00
|
|
|
return object;
|
2002-02-13 22:50:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_motion (GimpTool *tool,
|
2001-11-09 03:14:51 +08:00
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
2006-04-12 20:49:29 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
1999-05-13 19:12:32 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, display);
|
2003-07-11 00:01:45 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
|
2003-06-05 23:43:49 +08:00
|
|
|
{
|
2006-08-16 05:46:22 +08:00
|
|
|
brush_tool->brush_x = coords->x;
|
|
|
|
brush_tool->brush_y = coords->y;
|
2003-06-05 23:43:49 +08:00
|
|
|
}
|
2006-09-13 19:04:49 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
2003-06-05 23:43:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_oper_update (GimpTool *tool,
|
2003-06-05 23:43:49 +08:00
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
2006-03-25 22:23:09 +08:00
|
|
|
gboolean proximity,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-09-06 02:25:31 +08:00
|
|
|
GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (tool);
|
|
|
|
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
2000-03-05 08:06:11 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state,
|
|
|
|
proximity, display);
|
1999-05-15 08:02:47 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)) &&
|
|
|
|
gimp_image_active_drawable (display->image) && proximity)
|
2002-02-19 01:00:09 +08:00
|
|
|
{
|
2006-09-13 19:04:49 +08:00
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
|
|
|
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
|
|
|
|
GimpBrush *brush;
|
2006-08-16 05:46:22 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
brush_tool->brush_x = coords->x;
|
|
|
|
brush_tool->brush_y = coords->y;
|
2004-06-23 20:19:28 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
|
2004-06-23 20:19:28 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
if (brush_core->main_brush != brush)
|
|
|
|
gimp_brush_core_set_brush (brush_core, brush);
|
2002-02-05 01:43:01 +08:00
|
|
|
}
|
2006-09-13 19:04:49 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
2006-08-16 05:46:22 +08:00
|
|
|
}
|
2001-02-25 03:29:47 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
static void
|
|
|
|
gimp_brush_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (tool);
|
|
|
|
|
2006-09-12 22:24:10 +08:00
|
|
|
if (! brush_tool->show_cursor &&
|
|
|
|
! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)) &&
|
2006-09-13 19:04:49 +08:00
|
|
|
gimp_tool_control_get_cursor_modifier (tool->control) !=
|
|
|
|
GIMP_CURSOR_MODIFIER_BAD)
|
2006-08-16 05:46:22 +08:00
|
|
|
{
|
|
|
|
gimp_tool_set_cursor (tool, display,
|
|
|
|
GIMP_CURSOR_NONE,
|
|
|
|
GIMP_TOOL_CURSOR_NONE,
|
|
|
|
GIMP_CURSOR_MODIFIER_NONE);
|
|
|
|
}
|
2006-09-12 22:24:10 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool,
|
|
|
|
coords, state, display);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-02-28 03:18:01 +08:00
|
|
|
static void
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_draw (GimpDrawTool *draw_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-09-13 19:04:49 +08:00
|
|
|
GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (draw_tool);
|
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
|
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (draw_tool)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (brush_tool->draw_brush)
|
2002-02-07 19:33:01 +08:00
|
|
|
{
|
2006-09-13 19:04:49 +08:00
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (draw_tool);
|
|
|
|
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (draw_tool);
|
|
|
|
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
|
2003-07-11 00:01:45 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
if (! brush_core->brush_bound_segs && brush_core->main_brush)
|
2003-07-11 00:01:45 +08:00
|
|
|
{
|
2006-11-16 23:11:27 +08:00
|
|
|
gimp_brush_core_create_bound_segs (brush_core, paint_options);
|
2006-09-13 19:04:49 +08:00
|
|
|
}
|
2003-07-11 00:01:45 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
if (brush_core->brush_bound_segs)
|
|
|
|
{
|
|
|
|
gdouble brush_x, brush_y;
|
2003-07-14 22:50:41 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
brush_x = (brush_tool->brush_x -
|
|
|
|
((gdouble) brush_core->brush_bound_width / 2.0));
|
|
|
|
brush_y = (brush_tool->brush_y -
|
|
|
|
((gdouble) brush_core->brush_bound_height / 2.0));
|
2003-07-14 22:50:41 +08:00
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
if (gimp_paint_options_get_brush_mode (paint_options) ==
|
|
|
|
GIMP_BRUSH_HARD)
|
|
|
|
{
|
2003-07-17 00:19:16 +08:00
|
|
|
#define EPSILON 0.000001
|
|
|
|
|
2006-09-13 19:04:49 +08:00
|
|
|
/* Add EPSILON before rounding since e.g.
|
|
|
|
* (5.0 - 0.5) may end up at (4.499999999....)
|
|
|
|
* due to floating point fnords
|
|
|
|
*/
|
|
|
|
brush_x = RINT (brush_x + EPSILON);
|
|
|
|
brush_y = RINT (brush_y + EPSILON);
|
2003-07-17 00:19:16 +08:00
|
|
|
|
|
|
|
#undef EPSILON
|
2003-07-11 00:01:45 +08:00
|
|
|
}
|
2006-09-13 19:04:49 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_draw_boundary (draw_tool,
|
|
|
|
brush_core->brush_bound_segs,
|
|
|
|
brush_core->n_brush_bound_segs,
|
|
|
|
brush_x,
|
|
|
|
brush_y,
|
|
|
|
FALSE);
|
2003-07-11 00:01:45 +08:00
|
|
|
}
|
2002-02-07 19:33:01 +08:00
|
|
|
}
|
2004-06-05 07:08:29 +08:00
|
|
|
}
|
|
|
|
|
2006-05-07 05:10:32 +08:00
|
|
|
static void
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_brush_changed (GimpContext *context,
|
2006-05-07 05:10:32 +08:00
|
|
|
GimpBrush *brush,
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool)
|
2006-05-07 05:10:32 +08:00
|
|
|
{
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (brush_tool);
|
2006-05-07 05:10:32 +08:00
|
|
|
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
|
|
|
|
|
|
|
|
if (brush_core->main_brush != brush)
|
|
|
|
gimp_brush_core_set_brush (brush_core, brush);
|
|
|
|
}
|
|
|
|
|
2006-11-16 23:11:27 +08:00
|
|
|
static void
|
|
|
|
gimp_brush_tool_brush_scaled (GimpPaintOptions *options,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpBrushTool *brush_tool)
|
|
|
|
{
|
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (brush_tool);
|
|
|
|
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
|
|
|
|
|
|
|
|
gimp_brush_core_set_brush (brush_core, brush_core->main_brush);
|
|
|
|
}
|
|
|
|
|
2004-06-23 20:19:28 +08:00
|
|
|
static void
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_set_brush (GimpBrushCore *brush_core,
|
2004-06-23 20:19:28 +08:00
|
|
|
GimpBrush *brush,
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool)
|
2004-06-23 20:19:28 +08:00
|
|
|
{
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (brush_tool));
|
2004-06-23 20:19:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_set_brush_after (GimpBrushCore *brush_core,
|
2004-06-23 20:19:28 +08:00
|
|
|
GimpBrush *brush,
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool)
|
2004-06-23 20:19:28 +08:00
|
|
|
{
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (brush_tool));
|
2004-06-23 20:19:28 +08:00
|
|
|
}
|
|
|
|
|
2003-08-20 01:20:05 +08:00
|
|
|
static void
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_brush_tool_notify_brush (GimpDisplayConfig *config,
|
2003-08-20 01:20:05 +08:00
|
|
|
GParamSpec *pspec,
|
2006-08-16 05:46:22 +08:00
|
|
|
GimpBrushTool *brush_tool)
|
2003-08-20 01:20:05 +08:00
|
|
|
{
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (brush_tool));
|
2003-08-20 01:20:05 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
brush_tool->show_cursor = config->show_paint_tool_cursor;
|
|
|
|
brush_tool->draw_brush = config->show_brush_outline;
|
2003-08-20 01:20:05 +08:00
|
|
|
|
2006-08-16 05:46:22 +08:00
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (brush_tool));
|
2003-08-20 01:20:05 +08:00
|
|
|
}
|