[gimp] Add infrastructure for sending double and triple clicks to tools
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp] Add infrastructure for sending double and triple clicks to tools
- Date: Sat, 20 Jun 2009 11:42:54 -0400 (EDT)
commit 1a16b48c93316df7f2cf1be73245ab20ad0d2999
Author: Michael Natterer <mitch gimp org>
Date: Sat Jun 20 17:37:31 2009 +0200
Add infrastructure for sending double and triple clicks to tools
* app/tools/tools-enums.[ch]: add enum GimpButtonPressType which can
be { NORMAL, DOUBLE, TRIPLE }
* app/tools/gimptool.[ch]: add press_type paramater to GimpTool::button_press()
* app/tools/gimp*tool.c
* app/tools/tool_manager.[ch]: changed accordingly.
* app/tools/gimptoolcontrol.[ch]: add members and API so tools can choose
to receive double and triple clicks.
* app/display/gimpdisplayshell-callbacks.c (gimp_display_shell_tool_events):
dispatch double and triple clicks to tools if they want them, and if they
became active by the preceding normal button press.
app/display/gimpdisplayshell-callbacks.c | 60 ++++++++++++++++++++++-
app/tools/gimpaligntool.c | 14 +++--
app/tools/gimpblendtool.c | 12 +++--
app/tools/gimpbrightnesscontrasttool.c | 12 +++--
app/tools/gimpcolortool.c | 14 +++--
app/tools/gimpcroptool.c | 12 +++--
app/tools/gimpforegroundselecttool.c | 16 +++---
app/tools/gimpfreeselecttool.c | 12 +++--
app/tools/gimpiscissorstool.c | 12 +++--
app/tools/gimpmagnifytool.c | 12 +++--
app/tools/gimpmeasuretool.c | 12 +++--
app/tools/gimpmovetool.c | 12 +++--
app/tools/gimppainttool.c | 16 +++---
app/tools/gimpperspectiveclonetool.c | 14 +++--
app/tools/gimprectangleselecttool.c | 12 +++--
app/tools/gimpregionselecttool.c | 12 +++--
app/tools/gimpsourcetool.c | 80 +++++++++++++++--------------
app/tools/gimptexttool.c | 12 +++--
app/tools/gimptool.c | 37 ++++++++------
app/tools/gimptool.h | 2 +
app/tools/gimptoolcontrol.c | 71 ++++++++++++++++++++------
app/tools/gimptoolcontrol.h | 26 +++++++---
app/tools/gimptransformtool.c | 12 +++--
app/tools/gimpvectortool.c | 12 +++--
app/tools/tool_manager.c | 13 +++--
app/tools/tool_manager.h | 1 +
app/tools/tools-enums.c | 31 ++++++++++++
app/tools/tools-enums.h | 12 +++++
28 files changed, 380 insertions(+), 183 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index e76c968..46de64d 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -924,7 +924,9 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
tool_manager_button_press_active (gimp,
&image_coords,
- time, state, display);
+ time, state,
+ GIMP_BUTTON_PRESS_NORMAL,
+ display);
shell->last_read_motion_time = bevent->time;
}
@@ -973,6 +975,62 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
}
break;
+ case GDK_2BUTTON_PRESS:
+ {
+ GdkEventButton *bevent = (GdkEventButton *) event;
+
+ GIMP_LOG (TOOL_EVENTS, "event (display %p): 2BUTTON_PRESS (%d)",
+ display, bevent->button);
+
+ if (gimp->busy)
+ return TRUE;
+
+ active_tool = tool_manager_get_active (gimp);
+
+ if (bevent->button == 1 &&
+ active_tool &&
+ gimp_tool_control_is_active (active_tool->control) &&
+ gimp_tool_control_get_wants_double_click (active_tool->control))
+ {
+ tool_manager_button_press_active (gimp,
+ &image_coords,
+ time, state,
+ GIMP_BUTTON_PRESS_DOUBLE,
+ display);
+ }
+
+ return_val = TRUE;
+ }
+ break;
+
+ case GDK_3BUTTON_PRESS:
+ {
+ GdkEventButton *bevent = (GdkEventButton *) event;
+
+ GIMP_LOG (TOOL_EVENTS, "event (display %p): 3BUTTON_PRESS (%d)",
+ display, bevent->button);
+
+ if (gimp->busy)
+ return TRUE;
+
+ active_tool = tool_manager_get_active (gimp);
+
+ if (bevent->button == 1 &&
+ active_tool &&
+ gimp_tool_control_is_active (active_tool->control) &&
+ gimp_tool_control_get_wants_triple_click (active_tool->control))
+ {
+ tool_manager_button_press_active (gimp,
+ &image_coords,
+ time, state,
+ GIMP_BUTTON_PRESS_TRIPLE,
+ display);
+ }
+
+ return_val = TRUE;
+ }
+ break;
+
case GDK_BUTTON_RELEASE:
{
GdkEventButton *bevent = (GdkEventButton *) event;
diff --git a/app/tools/gimpaligntool.c b/app/tools/gimpaligntool.c
index c040bff..2ef98f7 100644
--- a/app/tools/gimpaligntool.c
+++ b/app/tools/gimpaligntool.c
@@ -70,12 +70,13 @@ static void gimp_align_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_align_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
- GimpButtonReleaseType release_tyle,
+ GimpButtonReleaseType release_type,
GimpDisplay *display);
static void gimp_align_tool_motion (GimpTool *tool,
const GimpCoords *coords,
@@ -270,11 +271,12 @@ gimp_align_tool_control (GimpTool *tool,
}
static void
-gimp_align_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_align_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (tool);
diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c
index e40828a..e41d919 100644
--- a/app/tools/gimpblendtool.c
+++ b/app/tools/gimpblendtool.c
@@ -58,6 +58,7 @@ static void gimp_blend_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_blend_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -170,11 +171,12 @@ gimp_blend_tool_initialize (GimpTool *tool,
}
static void
-gimp_blend_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_blend_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c
index d0c76f9..a2424ed 100644
--- a/app/tools/gimpbrightnesscontrasttool.c
+++ b/app/tools/gimpbrightnesscontrasttool.c
@@ -61,6 +61,7 @@ static void gimp_brightness_contrast_tool_button_press (GimpTool
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_brightness_contrast_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -227,11 +228,12 @@ gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool)
static void
-gimp_brightness_contrast_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_brightness_contrast_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c
index 6698766..51d1415 100644
--- a/app/tools/gimpcolortool.c
+++ b/app/tools/gimpcolortool.c
@@ -75,6 +75,7 @@ static void gimp_color_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_color_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -225,18 +226,19 @@ gimp_color_tool_control (GimpTool *tool,
}
static void
-gimp_color_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_color_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
/* Chain up to activate the tool */
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
- display);
+ press_type, display);
if (! color_tool->enabled)
return;
diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c
index 3d8a8d0..6738f4f 100644
--- a/app/tools/gimpcroptool.c
+++ b/app/tools/gimpcroptool.c
@@ -68,6 +68,7 @@ static void gimp_crop_tool_button_press (GimpTool
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_crop_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -246,11 +247,12 @@ gimp_crop_tool_control (GimpTool *tool,
}
static void
-gimp_crop_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_crop_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
if (tool->display && display != tool->display)
gimp_rectangle_tool_cancel (GIMP_RECTANGLE_TOOL (tool));
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index ccf28b1..b6e612b 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -91,6 +91,7 @@ static void gimp_foreground_select_tool_button_press (GimpTool *tool
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_foreground_select_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -427,11 +428,12 @@ gimp_foreground_select_tool_key_press (GimpTool *tool,
}
static void
-gimp_foreground_select_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_foreground_select_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
@@ -462,8 +464,8 @@ gimp_foreground_select_tool_button_press (GimpTool *tool,
}
else
{
- GIMP_TOOL_CLASS (parent_class)->button_press (tool,
- coords, time, state, display);
+ GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
+ press_type, display);
}
}
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index 1353b7b..9e40312 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -146,6 +146,7 @@ static void gimp_free_select_tool_button_press (GimpTool
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_free_select_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -1272,11 +1273,12 @@ gimp_free_select_tool_cursor_update (GimpTool *tool,
}
static void
-gimp_free_select_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_free_select_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c
index 8aefa1e..1cedd8d 100644
--- a/app/tools/gimpiscissorstool.c
+++ b/app/tools/gimpiscissorstool.c
@@ -124,6 +124,7 @@ static void gimp_iscissors_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_iscissors_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -398,11 +399,12 @@ gimp_iscissors_tool_control (GimpTool *tool,
}
static void
-gimp_iscissors_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_iscissors_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
GimpIscissorsOptions *options = GIMP_ISCISSORS_TOOL_GET_OPTIONS (tool);
diff --git a/app/tools/gimpmagnifytool.c b/app/tools/gimpmagnifytool.c
index f9384c0..af60423 100644
--- a/app/tools/gimpmagnifytool.c
+++ b/app/tools/gimpmagnifytool.c
@@ -44,6 +44,7 @@ static void gimp_magnify_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_magnify_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -132,11 +133,12 @@ gimp_magnify_tool_init (GimpMagnifyTool *magnify_tool)
}
static void
-gimp_magnify_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_magnify_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpMagnifyTool *magnify = GIMP_MAGNIFY_TOOL (tool);
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index 8d8f26f..4ee2c1d 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -65,6 +65,7 @@ static void gimp_measure_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_measure_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -178,11 +179,12 @@ gimp_measure_tool_control (GimpTool *tool,
}
static void
-gimp_measure_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_measure_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpMeasureTool *measure = GIMP_MEASURE_TOOL (tool);
GimpMeasureOptions *options = GIMP_MEASURE_TOOL_GET_OPTIONS (tool);
diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c
index b9b51fe..4325a2d 100644
--- a/app/tools/gimpmovetool.c
+++ b/app/tools/gimpmovetool.c
@@ -73,6 +73,7 @@ static void gimp_move_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_move_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -201,11 +202,12 @@ gimp_move_tool_control (GimpTool *tool,
}
static void
-gimp_move_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_move_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c
index 2cda5f4..3458ed3 100644
--- a/app/tools/gimppainttool.c
+++ b/app/tools/gimppainttool.c
@@ -65,6 +65,7 @@ static void gimp_paint_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_paint_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -242,11 +243,12 @@ gimp_paint_tool_control (GimpTool *tool,
}
static void
-gimp_paint_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_paint_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
@@ -260,7 +262,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
- display);
+ press_type, display);
return;
}
@@ -320,7 +322,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
/* chain up to activate the tool */
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
- display);
+ press_type, display);
/* pause the current selection */
gimp_image_selection_control (display->image, GIMP_SELECTION_PAUSE);
diff --git a/app/tools/gimpperspectiveclonetool.c b/app/tools/gimpperspectiveclonetool.c
index 793f371..51338bf 100644
--- a/app/tools/gimpperspectiveclonetool.c
+++ b/app/tools/gimpperspectiveclonetool.c
@@ -69,6 +69,7 @@ static void gimp_perspective_clone_tool_button_press (GimpTool
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_perspective_clone_tool_button_release(GimpTool *tool,
const GimpCoords *coords,
@@ -321,11 +322,12 @@ gimp_perspective_clone_tool_halt (GimpPerspectiveCloneTool *clone_tool)
}
static void
-gimp_perspective_clone_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_perspective_clone_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpPerspectiveCloneTool *clone_tool = GIMP_PERSPECTIVE_CLONE_TOOL (tool);
@@ -366,7 +368,7 @@ gimp_perspective_clone_tool_button_press (GimpTool *tool,
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
- display);
+ press_type, display);
/* Set the coordinates for the reference cross */
gimp_perspective_clone_get_source_point (clone,
diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c
index 2df06b6..4a3ba6b 100644
--- a/app/tools/gimprectangleselecttool.c
+++ b/app/tools/gimprectangleselecttool.c
@@ -90,6 +90,7 @@ static void gimp_rectangle_select_tool_button_press (GimpTool
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_rectangle_select_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -366,11 +367,12 @@ gimp_rectangle_select_tool_delegate_button_press (GimpRectangleSelectTool *rect_
}
static void
-gimp_rectangle_select_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_rectangle_select_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpRectangleTool *rectangle;
GimpRectangleSelectTool *rect_sel_tool;
diff --git a/app/tools/gimpregionselecttool.c b/app/tools/gimpregionselecttool.c
index 48b667e..1ab9129 100644
--- a/app/tools/gimpregionselecttool.c
+++ b/app/tools/gimpregionselecttool.c
@@ -53,6 +53,7 @@ static void gimp_region_select_tool_button_press (GimpTool *too
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_region_select_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -139,11 +140,12 @@ gimp_region_select_tool_finalize (GObject *object)
}
static void
-gimp_region_select_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_region_select_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpRegionSelectTool *region_sel = GIMP_REGION_SELECT_TOOL (tool);
GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c
index e1ea3dc..c29a7be 100644
--- a/app/tools/gimpsourcetool.c
+++ b/app/tools/gimpsourcetool.c
@@ -42,39 +42,40 @@
#define TARGET_SIZE 15
-static gboolean gimp_source_tool_has_display (GimpTool *tool,
- GimpDisplay *display);
-static GimpDisplay * gimp_source_tool_has_image (GimpTool *tool,
- GimpImage *image);
-static void gimp_source_tool_control (GimpTool *tool,
- GimpToolAction action,
- GimpDisplay *display);
-static void gimp_source_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display);
-static void gimp_source_tool_motion (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display);
-static void gimp_source_tool_cursor_update (GimpTool *tool,
- const GimpCoords *coords,
- GdkModifierType state,
- GimpDisplay *display);
-static void gimp_source_tool_modifier_key (GimpTool *tool,
- GdkModifierType key,
- gboolean press,
- GdkModifierType state,
- GimpDisplay *display);
-static void gimp_source_tool_oper_update (GimpTool *tool,
- const GimpCoords *coords,
- GdkModifierType state,
- gboolean proximity,
- GimpDisplay *display);
-
-static void gimp_source_tool_draw (GimpDrawTool *draw_tool);
+static gboolean gimp_source_tool_has_display (GimpTool *tool,
+ GimpDisplay *display);
+static GimpDisplay * gimp_source_tool_has_image (GimpTool *tool,
+ GimpImage *image);
+static void gimp_source_tool_control (GimpTool *tool,
+ GimpToolAction action,
+ GimpDisplay *display);
+static void gimp_source_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display);
+static void gimp_source_tool_motion (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpDisplay *display);
+static void gimp_source_tool_cursor_update (GimpTool *tool,
+ const GimpCoords *coords,
+ GdkModifierType state,
+ GimpDisplay *display);
+static void gimp_source_tool_modifier_key (GimpTool *tool,
+ GdkModifierType key,
+ gboolean press,
+ GdkModifierType state,
+ GimpDisplay *display);
+static void gimp_source_tool_oper_update (GimpTool *tool,
+ const GimpCoords *coords,
+ GdkModifierType state,
+ gboolean proximity,
+ GimpDisplay *display);
+
+static void gimp_source_tool_draw (GimpDrawTool *draw_tool);
G_DEFINE_TYPE (GimpSourceTool, gimp_source_tool, GIMP_TYPE_BRUSH_TOOL)
@@ -166,11 +167,12 @@ gimp_source_tool_control (GimpTool *tool,
}
static void
-gimp_source_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_source_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
@@ -190,7 +192,7 @@ gimp_source_tool_button_press (GimpTool *tool,
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
- display);
+ press_type, display);
source_tool->src_x = source->src_x;
source_tool->src_y = source->src_y;
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 614ec75..9c10f82 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -86,6 +86,7 @@ static void gimp_text_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_text_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -401,11 +402,12 @@ gimp_text_tool_control (GimpTool *tool,
}
static void
-gimp_text_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_text_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpTextTool *text_tool = GIMP_TEXT_TOOL (tool);
GimpRectangleTool *rect_tool = GIMP_RECTANGLE_TOOL (tool);
diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c
index 4ca20c3..e4e57a0 100644
--- a/app/tools/gimptool.c
+++ b/app/tools/gimptool.c
@@ -72,6 +72,7 @@ static void gimp_tool_real_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_tool_real_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -288,16 +289,20 @@ gimp_tool_real_control (GimpTool *tool,
}
static void
-gimp_tool_real_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_tool_real_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
- tool->display = display;
- tool->drawable = gimp_image_get_active_drawable (display->image);
+ if (press_type == GIMP_BUTTON_PRESS_NORMAL)
+ {
+ tool->display = display;
+ tool->drawable = gimp_image_get_active_drawable (display->image);
- gimp_tool_control_activate (tool->control);
+ gimp_tool_control_activate (tool->control);
+ }
}
static void
@@ -501,20 +506,22 @@ gimp_tool_control (GimpTool *tool,
}
void
-gimp_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (coords != NULL);
g_return_if_fail (GIMP_IS_DISPLAY (display));
GIMP_TOOL_GET_CLASS (tool)->button_press (tool, coords, time, state,
- display);
+ press_type, display);
- if (gimp_tool_control_is_active (tool->control))
+ if (press_type == GIMP_BUTTON_PRESS_NORMAL &&
+ gimp_tool_control_is_active (tool->control))
{
tool->button_press_state = state;
tool->active_modifier_state = state;
diff --git a/app/tools/gimptool.h b/app/tools/gimptool.h
index 46b4c1a..9bdeaeb 100644
--- a/app/tools/gimptool.h
+++ b/app/tools/gimptool.h
@@ -91,6 +91,7 @@ struct _GimpToolClass
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
void (* button_release) (GimpTool *tool,
const GimpCoords *coords,
@@ -155,6 +156,7 @@ void gimp_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
void gimp_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
diff --git a/app/tools/gimptoolcontrol.c b/app/tools/gimptoolcontrol.c
index 904265c..bdcd68c 100644
--- a/app/tools/gimptoolcontrol.c
+++ b/app/tools/gimptoolcontrol.c
@@ -63,6 +63,9 @@ gimp_tool_control_init (GimpToolControl *control)
control->toggled = FALSE;
+ control->wants_click = FALSE;
+ control->wants_double_click = FALSE;
+ control->wants_triple_click = FALSE;
control->wants_all_key_events = FALSE;
control->cursor = GIMP_CURSOR_MOUSE;
@@ -206,23 +209,6 @@ gimp_tool_control_get_handle_empty_image (GimpToolControl *control)
}
void
-gimp_tool_control_set_wants_click (GimpToolControl *control,
- gboolean wants_click)
-{
- g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
-
- control->wants_click = wants_click ? TRUE : FALSE;
-}
-
-gboolean
-gimp_tool_control_get_wants_click (GimpToolControl *control)
-{
- g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
-
- return control->wants_click;
-}
-
-void
gimp_tool_control_set_dirty_mask (GimpToolControl *control,
GimpDirtyMask dirty_mask)
{
@@ -274,6 +260,57 @@ gimp_tool_control_get_snap_to (GimpToolControl *control)
}
void
+gimp_tool_control_set_wants_click (GimpToolControl *control,
+ gboolean wants_click)
+{
+ g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
+
+ control->wants_click = wants_click ? TRUE : FALSE;
+}
+
+gboolean
+gimp_tool_control_get_wants_click (GimpToolControl *control)
+{
+ g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
+
+ return control->wants_click;
+}
+
+void
+gimp_tool_control_set_wants_double_click (GimpToolControl *control,
+ gboolean wants_double_click)
+{
+ g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
+
+ control->wants_double_click = wants_double_click ? TRUE : FALSE;
+}
+
+gboolean
+gimp_tool_control_get_wants_double_click (GimpToolControl *control)
+{
+ g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
+
+ return control->wants_double_click;
+}
+
+void
+gimp_tool_control_set_wants_triple_click (GimpToolControl *control,
+ gboolean wants_triple_click)
+{
+ g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
+
+ control->wants_triple_click = wants_triple_click ? TRUE : FALSE;
+}
+
+gboolean
+gimp_tool_control_get_wants_triple_click (GimpToolControl *control)
+{
+ g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
+
+ return control->wants_triple_click;
+}
+
+void
gimp_tool_control_set_wants_all_key_events (GimpToolControl *control,
gboolean wants_key_events)
{
diff --git a/app/tools/gimptoolcontrol.h b/app/tools/gimptoolcontrol.h
index 032a1fa..2ed3348 100644
--- a/app/tools/gimptoolcontrol.h
+++ b/app/tools/gimptoolcontrol.h
@@ -45,7 +45,6 @@ struct _GimpToolControl
gboolean scroll_lock; /* allow scrolling or not */
gboolean handle_empty_image; /* invoke the tool on images *
* without active drawable */
- gboolean wants_click; /* wants click detection */
GimpDirtyMask dirty_mask; /* if preserve is FALSE, cancel *
* the tool on these events */
GimpMotionMode motion_mode; /* how to process motion events *
@@ -58,6 +57,9 @@ struct _GimpToolControl
GimpCursorPrecision precision;
+ gboolean wants_click; /* wants click detection */
+ gboolean wants_double_click;
+ gboolean wants_triple_click;
gboolean wants_all_key_events;
gboolean toggled;
@@ -106,10 +108,6 @@ void gimp_tool_control_set_handle_empty_image (GimpToolControl *control,
gboolean handle_empty);
gboolean gimp_tool_control_get_handle_empty_image (GimpToolControl *control);
-void gimp_tool_control_set_wants_click (GimpToolControl *control,
- gboolean wants_click);
-gboolean gimp_tool_control_get_wants_click (GimpToolControl *control);
-
void gimp_tool_control_set_dirty_mask (GimpToolControl *control,
GimpDirtyMask dirty_mask);
GimpDirtyMask gimp_tool_control_get_dirty_mask (GimpToolControl *control);
@@ -122,9 +120,21 @@ void gimp_tool_control_set_snap_to (GimpToolControl *control,
gboolean snap_to);
gboolean gimp_tool_control_get_snap_to (GimpToolControl *control);
-void gimp_tool_control_set_wants_all_key_events (GimpToolControl *control,
- gboolean wants_key_events);
-gboolean gimp_tool_control_get_wants_all_key_events (GimpToolControl *control);
+void gimp_tool_control_set_wants_click (GimpToolControl *control,
+ gboolean wants_click);
+gboolean gimp_tool_control_get_wants_click (GimpToolControl *control);
+
+void gimp_tool_control_set_wants_double_click (GimpToolControl *control,
+ gboolean wants_double_click);
+gboolean gimp_tool_control_get_wants_double_click (GimpToolControl *control);
+
+void gimp_tool_control_set_wants_triple_click (GimpToolControl *control,
+ gboolean wants_double_click);
+gboolean gimp_tool_control_get_wants_triple_click (GimpToolControl *control);
+
+void gimp_tool_control_set_wants_all_key_events (GimpToolControl *control,
+ gboolean wants_key_events);
+gboolean gimp_tool_control_get_wants_all_key_events (GimpToolControl *control);
void gimp_tool_control_set_snap_offsets (GimpToolControl *control,
gint offset_x,
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 999a375..2a8adfc 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -83,6 +83,7 @@ static void gimp_transform_tool_button_press (GimpTool
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_transform_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -397,11 +398,12 @@ gimp_transform_tool_control (GimpTool *tool,
}
static void
-gimp_transform_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_transform_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c
index f86272b..f674a6d 100644
--- a/app/tools/gimpvectortool.c
+++ b/app/tools/gimpvectortool.c
@@ -77,6 +77,7 @@ static void gimp_vector_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_vector_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
@@ -243,11 +244,12 @@ gimp_vector_tool_control (GimpTool *tool,
}
static void
-gimp_vector_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_vector_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c
index 4cc9d26..2224f75 100644
--- a/app/tools/tool_manager.c
+++ b/app/tools/tool_manager.c
@@ -272,11 +272,12 @@ tool_manager_control_active (Gimp *gimp,
}
void
-tool_manager_button_press_active (Gimp *gimp,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+tool_manager_button_press_active (Gimp *gimp,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
GimpToolManager *tool_manager;
@@ -287,7 +288,7 @@ tool_manager_button_press_active (Gimp *gimp,
if (tool_manager->active_tool)
{
gimp_tool_button_press (tool_manager->active_tool,
- coords, time, state,
+ coords, time, state, press_type,
display);
}
}
diff --git a/app/tools/tool_manager.h b/app/tools/tool_manager.h
index a957b5b..7597a75 100644
--- a/app/tools/tool_manager.h
+++ b/app/tools/tool_manager.h
@@ -41,6 +41,7 @@ void tool_manager_button_press_active (Gimp *gimp,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
+ GimpButtonPressType press_type,
GimpDisplay *display);
void tool_manager_button_release_active (Gimp *gimp,
const GimpCoords *coords,
diff --git a/app/tools/tools-enums.c b/app/tools/tools-enums.c
index 34eeb76..0f243db 100644
--- a/app/tools/tools-enums.c
+++ b/app/tools/tools-enums.c
@@ -10,6 +10,37 @@
/* enumerations from "./tools-enums.h" */
GType
+gimp_button_press_type_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_BUTTON_PRESS_NORMAL, "GIMP_BUTTON_PRESS_NORMAL", "normal" },
+ { GIMP_BUTTON_PRESS_DOUBLE, "GIMP_BUTTON_PRESS_DOUBLE", "double" },
+ { GIMP_BUTTON_PRESS_TRIPLE, "GIMP_BUTTON_PRESS_TRIPLE", "triple" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_BUTTON_PRESS_NORMAL, "GIMP_BUTTON_PRESS_NORMAL", NULL },
+ { GIMP_BUTTON_PRESS_DOUBLE, "GIMP_BUTTON_PRESS_DOUBLE", NULL },
+ { GIMP_BUTTON_PRESS_TRIPLE, "GIMP_BUTTON_PRESS_TRIPLE", NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpButtonPressType", values);
+ gimp_type_set_translation_context (type, "button-press-type");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
gimp_button_release_type_get_type (void)
{
static const GEnumValue values[] =
diff --git a/app/tools/tools-enums.h b/app/tools/tools-enums.h
index a403858..3a508a7 100644
--- a/app/tools/tools-enums.h
+++ b/app/tools/tools-enums.h
@@ -22,6 +22,18 @@
* these enums are registered with the type system
*/
+#define GIMP_TYPE_BUTTON_PRESS_TYPE (gimp_button_press_type_get_type ())
+
+GType gimp_button_press_type_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_BUTTON_PRESS_NORMAL,
+ GIMP_BUTTON_PRESS_DOUBLE,
+ GIMP_BUTTON_PRESS_TRIPLE
+} GimpButtonPressType;
+
+
#define GIMP_TYPE_BUTTON_RELEASE_TYPE (gimp_button_release_type_get_type ())
GType gimp_button_release_type_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]