diff --git a/ChangeLog b/ChangeLog index 633e74efd8..ac752ebb5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jun 8 01:12:31 MEST 1999 Sven Neumann + + * app/flip_tool.c: Only install the tool cursor if we are inside a + selected region. + Tue Jun 8 00:30:57 MEST 1999 Sven Neumann * app/bucket_fill.c diff --git a/app/flip_tool.c b/app/flip_tool.c index 300468ed42..f16d3f85b2 100644 --- a/app/flip_tool.c +++ b/app/flip_tool.c @@ -22,6 +22,7 @@ #include "drawable.h" #include "flip_tool.h" #include "gdisplay.h" +#include "gimage_mask.h" #include "temp_buf.h" #include "tool_options_ui.h" #include "transform_core.h" @@ -154,15 +155,34 @@ flip_cursor_update (Tool *tool, gpointer gdisp_ptr) { GDisplay *gdisp; + Layer *layer; GdkCursorType ctype = GDK_TOP_LEFT_ARROW; gdisp = (GDisplay *) gdisp_ptr; + + if ((layer = gimage_get_active_layer (gdisp->gimage))) + { + int x, y, off_x, off_y; - if (flip_options->type == FLIP_HORZ) - ctype = GDK_SB_H_DOUBLE_ARROW; - else - ctype = GDK_SB_V_DOUBLE_ARROW; + drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y); + gdisplay_untransform_coords (gdisp, (double) mevent->x, + (double) mevent->y, + &x, &y, TRUE, FALSE); + if (x >= off_x && y >= off_y && + x < (off_x + drawable_width (GIMP_DRAWABLE(layer))) && + y < (off_y + drawable_height (GIMP_DRAWABLE(layer)))) + { + /* Is there a selected region? If so, is cursor inside? */ + if (gimage_mask_is_empty (gdisp->gimage) || gimage_mask_value (gdisp->gimage, x, y)) + { + if (flip_options->type == FLIP_HORZ) + ctype = GDK_SB_H_DOUBLE_ARROW; + else + ctype = GDK_SB_V_DOUBLE_ARROW; + } + } + } gdisplay_install_tool_cursor (gdisp, ctype); } diff --git a/app/tools/flip_tool.c b/app/tools/flip_tool.c index 300468ed42..f16d3f85b2 100644 --- a/app/tools/flip_tool.c +++ b/app/tools/flip_tool.c @@ -22,6 +22,7 @@ #include "drawable.h" #include "flip_tool.h" #include "gdisplay.h" +#include "gimage_mask.h" #include "temp_buf.h" #include "tool_options_ui.h" #include "transform_core.h" @@ -154,15 +155,34 @@ flip_cursor_update (Tool *tool, gpointer gdisp_ptr) { GDisplay *gdisp; + Layer *layer; GdkCursorType ctype = GDK_TOP_LEFT_ARROW; gdisp = (GDisplay *) gdisp_ptr; + + if ((layer = gimage_get_active_layer (gdisp->gimage))) + { + int x, y, off_x, off_y; - if (flip_options->type == FLIP_HORZ) - ctype = GDK_SB_H_DOUBLE_ARROW; - else - ctype = GDK_SB_V_DOUBLE_ARROW; + drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y); + gdisplay_untransform_coords (gdisp, (double) mevent->x, + (double) mevent->y, + &x, &y, TRUE, FALSE); + if (x >= off_x && y >= off_y && + x < (off_x + drawable_width (GIMP_DRAWABLE(layer))) && + y < (off_y + drawable_height (GIMP_DRAWABLE(layer)))) + { + /* Is there a selected region? If so, is cursor inside? */ + if (gimage_mask_is_empty (gdisp->gimage) || gimage_mask_value (gdisp->gimage, x, y)) + { + if (flip_options->type == FLIP_HORZ) + ctype = GDK_SB_H_DOUBLE_ARROW; + else + ctype = GDK_SB_V_DOUBLE_ARROW; + } + } + } gdisplay_install_tool_cursor (gdisp, ctype); } diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c index 300468ed42..f16d3f85b2 100644 --- a/app/tools/gimpfliptool.c +++ b/app/tools/gimpfliptool.c @@ -22,6 +22,7 @@ #include "drawable.h" #include "flip_tool.h" #include "gdisplay.h" +#include "gimage_mask.h" #include "temp_buf.h" #include "tool_options_ui.h" #include "transform_core.h" @@ -154,15 +155,34 @@ flip_cursor_update (Tool *tool, gpointer gdisp_ptr) { GDisplay *gdisp; + Layer *layer; GdkCursorType ctype = GDK_TOP_LEFT_ARROW; gdisp = (GDisplay *) gdisp_ptr; + + if ((layer = gimage_get_active_layer (gdisp->gimage))) + { + int x, y, off_x, off_y; - if (flip_options->type == FLIP_HORZ) - ctype = GDK_SB_H_DOUBLE_ARROW; - else - ctype = GDK_SB_V_DOUBLE_ARROW; + drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y); + gdisplay_untransform_coords (gdisp, (double) mevent->x, + (double) mevent->y, + &x, &y, TRUE, FALSE); + if (x >= off_x && y >= off_y && + x < (off_x + drawable_width (GIMP_DRAWABLE(layer))) && + y < (off_y + drawable_height (GIMP_DRAWABLE(layer)))) + { + /* Is there a selected region? If so, is cursor inside? */ + if (gimage_mask_is_empty (gdisp->gimage) || gimage_mask_value (gdisp->gimage, x, y)) + { + if (flip_options->type == FLIP_HORZ) + ctype = GDK_SB_H_DOUBLE_ARROW; + else + ctype = GDK_SB_V_DOUBLE_ARROW; + } + } + } gdisplay_install_tool_cursor (gdisp, ctype); }