2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2002-03-29 11:50:29 +08:00
|
|
|
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis and others
|
2001-02-14 12:55:21 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-02-14 12:55:21 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-02-14 12:55:21 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-02-14 12:55:21 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2001-02-14 12:55:21 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2007-03-09 21:00:01 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
2001-02-14 12:55:21 +08:00
|
|
|
|
2006-09-28 18:11:17 +08:00
|
|
|
#include "core/gimp.h"
|
2007-03-15 05:33:09 +08:00
|
|
|
#include "core/gimpcontainer.h"
|
2002-05-03 19:31:08 +08:00
|
|
|
#include "core/gimpimage.h"
|
2011-03-25 16:48:26 +08:00
|
|
|
#include "core/gimpprogress.h"
|
2003-08-31 00:41:35 +08:00
|
|
|
#include "core/gimptoolinfo.h"
|
2002-05-03 19:31:08 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2001-11-01 05:20:09 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2003-01-04 02:01:30 +08:00
|
|
|
#include "display/gimpdisplayshell-cursor.h"
|
2002-02-03 20:10:23 +08:00
|
|
|
#include "display/gimpstatusbar.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
#include "gimptool.h"
|
2011-03-25 17:55:07 +08:00
|
|
|
#include "gimptool-progress.h"
|
2003-04-15 22:20:19 +08:00
|
|
|
#include "gimptoolcontrol.h"
|
2001-02-21 20:18:09 +08:00
|
|
|
|
2007-12-08 02:52:41 +08:00
|
|
|
#include "gimp-log.h"
|
2009-01-30 05:32:30 +08:00
|
|
|
#include "gimp-intl.h"
|
2007-12-08 02:52:41 +08:00
|
|
|
|
2002-05-03 19:31:08 +08:00
|
|
|
|
2003-08-31 00:41:35 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_TOOL_INFO
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-11-10 21:18:33 +08:00
|
|
|
static void gimp_tool_constructed (GObject *object);
|
2011-04-01 21:39:37 +08:00
|
|
|
static void gimp_tool_dispose (GObject *object);
|
2007-02-28 02:55:12 +08:00
|
|
|
static void gimp_tool_finalize (GObject *object);
|
|
|
|
static void gimp_tool_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_tool_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
|
|
|
static gboolean gimp_tool_real_has_display (GimpTool *tool,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static GimpDisplay * gimp_tool_real_has_image (GimpTool *tool,
|
|
|
|
GimpImage *image);
|
|
|
|
static gboolean gimp_tool_real_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GError **error);
|
|
|
|
static void gimp_tool_real_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_tool_real_button_press (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2009-06-20 23:37:31 +08:00
|
|
|
GimpButtonPressType press_type,
|
2007-02-28 02:55:12 +08:00
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_tool_real_button_release (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonReleaseType release_type,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_tool_real_motion (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static gboolean gimp_tool_real_key_press (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *display);
|
2010-02-19 03:50:11 +08:00
|
|
|
static gboolean gimp_tool_real_key_release (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *display);
|
2007-02-28 02:55:12 +08:00
|
|
|
static void gimp_tool_real_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_tool_real_active_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_tool_real_oper_update (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
gboolean proximity,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_tool_real_cursor_update (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
2008-10-27 00:25:24 +08:00
|
|
|
static GimpUIManager * gimp_tool_real_get_popup (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-10-27 00:25:24 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display,
|
|
|
|
const gchar **ui_path);
|
2010-11-10 21:18:33 +08:00
|
|
|
static void gimp_tool_real_options_notify (GimpTool *tool,
|
|
|
|
GimpToolOptions *options,
|
|
|
|
const GParamSpec *pspec);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2010-11-10 21:18:33 +08:00
|
|
|
static void gimp_tool_options_notify (GimpToolOptions *options,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpTool *tool);
|
2007-03-15 07:07:00 +08:00
|
|
|
static void gimp_tool_clear_status (GimpTool *tool);
|
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2011-03-25 17:55:07 +08:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GimpTool, gimp_tool, GIMP_TYPE_OBJECT,
|
|
|
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS,
|
|
|
|
gimp_tool_progress_iface_init))
|
2005-12-13 17:13:50 +08:00
|
|
|
|
|
|
|
#define parent_class gimp_tool_parent_class
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2004-03-10 20:45:11 +08:00
|
|
|
static gint global_tool_ID = 1;
|
2003-04-15 22:20:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_tool_class_init (GimpToolClass *klass)
|
|
|
|
{
|
2004-03-10 20:45:11 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2010-11-10 21:18:33 +08:00
|
|
|
object_class->constructed = gimp_tool_constructed;
|
2011-04-01 21:39:37 +08:00
|
|
|
object_class->dispose = gimp_tool_dispose;
|
2003-08-31 00:41:35 +08:00
|
|
|
object_class->finalize = gimp_tool_finalize;
|
|
|
|
object_class->set_property = gimp_tool_set_property;
|
|
|
|
object_class->get_property = gimp_tool_get_property;
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2006-06-19 03:58:49 +08:00
|
|
|
klass->has_display = gimp_tool_real_has_display;
|
|
|
|
klass->has_image = gimp_tool_real_has_image;
|
|
|
|
klass->initialize = gimp_tool_real_initialize;
|
|
|
|
klass->control = gimp_tool_real_control;
|
|
|
|
klass->button_press = gimp_tool_real_button_press;
|
|
|
|
klass->button_release = gimp_tool_real_button_release;
|
|
|
|
klass->motion = gimp_tool_real_motion;
|
|
|
|
klass->key_press = gimp_tool_real_key_press;
|
2010-02-19 03:50:11 +08:00
|
|
|
klass->key_release = gimp_tool_real_key_release;
|
2006-06-19 03:58:49 +08:00
|
|
|
klass->modifier_key = gimp_tool_real_modifier_key;
|
2006-09-13 02:41:09 +08:00
|
|
|
klass->active_modifier_key = gimp_tool_real_active_modifier_key;
|
2006-06-19 03:58:49 +08:00
|
|
|
klass->oper_update = gimp_tool_real_oper_update;
|
|
|
|
klass->cursor_update = gimp_tool_real_cursor_update;
|
2008-10-27 00:25:24 +08:00
|
|
|
klass->get_popup = gimp_tool_real_get_popup;
|
2010-11-10 21:18:33 +08:00
|
|
|
klass->options_notify = gimp_tool_real_options_notify;
|
2003-08-31 00:41:35 +08:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_TOOL_INFO,
|
|
|
|
g_param_spec_object ("tool-info",
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_TOOL_INFO,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READWRITE |
|
2003-08-31 00:41:35 +08:00
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_tool_init (GimpTool *tool)
|
|
|
|
{
|
2006-09-14 05:28:17 +08:00
|
|
|
tool->tool_info = NULL;
|
|
|
|
tool->ID = global_tool_ID++;
|
|
|
|
tool->control = g_object_new (GIMP_TYPE_TOOL_CONTROL, NULL);
|
|
|
|
tool->display = NULL;
|
|
|
|
tool->drawable = NULL;
|
|
|
|
tool->focus_display = NULL;
|
|
|
|
tool->modifier_state = 0;
|
|
|
|
tool->active_modifier_state = 0;
|
|
|
|
tool->button_press_state = 0;
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
2010-11-10 21:18:33 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_constructed (GObject *object)
|
|
|
|
{
|
|
|
|
GimpTool *tool = GIMP_TOOL (object);
|
|
|
|
|
|
|
|
if (G_OBJECT_CLASS (parent_class)->constructed)
|
|
|
|
G_OBJECT_CLASS (parent_class)->constructed (object);
|
|
|
|
|
|
|
|
g_assert (GIMP_IS_TOOL_INFO (tool->tool_info));
|
|
|
|
|
|
|
|
g_signal_connect_object (gimp_tool_get_options (tool), "notify",
|
|
|
|
G_CALLBACK (gimp_tool_options_notify),
|
|
|
|
tool, 0);
|
|
|
|
}
|
|
|
|
|
2011-04-01 21:39:37 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
GimpTool *tool = GIMP_TOOL (object);
|
|
|
|
|
|
|
|
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GimpTool *tool = GIMP_TOOL (object);
|
2003-07-10 20:13:21 +08:00
|
|
|
|
2003-08-31 00:41:35 +08:00
|
|
|
if (tool->tool_info)
|
|
|
|
{
|
|
|
|
g_object_unref (tool->tool_info);
|
|
|
|
tool->tool_info = NULL;
|
|
|
|
}
|
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
if (tool->control)
|
|
|
|
{
|
|
|
|
g_object_unref (tool->control);
|
|
|
|
tool->control = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2003-08-31 00:41:35 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2004-03-10 20:45:11 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (object);
|
2003-08-31 00:41:35 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_TOOL_INFO:
|
2008-07-23 14:47:23 +08:00
|
|
|
tool->tool_info = g_value_dup_object (value);
|
2003-08-31 00:41:35 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_tool_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2004-03-10 20:45:11 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (object);
|
2003-08-31 00:41:35 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_TOOL_INFO:
|
|
|
|
g_value_set_object (value, tool->tool_info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
|
|
|
|
/* standard member functions */
|
|
|
|
|
2006-06-19 03:58:49 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_tool_real_has_display (GimpTool *tool,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
2007-03-15 07:07:00 +08:00
|
|
|
return (display == tool->display ||
|
|
|
|
g_list_find (tool->status_displays, display));
|
2006-06-19 03:58:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GimpDisplay *
|
|
|
|
gimp_tool_real_has_image (GimpTool *tool,
|
|
|
|
GimpImage *image)
|
|
|
|
{
|
|
|
|
if (tool->display)
|
|
|
|
{
|
2009-10-07 01:20:44 +08:00
|
|
|
if (image && gimp_display_get_image (tool->display) == image)
|
2006-06-19 03:58:49 +08:00
|
|
|
return tool->display;
|
|
|
|
|
|
|
|
/* NULL image means any display */
|
|
|
|
if (! image)
|
|
|
|
return tool->display;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-01-22 00:07:48 +08:00
|
|
|
static gboolean
|
2006-09-27 04:55:40 +08:00
|
|
|
gimp_tool_real_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GError **error)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
2004-01-22 00:07:48 +08:00
|
|
|
return TRUE;
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_tool_real_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
2006-06-19 03:58:49 +08:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case GIMP_TOOL_ACTION_PAUSE:
|
|
|
|
case GIMP_TOOL_ACTION_RESUME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_TOOL_ACTION_HALT:
|
|
|
|
tool->display = NULL;
|
|
|
|
break;
|
|
|
|
}
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
2003-04-16 00:05:52 +08:00
|
|
|
static void
|
2009-06-20 23:37:31 +08:00
|
|
|
gimp_tool_real_button_press (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonPressType press_type,
|
|
|
|
GimpDisplay *display)
|
2003-04-16 00:05:52 +08:00
|
|
|
{
|
2009-06-20 23:37:31 +08:00
|
|
|
if (press_type == GIMP_BUTTON_PRESS_NORMAL)
|
|
|
|
{
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpImage *image = gimp_display_get_image (display);
|
|
|
|
|
2009-06-20 23:37:31 +08:00
|
|
|
tool->display = display;
|
2009-10-07 01:20:44 +08:00
|
|
|
tool->drawable = gimp_image_get_active_drawable (image);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2009-06-20 23:37:31 +08:00
|
|
|
gimp_tool_control_activate (tool->control);
|
|
|
|
}
|
2003-04-16 00:05:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-02-28 02:55:12 +08:00
|
|
|
gimp_tool_real_button_release (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonReleaseType release_type,
|
|
|
|
GimpDisplay *display)
|
2003-04-16 00:05:52 +08:00
|
|
|
{
|
|
|
|
gimp_tool_control_halt (tool->control);
|
|
|
|
}
|
2003-04-15 22:20:19 +08:00
|
|
|
|
|
|
|
static void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_tool_real_motion (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-06-24 18:16:08 +08:00
|
|
|
static gboolean
|
2004-06-13 02:41:52 +08:00
|
|
|
gimp_tool_real_key_press (GimpTool *tool,
|
2003-04-15 22:20:19 +08:00
|
|
|
GdkEventKey *kevent,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
2004-06-24 18:16:08 +08:00
|
|
|
return FALSE;
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
2010-02-19 03:50:11 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_tool_real_key_release (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_real_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-09-13 02:41:09 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_real_active_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
static void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_tool_real_oper_update (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
gboolean proximity,
|
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_tool_real_cursor_update (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
gimp_tool_set_cursor (tool, display,
|
2005-07-31 04:46:05 +08:00
|
|
|
gimp_tool_control_get_cursor (tool->control),
|
|
|
|
gimp_tool_control_get_tool_cursor (tool->control),
|
|
|
|
gimp_tool_control_get_cursor_modifier (tool->control));
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
2008-10-27 00:25:24 +08:00
|
|
|
static GimpUIManager *
|
|
|
|
gimp_tool_real_get_popup (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-10-27 00:25:24 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display,
|
|
|
|
const gchar **ui_path)
|
|
|
|
{
|
|
|
|
*ui_path = NULL;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-10 21:18:33 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_real_options_notify (GimpTool *tool,
|
|
|
|
GimpToolOptions *options,
|
|
|
|
const GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2006-09-06 02:25:31 +08:00
|
|
|
GimpToolOptions *
|
|
|
|
gimp_tool_get_options (GimpTool *tool)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_TOOL (tool), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_TOOL_INFO (tool->tool_info), NULL);
|
|
|
|
|
|
|
|
return tool->tool_info->tool_options;
|
|
|
|
}
|
|
|
|
|
2006-06-19 03:58:49 +08:00
|
|
|
gboolean
|
|
|
|
gimp_tool_has_display (GimpTool *tool,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_TOOL (tool), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE);
|
|
|
|
|
|
|
|
return GIMP_TOOL_GET_CLASS (tool)->has_display (tool, display);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpDisplay *
|
|
|
|
gimp_tool_has_image (GimpTool *tool,
|
|
|
|
GimpImage *image)
|
|
|
|
{
|
2007-03-15 07:07:00 +08:00
|
|
|
GimpDisplay *display;
|
|
|
|
|
2006-06-19 03:58:49 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_TOOL (tool), NULL);
|
|
|
|
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
2007-03-15 07:07:00 +08:00
|
|
|
display = GIMP_TOOL_GET_CLASS (tool)->has_image (tool, image);
|
|
|
|
|
|
|
|
/* check status displays last because they don't affect the tool
|
|
|
|
* itself (unlike tool->display or draw_tool->display)
|
|
|
|
*/
|
|
|
|
if (! display && tool->status_displays)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
for (list = tool->status_displays; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpDisplay *status_display = list->data;
|
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
if (gimp_display_get_image (status_display) == image)
|
2007-03-15 07:07:00 +08:00
|
|
|
return status_display;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NULL image means any display */
|
|
|
|
if (! image)
|
|
|
|
return tool->status_displays->data;
|
|
|
|
}
|
|
|
|
|
|
|
|
return display;
|
2006-06-19 03:58:49 +08:00
|
|
|
}
|
|
|
|
|
2004-01-22 00:07:48 +08:00
|
|
|
gboolean
|
2003-07-10 20:13:21 +08:00
|
|
|
gimp_tool_initialize (GimpTool *tool,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
2006-09-27 04:55:40 +08:00
|
|
|
GError *error = NULL;
|
|
|
|
|
2004-01-22 00:07:48 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_TOOL (tool), FALSE);
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2006-09-27 04:55:40 +08:00
|
|
|
if (! GIMP_TOOL_GET_CLASS (tool)->initialize (tool, display, &error))
|
|
|
|
{
|
2008-12-21 23:49:12 +08:00
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
gimp_tool_message_literal (tool, display, error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
|
2006-09-27 04:55:40 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-07-10 20:13:21 +08:00
|
|
|
gimp_tool_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
2006-05-22 05:12:01 +08:00
|
|
|
case GIMP_TOOL_ACTION_PAUSE:
|
2003-05-06 19:11:15 +08:00
|
|
|
if (! gimp_tool_control_is_paused (tool->control))
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, display);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
|
|
|
gimp_tool_control_pause (tool->control);
|
|
|
|
break;
|
|
|
|
|
2006-05-22 05:12:01 +08:00
|
|
|
case GIMP_TOOL_ACTION_RESUME:
|
2003-04-15 22:20:19 +08:00
|
|
|
if (gimp_tool_control_is_paused (tool->control))
|
|
|
|
{
|
|
|
|
gimp_tool_control_resume (tool->control);
|
|
|
|
|
2003-05-06 19:11:15 +08:00
|
|
|
if (! gimp_tool_control_is_paused (tool->control))
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, display);
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-03-10 20:45:11 +08:00
|
|
|
g_warning ("gimp_tool_control: unable to RESUME tool with "
|
|
|
|
"tool->control->paused_count == 0");
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-05-22 05:12:01 +08:00
|
|
|
case GIMP_TOOL_ACTION_HALT:
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, display);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2003-05-06 19:11:15 +08:00
|
|
|
if (gimp_tool_control_is_active (tool->control))
|
|
|
|
gimp_tool_control_halt (tool->control);
|
2007-03-15 07:07:00 +08:00
|
|
|
|
|
|
|
gimp_tool_clear_status (tool);
|
2003-04-15 22:20:19 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-06-20 23:37:31 +08:00
|
|
|
gimp_tool_button_press (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonPressType press_type,
|
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
g_return_if_fail (coords != NULL);
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2006-09-13 02:41:09 +08:00
|
|
|
GIMP_TOOL_GET_CLASS (tool)->button_press (tool, coords, time, state,
|
2009-06-20 23:37:31 +08:00
|
|
|
press_type, display);
|
2006-09-13 02:41:09 +08:00
|
|
|
|
2009-06-20 23:37:31 +08:00
|
|
|
if (press_type == GIMP_BUTTON_PRESS_NORMAL &&
|
|
|
|
gimp_tool_control_is_active (tool->control))
|
2006-09-13 02:41:09 +08:00
|
|
|
{
|
|
|
|
tool->button_press_state = state;
|
|
|
|
tool->active_modifier_state = state;
|
2007-02-28 05:11:35 +08:00
|
|
|
|
|
|
|
if (gimp_tool_control_get_wants_click (tool->control))
|
|
|
|
{
|
2007-02-28 05:40:35 +08:00
|
|
|
tool->in_click_distance = TRUE;
|
2007-03-10 23:07:56 +08:00
|
|
|
tool->got_motion_event = FALSE;
|
2007-02-28 05:40:35 +08:00
|
|
|
tool->button_press_coords = *coords;
|
|
|
|
tool->button_press_time = time;
|
2007-02-28 05:11:35 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-01 00:00:26 +08:00
|
|
|
tool->in_click_distance = FALSE;
|
2007-02-28 05:11:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-01 00:00:26 +08:00
|
|
|
static gboolean
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_tool_check_click_distance (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GimpDisplay *display)
|
2007-02-28 05:11:35 +08:00
|
|
|
{
|
2009-10-06 01:58:03 +08:00
|
|
|
GimpDisplayShell *shell;
|
|
|
|
gint double_click_time;
|
|
|
|
gint double_click_distance;
|
2007-03-01 00:00:26 +08:00
|
|
|
|
|
|
|
if (! tool->in_click_distance)
|
|
|
|
return FALSE;
|
2007-02-28 05:11:35 +08:00
|
|
|
|
2009-10-06 01:58:03 +08:00
|
|
|
shell = gimp_display_get_shell (display);
|
|
|
|
|
|
|
|
g_object_get (gtk_widget_get_settings (GTK_WIDGET (shell)),
|
2007-02-28 05:11:35 +08:00
|
|
|
"gtk-double-click-time", &double_click_time,
|
|
|
|
"gtk-double-click-distance", &double_click_distance,
|
|
|
|
NULL);
|
|
|
|
|
2007-03-01 00:00:26 +08:00
|
|
|
if ((time - tool->button_press_time) > double_click_time)
|
2007-02-28 05:11:35 +08:00
|
|
|
{
|
|
|
|
tool->in_click_distance = FALSE;
|
2006-09-13 02:41:09 +08:00
|
|
|
}
|
2007-03-01 00:00:26 +08:00
|
|
|
else
|
|
|
|
{
|
2009-10-05 01:56:39 +08:00
|
|
|
GimpDisplayShell *shell = gimp_display_get_shell (display);
|
2007-03-01 00:00:26 +08:00
|
|
|
gdouble dx;
|
|
|
|
gdouble dy;
|
|
|
|
|
|
|
|
dx = SCALEX (shell, tool->button_press_coords.x - coords->x);
|
|
|
|
dy = SCALEY (shell, tool->button_press_coords.y - coords->y);
|
|
|
|
|
2007-03-30 03:00:45 +08:00
|
|
|
if ((SQR (dx) + SQR (dy)) > SQR (double_click_distance))
|
2007-03-01 00:00:26 +08:00
|
|
|
{
|
|
|
|
tool->in_click_distance = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return tool->in_click_distance;
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_tool_button_release (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
2007-02-28 02:55:12 +08:00
|
|
|
GimpButtonReleaseType release_type = GIMP_BUTTON_RELEASE_NORMAL;
|
2007-02-28 05:40:35 +08:00
|
|
|
GimpCoords my_coords;
|
2007-02-28 02:55:12 +08:00
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
g_return_if_fail (coords != NULL);
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2011-04-01 17:01:36 +08:00
|
|
|
g_return_if_fail (gimp_tool_control_is_active (tool->control) == TRUE);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2006-09-14 05:28:17 +08:00
|
|
|
g_object_ref (tool);
|
|
|
|
|
2007-02-28 05:40:35 +08:00
|
|
|
my_coords = *coords;
|
|
|
|
|
2007-02-28 02:55:12 +08:00
|
|
|
if (state & GDK_BUTTON3_MASK)
|
2007-02-28 05:11:35 +08:00
|
|
|
{
|
|
|
|
release_type = GIMP_BUTTON_RELEASE_CANCEL;
|
|
|
|
}
|
2007-03-10 23:07:56 +08:00
|
|
|
else if (gimp_tool_control_get_wants_click (tool->control))
|
2007-02-28 05:11:35 +08:00
|
|
|
{
|
2007-03-10 23:07:56 +08:00
|
|
|
if (gimp_tool_check_click_distance (tool, coords, time, display))
|
|
|
|
{
|
|
|
|
release_type = GIMP_BUTTON_RELEASE_CLICK;
|
|
|
|
my_coords = tool->button_press_coords;
|
|
|
|
|
|
|
|
/* synthesize a motion event back to the recorded press
|
|
|
|
* coordinates
|
|
|
|
*/
|
|
|
|
GIMP_TOOL_GET_CLASS (tool)->motion (tool, &my_coords, time,
|
|
|
|
state & GDK_BUTTON1_MASK,
|
|
|
|
display);
|
|
|
|
}
|
|
|
|
else if (! tool->got_motion_event)
|
|
|
|
{
|
|
|
|
release_type = GIMP_BUTTON_RELEASE_NO_MOTION;
|
|
|
|
}
|
2007-02-28 05:11:35 +08:00
|
|
|
}
|
2007-02-28 02:55:12 +08:00
|
|
|
|
2007-02-28 05:40:35 +08:00
|
|
|
GIMP_TOOL_GET_CLASS (tool)->button_release (tool, &my_coords, time, state,
|
2007-02-28 02:55:12 +08:00
|
|
|
release_type, display);
|
2006-09-13 03:36:05 +08:00
|
|
|
|
2011-04-01 17:01:36 +08:00
|
|
|
g_warn_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
|
|
|
|
|
2006-09-14 05:28:17 +08:00
|
|
|
if (tool->active_modifier_state != 0)
|
2011-04-01 17:01:36 +08:00
|
|
|
{
|
|
|
|
gimp_tool_control_activate (tool->control);
|
|
|
|
|
|
|
|
gimp_tool_set_active_modifier_state (tool, 0, display);
|
|
|
|
|
|
|
|
gimp_tool_control_halt (tool->control);
|
|
|
|
}
|
2006-09-14 05:28:17 +08:00
|
|
|
|
|
|
|
tool->button_press_state = 0;
|
|
|
|
|
|
|
|
g_object_unref (tool);
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_tool_motion (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
g_return_if_fail (coords != NULL);
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2011-04-01 17:01:36 +08:00
|
|
|
g_return_if_fail (gimp_tool_control_is_active (tool->control) == TRUE);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2007-03-10 23:07:56 +08:00
|
|
|
tool->got_motion_event = TRUE;
|
2007-03-01 00:00:26 +08:00
|
|
|
gimp_tool_check_click_distance (tool, coords, time, display);
|
2007-02-28 05:11:35 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_GET_CLASS (tool)->motion (tool, coords, time, state, display);
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
2003-10-14 19:14:28 +08:00
|
|
|
void
|
|
|
|
gimp_tool_set_focus_display (GimpTool *tool,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2003-10-14 19:14:28 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display));
|
2011-04-01 17:01:36 +08:00
|
|
|
g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
|
2003-10-14 19:14:28 +08:00
|
|
|
|
2007-12-08 02:52:41 +08:00
|
|
|
GIMP_LOG (TOOL_FOCUS, "tool: %p focus_display: %p tool->focus_display: %p",
|
|
|
|
tool, display, tool->focus_display);
|
2003-10-14 19:14:28 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (display != tool->focus_display)
|
2003-10-14 19:14:28 +08:00
|
|
|
{
|
|
|
|
if (tool->focus_display)
|
|
|
|
{
|
2006-09-14 05:28:17 +08:00
|
|
|
if (tool->active_modifier_state != 0)
|
2011-04-01 17:01:36 +08:00
|
|
|
{
|
|
|
|
gimp_tool_control_activate (tool->control);
|
|
|
|
|
|
|
|
gimp_tool_set_active_modifier_state (tool, 0, tool->focus_display);
|
|
|
|
|
|
|
|
gimp_tool_control_halt (tool->control);
|
|
|
|
}
|
2006-09-14 05:28:17 +08:00
|
|
|
|
2003-10-14 19:14:28 +08:00
|
|
|
if (tool->modifier_state != 0)
|
|
|
|
gimp_tool_set_modifier_state (tool, 0, tool->focus_display);
|
|
|
|
}
|
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
tool->focus_display = display;
|
2003-10-14 19:14:28 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-24 18:16:08 +08:00
|
|
|
gboolean
|
2004-06-13 02:41:52 +08:00
|
|
|
gimp_tool_key_press (GimpTool *tool,
|
2003-04-15 22:20:19 +08:00
|
|
|
GdkEventKey *kevent,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
2004-06-24 18:16:08 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_TOOL (tool), FALSE);
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE);
|
|
|
|
g_return_val_if_fail (display == tool->focus_display, FALSE);
|
2011-04-01 17:01:36 +08:00
|
|
|
g_return_val_if_fail (gimp_tool_control_is_active (tool->control) == FALSE,
|
|
|
|
FALSE);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
return GIMP_TOOL_GET_CLASS (tool)->key_press (tool, kevent, display);
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
2010-02-19 03:50:11 +08:00
|
|
|
gboolean
|
|
|
|
gimp_tool_key_release (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_TOOL (tool), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE);
|
|
|
|
g_return_val_if_fail (display == tool->focus_display, FALSE);
|
2011-04-01 17:01:36 +08:00
|
|
|
g_return_val_if_fail (gimp_tool_control_is_active (tool->control) == FALSE,
|
|
|
|
FALSE);
|
2010-02-19 03:50:11 +08:00
|
|
|
|
|
|
|
return GIMP_TOOL_GET_CLASS (tool)->key_release (tool, kevent, display);
|
|
|
|
}
|
|
|
|
|
2003-10-14 19:14:28 +08:00
|
|
|
static void
|
2003-04-15 22:20:19 +08:00
|
|
|
gimp_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
|
|
|
g_return_if_fail (display == tool->focus_display);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_GET_CLASS (tool)->modifier_key (tool, key, press, state, display);
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
2003-10-14 19:14:28 +08:00
|
|
|
void
|
|
|
|
gimp_tool_set_modifier_state (GimpTool *tool,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2003-10-14 19:14:28 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2011-04-01 17:01:36 +08:00
|
|
|
g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
|
2003-10-14 19:14:28 +08:00
|
|
|
|
2007-12-08 02:52:41 +08:00
|
|
|
GIMP_LOG (TOOL_FOCUS, "tool: %p display: %p tool->focus_display: %p",
|
|
|
|
tool, display, tool->focus_display);
|
2003-10-14 19:14:28 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (display == tool->focus_display);
|
2003-10-14 19:14:28 +08:00
|
|
|
|
|
|
|
if ((tool->modifier_state & GDK_SHIFT_MASK) != (state & GDK_SHIFT_MASK))
|
|
|
|
{
|
|
|
|
gimp_tool_modifier_key (tool, GDK_SHIFT_MASK,
|
|
|
|
(state & GDK_SHIFT_MASK) ? TRUE : FALSE, state,
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2003-10-14 19:14:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((tool->modifier_state & GDK_CONTROL_MASK) != (state & GDK_CONTROL_MASK))
|
|
|
|
{
|
|
|
|
gimp_tool_modifier_key (tool, GDK_CONTROL_MASK,
|
|
|
|
(state & GDK_CONTROL_MASK) ? TRUE : FALSE, state,
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2003-10-14 19:14:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((tool->modifier_state & GDK_MOD1_MASK) != (state & GDK_MOD1_MASK))
|
|
|
|
{
|
|
|
|
gimp_tool_modifier_key (tool, GDK_MOD1_MASK,
|
|
|
|
(state & GDK_MOD1_MASK) ? TRUE : FALSE, state,
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2003-10-14 19:14:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
tool->modifier_state = state;
|
|
|
|
}
|
|
|
|
|
2006-09-13 02:41:09 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_active_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
|
|
|
g_return_if_fail (display == tool->focus_display);
|
|
|
|
|
|
|
|
GIMP_TOOL_GET_CLASS (tool)->active_modifier_key (tool, key, press, state,
|
|
|
|
display);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_tool_set_active_modifier_state (GimpTool *tool,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2011-04-01 17:01:36 +08:00
|
|
|
g_return_if_fail (gimp_tool_control_is_active (tool->control) == TRUE);
|
2006-09-13 02:41:09 +08:00
|
|
|
|
2007-12-08 02:52:41 +08:00
|
|
|
GIMP_LOG (TOOL_FOCUS, "tool: %p display: %p tool->focus_display: %p",
|
|
|
|
tool, display, tool->focus_display);
|
|
|
|
|
2006-09-13 02:41:09 +08:00
|
|
|
g_return_if_fail (display == tool->focus_display);
|
|
|
|
|
|
|
|
if ((tool->active_modifier_state & GDK_SHIFT_MASK) !=
|
|
|
|
(state & GDK_SHIFT_MASK))
|
|
|
|
{
|
2006-09-13 06:55:03 +08:00
|
|
|
gboolean press = state & GDK_SHIFT_MASK;
|
|
|
|
|
2006-09-13 02:41:09 +08:00
|
|
|
#ifdef DEBUG_ACTIVE_STATE
|
|
|
|
g_printerr ("%s: SHIFT %s\n", G_STRFUNC,
|
2006-09-13 06:55:03 +08:00
|
|
|
press ? "pressed" : "released");
|
2006-09-13 02:41:09 +08:00
|
|
|
#endif
|
|
|
|
|
2006-09-13 06:55:03 +08:00
|
|
|
if (! press && (tool->button_press_state & GDK_SHIFT_MASK))
|
2006-09-13 02:41:09 +08:00
|
|
|
{
|
|
|
|
tool->button_press_state &= ~GDK_SHIFT_MASK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_tool_active_modifier_key (tool, GDK_SHIFT_MASK,
|
2006-09-13 06:55:03 +08:00
|
|
|
press, state,
|
2006-09-13 02:41:09 +08:00
|
|
|
display);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((tool->active_modifier_state & GDK_CONTROL_MASK) !=
|
|
|
|
(state & GDK_CONTROL_MASK))
|
|
|
|
{
|
2006-09-13 06:55:03 +08:00
|
|
|
gboolean press = state & GDK_CONTROL_MASK;
|
|
|
|
|
2006-09-13 02:41:09 +08:00
|
|
|
#ifdef DEBUG_ACTIVE_STATE
|
|
|
|
g_printerr ("%s: CONTROL %s\n", G_STRFUNC,
|
2006-09-13 06:55:03 +08:00
|
|
|
press ? "pressed" : "released");
|
2006-09-13 02:41:09 +08:00
|
|
|
#endif
|
|
|
|
|
2006-09-13 06:55:03 +08:00
|
|
|
if (! press && (tool->button_press_state & GDK_CONTROL_MASK))
|
2006-09-13 02:41:09 +08:00
|
|
|
{
|
2007-07-25 08:39:01 +08:00
|
|
|
tool->button_press_state &= ~GDK_CONTROL_MASK;
|
2006-09-13 02:41:09 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_tool_active_modifier_key (tool, GDK_CONTROL_MASK,
|
2006-09-13 06:55:03 +08:00
|
|
|
press, state,
|
2006-09-13 02:41:09 +08:00
|
|
|
display);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((tool->active_modifier_state & GDK_MOD1_MASK) !=
|
|
|
|
(state & GDK_MOD1_MASK))
|
|
|
|
{
|
2006-09-13 06:55:03 +08:00
|
|
|
gboolean press = state & GDK_MOD1_MASK;
|
|
|
|
|
2006-09-13 02:41:09 +08:00
|
|
|
#ifdef DEBUG_ACTIVE_STATE
|
|
|
|
g_printerr ("%s: ALT %s\n", G_STRFUNC,
|
2006-09-13 06:55:03 +08:00
|
|
|
press ? "pressed" : "released");
|
2006-09-13 02:41:09 +08:00
|
|
|
#endif
|
|
|
|
|
2006-09-13 06:55:03 +08:00
|
|
|
if (! press && (tool->button_press_state & GDK_MOD1_MASK))
|
2006-09-13 02:41:09 +08:00
|
|
|
{
|
|
|
|
tool->button_press_state &= ~GDK_MOD1_MASK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_tool_active_modifier_key (tool, GDK_MOD1_MASK,
|
2006-09-13 06:55:03 +08:00
|
|
|
press, state,
|
2006-09-13 02:41:09 +08:00
|
|
|
display);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tool->active_modifier_state = state;
|
|
|
|
}
|
|
|
|
|
2003-04-15 22:20:19 +08:00
|
|
|
void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_tool_oper_update (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
gboolean proximity,
|
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
g_return_if_fail (coords != NULL);
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2011-04-01 17:01:36 +08:00
|
|
|
g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2006-03-25 22:23:09 +08:00
|
|
|
GIMP_TOOL_GET_CLASS (tool)->oper_update (tool, coords, state, proximity,
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2009-01-30 05:32:30 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
if (G_UNLIKELY (gimp_image_is_empty (gimp_display_get_image (display)) &&
|
2009-01-30 05:32:30 +08:00
|
|
|
! gimp_tool_control_get_handle_empty_image (tool->control)))
|
|
|
|
{
|
|
|
|
gimp_tool_replace_status (tool, display,
|
|
|
|
"%s",
|
|
|
|
_("Can't work on an empty image, "
|
|
|
|
"add a layer first"));
|
|
|
|
}
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_tool_cursor_update (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
2003-04-15 22:20:19 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
g_return_if_fail (coords != NULL);
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2011-04-01 17:01:36 +08:00
|
|
|
g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
|
2003-04-15 22:20:19 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_GET_CLASS (tool)->cursor_update (tool, coords, state, display);
|
2003-04-15 22:20:19 +08:00
|
|
|
}
|
|
|
|
|
2008-10-27 00:25:24 +08:00
|
|
|
GimpUIManager *
|
|
|
|
gimp_tool_get_popup (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-10-27 00:25:24 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display,
|
|
|
|
const gchar **ui_path)
|
|
|
|
{
|
2008-10-27 00:36:01 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_TOOL (tool), NULL);
|
|
|
|
g_return_val_if_fail (coords != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
|
|
|
|
g_return_val_if_fail (ui_path != NULL, NULL);
|
2008-10-27 00:25:24 +08:00
|
|
|
|
|
|
|
return GIMP_TOOL_GET_CLASS (tool)->get_popup (tool, coords, state, display,
|
|
|
|
ui_path);
|
|
|
|
}
|
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
void
|
|
|
|
gimp_tool_push_status (GimpTool *tool,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display,
|
2006-09-28 19:07:55 +08:00
|
|
|
const gchar *format,
|
|
|
|
...)
|
2002-02-03 20:10:23 +08:00
|
|
|
{
|
2009-09-30 02:32:26 +08:00
|
|
|
GimpDisplayShell *shell;
|
2009-10-04 21:31:38 +08:00
|
|
|
const gchar *stock_id;
|
|
|
|
va_list args;
|
2002-02-03 20:10:23 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2006-09-28 19:07:55 +08:00
|
|
|
g_return_if_fail (format != NULL);
|
2002-02-03 20:10:23 +08:00
|
|
|
|
2009-10-05 01:56:39 +08:00
|
|
|
shell = gimp_display_get_shell (display);
|
2002-02-03 20:10:23 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
|
2006-10-09 16:17:22 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
va_start (args, format);
|
2006-10-09 16:17:22 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
gimp_statusbar_push_valist (gimp_display_shell_get_statusbar (shell),
|
|
|
|
G_OBJECT_TYPE_NAME (tool), stock_id,
|
|
|
|
format, args);
|
2009-09-30 02:32:26 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
va_end (args);
|
2007-03-15 05:33:09 +08:00
|
|
|
|
|
|
|
tool->status_displays = g_list_remove (tool->status_displays, display);
|
|
|
|
tool->status_displays = g_list_prepend (tool->status_displays, display);
|
2002-02-03 20:10:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-08-21 00:22:09 +08:00
|
|
|
gimp_tool_push_status_coords (GimpTool *tool,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GimpCursorPrecision precision,
|
|
|
|
const gchar *title,
|
|
|
|
gdouble x,
|
|
|
|
const gchar *separator,
|
|
|
|
gdouble y,
|
|
|
|
const gchar *help)
|
2002-02-03 20:10:23 +08:00
|
|
|
{
|
2009-09-30 02:32:26 +08:00
|
|
|
GimpDisplayShell *shell;
|
2009-10-04 21:31:38 +08:00
|
|
|
const gchar *stock_id;
|
2002-02-03 20:10:23 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2002-02-03 20:10:23 +08:00
|
|
|
|
2009-10-05 01:56:39 +08:00
|
|
|
shell = gimp_display_get_shell (display);
|
2002-02-03 20:10:23 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
|
2008-04-14 14:28:43 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
gimp_statusbar_push_coords (gimp_display_shell_get_statusbar (shell),
|
|
|
|
G_OBJECT_TYPE_NAME (tool), stock_id,
|
|
|
|
precision, title, x, separator, y,
|
|
|
|
help);
|
2007-03-15 05:33:09 +08:00
|
|
|
|
|
|
|
tool->status_displays = g_list_remove (tool->status_displays, display);
|
|
|
|
tool->status_displays = g_list_prepend (tool->status_displays, display);
|
2002-02-03 20:10:23 +08:00
|
|
|
}
|
|
|
|
|
2004-11-10 09:17:40 +08:00
|
|
|
void
|
|
|
|
gimp_tool_push_status_length (GimpTool *tool,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display,
|
2004-11-10 09:17:40 +08:00
|
|
|
const gchar *title,
|
|
|
|
GimpOrientationType axis,
|
2007-01-21 09:24:51 +08:00
|
|
|
gdouble value,
|
|
|
|
const gchar *help)
|
2004-11-10 09:17:40 +08:00
|
|
|
{
|
2009-09-30 02:32:26 +08:00
|
|
|
GimpDisplayShell *shell;
|
2009-10-04 21:31:38 +08:00
|
|
|
const gchar *stock_id;
|
2004-11-10 09:17:40 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2004-11-10 09:17:40 +08:00
|
|
|
|
2009-10-05 01:56:39 +08:00
|
|
|
shell = gimp_display_get_shell (display);
|
2009-09-30 02:32:26 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
|
2004-11-10 09:17:40 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
gimp_statusbar_push_length (gimp_display_shell_get_statusbar (shell),
|
|
|
|
G_OBJECT_TYPE_NAME (tool), stock_id,
|
|
|
|
title, axis, value, help);
|
2007-03-15 05:33:09 +08:00
|
|
|
|
|
|
|
tool->status_displays = g_list_remove (tool->status_displays, display);
|
|
|
|
tool->status_displays = g_list_prepend (tool->status_displays, display);
|
2004-11-10 09:17:40 +08:00
|
|
|
}
|
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
void
|
2005-05-07 21:24:47 +08:00
|
|
|
gimp_tool_replace_status (GimpTool *tool,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display,
|
2006-09-28 19:07:55 +08:00
|
|
|
const gchar *format,
|
|
|
|
...)
|
2005-05-07 21:24:47 +08:00
|
|
|
{
|
2009-09-30 02:32:26 +08:00
|
|
|
GimpDisplayShell *shell;
|
2009-10-04 21:31:38 +08:00
|
|
|
const gchar *stock_id;
|
|
|
|
va_list args;
|
2005-05-07 21:24:47 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2006-09-28 19:07:55 +08:00
|
|
|
g_return_if_fail (format != NULL);
|
2005-05-07 21:24:47 +08:00
|
|
|
|
2009-10-05 01:56:39 +08:00
|
|
|
shell = gimp_display_get_shell (display);
|
2008-04-14 14:28:43 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
|
2006-10-09 16:17:22 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
va_start (args, format);
|
2006-10-09 16:17:22 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
gimp_statusbar_replace_valist (gimp_display_shell_get_statusbar (shell),
|
|
|
|
G_OBJECT_TYPE_NAME (tool), stock_id,
|
|
|
|
format, args);
|
2009-09-30 02:32:26 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
va_end (args);
|
2007-03-15 05:33:09 +08:00
|
|
|
|
|
|
|
tool->status_displays = g_list_remove (tool->status_displays, display);
|
|
|
|
tool->status_displays = g_list_prepend (tool->status_displays, display);
|
2005-05-07 21:24:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_tool_pop_status (GimpTool *tool,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2002-02-03 20:10:23 +08:00
|
|
|
{
|
2009-09-30 02:32:26 +08:00
|
|
|
GimpDisplayShell *shell;
|
2002-02-03 20:10:23 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2002-02-03 20:10:23 +08:00
|
|
|
|
2009-10-05 01:56:39 +08:00
|
|
|
shell = gimp_display_get_shell (display);
|
2009-09-30 03:44:43 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
gimp_statusbar_pop (gimp_display_shell_get_statusbar (shell),
|
|
|
|
G_OBJECT_TYPE_NAME (tool));
|
2007-03-15 05:33:09 +08:00
|
|
|
|
|
|
|
tool->status_displays = g_list_remove (tool->status_displays, display);
|
|
|
|
}
|
|
|
|
|
2006-09-28 16:32:09 +08:00
|
|
|
void
|
|
|
|
gimp_tool_message (GimpTool *tool,
|
|
|
|
GimpDisplay *display,
|
2006-09-28 19:07:55 +08:00
|
|
|
const gchar *format,
|
|
|
|
...)
|
2006-09-28 16:32:09 +08:00
|
|
|
{
|
2006-09-28 19:16:42 +08:00
|
|
|
va_list args;
|
2006-09-28 16:32:09 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2006-10-09 16:17:22 +08:00
|
|
|
g_return_if_fail (format != NULL);
|
2006-09-28 16:32:09 +08:00
|
|
|
|
2006-09-28 19:07:55 +08:00
|
|
|
va_start (args, format);
|
2006-09-28 19:16:42 +08:00
|
|
|
|
2009-10-05 02:05:28 +08:00
|
|
|
gimp_message_valist (display->gimp, G_OBJECT (display),
|
2006-10-09 16:17:22 +08:00
|
|
|
GIMP_MESSAGE_WARNING, format, args);
|
2006-09-28 19:16:42 +08:00
|
|
|
|
2006-09-28 19:07:55 +08:00
|
|
|
va_end (args);
|
2006-09-28 16:32:09 +08:00
|
|
|
}
|
|
|
|
|
2008-11-04 20:33:09 +08:00
|
|
|
void
|
|
|
|
gimp_tool_message_literal (GimpTool *tool,
|
|
|
|
GimpDisplay *display,
|
|
|
|
const gchar *message)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
|
|
|
g_return_if_fail (message != NULL);
|
|
|
|
|
2009-10-05 02:05:28 +08:00
|
|
|
gimp_message_literal (display->gimp, G_OBJECT (display),
|
2008-11-04 20:33:09 +08:00
|
|
|
GIMP_MESSAGE_WARNING, message);
|
|
|
|
}
|
|
|
|
|
2002-02-05 01:43:01 +08:00
|
|
|
void
|
|
|
|
gimp_tool_set_cursor (GimpTool *tool,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display,
|
2004-06-14 18:19:39 +08:00
|
|
|
GimpCursorType cursor,
|
2002-02-05 01:43:01 +08:00
|
|
|
GimpToolCursorType tool_cursor,
|
|
|
|
GimpCursorModifier modifier)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2002-02-05 01:43:01 +08:00
|
|
|
|
2009-10-05 01:56:39 +08:00
|
|
|
gimp_display_shell_set_cursor (gimp_display_get_shell (display),
|
2003-10-14 19:14:28 +08:00
|
|
|
cursor, tool_cursor, modifier);
|
2002-02-03 20:10:23 +08:00
|
|
|
}
|
2007-03-15 07:07:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2010-11-10 21:18:33 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_options_notify (GimpToolOptions *options,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpTool *tool)
|
|
|
|
{
|
|
|
|
GIMP_TOOL_GET_CLASS (tool)->options_notify (tool, options, pspec);
|
|
|
|
}
|
|
|
|
|
2007-03-15 07:07:00 +08:00
|
|
|
static void
|
|
|
|
gimp_tool_clear_status (GimpTool *tool)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
|
2011-04-01 21:39:37 +08:00
|
|
|
while (tool->status_displays)
|
|
|
|
gimp_tool_pop_status (tool, tool->status_displays->data);
|
2007-03-15 07:07:00 +08:00
|
|
|
}
|