cursors/background.xbm cursors/background_mask.xbm cursors/foreground.xbm

2000-07-29  Michael Natterer  <mitch@gimp.org>

	* cursors/background.xbm
	* cursors/background_mask.xbm
	* cursors/foreground.xbm
	* cursors/foreground_mask.xbm
	* cursors/pattern.xbm
	* cursors/pattern_mask.xbm: new files.

	* cursors/gimp-tool-cursors.xcf
	* app/cursorutil.[ch]: new cursor modifiers for bucket_fill.

	* app/bucket_fill.c: use the new modifiers. Closes #17871.

	* app/convolve.c
	* app/dodgeburn.c: added cursor_update functions which update the
	tools' "toggled" state before they call the cursor_update "method"
	of the paint_core "class" -- eek -- I-want-real-objects!
	Closes #17872 and #17873.

	* app/tools.h: added SELECTION_ANCHOR to the SelectOps enum.

	* app/free_select.c
	* app/rect_select.c: use the new enum value in the "oper_update"
	and "cursor_update" functions. In the "motion" function, set the
	tool's operation type back to SELECTION_REPLACE if the tool is
	active and call the "cursor_update" function explicitly.
	Closes #17870.

	* app/by_color_select.c: fixed warning caused by the new enum value.
This commit is contained in:
Michael Natterer 2000-07-29 16:12:40 +00:00 committed by Michael Natterer
parent 0566a8804e
commit a17cf3bd0b
35 changed files with 546 additions and 41 deletions

View File

@ -1,3 +1,34 @@
2000-07-29 Michael Natterer <mitch@gimp.org>
* cursors/background.xbm
* cursors/background_mask.xbm
* cursors/foreground.xbm
* cursors/foreground_mask.xbm
* cursors/pattern.xbm
* cursors/pattern_mask.xbm: new files.
* cursors/gimp-tool-cursors.xcf
* app/cursorutil.[ch]: new cursor modifiers for bucket_fill.
* app/bucket_fill.c: use the new modifiers. Closes #17871.
* app/convolve.c
* app/dodgeburn.c: added cursor_update functions which update the
tools' "toggled" state before they call the cursor_update "method"
of the paint_core "class" -- eek -- I-want-real-objects!
Closes #17872 and #17873.
* app/tools.h: added SELECTION_ANCHOR to the SelectOps enum.
* app/free_select.c
* app/rect_select.c: use the new enum value in the "oper_update"
and "cursor_update" functions. In the "motion" function, set the
tool's operation type back to SELECTION_REPLACE if the tool is
active and call the "cursor_update" function explicitly.
Closes #17870.
* app/by_color_select.c: fixed warning caused by the new enum value.
2000-07-29 Michael Natterer <mitch@gimp.org>
* libgimp/gimpdrawable.[ch]: gimp_drawable_set_visible(): the

View File

@ -50,6 +50,12 @@ EXTRA_DIST = \
cursors/control_mask.xbm \
cursors/anchor.xbm \
cursors/anchor_mask.xbm \
cursors/foreground.xbm \
cursors/foreground_mask.xbm \
cursors/background.xbm \
cursors/background_mask.xbm \
cursors/pattern.xbm \
cursors/pattern_mask.xbm \
cursors/hand.xbm \
cursors/hand_mask.xbm \
\

View File

