app/tools/bezier_select.[ch] app/tools/bezier_selectP.h

2001-03-31  Michael Natterer  <mitch@gimp.org>

	* app/tools/bezier_select.[ch]
	* app/tools/bezier_selectP.h
	* app/tools/transform_core.[ch]
	* app/tools/transform_tool.[ch]: removed.

	* app/tools/Makefile.am
	* po/POTFILES.in: changed accordingly.

	* app/tools/gimpbezierselecttool.c: indentation fixes.

	* app/tools/gimpdodgeburntool.[ch]: made cursor toggling work
	again, cleanup.

	* app/tools/gimpscaletool.[ch]
	* app/tools/gimptool.c: minor cleanups like removing STUB()s.

	* app/tools/tool_manager.c: applied patch from Dave Neary which
	returns useful PDB strings for the paint tools again.
This commit is contained in:
Michael Natterer 2001-03-31 15:45:05 +00:00 committed by Michael Natterer
parent 4ee31d0cac
commit bb134d6ed4
19 changed files with 447 additions and 6647 deletions

View File

@ -1,3 +1,24 @@
2001-03-31 Michael Natterer <mitch@gimp.org>
* app/tools/bezier_select.[ch]
* app/tools/bezier_selectP.h
* app/tools/transform_core.[ch]
* app/tools/transform_tool.[ch]: removed.
* app/tools/Makefile.am
* po/POTFILES.in: changed accordingly.
* app/tools/gimpbezierselecttool.c: indentation fixes.
* app/tools/gimpdodgeburntool.[ch]: made cursor toggling work
again, cleanup.
* app/tools/gimpscaletool.[ch]
* app/tools/gimptool.c: minor cleanups like removing STUB()s.
* app/tools/tool_manager.c: applied patch from Dave Neary which
returns useful PDB strings for the paint tools again.
2001-03-31 Michael Natterer <mitch@gimp.org>
* app/undo.c: re-enabled transform undo. Fixes the transform tool

View File

