app: more vectors -> path, mostly in GimpToolPath

This commit is contained in:
Michael Natterer 2025-07-07 14:16:50 +02:00
parent 6d2c71591d
commit f5900020d3
8 changed files with 203 additions and 202 deletions

View file

@ -529,21 +529,21 @@ gimp_transform_handle_mode_get_type (void)
}
GType
gimp_vector_mode_get_type (void)
gimp_path_mode_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_VECTOR_MODE_DESIGN, "GIMP_VECTOR_MODE_DESIGN", "design" },
{ GIMP_VECTOR_MODE_EDIT, "GIMP_VECTOR_MODE_EDIT", "edit" },
{ GIMP_VECTOR_MODE_MOVE, "GIMP_VECTOR_MODE_MOVE", "move" },
{ GIMP_PATH_MODE_DESIGN, "GIMP_PATH_MODE_DESIGN", "design" },
{ GIMP_PATH_MODE_EDIT, "GIMP_PATH_MODE_EDIT", "edit" },
{ GIMP_PATH_MODE_MOVE, "GIMP_PATH_MODE_MOVE", "move" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_VECTOR_MODE_DESIGN, NC_("vector-mode", "Design"), NULL },
{ GIMP_VECTOR_MODE_EDIT, NC_("vector-mode", "Edit"), NULL },
{ GIMP_VECTOR_MODE_MOVE, NC_("vector-mode", "Move"), NULL },
{ GIMP_PATH_MODE_DESIGN, NC_("path-mode", "Design"), NULL },
{ GIMP_PATH_MODE_EDIT, NC_("path-mode", "Edit"), NULL },
{ GIMP_PATH_MODE_MOVE, NC_("path-mode", "Move"), NULL },
{ 0, NULL, NULL }
};
@ -551,8 +551,8 @@ gimp_vector_mode_get_type (void)
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpVectorMode", values);
gimp_type_set_translation_context (type, "vector-mode");
type = g_enum_register_static ("GimpPathMode", values);
gimp_type_set_translation_context (type, "path-mode");
gimp_enum_set_value_descriptions (type, descs);
}

View file

@ -226,16 +226,16 @@ typedef enum
} GimpTransformHandleMode;
#define GIMP_TYPE_VECTOR_MODE (gimp_vector_mode_get_type ())
#define GIMP_TYPE_PATH_MODE (gimp_path_mode_get_type ())
GType gimp_vector_mode_get_type (void) G_GNUC_CONST;
GType gimp_path_mode_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_VECTOR_MODE_DESIGN, /*< desc="Design" >*/
GIMP_VECTOR_MODE_EDIT, /*< desc="Edit" >*/
GIMP_VECTOR_MODE_MOVE /*< desc="Move" >*/
} GimpVectorMode;
GIMP_PATH_MODE_DESIGN, /*< desc="Design" >*/
GIMP_PATH_MODE_EDIT, /*< desc="Edit" >*/
GIMP_PATH_MODE_MOVE /*< desc="Move" >*/
} GimpPathMode;
#define GIMP_TYPE_ZOOM_FOCUS (gimp_zoom_focus_get_type ())

View file