@ -255,8 +255,9 @@ bucket_fill_cursor_update (Tool *tool,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
CursorModifier cmodifier = CURSOR_MODIFIER_NONE;
gint x, y;
gint off_x, off_y;
@ -267,6 +268,7 @@ bucket_fill_cursor_update (Tool *tool,
if ((layer = gimage_get_active_layer (gdisp->gimage)))
{
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (x >= off_x && y >= off_y &&
x < (off_x + drawable_width (GIMP_DRAWABLE (layer))) &&
y < (off_y + drawable_height (GIMP_DRAWABLE (layer))))
@ -274,15 +276,30 @@ bucket_fill_cursor_update (Tool *tool,
/* One more test--is there a selected region?
* if so, is cursor inside?
*/
if (gimage_mask_is_empty (gdisp->gimage))
ctype = GIMP_MOUSE_CURSOR;
else if (gimage_mask_value (gdisp->gimage, x, y))
ctype = GIMP_MOUSE_CURSOR;
if (gimage_mask_is_empty (gdisp->gimage) ||
gimage_mask_value (gdisp->gimage, x, y))
{
ctype = GIMP_MOUSE_CURSOR;
switch (bucket_options->fill_mode)
{
case FG_BUCKET_FILL:
cmodifier = CURSOR_MODIFIER_FOREGROUND;
break;
case BG_BUCKET_FILL:
cmodifier = CURSOR_MODIFIER_BACKGROUND;
break;
case PATTERN_BUCKET_FILL:
cmodifier = CURSOR_MODIFIER_PATTERN;
break;
}
}
}
}
gdisplay_install_tool_cursor (gdisp, ctype,
BUCKET_FILL,
CURSOR_MODIFIER_NONE,
cmodifier,
FALSE);
}

View File

@ -498,6 +498,12 @@ by_color_select_cursor_update (Tool *tool,
MOVE,
CURSOR_MODIFIER_NONE,
FALSE);
break;
case SELECTION_ANCHOR:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
RECT_SELECT,
CURSOR_MODIFIER_ANCHOR,
FALSE);
}
return;

View File

@ -259,6 +259,16 @@ convolve_modifier_key_func (Tool *tool,
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
}
static void
convolve_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
}
Tool *
tools_new_convolve (void)
{
@ -276,7 +286,8 @@ tools_new_convolve (void)
}
tool = paint_core_new (CONVOLVE);
tool->modifier_key_func = convolve_modifier_key_func;
tool->modifier_key_func = convolve_modifier_key_func;
tool->cursor_update_func = convolve_cursor_update_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View File

