1999-07-02 00:52:50 +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-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
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
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
#include "core/gimptoolinfo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#include "paint/gimpsmudge.h"
|
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
#include "gimpsmudgetool.h"
|
|
|
|
#include "paint_options.h"
|
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
1999-07-20 06:42:49 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
static void gimp_smudge_tool_class_init (GimpSmudgeToolClass *klass);
|
|
|
|
static void gimp_smudge_tool_init (GimpSmudgeTool *tool);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
static GimpToolOptions * smudge_options_new (GimpToolInfo *tool_info);
|
|
|
|
static void smudge_options_reset (GimpToolOptions *tool_options);
|
2000-01-14 20:41:00 +08:00
|
|
|
|
1999-07-20 06:42:49 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
static GimpPaintToolClass *parent_class = NULL;
|
|
|
|
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
/* global functions */
|
|
|
|
|
|
|
|
void
|
2001-11-21 07:00:47 +08:00
|
|
|
gimp_smudge_tool_register (Gimp *gimp,
|
|
|
|
GimpToolRegisterCallback callback)
|
1999-07-02 00:52:50 +08:00
|
|
|
{
|
2001-11-21 07:00:47 +08:00
|
|
|
(* callback) (gimp,
|
|
|
|
GIMP_TYPE_SMUDGE_TOOL,
|
|
|
|
smudge_options_new,
|
|
|
|
TRUE,
|
|
|
|
"gimp:smudge_tool",
|
|
|
|
_("Smudge"),
|
|
|
|
_("Smudge image"),
|
|
|
|
N_("/Tools/Paint Tools/Smudge"), "S",
|
|
|
|
NULL, "tools/smudge.html",
|
|
|
|
GIMP_STOCK_TOOL_SMUDGE);
|
2001-04-12 01:20:34 +08:00
|
|
|
}
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-04-12 01:20:34 +08:00
|
|
|
gimp_smudge_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-04-12 01:20:34 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpSmudgeToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_smudge_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpSmudgeTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_smudge_tool_init,
|
2001-04-12 01:20:34 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL,
|
|
|
|
"GimpSmudgeTool",
|
|
|
|
&tool_info, 0);
|
2001-04-12 01:20:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
1999-07-02 00:52:50 +08:00
|
|
|
}
|
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
static void
|
|
|
|
gimp_smudge_tool_class_init (GimpSmudgeToolClass *klass)
|
1999-07-02 00:52:50 +08:00
|
|
|
{
|
2001-04-12 01:20:34 +08:00
|
|
|
GimpPaintToolClass *paint_tool_class;
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
paint_tool_class = GIMP_PAINT_TOOL_CLASS (klass);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-04-12 01:20:34 +08:00
|
|
|
}
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
static void
|
|
|
|
gimp_smudge_tool_init (GimpSmudgeTool *smudge)
|
|
|
|
{
|
|
|
|
GimpTool *tool;
|
|
|
|
GimpPaintTool *paint_tool;
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
tool = GIMP_TOOL (smudge);
|
|
|
|
paint_tool = GIMP_PAINT_TOOL (smudge);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
tool->tool_cursor = GIMP_SMUDGE_TOOL_CURSOR;
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
paint_tool->pick_colors = TRUE;
|
|
|
|
paint_tool->core = g_object_new (GIMP_TYPE_SMUDGE, NULL);
|
1999-07-02 00:52:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
/* tool options stuff */
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
static GimpToolOptions *
|
|
|
|
smudge_options_new (GimpToolInfo *tool_info)
|
2001-04-12 01:20:34 +08:00
|
|
|
{
|
2002-02-22 00:02:30 +08:00
|
|
|
GimpSmudgeOptions *options;
|
|
|
|
GtkWidget *vbox;
|
2002-03-09 02:30:40 +08:00
|
|
|
GtkWidget *table;
|
2001-04-12 01:20:34 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
options = gimp_smudge_options_new ();
|
2001-04-12 01:20:34 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
paint_options_init ((GimpPaintOptions *) options, tool_info);
|
2001-11-21 07:00:47 +08:00
|
|
|
|
|
|
|
((GimpToolOptions *) options)->reset_func = smudge_options_reset;
|
2001-04-12 01:20:34 +08:00
|
|
|
|
|
|
|
/* the main vbox */
|
2001-07-18 04:50:01 +08:00
|
|
|
vbox = ((GimpToolOptions *) options)->main_vbox;
|
2001-04-12 01:20:34 +08:00
|
|
|
|
|
|
|
/* the rate scale */
|
2002-03-09 02:30:40 +08:00
|
|
|
table = gtk_table_new (1, 3, FALSE);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (table);
|
2001-04-12 01:20:34 +08:00
|
|
|
|
|
|
|
options->rate_w =
|
2002-03-09 02:30:40 +08:00
|
|
|
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
|
|
|
_("Rate:"), -1, 50,
|
|
|
|
options->rate_d,
|
|
|
|
0.0, 100.0, 1.0, 10.0, 1,
|
|
|
|
TRUE, 0.0, 0.0,
|
|
|
|
NULL, NULL);
|
|
|
|
|
2001-08-01 10:57:58 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->rate_w), "value_changed",
|
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&options->rate);
|
2001-04-12 01:20:34 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
return (GimpToolOptions *) options;
|
2001-04-12 01:20:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-07-18 04:50:01 +08:00
|
|
|
smudge_options_reset (GimpToolOptions *tool_options)
|
2001-04-12 01:20:34 +08:00
|
|
|
{
|
2002-02-22 00:02:30 +08:00
|
|
|
GimpSmudgeOptions *options;
|
2001-04-12 01:20:34 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
options = (GimpSmudgeOptions *) tool_options;
|
2001-04-12 01:20:34 +08:00
|
|
|
|
|
|
|
paint_options_reset (tool_options);
|
|
|
|
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->rate_w), options->rate_d);
|
|
|
|
}
|