Only install the tool cursor if we are inside a selected region.

--Sven
This commit is contained in:
Sven Neumann 1999-06-07 23:15:18 +00:00
parent 52f8d96885
commit 93452ea4d6
4 changed files with 77 additions and 12 deletions

View File

@ -1,3 +1,8 @@
Tue Jun 8 01:12:31 MEST 1999 Sven Neumann <sven@gimp.org>
* 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 <sven@gimp.org> Tue Jun 8 00:30:57 MEST 1999 Sven Neumann <sven@gimp.org>
* app/bucket_fill.c * app/bucket_fill.c

View File

@ -22,6 +22,7 @@
#include "drawable.h" #include "drawable.h"
#include "flip_tool.h" #include "flip_tool.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tool_options_ui.h" #include "tool_options_ui.h"
#include "transform_core.h" #include "transform_core.h"
@ -154,15 +155,34 @@ flip_cursor_update (Tool *tool,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp; GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW; GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
gdisp = (GDisplay *) gdisp_ptr; 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) drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
ctype = GDK_SB_H_DOUBLE_ARROW; gdisplay_untransform_coords (gdisp, (double) mevent->x,
else (double) mevent->y,
ctype = GDK_SB_V_DOUBLE_ARROW; &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); gdisplay_install_tool_cursor (gdisp, ctype);
} }

View File

@ -22,6 +22,7 @@
#include "drawable.h" #include "drawable.h"
#include "flip_tool.h" #include "flip_tool.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tool_options_ui.h" #include "tool_options_ui.h"
#include "transform_core.h" #include "transform_core.h"
@ -154,15 +155,34 @@ flip_cursor_update (Tool *tool,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp; GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW; GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
gdisp = (GDisplay *) gdisp_ptr; 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) drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
ctype = GDK_SB_H_DOUBLE_ARROW; gdisplay_untransform_coords (gdisp, (double) mevent->x,
else (double) mevent->y,
ctype = GDK_SB_V_DOUBLE_ARROW; &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); gdisplay_install_tool_cursor (gdisp, ctype);
} }

View File

@ -22,6 +22,7 @@
#include "drawable.h" #include "drawable.h"
#include "flip_tool.h" #include "flip_tool.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tool_options_ui.h" #include "tool_options_ui.h"
#include "transform_core.h" #include "transform_core.h"
@ -154,15 +155,34 @@ flip_cursor_update (Tool *tool,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay *gdisp; GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW; GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
gdisp = (GDisplay *) gdisp_ptr; 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) drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
ctype = GDK_SB_H_DOUBLE_ARROW; gdisplay_untransform_coords (gdisp, (double) mevent->x,
else (double) mevent->y,
ctype = GDK_SB_V_DOUBLE_ARROW; &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); gdisplay_install_tool_cursor (gdisp, ctype);
} }