@ -49,6 +49,12 @@
#include "cursors/control_mask.xbm"
#include "cursors/anchor.xbm"
#include "cursors/anchor_mask.xbm"
#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"
#include "cursors/hand.xbm"
#include "cursors/hand_mask.xbm"
@ -100,6 +106,9 @@ enum
GIMP_RESIZE_CURSOR,
GIMP_CONTROL_CURSOR,
GIMP_ANCHOR_CURSOR,
GIMP_FOREGROUND_CURSOR,
GIMP_BACKGROUND_CURSOR,
GIMP_PATTERN_CURSOR,
GIMP_HAND_CURSOR
};
@ -141,6 +150,21 @@ static BitmapCursor modifier_cursors[] =
anchor_width, anchor_height,
anchor_x_hot, anchor_y_hot, NULL, NULL, NULL
},
{
foreground_bits, foreground_mask_bits,
foreground_width, foreground_height,
foreground_x_hot, foreground_y_hot, NULL, NULL, NULL
},
{
background_bits, background_mask_bits,
background_width, background_height,
background_x_hot, background_y_hot, NULL, NULL, NULL
},
{
pattern_bits, pattern_mask_bits,
pattern_width, pattern_height,
pattern_x_hot, pattern_y_hot, NULL, NULL, NULL
},
{
hand_bits, hand_mask_bits,
hand_width, hand_height,
@ -266,6 +290,15 @@ gimp_change_win_cursor (GdkWindow *win,
case CURSOR_MODIFIER_ANCHOR:
modtype = GIMP_ANCHOR_CURSOR;
break;
case CURSOR_MODIFIER_FOREGROUND:
modtype = GIMP_FOREGROUND_CURSOR;
break;
case CURSOR_MODIFIER_BACKGROUND:
modtype = GIMP_BACKGROUND_CURSOR;
break;
case CURSOR_MODIFIER_PATTERN:
modtype = GIMP_PATTERN_CURSOR;
break;
case CURSOR_MODIFIER_HAND:
modtype = GIMP_HAND_CURSOR;
break;

View File

@ -59,6 +59,9 @@ typedef enum
CURSOR_MODIFIER_RESIZE,
CURSOR_MODIFIER_CONTROL,
CURSOR_MODIFIER_ANCHOR,
CURSOR_MODIFIER_FOREGROUND,
CURSOR_MODIFIER_BACKGROUND,
CURSOR_MODIFIER_PATTERN,
CURSOR_MODIFIER_HAND
} CursorModifier;

View File

@ -332,6 +332,16 @@ dodgeburn_modifier_key_func (Tool *tool,
tool->toggled = (dodgeburn_options->type == BURN);
}
static void
dodgeburn_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
tool->toggled = (dodgeburn_options->type == BURN);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
}
Tool *
tools_new_dodgeburn (void)
{
@ -349,12 +359,13 @@ tools_new_dodgeburn (void)
}
tool = paint_core_new (DODGEBURN);
private = (PaintCore *) tool->private;
tool->modifier_key_func = dodgeburn_modifier_key_func;
tool->cursor_update_func = dodgeburn_cursor_update_func;
private = (PaintCore *) tool->private;
private->paint_func = dodgeburn_paint_func;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
tool->modifier_key_func = dodgeburn_modifier_key_func;
return tool;
}

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <string.h>
@ -22,6 +23,7 @@
#include "draw_core.h"
#include "edit_selection.h"
#include "errors.h"
#include "floating_sel.h"
#include "free_select.h"
#include "gimage_mask.h"
#include "gdisplay.h"
@ -31,6 +33,7 @@
#include "libgimp/gimpmath.h"
#define DEFAULT_MAX_INC 1024
#define SUPERSAMPLE 3
#define SUPERSAMPLE2 9
@ -207,6 +210,19 @@ free_select_button_release (Tool *tool,
/* First take care of the case where the user "cancels" the action */
if (! (bevent->state & GDK_BUTTON3_MASK))
{
if (free_sel->op == SELECTION_ANCHOR)
{
/* If there is a floating selection, anchor it */
if (gimage_floating_sel (gdisp->gimage))
floating_sel_anchor (gimage_floating_sel (gdisp->gimage));
/* Otherwise, clear the selection mask */
else
gimage_mask_clear (gdisp->gimage);
gdisplays_flush ();
return;
}
pts = g_new (ScanConvertPoint, free_sel->num_pts);
for (i = 0; i < free_sel->num_pts; i++)
@ -243,6 +259,13 @@ free_select_motion (Tool *tool,
if (tool->state != ACTIVE)
return;
if (free_sel->op == SELECTION_ANCHOR)
{
free_sel->op = SELECTION_REPLACE;
rect_select_cursor_update (tool, mevent, gdisp_ptr);
}
if (add_point (free_sel->num_pts, mevent->x, mevent->y))
{
gdk_draw_line (free_sel->core->win, free_sel->core->gc,

View File

@ -259,6 +259,16 @@ convolve_modifier_key_func (Tool *tool,
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
}
static void
convolve_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
}
Tool *
tools_new_convolve (void)
{
@ -276,7 +286,8 @@ tools_new_convolve (void)
}
tool = paint_core_new (CONVOLVE);
tool->modifier_key_func = convolve_modifier_key_func;
tool->modifier_key_func = convolve_modifier_key_func;
tool->cursor_update_func = convolve_cursor_update_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View File

@ -332,6 +332,16 @@ dodgeburn_modifier_key_func (Tool *tool,
tool->toggled = (dodgeburn_options->type == BURN);
}
static void
dodgeburn_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
tool->toggled = (dodgeburn_options->type == BURN);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
}
Tool *
tools_new_dodgeburn (void)
{
@ -349,12 +359,13 @@ tools_new_dodgeburn (void)
}
tool = paint_core_new (DODGEBURN);
private = (PaintCore *) tool->private;
tool->modifier_key_func = dodgeburn_modifier_key_func;
tool->cursor_update_func = dodgeburn_cursor_update_func;
private = (PaintCore *) tool->private;
private->paint_func = dodgeburn_paint_func;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
tool->modifier_key_func = dodgeburn_modifier_key_func;
return tool;
}

View File

@ -15,7 +15,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
@ -28,10 +32,11 @@
#include "selection_options.h"
#include "cursorutil.h"
#include "config.h"
#include "libgimp/gimpunitmenu.h"
#include "libgimp/gimpintl.h"
#define STATUSBAR_SIZE 128
@ -309,6 +314,13 @@ rect_select_motion (Tool *tool,
if (tool->state != ACTIVE)
return;
if (rect_sel->op == SELECTION_ANCHOR)
{
rect_sel->op = SELECTION_REPLACE;
rect_select_cursor_update (tool, mevent, gdisp_ptr);
}
draw_core_pause (rect_sel->core, tool);
/* Calculate starting point */
@ -520,6 +532,10 @@ selection_tool_update_op_state (RectSelect *rect_sel,
{
rect_sel->op = SELECTION_INTERSECT; /* intersect with selection */
}
else if (floating_sel)
{
rect_sel->op = SELECTION_ANCHOR; /* anchor the selection */
}
else
{
rect_sel->op = SELECTION_REPLACE; /* replace the selection */
@ -628,12 +644,18 @@ rect_select_cursor_update (Tool *tool,
CURSOR_MODIFIER_MOVE,
FALSE);
break;
case SELECTION_MOVE:
case SELECTION_MOVE:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
MOVE,
CURSOR_MODIFIER_NONE,
FALSE);
break;
case SELECTION_ANCHOR:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
tool->type,
CURSOR_MODIFIER_ANCHOR,
FALSE);
break;
}
}

View File

@ -48,7 +48,8 @@ typedef enum
SELECTION_REPLACE = REPLACE,
SELECTION_INTERSECT = INTERSECT,
SELECTION_MOVE_MASK,
SELECTION_MOVE
SELECTION_MOVE,
SELECTION_ANCHOR
} SelectOps;
/* The possibilities for where the cursor lies */

