2001-02-27 13:21:12 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995-2001 Spencer Kimball, Peter Mattis, and others
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
|
|
|
|
#include "tools-types.h"
|
2001-11-12 22:45:58 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2001-11-01 05:20:09 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2001-05-10 06:34:59 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "gimpdrawtool.h"
|
2001-02-27 13:21:12 +08:00
|
|
|
|
|
|
|
|
2001-11-16 05:17:36 +08:00
|
|
|
static void gimp_draw_tool_class_init (GimpDrawToolClass *klass);
|
|
|
|
static void gimp_draw_tool_init (GimpDrawTool *draw_tool);
|
|
|
|
|
|
|
|
static void gimp_draw_tool_finalize (GObject *object);
|
|
|
|
|
|
|
|
static void gimp_draw_tool_control (GimpTool *tool,
|
|
|
|
ToolAction action,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
static inline void gimp_draw_tool_shift_to_north_west
|
|
|
|
(gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gint handle_width,
|
|
|
|
gint handle_height,
|
|
|
|
GtkAnchorType anchor,
|
|
|
|
gdouble *shifted_x,
|
|
|
|
gdouble *shifted_y);
|
|
|
|
static inline void gimp_draw_tool_shift_to_center
|
|
|
|
(gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gint handle_width,
|
|
|
|
gint handle_height,
|
|
|
|
GtkAnchorType anchor,
|
|
|
|
gdouble *shifted_x,
|
|
|
|
gdouble *shifted_y);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
|
|
|
|
2001-02-28 03:18:01 +08:00
|
|
|
static GimpToolClass *parent_class = NULL;
|
|
|
|
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-02-27 13:21:12 +08:00
|
|
|
gimp_draw_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
2001-02-27 13:21:12 +08:00
|
|
|
|
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-02-27 13:21:12 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpDrawToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_draw_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpDrawTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_draw_tool_init,
|
2001-02-27 13:21:12 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_TOOL,
|
|
|
|
"GimpDrawTool",
|
|
|
|
&tool_info, 0);
|
2001-02-27 13:21:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_draw_tool_class_init (GimpDrawToolClass *klass)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
GObjectClass *object_class;
|
|
|
|
GimpToolClass *tool_class;
|
2001-02-28 03:18:01 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
object_class = G_OBJECT_CLASS (klass);
|
|
|
|
tool_class = GIMP_TOOL_CLASS (klass);
|
2001-02-28 03:18:01 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
object_class->finalize = gimp_draw_tool_finalize;
|
2001-02-28 03:18:01 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_class->control = gimp_draw_tool_control;
|
2001-11-20 22:20:17 +08:00
|
|
|
|
|
|
|
klass->draw = NULL;
|
2001-02-27 13:21:12 +08:00
|
|
|
}
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_init (GimpDrawTool *draw_tool)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2002-02-07 19:33:01 +08:00
|
|
|
draw_tool->gdisp = NULL;
|
2001-11-12 22:45:58 +08:00
|
|
|
draw_tool->win = NULL;
|
|
|
|
draw_tool->gc = NULL;
|
2002-02-07 19:33:01 +08:00
|
|
|
|
|
|
|
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE;
|
2001-11-12 22:45:58 +08:00
|
|
|
draw_tool->paused_count = 0;
|
2002-02-07 19:33:01 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
draw_tool->line_width = 0;
|
|
|
|
draw_tool->line_style = GDK_LINE_SOLID;
|
|
|
|
draw_tool->cap_style = GDK_CAP_NOT_LAST;
|
|
|
|
draw_tool->join_style = GDK_JOIN_MITER;
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-02-28 03:18:01 +08:00
|
|
|
static void
|
2001-08-14 22:53:55 +08:00
|
|
|
gimp_draw_tool_finalize (GObject *object)
|
2001-02-28 03:18:01 +08:00
|
|
|
{
|
|
|
|
GimpDrawTool *draw_tool;
|
|
|
|
|
|
|
|
draw_tool = GIMP_DRAW_TOOL (object);
|
|
|
|
|
|
|
|
if (draw_tool->gc)
|
2001-08-14 22:53:55 +08:00
|
|
|
{
|
2001-08-30 09:09:58 +08:00
|
|
|
g_object_unref (G_OBJECT (draw_tool->gc));
|
2001-08-14 22:53:55 +08:00
|
|
|
draw_tool->gc = NULL;
|
|
|
|
}
|
2001-02-28 03:18:01 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-02-28 03:18:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-10-29 19:47:11 +08:00
|
|
|
gimp_draw_tool_control (GimpTool *tool,
|
|
|
|
ToolAction action,
|
|
|
|
GimpDisplay *gdisp)
|
2001-02-28 03:18:01 +08:00
|
|
|
{
|
|
|
|
GimpDrawTool *draw_tool;
|
|
|
|
|
|
|
|
draw_tool = GIMP_DRAW_TOOL (tool);
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case PAUSE:
|
|
|
|
gimp_draw_tool_pause (draw_tool);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RESUME:
|
|
|
|
gimp_draw_tool_resume (draw_tool);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HALT:
|
|
|
|
gimp_draw_tool_stop (draw_tool);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2001-08-14 22:53:55 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
|
2001-02-28 03:18:01 +08:00
|
|
|
}
|
|
|
|
|
2001-02-27 13:21:12 +08:00
|
|
|
void
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_start (GimpDrawTool *draw_tool,
|
2002-02-03 20:10:23 +08:00
|
|
|
GimpDisplay *gdisp)
|
2001-02-27 13:21:12 +08:00
|
|
|
{
|
2002-02-03 20:10:23 +08:00
|
|
|
GimpDisplayShell *shell;
|
|
|
|
GdkColor fg, bg;
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
2002-02-03 20:10:23 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
|
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
gimp_draw_tool_stop (draw_tool);
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
draw_tool->gdisp = gdisp;
|
2002-02-03 20:10:23 +08:00
|
|
|
draw_tool->win = shell->canvas->window;
|
2002-02-07 19:33:01 +08:00
|
|
|
draw_tool->gc = gdk_gc_new (draw_tool->win);
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
gdk_gc_set_function (draw_tool->gc, GDK_INVERT);
|
2001-02-27 13:21:12 +08:00
|
|
|
fg.pixel = 0xFFFFFFFF;
|
|
|
|
bg.pixel = 0x00000000;
|
2001-11-12 22:45:58 +08:00
|
|
|
gdk_gc_set_foreground (draw_tool->gc, &fg);
|
|
|
|
gdk_gc_set_background (draw_tool->gc, &bg);
|
|
|
|
gdk_gc_set_line_attributes (draw_tool->gc,
|
|
|
|
draw_tool->line_width,
|
|
|
|
draw_tool->line_style,
|
|
|
|
draw_tool->cap_style,
|
|
|
|
draw_tool->join_style);
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-11-20 22:20:17 +08:00
|
|
|
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool);
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-11-16 05:17:36 +08:00
|
|
|
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_VISIBLE;
|
2001-02-27 13:21:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_stop (GimpDrawTool *draw_tool)
|
2001-02-27 13:21:12 +08:00
|
|
|
{
|
2001-11-12 22:45:58 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
if (draw_tool->draw_state == GIMP_DRAW_TOOL_STATE_VISIBLE)
|
|
|
|
{
|
|
|
|
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool);
|
|
|
|
}
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE;
|
|
|
|
draw_tool->paused_count = 0;
|
|
|
|
|
|
|
|
draw_tool->gdisp = NULL;
|
|
|
|
draw_tool->win = NULL;
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
if (draw_tool->gc)
|
|
|
|
{
|
|
|
|
g_object_unref (G_OBJECT (draw_tool->gc));
|
|
|
|
draw_tool->gc = NULL;
|
|
|
|
}
|
2001-02-27 13:21:12 +08:00
|
|
|
}
|
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
void
|
|
|
|
gimp_draw_tool_pause (GimpDrawTool *draw_tool)
|
|
|
|
{
|
2001-11-22 21:01:26 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
if (draw_tool->paused_count == 0)
|
|
|
|
{
|
2001-11-16 05:17:36 +08:00
|
|
|
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE;
|
2001-11-12 22:45:58 +08:00
|
|
|
|
2001-11-20 22:20:17 +08:00
|
|
|
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool);
|
2001-11-12 22:45:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
draw_tool->paused_count++;
|
|
|
|
}
|
2001-02-27 13:21:12 +08:00
|
|
|
|
|
|
|
void
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_resume (GimpDrawTool *draw_tool)
|
2001-02-27 13:21:12 +08:00
|
|
|
{
|
2001-11-12 22:45:58 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
|
|
|
|
|
|
|
if (draw_tool->paused_count > 0)
|
2001-02-27 13:21:12 +08:00
|
|
|
{
|
2002-02-07 19:33:01 +08:00
|
|
|
draw_tool->paused_count--;
|
2001-02-28 03:18:01 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
if (draw_tool->paused_count == 0)
|
|
|
|
{
|
|
|
|
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_VISIBLE;
|
|
|
|
|
|
|
|
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-02-17 19:46:39 +08:00
|
|
|
g_warning ("gimp_draw_tool_resume(): "
|
|
|
|
"called with draw_tool->paused_count == 0");
|
2001-02-27 13:21:12 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
gdouble
|
|
|
|
gimp_draw_tool_calc_distance (GimpDrawTool *draw_tool,
|
|
|
|
GimpDisplay *gdisp,
|
|
|
|
gdouble x1,
|
|
|
|
gdouble y1,
|
|
|
|
gdouble x2,
|
|
|
|
gdouble y2)
|
|
|
|
{
|
2001-11-16 05:17:36 +08:00
|
|
|
gdouble tx1, ty1;
|
|
|
|
gdouble tx2, ty2;
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), 0.0);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), 0.0);
|
|
|
|
|
|
|
|
gdisplay_transform_coords_f (gdisp, x1, y1, &tx1, &ty1, FALSE);
|
|
|
|
gdisplay_transform_coords_f (gdisp, x2, y2, &tx2, &ty2, FALSE);
|
|
|
|
|
|
|
|
return sqrt (SQR (tx2 - tx1) + SQR (ty2 - ty1));
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_draw_tool_in_radius (GimpDrawTool *draw_tool,
|
|
|
|
GimpDisplay *gdisp,
|
|
|
|
gdouble x1,
|
|
|
|
gdouble y1,
|
|
|
|
gdouble x2,
|
|
|
|
gdouble y2,
|
|
|
|
gint radius)
|
|
|
|
{
|
2001-11-16 05:17:36 +08:00
|
|
|
gdouble tx1, ty1;
|
|
|
|
gdouble tx2, ty2;
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), FALSE);
|
|
|
|
|
|
|
|
gdisplay_transform_coords_f (gdisp, x1, y1, &tx1, &ty1, FALSE);
|
|
|
|
gdisplay_transform_coords_f (gdisp, x2, y2, &tx2, &ty2, FALSE);
|
|
|
|
|
|
|
|
return (SQR (tx2 - tx1) + SQR (ty2 - ty1)) < SQR (radius);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_draw_tool_draw_line (GimpDrawTool *draw_tool,
|
|
|
|
gdouble x1,
|
|
|
|
gdouble y1,
|
|
|
|
gdouble x2,
|
|
|
|
gdouble y2,
|
|
|
|
gboolean use_offsets)
|
|
|
|
{
|
|
|
|
GimpDisplayShell *shell;
|
|
|
|
gdouble tx1, ty1;
|
|
|
|
gdouble tx2, ty2;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (draw_tool->gdisp->shell);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
x1, y1,
|
|
|
|
&tx1, &ty1,
|
|
|
|
use_offsets);
|
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
x2, y2,
|
|
|
|
&tx2, &ty2,
|
|
|
|
use_offsets);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
gdk_draw_line (draw_tool->win,
|
|
|
|
draw_tool->gc,
|
|
|
|
RINT (tx1), RINT (ty1),
|
|
|
|
RINT (tx2), RINT (ty2));
|
|
|
|
}
|
2001-02-27 13:21:12 +08:00
|
|
|
|
|
|
|
void
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_draw_rectangle (GimpDrawTool *draw_tool,
|
|
|
|
gboolean filled,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gdouble width,
|
|
|
|
gdouble height,
|
|
|
|
gboolean use_offsets)
|
2001-02-27 13:21:12 +08:00
|
|
|
{
|
2001-11-12 22:45:58 +08:00
|
|
|
GimpDisplayShell *shell;
|
|
|
|
gdouble tx1, ty1;
|
|
|
|
gdouble tx2, ty2;
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (draw_tool->gdisp->shell);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
tx1 = MIN (x, x + width);
|
|
|
|
ty1 = MIN (y, y + height);
|
|
|
|
tx2 = MAX (x, x + width);
|
|
|
|
ty2 = MAX (y, y + height);
|
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
tx1, ty1,
|
|
|
|
&tx1, &ty1,
|
|
|
|
use_offsets);
|
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
tx2, ty2,
|
|
|
|
&tx2, &ty2,
|
|
|
|
use_offsets);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
gdk_draw_rectangle (draw_tool->win,
|
|
|
|
draw_tool->gc,
|
|
|
|
filled,
|
|
|
|
RINT (tx1), RINT (ty1),
|
|
|
|
RINT (tx2 - tx1), RINT (ty2 - ty1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_draw_tool_draw_arc (GimpDrawTool *draw_tool,
|
|
|
|
gboolean filled,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gdouble width,
|
|
|
|
gdouble height,
|
|
|
|
gint angle1,
|
|
|
|
gint angle2,
|
|
|
|
gboolean use_offsets)
|
|
|
|
{
|
|
|
|
GimpDisplayShell *shell;
|
|
|
|
gdouble tx1, ty1;
|
|
|
|
gdouble tx2, ty2;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (draw_tool->gdisp->shell);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
tx1 = MIN (x, x + width);
|
|
|
|
ty1 = MIN (y, y + height);
|
|
|
|
tx2 = MAX (x, x + width);
|
|
|
|
ty2 = MAX (y, y + height);
|
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
tx1, ty1,
|
|
|
|
&tx1, &ty1,
|
|
|
|
use_offsets);
|
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
tx2, ty2,
|
|
|
|
&tx2, &ty2,
|
|
|
|
use_offsets);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
gdk_draw_arc (draw_tool->win,
|
|
|
|
draw_tool->gc,
|
|
|
|
filled,
|
|
|
|
RINT (tx1), RINT (ty1),
|
|
|
|
RINT (tx2 - tx1), RINT (ty2 - ty1),
|
|
|
|
angle1, angle2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-11-16 05:17:36 +08:00
|
|
|
gimp_draw_tool_draw_rectangle_by_anchor (GimpDrawTool *draw_tool,
|
|
|
|
gboolean filled,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkAnchorType anchor,
|
|
|
|
gboolean use_offsets)
|
2001-11-12 22:45:58 +08:00
|
|
|
{
|
|
|
|
GimpDisplayShell *shell;
|
|
|
|
gdouble tx, ty;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (draw_tool->gdisp->shell);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
x, y,
|
|
|
|
&tx, &ty,
|
|
|
|
use_offsets);
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-11-16 05:17:36 +08:00
|
|
|
gimp_draw_tool_shift_to_north_west (tx, ty,
|
|
|
|
width, height,
|
|
|
|
anchor,
|
|
|
|
&tx, &ty);
|
|
|
|
|
|
|
|
if (filled)
|
|
|
|
{
|
|
|
|
width++;
|
|
|
|
height++;
|
|
|
|
}
|
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
gdk_draw_rectangle (draw_tool->win,
|
|
|
|
draw_tool->gc,
|
|
|
|
filled,
|
2001-11-16 05:17:36 +08:00
|
|
|
RINT (tx), RINT (ty),
|
2001-11-12 22:45:58 +08:00
|
|
|
width, height);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
2001-04-07 22:55:39 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
void
|
2001-11-16 05:17:36 +08:00
|
|
|
gimp_draw_tool_draw_arc_by_anchor (GimpDrawTool *draw_tool,
|
|
|
|
gboolean filled,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gint radius_x,
|
|
|
|
gint radius_y,
|
|
|
|
gint angle1,
|
|
|
|
gint angle2,
|
|
|
|
GtkAnchorType anchor,
|
|
|
|
gboolean use_offsets)
|
2001-11-12 22:45:58 +08:00
|
|
|
{
|
|
|
|
GimpDisplayShell *shell;
|
|
|
|
gdouble tx, ty;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (draw_tool->gdisp->shell);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
x, y,
|
|
|
|
&tx, &ty,
|
|
|
|
use_offsets);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
2001-11-16 05:17:36 +08:00
|
|
|
/* well... */
|
|
|
|
radius_x *= 2;
|
|
|
|
radius_y *= 2;
|
|
|
|
|
|
|
|
gimp_draw_tool_shift_to_north_west (tx, ty,
|
|
|
|
radius_x, radius_y,
|
|
|
|
anchor,
|
|
|
|
&tx, &ty);
|
|
|
|
|
|
|
|
if (filled)
|
|
|
|
{
|
|
|
|
radius_x += 1;
|
|
|
|
radius_y += 1;
|
|
|
|
}
|
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
gdk_draw_arc (draw_tool->win,
|
|
|
|
draw_tool->gc,
|
|
|
|
filled,
|
2001-11-16 05:17:36 +08:00
|
|
|
RINT (tx), RINT (ty),
|
|
|
|
radius_x, radius_y,
|
2001-11-12 22:45:58 +08:00
|
|
|
angle1, angle2);
|
|
|
|
}
|
2001-04-07 22:55:39 +08:00
|
|
|
|
|
|
|
void
|
2001-11-16 05:17:36 +08:00
|
|
|
gimp_draw_tool_draw_cross_by_anchor (GimpDrawTool *draw_tool,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkAnchorType anchor,
|
|
|
|
gboolean use_offsets)
|
2001-04-07 22:55:39 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
2001-11-12 22:45:58 +08:00
|
|
|
gdouble tx, ty;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (draw_tool->gdisp->shell);
|
2001-04-07 22:55:39 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
x, y,
|
|
|
|
&tx, &ty,
|
|
|
|
use_offsets);
|
2001-04-07 22:55:39 +08:00
|
|
|
|
2001-11-16 05:17:36 +08:00
|
|
|
gimp_draw_tool_shift_to_center (tx, ty,
|
|
|
|
width, height,
|
|
|
|
anchor,
|
|
|
|
&tx, &ty);
|
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
gdk_draw_line (draw_tool->win,
|
|
|
|
draw_tool->gc,
|
2001-11-16 05:17:36 +08:00
|
|
|
RINT (tx), RINT (ty) - (height >> 1),
|
|
|
|
RINT (tx), RINT (ty) + (height >> 1));
|
2001-11-12 22:45:58 +08:00
|
|
|
gdk_draw_line (draw_tool->win,
|
|
|
|
draw_tool->gc,
|
2001-11-16 05:17:36 +08:00
|
|
|
RINT (tx) - (width >> 1), RINT (ty),
|
|
|
|
RINT (tx) + (width >> 1), RINT (ty));
|
2001-11-12 22:45:58 +08:00
|
|
|
}
|
2001-04-07 22:55:39 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
void
|
|
|
|
gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool,
|
|
|
|
GimpHandleType type,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
2001-11-16 05:17:36 +08:00
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkAnchorType anchor,
|
2001-11-12 22:45:58 +08:00
|
|
|
gboolean use_offsets)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
2001-04-07 22:55:39 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
switch (type)
|
2001-11-01 05:20:09 +08:00
|
|
|
{
|
2001-11-12 22:45:58 +08:00
|
|
|
case GIMP_HANDLE_SQUARE:
|
2001-11-16 05:17:36 +08:00
|
|
|
gimp_draw_tool_draw_rectangle_by_anchor (draw_tool,
|
|
|
|
FALSE,
|
2001-11-12 22:45:58 +08:00
|
|
|
x, y,
|
2001-11-16 05:17:36 +08:00
|
|
|
width,
|
|
|
|
height,
|
|
|
|
anchor,
|
|
|
|
use_offsets);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_HANDLE_FILLED_SQUARE:
|
|
|
|
gimp_draw_tool_draw_rectangle_by_anchor (draw_tool,
|
|
|
|
TRUE,
|
|
|
|
x, y,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
anchor,
|
2001-11-12 22:45:58 +08:00
|
|
|
use_offsets);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_HANDLE_CIRCLE:
|
2001-11-16 05:17:36 +08:00
|
|
|
gimp_draw_tool_draw_arc_by_anchor (draw_tool,
|
|
|
|
FALSE,
|
|
|
|
x, y,
|
|
|
|
width >> 1,
|
|
|
|
height >> 1,
|
|
|
|
0, 360 * 64,
|
|
|
|
anchor,
|
|
|
|
use_offsets);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_HANDLE_FILLED_CIRCLE:
|
|
|
|
gimp_draw_tool_draw_arc_by_anchor (draw_tool,
|
|
|
|
TRUE,
|
2001-11-12 22:45:58 +08:00
|
|
|
x, y,
|
2001-11-16 05:17:36 +08:00
|
|
|
width >> 1,
|
|
|
|
height >> 1,
|
2001-11-12 22:45:58 +08:00
|
|
|
0, 360 * 64,
|
2001-11-16 05:17:36 +08:00
|
|
|
anchor,
|
2001-11-12 22:45:58 +08:00
|
|
|
use_offsets);
|
|
|
|
break;
|
|
|
|
|
2001-11-16 05:17:36 +08:00
|
|
|
case GIMP_HANDLE_CROSS:
|
|
|
|
gimp_draw_tool_draw_cross_by_anchor (draw_tool,
|
|
|
|
x, y,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
anchor,
|
|
|
|
use_offsets);
|
|
|
|
break;
|
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
default:
|
2001-11-16 05:17:36 +08:00
|
|
|
g_warning ("%s: invalid handle type %d", G_GNUC_PRETTY_FUNCTION, type);
|
2001-11-12 22:45:58 +08:00
|
|
|
break;
|
2001-11-01 05:20:09 +08:00
|
|
|
}
|
2001-04-07 22:55:39 +08:00
|
|
|
}
|
|
|
|
|
2001-11-16 05:17:36 +08:00
|
|
|
gboolean
|
|
|
|
gimp_draw_tool_on_handle (GimpDrawTool *draw_tool,
|
|
|
|
GimpDisplay *gdisp,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
GimpHandleType type,
|
|
|
|
gdouble handle_x,
|
|
|
|
gdouble handle_y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkAnchorType anchor,
|
|
|
|
gboolean use_offsets)
|
|
|
|
{
|
|
|
|
gdouble tx, ty;
|
|
|
|
gdouble handle_tx, handle_ty;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), 0.0);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), 0.0);
|
|
|
|
|
|
|
|
gdisplay_transform_coords_f (gdisp, x, y, &tx, &ty, use_offsets);
|
|
|
|
gdisplay_transform_coords_f (gdisp,
|
|
|
|
handle_x, handle_y,
|
|
|
|
&handle_tx, &handle_ty,
|
|
|
|
use_offsets);
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case GIMP_HANDLE_SQUARE:
|
|
|
|
case GIMP_HANDLE_FILLED_SQUARE:
|
|
|
|
case GIMP_HANDLE_CROSS:
|
|
|
|
gimp_draw_tool_shift_to_north_west (handle_tx, handle_ty,
|
|
|
|
width, height,
|
|
|
|
anchor,
|
|
|
|
&handle_tx, &handle_ty);
|
|
|
|
|
|
|
|
return (tx == CLAMP (tx, handle_tx, handle_tx + width) &&
|
|
|
|
ty == CLAMP (ty, handle_ty, handle_ty + height));
|
|
|
|
|
|
|
|
case GIMP_HANDLE_CIRCLE:
|
|
|
|
case GIMP_HANDLE_FILLED_CIRCLE:
|
|
|
|
gimp_draw_tool_shift_to_center (handle_tx, handle_ty,
|
|
|
|
width, height,
|
|
|
|
anchor,
|
|
|
|
&handle_tx, &handle_ty);
|
|
|
|
|
|
|
|
/* FIXME */
|
|
|
|
if (width != height)
|
2001-11-22 22:28:39 +08:00
|
|
|
width = (width + height) / 2;
|
|
|
|
|
|
|
|
width /= 2;
|
2001-11-16 05:17:36 +08:00
|
|
|
|
|
|
|
return ((SQR (handle_tx - tx) + SQR (handle_ty - ty)) < SQR (width));
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_warning ("%s: invalid handle type %d", G_GNUC_PRETTY_FUNCTION, type);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2001-04-07 22:55:39 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool,
|
2001-11-01 05:20:09 +08:00
|
|
|
gdouble *points,
|
|
|
|
gint npoints,
|
|
|
|
gint filled)
|
2001-04-07 22:55:39 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
|
|
|
GdkPoint *coords;
|
|
|
|
gint i;
|
|
|
|
gdouble sx, sy;
|
2001-04-07 22:55:39 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (draw_tool->gdisp->shell);
|
2001-04-07 22:55:39 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
coords = g_new (GdkPoint, npoints);
|
|
|
|
|
|
|
|
for (i = 0; i < npoints ; i++)
|
|
|
|
{
|
2002-02-07 19:33:01 +08:00
|
|
|
gdisplay_transform_coords_f (draw_tool->gdisp,
|
|
|
|
points[i*2], points[i*2+1],
|
|
|
|
&sx, &sy,
|
|
|
|
TRUE);
|
2001-11-01 05:20:09 +08:00
|
|
|
coords[i].x = ROUND (sx);
|
|
|
|
coords[i].y = ROUND (sy);
|
|
|
|
}
|
2001-04-07 22:55:39 +08:00
|
|
|
|
|
|
|
if (filled)
|
2001-11-01 05:20:09 +08:00
|
|
|
{
|
2002-02-07 19:33:01 +08:00
|
|
|
gdk_draw_polygon (draw_tool->win,
|
2001-11-01 05:20:09 +08:00
|
|
|
draw_tool->gc, TRUE,
|
|
|
|
coords, npoints);
|
|
|
|
}
|
2001-04-07 22:55:39 +08:00
|
|
|
else
|
2001-11-01 05:20:09 +08:00
|
|
|
{
|
2002-02-07 19:33:01 +08:00
|
|
|
gdk_draw_lines (draw_tool->win,
|
2001-11-01 05:20:09 +08:00
|
|
|
draw_tool->gc,
|
|
|
|
coords, npoints);
|
|
|
|
}
|
2001-04-07 22:55:39 +08:00
|
|
|
|
|
|
|
g_free (coords);
|
|
|
|
}
|
2001-11-16 05:17:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
gimp_draw_tool_shift_to_north_west (gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gint handle_width,
|
|
|
|
gint handle_height,
|
|
|
|
GtkAnchorType anchor,
|
|
|
|
gdouble *shifted_x,
|
|
|
|
gdouble *shifted_y)
|
|
|
|
{
|
|
|
|
switch (anchor)
|
|
|
|
{
|
|
|
|
case GTK_ANCHOR_CENTER:
|
|
|
|
x -= (handle_width >> 1);
|
|
|
|
y -= (handle_height >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_NORTH:
|
|
|
|
x -= (handle_width >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_NORTH_WEST:
|
|
|
|
/* nothing, this is the default */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_NORTH_EAST:
|
|
|
|
x -= handle_width;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_SOUTH:
|
|
|
|
x -= (handle_width >> 1);
|
|
|
|
y -= handle_height;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_SOUTH_WEST:
|
|
|
|
y -= handle_height;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_SOUTH_EAST:
|
|
|
|
x -= handle_width;
|
|
|
|
y -= handle_height;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_WEST:
|
|
|
|
y -= (handle_height >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_EAST:
|
|
|
|
x -= handle_width;
|
|
|
|
y -= (handle_height >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (shifted_x)
|
|
|
|
*shifted_x = x;
|
|
|
|
|
|
|
|
if (shifted_y)
|
|
|
|
*shifted_y = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
gimp_draw_tool_shift_to_center (gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gint handle_width,
|
|
|
|
gint handle_height,
|
|
|
|
GtkAnchorType anchor,
|
|
|
|
gdouble *shifted_x,
|
|
|
|
gdouble *shifted_y)
|
|
|
|
{
|
|
|
|
switch (anchor)
|
|
|
|
{
|
|
|
|
case GTK_ANCHOR_CENTER:
|
|
|
|
/* nothing, this is the default */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_NORTH:
|
|
|
|
y += (handle_height >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_NORTH_WEST:
|
|
|
|
x += (handle_width >> 1);
|
|
|
|
y += (handle_height >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_NORTH_EAST:
|
|
|
|
x -= (handle_width >> 1);
|
|
|
|
y += (handle_height >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_SOUTH:
|
|
|
|
y -= (handle_height >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_SOUTH_WEST:
|
|
|
|
x += (handle_width >> 1);
|
|
|
|
y -= (handle_height >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_SOUTH_EAST:
|
|
|
|
x -= (handle_width >> 1);
|
|
|
|
y -= (handle_height >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_WEST:
|
|
|
|
x += (handle_width >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ANCHOR_EAST:
|
|
|
|
x -= (handle_width >> 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (shifted_x)
|
|
|
|
*shifted_x = x;
|
|
|
|
|
|
|
|
if (shifted_y)
|
|
|
|
*shifted_y = y;
|
|
|
|
}
|