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
|
|
|
|
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 */
|
2000-03-02 03:32:41 +08:00
|
|
|
#include "cursors/mouse.xbm"
|
|
|
|
#include "cursors/mouse_mask.xbm"
|
2000-06-06 08:28:28 +08:00
|
|
|
#include "cursors/crosshair.xbm"
|
|
|
|
#include "cursors/crosshair_mask.xbm"
|
2000-06-09 20:31:19 +08:00
|
|
|
#include "cursors/crosshair_small.xbm"
|
|
|
|
#include "cursors/crosshair_small_mask.xbm"
|
2000-03-02 03:32:41 +08:00
|
|
|
#include "cursors/bad.xbm"
|
|
|
|
#include "cursors/bad_mask.xbm"
|
2000-06-14 18:59:16 +08:00
|
|
|
#include "cursors/zoom.xbm"
|
|
|
|
#include "cursors/zoom_mask.xbm"
|
2000-03-02 03:32:41 +08:00
|
|
|
#include "cursors/dropper.xbm"
|
|
|
|
#include "cursors/dropper_mask.xbm"
|
1999-05-05 17:10:35 +08:00
|
|
|
|
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
|
|
|
/* stock tool cursors */
|
2001-02-25 03:29:47 +08:00
|
|
|
#include "cursors/rect_select_small.xbm"
|
|
|
|
#include "cursors/rect_select_small_mask.xbm"
|
|
|
|
#include "cursors/ellipse_select_small.xbm"
|
|
|
|
#include "cursors/ellipse_select_small_mask.xbm"
|
|
|
|
#include "cursors/free_select_small.xbm"
|
|
|
|
#include "cursors/free_select_small_mask.xbm"
|
|
|
|
#include "cursors/fuzzy_select_small.xbm"
|
|
|
|
#include "cursors/fuzzy_select_small_mask.xbm"
|
|
|
|
#include "cursors/bezier_select_small.xbm"
|
|
|
|
#include "cursors/bezier_select_small_mask.xbm"
|
|
|
|
#include "cursors/scissors_small.xbm"
|
|
|
|
#include "cursors/scissors_small_mask.xbm"
|
|
|
|
#include "cursors/move_small.xbm"
|
|
|
|
#include "cursors/move_small_mask.xbm"
|
|
|
|
#include "cursors/zoom_small.xbm"
|
|
|
|
#include "cursors/zoom_small_mask.xbm"
|
|
|
|
#include "cursors/crop_small.xbm"
|
|
|
|
#include "cursors/crop_small_mask.xbm"
|
|
|
|
#include "cursors/resize_small.xbm"
|
|
|
|
#include "cursors/resize_small_mask.xbm"
|
|
|
|
#include "cursors/rotate_small.xbm"
|
|
|
|
#include "cursors/rotate_small_mask.xbm"
|
|
|
|
#include "cursors/shear_small.xbm"
|
|
|
|
#include "cursors/shear_small_mask.xbm"
|
|
|
|
#include "cursors/perspective_small.xbm"
|
|
|
|
#include "cursors/perspective_small_mask.xbm"
|
|
|
|
#include "cursors/flip_horizontal_small.xbm"
|
|
|
|
#include "cursors/flip_horizontal_small_mask.xbm"
|
|
|
|
#include "cursors/flip_vertical_small.xbm"
|
|
|
|
#include "cursors/flip_vertical_small_mask.xbm"
|
|
|
|
#include "cursors/text_small.xbm"
|
|
|
|
#include "cursors/text_small_mask.xbm"
|
|
|
|
#include "cursors/dropper_small.xbm"
|
|
|
|
#include "cursors/dropper_small_mask.xbm"
|
|
|
|
#include "cursors/bucket_fill_small.xbm"
|
|
|
|
#include "cursors/bucket_fill_small_mask.xbm"
|
|
|
|
#include "cursors/blend_small.xbm"
|
|
|
|
#include "cursors/blend_small_mask.xbm"
|
|
|
|
#include "cursors/pencil_small.xbm"
|
|
|
|
#include "cursors/pencil_small_mask.xbm"
|
|
|
|
#include "cursors/paintbrush_small.xbm"
|
|
|
|
#include "cursors/paintbrush_small_mask.xbm"
|
|
|
|
#include "cursors/eraser_small.xbm"
|
|
|
|
#include "cursors/eraser_small_mask.xbm"
|
|
|
|
#include "cursors/airbrush_small.xbm"
|
|
|
|
#include "cursors/airbrush_small_mask.xbm"
|
|
|
|
#include "cursors/clone_small.xbm"
|
|
|
|
#include "cursors/clone_small_mask.xbm"
|
|
|
|
#include "cursors/blur_small.xbm"
|
|
|
|
#include "cursors/blur_small_mask.xbm"
|
|
|
|
#include "cursors/ink_small.xbm"
|
|
|
|
#include "cursors/ink_small_mask.xbm"
|
|
|
|
#include "cursors/dodge_small.xbm"
|
|
|
|
#include "cursors/dodge_small_mask.xbm"
|
|
|
|
#include "cursors/burn_small.xbm"
|
|
|
|
#include "cursors/burn_small_mask.xbm"
|
|
|
|
#include "cursors/smudge_small.xbm"
|
|
|
|
#include "cursors/smudge_small_mask.xbm"
|
|
|
|
#include "cursors/measure_small.xbm"
|
|
|
|
#include "cursors/measure_small_mask.xbm"
|
|
|
|
|
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
|
|
|
/* modifiers */
|
2000-06-09 20:31:19 +08:00
|
|
|
#include "cursors/plus.xbm"
|
|
|
|
#include "cursors/plus_mask.xbm"
|
|
|
|
#include "cursors/minus.xbm"
|
|
|
|
#include "cursors/minus_mask.xbm"
|
|
|
|
#include "cursors/intersect.xbm"
|
|
|
|
#include "cursors/intersect_mask.xbm"
|
|
|
|
#include "cursors/move.xbm"
|
|
|
|
#include "cursors/move_mask.xbm"
|
2000-06-14 18:59:16 +08:00
|
|
|
#include "cursors/resize.xbm"
|
|
|
|
#include "cursors/resize_mask.xbm"
|
|
|
|
#include "cursors/control.xbm"
|
|
|
|
#include "cursors/control_mask.xbm"
|
2000-06-14 21:57:17 +08:00
|
|
|
#include "cursors/anchor.xbm"
|
|
|
|
#include "cursors/anchor_mask.xbm"
|
2000-07-30 00:12:40 +08:00
|
|
|
#include "cursors/foreground.xbm"
|
|
|
|
#include "cursors/foreground_mask.xbm"
|
|
|
|
#include "cursors/background.xbm"
|
|
|
|
#include "cursors/background_mask.xbm"
|
|
|
|
#include "cursors/pattern.xbm"
|
|
|
|
#include "cursors/pattern_mask.xbm"
|
2000-06-14 18:59:16 +08:00
|
|
|
#include "cursors/hand.xbm"
|
|
|
|
#include "cursors/hand_mask.xbm"
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2000-03-26 02:17:01 +08:00
|
|
|
|
2001-05-14 05:51:20 +08:00
|
|
|
typedef struct _GimpBitmapCursor GimpBitmapCursor;
|
|
|
|
|
|
|
|
struct _GimpBitmapCursor
|
|
|
|
{
|
|
|
|
guchar *bits;
|
|
|
|
guchar *mask_bits;
|
|
|
|
gint width, height;
|
|
|
|
gint x_hot, y_hot;
|
2002-11-18 07:13:26 +08:00
|
|
|
|
2001-05-14 05:51:20 +08:00
|
|
|
GdkBitmap *bitmap;
|
|
|
|
GdkBitmap *mask;
|
|
|
|
};
|
2000-03-26 02:17:01 +08:00
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
|
|
|
|
static GimpBitmapCursor 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 */
|
|
|
|
|
2000-03-02 03:32:41 +08:00
|
|
|
{
|
|
|
|
mouse_bits, mouse_mask_bits,
|
|
|
|
mouse_width, mouse_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
mouse_x_hot, mouse_y_hot, NULL, NULL
|
2000-03-02 03:32:41 +08:00
|
|
|
},
|
2000-06-06 08:28:28 +08:00
|
|
|
{
|
|
|
|
crosshair_bits, crosshair_mask_bits,
|
|
|
|
crosshair_width, crosshair_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
crosshair_x_hot, crosshair_y_hot, NULL, NULL
|
2000-06-06 08:28:28 +08:00
|
|
|
},
|
2000-06-09 20:31:19 +08:00
|
|
|
{
|
|
|
|
crosshair_small_bits, crosshair_small_mask_bits,
|
|
|
|
crosshair_small_width, crosshair_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
crosshair_small_x_hot, crosshair_small_y_hot, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
},
|
2000-03-02 03:32:41 +08:00
|
|
|
{
|
|
|
|
bad_bits, bad_mask_bits,
|
|
|
|
bad_width, bad_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
bad_x_hot, bad_y_hot, NULL, NULL
|
2000-03-02 03:32:41 +08:00
|
|
|
},
|
2000-06-14 18:59:16 +08:00
|
|
|
{
|
|
|
|
zoom_bits, zoom_mask_bits,
|
|
|
|
zoom_width, zoom_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
zoom_x_hot, zoom_y_hot, NULL, NULL
|
2000-06-14 18:59:16 +08:00
|
|
|
},
|
2000-03-02 03:32:41 +08:00
|
|
|
{
|
|
|
|
dropper_bits, dropper_mask_bits,
|
|
|
|
dropper_width, dropper_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
dropper_x_hot, dropper_y_hot, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
static GimpBitmapCursor gimp_stock_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,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
rect_select_small_bits, rect_select_small_mask_bits,
|
|
|
|
rect_select_small_width, rect_select_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ellipse_select_small_bits, ellipse_select_small_mask_bits,
|
|
|
|
ellipse_select_small_width, ellipse_select_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
free_select_small_bits, free_select_small_mask_bits,
|
|
|
|
free_select_small_width, free_select_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fuzzy_select_small_bits, fuzzy_select_small_mask_bits,
|
|
|
|
fuzzy_select_small_width, fuzzy_select_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
bezier_select_small_bits, bezier_select_small_mask_bits,
|
|
|
|
bezier_select_small_width, bezier_select_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
scissors_small_bits, scissors_small_mask_bits,
|
|
|
|
scissors_small_width, scissors_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
move_small_bits, move_small_mask_bits,
|
|
|
|
move_small_width, move_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
zoom_small_bits, zoom_small_mask_bits,
|
|
|
|
zoom_small_width, zoom_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
crop_small_bits, crop_small_mask_bits,
|
|
|
|
crop_small_width, crop_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
resize_small_bits, resize_small_mask_bits,
|
|
|
|
resize_small_width, resize_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
rotate_small_bits, rotate_small_mask_bits,
|
|
|
|
rotate_small_width, rotate_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
shear_small_bits, shear_small_mask_bits,
|
|
|
|
shear_small_width, shear_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
perspective_small_bits, perspective_small_mask_bits,
|
|
|
|
perspective_small_width, perspective_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
flip_horizontal_small_bits, flip_horizontal_small_mask_bits,
|
|
|
|
flip_horizontal_small_width, flip_horizontal_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
flip_vertical_small_bits, flip_vertical_small_mask_bits,
|
|
|
|
flip_vertical_small_width, flip_vertical_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text_small_bits, text_small_mask_bits,
|
|
|
|
text_small_width, text_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
dropper_small_bits, dropper_small_mask_bits,
|
|
|
|
dropper_small_width, dropper_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
bucket_fill_small_bits, bucket_fill_small_mask_bits,
|
|
|
|
bucket_fill_small_width, bucket_fill_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
blend_small_bits, blend_small_mask_bits,
|
|
|
|
blend_small_width, blend_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
pencil_small_bits, pencil_small_mask_bits,
|
|
|
|
pencil_small_width, pencil_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
paintbrush_small_bits, paintbrush_small_mask_bits,
|
|
|
|
paintbrush_small_width, paintbrush_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
airbrush_small_bits, airbrush_small_mask_bits,
|
|
|
|
airbrush_small_width, airbrush_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ink_small_bits, ink_small_mask_bits,
|
|
|
|
ink_small_width, ink_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
clone_small_bits, clone_small_mask_bits,
|
|
|
|
clone_small_width, clone_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
eraser_small_bits, eraser_small_mask_bits,
|
|
|
|
eraser_small_width, eraser_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
smudge_small_bits, smudge_small_mask_bits,
|
|
|
|
smudge_small_width, smudge_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
blur_small_bits, blur_small_mask_bits,
|
|
|
|
blur_small_width, blur_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
dodge_small_bits, dodge_small_mask_bits,
|
|
|
|
dodge_small_width, dodge_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
burn_small_bits, burn_small_mask_bits,
|
|
|
|
burn_small_width, burn_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
measure_small_bits, measure_small_mask_bits,
|
|
|
|
measure_small_width, measure_small_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
}
|
2000-06-09 20:31:19 +08:00
|
|
|
};
|
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
static GimpBitmapCursor gimp_modifier_cursors[] =
|
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,
|
2002-11-18 07:13:26 +08:00
|
|
|
0, 0, NULL, NULL
|
2001-02-25 03:29:47 +08:00
|
|
|
},
|
2000-06-09 20:31:19 +08:00
|
|
|
{
|
|
|
|
plus_bits, plus_mask_bits,
|
|
|
|
plus_width, plus_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
plus_x_hot, plus_y_hot, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
minus_bits, minus_mask_bits,
|
|
|
|
minus_width, minus_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
minus_x_hot, minus_y_hot, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
intersect_bits, intersect_mask_bits,
|
|
|
|
intersect_width, intersect_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
intersect_x_hot, intersect_y_hot, NULL, NULL
|
2000-06-09 20:31:19 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
move_bits, move_mask_bits,
|
|
|
|
move_width, move_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
move_x_hot, move_y_hot, NULL, NULL
|
2000-06-14 18:59:16 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
resize_bits, resize_mask_bits,
|
|
|
|
resize_width, resize_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
resize_x_hot, resize_y_hot, NULL, NULL
|
2000-06-14 18:59:16 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
control_bits, control_mask_bits,
|
|
|
|
control_width, control_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
control_x_hot, control_y_hot, NULL, NULL
|
2000-06-14 18:59:16 +08:00
|
|
|
},
|
2000-06-14 21:57:17 +08:00
|
|
|
{
|
|
|
|
anchor_bits, anchor_mask_bits,
|
|
|
|
anchor_width, anchor_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
anchor_x_hot, anchor_y_hot, NULL, NULL
|
2000-06-14 21:57:17 +08:00
|
|
|
},
|
2000-07-30 00:12:40 +08:00
|
|
|
{
|
|
|
|
foreground_bits, foreground_mask_bits,
|
|
|
|
foreground_width, foreground_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
foreground_x_hot, foreground_y_hot, NULL, NULL
|
2000-07-30 00:12:40 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
background_bits, background_mask_bits,
|
|
|
|
background_width, background_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
background_x_hot, background_y_hot, NULL, NULL
|
2000-07-30 00:12:40 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
pattern_bits, pattern_mask_bits,
|
|
|
|
pattern_width, pattern_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
pattern_x_hot, pattern_y_hot, NULL, NULL
|
2000-07-30 00:12:40 +08:00
|
|
|
},
|
2000-06-14 18:59:16 +08:00
|
|
|
{
|
|
|
|
hand_bits, hand_mask_bits,
|
|
|
|
hand_width, hand_height,
|
2002-11-18 07:13:26 +08:00
|
|
|
hand_x_hot, hand_y_hot, NULL, NULL
|
2000-03-02 03:32:41 +08:00
|
|
|
}
|
1999-05-05 17:10:35 +08:00
|
|
|
};
|
|
|
|
|
1999-01-11 07:36:29 +08:00
|
|
|
|
1999-05-05 17:10:35 +08:00
|
|
|
static void
|
2001-02-25 03:29:47 +08:00
|
|
|
create_cursor_bitmaps (GimpBitmapCursor *bmcursor)
|
1999-05-05 17:10:35 +08:00
|
|
|
{
|
2000-06-09 20:31:19 +08:00
|
|
|
if (bmcursor->bitmap == NULL)
|
|
|
|
bmcursor->bitmap = gdk_bitmap_create_from_data (NULL, bmcursor->bits,
|
|
|
|
bmcursor->width,
|
|
|
|
bmcursor->height);
|
|
|
|
g_return_if_fail (bmcursor->bitmap != NULL);
|
1999-05-05 17:10:35 +08:00
|
|
|
|
2000-06-09 20:31:19 +08:00
|
|
|
if (bmcursor->mask == NULL)
|
|
|
|
bmcursor->mask = gdk_bitmap_create_from_data (NULL, bmcursor->mask_bits,
|
|
|
|
bmcursor->width,
|
|
|
|
bmcursor->height);
|
|
|
|
g_return_if_fail (bmcursor->mask != NULL);
|
|
|
|
}
|
1999-05-05 17:10:35 +08:00
|
|
|
|
2001-05-14 05:51:20 +08:00
|
|
|
GdkCursor *
|
|
|
|
gimp_cursor_new (GimpCursorType cursor_type,
|
|
|
|
GimpToolCursorType tool_cursor,
|
|
|
|
GimpCursorModifier modifier)
|
1999-05-05 17:10:35 +08:00
|
|
|
{
|
2002-11-18 07:13:26 +08:00
|
|
|
GdkCursor *cursor;
|
|
|
|
GdkBitmap *bitmap;
|
|
|
|
GdkBitmap *mask;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
GdkColor color;
|
2001-02-25 03:29:47 +08:00
|
|
|
GimpBitmapCursor *bmcursor = NULL;
|
|
|
|
GimpBitmapCursor *bmmodifier = NULL;
|
|
|
|
GimpBitmapCursor *bmtool = NULL;
|
1999-05-05 17:10:35 +08:00
|
|
|
|
2002-11-18 07:13:26 +08:00
|
|
|
static GdkGC *gc = NULL;
|
|
|
|
static GdkColor fg, bg;
|
|
|
|
|
2001-05-14 05:51:20 +08:00
|
|
|
g_return_val_if_fail (cursor_type < GIMP_LAST_CURSOR_ENTRY, NULL);
|
|
|
|
|
|
|
|
if (cursor_type <= GDK_LAST_CURSOR)
|
2002-11-18 07:13:26 +08:00
|
|
|
return gdk_cursor_new (cursor_type);
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
g_return_val_if_fail (cursor_type >= GIMP_MOUSE_CURSOR, NULL);
|
|
|
|
|
2000-06-14 18:59:16 +08:00
|
|
|
/* allow the small tool cursor only with the standard mouse,
|
|
|
|
* the small crosshair and the bad cursor
|
2000-06-09 20:31:19 +08:00
|
|
|
*/
|
2001-02-25 03:29:47 +08:00
|
|
|
if (cursor_type != GIMP_MOUSE_CURSOR &&
|
|
|
|
cursor_type != GIMP_CROSSHAIR_SMALL_CURSOR &&
|
|
|
|
cursor_type != GIMP_BAD_CURSOR)
|
|
|
|
{
|
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_NONE;
|
|
|
|
}
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2002-11-18 07:13:26 +08:00
|
|
|
/* prepare the main cursor */
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2002-11-18 07:13:26 +08:00
|
|
|
cursor_type -= GIMP_MOUSE_CURSOR;
|
|
|
|
bmcursor = &gimp_cursors[cursor_type];
|
2001-05-14 05:51:20 +08:00
|
|
|
|
2002-11-18 07:13:26 +08:00
|
|
|
if (bmcursor->bitmap == NULL || bmcursor->mask == NULL)
|
|
|
|
create_cursor_bitmaps (bmcursor);
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
/* prepare the tool cursor */
|
|
|
|
|
|
|
|
if (tool_cursor < GIMP_TOOL_CURSOR_NONE ||
|
|
|
|
tool_cursor >= GIMP_LAST_STOCK_TOOL_CURSOR_ENTRY)
|
2000-06-09 20:31:19 +08:00
|
|
|
{
|
2001-02-25 03:29:47 +08:00
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_NONE;
|
2000-06-09 20:31:19 +08:00
|
|
|
}
|
2001-02-25 03:29:47 +08:00
|
|
|
|
|
|
|
if (tool_cursor != GIMP_TOOL_CURSOR_NONE)
|
2000-06-09 20:31:19 +08:00
|
|
|
{
|
2002-11-18 07:13:26 +08:00
|
|
|
bmtool = &gimp_stock_tool_cursors[tool_cursor];
|
2001-02-25 03:29:47 +08:00
|
|
|
|
2002-11-18 07:13:26 +08:00
|
|
|
if (bmtool->bitmap == NULL || bmtool->mask == NULL)
|
|
|
|
create_cursor_bitmaps (bmtool);
|
2000-06-09 20:31:19 +08:00
|
|
|
}
|
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
/* prepare the cursor modifier */
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
if (modifier < GIMP_CURSOR_MODIFIER_NONE ||
|
|
|
|
modifier >= GIMP_LAST_CURSOR_MODIFIER_ENTRY)
|
|
|
|
{
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_NONE;
|
|
|
|
}
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
if (modifier != GIMP_CURSOR_MODIFIER_NONE)
|
|
|
|
{
|
2002-11-18 07:13:26 +08:00
|
|
|
bmmodifier = &gimp_modifier_cursors[modifier];
|
2001-02-25 03:29:47 +08:00
|
|
|
|
2002-11-18 07:13:26 +08:00
|
|
|
if (bmmodifier->bitmap == NULL || bmmodifier->mask == NULL)
|
|
|
|
create_cursor_bitmaps (bmmodifier);
|
2001-02-25 03:29:47 +08:00
|
|
|
}
|
2000-06-09 20:31:19 +08:00
|
|
|
|
|
|
|
if (gc == NULL)
|
2002-11-18 07:13:26 +08:00
|
|
|
{
|
|
|
|
gc = gdk_gc_new (bmcursor->bitmap);
|
|
|
|
|
|
|
|
/* should have a way to configure the mouse colors */
|
|
|
|
gdk_color_parse ("#FFFFFF", &bg);
|
|
|
|
gdk_color_parse ("#000000", &fg);
|
|
|
|
}
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2001-07-25 07:11:30 +08:00
|
|
|
gdk_drawable_get_size (bmcursor->bitmap, &width, &height);
|
2000-06-09 20:31:19 +08:00
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
/* new bitmap and mask for on-the-fly cursor creation */
|
|
|
|
|
2000-06-09 20:31:19 +08:00
|
|
|
bitmap = gdk_pixmap_new (NULL, width, height, 1);
|
|
|
|
mask = gdk_pixmap_new (NULL, width, height, 1);
|
|
|
|
|
|
|
|
color.pixel = 1;
|
|
|
|
gdk_gc_set_foreground (gc, &color);
|
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
/* first draw the bitmap completely ... */
|
|
|
|
|
2001-07-25 07:11:30 +08:00
|
|
|
gdk_draw_drawable (bitmap, gc, bmcursor->bitmap,
|
|
|
|
0, 0, 0, 0, width, height);
|
2000-06-09 20:31:19 +08:00
|
|
|
|
|
|
|
if (bmmodifier)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_mask (gc, bmmodifier->bitmap);
|
2001-07-25 07:11:30 +08:00
|
|
|
gdk_draw_drawable (bitmap, gc, bmmodifier->bitmap,
|
|
|
|
0, 0, 0, 0, width, height);
|
2000-06-09 20:31:19 +08:00
|
|
|
gdk_gc_set_clip_mask (gc, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bmtool)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_mask (gc, bmtool->bitmap);
|
2001-07-25 07:11:30 +08:00
|
|
|
gdk_draw_drawable (bitmap, gc, bmtool->bitmap,
|
|
|
|
0, 0, 0, 0, width, height);
|
2000-06-09 20:31:19 +08:00
|
|
|
gdk_gc_set_clip_mask (gc, NULL);
|
|
|
|
}
|
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
/* ... then the mask */
|
|
|
|
|
2001-07-25 07:11:30 +08:00
|
|
|
gdk_draw_drawable (mask, gc, bmcursor->mask,
|
|
|
|
0, 0, 0, 0, width, height);
|
2000-06-09 20:31:19 +08:00
|
|
|
|
|
|
|
if (bmmodifier)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_mask (gc, bmmodifier->mask);
|
2001-07-25 07:11:30 +08:00
|
|
|
gdk_draw_drawable (mask, gc, bmmodifier->mask,
|
|
|
|
0, 0, 0, 0, width, height);
|
2000-06-09 20:31:19 +08:00
|
|
|
gdk_gc_set_clip_mask (gc, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bmtool)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_mask (gc, bmtool->mask);
|
2001-07-25 07:11:30 +08:00
|
|
|
gdk_draw_drawable (mask, gc, bmtool->mask,
|
|
|
|
0, 0, 0, 0, width, height);
|
2000-06-09 20:31:19 +08:00
|
|
|
gdk_gc_set_clip_mask (gc, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
cursor = gdk_cursor_new_from_pixmap (bitmap, mask,
|
|
|
|
&fg, &bg,
|
|
|
|
bmcursor->x_hot,
|
|
|
|
bmcursor->y_hot);
|
2001-02-25 03:29:47 +08:00
|
|
|
|
2001-12-02 23:43:00 +08:00
|
|
|
g_object_unref (bitmap);
|
|
|
|
g_object_unref (mask);
|
2000-10-19 01:51:25 +08:00
|
|
|
|
2001-05-14 05:51:20 +08:00
|
|
|
return cursor;
|
2000-02-29 03:25:42 +08:00
|
|
|
}
|