gimp/app/disp_callbacks.c gimp/app/ellipse_select.c gimp/app/free_select.c

2000-01-19  Garry R. Osgood <gosgood@idt.net>
* gimp/app/disp_callbacks.c
* gimp/app/ellipse_select.c
* gimp/app/free_select.c
* gimp/app/fuzzy_select.c
* gimp/app/rect_select.c
* gimp/app/rect_select.h
* gimp/app/rect_selectP.h
* gimp/app/tools.c
* gimp/app/tools.h
* gimp/app/toolsF.h

Boolean selection operations, (adding to,
subtracting from, or intersecting with
pre-existing functions) now occur regardless
of the setting of "Disable Cursor Update"
toggle button in Interface/Image Window
category. Introduced a new tool action type,
OperUpdateFunc, To provide a distinct context
for such activity. see
http://idt.net/~gosgood/gimp-patch/patch05.html
for full details. Closes #2568.
This commit is contained in:
Garry R. Osgood 2000-01-19 19:06:13 +00:00 committed by Garry R. Osgood
parent fb1c376105
commit 61bbabc6ad
27 changed files with 187 additions and 44 deletions

View File

@ -1,3 +1,26 @@
2000-01-19 Garry R. Osgood <gosgood@idt.net>
* gimp/app/disp_callbacks.c
* gimp/app/ellipse_select.c
* gimp/app/free_select.c
* gimp/app/fuzzy_select.c
* gimp/app/rect_select.c
* gimp/app/rect_select.h
* gimp/app/rect_selectP.h
* gimp/app/tools.c
* gimp/app/tools.h
* gimp/app/toolsF.h
Boolean selection operations, (adding to,
subtracting from, or intersecting with
pre-existing selections) now occur regardless
of the setting of "Disable Cursor Update"
toggle button in Interface/Image Window
category. Introduced a new tool action type,
OperUpdateFunc, To provide a distinct context
for such activity. see
http://idt.net/~gosgood/gimp-patch/patch05.html
for full details. Closes #2568.
Wed Jan 19 12:50:55 CET 2000 Stanislav Brabec <utx@penguin.cz>
* plug-ins/gflare/gflare.c: Typo fix and typo update.

View File

