diff --git a/ChangeLog b/ChangeLog index bb8234c12d..b76f424e9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2000-01-19 Garry R. Osgood + * 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 * plug-ins/gflare/gflare.c: Typo fix and typo update. diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c index 15e0316291..6162b52a0f 100644 --- a/app/disp_callbacks.c +++ b/app/disp_callbacks.c @@ -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 */ + /* /File/Preferences.../Interface/... */ + /* Image Windows/Disable Cursor Updating is TOGGLED ON */ + if (no_cursor_updating == 0) { if (active_tool && !gimage_is_empty (gdisp->gimage) && diff --git a/app/display/gimpdisplay-callbacks.c b/app/display/gimpdisplay-callbacks.c index 15e0316291..6162b52a0f 100644 --- a/app/display/gimpdisplay-callbacks.c +++ b/app/display/gimpdisplay-callbacks.c @@ -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 */ + /* /File/Preferences.../Interface/... */ + /* Image Windows/Disable Cursor Updating is TOGGLED ON */ + if (no_cursor_updating == 0) { if (active_tool && !gimage_is_empty (gdisp->gimage) && diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index 15e0316291..6162b52a0f 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -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 */ + /* /File/Preferences.../Interface/... */ + /* Image Windows/Disable Cursor Updating is TOGGLED ON */ + if (no_cursor_updating == 0) { if (active_tool && !gimage_is_empty (gdisp->gimage) && diff --git a/app/ellipse_select.c b/app/ellipse_select.c index 491f6238a0..9e75cee0e3 100644 --- a/app/ellipse_select.c +++ b/app/ellipse_select.c @@ -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; diff --git a/app/free_select.c b/app/free_select.c index 7b990e7fc2..a6e8ade276 100644 --- a/app/free_select.c +++ b/app/free_select.c @@ -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; diff --git a/app/fuzzy_select.c b/app/fuzzy_select.c index 1fc18f54c1..14923c543b 100644 --- a/app/fuzzy_select.c +++ b/app/fuzzy_select.c @@ -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; diff --git a/app/rect_select.c b/app/rect_select.c index 6b466e0d00..2d42270735 100644 --- a/app/rect_select.c +++ b/app/rect_select.c @@ -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; diff --git a/app/rect_select.h b/app/rect_select.h index 86ec7620e6..d2491e73cf 100644 --- a/app/rect_select.h +++ b/app/rect_select.h @@ -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 */ diff --git a/app/rect_selectP.h b/app/rect_selectP.h index 2d0476b8e9..91d888376a 100644 --- a/app/rect_selectP.h +++ b/app/rect_selectP.h @@ -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 */ diff --git a/app/tools.c b/app/tools.c index 70ca7b0349..db221b5078 100644 --- a/app/tools.c +++ b/app/tools.c @@ -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; diff --git a/app/tools.h b/app/tools.h index 98c5c85f46..89cc079ffc 100644 --- a/app/tools.h +++ b/app/tools.h @@ -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; }; diff --git a/app/tools/ellipse_select.c b/app/tools/ellipse_select.c index 491f6238a0..9e75cee0e3 100644 --- a/app/tools/ellipse_select.c +++ b/app/tools/ellipse_select.c @@ -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; diff --git a/app/tools/free_select.c b/app/tools/free_select.c index 7b990e7fc2..a6e8ade276 100644 --- a/app/tools/free_select.c +++ b/app/tools/free_select.c @@ -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; diff --git a/app/tools/fuzzy_select.c b/app/tools/fuzzy_select.c index 1fc18f54c1..14923c543b 100644 --- a/app/tools/fuzzy_select.c +++ b/app/tools/fuzzy_select.c @@ -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; diff --git a/app/tools/gimpellipseselecttool.c b/app/tools/gimpellipseselecttool.c index 491f6238a0..9e75cee0e3 100644 --- a/app/tools/gimpellipseselecttool.c +++ b/app/tools/gimpellipseselecttool.c @@ -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; diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c index 7b990e7fc2..a6e8ade276 100644 --- a/app/tools/gimpfreeselecttool.c +++ b/app/tools/gimpfreeselecttool.c @@ -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; diff --git a/app/tools/gimpfuzzyselecttool.c b/app/tools/gimpfuzzyselecttool.c index 1fc18f54c1..14923c543b 100644 --- a/app/tools/gimpfuzzyselecttool.c +++ b/app/tools/gimpfuzzyselecttool.c @@ -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; diff --git a/app/tools/gimprectselecttool.c b/app/tools/gimprectselecttool.c index 6b466e0d00..2d42270735 100644 --- a/app/tools/gimprectselecttool.c +++ b/app/tools/gimprectselecttool.c @@ -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; diff --git a/app/tools/gimprectselecttool.h b/app/tools/gimprectselecttool.h index 86ec7620e6..d2491e73cf 100644 --- a/app/tools/gimprectselecttool.h +++ b/app/tools/gimprectselecttool.h @@ -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 */ diff --git a/app/tools/gimpregionselecttool.c b/app/tools/gimpregionselecttool.c index 1fc18f54c1..14923c543b 100644 --- a/app/tools/gimpregionselecttool.c +++ b/app/tools/gimpregionselecttool.c @@ -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; diff --git a/app/tools/rect_select.c b/app/tools/rect_select.c index 6b466e0d00..2d42270735 100644 --- a/app/tools/rect_select.c +++ b/app/tools/rect_select.c @@ -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; diff --git a/app/tools/rect_select.h b/app/tools/rect_select.h index 86ec7620e6..d2491e73cf 100644 --- a/app/tools/rect_select.h +++ b/app/tools/rect_select.h @@ -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 */ diff --git a/app/tools/rect_selectP.h b/app/tools/rect_selectP.h index 2d0476b8e9..91d888376a 100644 --- a/app/tools/rect_selectP.h +++ b/app/tools/rect_selectP.h @@ -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 */ diff --git a/app/tools/tools.c b/app/tools/tools.c index 70ca7b0349..db221b5078 100644 --- a/app/tools/tools.c +++ b/app/tools/tools.c @@ -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; diff --git a/app/tools/tools.h b/app/tools/tools.h index 98c5c85f46..89cc079ffc 100644 --- a/app/tools/tools.h +++ b/app/tools/tools.h @@ -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; }; diff --git a/app/toolsF.h b/app/toolsF.h index 0dfcd56739..79dd5f79df 100644 --- a/app/toolsF.h +++ b/app/toolsF.h @@ -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 */