mirror of https://github.com/GNOME/gimp.git
app/tools/Makefile.am applied a patch from Dave Neary which re-activates
2001-03-31 Michael Natterer <mitch@gimp.org> * app/tools/Makefile.am * app/tools/gimpfliptool.[ch]: applied a patch from Dave Neary which re-activates this tool. Enabled the tool options too. * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpiscissorstool.c * app/tools/gimptexttool.c: trivial fixes. * app/tools/gimptool.c: removed cruft. * app/tools/gimptransformtool.[ch]: a special case for the flip tool, cleanup. * app/tools/tools.c: register the flip tool.
This commit is contained in:
parent
bb134d6ed4
commit
f81a8b0024
|
@ -59,6 +59,7 @@
|
|||
#include "tools/gimprotatetool.h"
|
||||
#include "tools/gimpscaletool.h"
|
||||
#include "tools/gimpsheartool.h"
|
||||
#include "tools/gimpfliptool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -554,8 +555,7 @@ gimp_transform_tool_button_release (GimpTool *tool,
|
|||
gt_tool->bpressed = FALSE; /* ALT */
|
||||
|
||||
/* if we are creating, there is nothing to be done...exit */
|
||||
if (gt_tool->function == TRANSFORM_CREATING &&
|
||||
gt_tool->interactive)
|
||||
if (gt_tool->function == TRANSFORM_CREATING && gt_tool->interactive)
|
||||
return;
|
||||
|
||||
/* release of the pointer grab */
|
||||
|
@ -566,7 +566,7 @@ gimp_transform_tool_button_release (GimpTool *tool,
|
|||
if (! (bevent->state & GDK_BUTTON3_MASK))
|
||||
{
|
||||
/* Shift-clicking is another way to approve the transform */
|
||||
if ((bevent->state & GDK_SHIFT_MASK) /* FIXME || (tool->type == FLIP) */)
|
||||
if ((bevent->state & GDK_SHIFT_MASK) || GIMP_IS_FLIP_TOOL (tool))
|
||||
{
|
||||
gimp_transform_tool_doit (gt_tool, gdisp);
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool,
|
|||
/* Send the request for the transformation to the tool...
|
||||
*/
|
||||
new_tiles = gimp_transform_tool_transform (gt_tool, gdisp,
|
||||
TRANSFORM_FINISH);
|
||||
TRANSFORM_FINISH);
|
||||
|
||||
gimp_transform_tool_transform (gt_tool, gdisp, TRANSFORM_INIT);
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "tools/gimprotatetool.h"
|
||||
#include "tools/gimpscaletool.h"
|
||||
#include "tools/gimpsheartool.h"
|
||||
#include "tools/gimpfliptool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -554,8 +555,7 @@ gimp_transform_tool_button_release (GimpTool *tool,
|
|||
gt_tool->bpressed = FALSE; /* ALT */
|
||||
|
||||
/* if we are creating, there is nothing to be done...exit */
|
||||
if (gt_tool->function == TRANSFORM_CREATING &&
|
||||
gt_tool->interactive)
|
||||
if (gt_tool->function == TRANSFORM_CREATING && gt_tool->interactive)
|
||||
return;
|
||||
|
||||
/* release of the pointer grab */
|
||||
|
@ -566,7 +566,7 @@ gimp_transform_tool_button_release (GimpTool *tool,
|
|||
if (! (bevent->state & GDK_BUTTON3_MASK))
|
||||
{
|
||||
/* Shift-clicking is another way to approve the transform */
|
||||
if ((bevent->state & GDK_SHIFT_MASK) /* FIXME || (tool->type == FLIP) */)
|
||||
if ((bevent->state & GDK_SHIFT_MASK) || GIMP_IS_FLIP_TOOL (tool))
|
||||
{
|
||||
gimp_transform_tool_doit (gt_tool, gdisp);
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool,
|
|||
/* Send the request for the transformation to the tool...
|
||||
*/
|
||||
new_tiles = gimp_transform_tool_transform (gt_tool, gdisp,
|
||||
TRANSFORM_FINISH);
|
||||
TRANSFORM_FINISH);
|
||||
|
||||
gimp_transform_tool_transform (gt_tool, gdisp, TRANSFORM_INIT);
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ libapptools_la_SOURCES = \
|
|||
gimpellipseselecttool.h \
|
||||
gimperasertool.c \
|
||||
gimperasertool.h \
|
||||
## gimpfliptool.c \
|
||||
## gimpfliptool.h \
|
||||
gimpfliptool.c \
|
||||
gimpfliptool.h \
|
||||
gimpfreeselecttool.c \
|
||||
gimpfreeselecttool.h \
|
||||
gimpfuzzyselecttool.c \
|
||||
|
|
|
@ -277,7 +277,7 @@ gimp_bezier_select_tool_register (void)
|
|||
"gimp:bezier_select_tool",
|
||||
_("Bezier Select"),
|
||||
_("Select regions using Bezier curves"),
|
||||
_("/Tools/Select Tools/Bezier Select"), "B",
|
||||
_("/Tools/Selection Tools/Bezier Select"), "B",
|
||||
NULL, "tools/bezier_select.html",
|
||||
(const gchar **) bezier_bits);
|
||||
}
|
||||
|
@ -3774,10 +3774,9 @@ bezier_stroke (GimpBezierSelectTool *bezier_sel,
|
|||
*ptr /= SUPERSAMPLE;
|
||||
*ptr++ -= offset_y;
|
||||
}
|
||||
#if 0
|
||||
/* Stroke with the correct tool */
|
||||
return_vals =
|
||||
procedural_db_run_proc (tool_active_PDB_string (),
|
||||
procedural_db_run_proc (tool_manager_active_get_PDB_string (),
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
|
||||
PDB_INT32, (gint32) rpnts->num_stroke_points * 2,
|
||||
|
@ -3788,7 +3787,7 @@ bezier_stroke (GimpBezierSelectTool *bezier_sel,
|
|||
g_message (_("Paintbrush operation failed."));
|
||||
|
||||
procedural_db_destroy_args (return_vals, nreturn_vals);
|
||||
#endif
|
||||
|
||||
g_free (rpnts->stroke_points);
|
||||
}
|
||||
|
||||
|
|
|
@ -196,6 +196,8 @@ gimp_bucket_fill_tool_init (GimpBucketFillTool *bucket_fill_tool)
|
|||
bucket_options_reset ();
|
||||
}
|
||||
|
||||
tool->tool_cursor = GIMP_BUCKET_FILL_TOOL_CURSOR;
|
||||
|
||||
tool->scroll_lock = TRUE; /* Disallow scrolling */
|
||||
}
|
||||
|
||||
|
|
|
@ -28,28 +28,34 @@
|
|||
#include "apptypes.h"
|
||||
|
||||
#include "cursorutil.h"
|
||||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimplayer.h"
|
||||
#include "gimpimage.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "selection.h"
|
||||
#include "undo.h"
|
||||
#include "path_transform.h"
|
||||
#include "pixel_region.h"
|
||||
#include "temp_buf.h"
|
||||
#include "tile_manager.h"
|
||||
#include "paint_funcs.h"
|
||||
|
||||
#include "flip_tool.h"
|
||||
#include "gimpfliptool.h"
|
||||
#include "tool_manager.h"
|
||||
#include "tool_options.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "pixmaps2.h"
|
||||
|
||||
|
||||
/* FIXME: Lame - 1 hacks abound since the code assumes certain values for
|
||||
* the ORIENTATION_FOO constants.
|
||||
*/
|
||||
|
||||
#define FLIP_INFO 0
|
||||
|
||||
/* the flip structures */
|
||||
|
||||
typedef struct _FlipOptions FlipOptions;
|
||||
|
||||
struct _FlipOptions
|
||||
|
@ -64,196 +70,69 @@ struct _FlipOptions
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static TileManager * flip_tool_transform (Tool *tool,
|
||||
GDisplay *gdisp,
|
||||
TransformState state);
|
||||
static void gimp_flip_tool_class_init (GimpFlipToolClass *klass);
|
||||
static void gimp_flip_tool_init (GimpFlipTool *flip_tool);
|
||||
|
||||
static void gimp_flip_tool_destroy (GtkObject *object);
|
||||
|
||||
static void gimp_flip_tool_cursor_update (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp);
|
||||
static void gimp_flip_tool_modifier_key (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GDisplay *gdisp);
|
||||
|
||||
static TileManager * gimp_flip_tool_transform (GimpTransformTool *tool,
|
||||
GDisplay *gdisp,
|
||||
TransformState state);
|
||||
|
||||
static FlipOptions * flip_options_new (void);
|
||||
static void flip_options_reset (void);
|
||||
|
||||
/* private variables */
|
||||
|
||||
static FlipOptions *flip_options = NULL;
|
||||
|
||||
/* functions */
|
||||
static GimpTransformToolClass *parent_class = NULL;
|
||||
|
||||
/* FIXME: Lame - 1 hacks abound since the code assumes certain values for
|
||||
* the ORIENTATION_FOO constants.
|
||||
*/
|
||||
|
||||
static void
|
||||
flip_options_reset (void)
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_flip_tool_register (void)
|
||||
{
|
||||
FlipOptions *options = flip_options;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d - 1]), TRUE);
|
||||
tool_manager_register_tool (GIMP_TYPE_FLIP_TOOL,
|
||||
FALSE,
|
||||
"gimp:flip_tool",
|
||||
_("Flip Tool"),
|
||||
_("Flip the layer or selection"),
|
||||
N_("/Tools/Transform Tools/Flip"), "<shift>F",
|
||||
NULL, "tools/flip.html",
|
||||
(const gchar **) flip_bits);
|
||||
}
|
||||
|
||||
static FlipOptions *
|
||||
flip_options_new (void)
|
||||
GtkType
|
||||
gimp_flip_tool_get_type (void)
|
||||
{
|
||||
FlipOptions *options;
|
||||
static GtkType tool_type = 0;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
|
||||
/* the new flip tool options structure */
|
||||
options = g_new (FlipOptions, 1);
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Flip Tool"),
|
||||
flip_options_reset);
|
||||
options->type = options->type_d = ORIENTATION_HORIZONTAL;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* tool toggle */
|
||||
frame =
|
||||
gimp_radio_group_new2 (TRUE, _("Tool Toggle"),
|
||||
gimp_radio_button_update,
|
||||
&options->type, (gpointer) options->type,
|
||||
|
||||
_("Horizontal"), (gpointer) ORIENTATION_HORIZONTAL,
|
||||
&options->type_w[0],
|
||||
_("Vertical"), (gpointer) ORIENTATION_VERTICAL,
|
||||
&options->type_w[1],
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
static void
|
||||
flip_modifier_key_func (Tool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
switch (kevent->keyval)
|
||||
if (! tool_type)
|
||||
{
|
||||
case GDK_Alt_L: case GDK_Alt_R:
|
||||
break;
|
||||
case GDK_Shift_L: case GDK_Shift_R:
|
||||
break;
|
||||
case GDK_Control_L: case GDK_Control_R:
|
||||
if (flip_options->type == ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (flip_options->type_w[ORIENTATION_VERTICAL - 1]), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (flip_options->type_w[ORIENTATION_HORIZONTAL - 1]), TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
GtkTypeInfo tool_info =
|
||||
{
|
||||
"GimpFlipTool",
|
||||
sizeof (GimpFlipTool),
|
||||
sizeof (GimpFlipToolClass),
|
||||
(GtkClassInitFunc) gimp_flip_tool_class_init,
|
||||
(GtkObjectInitFunc) gimp_flip_tool_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
static TileManager *
|
||||
flip_tool_transform (Tool *tool,
|
||||
GDisplay *gdisp,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore *transform_core;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case TRANSFORM_INIT:
|
||||
transform_info = NULL;
|
||||
break;
|
||||
|
||||
case TRANSFORM_MOTION:
|
||||
break;
|
||||
|
||||
case TRANSFORM_RECALC:
|
||||
break;
|
||||
|
||||
case TRANSFORM_FINISH:
|
||||
/* transform_core->trans_info[FLIP] *= -1.0;*/
|
||||
return flip_tool_flip (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
transform_core->original,
|
||||
(int) transform_core->trans_info[FLIP_INFO],
|
||||
flip_options->type);
|
||||
break;
|
||||
tool_type = gtk_type_unique (GIMP_TYPE_TRANSFORM_TOOL, &tool_info);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
flip_cursor_update (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GdkCursorType ctype = GIMP_BAD_CURSOR;
|
||||
|
||||
if ((drawable = gimp_image_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
gint x, y;
|
||||
gint off_x, off_y;
|
||||
|
||||
gimp_drawable_offsets (drawable, &off_x, &off_y);
|
||||
gdisplay_untransform_coords (gdisp,
|
||||
(double) mevent->x, (double) mevent->y,
|
||||
&x, &y, TRUE, FALSE);
|
||||
|
||||
if (x >= off_x && y >= off_y &&
|
||||
x < (off_x + gimp_drawable_width (drawable)) &&
|
||||
y < (off_y + gimp_drawable_height (drawable)))
|
||||
{
|
||||
/* Is there a selected region? If so, is cursor inside? */
|
||||
if (gimage_mask_is_empty (gdisp->gimage) ||
|
||||
gimage_mask_value (gdisp->gimage, x, y))
|
||||
{
|
||||
if (flip_options->type == ORIENTATION_HORIZONTAL)
|
||||
ctype = GDK_SB_H_DOUBLE_ARROW;
|
||||
else
|
||||
ctype = GDK_SB_V_DOUBLE_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
gdisplay_install_tool_cursor (gdisp,
|
||||
ctype,
|
||||
ctype == GDK_SB_H_DOUBLE_ARROW ?
|
||||
GIMP_FLIP_HORIZONTAL_TOOL_CORSOR :
|
||||
GIMP_FLIP_VERTICAL_TOOL_CORSOR,
|
||||
CURSOR_MODIFIER_NONE);
|
||||
}
|
||||
|
||||
Tool *
|
||||
tools_new_flip (void)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
/* The tool options */
|
||||
if (! flip_options)
|
||||
{
|
||||
flip_options = flip_options_new ();
|
||||
tools_register (FLIP, (ToolOptions *) flip_options);
|
||||
}
|
||||
|
||||
tool = transform_core_new (FLIP, FALSE);
|
||||
private = tool->private;
|
||||
|
||||
private->trans_func = flip_tool_transform;
|
||||
private->trans_info[FLIP_INFO] = -1.0;
|
||||
|
||||
tool->modifier_key_func = flip_modifier_key_func;
|
||||
tool->cursor_update_func = flip_cursor_update;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
||||
void
|
||||
tools_free_flip_tool (Tool *tool)
|
||||
{
|
||||
transform_core_free (tool);
|
||||
return tool_type;
|
||||
}
|
||||
|
||||
TileManager *
|
||||
|
@ -324,3 +203,220 @@ flip_tool_flip (GimpImage *gimage,
|
|||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_flip_tool_class_init (GimpFlipToolClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GimpToolClass *tool_class;
|
||||
GimpDrawToolClass *draw_class;
|
||||
GimpTransformToolClass *trans_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
tool_class = (GimpToolClass *) klass;
|
||||
draw_class = (GimpDrawToolClass *) klass;
|
||||
trans_class = (GimpTransformToolClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_TRANSFORM_TOOL);
|
||||
|
||||
object_class->destroy = gimp_flip_tool_destroy;
|
||||
|
||||
tool_class->cursor_update = gimp_flip_tool_cursor_update;
|
||||
tool_class->modifier_key = gimp_flip_tool_modifier_key;
|
||||
|
||||
draw_class->draw = NULL;
|
||||
|
||||
trans_class->transform = gimp_flip_tool_transform;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_flip_tool_init (GimpFlipTool *flip_tool)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpTransformTool *tr_tool;
|
||||
|
||||
tool = GIMP_TOOL (flip_tool);
|
||||
tr_tool = GIMP_TRANSFORM_TOOL (flip_tool);
|
||||
|
||||
/* The tool options */
|
||||
if (! flip_options)
|
||||
{
|
||||
flip_options = flip_options_new ();
|
||||
|
||||
tool_manager_register_tool_options (GIMP_TYPE_FLIP_TOOL,
|
||||
(ToolOptions *) flip_options);
|
||||
}
|
||||
|
||||
tool->tool_cursor = GIMP_FLIP_HORIZONTAL_TOOL_CURSOR;
|
||||
tool->toggle_cursor = GIMP_FLIP_VERTICAL_TOOL_CURSOR;
|
||||
|
||||
tool->auto_snap_to = FALSE; /* Don't snap to guides */
|
||||
|
||||
tr_tool->trans_info[FLIP_INFO] = -1.0;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_flip_tool_destroy (GtkObject *object)
|
||||
{
|
||||
GimpFlipTool *flip_tool;
|
||||
GimpTool *tool;
|
||||
|
||||
flip_tool = GIMP_FLIP_TOOL (object);
|
||||
tool = GIMP_TOOL (flip_tool);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_flip_tool_cursor_update (GimpTool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GdkCursorType ctype = GIMP_BAD_CURSOR;
|
||||
GimpToolCursorType tool_cursor = GIMP_FLIP_HORIZONTAL_TOOL_CURSOR;
|
||||
|
||||
if ((drawable = gimp_image_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
gint x, y;
|
||||
gint off_x, off_y;
|
||||
|
||||
gimp_drawable_offsets (drawable, &off_x, &off_y);
|
||||
gdisplay_untransform_coords (gdisp,
|
||||
(double) mevent->x, (double) mevent->y,
|
||||
&x, &y, TRUE, FALSE);
|
||||
|
||||
if (x >= off_x && y >= off_y &&
|
||||
x < (off_x + gimp_drawable_width (drawable)) &&
|
||||
y < (off_y + gimp_drawable_height (drawable)))
|
||||
{
|
||||
/* Is there a selected region? If so, is cursor inside? */
|
||||
if (gimage_mask_is_empty (gdisp->gimage) ||
|
||||
gimage_mask_value (gdisp->gimage, x, y))
|
||||
{
|
||||
if (flip_options->type == ORIENTATION_HORIZONTAL)
|
||||
ctype = GDK_SB_H_DOUBLE_ARROW;
|
||||
else
|
||||
ctype = GDK_SB_V_DOUBLE_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flip_options->type == ORIENTATION_HORIZONTAL)
|
||||
tool_cursor = GIMP_FLIP_HORIZONTAL_TOOL_CURSOR;
|
||||
else
|
||||
tool_cursor = GIMP_FLIP_VERTICAL_TOOL_CURSOR;
|
||||
|
||||
gdisplay_install_tool_cursor (gdisp,
|
||||
ctype,
|
||||
tool_cursor,
|
||||
GIMP_CURSOR_MODIFIER_NONE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_flip_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:
|
||||
break;
|
||||
case GDK_Control_L: case GDK_Control_R:
|
||||
if (flip_options->type == ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (flip_options->type_w[ORIENTATION_VERTICAL - 1]), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (flip_options->type_w[ORIENTATION_HORIZONTAL - 1]), TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static TileManager *
|
||||
gimp_flip_tool_transform (GimpTransformTool *trans_tool,
|
||||
GDisplay *gdisp,
|
||||
TransformState state)
|
||||
{
|
||||
GimpTool *tool;
|
||||
|
||||
tool = GIMP_TOOL (trans_tool);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case TRANSFORM_INIT:
|
||||
transform_info = NULL;
|
||||
break;
|
||||
|
||||
case TRANSFORM_MOTION:
|
||||
break;
|
||||
|
||||
case TRANSFORM_RECALC:
|
||||
break;
|
||||
|
||||
case TRANSFORM_FINISH:
|
||||
return flip_tool_flip (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
trans_tool->original,
|
||||
(gint) trans_tool->trans_info[FLIP_INFO],
|
||||
flip_options->type);
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static FlipOptions *
|
||||
flip_options_new (void)
|
||||
{
|
||||
FlipOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
|
||||
/* the new flip tool options structure */
|
||||
options = g_new0 (FlipOptions, 1);
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
flip_options_reset);
|
||||
|
||||
options->type = options->type_d = ORIENTATION_HORIZONTAL;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* tool toggle */
|
||||
frame =
|
||||
gimp_radio_group_new2 (TRUE, _("Tool Toggle"),
|
||||
gimp_radio_button_update,
|
||||
&options->type, (gpointer) options->type,
|
||||
|
||||
_("Horizontal"), (gpointer) ORIENTATION_HORIZONTAL,
|
||||
&options->type_w[0],
|
||||
_("Vertical"), (gpointer) ORIENTATION_VERTICAL,
|
||||
&options->type_w[1],
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
static void
|
||||
flip_options_reset (void)
|
||||
{
|
||||
FlipOptions *options = flip_options;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d - 1]), TRUE);
|
||||
}
|
||||
|
|
|
@ -16,18 +16,44 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __FLIP_TOOL_H__
|
||||
#define __FLIP_TOOL_H__
|
||||
#ifndef __GIMP_FLIP_TOOL_H__
|
||||
#define __GIMP_FLIP_TOOL_H__
|
||||
|
||||
|
||||
TileManager * flip_tool_flip (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
TileManager *orig,
|
||||
gint flip,
|
||||
InternalOrientationType type);
|
||||
|
||||
Tool * tools_new_flip (void);
|
||||
void tools_free_flip_tool (Tool *tool);
|
||||
#include "gimptransformtool.h"
|
||||
|
||||
|
||||
#endif /* __FLIP_TOOL_H__ */
|
||||
#define GIMP_TYPE_FLIP_TOOL (gimp_flip_tool_get_type ())
|
||||
#define GIMP_FLIP_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_FLIP_TOOL, GimpFlipTool))
|
||||
#define GIMP_IS_FLIP_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_FLIP_TOOL))
|
||||
#define GIMP_FLIP_TOOL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FLIP_TOOL, GimpFlipToolClass))
|
||||
#define GIMP_IS_FLIP_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FLIP_TOOL))
|
||||
|
||||
|
||||
typedef struct _GimpFlipTool GimpFlipTool;
|
||||
typedef struct _GimpFlipToolClass GimpFlipToolClass;
|
||||
|
||||
struct _GimpFlipTool
|
||||
{
|
||||
GimpTransformTool parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpFlipToolClass
|
||||
{
|
||||
GimpTransformToolClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType gimp_flip_tool_get_type (void);
|
||||
|
||||
void gimp_flip_tool_register (void);
|
||||
|
||||
|
||||
TileManager * flip_tool_flip (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
TileManager *orig,
|
||||
gint flip,
|
||||
InternalOrientationType type);
|
||||
|
||||
|
||||
#endif /* __GIMP_FLIP_TOOL_H__ */
|
||||
|
|
|
@ -279,7 +279,7 @@ gimp_iscissors_tool_register (void)
|
|||
"gimp:iscissors_tool",
|
||||
_("Intelligent Scissors"),
|
||||
_("Select shapes from image"),
|
||||
N_("/Tools/Select Tools/Intelligent Scissors"),
|
||||
N_("/Tools/Selection Tools/Intelligent Scissors"),
|
||||
"I",
|
||||
NULL, "tools/iscissors.html",
|
||||
(const gchar **) iscissors_bits);
|
||||
|
|
|
@ -225,6 +225,8 @@ gimp_text_tool_init (GimpTextTool *text_tool)
|
|||
(ToolOptions *) text_tool_options);
|
||||
}
|
||||
|
||||
tool->tool_cursor = GIMP_TEXT_TOOL_CURSOR;
|
||||
|
||||
tool->scroll_lock = TRUE; /* Disallow scrolling */
|
||||
}
|
||||
|
||||
|
|
|
@ -504,7 +504,6 @@ STUB(posterize_dialog_hide)
|
|||
STUB(by_color_select_initialize_by_image)
|
||||
STUB(undo_pop_paint)
|
||||
STUB(histogram_tool_histogram_range)
|
||||
STUB(flip_tool_flip)
|
||||
STUB(perspective_find_transform)
|
||||
STUB(perspective_tool_perspective)
|
||||
STUB(rotate_tool_rotate)
|
||||
|
@ -637,90 +636,6 @@ ToolInfo tool_info[] =
|
|||
}
|
||||
}, /* perspective */
|
||||
|
||||
{
|
||||
NULL,
|
||||
N_("Flip"),
|
||||
N_("/Tools/Transform Tools/Flip"),
|
||||
"<shift>F",
|
||||
(char **) flip_bits,
|
||||
NULL,
|
||||
NULL,
|
||||
N_("Flip the layer or selection"),
|
||||
"tools/flip.html",
|
||||
FLIP,
|
||||
tools_new_flip,
|
||||
tools_free_flip_tool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
{
|
||||
flip_horizontal_small_bits, flip_horizontal_small_mask_bits,
|
||||
flip_horizontal_small_width, flip_horizontal_small_height,
|
||||
0, 0, NULL, NULL, NULL
|
||||
},
|
||||
{
|
||||
flip_vertical_small_bits, flip_vertical_small_mask_bits,
|
||||
flip_vertical_small_width, flip_vertical_small_height,
|
||||
0, 0, NULL, NULL, NULL
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
N_("Text"),
|
||||
N_("/Tools/Text"),
|
||||
"T",
|
||||
(char **) text_bits,
|
||||
NULL,
|
||||
NULL,
|
||||
N_("Add text to the image"),
|
||||
"tools/text.html",
|
||||
TEXT,
|
||||
tools_new_text,
|
||||
tools_free_text,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
{
|
||||
text_small_bits, text_small_mask_bits,
|
||||
text_small_width, text_small_height,
|
||||
0, 0, NULL, NULL, NULL
|
||||
},
|
||||
{
|
||||
NULL, NULL,
|
||||
0, 0,
|
||||
0, 0, NULL, NULL, NULL
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
N_("Bucket Fill"),
|
||||
N_("/Tools/Paint Tools/Bucket Fill"),
|
||||
"<shift>B",
|
||||
(char **) fill_bits,
|
||||
NULL,
|
||||
NULL,
|
||||
N_("Fill with a color or pattern"),
|
||||
"tools/bucket_fill.html",
|
||||
BUCKET_FILL,
|
||||
tools_new_bucket_fill,
|
||||
tools_free_bucket_fill,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
{
|
||||
bucket_fill_small_bits, bucket_fill_small_mask_bits,
|
||||
bucket_fill_small_width, bucket_fill_small_height,
|
||||
0, 0, NULL, NULL, NULL
|
||||
},
|
||||
{
|
||||
NULL, NULL,
|
||||
0, 0,
|
||||
0, 0, NULL, NULL, NULL
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
N_("Blend"),
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "tools/gimprotatetool.h"
|
||||
#include "tools/gimpscaletool.h"
|
||||
#include "tools/gimpsheartool.h"
|
||||
#include "tools/gimpfliptool.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -554,8 +555,7 @@ gimp_transform_tool_button_release (GimpTool *tool,
|
|||
gt_tool->bpressed = FALSE; /* ALT */
|
||||
|
||||
/* if we are creating, there is nothing to be done...exit */
|
||||
if (gt_tool->function == TRANSFORM_CREATING &&
|
||||
gt_tool->interactive)
|
||||
if (gt_tool->function == TRANSFORM_CREATING && gt_tool->interactive)
|
||||
return;
|
||||
|
||||
/* release of the pointer grab */
|
||||
|
@ -566,7 +566,7 @@ gimp_transform_tool_button_release (GimpTool *tool,
|
|||
if (! (bevent->state & GDK_BUTTON3_MASK))
|
||||
{
|
||||
/* Shift-clicking is another way to approve the transform */
|
||||
if ((bevent->state & GDK_SHIFT_MASK) /* FIXME || (tool->type == FLIP) */)
|
||||
if ((bevent->state & GDK_SHIFT_MASK) || GIMP_IS_FLIP_TOOL (tool))
|
||||
{
|
||||
gimp_transform_tool_doit (gt_tool, gdisp);
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool,
|
|||
/* Send the request for the transformation to the tool...
|
||||
*/
|
||||
new_tiles = gimp_transform_tool_transform (gt_tool, gdisp,
|
||||
TRANSFORM_FINISH);
|
||||
TRANSFORM_FINISH);
|
||||
|
||||
gimp_transform_tool_transform (gt_tool, gdisp, TRANSFORM_INIT);
|
||||
|
||||
|
|
|
@ -22,13 +22,6 @@
|
|||
|
||||
#include "tools/gimpdrawtool.h"
|
||||
|
||||
#define GIMP_TYPE_TRANSFORM_TOOL (gimp_transform_tool_get_type ())
|
||||
#define GIMP_TRANSFORM_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_TRANSFORM_TOOL, GimpTransformTool))
|
||||
#define GIMP_IS_TRANSFORM_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_TRANSFORM_TOOL))
|
||||
#define GIMP_TRANSFORM_TOOL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TRANSFORM_TOOL, GimpTransformToolClass))
|
||||
#define GIMP_IS_TRANSFORM_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TRANSFORM_TOOL))
|
||||
|
||||
typedef struct _GimpTransformToolClass GimpTransformToolClass;
|
||||
|
||||
/* buffer sizes for scaling information strings (for the info dialog) */
|
||||
#define MAX_INFO_BUF 40
|
||||
|
@ -41,6 +34,16 @@ enum BoundingBox
|
|||
|
||||
typedef gdouble TranInfo[TRAN_INFO_SIZE];
|
||||
|
||||
|
||||
#define GIMP_TYPE_TRANSFORM_TOOL (gimp_transform_tool_get_type ())
|
||||
#define GIMP_TRANSFORM_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_TRANSFORM_TOOL, GimpTransformTool))
|
||||
#define GIMP_IS_TRANSFORM_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_TRANSFORM_TOOL))
|
||||
#define GIMP_TRANSFORM_TOOL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TRANSFORM_TOOL, GimpTransformToolClass))
|
||||
#define GIMP_IS_TRANSFORM_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TRANSFORM_TOOL))
|
||||
|
||||
|
||||
typedef struct _GimpTransformToolClass GimpTransformToolClass;
|
||||
|
||||
struct _GimpTransformTool
|
||||
{
|
||||
GimpDrawTool parent_instance;
|
||||
|
|
|
@ -78,7 +78,7 @@ register_tools (void)
|
|||
|
||||
/* transform tools */
|
||||
|
||||
/* gimp_flip_tool_registrer (); */
|
||||
gimp_flip_tool_register ();
|
||||
/* gimp_perspective_tool_register (); */
|
||||
/* gimp_shear_tool_register (); */
|
||||
gimp_scale_tool_register ();
|
||||
|
|
Loading…
Reference in New Issue