@ -76,16 +76,26 @@ struct _DodgeBurnOptions
};
static void gimp_dodgeburn_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state);
static void gimp_dodgeburn_tool_class_init (GimpDodgeBurnToolClass *klass);
static void gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn);
static void gimp_dodgeburn_tool_make_luts (GimpPaintTool *paint_tool,
gdouble db_exposure,
DodgeBurnType type,
DodgeBurnMode mode,
GimpLut *lut,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_make_luts (GimpPaintTool *paint_tool,
gdouble db_exposure,
DodgeBurnType type,
DodgeBurnMode mode,
GimpLut *lut,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_modifier_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
static void gimp_dodgeburn_tool_cursor_update (GimpTool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void gimp_dodgeburn_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state);
static gfloat gimp_dodgeburn_tool_highlights_lut_func (gpointer user_data,
gint nchannels,
@ -100,18 +110,19 @@ static gfloat gimp_dodgeburn_tool_shadows_lut_func (gpointer user_dat
gint channel,
gfloat value);
static void gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
PaintPressureOptions *pressure_options,
gdouble dodgeburn_exposure,
GimpLut *lut,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_init (GimpDodgeBurnTool *tool);
static void gimp_dodgeburn_tool_finish (GimpPaintTool *paint_tool,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
PaintPressureOptions *pressure_options,
gdouble dodgeburn_exposure,
GimpLut *lut,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_init (GimpDodgeBurnTool *tool);
static void gimp_dodgeburn_tool_finish (GimpPaintTool *paint_tool,
GimpDrawable *drawable);
/* the dodgeburn tool options */
static DodgeBurnOptions * dodgeburn_options = NULL;
static GimpPaintToolClass *parent_class = NULL;
/* Non gui function */
@ -123,6 +134,45 @@ static GimpPaintToolClass *parent_class = NULL;
/* functions */
void
gimp_dodgeburn_tool_register (void)
{
tool_manager_register_tool (GIMP_TYPE_DODGEBURN_TOOL,
TRUE,
"gimp:dodgeburn_tool",
_("Dodge/Burn"),
_("Dodge or Burn strokes"),
N_("/Tools/Paint Tools/DodgeBurn"), "<shift>D",
NULL, "tools/dodgeburn.html",
(const gchar **) dodge_bits);
}
GtkType
gimp_dodgeburn_tool_get_type (void)
{
static GtkType tool_type = 0;
if (!tool_type)
{
GtkTypeInfo tool_info =
{
"GimpDodgeBurnTool",
sizeof(GimpDodgeBurnTool),
sizeof(GimpDodgeBurnToolClass),
(GtkClassInitFunc) gimp_dodgeburn_tool_class_init,
(GtkObjectInitFunc) gimp_dodgeburn_tool_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
NULL
};
tool_type = gtk_type_unique (GIMP_TYPE_PAINT_TOOL, &tool_info);
}
return tool_type;
}
static void
gimp_dodgeburn_tool_options_reset (void)
{
@ -150,7 +200,7 @@ gimp_dodgeburn_tool_options_new (void)
GtkWidget *frame;
/* the new dodgeburn tool options structure */
options = g_new (DodgeBurnOptions, 1);
options = g_new0 (DodgeBurnOptions, 1);
paint_options_init ((PaintOptions *) options,
GIMP_TYPE_DODGEBURN_TOOL,
gimp_dodgeburn_tool_options_reset);
@ -229,15 +279,14 @@ gimp_dodgeburn_tool_paint (GimpPaintTool *paint_tool,
switch (state)
{
case INIT_PAINT:
/* gimp_dodgeburn_tool_init (paint_tool); */
dodgeburn_options->lut = gimp_lut_new ();
gimp_dodgeburn_tool_make_luts (paint_tool,
dodgeburn_options->exposure,
dodgeburn_options->type,
dodgeburn_options->mode,
dodgeburn_options->lut,
drawable);
/* gimp_dodgeburn_tool_init (paint_tool); */
dodgeburn_options->lut = gimp_lut_new ();
gimp_dodgeburn_tool_make_luts (paint_tool,
dodgeburn_options->exposure,
dodgeburn_options->type,
dodgeburn_options->mode,
dodgeburn_options->lut,
drawable);
break;
case MOTION_PAINT:
@ -257,35 +306,36 @@ gimp_dodgeburn_tool_paint (GimpPaintTool *paint_tool,
}
static void
gimp_dodgeburn_tool_finish (GimpPaintTool *paint_tool,
GimpDrawable *drawable)
gimp_dodgeburn_tool_finish (GimpPaintTool *paint_tool,
GimpDrawable *drawable)
{
/* Here we destroy the luts to do the painting with.*/
if (dodgeburn_options->lut)
{
gimp_lut_free (dodgeburn_options->lut);
dodgeburn_options->lut = NULL;
}
{
gimp_lut_free (dodgeburn_options->lut);
dodgeburn_options->lut = NULL;
}
}
static void
gimp_dodgeburn_tool_class_init (GimpDodgeBurnToolClass *klass)
{
GimpToolClass *tool_class;
GimpPaintToolClass *paint_tool_class;
GimpToolClass *tool_class;
GimpPaintToolClass *paint_tool_class;
tool_class =(GimpToolClass *) klass;
paint_tool_class =(GimpPaintToolClass *) klass;
tool_class = (GimpToolClass *) klass;
paint_tool_class = (GimpPaintToolClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_PAINT_TOOL);
paint_tool_class->paint = gimp_dodgeburn_tool_paint;
tool_class->modifier_key = gimp_dodgeburn_tool_modifier_key;
tool_class->cursor_update = gimp_dodgeburn_tool_cursor_update;
paint_tool_class->paint = gimp_dodgeburn_tool_paint;
}
static void
gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn)
gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn)
{
GimpTool *tool;
GimpPaintTool *paint_tool;
@ -295,10 +345,8 @@ gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn)
if (! dodgeburn_options)
{
dodgeburn_options = gimp_dodgeburn_tool_options_new();
GIMP_TYPE_DODGEBURN_TOOL;
dodgeburn_options = gimp_dodgeburn_tool_options_new ();
tool_manager_register_tool_options (GIMP_TYPE_DODGEBURN_TOOL,
(ToolOptions *) dodgeburn_options);
}
@ -314,9 +362,10 @@ gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn)
dodgeburn_options->lut,
drawable);
*/
tool->tool_cursor = GIMP_DODGE_TOOL_CURSOR;
tool->tool_cursor = GIMP_DODGE_TOOL_CURSOR;
tool->toggle_cursor = GIMP_BURN_TOOL_CURSOR;
paint_tool->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
}
@ -358,17 +407,18 @@ gimp_dodgeburn_tool_make_luts (GimpPaintTool *paint_tool,
lut_func, (gpointer) &exposure,
nchannels);
}
static void
dodgeburn_modifier_key_func (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
gimp_dodgeburn_tool_modifier_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
{
switch (kevent->keyval)
{
case GDK_Alt_L:
case GDK_Alt_R:
break;
case GDK_Shift_L:
case GDK_Shift_R:
if (kevent->state & GDK_CONTROL_MASK) /* reset tool toggle */
@ -388,7 +438,8 @@ dodgeburn_modifier_key_func (GimpTool *tool,
}
}
break;
case GDK_Control_L:
case GDK_Control_L:
case GDK_Control_R:
if (! (kevent->state & GDK_SHIFT_MASK)) /* shift enables line draw mode */
{
@ -413,19 +464,18 @@ dodgeburn_modifier_key_func (GimpTool *tool,
}
static void
dodgeburn_cursor_update_func (GimpTool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp)
gimp_dodgeburn_tool_cursor_update (GimpTool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp)
{
tool->toggled = (dodgeburn_options->type == BURN);
/* FIXME: come up with a way to change cursor */
/* gimp_paint_tool_cursor_update (tool, mevent, gdisp); */
if (GIMP_TOOL_CLASS (parent_class)->cursor_update)
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, mevent, gdisp);
}
static void
gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
PaintPressureOptions *pressure_options,
double dodgeburn_exposure,
GimpLut *lut,
@ -456,9 +506,9 @@ gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
if (! (area = gimp_paint_tool_get_paint_area (paint_tool, drawable, scale)))
return;
/* Constant painting --get a copy of the orig drawable (with
no paint from this stroke yet) */
/* Constant painting --get a copy of the orig drawable (with no
* paint from this stroke yet)
*/
{
gint x1, y1, x2, y2;
@ -528,16 +578,15 @@ gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
#if 0
static gpointer
gimp_dodgeburn_tool_non_gui_paint (GimpPaintTool *paint_tool,
gimp_dodgeburn_tool_non_gui_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state)
{
gimp_dodgeburn_tool_motion (paint_tool, &non_gui_pressure_options,
{
gimp_dodgeburn_tool_motion (paint_tool, &non_gui_pressure_options,
non_gui_exposure, non_gui_lut, drawable);
return NULL;
}
return NULL;
}
gboolean
gimp_dodgeburn_tool_non_gui_default (GimpDrawable *drawable,
@ -629,15 +678,15 @@ gimp_dodgeburn_tool_highlights_lut_func (gpointer user_data,
gint channel,
gfloat value)
{
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor = 1.0 + exposure * (.333333);
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor = 1.0 + exposure * (.333333);
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
return value;
return factor * value;
return factor * value;
}
static gfloat
@ -646,20 +695,20 @@ gimp_dodgeburn_tool_midtones_lut_func (gpointer user_data,
gint channel,
gfloat value)
{
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor;
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor;
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
return value;
if (exposure < 0)
factor = 1.0 - exposure * (.333333);
else
factor = 1/(1.0 + exposure);
if (exposure < 0)
factor = 1.0 - exposure * (.333333);
else
factor = 1/(1.0 + exposure);
return pow (value, factor);
return pow (value, factor);
}
static gfloat
@ -673,8 +722,8 @@ gimp_dodgeburn_tool_shadows_lut_func (gpointer user_data,
gfloat new_value;
gfloat factor;
if ( (nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
return value;
if (exposure >= 0)
@ -694,65 +743,27 @@ gimp_dodgeburn_tool_shadows_lut_func (gpointer user_data,
return new_value;
}
void
gimp_dodgeburn_tool_register (void)
{
tool_manager_register_tool (GIMP_TYPE_DODGEBURN_TOOL,
TRUE,
"gimp:dodgeburn_tool",
_("Dodge/Burn"),
_("Dodge or Burn strokes"),
N_("/Tools/Paint Tools/DodgeBurn"),
"<shift>O",
NULL,
"tools/dodgeburn.html",
(const gchar **) dodge_bits);
}
GtkType
gimp_dodgeburn_tool_get_type (void)
{
static GtkType tool_type = 0;
if (!tool_type)
{
GtkTypeInfo tool_info =
{
"GimpDodgeBurnTool",
sizeof(GimpDodgeBurnTool),
sizeof(GimpDodgeBurnToolClass),
(GtkClassInitFunc) gimp_dodgeburn_tool_class_init,
(GtkObjectInitFunc) gimp_dodgeburn_tool_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
NULL
};
tool_type = gtk_type_unique (GIMP_TYPE_PAINT_TOOL, &tool_info);
}
return tool_type;
}
/* FIXME: do someting usefule here */
gboolean dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array)
gboolean
dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array)
{
g_message ("gimp_dodgeburn_tool_non_gui not implemented yet\n");
g_message ("gimp_dodgeburn_tool_non_gui not implemented yet\n");
return FALSE;
return FALSE;
}
gboolean dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array)
gboolean
dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array)
{
g_message ("gimp_dodgeburn_tool_non_gui not implemented yet\n");
g_message ("gimp_dodgeburn_tool_non_gui not implemented yet\n");
return FALSE;
return FALSE;
}

View File

@ -19,8 +19,24 @@
#ifndef __GIMP_DODGE_BURN_TOOL_H__
#define __GIMP_DODGE_BURN_TOOL_H__
#include "gimppainttool.h"
typedef enum
{
DODGE,
BURN
} DodgeBurnType;
typedef enum
{
DODGEBURN_HIGHLIGHTS,
DODGEBURN_MIDTONES,
DODGEBURN_SHADOWS
} DodgeBurnMode;
#define GIMP_TYPE_DODGEBURN_TOOL (gimp_dodgeburn_tool_get_type ())
#define GIMP_DODGEBURN_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DODGEBURN_TOOL, GimpDodgeBurnTool))
#define GIMP_IS_DODGEBURN_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DODGEBURN_TOOL))
@ -28,20 +44,6 @@
#define GIMP_IS_DODGEBURN_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DODGEBURN_TOOL))
typedef enum
{
DODGE,
BURN
} DodgeBurnType;
typedef enum
{
DODGEBURN_HIGHLIGHTS,
DODGEBURN_MIDTONES,
DODGEBURN_SHADOWS
} DodgeBurnMode;
typedef struct _GimpDodgeBurnTool GimpDodgeBurnTool;
typedef struct _GimpDodgeBurnToolClass GimpDodgeBurnToolClass;
@ -63,19 +65,16 @@ GtkType gimp_dodgeburn_tool_get_type (void);
/* FIXME: Get rid of this non_gui stuff someday. Preferably make
* everything use it interally for ease of macro recording.
*/
gboolean dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array);
gboolean dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array);
gboolean dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
gboolean dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
#endif /* __GIMP_DODGEBURN_TOOL_H__ */

View File

@ -74,8 +74,6 @@ libapptools_la_SOURCES = \
gimptexttool.h \
gimptool.c \
gimptool.h \
gimptoolinfo.c \
gimptoolinfo.h \
gimptransformtool.c \
gimptransformtool.h \
\
@ -88,6 +86,8 @@ libapptools_la_SOURCES = \
tool_options_dialog.c \
tool_options_dialog.h \
\
gimptoolinfo.c \
gimptoolinfo.h \
tool_manager.c \
tool_manager.h \
tools.c
@ -107,11 +107,7 @@ libapptools_la_SOURCES = \
## posterize.c \
## posterize.h \
## threshold.c \
## threshold.h \
## transform_core.c \
## transform_core.h \
## transform_tool.c \
## transform_tool.h
## threshold.h
AM_CPPFLAGS = \

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
/* 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 __BEZIER_SELECT_H__
#define __BEZIER_SELECT_H__
Tool * tools_new_bezier_select (void);
void tools_free_bezier_select (Tool *tool);
gboolean bezier_tool_selected (void);
#endif /* __BEZIER_SELECT_H__ */

View File

@ -1,116 +0,0 @@
/* 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 __BEZIER_SELECTP_H__
#define __BEZIER_SELECTP_H__
#include "tools/gimpdrawtool.h"
#define BEZIER_START 1
#define BEZIER_ADD 2
#define BEZIER_EDIT 4
#define BEZIER_DRAG 8
#define BEZIER_ANCHOR 1
#define BEZIER_CONTROL 2
#define BEZIER_MOVE 3
#define IMAGE_COORDS 1
#define AA_IMAGE_COORDS 2
#define SCREEN_COORDS 3
#define SUBDIVIDE 1000
enum { EXTEND_EDIT, EXTEND_ADD, EXTEND_REMOVE, EXTEND_NEW };
struct _BezierPoint
{
gint type; /* type of point (anchor/control/move) */
gdouble x, y; /* location of point in image space */
gint sx, sy; /* location of point in screen space */
BezierPoint *next; /* next point on curve */
BezierPoint *prev; /* prev point on curve */
BezierPoint *next_curve; /* Next curve segment */
gint pointflags; /* Status of point 0 = not selected
* 1 = selected
*/
};
struct _BezierSelect
{
gint state; /* start, add, edit or drag */
gint draw; /* all or part */
gint closed; /* is the last curve closed */
GimpDrawTool *core; /* Core drawing object */
BezierPoint *points; /* the curve */
BezierPoint *cur_anchor; /* the current active anchor point */
BezierPoint *cur_control; /* the current active control point */
BezierPoint *last_point; /* the last point on the curve */
gint num_points; /* number of points in the curve */
GimpChannel *mask; /* null if the curve is open */
GSList **scanlines; /* used in converting a curve */
};
/* All data that are passed to the bezier_draw_curve must
* have this structure as the first element.
*/
typedef struct
{
gint count;
} CountCurves;
typedef void (* BezierPointsFunc) (BezierSelect *bezier_sel,
GdkPoint *points,
gint n_points,
gpointer data);
/* Functions */
gint bezier_select_load (GDisplay *gdisp,
BezierPoint *points,
gint n_points,
gint closed);
void bezier_draw_curve (BezierSelect *bezier_sel,
BezierPointsFunc func,
gint coord,
gpointer data);
void bezier_select_reset (BezierSelect *bezier_sel);
void bezier_select_free (BezierSelect *bezier_sel);
void bezier_add_point (BezierSelect *bezier_sel,
gint type,
gdouble x,
gdouble y);
void bezier_paste_bezierselect_to_current (GDisplay *gdisp,
BezierSelect *bezier_sel);
void bezier_select_mode (gint);
void bezier_stroke (BezierSelect *bezier_sel,
GDisplay *gdisp,
gint subdivisions,
gint open_path);
void bezier_to_selection (BezierSelect *bezier_sel,
GDisplay *gdisp);
gint bezier_distance_along (BezierSelect *bezier_sel,
gint open_path,
gdouble dist,
gint *x,
gint *y,
gdouble *gradient);
void bezier_draw (GDisplay *gdisp,
BezierSelect *bezier_sel);
#endif /* __BEZIER_SELECTP_H__ */

View File

@ -272,11 +272,12 @@ static void bezier_start_new_segment (GimpBezierSelectTool *bezier_sel,
void
gimp_bezier_select_tool_register (void)
{
tool_manager_register_tool (GIMP_TYPE_BEZIER_SELECT_TOOL, FALSE,
tool_manager_register_tool (GIMP_TYPE_BEZIER_SELECT_TOOL,
FALSE,
"gimp:bezier_select_tool",
_("Bezier Select"),
_("Select regions using Bezier curves"),
_("/Tools/Selection Tools/Bezier Select"), "R",
_("/Tools/Select Tools/Bezier Select"), "B",
NULL, "tools/bezier_select.html",
(const gchar **) bezier_bits);
}
@ -374,10 +375,10 @@ gimp_bezier_select_tool_init (GimpBezierSelectTool *bezier_select)
tool->tool_cursor = GIMP_BEZIER_SELECT_TOOL_CURSOR;
tool->preserve = FALSE; /* Don't preserve on drawable change */
bezier_select_reset (bezier_select);
paths_new_bezier_select_tool ();
}
static void
@ -387,21 +388,19 @@ gimp_bezier_select_tool_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_bezier_select_tool_button_press (GimpTool *tool,
GdkEventButton *bevent,
GDisplay *gdisp)
GdkEventButton *bevent,
GDisplay *gdisp)
{
GimpBezierSelectTool *bezier_sel;
GimpBezierSelectPoint *points;
GimpBezierSelectPoint *start_pt;
GimpBezierSelectPoint *curve_start;
gboolean grab_pointer;
gint op;
gint x, y;
gint halfwidth, dummy;
GimpBezierSelectTool *bezier_sel;
GimpBezierSelectPoint *points;
GimpBezierSelectPoint *start_pt;
GimpBezierSelectPoint *curve_start;
gboolean grab_pointer;
gint op;
gint x, y;
gint halfwidth, dummy;
tool->drawable = gimp_image_active_drawable (gdisp->gimage);

View File

@ -76,16 +76,26 @@ struct _DodgeBurnOptions
};
static void gimp_dodgeburn_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state);
static void gimp_dodgeburn_tool_class_init (GimpDodgeBurnToolClass *klass);
static void gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn);
static void gimp_dodgeburn_tool_make_luts (GimpPaintTool *paint_tool,
gdouble db_exposure,
DodgeBurnType type,
DodgeBurnMode mode,
GimpLut *lut,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_make_luts (GimpPaintTool *paint_tool,
gdouble db_exposure,
DodgeBurnType type,
DodgeBurnMode mode,
GimpLut *lut,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_modifier_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
static void gimp_dodgeburn_tool_cursor_update (GimpTool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void gimp_dodgeburn_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state);
static gfloat gimp_dodgeburn_tool_highlights_lut_func (gpointer user_data,
gint nchannels,
@ -100,18 +110,19 @@ static gfloat gimp_dodgeburn_tool_shadows_lut_func (gpointer user_dat
gint channel,
gfloat value);
static void gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
PaintPressureOptions *pressure_options,
gdouble dodgeburn_exposure,
GimpLut *lut,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_init (GimpDodgeBurnTool *tool);
static void gimp_dodgeburn_tool_finish (GimpPaintTool *paint_tool,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
PaintPressureOptions *pressure_options,
gdouble dodgeburn_exposure,
GimpLut *lut,
GimpDrawable *drawable);
static void gimp_dodgeburn_tool_init (GimpDodgeBurnTool *tool);
static void gimp_dodgeburn_tool_finish (GimpPaintTool *paint_tool,
GimpDrawable *drawable);
/* the dodgeburn tool options */
static DodgeBurnOptions * dodgeburn_options = NULL;
static GimpPaintToolClass *parent_class = NULL;
/* Non gui function */
@ -123,6 +134,45 @@ static GimpPaintToolClass *parent_class = NULL;
/* functions */
void
gimp_dodgeburn_tool_register (void)
{
tool_manager_register_tool (GIMP_TYPE_DODGEBURN_TOOL,
TRUE,
"gimp:dodgeburn_tool",
_("Dodge/Burn"),
_("Dodge or Burn strokes"),
N_("/Tools/Paint Tools/DodgeBurn"), "<shift>D",
NULL, "tools/dodgeburn.html",
(const gchar **) dodge_bits);
}
GtkType
gimp_dodgeburn_tool_get_type (void)
{
static GtkType tool_type = 0;
if (!tool_type)
{
GtkTypeInfo tool_info =
{
"GimpDodgeBurnTool",
sizeof(GimpDodgeBurnTool),
sizeof(GimpDodgeBurnToolClass),
(GtkClassInitFunc) gimp_dodgeburn_tool_class_init,
(GtkObjectInitFunc) gimp_dodgeburn_tool_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
NULL
};
tool_type = gtk_type_unique (GIMP_TYPE_PAINT_TOOL, &tool_info);
}
return tool_type;
}
static void
gimp_dodgeburn_tool_options_reset (void)
{
@ -150,7 +200,7 @@ gimp_dodgeburn_tool_options_new (void)
GtkWidget *frame;
/* the new dodgeburn tool options structure */
options = g_new (DodgeBurnOptions, 1);
options = g_new0 (DodgeBurnOptions, 1);
paint_options_init ((PaintOptions *) options,
GIMP_TYPE_DODGEBURN_TOOL,
gimp_dodgeburn_tool_options_reset);
@ -229,15 +279,14 @@ gimp_dodgeburn_tool_paint (GimpPaintTool *paint_tool,
switch (state)
{
case INIT_PAINT:
/* gimp_dodgeburn_tool_init (paint_tool); */
dodgeburn_options->lut = gimp_lut_new ();
gimp_dodgeburn_tool_make_luts (paint_tool,
dodgeburn_options->exposure,
dodgeburn_options->type,
dodgeburn_options->mode,
dodgeburn_options->lut,
drawable);
/* gimp_dodgeburn_tool_init (paint_tool); */
dodgeburn_options->lut = gimp_lut_new ();
gimp_dodgeburn_tool_make_luts (paint_tool,
dodgeburn_options->exposure,
dodgeburn_options->type,
dodgeburn_options->mode,
dodgeburn_options->lut,
drawable);
break;
case MOTION_PAINT:
@ -257,35 +306,36 @@ gimp_dodgeburn_tool_paint (GimpPaintTool *paint_tool,
}
static void
gimp_dodgeburn_tool_finish (GimpPaintTool *paint_tool,
GimpDrawable *drawable)
gimp_dodgeburn_tool_finish (GimpPaintTool *paint_tool,
GimpDrawable *drawable)
{
/* Here we destroy the luts to do the painting with.*/
if (dodgeburn_options->lut)
{
gimp_lut_free (dodgeburn_options->lut);
dodgeburn_options->lut = NULL;
}
{
gimp_lut_free (dodgeburn_options->lut);
dodgeburn_options->lut = NULL;
}
}
static void
gimp_dodgeburn_tool_class_init (GimpDodgeBurnToolClass *klass)
{
GimpToolClass *tool_class;
GimpPaintToolClass *paint_tool_class;
GimpToolClass *tool_class;
GimpPaintToolClass *paint_tool_class;
tool_class =(GimpToolClass *) klass;
paint_tool_class =(GimpPaintToolClass *) klass;
tool_class = (GimpToolClass *) klass;
paint_tool_class = (GimpPaintToolClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_PAINT_TOOL);
paint_tool_class->paint = gimp_dodgeburn_tool_paint;
tool_class->modifier_key = gimp_dodgeburn_tool_modifier_key;
tool_class->cursor_update = gimp_dodgeburn_tool_cursor_update;
paint_tool_class->paint = gimp_dodgeburn_tool_paint;
}
static void
gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn)
gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn)
{
GimpTool *tool;
GimpPaintTool *paint_tool;
@ -295,10 +345,8 @@ gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn)
if (! dodgeburn_options)
{
dodgeburn_options = gimp_dodgeburn_tool_options_new();
GIMP_TYPE_DODGEBURN_TOOL;
dodgeburn_options = gimp_dodgeburn_tool_options_new ();
tool_manager_register_tool_options (GIMP_TYPE_DODGEBURN_TOOL,
(ToolOptions *) dodgeburn_options);
}
@ -314,9 +362,10 @@ gimp_dodgeburn_tool_init (GimpDodgeBurnTool *dodgeburn)
dodgeburn_options->lut,
drawable);
*/
tool->tool_cursor = GIMP_DODGE_TOOL_CURSOR;
tool->tool_cursor = GIMP_DODGE_TOOL_CURSOR;
tool->toggle_cursor = GIMP_BURN_TOOL_CURSOR;
paint_tool->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
}
@ -358,17 +407,18 @@ gimp_dodgeburn_tool_make_luts (GimpPaintTool *paint_tool,
lut_func, (gpointer) &exposure,
nchannels);
}
static void
dodgeburn_modifier_key_func (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
gimp_dodgeburn_tool_modifier_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
{
switch (kevent->keyval)
{
case GDK_Alt_L:
case GDK_Alt_R:
break;
case GDK_Shift_L:
case GDK_Shift_R:
if (kevent->state & GDK_CONTROL_MASK) /* reset tool toggle */
@ -388,7 +438,8 @@ dodgeburn_modifier_key_func (GimpTool *tool,
}
}
break;
case GDK_Control_L:
case GDK_Control_L:
case GDK_Control_R:
if (! (kevent->state & GDK_SHIFT_MASK)) /* shift enables line draw mode */
{
@ -413,19 +464,18 @@ dodgeburn_modifier_key_func (GimpTool *tool,
}
static void
dodgeburn_cursor_update_func (GimpTool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp)
gimp_dodgeburn_tool_cursor_update (GimpTool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp)
{
tool->toggled = (dodgeburn_options->type == BURN);
/* FIXME: come up with a way to change cursor */
/* gimp_paint_tool_cursor_update (tool, mevent, gdisp); */
if (GIMP_TOOL_CLASS (parent_class)->cursor_update)
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, mevent, gdisp);
}
static void
gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
PaintPressureOptions *pressure_options,
double dodgeburn_exposure,
GimpLut *lut,
@ -456,9 +506,9 @@ gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
if (! (area = gimp_paint_tool_get_paint_area (paint_tool, drawable, scale)))
return;
/* Constant painting --get a copy of the orig drawable (with
no paint from this stroke yet) */
/* Constant painting --get a copy of the orig drawable (with no
* paint from this stroke yet)
*/
{
gint x1, y1, x2, y2;
@ -528,16 +578,15 @@ gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
#if 0
static gpointer
gimp_dodgeburn_tool_non_gui_paint (GimpPaintTool *paint_tool,
gimp_dodgeburn_tool_non_gui_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state)
{
gimp_dodgeburn_tool_motion (paint_tool, &non_gui_pressure_options,
{
gimp_dodgeburn_tool_motion (paint_tool, &non_gui_pressure_options,
non_gui_exposure, non_gui_lut, drawable);
return NULL;
}
return NULL;
}
gboolean
gimp_dodgeburn_tool_non_gui_default (GimpDrawable *drawable,
@ -629,15 +678,15 @@ gimp_dodgeburn_tool_highlights_lut_func (gpointer user_data,
gint channel,
gfloat value)
{
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor = 1.0 + exposure * (.333333);
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor = 1.0 + exposure * (.333333);
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
return value;
return factor * value;
return factor * value;
}
static gfloat
@ -646,20 +695,20 @@ gimp_dodgeburn_tool_midtones_lut_func (gpointer user_data,
gint channel,
gfloat value)
{
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor;
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor;
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
return value;
if (exposure < 0)
factor = 1.0 - exposure * (.333333);
else
factor = 1/(1.0 + exposure);
if (exposure < 0)
factor = 1.0 - exposure * (.333333);
else
factor = 1/(1.0 + exposure);
return pow (value, factor);
return pow (value, factor);
}
static gfloat
@ -673,8 +722,8 @@ gimp_dodgeburn_tool_shadows_lut_func (gpointer user_data,
gfloat new_value;
gfloat factor;
if ( (nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
return value;
if (exposure >= 0)
@ -694,65 +743,27 @@ gimp_dodgeburn_tool_shadows_lut_func (gpointer user_data,
return new_value;
}
void
gimp_dodgeburn_tool_register (void)
{
tool_manager_register_tool (GIMP_TYPE_DODGEBURN_TOOL,
TRUE,
"gimp:dodgeburn_tool",
_("Dodge/Burn"),
_("Dodge or Burn strokes"),
N_("/Tools/Paint Tools/DodgeBurn"),
"<shift>O",
NULL,
"tools/dodgeburn.html",
(const gchar **) dodge_bits);
}
GtkType
gimp_dodgeburn_tool_get_type (void)
{
static GtkType tool_type = 0;
if (!tool_type)
{
GtkTypeInfo tool_info =
{
"GimpDodgeBurnTool",
sizeof(GimpDodgeBurnTool),
sizeof(GimpDodgeBurnToolClass),
(GtkClassInitFunc) gimp_dodgeburn_tool_class_init,
(GtkObjectInitFunc) gimp_dodgeburn_tool_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
NULL
};
tool_type = gtk_type_unique (GIMP_TYPE_PAINT_TOOL, &tool_info);
}
return tool_type;
}
/* FIXME: do someting usefule here */
gboolean dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array)
gboolean
dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array)
{
g_message ("gimp_dodgeburn_tool_non_gui not implemented yet\n");
g_message ("gimp_dodgeburn_tool_non_gui not implemented yet\n");
return FALSE;
return FALSE;
}
gboolean dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array)
gboolean
dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array)
{
g_message ("gimp_dodgeburn_tool_non_gui not implemented yet\n");
g_message ("gimp_dodgeburn_tool_non_gui not implemented yet\n");
return FALSE;
return FALSE;
}

View File

@ -19,8 +19,24 @@
#ifndef __GIMP_DODGE_BURN_TOOL_H__
#define __GIMP_DODGE_BURN_TOOL_H__
#include "gimppainttool.h"
typedef enum
{
DODGE,
BURN
} DodgeBurnType;
typedef enum
{
DODGEBURN_HIGHLIGHTS,
DODGEBURN_MIDTONES,
DODGEBURN_SHADOWS
} DodgeBurnMode;
#define GIMP_TYPE_DODGEBURN_TOOL (gimp_dodgeburn_tool_get_type ())
#define GIMP_DODGEBURN_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DODGEBURN_TOOL, GimpDodgeBurnTool))
#define GIMP_IS_DODGEBURN_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DODGEBURN_TOOL))
@ -28,20 +44,6 @@
#define GIMP_IS_DODGEBURN_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DODGEBURN_TOOL))
typedef enum
{
DODGE,
BURN
} DodgeBurnType;
typedef enum
{
DODGEBURN_HIGHLIGHTS,
DODGEBURN_MIDTONES,
DODGEBURN_SHADOWS
} DodgeBurnMode;
typedef struct _GimpDodgeBurnTool GimpDodgeBurnTool;
typedef struct _GimpDodgeBurnToolClass GimpDodgeBurnToolClass;
@ -63,19 +65,16 @@ GtkType gimp_dodgeburn_tool_get_type (void);
/* FIXME: Get rid of this non_gui stuff someday. Preferably make
* everything use it interally for ease of macro recording.
*/
gboolean dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array);
gboolean dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array);
gboolean dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
gboolean dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
#endif /* __GIMP_DODGEBURN_TOOL_H__ */

View File

@ -88,7 +88,7 @@ gimp_scale_tool_register (void)
"gimp:scale_tool",
_("Scale Tool"),
_("Scale the layer or selection"),
N_("/Tools/Color Picker"), "<shift>T",
N_("/Tools/Transform Tools/Transform"), "<shift>T",
NULL, "tools/transform.html",
(const gchar **) scale_bits);
}

View File

@ -20,7 +20,7 @@
#define __GIMP_SCALE_TOOL_H__
#include "tools/gimptransformtool.h"
#include "gimptransformtool.h"
#define GIMP_TYPE_SCALE_TOOL (gimp_scale_tool_get_type ())
@ -43,6 +43,9 @@ struct _GimpScaleToolClass
};
void gimp_scale_tool_register (void);
GtkType gimp_scale_tool_get_type (void);
TileManager * gimp_scale_tool_scale (GimpImage *gimage,
GimpDrawable *drawable,
GDisplay *gdisp,
@ -51,8 +54,5 @@ TileManager * gimp_scale_tool_scale (GimpImage *gimage,
gboolean interpolation,
GimpMatrix3 matrix);
void gimp_scale_tool_register (void);
GtkType gimp_scale_tool_get_type (void);
#endif /* __GIMP_SCALE_TOOL_H__ */

View File

@ -501,21 +501,16 @@ STUB(threshold_dialog_hide)
STUB(levels_dialog_hide)
STUB(curves_dialog_hide)
STUB(posterize_dialog_hide)
STUB(move_tool_start_hguide)
STUB(move_tool_start_vguide)
STUB(by_color_select_initialize_by_image)
STUB(undo_pop_paint)
STUB(histogram_tool_histogram_range)
STUB(transform_core_cut)
STUB(flip_tool_flip)
STUB(transform_core_paste)
STUB(perspective_find_transform)
STUB(perspective_tool_perspective)
STUB(rotate_tool_rotate)
STUB(shear_tool_shear)
STUB(smudge_non_gui)
STUB(smudge_non_gui_default)
STUB(transform_core_do)
STUB(airbrush_non_gui)
STUB(airbrush_non_gui_default)
STUB(by_color_select)
@ -532,32 +527,25 @@ ToolInfo tool_info[] =
{
{
NULL,
N_("Bezier Select"),
N_("/Tools/Select Tools/Bezier Select"),
"B",
(char **) bezier_bits,
N_("Transform"),
N_("/Tools/Transform Tools/Transform"),
"<shift>T",
(char **) scale_bits,
NULL,
NULL,
N_("Select regions using Bezier curves"),
"tools/bezier_select.html",
BEZIER_SELECT,
tools_new_bezier_select,
tools_free_bezier_select,
N_("Rotation, scaling, shearing, perspective."),
"tools/transform.html",
ROTATE,
tools_new_transform_tool,
tools_free_transform_tool,
NULL,
NULL,
NULL,
{
bezier_select_small_bits, bezier_select_small_mask_bits,
bezier_select_small_width, bezier_select_small_height,
rotate_small_bits, rotate_small_mask_bits,
rotate_small_width, rotate_small_height,
0, 0, NULL, NULL, NULL
},
{
NULL, NULL,
0, 0,
0, 0, NULL, NULL, NULL
}
},
{
NULL, NULL,
0, 0,
@ -901,34 +889,6 @@ ToolInfo tool_info[] =
}
},
{
NULL,
N_("Dodge or Burn"),
N_("/Tools/Paint Tools/DodgeBurn"),
"<shift>D",
(char **) dodge_bits,
NULL,
NULL,
N_("Dodge or Burn"),
"tools/dodgeburn.html",
DODGEBURN,
tools_new_dodgeburn,
tools_free_dodgeburn,
NULL,
NULL,
NULL,
{
dodge_small_bits, dodge_small_mask_bits,
dodge_small_width, dodge_small_height,
0, 0, NULL, NULL, NULL
},
{
burn_small_bits, burn_small_mask_bits,
burn_small_width, burn_small_height,
0, 0, NULL, NULL, NULL
}
},
/*
{
NULL,
@ -959,34 +919,6 @@ ToolInfo tool_info[] =
},
*/
{
NULL,
N_("Measure"),
N_("/Tools/Measure"),
"",
(char **) measure_bits,
NULL,
NULL,
N_("Measure distances and angles"),
"tools/measure.html",
MEASURE,
tools_new_measure_tool,
tools_free_measure_tool,
NULL,
NULL,
NULL,
{
measure_small_bits, measure_small_mask_bits,
measure_small_width, measure_small_height,
0, 0, NULL, NULL, NULL
},
{
NULL, NULL,
0, 0,
0, 0, NULL, NULL, NULL
}
},
/*
{
NULL,
@ -1273,4 +1205,3 @@ ToolInfo tool_info[] =
gint num_tools = sizeof (tool_info) / sizeof (tool_info[0]);
#endif

View File

@ -41,6 +41,11 @@
#include "tool_options.h"
#include "tool_options_dialog.h"
#include "gimppaintbrushtool.h"
#include "gimpdodgeburntool.h"
#include "gimperasertool.h"
#include "gimppenciltool.h"
#include "libgimp/gimpintl.h"
@ -340,16 +345,52 @@ tool_manager_get_info_by_tool (GimpTool *tool)
const gchar *
tool_manager_active_get_PDB_string (void)
{
const gchar *toolStr = "gimp_paintbrush_default";
GimpToolInfo *tool_info;
const gchar *tool_str = "gimp_paintbrush_default";
/* Return the correct PDB function for the active tool
* The default is paintbrush if the tool is not recognised
* The default is paintbrush if the tool is not recognized
*/
if (! active_tool)
return toolStr;
return tool_str;
return gimp_tool_get_PDB_string (active_tool);
tool_info = gimp_context_get_tool (gimp_context_get_user ());
if (tool_info->tool_type == GIMP_TYPE_PENCIL_TOOL)
{
tool_str = "gimp_pencil";
}
else if (tool_info->tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
{
tool_str = "gimp_paintbrush_default";
}
else if (tool_info->tool_type == GIMP_TYPE_ERASER_TOOL)
{
tool_str = "gimp_eraser_default";
}
else if (tool_info->tool_type == GIMP_TYPE_AIRBRUSH_TOOL)
{
tool_str = "gimp_airbrush_default";
}
else if (tool_info->tool_type == GIMP_TYPE_CLONE_TOOL)
{
tool_str = "gimp_clone_default";
}
else if (tool_info->tool_type == GIMP_TYPE_CONVOLVE_TOOL)
{
tool_str = "gimp_convolve_default";
}
else if (tool_info->tool_type == GIMP_TYPE_SMUDGE_TOOL)
{
tool_str = "gimp_smudge_default";
}
else if (tool_info->tool_type == GIMP_TYPE_DODGEBURN_TOOL)
{
tool_str = "gimp_dodgeburn_default";
}
return tool_str;
}
const gchar *

File diff suppressed because it is too large Load Diff

View File

@ -1,159 +0,0 @@
/* 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 __TRANSFORM_CORE_H__
#define __TRANSFORM_CORE_H__
/* buffer sizes for scaling information strings (for the info dialog) */
#define MAX_INFO_BUF 40
#define TRAN_INFO_SIZE 8
enum BoundingBox
{
X0, Y0, X1, Y1, X2, Y2, X3, Y3
};
typedef gdouble TranInfo[TRAN_INFO_SIZE];
typedef TileManager * (* TransformFunc) (Tool *tool,
GDisplay *gdisp,
TransformState state);
struct _TransformCore
{
GimpDrawTool parent_instance; /* Core select object */
gint startx; /* starting x coord */
gint starty; /* starting y coord */
gint curx; /* current x coord */
gint cury; /* current y coord */
gint lastx; /* last x coord */
gint lasty; /* last y coord */
gint state; /* state of buttons and keys */
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
gint cx, cy; /* center point (for rotation) */
gdouble tx1, ty1; /* transformed coords */
gdouble tx2, ty2; /* */
gdouble tx3, ty3; /* */
gdouble tx4, ty4; /* */
gdouble tcx, tcy; /* */
gint sx1, sy1; /* transformed screen coords */
gint sx2, sy2; /* position of four handles */
gint sx3, sy3; /* */
gint sx4, sy4; /* */
gint scx, scy; /* and center for rotation */
GimpMatrix3 transform; /* transformation matrix */
TranInfo trans_info; /* transformation info */
TileManager *original; /* pointer to original tiles */
TransformFunc trans_func; /* transformation function */
TransformAction function; /* current tool activity */
gboolean interactive; /* tool is interactive */
gboolean bpressed; /* Bug work around make sure we have
* a button pressed before we deal with
* motion events. ALT.
*/
gint ngx, ngy; /* number of grid lines in original
* x and y directions
*/
gdouble *grid_coords; /* x and y coordinates of the grid
* endpoints (a total of (ngx+ngy)*2
* coordinate pairs)
*/
gdouble *tgrid_coords; /* transformed grid_coords */
};
/* Special undo type */
typedef struct _TransformUndo TransformUndo;
struct _TransformUndo
{
gint tool_ID;
gint tool_type;
TranInfo trans_info;
TileManager *original;
gpointer path_undo;
};
/* make this variable available to all */
extern InfoDialog * transform_info;
/* transform tool action functions */
void transform_core_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
void transform_core_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
void transform_core_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
void transform_core_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
void transform_core_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
/* transform tool functions */
/* make PDB compile: ToolType doesn't exist any more
Tool * transform_core_new (ToolType tool_type,
gboolean interactive);
*/
void transform_core_free (Tool *tool);
void transform_core_draw (Tool *tool);
void transform_core_no_draw (Tool *tool);
void transform_core_transform_bounding_box (Tool *tool);
void transform_core_reset (Tool *tool,
GDisplay *gdisp);
void transform_core_grid_density_changed (void);
void transform_core_showpath_changed (gint type);
/* transform functions */
TileManager * transform_core_do (GimpImage *gimage,
GimpDrawable *drawable,
TileManager *float_tiles,
gboolean interpolation,
GimpMatrix3 matrix,
GimpProgressFunc progress_callback,
gpointer progress_data);
TileManager * transform_core_cut (GimpImage *gimage,
GimpDrawable *drawable,
gboolean *new_layer);
gboolean transform_core_paste (GimpImage *gimage,
GimpDrawable *drawable,
TileManager *tiles,
gboolean new_layer);
#endif /* __TRANSFORM_CORE_H__ */

View File

@ -1,460 +0,0 @@
/* 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 "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "apptypes.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "perspective_tool.h"
#include "rotate_tool.h"
#include "scale_tool.h"
#include "shear_tool.h"
#include "tools.h"
#include "tool_options.h"
#include "transform_core.h"
#include "transform_tool.h"
#include "libgimp/gimpintl.h"
/* the transform structures */
typedef struct _TransformOptions TransformOptions;
struct _TransformOptions
{
ToolOptions tool_options;
ToolType type;
ToolType type_d;
GtkWidget *type_w[4]; /* 4 radio buttons */
gboolean smoothing;
gboolean smoothing_d;
GtkWidget *smoothing_w;
gint direction;
gint direction_d;
GtkWidget *direction_w[2]; /* 2 radio buttons */
gboolean show_grid;
gboolean show_grid_d;
GtkWidget *show_grid_w;
gint grid_size;
gint grid_size_d;
GtkObject *grid_size_w;
gboolean clip;
gboolean clip_d;
GtkWidget *clip_w;
gboolean showpath;
gboolean showpath_d;
GtkWidget *showpath_w;
};
/* the transform tool options */
static TransformOptions *transform_options = NULL;
/* local functions */
static void transform_change_type (ToolType new_type);
/* functions */
static void
transform_show_grid_update (GtkWidget *widget,
gpointer data)
{
static gboolean first_call = TRUE; /* eek, this hack avoids a segfault */
if (first_call)
{
first_call = FALSE;
return;
}
gimp_toggle_button_update (widget, data);
transform_core_grid_density_changed ();
}
static void
transform_show_path_update (GtkWidget *widget,
gpointer data)
{
static gboolean first_call = TRUE; /* eek, this hack avoids a segfault */
if (first_call)
{
first_call = FALSE;
return;
}
transform_core_showpath_changed (1); /* pause */
gimp_toggle_button_update (widget, data);
transform_core_showpath_changed (0); /* resume */
}
static void
transform_type_callback (GtkWidget *widget,
gpointer data)
{
transform_change_type ((long) data);
}
static void
transform_direction_callback (GtkWidget *widget,
gpointer data)
{
long dir = (long) data;
if (dir == TRANSFORM_TRADITIONAL)
transform_options->direction = TRANSFORM_TRADITIONAL;
else
transform_options->direction = TRANSFORM_CORRECTIVE;
}
static void
transform_grid_density_callback (GtkWidget *widget,
gpointer data)
{
transform_options->grid_size =
(int) (pow (2.0, 7.0 - GTK_ADJUSTMENT (widget)->value) + 0.5);
transform_core_grid_density_changed ();
}
static void
transform_options_reset (void)
{
TransformOptions *options = transform_options;
gtk_toggle_button_set_active (((options->type_d == ROTATE) ?
GTK_TOGGLE_BUTTON (options->type_w[0]) :
((options->type_d == SCALE) ?
GTK_TOGGLE_BUTTON (options->type_w[1]) :
((options->type_d == SHEAR) ?
GTK_TOGGLE_BUTTON (options->type_w[2]) :
GTK_TOGGLE_BUTTON (options->type_w[3])))),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
options->smoothing_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->showpath_w),
options->showpath_d);
gtk_toggle_button_set_active (((options->direction_d == TRANSFORM_TRADITIONAL) ?
GTK_TOGGLE_BUTTON (options->direction_w[0]) :
GTK_TOGGLE_BUTTON (options->direction_w[1])),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w),
options->show_grid_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w),
7.0 - log (options->grid_size_d) / log (2.0));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->clip_w),
options->clip_d);
}
static TransformOptions *
transform_options_new (void)
{
TransformOptions *options;
GtkWidget *table;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *fbox;
GtkWidget *grid_density;
/* the new transform tool options structure */
options = g_new (TransformOptions, 1);
tool_options_init ((ToolOptions *) options,
_("Transform Tool"),
transform_options_reset);
options->type = options->type_d = ROTATE;
options->smoothing = options->smoothing_d = TRUE;
options->showpath = options->showpath_d = TRUE;
options->clip = options->clip_d = FALSE;
options->direction = options->direction_d = TRANSFORM_TRADITIONAL;
options->grid_size = options->grid_size_d = 32;
options->show_grid = options->show_grid_d = TRUE;
/* the main table */
table = gtk_table_new (2, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox), table,
FALSE, FALSE, 0);
/* the left vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_table_attach_defaults (GTK_TABLE (table), vbox, 0, 1, 0, 1);
/* the transform type radio buttons */
frame = gimp_radio_group_new (TRUE, _("Transform"),
_("Rotation"), transform_type_callback,
ROTATE, NULL, &options->type_w[0], TRUE,
_("Scaling"), transform_type_callback,
SCALE, NULL, &options->type_w[1], FALSE,
_("Shearing"), transform_type_callback,
SHEAR, NULL, &options->type_w[2], FALSE,
_("Perspective"), transform_type_callback,
PERSPECTIVE, NULL, &options->type_w[3], FALSE,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
gtk_widget_show (vbox);
/* the right vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_table_attach_defaults (GTK_TABLE (table), vbox, 1, 2, 0, 1);
/* the second radio frame and box, for transform direction */
frame = gimp_radio_group_new (TRUE, _("Tool Paradigm"),
_("Traditional"), transform_direction_callback,
TRANSFORM_TRADITIONAL, NULL,
&options->direction_w[0], TRUE,
_("Corrective"), transform_direction_callback,
TRANSFORM_CORRECTIVE, NULL,
&options->direction_w[1], FALSE,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
/* the grid frame */
frame = gtk_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
fbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (fbox), 2);
gtk_container_add (GTK_CONTAINER (frame), fbox);
/* the show grid toggle button */
options->show_grid_w = gtk_check_button_new_with_label (_("Show Grid"));
gtk_signal_connect (GTK_OBJECT (options->show_grid_w), "toggled",
GTK_SIGNAL_FUNC (transform_show_grid_update),
&options->show_grid);
gtk_box_pack_start (GTK_BOX (fbox), options->show_grid_w, FALSE, FALSE, 0);
gtk_widget_show (options->show_grid_w);
/* the grid density entry */
hbox = gtk_hbox_new (FALSE, 6);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (fbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new (_("Density:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
options->grid_size_w =
gtk_adjustment_new (7.0 - log (options->grid_size_d) / log (2.0), 0.0, 5.0,
1.0, 1.0, 0.0);
grid_density =
gtk_spin_button_new (GTK_ADJUSTMENT (options->grid_size_w), 0, 0);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (grid_density), TRUE);
gtk_signal_connect (GTK_OBJECT (options->grid_size_w), "value_changed",
GTK_SIGNAL_FUNC (transform_grid_density_callback),
&options->grid_size);
gtk_box_pack_start (GTK_BOX (hbox), grid_density, FALSE, FALSE, 0);
gtk_widget_show (grid_density);
gtk_widget_set_sensitive (label, options->show_grid_d);
gtk_widget_set_sensitive (grid_density, options->show_grid_d);
gtk_object_set_data (GTK_OBJECT (options->show_grid_w), "set_sensitive",
grid_density);
gtk_object_set_data (GTK_OBJECT (grid_density), "set_sensitive", label);
gtk_widget_show (fbox);
gtk_widget_show (frame);
gtk_widget_show (vbox);
/* the smoothing toggle button */
options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing"));
gtk_signal_connect (GTK_OBJECT (options->smoothing_w), "toggled",
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
&options->smoothing);
gtk_table_attach_defaults (GTK_TABLE (table),
options->smoothing_w, 0, 1, 1, 2);
gtk_widget_show (options->smoothing_w);
/* the showpath toggle button */
options->showpath_w = gtk_check_button_new_with_label (_("Show Path"));
gtk_signal_connect (GTK_OBJECT (options->showpath_w), "toggled",
GTK_SIGNAL_FUNC (transform_show_path_update),
&options->showpath);
gtk_table_attach_defaults (GTK_TABLE (table),
options->showpath_w, 1, 2, 1, 2);
gtk_widget_show (options->showpath_w);
gtk_widget_show (table);
/* the clip resulting image toggle button */
options->clip_w = gtk_check_button_new_with_label (_("Clip Result"));
gtk_signal_connect (GTK_OBJECT (options->clip_w), "toggled",
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
&options->clip);
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
options->clip_w, FALSE, FALSE, 0);
gtk_widget_show (options->clip_w);
return options;
}
Tool *
tools_new_transform_tool (void)
{
/* The tool options */
if (! transform_options)
{
transform_options = transform_options_new ();
tools_register (ROTATE, (ToolOptions *) transform_options);
tools_register (SCALE, (ToolOptions *) transform_options);
tools_register (SHEAR, (ToolOptions *) transform_options);
tools_register (PERSPECTIVE, (ToolOptions *) transform_options);
/* press all default buttons */
transform_options_reset ();
}
switch (transform_options->type)
{
case ROTATE:
return tools_new_rotate_tool ();
break;
case SCALE:
return tools_new_scale_tool ();
break;
case SHEAR:
return tools_new_shear_tool ();
break;
case PERSPECTIVE:
return tools_new_perspective_tool ();
break;
default :
return NULL;
break;
}
}
void
tools_free_transform_tool (Tool *tool)
{
switch (transform_options->type)
{
case ROTATE:
tools_free_rotate_tool (tool);
break;
case SCALE:
tools_free_scale_tool (tool);
break;
case SHEAR:
tools_free_shear_tool (tool);
break;
case PERSPECTIVE:
tools_free_perspective_tool (tool);
break;
default:
break;
}
}
static void
transform_change_type (ToolType new_type)
{
if (transform_options->type != new_type)
{
/* change the type, free the old tool, create the new tool */
transform_options->type = new_type;
if (gimp_context_get_tool (gimp_context_get_user ()) != new_type)
gimp_context_set_tool (gimp_context_get_user (), new_type);
else
gimp_context_tool_changed (gimp_context_get_user ());
}
}
gboolean
transform_tool_smoothing (void)
{
if (!transform_options)
return TRUE;
else
return transform_options->smoothing;
}
gboolean
transform_tool_showpath (void)
{
if (!transform_options)
return TRUE;
else
return transform_options->showpath;
}
gboolean
transform_tool_clip (void)
{
if (!transform_options)
return FALSE;
else
return transform_options->clip;
}
gint
transform_tool_direction (void)
{
if (!transform_options)
return TRANSFORM_TRADITIONAL;
else
return transform_options->direction;
}
gint
transform_tool_grid_size (void)
{
if (!transform_options)
return 32;
else
return transform_options->grid_size;
}
gboolean
transform_tool_show_grid (void)
{
if (!transform_options)
return TRUE;
else
return transform_options->show_grid;
}

View File

@ -1,39 +0,0 @@
/* 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 __TRANSFORM_TOOL_H__
#define __TRANSFORM_TOOL_H__
/* transform directions */
#define TRANSFORM_TRADITIONAL 0
#define TRANSFORM_CORRECTIVE 1
/* tool functions */
Tool * tools_new_transform_tool (void);
void tools_free_transform_tool (Tool *tool);
gboolean transform_tool_smoothing (void);
gboolean transform_tool_showpath (void);
gboolean transform_tool_clip (void);
gint transform_tool_direction (void);
gint transform_tool_grid_size (void);
gboolean transform_tool_show_grid (void);
#endif /* __TRANSFORM_TOOL_H__ */

View File

@ -71,11 +71,11 @@ app/resolution_calibrate.c
app/scan_convert.c
app/tips_dialog.c
app/toolbox.c
app/tools/bezier_select.c
app/tools/brightness_contrast.c
app/tools/color_balance.c
app/tools/curves.c
app/tools/gimpairbrushtool.c
app/tools/gimpbezierselecttool.c
app/tools/gimpblendtool.c
app/tools/gimpbucketfilltool.c
app/tools/gimpbycolorselecttool.c
@ -101,6 +101,7 @@ app/tools/gimpscaletool.c
app/tools/gimpsheartool.c
app/tools/gimpsmudgetool.c
app/tools/gimptexttool.c
app/tools/gimptransformtool.c
app/tools/histogram_tool.c
app/tools/hue_saturation.c
app/tools/levels.c
@ -111,8 +112,6 @@ app/tools/threshold.c
app/tools/tool_options.c
app/tools/tool_options_dialog.c
app/tools/tools.c
app/tools/transform_core.c
app/tools/transform_tool.c
app/undo.c
app/undo_history.c
app/user_install.c