added enum GimpTransformType which can be one of { LAYER, SELECTION, PATH

2003-05-31  Michael Natterer  <mitch@gimp.org>

	* app/tools/tools-enums.[ch]: added enum GimpTransformType which
	can be one of { LAYER, SELECTION, PATH }

	* app/tools/gimptransformoptions.[ch]: added a GimpTransformType
	property to GimpTransformOptions. Added a GUI for the new
	option.

	* app/tools/gimpflipoptions.[ch]: derive it from
	GimpTransformOptions and add the GUI here, too.

	* app/tools/gimpfliptool.c
	* app/tools/gimptransformtool.[ch]: added support for transforming
	the selection. Added framework for transforming paths (still
	unimplemented).

	* app/tools/gimpselectionoptions.c: small cleanup.

	* libgimpwidgets/gimpstock.[ch]
	* themes/Default/images/Makefile.am
	* themes/Default/images/stock-path-16.png
	* themes/Default/images/stock-path-22.png
	* themes/Default/images/stock-selection-16.png: new icons for the
	new transform options buttons. Simply copied existing ones...
This commit is contained in:
Michael Natterer 2003-05-30 23:52:24 +00:00 committed by Michael Natterer
parent 31e12a213b
commit 15b9be6a2c
17 changed files with 321 additions and 152 deletions

View File

@ -1,3 +1,29 @@
2003-05-31 Michael Natterer <mitch@gimp.org>
* app/tools/tools-enums.[ch]: added enum GimpTransformType which
can be one of { LAYER, SELECTION, PATH }
* app/tools/gimptransformoptions.[ch]: added a GimpTransformType
property to GimpTransformOptions. Added a GUI for the new
option.
* app/tools/gimpflipoptions.[ch]: derive it from
GimpTransformOptions and add the GUI here, too.
* app/tools/gimpfliptool.c
* app/tools/gimptransformtool.[ch]: added support for transforming
the selection. Added framework for transforming paths (still
unimplemented).
* app/tools/gimpselectionoptions.c: small cleanup.
* libgimpwidgets/gimpstock.[ch]
* themes/Default/images/Makefile.am
* themes/Default/images/stock-path-16.png
* themes/Default/images/stock-path-22.png
* themes/Default/images/stock-selection-16.png: new icons for the
new transform options buttons. Simply copied existing ones...
2003-05-30 Tor Lillqvist <tml@iki.fi>
* configure.in: As gimp uses fontconfig directly, check for it.

View File

@ -56,7 +56,7 @@ static void gimp_flip_options_get_property (GObject *object,
GParamSpec *pspec);
static GimpToolOptionsClass *parent_class = NULL;
static GimpTransformOptionsClass *parent_class = NULL;
GType
@ -79,7 +79,7 @@ gimp_flip_options_get_type (void)
(GInstanceInitFunc) gimp_flip_options_init,
};
type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS,
type = g_type_register_static (GIMP_TYPE_TRANSFORM_OPTIONS,
"GimpFlipOptions",
&info, 0);
}
@ -158,6 +158,8 @@ gimp_flip_options_gui (GimpToolOptions *tool_options)
{
GObject *config;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *frame;
gchar *str;
@ -165,8 +167,17 @@ gimp_flip_options_gui (GimpToolOptions *tool_options)
vbox = gimp_tool_options_gui (tool_options);
hbox = gimp_prop_enum_stock_box_new (config, "type", "gimp", 0, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
label = gtk_label_new (_("Affect:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (hbox), label, 0);
gtk_widget_show (label);
/* tool toggle */
str = g_strdup_printf (_("Tool Toggle %s"), gimp_get_mod_name_control ());
str = g_strdup_printf (_("Flip Type %s"), gimp_get_mod_name_control ());
frame = gimp_prop_enum_radio_frame_new (config, "flip-type",
str,

View File

@ -20,7 +20,7 @@
#define __GIMP_FLIP_OPTIONS_H__
#include "tool_options.h"
#include "gimptransformoptions.h"
#define GIMP_TYPE_FLIP_OPTIONS (gimp_flip_options_get_type ())
@ -36,9 +36,9 @@ typedef struct _GimpToolOptionsClass GimpFlipOptionsClass;
struct _GimpFlipOptions
{
GimpToolOptions parent_instance;
GimpTransformOptions parent_instance;
GimpOrientationType flip_type;
GimpOrientationType flip_type;
};

View File

@ -63,6 +63,7 @@ static void gimp_flip_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp);
static TileManager * gimp_flip_tool_transform (GimpTransformTool *tool,
GimpItem *item,
GimpDisplay *gdisp);
@ -231,32 +232,27 @@ gimp_flip_tool_cursor_update (GimpTool *tool,
static TileManager *
gimp_flip_tool_transform (GimpTransformTool *trans_tool,
GimpItem *active_item,
GimpDisplay *gdisp)
{
GimpFlipOptions *options;
GimpDrawable *active_drawable;
GimpItem *active_item;
gint off_x, off_y;
gint width, height;
gdouble axis = 0.0;
GimpTransformOptions *tr_options;
GimpFlipOptions *options;
gdouble axis = 0.0;
TileManager *ret = NULL;
options = GIMP_FLIP_OPTIONS (GIMP_TOOL (trans_tool)->tool_info->tool_options);
active_drawable = gimp_image_active_drawable (gdisp->gimage);
active_item = GIMP_ITEM (active_drawable);
tile_manager_get_offsets (trans_tool->original, &off_x, &off_y);
width = tile_manager_width (trans_tool->original);
height = tile_manager_height (trans_tool->original);
tr_options = GIMP_TRANSFORM_OPTIONS (options);
switch (options->flip_type)
{
case GIMP_ORIENTATION_HORIZONTAL:
axis = ((gdouble) off_x + (gdouble) width / 2.0);
axis = ((gdouble) trans_tool->x1 +
(gdouble) (trans_tool->x2 - trans_tool->x1) / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
axis = ((gdouble) off_y + (gdouble) height / 2.0);
axis = ((gdouble) trans_tool->y1 +
(gdouble) (trans_tool->y2 - trans_tool->y1) / 2.0);
break;
default:
@ -266,7 +262,20 @@ gimp_flip_tool_transform (GimpTransformTool *trans_tool,
if (gimp_item_get_linked (active_item))
gimp_item_linked_flip (active_item, options->flip_type, axis, FALSE);
return gimp_drawable_transform_tiles_flip (active_drawable,
trans_tool->original,
options->flip_type, axis, FALSE);
switch (tr_options->type)
{
case GIMP_TRANSFORM_TYPE_LAYER:
case GIMP_TRANSFORM_TYPE_SELECTION:
ret = gimp_drawable_transform_tiles_flip (GIMP_DRAWABLE (active_item),
trans_tool->original,
options->flip_type, axis,
FALSE);
break;
case GIMP_TRANSFORM_TYPE_PATH:
/* TODO */
break;
}
return ret;
}

View File

@ -396,9 +396,8 @@ gimp_selection_options_gui (GimpToolOptions *tool_options)
label = gtk_label_new (_("Mode:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
gtk_box_reorder_child (GTK_BOX (hbox), label, 0);
gtk_widget_show (label);
}
/* the antialias toggle button */

View File

@ -44,12 +44,12 @@
enum
{
PROP_0,
PROP_TYPE,
PROP_DIRECTION,
PROP_INTERPOLATION,
PROP_CLIP,
PROP_GRID_TYPE,
PROP_GRID_SIZE,
PROP_SHOW_PATH,
PROP_CONSTRAIN_1,
PROP_CONSTRAIN_2
};
@ -121,6 +121,11 @@ gimp_transform_options_class_init (GimpTransformOptionsClass *klass)
options_class->reset = gimp_transform_options_reset;
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TYPE,
"type", NULL,
GIMP_TYPE_TRANSFORM_TYPE,
GIMP_TRANSFORM_TYPE_LAYER,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_DIRECTION,
"direction", NULL,
GIMP_TYPE_TRANSFORM_DIRECTION,
@ -144,10 +149,6 @@ gimp_transform_options_class_init (GimpTransformOptionsClass *klass)
"grid-size", NULL,
1, 128, 15,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_PATH,
"show-path", NULL,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_CONSTRAIN_1,
"constrain-1", NULL,
FALSE,
@ -175,6 +176,9 @@ gimp_transform_options_set_property (GObject *object,
switch (property_id)
{
case PROP_TYPE:
options->type = g_value_get_enum (value);
break;
case PROP_DIRECTION:
options->direction = g_value_get_enum (value);
break;
@ -190,9 +194,6 @@ gimp_transform_options_set_property (GObject *object,
case PROP_GRID_SIZE:
options->grid_size = g_value_get_int (value);
break;
case PROP_SHOW_PATH:
options->show_path = g_value_get_boolean (value);
break;
case PROP_CONSTRAIN_1:
options->constrain_1 = g_value_get_boolean (value);
break;
@ -217,6 +218,9 @@ gimp_transform_options_get_property (GObject *object,
switch (property_id)
{
case PROP_TYPE:
g_value_set_enum (value, options->type);
break;
case PROP_DIRECTION:
g_value_set_enum (value, options->direction);
break;
@ -232,9 +236,6 @@ gimp_transform_options_get_property (GObject *object,
case PROP_GRID_SIZE:
g_value_set_int (value, options->grid_size);
break;
case PROP_SHOW_PATH:
g_value_set_boolean (value, options->show_path);
break;
case PROP_CONSTRAIN_1:
g_value_set_boolean (value, options->constrain_1);
break;
@ -270,7 +271,7 @@ gimp_transform_options_reset (GimpToolOptions *tool_options)
GtkWidget *
gimp_transform_options_gui (GimpToolOptions *tool_options)
{
GObject *config;
GObject *config;
GimpTransformOptions *options;
GtkWidget *vbox;
GtkWidget *hbox;
@ -280,11 +281,20 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
GtkWidget *optionmenu;
GtkWidget *button;
config = G_OBJECT (tool_options);
config = G_OBJECT (tool_options);
options = GIMP_TRANSFORM_OPTIONS (tool_options);
vbox = gimp_tool_options_gui (tool_options);
hbox = gimp_prop_enum_stock_box_new (config, "type", "gimp", 0, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
label = gtk_label_new (_("Affect:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (hbox), label, 0);
gtk_widget_show (label);
frame = gimp_prop_enum_radio_frame_new (config, "direction",
_("Transform Direction"), 0, 0);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
@ -335,11 +345,6 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
1.0, 8.0, 0,
FALSE, 0.0, 0.0);
/* the show_path toggle button */
button = gimp_prop_check_button_new (config, "show-path", _("Show Path"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
if (tool_options->tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL ||
tool_options->tool_info->tool_type == GIMP_TYPE_SCALE_TOOL)
{

View File

@ -38,12 +38,12 @@ struct _GimpTransformOptions
{
GimpToolOptions parent_instance;
GimpTransformType type;
GimpTransformDirection direction;
GimpInterpolationType interpolation;
gboolean clip;
GimpTransformGridType grid_type;
gint grid_size;
gboolean show_path;
gint grid_size;
gboolean constrain_1;
gboolean constrain_2;
};

View File

@ -44,14 +44,12 @@
#include "core/gimpimage-undo-push.h"
#include "core/gimpitem-linked.h"
#include "core/gimplayer.h"
#include "core/gimpmarshal.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpprogress.h"
#include "gui/info-dialog.h"
@ -110,6 +108,7 @@ static void gimp_transform_tool_draw (GimpDrawTool *draw_tool
static TileManager *
gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
GimpItem *item,
GimpDisplay *gdisp);
static void gimp_transform_tool_reset (GimpTransformTool *tr_tool);
@ -131,10 +130,10 @@ static void transform_cancel_callback (GtkWidget *widget,
static void transform_ok_callback (GtkWidget *widget,
GimpTransformTool *tr_tool);
static void gimp_transform_tool_notify_grid (GimpTransformOptions *options,
static void gimp_transform_tool_notify_type (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool);
static void gimp_transform_tool_notify_path (GimpTransformOptions *options,
static void gimp_transform_tool_notify_grid (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool);
@ -232,7 +231,7 @@ gimp_transform_tool_init (GimpTransformTool *tr_tool)
tr_tool->tgrid_coords = NULL;
tr_tool->notify_connected = FALSE;
tr_tool->show_path = FALSE;
tr_tool->type = GIMP_TRANSFORM_TYPE_LAYER;
tr_tool->shell_desc = NULL;
tr_tool->progress_text = _("Transforming...");
@ -322,9 +321,13 @@ gimp_transform_tool_button_press (GimpTool *tool,
if (tr_tool->use_grid && ! tr_tool->notify_connected)
{
tr_tool->show_path =
GIMP_TRANSFORM_OPTIONS (tool->tool_info->tool_options)->show_path;
tr_tool->type =
GIMP_TRANSFORM_OPTIONS (tool->tool_info->tool_options)->type;
g_signal_connect_object (tool->tool_info->tool_options,
"notify::type",
G_CALLBACK (gimp_transform_tool_notify_type),
tr_tool, 0);
g_signal_connect_object (tool->tool_info->tool_options,
"notify::grid-type",
G_CALLBACK (gimp_transform_tool_notify_grid),
@ -333,10 +336,6 @@ gimp_transform_tool_button_press (GimpTool *tool,
"notify::grid-size",
G_CALLBACK (gimp_transform_tool_notify_grid),
tr_tool, 0);
g_signal_connect_object (tool->tool_info->tool_options,
"notify::show-path",
G_CALLBACK (gimp_transform_tool_notify_path),
tr_tool, 0);
tr_tool->notify_connected = TRUE;
}
@ -748,7 +747,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
FALSE);
}
if (tr_tool->show_path)
if (tr_tool->type == GIMP_TRANSFORM_TYPE_PATH)
{
GimpMatrix3 tmp_matrix;
@ -770,22 +769,17 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
static TileManager *
gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
GimpItem *active_item,
GimpDisplay *gdisp)
{
GimpTool *tool;
GimpTransformOptions *options;
GimpDrawable *active_drawable;
GimpItem *active_item;
GimpProgress *progress;
gboolean clip_result;
TileManager *ret;
TileManager *ret = NULL;
tool = GIMP_TOOL (tr_tool);
options = GIMP_TRANSFORM_OPTIONS (tool->tool_info->tool_options);
active_drawable = gimp_image_active_drawable (gdisp->gimage);
active_item = GIMP_ITEM (active_drawable);
if (tr_tool->info_dialog)
gtk_widget_set_sensitive (GTK_WIDGET (tr_tool->info_dialog->shell), FALSE);
@ -800,23 +794,38 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
gimp_progress_update_and_flush : NULL,
progress);
clip_result = options->clip;
switch (options->type)
{
case GIMP_TRANSFORM_TYPE_LAYER:
case GIMP_TRANSFORM_TYPE_SELECTION:
{
gboolean clip_result = options->clip;
/* always clip unfloated channels so they keep their size */
if (GIMP_IS_CHANNEL (active_drawable) &&
tile_manager_bpp (tr_tool->original) == 1)
clip_result = TRUE;
/* always clip the selction and unfloated channels
* so they keep their size
*/
if (GIMP_IS_CHANNEL (active_item) &&
tile_manager_bpp (tr_tool->original) == 1)
clip_result = TRUE;
ret = gimp_drawable_transform_tiles_affine (active_drawable,
tr_tool->original,
tr_tool->transform,
options->direction,
options->interpolation,
clip_result,
progress ?
gimp_progress_update_and_flush :
NULL,
progress);
ret =
gimp_drawable_transform_tiles_affine (GIMP_DRAWABLE (active_item),
tr_tool->original,
tr_tool->transform,
options->direction,
options->interpolation,
clip_result,
progress ?
gimp_progress_update_and_flush :
NULL,
progress);
}
break;
case GIMP_TRANSFORM_TYPE_PATH:
/* TODO */
break;
}
if (progress)
gimp_progress_end (progress);
@ -828,13 +837,16 @@ static void
gimp_transform_tool_doit (GimpTransformTool *tr_tool,
GimpDisplay *gdisp)
{
GimpTool *tool;
TileManager *new_tiles;
gboolean new_layer;
GimpTool *tool;
GimpTransformOptions *options;
GimpItem *active_item;
TileManager *new_tiles;
gboolean new_layer;
gimp_set_busy (gdisp->gimage->gimp);
tool = GIMP_TOOL (tr_tool);
tool = GIMP_TOOL (tr_tool);
options = GIMP_TRANSFORM_OPTIONS (tool->tool_info->tool_options);
/* undraw the tool before we muck around with the transform matrix */
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
@ -859,40 +871,86 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
*/
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
tr_tool->original = gimp_drawable_transform_cut (tool->drawable,
&new_layer);
switch (options->type)
{
case GIMP_TRANSFORM_TYPE_LAYER:
active_item = (GimpItem *) gimp_image_active_drawable (gdisp->gimage);
tr_tool->original = gimp_drawable_transform_cut (tool->drawable,
&new_layer);
break;
case GIMP_TRANSFORM_TYPE_SELECTION:
active_item = (GimpItem *) gimp_image_get_mask (gdisp->gimage);
tr_tool->original = gimp_drawable_data (GIMP_DRAWABLE (active_item));
tile_manager_set_offsets (tr_tool->original, 0, 0);
break;
case GIMP_TRANSFORM_TYPE_PATH:
active_item = (GimpItem *) gimp_image_get_active_vectors (gdisp->gimage);
tr_tool->original = NULL;
break;
}
/* Send the request for the transformation to the tool...
*/
new_tiles = GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->transform (tr_tool,
active_item,
gdisp);
gimp_transform_tool_prepare (tr_tool, gdisp);
gimp_transform_tool_recalc (tr_tool, gdisp);
if (new_tiles)
switch (options->type)
{
/* paste the new transformed image to the gimage...also implement
* undo...
*/
/* FIXME: we should check if the drawable is still valid */
gimp_drawable_transform_paste (tool->drawable,
new_tiles,
new_layer);
tile_manager_unref (new_tiles);
case GIMP_TRANSFORM_TYPE_LAYER:
if (new_tiles)
{
/* paste the new transformed image to the gimage...also implement
* undo...
*/
/* FIXME: we should check if the drawable is still valid */
gimp_drawable_transform_paste (tool->drawable,
new_tiles,
new_layer);
tile_manager_unref (new_tiles);
}
break;
/* Make a note of the new current drawable (since we may have
* a floating selection, etc now.
*/
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
case GIMP_TRANSFORM_TYPE_SELECTION:
if (new_tiles)
{
gimp_image_mask_push_undo (gdisp->gimage, NULL);
gimp_transform_tool_push_undo (gdisp->gimage, NULL,
tool->ID,
G_TYPE_FROM_INSTANCE (tool),
tr_tool->old_trans_info,
NULL);
GIMP_DRAWABLE (active_item)->tiles = new_tiles;
tile_manager_unref (tr_tool->original);
tr_tool->original = NULL;
GIMP_CHANNEL (active_item)->bounds_known = FALSE;
gimp_image_mask_changed (gdisp->gimage);
}
break;
case GIMP_TRANSFORM_TYPE_PATH:
/* TODO */
break;
}
/* Make a note of the new current drawable (since we may have
* a floating selection, etc now.
*/
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_transform_tool_push_undo (gdisp->gimage, NULL,
tool->ID,
G_TYPE_FROM_INSTANCE (tool),
tr_tool->old_trans_info,
NULL);
/* push the undo group end */
gimp_image_undo_group_end (gdisp->gimage);
@ -980,43 +1038,57 @@ static void
gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
GimpDisplay *gdisp)
{
TileManager *tiles;
GimpDrawable *drawable;
GimpTransformOptions *options;
tiles = tr_tool->original;
drawable = gimp_image_active_drawable (gdisp->gimage);
options =
GIMP_TRANSFORM_OPTIONS (GIMP_TOOL (tr_tool)->tool_info->tool_options);
/* find the boundaries */
if (tiles)
if (tr_tool->original)
{
tile_manager_get_offsets (tiles, &tr_tool->x1, &tr_tool->y1);
tile_manager_get_offsets (tr_tool->original, &tr_tool->x1, &tr_tool->y1);
tr_tool->x2 = tr_tool->x1 + tile_manager_width (tiles);
tr_tool->y2 = tr_tool->y1 + tile_manager_height (tiles);
tr_tool->x2 = tr_tool->x1 + tile_manager_width (tr_tool->original);
tr_tool->y2 = tr_tool->y1 + tile_manager_height (tr_tool->original);
}
else
{
gint offset_x, offset_y;
switch (options->type)
{
case GIMP_TRANSFORM_TYPE_LAYER:
{
GimpDrawable *drawable;
gint offset_x, offset_y;
gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_drawable_mask_bounds (drawable,
&tr_tool->x1, &tr_tool->y1,
&tr_tool->x2, &tr_tool->y2);
tr_tool->x1 += offset_x;
tr_tool->y1 += offset_y;
tr_tool->x2 += offset_x;
tr_tool->y2 += offset_y;
gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);
gimp_drawable_mask_bounds (drawable,
&tr_tool->x1, &tr_tool->y1,
&tr_tool->x2, &tr_tool->y2);
tr_tool->x1 += offset_x;
tr_tool->y1 += offset_y;
tr_tool->x2 += offset_x;
tr_tool->y2 += offset_y;
}
break;
case GIMP_TRANSFORM_TYPE_SELECTION:
case GIMP_TRANSFORM_TYPE_PATH:
gimp_image_mask_bounds (gdisp->gimage,
&tr_tool->x1, &tr_tool->y1,
&tr_tool->x2, &tr_tool->y2);
break;
}
}
tr_tool->cx = (gdouble) (tr_tool->x1 + tr_tool->x2) / 2.0;
tr_tool->cy = (gdouble) (tr_tool->y1 + tr_tool->y2) / 2.0;
/* changing the bounds invalidates any grid we may have */
if (tr_tool->use_grid)
{
/* changing the bounds invalidates any grid we may have */
gimp_transform_tool_grid_recalc (tr_tool);
}
gimp_transform_tool_grid_recalc (tr_tool);
}
static void
@ -1024,7 +1096,8 @@ gimp_transform_tool_grid_recalc (GimpTransformTool *tr_tool)
{
GimpTransformOptions *options;
options = GIMP_TRANSFORM_OPTIONS (GIMP_TOOL (tr_tool)->tool_info->tool_options);
options =
GIMP_TRANSFORM_OPTIONS (GIMP_TOOL (tr_tool)->tool_info->tool_options);
if (tr_tool->grid_coords != NULL)
{
@ -1222,6 +1295,24 @@ transform_ok_callback (GtkWidget *widget,
gimp_transform_tool_doit (tr_tool, GIMP_TOOL (tr_tool)->gdisp);
}
static void
gimp_transform_tool_notify_type (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool)
{
if (tr_tool->function == TRANSFORM_CREATING)
return;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
tr_tool->type = options->type;
/* recalculate the tool's transformation matrix */
gimp_transform_tool_recalc (tr_tool, GIMP_TOOL (tr_tool)->gdisp);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
static void
gimp_transform_tool_notify_grid (GimpTransformOptions *options,
GParamSpec *pspec,
@ -1237,18 +1328,3 @@ gimp_transform_tool_notify_grid (GimpTransformOptions *options,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
static void
gimp_transform_tool_notify_path (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool)
{
if (tr_tool->function == TRANSFORM_CREATING)
return;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
tr_tool->show_path = options->show_path;
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}

View File

@ -89,8 +89,8 @@ struct _GimpTransformTool
*/
gdouble *tgrid_coords; /* transformed grid_coords */
gboolean notify_connected;
gboolean show_path;
gboolean notify_connected;
GimpTransformType type;
/* transform info dialog */
const gchar *shell_identifier;
@ -105,15 +105,16 @@ struct _GimpTransformToolClass
GimpDrawToolClass parent_class;
/* virtual functions */
void (* dialog) (GimpTransformTool *tool);
void (* prepare) (GimpTransformTool *tool,
GimpDisplay *gdisp);
void (* motion) (GimpTransformTool *tool,
GimpDisplay *gdisp);
void (* recalc) (GimpTransformTool *tool,
GimpDisplay *gdisp);
TileManager * (* transform) (GimpTransformTool *tool,
GimpDisplay *gdisp);
void (* dialog) (GimpTransformTool *tool);
void (* prepare) (GimpTransformTool *tool,
GimpDisplay *gdisp);
void (* motion) (GimpTransformTool *tool,
GimpDisplay *gdisp);
void (* recalc) (GimpTransformTool *tool,
GimpDisplay *gdisp);
TileManager * (* transform) (GimpTransformTool *tool,
GimpItem *item,
GimpDisplay *gdisp);
};

View File

@ -113,6 +113,26 @@ gimp_rect_select_mode_get_type (void)
}
static const GEnumValue gimp_transform_type_enum_values[] =
{
{ GIMP_TRANSFORM_TYPE_LAYER, N_("Transform Active Layer"), "layer" },
{ GIMP_TRANSFORM_TYPE_SELECTION, N_("Transform Selection"), "selection" },
{ GIMP_TRANSFORM_TYPE_PATH, N_("Transform Active Path"), "path" },
{ 0, NULL, NULL }
};
GType
gimp_transform_type_get_type (void)
{
static GType enum_type = 0;
if (!enum_type)
enum_type = g_enum_register_static ("GimpTransformType", gimp_transform_type_enum_values);
return enum_type;
}
static const GEnumValue gimp_transform_grid_type_enum_values[] =
{
{ GIMP_TRANSFORM_GRID_TYPE_NONE, N_("Don't Show Grid"), "none" },

View File

@ -92,6 +92,18 @@ typedef enum /*< pdb-skip >*/
} GimpRectSelectMode;
#define GIMP_TYPE_TRANSFORM_TYPE (gimp_transform_type_get_type ())
GType gimp_transform_type_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
GIMP_TRANSFORM_TYPE_LAYER, /*< desc="Transform Active Layer" >*/
GIMP_TRANSFORM_TYPE_SELECTION, /*< desc="Transform Selection" >*/
GIMP_TRANSFORM_TYPE_PATH /*< desc="Transform Active Path" >*/
} GimpTransformType;
#define GIMP_TYPE_TRANSFORM_GRID_TYPE (gimp_transform_grid_type_get_type ())
GType gimp_transform_grid_type_get_type (void) G_GNUC_CONST;

View File

@ -133,6 +133,7 @@ static GtkStockItem gimp_stock_items[] =
{ GIMP_STOCK_VCHAIN, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_VCHAIN_BROKEN, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_SELECTION, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_SELECTION_REPLACE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_SELECTION_ADD, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_SELECTION_SUBTRACT, NULL, 0, 0, LIBGIMP_DOMAIN },
@ -189,6 +190,7 @@ static GtkStockItem gimp_stock_items[] =
{ GIMP_STOCK_CHANNEL_BLUE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_CHANNEL_GRAY, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_CHANNEL_ALPHA, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_PATH, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_TEMPLATE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_SELECTION_ALL, NULL, 0, 0, LIBGIMP_DOMAIN },
@ -287,6 +289,7 @@ gimp_stock_button_pixbufs[] =
{ GIMP_STOCK_VCHAIN, stock_vchain_24 },
{ GIMP_STOCK_VCHAIN_BROKEN, stock_vchain_broken_24 },
{ GIMP_STOCK_SELECTION, stock_selection_16 },
{ GIMP_STOCK_SELECTION_REPLACE, stock_selection_replace_16 },
{ GIMP_STOCK_SELECTION_ADD, stock_selection_add_16 },
{ GIMP_STOCK_SELECTION_SUBTRACT, stock_selection_subtract_16 },
@ -325,6 +328,7 @@ gimp_stock_button_pixbufs[] =
{ GIMP_STOCK_IMAGE, stock_image_24 },
{ GIMP_STOCK_LAYER, stock_layer_24 },
{ GIMP_STOCK_TEXT_LAYER, stock_text_layer_24 },
{ GIMP_STOCK_PATH, stock_path_22 },
{ GIMP_STOCK_TEMPLATE, stock_template_24 },
{ GIMP_STOCK_LINKED, stock_linked_20 },
@ -417,6 +421,7 @@ gimp_stock_menu_pixbufs[] =
{ GIMP_STOCK_IMAGE, stock_image_16 },
{ GIMP_STOCK_LAYER, stock_layer_16 },
{ GIMP_STOCK_TEXT_LAYER, stock_text_layer_16 },
{ GIMP_STOCK_PATH, stock_path_16 },
{ GIMP_STOCK_TEMPLATE, stock_template_16 },
{ GIMP_STOCK_LINKED, stock_linked_12 },

View File

@ -66,6 +66,7 @@ G_BEGIN_DECLS
#define GIMP_STOCK_VCHAIN "gimp-vchain"
#define GIMP_STOCK_VCHAIN_BROKEN "gimp-vchain-broken"
#define GIMP_STOCK_SELECTION "gimp-selection"
#define GIMP_STOCK_SELECTION_REPLACE "gimp-selection-replace"
#define GIMP_STOCK_SELECTION_ADD "gimp-selection-add"
#define GIMP_STOCK_SELECTION_SUBTRACT "gimp-selection-subtract"
@ -158,6 +159,7 @@ G_BEGIN_DECLS
#define GIMP_STOCK_CHANNEL_BLUE "gimp-channel-blue"
#define GIMP_STOCK_CHANNEL_GRAY "gimp-channel-gray"
#define GIMP_STOCK_CHANNEL_ALPHA "gimp-channel-alpha"
#define GIMP_STOCK_PATH "gimp-path"
#define GIMP_STOCK_TEMPLATE "gimp-template"
#define GIMP_STOCK_IMAGES "gimp-images"

View File

@ -61,6 +61,7 @@ STOCK_MENU_IMAGES = \
stock-list-16.png \
stock-merge-down-16.png \
stock-navigation-16.png \
stock-path-16.png \
stock-paths-16.png \
stock-plugin-16.png \
stock-portrait-16.png \
@ -72,6 +73,7 @@ STOCK_MENU_IMAGES = \
stock-rotate-270-16.png \
stock-rotate-90-16.png \
stock-scale-16.png \
stock-selection-16.png \
stock-selection-all-16.png \
stock-selection-grow-16.png \
stock-selection-none-16.png \
@ -127,6 +129,7 @@ STOCK_BUTTON_IMAGES = \
stock-paste-as-new-16.png \
stock-paste-into-16.png \
stock-path-stroke-16.png \
stock-path-22.png \
stock-paths-22.png \
stock-reset-16.png \
stock-selection-add-16.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B