View File

@ -255,8 +255,9 @@ bucket_fill_cursor_update (Tool *tool,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
CursorModifier cmodifier = CURSOR_MODIFIER_NONE;
gint x, y;
gint off_x, off_y;
@ -267,6 +268,7 @@ bucket_fill_cursor_update (Tool *tool,
if ((layer = gimage_get_active_layer (gdisp->gimage)))
{
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (x >= off_x && y >= off_y &&
x < (off_x + drawable_width (GIMP_DRAWABLE (layer))) &&
y < (off_y + drawable_height (GIMP_DRAWABLE (layer))))
@ -274,15 +276,30 @@ bucket_fill_cursor_update (Tool *tool,
/* One more test--is there a selected region?
* if so, is cursor inside?
*/
if (gimage_mask_is_empty (gdisp->gimage))
ctype = GIMP_MOUSE_CURSOR;
else if (gimage_mask_value (gdisp->gimage, x, y))
ctype = GIMP_MOUSE_CURSOR;
if (gimage_mask_is_empty (gdisp->gimage) ||
gimage_mask_value (gdisp->gimage, x, y))
{
ctype = GIMP_MOUSE_CURSOR;
switch (bucket_options->fill_mode)
{
case FG_BUCKET_FILL:
cmodifier = CURSOR_MODIFIER_FOREGROUND;
break;
case BG_BUCKET_FILL:
cmodifier = CURSOR_MODIFIER_BACKGROUND;
break;
case PATTERN_BUCKET_FILL:
cmodifier = CURSOR_MODIFIER_PATTERN;
break;
}
}
}
}
gdisplay_install_tool_cursor (gdisp, ctype,
BUCKET_FILL,
CURSOR_MODIFIER_NONE,
cmodifier,
FALSE);
}

View File

@ -498,6 +498,12 @@ by_color_select_cursor_update (Tool *tool,
MOVE,
CURSOR_MODIFIER_NONE,
FALSE);
break;
case SELECTION_ANCHOR:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
RECT_SELECT,
CURSOR_MODIFIER_ANCHOR,
FALSE);
}
return;

View File

