mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 14:23:33 +00:00
prototype for an extension that allows gmodules as plugins. Known bug:
* plug-ins/plugin-helper/*: prototype for an extension that allows gmodules as plugins. Known bug: crashes on gmodules with a static "query" function * app/tools/tool.c * app/tools/tool.h: created new GimpTool object. Did away with ToolInfo. Most tools still need to be ported over to the new api. * plug-ins/script-fu/script-fu-scripts.c: fixed typo in comment. Pathetic, huh?
This commit is contained in:
parent
a97e433ba2
commit
35ac032ff1
54
ChangeLog
54
ChangeLog
|
@ -1,3 +1,57 @@
|
|||
2001-02-13 Nathan Summers <rock@gimp.org>
|
||||
|
||||
* configure.in
|
||||
* plug-ins/plugin-helper/*: prototype for an extension that allows
|
||||
gmodules as plugins. Known bug: crashes on gmodules with a static "query" function
|
||||
|
||||
* app/tools/tool.c
|
||||
* app/tools/tool.h: created new GimpTool object. Did away with ToolInfo.
|
||||
Most tools still need to be ported over to the new api.
|
||||
|
||||
* app/tools/tools.c: now contains the initialization function to register
|
||||
the tools with the Gimp
|
||||
|
||||
* app/tools/tools.h: renamed to tool.h
|
||||
|
||||
* app/Makefile.am
|
||||
* app/app_procs.c
|
||||
* app/apptypes.h
|
||||
* app/commands.c
|
||||
* app/context_manager.c
|
||||
* app/cursorutil.c
|
||||
* app/devices.c
|
||||
* app/devices.h
|
||||
* app/disp_callbacks.c
|
||||
* app/draw_core.c
|
||||
* app/draw_core.h
|
||||
* app/gdisplay.c
|
||||
* app/gimage.c
|
||||
* app/gimage_mask.c
|
||||
* app/gimpcontext.c
|
||||
* app/gimpcontext.h
|
||||
* app/global_edit.c
|
||||
* app/info_window.c
|
||||
* app/interface.c
|
||||
* app/libgimp_glue.c
|
||||
* app/menus.c
|
||||
* app/paint_core.h
|
||||
* app/paint_options.h
|
||||
* app/scale.c
|
||||
* app/scroll.c
|
||||
* app/toolbox.c
|
||||
* app/undo.c
|
||||
* app/tools/Makefile.am
|
||||
* app/tools/color_picker.c
|
||||
* app/tools/color_picker.h
|
||||
* app/tools/paint_core.c
|
||||
* app/tools/tool_options.c
|
||||
* app/tools/tool_options.h
|
||||
* app/tools/tool_options_dialog.c
|
||||
* libgimp/gimp.c
|
||||
* plug-ins/Makefile.am: changed acordingly
|
||||
|
||||
* plug-ins/script-fu/script-fu-scripts.c: fixed typo in comment. Pathetic, huh?
|
||||
|
||||
2001-02-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/Makefile.am
|
||||
|
|
|
@ -219,7 +219,7 @@ gimp_SOURCES = \
|
|||
path.h \
|
||||
pathP.h \
|
||||
path_transform.h \
|
||||
paths_dialog.c \
|
||||
## paths_dialog.c \
|
||||
paths_dialog.h \
|
||||
paths_dialogP.h \
|
||||
pattern_header.h \
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
#endif /* DISPLAY_FILTERS */
|
||||
|
||||
#include "tools/tool_options_dialog.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -1120,6 +1120,8 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
gdisp = gdisplay_active ();
|
||||
|
||||
|
||||
#warning fix tools_select_cmd_callback
|
||||
#if 0
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool_type);
|
||||
|
||||
/* Paranoia */
|
||||
|
@ -1141,6 +1143,7 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
* before deleting it
|
||||
*/
|
||||
active_tool->gdisp = gdisp;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***** Filters *****/
|
||||
|
|
440
app/airbrush.c
Normal file
440
app/airbrush.c
Normal file
|
@ -0,0 +1,440 @@
|
|||
/* 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>
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "airbrush.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gradient.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimpbrush.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpui.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "selection.h"
|
||||
#include "temp_buf.h"
|
||||
#include "tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* The maximum amount of pressure that can be exerted */
|
||||
#define MAX_PRESSURE 0.075
|
||||
|
||||
/* Default pressure setting */
|
||||
#define AIRBRUSH_PRESSURE_DEFAULT 10.0
|
||||
#define AIRBRUSH_INCREMENTAL_DEFAULT FALSE
|
||||
|
||||
#define OFF 0
|
||||
#define ON 1
|
||||
|
||||
/* the airbrush structures */
|
||||
|
||||
typedef struct _AirbrushTimeout AirbrushTimeout;
|
||||
|
||||
struct _AirbrushTimeout
|
||||
{
|
||||
PaintCore *paint_core;
|
||||
GimpDrawable *drawable;
|
||||
};
|
||||
|
||||
typedef struct _AirbrushOptions AirbrushOptions;
|
||||
|
||||
struct _AirbrushOptions
|
||||
{
|
||||
PaintOptions paint_options;
|
||||
|
||||
gdouble rate;
|
||||
gdouble rate_d;
|
||||
GtkObject *rate_w;
|
||||
|
||||
gdouble pressure;
|
||||
gdouble pressure_d;
|
||||
GtkObject *pressure_w;
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static gpointer airbrush_paint_func (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
PaintState state);
|
||||
static gpointer airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
PaintState state);
|
||||
|
||||
|
||||
/* the airbrush tool options */
|
||||
static AirbrushOptions *airbrush_options = NULL;
|
||||
|
||||
/* local variables */
|
||||
static gint timer; /* timer for successive paint applications */
|
||||
static gint timer_state = OFF; /* state of airbrush tool */
|
||||
static AirbrushTimeout airbrush_timeout;
|
||||
|
||||
static gdouble non_gui_pressure;
|
||||
static gboolean non_gui_incremental;
|
||||
|
||||
/* forward function declarations */
|
||||
static void airbrush_motion (PaintCore *, GimpDrawable *,
|
||||
PaintPressureOptions *,
|
||||
gdouble, PaintApplicationMode);
|
||||
static gint airbrush_time_out (gpointer);
|
||||
|
||||
|
||||
/* functions */
|
||||
|
||||
static void
|
||||
airbrush_options_reset (void)
|
||||
{
|
||||
AirbrushOptions *options = airbrush_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->rate_w),
|
||||
options->rate_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
|
||||
options->pressure_d);
|
||||
}
|
||||
|
||||
static AirbrushOptions *
|
||||
airbrush_options_new (void)
|
||||
{
|
||||
AirbrushOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *scale;
|
||||
|
||||
/* the new airbrush tool options structure */
|
||||
options = g_new (AirbrushOptions, 1);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
AIRBRUSH,
|
||||
airbrush_options_reset);
|
||||
options->rate = options->rate_d = 80.0;
|
||||
options->pressure = options->pressure_d = AIRBRUSH_PRESSURE_DEFAULT;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the rate scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
options->rate_w =
|
||||
gtk_adjustment_new (options->rate_d, 0.0, 150.0, 1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->rate_w));
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (options->rate_w), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
|
||||
&options->rate);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Rate:"), 1.0, 1.0,
|
||||
scale, 1, FALSE);
|
||||
|
||||
/* the pressure scale */
|
||||
options->pressure_w =
|
||||
gtk_adjustment_new (options->pressure_d, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->pressure_w));
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (options->pressure_w), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
|
||||
&options->pressure);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
_("Pressure:"), 1.0, 1.0,
|
||||
scale, 1, FALSE);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
Tool *
|
||||
tools_new_airbrush (void)
|
||||
{
|
||||
Tool * tool;
|
||||
PaintCore * private;
|
||||
|
||||
/* The tool options */
|
||||
if (! airbrush_options)
|
||||
{
|
||||
airbrush_options = airbrush_options_new ();
|
||||
tools_register (AIRBRUSH, (ToolOptions *) airbrush_options);
|
||||
}
|
||||
|
||||
tool = paint_core_new (AIRBRUSH);
|
||||
|
||||
private = (PaintCore *) tool->private;
|
||||
private->paint_func = airbrush_paint_func;
|
||||
private->pick_colors = TRUE;
|
||||
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
||||
static gpointer
|
||||
airbrush_paint_func (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
PaintState state)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
gdouble rate;
|
||||
|
||||
if (!drawable)
|
||||
return NULL;
|
||||
|
||||
brush = gimp_context_get_brush (NULL);
|
||||
switch (state)
|
||||
{
|
||||
case INIT_PAINT :
|
||||
/* timer_state = OFF; */
|
||||
if (timer_state == ON)
|
||||
{
|
||||
g_warning ("killing stray timer, please report to lewing@gimp.org");
|
||||
gtk_timeout_remove (timer);
|
||||
}
|
||||
timer_state = OFF;
|
||||
break;
|
||||
|
||||
case MOTION_PAINT :
|
||||
if (timer_state == ON)
|
||||
gtk_timeout_remove (timer);
|
||||
timer_state = OFF;
|
||||
|
||||
airbrush_motion (paint_core, drawable,
|
||||
airbrush_options->paint_options.pressure_options,
|
||||
airbrush_options->pressure,
|
||||
airbrush_options->paint_options.incremental ?
|
||||
INCREMENTAL : CONSTANT);
|
||||
|
||||
if (airbrush_options->rate != 0.0)
|
||||
{
|
||||
airbrush_timeout.paint_core = paint_core;
|
||||
airbrush_timeout.drawable = drawable;
|
||||
rate = airbrush_options->paint_options.pressure_options->rate ?
|
||||
(10000 / (airbrush_options->rate * 2.0 * paint_core->curpressure)) :
|
||||
(10000 / airbrush_options->rate);
|
||||
timer = gtk_timeout_add (rate, airbrush_time_out, NULL);
|
||||
timer_state = ON;
|
||||
}
|
||||
break;
|
||||
|
||||
case FINISH_PAINT :
|
||||
if (timer_state == ON)
|
||||
gtk_timeout_remove (timer);
|
||||
timer_state = OFF;
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tools_free_airbrush (Tool *tool)
|
||||
{
|
||||
if (timer_state == ON)
|
||||
gtk_timeout_remove (timer);
|
||||
timer_state = OFF;
|
||||
|
||||
paint_core_free (tool);
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
airbrush_time_out (gpointer client_data)
|
||||
{
|
||||
/* service the timer */
|
||||
airbrush_motion (airbrush_timeout.paint_core,
|
||||
airbrush_timeout.drawable,
|
||||
airbrush_options->paint_options.pressure_options,
|
||||
airbrush_options->pressure,
|
||||
airbrush_options->paint_options.incremental ?
|
||||
INCREMENTAL : CONSTANT);
|
||||
gdisplays_flush ();
|
||||
|
||||
/* restart the timer */
|
||||
if (airbrush_options->rate != 0.0)
|
||||
{
|
||||
if (airbrush_options->paint_options.pressure_options->rate)
|
||||
{
|
||||
/* set a new timer */
|
||||
timer = gtk_timeout_add ((10000 / (airbrush_options->rate * 2.0 * airbrush_timeout.paint_core->curpressure)),
|
||||
airbrush_time_out, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
airbrush_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
PaintPressureOptions *pressure_options,
|
||||
double pressure,
|
||||
PaintApplicationMode mode)
|
||||
{
|
||||
GImage *gimage;
|
||||
TempBuf *area;
|
||||
guchar col[MAX_CHANNELS];
|
||||
gdouble scale;
|
||||
|
||||
if (!drawable)
|
||||
return;
|
||||
|
||||
if (! (gimage = gimp_drawable_gimage (drawable)))
|
||||
return;
|
||||
|
||||
if (pressure_options->size)
|
||||
scale = paint_core->curpressure;
|
||||
else
|
||||
scale = 1.0;
|
||||
|
||||
if (! (area = paint_core_get_paint_area (paint_core, drawable, scale)))
|
||||
return;
|
||||
|
||||
/* color the pixels */
|
||||
if (pressure_options->color)
|
||||
{
|
||||
GimpRGB color;
|
||||
|
||||
gradient_get_color_at (gimp_context_get_gradient (NULL),
|
||||
paint_core->curpressure, &color);
|
||||
|
||||
gimp_rgba_get_uchar (&color,
|
||||
&col[RED_PIX],
|
||||
&col[GREEN_PIX],
|
||||
&col[BLUE_PIX],
|
||||
&col[ALPHA_PIX]);
|
||||
|
||||
mode = INCREMENTAL;
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
}
|
||||
else if (paint_core->brush && paint_core->brush->pixmap)
|
||||
{
|
||||
mode = INCREMENTAL;
|
||||
paint_core_color_area_with_pixmap (paint_core, gimage, drawable, area,
|
||||
scale, SOFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_image_get_foreground (gimage, drawable, col);
|
||||
col[area->bytes - 1] = OPAQUE_OPACITY;
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
}
|
||||
|
||||
if (pressure_options->pressure)
|
||||
pressure = pressure * 2.0 * paint_core->curpressure;
|
||||
|
||||
/* paste the newly painted area to the image */
|
||||
paint_core_paste_canvas (paint_core, drawable,
|
||||
MIN (pressure, 255),
|
||||
(gint) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, scale, mode);
|
||||
}
|
||||
|
||||
static gpointer
|
||||
airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
PaintState state)
|
||||
{
|
||||
airbrush_motion (paint_core, drawable, &non_gui_pressure_options,
|
||||
non_gui_pressure, non_gui_incremental);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
airbrush_non_gui_default (GimpDrawable *drawable,
|
||||
gint num_strokes,
|
||||
gdouble *stroke_array)
|
||||
{
|
||||
AirbrushOptions *options = airbrush_options;
|
||||
gdouble pressure = AIRBRUSH_PRESSURE_DEFAULT;
|
||||
|
||||
if(options)
|
||||
pressure = options->pressure;
|
||||
|
||||
return airbrush_non_gui (drawable, pressure, num_strokes, stroke_array);
|
||||
}
|
||||
|
||||
gboolean
|
||||
airbrush_non_gui (GimpDrawable *drawable,
|
||||
gdouble pressure,
|
||||
gint num_strokes,
|
||||
gdouble *stroke_array)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if (paint_core_init (&non_gui_paint_core, drawable,
|
||||
stroke_array[0], stroke_array[1]))
|
||||
{
|
||||
/* Set the paint core's paint func */
|
||||
non_gui_paint_core.paint_func = airbrush_non_gui_paint_func;
|
||||
|
||||
non_gui_pressure = pressure;
|
||||
|
||||
non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0];
|
||||
non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1];
|
||||
|
||||
airbrush_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
|
||||
|
||||
for (i = 1; i < num_strokes; i++)
|
||||
{
|
||||
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
|
||||
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
|
||||
|
||||
paint_core_interpolate (&non_gui_paint_core, drawable);
|
||||
|
||||
non_gui_paint_core.lastx = non_gui_paint_core.curx;
|
||||
non_gui_paint_core.lasty = non_gui_paint_core.cury;
|
||||
}
|
||||
|
||||
/* Finish the painting */
|
||||
paint_core_finish (&non_gui_paint_core, drawable, -1);
|
||||
|
||||
/* Cleanup */
|
||||
paint_core_cleanup ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
|
@ -567,6 +567,8 @@ app_init (void)
|
|||
RESET_BAR();
|
||||
xcf_init (); /* initialize the xcf file format routines */
|
||||
|
||||
register_tools(); /* register internal tools */
|
||||
|
||||
/* initialize the global parasite table */
|
||||
app_init_update_status (_("Looking for data files"), _("Parasites"), 0.00);
|
||||
gimp_init_parasites ();
|
||||
|
|
|
@ -150,9 +150,8 @@ typedef struct _TempBuf MaskBuf;
|
|||
typedef struct _Tile Tile;
|
||||
typedef struct _TileManager TileManager;
|
||||
|
||||
typedef struct _Tool Tool;
|
||||
typedef struct _ToolInfo ToolInfo;
|
||||
|
||||
typedef struct _Tool Tool;
|
||||
typedef struct _ToolInfo ToolInfo;
|
||||
typedef struct _ToolOptions ToolOptions;
|
||||
|
||||
typedef struct _ScanConvertPoint ScanConvertPoint;
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
#endif /* DISPLAY_FILTERS */
|
||||
|
||||
#include "tools/tool_options_dialog.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -1120,6 +1120,8 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
gdisp = gdisplay_active ();
|
||||
|
||||
|
||||
#warning fix tools_select_cmd_callback
|
||||
#if 0
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool_type);
|
||||
|
||||
/* Paranoia */
|
||||
|
@ -1141,6 +1143,7 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
* before deleting it
|
||||
*/
|
||||
active_tool->gdisp = gdisp;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***** Filters *****/
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "gimprc.h"
|
||||
|
||||
#include "tools/paint_options.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -76,7 +76,10 @@ context_manager_tool_changed (GimpContext *user_context,
|
|||
ToolType tool_type,
|
||||
gpointer data)
|
||||
{
|
||||
/* FIXME: gimp_busy HACK */
|
||||
#warning fix context_manager_tool_changed
|
||||
#if 0
|
||||
|
||||
/* FIXME: gimp_busy HACK */
|
||||
if (gimp_busy)
|
||||
{
|
||||
/* there may be contexts waiting for the user_context's "tool_changed"
|
||||
|
@ -139,6 +142,8 @@ context_manager_tool_changed (GimpContext *user_context,
|
|||
gtk_signal_handler_unblock_by_data
|
||||
(GTK_OBJECT (tool_info[tool_type].tool_widget), (gpointer) tool_type);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -252,7 +257,9 @@ context_manager_init (void)
|
|||
/* TODO: add foreground, background, brush, pattern, gradient */
|
||||
gimp_context_define_args (global_tool_context, PAINT_OPTIONS_MASK, FALSE);
|
||||
|
||||
/* Initialize the paint tools' private contexts */
|
||||
#warning fixme here too
|
||||
#if 0
|
||||
/* Initialize the paint tools' private contexts */
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
switch (tool_info[i].tool_id)
|
||||
|
@ -290,6 +297,7 @@ context_manager_init (void)
|
|||
{
|
||||
gimp_context_set_parent (global_tool_context, user_context);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -300,6 +308,8 @@ context_manager_free (void)
|
|||
gtk_object_unref (GTK_OBJECT (global_tool_context));
|
||||
global_tool_context = NULL;
|
||||
|
||||
#warning I need fixing
|
||||
#if 0
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
if (tool_info[i].tool_context != NULL)
|
||||
|
@ -308,7 +318,7 @@ context_manager_free (void)
|
|||
tool_info[i].tool_context = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
gtk_object_unref (GTK_OBJECT (gimp_context_get_user ()));
|
||||
gimp_context_set_user (NULL);
|
||||
gimp_context_set_current (NULL);
|
||||
|
@ -332,6 +342,9 @@ context_manager_set_global_paint_options (gboolean global)
|
|||
|
||||
paint_options_set_global (global);
|
||||
|
||||
#warning yet another fix needed
|
||||
#if 0
|
||||
|
||||
if (global)
|
||||
{
|
||||
if (active_tool &&
|
||||
|
@ -356,4 +369,6 @@ context_manager_set_global_paint_options (gboolean global)
|
|||
gimp_context_set_parent (context, gimp_context_get_user ());
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -533,7 +533,7 @@ gboolean
|
|||
global_edit_cut (GDisplay *gdisp)
|
||||
{
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_cut (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage)))
|
||||
return FALSE;
|
||||
|
@ -558,7 +558,7 @@ global_edit_paste (GDisplay *gdisp,
|
|||
gboolean paste_into)
|
||||
{
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_paste (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buf, paste_into))
|
||||
|
@ -578,7 +578,7 @@ global_edit_paste_as_new (GDisplay *gdisp)
|
|||
return FALSE;
|
||||
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
return edit_paste_as_new (gdisp->gimage, global_buf);
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ named_edit_cut (GDisplay *gdisp)
|
|||
GtkWidget *qbox;
|
||||
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Cut Named"),
|
||||
gimp_standard_help_func,
|
||||
|
|
|
@ -90,7 +90,7 @@ static void gimp_context_copy_display (GimpContext *src,
|
|||
|
||||
/* tool */
|
||||
static void gimp_context_real_set_tool (GimpContext *context,
|
||||
ToolType tool);
|
||||
GimpTool *tool);
|
||||
static void gimp_context_copy_tool (GimpContext *src,
|
||||
GimpContext *dest);
|
||||
|
||||
|
@ -379,9 +379,9 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
tool_changed),
|
||||
gtk_marshal_NONE__INT,
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_INT);
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
gimp_context_signals[FOREGROUND_CHANGED] =
|
||||
gtk_signal_new (gimp_context_signal_names[FOREGROUND_CHANGED],
|
||||
|
@ -493,7 +493,7 @@ gimp_context_init (GimpContext *context)
|
|||
context->image = NULL;
|
||||
context->display = NULL;
|
||||
|
||||
context->tool = RECT_SELECT;
|
||||
context->tool = NULL;
|
||||
|
||||
gimp_rgba_set (&context->foreground, 0.0, 0.0, 0.0, 1.0);
|
||||
gimp_rgba_set (&context->background, 1.0, 1.0, 1.0, 1.0);
|
||||
|
@ -1228,7 +1228,7 @@ gimp_context_copy_display (GimpContext *src,
|
|||
/*****************************************************************************/
|
||||
/* tool ********************************************************************/
|
||||
|
||||
ToolType
|
||||
GimpTool *
|
||||
gimp_context_get_tool (GimpContext *context)
|
||||
{
|
||||
context_check_current (context);
|
||||
|
@ -1239,7 +1239,7 @@ gimp_context_get_tool (GimpContext *context)
|
|||
|
||||
void
|
||||
gimp_context_set_tool (GimpContext *context,
|
||||
ToolType tool)
|
||||
GimpTool *tool)
|
||||
{
|
||||
context_check_current (context);
|
||||
context_return_if_fail (context);
|
||||
|
@ -1261,7 +1261,7 @@ gimp_context_tool_changed (GimpContext *context)
|
|||
|
||||
static void
|
||||
gimp_context_real_set_tool (GimpContext *context,
|
||||
ToolType tool)
|
||||
GimpTool *tool)
|
||||
{
|
||||
if (context->tool == tool)
|
||||
return;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define __GIMP_CONTEXT_H__
|
||||
|
||||
|
||||
#include "tools/tool.h"
|
||||
#include "gimpobject.h"
|
||||
|
||||
|
||||
|
@ -89,7 +90,7 @@ struct _GimpContext
|
|||
GimpImage *image;
|
||||
GDisplay *display;
|
||||
|
||||
ToolType tool;
|
||||
GimpTool *tool;
|
||||
|
||||
GimpRGB foreground;
|
||||
GimpRGB background;
|
||||
|
@ -234,9 +235,9 @@ void gimp_context_display_changed (GimpContext *context);
|
|||
|
||||
|
||||
/* tool */
|
||||
ToolType gimp_context_get_tool (GimpContext *context);
|
||||
GimpTool *gimp_context_get_tool (GimpContext *context);
|
||||
void gimp_context_set_tool (GimpContext *context,
|
||||
ToolType tool_type);
|
||||
GimpTool *tool_type);
|
||||
void gimp_context_tool_changed (GimpContext *context);
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -533,7 +533,7 @@ gboolean
|
|||
global_edit_cut (GDisplay *gdisp)
|
||||
{
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_cut (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage)))
|
||||
return FALSE;
|
||||
|
@ -558,7 +558,7 @@ global_edit_paste (GDisplay *gdisp,
|
|||
gboolean paste_into)
|
||||
{
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_paste (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buf, paste_into))
|
||||
|
@ -578,7 +578,7 @@ global_edit_paste_as_new (GDisplay *gdisp)
|
|||
return FALSE;
|
||||
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
return edit_paste_as_new (gdisp->gimage, global_buf);
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ named_edit_cut (GDisplay *gdisp)
|
|||
GtkWidget *qbox;
|
||||
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Cut Named"),
|
||||
gimp_standard_help_func,
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "tools/paint_core.h"
|
||||
#include "tools/paint_options.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "pdb/procedural_db.h"
|
||||
|
||||
|
@ -627,7 +627,7 @@ gimage_mask_stroke (GImage *gimage,
|
|||
|
||||
/* Stroke with the correct tool */
|
||||
return_vals =
|
||||
procedural_db_run_proc (tool_active_PDB_string (),
|
||||
procedural_db_run_proc (tool_manager_get_active_PDB_string (),
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
|
||||
PDB_INT32, (gint32) cpnt,
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
#include "tools/by_color_select.h"
|
||||
#include "tools/paint_core.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
#include "tools/transform_core.h"
|
||||
|
||||
#include "libgimp/gimpparasite.h"
|
||||
|
@ -1268,6 +1268,9 @@ undo_pop_transform (GimpImage *gimage,
|
|||
gdouble d;
|
||||
gint i;
|
||||
|
||||
|
||||
#warning very bogus
|
||||
#if 0
|
||||
/* Can't have ANY tool selected - maybe a plugin running */
|
||||
if (active_tool == NULL)
|
||||
return TRUE;
|
||||
|
@ -1301,7 +1304,7 @@ undo_pop_transform (GimpImage *gimage,
|
|||
active_tool->state = ACTIVE;
|
||||
draw_core_resume (tc->core, active_tool);
|
||||
}
|
||||
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1346,7 +1349,8 @@ undo_push_paint (GimpImage *gimage,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#warning super bogosity error
|
||||
#if 0
|
||||
static gboolean
|
||||
undo_pop_paint (GimpImage *gimage,
|
||||
UndoState state,
|
||||
|
@ -1391,7 +1395,7 @@ undo_pop_paint (GimpImage *gimage,
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
undo_free_paint (UndoState state,
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#include "gdisplay_color.h"
|
||||
#endif /* DISPLAY_FILTERS */
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -373,7 +373,7 @@ gdisplay_delete (GDisplay *gdisp)
|
|||
g_hash_table_remove (display_ht, gdisp->canvas);
|
||||
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, (void *) gdisp);
|
||||
tool_manager_control_active (HALT, (void *) gdisp);
|
||||
|
||||
/* clear out the pointer to this gdisp from the active tool */
|
||||
if (active_tool &&
|
||||
|
@ -657,7 +657,7 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
if (list)
|
||||
{
|
||||
/* stop the currently active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
while (list)
|
||||
{
|
||||
|
@ -682,7 +682,7 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
selection_start (gdisp->select, TRUE);
|
||||
|
||||
/* start the currently active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
/*
|
||||
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -23,7 +23,7 @@
|
|||
#include "apptypes.h"
|
||||
|
||||
#include "tool_options.h"
|
||||
#include "tools.h"
|
||||
#include "tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
|
|
@ -19,28 +19,42 @@
|
|||
#ifndef __TOOL_OPTIONS_H__
|
||||
#define __TOOL_OPTIONS_H__
|
||||
|
||||
#include "gimpobject.h"
|
||||
|
||||
#define GIMP_TYPE_TOOL_OPTIONS (gimp_tool_options_get_type ())
|
||||
#define GIMP_TOOL_OPTIONS(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_TOOL_OPTIONS, GimpToolOptions))
|
||||
#define GIMP_IS_TOOL_OPTIONS(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_TOOL_OPTIONS))
|
||||
#define GIMP_TOOL_OPTIONS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TOOL_OPTIONS, GimpToolOptionsClass))
|
||||
#define GIMP_IS_TOOL_OPTIONS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TOOL_OPTIONS))
|
||||
|
||||
/* the tool options structures */
|
||||
|
||||
struct _ToolOptions
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
GtkWidget *main_vbox;
|
||||
const gchar *title;
|
||||
gchar *title;
|
||||
|
||||
ToolOptionsResetFunc reset_func;
|
||||
};
|
||||
|
||||
struct _ToolOptionsClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
};
|
||||
|
||||
typedef struct _ToolOptionsClass ToolOptionsClass;
|
||||
|
||||
/* create a dummy tool options structure
|
||||
* (to be used by tools without options)
|
||||
*/
|
||||
ToolOptions * tool_options_new (const gchar *title);
|
||||
ToolOptions * tool_options_new (const gchar *title);
|
||||
|
||||
/* initialize an already allocated ToolOptions structure
|
||||
* (to be used by derived tool options only)
|
||||
*/
|
||||
void tool_options_init (ToolOptions *options,
|
||||
const gchar *title,
|
||||
const gchar *title,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
#include "cursorutil.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "gdisplay.h" /* for gdisplay_*_override_cursor() */
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "cursors/mouse.xbm"
|
||||
#include "cursors/mouse_mask.xbm"
|
||||
|
@ -319,7 +318,8 @@ gimp_change_win_cursor (GdkWindow *win,
|
|||
modtype -= GIMP_PLUS_CURSOR;
|
||||
bmmodifier = &modifier_cursors[(int)modtype];
|
||||
}
|
||||
|
||||
#warning Im obsolete
|
||||
#if 0
|
||||
if (tool_type != TOOL_TYPE_NONE)
|
||||
{
|
||||
if (toggle_cursor)
|
||||
|
@ -335,6 +335,7 @@ gimp_change_win_cursor (GdkWindow *win,
|
|||
bmtool = &tool_info[(gint) tool_type].tool_cursor;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bmcursor->bitmap == NULL ||
|
||||
bmcursor->mask == NULL)
|
||||
|
|
|
@ -42,9 +42,7 @@
|
|||
#include "gimplist.h"
|
||||
#include "gimprc.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
|
||||
#include "tools/tool.h"
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -119,10 +117,10 @@ static void devices_close_callback (GtkWidget *widget,
|
|||
static void device_status_update (guint32 deviceid);
|
||||
static void device_status_update_current (void);
|
||||
|
||||
static ToolType device_status_drag_tool (GtkWidget *widget,
|
||||
static GimpTool *device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data);
|
||||
static void device_status_foreground_changed (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
@ -365,7 +363,7 @@ devices_rc_update (gchar *name,
|
|||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
gchar *brush_name,
|
||||
|
@ -682,8 +680,12 @@ devices_write_rc_device (DeviceInfo *device_info,
|
|||
if (gimp_context_get_tool (device_info->context) >= FIRST_TOOLBOX_TOOL &&
|
||||
gimp_context_get_tool (device_info->context) <= LAST_TOOLBOX_TOOL)
|
||||
{
|
||||
|
||||
#warning somebody fix me, please
|
||||
#if 0
|
||||
fprintf (fp, "\n (tool \"%s\")",
|
||||
tool_info[gimp_context_get_tool (device_info->context)].tool_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -827,8 +829,8 @@ device_status_create (void)
|
|||
|
||||
deviceD->eventboxes[i] = gtk_event_box_new ();
|
||||
|
||||
deviceD->tools[i] = gtk_pixmap_new (tool_get_pixmap (RECT_SELECT),
|
||||
tool_get_mask (RECT_SELECT));
|
||||
deviceD->tools[i] = gtk_pixmap_new (gimp_tool_get_pixmap (RECT_SELECT),
|
||||
gimp_tool_get_mask (RECT_SELECT));
|
||||
|
||||
gtk_drag_source_set (deviceD->eventboxes[i],
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
|
||||
|
@ -1076,17 +1078,19 @@ device_status_update (guint32 deviceid)
|
|||
gtk_widget_show (deviceD->frames[i]);
|
||||
|
||||
gtk_pixmap_set (GTK_PIXMAP (deviceD->tools[i]),
|
||||
tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
gimp_tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
gimp_tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
gtk_widget_show (deviceD->eventboxes[i]);
|
||||
|
||||
#warning fixme
|
||||
#if 0
|
||||
gimp_help_set_help_data (deviceD->eventboxes[i],
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].tool_desc,
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].private_tip);
|
||||
|
||||
#endif
|
||||
/* foreground color */
|
||||
gimp_context_get_foreground (device_info->context, &color);
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (deviceD->foregrounds[i]),
|
||||
|
@ -1134,7 +1138,7 @@ device_status_update (guint32 deviceid)
|
|||
|
||||
/* dnd stuff */
|
||||
|
||||
static ToolType
|
||||
static GimpTool *
|
||||
device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -1154,7 +1158,7 @@ device_status_drag_tool (GtkWidget *widget,
|
|||
|
||||
static void
|
||||
device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef __DEVICES_H__
|
||||
#define __DEVICES_H__
|
||||
|
||||
#include "tools/tool.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -61,7 +62,7 @@ void devices_rc_update (gchar *name,
|
|||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
gchar *brush_name,
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "info_dialog.h"
|
||||
#include "info_window.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "pdb/procedural_db.h"
|
||||
|
||||
|
@ -158,8 +158,8 @@ info_window_create_extended (InfoDialog *info_win)
|
|||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
pixmap = gtk_pixmap_new (tool_get_pixmap (COLOR_PICKER),
|
||||
tool_get_mask (COLOR_PICKER));
|
||||
pixmap = gtk_pixmap_new (gimp_tool_get_pixmap (COLOR_PICKER),
|
||||
gimp_tool_get_mask (COLOR_PICKER));
|
||||
gtk_table_attach (GTK_TABLE (table), pixmap, 0, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
|
||||
gtk_widget_show (pixmap);
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
#include "tools/bucket_fill.h"
|
||||
#include "tools/move.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -250,6 +250,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
switch (bevent->button)
|
||||
{
|
||||
case 1:
|
||||
g_message("disp_callbacks button pressed");
|
||||
state |= GDK_BUTTON1_MASK;
|
||||
gtk_grab_add (canvas);
|
||||
|
||||
|
@ -261,14 +262,19 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
* guaranteed to work in future versions of GTK.
|
||||
* -Yosh
|
||||
*/
|
||||
|
||||
|
||||
if (key_signal_id == 0)
|
||||
key_signal_id = gtk_signal_connect (GTK_OBJECT (canvas),
|
||||
"key_press_event",
|
||||
GTK_SIGNAL_FUNC (gtk_true),
|
||||
NULL);
|
||||
/* FIXME!!! This code is ugly, and active_tool shouldn't be referenced directly */
|
||||
|
||||
if (active_tool && ((active_tool->type == MOVE) ||
|
||||
! gimp_image_is_empty (gdisp->gimage)))
|
||||
|
||||
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) ||
|
||||
!gimp_image_is_empty (gdisp->gimage)))
|
||||
{
|
||||
if (active_tool->auto_snap_to)
|
||||
{
|
||||
|
@ -289,7 +295,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
/* and doesn't want to be preserved across drawable changes */
|
||||
! active_tool->preserve)
|
||||
{
|
||||
tools_initialize (active_tool->type, gdisp);
|
||||
gimp_tool_old_initialize (active_tool, gdisp);
|
||||
}
|
||||
|
||||
/* otherwise set it's drawable if it has none */
|
||||
|
@ -298,9 +304,9 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
active_tool->drawable =
|
||||
gimp_image_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
(* active_tool->button_press_func) (active_tool, bevent, gdisp);
|
||||
}
|
||||
|
||||
gimp_tool_emit_button_press (active_tool, bevent, gdisp);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@ -370,8 +376,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
*
|
||||
* ugly: fuzzy_select sets busy cursors while ACTIVE.
|
||||
*/
|
||||
if (gimp_busy && ! (active_tool->type == FUZZY_SELECT &&
|
||||
active_tool->state == ACTIVE))
|
||||
if (gimp_busy && ! (GIMP_IS_FUZZY_SELECT(active_tool) &&
|
||||
active_tool->state == ACTIVE))
|
||||
return TRUE;
|
||||
|
||||
switch (bevent->button)
|
||||
|
@ -388,7 +394,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
|
||||
gtk_grab_remove (canvas);
|
||||
gdk_pointer_ungrab (bevent->time); /* fixes pointer grab bug */
|
||||
if (active_tool && ((active_tool->type == MOVE) ||
|
||||
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) ||
|
||||
!gimp_image_is_empty (gdisp->gimage)))
|
||||
{
|
||||
if (active_tool->state == ACTIVE)
|
||||
|
@ -400,8 +407,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
bevent->y = ty;
|
||||
update_cursor = TRUE;
|
||||
}
|
||||
|
||||
(* active_tool->button_release_func) (active_tool, bevent,
|
||||
|
||||
gimp_tool_emit_button_release (active_tool, bevent,
|
||||
gdisp);
|
||||
}
|
||||
}
|
||||
|
@ -443,13 +450,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
*
|
||||
* ugly: fuzzy_select sets busy cursors while ACTIVE.
|
||||
*/
|
||||
if (gimp_busy && ! (active_tool->type == FUZZY_SELECT &&
|
||||
active_tool->state == ACTIVE))
|
||||
if (gimp_busy && !(GIMP_IS_FUZZY_SELECT(active_tool) &&
|
||||
active_tool->state == ACTIVE))
|
||||
return TRUE;
|
||||
|
||||
/* Ask for the pointer position, but ignore it except for cursor
|
||||
* handling, so motion events sync with the button press/release events
|
||||
* handling, so motion events sync with the button press/release events
|
||||
*/
|
||||
|
||||
if (mevent->is_hint)
|
||||
{
|
||||
gdk_input_window_get_pointer (canvas->window, current_device, &tx, &ty,
|
||||
|
@ -473,8 +480,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
gdisplay_check_device_cursor (gdisp);
|
||||
}
|
||||
|
||||
if (active_tool && ((active_tool->type == MOVE) ||
|
||||
! gimp_image_is_empty (gdisp->gimage)) &&
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) ||
|
||||
!gimp_image_is_empty (gdisp->gimage)) &&
|
||||
(mevent->state & GDK_BUTTON1_MASK))
|
||||
{
|
||||
if (active_tool->state == ACTIVE)
|
||||
|
@ -499,7 +506,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
update_cursor = TRUE;
|
||||
}
|
||||
|
||||
(* active_tool->motion_func) (active_tool, mevent, gdisp);
|
||||
gimp_tool_emit_motion (active_tool, mevent, gdisp);
|
||||
}
|
||||
}
|
||||
else if ((mevent->state & GDK_BUTTON2_MASK) && scrolled)
|
||||
|
@ -517,7 +524,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
{
|
||||
/* ...then preconditions to modify a tool */
|
||||
/* operator state have been met. */
|
||||
(* active_tool->oper_update_func) (active_tool, mevent, gdisp);
|
||||
gimp_tool_emit_oper_update (active_tool, mevent, gdisp);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -534,10 +541,10 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
{
|
||||
case GDK_Left: case GDK_Right:
|
||||
case GDK_Up: case GDK_Down:
|
||||
if (active_tool && !gimp_image_is_empty (gdisp->gimage))
|
||||
(* active_tool->arrow_keys_func) (active_tool, kevent, gdisp);
|
||||
if (active_tool && !gimp_image_is_empty (gdisp->gimage))
|
||||
gimp_tool_emit_arrow_keys (active_tool, kevent, gdisp);
|
||||
return_val = TRUE;
|
||||
break;
|
||||
break;
|
||||
|
||||
case GDK_Tab:
|
||||
if (kevent->state & GDK_MOD1_MASK &&
|
||||
|
@ -570,7 +577,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
&tx, &ty, NULL, NULL, NULL, NULL
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
);
|
||||
(* active_tool->modifier_key_func) (active_tool, kevent, gdisp);
|
||||
gimp_tool_emit_modifier_key (active_tool, kevent, gdisp);
|
||||
return_val = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -601,7 +608,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
&tx, &ty, NULL, NULL, NULL, NULL
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
);
|
||||
(* active_tool->modifier_key_func) (active_tool, kevent, gdisp);
|
||||
gimp_tool_emit_modifier_key (active_tool, kevent, gdisp);
|
||||
return_val = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -631,7 +638,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
GdkEventMotion me;
|
||||
me.x = tx; me.y = ty;
|
||||
me.state = state;
|
||||
(* active_tool->cursor_update_func) (active_tool, &me, gdisp);
|
||||
gimp_tool_emit_cursor_update (active_tool, &me, gdisp);
|
||||
}
|
||||
else if (gimp_image_is_empty (gdisp->gimage))
|
||||
{
|
||||
|
@ -923,11 +930,13 @@ gdisplay_bucket_fill (GtkWidget *widget,
|
|||
gimp_add_busy_cursors ();
|
||||
|
||||
/* Get the bucket fill context */
|
||||
if (! global_paint_options)
|
||||
#warning I like cheese
|
||||
#if 0
|
||||
if (! global_paint_options)
|
||||
context = tool_info[BUCKET_FILL].tool_context;
|
||||
else
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
#endif
|
||||
/* Transform the passed data for the dest image */
|
||||
if (fill_mode == FG_BUCKET_FILL)
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
#include "tools/bucket_fill.h"
|
||||
#include "tools/move.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -250,6 +250,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
switch (bevent->button)
|
||||
{
|
||||
case 1:
|
||||
g_message("disp_callbacks button pressed");
|
||||
state |= GDK_BUTTON1_MASK;
|
||||
gtk_grab_add (canvas);
|
||||
|
||||
|
@ -261,14 +262,19 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
* guaranteed to work in future versions of GTK.
|
||||
* -Yosh
|
||||
*/
|
||||
|
||||
|
||||
if (key_signal_id == 0)
|
||||
key_signal_id = gtk_signal_connect (GTK_OBJECT (canvas),
|
||||
"key_press_event",
|
||||
GTK_SIGNAL_FUNC (gtk_true),
|
||||
NULL);
|
||||
/* FIXME!!! This code is ugly, and active_tool shouldn't be referenced directly */
|
||||
|
||||
if (active_tool && ((active_tool->type == MOVE) ||
|
||||
! gimp_image_is_empty (gdisp->gimage)))
|
||||
|
||||
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) ||
|
||||
!gimp_image_is_empty (gdisp->gimage)))
|
||||
{
|
||||
if (active_tool->auto_snap_to)
|
||||
{
|
||||
|
@ -289,7 +295,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
/* and doesn't want to be preserved across drawable changes */
|
||||
! active_tool->preserve)
|
||||
{
|
||||
tools_initialize (active_tool->type, gdisp);
|
||||
gimp_tool_old_initialize (active_tool, gdisp);
|
||||
}
|
||||
|
||||
/* otherwise set it's drawable if it has none */
|
||||
|
@ -298,9 +304,9 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
active_tool->drawable =
|
||||
gimp_image_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
(* active_tool->button_press_func) (active_tool, bevent, gdisp);
|
||||
}
|
||||
|
||||
gimp_tool_emit_button_press (active_tool, bevent, gdisp);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@ -370,8 +376,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
*
|
||||
* ugly: fuzzy_select sets busy cursors while ACTIVE.
|
||||
*/
|
||||
if (gimp_busy && ! (active_tool->type == FUZZY_SELECT &&
|
||||
active_tool->state == ACTIVE))
|
||||
if (gimp_busy && ! (GIMP_IS_FUZZY_SELECT(active_tool) &&
|
||||
active_tool->state == ACTIVE))
|
||||
return TRUE;
|
||||
|
||||
switch (bevent->button)
|
||||
|
@ -388,7 +394,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
|
||||
gtk_grab_remove (canvas);
|
||||
gdk_pointer_ungrab (bevent->time); /* fixes pointer grab bug */
|
||||
if (active_tool && ((active_tool->type == MOVE) ||
|
||||
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) ||
|
||||
!gimp_image_is_empty (gdisp->gimage)))
|
||||
{
|
||||
if (active_tool->state == ACTIVE)
|
||||
|
@ -400,8 +407,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
bevent->y = ty;
|
||||
update_cursor = TRUE;
|
||||
}
|
||||
|
||||
(* active_tool->button_release_func) (active_tool, bevent,
|
||||
|
||||
gimp_tool_emit_button_release (active_tool, bevent,
|
||||
gdisp);
|
||||
}
|
||||
}
|
||||
|
@ -443,13 +450,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
*
|
||||
* ugly: fuzzy_select sets busy cursors while ACTIVE.
|
||||
*/
|
||||
if (gimp_busy && ! (active_tool->type == FUZZY_SELECT &&
|
||||
active_tool->state == ACTIVE))
|
||||
if (gimp_busy && !(GIMP_IS_FUZZY_SELECT(active_tool) &&
|
||||
active_tool->state == ACTIVE))
|
||||
return TRUE;
|
||||
|
||||
/* Ask for the pointer position, but ignore it except for cursor
|
||||
* handling, so motion events sync with the button press/release events
|
||||
* handling, so motion events sync with the button press/release events
|
||||
*/
|
||||
|
||||
if (mevent->is_hint)
|
||||
{
|
||||
gdk_input_window_get_pointer (canvas->window, current_device, &tx, &ty,
|
||||
|
@ -473,8 +480,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
gdisplay_check_device_cursor (gdisp);
|
||||
}
|
||||
|
||||
if (active_tool && ((active_tool->type == MOVE) ||
|
||||
! gimp_image_is_empty (gdisp->gimage)) &&
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) ||
|
||||
!gimp_image_is_empty (gdisp->gimage)) &&
|
||||
(mevent->state & GDK_BUTTON1_MASK))
|
||||
{
|
||||
if (active_tool->state == ACTIVE)
|
||||
|
@ -499,7 +506,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
update_cursor = TRUE;
|
||||
}
|
||||
|
||||
(* active_tool->motion_func) (active_tool, mevent, gdisp);
|
||||
gimp_tool_emit_motion (active_tool, mevent, gdisp);
|
||||
}
|
||||
}
|
||||
else if ((mevent->state & GDK_BUTTON2_MASK) && scrolled)
|
||||
|
@ -517,7 +524,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
{
|
||||
/* ...then preconditions to modify a tool */
|
||||
/* operator state have been met. */
|
||||
(* active_tool->oper_update_func) (active_tool, mevent, gdisp);
|
||||
gimp_tool_emit_oper_update (active_tool, mevent, gdisp);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -534,10 +541,10 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
{
|
||||
case GDK_Left: case GDK_Right:
|
||||
case GDK_Up: case GDK_Down:
|
||||
if (active_tool && !gimp_image_is_empty (gdisp->gimage))
|
||||
(* active_tool->arrow_keys_func) (active_tool, kevent, gdisp);
|
||||
if (active_tool && !gimp_image_is_empty (gdisp->gimage))
|
||||
gimp_tool_emit_arrow_keys (active_tool, kevent, gdisp);
|
||||
return_val = TRUE;
|
||||
break;
|
||||
break;
|
||||
|
||||
case GDK_Tab:
|
||||
if (kevent->state & GDK_MOD1_MASK &&
|
||||
|
@ -570,7 +577,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
&tx, &ty, NULL, NULL, NULL, NULL
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
);
|
||||
(* active_tool->modifier_key_func) (active_tool, kevent, gdisp);
|
||||
gimp_tool_emit_modifier_key (active_tool, kevent, gdisp);
|
||||
return_val = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -601,7 +608,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
&tx, &ty, NULL, NULL, NULL, NULL
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
);
|
||||
(* active_tool->modifier_key_func) (active_tool, kevent, gdisp);
|
||||
gimp_tool_emit_modifier_key (active_tool, kevent, gdisp);
|
||||
return_val = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -631,7 +638,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
GdkEventMotion me;
|
||||
me.x = tx; me.y = ty;
|
||||
me.state = state;
|
||||
(* active_tool->cursor_update_func) (active_tool, &me, gdisp);
|
||||
gimp_tool_emit_cursor_update (active_tool, &me, gdisp);
|
||||
}
|
||||
else if (gimp_image_is_empty (gdisp->gimage))
|
||||
{
|
||||
|
@ -923,11 +930,13 @@ gdisplay_bucket_fill (GtkWidget *widget,
|
|||
gimp_add_busy_cursors ();
|
||||
|
||||
/* Get the bucket fill context */
|
||||
if (! global_paint_options)
|
||||
#warning I like cheese
|
||||
#if 0
|
||||
if (! global_paint_options)
|
||||
context = tool_info[BUCKET_FILL].tool_context;
|
||||
else
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
#endif
|
||||
/* Transform the passed data for the dest image */
|
||||
if (fill_mode == FG_BUCKET_FILL)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "nav_window.h"
|
||||
#include "scale.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
|
||||
void
|
||||
|
@ -56,7 +56,7 @@ resize_display (GDisplay *gdisp,
|
|||
gboolean redisplay)
|
||||
{
|
||||
/* freeze the active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
if (resize_window)
|
||||
gdisplay_shrink_wrap (gdisp);
|
||||
|
@ -73,7 +73,7 @@ resize_display (GDisplay *gdisp,
|
|||
}
|
||||
|
||||
/* re-enable the active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ void
|
|||
shrink_wrap_display (GDisplay *gdisp)
|
||||
{
|
||||
/* freeze the active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
gdisplay_shrink_wrap (gdisp);
|
||||
|
||||
|
@ -92,7 +92,7 @@ shrink_wrap_display (GDisplay *gdisp)
|
|||
gdisplays_flush ();
|
||||
|
||||
/* re-enable the active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "scroll.h"
|
||||
#include "nav_window.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
|
||||
/* This is the delay before dithering begins
|
||||
|
@ -179,7 +179,7 @@ scroll_display (GDisplay *gdisp,
|
|||
gdisp->offset_y = old_y;
|
||||
|
||||
/* stop the currently active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
/* set the offsets back to the new values */
|
||||
gdisp->offset_x += x_offset;
|
||||
|
@ -194,7 +194,7 @@ scroll_display (GDisplay *gdisp,
|
|||
(gdisp->disp_height - abs (y_offset)));
|
||||
|
||||
/* resume the currently active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
|
||||
/* scale the image into the exposed regions */
|
||||
if (x_offset)
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#include "gdisplay_color.h"
|
||||
#endif /* DISPLAY_FILTERS */
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -373,7 +373,7 @@ gdisplay_delete (GDisplay *gdisp)
|
|||
g_hash_table_remove (display_ht, gdisp->canvas);
|
||||
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, (void *) gdisp);
|
||||
tool_manager_control_active (HALT, (void *) gdisp);
|
||||
|
||||
/* clear out the pointer to this gdisp from the active tool */
|
||||
if (active_tool &&
|
||||
|
@ -657,7 +657,7 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
if (list)
|
||||
{
|
||||
/* stop the currently active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
while (list)
|
||||
{
|
||||
|
@ -682,7 +682,7 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
selection_start (gdisp->select, TRUE);
|
||||
|
||||
/* start the currently active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
#include "tools/bucket_fill.h"
|
||||
#include "tools/move.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -250,6 +250,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
switch (bevent->button)
|
||||
{
|
||||
case 1:
|
||||
g_message("disp_callbacks button pressed");
|
||||
state |= GDK_BUTTON1_MASK;
|
||||
gtk_grab_add (canvas);
|
||||
|
||||
|
@ -261,14 +262,19 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
* guaranteed to work in future versions of GTK.
|
||||
* -Yosh
|
||||
*/
|
||||
|
||||
|
||||
if (key_signal_id == 0)
|
||||
key_signal_id = gtk_signal_connect (GTK_OBJECT (canvas),
|
||||
"key_press_event",
|
||||
GTK_SIGNAL_FUNC (gtk_true),
|
||||
NULL);
|
||||
/* FIXME!!! This code is ugly, and active_tool shouldn't be referenced directly */
|
||||
|
||||
if (active_tool && ((active_tool->type == MOVE) ||
|
||||
! gimp_image_is_empty (gdisp->gimage)))
|
||||
|
||||
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) ||
|
||||
!gimp_image_is_empty (gdisp->gimage)))
|
||||
{
|
||||
if (active_tool->auto_snap_to)
|
||||
{
|
||||
|
@ -289,7 +295,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
/* and doesn't want to be preserved across drawable changes */
|
||||
! active_tool->preserve)
|
||||
{
|
||||
tools_initialize (active_tool->type, gdisp);
|
||||
gimp_tool_old_initialize (active_tool, gdisp);
|
||||
}
|
||||
|
||||
/* otherwise set it's drawable if it has none */
|
||||
|
@ -298,9 +304,9 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
active_tool->drawable =
|
||||
gimp_image_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
(* active_tool->button_press_func) (active_tool, bevent, gdisp);
|
||||
}
|
||||
|
||||
gimp_tool_emit_button_press (active_tool, bevent, gdisp);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@ -370,8 +376,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
*
|
||||
* ugly: fuzzy_select sets busy cursors while ACTIVE.
|
||||
*/
|
||||
if (gimp_busy && ! (active_tool->type == FUZZY_SELECT &&
|
||||
active_tool->state == ACTIVE))
|
||||
if (gimp_busy && ! (GIMP_IS_FUZZY_SELECT(active_tool) &&
|
||||
active_tool->state == ACTIVE))
|
||||
return TRUE;
|
||||
|
||||
switch (bevent->button)
|
||||
|
@ -388,7 +394,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
|
||||
gtk_grab_remove (canvas);
|
||||
gdk_pointer_ungrab (bevent->time); /* fixes pointer grab bug */
|
||||
if (active_tool && ((active_tool->type == MOVE) ||
|
||||
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) ||
|
||||
!gimp_image_is_empty (gdisp->gimage)))
|
||||
{
|
||||
if (active_tool->state == ACTIVE)
|
||||
|
@ -400,8 +407,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
bevent->y = ty;
|
||||
update_cursor = TRUE;
|
||||
}
|
||||
|
||||
(* active_tool->button_release_func) (active_tool, bevent,
|
||||
|
||||
gimp_tool_emit_button_release (active_tool, bevent,
|
||||
gdisp);
|
||||
}
|
||||
}
|
||||
|
@ -443,13 +450,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
*
|
||||
* ugly: fuzzy_select sets busy cursors while ACTIVE.
|
||||
*/
|
||||
if (gimp_busy && ! (active_tool->type == FUZZY_SELECT &&
|
||||
active_tool->state == ACTIVE))
|
||||
if (gimp_busy && !(GIMP_IS_FUZZY_SELECT(active_tool) &&
|
||||
active_tool->state == ACTIVE))
|
||||
return TRUE;
|
||||
|
||||
/* Ask for the pointer position, but ignore it except for cursor
|
||||
* handling, so motion events sync with the button press/release events
|
||||
* handling, so motion events sync with the button press/release events
|
||||
*/
|
||||
|
||||
if (mevent->is_hint)
|
||||
{
|
||||
gdk_input_window_get_pointer (canvas->window, current_device, &tx, &ty,
|
||||
|
@ -473,8 +480,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
gdisplay_check_device_cursor (gdisp);
|
||||
}
|
||||
|
||||
if (active_tool && ((active_tool->type == MOVE) ||
|
||||
! gimp_image_is_empty (gdisp->gimage)) &&
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) ||
|
||||
!gimp_image_is_empty (gdisp->gimage)) &&
|
||||
(mevent->state & GDK_BUTTON1_MASK))
|
||||
{
|
||||
if (active_tool->state == ACTIVE)
|
||||
|
@ -499,7 +506,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
update_cursor = TRUE;
|
||||
}
|
||||
|
||||
(* active_tool->motion_func) (active_tool, mevent, gdisp);
|
||||
gimp_tool_emit_motion (active_tool, mevent, gdisp);
|
||||
}
|
||||
}
|
||||
else if ((mevent->state & GDK_BUTTON2_MASK) && scrolled)
|
||||
|
@ -517,7 +524,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
{
|
||||
/* ...then preconditions to modify a tool */
|
||||
/* operator state have been met. */
|
||||
(* active_tool->oper_update_func) (active_tool, mevent, gdisp);
|
||||
gimp_tool_emit_oper_update (active_tool, mevent, gdisp);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -534,10 +541,10 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
{
|
||||
case GDK_Left: case GDK_Right:
|
||||
case GDK_Up: case GDK_Down:
|
||||
if (active_tool && !gimp_image_is_empty (gdisp->gimage))
|
||||
(* active_tool->arrow_keys_func) (active_tool, kevent, gdisp);
|
||||
if (active_tool && !gimp_image_is_empty (gdisp->gimage))
|
||||
gimp_tool_emit_arrow_keys (active_tool, kevent, gdisp);
|
||||
return_val = TRUE;
|
||||
break;
|
||||
break;
|
||||
|
||||
case GDK_Tab:
|
||||
if (kevent->state & GDK_MOD1_MASK &&
|
||||
|
@ -570,7 +577,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
&tx, &ty, NULL, NULL, NULL, NULL
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
);
|
||||
(* active_tool->modifier_key_func) (active_tool, kevent, gdisp);
|
||||
gimp_tool_emit_modifier_key (active_tool, kevent, gdisp);
|
||||
return_val = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -601,7 +608,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
&tx, &ty, NULL, NULL, NULL, NULL
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
);
|
||||
(* active_tool->modifier_key_func) (active_tool, kevent, gdisp);
|
||||
gimp_tool_emit_modifier_key (active_tool, kevent, gdisp);
|
||||
return_val = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -631,7 +638,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
GdkEventMotion me;
|
||||
me.x = tx; me.y = ty;
|
||||
me.state = state;
|
||||
(* active_tool->cursor_update_func) (active_tool, &me, gdisp);
|
||||
gimp_tool_emit_cursor_update (active_tool, &me, gdisp);
|
||||
}
|
||||
else if (gimp_image_is_empty (gdisp->gimage))
|
||||
{
|
||||
|
@ -923,11 +930,13 @@ gdisplay_bucket_fill (GtkWidget *widget,
|
|||
gimp_add_busy_cursors ();
|
||||
|
||||
/* Get the bucket fill context */
|
||||
if (! global_paint_options)
|
||||
#warning I like cheese
|
||||
#if 0
|
||||
if (! global_paint_options)
|
||||
context = tool_info[BUCKET_FILL].tool_context;
|
||||
else
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
#endif
|
||||
/* Transform the passed data for the dest image */
|
||||
if (fill_mode == FG_BUCKET_FILL)
|
||||
{
|
||||
|
|
|
@ -45,12 +45,10 @@
|
|||
/* local functions */
|
||||
static void gdisplay_destroy (GtkWidget *widget,
|
||||
GDisplay *display);
|
||||
|
||||
static gint gdisplay_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
GDisplay *display);
|
||||
|
||||
|
||||
static GtkTargetEntry display_target_table[] =
|
||||
{
|
||||
GIMP_TARGET_LAYER,
|
||||
|
@ -62,7 +60,6 @@ static GtkTargetEntry display_target_table[] =
|
|||
static guint display_n_targets = (sizeof (display_target_table) /
|
||||
sizeof (display_target_table[0]));
|
||||
|
||||
|
||||
static void
|
||||
gdisplay_destroy (GtkWidget *widget,
|
||||
GDisplay *gdisp)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "nav_window.h"
|
||||
#include "scale.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
|
||||
void
|
||||
|
@ -56,7 +56,7 @@ resize_display (GDisplay *gdisp,
|
|||
gboolean redisplay)
|
||||
{
|
||||
/* freeze the active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
if (resize_window)
|
||||
gdisplay_shrink_wrap (gdisp);
|
||||
|
@ -73,7 +73,7 @@ resize_display (GDisplay *gdisp,
|
|||
}
|
||||
|
||||
/* re-enable the active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ void
|
|||
shrink_wrap_display (GDisplay *gdisp)
|
||||
{
|
||||
/* freeze the active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
gdisplay_shrink_wrap (gdisp);
|
||||
|
||||
|
@ -92,7 +92,7 @@ shrink_wrap_display (GDisplay *gdisp)
|
|||
gdisplays_flush ();
|
||||
|
||||
/* re-enable the active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "scroll.h"
|
||||
#include "nav_window.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
|
||||
/* This is the delay before dithering begins
|
||||
|
@ -179,7 +179,7 @@ scroll_display (GDisplay *gdisp,
|
|||
gdisp->offset_y = old_y;
|
||||
|
||||
/* stop the currently active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
/* set the offsets back to the new values */
|
||||
gdisp->offset_x += x_offset;
|
||||
|
@ -194,7 +194,7 @@ scroll_display (GDisplay *gdisp,
|
|||
(gdisp->disp_height - abs (y_offset)));
|
||||
|
||||
/* resume the currently active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
|
||||
/* scale the image into the exposed regions */
|
||||
if (x_offset)
|
||||
|
|
|
@ -45,12 +45,10 @@
|
|||
/* local functions */
|
||||
static void gdisplay_destroy (GtkWidget *widget,
|
||||
GDisplay *display);
|
||||
|
||||
static gint gdisplay_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
GDisplay *display);
|
||||
|
||||
|
||||
static GtkTargetEntry display_target_table[] =
|
||||
{
|
||||
GIMP_TARGET_LAYER,
|
||||
|
@ -62,7 +60,6 @@ static GtkTargetEntry display_target_table[] =
|
|||
static guint display_n_targets = (sizeof (display_target_table) /
|
||||
sizeof (display_target_table[0]));
|
||||
|
||||
|
||||
static void
|
||||
gdisplay_destroy (GtkWidget *widget,
|
||||
GDisplay *gdisp)
|
||||
|
|
|
@ -50,7 +50,7 @@ draw_core_new (DrawCoreDraw draw_func)
|
|||
void
|
||||
draw_core_start (DrawCore *core,
|
||||
GdkWindow *win,
|
||||
Tool *tool)
|
||||
GimpTool *tool)
|
||||
{
|
||||
GdkColor fg, bg;
|
||||
|
||||
|
@ -81,7 +81,7 @@ draw_core_start (DrawCore *core,
|
|||
|
||||
void
|
||||
draw_core_stop (DrawCore *core,
|
||||
Tool *tool)
|
||||
GimpTool *tool)
|
||||
{
|
||||
if (core->draw_state == INVISIBLE)
|
||||
return;
|
||||
|
@ -94,7 +94,7 @@ draw_core_stop (DrawCore *core,
|
|||
|
||||
void
|
||||
draw_core_resume (DrawCore *core,
|
||||
Tool *tool)
|
||||
GimpTool *tool)
|
||||
{
|
||||
core->paused_count = (core->paused_count > 0) ? core->paused_count - 1 : 0;
|
||||
if (core->paused_count == 0)
|
||||
|
@ -107,7 +107,7 @@ draw_core_resume (DrawCore *core,
|
|||
|
||||
void
|
||||
draw_core_pause (DrawCore *core,
|
||||
Tool *tool)
|
||||
GimpTool *tool)
|
||||
{
|
||||
if (core->paused_count == 0)
|
||||
{
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
#ifndef __DRAW_CORE_H__
|
||||
#define __DRAW_CORE_H__
|
||||
|
||||
|
||||
#include "tools/tool.h"
|
||||
/* drawing states */
|
||||
#define INVISIBLE 0
|
||||
#define VISIBLE 1
|
||||
|
||||
/* Structure definitions */
|
||||
|
||||
typedef void (* DrawCoreDraw) (Tool *);
|
||||
typedef void (* DrawCoreDraw) (GimpTool *);
|
||||
|
||||
struct _DrawCore
|
||||
{
|
||||
|
@ -53,13 +53,13 @@ struct _DrawCore
|
|||
DrawCore * draw_core_new (DrawCoreDraw );
|
||||
void draw_core_start (DrawCore *,
|
||||
GdkWindow *,
|
||||
Tool *);
|
||||
GimpTool *);
|
||||
void draw_core_stop (DrawCore *,
|
||||
Tool *);
|
||||
GimpTool *);
|
||||
void draw_core_pause (DrawCore *,
|
||||
Tool *);
|
||||
GimpTool *);
|
||||
void draw_core_resume (DrawCore *,
|
||||
Tool *);
|
||||
GimpTool *);
|
||||
void draw_core_free (DrawCore *);
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#include "gdisplay_color.h"
|
||||
#endif /* DISPLAY_FILTERS */
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -373,7 +373,7 @@ gdisplay_delete (GDisplay *gdisp)
|
|||
g_hash_table_remove (display_ht, gdisp->canvas);
|
||||
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, (void *) gdisp);
|
||||
tool_manager_control_active (HALT, (void *) gdisp);
|
||||
|
||||
/* clear out the pointer to this gdisp from the active tool */
|
||||
if (active_tool &&
|
||||
|
@ -657,7 +657,7 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
if (list)
|
||||
{
|
||||
/* stop the currently active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
while (list)
|
||||
{
|
||||
|
@ -682,7 +682,7 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
selection_start (gdisp->select, TRUE);
|
||||
|
||||
/* start the currently active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
10
app/gimage.c
10
app/gimage.c
|
@ -35,7 +35,7 @@
|
|||
#include "palette_import.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
|
||||
/* gimage.c: Junk (ugly dependencies) from gimpimage.c on its way
|
||||
|
@ -92,6 +92,7 @@ gimage_new (gint width,
|
|||
return gimage;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gimage_dirty_handler (GimpImage *gimage)
|
||||
{
|
||||
|
@ -102,10 +103,11 @@ gimage_dirty_handler (GimpImage *gimage)
|
|||
if (gdisp)
|
||||
{
|
||||
if (gdisp->gimage == gimage)
|
||||
tools_initialize (active_tool->type, gdisp);
|
||||
gimp_tool_old_initialize (active_tool, gdisp);
|
||||
else
|
||||
tools_initialize (active_tool->type, NULL);
|
||||
}
|
||||
gimp_tool_old_initialize (active_tool, NULL);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "tools/paint_core.h"
|
||||
#include "tools/paint_options.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "pdb/procedural_db.h"
|
||||
|
||||
|
@ -627,7 +627,7 @@ gimage_mask_stroke (GImage *gimage,
|
|||
|
||||
/* Stroke with the correct tool */
|
||||
return_vals =
|
||||
procedural_db_run_proc (tool_active_PDB_string (),
|
||||
procedural_db_run_proc (tool_manager_get_active_PDB_string (),
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
|
||||
PDB_INT32, (gint32) cpnt,
|
||||
|
|
|
@ -90,7 +90,7 @@ static void gimp_context_copy_display (GimpContext *src,
|
|||
|
||||
/* tool */
|
||||
static void gimp_context_real_set_tool (GimpContext *context,
|
||||
ToolType tool);
|
||||
GimpTool *tool);
|
||||
static void gimp_context_copy_tool (GimpContext *src,
|
||||
GimpContext *dest);
|
||||
|
||||
|
@ -379,9 +379,9 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
tool_changed),
|
||||
gtk_marshal_NONE__INT,
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_INT);
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
gimp_context_signals[FOREGROUND_CHANGED] =
|
||||
gtk_signal_new (gimp_context_signal_names[FOREGROUND_CHANGED],
|
||||
|
@ -493,7 +493,7 @@ gimp_context_init (GimpContext *context)
|
|||
context->image = NULL;
|
||||
context->display = NULL;
|
||||
|
||||
context->tool = RECT_SELECT;
|
||||
context->tool = NULL;
|
||||
|
||||
gimp_rgba_set (&context->foreground, 0.0, 0.0, 0.0, 1.0);
|
||||
gimp_rgba_set (&context->background, 1.0, 1.0, 1.0, 1.0);
|
||||
|
@ -1228,7 +1228,7 @@ gimp_context_copy_display (GimpContext *src,
|
|||
/*****************************************************************************/
|
||||
/* tool ********************************************************************/
|
||||
|
||||
ToolType
|
||||
GimpTool *
|
||||
gimp_context_get_tool (GimpContext *context)
|
||||
{
|
||||
context_check_current (context);
|
||||
|
@ -1239,7 +1239,7 @@ gimp_context_get_tool (GimpContext *context)
|
|||
|
||||
void
|
||||
gimp_context_set_tool (GimpContext *context,
|
||||
ToolType tool)
|
||||
GimpTool *tool)
|
||||
{
|
||||
context_check_current (context);
|
||||
context_return_if_fail (context);
|
||||
|
@ -1261,7 +1261,7 @@ gimp_context_tool_changed (GimpContext *context)
|
|||
|
||||
static void
|
||||
gimp_context_real_set_tool (GimpContext *context,
|
||||
ToolType tool)
|
||||
GimpTool *tool)
|
||||
{
|
||||
if (context->tool == tool)
|
||||
return;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define __GIMP_CONTEXT_H__
|
||||
|
||||
|
||||
#include "tools/tool.h"
|
||||
#include "gimpobject.h"
|
||||
|
||||
|
||||
|
@ -89,7 +90,7 @@ struct _GimpContext
|
|||
GimpImage *image;
|
||||
GDisplay *display;
|
||||
|
||||
ToolType tool;
|
||||
GimpTool *tool;
|
||||
|
||||
GimpRGB foreground;
|
||||
GimpRGB background;
|
||||
|
@ -234,9 +235,9 @@ void gimp_context_display_changed (GimpContext *context);
|
|||
|
||||
|
||||
/* tool */
|
||||
ToolType gimp_context_get_tool (GimpContext *context);
|
||||
GimpTool *gimp_context_get_tool (GimpContext *context);
|
||||
void gimp_context_set_tool (GimpContext *context,
|
||||
ToolType tool_type);
|
||||
GimpTool *tool_type);
|
||||
void gimp_context_tool_changed (GimpContext *context);
|
||||
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@
|
|||
#include "gimppreview.h"
|
||||
#include "gimprc.h"
|
||||
#include "temp_buf.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimplimits.h"
|
||||
|
||||
|
@ -991,6 +990,7 @@ gimp_dnd_get_gradient_icon (GtkWidget *widget,
|
|||
0,
|
||||
TRUE, FALSE, FALSE);
|
||||
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
|
@ -1195,13 +1195,16 @@ gimp_dnd_get_tool_icon (GtkWidget *widget,
|
|||
|
||||
tool_type = (* (GimpDndDragToolFunc) get_tool_func) (widget, get_tool_data);
|
||||
|
||||
#warning obsolete
|
||||
#if 0
|
||||
if (((gint) tool_type < 0) || ((gint) tool_type >= num_tools))
|
||||
return NULL;
|
||||
|
||||
tool_icon = gtk_pixmap_new (tool_get_pixmap (tool_type),
|
||||
tool_get_mask (tool_type));
|
||||
tool_icon = gtk_pixmap_new (gimp_tool_get_pixmap (tool_type),
|
||||
gimp_tool_get_mask (tool_type));
|
||||
|
||||
return tool_icon;
|
||||
#endif
|
||||
}
|
||||
|
||||
static guchar *
|
||||
|
@ -1216,9 +1219,11 @@ gimp_dnd_get_tool_data (GtkWidget *widget,
|
|||
|
||||
tool_type = (* (GimpDndDragToolFunc) get_tool_func) (widget, get_tool_data);
|
||||
|
||||
#warning yet another
|
||||
#if 0
|
||||
if (((gint) tool_type < 0) || ((gint) tool_type >= num_tools))
|
||||
return NULL;
|
||||
|
||||
#endif
|
||||
val = g_new (guint16, 1);
|
||||
|
||||
val[0] = (guint16) tool_type;
|
||||
|
@ -1249,9 +1254,11 @@ gimp_dnd_set_tool_data (GtkWidget *widget,
|
|||
val = *((guint16 *) vals);
|
||||
|
||||
tool_type = (ToolType) val;
|
||||
|
||||
#warning nothing special
|
||||
#if 0
|
||||
if (((gint) tool_type < 0) || ((gint) tool_type >= num_tools))
|
||||
return;
|
||||
#endif
|
||||
|
||||
(* (GimpDndDropToolFunc) set_tool_func) (widget, tool_type, set_tool_data);
|
||||
}
|
||||
|
|
12
app/gimprc.c
12
app/gimprc.c
|
@ -52,8 +52,7 @@
|
|||
#include "plug_in.h"
|
||||
#include "gimage.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
#include "libgimp/gimputils.h"
|
||||
|
@ -2114,7 +2113,7 @@ parse_device (gpointer val1p,
|
|||
gint num_keys = 0;
|
||||
GdkDeviceKey *keys = NULL;
|
||||
|
||||
ToolType tool = RECT_SELECT;
|
||||
GimpTool *tool;
|
||||
GimpRGB foreground = { 1.0, 1.0, 1.0, 1.0 };
|
||||
GimpRGB background = { 0.0, 0.0, 0.0, 1.0 };
|
||||
gchar *brush_name = NULL;
|
||||
|
@ -2228,12 +2227,17 @@ parse_device (gpointer val1p,
|
|||
token = get_next_token ();
|
||||
|
||||
/* FIXME: this shouldn't be hard coded like this */
|
||||
#warning deep bogosity error
|
||||
#if 0
|
||||
for (tool = FIRST_TOOLBOX_TOOL; tool <= LAST_TOOLBOX_TOOL; tool++)
|
||||
{
|
||||
if (!strcmp (tool_info[tool].tool_name, token_str))
|
||||
break;
|
||||
}
|
||||
if (tool > LAST_TOOLBOX_TOOL)
|
||||
|
||||
#endif
|
||||
|
||||
if (tool > LAST_TOOLBOX_TOOL)
|
||||
goto error;
|
||||
}
|
||||
else if (!strcmp ("foreground", token_sym))
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -533,7 +533,7 @@ gboolean
|
|||
global_edit_cut (GDisplay *gdisp)
|
||||
{
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_cut (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage)))
|
||||
return FALSE;
|
||||
|
@ -558,7 +558,7 @@ global_edit_paste (GDisplay *gdisp,
|
|||
gboolean paste_into)
|
||||
{
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_paste (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buf, paste_into))
|
||||
|
@ -578,7 +578,7 @@ global_edit_paste_as_new (GDisplay *gdisp)
|
|||
return FALSE;
|
||||
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
return edit_paste_as_new (gdisp->gimage, global_buf);
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ named_edit_cut (GDisplay *gdisp)
|
|||
GtkWidget *qbox;
|
||||
|
||||
/* stop any active tool */
|
||||
active_tool_control (HALT, gdisp);
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Cut Named"),
|
||||
gimp_standard_help_func,
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
#endif /* DISPLAY_FILTERS */
|
||||
|
||||
#include "tools/tool_options_dialog.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -1120,6 +1120,8 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
gdisp = gdisplay_active ();
|
||||
|
||||
|
||||
#warning fix tools_select_cmd_callback
|
||||
#if 0
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool_type);
|
||||
|
||||
/* Paranoia */
|
||||
|
@ -1141,6 +1143,7 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
* before deleting it
|
||||
*/
|
||||
active_tool->gdisp = gdisp;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***** Filters *****/
|
||||
|
|
|
@ -42,9 +42,7 @@
|
|||
#include "gimplist.h"
|
||||
#include "gimprc.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
|
||||
#include "tools/tool.h"
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -119,10 +117,10 @@ static void devices_close_callback (GtkWidget *widget,
|
|||
static void device_status_update (guint32 deviceid);
|
||||
static void device_status_update_current (void);
|
||||
|
||||
static ToolType device_status_drag_tool (GtkWidget *widget,
|
||||
static GimpTool *device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data);
|
||||
static void device_status_foreground_changed (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
@ -365,7 +363,7 @@ devices_rc_update (gchar *name,
|
|||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
gchar *brush_name,
|
||||
|
@ -682,8 +680,12 @@ devices_write_rc_device (DeviceInfo *device_info,
|
|||
if (gimp_context_get_tool (device_info->context) >= FIRST_TOOLBOX_TOOL &&
|
||||
gimp_context_get_tool (device_info->context) <= LAST_TOOLBOX_TOOL)
|
||||
{
|
||||
|
||||
#warning somebody fix me, please
|
||||
#if 0
|
||||
fprintf (fp, "\n (tool \"%s\")",
|
||||
tool_info[gimp_context_get_tool (device_info->context)].tool_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -827,8 +829,8 @@ device_status_create (void)
|
|||
|
||||
deviceD->eventboxes[i] = gtk_event_box_new ();
|
||||
|
||||
deviceD->tools[i] = gtk_pixmap_new (tool_get_pixmap (RECT_SELECT),
|
||||
tool_get_mask (RECT_SELECT));
|
||||
deviceD->tools[i] = gtk_pixmap_new (gimp_tool_get_pixmap (RECT_SELECT),
|
||||
gimp_tool_get_mask (RECT_SELECT));
|
||||
|
||||
gtk_drag_source_set (deviceD->eventboxes[i],
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
|
||||
|
@ -1076,17 +1078,19 @@ device_status_update (guint32 deviceid)
|
|||
gtk_widget_show (deviceD->frames[i]);
|
||||
|
||||
gtk_pixmap_set (GTK_PIXMAP (deviceD->tools[i]),
|
||||
tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
gimp_tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
gimp_tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
gtk_widget_show (deviceD->eventboxes[i]);
|
||||
|
||||
#warning fixme
|
||||
#if 0
|
||||
gimp_help_set_help_data (deviceD->eventboxes[i],
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].tool_desc,
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].private_tip);
|
||||
|
||||
#endif
|
||||
/* foreground color */
|
||||
gimp_context_get_foreground (device_info->context, &color);
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (deviceD->foregrounds[i]),
|
||||
|
@ -1134,7 +1138,7 @@ device_status_update (guint32 deviceid)
|
|||
|
||||
/* dnd stuff */
|
||||
|
||||
static ToolType
|
||||
static GimpTool *
|
||||
device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -1154,7 +1158,7 @@ device_status_drag_tool (GtkWidget *widget,
|
|||
|
||||
static void
|
||||
device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
#endif /* DISPLAY_FILTERS */
|
||||
|
||||
#include "tools/tool_options_dialog.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -1120,6 +1120,8 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
gdisp = gdisplay_active ();
|
||||
|
||||
|
||||
#warning fix tools_select_cmd_callback
|
||||
#if 0
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool_type);
|
||||
|
||||
/* Paranoia */
|
||||
|
@ -1141,6 +1143,7 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
* before deleting it
|
||||
*/
|
||||
active_tool->gdisp = gdisp;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***** Filters *****/
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "info_dialog.h"
|
||||
#include "info_window.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "pdb/procedural_db.h"
|
||||
|
||||
|
@ -158,8 +158,8 @@ info_window_create_extended (InfoDialog *info_win)
|
|||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
pixmap = gtk_pixmap_new (tool_get_pixmap (COLOR_PICKER),
|
||||
tool_get_mask (COLOR_PICKER));
|
||||
pixmap = gtk_pixmap_new (gimp_tool_get_pixmap (COLOR_PICKER),
|
||||
gimp_tool_get_mask (COLOR_PICKER));
|
||||
gtk_table_attach (GTK_TABLE (table), pixmap, 0, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
|
||||
gtk_widget_show (pixmap);
|
||||
|
|
|
@ -42,9 +42,7 @@
|
|||
#include "gimplist.h"
|
||||
#include "gimprc.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
|
||||
#include "tools/tool.h"
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -119,10 +117,10 @@ static void devices_close_callback (GtkWidget *widget,
|
|||
static void device_status_update (guint32 deviceid);
|
||||
static void device_status_update_current (void);
|
||||
|
||||
static ToolType device_status_drag_tool (GtkWidget *widget,
|
||||
static GimpTool *device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data);
|
||||
static void device_status_foreground_changed (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
@ -365,7 +363,7 @@ devices_rc_update (gchar *name,
|
|||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
gchar *brush_name,
|
||||
|
@ -682,8 +680,12 @@ devices_write_rc_device (DeviceInfo *device_info,
|
|||
if (gimp_context_get_tool (device_info->context) >= FIRST_TOOLBOX_TOOL &&
|
||||
gimp_context_get_tool (device_info->context) <= LAST_TOOLBOX_TOOL)
|
||||
{
|
||||
|
||||
#warning somebody fix me, please
|
||||
#if 0
|
||||
fprintf (fp, "\n (tool \"%s\")",
|
||||
tool_info[gimp_context_get_tool (device_info->context)].tool_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -827,8 +829,8 @@ device_status_create (void)
|
|||
|
||||
deviceD->eventboxes[i] = gtk_event_box_new ();
|
||||
|
||||
deviceD->tools[i] = gtk_pixmap_new (tool_get_pixmap (RECT_SELECT),
|
||||
tool_get_mask (RECT_SELECT));
|
||||
deviceD->tools[i] = gtk_pixmap_new (gimp_tool_get_pixmap (RECT_SELECT),
|
||||
gimp_tool_get_mask (RECT_SELECT));
|
||||
|
||||
gtk_drag_source_set (deviceD->eventboxes[i],
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
|
||||
|
@ -1076,17 +1078,19 @@ device_status_update (guint32 deviceid)
|
|||
gtk_widget_show (deviceD->frames[i]);
|
||||
|
||||
gtk_pixmap_set (GTK_PIXMAP (deviceD->tools[i]),
|
||||
tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
gimp_tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
gimp_tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
gtk_widget_show (deviceD->eventboxes[i]);
|
||||
|
||||
#warning fixme
|
||||
#if 0
|
||||
gimp_help_set_help_data (deviceD->eventboxes[i],
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].tool_desc,
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].private_tip);
|
||||
|
||||
#endif
|
||||
/* foreground color */
|
||||
gimp_context_get_foreground (device_info->context, &color);
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (deviceD->foregrounds[i]),
|
||||
|
@ -1134,7 +1138,7 @@ device_status_update (guint32 deviceid)
|
|||
|
||||
/* dnd stuff */
|
||||
|
||||
static ToolType
|
||||
static GimpTool *
|
||||
device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -1154,7 +1158,7 @@ device_status_drag_tool (GtkWidget *widget,
|
|||
|
||||
static void
|
||||
device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "preferences_dialog.h"
|
||||
#include "toolbox.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
|
@ -1224,10 +1224,9 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
|
||||
static void
|
||||
menus_tools_create (ToolInfo *tool_info)
|
||||
menus_tools_create (GimpToolClass *tool_info)
|
||||
{
|
||||
GimpItemFactoryEntry entry;
|
||||
|
||||
if (tool_info->menu_path == NULL)
|
||||
return;
|
||||
|
||||
|
@ -1236,7 +1235,7 @@ menus_tools_create (ToolInfo *tool_info)
|
|||
entry.entry.callback = tools_select_cmd_callback;
|
||||
entry.entry.callback_action = tool_info->tool_id;
|
||||
entry.entry.item_type = NULL;
|
||||
entry.help_page = tool_info->private_tip;
|
||||
entry.help_page = tool_info->help_data;
|
||||
entry.description = NULL;
|
||||
|
||||
menus_create_item (image_factory, &entry, (gpointer) tool_info, 2);
|
||||
|
@ -1686,6 +1685,8 @@ menus_init (void)
|
|||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *klass;
|
||||
|
||||
if (menus_initialized)
|
||||
return;
|
||||
|
@ -1765,13 +1766,15 @@ menus_init (void)
|
|||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
menus_tools_create (tools->data);
|
||||
}
|
||||
/* reorder <Image>/Image/Colors */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
#warning fixme
|
||||
#if 0
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
|
@ -1802,7 +1805,6 @@ menus_init (void)
|
|||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
separator = gtk_menu_item_new ();
|
||||
|
@ -1811,6 +1813,7 @@ menus_init (void)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
|
||||
#include "tool_options.h"
|
||||
#include "tool_options_dialog.h"
|
||||
#include "tools.h"
|
||||
#include "tool.h"
|
||||
#include "tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "tile_manager.h"
|
||||
|
||||
#include "tools/tool_options_dialog.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -82,10 +82,10 @@ static gboolean toolbox_drag_drop (GtkWidget *widget,
|
|||
gint x,
|
||||
gint y,
|
||||
guint time);
|
||||
static ToolType toolbox_drag_tool (GtkWidget *widget,
|
||||
static GimpTool * toolbox_drag_tool (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void toolbox_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data);
|
||||
|
||||
|
||||
|
@ -134,11 +134,11 @@ static void
|
|||
tools_select_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ToolType tool_type;
|
||||
GimpToolClass *tool_type;
|
||||
|
||||
tool_type = (ToolType) data;
|
||||
tool_type = GIMP_TOOL_CLASS (data);
|
||||
|
||||
if ((tool_type != -1) && GTK_TOGGLE_BUTTON (widget)->active)
|
||||
if ((tool_type) && GTK_TOGGLE_BUTTON (widget)->active)
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool_type);
|
||||
}
|
||||
|
||||
|
@ -287,20 +287,22 @@ create_color_area (GtkWidget *parent)
|
|||
static void
|
||||
create_tool_pixmaps (GtkWidget *parent)
|
||||
{
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *tool;
|
||||
|
||||
g_return_if_fail (parent != NULL);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
if (tool_info[i].icon_data)
|
||||
tool_info[i].icon_pixmap = create_pixmap (parent->window,
|
||||
&tool_info[i].icon_mask,
|
||||
tool_info[i].icon_data,
|
||||
tool = GIMP_TOOL_CLASS (tools->data);
|
||||
if (tool->icon_data)
|
||||
tool->icon_pixmap = create_pixmap (parent->window,
|
||||
&tool->icon_mask,
|
||||
tool->icon_data,
|
||||
22, 22);
|
||||
else
|
||||
tool_info[i].icon_pixmap = create_pixmap (parent->window,
|
||||
&tool_info[i].icon_mask,
|
||||
tool->icon_pixmap = create_pixmap (parent->window,
|
||||
&tool->icon_mask,
|
||||
dialog_bits,
|
||||
22, 22);
|
||||
}
|
||||
|
@ -313,7 +315,8 @@ create_tools (GtkWidget *parent)
|
|||
GtkWidget *button;
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *pixmap;
|
||||
GSList *group;
|
||||
GSList *group, *tools;
|
||||
GimpToolClass *tool;
|
||||
gint i, j;
|
||||
|
||||
wbox = parent;
|
||||
|
@ -326,12 +329,10 @@ create_tools (GtkWidget *parent)
|
|||
group = NULL;
|
||||
|
||||
i = 0;
|
||||
for (j = 0; j < num_tools; j++)
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
if (j <= LAST_TOOLBOX_TOOL &&
|
||||
j != SCALE && j!= SHEAR && j != PERSPECTIVE)
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
tool = GIMP_TOOL_CLASS(tools->data);
|
||||
tool->tool_widget = button = gtk_radio_button_new (group);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (button), 0);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
|
@ -344,44 +345,33 @@ create_tools (GtkWidget *parent)
|
|||
gtk_container_set_border_width (GTK_CONTAINER (alignment), 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), alignment);
|
||||
|
||||
pixmap = gtk_pixmap_new (tool_get_pixmap ((ToolType)j),
|
||||
tool_get_mask ((ToolType)j));
|
||||
pixmap = gtk_pixmap_new (gimp_tool_get_pixmap (tool),
|
||||
gimp_tool_get_mask (tool));
|
||||
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (tools_select_update),
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
(gpointer) tool);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (tools_button_press),
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
(gpointer) tool);
|
||||
|
||||
/* dnd stuff */
|
||||
gtk_drag_source_set (tool_info[j].tool_widget,
|
||||
gtk_drag_source_set (tool->tool_widget,
|
||||
GDK_BUTTON2_MASK,
|
||||
tool_target_table, tool_n_targets,
|
||||
GDK_ACTION_COPY);
|
||||
gimp_dnd_tool_source_set (tool_info[j].tool_widget,
|
||||
toolbox_drag_tool, (gpointer) j);
|
||||
gimp_dnd_tool_source_set (tool->tool_widget,
|
||||
toolbox_drag_tool, tool);
|
||||
|
||||
gimp_help_set_help_data (button,
|
||||
gettext(tool_info[j].tool_desc),
|
||||
tool_info[j].private_tip);
|
||||
gettext(tool->tool_desc),
|
||||
tool->help_data);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (alignment);
|
||||
gtk_widget_show (button);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tools_select_update),
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_show (wbox);
|
||||
|
@ -582,18 +572,20 @@ toolbox_create (void)
|
|||
void
|
||||
toolbox_free (void)
|
||||
{
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *tool;
|
||||
|
||||
session_get_window_info (toolbox_shell, &toolbox_session_info);
|
||||
|
||||
gtk_widget_destroy (toolbox_shell);
|
||||
for (i = 0; i < num_tools; i++)
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
if (tool_info[i].icon_pixmap)
|
||||
gdk_pixmap_unref (tool_info[i].icon_pixmap);
|
||||
tool = GIMP_TOOL_CLASS (tools->data);
|
||||
if (tool->icon_pixmap)
|
||||
gdk_pixmap_unref (tool->icon_pixmap);
|
||||
|
||||
if (!tool_info[i].icon_data)
|
||||
gtk_object_sink (GTK_OBJECT (tool_info[i].tool_widget));
|
||||
if (!tool->icon_data)
|
||||
gtk_object_sink (GTK_OBJECT (tool->tool_widget));
|
||||
}
|
||||
gimp_help_free ();
|
||||
}
|
||||
|
@ -804,16 +796,16 @@ toolbox_drag_drop (GtkWidget *widget,
|
|||
return return_val;
|
||||
}
|
||||
|
||||
static ToolType
|
||||
static GimpTool *
|
||||
toolbox_drag_tool (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
return (ToolType) data;
|
||||
return GIMP_TOOL(data);
|
||||
}
|
||||
|
||||
static void
|
||||
toolbox_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "info_dialog.h"
|
||||
#include "info_window.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "pdb/procedural_db.h"
|
||||
|
||||
|
@ -158,8 +158,8 @@ info_window_create_extended (InfoDialog *info_win)
|
|||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
pixmap = gtk_pixmap_new (tool_get_pixmap (COLOR_PICKER),
|
||||
tool_get_mask (COLOR_PICKER));
|
||||
pixmap = gtk_pixmap_new (gimp_tool_get_pixmap (COLOR_PICKER),
|
||||
gimp_tool_get_mask (COLOR_PICKER));
|
||||
gtk_table_attach (GTK_TABLE (table), pixmap, 0, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
|
||||
gtk_widget_show (pixmap);
|
||||
|
|
|
@ -45,12 +45,10 @@
|
|||
/* local functions */
|
||||
static void gdisplay_destroy (GtkWidget *widget,
|
||||
GDisplay *display);
|
||||
|
||||
static gint gdisplay_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
GDisplay *display);
|
||||
|
||||
|
||||
static GtkTargetEntry display_target_table[] =
|
||||
{
|
||||
GIMP_TARGET_LAYER,
|
||||
|
@ -62,7 +60,6 @@ static GtkTargetEntry display_target_table[] =
|
|||
static guint display_n_targets = (sizeof (display_target_table) /
|
||||
sizeof (display_target_table[0]));
|
||||
|
||||
|
||||
static void
|
||||
gdisplay_destroy (GtkWidget *widget,
|
||||
GDisplay *gdisp)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
|
|
23
app/menus.c
23
app/menus.c
|
@ -41,7 +41,7 @@
|
|||
#include "preferences_dialog.h"
|
||||
#include "toolbox.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
|
@ -1224,10 +1224,9 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
|
||||
static void
|
||||
menus_tools_create (ToolInfo *tool_info)
|
||||
menus_tools_create (GimpToolClass *tool_info)
|
||||
{
|
||||
GimpItemFactoryEntry entry;
|
||||
|
||||
if (tool_info->menu_path == NULL)
|
||||
return;
|
||||
|
||||
|
@ -1236,7 +1235,7 @@ menus_tools_create (ToolInfo *tool_info)
|
|||
entry.entry.callback = tools_select_cmd_callback;
|
||||
entry.entry.callback_action = tool_info->tool_id;
|
||||
entry.entry.item_type = NULL;
|
||||
entry.help_page = tool_info->private_tip;
|
||||
entry.help_page = tool_info->help_data;
|
||||
entry.description = NULL;
|
||||
|
||||
menus_create_item (image_factory, &entry, (gpointer) tool_info, 2);
|
||||
|
@ -1686,6 +1685,8 @@ menus_init (void)
|
|||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *klass;
|
||||
|
||||
if (menus_initialized)
|
||||
return;
|
||||
|
@ -1765,13 +1766,15 @@ menus_init (void)
|
|||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
menus_tools_create (tools->data);
|
||||
}
|
||||
/* reorder <Image>/Image/Colors */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
#warning fixme
|
||||
#if 0
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
|
@ -1802,7 +1805,6 @@ menus_init (void)
|
|||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
separator = gtk_menu_item_new ();
|
||||
|
@ -1811,6 +1813,7 @@ menus_init (void)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "preferences_dialog.h"
|
||||
#include "toolbox.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
|
@ -1224,10 +1224,9 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
|
||||
static void
|
||||
menus_tools_create (ToolInfo *tool_info)
|
||||
menus_tools_create (GimpToolClass *tool_info)
|
||||
{
|
||||
GimpItemFactoryEntry entry;
|
||||
|
||||
if (tool_info->menu_path == NULL)
|
||||
return;
|
||||
|
||||
|
@ -1236,7 +1235,7 @@ menus_tools_create (ToolInfo *tool_info)
|
|||
entry.entry.callback = tools_select_cmd_callback;
|
||||
entry.entry.callback_action = tool_info->tool_id;
|
||||
entry.entry.item_type = NULL;
|
||||
entry.help_page = tool_info->private_tip;
|
||||
entry.help_page = tool_info->help_data;
|
||||
entry.description = NULL;
|
||||
|
||||
menus_create_item (image_factory, &entry, (gpointer) tool_info, 2);
|
||||
|
@ -1686,6 +1685,8 @@ menus_init (void)
|
|||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *klass;
|
||||
|
||||
if (menus_initialized)
|
||||
return;
|
||||
|
@ -1765,13 +1766,15 @@ menus_init (void)
|
|||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
menus_tools_create (tools->data);
|
||||
}
|
||||
/* reorder <Image>/Image/Colors */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
#warning fixme
|
||||
#if 0
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
|
@ -1802,7 +1805,6 @@ menus_init (void)
|
|||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
separator = gtk_menu_item_new ();
|
||||
|
@ -1811,6 +1813,7 @@ menus_init (void)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
|
|
194
app/paint_core.h
Normal file
194
app/paint_core.h
Normal file
|
@ -0,0 +1,194 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#ifndef __PAINT_CORE_H__
|
||||
#define __PAINT_CORE_H__
|
||||
|
||||
#include "tool.h"
|
||||
/* the different states that the painting function can be called with */
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
INIT_PAINT, /* Setup PaintFunc internals */
|
||||
MOTION_PAINT, /* PaintFunc performs motion-related rendering */
|
||||
PAUSE_PAINT, /* Unused. Reserved */
|
||||
RESUME_PAINT, /* Unused. Reserved */
|
||||
FINISH_PAINT, /* Cleanup and/or reset PaintFunc operation */
|
||||
PRETRACE_PAINT, /* PaintFunc performs window tracing activity prior to rendering */
|
||||
POSTTRACE_PAINT /* PaintFunc performs window tracing activity following rendering */
|
||||
} PaintState;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
TOOL_CAN_HANDLE_CHANGING_BRUSH = 0x0001, /* Set for tools that don't mind
|
||||
* if the brush changes while
|
||||
* painting.
|
||||
*/
|
||||
|
||||
TOOL_TRACES_ON_WINDOW /* Set for tools that perform temporary
|
||||
* rendering directly to the window. These
|
||||
* require sequencing with gdisplay_flush()
|
||||
* routines. See clone.c for example.
|
||||
*/
|
||||
} ToolFlags;
|
||||
|
||||
typedef gpointer (* PaintFunc) (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
PaintState paint_state);
|
||||
|
||||
struct _PaintCore
|
||||
{
|
||||
DrawCore * core; /* Core select object */
|
||||
|
||||
gdouble startx; /* starting x coord */
|
||||
gdouble starty; /* starting y coord */
|
||||
gdouble startpressure; /* starting pressure */
|
||||
gdouble startxtilt; /* starting xtilt */
|
||||
gdouble startytilt; /* starting ytilt */
|
||||
#ifdef GTK_HAVE_SIX_VALUATORS
|
||||
gdouble startwheel; /* starting wheel */
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
|
||||
gdouble curx; /* current x coord */
|
||||
gdouble cury; /* current y coord */
|
||||
gdouble curpressure; /* current pressure */
|
||||
gdouble curxtilt; /* current xtilt */
|
||||
gdouble curytilt; /* current ytilt */
|
||||
#ifdef GTK_HAVE_SIX_VALUATORS
|
||||
gdouble curwheel; /* current wheel */
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
|
||||
gdouble lastx; /* last x coord */
|
||||
gdouble lasty; /* last y coord */
|
||||
gdouble lastpressure; /* last pressure */
|
||||
gdouble lastxtilt; /* last xtilt */
|
||||
gdouble lastytilt; /* last ytilt */
|
||||
#ifdef GTK_HAVE_SIX_VALUATORS
|
||||
gdouble lastwheel; /* last wheel */
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
|
||||
gint state; /* state of buttons and keys */
|
||||
|
||||
gdouble distance; /* distance traveled by brush */
|
||||
gdouble pixel_dist; /* distance in pixels */
|
||||
gdouble spacing; /* spacing */
|
||||
|
||||
gint x1, y1; /* image space coordinate */
|
||||
gint x2, y2; /* image space coords */
|
||||
|
||||
GimpBrush * brush; /* current brush */
|
||||
|
||||
PaintFunc paint_func; /* painting function */
|
||||
|
||||
gboolean pick_colors; /* pick color if ctrl or alt is pressed */
|
||||
gboolean pick_state; /* was ctrl or alt pressed when clicked? */
|
||||
ToolFlags flags; /* tool flags, see ToolFlags above */
|
||||
|
||||
guint context_id; /* for the statusbar */
|
||||
};
|
||||
|
||||
extern PaintCore non_gui_paint_core;
|
||||
|
||||
/* Special undo type */
|
||||
typedef struct _PaintUndo PaintUndo;
|
||||
|
||||
struct _PaintUndo
|
||||
{
|
||||
gint tool_ID;
|
||||
gdouble lastx;
|
||||
gdouble lasty;
|
||||
gdouble lastpressure;
|
||||
gdouble lastxtilt;
|
||||
gdouble lastytilt;
|
||||
#ifdef GTK_HAVE_SIX_VALUATORS
|
||||
gdouble lastwheel;
|
||||
#endif /* GTK_HAVE_SIX_VALUATORS */
|
||||
};
|
||||
|
||||
/* paint tool action functions */
|
||||
void paint_core_button_press (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
void paint_core_button_release (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
void paint_core_motion (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
void paint_core_cursor_update (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
|
||||
void paint_core_control (GimpTool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp);
|
||||
|
||||
/* paint tool functions */
|
||||
void paint_core_no_draw (GimpTool *tool);
|
||||
GimpTool * paint_core_new (GimpToolClass *type);
|
||||
void paint_core_free (GimpTool *tool);
|
||||
int paint_core_init (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
void paint_core_interpolate (PaintCore *paint_core,
|
||||
GimpDrawable *drawable);
|
||||
void paint_core_finish (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
gint tool_ID);
|
||||
void paint_core_cleanup (void);
|
||||
|
||||
void paint_core_get_color_from_gradient (PaintCore *paint_core,
|
||||
gdouble gradient_length,
|
||||
GimpRGB *color,
|
||||
GradientPaintMode mode);
|
||||
|
||||
/* paint tool painting functions */
|
||||
TempBuf * paint_core_get_paint_area (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
gdouble scale);
|
||||
TempBuf * paint_core_get_orig_image (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2);
|
||||
void paint_core_paste_canvas (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
gint brush_opacity,
|
||||
gint image_opacity,
|
||||
LayerModeEffects paint_mode,
|
||||
BrushApplicationMode brush_hardness,
|
||||
gdouble brush_scale,
|
||||
PaintApplicationMode mode);
|
||||
void paint_core_replace_canvas (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
gint brush_opacity,
|
||||
gint image_opacity,
|
||||
BrushApplicationMode brush_hardness,
|
||||
gdouble brush_scale,
|
||||
PaintApplicationMode mode);
|
||||
void paint_core_color_area_with_pixmap (PaintCore *paint_core,
|
||||
GimpImage *dest,
|
||||
GimpDrawable *drawable,
|
||||
TempBuf *area,
|
||||
gdouble scale,
|
||||
BrushApplicationMode mode);
|
||||
|
||||
|
||||
#endif /* __PAINT_CORE_H__ */
|
108
app/paint_options.h
Normal file
108
app/paint_options.h
Normal file
|
@ -0,0 +1,108 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995-1999 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.
|
||||
*/
|
||||
#ifndef __PAINT_OPTIONS_H__
|
||||
#define __PAINT_OPTIONS_H__
|
||||
|
||||
#include "tool.h"
|
||||
#include "tool_options.h"
|
||||
|
||||
/* the paint options structures */
|
||||
typedef struct _PaintPressureOptions PaintPressureOptions;
|
||||
struct _PaintPressureOptions
|
||||
{
|
||||
GtkWidget *frame;
|
||||
|
||||
gboolean opacity;
|
||||
gboolean opacity_d;
|
||||
GtkWidget *opacity_w;
|
||||
|
||||
gboolean pressure;
|
||||
gboolean pressure_d;
|
||||
GtkWidget *pressure_w;
|
||||
|
||||
gboolean rate;
|
||||
gboolean rate_d;
|
||||
GtkWidget *rate_w;
|
||||
|
||||
gboolean size;
|
||||
gboolean size_d;
|
||||
GtkWidget *size_w;
|
||||
|
||||
gboolean color;
|
||||
gboolean color_d;
|
||||
GtkWidget *color_w;
|
||||
};
|
||||
|
||||
/* the paint options structures */
|
||||
typedef struct _PaintOptions PaintOptions;
|
||||
struct _PaintOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
/* vbox for the common paint options */
|
||||
GtkWidget *paint_vbox;
|
||||
|
||||
/* a widget to be shown if we are in global mode */
|
||||
GtkWidget *global;
|
||||
|
||||
/* options used by all paint tools */
|
||||
GtkObject *opacity_w;
|
||||
GtkWidget *paint_mode_w;
|
||||
|
||||
/* this tool's private context */
|
||||
GimpContext *context;
|
||||
|
||||
/* the incremental toggle */
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
|
||||
/* the pressure-sensitivity options */
|
||||
PaintPressureOptions *pressure_options;
|
||||
};
|
||||
|
||||
|
||||
/* the default pressure_options for non_gui use */
|
||||
extern PaintPressureOptions non_gui_pressure_options;
|
||||
|
||||
|
||||
/* paint tool options functions */
|
||||
|
||||
PaintOptions *paint_options_new (ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
void paint_options_reset (PaintOptions *options);
|
||||
|
||||
/* to be used by "derived" paint options only */
|
||||
void paint_options_init (PaintOptions *options,
|
||||
ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
|
||||
/* functions for the global paint options */
|
||||
|
||||
/* switch between global and per-tool paint options */
|
||||
void paint_options_set_global (gboolean global);
|
||||
|
||||
|
||||
/* a utility function which returns a paint mode menu */
|
||||
GtkWidget * paint_mode_menu_new (GtkSignalFunc callback,
|
||||
gpointer data,
|
||||
LayerModeEffects initial);
|
||||
|
||||
#endif /* __PAINT_OPTIONS_H__ */
|
10
app/scale.c
10
app/scale.c
|
@ -31,7 +31,7 @@
|
|||
#include "nav_window.h"
|
||||
#include "scale.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
|
||||
void
|
||||
|
@ -56,7 +56,7 @@ resize_display (GDisplay *gdisp,
|
|||
gboolean redisplay)
|
||||
{
|
||||
/* freeze the active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
if (resize_window)
|
||||
gdisplay_shrink_wrap (gdisp);
|
||||
|
@ -73,7 +73,7 @@ resize_display (GDisplay *gdisp,
|
|||
}
|
||||
|
||||
/* re-enable the active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ void
|
|||
shrink_wrap_display (GDisplay *gdisp)
|
||||
{
|
||||
/* freeze the active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
gdisplay_shrink_wrap (gdisp);
|
||||
|
||||
|
@ -92,7 +92,7 @@ shrink_wrap_display (GDisplay *gdisp)
|
|||
gdisplays_flush ();
|
||||
|
||||
/* re-enable the active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "scroll.h"
|
||||
#include "nav_window.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
|
||||
/* This is the delay before dithering begins
|
||||
|
@ -179,7 +179,7 @@ scroll_display (GDisplay *gdisp,
|
|||
gdisp->offset_y = old_y;
|
||||
|
||||
/* stop the currently active tool */
|
||||
active_tool_control (PAUSE, (void *) gdisp);
|
||||
tool_manager_control_active (PAUSE, (void *) gdisp);
|
||||
|
||||
/* set the offsets back to the new values */
|
||||
gdisp->offset_x += x_offset;
|
||||
|
@ -194,7 +194,7 @@ scroll_display (GDisplay *gdisp,
|
|||
(gdisp->disp_height - abs (y_offset)));
|
||||
|
||||
/* resume the currently active tool */
|
||||
active_tool_control (RESUME, (void *) gdisp);
|
||||
tool_manager_control_active (RESUME, (void *) gdisp);
|
||||
|
||||
/* scale the image into the exposed regions */
|
||||
if (x_offset)
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "tile_manager.h"
|
||||
|
||||
#include "tools/tool_options_dialog.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -82,10 +82,10 @@ static gboolean toolbox_drag_drop (GtkWidget *widget,
|
|||
gint x,
|
||||
gint y,
|
||||
guint time);
|
||||
static ToolType toolbox_drag_tool (GtkWidget *widget,
|
||||
static GimpTool * toolbox_drag_tool (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void toolbox_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data);
|
||||
|
||||
|
||||
|
@ -134,11 +134,11 @@ static void
|
|||
tools_select_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ToolType tool_type;
|
||||
GimpToolClass *tool_type;
|
||||
|
||||
tool_type = (ToolType) data;
|
||||
tool_type = GIMP_TOOL_CLASS (data);
|
||||
|
||||
if ((tool_type != -1) && GTK_TOGGLE_BUTTON (widget)->active)
|
||||
if ((tool_type) && GTK_TOGGLE_BUTTON (widget)->active)
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool_type);
|
||||
}
|
||||
|
||||
|
@ -287,20 +287,22 @@ create_color_area (GtkWidget *parent)
|
|||
static void
|
||||
create_tool_pixmaps (GtkWidget *parent)
|
||||
{
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *tool;
|
||||
|
||||
g_return_if_fail (parent != NULL);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
if (tool_info[i].icon_data)
|
||||
tool_info[i].icon_pixmap = create_pixmap (parent->window,
|
||||
&tool_info[i].icon_mask,
|
||||
tool_info[i].icon_data,
|
||||
tool = GIMP_TOOL_CLASS (tools->data);
|
||||
if (tool->icon_data)
|
||||
tool->icon_pixmap = create_pixmap (parent->window,
|
||||
&tool->icon_mask,
|
||||
tool->icon_data,
|
||||
22, 22);
|
||||
else
|
||||
tool_info[i].icon_pixmap = create_pixmap (parent->window,
|
||||
&tool_info[i].icon_mask,
|
||||
tool->icon_pixmap = create_pixmap (parent->window,
|
||||
&tool->icon_mask,
|
||||
dialog_bits,
|
||||
22, 22);
|
||||
}
|
||||
|
@ -313,7 +315,8 @@ create_tools (GtkWidget *parent)
|
|||
GtkWidget *button;
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *pixmap;
|
||||
GSList *group;
|
||||
GSList *group, *tools;
|
||||
GimpToolClass *tool;
|
||||
gint i, j;
|
||||
|
||||
wbox = parent;
|
||||
|
@ -326,12 +329,10 @@ create_tools (GtkWidget *parent)
|
|||
group = NULL;
|
||||
|
||||
i = 0;
|
||||
for (j = 0; j < num_tools; j++)
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
if (j <= LAST_TOOLBOX_TOOL &&
|
||||
j != SCALE && j!= SHEAR && j != PERSPECTIVE)
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
tool = GIMP_TOOL_CLASS(tools->data);
|
||||
tool->tool_widget = button = gtk_radio_button_new (group);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (button), 0);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
|
@ -344,44 +345,33 @@ create_tools (GtkWidget *parent)
|
|||
gtk_container_set_border_width (GTK_CONTAINER (alignment), 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), alignment);
|
||||
|
||||
pixmap = gtk_pixmap_new (tool_get_pixmap ((ToolType)j),
|
||||
tool_get_mask ((ToolType)j));
|
||||
pixmap = gtk_pixmap_new (gimp_tool_get_pixmap (tool),
|
||||
gimp_tool_get_mask (tool));
|
||||
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (tools_select_update),
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
(gpointer) tool);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (tools_button_press),
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
(gpointer) tool);
|
||||
|
||||
/* dnd stuff */
|
||||
gtk_drag_source_set (tool_info[j].tool_widget,
|
||||
gtk_drag_source_set (tool->tool_widget,
|
||||
GDK_BUTTON2_MASK,
|
||||
tool_target_table, tool_n_targets,
|
||||
GDK_ACTION_COPY);
|
||||
gimp_dnd_tool_source_set (tool_info[j].tool_widget,
|
||||
toolbox_drag_tool, (gpointer) j);
|
||||
gimp_dnd_tool_source_set (tool->tool_widget,
|
||||
toolbox_drag_tool, tool);
|
||||
|
||||
gimp_help_set_help_data (button,
|
||||
gettext(tool_info[j].tool_desc),
|
||||
tool_info[j].private_tip);
|
||||
gettext(tool->tool_desc),
|
||||
tool->help_data);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (alignment);
|
||||
gtk_widget_show (button);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tools_select_update),
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_show (wbox);
|
||||
|
@ -582,18 +572,20 @@ toolbox_create (void)
|
|||
void
|
||||
toolbox_free (void)
|
||||
{
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *tool;
|
||||
|
||||
session_get_window_info (toolbox_shell, &toolbox_session_info);
|
||||
|
||||
gtk_widget_destroy (toolbox_shell);
|
||||
for (i = 0; i < num_tools; i++)
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
if (tool_info[i].icon_pixmap)
|
||||
gdk_pixmap_unref (tool_info[i].icon_pixmap);
|
||||
tool = GIMP_TOOL_CLASS (tools->data);
|
||||
if (tool->icon_pixmap)
|
||||
gdk_pixmap_unref (tool->icon_pixmap);
|
||||
|
||||
if (!tool_info[i].icon_data)
|
||||
gtk_object_sink (GTK_OBJECT (tool_info[i].tool_widget));
|
||||
if (!tool->icon_data)
|
||||
gtk_object_sink (GTK_OBJECT (tool->tool_widget));
|
||||
}
|
||||
gimp_help_free ();
|
||||
}
|
||||
|
@ -804,16 +796,16 @@ toolbox_drag_drop (GtkWidget *widget,
|
|||
return return_val;
|
||||
}
|
||||
|
||||
static ToolType
|
||||
static GimpTool *
|
||||
toolbox_drag_tool (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
return (ToolType) data;
|
||||
return GIMP_TOOL(data);
|
||||
}
|
||||
|
||||
static void
|
||||
toolbox_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool);
|
||||
|
|
|
@ -3,105 +3,108 @@
|
|||
noinst_LTLIBRARIES = libapptools.la
|
||||
|
||||
libapptools_la_SOURCES = \
|
||||
airbrush.c \
|
||||
airbrush.h \
|
||||
airbrush_blob.c \
|
||||
airbrush_blob.h \
|
||||
bezier_select.c \
|
||||
bezier_select.h \
|
||||
bezier_selectP.h \
|
||||
blend.c \
|
||||
blend.h \
|
||||
blob.c \
|
||||
blob.h \
|
||||
brightness_contrast.c \
|
||||
brightness_contrast.h \
|
||||
bucket_fill.c \
|
||||
bucket_fill.h \
|
||||
by_color_select.c \
|
||||
by_color_select.h \
|
||||
clone.c \
|
||||
clone.h \
|
||||
color_balance.c \
|
||||
color_balance.h \
|
||||
## airbrush.c \
|
||||
## airbrush.h \
|
||||
## airbrush_blob.c \
|
||||
## airbrush_blob.h \
|
||||
## bezier_select.c \
|
||||
## bezier_select.h \
|
||||
## bezier_selectP.h \
|
||||
## blend.c \
|
||||
## blend.h \
|
||||
## blob.c \
|
||||
## blob.h \
|
||||
## brightness_contrast.c \
|
||||
## brightness_contrast.h \
|
||||
## bucket_fill.c \
|
||||
## bucket_fill.h \
|
||||
## by_color_select.c \
|
||||
## by_color_select.h \
|
||||
## clone.c \
|
||||
## clone.h \
|
||||
## color_balance.c \
|
||||
## color_balance.h \
|
||||
color_picker.c \
|
||||
color_picker.h \
|
||||
convolve.c \
|
||||
convolve.h \
|
||||
crop.c \
|
||||
crop.h \
|
||||
curves.c \
|
||||
curves.h \
|
||||
dodgeburn.c \
|
||||
dodgeburn.h \
|
||||
edit_selection.c \
|
||||
edit_selection.h \
|
||||
ellipse_select.c \
|
||||
ellipse_select.h \
|
||||
eraser.c \
|
||||
eraser.h \
|
||||
flip_tool.c \
|
||||
flip_tool.h \
|
||||
free_select.c \
|
||||
free_select.h \
|
||||
fuzzy_select.c \
|
||||
fuzzy_select.h \
|
||||
histogram_tool.c \
|
||||
histogram_tool.h \
|
||||
hue_saturation.c \
|
||||
hue_saturation.h \
|
||||
ink.c \
|
||||
ink.h \
|
||||
iscissors.c \
|
||||
iscissors.h \
|
||||
levels.c \
|
||||
levels.h \
|
||||
magnify.c \
|
||||
magnify.h \
|
||||
measure.c \
|
||||
measure.h \
|
||||
move.c \
|
||||
move.h \
|
||||
paintbrush.c \
|
||||
paintbrush.h \
|
||||
paint_core.c \
|
||||
paint_core.h \
|
||||
paint_core_kernels.h \
|
||||
paint_options.c \
|
||||
paint_options.h \
|
||||
pencil.c \
|
||||
pencil.h \
|
||||
perspective_tool.c \
|
||||
perspective_tool.h \
|
||||
posterize.c \
|
||||
posterize.h \
|
||||
rect_select.c \
|
||||
rect_select.h \
|
||||
rect_selectP.h \
|
||||
rotate_tool.c \
|
||||
rotate_tool.h \
|
||||
scale_tool.c \
|
||||
scale_tool.h \
|
||||
selection_options.c \
|
||||
selection_options.h \
|
||||
shear_tool.c \
|
||||
shear_tool.h \
|
||||
smudge.c \
|
||||
smudge.h \
|
||||
text_tool.c \
|
||||
text_tool.h \
|
||||
threshold.c \
|
||||
threshold.h \
|
||||
## convolve.c \
|
||||
## convolve.h \
|
||||
## crop.c \
|
||||
## crop.h \
|
||||
## curves.c \
|
||||
## curves.h \
|
||||
## dodgeburn.c \
|
||||
## dodgeburn.h \
|
||||
## edit_selection.c \
|
||||
## edit_selection.h \
|
||||
## ellipse_select.c \
|
||||
## ellipse_select.h \
|
||||
## eraser.c \
|
||||
## eraser.h \
|
||||
## flip_tool.c \
|
||||
## flip_tool.h \
|
||||
## free_select.c \
|
||||
## free_select.h \
|
||||
## fuzzy_select.c \
|
||||
## fuzzy_select.h \
|
||||
## histogram_tool.c \
|
||||
## histogram_tool.h \
|
||||
## hue_saturation.c \
|
||||
## hue_saturation.h \
|
||||
## ink.c \
|
||||
## ink.h \
|
||||
## iscissors.c \
|
||||
## iscissors.h \
|
||||
## levels.c \
|
||||
## levels.h \
|
||||
## magnify.c \
|
||||
## magnify.h \
|
||||
## measure.c \
|
||||
## measure.h \
|
||||
## move.c \
|
||||
## move.h \
|
||||
## paintbrush.c \
|
||||
## paintbrush.h \
|
||||
## paint_core.c \
|
||||
## paint_core.h \
|
||||
## paint_core_kernels.h \
|
||||
## paint_options.c \
|
||||
## paint_options.h \
|
||||
## pencil.c \
|
||||
## pencil.h \
|
||||
## perspective_tool.c \
|
||||
## perspective_tool.h \
|
||||
## posterize.c \
|
||||
## posterize.h \
|
||||
## rect_select.c \
|
||||
## rect_select.h \
|
||||
## rect_selectP.h \
|
||||
## rotate_tool.c \
|
||||
## rotate_tool.h \
|
||||
## scale_tool.c \
|
||||
## scale_tool.h \
|
||||
## selection_options.c \
|
||||
## selection_options.h \
|
||||
## shear_tool.c \
|
||||
## shear_tool.h \
|
||||
## smudge.c \
|
||||
## smudge.h \
|
||||
## text_tool.c \
|
||||
## text_tool.h \
|
||||
## threshold.c \
|
||||
## threshold.h \
|
||||
tool.c \
|
||||
tool.h \
|
||||
tool_manager.c \
|
||||
tool_manager.h \
|
||||
tool_options.c \
|
||||
tool_options.h \
|
||||
tool_options_dialog.c \
|
||||
tool_options_dialog.h \
|
||||
tools.c \
|
||||
tools.h \
|
||||
transform_core.c \
|
||||
transform_core.h \
|
||||
transform_tool.c \
|
||||
transform_tool.h
|
||||
## tool_options_dialog.c \
|
||||
## tool_options_dialog.h \
|
||||
tools.c
|
||||
## transform_core.c \
|
||||
## transform_core.h \
|
||||
## transform_tool.c \
|
||||
## transform_tool.h
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gimp-Tools\"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
* Copyright (C) 1995-2001 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
|
||||
|
@ -25,22 +25,25 @@
|
|||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "cursorutil.h"
|
||||
#include "appenv.h"
|
||||
#include "color_picker.h"
|
||||
#include "draw_core.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimpui.h"
|
||||
#include "gimprc.h"
|
||||
#include "cursorutil.h"
|
||||
#include "info_dialog.h"
|
||||
#include "palette.h"
|
||||
|
||||
#include "color_picker.h"
|
||||
#include "tool.h"
|
||||
#include "tool_options.h"
|
||||
#include "tools.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "pixmaps2.h"
|
||||
#include "cursors/dropper_small.xbm"
|
||||
#include "cursors/dropper_small_mask.xbm"
|
||||
|
||||
/* maximum information buffer size */
|
||||
#define MAX_INFO_BUF 8
|
||||
|
@ -72,14 +75,6 @@ struct _ColorPickerOptions
|
|||
|
||||
typedef struct _ColorPickerTool ColorPickerTool;
|
||||
|
||||
struct _ColorPickerTool
|
||||
{
|
||||
DrawCore *core; /* Core select object */
|
||||
|
||||
gint centerx; /* starting x coord */
|
||||
gint centery; /* starting y coord */
|
||||
};
|
||||
|
||||
/* the color picker tool options */
|
||||
static ColorPickerOptions * color_picker_options = NULL;
|
||||
|
||||
|
@ -99,28 +94,36 @@ static gchar index_buf [MAX_INFO_BUF];
|
|||
static gchar gray_buf [MAX_INFO_BUF];
|
||||
static gchar hex_buf [MAX_INFO_BUF];
|
||||
|
||||
/*The cursor */
|
||||
|
||||
BitmapCursor tool_cursor = {
|
||||
dropper_small_bits, dropper_small_mask_bits,
|
||||
dropper_small_width, dropper_small_height,
|
||||
0, 0, NULL, NULL, NULL};
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void color_picker_button_press (Tool *tool,
|
||||
static void color_picker_class_init (GimpToolClass *klass);
|
||||
static void color_picker_initialize (GimpTool *tool);
|
||||
static void color_picker_button_press (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
static void color_picker_button_release (Tool *tool,
|
||||
static void color_picker_button_release (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
static void color_picker_motion (Tool *tool,
|
||||
static void color_picker_motion (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
static void color_picker_cursor_update (Tool *tool,
|
||||
static void color_picker_cursor_update (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
static void color_picker_control (Tool *tool,
|
||||
static void color_picker_control (GimpTool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp);
|
||||
|
||||
static void color_picker_info_window_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_picker_info_update (Tool *tool,
|
||||
static void color_picker_info_update (GimpTool *tool,
|
||||
gboolean valid);
|
||||
|
||||
static gboolean pick_color_do (GimpImage *gimage,
|
||||
|
@ -135,6 +138,42 @@ static gboolean pick_color_do (GimpImage *gimage,
|
|||
|
||||
/* functions */
|
||||
|
||||
GtkType
|
||||
gimp_color_picker_get_type (void)
|
||||
{
|
||||
static GtkType tool_type = 0;
|
||||
|
||||
if (! tool_type)
|
||||
{
|
||||
GtkTypeInfo tool_info =
|
||||
{
|
||||
"GimpColorPicker",
|
||||
sizeof (GimpColorPicker),
|
||||
sizeof (GimpColorPickerClass),
|
||||
(GtkClassInitFunc) color_picker_class_init,
|
||||
(GtkObjectInitFunc) color_picker_initialize,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
tool_type = gtk_type_unique (GIMP_TYPE_TOOL, &tool_info);
|
||||
}
|
||||
|
||||
return tool_type;
|
||||
}
|
||||
|
||||
GimpTool *
|
||||
gimp_color_picker_new (void)
|
||||
{
|
||||
GimpTool *tool;
|
||||
|
||||
tool = gtk_type_new (GIMP_TYPE_COLOR_PICKER);
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_picker_options_reset (void)
|
||||
{
|
||||
|
@ -247,14 +286,14 @@ color_picker_options_new (void)
|
|||
}
|
||||
|
||||
static void
|
||||
color_picker_button_press (Tool *tool,
|
||||
color_picker_button_press (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
GimpColorPicker *cp_tool;
|
||||
gint x, y;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
cp_tool = GIMP_COLOR_PICKER(tool);
|
||||
|
||||
/* Make the tool active and set it's gdisplay & drawable */
|
||||
tool->gdisp = gdisp;
|
||||
|
@ -269,7 +308,7 @@ color_picker_button_press (Tool *tool,
|
|||
GimpRGB color;
|
||||
|
||||
color_picker_info = info_dialog_new (_("Color Picker"),
|
||||
tools_help_func, NULL);
|
||||
gimp_tool_help_func, NULL);
|
||||
|
||||
/* if the gdisplay is for a color image, the dialog must have RGB */
|
||||
switch (gimp_drawable_type (tool->drawable))
|
||||
|
@ -380,17 +419,17 @@ color_picker_button_press (Tool *tool,
|
|||
}
|
||||
|
||||
static void
|
||||
color_picker_button_release (Tool *tool,
|
||||
color_picker_button_release (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
GimpColorPicker *cp_tool;
|
||||
gint x, y;
|
||||
|
||||
gdk_pointer_ungrab (bevent->time);
|
||||
gdk_flush ();
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
cp_tool = GIMP_COLOR_PICKER(tool);
|
||||
|
||||
/* First, transform the coordinates to gimp image space */
|
||||
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
|
||||
|
@ -409,14 +448,14 @@ color_picker_button_release (Tool *tool,
|
|||
}
|
||||
|
||||
static void
|
||||
color_picker_motion (Tool *tool,
|
||||
color_picker_motion (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
GimpColorPicker *cp_tool;
|
||||
gint x, y;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
cp_tool = GIMP_COLOR_PICKER(tool);
|
||||
|
||||
/* undraw the current tool */
|
||||
draw_core_pause (cp_tool->core, tool);
|
||||
|
@ -442,7 +481,7 @@ color_picker_motion (Tool *tool,
|
|||
}
|
||||
|
||||
static void
|
||||
color_picker_cursor_update (Tool *tool,
|
||||
color_picker_cursor_update (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
|
@ -475,13 +514,13 @@ color_picker_cursor_update (Tool *tool,
|
|||
}
|
||||
|
||||
static void
|
||||
color_picker_control (Tool *tool,
|
||||
color_picker_control (GimpTool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
GimpColorPicker *cp_tool;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
cp_tool = GIMP_COLOR_PICKER(tool);
|
||||
|
||||
switch (action)
|
||||
{
|
||||
|
@ -503,7 +542,6 @@ color_picker_control (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
typedef guchar * (*GetColorFunc) (GimpObject *object,
|
||||
gint x,
|
||||
gint y);
|
||||
|
@ -628,9 +666,9 @@ pick_color (GimpImage *gimage,
|
|||
}
|
||||
|
||||
static void
|
||||
colorpicker_draw (Tool *tool)
|
||||
colorpicker_draw (GimpTool *tool)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
GimpColorPicker *cp_tool;
|
||||
gint tx, ty;
|
||||
gint radiusx, radiusy;
|
||||
gint cx, cy;
|
||||
|
@ -638,7 +676,7 @@ colorpicker_draw (Tool *tool)
|
|||
if (! color_picker_options->sample_average)
|
||||
return;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
cp_tool = GIMP_COLOR_PICKER(tool);
|
||||
|
||||
gdisplay_transform_coords (tool->gdisp, cp_tool->centerx, cp_tool->centery,
|
||||
&tx, &ty, TRUE);
|
||||
|
@ -664,7 +702,7 @@ colorpicker_draw (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
color_picker_info_update (Tool *tool,
|
||||
color_picker_info_update (GimpTool *tool,
|
||||
gboolean valid)
|
||||
{
|
||||
if (!valid)
|
||||
|
@ -770,11 +808,10 @@ color_picker_info_window_close_callback (GtkWidget *widget,
|
|||
info_dialog_popdown ((InfoDialog *) client_data);
|
||||
}
|
||||
|
||||
Tool *
|
||||
tools_new_color_picker ()
|
||||
void
|
||||
color_picker_initialize (GimpTool *tool)
|
||||
{
|
||||
Tool * tool;
|
||||
ColorPickerTool * private;
|
||||
GimpColorPicker * cp_tool;
|
||||
|
||||
/* The tool options */
|
||||
if (! color_picker_options)
|
||||
|
@ -783,30 +820,38 @@ tools_new_color_picker ()
|
|||
tools_register (COLOR_PICKER, (ToolOptions *) color_picker_options);
|
||||
}
|
||||
|
||||
tool = tools_new_tool (COLOR_PICKER);
|
||||
private = g_new0 (ColorPickerTool, 1);
|
||||
|
||||
private->core = draw_core_new (colorpicker_draw);
|
||||
cp_tool = GIMP_COLOR_PICKER (tool);
|
||||
cp_tool->core = draw_core_new (colorpicker_draw);
|
||||
|
||||
tool->preserve = FALSE; /* Don't preserve on drawable change */
|
||||
}
|
||||
|
||||
tool->private = (void *) private;
|
||||
void color_picker_class_init (GimpToolClass *klass)
|
||||
{
|
||||
|
||||
tool->button_press_func = color_picker_button_press;
|
||||
tool->button_release_func = color_picker_button_release;
|
||||
tool->motion_func = color_picker_motion;
|
||||
tool->cursor_update_func = color_picker_cursor_update;
|
||||
tool->control_func = color_picker_control;
|
||||
klass->tool_name = N_("Color Picker");
|
||||
klass->menu_path = N_("/Tools/Color Picker");
|
||||
klass->menu_accel = "O";
|
||||
klass->icon_data = (char **) colorpicker_bits;
|
||||
klass->tool_desc = N_("Pick colors from the image"),
|
||||
klass->help_data = "tools/color_picker.html";
|
||||
klass->tool_id = COLOR_PICKER;
|
||||
klass->tool_cursor = &tool_cursor;
|
||||
|
||||
return tool;
|
||||
|
||||
klass->button_press_func = color_picker_button_press;
|
||||
klass->button_release_func = color_picker_button_release;
|
||||
klass->motion_func = color_picker_motion;
|
||||
klass->cursor_update_func = color_picker_cursor_update;
|
||||
klass->control_func = color_picker_control;
|
||||
}
|
||||
|
||||
void
|
||||
tools_free_color_picker (Tool *tool)
|
||||
finalize_color_picker (GimpTool *tool)
|
||||
{
|
||||
ColorPickerTool * cp_tool;
|
||||
GimpColorPicker * cp_tool;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
cp_tool = GIMP_COLOR_PICKER(tool);
|
||||
|
||||
if (tool->state == ACTIVE)
|
||||
draw_core_stop (cp_tool->core, tool);
|
||||
|
@ -821,5 +866,4 @@ tools_free_color_picker (Tool *tool)
|
|||
color_area = NULL;
|
||||
}
|
||||
|
||||
g_free (cp_tool);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,34 @@
|
|||
#ifndef __COLOR_PICKER_H__
|
||||
#define __COLOR_PICKER_H__
|
||||
|
||||
#include "tool.h"
|
||||
|
||||
#define GIMP_TYPE_COLOR_PICKER (gimp_color_picker_get_type ())
|
||||
#define GIMP_COLOR_PICKER(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_COLOR_PICKER, GimpColorPicker))
|
||||
#define GIMP_IS_COLOR_PICKER(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_COLOR_PICKER))
|
||||
#define GIMP_COLOR_PICKER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_PICKER, GimpColorPickerClass))
|
||||
#define GIMP_IS_COLOR_PICKER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_PICKER))
|
||||
|
||||
GtkType gimp_color_picker_get_type (void);
|
||||
|
||||
struct _GimpColorPicker
|
||||
{
|
||||
GimpTool parent_instance;
|
||||
|
||||
DrawCore *core; /* Core select object */
|
||||
|
||||
gint centerx; /* starting x coord */
|
||||
gint centery; /* starting y coord */
|
||||
|
||||
};
|
||||
|
||||
struct _GimpColorPickerClass
|
||||
{
|
||||
GimpToolClass parent_class;
|
||||
};
|
||||
|
||||
typedef struct _GimpColorPicker GimpColorPicker; /* This is one of the stupidest parts of the gnu coding standards */
|
||||
typedef struct _GimpColorPickerClass GimpColorPickerClass; /* making the typedef and the struct one line like everyone else does confuses nobody */
|
||||
|
||||
extern gint col_value[5];
|
||||
|
||||
|
@ -32,8 +60,6 @@ gboolean pick_color (GimpImage *gimage,
|
|||
double average_radius,
|
||||
gint final);
|
||||
|
||||
Tool * tools_new_color_picker (void);
|
||||
void tools_free_color_picker (Tool *tool);
|
||||
|
||||
GimpTool * gimp_color_picker_new (void);
|
||||
|
||||
#endif /* __COLOR_PICKER_H__ */
|
||||
|
|
1690
app/tools/gimptool.c
Normal file
1690
app/tools/gimptool.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -16,55 +16,65 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __TOOLS_H__
|
||||
#define __TOOLS_H__
|
||||
|
||||
#ifndef __TOOL_H__
|
||||
#define __TOOL_H__
|
||||
|
||||
#include "gimpdrawable.h"
|
||||
#include "cursorutil.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_TOOL (gimp_tool_get_type ())
|
||||
#define GIMP_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_TOOL, GimpTool))
|
||||
#define GIMP_IS_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_TOOL))
|
||||
#define GIMP_TOOL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TOOL, GimpToolClass))
|
||||
#define GIMP_IS_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TOOL))
|
||||
|
||||
|
||||
/* The possibilities for where the cursor lies */
|
||||
#define ACTIVE_LAYER (1 << 0)
|
||||
#define SELECTION (1 << 1)
|
||||
#define NON_ACTIVE_LAYER (1 << 2)
|
||||
|
||||
typedef struct _GimpTool GimpTool;
|
||||
|
||||
/* Tool action function declarations */
|
||||
typedef void (* ButtonPressFunc) (Tool *tool,
|
||||
typedef void (* ButtonPressFunc) (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* ButtonReleaseFunc) (Tool *tool,
|
||||
typedef void (* ButtonReleaseFunc) (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* MotionFunc) (Tool *tool,
|
||||
typedef void (* MotionFunc) (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* ArrowKeysFunc) (Tool *tool,
|
||||
typedef void (* ArrowKeysFunc) (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* ModifierKeyFunc) (Tool *tool,
|
||||
typedef void (* ModifierKeyFunc) (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* CursorUpdateFunc) (Tool *tool,
|
||||
typedef void (* CursorUpdateFunc) (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* OperUpdateFunc) (Tool *tool,
|
||||
typedef void (* OperUpdateFunc) (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* ToolCtlFunc) (Tool *tool,
|
||||
ToolAction action,
|
||||
typedef void (* ToolCtlFunc) (GimpTool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp);
|
||||
|
||||
/* ToolInfo function declarations */
|
||||
typedef Tool * (* ToolInfoNewFunc) (void);
|
||||
typedef void (* ToolInfoFreeFunc) (Tool *tool);
|
||||
typedef void (* ToolInfoInitFunc) (GDisplay *gdisp);
|
||||
typedef GimpTool * (* GimpToolNewFunc) (void);
|
||||
typedef void (* GimpToolUnrefFunc) (GimpTool *tool);
|
||||
typedef void (* GimpToolInitFunc) (GimpTool *tool,
|
||||
GDisplay *gdisp);
|
||||
|
||||
typedef struct _GimpToolClass GimpToolClass;
|
||||
|
||||
/* The types of tools... */
|
||||
struct _Tool
|
||||
struct _GimpTool
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
/* Data */
|
||||
ToolType type; /* Tool type */
|
||||
gint ID; /* unique tool ID */
|
||||
|
||||
ToolState state; /* state of tool activity */
|
||||
gint paused_count; /* paused control count */
|
||||
|
@ -78,25 +88,19 @@ struct _Tool
|
|||
gboolean toggled; /* Bad hack to let the paint_core show the
|
||||
* right toggle cursors
|
||||
*/
|
||||
|
||||
|
||||
gpointer private; /* Tool-specific information */
|
||||
|
||||
/* Action functions */
|
||||
ButtonPressFunc button_press_func;
|
||||
ButtonReleaseFunc button_release_func;
|
||||
MotionFunc motion_func;
|
||||
ArrowKeysFunc arrow_keys_func;
|
||||
ModifierKeyFunc modifier_key_func;
|
||||
CursorUpdateFunc cursor_update_func;
|
||||
OperUpdateFunc oper_update_func;
|
||||
ToolCtlFunc control_func;
|
||||
PaintCore *paintcore;
|
||||
};
|
||||
|
||||
struct _ToolInfo
|
||||
struct _GimpToolClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
/* stuff to be filled in by child classes */
|
||||
|
||||
ToolOptions *tool_options;
|
||||
|
||||
gchar *pdb_string;
|
||||
|
||||
gchar *tool_name;
|
||||
|
||||
gchar *menu_path;
|
||||
|
@ -107,49 +111,56 @@ struct _ToolInfo
|
|||
GdkBitmap *icon_mask;
|
||||
|
||||
gchar *tool_desc;
|
||||
const gchar *private_tip;
|
||||
const gchar *help_data;
|
||||
|
||||
ToolType tool_id;
|
||||
|
||||
ToolInfoNewFunc new_func;
|
||||
ToolInfoFreeFunc free_func;
|
||||
ToolInfoInitFunc init_func;
|
||||
|
||||
GtkWidget *tool_widget;
|
||||
|
||||
GimpContext *tool_context;
|
||||
|
||||
BitmapCursor tool_cursor;
|
||||
BitmapCursor toggle_cursor;
|
||||
BitmapCursor *tool_cursor;
|
||||
BitmapCursor *toggle_cursor;
|
||||
|
||||
/* Action functions */
|
||||
ButtonPressFunc button_press_func;
|
||||
ButtonReleaseFunc button_release_func;
|
||||
MotionFunc motion_func;
|
||||
ArrowKeysFunc arrow_keys_func;
|
||||
ModifierKeyFunc modifier_key_func;
|
||||
CursorUpdateFunc cursor_update_func;
|
||||
OperUpdateFunc oper_update_func;
|
||||
ToolCtlFunc control_func;
|
||||
|
||||
|
||||
/* put lots of interesting signals here */
|
||||
ToolCtlFunc reserved1;
|
||||
ToolCtlFunc reserved2;
|
||||
ToolCtlFunc reserved3;
|
||||
};
|
||||
|
||||
|
||||
/* Function declarations */
|
||||
Tool * tools_new_tool (ToolType tool_type);
|
||||
GtkType gimp_tool_get_type (void);
|
||||
|
||||
void tools_select (ToolType tool_type);
|
||||
void tools_initialize (ToolType tool_type,
|
||||
GDisplay *gdisplay);
|
||||
GimpTool * gimp_tool_new (void);
|
||||
void gimp_tool_control (GimpTool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp);
|
||||
void gimp_tool_initialize (GimpTool *tool);
|
||||
void gimp_tool_old_initialize (GimpTool *tool,
|
||||
GDisplay *gdisplay);
|
||||
|
||||
gchar * gimp_tool_get_help_data (GimpTool *tool);
|
||||
void gimp_tool_help_func (const gchar *help_data);
|
||||
|
||||
void active_tool_control (ToolAction action,
|
||||
GDisplay *gdisp);
|
||||
void gimp_tool_show_options (GimpTool *tool);
|
||||
|
||||
void tools_help_func (const gchar *help_data);
|
||||
|
||||
void tools_register (ToolType tool_type,
|
||||
ToolOptions *tool_options);
|
||||
|
||||
gchar * tool_active_PDB_string (void);
|
||||
gchar * tool_get_PDB_string (GimpTool *tool);
|
||||
|
||||
/* don't unref these pixmaps, they are static! */
|
||||
GdkPixmap * tool_get_pixmap (ToolType tool_type);
|
||||
GdkBitmap * tool_get_mask (ToolType tool_type);
|
||||
GdkPixmap * gimp_tool_get_pixmap (GimpToolClass *tool);
|
||||
GdkBitmap * gimp_tool_get_mask (GimpToolClass *tool);
|
||||
|
||||
|
||||
/* Global Data Structures */
|
||||
extern Tool *active_tool;
|
||||
extern ToolInfo tool_info[];
|
||||
extern gint num_tools;
|
||||
|
||||
|
||||
#endif /* __TOOLS_H__ */
|
||||
#endif /* __TOOL_H__ */
|
|
@ -47,7 +47,7 @@
|
|||
#include "temp_buf.h"
|
||||
#include "tile.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tools.h"
|
||||
#include "tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -198,7 +198,7 @@ paint_core_sample_color (GimpDrawable *drawable,
|
|||
|
||||
|
||||
void
|
||||
paint_core_button_press (Tool *tool,
|
||||
paint_core_button_press (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
|
@ -208,7 +208,7 @@ paint_core_button_press (Tool *tool,
|
|||
gdouble x, y;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
paint_core = (PaintCore *) tool->private;
|
||||
paint_core = tool->paint_core;
|
||||
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
g_return_if_fail (paint_core != NULL);
|
||||
|
@ -380,7 +380,7 @@ paint_core_button_press (Tool *tool,
|
|||
}
|
||||
|
||||
void
|
||||
paint_core_button_release (Tool *tool,
|
||||
paint_core_button_release (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ paint_core_button_release (Tool *tool,
|
|||
PaintCore *paint_core;
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
paint_core = (PaintCore *) tool->private;
|
||||
paint_core = tool->paint_core;
|
||||
|
||||
/* resume the current selection and ungrab the pointer */
|
||||
gdisplays_selection_visibility (gdisp->gimage, SelectionResume);
|
||||
|
@ -413,13 +413,13 @@ paint_core_button_release (Tool *tool,
|
|||
}
|
||||
|
||||
void
|
||||
paint_core_motion (Tool *tool,
|
||||
paint_core_motion (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
PaintCore *paint_core;
|
||||
|
||||
paint_core = (PaintCore *) tool->private;
|
||||
paint_core = tool->paint_core;
|
||||
|
||||
gdisplay_untransform_coords_f (gdisp, (double) mevent->x, (double) mevent->y,
|
||||
&paint_core->curx, &paint_core->cury, TRUE);
|
||||
|
@ -479,7 +479,7 @@ paint_core_cursor_update (Tool *tool,
|
|||
CursorModifier cmodifier = CURSOR_MODIFIER_NONE;
|
||||
gboolean ctoggle = FALSE;
|
||||
|
||||
paint_core = (PaintCore *) tool->private;
|
||||
paint_core = tool->paint_core;
|
||||
|
||||
/* undraw the current tool */
|
||||
draw_core_pause (paint_core->core, tool);
|
||||
|
@ -633,14 +633,14 @@ paint_core_cursor_update (Tool *tool,
|
|||
}
|
||||
|
||||
void
|
||||
paint_core_control (Tool *tool,
|
||||
paint_core_control (GimpTool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
PaintCore *paint_core;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
paint_core = (PaintCore *) tool->private;
|
||||
paint_core = (PaintCore *) tool->paint_core;
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
switch (action)
|
||||
|
@ -663,13 +663,13 @@ paint_core_control (Tool *tool,
|
|||
}
|
||||
|
||||
void
|
||||
paint_core_draw (Tool *tool)
|
||||
paint_core_draw (GimpTool *tool)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
PaintCore *paint_core;
|
||||
gint tx1, ty1, tx2, ty2;
|
||||
|
||||
paint_core = (PaintCore *) tool->private;
|
||||
paint_core = tool->paint_core;
|
||||
|
||||
/* if shift was never used, paint_core->core->gc is NULL
|
||||
and we don't care about a redraw */
|
||||
|
@ -723,9 +723,9 @@ paint_core_draw (Tool *tool)
|
|||
}
|
||||
|
||||
Tool *
|
||||
paint_core_new (ToolType type)
|
||||
paint_core_new (GimpToolClas *type)
|
||||
{
|
||||
Tool *tool;
|
||||
GimpTool *tool;
|
||||
PaintCore *private;
|
||||
|
||||
tool = tools_new_tool (type);
|
||||
|
@ -748,11 +748,11 @@ paint_core_new (ToolType type)
|
|||
}
|
||||
|
||||
void
|
||||
paint_core_free (Tool *tool)
|
||||
paint_core_free (GimpTool *tool)
|
||||
{
|
||||
PaintCore * paint_core;
|
||||
|
||||
paint_core = (PaintCore *) tool->private;
|
||||
paint_core = (PaintCore *) tool->paint_core;
|
||||
|
||||
/* Make sure the selection core is not visible */
|
||||
if (tool->state == ACTIVE && paint_core->core)
|
||||
|
|
1690
app/tools/tool.c
Normal file
1690
app/tools/tool.c
Normal file
File diff suppressed because it is too large
Load diff
166
app/tools/tool.h
Normal file
166
app/tools/tool.h
Normal file
|
@ -0,0 +1,166 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#ifndef __TOOL_H__
|
||||
#define __TOOL_H__
|
||||
|
||||
#include "gimpdrawable.h"
|
||||
#include "cursorutil.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_TOOL (gimp_tool_get_type ())
|
||||
#define GIMP_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_TOOL, GimpTool))
|
||||
#define GIMP_IS_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_TOOL))
|
||||
#define GIMP_TOOL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TOOL, GimpToolClass))
|
||||
#define GIMP_IS_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TOOL))
|
||||
|
||||
|
||||
/* The possibilities for where the cursor lies */
|
||||
#define ACTIVE_LAYER (1 << 0)
|
||||
#define SELECTION (1 << 1)
|
||||
#define NON_ACTIVE_LAYER (1 << 2)
|
||||
|
||||
typedef struct _GimpTool GimpTool;
|
||||
|
||||
/* Tool action function declarations */
|
||||
typedef void (* ButtonPressFunc) (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* ButtonReleaseFunc) (GimpTool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* MotionFunc) (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* ArrowKeysFunc) (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* ModifierKeyFunc) (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* CursorUpdateFunc) (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* OperUpdateFunc) (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
typedef void (* ToolCtlFunc) (GimpTool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp);
|
||||
|
||||
typedef GimpTool * (* GimpToolNewFunc) (void);
|
||||
typedef void (* GimpToolUnrefFunc) (GimpTool *tool);
|
||||
typedef void (* GimpToolInitFunc) (GimpTool *tool,
|
||||
GDisplay *gdisp);
|
||||
|
||||
typedef struct _GimpToolClass GimpToolClass;
|
||||
|
||||
/* The types of tools... */
|
||||
struct _GimpTool
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
/* Data */
|
||||
|
||||
ToolState state; /* state of tool activity */
|
||||
gint paused_count; /* paused control count */
|
||||
gboolean scroll_lock; /* allow scrolling or not */
|
||||
gboolean auto_snap_to; /* snap to guides automatically */
|
||||
|
||||
gboolean preserve; /* Preserve this tool across drawable changes */
|
||||
GDisplay *gdisp; /* pointer to currently active gdisp */
|
||||
GimpDrawable *drawable; /* pointer to the tool's current drawable */
|
||||
|
||||
gboolean toggled; /* Bad hack to let the paint_core show the
|
||||
* right toggle cursors
|
||||
*/
|
||||
PaintCore *paintcore;
|
||||
};
|
||||
|
||||
struct _GimpToolClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
/* stuff to be filled in by child classes */
|
||||
|
||||
ToolOptions *tool_options;
|
||||
|
||||
gchar *pdb_string;
|
||||
|
||||
gchar *tool_name;
|
||||
|
||||
gchar *menu_path;
|
||||
gchar *menu_accel;
|
||||
|
||||
gchar **icon_data;
|
||||
GdkPixmap *icon_pixmap;
|
||||
GdkBitmap *icon_mask;
|
||||
|
||||
gchar *tool_desc;
|
||||
const gchar *help_data;
|
||||
|
||||
ToolType tool_id;
|
||||
|
||||
GtkWidget *tool_widget;
|
||||
|
||||
GimpContext *tool_context;
|
||||
|
||||
BitmapCursor *tool_cursor;
|
||||
BitmapCursor *toggle_cursor;
|
||||
|
||||
/* Action functions */
|
||||
ButtonPressFunc button_press_func;
|
||||
ButtonReleaseFunc button_release_func;
|
||||
MotionFunc motion_func;
|
||||
ArrowKeysFunc arrow_keys_func;
|
||||
ModifierKeyFunc modifier_key_func;
|
||||
CursorUpdateFunc cursor_update_func;
|
||||
OperUpdateFunc oper_update_func;
|
||||
ToolCtlFunc control_func;
|
||||
|
||||
|
||||
/* put lots of interesting signals here */
|
||||
ToolCtlFunc reserved1;
|
||||
ToolCtlFunc reserved2;
|
||||
ToolCtlFunc reserved3;
|
||||
};
|
||||
|
||||
|
||||
/* Function declarations */
|
||||
GtkType gimp_tool_get_type (void);
|
||||
|
||||
GimpTool * gimp_tool_new (void);
|
||||
void gimp_tool_control (GimpTool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp);
|
||||
void gimp_tool_initialize (GimpTool *tool);
|
||||
void gimp_tool_old_initialize (GimpTool *tool,
|
||||
GDisplay *gdisplay);
|
||||
|
||||
gchar * gimp_tool_get_help_data (GimpTool *tool);
|
||||
void gimp_tool_help_func (const gchar *help_data);
|
||||
|
||||
void gimp_tool_show_options (GimpTool *tool);
|
||||
|
||||
gchar * tool_get_PDB_string (GimpTool *tool);
|
||||
|
||||
/* don't unref these pixmaps, they are static! */
|
||||
GdkPixmap * gimp_tool_get_pixmap (GimpToolClass *tool);
|
||||
GdkBitmap * gimp_tool_get_mask (GimpToolClass *tool);
|
||||
|
||||
|
||||
#endif /* __TOOL_H__ */
|
|
@ -1,4 +1,4 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
/*
|
||||
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -23,7 +23,7 @@
|
|||
#include "apptypes.h"
|
||||
|
||||
#include "tool_options.h"
|
||||
#include "tools.h"
|
||||
#include "tool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
|
|
@ -19,28 +19,42 @@
|
|||
#ifndef __TOOL_OPTIONS_H__
|
||||
#define __TOOL_OPTIONS_H__
|
||||
|
||||
#include "gimpobject.h"
|
||||
|
||||
#define GIMP_TYPE_TOOL_OPTIONS (gimp_tool_options_get_type ())
|
||||
#define GIMP_TOOL_OPTIONS(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_TOOL_OPTIONS, GimpToolOptions))
|
||||
#define GIMP_IS_TOOL_OPTIONS(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_TOOL_OPTIONS))
|
||||
#define GIMP_TOOL_OPTIONS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TOOL_OPTIONS, GimpToolOptionsClass))
|
||||
#define GIMP_IS_TOOL_OPTIONS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TOOL_OPTIONS))
|
||||
|
||||
/* the tool options structures */
|
||||
|
||||
struct _ToolOptions
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
GtkWidget *main_vbox;
|
||||
const gchar *title;
|
||||
gchar *title;
|
||||
|
||||
ToolOptionsResetFunc reset_func;
|
||||
};
|
||||
|
||||
struct _ToolOptionsClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
};
|
||||
|
||||
typedef struct _ToolOptionsClass ToolOptionsClass;
|
||||
|
||||
/* create a dummy tool options structure
|
||||
* (to be used by tools without options)
|
||||
*/
|
||||
ToolOptions * tool_options_new (const gchar *title);
|
||||
ToolOptions * tool_options_new (const gchar *title);
|
||||
|
||||
/* initialize an already allocated ToolOptions structure
|
||||
* (to be used by derived tool options only)
|
||||
*/
|
||||
void tool_options_init (ToolOptions *options,
|
||||
const gchar *title,
|
||||
const gchar *title,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
|
||||
#include "tool_options.h"
|
||||
#include "tool_options_dialog.h"
|
||||
#include "tools.h"
|
||||
#include "tool.h"
|
||||
#include "tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
|
1534
app/tools/tools.c
1534
app/tools/tools.c
File diff suppressed because it is too large
Load diff
1723
app/transform_core.c
Normal file
1723
app/transform_core.c
Normal file
File diff suppressed because it is too large
Load diff
12
app/undo.c
12
app/undo.c
|
@ -47,7 +47,7 @@
|
|||
|
||||
#include "tools/by_color_select.h"
|
||||
#include "tools/paint_core.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
#include "tools/transform_core.h"
|
||||
|
||||
#include "libgimp/gimpparasite.h"
|
||||
|
@ -1268,6 +1268,9 @@ undo_pop_transform (GimpImage *gimage,
|
|||
gdouble d;
|
||||
gint i;
|
||||
|
||||
|
||||
#warning very bogus
|
||||
#if 0
|
||||
/* Can't have ANY tool selected - maybe a plugin running */
|
||||
if (active_tool == NULL)
|
||||
return TRUE;
|
||||
|
@ -1301,7 +1304,7 @@ undo_pop_transform (GimpImage *gimage,
|
|||
active_tool->state = ACTIVE;
|
||||
draw_core_resume (tc->core, active_tool);
|
||||
}
|
||||
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1346,7 +1349,8 @@ undo_push_paint (GimpImage *gimage,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#warning super bogosity error
|
||||
#if 0
|
||||
static gboolean
|
||||
undo_pop_paint (GimpImage *gimage,
|
||||
UndoState state,
|
||||
|
@ -1391,7 +1395,7 @@ undo_pop_paint (GimpImage *gimage,
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
undo_free_paint (UndoState state,
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
#include "cursorutil.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "gdisplay.h" /* for gdisplay_*_override_cursor() */
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "cursors/mouse.xbm"
|
||||
#include "cursors/mouse_mask.xbm"
|
||||
|
@ -319,7 +318,8 @@ gimp_change_win_cursor (GdkWindow *win,
|
|||
modtype -= GIMP_PLUS_CURSOR;
|
||||
bmmodifier = &modifier_cursors[(int)modtype];
|
||||
}
|
||||
|
||||
#warning Im obsolete
|
||||
#if 0
|
||||
if (tool_type != TOOL_TYPE_NONE)
|
||||
{
|
||||
if (toggle_cursor)
|
||||
|
@ -335,6 +335,7 @@ gimp_change_win_cursor (GdkWindow *win,
|
|||
bmtool = &tool_info[(gint) tool_type].tool_cursor;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bmcursor->bitmap == NULL ||
|
||||
bmcursor->mask == NULL)
|
||||
|
|
|
@ -42,9 +42,7 @@
|
|||
#include "gimplist.h"
|
||||
#include "gimprc.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
|
||||
#include "tools/tool.h"
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -119,10 +117,10 @@ static void devices_close_callback (GtkWidget *widget,
|
|||
static void device_status_update (guint32 deviceid);
|
||||
static void device_status_update_current (void);
|
||||
|
||||
static ToolType device_status_drag_tool (GtkWidget *widget,
|
||||
static GimpTool *device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data);
|
||||
static void device_status_foreground_changed (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
@ -365,7 +363,7 @@ devices_rc_update (gchar *name,
|
|||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
gchar *brush_name,
|
||||
|
@ -682,8 +680,12 @@ devices_write_rc_device (DeviceInfo *device_info,
|
|||
if (gimp_context_get_tool (device_info->context) >= FIRST_TOOLBOX_TOOL &&
|
||||
gimp_context_get_tool (device_info->context) <= LAST_TOOLBOX_TOOL)
|
||||
{
|
||||
|
||||
#warning somebody fix me, please
|
||||
#if 0
|
||||
fprintf (fp, "\n (tool \"%s\")",
|
||||
tool_info[gimp_context_get_tool (device_info->context)].tool_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -827,8 +829,8 @@ device_status_create (void)
|
|||
|
||||
deviceD->eventboxes[i] = gtk_event_box_new ();
|
||||
|
||||
deviceD->tools[i] = gtk_pixmap_new (tool_get_pixmap (RECT_SELECT),
|
||||
tool_get_mask (RECT_SELECT));
|
||||
deviceD->tools[i] = gtk_pixmap_new (gimp_tool_get_pixmap (RECT_SELECT),
|
||||
gimp_tool_get_mask (RECT_SELECT));
|
||||
|
||||
gtk_drag_source_set (deviceD->eventboxes[i],
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
|
||||
|
@ -1076,17 +1078,19 @@ device_status_update (guint32 deviceid)
|
|||
gtk_widget_show (deviceD->frames[i]);
|
||||
|
||||
gtk_pixmap_set (GTK_PIXMAP (deviceD->tools[i]),
|
||||
tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
gimp_tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
gimp_tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
gtk_widget_show (deviceD->eventboxes[i]);
|
||||
|
||||
#warning fixme
|
||||
#if 0
|
||||
gimp_help_set_help_data (deviceD->eventboxes[i],
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].tool_desc,
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].private_tip);
|
||||
|
||||
#endif
|
||||
/* foreground color */
|
||||
gimp_context_get_foreground (device_info->context, &color);
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (deviceD->foregrounds[i]),
|
||||
|
@ -1134,7 +1138,7 @@ device_status_update (guint32 deviceid)
|
|||
|
||||
/* dnd stuff */
|
||||
|
||||
static ToolType
|
||||
static GimpTool *
|
||||
device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -1154,7 +1158,7 @@ device_status_drag_tool (GtkWidget *widget,
|
|||
|
||||
static void
|
||||
device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
|
|
|
@ -42,9 +42,7 @@
|
|||
#include "gimplist.h"
|
||||
#include "gimprc.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
|
||||
#include "tools/tool.h"
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -119,10 +117,10 @@ static void devices_close_callback (GtkWidget *widget,
|
|||
static void device_status_update (guint32 deviceid);
|
||||
static void device_status_update_current (void);
|
||||
|
||||
static ToolType device_status_drag_tool (GtkWidget *widget,
|
||||
static GimpTool *device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data);
|
||||
static void device_status_foreground_changed (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
@ -365,7 +363,7 @@ devices_rc_update (gchar *name,
|
|||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
gchar *brush_name,
|
||||
|
@ -682,8 +680,12 @@ devices_write_rc_device (DeviceInfo *device_info,
|
|||
if (gimp_context_get_tool (device_info->context) >= FIRST_TOOLBOX_TOOL &&
|
||||
gimp_context_get_tool (device_info->context) <= LAST_TOOLBOX_TOOL)
|
||||
{
|
||||
|
||||
#warning somebody fix me, please
|
||||
#if 0
|
||||
fprintf (fp, "\n (tool \"%s\")",
|
||||
tool_info[gimp_context_get_tool (device_info->context)].tool_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -827,8 +829,8 @@ device_status_create (void)
|
|||
|
||||
deviceD->eventboxes[i] = gtk_event_box_new ();
|
||||
|
||||
deviceD->tools[i] = gtk_pixmap_new (tool_get_pixmap (RECT_SELECT),
|
||||
tool_get_mask (RECT_SELECT));
|
||||
deviceD->tools[i] = gtk_pixmap_new (gimp_tool_get_pixmap (RECT_SELECT),
|
||||
gimp_tool_get_mask (RECT_SELECT));
|
||||
|
||||
gtk_drag_source_set (deviceD->eventboxes[i],
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
|
||||
|
@ -1076,17 +1078,19 @@ device_status_update (guint32 deviceid)
|
|||
gtk_widget_show (deviceD->frames[i]);
|
||||
|
||||
gtk_pixmap_set (GTK_PIXMAP (deviceD->tools[i]),
|
||||
tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
gimp_tool_get_pixmap (gimp_context_get_tool (device_info->context)),
|
||||
gimp_tool_get_mask (gimp_context_get_tool (device_info->context)));
|
||||
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
gtk_widget_show (deviceD->eventboxes[i]);
|
||||
|
||||
#warning fixme
|
||||
#if 0
|
||||
gimp_help_set_help_data (deviceD->eventboxes[i],
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].tool_desc,
|
||||
tool_info[(gint) gimp_context_get_tool (device_info->context)].private_tip);
|
||||
|
||||
#endif
|
||||
/* foreground color */
|
||||
gimp_context_get_foreground (device_info->context, &color);
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (deviceD->foregrounds[i]),
|
||||
|
@ -1134,7 +1138,7 @@ device_status_update (guint32 deviceid)
|
|||
|
||||
/* dnd stuff */
|
||||
|
||||
static ToolType
|
||||
static GimpTool *
|
||||
device_status_drag_tool (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -1154,7 +1158,7 @@ device_status_drag_tool (GtkWidget *widget,
|
|||
|
||||
static void
|
||||
device_status_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef __DEVICES_H__
|
||||
#define __DEVICES_H__
|
||||
|
||||
#include "tools/tool.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -61,7 +62,7 @@ void devices_rc_update (gchar *name,
|
|||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
gchar *brush_name,
|
||||
|
|
|
@ -41,8 +41,7 @@
|
|||
#include "gimppreview.h"
|
||||
#include "gimprc.h"
|
||||
#include "temp_buf.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool.h"
|
||||
|
||||
#include "libgimp/gimplimits.h"
|
||||
|
||||
|
@ -991,6 +990,7 @@ gimp_dnd_get_gradient_icon (GtkWidget *widget,
|
|||
0,
|
||||
TRUE, FALSE, FALSE);
|
||||
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
|
@ -1195,13 +1195,16 @@ gimp_dnd_get_tool_icon (GtkWidget *widget,
|
|||
|
||||
tool_type = (* (GimpDndDragToolFunc) get_tool_func) (widget, get_tool_data);
|
||||
|
||||
#warning obsolete
|
||||
#if 0
|
||||
if (((gint) tool_type < 0) || ((gint) tool_type >= num_tools))
|
||||
return NULL;
|
||||
|
||||
tool_icon = gtk_pixmap_new (tool_get_pixmap (tool_type),
|
||||
tool_get_mask (tool_type));
|
||||
tool_icon = gtk_pixmap_new (gimp_tool_get_pixmap (tool_type),
|
||||
gimp_tool_get_mask (tool_type));
|
||||
|
||||
return tool_icon;
|
||||
#endif
|
||||
}
|
||||
|
||||
static guchar *
|
||||
|
@ -1216,9 +1219,11 @@ gimp_dnd_get_tool_data (GtkWidget *widget,
|
|||
|
||||
tool_type = (* (GimpDndDragToolFunc) get_tool_func) (widget, get_tool_data);
|
||||
|
||||
#warning yet another
|
||||
#if 0
|
||||
if (((gint) tool_type < 0) || ((gint) tool_type >= num_tools))
|
||||
return NULL;
|
||||
|
||||
#endif
|
||||
val = g_new (guint16, 1);
|
||||
|
||||
val[0] = (guint16) tool_type;
|
||||
|
@ -1249,9 +1254,11 @@ gimp_dnd_set_tool_data (GtkWidget *widget,
|
|||
val = *((guint16 *) vals);
|
||||
|
||||
tool_type = (ToolType) val;
|
||||
|
||||
#warning nothing special
|
||||
#if 0
|
||||
if (((gint) tool_type < 0) || ((gint) tool_type >= num_tools))
|
||||
return;
|
||||
#endif
|
||||
|
||||
(* (GimpDndDropToolFunc) set_tool_func) (widget, tool_type, set_tool_data);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "preferences_dialog.h"
|
||||
#include "toolbox.h"
|
||||
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
|
@ -1224,10 +1224,9 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
|
||||
static void
|
||||
menus_tools_create (ToolInfo *tool_info)
|
||||
menus_tools_create (GimpToolClass *tool_info)
|
||||
{
|
||||
GimpItemFactoryEntry entry;
|
||||
|
||||
if (tool_info->menu_path == NULL)
|
||||
return;
|
||||
|
||||
|
@ -1236,7 +1235,7 @@ menus_tools_create (ToolInfo *tool_info)
|
|||
entry.entry.callback = tools_select_cmd_callback;
|
||||
entry.entry.callback_action = tool_info->tool_id;
|
||||
entry.entry.item_type = NULL;
|
||||
entry.help_page = tool_info->private_tip;
|
||||
entry.help_page = tool_info->help_data;
|
||||
entry.description = NULL;
|
||||
|
||||
menus_create_item (image_factory, &entry, (gpointer) tool_info, 2);
|
||||
|
@ -1686,6 +1685,8 @@ menus_init (void)
|
|||
GtkWidget *menu_item;
|
||||
gchar *filename;
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *klass;
|
||||
|
||||
if (menus_initialized)
|
||||
return;
|
||||
|
@ -1765,13 +1766,15 @@ menus_init (void)
|
|||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
menus_tools_create (&tool_info[i]);
|
||||
}
|
||||
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
menus_tools_create (tools->data);
|
||||
}
|
||||
/* reorder <Image>/Image/Colors */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
#warning fixme
|
||||
#if 0
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
tool_info[POSTERIZE].menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
|
||||
|
@ -1802,7 +1805,6 @@ menus_init (void)
|
|||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
separator = gtk_menu_item_new ();
|
||||
|
@ -1811,6 +1813,7 @@ menus_init (void)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "tile_manager.h"
|
||||
|
||||
#include "tools/tool_options_dialog.h"
|
||||
#include "tools/tools.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -82,10 +82,10 @@ static gboolean toolbox_drag_drop (GtkWidget *widget,
|
|||
gint x,
|
||||
gint y,
|
||||
guint time);
|
||||
static ToolType toolbox_drag_tool (GtkWidget *widget,
|
||||
static GimpTool * toolbox_drag_tool (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void toolbox_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data);
|
||||
|
||||
|
||||
|
@ -134,11 +134,11 @@ static void
|
|||
tools_select_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ToolType tool_type;
|
||||
GimpToolClass *tool_type;
|
||||
|
||||
tool_type = (ToolType) data;
|
||||
tool_type = GIMP_TOOL_CLASS (data);
|
||||
|
||||
if ((tool_type != -1) && GTK_TOGGLE_BUTTON (widget)->active)
|
||||
if ((tool_type) && GTK_TOGGLE_BUTTON (widget)->active)
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool_type);
|
||||
}
|
||||
|
||||
|
@ -287,20 +287,22 @@ create_color_area (GtkWidget *parent)
|
|||
static void
|
||||
create_tool_pixmaps (GtkWidget *parent)
|
||||
{
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *tool;
|
||||
|
||||
g_return_if_fail (parent != NULL);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
if (tool_info[i].icon_data)
|
||||
tool_info[i].icon_pixmap = create_pixmap (parent->window,
|
||||
&tool_info[i].icon_mask,
|
||||
tool_info[i].icon_data,
|
||||
tool = GIMP_TOOL_CLASS (tools->data);
|
||||
if (tool->icon_data)
|
||||
tool->icon_pixmap = create_pixmap (parent->window,
|
||||
&tool->icon_mask,
|
||||
tool->icon_data,
|
||||
22, 22);
|
||||
else
|
||||
tool_info[i].icon_pixmap = create_pixmap (parent->window,
|
||||
&tool_info[i].icon_mask,
|
||||
tool->icon_pixmap = create_pixmap (parent->window,
|
||||
&tool->icon_mask,
|
||||
dialog_bits,
|
||||
22, 22);
|
||||
}
|
||||
|
@ -313,7 +315,8 @@ create_tools (GtkWidget *parent)
|
|||
GtkWidget *button;
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *pixmap;
|
||||
GSList *group;
|
||||
GSList *group, *tools;
|
||||
GimpToolClass *tool;
|
||||
gint i, j;
|
||||
|
||||
wbox = parent;
|
||||
|
@ -326,12 +329,10 @@ create_tools (GtkWidget *parent)
|
|||
group = NULL;
|
||||
|
||||
i = 0;
|
||||
for (j = 0; j < num_tools; j++)
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
if (j <= LAST_TOOLBOX_TOOL &&
|
||||
j != SCALE && j!= SHEAR && j != PERSPECTIVE)
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
tool = GIMP_TOOL_CLASS(tools->data);
|
||||
tool->tool_widget = button = gtk_radio_button_new (group);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (button), 0);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
|
@ -344,44 +345,33 @@ create_tools (GtkWidget *parent)
|
|||
gtk_container_set_border_width (GTK_CONTAINER (alignment), 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), alignment);
|
||||
|
||||
pixmap = gtk_pixmap_new (tool_get_pixmap ((ToolType)j),
|
||||
tool_get_mask ((ToolType)j));
|
||||
pixmap = gtk_pixmap_new (gimp_tool_get_pixmap (tool),
|
||||
gimp_tool_get_mask (tool));
|
||||
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (tools_select_update),
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
(gpointer) tool);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (tools_button_press),
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
(gpointer) tool);
|
||||
|
||||
/* dnd stuff */
|
||||
gtk_drag_source_set (tool_info[j].tool_widget,
|
||||
gtk_drag_source_set (tool->tool_widget,
|
||||
GDK_BUTTON2_MASK,
|
||||
tool_target_table, tool_n_targets,
|
||||
GDK_ACTION_COPY);
|
||||
gimp_dnd_tool_source_set (tool_info[j].tool_widget,
|
||||
toolbox_drag_tool, (gpointer) j);
|
||||
gimp_dnd_tool_source_set (tool->tool_widget,
|
||||
toolbox_drag_tool, tool);
|
||||
|
||||
gimp_help_set_help_data (button,
|
||||
gettext(tool_info[j].tool_desc),
|
||||
tool_info[j].private_tip);
|
||||
gettext(tool->tool_desc),
|
||||
tool->help_data);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (alignment);
|
||||
gtk_widget_show (button);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tools_select_update),
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_show (wbox);
|
||||
|
@ -582,18 +572,20 @@ toolbox_create (void)
|
|||
void
|
||||
toolbox_free (void)
|
||||
{
|
||||
gint i;
|
||||
GSList *tools;
|
||||
GimpToolClass *tool;
|
||||
|
||||
session_get_window_info (toolbox_shell, &toolbox_session_info);
|
||||
|
||||
gtk_widget_destroy (toolbox_shell);
|
||||
for (i = 0; i < num_tools; i++)
|
||||
for (tools = registered_tools; tools; tools=tools->next)
|
||||
{
|
||||
if (tool_info[i].icon_pixmap)
|
||||
gdk_pixmap_unref (tool_info[i].icon_pixmap);
|
||||
tool = GIMP_TOOL_CLASS (tools->data);
|
||||
if (tool->icon_pixmap)
|
||||
gdk_pixmap_unref (tool->icon_pixmap);
|
||||
|
||||
if (!tool_info[i].icon_data)
|
||||
gtk_object_sink (GTK_OBJECT (tool_info[i].tool_widget));
|
||||
if (!tool->icon_data)
|
||||
gtk_object_sink (GTK_OBJECT (tool->tool_widget));
|
||||
}
|
||||
gimp_help_free ();
|
||||
}
|
||||
|
@ -804,16 +796,16 @@ toolbox_drag_drop (GtkWidget *widget,
|
|||
return return_val;
|
||||
}
|
||||
|
||||
static ToolType
|
||||
static GimpTool *
|
||||
toolbox_drag_tool (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
return (ToolType) data;
|
||||
return GIMP_TOOL(data);
|
||||
}
|
||||
|
||||
static void
|
||||
toolbox_drop_tool (GtkWidget *widget,
|
||||
ToolType tool,
|
||||
GimpTool *tool,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_context_set_tool (gimp_context_get_user (), tool);
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
|
||||
#include "tool_options.h"
|
||||
#include "tool_options_dialog.h"
|
||||
#include "tools.h"
|
||||
#include "tool.h"
|
||||
#include "tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
|
|
@ -826,6 +826,7 @@ plug-ins/print/escputil.1
|
|||
plug-ins/rcm/Makefile
|
||||
plug-ins/sel2path/Makefile
|
||||
plug-ins/sgi/Makefile
|
||||
plug-ins/plugin-helper/Makefile
|
||||
modules/Makefile
|
||||
modules/makefile.mingw
|
||||
cursors/Makefile
|
||||
|
|
|
@ -1032,17 +1032,17 @@ gimp_config (GPConfig *config)
|
|||
|
||||
if (config->version < GP_VERSION)
|
||||
{
|
||||
g_message ("Could not execute Plug-In \"%s\"\n(%s)\n\n"
|
||||
"The GIMP is using an older version of the "
|
||||
"Plug-In protocol than this Plug-In.",
|
||||
g_message ("Could not execute plug-in \"%s\"\n(%s)"
|
||||
"because the GIMP is using an older version of the "
|
||||
"plug-in protocol.",
|
||||
g_basename (progname), progname);
|
||||
gimp_quit ();
|
||||
}
|
||||
else if (config->version > GP_VERSION)
|
||||
{
|
||||
g_message ("Could not execute Plug-In \"%s\"\n(%s)\n\n"
|
||||
"The GIMP is using an older version of the "
|
||||
"Plug-In protocol than this Plug-In.",
|
||||
g_message ("Could not execute plug-in \"%s\"\n(%s)"
|
||||
"because it uses an obsolete version of the "
|
||||
"plug-in protocol.",
|
||||
g_basename (progname), progname);
|
||||
gimp_quit ();
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ SUBDIRS = \
|
|||
sel2path \
|
||||
$(WEBBROWSER) \
|
||||
$(XJT) \
|
||||
plugin-helper \
|
||||
common
|
||||
|
||||
.PHONY: files
|
||||
|
|
32
plug-ins/plugin-helper/Makefile.am
Normal file
32
plug-ins/plugin-helper/Makefile.am
Normal file
|
@ -0,0 +1,32 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
libexecdir = $(gimpplugindir)/plug-ins
|
||||
|
||||
libexec_PROGRAMS = plugin-helper
|
||||
|
||||
plugin_helper_SOURCES = \
|
||||
plugin-helper.c
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DLOCALEDIR=\""$(localedir)"\"
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimpwidgets/libgimpwidgets.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(top_builddir)/libgimpcolor/libgimpcolor.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
820
plug-ins/plugin-helper/color_picker.c
Normal file
820
plug-ins/plugin-helper/color_picker.c
Normal file
|
@ -0,0 +1,820 @@
|
|||
/* 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>
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "libgimp/gimpcolorarea.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "color_picker.h"
|
||||
#include "draw_core.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimpui.h"
|
||||
#include "gimprc.h"
|
||||
#include "cursorutil.h"
|
||||
#include "info_dialog.h"
|
||||
#include "palette.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* maximum information buffer size */
|
||||
#define MAX_INFO_BUF 8
|
||||
|
||||
/* the color picker structures */
|
||||
|
||||
typedef struct _ColorPickerOptions ColorPickerOptions;
|
||||
|
||||
struct _ColorPickerOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
gboolean sample_merged;
|
||||
gboolean sample_merged_d;
|
||||
GtkWidget *sample_merged_w;
|
||||
|
||||
gboolean sample_average;
|
||||
gboolean sample_average_d;
|
||||
GtkWidget *sample_average_w;
|
||||
|
||||
gdouble average_radius;
|
||||
gdouble average_radius_d;
|
||||
GtkObject *average_radius_w;
|
||||
|
||||
gboolean update_active;
|
||||
gboolean update_active_d;
|
||||
GtkWidget *update_active_w;
|
||||
};
|
||||
|
||||
typedef struct _ColorPickerTool ColorPickerTool;
|
||||
|
||||
struct _ColorPickerTool
|
||||
{
|
||||
DrawCore *core; /* Core select object */
|
||||
|
||||
gint centerx; /* starting x coord */
|
||||
gint centery; /* starting y coord */
|
||||
};
|
||||
|
||||
/* the color picker tool options */
|
||||
static ColorPickerOptions * color_picker_options = NULL;
|
||||
|
||||
/* the color value */
|
||||
gint col_value[5] = { 0, 0, 0, 0, 0 };
|
||||
|
||||
/* the color picker dialog */
|
||||
static gint update_type;
|
||||
static GimpImageType sample_type;
|
||||
static InfoDialog *color_picker_info = NULL;
|
||||
static GtkWidget *color_area = NULL;
|
||||
static gchar red_buf [MAX_INFO_BUF];
|
||||
static gchar green_buf [MAX_INFO_BUF];
|
||||
static gchar blue_buf [MAX_INFO_BUF];
|
||||
static gchar alpha_buf [MAX_INFO_BUF];
|
||||
static gchar index_buf [MAX_INFO_BUF];
|
||||
static gchar gray_buf [MAX_INFO_BUF];
|
||||
static gchar hex_buf [MAX_INFO_BUF];
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void color_picker_button_press (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
static void color_picker_button_release (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp);
|
||||
static void color_picker_motion (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
static void color_picker_cursor_update (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
static void color_picker_control (Tool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp);
|
||||
|
||||
static void color_picker_info_window_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_picker_info_update (Tool *tool,
|
||||
gboolean valid);
|
||||
|
||||
static gboolean pick_color_do (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean sample_merged,
|
||||
gboolean sample_average,
|
||||
gdouble average_radius,
|
||||
gboolean update_active,
|
||||
gint final);
|
||||
|
||||
/* functions */
|
||||
|
||||
static void
|
||||
color_picker_options_reset (void)
|
||||
{
|
||||
ColorPickerOptions *options = color_picker_options;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
|
||||
options->sample_merged_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_average_w),
|
||||
options->sample_average_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->average_radius_w),
|
||||
options->average_radius_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->update_active_w),
|
||||
options->update_active_d);
|
||||
}
|
||||
|
||||
static ColorPickerOptions *
|
||||
color_picker_options_new (void)
|
||||
{
|
||||
ColorPickerOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
|
||||
/* the new color picker tool options structure */
|
||||
options = g_new (ColorPickerOptions, 1);
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Color Picker"),
|
||||
color_picker_options_reset);
|
||||
options->sample_merged = options->sample_merged_d = FALSE;
|
||||
options->sample_average = options->sample_average_d = FALSE;
|
||||
options->average_radius = options->average_radius_d = 1.0;
|
||||
options->update_active = options->update_active_d = TRUE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the sample merged toggle button */
|
||||
options->sample_merged_w =
|
||||
gtk_check_button_new_with_label (_("Sample Merged"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
|
||||
options->sample_merged_d);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled",
|
||||
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
||||
&options->sample_merged);
|
||||
gtk_widget_show (options->sample_merged_w);
|
||||
|
||||
/* the sample average options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
options->sample_average_w =
|
||||
gtk_check_button_new_with_label (_("Sample Average"));
|
||||
gtk_table_attach (GTK_TABLE (table), options->sample_average_w, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_average_w),
|
||||
options->sample_average_d);
|
||||
gtk_signal_connect (GTK_OBJECT (options->sample_average_w), "toggled",
|
||||
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
||||
&options->sample_average);
|
||||
gtk_widget_show (options->sample_average_w);
|
||||
|
||||
label = gtk_label_new (_("Radius:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* the feather radius scale */
|
||||
abox = gtk_alignment_new (0.5, 1.0, 1.0, 0.0);
|
||||
gtk_table_attach (GTK_TABLE (table), abox, 1, 2, 0, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->average_radius_w =
|
||||
gtk_adjustment_new (options->average_radius_d, 1.0, 15.0, 2.0, 2.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->average_radius_w));
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_container_add (GTK_CONTAINER (abox), scale);
|
||||
gtk_widget_set_sensitive (scale, options->sample_average_d);
|
||||
gtk_object_set_data (GTK_OBJECT (options->sample_average_w), "set_sensitive",
|
||||
scale);
|
||||
gtk_widget_set_sensitive (label, options->sample_average_d);
|
||||
gtk_object_set_data (GTK_OBJECT (scale), "set_sensitive",
|
||||
label);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (options->average_radius_w), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
|
||||
&options->average_radius);
|
||||
gtk_widget_show (scale);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* the update active color toggle button */
|
||||
options->update_active_w =
|
||||
gtk_check_button_new_with_label (_("Update Active Color"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->update_active_w),
|
||||
options->update_active_d);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->update_active_w, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (options->update_active_w), "toggled",
|
||||
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
||||
&options->update_active);
|
||||
gtk_widget_show (options->update_active_w);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
static void
|
||||
color_picker_button_press (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
gint x, y;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
|
||||
/* Make the tool active and set it's gdisplay & drawable */
|
||||
tool->gdisp = gdisp;
|
||||
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
tool->state = ACTIVE;
|
||||
|
||||
/* create the info dialog if it doesn't exist */
|
||||
if (! color_picker_info)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *frame;
|
||||
GimpRGB color;
|
||||
|
||||
color_picker_info = info_dialog_new (_("Color Picker"),
|
||||
tools_help_func, NULL);
|
||||
|
||||
/* if the gdisplay is for a color image, the dialog must have RGB */
|
||||
switch (gimp_drawable_type (tool->drawable))
|
||||
{
|
||||
case RGB_GIMAGE: case RGBA_GIMAGE:
|
||||
info_dialog_add_label (color_picker_info, _("Red:"), red_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Green:"), green_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Blue:"), blue_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Alpha:"), alpha_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Hex Triplet:"), hex_buf);
|
||||
break;
|
||||
|
||||
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
|
||||
info_dialog_add_label (color_picker_info, _("Index:"), index_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Red:"), red_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Green:"), green_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Blue:"), blue_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Alpha:"), alpha_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Hex Triplet"), hex_buf);
|
||||
break;
|
||||
|
||||
case GRAY_GIMAGE: case GRAYA_GIMAGE:
|
||||
info_dialog_add_label (color_picker_info, _("Intensity:"), gray_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Alpha:"), alpha_buf);
|
||||
info_dialog_add_label (color_picker_info, _("Hex Triplet:"), hex_buf);
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (color_picker_info->vbox), hbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_widget_reparent (color_picker_info->info_table, hbox);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.0);
|
||||
color_area =
|
||||
gimp_color_area_new (&color,
|
||||
gimp_drawable_has_alpha (tool->drawable) ?
|
||||
GIMP_COLOR_AREA_LARGE_CHECKS :
|
||||
GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_widget_set_usize (color_area, 48, 64);
|
||||
gtk_drag_dest_unset (color_area);
|
||||
gtk_container_add (GTK_CONTAINER (frame), color_area);
|
||||
gtk_widget_show (color_area);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* create the action area */
|
||||
gimp_dialog_create_action_area
|
||||
(GTK_DIALOG (color_picker_info->shell),
|
||||
|
||||
_("Close"), color_picker_info_window_close_callback,
|
||||
color_picker_info, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Keep the coordinates of the target */
|
||||
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y,
|
||||
&cp_tool->centerx, &cp_tool->centery, FALSE, 1);
|
||||
|
||||
gdk_pointer_grab (gdisp->canvas->window, FALSE,
|
||||
(GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_BUTTON1_MOTION_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK),
|
||||
NULL, NULL, bevent->time);
|
||||
|
||||
/* First, transform the coordinates to gimp image space */
|
||||
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
|
||||
FALSE, FALSE);
|
||||
|
||||
/* if the shift key is down, create a new color.
|
||||
* otherwise, modify the current color.
|
||||
*/
|
||||
if (bevent->state & GDK_SHIFT_MASK)
|
||||
{
|
||||
color_picker_info_update
|
||||
(tool, pick_color_do (gdisp->gimage, tool->drawable, x, y,
|
||||
color_picker_options->sample_merged,
|
||||
color_picker_options->sample_average,
|
||||
color_picker_options->average_radius,
|
||||
color_picker_options->update_active,
|
||||
COLOR_NEW));
|
||||
update_type = COLOR_UPDATE_NEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
color_picker_info_update
|
||||
(tool, pick_color_do (gdisp->gimage, tool->drawable, x, y,
|
||||
color_picker_options->sample_merged,
|
||||
color_picker_options->sample_average,
|
||||
color_picker_options->average_radius,
|
||||
color_picker_options->update_active,
|
||||
COLOR_UPDATE));
|
||||
update_type = COLOR_UPDATE;
|
||||
}
|
||||
|
||||
/* Start drawing the colorpicker tool */
|
||||
draw_core_start (cp_tool->core, gdisp->canvas->window, tool);
|
||||
}
|
||||
|
||||
static void
|
||||
color_picker_button_release (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
gint x, y;
|
||||
|
||||
gdk_pointer_ungrab (bevent->time);
|
||||
gdk_flush ();
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
|
||||
/* First, transform the coordinates to gimp image space */
|
||||
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
|
||||
FALSE, FALSE);
|
||||
|
||||
color_picker_info_update
|
||||
(tool, pick_color_do (gdisp->gimage, tool->drawable, x, y,
|
||||
color_picker_options->sample_merged,
|
||||
color_picker_options->sample_average,
|
||||
color_picker_options->average_radius,
|
||||
color_picker_options->update_active,
|
||||
update_type));
|
||||
|
||||
draw_core_stop (cp_tool->core, tool);
|
||||
tool->state = INACTIVE;
|
||||
}
|
||||
|
||||
static void
|
||||
color_picker_motion (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
gint x, y;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
|
||||
/* undraw the current tool */
|
||||
draw_core_pause (cp_tool->core, tool);
|
||||
|
||||
/* First, transform the coordinates to gimp image space */
|
||||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y,
|
||||
FALSE, FALSE);
|
||||
|
||||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
|
||||
&cp_tool->centerx, &cp_tool->centery,
|
||||
FALSE, TRUE);
|
||||
|
||||
color_picker_info_update
|
||||
(tool, pick_color_do (gdisp->gimage, tool->drawable, x, y,
|
||||
color_picker_options->sample_merged,
|
||||
color_picker_options->sample_average,
|
||||
color_picker_options->average_radius,
|
||||
color_picker_options->update_active,
|
||||
update_type));
|
||||
|
||||
/* redraw the current tool */
|
||||
draw_core_resume (cp_tool->core, tool);
|
||||
}
|
||||
|
||||
static void
|
||||
color_picker_cursor_update (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
gint x, y;
|
||||
|
||||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y,
|
||||
FALSE, FALSE);
|
||||
|
||||
/* We used to use the following code here:
|
||||
*
|
||||
* if (gimp_image_pick_correlate_layer (gdisp->gimage, x, y)) { ... }
|
||||
*/
|
||||
|
||||
if (gdisp->gimage &&
|
||||
x > 0 && x < gdisp->gimage->width &&
|
||||
y > 0 && y < gdisp->gimage->height)
|
||||
{
|
||||
gdisplay_install_tool_cursor (gdisp, GIMP_COLOR_PICKER_CURSOR,
|
||||
COLOR_PICKER,
|
||||
CURSOR_MODIFIER_NONE,
|
||||
FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdisplay_install_tool_cursor (gdisp, GIMP_BAD_CURSOR,
|
||||
COLOR_PICKER,
|
||||
CURSOR_MODIFIER_NONE,
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
color_picker_control (Tool *tool,
|
||||
ToolAction action,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case PAUSE :
|
||||
draw_core_pause (cp_tool->core, tool);
|
||||
break;
|
||||
|
||||
case RESUME :
|
||||
draw_core_resume (cp_tool->core, tool);
|
||||
break;
|
||||
|
||||
case HALT :
|
||||
draw_core_stop (cp_tool->core, tool);
|
||||
info_dialog_popdown (color_picker_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
typedef guchar * (*GetColorFunc) (GtkObject *, int, int);
|
||||
|
||||
static gboolean
|
||||
pick_color_do (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean sample_merged,
|
||||
gboolean sample_average,
|
||||
gdouble average_radius,
|
||||
gboolean update_active,
|
||||
gint final)
|
||||
{
|
||||
guchar *color;
|
||||
gint offx, offy;
|
||||
gint has_alpha;
|
||||
gint is_indexed;
|
||||
GetColorFunc get_color_func;
|
||||
GtkObject *get_color_obj;
|
||||
|
||||
|
||||
if (!drawable && !sample_merged)
|
||||
return FALSE;
|
||||
|
||||
if (!sample_merged)
|
||||
{
|
||||
gimp_drawable_offsets (drawable, &offx, &offy);
|
||||
x -= offx;
|
||||
y -= offy;
|
||||
|
||||
sample_type = gimp_drawable_type (drawable);
|
||||
is_indexed = gimp_drawable_is_indexed (drawable);
|
||||
|
||||
get_color_func = (GetColorFunc) gimp_drawable_get_color_at;
|
||||
get_color_obj = GTK_OBJECT (drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
sample_type = gimp_image_composite_type (gimage);
|
||||
is_indexed = FALSE;
|
||||
|
||||
get_color_func = (GetColorFunc) gimp_image_get_color_at;
|
||||
get_color_obj = GTK_OBJECT (gimage);
|
||||
}
|
||||
|
||||
has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type);
|
||||
|
||||
if (!(color = (* get_color_func) (get_color_obj, x, y)))
|
||||
return FALSE;
|
||||
|
||||
if (sample_average)
|
||||
{
|
||||
gint i, j;
|
||||
gint count = 0;
|
||||
gint color_avg[4] = { 0, 0, 0, 0 };
|
||||
guchar *tmp_color;
|
||||
gint radius = (gint) average_radius;
|
||||
|
||||
for (i = x - radius; i <= x + radius; i++)
|
||||
for (j = y - radius; j <= y + radius; j++)
|
||||
if ((tmp_color = (* get_color_func) (get_color_obj, i, j)))
|
||||
{
|
||||
count++;
|
||||
|
||||
color_avg[RED_PIX] += tmp_color[RED_PIX];
|
||||
color_avg[GREEN_PIX] += tmp_color[GREEN_PIX];
|
||||
color_avg[BLUE_PIX] += tmp_color[BLUE_PIX];
|
||||
if (has_alpha)
|
||||
color_avg[ALPHA_PIX] += tmp_color[3];
|
||||
|
||||
g_free (tmp_color);
|
||||
}
|
||||
|
||||
color[RED_PIX] = (guchar) (color_avg[RED_PIX] / count);
|
||||
color[GREEN_PIX] = (guchar) (color_avg[GREEN_PIX] / count);
|
||||
color[BLUE_PIX] = (guchar) (color_avg[BLUE_PIX] / count);
|
||||
if (has_alpha)
|
||||
color[ALPHA_PIX] = (guchar) (color_avg[3] / count);
|
||||
|
||||
is_indexed = FALSE;
|
||||
}
|
||||
|
||||
col_value[RED_PIX] = color[RED_PIX];
|
||||
col_value[GREEN_PIX] = color[GREEN_PIX];
|
||||
col_value[BLUE_PIX] = color[BLUE_PIX];
|
||||
if (has_alpha)
|
||||
col_value[ALPHA_PIX] = color[3];
|
||||
if (is_indexed)
|
||||
col_value[4] = color[4];
|
||||
|
||||
if (update_active)
|
||||
palette_set_active_color (col_value [RED_PIX],
|
||||
col_value [GREEN_PIX],
|
||||
col_value [BLUE_PIX],
|
||||
final);
|
||||
|
||||
g_free (color);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
pick_color (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean sample_merged,
|
||||
gboolean sample_average,
|
||||
gdouble average_radius,
|
||||
gint final)
|
||||
{
|
||||
return pick_color_do (gimage, drawable,
|
||||
x, y,
|
||||
sample_merged,
|
||||
sample_average,
|
||||
average_radius,
|
||||
TRUE,
|
||||
final);
|
||||
}
|
||||
|
||||
static void
|
||||
colorpicker_draw (Tool *tool)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
gint tx, ty;
|
||||
gint radiusx, radiusy;
|
||||
gint cx, cy;
|
||||
|
||||
if (! color_picker_options->sample_average)
|
||||
return;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
|
||||
gdisplay_transform_coords (tool->gdisp, cp_tool->centerx, cp_tool->centery,
|
||||
&tx, &ty, TRUE);
|
||||
|
||||
radiusx = SCALEX (tool->gdisp, color_picker_options->average_radius);
|
||||
radiusy = SCALEY (tool->gdisp, color_picker_options->average_radius);
|
||||
cx = SCALEX (tool->gdisp, 1);
|
||||
cy = SCALEY (tool->gdisp, 1);
|
||||
|
||||
/* Draw the circle around the collecting area */
|
||||
gdk_draw_rectangle (cp_tool->core->win, cp_tool->core->gc, 0,
|
||||
tx - radiusx,
|
||||
ty - radiusy,
|
||||
2 * radiusx + cx, 2 * radiusy + cy);
|
||||
|
||||
if (radiusx > 1 && radiusy > 1)
|
||||
{
|
||||
gdk_draw_rectangle (cp_tool->core->win, cp_tool->core->gc, 0,
|
||||
tx - radiusx + 2,
|
||||
ty - radiusy + 2,
|
||||
2 * radiusx + cx - 4, 2 * radiusy + cy - 4);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
color_picker_info_update (Tool *tool,
|
||||
gboolean valid)
|
||||
{
|
||||
if (!valid)
|
||||
{
|
||||
if (GTK_WIDGET_IS_SENSITIVE (color_area))
|
||||
gtk_widget_set_sensitive (color_area, FALSE);
|
||||
|
||||
g_snprintf (red_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (green_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (blue_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (alpha_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (index_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (gray_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (hex_buf, MAX_INFO_BUF, _("N/A"));
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpRGB color;
|
||||
guchar r = 0;
|
||||
guchar g = 0;
|
||||
guchar b = 0;
|
||||
guchar a = 0;
|
||||
|
||||
if (! GTK_WIDGET_IS_SENSITIVE (color_area))
|
||||
gtk_widget_set_sensitive (color_area, TRUE);
|
||||
|
||||
switch (sample_type)
|
||||
{
|
||||
case RGB_GIMAGE: case RGBA_GIMAGE:
|
||||
g_snprintf (index_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (red_buf, MAX_INFO_BUF, "%d", col_value [RED_PIX]);
|
||||
g_snprintf (green_buf, MAX_INFO_BUF, "%d", col_value [GREEN_PIX]);
|
||||
g_snprintf (blue_buf, MAX_INFO_BUF, "%d", col_value [BLUE_PIX]);
|
||||
if (sample_type == RGBA_GIMAGE)
|
||||
g_snprintf (alpha_buf, MAX_INFO_BUF, "%d", col_value [ALPHA_PIX]);
|
||||
else
|
||||
g_snprintf (alpha_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (hex_buf, MAX_INFO_BUF, "#%.2x%.2x%.2x",
|
||||
col_value [RED_PIX],
|
||||
col_value [GREEN_PIX],
|
||||
col_value [BLUE_PIX]);
|
||||
|
||||
r = col_value [RED_PIX];
|
||||
g = col_value [GREEN_PIX];
|
||||
b = col_value [BLUE_PIX];
|
||||
if (sample_type == RGBA_GIMAGE)
|
||||
a = col_value [ALPHA_PIX];
|
||||
break;
|
||||
|
||||
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
|
||||
g_snprintf (index_buf, MAX_INFO_BUF, "%d", col_value [4]);
|
||||
g_snprintf (red_buf, MAX_INFO_BUF, "%d", col_value [RED_PIX]);
|
||||
g_snprintf (green_buf, MAX_INFO_BUF, "%d", col_value [GREEN_PIX]);
|
||||
g_snprintf (blue_buf, MAX_INFO_BUF, "%d", col_value [BLUE_PIX]);
|
||||
if (sample_type == INDEXEDA_GIMAGE)
|
||||
g_snprintf (alpha_buf, MAX_INFO_BUF, "%d", col_value [ALPHA_PIX]);
|
||||
else
|
||||
g_snprintf (alpha_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (hex_buf, MAX_INFO_BUF, "#%.2x%.2x%.2x",
|
||||
col_value [RED_PIX],
|
||||
col_value [GREEN_PIX],
|
||||
col_value [BLUE_PIX]);
|
||||
|
||||
r = col_value [RED_PIX];
|
||||
g = col_value [GREEN_PIX];
|
||||
b = col_value [BLUE_PIX];
|
||||
if (sample_type == INDEXEDA_GIMAGE)
|
||||
a = col_value [ALPHA_PIX];
|
||||
break;
|
||||
|
||||
case GRAY_GIMAGE: case GRAYA_GIMAGE:
|
||||
g_snprintf (gray_buf, MAX_INFO_BUF, "%d", col_value [GRAY_PIX]);
|
||||
if (sample_type == GRAYA_GIMAGE)
|
||||
g_snprintf (alpha_buf, MAX_INFO_BUF, "%d", col_value [ALPHA_PIX]);
|
||||
else
|
||||
g_snprintf (alpha_buf, MAX_INFO_BUF, _("N/A"));
|
||||
g_snprintf (hex_buf, MAX_INFO_BUF, "#%.2x%.2x%.2x",
|
||||
col_value [GRAY_PIX],
|
||||
col_value [GRAY_PIX],
|
||||
col_value [GRAY_PIX]);
|
||||
|
||||
r = col_value [GRAY_PIX];
|
||||
g = col_value [GRAY_PIX];
|
||||
b = col_value [GRAY_PIX];
|
||||
if (sample_type == GRAYA_GIMAGE)
|
||||
a = col_value [ALPHA_PIX];
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_rgba_set_uchar (&color, r, g, b, a);
|
||||
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (color_area), &color);
|
||||
}
|
||||
|
||||
info_dialog_update (color_picker_info);
|
||||
info_dialog_popup (color_picker_info);
|
||||
}
|
||||
|
||||
static void
|
||||
color_picker_info_window_close_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
info_dialog_popdown ((InfoDialog *) client_data);
|
||||
}
|
||||
|
||||
Tool *
|
||||
tools_new_color_picker ()
|
||||
{
|
||||
Tool * tool;
|
||||
ColorPickerTool * private;
|
||||
|
||||
/* The tool options */
|
||||
if (! color_picker_options)
|
||||
{
|
||||
color_picker_options = color_picker_options_new ();
|
||||
tools_register (COLOR_PICKER, (ToolOptions *) color_picker_options);
|
||||
}
|
||||
|
||||
tool = tools_new_tool (COLOR_PICKER);
|
||||
private = g_new0 (ColorPickerTool, 1);
|
||||
|
||||
private->core = draw_core_new (colorpicker_draw);
|
||||
|
||||
tool->preserve = FALSE; /* Don't preserve on drawable change */
|
||||
|
||||
tool->private = (void *) private;
|
||||
|
||||
tool->button_press_func = color_picker_button_press;
|
||||
tool->button_release_func = color_picker_button_release;
|
||||
tool->motion_func = color_picker_motion;
|
||||
tool->cursor_update_func = color_picker_cursor_update;
|
||||
tool->control_func = color_picker_control;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
||||
void
|
||||
tools_free_color_picker (Tool *tool)
|
||||
{
|
||||
ColorPickerTool * cp_tool;
|
||||
|
||||
cp_tool = (ColorPickerTool *) tool->private;
|
||||
|
||||
if (tool->state == ACTIVE)
|
||||
draw_core_stop (cp_tool->core, tool);
|
||||
|
||||
draw_core_free (cp_tool->core);
|
||||
|
||||
if (color_picker_info)
|
||||
{
|
||||
info_dialog_free (color_picker_info);
|
||||
color_picker_info = NULL;
|
||||
|
||||
color_area = NULL;
|
||||
}
|
||||
|
||||
g_free (cp_tool);
|
||||
}
|
39
plug-ins/plugin-helper/color_picker.h
Normal file
39
plug-ins/plugin-helper/color_picker.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#ifndef __COLOR_PICKER_H__
|
||||
#define __COLOR_PICKER_H__
|
||||
|
||||
|
||||
extern gint col_value[5];
|
||||
|
||||
|
||||
gboolean pick_color (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean sample_merged,
|
||||
gboolean sample_average,
|
||||
double average_radius,
|
||||
gint final);
|
||||
|
||||
Tool * tools_new_color_picker (void);
|
||||
void tools_free_color_picker (Tool *tool);
|
||||
|
||||
|
||||
#endif /* __COLOR_PICKER_H__ */
|
1584
plug-ins/plugin-helper/iwarp.c
Normal file
1584
plug-ins/plugin-helper/iwarp.c
Normal file
File diff suppressed because it is too large
Load diff
258
plug-ins/plugin-helper/plugin-helper.c
Normal file
258
plug-ins/plugin-helper/plugin-helper.c
Normal file
|
@ -0,0 +1,258 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
*
|
||||
* plugin-helper -- support plugin for dynamically loaded plugin modules
|
||||
* Copyright (C) 2000 Nathan Summers
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
/* why aren't these functions defined in gimp.h? */
|
||||
|
||||
extern void gimp_extension_ack (void);
|
||||
extern void gimp_extension_process (int timeout);
|
||||
|
||||
/* Declare local functions */
|
||||
static void helper_query (void);
|
||||
static void helper_run (gchar * name,
|
||||
gint nparams,
|
||||
GimpParam * param,
|
||||
gint * nreturn_vals, GimpParam ** return_vals);
|
||||
|
||||
|
||||
static void query_module (gchar *);
|
||||
|
||||
GimpPlugInInfo PLUG_IN_INFO = {
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
helper_query, /* query_proc */
|
||||
helper_run, /* run_proc */
|
||||
};
|
||||
|
||||
|
||||
MAIN ()
|
||||
|
||||
static void helper_query (void)
|
||||
{
|
||||
g_message ("query called");
|
||||
gimp_install_procedure ("extension_plugin_helper",
|
||||
"Proxy process for dynamically loaded plugin modules",
|
||||
"Automagically called by the Gimp at startup",
|
||||
"Nathan Summers",
|
||||
"Nathan Summers",
|
||||
"2000",
|
||||
NULL, NULL, GIMP_EXTENSION, 0, 0, NULL, NULL);
|
||||
g_message ("query done");
|
||||
}
|
||||
|
||||
static void
|
||||
helper_run (gchar * name,
|
||||
gint nparams,
|
||||
GimpParam * param, gint * nreturn_vals, GimpParam ** return_vals)
|
||||
{
|
||||
static GimpParam values[2];
|
||||
GimpRunModeType run_mode;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
|
||||
g_message ("run called %s", name);
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
*nreturn_vals = 1;
|
||||
*return_vals = values;
|
||||
values[0].type = GIMP_PDB_STATUS;
|
||||
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
||||
if (strcmp (name, "extension_plugin_helper") == 0)
|
||||
{
|
||||
status = GIMP_PDB_SUCCESS;
|
||||
values[0].data.d_status = status;
|
||||
|
||||
query_module ("/usr/local/lib/gimp/1.3/plugin-modules/libiwarp.so");
|
||||
|
||||
g_message ("time for the evil loop");
|
||||
|
||||
|
||||
gimp_extension_ack ();
|
||||
|
||||
while (TRUE) /* this construction bothers me deeply */
|
||||
gimp_extension_process (0);
|
||||
|
||||
/* doubtful that execution ever passes this point. */
|
||||
g_message ("Brigadoon!");
|
||||
}
|
||||
else
|
||||
{
|
||||
status = GIMP_PDB_CALLING_ERROR;
|
||||
}
|
||||
|
||||
values[0].data.d_status = status;
|
||||
}
|
||||
|
||||
|
||||
void query_module (gchar *module)
|
||||
{
|
||||
GModule *mod;
|
||||
GimpQueryProc query_proc = NULL;
|
||||
|
||||
mod = g_module_open (module, G_MODULE_BIND_LAZY);
|
||||
|
||||
if (!mod) {
|
||||
g_message ("Could not open module %s!", module);
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_module_symbol (mod, "query", (gpointer *)&query_proc)) {
|
||||
g_message ("alright!");
|
||||
(*query_proc)();
|
||||
} else {
|
||||
g_message ("doh!");
|
||||
g_error (g_module_error());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void plugin_module_install_procedure (gchar *name,
|
||||
gchar *blurb,
|
||||
gchar *help,
|
||||
gchar *author,
|
||||
gchar *copyright,
|
||||
gchar *date,
|
||||
gchar *menu_path,
|
||||
gchar *image_types,
|
||||
gint nparams,
|
||||
gint nreturn_vals,
|
||||
GimpParamDef *params,
|
||||
GimpParamDef *return_vals,
|
||||
GimpRunProc run_proc)
|
||||
{
|
||||
g_message ("Installing plug-in procedure %s (%p)", name, run_proc);
|
||||
|
||||
gimp_install_temp_proc(name, blurb, help, author, copyright, date, menu_path, image_types,
|
||||
GIMP_TEMPORARY, nparams, nreturn_vals, params, return_vals,
|
||||
run_proc);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
/* search for binaries in the plug-in directory path */
|
||||
find_modules (plug_in_path, plug_in_init_file,
|
||||
MODE_EXECUTABLE);
|
||||
|
||||
/* read the pluginrc file for cached data */
|
||||
filename = NULL;
|
||||
if (pluginrc_path)
|
||||
{
|
||||
if (g_path_is_absolute (pluginrc_path))
|
||||
filename = g_strdup (pluginrc_path);
|
||||
else
|
||||
filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
|
||||
gimp_directory (), pluginrc_path);
|
||||
}
|
||||
else
|
||||
filename = gimp_personal_rc_file ("pluginrc");
|
||||
|
||||
app_init_update_status (_("Resource configuration"), filename, -1);
|
||||
parse_gimprc_file (filename);
|
||||
|
||||
/* query any plug-ins that have changed since we last wrote out
|
||||
* the pluginrc file.
|
||||
*/
|
||||
tmp = plug_in_defs;
|
||||
app_init_update_status (_("Plug-ins"), "", 0);
|
||||
nplugins = g_slist_length (tmp);
|
||||
nth = 0;
|
||||
while (tmp)
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
if (plug_in_def->query)
|
||||
{
|
||||
write_pluginrc = TRUE;
|
||||
|
||||
if (be_verbose)
|
||||
g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog);
|
||||
|
||||
plug_in_query (plug_in_def);
|
||||
}
|
||||
|
||||
app_init_update_status (NULL, plug_in_def->prog, nth / nplugins);
|
||||
nth++;
|
||||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef *) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
tmp = tmp->next;
|
||||
|
||||
tmp2 = plug_in_def->proc_defs;
|
||||
while (tmp2)
|
||||
{
|
||||
proc_def = tmp2->data;
|
||||
tmp2 = tmp2->next;
|
||||
|
||||
proc_def->mtime = plug_in_def->mtime;
|
||||
plug_in_proc_def_insert (proc_def, plug_in_proc_def_dead);
|
||||
}
|
||||
}
|
||||
|
||||
/* write the pluginrc file if necessary */
|
||||
if (write_pluginrc)
|
||||
{
|
||||
if (be_verbose)
|
||||
g_print (_("writing \"%s\"\n"), filename);
|
||||
|
||||
plug_in_write_rc (filename);
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
|
||||
/* add the plug-in procs to the procedure database */
|
||||
plug_in_add_to_db ();
|
||||
|
||||
#endif
|
||||
|
38
plug-ins/plugin-helper/plugin-helper.h
Normal file
38
plug-ins/plugin-helper/plugin-helper.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* Plugin-helper.h
|
||||
* Copyright (C) 2000 Nathan Summers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PLUGIN_HELPER_H__
|
||||
#define __PLUGIN_HELPER_H__
|
||||
|
||||
extern void plugin_module_install_procedure (gchar * name,
|
||||
gchar * blurb,
|
||||
gchar * help,
|
||||
gchar * author,
|
||||
gchar * copyright,
|
||||
gchar * date,
|
||||
gchar * menu_path,
|
||||
gchar * image_types,
|
||||
gint nparams,
|
||||
gint nreturn_vals,
|
||||
GimpParamDef * params,
|
||||
GimpParamDef * return_vals,
|
||||
GimpRunProc run_proc);
|
||||
|
||||
|
||||
#endif /* __PLUGIN_HELPER_H__ */
|
|
@ -786,7 +786,7 @@ script_fu_report_cc (gchar *command)
|
|||
|
||||
|
||||
/*
|
||||
* The following function is a GTraverseFunction, Please
|
||||
* The following function is a GTraverseFunction. Please
|
||||
* note that it frees the script->args structure. --Sven
|
||||
*/
|
||||
static gboolean
|
||||
|
|
|
@ -786,7 +786,7 @@ script_fu_report_cc (gchar *command)
|
|||
|
||||
|
||||
/*
|
||||
* The following function is a GTraverseFunction, Please
|
||||
* The following function is a GTraverseFunction. Please
|
||||
* note that it frees the script->args structure. --Sven
|
||||
*/
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue