1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* 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
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "widgets-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-14 05:51:20 +08:00
|
|
|
#include "gimpcursor.h"
|
2000-03-02 03:32:41 +08:00
|
|
|
|
2004-06-03 20:36:02 +08:00
|
|
|
#include "cursors/gimp-tool-cursors.h"
|
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
/* standard gimp cursors */
|
2004-06-05 07:08:29 +08:00
|
|
|
#include "cursors/xbm/cursor-none.xbm"
|
2004-06-04 20:10:13 +08:00
|
|
|
#include "cursors/xbm/cursor-mouse.xbm"
|
|
|
|
#include "cursors/xbm/cursor-mouse-mask.xbm"
|
|
|
|
#include "cursors/xbm/cursor-crosshair.xbm"
|
|
|
|
#include "cursors/xbm/cursor-crosshair-mask.xbm"
|
|
|
|
#include "cursors/xbm/cursor-crosshair-small.xbm"
|
|
|
|
#include "cursors/xbm/cursor-crosshair-small-mask.xbm"
|
|
|
|
#include "cursors/xbm/cursor-bad.xbm"
|
|
|
|
#include "cursors/xbm/cursor-bad-mask.xbm"
|
|
|
|
#include "cursors/xbm/cursor-zoom.xbm"
|
|
|
|
#include "cursors/xbm/cursor-zoom-mask.xbm"
|
|
|
|
#include "cursors/xbm/cursor-color-picker.xbm"
|
|
|
|
#include "cursors/xbm/cursor-color-picker-mask.xbm"
|
1999-05-05 17:10:35 +08:00
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
/* tool cursors */
|
2004-06-04 20:10:13 +08:00
|
|
|
#include "cursors/xbm/tool-rect-select.xbm"
|
|
|
|
#include "cursors/xbm/tool-rect-select-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-ellipse-select.xbm"
|
|
|
|
#include "cursors/xbm/tool-ellipse-select-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-free-select.xbm"
|
|
|
|
#include "cursors/xbm/tool-free-select-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-fuzzy-select.xbm"
|
|
|
|
#include "cursors/xbm/tool-fuzzy-select-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-paths.xbm"
|
|
|
|
#include "cursors/xbm/tool-paths-mask.xbm"
|
2005-08-10 05:22:11 +08:00
|
|
|
#include "cursors/xbm/tool-paths-anchor.xbm"
|
|
|
|
#include "cursors/xbm/tool-paths-anchor-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-paths-control.xbm"
|
|
|
|
#include "cursors/xbm/tool-paths-control-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-paths-segment.xbm"
|
|
|
|
#include "cursors/xbm/tool-paths-segment-mask.xbm"
|
2004-06-04 20:10:13 +08:00
|
|
|
#include "cursors/xbm/tool-iscissors.xbm"
|
|
|
|
#include "cursors/xbm/tool-iscissors-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-move.xbm"
|
|
|
|
#include "cursors/xbm/tool-move-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-zoom.xbm"
|
|
|
|
#include "cursors/xbm/tool-zoom-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-crop.xbm"
|
|
|
|
#include "cursors/xbm/tool-crop-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-resize.xbm"
|
|
|
|
#include "cursors/xbm/tool-resize-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-rotate.xbm"
|
|
|
|
#include "cursors/xbm/tool-rotate-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-shear.xbm"
|
|
|
|
#include "cursors/xbm/tool-shear-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-perspective.xbm"
|
|
|
|
#include "cursors/xbm/tool-perspective-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-flip-horizontal.xbm"
|
|
|
|
#include "cursors/xbm/tool-flip-horizontal-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-flip-vertical.xbm"
|
|
|
|
#include "cursors/xbm/tool-flip-vertical-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-text.xbm"
|
|
|
|
#include "cursors/xbm/tool-text-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-color-picker.xbm"
|
|
|
|
#include "cursors/xbm/tool-color-picker-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-bucket-fill.xbm"
|
|
|
|
#include "cursors/xbm/tool-bucket-fill-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-blend.xbm"
|
|
|
|
#include "cursors/xbm/tool-blend-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-pencil.xbm"
|
|
|
|
#include "cursors/xbm/tool-pencil-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-paintbrush.xbm"
|
|
|
|
#include "cursors/xbm/tool-paintbrush-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-eraser.xbm"
|
|
|
|
#include "cursors/xbm/tool-eraser-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-airbrush.xbm"
|
|
|
|
#include "cursors/xbm/tool-airbrush-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-clone.xbm"
|
|
|
|
#include "cursors/xbm/tool-clone-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-blur.xbm"
|
|
|
|
#include "cursors/xbm/tool-blur-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-ink.xbm"
|
|
|
|
#include "cursors/xbm/tool-ink-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-dodge.xbm"
|
|
|
|
#include "cursors/xbm/tool-dodge-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-burn.xbm"
|
|
|
|
#include "cursors/xbm/tool-burn-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-smudge.xbm"
|
|
|
|
#include "cursors/xbm/tool-smudge-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-measure.xbm"
|
|
|
|
#include "cursors/xbm/tool-measure-mask.xbm"
|
|
|
|
#include "cursors/xbm/tool-hand.xbm"
|
|
|
|
#include "cursors/xbm/tool-hand-mask.xbm"
|
2001-02-25 03:29:47 +08:00
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
/* cursor modifiers */
|
2004-06-04 20:10:13 +08:00
|
|
|
#include "cursors/xbm/modifier-plus.xbm"
|
|
|
|
#include "cursors/xbm/modifier-plus-mask.xbm"
|
|
|
|
#include "cursors/xbm/modifier-minus.xbm"
|
|
|
|
#include "cursors/xbm/modifier-minus-mask.xbm"
|
|
|
|
#include "cursors/xbm/modifier-intersect.xbm"
|
|
|
|
#include "cursors/xbm/modifier-intersect-mask.xbm"
|
|
|
|
#include "cursors/xbm/modifier-move.xbm"
|
|
|
|
#include "cursors/xbm/modifier-move-mask.xbm"
|
|
|
|
#include "cursors/xbm/modifier-resize.xbm"
|
|
|
|
#include "cursors/xbm/modifier-resize-mask.xbm"
|
|
|
|
#include "cursors/xbm/modifier-control.xbm"
|
|
|
|
#include "cursors/xbm/modifier-control-mask.xbm"
|
|
|
|
#include "cursors/xbm/modifier-anchor.xbm"
|
|
|
|
#include "cursors/xbm/modifier-anchor-mask.xbm"
|
|
|
|
#include "cursors/xbm/modifier-foreground.xbm"
|
|
|
|
#include "cursors/xbm/modifier-foreground-mask.xbm"
|
|
|
|
#include "cursors/xbm/modifier-background.xbm"
|
|
|
|
#include "cursors/xbm/modifier-background-mask.xbm"
|
|
|
|
#include "cursors/xbm/modifier-pattern.xbm"
|
|
|
|
#include "cursors/xbm/modifier-pattern-mask.xbm"
|
2005-08-19 05:35:06 +08:00
|
|
|
#include "cursors/xbm/modifier-join.xbm"
|
|
|
|
#include "cursors/xbm/modifier-join-mask.xbm"
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2000-03-26 02:17:01 +08:00
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
typedef struct _GimpCursor GimpCursor;
|
2001-05-14 05:51:20 +08:00
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
struct _GimpCursor
|
2001-05-14 05:51:20 +08:00
|
|
|
{
|
2004-06-10 22:43:08 +08:00
|
|
|
guchar *bits;
|
|
|
|
guchar *mask_bits;
|
|
|
|
gint width, height;
|
|
|
|
gint x_hot, y_hot;
|
2004-06-03 20:36:02 +08:00
|
|
|
const guint8 *pixbuf_data;
|
2004-06-10 22:43:08 +08:00
|
|
|
|
|
|
|
GdkBitmap *bitmap;
|
|
|
|
GdkBitmap *mask;
|
2004-06-03 20:36:02 +08:00
|
|
|
GdkPixbuf *pixbuf;
|
2001-05-14 05:51:20 +08:00
|
|
|
};
|
2000-03-26 02:17:01 +08:00
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
static GimpCursor gimp_cursors[] =
|
1999-05-05 17:10:35 +08:00
|
|
|
{
|
2002-11-18 07:13:26 +08:00
|
|
|
/* these have to match up with enum GimpCursorType in widgets-enums.h */
|
|
|
|
|
2004-06-05 07:08:29 +08:00
|
|
|
{
|
|
|
|
cursor_none_bits, cursor_none_bits,
|
|
|
|
cursor_none_width, cursor_none_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
cursor_none_x_hot, cursor_none_y_hot,
|
|
|
|
cursor_none, NULL, NULL, NULL
|
2004-06-05 07:08:29 +08:00
|
|
|
},
|
2000-03-02 03:32:41 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
cursor_mouse_bits, cursor_mouse_mask_bits,
|
|
|
|
cursor_mouse_width, cursor_mouse_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
cursor_mouse_x_hot, cursor_mouse_y_hot,
|
|
|
|
cursor_mouse,
|
2000-03-02 03:32:41 +08:00
|
|
|
},
|
2000-06-06 08:28:28 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
cursor_crosshair_bits, cursor_crosshair_mask_bits,
|
|
|
|
cursor_crosshair_width, cursor_crosshair_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
cursor_crosshair_x_hot, cursor_crosshair_y_hot,
|
|
|
|
cursor_crosshair, NULL, NULL, NULL
|
2000-06-06 08:28:28 +08:00
|
|
|
},
|
2000-06-09 20:31:19 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
cursor_crosshair_small_bits, cursor_crosshair_small_mask_bits,
|
|
|
|
cursor_crosshair_small_width, cursor_crosshair_small_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
cursor_crosshair_small_x_hot, cursor_crosshair_small_y_hot,
|
|
|
|
cursor_crosshair_small, NULL, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
},
|
2000-03-02 03:32:41 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
cursor_bad_bits, cursor_bad_mask_bits,
|
|
|
|
cursor_bad_width, cursor_bad_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
cursor_bad_x_hot, cursor_bad_y_hot,
|
|
|
|
cursor_bad, NULL, NULL, NULL
|
2000-03-02 03:32:41 +08:00
|
|
|
},
|
2000-06-14 18:59:16 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
cursor_zoom_bits, cursor_zoom_mask_bits,
|
|
|
|
cursor_zoom_width, cursor_zoom_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
cursor_zoom_x_hot, cursor_zoom_y_hot,
|
|
|
|
cursor_zoom, NULL, NULL, NULL
|
2000-06-14 18:59:16 +08:00
|
|
|
},
|
2000-03-02 03:32:41 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
cursor_color_picker_bits, cursor_color_picker_mask_bits,
|
|
|
|
cursor_color_picker_width, cursor_color_picker_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
cursor_color_picker_x_hot, cursor_color_picker_y_hot,
|
|
|
|
cursor_color_picker, NULL, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
static GimpCursor gimp_tool_cursors[] =
|
2000-06-09 20:31:19 +08:00
|
|
|
{
|
2002-11-18 07:13:26 +08:00
|
|
|
/* these have to match up with enum GimpToolCursorType in widgets-enums.h */
|
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
{
|
|
|
|
NULL, NULL,
|
|
|
|
0, 0,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
NULL, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_rect_select_bits, tool_rect_select_mask_bits,
|
|
|
|
tool_rect_select_width, tool_rect_select_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_rect_select, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_ellipse_select_bits, tool_ellipse_select_mask_bits,
|
|
|
|
tool_ellipse_select_width, tool_ellipse_select_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_ellipse_select, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_free_select_bits, tool_free_select_mask_bits,
|
|
|
|
tool_free_select_width, tool_free_select_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_free_select, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_fuzzy_select_bits, tool_fuzzy_select_mask_bits,
|
|
|
|
tool_fuzzy_select_width, tool_fuzzy_select_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_fuzzy_select, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_paths_bits, tool_paths_mask_bits,
|
|
|
|
tool_paths_width, tool_paths_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_paths, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
2005-08-10 05:22:11 +08:00
|
|
|
{
|
|
|
|
tool_paths_anchor_bits, tool_paths_anchor_mask_bits,
|
|
|
|
tool_paths_anchor_width, tool_paths_anchor_height,
|
|
|
|
0, 0,
|
|
|
|
tool_paths_anchor, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
tool_paths_control_bits, tool_paths_control_mask_bits,
|
|
|
|
tool_paths_control_width, tool_paths_control_height,
|
|
|
|
0, 0,
|
|
|
|
tool_paths_control, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
tool_paths_segment_bits, tool_paths_segment_mask_bits,
|
|
|
|
tool_paths_segment_width, tool_paths_segment_height,
|
|
|
|
0, 0,
|
|
|
|
tool_paths_segment, NULL, NULL, NULL
|
|
|
|
},
|
2001-02-25 03:29:47 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_iscissors_bits, tool_iscissors_mask_bits,
|
|
|
|
tool_iscissors_width, tool_iscissors_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_iscissors, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_move_bits, tool_move_mask_bits,
|
|
|
|
tool_move_width, tool_move_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_move, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_zoom_bits, tool_zoom_mask_bits,
|
|
|
|
tool_zoom_width, tool_zoom_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_zoom, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_crop_bits, tool_crop_mask_bits,
|
|
|
|
tool_crop_width, tool_crop_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_crop, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_resize_bits, tool_resize_mask_bits,
|
|
|
|
tool_resize_width, tool_resize_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_resize, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_rotate_bits, tool_rotate_mask_bits,
|
|
|
|
tool_rotate_width, tool_rotate_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_rotate, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_shear_bits, tool_shear_mask_bits,
|
|
|
|
tool_shear_width, tool_shear_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_shear, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_perspective_bits, tool_perspective_mask_bits,
|
|
|
|
tool_perspective_width, tool_perspective_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_perspective, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_flip_horizontal_bits, tool_flip_horizontal_mask_bits,
|
|
|
|
tool_flip_horizontal_width, tool_flip_horizontal_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_flip_horizontal, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_flip_vertical_bits, tool_flip_vertical_mask_bits,
|
|
|
|
tool_flip_vertical_width, tool_flip_vertical_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_flip_vertical, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_text_bits, tool_text_mask_bits,
|
|
|
|
tool_text_width, tool_text_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_text, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_color_picker_bits, tool_color_picker_mask_bits,
|
|
|
|
tool_color_picker_width, tool_color_picker_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_color_picker, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_bucket_fill_bits, tool_bucket_fill_mask_bits,
|
|
|
|
tool_bucket_fill_width, tool_bucket_fill_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_bucket_fill, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_blend_bits, tool_blend_mask_bits,
|
|
|
|
tool_blend_width, tool_blend_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_blend, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_pencil_bits, tool_pencil_mask_bits,
|
|
|
|
tool_pencil_width, tool_pencil_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_pencil, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_paintbrush_bits, tool_paintbrush_mask_bits,
|
|
|
|
tool_paintbrush_width, tool_paintbrush_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_paintbrush, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_airbrush_bits, tool_airbrush_mask_bits,
|
|
|
|
tool_airbrush_width, tool_airbrush_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_airbrush, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_ink_bits, tool_ink_mask_bits,
|
|
|
|
tool_ink_width, tool_ink_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_ink, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_clone_bits, tool_clone_mask_bits,
|
|
|
|
tool_clone_width, tool_clone_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_clone, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_eraser_bits, tool_eraser_mask_bits,
|
|
|
|
tool_eraser_width, tool_eraser_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_eraser, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_smudge_bits, tool_smudge_mask_bits,
|
|
|
|
tool_smudge_width, tool_smudge_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_smudge, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_blur_bits, tool_blur_mask_bits,
|
|
|
|
tool_blur_width, tool_blur_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_blur, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_dodge_bits, tool_dodge_mask_bits,
|
|
|
|
tool_dodge_width, tool_dodge_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_dodge, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_burn_bits, tool_burn_mask_bits,
|
|
|
|
tool_burn_width, tool_burn_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_burn, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_measure_bits, tool_measure_mask_bits,
|
|
|
|
tool_measure_width, tool_measure_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_measure, NULL, NULL, NULL
|
2003-09-17 18:42:26 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
tool_hand_bits, tool_hand_mask_bits,
|
|
|
|
tool_hand_width, tool_hand_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
tool_hand, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
}
|
2000-06-09 20:31:19 +08:00
|
|
|
};
|
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
static GimpCursor gimp_cursor_modifiers[] =
|
2000-06-09 20:31:19 +08:00
|
|
|
{
|
2002-11-18 07:13:26 +08:00
|
|
|
/* these have to match up with enum GimpCursorModifier in widgets-enums.h */
|
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
{
|
|
|
|
NULL, NULL,
|
|
|
|
0, 0,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
NULL, NULL, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
2000-06-09 20:31:19 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_plus_bits, modifier_plus_mask_bits,
|
|
|
|
modifier_plus_width, modifier_plus_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_plus, NULL, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_minus_bits, modifier_minus_mask_bits,
|
|
|
|
modifier_minus_width, modifier_minus_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_minus, NULL, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_intersect_bits, modifier_intersect_mask_bits,
|
|
|
|
modifier_intersect_width, modifier_intersect_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_intersect, NULL, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_move_bits, modifier_move_mask_bits,
|
|
|
|
modifier_move_width, modifier_move_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_move, NULL, NULL, NULL
|
2000-06-14 18:59:16 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_resize_bits, modifier_resize_mask_bits,
|
|
|
|
modifier_resize_width, modifier_resize_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_resize, NULL, NULL, NULL
|
2000-06-14 18:59:16 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_control_bits, modifier_control_mask_bits,
|
|
|
|
modifier_control_width, modifier_control_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_control, NULL, NULL, NULL
|
2000-06-14 18:59:16 +08:00
|
|
|
},
|
2000-06-14 21:57:17 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_anchor_bits, modifier_anchor_mask_bits,
|
|
|
|
modifier_anchor_width, modifier_anchor_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_anchor, NULL, NULL, NULL
|
2000-06-14 21:57:17 +08:00
|
|
|
},
|
2000-07-30 00:12:40 +08:00
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_foreground_bits, modifier_foreground_mask_bits,
|
|
|
|
modifier_foreground_width, modifier_foreground_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_foreground, NULL, NULL, NULL
|
2000-07-30 00:12:40 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_background_bits, modifier_background_mask_bits,
|
|
|
|
modifier_background_width, modifier_background_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_background, NULL, NULL, NULL
|
2000-07-30 00:12:40 +08:00
|
|
|
},
|
|
|
|
{
|
2004-06-04 20:10:13 +08:00
|
|
|
modifier_pattern_bits, modifier_pattern_mask_bits,
|
|
|
|
modifier_pattern_width, modifier_pattern_height,
|
2004-06-10 22:43:08 +08:00
|
|
|
0, 0,
|
|
|
|
modifier_pattern, NULL, NULL, NULL
|
2005-08-19 05:35:06 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
modifier_join_bits, modifier_join_mask_bits,
|
|
|
|
modifier_join_width, modifier_join_height,
|
|
|
|
0, 0,
|
|
|
|
modifier_join, NULL, NULL, NULL
|
2000-03-02 03:32:41 +08:00
|
|
|
}
|
1999-05-05 17:10:35 +08:00
|
|
|
};
|
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
static GdkBitmap *
|
2004-06-10 22:43:08 +08:00
|
|
|
get_cursor_bitmap (GimpCursor *cursor)
|
1999-05-05 17:10:35 +08:00
|
|
|
{
|
2004-06-10 22:43:08 +08:00
|
|
|
if (! cursor->bitmap)
|
2005-08-10 05:27:36 +08:00
|
|
|
cursor->bitmap = gdk_bitmap_create_from_data (NULL,
|
|
|
|
(const gchar *) cursor->bits,
|
2004-06-10 22:43:08 +08:00
|
|
|
cursor->width,
|
|
|
|
cursor->height);
|
|
|
|
g_return_val_if_fail (cursor->bitmap != NULL, NULL);
|
1999-05-05 17:10:35 +08:00
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
return cursor->bitmap;
|
2004-06-05 03:03:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GdkBitmap *
|
2004-06-10 22:43:08 +08:00
|
|
|
get_cursor_mask (GimpCursor *cursor)
|
2004-06-05 03:03:49 +08:00
|
|
|
{
|
2004-06-10 22:43:08 +08:00
|
|
|
if (! cursor->mask)
|
2005-08-10 05:27:36 +08:00
|
|
|
cursor->mask = gdk_bitmap_create_from_data (NULL,
|
|
|
|
(const gchar *) cursor->mask_bits,
|
2004-06-10 22:43:08 +08:00
|
|
|
cursor->width,
|
|
|
|
cursor->height);
|
|
|
|
g_return_val_if_fail (cursor->mask != NULL, NULL);
|
2004-06-05 03:03:49 +08:00
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
return cursor->mask;
|
2000-06-09 20:31:19 +08:00
|
|
|
}
|
1999-05-05 17:10:35 +08:00
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
static const GdkPixbuf *
|
2004-06-10 22:43:08 +08:00
|
|
|
get_cursor_pixbuf (GimpCursor *cursor)
|
2004-06-03 20:36:02 +08:00
|
|
|
{
|
2004-06-10 22:43:08 +08:00
|
|
|
if (! cursor->pixbuf)
|
|
|
|
cursor->pixbuf = gdk_pixbuf_new_from_inline (-1, cursor->pixbuf_data,
|
|
|
|
FALSE, NULL);
|
|
|
|
g_return_val_if_fail (cursor->pixbuf != NULL, NULL);
|
2004-06-03 20:36:02 +08:00
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
return cursor->pixbuf;
|
2004-06-03 20:36:02 +08:00
|
|
|
}
|
|
|
|
|
2004-06-04 20:10:13 +08:00
|
|
|
GdkCursor *
|
|
|
|
gimp_cursor_new (GdkDisplay *display,
|
2004-06-13 10:08:54 +08:00
|
|
|
GimpCursorFormat cursor_format,
|
2004-06-04 20:10:13 +08:00
|
|
|
GimpCursorType cursor_type,
|
|
|
|
GimpToolCursorType tool_cursor,
|
|
|
|
GimpCursorModifier modifier)
|
2004-06-03 20:36:02 +08:00
|
|
|
{
|
2004-06-10 22:43:08 +08:00
|
|
|
GdkCursor *cursor;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
GimpCursor *bmcursor = NULL;
|
|
|
|
GimpCursor *bmmodifier = NULL;
|
|
|
|
GimpCursor *bmtool = NULL;
|
2004-06-03 20:36:02 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
2004-06-05 07:08:29 +08:00
|
|
|
g_return_val_if_fail (cursor_type < GIMP_CURSOR_LAST, NULL);
|
2004-06-03 20:36:02 +08:00
|
|
|
|
|
|
|
if (cursor_type <= GDK_LAST_CURSOR)
|
|
|
|
return gdk_cursor_new_for_display (display, cursor_type);
|
|
|
|
|
2004-06-05 07:08:29 +08:00
|
|
|
g_return_val_if_fail (cursor_type >= GIMP_CURSOR_NONE, NULL);
|
2004-06-03 20:36:02 +08:00
|
|
|
|
|
|
|
/* allow the small tool cursor only with the standard mouse,
|
|
|
|
* the small crosshair and the bad cursor
|
|
|
|
*/
|
2004-06-05 07:08:29 +08:00
|
|
|
if (cursor_type != GIMP_CURSOR_MOUSE &&
|
|
|
|
cursor_type != GIMP_CURSOR_CROSSHAIR_SMALL &&
|
|
|
|
cursor_type != GIMP_CURSOR_BAD)
|
2004-06-03 20:36:02 +08:00
|
|
|
{
|
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_NONE;
|
|
|
|
}
|
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
/* don't allow anything with the empty cursor
|
|
|
|
*/
|
|
|
|
if (cursor_type == GIMP_CURSOR_NONE)
|
|
|
|
{
|
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_NONE;
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_NONE;
|
|
|
|
}
|
|
|
|
|
2004-06-03 20:36:02 +08:00
|
|
|
/* prepare the main cursor */
|
|
|
|
|
2004-06-05 07:08:29 +08:00
|
|
|
cursor_type -= GIMP_CURSOR_NONE;
|
2004-06-03 20:36:02 +08:00
|
|
|
bmcursor = &gimp_cursors[cursor_type];
|
|
|
|
|
|
|
|
/* prepare the tool cursor */
|
|
|
|
|
2004-06-05 07:08:29 +08:00
|
|
|
if (tool_cursor >= GIMP_TOOL_CURSOR_LAST)
|
2004-06-03 22:03:54 +08:00
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_NONE;
|
2004-06-03 20:36:02 +08:00
|
|
|
|
|
|
|
if (tool_cursor != GIMP_TOOL_CURSOR_NONE)
|
2004-06-10 22:43:08 +08:00
|
|
|
bmtool = &gimp_tool_cursors[tool_cursor];
|
2004-06-03 20:36:02 +08:00
|
|
|
|
|
|
|
/* prepare the cursor modifier */
|
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
if (modifier >= GIMP_CURSOR_MODIFIER_LAST)
|
2004-06-03 22:03:54 +08:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_NONE;
|
2004-06-03 20:36:02 +08:00
|
|
|
|
|
|
|
if (modifier != GIMP_CURSOR_MODIFIER_NONE)
|
2004-06-10 22:43:08 +08:00
|
|
|
bmmodifier = &gimp_cursor_modifiers[modifier];
|
2004-06-03 20:36:02 +08:00
|
|
|
|
2004-06-13 10:08:54 +08:00
|
|
|
if (cursor_format != GIMP_CURSOR_FORMAT_BITMAP &&
|
|
|
|
gdk_display_supports_cursor_alpha (display) &&
|
2004-06-04 20:10:13 +08:00
|
|
|
gdk_display_supports_cursor_color (display))
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
pixbuf = gdk_pixbuf_copy (get_cursor_pixbuf (bmcursor));
|
2004-06-04 20:10:13 +08:00
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
width = gdk_pixbuf_get_width (pixbuf);
|
|
|
|
height = gdk_pixbuf_get_height (pixbuf);
|
2004-06-04 20:10:13 +08:00
|
|
|
|
|
|
|
if (bmmodifier)
|
2004-06-05 03:03:49 +08:00
|
|
|
gdk_pixbuf_composite (get_cursor_pixbuf (bmmodifier), pixbuf,
|
|
|
|
0, 0, width, height,
|
|
|
|
0.0, 0.0, 1.0, 1.0,
|
2004-06-13 10:08:54 +08:00
|
|
|
GDK_INTERP_NEAREST, 200);
|
2004-06-04 20:10:13 +08:00
|
|
|
|
|
|
|
if (bmtool)
|
2004-06-05 03:03:49 +08:00
|
|
|
gdk_pixbuf_composite (get_cursor_pixbuf (bmtool), pixbuf,
|
|
|
|
0, 0, width, height,
|
|
|
|
0.0, 0.0, 1.0, 1.0,
|
2004-06-13 10:08:54 +08:00
|
|
|
GDK_INTERP_NEAREST, 200);
|
|
|
|
|
2004-06-04 20:10:13 +08:00
|
|
|
cursor = gdk_cursor_new_from_pixbuf (display, pixbuf,
|
|
|
|
bmcursor->x_hot,
|
|
|
|
bmcursor->y_hot);
|
|
|
|
g_object_unref (pixbuf);
|
2004-06-03 20:36:02 +08:00
|
|
|
}
|
2004-06-04 20:10:13 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GdkBitmap *bitmap;
|
|
|
|
GdkBitmap *mask;
|
|
|
|
static GdkGC *gc = NULL;
|
|
|
|
static GdkColor fg, bg;
|
2004-06-03 20:36:02 +08:00
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
if (! gc)
|
2004-06-04 20:10:13 +08:00
|
|
|
{
|
2004-06-10 22:43:08 +08:00
|
|
|
GdkColor color;
|
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
gc = gdk_gc_new (get_cursor_bitmap (bmcursor));
|
2004-06-03 20:36:02 +08:00
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
color.pixel = 1;
|
|
|
|
gdk_gc_set_foreground (gc, &color);
|
|
|
|
|
2004-06-04 20:10:13 +08:00
|
|
|
/* should have a way to configure the mouse colors */
|
|
|
|
gdk_color_parse ("#FFFFFF", &bg);
|
|
|
|
gdk_color_parse ("#000000", &fg);
|
|
|
|
}
|
2004-06-03 20:36:02 +08:00
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
gdk_drawable_get_size (get_cursor_bitmap (bmcursor), &width, &height);
|
2004-06-03 20:36:02 +08:00
|
|
|
|
2004-06-04 20:10:13 +08:00
|
|
|
bitmap = gdk_pixmap_new (NULL, width, height, 1);
|
|
|
|
mask = gdk_pixmap_new (NULL, width, height, 1);
|
2004-06-03 20:36:02 +08:00
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
gdk_draw_drawable (bitmap, gc, get_cursor_bitmap (bmcursor),
|
2004-06-04 20:10:13 +08:00
|
|
|
0, 0, 0, 0, width, height);
|
2004-06-10 22:43:08 +08:00
|
|
|
gdk_draw_drawable (mask, gc, get_cursor_mask (bmcursor),
|
|
|
|
0, 0, 0, 0, width, height);
|
2004-06-04 20:10:13 +08:00
|
|
|
|
|
|
|
if (bmmodifier)
|
|
|
|
{
|
2004-06-05 03:03:49 +08:00
|
|
|
gdk_gc_set_clip_mask (gc, get_cursor_bitmap (bmmodifier));
|
|
|
|
gdk_draw_drawable (bitmap, gc, get_cursor_bitmap (bmmodifier),
|
2004-06-04 20:10:13 +08:00
|
|
|
0, 0, 0, 0, width, height);
|
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
gdk_gc_set_clip_mask (gc, get_cursor_mask (bmmodifier));
|
|
|
|
gdk_draw_drawable (mask, gc, get_cursor_mask (bmmodifier),
|
2004-06-04 20:10:13 +08:00
|
|
|
0, 0, 0, 0, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bmtool)
|
|
|
|
{
|
2004-06-10 22:43:08 +08:00
|
|
|
gdk_gc_set_clip_mask (gc, get_cursor_bitmap (bmtool));
|
|
|
|
gdk_draw_drawable (bitmap, gc, get_cursor_bitmap (bmtool),
|
|
|
|
0, 0, 0, 0, width, height);
|
|
|
|
|
2004-06-05 03:03:49 +08:00
|
|
|
gdk_gc_set_clip_mask (gc, get_cursor_mask (bmtool));
|
|
|
|
gdk_draw_drawable (mask, gc, get_cursor_mask (bmtool),
|
2004-06-04 20:10:13 +08:00
|
|
|
0, 0, 0, 0, width, height);
|
|
|
|
}
|
|
|
|
|
2004-06-10 22:43:08 +08:00
|
|
|
if (bmmodifier || bmtool)
|
|
|
|
gdk_gc_set_clip_mask (gc, NULL);
|
|
|
|
|
2004-06-04 20:10:13 +08:00
|
|
|
cursor = gdk_cursor_new_from_pixmap (bitmap, mask,
|
|
|
|
&fg, &bg,
|
|
|
|
bmcursor->x_hot,
|
|
|
|
bmcursor->y_hot);
|
|
|
|
|
|
|
|
g_object_unref (bitmap);
|
|
|
|
g_object_unref (mask);
|
2004-06-03 20:36:02 +08:00
|
|
|
}
|
|
|
|
|
2004-06-04 20:10:13 +08:00
|
|
|
return cursor;
|
2004-06-03 20:36:02 +08:00
|
|
|
}
|
|
|
|
|
2003-11-02 04:53:18 +08:00
|
|
|
void
|
|
|
|
gimp_cursor_set (GtkWidget *widget,
|
2004-06-13 10:08:54 +08:00
|
|
|
GimpCursorFormat cursor_format,
|
2003-11-02 04:53:18 +08:00
|
|
|
GimpCursorType cursor_type,
|
|
|
|
GimpToolCursorType tool_cursor,
|
|
|
|
GimpCursorModifier modifier)
|
|
|
|
{
|
|
|
|
GdkCursor *cursor;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
|
|
|
g_return_if_fail (GTK_WIDGET_REALIZED (widget));
|
|
|
|
|
|
|
|
cursor = gimp_cursor_new (gtk_widget_get_display (widget),
|
2004-06-13 10:08:54 +08:00
|
|
|
cursor_format,
|
2003-11-02 04:53:18 +08:00
|
|
|
cursor_type,
|
|
|
|
tool_cursor,
|
|
|
|
modifier);
|
|
|
|
gdk_window_set_cursor (widget->window, cursor);
|
|
|
|
gdk_cursor_unref (cursor);
|
|
|
|
}
|