2001-02-14 13:19:55 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
2001-02-14 13:19:55 +08:00
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
#include "core/gimpimage.h"
|
|
|
|
#include "core/gimplist.h"
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core/gimptoolinfo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "gui/brush-select.h"
|
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2001-03-08 09:07:03 +08:00
|
|
|
#include "gimptool.h"
|
2001-07-08 06:49:01 +08:00
|
|
|
#include "gimprectselecttool.h"
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "paint_options.h"
|
2001-02-24 05:32:47 +08:00
|
|
|
#include "tool_manager.h"
|
2001-02-14 13:19:55 +08:00
|
|
|
#include "tool_options.h"
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "tools.h"
|
2001-02-14 13:19:55 +08:00
|
|
|
|
2001-04-01 07:04:29 +08:00
|
|
|
#include "gimpairbrushtool.h"
|
2001-03-31 23:45:05 +08:00
|
|
|
#include "gimppaintbrushtool.h"
|
2001-04-19 21:01:44 +08:00
|
|
|
#include "gimpclonetool.h"
|
|
|
|
#include "gimpconvolvetool.h"
|
2001-03-31 23:45:05 +08:00
|
|
|
#include "gimpdodgeburntool.h"
|
|
|
|
#include "gimperasertool.h"
|
|
|
|
#include "gimppenciltool.h"
|
2001-04-12 01:20:34 +08:00
|
|
|
#include "gimpsmudgetool.h"
|
2001-03-31 23:45:05 +08:00
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "app_procs.h"
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "gimprc.h"
|
2001-05-25 09:24:12 +08:00
|
|
|
|
2001-02-14 13:19:55 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
#define PAINT_OPTIONS_MASK GIMP_CONTEXT_OPACITY_MASK | \
|
|
|
|
GIMP_CONTEXT_PAINT_MODE_MASK
|
|
|
|
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
typedef struct _GimpToolManager GimpToolManager;
|
2001-02-14 13:19:55 +08:00
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
struct _GimpToolManager
|
|
|
|
{
|
|
|
|
GimpTool *active_tool;
|
|
|
|
GSList *tool_stack;
|
2001-02-14 13:19:55 +08:00
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpContext *global_tool_context;
|
2001-07-08 02:16:18 +08:00
|
|
|
|
|
|
|
GQuark image_dirty_handler_id;
|
2001-07-08 01:36:00 +08:00
|
|
|
};
|
2001-02-28 10:29:25 +08:00
|
|
|
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
/* local function prototypes */
|
2001-02-14 13:19:55 +08:00
|
|
|
|
2001-07-08 02:16:18 +08:00
|
|
|
static GimpToolManager * tool_manager_get (Gimp *gimp);
|
|
|
|
static void tool_manager_set (Gimp *gimp,
|
|
|
|
GimpToolManager *tool_manager);
|
|
|
|
static void tool_manager_tool_changed (GimpContext *user_context,
|
|
|
|
GimpToolInfo *tool_info,
|
|
|
|
gpointer data);
|
|
|
|
static void tool_manager_image_dirty (GimpImage *gimage,
|
|
|
|
gpointer data);
|
2001-07-07 20:17:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
void
|
|
|
|
tool_manager_init (Gimp *gimp)
|
2001-02-14 13:19:55 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
GimpContext *user_context;
|
|
|
|
GimpContext *tool_context;
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = g_new0 (GimpToolManager, 1);
|
|
|
|
|
2001-07-08 02:16:18 +08:00
|
|
|
tool_manager->active_tool = NULL;
|
|
|
|
tool_manager->tool_stack = NULL;
|
|
|
|
tool_manager->global_tool_context = NULL;
|
|
|
|
tool_manager->image_dirty_handler_id = 0;
|
2001-07-08 01:36:00 +08:00
|
|
|
|
|
|
|
tool_manager_set (gimp, tool_manager);
|
2001-07-07 20:17:23 +08:00
|
|
|
|
2001-07-08 02:16:18 +08:00
|
|
|
tool_manager->image_dirty_handler_id =
|
|
|
|
gimp_container_add_handler (gimp->images, "dirty",
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
G_CALLBACK (tool_manager_image_dirty),
|
2001-07-08 02:16:18 +08:00
|
|
|
tool_manager);
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
user_context = gimp_get_user_context (gimp);
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_connect (G_OBJECT (user_context), "tool_changed",
|
|
|
|
G_CALLBACK (tool_manager_tool_changed),
|
|
|
|
tool_manager);
|
2001-07-07 20:17:23 +08:00
|
|
|
|
|
|
|
/* Create a context to store the paint options of the
|
|
|
|
* global paint options mode
|
|
|
|
*/
|
2001-12-08 01:39:51 +08:00
|
|
|
tool_manager->global_tool_context = gimp_context_new (gimp,
|
|
|
|
"Global Tool Context",
|
|
|
|
user_context);
|
2001-07-07 20:17:23 +08:00
|
|
|
|
|
|
|
/* TODO: add foreground, background, brush, pattern, gradient */
|
2001-08-12 03:53:35 +08:00
|
|
|
gimp_context_define_properties (tool_manager->global_tool_context,
|
|
|
|
PAINT_OPTIONS_MASK, FALSE);
|
2001-07-07 20:17:23 +08:00
|
|
|
|
|
|
|
/* register internal tools */
|
|
|
|
tools_init (gimp);
|
|
|
|
|
2001-08-17 22:27:31 +08:00
|
|
|
gimp_tool_info_set_standard (gimp, tool_manager_get_info_by_type (gimp, GIMP_TYPE_RECT_SELECT_TOOL));
|
|
|
|
|
2002-03-13 05:02:10 +08:00
|
|
|
if (tool_manager->active_tool)
|
2001-07-07 20:17:23 +08:00
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
tool_context = tool_manager->active_tool->tool_info->context;
|
2001-07-08 01:36:00 +08:00
|
|
|
|
|
|
|
if (tool_context)
|
|
|
|
{
|
|
|
|
gimp_context_set_parent (tool_context, user_context);
|
|
|
|
}
|
2001-07-07 20:17:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_container_thaw (gimp->tool_info_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tool_manager_exit (Gimp *gimp)
|
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
2001-07-25 08:27:41 +08:00
|
|
|
g_object_unref (G_OBJECT (tool_manager->global_tool_context));
|
2001-07-08 01:36:00 +08:00
|
|
|
|
2001-07-08 02:16:18 +08:00
|
|
|
gimp_container_remove_handler (gimp->images,
|
|
|
|
tool_manager->image_dirty_handler_id);
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
g_free (tool_manager);
|
|
|
|
|
|
|
|
tool_manager_set (gimp, NULL);
|
2001-07-07 20:17:23 +08:00
|
|
|
}
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpTool *
|
|
|
|
tool_manager_get_active (Gimp *gimp)
|
|
|
|
{
|
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
return tool_manager->active_tool;
|
|
|
|
}
|
|
|
|
|
2001-02-14 13:19:55 +08:00
|
|
|
void
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager_select_tool (Gimp *gimp,
|
|
|
|
GimpTool *tool)
|
2001-02-14 13:19:55 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2001-02-28 10:29:25 +08:00
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->active_tool)
|
2001-11-02 17:31:21 +08:00
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
if (tool_manager->active_tool->gdisp)
|
|
|
|
{
|
|
|
|
tool_manager_control_active (gimp,
|
|
|
|
HALT,
|
|
|
|
tool_manager->active_tool->gdisp);
|
|
|
|
}
|
2001-11-02 17:31:21 +08:00
|
|
|
|
|
|
|
g_object_unref (G_OBJECT (tool_manager->active_tool));
|
|
|
|
}
|
2001-02-14 13:19:55 +08:00
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager->active_tool = tool;
|
2001-11-09 03:14:51 +08:00
|
|
|
|
|
|
|
g_object_ref (G_OBJECT (tool_manager->active_tool));
|
2001-02-14 13:19:55 +08:00
|
|
|
}
|
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
void
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager_push_tool (Gimp *gimp,
|
|
|
|
GimpTool *tool)
|
2001-02-28 10:29:25 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2001-02-28 10:29:25 +08:00
|
|
|
g_return_if_fail (GIMP_IS_TOOL (tool));
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->active_tool)
|
2001-02-28 10:29:25 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager->tool_stack = g_slist_prepend (tool_manager->tool_stack,
|
|
|
|
tool_manager->active_tool);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
|
|
|
g_object_ref (G_OBJECT (tool_manager->tool_stack->data));
|
2001-02-28 10:29:25 +08:00
|
|
|
}
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager_select_tool (gimp, tool);
|
2001-02-28 10:29:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager_pop_tool (Gimp *gimp)
|
2001-02-28 10:29:25 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->tool_stack)
|
2001-02-28 10:29:25 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager_select_tool (gimp,
|
|
|
|
GIMP_TOOL (tool_manager->tool_stack->data));
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_object_unref (G_OBJECT (tool_manager->tool_stack->data));
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager->tool_stack = g_slist_remove (tool_manager->tool_stack,
|
|
|
|
tool_manager->active_tool);
|
2001-02-28 10:29:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-21 20:18:09 +08:00
|
|
|
void
|
2001-11-09 03:14:51 +08:00
|
|
|
tool_manager_initialize_active (Gimp *gimp,
|
|
|
|
GimpDisplay *gdisp)
|
2001-02-21 20:18:09 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
2001-11-09 03:14:51 +08:00
|
|
|
GimpTool *tool;
|
2001-07-08 01:36:00 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2001-02-21 20:18:09 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
tool_manager = tool_manager_get (gimp);
|
2001-07-08 06:49:01 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
if (tool_manager->active_tool)
|
2001-07-08 06:49:01 +08:00
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
tool = tool_manager->active_tool;
|
2001-02-21 20:18:09 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_tool_initialize (tool, gdisp);
|
2001-02-21 20:18:09 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
if (gdisp)
|
|
|
|
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
|
|
|
|
else
|
|
|
|
tool->drawable = NULL;
|
2001-02-21 20:18:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-14 13:19:55 +08:00
|
|
|
void
|
2002-02-19 01:00:09 +08:00
|
|
|
tool_manager_control_active (Gimp *gimp,
|
|
|
|
GimpToolAction action,
|
|
|
|
GimpDisplay *gdisp)
|
2001-02-14 13:19:55 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
2002-02-17 19:46:39 +08:00
|
|
|
if (! tool_manager->active_tool)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (tool_manager->active_tool->gdisp == gdisp)
|
2001-02-21 20:18:09 +08:00
|
|
|
{
|
2002-02-19 01:00:09 +08:00
|
|
|
gimp_tool_control (tool_manager->active_tool,
|
|
|
|
action,
|
|
|
|
gdisp);
|
2002-02-17 19:46:39 +08:00
|
|
|
}
|
|
|
|
else if (action == HALT)
|
|
|
|
{
|
|
|
|
tool_manager->active_tool->state = INACTIVE;
|
2001-02-21 20:18:09 +08:00
|
|
|
}
|
2001-02-14 13:19:55 +08:00
|
|
|
}
|
|
|
|
|
2001-11-15 01:12:51 +08:00
|
|
|
void
|
|
|
|
tool_manager_button_press_active (Gimp *gimp,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->active_tool)
|
|
|
|
{
|
|
|
|
gimp_tool_button_press (tool_manager->active_tool,
|
|
|
|
coords, time, state,
|
|
|
|
gdisp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tool_manager_button_release_active (Gimp *gimp,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->active_tool)
|
|
|
|
{
|
|
|
|
gimp_tool_button_release (tool_manager->active_tool,
|
|
|
|
coords, time, state,
|
|
|
|
gdisp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tool_manager_motion_active (Gimp *gimp,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->active_tool)
|
|
|
|
{
|
|
|
|
gimp_tool_motion (tool_manager->active_tool,
|
|
|
|
coords, time, state,
|
|
|
|
gdisp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tool_manager_arrow_key_active (Gimp *gimp,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->active_tool)
|
|
|
|
{
|
|
|
|
gimp_tool_arrow_key (tool_manager->active_tool,
|
|
|
|
kevent,
|
|
|
|
gdisp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tool_manager_modifier_key_active (Gimp *gimp,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->active_tool)
|
|
|
|
{
|
|
|
|
gimp_tool_modifier_key (tool_manager->active_tool,
|
|
|
|
key, press, state,
|
|
|
|
gdisp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tool_manager_oper_update_active (Gimp *gimp,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->active_tool)
|
|
|
|
{
|
|
|
|
gimp_tool_oper_update (tool_manager->active_tool,
|
|
|
|
coords, state,
|
|
|
|
gdisp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tool_manager_cursor_update_active (Gimp *gimp,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
tool_manager = tool_manager_get (gimp);
|
|
|
|
|
|
|
|
if (tool_manager->active_tool)
|
|
|
|
{
|
|
|
|
gimp_tool_cursor_update (tool_manager->active_tool,
|
|
|
|
coords, state,
|
|
|
|
gdisp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-21 20:18:09 +08:00
|
|
|
void
|
2001-11-21 07:00:47 +08:00
|
|
|
tool_manager_register_tool (Gimp *gimp,
|
|
|
|
GType tool_type,
|
|
|
|
GimpToolOptionsNewFunc options_new_func,
|
|
|
|
gboolean tool_context,
|
|
|
|
const gchar *identifier,
|
|
|
|
const gchar *blurb,
|
|
|
|
const gchar *help,
|
|
|
|
const gchar *menu_path,
|
|
|
|
const gchar *menu_accel,
|
|
|
|
const gchar *help_domain,
|
|
|
|
const gchar *help_data,
|
|
|
|
const gchar *stock_id)
|
2001-02-21 20:18:09 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
GimpToolInfo *tool_info;
|
2002-02-26 10:00:02 +08:00
|
|
|
const gchar *paint_core_name;
|
2001-08-06 00:08:19 +08:00
|
|
|
GtkIconSet *icon_set;
|
|
|
|
GtkStyle *style;
|
|
|
|
GdkPixbuf *pixbuf;
|
2001-07-18 04:50:01 +08:00
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (g_type_is_a (tool_type, GIMP_TYPE_TOOL));
|
|
|
|
|
2001-07-18 04:50:01 +08:00
|
|
|
if (tool_type == GIMP_TYPE_PENCIL_TOOL)
|
|
|
|
{
|
2002-02-26 10:00:02 +08:00
|
|
|
paint_core_name = "GimpPencil";
|
2001-07-18 04:50:01 +08:00
|
|
|
}
|
|
|
|
else if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
|
|
|
|
{
|
2002-02-26 10:00:02 +08:00
|
|
|
paint_core_name = "GimpPaintbrush";
|
2001-07-18 04:50:01 +08:00
|
|
|
}
|
|
|
|
else if (tool_type == GIMP_TYPE_ERASER_TOOL)
|
|
|
|
{
|
2002-02-26 10:00:02 +08:00
|
|
|
paint_core_name = "GimpEraser";
|
2001-07-18 04:50:01 +08:00
|
|
|
}
|
|
|
|
else if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL)
|
|
|
|
{
|
2002-02-26 10:00:02 +08:00
|
|
|
paint_core_name = "GimpAirbrush";
|
2001-07-18 04:50:01 +08:00
|
|
|
}
|
|
|
|
else if (tool_type == GIMP_TYPE_CLONE_TOOL)
|
|
|
|
{
|
2002-02-26 10:00:02 +08:00
|
|
|
paint_core_name = "GimpClone";
|
2001-07-18 04:50:01 +08:00
|
|
|
}
|
|
|
|
else if (tool_type == GIMP_TYPE_CONVOLVE_TOOL)
|
|
|
|
{
|
2002-02-26 10:00:02 +08:00
|
|
|
paint_core_name = "GimpConvolve";
|
2001-07-18 04:50:01 +08:00
|
|
|
}
|
|
|
|
else if (tool_type == GIMP_TYPE_SMUDGE_TOOL)
|
|
|
|
{
|
2002-02-26 10:00:02 +08:00
|
|
|
paint_core_name = "GimpSmudge";
|
2001-07-18 04:50:01 +08:00
|
|
|
}
|
|
|
|
else if (tool_type == GIMP_TYPE_DODGEBURN_TOOL)
|
|
|
|
{
|
2002-02-26 10:00:02 +08:00
|
|
|
paint_core_name = "GimpDodgeBurn";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
paint_core_name = "GimpPaintbrush";
|
2001-07-18 04:50:01 +08:00
|
|
|
}
|
2001-07-08 01:36:00 +08:00
|
|
|
|
2001-08-06 00:08:19 +08:00
|
|
|
icon_set = gtk_icon_factory_lookup_default (stock_id);
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#warning FIXME: remove gtk_widget_get_default_style()
|
|
|
|
#endif
|
|
|
|
style = gtk_widget_get_default_style ();
|
|
|
|
|
|
|
|
pixbuf = gtk_icon_set_render_icon (icon_set,
|
|
|
|
style,
|
|
|
|
GTK_TEXT_DIR_LTR,
|
|
|
|
GTK_STATE_NORMAL,
|
|
|
|
GTK_ICON_SIZE_BUTTON,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = tool_manager_get (gimp);
|
2001-02-21 20:18:09 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
tool_info = gimp_tool_info_new (gimp,
|
|
|
|
tool_manager->global_tool_context,
|
2001-07-07 20:17:23 +08:00
|
|
|
tool_type,
|
2001-02-28 07:20:51 +08:00
|
|
|
tool_context,
|
2001-02-24 05:32:47 +08:00
|
|
|
identifier,
|
|
|
|
blurb,
|
|
|
|
help,
|
2001-02-21 20:18:09 +08:00
|
|
|
menu_path,
|
|
|
|
menu_accel,
|
|
|
|
help_domain,
|
|
|
|
help_data,
|
2002-02-26 10:00:02 +08:00
|
|
|
paint_core_name,
|
2001-08-06 00:08:19 +08:00
|
|
|
stock_id,
|
|
|
|
pixbuf);
|
|
|
|
|
|
|
|
g_object_unref (G_OBJECT (pixbuf));
|
2001-02-21 20:18:09 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
if (options_new_func)
|
2001-02-24 05:32:47 +08:00
|
|
|
{
|
2001-11-21 07:00:47 +08:00
|
|
|
tool_info->tool_options = options_new_func (tool_info);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tool_info->tool_options = tool_options_new (tool_info);
|
2001-02-24 05:32:47 +08:00
|
|
|
}
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
gimp_container_add (gimp->tool_info_list, GIMP_OBJECT (tool_info));
|
2001-02-24 05:32:47 +08:00
|
|
|
}
|
|
|
|
|
2001-02-21 20:18:09 +08:00
|
|
|
GimpToolInfo *
|
2001-10-17 19:33:43 +08:00
|
|
|
tool_manager_get_info_by_type (Gimp *gimp,
|
|
|
|
GType tool_type)
|
2001-02-21 20:18:09 +08:00
|
|
|
{
|
|
|
|
GimpToolInfo *tool_info;
|
|
|
|
GList *list;
|
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
g_return_val_if_fail (g_type_is_a (tool_type, GIMP_TYPE_TOOL), NULL);
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
for (list = GIMP_LIST (gimp->tool_info_list)->list;
|
2001-02-21 20:18:09 +08:00
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
tool_info = (GimpToolInfo *) list->data;
|
|
|
|
|
|
|
|
if (tool_info->tool_type == tool_type)
|
|
|
|
return tool_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2001-02-22 05:56:39 +08:00
|
|
|
|
|
|
|
const gchar *
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager_active_get_help_data (Gimp *gimp)
|
2001-02-22 05:56:39 +08:00
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = tool_manager_get (gimp);
|
2001-02-22 05:56:39 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
if (tool_manager->active_tool)
|
|
|
|
{
|
|
|
|
return tool_manager->active_tool->tool_info->help_data;
|
|
|
|
}
|
2001-07-08 01:36:00 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
return NULL;
|
2001-02-22 05:56:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tool_manager_help_func (const gchar *help_data)
|
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
gimp_standard_help_func (tool_manager_active_get_help_data (the_gimp));
|
2001-02-22 05:56:39 +08:00
|
|
|
}
|
2001-07-07 20:17:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
#define TOOL_MANAGER_DATA_KEY "gimp-tool-manager"
|
2001-07-07 20:17:23 +08:00
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
static GimpToolManager *
|
|
|
|
tool_manager_get (Gimp *gimp)
|
|
|
|
{
|
2001-07-25 08:27:41 +08:00
|
|
|
return g_object_get_data (G_OBJECT (gimp), TOOL_MANAGER_DATA_KEY);
|
2001-07-08 01:36:00 +08:00
|
|
|
}
|
2001-07-07 20:17:23 +08:00
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
static void
|
|
|
|
tool_manager_set (Gimp *gimp,
|
|
|
|
GimpToolManager *tool_manager)
|
|
|
|
{
|
2001-07-25 08:27:41 +08:00
|
|
|
g_object_set_data (G_OBJECT (gimp), TOOL_MANAGER_DATA_KEY,
|
2001-10-17 19:33:43 +08:00
|
|
|
tool_manager);
|
2001-07-07 20:17:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
tool_manager_tool_changed (GimpContext *user_context,
|
|
|
|
GimpToolInfo *tool_info,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
GimpTool *new_tool = NULL;
|
|
|
|
GimpContext *tool_context = NULL;
|
2001-07-07 20:17:23 +08:00
|
|
|
|
|
|
|
if (! tool_info)
|
|
|
|
return;
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager = (GimpToolManager *) data;
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
/* FIXME: gimp_busy HACK */
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
if (user_context->gimp->busy)
|
2001-07-07 20:17:23 +08:00
|
|
|
{
|
|
|
|
/* there may be contexts waiting for the user_context's "tool_changed"
|
|
|
|
* signal, so stop emitting it.
|
|
|
|
*/
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_stop_emission_by_name (G_OBJECT (user_context), "tool_changed");
|
2001-07-07 20:17:23 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
if (G_TYPE_FROM_INSTANCE (tool_manager->active_tool) !=
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_info->tool_type)
|
2001-07-07 20:17:23 +08:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_handlers_block_by_func (G_OBJECT (user_context),
|
|
|
|
tool_manager_tool_changed,
|
|
|
|
data);
|
2001-07-07 20:17:23 +08:00
|
|
|
|
|
|
|
/* explicitly set the current tool */
|
|
|
|
gimp_context_set_tool (user_context,
|
2001-10-29 19:47:11 +08:00
|
|
|
tool_manager->active_tool->tool_info);
|
2001-07-07 20:17:23 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_handlers_unblock_by_func (G_OBJECT (user_context),
|
|
|
|
tool_manager_tool_changed,
|
|
|
|
data);
|
2001-07-07 20:17:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
if (g_type_is_a (tool_info->tool_type, GIMP_TYPE_TOOL))
|
2001-07-07 20:17:23 +08:00
|
|
|
{
|
2001-08-10 22:41:39 +08:00
|
|
|
new_tool = g_object_new (tool_info->tool_type, NULL);
|
2001-10-29 19:47:11 +08:00
|
|
|
|
|
|
|
new_tool->tool_info = tool_info;
|
2001-07-07 20:17:23 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
g_warning ("%s(): tool_info->tool_type is no GimpTool subclass",
|
2001-07-07 20:17:23 +08:00
|
|
|
G_GNUC_FUNCTION);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-03-13 05:02:10 +08:00
|
|
|
if (tool_manager->active_tool &&
|
|
|
|
(tool_context = tool_manager->active_tool->tool_info->context))
|
2001-07-07 20:17:23 +08:00
|
|
|
{
|
2002-03-13 05:02:10 +08:00
|
|
|
gimp_context_unset_parent (tool_context);
|
|
|
|
}
|
2001-07-07 20:17:23 +08:00
|
|
|
|
2002-03-13 05:02:10 +08:00
|
|
|
if ((tool_context = tool_info->context))
|
|
|
|
{
|
|
|
|
gimp_context_copy_properties (tool_context, user_context,
|
|
|
|
PAINT_OPTIONS_MASK);
|
|
|
|
gimp_context_set_parent (tool_context, user_context);
|
2001-07-07 20:17:23 +08:00
|
|
|
}
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager_select_tool (user_context->gimp, new_tool);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
|
|
|
g_object_unref (G_OBJECT (new_tool));
|
2001-07-07 20:17:23 +08:00
|
|
|
}
|
2001-07-08 02:16:18 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
tool_manager_image_dirty (GimpImage *gimage,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpToolManager *tool_manager;
|
|
|
|
|
|
|
|
tool_manager = (GimpToolManager *) data;
|
|
|
|
|
|
|
|
if (tool_manager->active_tool && ! tool_manager->active_tool->preserve)
|
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
|
|
|
|
gdisp = tool_manager->active_tool->gdisp;
|
2001-07-08 02:16:18 +08:00
|
|
|
|
|
|
|
if (gdisp)
|
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
/* create a new one, deleting the current
|
|
|
|
*/
|
|
|
|
gimp_context_tool_changed (gimp_get_user_context (gimage->gimp));
|
|
|
|
|
2001-07-08 02:16:18 +08:00
|
|
|
if (gdisp->gimage == gimage)
|
2001-11-09 03:14:51 +08:00
|
|
|
{
|
|
|
|
tool_manager_initialize_active (gimage->gimp, gdisp);
|
|
|
|
|
|
|
|
tool_manager->active_tool->gdisp = gdisp;
|
|
|
|
}
|
2001-07-08 02:16:18 +08:00
|
|
|
else
|
2001-11-09 03:14:51 +08:00
|
|
|
{
|
|
|
|
tool_manager_initialize_active (gimage->gimp, NULL);
|
|
|
|
}
|
2001-07-08 02:16:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|