1998-06-15 06:42:36 +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.
|
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2002-05-03 20:45:22 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
#include "paint/gimpinkoptions.h"
|
2002-02-22 00:02:30 +08:00
|
|
|
|
2003-08-22 09:42:57 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
#include "gimpinkoptions-gui.h"
|
2001-03-08 09:07:03 +08:00
|
|
|
#include "gimpinktool.h"
|
2003-04-16 00:05:52 +08:00
|
|
|
#include "gimptoolcontrol.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2004-06-05 07:08:29 +08:00
|
|
|
static void gimp_ink_tool_init (GimpInkTool *tool);
|
|
|
|
static void gimp_ink_tool_class_init (GimpInkToolClass *klass);
|
|
|
|
|
|
|
|
static void gimp_ink_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
|
|
|
|
static GimpPaintToolClass *parent_class = NULL;
|
2000-12-31 12:07:42 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-02-28 08:10:58 +08:00
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_ink_tool_register (GimpToolRegisterCallback callback,
|
2002-05-03 19:31:08 +08:00
|
|
|
gpointer data)
|
2001-02-28 08:10:58 +08:00
|
|
|
{
|
2002-03-29 11:50:29 +08:00
|
|
|
(* callback) (GIMP_TYPE_INK_TOOL,
|
2003-02-05 22:39:40 +08:00
|
|
|
GIMP_TYPE_INK_OPTIONS,
|
|
|
|
gimp_ink_options_gui,
|
2004-05-04 19:26:22 +08:00
|
|
|
GIMP_CONTEXT_FOREGROUND_MASK |
|
|
|
|
GIMP_CONTEXT_BACKGROUND_MASK |
|
|
|
|
GIMP_CONTEXT_OPACITY_MASK |
|
2003-06-28 19:20:37 +08:00
|
|
|
GIMP_CONTEXT_PAINT_MODE_MASK,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-ink-tool",
|
2002-11-01 07:06:09 +08:00
|
|
|
_("Ink"),
|
2001-11-21 07:00:47 +08:00
|
|
|
_("Draw in ink"),
|
2004-04-29 21:19:28 +08:00
|
|
|
N_("In_k"), "K",
|
2003-08-22 09:42:57 +08:00
|
|
|
NULL, GIMP_HELP_TOOL_INK,
|
2002-03-29 11:50:29 +08:00
|
|
|
GIMP_STOCK_TOOL_INK,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
2001-02-28 08:10:58 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-02-28 08:10:58 +08:00
|
|
|
gimp_ink_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
2001-02-28 08:10:58 +08:00
|
|
|
|
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-02-28 08:10:58 +08:00
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
sizeof (GimpInkToolClass),
|
2004-05-28 17:34:13 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
2004-06-05 07:08:29 +08:00
|
|
|
(GClassInitFunc) gimp_ink_tool_class_init,
|
2004-05-28 17:34:13 +08:00
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpInkTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_ink_tool_init,
|
2001-02-28 08:10:58 +08:00
|
|
|
};
|
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL,
|
2004-05-28 17:34:13 +08:00
|
|
|
"GimpInkTool",
|
2001-08-14 22:53:55 +08:00
|
|
|
&tool_info, 0);
|
2001-02-28 08:10:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
|
|
|
}
|
|
|
|
|
2004-06-05 07:08:29 +08:00
|
|
|
static void
|
|
|
|
gimp_ink_tool_class_init (GimpInkToolClass *klass)
|
|
|
|
{
|
|
|
|
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
|
|
|
tool_class->cursor_update = gimp_ink_tool_cursor_update;
|
|
|
|
}
|
|
|
|
|
2001-02-28 08:10:58 +08:00
|
|
|
static void
|
|
|
|
gimp_ink_tool_init (GimpInkTool *ink_tool)
|
|
|
|
{
|
2004-05-26 23:34:45 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (ink_tool);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2004-06-05 07:08:29 +08:00
|
|
|
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_INK);
|
2005-03-04 19:42:46 +08:00
|
|
|
gimp_tool_control_set_action_value_2 (tool->control,
|
|
|
|
"tools/tools-ink-blob-size-set");
|
|
|
|
gimp_tool_control_set_action_value_3 (tool->control,
|
|
|
|
"tools/tools-ink-blob-aspect-set");
|
|
|
|
gimp_tool_control_set_action_value_4 (tool->control,
|
|
|
|
"tools/tools-ink-blob-angle-set");
|
2004-06-09 20:14:55 +08:00
|
|
|
|
|
|
|
gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (ink_tool),
|
|
|
|
GIMP_COLOR_PICK_MODE_FOREGROUND);
|
2004-06-05 07:08:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_ink_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
|
|
|
|
|
|
|
paint_tool->show_cursor = TRUE;
|
|
|
|
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
|
2001-02-28 08:10:58 +08:00
|
|
|
}
|