@ -259,6 +259,16 @@ convolve_modifier_key_func (Tool *tool,
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
}
static void
convolve_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
}
Tool *
tools_new_convolve (void)
{
@ -276,7 +286,8 @@ tools_new_convolve (void)
}
tool = paint_core_new (CONVOLVE);
tool->modifier_key_func = convolve_modifier_key_func;
tool->modifier_key_func = convolve_modifier_key_func;
tool->cursor_update_func = convolve_cursor_update_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View File

@ -332,6 +332,16 @@ dodgeburn_modifier_key_func (Tool *tool,
tool->toggled = (dodgeburn_options->type == BURN);
}
static void
dodgeburn_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
tool->toggled = (dodgeburn_options->type == BURN);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
}
Tool *
tools_new_dodgeburn (void)
{
@ -349,12 +359,13 @@ tools_new_dodgeburn (void)
}
tool = paint_core_new (DODGEBURN);
private = (PaintCore *) tool->private;
tool->modifier_key_func = dodgeburn_modifier_key_func;
tool->cursor_update_func = dodgeburn_cursor_update_func;
private = (PaintCore *) tool->private;
private->paint_func = dodgeburn_paint_func;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
tool->modifier_key_func = dodgeburn_modifier_key_func;
return tool;
}

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <string.h>
@ -22,6 +23,7 @@
#include "draw_core.h"
#include "edit_selection.h"
#include "errors.h"
#include "floating_sel.h"
#include "free_select.h"
#include "gimage_mask.h"
#include "gdisplay.h"
@ -31,6 +33,7 @@
#include "libgimp/gimpmath.h"
#define DEFAULT_MAX_INC 1024
#define SUPERSAMPLE 3
#define SUPERSAMPLE2 9
@ -207,6 +210,19 @@ free_select_button_release (Tool *tool,
/* First take care of the case where the user "cancels" the action */
if (! (bevent->state & GDK_BUTTON3_MASK))
{
if (free_sel->op == SELECTION_ANCHOR)
{
/* If there is a floating selection, anchor it */
if (gimage_floating_sel (gdisp->gimage))
floating_sel_anchor (gimage_floating_sel (gdisp->gimage));
/* Otherwise, clear the selection mask */
else
gimage_mask_clear (gdisp->gimage);
gdisplays_flush ();
return;
}
pts = g_new (ScanConvertPoint, free_sel->num_pts);
for (i = 0; i < free_sel->num_pts; i++)
@ -243,6 +259,13 @@ free_select_motion (Tool *tool,
if (tool->state != ACTIVE)
return;
if (free_sel->op == SELECTION_ANCHOR)
{
free_sel->op = SELECTION_REPLACE;
rect_select_cursor_update (tool, mevent, gdisp_ptr);
}
if (add_point (free_sel->num_pts, mevent->x, mevent->y))
{
gdk_draw_line (free_sel->core->win, free_sel->core->gc,

View File

@ -255,8 +255,9 @@ bucket_fill_cursor_update (Tool *tool,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
CursorModifier cmodifier = CURSOR_MODIFIER_NONE;
gint x, y;
gint off_x, off_y;
@ -267,6 +268,7 @@ bucket_fill_cursor_update (Tool *tool,
if ((layer = gimage_get_active_layer (gdisp->gimage)))
{
drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (x >= off_x && y >= off_y &&
x < (off_x + drawable_width (GIMP_DRAWABLE (layer))) &&
y < (off_y + drawable_height (GIMP_DRAWABLE (layer))))
@ -274,15 +276,30 @@ bucket_fill_cursor_update (Tool *tool,
/* One more test--is there a selected region?
* if so, is cursor inside?
*/
if (gimage_mask_is_empty (gdisp->gimage))
ctype = GIMP_MOUSE_CURSOR;
else if (gimage_mask_value (gdisp->gimage, x, y))
ctype = GIMP_MOUSE_CURSOR;
if (gimage_mask_is_empty (gdisp->gimage) ||
gimage_mask_value (gdisp->gimage, x, y))
{
ctype = GIMP_MOUSE_CURSOR;
switch (bucket_options->fill_mode)
{
case FG_BUCKET_FILL:
cmodifier = CURSOR_MODIFIER_FOREGROUND;
break;
case BG_BUCKET_FILL:
cmodifier = CURSOR_MODIFIER_BACKGROUND;
break;
case PATTERN_BUCKET_FILL:
cmodifier = CURSOR_MODIFIER_PATTERN;
break;
}
}
}
}
gdisplay_install_tool_cursor (gdisp, ctype,
BUCKET_FILL,
CURSOR_MODIFIER_NONE,
cmodifier,
FALSE);
}

View File

@ -498,6 +498,12 @@ by_color_select_cursor_update (Tool *tool,
MOVE,
CURSOR_MODIFIER_NONE,
FALSE);
break;
case SELECTION_ANCHOR:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
RECT_SELECT,
CURSOR_MODIFIER_ANCHOR,
FALSE);
}
return;

View File

@ -259,6 +259,16 @@ convolve_modifier_key_func (Tool *tool,
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
}
static void
convolve_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
}
Tool *
tools_new_convolve (void)
{
@ -276,7 +286,8 @@ tools_new_convolve (void)
}
tool = paint_core_new (CONVOLVE);
tool->modifier_key_func = convolve_modifier_key_func;
tool->modifier_key_func = convolve_modifier_key_func;
tool->cursor_update_func = convolve_cursor_update_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View File

@ -332,6 +332,16 @@ dodgeburn_modifier_key_func (Tool *tool,
tool->toggled = (dodgeburn_options->type == BURN);
}
static void
dodgeburn_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
tool->toggled = (dodgeburn_options->type == BURN);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
}
Tool *
tools_new_dodgeburn (void)
{
@ -349,12 +359,13 @@ tools_new_dodgeburn (void)
}
tool = paint_core_new (DODGEBURN);
private = (PaintCore *) tool->private;
tool->modifier_key_func = dodgeburn_modifier_key_func;
tool->cursor_update_func = dodgeburn_cursor_update_func;
private = (PaintCore *) tool->private;
private->paint_func = dodgeburn_paint_func;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
tool->modifier_key_func = dodgeburn_modifier_key_func;
return tool;
}

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <string.h>
@ -22,6 +23,7 @@
#include "draw_core.h"
#include "edit_selection.h"
#include "errors.h"
#include "floating_sel.h"
#include "free_select.h"
#include "gimage_mask.h"
#include "gdisplay.h"
@ -31,6 +33,7 @@
#include "libgimp/gimpmath.h"
#define DEFAULT_MAX_INC 1024
#define SUPERSAMPLE 3
#define SUPERSAMPLE2 9
@ -207,6 +210,19 @@ free_select_button_release (Tool *tool,
/* First take care of the case where the user "cancels" the action */
if (! (bevent->state & GDK_BUTTON3_MASK))
{
if (free_sel->op == SELECTION_ANCHOR)
{
/* If there is a floating selection, anchor it */
if (gimage_floating_sel (gdisp->gimage))
floating_sel_anchor (gimage_floating_sel (gdisp->gimage));
/* Otherwise, clear the selection mask */
else
gimage_mask_clear (gdisp->gimage);
gdisplays_flush ();
return;
}
pts = g_new (ScanConvertPoint, free_sel->num_pts);
for (i = 0; i < free_sel->num_pts; i++)
@ -243,6 +259,13 @@ free_select_motion (Tool *tool,
if (tool->state != ACTIVE)
return;
if (free_sel->op == SELECTION_ANCHOR)
{
free_sel->op = SELECTION_REPLACE;
rect_select_cursor_update (tool, mevent, gdisp_ptr);
}
if (add_point (free_sel->num_pts, mevent->x, mevent->y))
{
gdk_draw_line (free_sel->core->win, free_sel->core->gc,

View File

@ -15,7 +15,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
@ -28,10 +32,11 @@
#include "selection_options.h"
#include "cursorutil.h"
#include "config.h"
#include "libgimp/gimpunitmenu.h"
#include "libgimp/gimpintl.h"
#define STATUSBAR_SIZE 128
@ -309,6 +314,13 @@ rect_select_motion (Tool *tool,
if (tool->state != ACTIVE)
return;
if (rect_sel->op == SELECTION_ANCHOR)
{
rect_sel->op = SELECTION_REPLACE;
rect_select_cursor_update (tool, mevent, gdisp_ptr);
}
draw_core_pause (rect_sel->core, tool);
/* Calculate starting point */
@ -520,6 +532,10 @@ selection_tool_update_op_state (RectSelect *rect_sel,
{
rect_sel->op = SELECTION_INTERSECT; /* intersect with selection */
}
else if (floating_sel)
{
rect_sel->op = SELECTION_ANCHOR; /* anchor the selection */
}
else
{
rect_sel->op = SELECTION_REPLACE; /* replace the selection */
@ -628,12 +644,18 @@ rect_select_cursor_update (Tool *tool,
CURSOR_MODIFIER_MOVE,
FALSE);
break;
case SELECTION_MOVE:
case SELECTION_MOVE:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
MOVE,
CURSOR_MODIFIER_NONE,
FALSE);
break;
case SELECTION_ANCHOR:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
tool->type,
CURSOR_MODIFIER_ANCHOR,
FALSE);
break;
}
}

View File

@ -15,7 +15,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
@ -28,10 +32,11 @@
#include "selection_options.h"
#include "cursorutil.h"
#include "config.h"
#include "libgimp/gimpunitmenu.h"
#include "libgimp/gimpintl.h"
#define STATUSBAR_SIZE 128
@ -309,6 +314,13 @@ rect_select_motion (Tool *tool,
if (tool->state != ACTIVE)
return;
if (rect_sel->op == SELECTION_ANCHOR)
{
rect_sel->op = SELECTION_REPLACE;
rect_select_cursor_update (tool, mevent, gdisp_ptr);
}
draw_core_pause (rect_sel->core, tool);
/* Calculate starting point */
@ -520,6 +532,10 @@ selection_tool_update_op_state (RectSelect *rect_sel,
{
rect_sel->op = SELECTION_INTERSECT; /* intersect with selection */
}
else if (floating_sel)
{
rect_sel->op = SELECTION_ANCHOR; /* anchor the selection */
}
else
{
rect_sel->op = SELECTION_REPLACE; /* replace the selection */
@ -628,12 +644,18 @@ rect_select_cursor_update (Tool *tool,
CURSOR_MODIFIER_MOVE,
FALSE);
break;
case SELECTION_MOVE:
case SELECTION_MOVE:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
MOVE,
CURSOR_MODIFIER_NONE,
FALSE);
break;
case SELECTION_ANCHOR:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
tool->type,
CURSOR_MODIFIER_ANCHOR,
FALSE);
break;
}
}

View File

@ -48,7 +48,8 @@ typedef enum
SELECTION_REPLACE = REPLACE,
SELECTION_INTERSECT = INTERSECT,
SELECTION_MOVE_MASK,
SELECTION_MOVE
SELECTION_MOVE,
SELECTION_ANCHOR
} SelectOps;
/* The possibilities for where the cursor lies */

View File

@ -49,6 +49,12 @@
#include "cursors/control_mask.xbm"
#include "cursors/anchor.xbm"
#include "cursors/anchor_mask.xbm"
#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"
#include "cursors/hand.xbm"
#include "cursors/hand_mask.xbm"
@ -100,6 +106,9 @@ enum
GIMP_RESIZE_CURSOR,
GIMP_CONTROL_CURSOR,
GIMP_ANCHOR_CURSOR,
GIMP_FOREGROUND_CURSOR,
GIMP_BACKGROUND_CURSOR,
GIMP_PATTERN_CURSOR,
GIMP_HAND_CURSOR
};
@ -141,6 +150,21 @@ static BitmapCursor modifier_cursors[] =
anchor_width, anchor_height,
anchor_x_hot, anchor_y_hot, NULL, NULL, NULL
},
{
foreground_bits, foreground_mask_bits,
foreground_width, foreground_height,
foreground_x_hot, foreground_y_hot, NULL, NULL, NULL
},
{
background_bits, background_mask_bits,
background_width, background_height,
background_x_hot, background_y_hot, NULL, NULL, NULL
},
{
pattern_bits, pattern_mask_bits,
pattern_width, pattern_height,
pattern_x_hot, pattern_y_hot, NULL, NULL, NULL
},
{
hand_bits, hand_mask_bits,
hand_width, hand_height,
@ -266,6 +290,15 @@ gimp_change_win_cursor (GdkWindow *win,
case CURSOR_MODIFIER_ANCHOR:
modtype = GIMP_ANCHOR_CURSOR;
break;
case CURSOR_MODIFIER_FOREGROUND:
modtype = GIMP_FOREGROUND_CURSOR;
break;
case CURSOR_MODIFIER_BACKGROUND:
modtype = GIMP_BACKGROUND_CURSOR;
break;
case CURSOR_MODIFIER_PATTERN:
modtype = GIMP_PATTERN_CURSOR;
break;
case CURSOR_MODIFIER_HAND:
modtype = GIMP_HAND_CURSOR;
break;

View File

@ -59,6 +59,9 @@ typedef enum
CURSOR_MODIFIER_RESIZE,
CURSOR_MODIFIER_CONTROL,
CURSOR_MODIFIER_ANCHOR,
CURSOR_MODIFIER_FOREGROUND,
CURSOR_MODIFIER_BACKGROUND,
CURSOR_MODIFIER_PATTERN,
CURSOR_MODIFIER_HAND
} CursorModifier;

17
cursors/background.xbm Normal file
View File

@ -0,0 +1,17 @@
/* Created with The GIMP */
#define background_width 32
#define background_height 32
#define background_x_hot 0
#define background_y_hot 0
static unsigned char background_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf8, 0x1f,
0x00, 0x00, 0xf8, 0x11, 0x00, 0x00, 0xf8, 0x11, 0x00, 0x00, 0x40, 0x10,
0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0xc0, 0x1f, 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 };

View File

@ -0,0 +1,17 @@
/* Created with The GIMP */
#define background_mask_width 32
#define background_mask_height 32
#define background_mask_x_hot 0
#define background_mask_y_hot 0
static unsigned char background_mask_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03,
0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xfc, 0x3f,
0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xfc, 0x3f,
0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f,
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 };