@ -456,6 +456,22 @@ gdisplay_canvas_events (GtkWidget *canvas,
{
grab_and_scroll (gdisp, mevent);
}
/* Operator update support: Bug #XXXX */
if (
/* Should we have a tool... */
active_tool &&
/* and this event is NOT driving */
/* button press handlers ... */
!(state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))
)
{
/* ...then preconditions to modify a tool */
/* operator state have been met. */
(* active_tool->oper_update_func) (active_tool, mevent, gdisp);
}
break;
case GDK_KEY_PRESS:
@ -537,6 +553,11 @@ gdisplay_canvas_events (GtkWidget *canvas,
break;
}
/* Cursor update support */
/* no_cursor_updating is TRUE (=1) when */
/* <Toolbox>/File/Preferences.../Interface/... */
/* Image Windows/Disable Cursor Updating is TOGGLED ON */
if (no_cursor_updating == 0)
{
if (active_tool && !gimage_is_empty (gdisp->gimage) &&

View File

@ -456,6 +456,22 @@ gdisplay_canvas_events (GtkWidget *canvas,
{
grab_and_scroll (gdisp, mevent);
}
/* Operator update support: Bug #XXXX */
if (
/* Should we have a tool... */
active_tool &&
/* and this event is NOT driving */
/* button press handlers ... */
!(state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))
)
{
/* ...then preconditions to modify a tool */
/* operator state have been met. */
(* active_tool->oper_update_func) (active_tool, mevent, gdisp);
}
break;
case GDK_KEY_PRESS:
@ -537,6 +553,11 @@ gdisplay_canvas_events (GtkWidget *canvas,
break;
}
/* Cursor update support */
/* no_cursor_updating is TRUE (=1) when */
/* <Toolbox>/File/Preferences.../Interface/... */
/* Image Windows/Disable Cursor Updating is TOGGLED ON */
if (no_cursor_updating == 0)
{
if (active_tool && !gimage_is_empty (gdisp->gimage) &&

View File

@ -456,6 +456,22 @@ gdisplay_canvas_events (GtkWidget *canvas,
{
grab_and_scroll (gdisp, mevent);
}
/* Operator update support: Bug #XXXX */
if (
/* Should we have a tool... */
active_tool &&
/* and this event is NOT driving */
/* button press handlers ... */
!(state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))
)
{
/* ...then preconditions to modify a tool */
/* operator state have been met. */
(* active_tool->oper_update_func) (active_tool, mevent, gdisp);
}
break;
case GDK_KEY_PRESS:
@ -537,6 +553,11 @@ gdisplay_canvas_events (GtkWidget *canvas,
break;
}
/* Cursor update support */
/* no_cursor_updating is TRUE (=1) when */
/* <Toolbox>/File/Preferences.../Interface/... */
/* Image Windows/Disable Cursor Updating is TOGGLED ON */
if (no_cursor_updating == 0)
{
if (active_tool && !gimage_is_empty (gdisp->gimage) &&

View File

@ -136,6 +136,7 @@ tools_new_ellipse_select (void)
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = rect_select_control;
return tool;

View File

@ -320,6 +320,7 @@ tools_new_free_select (void)
tool->button_release_func = free_select_button_release;
tool->motion_func = free_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = free_select_control;
return tool;

View File

@ -685,6 +685,7 @@ tools_new_fuzzy_select ()
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = fuzzy_select_control;
return tool;

View File

@ -475,6 +475,18 @@ selection_tool_update_op_state (RectSelect *rect_sel,
rect_sel->op = SELECTION_REPLACE; /* replace the selection */
}
void
rect_select_oper_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
RectSelect *rect_sel;
rect_sel = (RectSelect*)tool->private;
selection_tool_update_op_state (rect_sel, mevent->x, mevent->y,
mevent->state, gdisp_ptr);
}
void
rect_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -487,9 +499,6 @@ rect_select_cursor_update (Tool *tool,
active = (active_tool->state == ACTIVE);
rect_sel = (RectSelect*)tool->private;
selection_tool_update_op_state (rect_sel, mevent->x, mevent->y,
mevent->state, gdisp_ptr);
switch (rect_sel->op)
{
case SELECTION_ADD:
@ -574,6 +583,7 @@ tools_new_rect_select ()
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = rect_select_control;
return tool;

View File

@ -20,23 +20,13 @@
#include "gimpimageF.h"
#include "tools.h"
#include "channel.h"
typedef enum
{
SELECTION_ADD = ADD,
SELECTION_SUB = SUB,
SELECTION_REPLACE = REPLACE,
SELECTION_INTERSECT = INTERSECT,
SELECTION_MOVE_MASK,
SELECTION_MOVE
} SelectOps;
/* rect select action functions */
void rect_select_button_press (Tool *, GdkEventButton *, gpointer);
void rect_select_button_release (Tool *, GdkEventButton *, gpointer);
void rect_select_motion (Tool *, GdkEventMotion *, gpointer);
void rect_select_cursor_update (Tool *, GdkEventMotion *, gpointer);
void rect_select_oper_update (Tool *, GdkEventMotion *, gpointer);
void rect_select_control (Tool *, ToolAction, gpointer);
/* rect select functions */

View File

@ -9,7 +9,7 @@ struct _RectSelect
{
DrawCore * core; /* Core select object */
int op; /* selection operation (SELECTION_ADD etc.) */
SelectOps op; /* selection operation (SELECTION_ADD etc.) */
int x, y; /* upper left hand coordinate */
int w, h; /* width and height */

View File

@ -894,6 +894,12 @@ standard_cursor_update_func (Tool *tool,
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
standard_operator_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
standard_control_func (Tool *tool,
ToolAction action,
@ -933,6 +939,7 @@ tools_new_tool (ToolType tool_type)
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = standard_cursor_update_func;
tool->oper_update_func = standard_operator_update_func;
tool->control_func = standard_control_func;
return tool;

View File

@ -22,6 +22,7 @@
#include "gdisplayF.h"
#include "gimpcontext.h"
#include "tool_options.h"
#include "channel.h"
#include "toolsF.h"
@ -35,6 +36,20 @@ typedef enum
PAUSED
} ToolState;
/* Selection Boolean operations that rect, */
/* ellipse, freehand, and fuzzy tools may */
/* perform. */
typedef enum
{
SELECTION_ADD = ADD,
SELECTION_SUB = SUB,
SELECTION_REPLACE = REPLACE,
SELECTION_INTERSECT = INTERSECT,
SELECTION_MOVE_MASK,
SELECTION_MOVE
} SelectOps;
/* The possibilities for where the cursor lies */
#define ACTIVE_LAYER (1 << 0)
#define SELECTION (1 << 1)
@ -65,6 +80,7 @@ struct _Tool
ArrowKeysFunc arrow_keys_func;
ModifierKeyFunc modifier_key_func;
CursorUpdateFunc cursor_update_func;
OperUpdateFunc oper_update_func;
ToolCtlFunc control_func;
};

View File

@ -136,6 +136,7 @@ tools_new_ellipse_select (void)
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = rect_select_control;
return tool;

View File

@ -320,6 +320,7 @@ tools_new_free_select (void)
tool->button_release_func = free_select_button_release;
tool->motion_func = free_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = free_select_control;
return tool;

View File

@ -685,6 +685,7 @@ tools_new_fuzzy_select ()
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = fuzzy_select_control;
return tool;

View File

@ -136,6 +136,7 @@ tools_new_ellipse_select (void)
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = rect_select_control;
return tool;

View File

@ -320,6 +320,7 @@ tools_new_free_select (void)
tool->button_release_func = free_select_button_release;
tool->motion_func = free_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = free_select_control;
return tool;

View File

@ -685,6 +685,7 @@ tools_new_fuzzy_select ()
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = fuzzy_select_control;
return tool;

View File

@ -475,6 +475,18 @@ selection_tool_update_op_state (RectSelect *rect_sel,
rect_sel->op = SELECTION_REPLACE; /* replace the selection */
}
void
rect_select_oper_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
RectSelect *rect_sel;
rect_sel = (RectSelect*)tool->private;
selection_tool_update_op_state (rect_sel, mevent->x, mevent->y,
mevent->state, gdisp_ptr);
}
void
rect_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -487,9 +499,6 @@ rect_select_cursor_update (Tool *tool,
active = (active_tool->state == ACTIVE);
rect_sel = (RectSelect*)tool->private;
selection_tool_update_op_state (rect_sel, mevent->x, mevent->y,
mevent->state, gdisp_ptr);
switch (rect_sel->op)
{
case SELECTION_ADD:
@ -574,6 +583,7 @@ tools_new_rect_select ()
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = rect_select_control;
return tool;

View File

@ -20,23 +20,13 @@
#include "gimpimageF.h"
#include "tools.h"
#include "channel.h"
typedef enum
{
SELECTION_ADD = ADD,
SELECTION_SUB = SUB,
SELECTION_REPLACE = REPLACE,
SELECTION_INTERSECT = INTERSECT,
SELECTION_MOVE_MASK,
SELECTION_MOVE
} SelectOps;
/* rect select action functions */
void rect_select_button_press (Tool *, GdkEventButton *, gpointer);
void rect_select_button_release (Tool *, GdkEventButton *, gpointer);
void rect_select_motion (Tool *, GdkEventMotion *, gpointer);
void rect_select_cursor_update (Tool *, GdkEventMotion *, gpointer);
void rect_select_oper_update (Tool *, GdkEventMotion *, gpointer);
void rect_select_control (Tool *, ToolAction, gpointer);
/* rect select functions */

View File

@ -685,6 +685,7 @@ tools_new_fuzzy_select ()
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = fuzzy_select_control;
return tool;

View File

@ -475,6 +475,18 @@ selection_tool_update_op_state (RectSelect *rect_sel,
rect_sel->op = SELECTION_REPLACE; /* replace the selection */
}
void
rect_select_oper_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
RectSelect *rect_sel;
rect_sel = (RectSelect*)tool->private;
selection_tool_update_op_state (rect_sel, mevent->x, mevent->y,
mevent->state, gdisp_ptr);
}
void
rect_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -487,9 +499,6 @@ rect_select_cursor_update (Tool *tool,
active = (active_tool->state == ACTIVE);
rect_sel = (RectSelect*)tool->private;
selection_tool_update_op_state (rect_sel, mevent->x, mevent->y,
mevent->state, gdisp_ptr);
switch (rect_sel->op)
{
case SELECTION_ADD:
@ -574,6 +583,7 @@ tools_new_rect_select ()
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->oper_update_func = rect_select_oper_update;
tool->control_func = rect_select_control;
return tool;

View File

@ -20,23 +20,13 @@
#include "gimpimageF.h"
#include "tools.h"
#include "channel.h"
typedef enum
{
SELECTION_ADD = ADD,
SELECTION_SUB = SUB,
SELECTION_REPLACE = REPLACE,
SELECTION_INTERSECT = INTERSECT,
SELECTION_MOVE_MASK,
SELECTION_MOVE
} SelectOps;
/* rect select action functions */
void rect_select_button_press (Tool *, GdkEventButton *, gpointer);
void rect_select_button_release (Tool *, GdkEventButton *, gpointer);
void rect_select_motion (Tool *, GdkEventMotion *, gpointer);
void rect_select_cursor_update (Tool *, GdkEventMotion *, gpointer);
void rect_select_oper_update (Tool *, GdkEventMotion *, gpointer);
void rect_select_control (Tool *, ToolAction, gpointer);
/* rect select functions */

View File

@ -9,7 +9,7 @@ struct _RectSelect
{
DrawCore * core; /* Core select object */
int op; /* selection operation (SELECTION_ADD etc.) */
SelectOps op; /* selection operation (SELECTION_ADD etc.) */
int x, y; /* upper left hand coordinate */
int w, h; /* width and height */

View File

@ -894,6 +894,12 @@ standard_cursor_update_func (Tool *tool,
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
standard_operator_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
standard_control_func (Tool *tool,
ToolAction action,
@ -933,6 +939,7 @@ tools_new_tool (ToolType tool_type)
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = standard_cursor_update_func;
tool->oper_update_func = standard_operator_update_func;
tool->control_func = standard_control_func;
return tool;

View File

@ -22,6 +22,7 @@
#include "gdisplayF.h"
#include "gimpcontext.h"
#include "tool_options.h"
#include "channel.h"
#include "toolsF.h"
@ -35,6 +36,20 @@ typedef enum
PAUSED
} ToolState;
/* Selection Boolean operations that rect, */
/* ellipse, freehand, and fuzzy tools may */
/* perform. */
typedef enum
{
SELECTION_ADD = ADD,
SELECTION_SUB = SUB,
SELECTION_REPLACE = REPLACE,
SELECTION_INTERSECT = INTERSECT,
SELECTION_MOVE_MASK,
SELECTION_MOVE
} SelectOps;
/* The possibilities for where the cursor lies */
#define ACTIVE_LAYER (1 << 0)
#define SELECTION (1 << 1)
@ -65,6 +80,7 @@ struct _Tool
ArrowKeysFunc arrow_keys_func;
ModifierKeyFunc modifier_key_func;
CursorUpdateFunc cursor_update_func;
OperUpdateFunc oper_update_func;
ToolCtlFunc control_func;
};

View File

@ -92,6 +92,7 @@ typedef void (* MotionFunc) (Tool *, GdkEventMotion *, gpointer);
typedef void (* ArrowKeysFunc) (Tool *, GdkEventKey *, gpointer);
typedef void (* ModifierKeyFunc) (Tool *, GdkEventKey *, gpointer);
typedef void (* CursorUpdateFunc) (Tool *, GdkEventMotion *, gpointer);
typedef void (* OperUpdateFunc) (Tool *, GdkEventMotion *, gpointer);
typedef void (* ToolCtlFunc) (Tool *, ToolAction, gpointer);
/* ToolInfo function declarations */