@ -67,8 +67,8 @@
/* possible path functions */
typedef enum
{
VECTORS_SELECT_VECTOR,
VECTORS_CREATE_VECTOR,
VECTORS_SELECT_PATH,
VECTORS_CREATE_PATH,
VECTORS_CREATE_STROKE,
VECTORS_ADD_ANCHOR,
VECTORS_MOVE_ANCHOR,
@ -76,7 +76,7 @@ typedef enum
VECTORS_MOVE_HANDLE,
VECTORS_MOVE_CURVE,
VECTORS_MOVE_STROKE,
VECTORS_MOVE_VECTORS,
VECTORS_MOVE_PATH,
VECTORS_INSERT_ANCHOR,
VECTORS_DELETE_ANCHOR,
VECTORS_CONNECT_STROKES,
@ -88,7 +88,7 @@ typedef enum
enum
{
PROP_0,
PROP_VECTORS,
PROP_PATH,
PROP_EDIT_MODE,
PROP_POLYGONAL
};
@ -101,10 +101,11 @@ enum
LAST_SIGNAL
};
struct _GimpToolPathPrivate
{
GimpPath *vectors; /* the current Path data */
GimpVectorMode edit_mode;
GimpPath *path; /* the current Path data */
GimpPathMode edit_mode;
gboolean polygonal;
GimpPathFunction function; /* function we're performing */
@ -127,7 +128,7 @@ struct _GimpToolPathPrivate
/* if multiple anchors are selected */
GimpStroke *sel_stroke; /* selected stroke */
GimpVectorMode saved_mode; /* used by modifier_key() */
GimpPathMode saved_mode; /* used by modifier_key() */
GimpCanvasItem *canvas_path;
GList *items;
@ -197,11 +198,11 @@ static void gimp_tool_path_begin_change (GimpToolPath *tool_path
static void gimp_tool_path_end_change (GimpToolPath *tool_path,
gboolean success);
static void gimp_tool_path_vectors_visible (GimpPath *vectors,
static void gimp_tool_path_path_visible (GimpPath *path,
GimpToolPath *tool_path);
static void gimp_tool_path_vectors_freeze (GimpPath *vectors,
static void gimp_tool_path_path_freeze (GimpPath *path,
GimpToolPath *tool_path);
static void gimp_tool_path_vectors_thaw (GimpPath *vectors,
static void gimp_tool_path_path_thaw (GimpPath *path,
GimpToolPath *tool_path);
static void gimp_tool_path_verify_state (GimpToolPath *tool_path);
@ -269,8 +270,8 @@ gimp_tool_path_class_init (GimpToolPathClass *klass)
G_TYPE_NONE, 1,
GDK_TYPE_MODIFIER_TYPE);
g_object_class_install_property (object_class, PROP_VECTORS,
g_param_spec_object ("vectors", NULL, NULL,
g_object_class_install_property (object_class, PROP_PATH,
g_param_spec_object ("path", NULL, NULL,
GIMP_TYPE_PATH,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
@ -279,8 +280,8 @@ gimp_tool_path_class_init (GimpToolPathClass *klass)
g_param_spec_enum ("edit-mode",
_("Edit Mode"),
NULL,
GIMP_TYPE_VECTOR_MODE,
GIMP_VECTOR_MODE_DESIGN,
GIMP_TYPE_PATH_MODE,
GIMP_PATH_MODE_DESIGN,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
@ -334,7 +335,7 @@ gimp_tool_path_set_property (GObject *object,
switch (property_id)
{
case PROP_VECTORS:
case PROP_PATH:
gimp_tool_path_set_path (tool_path, g_value_get_object (value));
break;
case PROP_EDIT_MODE:
@ -361,8 +362,8 @@ gimp_tool_path_get_property (GObject *object,
switch (property_id)
{
case PROP_VECTORS:
g_value_set_object (value, private->vectors);
case PROP_PATH:
g_value_set_object (value, private->path);
break;
case PROP_EDIT_MODE:
g_value_set_enum (value, private->edit_mode);
@ -389,7 +390,7 @@ gimp_tool_path_changed (GimpToolWidget *widget)
{
GimpToolPath *tool_path = GIMP_TOOL_PATH (widget);
GimpToolPathPrivate *private = tool_path->private;
GimpPath *vectors = private->vectors;
GimpPath *path = private->path;
if (private->items)
{
@ -398,18 +399,18 @@ gimp_tool_path_changed (GimpToolWidget *widget)
private->items = NULL;
}
if (vectors && gimp_path_get_bezier (vectors))
if (path && gimp_path_get_bezier (path))
{
GimpStroke *cur_stroke;
gimp_canvas_path_set (private->canvas_path,
gimp_path_get_bezier (vectors));
gimp_path_get_bezier (path));
gimp_canvas_item_set_visible (private->canvas_path,
! gimp_item_get_visible (GIMP_ITEM (vectors)));
! gimp_item_get_visible (GIMP_ITEM (path)));
for (cur_stroke = gimp_path_stroke_get_next (vectors, NULL);
for (cur_stroke = gimp_path_stroke_get_next (path, NULL);
cur_stroke;
cur_stroke = gimp_path_stroke_get_next (vectors, cur_stroke))
cur_stroke = gimp_path_stroke_get_next (path, cur_stroke))
{
GimpCanvasItem *item;
GArray *coords;
@ -542,14 +543,14 @@ gimp_tool_path_check_writable (GimpToolPath *tool_path)
GimpDisplayShell *shell = gimp_tool_widget_get_shell (widget);
GimpItem *locked_item = NULL;
if (gimp_item_is_content_locked (GIMP_ITEM (private->vectors), &locked_item) ||
gimp_item_is_position_locked (GIMP_ITEM (private->vectors), &locked_item))
if (gimp_item_is_content_locked (GIMP_ITEM (private->path), &locked_item) ||
gimp_item_is_position_locked (GIMP_ITEM (private->path), &locked_item))
{
gimp_tool_widget_message_literal (GIMP_TOOL_WIDGET (tool_path),
_("The selected path is locked."));
if (locked_item == NULL)
locked_item = GIMP_ITEM (private->vectors);
locked_item = GIMP_ITEM (private->path);
/* FIXME: this should really be done by the tool */
gimp_tools_blink_lock_box (shell->display->gimp, locked_item);
@ -576,9 +577,9 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
if (private->function == VECTORS_FINISHED)
return 0;
g_return_val_if_fail (private->vectors != NULL ||
private->function == VECTORS_SELECT_VECTOR ||
private->function == VECTORS_CREATE_VECTOR, 0);
g_return_val_if_fail (private->path != NULL ||
private->function == VECTORS_SELECT_PATH ||
private->function == VECTORS_CREATE_PATH, 0);
private->undo_motion = FALSE;
@ -587,19 +588,19 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
private->saved_state = state;
/* select a vectors object */
/* select a path object */
if (private->function == VECTORS_SELECT_VECTOR)
if (private->function == VECTORS_SELECT_PATH)
{
GimpPath *vectors;
GimpPath *path;
if (gimp_canvas_item_on_path (private->canvas_path,
coords,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
NULL, NULL, NULL, NULL, NULL, &vectors))
NULL, NULL, NULL, NULL, NULL, &path))
{
gimp_tool_path_set_path (tool_path, vectors);
gimp_tool_path_set_path (tool_path, path);
}
private->function = VECTORS_FINISHED;
@ -608,28 +609,28 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
/* create a new vector from scratch */
if (private->function == VECTORS_CREATE_VECTOR)
if (private->function == VECTORS_CREATE_PATH)
{
GimpDisplayShell *shell = gimp_tool_widget_get_shell (widget);
GimpImage *image = gimp_display_get_image (shell->display);
GimpPath *vectors;
GimpPath *path;
vectors = gimp_path_new (image, _("Unnamed"));
g_object_ref_sink (vectors);
path = gimp_path_new (image, _("Unnamed"));
g_object_ref_sink (path);
/* Undo step gets added implicitly */
private->have_undo = TRUE;
private->undo_motion = TRUE;
gimp_tool_path_set_path (tool_path, vectors);
g_object_unref (vectors);
gimp_tool_path_set_path (tool_path, path);
g_object_unref (path);
private->function = VECTORS_CREATE_STROKE;
}
gimp_path_freeze (private->vectors);
gimp_path_freeze (private->path);
/* create a new stroke */
@ -640,7 +641,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
private->undo_motion = TRUE;
private->cur_stroke = gimp_bezier_stroke_new ();
gimp_path_stroke_add (private->vectors, private->cur_stroke);
gimp_path_stroke_add (private->path, private->cur_stroke);
g_object_unref (private->cur_stroke);
private->sel_stroke = private->cur_stroke;
@ -719,7 +720,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
{
if (! private->cur_anchor->selected)
{
gimp_path_anchor_select (private->vectors,
gimp_path_anchor_select (private->path,
private->cur_stroke,
private->cur_anchor,
TRUE, TRUE);
@ -727,7 +728,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
}
gimp_canvas_item_on_path_handle (private->canvas_path,
private->vectors, coords,
private->path, coords,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
GIMP_ANCHOR_CONTROL, TRUE,
@ -748,7 +749,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
if (! private->cur_anchor->selected)
{
gimp_path_anchor_select (private->vectors,
gimp_path_anchor_select (private->path,
private->cur_stroke,
private->cur_anchor,
TRUE, TRUE);
@ -766,7 +767,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
if (state & TOGGLE_MASK)
{
gimp_path_anchor_select (private->vectors,
gimp_path_anchor_select (private->path,
private->cur_stroke,
private->cur_anchor,
!private->cur_anchor->selected,
@ -790,7 +791,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
* from gimp_bezier_stroke_point_move_relative in gimpbezierstroke.c. */
if (private->cur_position < 5.0 / 6.0)
{
gimp_path_anchor_select (private->vectors,
gimp_path_anchor_select (private->path,
private->cur_stroke,
private->cur_anchor, TRUE, TRUE);
private->undo_motion = TRUE;
@ -798,7 +799,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
if (private->cur_position > 1.0 / 6.0)
{
gimp_path_anchor_select (private->vectors,
gimp_path_anchor_select (private->path,
private->cur_stroke,
private->cur_anchor2, TRUE,
(private->cur_position >= 5.0 / 6.0));
@ -824,14 +825,14 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
if (private->cur_stroke != private->sel_stroke &&
gimp_stroke_is_empty (private->cur_stroke))
{
gimp_path_stroke_remove (private->vectors,
gimp_path_stroke_remove (private->path,
private->cur_stroke);
}
private->sel_anchor = private->cur_anchor;
private->cur_stroke = private->sel_stroke;
gimp_path_anchor_select (private->vectors,
gimp_path_anchor_select (private->path,
private->sel_stroke,
private->sel_anchor, TRUE, TRUE);
@ -839,10 +840,10 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
}
/* move a stroke or all strokes of a vectors object */
/* move a stroke or all strokes of a path object */
if ((private->function == VECTORS_MOVE_STROKE ||
private->function == VECTORS_MOVE_VECTORS) &&
private->function == VECTORS_MOVE_PATH) &&
gimp_tool_path_check_writable (tool_path))
{
gimp_tool_path_begin_change (tool_path, _("Drag Path"));
@ -865,7 +866,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
if (private->cur_anchor->type == GIMP_ANCHOR_ANCHOR)
{
gimp_path_anchor_select (private->vectors,
gimp_path_anchor_select (private->path,
private->cur_stroke,
private->cur_anchor, TRUE, TRUE);
@ -894,7 +895,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
private->cur_anchor);
if (gimp_stroke_is_empty (private->cur_stroke))
gimp_path_stroke_remove (private->vectors,
gimp_path_stroke_remove (private->path,
private->cur_stroke);
private->cur_stroke = NULL;
@ -917,7 +918,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
private->cur_anchor);
if (new_stroke)
{
gimp_path_stroke_add (private->vectors, new_stroke);
gimp_path_stroke_add (private->path, new_stroke);
g_object_unref (new_stroke);
}
@ -929,7 +930,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget,
private->last_x = coords->x;
private->last_y = coords->y;
gimp_path_thaw (private->vectors);
gimp_path_thaw (private->path);
return 1;
}
@ -977,7 +978,7 @@ gimp_tool_path_motion (GimpToolWidget *widget,
position.x = coords->x;
position.y = coords->y;
gimp_path_freeze (private->vectors);
gimp_path_freeze (private->path);
if ((private->saved_state & TOGGLE_MASK) != (state & TOGGLE_MASK))
private->modifier_lock = FALSE;
@ -1053,8 +1054,8 @@ gimp_tool_path_motion (GimpToolWidget *widget,
}
break;
case VECTORS_MOVE_VECTORS:
gimp_item_translate (GIMP_ITEM (private->vectors),
case VECTORS_MOVE_PATH:
gimp_item_translate (GIMP_ITEM (private->path),
coords->x - private->last_x,
coords->y - private->last_y, FALSE);
private->undo_motion = TRUE;
@ -1064,7 +1065,7 @@ gimp_tool_path_motion (GimpToolWidget *widget,
break;
}
gimp_path_thaw (private->vectors);
gimp_path_thaw (private->path);
private->last_x = coords->x;
private->last_y = coords->y;
@ -1080,7 +1081,7 @@ gimp_tool_path_hit (GimpToolWidget *widget,
switch (gimp_tool_path_get_function (tool_path, coords, state))
{
case VECTORS_SELECT_VECTOR:
case VECTORS_SELECT_PATH:
case VECTORS_MOVE_ANCHOR:
case VECTORS_MOVE_ANCHORSET:
case VECTORS_MOVE_HANDLE:
@ -1093,10 +1094,10 @@ gimp_tool_path_hit (GimpToolWidget *widget,
case VECTORS_CONVERT_EDGE:
return GIMP_HIT_DIRECT;
case VECTORS_CREATE_VECTOR:
case VECTORS_CREATE_PATH:
case VECTORS_CREATE_STROKE:
case VECTORS_ADD_ANCHOR:
case VECTORS_MOVE_VECTORS:
case VECTORS_MOVE_PATH:
return GIMP_HIT_INDIRECT;
case VECTORS_FINISHED:
@ -1130,7 +1131,7 @@ gimp_tool_path_key_press (GimpToolWidget *widget,
gdouble xdist, ydist;
gdouble pixels = 1.0;
if (! private->vectors)
if (! private->path)
return FALSE;
shell = gimp_tool_widget_get_shell (widget);
@ -1163,7 +1164,7 @@ gimp_tool_path_key_press (GimpToolWidget *widget,
ydist = FUNSCALEY (shell, pixels);
gimp_tool_path_begin_change (tool_path, _("Move Anchors"));
gimp_path_freeze (private->vectors);
gimp_path_freeze (private->path);
switch (kevent->keyval)
{
@ -1187,14 +1188,14 @@ gimp_tool_path_key_press (GimpToolWidget *widget,
break;
}
gimp_path_thaw (private->vectors);
gimp_path_thaw (private->path);
gimp_tool_path_end_change (tool_path, TRUE);
break;
case GDK_KEY_Escape:
if (private->edit_mode != GIMP_VECTOR_MODE_DESIGN)
if (private->edit_mode != GIMP_PATH_MODE_DESIGN)
g_object_set (private,
"vectors-edit-mode", GIMP_VECTOR_MODE_DESIGN,
"vectors-edit-mode", GIMP_PATH_MODE_DESIGN,
NULL);
break;
@ -1221,11 +1222,11 @@ gimp_tool_path_get_cursor (GimpToolWidget *widget,
switch (private->function)
{
case VECTORS_SELECT_VECTOR:
case VECTORS_SELECT_PATH:
*tool_cursor = GIMP_TOOL_CURSOR_HAND;
break;
case VECTORS_CREATE_VECTOR:
case VECTORS_CREATE_PATH:
case VECTORS_CREATE_STROKE:
*modifier = GIMP_CURSOR_MODIFIER_CONTROL;
break;
@ -1267,7 +1268,7 @@ gimp_tool_path_get_cursor (GimpToolWidget *widget,
break;
case VECTORS_MOVE_STROKE:
case VECTORS_MOVE_VECTORS:
case VECTORS_MOVE_PATH:
*modifier = GIMP_CURSOR_MODIFIER_MOVE;
break;
@ -1337,16 +1338,16 @@ gimp_tool_path_get_function (GimpToolPath *tool_path,
gdouble position = -1;
gboolean on_handle = FALSE;
gboolean on_curve = FALSE;
gboolean on_vectors = FALSE;
gboolean on_path = FALSE;
GimpPathFunction function = VECTORS_FINISHED;
private->modifier_lock = FALSE;
/* are we hovering the current vectors on the current display? */
if (private->vectors)
/* are we hovering the current path on the current display? */
if (private->path)
{
on_handle = gimp_canvas_item_on_path_handle (private->canvas_path,
private->vectors,
private->path,
coords,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
@ -1356,7 +1357,7 @@ gimp_tool_path_get_function (GimpToolPath *tool_path,
if (! on_handle)
on_curve = gimp_canvas_item_on_path_curve (private->canvas_path,
private->vectors,
private->path,
coords,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
@ -1367,12 +1368,12 @@ gimp_tool_path_get_function (GimpToolPath *tool_path,
if (! on_handle && ! on_curve)
{
on_vectors = gimp_canvas_item_on_path (private->canvas_path,
coords,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
NULL, NULL, NULL, NULL, NULL,
NULL);
on_path = gimp_canvas_item_on_path (private->canvas_path,
coords,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
NULL, NULL, NULL, NULL, NULL,
NULL);
}
private->cur_position = position;
@ -1382,16 +1383,16 @@ gimp_tool_path_get_function (GimpToolPath *tool_path,
switch (private->edit_mode)
{
case GIMP_VECTOR_MODE_DESIGN:
if (! private->vectors)
case GIMP_PATH_MODE_DESIGN:
if (! private->path)
{
if (on_vectors)
if (on_path)
{
function = VECTORS_SELECT_VECTOR;
function = VECTORS_SELECT_PATH;
}
else
{
function = VECTORS_CREATE_VECTOR;
function = VECTORS_CREATE_PATH;
private->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
private->modifier_lock = TRUE;
}
@ -1467,12 +1468,12 @@ gimp_tool_path_get_function (GimpToolPath *tool_path,
break;
case GIMP_VECTOR_MODE_EDIT:
if (! private->vectors)
case GIMP_PATH_MODE_EDIT:
if (! private->path)
{
if (on_vectors)
if (on_path)
{
function = VECTORS_SELECT_VECTOR;
function = VECTORS_SELECT_PATH;
}
else
{
@ -1537,12 +1538,12 @@ gimp_tool_path_get_function (GimpToolPath *tool_path,
break;
case GIMP_VECTOR_MODE_MOVE:
if (! private->vectors)
case GIMP_PATH_MODE_MOVE:
if (! private->path)
{
if (on_vectors)
if (on_path)
{
function = VECTORS_SELECT_VECTOR;
function = VECTORS_SELECT_PATH;
}
else
{
@ -1553,7 +1554,7 @@ gimp_tool_path_get_function (GimpToolPath *tool_path,
{
if (state & TOGGLE_MASK)
{
function = VECTORS_MOVE_VECTORS;
function = VECTORS_MOVE_PATH;
}
else
{
@ -1562,13 +1563,13 @@ gimp_tool_path_get_function (GimpToolPath *tool_path,
}
else
{
if (on_vectors)
if (on_path)
{
function = VECTORS_SELECT_VECTOR;
function = VECTORS_SELECT_PATH;
}
else
{
function = VECTORS_MOVE_VECTORS;
function = VECTORS_MOVE_PATH;
}
}
break;
@ -1596,11 +1597,11 @@ gimp_tool_path_update_status (GimpToolPath *tool_path,
switch (private->function)
{
case VECTORS_SELECT_VECTOR:
case VECTORS_SELECT_PATH:
status = _("Click to pick path to edit");
break;
case VECTORS_CREATE_VECTOR:
case VECTORS_CREATE_PATH:
status = _("Click to create a new path");
break;
@ -1617,7 +1618,7 @@ gimp_tool_path_update_status (GimpToolPath *tool_path,
break;
case VECTORS_MOVE_ANCHOR:
if (private->edit_mode != GIMP_VECTOR_MODE_EDIT)
if (private->edit_mode != GIMP_PATH_MODE_EDIT)
{
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"anchor around"),
@ -1673,7 +1674,7 @@ gimp_tool_path_update_status (GimpToolPath *tool_path,
free_status = TRUE;
break;
case VECTORS_MOVE_VECTORS:
case VECTORS_MOVE_PATH:
status = _("Click-Drag to move the path around");
break;
@ -1719,7 +1720,7 @@ gimp_tool_path_begin_change (GimpToolPath *tool_path,
{
GimpToolPathPrivate *private = tool_path->private;
g_return_if_fail (private->vectors != NULL);
g_return_if_fail (private->path != NULL);
/* don't push two undos */
if (private->have_undo)
@ -1745,24 +1746,24 @@ gimp_tool_path_end_change (GimpToolPath *tool_path,
}
static void
gimp_tool_path_vectors_visible (GimpPath *vectors,
GimpToolPath *tool_path)
gimp_tool_path_path_visible (GimpPath *path,
GimpToolPath *tool_path)
{
GimpToolPathPrivate *private = tool_path->private;
gimp_canvas_item_set_visible (private->canvas_path,
! gimp_item_get_visible (GIMP_ITEM (vectors)));
! gimp_item_get_visible (GIMP_ITEM (path)));
}
static void
gimp_tool_path_vectors_freeze (GimpPath *vectors,
GimpToolPath *tool_path)
gimp_tool_path_path_freeze (GimpPath *path,
GimpToolPath *tool_path)
{
}
static void
gimp_tool_path_vectors_thaw (GimpPath *vectors,
GimpToolPath *tool_path)
gimp_tool_path_path_thaw (GimpPath *path,
GimpToolPath *tool_path)
{
/* Ok, the vector might have changed externally (e.g. Undo) we need
* to validate our internal state.
@ -1783,7 +1784,7 @@ gimp_tool_path_verify_state (GimpToolPath *tool_path)
private->sel_anchor = NULL;
private->sel_stroke = NULL;
if (! private->vectors)
if (! private->path)
{
private->cur_position = -1;
private->cur_anchor = NULL;
@ -1791,7 +1792,7 @@ gimp_tool_path_verify_state (GimpToolPath *tool_path)
return;
}
while ((cur_stroke = gimp_path_stroke_get_next (private->vectors,
while ((cur_stroke = gimp_path_stroke_get_next (private->path,
cur_stroke)))
{
GList *anchors;
@ -1864,7 +1865,7 @@ gimp_tool_path_move_selected_anchors (GimpToolPath *tool_path,
offset.x = x;
offset.y = y;
while ((cur_stroke = gimp_path_stroke_get_next (private->vectors,
while ((cur_stroke = gimp_path_stroke_get_next (private->path,
cur_stroke)))
{
/* anchors */
@ -1895,9 +1896,9 @@ gimp_tool_path_delete_selected_anchors (GimpToolPath *tool_path)
GList *list;
gboolean have_undo = FALSE;
gimp_path_freeze (private->vectors);
gimp_path_freeze (private->path);
while ((cur_stroke = gimp_path_stroke_get_next (private->vectors,
while ((cur_stroke = gimp_path_stroke_get_next (private->path,
cur_stroke)))
{
/* anchors */
@ -1919,7 +1920,7 @@ gimp_tool_path_delete_selected_anchors (GimpToolPath *tool_path)
if (gimp_stroke_is_empty (cur_stroke))
{
gimp_path_stroke_remove (private->vectors, cur_stroke);
gimp_path_stroke_remove (private->path, cur_stroke);
cur_stroke = NULL;
}
}
@ -1931,7 +1932,7 @@ gimp_tool_path_delete_selected_anchors (GimpToolPath *tool_path)
if (have_undo)
gimp_tool_path_end_change (tool_path, TRUE);
gimp_path_thaw (private->vectors);
gimp_path_thaw (private->path);
}
@ -1949,53 +1950,53 @@ gimp_tool_path_new (GimpDisplayShell *shell)
void
gimp_tool_path_set_path (GimpToolPath *tool_path,
GimpPath *vectors)
GimpPath *path)
{
GimpToolPathPrivate *private;
g_return_if_fail (GIMP_IS_TOOL_PATH (tool_path));
g_return_if_fail (vectors == NULL || GIMP_IS_PATH (vectors));
g_return_if_fail (path == NULL || GIMP_IS_PATH (path));
private = tool_path->private;
if (vectors == private->vectors)
if (path == private->path)
return;
if (private->vectors)
if (private->path)
{
g_signal_handlers_disconnect_by_func (private->vectors,
gimp_tool_path_vectors_visible,
g_signal_handlers_disconnect_by_func (private->path,
gimp_tool_path_path_visible,
tool_path);
g_signal_handlers_disconnect_by_func (private->vectors,
gimp_tool_path_vectors_freeze,
g_signal_handlers_disconnect_by_func (private->path,
gimp_tool_path_path_freeze,
tool_path);
g_signal_handlers_disconnect_by_func (private->vectors,
gimp_tool_path_vectors_thaw,
g_signal_handlers_disconnect_by_func (private->path,
gimp_tool_path_path_thaw,
tool_path);
g_object_unref (private->vectors);
g_object_unref (private->path);
}
private->vectors = vectors;
private->path = path;
private->function = VECTORS_FINISHED;
gimp_tool_path_verify_state (tool_path);
if (private->vectors)
if (private->path)
{
g_object_ref (private->vectors);
g_object_ref (private->path);
g_signal_connect_object (private->vectors, "visibility-changed",
G_CALLBACK (gimp_tool_path_vectors_visible),
g_signal_connect_object (private->path, "visibility-changed",
G_CALLBACK (gimp_tool_path_path_visible),
tool_path, 0);
g_signal_connect_object (private->vectors, "freeze",
G_CALLBACK (gimp_tool_path_vectors_freeze),
g_signal_connect_object (private->path, "freeze",
G_CALLBACK (gimp_tool_path_path_freeze),
tool_path, 0);
g_signal_connect_object (private->vectors, "thaw",
G_CALLBACK (gimp_tool_path_vectors_thaw),
g_signal_connect_object (private->path, "thaw",
G_CALLBACK (gimp_tool_path_path_thaw),
tool_path, 0);
}
g_object_notify (G_OBJECT (tool_path), "vectors");
g_object_notify (G_OBJECT (tool_path), "path");
}
void
@ -2021,14 +2022,14 @@ gimp_tool_path_delete_anchor (GimpToolPath *tool_path)
g_return_if_fail (private->cur_stroke != NULL);
g_return_if_fail (private->cur_anchor != NULL);
gimp_path_freeze (private->vectors);
gimp_path_freeze (private->path);
gimp_tool_path_begin_change (tool_path, _("Delete Anchors"));
if (private->cur_anchor->type == GIMP_ANCHOR_ANCHOR)
{
gimp_stroke_anchor_delete (private->cur_stroke, private->cur_anchor);
if (gimp_stroke_is_empty (private->cur_stroke))
gimp_path_stroke_remove (private->vectors,
gimp_path_stroke_remove (private->path,
private->cur_stroke);
}
else
@ -2039,7 +2040,7 @@ gimp_tool_path_delete_anchor (GimpToolPath *tool_path)
}
gimp_tool_path_end_change (tool_path, TRUE);
gimp_path_thaw (private->vectors);
gimp_path_thaw (private->path);
}
void
@ -2050,13 +2051,13 @@ gimp_tool_path_shift_start (GimpToolPath *tool_path)
g_return_if_fail (private->cur_stroke != NULL);
g_return_if_fail (private->cur_anchor != NULL);
gimp_path_freeze (private->vectors);
gimp_path_freeze (private->path);
gimp_tool_path_begin_change (tool_path, _("Shift start"));
gimp_stroke_shift_start (private->cur_stroke, private->cur_anchor);
gimp_tool_path_end_change (tool_path, TRUE);
gimp_path_thaw (private->vectors);
gimp_path_thaw (private->path);
}
void
@ -2068,7 +2069,7 @@ gimp_tool_path_insert_anchor (GimpToolPath *tool_path)
g_return_if_fail (private->cur_anchor != NULL);
g_return_if_fail (private->cur_position >= 0.0);
gimp_path_freeze (private->vectors);
gimp_path_freeze (private->path);
gimp_tool_path_begin_change (tool_path, _("Insert Anchor"));
private->cur_anchor = gimp_stroke_anchor_insert (private->cur_stroke,
@ -2076,7 +2077,7 @@ gimp_tool_path_insert_anchor (GimpToolPath *tool_path)
private->cur_position);
gimp_tool_path_end_change (tool_path, TRUE);
gimp_path_thaw (private->vectors);
gimp_path_thaw (private->path);
}
void
@ -2088,19 +2089,19 @@ gimp_tool_path_delete_segment (GimpToolPath *tool_path)
g_return_if_fail (private->cur_stroke != NULL);
g_return_if_fail (private->cur_anchor != NULL);
gimp_path_freeze (private->vectors);
gimp_path_freeze (private->path);
gimp_tool_path_begin_change (tool_path, _("Delete Segment"));
new_stroke = gimp_stroke_open (private->cur_stroke,
private->cur_anchor);
if (new_stroke)
{
gimp_path_stroke_add (private->vectors, new_stroke);
gimp_path_stroke_add (private->path, new_stroke);
g_object_unref (new_stroke);
}
gimp_tool_path_end_change (tool_path, TRUE);
gimp_path_thaw (private->vectors);
gimp_path_thaw (private->path);
}
void
@ -2110,11 +2111,11 @@ gimp_tool_path_reverse_stroke (GimpToolPath *tool_path)
g_return_if_fail (private->cur_stroke != NULL);
gimp_path_freeze (private->vectors);
gimp_path_freeze (private->path);
gimp_tool_path_begin_change (tool_path, _("Insert Anchor"));
gimp_stroke_reverse (private->cur_stroke);
gimp_tool_path_end_change (tool_path, TRUE);
gimp_path_thaw (private->vectors);
gimp_path_thaw (private->path);
}

View file

@ -62,7 +62,7 @@ GType gimp_tool_path_get_type (void) G_GNUC_CONST;
GimpToolWidget * gimp_tool_path_new (GimpDisplayShell *shell);
void gimp_tool_path_set_path (GimpToolPath *tool_path,
GimpPath *vectors);
GimpPath *path);
void gimp_tool_path_get_popup_state (GimpToolPath *tool_path,
gboolean *on_handle,

View file

@ -71,8 +71,8 @@ gimp_vector_options_class_init (GimpVectorOptionsClass *klass)
"vectors-edit-mode",
_("Edit Mode"),
NULL,
GIMP_TYPE_VECTOR_MODE,
GIMP_VECTOR_MODE_DESIGN,
GIMP_TYPE_PATH_MODE,
GIMP_PATH_MODE_DESIGN,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_VECTORS_POLYGONAL,
@ -166,10 +166,10 @@ gimp_vector_options_gui (GimpToolOptions *tool_options)
{
GSList *list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
/* GIMP_VECTOR_MODE_MOVE */
/* GIMP_PATH_MODE_MOVE */
button_append_modifier (list->data, GDK_MOD1_MASK);
if (list->next) /* GIMP_VECTOR_MODE_EDIT */
if (list->next) /* GIMP_PATH_MODE_EDIT */
button_append_modifier (list->next->data,
gimp_get_toggle_behavior_mask ());
}

View file

@ -37,7 +37,7 @@ struct _GimpVectorOptions
{
GimpToolOptions parent_instance;
GimpVectorMode edit_mode;
GimpPathMode edit_mode;
gboolean polygonal;
/* options gui */

View file

@ -199,7 +199,7 @@ gimp_vector_tool_init (GimpVectorTool *vector_tool)
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PATHS);
vector_tool->saved_mode = GIMP_VECTOR_MODE_DESIGN;
vector_tool->saved_mode = GIMP_PATH_MODE_DESIGN;
}
static void
@ -316,7 +316,7 @@ gimp_vector_tool_modifier_key (GimpTool *tool,
if (key == INSDEL_MASK || key == MOVE_MASK)
{
GimpVectorMode button_mode = options->edit_mode;
GimpPathMode button_mode = options->edit_mode;
if (press)
{
@ -339,11 +339,11 @@ gimp_vector_tool_modifier_key (GimpTool *tool,
if (state & MOVE_MASK)
{
button_mode = GIMP_VECTOR_MODE_MOVE;
button_mode = GIMP_PATH_MODE_MOVE;
}
else if (state & INSDEL_MASK)
{
button_mode = GIMP_VECTOR_MODE_EDIT;
button_mode = GIMP_PATH_MODE_EDIT;
}
if (button_mode != options->edit_mode)
@ -407,7 +407,7 @@ gimp_vector_tool_start (GimpVectorTool *vector_tool,
G_BINDING_BIDIRECTIONAL);
gimp_tool_path_set_path (GIMP_TOOL_PATH (widget),
vector_tool->vectors);
vector_tool->path);
g_signal_connect (widget, "changed",
G_CALLBACK (gimp_vector_tool_path_changed),
@ -445,18 +445,18 @@ gimp_vector_tool_halt (GimpVectorTool *vector_tool)
}
static void
gimp_vector_tool_path_changed (GimpToolWidget *path,
gimp_vector_tool_path_changed (GimpToolWidget *tool_path,
GimpVectorTool *vector_tool)
{
GimpDisplayShell *shell = gimp_tool_widget_get_shell (path);
GimpDisplayShell *shell = gimp_tool_widget_get_shell (tool_path);
GimpImage *image = gimp_display_get_image (shell->display);
GimpPath *vectors;
g_object_get (path,
"vectors", &vectors,
g_object_get (tool_path,
"path", &vectors,
NULL);
if (vectors != vector_tool->vectors)
if (vectors != vector_tool->path)
{
if (vectors && ! gimp_item_is_attached (GIMP_ITEM (vectors)))
{
@ -492,7 +492,7 @@ gimp_vector_tool_path_begin_change (GimpToolWidget *path,
GimpDisplayShell *shell = gimp_tool_widget_get_shell (path);
GimpImage *image = gimp_display_get_image (shell->display);
gimp_image_undo_push_path_mod (image, desc, vector_tool->vectors);
gimp_image_undo_push_path_mod (image, desc, vector_tool->path);
}
static void
@ -565,23 +565,23 @@ gimp_vector_tool_set_path (GimpVectorTool *vector_tool,
if (vectors)
item = GIMP_ITEM (vectors);
if (vectors == vector_tool->vectors)
if (vectors == vector_tool->path)
return;
if (vector_tool->vectors)
if (vector_tool->path)
{
GimpImage *old_image;
old_image = gimp_item_get_image (GIMP_ITEM (vector_tool->vectors));
old_image = gimp_item_get_image (GIMP_ITEM (vector_tool->path));
g_signal_handlers_disconnect_by_func (old_image,
gimp_vector_tool_vectors_changed,
vector_tool);
g_signal_handlers_disconnect_by_func (vector_tool->vectors,
g_signal_handlers_disconnect_by_func (vector_tool->path,
gimp_vector_tool_vectors_removed,
vector_tool);
g_clear_object (&vector_tool->vectors);
g_clear_object (&vector_tool->path);
if (options->to_selection_button)
{
@ -621,7 +621,7 @@ gimp_vector_tool_set_path (GimpVectorTool *vector_tool,
if (! vectors)
return;
vector_tool->vectors = g_object_ref (vectors);
vector_tool->path = g_object_ref (vectors);
g_signal_connect_object (gimp_item_get_image (item), "selected-paths-changed",
G_CALLBACK (gimp_vector_tool_vectors_changed),
@ -693,9 +693,9 @@ gimp_vector_tool_set_path (GimpVectorTool *vector_tool,
gimp_vector_tool_start (vector_tool, display);
}
if (options->edit_mode != GIMP_VECTOR_MODE_DESIGN)
if (options->edit_mode != GIMP_PATH_MODE_DESIGN)
g_object_set (options, "vectors-edit-mode",
GIMP_VECTOR_MODE_DESIGN, NULL);
GIMP_PATH_MODE_DESIGN, NULL);
}
static void
@ -710,12 +710,12 @@ gimp_vector_tool_to_selection_extended (GimpVectorTool *vector_tool,
{
GimpImage *image;
if (! vector_tool->vectors)
if (! vector_tool->path)
return;
image = gimp_item_get_image (GIMP_ITEM (vector_tool->vectors));
image = gimp_item_get_image (GIMP_ITEM (vector_tool->path));
gimp_item_to_selection (GIMP_ITEM (vector_tool->vectors),
gimp_item_to_selection (GIMP_ITEM (vector_tool->path),
gimp_modifiers_to_channel_op (state),
TRUE, FALSE, 0, 0);
gimp_image_flush (image);
@ -732,10 +732,10 @@ gimp_vector_tool_fill_vectors (GimpVectorTool *vector_tool,
GList *vectors_list = NULL;
GtkWidget *dialog;
if (! vector_tool->vectors)
if (! vector_tool->path)
return;
image = gimp_item_get_image (GIMP_ITEM (vector_tool->vectors));
image = gimp_item_get_image (GIMP_ITEM (vector_tool->path));
config = GIMP_DIALOG_CONFIG (image->gimp->config);
@ -758,7 +758,7 @@ gimp_vector_tool_fill_vectors (GimpVectorTool *vector_tool,
return;
}
vectors_list = g_list_prepend (NULL, vector_tool->vectors);
vectors_list = g_list_prepend (NULL, vector_tool->path);
dialog = fill_dialog_new (vectors_list, drawables,
GIMP_CONTEXT (GIMP_TOOL_GET_OPTIONS (vector_tool)),
_("Fill Path"),
@ -821,10 +821,10 @@ gimp_vector_tool_stroke_vectors (GimpVectorTool *vector_tool,
GList *vectors_list = NULL;
GtkWidget *dialog;
if (! vector_tool->vectors)
if (! vector_tool->path)
return;
image = gimp_item_get_image (GIMP_ITEM (vector_tool->vectors));
image = gimp_item_get_image (GIMP_ITEM (vector_tool->path));
config = GIMP_DIALOG_CONFIG (image->gimp->config);
@ -847,7 +847,7 @@ gimp_vector_tool_stroke_vectors (GimpVectorTool *vector_tool,
return;
}
vectors_list = g_list_prepend (NULL, vector_tool->vectors);
vectors_list = g_list_prepend (NULL, vector_tool->path);
dialog = stroke_dialog_new (vectors_list, drawables,
GIMP_CONTEXT (GIMP_TOOL_GET_OPTIONS (vector_tool)),
_("Stroke Path"),

View file

@ -42,8 +42,8 @@ struct _GimpVectorTool
{
GimpDrawTool parent_instance;
GimpPath *vectors; /* the current Path data */
GimpVectorMode saved_mode; /* used by modifier_key() */
GimpPath *path; /* the current Path data */
GimpPathMode saved_mode; /* used by modifier_key() */
GimpToolWidget *widget;
GimpToolWidget *grab_widget;