17
cursors/foreground.xbm Normal file
View File

@ -0,0 +1,17 @@
/* Created with The GIMP */
#define foreground_width 32
#define foreground_height 32
#define foreground_x_hot 0
#define foreground_y_hot 0
static unsigned char foreground_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01,
0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xfc, 0x0f,
0x00, 0x00, 0xfc, 0x09, 0x00, 0x00, 0xfc, 0x09, 0x00, 0x00, 0x40, 0x08,
0x00, 0x00, 0xc0, 0x0f, 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 };

View File

@ -0,0 +1,17 @@
/* Created with The GIMP */
#define foreground_mask_width 32
#define foreground_mask_height 32
#define foreground_mask_x_hot 0
#define foreground_mask_y_hot 0
static unsigned char foreground_mask_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xfe, 0x03,
0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xfe, 0x1f,
0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xfe, 0x1f,
0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xe0, 0x1f, 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 };

Binary file not shown.

17
cursors/pattern.xbm Normal file
View File

@ -0,0 +1,17 @@
/* Created with The GIMP */
#define pattern_width 32
#define pattern_height 32
#define pattern_x_hot 0
#define pattern_y_hot 0
static unsigned char pattern_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x13,
0x00, 0x00, 0x90, 0x19, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x90, 0x19,
0x00, 0x00, 0x30, 0x13, 0x00, 0x00, 0x90, 0x19, 0x00, 0x00, 0xf0, 0x1f,
0x00, 0x00, 0x90, 0x19, 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 };

17
cursors/pattern_mask.xbm Normal file
View File

@ -0,0 +1,17 @@
/* Created with The GIMP */
#define pattern_mask_width 32
#define pattern_mask_height 32
#define pattern_mask_x_hot 0
#define pattern_mask_y_hot 0
static unsigned char pattern_mask_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f,
0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f,
0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f,
0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 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 };