gimp/app/tools/gimptool.c

469 lines
15 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
2002-03-29 11:50:29 +08:00
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis and others
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "tools-types.h"
app/tools/gimpairbrushtool.[ch] app/tools/gimpbezierselecttool.[ch] 2002-05-03 Sven Neumann <sven@gimp.org> * app/tools/gimpairbrushtool.[ch] * app/tools/gimpbezierselecttool.[ch] * app/tools/gimpblendtool.[ch] * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbucketfilltool[.ch] * app/tools/gimpbycolorselecttool[.ch] * app/tools/gimpclonetool[.ch] * app/tools/gimpcolorbalancetool[.ch] * app/tools/gimpcolorpickertool[.ch] * app/tools/gimpconvolvetool[.ch] * app/tools/gimpcroptool[.ch] * app/tools/gimpcurvestool[.ch] * app/tools/gimpdodgeburntool[.ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool[.ch] * app/tools/gimperasertool[.ch] * app/tools/gimpfliptool[.ch] * app/tools/gimpfreeselecttool[.ch] * app/tools/gimpfuzzyselecttool[.ch] * app/tools/gimphistogramtool[.ch] * app/tools/gimphuesaturationtool[.ch] * app/tools/gimpinktool[.ch] * app/tools/gimpiscissorstool[.ch] * app/tools/gimplevelstool[.ch] * app/tools/gimpmagnifytool[.ch] * app/tools/gimpmeasuretool[.ch] * app/tools/gimpmovetool[.ch] * app/tools/gimppaintbrushtool[.ch] * app/tools/gimppainttool.c * app/tools/gimppathtool[.ch] * app/tools/gimppenciltool[.ch] * app/tools/gimpperspectivetool[.ch] * app/tools/gimpposterizetool[.ch] * app/tools/gimprectselecttool[.ch] * app/tools/gimprotatetool[.ch] * app/tools/gimpscaletool[.ch] * app/tools/gimpselectiontool.c * app/tools/gimpsheartool[.ch] * app/tools/gimpsmudgetool[.ch] * app/tools/gimptexttool[.ch] * app/tools/gimpthresholdtool[.ch] * app/tools/gimptool.c * app/tools/gimptoolcontrol.h * app/tools/gimptoolmodule[.ch] * app/tools/gimptransformtool.c * app/tools/gimpvectortool[.ch] * app/tools/path_tool.c * app/tools/tool_manager[.ch] * app/tools/tools.c * libgimptool/gimptool.c * libgimptool/gimptoolcontrol.h * libgimptool/gimptoolmodule.h: removed tons of warnings. Do we need to add -Werror to the CFLAGS to avoid such a mess in the future ?! Also had to enforce the GIMP coding style in lots of places :-( * libgimp/gimppixelrgn.c: got sick and tired of debugging plug-ins, so I've added checks for most parameters passed to the GimpPixelRgn functions. This will slow down plug-in execution a little bit but should help to find bugs early.
2002-05-03 19:31:08 +08:00
#include "core/gimpimage.h"
#include "display/gimpdisplay.h"
2001-11-01 05:20:09 +08:00
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-cursor.h"
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
#include "display/gimpstatusbar.h"
#include "gimptool.h"
#include "gimptoolcontrol.h"
Made the tool system work again and integrated it back with the 2001-02-21 Michael Natterer <mitch@gimp.org> Made the tool system work again and integrated it back with the GimpContext. It's a hack between old, new and freshly hacked stuff. There are still lots of warnings but at least we can switch tools again. * app/tools/Makefile.am * app/tools/gimptoolinfo.[ch]: resurrected as real object. The GimpToolInfo objects are derived from GimpData, which gives us the tool icon stuff for free. Also, we need a list of _objects_ which is allocated all the time. All tools are required to have a "register" function which registers themselves with the list of GimpToolInfo objects which is maintained by the tool manager. * app/tools/tool.[ch]: made a real GtkObject with properly named functions out of it. The former "active_tool_control" is of course not the default implementation of the tool's "control" method but a hack _around_ it, so it went to the tool manager. * app/tools/color_picker.[ch] * app/tools/measure.[ch]: ditto. Added "register" functions and "destroy" implementations so the tools go away after use. * app/tools/tool_manager.[ch]: badly hacked at the moment to keep both the list of class structures _and_ the tool info list. * app/tools/tools.c: call the tools' register functions. * app/gimpcontext.[ch]: store a pointer to a GimpToolInfo object as "active_tool" in the context, so we're independent of tools being allocated or not. It's treated just like a brush or pattern now. * app/gimpdnd.[ch]: made tool DND work like all other DND types. * app/devices.[ch]: also here: the tool is just a normal data object now, resulting in removal of lots of code. * app/commands.c * app/context_manager.c: updated the tool select and context stuff to work again. * app/toolbox.c: removed the old pixmap buttons and put GimpPreviews inside the tool buttons. Still needs an own preview type to look nice. * app/disp_callbacks.c * app/about_dialog.c * app/app_procs.c * app/appenums.h * app/apptypes.h * app/gimage.c * app/gimppalette.c * app/gimppreview.c * app/gimprc.c * app/info_window.c * app/menus.c * app/palette_select.h * app/scale.c * app/scroll.c: lots of changes to make it work again.
2001-02-21 20:18:09 +08:00
app/tools/gimpairbrushtool.[ch] app/tools/gimpbezierselecttool.[ch] 2002-05-03 Sven Neumann <sven@gimp.org> * app/tools/gimpairbrushtool.[ch] * app/tools/gimpbezierselecttool.[ch] * app/tools/gimpblendtool.[ch] * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbucketfilltool[.ch] * app/tools/gimpbycolorselecttool[.ch] * app/tools/gimpclonetool[.ch] * app/tools/gimpcolorbalancetool[.ch] * app/tools/gimpcolorpickertool[.ch] * app/tools/gimpconvolvetool[.ch] * app/tools/gimpcroptool[.ch] * app/tools/gimpcurvestool[.ch] * app/tools/gimpdodgeburntool[.ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool[.ch] * app/tools/gimperasertool[.ch] * app/tools/gimpfliptool[.ch] * app/tools/gimpfreeselecttool[.ch] * app/tools/gimpfuzzyselecttool[.ch] * app/tools/gimphistogramtool[.ch] * app/tools/gimphuesaturationtool[.ch] * app/tools/gimpinktool[.ch] * app/tools/gimpiscissorstool[.ch] * app/tools/gimplevelstool[.ch] * app/tools/gimpmagnifytool[.ch] * app/tools/gimpmeasuretool[.ch] * app/tools/gimpmovetool[.ch] * app/tools/gimppaintbrushtool[.ch] * app/tools/gimppainttool.c * app/tools/gimppathtool[.ch] * app/tools/gimppenciltool[.ch] * app/tools/gimpperspectivetool[.ch] * app/tools/gimpposterizetool[.ch] * app/tools/gimprectselecttool[.ch] * app/tools/gimprotatetool[.ch] * app/tools/gimpscaletool[.ch] * app/tools/gimpselectiontool.c * app/tools/gimpsheartool[.ch] * app/tools/gimpsmudgetool[.ch] * app/tools/gimptexttool[.ch] * app/tools/gimpthresholdtool[.ch] * app/tools/gimptool.c * app/tools/gimptoolcontrol.h * app/tools/gimptoolmodule[.ch] * app/tools/gimptransformtool.c * app/tools/gimpvectortool[.ch] * app/tools/path_tool.c * app/tools/tool_manager[.ch] * app/tools/tools.c * libgimptool/gimptool.c * libgimptool/gimptoolcontrol.h * libgimptool/gimptoolmodule.h: removed tons of warnings. Do we need to add -Werror to the CFLAGS to avoid such a mess in the future ?! Also had to enforce the GIMP coding style in lots of places :-( * libgimp/gimppixelrgn.c: got sick and tired of debugging plug-ins, so I've added checks for most parameters passed to the GimpPixelRgn functions. This will slow down plug-in execution a little bit but should help to find bugs early.
2002-05-03 19:31:08 +08:00
static void gimp_tool_class_init (GimpToolClass *klass);
static void gimp_tool_init (GimpTool *tool);
static void gimp_tool_finalize (GObject *object);
static void gimp_tool_real_initialize (GimpTool *tool,
GimpDisplay *gdisp);
static void gimp_tool_real_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp);
static void gimp_tool_real_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_tool_real_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_tool_real_motion (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_tool_real_arrow_key (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *gdisp);
static void gimp_tool_real_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_tool_real_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_tool_real_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static GimpObjectClass *parent_class = NULL;
static gint global_tool_ID = 0;
GType
gimp_tool_get_type (void)
{
static GType tool_type = 0;
if (! tool_type)
{
static const GTypeInfo tool_info =
{
sizeof (GimpToolClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_tool_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpTool),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_tool_init,
};
tool_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpTool",
&tool_info, 0);
}
return tool_type;
}
static void
gimp_tool_class_init (GimpToolClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_tool_finalize;
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->arrow_key = gimp_tool_real_arrow_key;
klass->modifier_key = gimp_tool_real_modifier_key;
klass->oper_update = gimp_tool_real_oper_update;
klass->cursor_update = gimp_tool_real_cursor_update;
}
static void
gimp_tool_init (GimpTool *tool)
{
tool->ID = global_tool_ID++;
tool->control = GIMP_TOOL_CONTROL (g_object_new (GIMP_TYPE_TOOL_CONTROL,
NULL));
tool->gdisp = NULL;
tool->drawable = NULL;
}
static void
gimp_tool_finalize (GObject *object)
{
GimpTool *tool = GIMP_TOOL (object);
if (tool->control)
{
g_object_unref (tool->control);
tool->control = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/* standard member functions */
static void
gimp_tool_real_initialize (GimpTool *tool,
GimpDisplay *gdisp)
{
}
static void
gimp_tool_real_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp)
{
}
static void
gimp_tool_real_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
tool->gdisp = gdisp;
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_tool_control_activate (tool->control);
}
static void
gimp_tool_real_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
gimp_tool_control_halt (tool->control);
}
static void
gimp_tool_real_motion (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
}
static void
gimp_tool_real_arrow_key (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *gdisp)
{
}
static void
gimp_tool_real_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp)
{
}
static void
gimp_tool_real_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
{
}
static void
gimp_tool_real_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
{
if (gimp_tool_control_is_toggled (tool->control))
{
gimp_tool_set_cursor (tool, gdisp,
gimp_tool_control_get_toggle_cursor (tool->control),
gimp_tool_control_get_toggle_tool_cursor (tool->control),
gimp_tool_control_get_toggle_cursor_modifier (tool->control));
}
else
{
gimp_tool_set_cursor (tool, gdisp,
gimp_tool_control_get_cursor (tool->control),
gimp_tool_control_get_tool_cursor (tool->control),
gimp_tool_control_get_cursor_modifier (tool->control));
}
}
/* public functions */
void
gimp_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
GIMP_TOOL_GET_CLASS (tool)->initialize (tool, gdisp);
}
void
gimp_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
switch (action)
{
case PAUSE:
if (!gimp_tool_control_is_paused (tool->control))
{
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, gdisp);
}
gimp_tool_control_pause (tool->control);
break;
case RESUME:
if (gimp_tool_control_is_paused (tool->control))
{
gimp_tool_control_resume (tool->control);
if (!gimp_tool_control_is_paused (tool->control))
{
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, gdisp);
}
}
else
{
g_warning ("gimp_tool_control(): "
"unable to RESUME tool with tool->paused_count == 0");
}
break;
case HALT:
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, gdisp);
gimp_tool_control_halt (tool->control);
break;
}
}
void
gimp_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (coords != NULL);
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
GIMP_TOOL_GET_CLASS (tool)->button_press (tool, coords, time, state, gdisp);
}
void
gimp_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (coords != NULL);
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
GIMP_TOOL_GET_CLASS (tool)->button_release (tool, coords, time, state, gdisp);
}
void
gimp_tool_motion (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (coords != NULL);
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
GIMP_TOOL_GET_CLASS (tool)->motion (tool, coords, time, state, gdisp);
}
void
gimp_tool_arrow_key (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
GIMP_TOOL_GET_CLASS (tool)->arrow_key (tool, kevent, gdisp);
}
void
gimp_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
GIMP_TOOL_GET_CLASS (tool)->modifier_key (tool, key, press, state, gdisp);
}
void
gimp_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (coords != NULL);
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
GIMP_TOOL_GET_CLASS (tool)->oper_update (tool, coords, state, gdisp);
}
void
gimp_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (coords != NULL);
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
GIMP_TOOL_GET_CLASS (tool)->cursor_update (tool, coords, state, gdisp);
}
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
void
gimp_tool_push_status (GimpTool *tool,
const gchar *message)
{
GimpStatusbar *statusbar;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (tool->gdisp));
g_return_if_fail (message != NULL);
statusbar =
GIMP_STATUSBAR (GIMP_DISPLAY_SHELL (tool->gdisp->shell)->statusbar);
gimp_statusbar_push (statusbar,
added fields for both the tool's toggled and untoggled GdkCursorType, 2002-02-04 Michael Natterer <mitch@gimp.org> * app/tools/gimptool.[ch]: added fields for both the tool's toggled and untoggled GdkCursorType, GimpToolCursorType and GimpCursorModifier. Added a default implementation of gimp_tool_cursor_update() which uses the new fields. Added gimp_tool_set_cursor() as simple wrapper around the resp. GimpDisplayShell functions so tools don't need to know them. Tool implementations can either set the new fields in their cursor_update() function and chain up or call the new wrapper. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimpselectiontool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.c: changed accordingly: - set default values in the tools' instance_init functions. - changed the cursor_update() stuff. - removed inclusion of subclasses in gimppainttool.c - the cursor_update() functions are better than before but still evil. - i probably broke some of them...
2002-02-05 01:43:01 +08:00
G_OBJECT_TYPE_NAME (tool),
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
message);
}
void
gimp_tool_push_status_coords (GimpTool *tool,
const gchar *title,
gdouble x,
const gchar *separator,
gdouble y)
{
GimpStatusbar *statusbar;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (tool->gdisp));
g_return_if_fail (title != NULL);
g_return_if_fail (separator != NULL);
statusbar =
GIMP_STATUSBAR (GIMP_DISPLAY_SHELL (tool->gdisp->shell)->statusbar);
gimp_statusbar_push_coords (statusbar,
added fields for both the tool's toggled and untoggled GdkCursorType, 2002-02-04 Michael Natterer <mitch@gimp.org> * app/tools/gimptool.[ch]: added fields for both the tool's toggled and untoggled GdkCursorType, GimpToolCursorType and GimpCursorModifier. Added a default implementation of gimp_tool_cursor_update() which uses the new fields. Added gimp_tool_set_cursor() as simple wrapper around the resp. GimpDisplayShell functions so tools don't need to know them. Tool implementations can either set the new fields in their cursor_update() function and chain up or call the new wrapper. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimpselectiontool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.c: changed accordingly: - set default values in the tools' instance_init functions. - changed the cursor_update() stuff. - removed inclusion of subclasses in gimppainttool.c - the cursor_update() functions are better than before but still evil. - i probably broke some of them...
2002-02-05 01:43:01 +08:00
G_OBJECT_TYPE_NAME (tool),
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
title, x, separator, y);
}
void
gimp_tool_pop_status (GimpTool *tool)
{
GimpStatusbar *statusbar;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (tool->gdisp));
statusbar =
GIMP_STATUSBAR (GIMP_DISPLAY_SHELL (tool->gdisp->shell)->statusbar);
gimp_statusbar_pop (statusbar,
added fields for both the tool's toggled and untoggled GdkCursorType, 2002-02-04 Michael Natterer <mitch@gimp.org> * app/tools/gimptool.[ch]: added fields for both the tool's toggled and untoggled GdkCursorType, GimpToolCursorType and GimpCursorModifier. Added a default implementation of gimp_tool_cursor_update() which uses the new fields. Added gimp_tool_set_cursor() as simple wrapper around the resp. GimpDisplayShell functions so tools don't need to know them. Tool implementations can either set the new fields in their cursor_update() function and chain up or call the new wrapper. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimpselectiontool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.c: changed accordingly: - set default values in the tools' instance_init functions. - changed the cursor_update() stuff. - removed inclusion of subclasses in gimppainttool.c - the cursor_update() functions are better than before but still evil. - i probably broke some of them...
2002-02-05 01:43:01 +08:00
G_OBJECT_TYPE_NAME (tool));
}
void
gimp_tool_set_cursor (GimpTool *tool,
GimpDisplay *gdisp,
GdkCursorType cursor,
GimpToolCursorType tool_cursor,
GimpCursorModifier modifier)
{
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
made the gimp_object_get_memsize() debugging output configurable by a 2002-02-06 Michael Natterer <mitch@gimp.org> * app/core/gimpobject.c: made the gimp_object_get_memsize() debugging output configurable by a global "gimp_debug_memsize" boolean. * app/display/gimpdisplay.c: removed duplicated prototype. * app/display/gimpdisplayshell.[ch]: renamed the various cursor functions to be more consistent and shorter. Compress window title updates by adding a "gboolean title_dirty" and updating the title in gimp_display_shell_flush(). Added "%m" (memory size) to the possible title string substitutions. * app/display/gimpdisplay-foreach.c * app/display/gimpdisplayshell-handlers.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptool.c: changed accordingly. * app/display/gimpdisplayshell-callbacks.c: forgot to grab the pointer when dragging guides from the rulers. Coincidentially, this also fixes the buggy offset between guide and mouse pointer... Cleaned up the main tool event callback a but more. * app/widgets/gimppreview.c * app/gui/commands.c: set the new global "gimp_debug_memsize" toggle to TRUE while calling gimp_object_get_memsize(). * app/gui/preferences-dialog.c: added a image title example containing the new "%m" feature. * docs/gimprc-1.3.5.in: document "%m" in the manpage. * app/tools/gimpbezierselecttool.c: reordered some statements. * app/tools/gimpdrawtool.[ch]: store the GimpDisplay passed to gimp_draw_tool_start() in draw_tool->gdisp and use it for coordinate transfomration. This way we can paint on a display which is not tool->gdisp. * app/tools/gimppainttool.c: changed the gimp_draw_tool_foo() calls needed to make the straight_line preview work in a way that does not interfere with paint_tool subclasses which want to do their own drawing (like the clone tool). Also changed the paint_tools PRETRACE_PAINT and POSTTRACE_PAINT flags usage in a way that subclasses can use them without major hackery: don't simply wrap gimp_display_flush_now() with PRETRACE/POSTTRACE calls, but wrap the actual painting calls, so subclasses are able to do useful things with paint_tool->*_coords. * app/tools/gimpclonetool.c: removed poking around in draw_tool internals and simply suspend()/resume() it in PRETRACE_PAINT/POSTTRACE_PAINT to get the clone_src indicator drawn correctly.
2002-02-07 19:33:01 +08:00
gimp_display_shell_set_cursor (GIMP_DISPLAY_SHELL (gdisp->shell),
cursor,
tool_cursor,
modifier);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}