diff --git a/ChangeLog b/ChangeLog index 82c79b623f..bad0f9d7e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2004-06-05 Michael Natterer + + * cursors/Makefile.am + * cursors/cursor-none.png + * cursors/xbm/cursor-none.xbm: new empty cursor images. + + * app/config/gimpdisplayconfig.[ch] + * app/config/gimprc-blurbs.h + * app/widgets/widgets-enums.h + * app/widgets/gimpcursor.c + * app/display/gimpdisplayshell-cursor.c + * app/tools/gimppainttool.[ch] + * app/tools/gimpinktool.c + * app/gui/preferences-dialog.c: applied patches from Philip + Lafleur which implement hiding the cursor completely for paint + tools. Changed the name of the config option from + "hide-paint-tool-cursor" to "show-paint-tool-cursor" and default + to TRUE because this needs the brush outline being visible while + painting to be really usable. Fixes bug #132163. + + * app/widgets/widgets-enums.h: renamed all GimpCursorType and + GimpToolCursorType enum values to GIMP_CURSOR_* and + GIMP_TOOL_CURSOR_*. + + * app/widgets/gimpcursor.c + * app/display/gimpdisplayshell-callbacks.c + * app/display/gimpdisplayshell-cursor.c + * app/tools/gimp*tool.c; changed accordingly. + 2004-06-04 Michael Natterer * app/widgets/gimpcursor.c: changed create_cursor_foo() utility diff --git a/app/config/gimpdisplayconfig.c b/app/config/gimpdisplayconfig.c index 5c121266ec..d27ca07feb 100644 --- a/app/config/gimpdisplayconfig.c +++ b/app/config/gimpdisplayconfig.c @@ -79,6 +79,7 @@ enum PROP_CURSOR_MODE, PROP_CURSOR_UPDATING, PROP_SHOW_BRUSH_OUTLINE, + PROP_SHOW_PAINT_TOOL_CURSOR, PROP_IMAGE_TITLE_FORMAT, PROP_IMAGE_STATUS_FORMAT, PROP_CONFIRM_ON_CLOSE, @@ -183,6 +184,11 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass) SHOW_BRUSH_OUTLINE_BLURB, TRUE, 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_PAINT_TOOL_CURSOR, + "show-paint-tool-cursor", + SHOW_PAINT_TOOL_CURSOR_BLURB, + TRUE, + 0); GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_IMAGE_TITLE_FORMAT, "image-title-format", IMAGE_TITLE_FORMAT_BLURB, @@ -308,6 +314,9 @@ gimp_display_config_set_property (GObject *object, case PROP_SHOW_BRUSH_OUTLINE: display_config->show_brush_outline = g_value_get_boolean (value); break; + case PROP_SHOW_PAINT_TOOL_CURSOR: + display_config->show_paint_tool_cursor = g_value_get_boolean (value); + break; case PROP_IMAGE_TITLE_FORMAT: g_free (display_config->image_title_format); display_config->image_title_format = g_value_dup_string (value); @@ -389,6 +398,9 @@ gimp_display_config_get_property (GObject *object, case PROP_SHOW_BRUSH_OUTLINE: g_value_set_boolean (value, display_config->show_brush_outline); break; + case PROP_SHOW_PAINT_TOOL_CURSOR: + g_value_set_boolean (value, display_config->show_paint_tool_cursor); + break; case PROP_IMAGE_TITLE_FORMAT: g_value_set_string (value, display_config->image_title_format); break; diff --git a/app/config/gimpdisplayconfig.h b/app/config/gimpdisplayconfig.h index 0c9c3041b9..ebe7dfc95f 100644 --- a/app/config/gimpdisplayconfig.h +++ b/app/config/gimpdisplayconfig.h @@ -49,6 +49,7 @@ struct _GimpDisplayConfig GimpCursorMode cursor_mode; gboolean cursor_updating; gboolean show_brush_outline; + gboolean show_paint_tool_cursor; gchar *image_title_format; gchar *image_status_format; gboolean confirm_on_close; diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index e30060ca4c..2554c627ba 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -263,6 +263,10 @@ N_("Save the positions and sizes of the main dialogs when the GIMP exits.") N_("When enabled, all paint tools will show a preview of the current " \ "brush's outline.") +#define SHOW_PAINT_TOOL_CURSOR_BLURB \ +N_("When enabled, the cursor will be shown over the image while " \ + "using a paint tool.") + #define SHOW_MENUBAR_BLURB \ N_("When enabled, the menubar is visible by default. This can also be " \ "toggled with the \"View->Show Menubar\" command.") diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index 031a6b4080..da741933ef 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -1494,6 +1494,9 @@ prefs_dialog_new (Gimp *gimp, prefs_check_button_add (object, "show-brush-outline", _("Show _Brush Outline"), GTK_BOX (vbox2)); + prefs_check_button_add (object, "show-paint-tool-cursor", + _("Show Paint _Tool Cursor"), + GTK_BOX (vbox2)); prefs_check_button_add (object, "perfect-mouse", _("Perfect-but-Slow _Pointer Tracking"), GTK_BOX (vbox2)); diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index d6366351e4..185d1e5e9c 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -632,7 +632,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, else if (gimp_image_is_empty (gimage)) { gimp_display_shell_set_cursor (shell, - GIMP_BAD_CURSOR, + GIMP_CURSOR_BAD, gimp_tool_control_get_tool_cursor (active_tool->control), GIMP_CURSOR_MODIFIER_NONE); } @@ -640,7 +640,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, else { gimp_display_shell_set_cursor (shell, - GIMP_BAD_CURSOR, + GIMP_CURSOR_BAD, GIMP_TOOL_CURSOR_NONE, GIMP_CURSOR_MODIFIER_NONE); } @@ -1263,7 +1263,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, else if (gimp_image_is_empty (gimage)) { gimp_display_shell_set_cursor (shell, - GIMP_BAD_CURSOR, + GIMP_CURSOR_BAD, gimp_tool_control_get_tool_cursor (active_tool->control), GIMP_CURSOR_MODIFIER_NONE); } @@ -1271,7 +1271,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, else { gimp_display_shell_set_cursor (shell, - GIMP_BAD_CURSOR, + GIMP_CURSOR_BAD, GIMP_TOOL_CURSOR_NONE, GIMP_CURSOR_MODIFIER_NONE); } diff --git a/app/display/gimpdisplayshell-cursor.c b/app/display/gimpdisplayshell-cursor.c index 989db82f08..6abb53346d 100644 --- a/app/display/gimpdisplayshell-cursor.c +++ b/app/display/gimpdisplayshell-cursor.c @@ -191,7 +191,8 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell, config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config); - if (cursor_type != GIMP_BAD_CURSOR) + if (cursor_type != GIMP_CURSOR_NONE && + cursor_type != GIMP_CURSOR_BAD) { switch (config->cursor_mode) { @@ -199,11 +200,11 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell, break; case GIMP_CURSOR_MODE_TOOL_CROSSHAIR: - cursor_type = GIMP_CROSSHAIR_SMALL_CURSOR; + cursor_type = GIMP_CURSOR_CROSSHAIR_SMALL; break; case GIMP_CURSOR_MODE_CROSSHAIR: - cursor_type = GIMP_CROSSHAIR_CURSOR; + cursor_type = GIMP_CURSOR_CROSSHAIR; tool_cursor = GIMP_TOOL_CURSOR_NONE; modifier = GIMP_CURSOR_MODIFIER_NONE; break; diff --git a/app/gui/preferences-dialog.c b/app/gui/preferences-dialog.c index 031a6b4080..da741933ef 100644 --- a/app/gui/preferences-dialog.c +++ b/app/gui/preferences-dialog.c @@ -1494,6 +1494,9 @@ prefs_dialog_new (Gimp *gimp, prefs_check_button_add (object, "show-brush-outline", _("Show _Brush Outline"), GTK_BOX (vbox2)); + prefs_check_button_add (object, "show-paint-tool-cursor", + _("Show Paint _Tool Cursor"), + GTK_BOX (vbox2)); prefs_check_button_add (object, "perfect-mouse", _("Perfect-but-Slow _Pointer Tracking"), GTK_BOX (vbox2)); diff --git a/app/tools/gimpairbrushtool.c b/app/tools/gimpairbrushtool.c index c1edd0165d..ccd0c5b3d1 100644 --- a/app/tools/gimpairbrushtool.c +++ b/app/tools/gimpairbrushtool.c @@ -92,7 +92,7 @@ gimp_airbrush_tool_init (GimpAirbrushTool *airbrush) { GimpTool *tool = GIMP_TOOL (airbrush); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_AIRBRUSH_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_AIRBRUSH); gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (airbrush), GIMP_COLOR_PICK_MODE_FOREGROUND); diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index a3803a46bc..bc71d2a309 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -165,7 +165,7 @@ gimp_blend_tool_init (GimpBlendTool *blend_tool) tool = GIMP_TOOL (blend_tool); gimp_tool_control_set_scroll_lock (tool->control, TRUE); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_BLEND_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_BLEND); } @@ -347,10 +347,10 @@ gimp_blend_tool_cursor_update (GimpTool *tool, { case GIMP_INDEXED_IMAGE: case GIMP_INDEXEDA_IMAGE: - gimp_tool_control_set_cursor (tool->control, GIMP_BAD_CURSOR); + gimp_tool_control_set_cursor (tool->control, GIMP_CURSOR_BAD); break; default: - gimp_tool_control_set_cursor (tool->control, GIMP_MOUSE_CURSOR); + gimp_tool_control_set_cursor (tool->control, GIMP_CURSOR_MOUSE); break; } diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c index 32ddb4fb23..8ce8758fc1 100644 --- a/app/tools/gimpbrushtool.c +++ b/app/tools/gimpbrushtool.c @@ -69,23 +69,23 @@ static GObject * gimp_paint_tool_constructor (GType type, static void gimp_paint_tool_finalize (GObject *object); static void gimp_paint_tool_control (GimpTool *tool, - GimpToolAction action, - GimpDisplay *gdisp); + GimpToolAction action, + GimpDisplay *gdisp); static void gimp_paint_tool_button_press (GimpTool *tool, GimpCoords *coords, guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_paint_tool_button_release (GimpTool *tool, GimpCoords *coords, guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_paint_tool_motion (GimpTool *tool, GimpCoords *coords, guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_paint_tool_arrow_key (GimpTool *tool, GdkEventKey *kevent, GimpDisplay *gdisp); @@ -96,8 +96,12 @@ static void gimp_paint_tool_modifier_key (GimpTool *tool, GimpDisplay *gdisp); static void gimp_paint_tool_oper_update (GimpTool *tool, GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_paint_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_paint_tool_draw (GimpDrawTool *draw_tool); @@ -162,6 +166,7 @@ gimp_paint_tool_class_init (GimpPaintToolClass *klass) tool_class->arrow_key = gimp_paint_tool_arrow_key; tool_class->modifier_key = gimp_paint_tool_modifier_key; tool_class->oper_update = gimp_paint_tool_oper_update; + tool_class->cursor_update = gimp_paint_tool_cursor_update; draw_tool_class->draw = gimp_paint_tool_draw; @@ -178,6 +183,7 @@ gimp_paint_tool_init (GimpPaintTool *paint_tool) paint_tool->pick_colors = FALSE; paint_tool->draw_line = FALSE; + paint_tool->show_cursor = TRUE; paint_tool->draw_brush = TRUE; paint_tool->brush_x = 0.0; paint_tool->brush_y = 0.0; @@ -201,9 +207,15 @@ gimp_paint_tool_constructor (GType type, g_assert (GIMP_IS_TOOL_INFO (tool->tool_info)); + paint_tool->show_cursor = + GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_paint_tool_cursor; paint_tool->draw_brush = GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_brush_outline; + g_signal_connect_object (tool->tool_info->gimp->config, + "notify::show-paint-tool-cursor", + G_CALLBACK (gimp_paint_tool_notify_brush), + paint_tool, 0); g_signal_connect_object (tool->tool_info->gimp->config, "notify::show-brush-outline", G_CALLBACK (gimp_paint_tool_notify_brush), @@ -850,6 +862,26 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool) GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool); } +static void +gimp_paint_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp) +{ + GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool); + + if (! paint_tool->show_cursor) + { + gimp_tool_set_cursor (tool, gdisp, + GIMP_CURSOR_NONE, + GIMP_TOOL_CURSOR_NONE, + GIMP_CURSOR_MODIFIER_NONE); + return; + } + + GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp); +} + static void gimp_paint_tool_color_picked (GimpColorTool *color_tool, GimpImageType sample_type, @@ -887,7 +919,8 @@ gimp_paint_tool_notify_brush (GimpDisplayConfig *config, { gimp_draw_tool_pause (GIMP_DRAW_TOOL (paint_tool)); - paint_tool->draw_brush = config->show_brush_outline; + paint_tool->show_cursor = config->show_paint_tool_cursor; + paint_tool->draw_brush = config->show_brush_outline; gimp_draw_tool_resume (GIMP_DRAW_TOOL (paint_tool)); } diff --git a/app/tools/gimpbrushtool.h b/app/tools/gimpbrushtool.h index a9abc99a06..c30669d95d 100644 --- a/app/tools/gimpbrushtool.h +++ b/app/tools/gimpbrushtool.h @@ -40,6 +40,7 @@ struct _GimpPaintTool gboolean pick_colors; /* pick color if ctrl is pressed */ gboolean draw_line; + gboolean show_cursor; gboolean draw_brush; gdouble brush_x; gdouble brush_y; diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c index 97e26db337..aa96b98121 100644 --- a/app/tools/gimpbucketfilltool.c +++ b/app/tools/gimpbucketfilltool.c @@ -151,7 +151,7 @@ gimp_bucket_fill_tool_init (GimpBucketFillTool *bucket_fill_tool) gimp_tool_control_set_scroll_lock (tool->control, TRUE); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_BUCKET_FILL_TOOL_CURSOR); + GIMP_TOOL_CURSOR_BUCKET_FILL); } static void diff --git a/app/tools/gimpbycolorselecttool.c b/app/tools/gimpbycolorselecttool.c index 77d6153690..4f99567c89 100644 --- a/app/tools/gimpbycolorselecttool.c +++ b/app/tools/gimpbycolorselecttool.c @@ -141,7 +141,7 @@ gimp_by_color_select_tool_init (GimpByColorSelectTool *by_color_select) tool = GIMP_TOOL (by_color_select); gimp_tool_control_set_preserve (tool->control, FALSE); - gimp_tool_control_set_preserve (tool->control, GIMP_RECT_SELECT_TOOL_CURSOR); + gimp_tool_control_set_preserve (tool->control, GIMP_TOOL_CURSOR_RECT_SELECT); by_color_select->x = 0; by_color_select->y = 0; @@ -297,11 +297,11 @@ gimp_by_color_select_tool_cursor_update (GimpTool *tool, if (! options->sample_merged && layer && layer != gdisp->gimage->active_layer) { - gimp_tool_control_set_cursor (tool->control, GIMP_BAD_CURSOR); + gimp_tool_control_set_cursor (tool->control, GIMP_CURSOR_BAD); } else { - gimp_tool_control_set_cursor (tool->control, GIMP_MOUSE_CURSOR); + gimp_tool_control_set_cursor (tool->control, GIMP_CURSOR_MOUSE); } GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp); diff --git a/app/tools/gimpclonetool.c b/app/tools/gimpclonetool.c index 07792c1f56..b7324c67f5 100644 --- a/app/tools/gimpclonetool.c +++ b/app/tools/gimpclonetool.c @@ -155,7 +155,7 @@ gimp_clone_tool_init (GimpCloneTool *clone) { GimpTool *tool = GIMP_TOOL (clone); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_CLONE_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_CLONE); } static GObject * @@ -224,7 +224,7 @@ gimp_clone_tool_cursor_update (GimpTool *tool, GimpDisplay *gdisp) { GimpCloneOptions *options; - GdkCursorType ctype = GIMP_MOUSE_CURSOR; + GdkCursorType ctype = GIMP_CURSOR_MOUSE; options = (GimpCloneOptions *) tool->tool_info->tool_options; @@ -236,17 +236,17 @@ gimp_clone_tool_cursor_update (GimpTool *tool, * if so, is cursor inside? */ if (gimp_channel_is_empty (selection)) - ctype = GIMP_MOUSE_CURSOR; + ctype = GIMP_CURSOR_MOUSE; else if (gimp_channel_value (selection, coords->x, coords->y)) - ctype = GIMP_MOUSE_CURSOR; + ctype = GIMP_CURSOR_MOUSE; } if (options->clone_type == GIMP_IMAGE_CLONE) { if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK) - ctype = GIMP_CROSSHAIR_SMALL_CURSOR; + ctype = GIMP_CURSOR_CROSSHAIR_SMALL; else if (! GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core)->src_drawable) - ctype = GIMP_BAD_CURSOR; + ctype = GIMP_CURSOR_BAD; } gimp_tool_control_set_cursor (tool->control, ctype); diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c index c089bf8dd9..71eee1de67 100644 --- a/app/tools/gimpcolortool.c +++ b/app/tools/gimpcolortool.c @@ -261,7 +261,7 @@ gimp_color_tool_cursor_update (GimpTool *tool, if (color_tool->enabled) { - GdkCursorType cursor = GIMP_BAD_CURSOR; + GdkCursorType cursor = GIMP_CURSOR_BAD; GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE; if (coords->x > 0 && coords->x < gdisp->gimage->width && @@ -270,7 +270,7 @@ gimp_color_tool_cursor_update (GimpTool *tool, (color_tool->options->sample_merged || gimp_display_coords_in_active_drawable (gdisp, coords))) { - cursor = GIMP_COLOR_PICKER_CURSOR; + cursor = GIMP_CURSOR_COLOR_PICKER; } switch (color_tool->pick_mode) @@ -287,8 +287,7 @@ gimp_color_tool_cursor_update (GimpTool *tool, } gimp_tool_set_cursor (tool, gdisp, - cursor, - GIMP_COLOR_PICKER_TOOL_CURSOR, modifier); + cursor, GIMP_TOOL_CURSOR_COLOR_PICKER, modifier); return; /* don't chain up */ } diff --git a/app/tools/gimpconvolvetool.c b/app/tools/gimpconvolvetool.c index 28a6334d77..ead9d6fe96 100644 --- a/app/tools/gimpconvolvetool.c +++ b/app/tools/gimpconvolvetool.c @@ -120,9 +120,9 @@ gimp_convolve_tool_init (GimpConvolveTool *convolve) GimpTool *tool = GIMP_TOOL (convolve); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_BLUR_TOOL_CURSOR); + GIMP_TOOL_CURSOR_BLUR); gimp_tool_control_set_toggle_tool_cursor (tool->control, - GIMP_BLUR_TOOL_CURSOR); + GIMP_TOOL_CURSOR_BLUR); gimp_tool_control_set_toggle_cursor_modifier (tool->control, GIMP_CURSOR_MODIFIER_MINUS); } diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c index 609a1c910d..a677d818d7 100644 --- a/app/tools/gimpcroptool.c +++ b/app/tools/gimpcroptool.c @@ -224,7 +224,7 @@ gimp_crop_tool_init (GimpCropTool *crop_tool) GimpTool *tool = GIMP_TOOL (crop_tool); gimp_tool_control_set_preserve (tool->control, FALSE); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_CROP_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_CROP); } static void @@ -742,7 +742,7 @@ gimp_crop_tool_cursor_update (GimpTool *tool, { GimpCropTool *crop = GIMP_CROP_TOOL (tool); GimpCropOptions *options; - GdkCursorType ctype = GIMP_CROSSHAIR_SMALL_CURSOR; + GdkCursorType ctype = GIMP_CURSOR_CROSSHAIR_SMALL; GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE; options = GIMP_CROP_OPTIONS (tool->tool_info->tool_options); @@ -769,8 +769,8 @@ gimp_crop_tool_cursor_update (GimpTool *tool, gimp_tool_control_set_tool_cursor (tool->control, options->crop_mode == GIMP_CROP_MODE_CROP ? - GIMP_CROP_TOOL_CURSOR : - GIMP_RESIZE_TOOL_CURSOR); + GIMP_TOOL_CURSOR_CROP : + GIMP_TOOL_CURSOR_RESIZE); gimp_tool_control_set_cursor_modifier (tool->control, cmodifier); GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp); diff --git a/app/tools/gimpdodgeburntool.c b/app/tools/gimpdodgeburntool.c index 90e3c68d8d..c84c4215e1 100644 --- a/app/tools/gimpdodgeburntool.c +++ b/app/tools/gimpdodgeburntool.c @@ -120,9 +120,9 @@ gimp_dodge_burn_tool_init (GimpDodgeBurnTool *dodgeburn) GimpTool *tool = GIMP_TOOL (dodgeburn); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_DODGE_TOOL_CURSOR); + GIMP_TOOL_CURSOR_DODGE); gimp_tool_control_set_toggle_tool_cursor (tool->control, - GIMP_BURN_TOOL_CURSOR); + GIMP_TOOL_CURSOR_BURN); } static void diff --git a/app/tools/gimpellipseselecttool.c b/app/tools/gimpellipseselecttool.c index 048e2f8566..bb769d52d6 100644 --- a/app/tools/gimpellipseselecttool.c +++ b/app/tools/gimpellipseselecttool.c @@ -129,7 +129,7 @@ gimp_ellipse_select_tool_init (GimpEllipseSelectTool *ellipse_select) GimpTool *tool = GIMP_TOOL (ellipse_select); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_ELLIPSE_SELECT_TOOL_CURSOR); + GIMP_TOOL_CURSOR_ELLIPSE_SELECT); } static void diff --git a/app/tools/gimperasertool.c b/app/tools/gimperasertool.c index 3c9bc4b212..c98a6c20c1 100644 --- a/app/tools/gimperasertool.c +++ b/app/tools/gimperasertool.c @@ -120,9 +120,9 @@ gimp_eraser_tool_init (GimpEraserTool *eraser) GimpTool *tool = GIMP_TOOL (eraser); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_ERASER_TOOL_CURSOR); + GIMP_TOOL_CURSOR_ERASER); gimp_tool_control_set_toggle_tool_cursor (tool->control, - GIMP_ERASER_TOOL_CURSOR); + GIMP_TOOL_CURSOR_ERASER); gimp_tool_control_set_toggle_cursor_modifier (tool->control, GIMP_CURSOR_MODIFIER_MINUS); diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c index 9cbc5f0a80..c6b990df14 100644 --- a/app/tools/gimpfliptool.c +++ b/app/tools/gimpfliptool.c @@ -150,11 +150,11 @@ gimp_flip_tool_init (GimpFlipTool *flip_tool) gimp_tool_control_set_cursor (tool->control, GDK_SB_H_DOUBLE_ARROW); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_FLIP_HORIZONTAL_TOOL_CURSOR); + GIMP_TOOL_CURSOR_FLIP_HORIZONTAL); gimp_tool_control_set_toggle_cursor (tool->control, GDK_SB_V_DOUBLE_ARROW); gimp_tool_control_set_toggle_tool_cursor (tool->control, - GIMP_FLIP_VERTICAL_TOOL_CURSOR); + GIMP_TOOL_CURSOR_FLIP_VERTICAL); transform_tool->use_grid = FALSE; } @@ -217,12 +217,12 @@ gimp_flip_tool_cursor_update (GimpTool *tool, if (bad_cursor) { - gimp_tool_control_set_cursor (tool->control, GIMP_BAD_CURSOR); - gimp_tool_control_set_toggle_cursor (tool->control, GIMP_BAD_CURSOR); + gimp_tool_control_set_cursor (tool->control, GIMP_CURSOR_BAD); + gimp_tool_control_set_toggle_cursor (tool->control, GIMP_CURSOR_BAD); } else { - gimp_tool_control_set_cursor (tool->control, GDK_SB_H_DOUBLE_ARROW); + gimp_tool_control_set_cursor (tool->control, GDK_SB_H_DOUBLE_ARROW); gimp_tool_control_set_toggle_cursor (tool->control, GDK_SB_V_DOUBLE_ARROW); } diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c index 1d1d40a14e..279d972068 100644 --- a/app/tools/gimpfreeselecttool.c +++ b/app/tools/gimpfreeselecttool.c @@ -112,18 +112,18 @@ gimp_free_select_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpFreeSelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_free_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFreeSelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_free_select_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_free_select_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpFreeSelectTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_free_select_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpFreeSelectTool", + "GimpFreeSelectTool", &tool_info, 0); } @@ -135,13 +135,9 @@ gimp_free_select_tool_get_type (void) static void gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpDrawToolClass *draw_tool_class; - - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -157,14 +153,11 @@ gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass) static void gimp_free_select_tool_init (GimpFreeSelectTool *free_select) { - GimpTool *tool; - GimpSelectionTool *select_tool; - - tool = GIMP_TOOL (free_select); - select_tool = GIMP_SELECTION_TOOL (free_select); + GimpTool *tool = GIMP_TOOL (free_select); gimp_tool_control_set_scroll_lock (tool->control, TRUE); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_FREE_SELECT_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, + GIMP_TOOL_CURSOR_FREE_SELECT); free_select->points = NULL; free_select->num_points = 0; @@ -174,9 +167,7 @@ gimp_free_select_tool_init (GimpFreeSelectTool *free_select) static void gimp_free_select_tool_finalize (GObject *object) { - GimpFreeSelectTool *free_sel; - - free_sel = GIMP_FREE_SELECT_TOOL (object); + GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (object); if (free_sel->points) { @@ -194,9 +185,7 @@ gimp_free_select_tool_button_press (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpFreeSelectTool *free_sel; - - free_sel = GIMP_FREE_SELECT_TOOL (tool); + GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (tool); gimp_tool_control_activate (tool->control); tool->gdisp = gdisp; @@ -231,10 +220,9 @@ gimp_free_select_tool_button_release (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpFreeSelectTool *free_sel; + GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (tool); GimpSelectionOptions *options; - free_sel = GIMP_FREE_SELECT_TOOL (tool); options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool)); @@ -279,11 +267,8 @@ gimp_free_select_tool_motion (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpFreeSelectTool *free_sel; - GimpSelectionTool *sel_tool; - - free_sel = GIMP_FREE_SELECT_TOOL (tool); - sel_tool = GIMP_SELECTION_TOOL (tool); + GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (tool); + GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool); if (sel_tool->op == SELECTION_ANCHOR) { @@ -320,11 +305,9 @@ gimp_free_select_tool_motion (GimpTool *tool, static void gimp_free_select_tool_draw (GimpDrawTool *draw_tool) { - GimpFreeSelectTool *free_sel; + GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (draw_tool); gint i; - free_sel = GIMP_FREE_SELECT_TOOL (draw_tool); - for (i = 1; i < free_sel->num_points; i++) { gimp_draw_tool_draw_line (draw_tool, diff --git a/app/tools/gimpfuzzyselecttool.c b/app/tools/gimpfuzzyselecttool.c index f2d6d68d23..b19237f8f8 100644 --- a/app/tools/gimpfuzzyselecttool.c +++ b/app/tools/gimpfuzzyselecttool.c @@ -86,8 +86,6 @@ static GdkSegment * static GimpSelectionToolClass *parent_class = NULL; -/* public functions */ - void gimp_fuzzy_select_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -115,37 +113,30 @@ gimp_fuzzy_select_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpFuzzySelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_fuzzy_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFuzzySelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_fuzzy_select_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_fuzzy_select_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpFuzzySelectTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_fuzzy_select_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpFuzzySelectTool", + "GimpFuzzySelectTool", &tool_info, 0); } return tool_type; } - -/* private functions */ - static void gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpDrawToolClass *draw_tool_class; - - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -161,13 +152,11 @@ gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass) static void gimp_fuzzy_select_tool_init (GimpFuzzySelectTool *fuzzy_select) { - GimpTool *tool; - - tool = GIMP_TOOL (fuzzy_select); + GimpTool *tool = GIMP_TOOL (fuzzy_select); gimp_tool_control_set_scroll_lock (tool->control, TRUE); gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_COMPRESS); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_FUZZY_SELECT_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_FUZZY_SELECT); fuzzy_select->x = 0; fuzzy_select->y = 0; @@ -183,9 +172,7 @@ gimp_fuzzy_select_tool_init (GimpFuzzySelectTool *fuzzy_select) static void gimp_fuzzy_select_tool_finalize (GObject *object) { - GimpFuzzySelectTool *fuzzy_sel; - - fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (object); + GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (object); if (fuzzy_sel->fuzzy_mask) { @@ -210,10 +197,9 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpFuzzySelectTool *fuzzy_sel; + GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); GimpSelectionOptions *options; - fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); fuzzy_sel->x = coords->x; @@ -254,10 +240,9 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpFuzzySelectTool *fuzzy_sel; + GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); GimpSelectionOptions *options; - fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool)); @@ -290,9 +275,7 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool, } else { - GimpDrawable *drawable; - - drawable = gimp_image_active_drawable (gdisp->gimage); + GimpDrawable *drawable = gimp_image_active_drawable (gdisp->gimage); gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y); } @@ -334,8 +317,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpFuzzySelectTool *fuzzy_sel; - GimpSelectionTool *sel_tool; + GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); GimpSelectionOptions *options; GdkSegment *new_segs; gint num_new_segs; @@ -344,9 +326,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool, static guint32 last_time = 0; - fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); - sel_tool = GIMP_SELECTION_TOOL (tool); - options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); + options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); /* don't let the events come in too fast, ignore below a delay of 100 ms */ if (time - last_time < 100) @@ -400,7 +380,7 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel, GimpDisplay *gdisp, gint *num_segs) { - GimpTool *tool; + GimpTool *tool = GIMP_TOOL (fuzzy_sel); GimpSelectionOptions *options; GimpDisplayShell *shell; PixelRegion maskPR; @@ -411,7 +391,6 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel, gint i; gint x, y; - tool = GIMP_TOOL (fuzzy_sel); options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); shell = GIMP_DISPLAY_SHELL (gdisp->shell); diff --git a/app/tools/gimpinktool.c b/app/tools/gimpinktool.c index 2350a1015b..310d9cc8af 100644 --- a/app/tools/gimpinktool.c +++ b/app/tools/gimpinktool.c @@ -37,7 +37,16 @@ #include "gimp-intl.h" -static void gimp_ink_tool_init (GimpInkTool *tool); +static void gimp_ink_tool_init (GimpInkTool *tool); +static void gimp_ink_tool_class_init (GimpInkToolClass *klass); + +static void gimp_ink_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); + + +static GimpPaintToolClass *parent_class = NULL; void @@ -72,7 +81,7 @@ gimp_ink_tool_get_type (void) sizeof (GimpInkToolClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ + (GClassInitFunc) gimp_ink_tool_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (GimpInkTool), @@ -88,11 +97,34 @@ gimp_ink_tool_get_type (void) return tool_type; } +static void +gimp_ink_tool_class_init (GimpInkToolClass *klass) +{ + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + tool_class->cursor_update = gimp_ink_tool_cursor_update; +} + static void gimp_ink_tool_init (GimpInkTool *ink_tool) { GimpTool *tool = GIMP_TOOL (ink_tool); gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_EXACT); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_INK_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_INK); +} + +static void +gimp_ink_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp) +{ + GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool); + + paint_tool->show_cursor = TRUE; + + GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp); } diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c index 1ac5f60ed0..d5022383dc 100644 --- a/app/tools/gimpiscissorstool.c +++ b/app/tools/gimpiscissorstool.c @@ -294,18 +294,18 @@ gimp_iscissors_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpIscissorsToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_iscissors_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpIscissorsTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_iscissors_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_iscissors_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpIscissorsTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_iscissors_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpIscissorsTool", + "GimpIscissorsTool", &tool_info, 0); } @@ -315,13 +315,9 @@ gimp_iscissors_tool_get_type (void) static void gimp_iscissors_tool_class_init (GimpIscissorsToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpDrawToolClass *draw_tool_class; - - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -340,9 +336,7 @@ gimp_iscissors_tool_class_init (GimpIscissorsToolClass *klass) static void gimp_iscissors_tool_init (GimpIscissorsTool *iscissors) { - GimpTool *tool; - - tool = GIMP_TOOL (iscissors); + GimpTool *tool = GIMP_TOOL (iscissors); iscissors->op = ISCISSORS_OP_NONE; iscissors->dp_buf = NULL; @@ -356,7 +350,7 @@ gimp_iscissors_tool_init (GimpIscissorsTool *iscissors) gimp_tool_control_set_scroll_lock (tool->control, TRUE); gimp_tool_control_set_snap_to (tool->control, FALSE); gimp_tool_control_set_preserve (tool->control, FALSE); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_SCISSORS_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_ISCISSORS); gimp_iscissors_tool_reset (iscissors); } @@ -376,11 +370,9 @@ gimp_iscissors_tool_control (GimpTool *tool, GimpToolAction action, GimpDisplay *gdisp) { - GimpIscissorsTool *iscissors; + GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool); IscissorsDraw draw; - iscissors = GIMP_ISCISSORS_TOOL (tool); - switch (iscissors->state) { case SEED_PLACEMENT: @@ -424,11 +416,10 @@ gimp_iscissors_tool_button_press (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpIscissorsTool *iscissors; + GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool); GimpSelectionOptions *options; - iscissors = GIMP_ISCISSORS_TOOL (tool); - options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); + options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); iscissors->x = coords->x; iscissors->y = coords->y; @@ -589,12 +580,11 @@ gimp_iscissors_tool_button_release (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpIscissorsTool *iscissors; + GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool); GimpSelectionOptions *options; ICurve *curve; - iscissors = GIMP_ISCISSORS_TOOL (tool); - options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); + options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); /* Make sure X didn't skip the button release event -- as it's known * to do @@ -703,11 +693,10 @@ gimp_iscissors_tool_motion (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpIscissorsTool *iscissors; + GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool); GimpSelectionOptions *options; - iscissors = GIMP_ISCISSORS_TOOL (tool); - options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); + options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); if (iscissors->state == NO_ACTION) return; @@ -770,15 +759,12 @@ gimp_iscissors_tool_motion (GimpTool *tool, static void gimp_iscissors_tool_draw (GimpDrawTool *draw_tool) { - GimpTool *tool; - GimpIscissorsTool *iscissors; + GimpTool *tool = GIMP_TOOL (draw_tool); + GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (draw_tool); GimpDisplay *gdisp; ICurve *curve; GSList *list; - tool = GIMP_TOOL (draw_tool); - iscissors = GIMP_ISCISSORS_TOOL (draw_tool); - gdisp = tool->gdisp; /* Draw the crosshairs target if we're placing a seed */ @@ -1019,7 +1005,7 @@ gimp_iscissors_tool_cursor_update (GimpTool *tool, GimpDisplay *gdisp) { GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool); - GdkCursorType cursor = GIMP_MOUSE_CURSOR; + GdkCursorType cursor = GIMP_CURSOR_MOUSE; GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE; switch (iscissors->op) @@ -1034,16 +1020,14 @@ gimp_iscissors_tool_cursor_update (GimpTool *tool, cmodifier = GIMP_CURSOR_MODIFIER_PLUS; break; case ISCISSORS_OP_IMPOSSIBLE: - cursor = GIMP_BAD_CURSOR; + cursor = GIMP_CURSOR_BAD; break; default: break; } gimp_tool_set_cursor (tool, gdisp, - cursor, - GIMP_SCISSORS_TOOL_CURSOR /* tool->tool_cursor*/, - cmodifier); + cursor, GIMP_TOOL_CURSOR_ISCISSORS, cmodifier); } diff --git a/app/tools/gimpmagnifytool.c b/app/tools/gimpmagnifytool.c index a8cd99a2a4..904ca7695b 100644 --- a/app/tools/gimpmagnifytool.c +++ b/app/tools/gimpmagnifytool.c @@ -110,18 +110,18 @@ gimp_magnify_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpMagnifyToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_magnify_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMagnifyTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_magnify_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_magnify_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpMagnifyTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_magnify_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpMagnifyTool", + "GimpMagnifyTool", &tool_info, 0); } @@ -134,11 +134,8 @@ gimp_magnify_tool_get_type (void) static void gimp_magnify_tool_class_init (GimpMagnifyToolClass *klass) { - GimpToolClass *tool_class; - GimpDrawToolClass *draw_tool_class; - - tool_class = GIMP_TOOL_CLASS (klass); - draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -154,9 +151,7 @@ gimp_magnify_tool_class_init (GimpMagnifyToolClass *klass) static void gimp_magnify_tool_init (GimpMagnifyTool *magnify_tool) { - GimpTool *tool; - - tool = GIMP_TOOL (magnify_tool); + GimpTool *tool = GIMP_TOOL (magnify_tool); magnify_tool->x = 0; magnify_tool->y = 0; @@ -167,16 +162,16 @@ gimp_magnify_tool_init (GimpMagnifyTool *magnify_tool) gimp_tool_control_set_snap_to (tool->control, FALSE); gimp_tool_control_set_cursor (tool->control, - GIMP_ZOOM_CURSOR); + GIMP_CURSOR_ZOOM); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_ZOOM_TOOL_CURSOR); + GIMP_TOOL_CURSOR_ZOOM); gimp_tool_control_set_cursor_modifier (tool->control, GIMP_CURSOR_MODIFIER_PLUS); gimp_tool_control_set_toggle_cursor (tool->control, - GIMP_ZOOM_CURSOR); + GIMP_CURSOR_ZOOM); gimp_tool_control_set_toggle_tool_cursor (tool->control, - GIMP_ZOOM_TOOL_CURSOR); + GIMP_TOOL_CURSOR_ZOOM); gimp_tool_control_set_toggle_cursor_modifier (tool->control, GIMP_CURSOR_MODIFIER_MINUS); } @@ -188,9 +183,7 @@ gimp_magnify_tool_button_press (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpMagnifyTool *magnify; - - magnify = GIMP_MAGNIFY_TOOL (tool); + GimpMagnifyTool *magnify = GIMP_MAGNIFY_TOOL (tool); magnify->x = coords->x; magnify->y = coords->y; @@ -210,11 +203,10 @@ gimp_magnify_tool_button_release (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpMagnifyTool *magnify; + GimpMagnifyTool *magnify = GIMP_MAGNIFY_TOOL (tool); GimpMagnifyOptions *options; GimpDisplayShell *shell; - magnify = GIMP_MAGNIFY_TOOL (tool); options = GIMP_MAGNIFY_OPTIONS (tool->tool_info->tool_options); shell = GIMP_DISPLAY_SHELL (tool->gdisp->shell); @@ -226,9 +218,9 @@ gimp_magnify_tool_button_release (GimpTool *tool, /* First take care of the case where the user "cancels" the action */ if (! (state & GDK_BUTTON3_MASK)) { - gint x1, y1, x2, y2, w, h; - gint win_width, win_height; - gint offset_x, offset_y; + gint x1, y1, x2, y2, w, h; + gint win_width, win_height; + gint offset_x, offset_y; gdouble new_scale; x1 = (magnify->w < 0) ? magnify->x + magnify->w : magnify->x; @@ -267,7 +259,7 @@ gimp_magnify_tool_button_release (GimpTool *tool, scale = MIN (((gdouble) w / (gdouble) width), ((gdouble) h / (gdouble) height)); break; - + case GIMP_ZOOM_TO: break; } @@ -292,9 +284,7 @@ gimp_magnify_tool_motion (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpMagnifyTool *magnify; - - magnify = GIMP_MAGNIFY_TOOL (tool); + GimpMagnifyTool *magnify = GIMP_MAGNIFY_TOOL (tool); gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool)); @@ -352,10 +342,9 @@ gimp_magnify_tool_cursor_update (GimpTool *tool, static void gimp_magnify_tool_draw (GimpDrawTool *draw_tool) { - GimpMagnifyTool *magnify; + GimpMagnifyTool *magnify = GIMP_MAGNIFY_TOOL (draw_tool); GimpMagnifyOptions *options; - magnify = GIMP_MAGNIFY_TOOL (draw_tool); options = GIMP_MAGNIFY_OPTIONS (GIMP_TOOL (draw_tool)->tool_info->tool_options); gimp_draw_tool_draw_rectangle (draw_tool, diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c index 84a5da3f51..69a3d61af1 100644 --- a/app/tools/gimpmeasuretool.c +++ b/app/tools/gimpmeasuretool.c @@ -128,18 +128,18 @@ gimp_measure_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpMeasureToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_measure_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMeasureTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_measure_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_measure_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpMeasureTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_measure_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpMeasureTool", + "GimpMeasureTool", &tool_info, 0); } @@ -149,11 +149,8 @@ gimp_measure_tool_get_type (void) static void gimp_measure_tool_class_init (GimpMeasureToolClass *klass) { - GimpToolClass *tool_class; - GimpDrawToolClass *draw_tool_class; - - tool_class = GIMP_TOOL_CLASS (klass); - draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -171,7 +168,7 @@ gimp_measure_tool_init (GimpMeasureTool *measure_tool) { GimpTool *tool = GIMP_TOOL (measure_tool); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_MEASURE_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_MEASURE); } static void @@ -207,12 +204,11 @@ gimp_measure_tool_button_press (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpMeasureTool *mtool; + GimpMeasureTool *mtool = GIMP_MEASURE_TOOL (tool); GimpMeasureOptions *options; GimpDisplayShell *shell; gint i; - mtool = GIMP_MEASURE_TOOL (tool); options = GIMP_MEASURE_OPTIONS (tool->tool_info->tool_options); shell = GIMP_DISPLAY_SHELL (gdisp->shell); @@ -386,13 +382,12 @@ gimp_measure_tool_motion (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpMeasureTool *mtool; + GimpMeasureTool *mtool = GIMP_MEASURE_TOOL (tool); GimpMeasureOptions *options; gint dx, dy; gint i; gint tmp; - mtool = GIMP_MEASURE_TOOL (tool); options = GIMP_MEASURE_OPTIONS (tool->tool_info->tool_options); gimp_draw_tool_pause (GIMP_DRAW_TOOL (mtool)); @@ -513,7 +508,7 @@ gimp_measure_tool_cursor_update (GimpTool *tool, { GimpMeasureTool *mtool = GIMP_MEASURE_TOOL (tool); gboolean in_handle = FALSE; - GdkCursorType ctype = GIMP_CROSSHAIR_SMALL_CURSOR; + GdkCursorType ctype = GIMP_CURSOR_CROSSHAIR_SMALL; GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE; gint i; diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c index 8644d1b922..0520cd47f6 100644 --- a/app/tools/gimpmovetool.c +++ b/app/tools/gimpmovetool.c @@ -179,7 +179,7 @@ gimp_move_tool_init (GimpMoveTool *move_tool) gimp_tool_control_set_snap_to (tool->control, FALSE); gimp_tool_control_set_handles_empty_image (tool->control, TRUE); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_MOVE_TOOL_CURSOR); + GIMP_TOOL_CURSOR_MOVE); } static void @@ -586,19 +586,19 @@ gimp_move_tool_cursor_update (GimpTool *tool, GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell); GimpMoveOptions *options = GIMP_MOVE_OPTIONS (tool->tool_info->tool_options); - GdkCursorType cursor = GIMP_BAD_CURSOR; - GimpToolCursorType tool_cursor = GIMP_MOVE_TOOL_CURSOR; + GdkCursorType cursor = GIMP_CURSOR_BAD; + GimpToolCursorType tool_cursor = GIMP_TOOL_CURSOR_MOVE; GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE; if (options->move_type == GIMP_TRANSFORM_TYPE_PATH) { - tool_cursor = GIMP_BEZIER_SELECT_TOOL_CURSOR; + tool_cursor = GIMP_TOOL_CURSOR_PATHS; modifier = GIMP_CURSOR_MODIFIER_MOVE; if (options->move_current) { if (gimp_image_get_active_vectors (gdisp->gimage)) - cursor = GIMP_MOUSE_CURSOR; + cursor = GIMP_CURSOR_MOUSE; } else { @@ -607,22 +607,22 @@ gimp_move_tool_cursor_update (GimpTool *tool, NULL, NULL, NULL, NULL, NULL, NULL)) { cursor = GDK_HAND2; - tool_cursor = GIMP_HAND_TOOL_CURSOR; + tool_cursor = GIMP_TOOL_CURSOR_HAND; } } } else if (options->move_type == GIMP_TRANSFORM_TYPE_SELECTION) { - tool_cursor = GIMP_RECT_SELECT_TOOL_CURSOR; + tool_cursor = GIMP_TOOL_CURSOR_RECT_SELECT; modifier = GIMP_CURSOR_MODIFIER_MOVE; if (! gimp_channel_is_empty (gimp_image_get_mask (gdisp->gimage))) - cursor = GIMP_MOUSE_CURSOR; + cursor = GIMP_CURSOR_MOUSE; } else if (options->move_current) { if (gimp_image_active_drawable (gdisp->gimage)) - cursor = GIMP_MOUSE_CURSOR; + cursor = GIMP_CURSOR_MOUSE; } else { @@ -639,7 +639,7 @@ gimp_move_tool_cursor_update (GimpTool *tool, FUNSCALEY (shell, snap_distance)))) { cursor = GDK_HAND2; - tool_cursor = GIMP_HAND_TOOL_CURSOR; + tool_cursor = GIMP_TOOL_CURSOR_HAND; modifier = GIMP_CURSOR_MODIFIER_MOVE; } else if ((layer = gimp_image_pick_correlate_layer (gdisp->gimage, @@ -649,18 +649,18 @@ gimp_move_tool_cursor_update (GimpTool *tool, if (gimp_image_floating_sel (gdisp->gimage) && ! gimp_layer_is_floating_sel (layer)) { - cursor = GIMP_MOUSE_CURSOR; - tool_cursor = GIMP_RECT_SELECT_TOOL_CURSOR; + cursor = GIMP_CURSOR_MOUSE; + tool_cursor = GIMP_TOOL_CURSOR_RECT_SELECT; modifier = GIMP_CURSOR_MODIFIER_ANCHOR; } else if (layer == gimp_image_get_active_layer (gdisp->gimage)) { - cursor = GIMP_MOUSE_CURSOR; + cursor = GIMP_CURSOR_MOUSE; } else { cursor = GDK_HAND2; - tool_cursor = GIMP_HAND_TOOL_CURSOR; + tool_cursor = GIMP_TOOL_CURSOR_HAND; modifier = GIMP_CURSOR_MODIFIER_MOVE; } } @@ -751,7 +751,7 @@ gimp_move_tool_start_guide (GimpMoveTool *move, gimp_tool_set_cursor (tool, gdisp, GDK_HAND2, - GIMP_HAND_TOOL_CURSOR, + GIMP_TOOL_CURSOR_HAND, GIMP_CURSOR_MODIFIER_MOVE); gimp_draw_tool_start (GIMP_DRAW_TOOL (move), gdisp); diff --git a/app/tools/gimppaintbrushtool.c b/app/tools/gimppaintbrushtool.c index 37a44df083..15b769309d 100644 --- a/app/tools/gimppaintbrushtool.c +++ b/app/tools/gimppaintbrushtool.c @@ -90,7 +90,7 @@ gimp_paintbrush_tool_init (GimpPaintbrushTool *paintbrush) GimpTool *tool = GIMP_TOOL (paintbrush); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_PAINTBRUSH_TOOL_CURSOR); + GIMP_TOOL_CURSOR_PAINTBRUSH); gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (paintbrush), GIMP_COLOR_PICK_MODE_FOREGROUND); diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c index 32ddb4fb23..8ce8758fc1 100644 --- a/app/tools/gimppainttool.c +++ b/app/tools/gimppainttool.c @@ -69,23 +69,23 @@ static GObject * gimp_paint_tool_constructor (GType type, static void gimp_paint_tool_finalize (GObject *object); static void gimp_paint_tool_control (GimpTool *tool, - GimpToolAction action, - GimpDisplay *gdisp); + GimpToolAction action, + GimpDisplay *gdisp); static void gimp_paint_tool_button_press (GimpTool *tool, GimpCoords *coords, guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_paint_tool_button_release (GimpTool *tool, GimpCoords *coords, guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_paint_tool_motion (GimpTool *tool, GimpCoords *coords, guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_paint_tool_arrow_key (GimpTool *tool, GdkEventKey *kevent, GimpDisplay *gdisp); @@ -96,8 +96,12 @@ static void gimp_paint_tool_modifier_key (GimpTool *tool, GimpDisplay *gdisp); static void gimp_paint_tool_oper_update (GimpTool *tool, GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_paint_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_paint_tool_draw (GimpDrawTool *draw_tool); @@ -162,6 +166,7 @@ gimp_paint_tool_class_init (GimpPaintToolClass *klass) tool_class->arrow_key = gimp_paint_tool_arrow_key; tool_class->modifier_key = gimp_paint_tool_modifier_key; tool_class->oper_update = gimp_paint_tool_oper_update; + tool_class->cursor_update = gimp_paint_tool_cursor_update; draw_tool_class->draw = gimp_paint_tool_draw; @@ -178,6 +183,7 @@ gimp_paint_tool_init (GimpPaintTool *paint_tool) paint_tool->pick_colors = FALSE; paint_tool->draw_line = FALSE; + paint_tool->show_cursor = TRUE; paint_tool->draw_brush = TRUE; paint_tool->brush_x = 0.0; paint_tool->brush_y = 0.0; @@ -201,9 +207,15 @@ gimp_paint_tool_constructor (GType type, g_assert (GIMP_IS_TOOL_INFO (tool->tool_info)); + paint_tool->show_cursor = + GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_paint_tool_cursor; paint_tool->draw_brush = GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_brush_outline; + g_signal_connect_object (tool->tool_info->gimp->config, + "notify::show-paint-tool-cursor", + G_CALLBACK (gimp_paint_tool_notify_brush), + paint_tool, 0); g_signal_connect_object (tool->tool_info->gimp->config, "notify::show-brush-outline", G_CALLBACK (gimp_paint_tool_notify_brush), @@ -850,6 +862,26 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool) GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool); } +static void +gimp_paint_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp) +{ + GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool); + + if (! paint_tool->show_cursor) + { + gimp_tool_set_cursor (tool, gdisp, + GIMP_CURSOR_NONE, + GIMP_TOOL_CURSOR_NONE, + GIMP_CURSOR_MODIFIER_NONE); + return; + } + + GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp); +} + static void gimp_paint_tool_color_picked (GimpColorTool *color_tool, GimpImageType sample_type, @@ -887,7 +919,8 @@ gimp_paint_tool_notify_brush (GimpDisplayConfig *config, { gimp_draw_tool_pause (GIMP_DRAW_TOOL (paint_tool)); - paint_tool->draw_brush = config->show_brush_outline; + paint_tool->show_cursor = config->show_paint_tool_cursor; + paint_tool->draw_brush = config->show_brush_outline; gimp_draw_tool_resume (GIMP_DRAW_TOOL (paint_tool)); } diff --git a/app/tools/gimppainttool.h b/app/tools/gimppainttool.h index a9abc99a06..c30669d95d 100644 --- a/app/tools/gimppainttool.h +++ b/app/tools/gimppainttool.h @@ -40,6 +40,7 @@ struct _GimpPaintTool gboolean pick_colors; /* pick color if ctrl is pressed */ gboolean draw_line; + gboolean show_cursor; gboolean draw_brush; gdouble brush_x; gdouble brush_y; diff --git a/app/tools/gimppenciltool.c b/app/tools/gimppenciltool.c index 66ae307674..b9de7d8516 100644 --- a/app/tools/gimppenciltool.c +++ b/app/tools/gimppenciltool.c @@ -89,7 +89,7 @@ gimp_pencil_tool_init (GimpPencilTool *pencil) GimpTool *tool = GIMP_TOOL (pencil); gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_EXACT); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_PENCIL_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_PENCIL); gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (pencil), GIMP_COLOR_PICK_MODE_FOREGROUND); diff --git a/app/tools/gimpperspectivetool.c b/app/tools/gimpperspectivetool.c index 80d58f72b5..967584f5a8 100644 --- a/app/tools/gimpperspectivetool.c +++ b/app/tools/gimpperspectivetool.c @@ -138,7 +138,7 @@ gimp_perspective_tool_init (GimpPerspectiveTool *perspective_tool) GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (perspective_tool); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_PERSPECTIVE_TOOL_CURSOR); + GIMP_TOOL_CURSOR_PERSPECTIVE); tr_tool->shell_desc = _("Perspective Transform Information"); tr_tool->progress_text = _("Perspective..."); diff --git a/app/tools/gimprectselecttool.c b/app/tools/gimprectselecttool.c index 9b50a7de31..f316c63196 100644 --- a/app/tools/gimprectselecttool.c +++ b/app/tools/gimprectselecttool.c @@ -136,11 +136,8 @@ gimp_rect_select_tool_get_type (void) static void gimp_rect_select_tool_class_init (GimpRectSelectToolClass *klass) { - GimpToolClass *tool_class; - GimpDrawToolClass *draw_tool_class; - - tool_class = GIMP_TOOL_CLASS (klass); - draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -159,7 +156,7 @@ gimp_rect_select_tool_init (GimpRectSelectTool *rect_select) GimpTool *tool = GIMP_TOOL (rect_select); gimp_tool_control_set_tool_cursor (tool->control, - GIMP_RECT_SELECT_TOOL_CURSOR); + GIMP_TOOL_CURSOR_RECT_SELECT); rect_select->x = rect_select->y = 0.0; rect_select->w = rect_select->h = 0.0; @@ -172,15 +169,13 @@ gimp_rect_select_tool_button_press (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpRectSelectTool *rect_sel; - GimpSelectionTool *sel_tool; + GimpRectSelectTool *rect_sel = GIMP_RECT_SELECT_TOOL (tool); + GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool); GimpSelectionOptions *options; - GimpUnit unit = GIMP_UNIT_PIXEL; + GimpUnit unit = GIMP_UNIT_PIXEL; gdouble unit_factor; - rect_sel = GIMP_RECT_SELECT_TOOL (tool); - sel_tool = GIMP_SELECTION_TOOL (tool); - options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); + options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); rect_sel->x = coords->x; rect_sel->y = coords->y; @@ -264,16 +259,12 @@ gimp_rect_select_tool_button_release (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpRectSelectTool *rect_sel; - GimpSelectionTool *sel_tool; + GimpRectSelectTool *rect_sel = GIMP_RECT_SELECT_TOOL (tool); gdouble x, y; gdouble w, h; gint ix, iy; gint iw, ih; - rect_sel = GIMP_RECT_SELECT_TOOL (tool); - sel_tool = GIMP_SELECTION_TOOL (tool); - gimp_tool_pop_status (tool); gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool)); @@ -323,8 +314,8 @@ gimp_rect_select_tool_motion (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpRectSelectTool *rect_sel; - GimpSelectionTool *sel_tool; + GimpRectSelectTool *rect_sel = GIMP_RECT_SELECT_TOOL (tool); + GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool); gdouble ox, oy; gdouble w, h; gdouble tw, th; @@ -332,9 +323,6 @@ gimp_rect_select_tool_motion (GimpTool *tool, gint ix, iy; gint iw, ih; - rect_sel = GIMP_RECT_SELECT_TOOL (tool); - sel_tool = GIMP_SELECTION_TOOL (tool); - if (coords->x != rect_sel->x || coords->y != rect_sel->y) rect_sel->moved = TRUE; @@ -523,13 +511,11 @@ gimp_rect_select_tool_real_rect_select (GimpRectSelectTool *rect_tool, gint w, gint h) { - GimpTool *tool; - GimpSelectionTool *sel_tool; + GimpTool *tool = GIMP_TOOL (rect_tool); + GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (rect_tool); GimpSelectionOptions *options; - tool = GIMP_TOOL (rect_tool); - sel_tool = GIMP_SELECTION_TOOL (rect_tool); - options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); + options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); gimp_channel_select_rectangle (gimp_image_get_mask (tool->gdisp->gimage), x, y, w, h, diff --git a/app/tools/gimpregionselecttool.c b/app/tools/gimpregionselecttool.c index f2d6d68d23..b19237f8f8 100644 --- a/app/tools/gimpregionselecttool.c +++ b/app/tools/gimpregionselecttool.c @@ -86,8 +86,6 @@ static GdkSegment * static GimpSelectionToolClass *parent_class = NULL; -/* public functions */ - void gimp_fuzzy_select_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -115,37 +113,30 @@ gimp_fuzzy_select_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpFuzzySelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_fuzzy_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFuzzySelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_fuzzy_select_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_fuzzy_select_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpFuzzySelectTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_fuzzy_select_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpFuzzySelectTool", + "GimpFuzzySelectTool", &tool_info, 0); } return tool_type; } - -/* private functions */ - static void gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpDrawToolClass *draw_tool_class; - - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -161,13 +152,11 @@ gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass) static void gimp_fuzzy_select_tool_init (GimpFuzzySelectTool *fuzzy_select) { - GimpTool *tool; - - tool = GIMP_TOOL (fuzzy_select); + GimpTool *tool = GIMP_TOOL (fuzzy_select); gimp_tool_control_set_scroll_lock (tool->control, TRUE); gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_COMPRESS); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_FUZZY_SELECT_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_FUZZY_SELECT); fuzzy_select->x = 0; fuzzy_select->y = 0; @@ -183,9 +172,7 @@ gimp_fuzzy_select_tool_init (GimpFuzzySelectTool *fuzzy_select) static void gimp_fuzzy_select_tool_finalize (GObject *object) { - GimpFuzzySelectTool *fuzzy_sel; - - fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (object); + GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (object); if (fuzzy_sel->fuzzy_mask) { @@ -210,10 +197,9 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpFuzzySelectTool *fuzzy_sel; + GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); GimpSelectionOptions *options; - fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); fuzzy_sel->x = coords->x; @@ -254,10 +240,9 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpFuzzySelectTool *fuzzy_sel; + GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); GimpSelectionOptions *options; - fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool)); @@ -290,9 +275,7 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool, } else { - GimpDrawable *drawable; - - drawable = gimp_image_active_drawable (gdisp->gimage); + GimpDrawable *drawable = gimp_image_active_drawable (gdisp->gimage); gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y); } @@ -334,8 +317,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpFuzzySelectTool *fuzzy_sel; - GimpSelectionTool *sel_tool; + GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); GimpSelectionOptions *options; GdkSegment *new_segs; gint num_new_segs; @@ -344,9 +326,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool, static guint32 last_time = 0; - fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool); - sel_tool = GIMP_SELECTION_TOOL (tool); - options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); + options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); /* don't let the events come in too fast, ignore below a delay of 100 ms */ if (time - last_time < 100) @@ -400,7 +380,7 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel, GimpDisplay *gdisp, gint *num_segs) { - GimpTool *tool; + GimpTool *tool = GIMP_TOOL (fuzzy_sel); GimpSelectionOptions *options; GimpDisplayShell *shell; PixelRegion maskPR; @@ -411,7 +391,6 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel, gint i; gint x, y; - tool = GIMP_TOOL (fuzzy_sel); options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); shell = GIMP_DISPLAY_SHELL (gdisp->shell); diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c index 5402448377..b4a84a77a9 100644 --- a/app/tools/gimprotatetool.c +++ b/app/tools/gimprotatetool.c @@ -118,18 +118,18 @@ gimp_rotate_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpRotateToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_rotate_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpRotateTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_rotate_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_rotate_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpRotateTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_rotate_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_TRANSFORM_TOOL, - "GimpRotateTool", + "GimpRotateTool", &tool_info, 0); } @@ -142,9 +142,7 @@ gimp_rotate_tool_get_type (void) static void gimp_rotate_tool_class_init (GimpRotateToolClass *klass) { - GimpTransformToolClass *trans_class; - - trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); + GimpTransformToolClass *trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -160,7 +158,7 @@ gimp_rotate_tool_init (GimpRotateTool *rotate_tool) GimpTool *tool = GIMP_TOOL (rotate_tool); GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (rotate_tool); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_ROTATE_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_ROTATE); tr_tool->shell_desc = _("Rotation Information"); tr_tool->progress_text = _("Rotating..."); diff --git a/app/tools/gimpscaletool.c b/app/tools/gimpscaletool.c index 2c6d84fd1b..5a686581f6 100644 --- a/app/tools/gimpscaletool.c +++ b/app/tools/gimpscaletool.c @@ -114,18 +114,18 @@ gimp_scale_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpScaleToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_scale_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpScaleTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_scale_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_scale_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpScaleTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_scale_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_TRANSFORM_TOOL, - "GimpScaleTool", + "GimpScaleTool", &tool_info, 0); } @@ -138,9 +138,7 @@ gimp_scale_tool_get_type (void) static void gimp_scale_tool_class_init (GimpScaleToolClass *klass) { - GimpTransformToolClass *trans_class; - - trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); + GimpTransformToolClass *trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -156,7 +154,7 @@ gimp_scale_tool_init (GimpScaleTool *scale_tool) GimpTool *tool = GIMP_TOOL (scale_tool); GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (scale_tool); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_RESIZE_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_RESIZE); tr_tool->shell_desc = _("Scaling Information"); tr_tool->progress_text = _("Scaling..."); diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c index 4d91cb8f34..14d3d1736b 100644 --- a/app/tools/gimpselectiontool.c +++ b/app/tools/gimpselectiontool.c @@ -265,7 +265,7 @@ gimp_selection_tool_cursor_update (GimpTool *tool, break; case SELECTION_MOVE: case SELECTION_MOVE_COPY: - tool_cursor = GIMP_MOVE_TOOL_CURSOR; + tool_cursor = GIMP_TOOL_CURSOR_MOVE; break; case SELECTION_ANCHOR: cmodifier = GIMP_CURSOR_MODIFIER_ANCHOR; @@ -273,7 +273,5 @@ gimp_selection_tool_cursor_update (GimpTool *tool, } gimp_tool_set_cursor (tool, gdisp, - GIMP_MOUSE_CURSOR, - tool_cursor, - cmodifier); + GIMP_CURSOR_MOUSE, tool_cursor, cmodifier); } diff --git a/app/tools/gimpsheartool.c b/app/tools/gimpsheartool.c index e7b5b1f41c..923e5d8859 100644 --- a/app/tools/gimpsheartool.c +++ b/app/tools/gimpsheartool.c @@ -115,18 +115,18 @@ gimp_shear_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpShearToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_shear_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpShearTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_shear_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_shear_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpShearTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_shear_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_TRANSFORM_TOOL, - "GimpShearTool", + "GimpShearTool", &tool_info, 0); } @@ -136,9 +136,7 @@ gimp_shear_tool_get_type (void) static void gimp_shear_tool_class_init (GimpShearToolClass *klass) { - GimpTransformToolClass *trans_class; - - trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); + GimpTransformToolClass *trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -154,7 +152,7 @@ gimp_shear_tool_init (GimpShearTool *shear_tool) GimpTool *tool = GIMP_TOOL (shear_tool); GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (shear_tool); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_SHEAR_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_SHEAR); tr_tool->use_center = FALSE; tr_tool->shell_desc = _("Shearing Information"); diff --git a/app/tools/gimpsmudgetool.c b/app/tools/gimpsmudgetool.c index f7d360e534..e7fb795e32 100644 --- a/app/tools/gimpsmudgetool.c +++ b/app/tools/gimpsmudgetool.c @@ -92,7 +92,7 @@ gimp_smudge_tool_init (GimpSmudgeTool *smudge) { GimpTool *tool = GIMP_TOOL (smudge); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_SMUDGE_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_SMUDGE); gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (smudge), GIMP_COLOR_PICK_MODE_FOREGROUND); diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c index 07792c1f56..b7324c67f5 100644 --- a/app/tools/gimpsourcetool.c +++ b/app/tools/gimpsourcetool.c @@ -155,7 +155,7 @@ gimp_clone_tool_init (GimpCloneTool *clone) { GimpTool *tool = GIMP_TOOL (clone); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_CLONE_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_CLONE); } static GObject * @@ -224,7 +224,7 @@ gimp_clone_tool_cursor_update (GimpTool *tool, GimpDisplay *gdisp) { GimpCloneOptions *options; - GdkCursorType ctype = GIMP_MOUSE_CURSOR; + GdkCursorType ctype = GIMP_CURSOR_MOUSE; options = (GimpCloneOptions *) tool->tool_info->tool_options; @@ -236,17 +236,17 @@ gimp_clone_tool_cursor_update (GimpTool *tool, * if so, is cursor inside? */ if (gimp_channel_is_empty (selection)) - ctype = GIMP_MOUSE_CURSOR; + ctype = GIMP_CURSOR_MOUSE; else if (gimp_channel_value (selection, coords->x, coords->y)) - ctype = GIMP_MOUSE_CURSOR; + ctype = GIMP_CURSOR_MOUSE; } if (options->clone_type == GIMP_IMAGE_CLONE) { if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK) - ctype = GIMP_CROSSHAIR_SMALL_CURSOR; + ctype = GIMP_CURSOR_CROSSHAIR_SMALL; else if (! GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core)->src_drawable) - ctype = GIMP_BAD_CURSOR; + ctype = GIMP_CURSOR_BAD; } gimp_tool_control_set_cursor (tool->control, ctype); diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index 4c196308a6..3dd3b8649a 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -157,18 +157,18 @@ gimp_text_tool_get_type (void) static const GTypeInfo tool_info = { sizeof (GimpTextToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_text_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpTextTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_text_tool_init, + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_text_tool_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpTextTool), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_text_tool_init, }; tool_type = g_type_register_static (GIMP_TYPE_TOOL, - "GimpTextTool", + "GimpTextTool", &tool_info, 0); } @@ -211,7 +211,7 @@ gimp_text_tool_init (GimpTextTool *text_tool) gimp_tool_control_set_scroll_lock (tool->control, TRUE); gimp_tool_control_set_preserve (tool->control, TRUE); - gimp_tool_control_set_tool_cursor (tool->control, GIMP_TEXT_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_TEXT); } static GObject * diff --git a/app/tools/gimptoolcontrol.c b/app/tools/gimptoolcontrol.c index 59bfa52592..e8311007b7 100644 --- a/app/tools/gimptoolcontrol.c +++ b/app/tools/gimptoolcontrol.c @@ -85,11 +85,11 @@ gimp_tool_control_init (GimpToolControl *control) control->handle_empty_image = FALSE; control->motion_mode = GIMP_MOTION_MODE_HINT; - control->cursor = GIMP_MOUSE_CURSOR; + control->cursor = GIMP_CURSOR_MOUSE; control->tool_cursor = GIMP_TOOL_CURSOR_NONE; control->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE; - control->toggle_cursor = GIMP_MOUSE_CURSOR; + control->toggle_cursor = GIMP_CURSOR_MOUSE; control->toggle_tool_cursor = GIMP_TOOL_CURSOR_NONE; control->toggle_cursor_modifier = GIMP_CURSOR_MODIFIER_NONE; } diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index 38ec47a047..6e80c0fd6d 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -608,14 +608,14 @@ gimp_transform_tool_cursor_update (GimpTool *tool, if (GIMP_IS_LAYER (drawable) && gimp_layer_get_mask (GIMP_LAYER (drawable))) { - ctype = GIMP_BAD_CURSOR; + ctype = GIMP_CURSOR_BAD; } else if (gimp_display_coords_in_active_drawable (gdisp, coords)) { if (gimp_channel_is_empty (selection) || gimp_channel_value (selection, coords->x, coords->y)) { - ctype = GIMP_MOUSE_CURSOR; + ctype = GIMP_CURSOR_MOUSE; } } } @@ -626,15 +626,15 @@ gimp_transform_tool_cursor_update (GimpTool *tool, if (gimp_channel_is_empty (selection) || gimp_channel_value (selection, coords->x, coords->y)) { - ctype = GIMP_MOUSE_CURSOR; + ctype = GIMP_CURSOR_MOUSE; } break; case GIMP_TRANSFORM_TYPE_PATH: if (gimp_image_get_active_vectors (gdisp->gimage)) - ctype = GIMP_MOUSE_CURSOR; + ctype = GIMP_CURSOR_MOUSE; else - ctype = GIMP_BAD_CURSOR; + ctype = GIMP_CURSOR_BAD; break; } diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c index ab1ceb5cdf..4eedc2209b 100644 --- a/app/tools/gimpvectortool.c +++ b/app/tools/gimpvectortool.c @@ -223,8 +223,7 @@ gimp_vector_tool_init (GimpVectorTool *vector_tool) gimp_tool_control_set_scroll_lock (tool->control, TRUE); gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_COMPRESS); - gimp_tool_control_set_tool_cursor (tool->control, - GIMP_BEZIER_SELECT_TOOL_CURSOR); + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_PATHS); vector_tool->status_msg = NULL; @@ -1252,15 +1251,15 @@ gimp_vector_tool_cursor_update (GimpTool *tool, vector_tool = GIMP_VECTOR_TOOL (tool); - cursor = GIMP_MOUSE_CURSOR; - tool_cursor = GIMP_BEZIER_SELECT_TOOL_CURSOR; + cursor = GIMP_CURSOR_MOUSE; + tool_cursor = GIMP_TOOL_CURSOR_PATHS; cmodifier = GIMP_CURSOR_MODIFIER_NONE; switch (vector_tool->function) { case VECTORS_SELECT_VECTOR: cursor = GDK_HAND2; - tool_cursor = GIMP_HAND_TOOL_CURSOR; + tool_cursor = GIMP_TOOL_CURSOR_HAND; break; case VECTORS_CREATE_VECTOR: case VECTORS_CREATE_STROKE: @@ -1277,7 +1276,7 @@ gimp_vector_tool_cursor_update (GimpTool *tool, case VECTORS_MOVE_HANDLE: case VECTORS_CONVERT_EDGE: cursor = GDK_HAND2; - tool_cursor = GIMP_HAND_TOOL_CURSOR; + tool_cursor = GIMP_TOOL_CURSOR_HAND; cmodifier = GIMP_CURSOR_MODIFIER_CONTROL; break; case VECTORS_MOVE_ANCHOR: @@ -1291,12 +1290,12 @@ gimp_vector_tool_cursor_update (GimpTool *tool, cmodifier = GIMP_CURSOR_MODIFIER_INTERSECT; break; default: - cursor = GIMP_BAD_CURSOR; + cursor = GIMP_CURSOR_BAD; break; } - gimp_tool_control_set_cursor (tool->control, cursor); - gimp_tool_control_set_tool_cursor (tool->control, tool_cursor); + gimp_tool_control_set_cursor (tool->control, cursor); + gimp_tool_control_set_tool_cursor (tool->control, tool_cursor); gimp_tool_control_set_cursor_modifier (tool->control, cmodifier); GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp); @@ -1305,19 +1304,15 @@ gimp_vector_tool_cursor_update (GimpTool *tool, static void gimp_vector_tool_draw (GimpDrawTool *draw_tool) { - GimpVectorTool *vector_tool; - GimpTool *tool; - GimpAnchor *cur_anchor = NULL; - GimpStroke *cur_stroke = NULL; + GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (draw_tool); + GimpAnchor *cur_anchor = NULL; + GimpStroke *cur_stroke = NULL; GimpVectors *vectors; GArray *coords; gboolean closed; GList *draw_anchors; GList *list; - vector_tool = GIMP_VECTOR_TOOL (draw_tool); - tool = GIMP_TOOL (draw_tool); - vectors = vector_tool->vectors; if (!vectors) diff --git a/app/widgets/gimpcursor.c b/app/widgets/gimpcursor.c index 56dd466626..78e9f2828d 100644 --- a/app/widgets/gimpcursor.c +++ b/app/widgets/gimpcursor.c @@ -27,6 +27,7 @@ #include "cursors/gimp-tool-cursors.h" /* standard gimp cursors */ +#include "cursors/xbm/cursor-none.xbm" #include "cursors/xbm/cursor-mouse.xbm" #include "cursors/xbm/cursor-mouse-mask.xbm" #include "cursors/xbm/cursor-crosshair.xbm" @@ -148,6 +149,13 @@ static GimpBitmapCursor gimp_cursors[] = { /* these have to match up with enum GimpCursorType in widgets-enums.h */ + { + cursor_none_bits, cursor_none_bits, + cursor_none_width, cursor_none_height, + cursor_none_x_hot, cursor_none_y_hot, NULL, NULL, + + cursor_none, NULL + }, { cursor_mouse_bits, cursor_mouse_mask_bits, cursor_mouse_width, cursor_mouse_height, @@ -556,31 +564,31 @@ gimp_cursor_new (GdkDisplay *display, GimpBitmapCursor *bmtool = NULL; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - g_return_val_if_fail (cursor_type < GIMP_LAST_CURSOR_ENTRY, NULL); + g_return_val_if_fail (cursor_type < GIMP_CURSOR_LAST, NULL); if (cursor_type <= GDK_LAST_CURSOR) return gdk_cursor_new_for_display (display, cursor_type); - g_return_val_if_fail (cursor_type >= GIMP_MOUSE_CURSOR, NULL); + g_return_val_if_fail (cursor_type >= GIMP_CURSOR_NONE, NULL); /* allow the small tool cursor only with the standard mouse, * the small crosshair and the bad cursor */ - if (cursor_type != GIMP_MOUSE_CURSOR && - cursor_type != GIMP_CROSSHAIR_SMALL_CURSOR && - cursor_type != GIMP_BAD_CURSOR) + if (cursor_type != GIMP_CURSOR_MOUSE && + cursor_type != GIMP_CURSOR_CROSSHAIR_SMALL && + cursor_type != GIMP_CURSOR_BAD) { tool_cursor = GIMP_TOOL_CURSOR_NONE; } /* prepare the main cursor */ - cursor_type -= GIMP_MOUSE_CURSOR; + cursor_type -= GIMP_CURSOR_NONE; bmcursor = &gimp_cursors[cursor_type]; /* prepare the tool cursor */ - if (tool_cursor >= GIMP_LAST_STOCK_TOOL_CURSOR_ENTRY) + if (tool_cursor >= GIMP_TOOL_CURSOR_LAST) tool_cursor = GIMP_TOOL_CURSOR_NONE; if (tool_cursor != GIMP_TOOL_CURSOR_NONE) diff --git a/app/widgets/widgets-enums.h b/app/widgets/widgets-enums.h index 808de611d7..2de28f04d6 100644 --- a/app/widgets/widgets-enums.h +++ b/app/widgets/widgets-enums.h @@ -190,50 +190,51 @@ typedef enum /*< skip >*/ typedef enum /*< skip >*/ { - GIMP_MOUSE_CURSOR = 1024 /* (GDK_LAST_CURSOR + 2) yes, this is insane */, - GIMP_CROSSHAIR_CURSOR, - GIMP_CROSSHAIR_SMALL_CURSOR, - GIMP_BAD_CURSOR, - GIMP_ZOOM_CURSOR, - GIMP_COLOR_PICKER_CURSOR, - GIMP_LAST_CURSOR_ENTRY + GIMP_CURSOR_NONE = 1024, /* (GDK_LAST_CURSOR + 2) yes, this is insane */ + GIMP_CURSOR_MOUSE, + GIMP_CURSOR_CROSSHAIR, + GIMP_CURSOR_CROSSHAIR_SMALL, + GIMP_CURSOR_BAD, + GIMP_CURSOR_ZOOM, + GIMP_CURSOR_COLOR_PICKER, + GIMP_CURSOR_LAST } GimpCursorType; typedef enum /*< skip >*/ { GIMP_TOOL_CURSOR_NONE, - GIMP_RECT_SELECT_TOOL_CURSOR, - GIMP_ELLIPSE_SELECT_TOOL_CURSOR, - GIMP_FREE_SELECT_TOOL_CURSOR, - GIMP_FUZZY_SELECT_TOOL_CURSOR, - GIMP_BEZIER_SELECT_TOOL_CURSOR, - GIMP_SCISSORS_TOOL_CURSOR, - GIMP_MOVE_TOOL_CURSOR, - GIMP_ZOOM_TOOL_CURSOR, - GIMP_CROP_TOOL_CURSOR, - GIMP_RESIZE_TOOL_CURSOR, - GIMP_ROTATE_TOOL_CURSOR, - GIMP_SHEAR_TOOL_CURSOR, - GIMP_PERSPECTIVE_TOOL_CURSOR, - GIMP_FLIP_HORIZONTAL_TOOL_CURSOR, - GIMP_FLIP_VERTICAL_TOOL_CURSOR, - GIMP_TEXT_TOOL_CURSOR, - GIMP_COLOR_PICKER_TOOL_CURSOR, - GIMP_BUCKET_FILL_TOOL_CURSOR, - GIMP_BLEND_TOOL_CURSOR, - GIMP_PENCIL_TOOL_CURSOR, - GIMP_PAINTBRUSH_TOOL_CURSOR, - GIMP_AIRBRUSH_TOOL_CURSOR, - GIMP_INK_TOOL_CURSOR, - GIMP_CLONE_TOOL_CURSOR, - GIMP_ERASER_TOOL_CURSOR, - GIMP_SMUDGE_TOOL_CURSOR, - GIMP_BLUR_TOOL_CURSOR, - GIMP_DODGE_TOOL_CURSOR, - GIMP_BURN_TOOL_CURSOR, - GIMP_MEASURE_TOOL_CURSOR, - GIMP_HAND_TOOL_CURSOR, - GIMP_LAST_STOCK_TOOL_CURSOR_ENTRY + GIMP_TOOL_CURSOR_RECT_SELECT, + GIMP_TOOL_CURSOR_ELLIPSE_SELECT, + GIMP_TOOL_CURSOR_FREE_SELECT, + GIMP_TOOL_CURSOR_FUZZY_SELECT, + GIMP_TOOL_CURSOR_PATHS, + GIMP_TOOL_CURSOR_ISCISSORS, + GIMP_TOOL_CURSOR_MOVE, + GIMP_TOOL_CURSOR_ZOOM, + GIMP_TOOL_CURSOR_CROP, + GIMP_TOOL_CURSOR_RESIZE, + GIMP_TOOL_CURSOR_ROTATE, + GIMP_TOOL_CURSOR_SHEAR, + GIMP_TOOL_CURSOR_PERSPECTIVE, + GIMP_TOOL_CURSOR_FLIP_HORIZONTAL, + GIMP_TOOL_CURSOR_FLIP_VERTICAL, + GIMP_TOOL_CURSOR_TEXT, + GIMP_TOOL_CURSOR_COLOR_PICKER, + GIMP_TOOL_CURSOR_BUCKET_FILL, + GIMP_TOOL_CURSOR_BLEND, + GIMP_TOOL_CURSOR_PENCIL, + GIMP_TOOL_CURSOR_PAINTBRUSH, + GIMP_TOOL_CURSOR_AIRBRUSH, + GIMP_TOOL_CURSOR_INK, + GIMP_TOOL_CURSOR_CLONE, + GIMP_TOOL_CURSOR_ERASER, + GIMP_TOOL_CURSOR_SMUDGE, + GIMP_TOOL_CURSOR_BLUR, + GIMP_TOOL_CURSOR_DODGE, + GIMP_TOOL_CURSOR_BURN, + GIMP_TOOL_CURSOR_MEASURE, + GIMP_TOOL_CURSOR_HAND, + GIMP_TOOL_CURSOR_LAST } GimpToolCursorType; typedef enum /*< skip >*/ diff --git a/cursors/Makefile.am b/cursors/Makefile.am index a21b1f64d5..a9ebbc1d26 100644 --- a/cursors/Makefile.am +++ b/cursors/Makefile.am @@ -6,6 +6,7 @@ CURSOR_IMAGES = \ cursor-crosshair.png \ cursor-crosshair-small.png \ cursor-mouse.png \ + cursor-none.png \ cursor-zoom.png \ \ modifier-anchor.png \ @@ -55,6 +56,7 @@ EXTRA_DIST = \ $(CURSOR_IMAGES) \ gimp-tool-cursors.xcf \ \ + xbm/cursor-none.xbm \ xbm/cursor-mouse.xbm \ xbm/cursor-mouse-mask.xbm \ xbm/cursor-crosshair.xbm \ diff --git a/cursors/cursor-none.png b/cursors/cursor-none.png new file mode 100644 index 0000000000..a16d6562a6 Binary files /dev/null and b/cursors/cursor-none.png differ diff --git a/cursors/xbm/cursor-none.xbm b/cursors/xbm/cursor-none.xbm new file mode 100644 index 0000000000..563ed173cd --- /dev/null +++ b/cursors/xbm/cursor-none.xbm @@ -0,0 +1,16 @@ +#define cursor_none_width 32 +#define cursor_none_height 32 +#define cursor_none_x_hot 10 +#define cursor_none_y_hot 10 +static unsigned char cursor_none_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };