diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c index b7e71fb5fc..053dd8f6dc 100644 --- a/app/actions/edit-commands.c +++ b/app/actions/edit-commands.c @@ -43,7 +43,7 @@ #include "core/gimpimage.h" #include "core/gimpimage-undo.h" -#include "vectors/gimpvectors-import.h" +#include "vectors/gimppath-import.h" #include "widgets/gimpclipboard.h" #include "widgets/gimphelp-ids.h" @@ -658,10 +658,10 @@ edit_paste (GimpDisplay *display, if (svg) { - if (gimp_vectors_import_buffer (image, svg, svg_size, - TRUE, FALSE, - GIMP_IMAGE_ACTIVE_PARENT, -1, - NULL, NULL)) + if (gimp_path_import_buffer (image, svg, svg_size, + TRUE, FALSE, + GIMP_IMAGE_ACTIVE_PARENT, -1, + NULL, NULL)) { gimp_image_flush (image); } diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index 55aeb88ae9..689cb901a3 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -58,12 +58,12 @@ #include "core/gimpprogress.h" #include "text/gimptext.h" -#include "text/gimptext-vectors.h" +#include "text/gimptext-path.h" #include "text/gimptextlayer.h" #include "vectors/gimppath.h" +#include "vectors/gimppath-warp.h" #include "vectors/gimpstroke.h" -#include "vectors/gimpvectors-warp.h" #include "widgets/gimpaction.h" #include "widgets/gimpdock.h" @@ -1044,7 +1044,7 @@ layers_text_to_vectors_cmd_callback (GimpAction *action, return_if_no_layers (image, layers, data); /* TODO: have the proper undo group. */ - gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_VECTORS_IMPORT, + gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_PATHS_IMPORT, _("Add Paths")); for (iter = layers; iter; iter = iter->next) { @@ -1055,7 +1055,7 @@ layers_text_to_vectors_cmd_callback (GimpAction *action, GimpPath *path; gint x, y; - path = gimp_text_vectors_new (image, GIMP_TEXT_LAYER (layer)->text); + path = gimp_text_path_new (image, GIMP_TEXT_LAYER (layer)->text); gimp_item_get_offset (GIMP_ITEM (layer), &x, &y); gimp_item_translate (GIMP_ITEM (path), x, y, FALSE); @@ -1077,26 +1077,26 @@ layers_text_along_vectors_cmd_callback (GimpAction *action, GList *layers; GList *paths; GimpLayer *layer; - GimpPath *vectors; + GimpPath *path; return_if_no_layers (image, layers, data); return_if_no_vectors_list (image, paths, data); if (g_list_length (layers) != 1 || g_list_length (paths) != 1) return; - layer = layers->data; - vectors = paths->data; + layer = layers->data; + path = paths->data; if (GIMP_IS_TEXT_LAYER (layer)) { gdouble box_width; gdouble box_height; - GimpPath *new_vectors; + GimpPath *new_path; gdouble offset; box_width = gimp_item_get_width (GIMP_ITEM (layer)); box_height = gimp_item_get_height (GIMP_ITEM (layer)); - new_vectors = gimp_text_vectors_new (image, GIMP_TEXT_LAYER (layer)->text); + new_path = gimp_text_path_new (image, GIMP_TEXT_LAYER (layer)->text); offset = 0; switch (GIMP_TEXT_LAYER (layer)->text->base_dir) @@ -1112,7 +1112,7 @@ layers_text_along_vectors_cmd_callback (GimpAction *action, { GimpStroke *stroke = NULL; - while ((stroke = gimp_vectors_stroke_get_next (new_vectors, stroke))) + while ((stroke = gimp_path_stroke_get_next (new_path, stroke))) { gimp_stroke_rotate (stroke, 0, 0, 270); gimp_stroke_translate (stroke, 0, box_width); @@ -1122,12 +1122,11 @@ layers_text_along_vectors_cmd_callback (GimpAction *action, break; } + gimp_path_warp_path (path, new_path, offset); - gimp_vectors_warp_vectors (vectors, new_vectors, offset); + gimp_item_set_visible (GIMP_ITEM (new_path), TRUE, FALSE); - gimp_item_set_visible (GIMP_ITEM (new_vectors), TRUE, FALSE); - - gimp_image_add_path (image, new_vectors, + gimp_image_add_path (image, new_path, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE); gimp_image_flush (image); } diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c index befac2a345..57a46e82b6 100644 --- a/app/actions/vectors-commands.c +++ b/app/actions/vectors-commands.c @@ -45,8 +45,8 @@ #include "pdb/gimpprocedure.h" #include "vectors/gimppath.h" -#include "vectors/gimpvectors-export.h" -#include "vectors/gimpvectors-import.h" +#include "vectors/gimppath-export.h" +#include "vectors/gimppath-import.h" #include "widgets/gimpaction.h" #include "widgets/gimpclipboard.h" @@ -58,9 +58,9 @@ #include "tools/tool_manager.h" #include "dialogs/dialogs.h" -#include "dialogs/vectors-export-dialog.h" -#include "dialogs/vectors-import-dialog.h" -#include "dialogs/vectors-options-dialog.h" +#include "dialogs/path-export-dialog.h" +#include "dialogs/path-import-dialog.h" +#include "dialogs/path-options-dialog.h" #include "actions.h" #include "items-commands.h" @@ -73,32 +73,32 @@ static void vectors_new_callback (GtkWidget *dialog, GimpImage *image, - GimpPath *vectors, + GimpPath *path, GimpContext *context, - const gchar *vectors_name, - gboolean vectors_visible, - GimpColorTag vectors_color_tag, - gboolean vectors_lock_content, - gboolean vectors_lock_position, - gboolean vectors_lock_visibility, + const gchar *path_name, + gboolean path_visible, + GimpColorTag path_color_tag, + gboolean path_lock_content, + gboolean path_lock_position, + gboolean path_lock_visibility, gpointer user_data); static void vectors_edit_attributes_callback (GtkWidget *dialog, GimpImage *image, - GimpPath *vectors, + GimpPath *path, GimpContext *context, - const gchar *vectors_name, - gboolean vectors_visible, - GimpColorTag vectors_color_tag, - gboolean vectors_lock_content, - gboolean vectors_lock_position, - gboolean vectors_lock_visibility, + const gchar *path_name, + gboolean path_visible, + GimpColorTag path_color_tag, + gboolean path_lock_content, + gboolean path_lock_position, + gboolean path_lock_visibility, gpointer user_data); static void vectors_import_callback (GtkWidget *dialog, GimpImage *image, GFile *file, GFile *import_folder, - gboolean merge_vectors, - gboolean scale_vectors, + gboolean merge_paths, + gboolean scale_paths, gpointer user_data); static void vectors_export_callback (GtkWidget *dialog, GimpImage *image, @@ -116,11 +116,11 @@ vectors_edit_cmd_callback (GimpAction *action, gpointer data) { GimpImage *image; - GList *vectors; + GList *paths; GimpTool *active_tool; - return_if_no_vectors_list (image, vectors, data); + return_if_no_vectors_list (image, paths, data); - if (g_list_length (vectors) != 1) + if (g_list_length (paths) != 1) return; active_tool = tool_manager_get_active (image->gimp); @@ -138,7 +138,7 @@ vectors_edit_cmd_callback (GimpAction *action, } if (GIMP_IS_VECTOR_TOOL (active_tool)) - gimp_vector_tool_set_vectors (GIMP_VECTOR_TOOL (active_tool), vectors->data); + gimp_vector_tool_set_vectors (GIMP_VECTOR_TOOL (active_tool), paths->data); } void @@ -167,22 +167,22 @@ vectors_edit_attributes_cmd_callback (GimpAction *action, { GimpItem *item = GIMP_ITEM (vectors); - dialog = vectors_options_dialog_new (image, vectors, - action_data_get_context (data), - widget, - _("Path Attributes"), - "gimp-vectors-edit", - GIMP_ICON_EDIT, - _("Edit Path Attributes"), - GIMP_HELP_PATH_EDIT, - gimp_object_get_name (vectors), - gimp_item_get_visible (item), - gimp_item_get_color_tag (item), - gimp_item_get_lock_content (item), - gimp_item_get_lock_position (item), - gimp_item_get_lock_visibility (item), - vectors_edit_attributes_callback, - NULL); + dialog = path_options_dialog_new (image, vectors, + action_data_get_context (data), + widget, + _("Path Attributes"), + "gimp-vectors-edit", + GIMP_ICON_EDIT, + _("Edit Path Attributes"), + GIMP_HELP_PATH_EDIT, + gimp_object_get_name (vectors), + gimp_item_get_visible (item), + gimp_item_get_color_tag (item), + gimp_item_get_lock_content (item), + gimp_item_get_lock_position (item), + gimp_item_get_lock_visibility (item), + vectors_edit_attributes_callback, + NULL); dialogs_attach_dialog (G_OBJECT (vectors), EDIT_DIALOG_KEY, dialog); } @@ -209,22 +209,22 @@ vectors_new_cmd_callback (GimpAction *action, { GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config); - dialog = vectors_options_dialog_new (image, NULL, - action_data_get_context (data), - widget, - _("New Path"), - "gimp-vectors-new", - GIMP_ICON_PATH, - _("Create a New Path"), - GIMP_HELP_PATH_NEW, - config->vectors_new_name, - FALSE, - GIMP_COLOR_TAG_NONE, - FALSE, - FALSE, - FALSE, - vectors_new_callback, - NULL); + dialog = path_options_dialog_new (image, NULL, + action_data_get_context (data), + widget, + _("New Path"), + "gimp-vectors-new", + GIMP_ICON_PATH, + _("Create a New Path"), + GIMP_HELP_PATH_NEW, + config->vectors_new_name, + FALSE, + GIMP_COLOR_TAG_NONE, + FALSE, + FALSE, + FALSE, + vectors_new_callback, + NULL); dialogs_attach_dialog (G_OBJECT (image), NEW_DIALOG_KEY, dialog); } @@ -244,7 +244,7 @@ vectors_new_last_vals_cmd_callback (GimpAction *action, config = GIMP_DIALOG_CONFIG (image->gimp->config); - vectors = gimp_vectors_new (image, config->vectors_new_name); + vectors = gimp_path_new (image, config->vectors_new_name); gimp_image_add_path (image, vectors, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE); gimp_image_flush (image); @@ -419,7 +419,7 @@ vectors_duplicate_cmd_callback (GimpAction *action, /* TODO: proper undo group. */ gimp_image_undo_group_start (image, - GIMP_UNDO_GROUP_VECTORS_IMPORT, + GIMP_UNDO_GROUP_PATHS_IMPORT, _("Duplicate Paths")); for (iter = paths; iter; iter = iter->next) { @@ -432,7 +432,7 @@ vectors_duplicate_cmd_callback (GimpAction *action, * above it */ gimp_image_add_path (image, new_path, - gimp_vectors_get_parent (iter->data), -1, + gimp_path_get_parent (iter->data), -1, TRUE); new_paths = g_list_prepend (new_paths, new_path); } @@ -457,7 +457,7 @@ vectors_delete_cmd_callback (GimpAction *action, paths = g_list_copy (paths); /* TODO: proper undo group. */ gimp_image_undo_group_start (image, - GIMP_UNDO_GROUP_VECTORS_IMPORT, + GIMP_UNDO_GROUP_PATHS_IMPORT, _("Remove Paths")); for (GList *iter = paths; iter; iter = iter->next) @@ -641,7 +641,7 @@ vectors_copy_cmd_callback (GimpAction *action, gchar *svg; return_if_no_vectors_list (image, vectors, data); - svg = gimp_vectors_export_string (image, vectors); + svg = gimp_path_export_string (image, vectors); if (svg) { @@ -668,10 +668,10 @@ vectors_paste_cmd_callback (GimpAction *action, { GError *error = NULL; - if (! gimp_vectors_import_buffer (image, svg, svg_size, - TRUE, FALSE, - GIMP_IMAGE_ACTIVE_PARENT, -1, - NULL, &error)) + if (! gimp_path_import_buffer (image, svg, svg_size, + TRUE, FALSE, + GIMP_IMAGE_ACTIVE_PARENT, -1, + NULL, &error)) { gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_ERROR, "%s", error->message); @@ -711,11 +711,11 @@ vectors_export_cmd_callback (GimpAction *action, folder = gimp_file_new_for_config_path (config->vectors_export_path, NULL); - dialog = vectors_export_dialog_new (image, widget, - folder, - config->vectors_export_active_only, - vectors_export_callback, - NULL); + dialog = path_export_dialog_new (image, widget, + folder, + config->vectors_export_active_only, + vectors_export_callback, + NULL); if (folder) g_object_unref (folder); @@ -750,12 +750,12 @@ vectors_import_cmd_callback (GimpAction *action, folder = gimp_file_new_for_config_path (config->vectors_import_path, NULL); - dialog = vectors_import_dialog_new (image, widget, - folder, - config->vectors_import_merge, - config->vectors_import_scale, - vectors_import_callback, - NULL); + dialog = path_import_dialog_new (image, widget, + folder, + config->vectors_import_merge, + config->vectors_import_scale, + vectors_import_callback, + NULL); dialogs_attach_dialog (G_OBJECT (image), IMPORT_DIALOG_KEY, dialog); } @@ -836,7 +836,7 @@ vectors_new_callback (GtkWidget *dialog, "path-new-name", vectors_name, NULL); - vectors = gimp_vectors_new (image, config->vectors_new_name); + vectors = gimp_path_new (image, config->vectors_new_name); gimp_item_set_visible (GIMP_ITEM (vectors), vectors_visible, FALSE); gimp_item_set_color_tag (GIMP_ITEM (vectors), vectors_color_tag, FALSE); gimp_item_set_lock_content (GIMP_ITEM (vectors), vectors_lock_content, FALSE); @@ -927,11 +927,11 @@ vectors_import_callback (GtkWidget *dialog, if (path) g_free (path); - if (gimp_vectors_import_file (image, file, - config->vectors_import_merge, - config->vectors_import_scale, - GIMP_IMAGE_ACTIVE_PARENT, -1, - NULL, &error)) + if (gimp_path_import_file (image, file, + config->vectors_import_merge, + config->vectors_import_scale, + GIMP_IMAGE_ACTIVE_PARENT, -1, + NULL, &error)) { gimp_image_flush (image); } @@ -974,7 +974,7 @@ vectors_export_callback (GtkWidget *dialog, if (config->vectors_export_active_only) vectors = gimp_image_get_selected_paths (image); - if (! gimp_vectors_export_file (image, vectors, file, &error)) + if (! gimp_path_export_file (image, vectors, file, &error)) { gimp_message (image->gimp, G_OBJECT (dialog), GIMP_MESSAGE_ERROR, diff --git a/app/core/core-enums.c b/app/core/core-enums.c index 6f02b431b9..e416283dcc 100644 --- a/app/core/core-enums.c +++ b/app/core/core-enums.c @@ -504,7 +504,7 @@ gimp_dirty_mask_get_type (void) { GIMP_DIRTY_ITEM, "GIMP_DIRTY_ITEM", "item" }, { GIMP_DIRTY_ITEM_META, "GIMP_DIRTY_ITEM_META", "item-meta" }, { GIMP_DIRTY_DRAWABLE, "GIMP_DIRTY_DRAWABLE", "drawable" }, - { GIMP_DIRTY_VECTORS, "GIMP_DIRTY_VECTORS", "vectors" }, + { GIMP_DIRTY_PATH, "GIMP_DIRTY_PATH", "path" }, { GIMP_DIRTY_SELECTION, "GIMP_DIRTY_SELECTION", "selection" }, { GIMP_DIRTY_ACTIVE_DRAWABLE, "GIMP_DIRTY_ACTIVE_DRAWABLE", "active-drawable" }, { GIMP_DIRTY_ALL, "GIMP_DIRTY_ALL", "all" }, @@ -521,7 +521,7 @@ gimp_dirty_mask_get_type (void) { GIMP_DIRTY_ITEM, "GIMP_DIRTY_ITEM", NULL }, { GIMP_DIRTY_ITEM_META, "GIMP_DIRTY_ITEM_META", NULL }, { GIMP_DIRTY_DRAWABLE, "GIMP_DIRTY_DRAWABLE", NULL }, - { GIMP_DIRTY_VECTORS, "GIMP_DIRTY_VECTORS", NULL }, + { GIMP_DIRTY_PATH, "GIMP_DIRTY_PATH", NULL }, { GIMP_DIRTY_SELECTION, "GIMP_DIRTY_SELECTION", NULL }, { GIMP_DIRTY_ACTIVE_DRAWABLE, "GIMP_DIRTY_ACTIVE_DRAWABLE", NULL }, { GIMP_DIRTY_ALL, "GIMP_DIRTY_ALL", NULL }, @@ -1192,7 +1192,7 @@ gimp_undo_type_get_type (void) { GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE, "GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE", "group-image-item-remove" }, { GIMP_UNDO_GROUP_IMAGE_ITEM_REORDER, "GIMP_UNDO_GROUP_IMAGE_ITEM_REORDER", "group-image-item-reorder" }, { GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, "GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE", "group-image-layers-merge" }, - { GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE, "GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE", "group-image-vectors-merge" }, + { GIMP_UNDO_GROUP_IMAGE_PATHS_MERGE, "GIMP_UNDO_GROUP_IMAGE_PATHS_MERGE", "group-image-paths-merge" }, { GIMP_UNDO_GROUP_IMAGE_QUICK_MASK, "GIMP_UNDO_GROUP_IMAGE_QUICK_MASK", "group-image-quick-mask" }, { GIMP_UNDO_GROUP_IMAGE_GRID, "GIMP_UNDO_GROUP_IMAGE_GRID", "group-image-grid" }, { GIMP_UNDO_GROUP_IMAGE_COLORMAP_REMAP, "GIMP_UNDO_GROUP_IMAGE_COLORMAP_REMAP", "group-image-colormap-remap" }, @@ -1228,7 +1228,7 @@ gimp_undo_type_get_type (void) { GIMP_UNDO_GROUP_PAINT, "GIMP_UNDO_GROUP_PAINT", "group-paint" }, { GIMP_UNDO_GROUP_PARASITE_ATTACH, "GIMP_UNDO_GROUP_PARASITE_ATTACH", "group-parasite-attach" }, { GIMP_UNDO_GROUP_PARASITE_REMOVE, "GIMP_UNDO_GROUP_PARASITE_REMOVE", "group-parasite-remove" }, - { GIMP_UNDO_GROUP_VECTORS_IMPORT, "GIMP_UNDO_GROUP_VECTORS_IMPORT", "group-vectors-import" }, + { GIMP_UNDO_GROUP_PATHS_IMPORT, "GIMP_UNDO_GROUP_PATHS_IMPORT", "group-paths-import" }, { GIMP_UNDO_GROUP_MISC, "GIMP_UNDO_GROUP_MISC", "group-misc" }, { GIMP_UNDO_IMAGE_TYPE, "GIMP_UNDO_IMAGE_TYPE", "image-type" }, { GIMP_UNDO_IMAGE_PRECISION, "GIMP_UNDO_IMAGE_PRECISION", "image-precision" }, @@ -1274,9 +1274,9 @@ gimp_undo_type_get_type (void) { GIMP_UNDO_CHANNEL_ADD, "GIMP_UNDO_CHANNEL_ADD", "channel-add" }, { GIMP_UNDO_CHANNEL_REMOVE, "GIMP_UNDO_CHANNEL_REMOVE", "channel-remove" }, { GIMP_UNDO_CHANNEL_COLOR, "GIMP_UNDO_CHANNEL_COLOR", "channel-color" }, - { GIMP_UNDO_VECTORS_ADD, "GIMP_UNDO_VECTORS_ADD", "vectors-add" }, - { GIMP_UNDO_VECTORS_REMOVE, "GIMP_UNDO_VECTORS_REMOVE", "vectors-remove" }, - { GIMP_UNDO_VECTORS_MOD, "GIMP_UNDO_VECTORS_MOD", "vectors-mod" }, + { GIMP_UNDO_PATH_ADD, "GIMP_UNDO_PATH_ADD", "path-add" }, + { GIMP_UNDO_PATH_REMOVE, "GIMP_UNDO_PATH_REMOVE", "path-remove" }, + { GIMP_UNDO_PATH_MOD, "GIMP_UNDO_PATH_MOD", "path-mod" }, { GIMP_UNDO_FS_TO_LAYER, "GIMP_UNDO_FS_TO_LAYER", "fs-to-layer" }, { GIMP_UNDO_TRANSFORM_GRID, "GIMP_UNDO_TRANSFORM_GRID", "transform-grid" }, { GIMP_UNDO_PAINT, "GIMP_UNDO_PAINT", "paint" }, @@ -1304,7 +1304,7 @@ gimp_undo_type_get_type (void) { GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE, NC_("undo-type", "Remove item"), NULL }, { GIMP_UNDO_GROUP_IMAGE_ITEM_REORDER, NC_("undo-type", "Reorder item"), NULL }, { GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, NC_("undo-type", "Merge layers"), NULL }, - { GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE, NC_("undo-type", "Merge paths"), NULL }, + { GIMP_UNDO_GROUP_IMAGE_PATHS_MERGE, NC_("undo-type", "Merge paths"), NULL }, { GIMP_UNDO_GROUP_IMAGE_QUICK_MASK, NC_("undo-type", "Quick Mask"), NULL }, { GIMP_UNDO_GROUP_IMAGE_GRID, NC_("undo-type", "Grid"), NULL }, { GIMP_UNDO_GROUP_IMAGE_COLORMAP_REMAP, NC_("undo-type", "Colormap remapping"), NULL }, @@ -1340,7 +1340,7 @@ gimp_undo_type_get_type (void) { GIMP_UNDO_GROUP_PAINT, NC_("undo-type", "Paint"), NULL }, { GIMP_UNDO_GROUP_PARASITE_ATTACH, NC_("undo-type", "Attach parasite"), NULL }, { GIMP_UNDO_GROUP_PARASITE_REMOVE, NC_("undo-type", "Remove parasite"), NULL }, - { GIMP_UNDO_GROUP_VECTORS_IMPORT, NC_("undo-type", "Import paths"), NULL }, + { GIMP_UNDO_GROUP_PATHS_IMPORT, NC_("undo-type", "Import paths"), NULL }, { GIMP_UNDO_GROUP_MISC, NC_("undo-type", "Plug-In"), NULL }, { GIMP_UNDO_IMAGE_TYPE, NC_("undo-type", "Image type"), NULL }, { GIMP_UNDO_IMAGE_PRECISION, NC_("undo-type", "Image precision"), NULL }, @@ -1386,9 +1386,9 @@ gimp_undo_type_get_type (void) { GIMP_UNDO_CHANNEL_ADD, NC_("undo-type", "New channel"), NULL }, { GIMP_UNDO_CHANNEL_REMOVE, NC_("undo-type", "Delete channel"), NULL }, { GIMP_UNDO_CHANNEL_COLOR, NC_("undo-type", "Channel color"), NULL }, - { GIMP_UNDO_VECTORS_ADD, NC_("undo-type", "New path"), NULL }, - { GIMP_UNDO_VECTORS_REMOVE, NC_("undo-type", "Delete path"), NULL }, - { GIMP_UNDO_VECTORS_MOD, NC_("undo-type", "Path modification"), NULL }, + { GIMP_UNDO_PATH_ADD, NC_("undo-type", "New path"), NULL }, + { GIMP_UNDO_PATH_REMOVE, NC_("undo-type", "Delete path"), NULL }, + { GIMP_UNDO_PATH_MOD, NC_("undo-type", "Path modification"), NULL }, { GIMP_UNDO_FS_TO_LAYER, NC_("undo-type", "Floating selection to layer"), NULL }, { GIMP_UNDO_TRANSFORM_GRID, NC_("undo-type", "Transform grid"), NULL }, { GIMP_UNDO_PAINT, NC_("undo-type", "Paint"), NULL }, diff --git a/app/core/core-enums.h b/app/core/core-enums.h index bbc10db1e6..3c33799540 100644 --- a/app/core/core-enums.h +++ b/app/core/core-enums.h @@ -262,7 +262,7 @@ typedef enum /*< pdb-skip >*/ GIMP_DIRTY_ITEM = 1 << 4, GIMP_DIRTY_ITEM_META = 1 << 5, GIMP_DIRTY_DRAWABLE = 1 << 6, - GIMP_DIRTY_VECTORS = 1 << 7, + GIMP_DIRTY_PATH = 1 << 7, GIMP_DIRTY_SELECTION = 1 << 8, GIMP_DIRTY_ACTIVE_DRAWABLE = 1 << 9, @@ -541,7 +541,7 @@ typedef enum /*< pdb-skip >*/ GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE, /*< desc="Remove item" >*/ GIMP_UNDO_GROUP_IMAGE_ITEM_REORDER, /*< desc="Reorder item" >*/ GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, /*< desc="Merge layers" >*/ - GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE, /*< desc="Merge paths" >*/ + GIMP_UNDO_GROUP_IMAGE_PATHS_MERGE, /*< desc="Merge paths" >*/ GIMP_UNDO_GROUP_IMAGE_QUICK_MASK, /*< desc="Quick Mask" >*/ GIMP_UNDO_GROUP_IMAGE_GRID, /*< desc="Grid" >*/ GIMP_UNDO_GROUP_IMAGE_COLORMAP_REMAP, /*< desc="Colormap remapping" >*/ @@ -577,7 +577,7 @@ typedef enum /*< pdb-skip >*/ GIMP_UNDO_GROUP_PAINT, /*< desc="Paint" >*/ GIMP_UNDO_GROUP_PARASITE_ATTACH, /*< desc="Attach parasite" >*/ GIMP_UNDO_GROUP_PARASITE_REMOVE, /*< desc="Remove parasite" >*/ - GIMP_UNDO_GROUP_VECTORS_IMPORT, /*< desc="Import paths" >*/ + GIMP_UNDO_GROUP_PATHS_IMPORT, /*< desc="Import paths" >*/ GIMP_UNDO_GROUP_MISC, /*< desc="Plug-In" >*/ GIMP_UNDO_GROUP_LAST = GIMP_UNDO_GROUP_MISC, /*< skip >*/ @@ -628,9 +628,9 @@ typedef enum /*< pdb-skip >*/ GIMP_UNDO_CHANNEL_ADD, /*< desc="New channel" >*/ GIMP_UNDO_CHANNEL_REMOVE, /*< desc="Delete channel" >*/ GIMP_UNDO_CHANNEL_COLOR, /*< desc="Channel color" >*/ - GIMP_UNDO_VECTORS_ADD, /*< desc="New path" >*/ - GIMP_UNDO_VECTORS_REMOVE, /*< desc="Delete path" >*/ - GIMP_UNDO_VECTORS_MOD, /*< desc="Path modification" >*/ + GIMP_UNDO_PATH_ADD, /*< desc="New path" >*/ + GIMP_UNDO_PATH_REMOVE, /*< desc="Delete path" >*/ + GIMP_UNDO_PATH_MOD, /*< desc="Path modification" >*/ GIMP_UNDO_FS_TO_LAYER, /*< desc="Floating selection to layer" >*/ GIMP_UNDO_TRANSFORM_GRID, /*< desc="Transform grid" >*/ GIMP_UNDO_PAINT, /*< desc="Paint" >*/ diff --git a/app/core/gimpchannel-select.c b/app/core/gimpchannel-select.c index 93b228c83f..5b12205c72 100644 --- a/app/core/gimpchannel-select.c +++ b/app/core/gimpchannel-select.c @@ -279,15 +279,15 @@ gimp_channel_select_polygon (GimpChannel *channel, } void -gimp_channel_select_vectors (GimpChannel *channel, - const gchar *undo_desc, - GimpPath *vectors, - GimpChannelOps op, - gboolean antialias, - gboolean feather, - gdouble feather_radius_x, - gdouble feather_radius_y, - gboolean push_undo) +gimp_channel_select_path (GimpChannel *channel, + const gchar *undo_desc, + GimpPath *vectors, + GimpChannelOps op, + gboolean antialias, + gboolean feather, + gdouble feather_radius_x, + gdouble feather_radius_y, + gboolean push_undo) { const GimpBezierDesc *bezier; @@ -296,7 +296,7 @@ gimp_channel_select_vectors (GimpChannel *channel, g_return_if_fail (undo_desc != NULL); g_return_if_fail (GIMP_IS_PATH (vectors)); - bezier = gimp_vectors_get_bezier (vectors); + bezier = gimp_path_get_bezier (vectors); if (bezier && bezier->num_data > 4) { diff --git a/app/core/gimpchannel-select.h b/app/core/gimpchannel-select.h index b4e4bf645a..be9cac15d4 100644 --- a/app/core/gimpchannel-select.h +++ b/app/core/gimpchannel-select.h @@ -79,7 +79,7 @@ void gimp_channel_select_polygon (GimpChannel *channel, gdouble feather_radius_x, gdouble feather_radius_y, gboolean push_undo); -void gimp_channel_select_vectors (GimpChannel *channel, +void gimp_channel_select_path (GimpChannel *channel, const gchar *undo_desc, GimpPath *vectors, GimpChannelOps op, diff --git a/app/core/gimpdrawable-fill.c b/app/core/gimpdrawable-fill.c index 087e094337..cea0fa07ae 100644 --- a/app/core/gimpdrawable-fill.c +++ b/app/core/gimpdrawable-fill.c @@ -177,11 +177,11 @@ gimp_drawable_fill_boundary (GimpDrawable *drawable, } gboolean -gimp_drawable_fill_vectors (GimpDrawable *drawable, - GimpFillOptions *options, - GimpPath *vectors, - gboolean push_undo, - GError **error) +gimp_drawable_fill_path (GimpDrawable *drawable, + GimpFillOptions *options, + GimpPath *vectors, + gboolean push_undo, + GError **error) { const GimpBezierDesc *bezier; @@ -195,7 +195,7 @@ gimp_drawable_fill_vectors (GimpDrawable *drawable, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - bezier = gimp_vectors_get_bezier (vectors); + bezier = gimp_path_get_bezier (vectors); if (bezier && bezier->num_data > 4) { diff --git a/app/core/gimpdrawable-fill.h b/app/core/gimpdrawable-fill.h index fd75f477e9..bc345c4190 100644 --- a/app/core/gimpdrawable-fill.h +++ b/app/core/gimpdrawable-fill.h @@ -45,7 +45,7 @@ void gimp_drawable_fill_boundary (GimpDrawable *drawable, gint offset_y, gboolean push_undo); -gboolean gimp_drawable_fill_vectors (GimpDrawable *drawable, +gboolean gimp_drawable_fill_path (GimpDrawable *drawable, GimpFillOptions *options, GimpPath *vectors, gboolean push_undo, diff --git a/app/core/gimpdrawable-stroke.c b/app/core/gimpdrawable-stroke.c index 9da63405f9..cd0f788de9 100644 --- a/app/core/gimpdrawable-stroke.c +++ b/app/core/gimpdrawable-stroke.c @@ -74,11 +74,11 @@ gimp_drawable_stroke_boundary (GimpDrawable *drawable, } gboolean -gimp_drawable_stroke_vectors (GimpDrawable *drawable, - GimpStrokeOptions *options, - GimpPath *vectors, - gboolean push_undo, - GError **error) +gimp_drawable_stroke_path (GimpDrawable *drawable, + GimpStrokeOptions *options, + GimpPath *vectors, + gboolean push_undo, + GError **error) { const GimpBezierDesc *bezier; @@ -92,7 +92,7 @@ gimp_drawable_stroke_vectors (GimpDrawable *drawable, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - bezier = gimp_vectors_get_bezier (vectors); + bezier = gimp_path_get_bezier (vectors); if (bezier && bezier->num_data >= 2) { diff --git a/app/core/gimpdrawable-stroke.h b/app/core/gimpdrawable-stroke.h index 0c73d58ce2..6aa5401414 100644 --- a/app/core/gimpdrawable-stroke.h +++ b/app/core/gimpdrawable-stroke.h @@ -30,7 +30,7 @@ void gimp_drawable_stroke_boundary (GimpDrawable *drawable, gint offset_y, gboolean push_undo); -gboolean gimp_drawable_stroke_vectors (GimpDrawable *drawable, +gboolean gimp_drawable_stroke_path (GimpDrawable *drawable, GimpStrokeOptions *options, GimpPath *vectors, gboolean push_undo, diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index 95ef531003..69429a62c8 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -499,7 +499,7 @@ gimp_image_merge_visible_paths (GimpImage *image, gimp_set_busy (image->gimp); - gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE, + gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_PATHS_MERGE, C_("undo-type", "Merge Visible Paths")); path = GIMP_PATH (merge_list->data); @@ -517,7 +517,7 @@ gimp_image_merge_visible_paths (GimpImage *image, { path = list->data; - gimp_vectors_add_strokes (path, target_path); + gimp_path_add_strokes (path, target_path); gimp_image_remove_path (image, path, TRUE, NULL); } diff --git a/app/core/gimpimage-pick-item.c b/app/core/gimpimage-pick-item.c index 2b94676268..2de1d2106f 100644 --- a/app/core/gimpimage-pick-item.c +++ b/app/core/gimpimage-pick-item.c @@ -210,7 +210,7 @@ gimp_image_pick_path (GimpImage *image, GimpStroke *stroke = NULL; GimpCoords coords = GIMP_COORDS_DEFAULT_VALUES; - while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke))) + while ((stroke = gimp_path_stroke_get_next (vectors, stroke))) { gdouble dist; diff --git a/app/core/gimpimage-snap.c b/app/core/gimpimage-snap.c index 35499ea75f..545f401a08 100644 --- a/app/core/gimpimage-snap.c +++ b/app/core/gimpimage-snap.c @@ -730,7 +730,7 @@ gimp_image_snap_point (GimpImage *image, { GimpPath *vectors = iter->data; - while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke))) + while ((stroke = gimp_path_stroke_get_next (vectors, stroke))) { GimpCoords nearest; @@ -979,7 +979,7 @@ gimp_image_snap_rectangle (GimpImage *image, { GimpPath *vectors = iter->data; - while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke))) + while ((stroke = gimp_path_stroke_get_next (vectors, stroke))) { GimpCoords nearest; gdouble dist; diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c index ae02d9fa3a..426c2a4424 100644 --- a/app/core/gimpimage-undo-push.c +++ b/app/core/gimpimage-undo-push.c @@ -57,9 +57,9 @@ #include "text/gimptextundo.h" #include "vectors/gimppath.h" -#include "vectors/gimpvectorsmodundo.h" -#include "vectors/gimpvectorspropundo.h" -#include "vectors/gimpvectorsundo.h" +#include "vectors/gimppathmodundo.h" +#include "vectors/gimppathpropundo.h" +#include "vectors/gimppathundo.h" #include "gimp-intl.h" @@ -451,7 +451,7 @@ gimp_image_undo_push_item_displace (GimpImage *image, GIMP_UNDO_ITEM_DISPLACE, undo_desc, GIMP_IS_DRAWABLE (item) ? GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE : - GIMP_DIRTY_ITEM | GIMP_DIRTY_VECTORS, + GIMP_DIRTY_ITEM | GIMP_DIRTY_PATH, "item", item, NULL); } @@ -1023,11 +1023,11 @@ gimp_image_undo_push_path_add (GimpImage *image, for (iter = prev_paths; iter; iter = iter->next) g_return_val_if_fail (GIMP_IS_PATH (iter->data), NULL); - return gimp_image_undo_push (image, GIMP_TYPE_VECTORS_UNDO, - GIMP_UNDO_VECTORS_ADD, undo_desc, + return gimp_image_undo_push (image, GIMP_TYPE_PATH_UNDO, + GIMP_UNDO_PATH_ADD, undo_desc, GIMP_DIRTY_IMAGE_STRUCTURE, "item", path, - "prev-vectors", prev_paths, + "prev-paths", prev_paths, NULL); } @@ -1050,13 +1050,13 @@ gimp_image_undo_push_path_remove (GimpImage *image, for (iter = prev_paths; iter; iter = iter->next) g_return_val_if_fail (GIMP_IS_PATH (iter->data), NULL); - return gimp_image_undo_push (image, GIMP_TYPE_VECTORS_UNDO, - GIMP_UNDO_VECTORS_REMOVE, undo_desc, + return gimp_image_undo_push (image, GIMP_TYPE_PATH_UNDO, + GIMP_UNDO_PATH_REMOVE, undo_desc, GIMP_DIRTY_IMAGE_STRUCTURE, "item", path, "prev-parent", prev_parent, "prev-position", prev_position, - "prev-vectors", prev_paths, + "prev-paths", prev_paths, NULL); } @@ -1069,9 +1069,9 @@ gimp_image_undo_push_path_mod (GimpImage *image, g_return_val_if_fail (GIMP_IS_PATH (path), NULL); g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (path)), NULL); - return gimp_image_undo_push (image, GIMP_TYPE_VECTORS_MOD_UNDO, - GIMP_UNDO_VECTORS_MOD, undo_desc, - GIMP_DIRTY_ITEM | GIMP_DIRTY_VECTORS, + return gimp_image_undo_push (image, GIMP_TYPE_PATH_MOD_UNDO, + GIMP_UNDO_PATH_MOD, undo_desc, + GIMP_DIRTY_ITEM | GIMP_DIRTY_PATH, "item", path, NULL); } diff --git a/app/core/gimpimage-undo.c b/app/core/gimpimage-undo.c index 9af8d0f373..68692403ed 100644 --- a/app/core/gimpimage-undo.c +++ b/app/core/gimpimage-undo.c @@ -627,8 +627,8 @@ gimp_image_undo_dirty_from_type (GimpUndoType undo_type) case GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE: return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_DRAWABLE; - case GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE: - return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_VECTORS; + case GIMP_UNDO_GROUP_IMAGE_PATHS_MERGE: + return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_PATH; case GIMP_UNDO_GROUP_IMAGE_QUICK_MASK: /* FIXME */ return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_SELECTION; @@ -649,11 +649,11 @@ gimp_image_undo_dirty_from_type (GimpUndoType undo_type) return GIMP_DIRTY_ITEM_META; case GIMP_UNDO_GROUP_ITEM_DISPLACE: /* FIXME */ - return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE | GIMP_DIRTY_VECTORS; + return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE | GIMP_DIRTY_PATH; case GIMP_UNDO_GROUP_ITEM_SCALE: /* FIXME */ case GIMP_UNDO_GROUP_ITEM_RESIZE: /* FIXME */ - return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE | GIMP_DIRTY_VECTORS; + return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE | GIMP_DIRTY_PATH; case GIMP_UNDO_GROUP_LAYER_ADD_MASK: case GIMP_UNDO_GROUP_LAYER_APPLY_MASK: @@ -674,7 +674,7 @@ gimp_image_undo_dirty_from_type (GimpUndoType undo_type) return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE; case GIMP_UNDO_GROUP_TRANSFORM: /* FIXME */ - return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE | GIMP_DIRTY_VECTORS; + return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE | GIMP_DIRTY_PATH; case GIMP_UNDO_GROUP_PAINT: return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE; @@ -683,8 +683,8 @@ gimp_image_undo_dirty_from_type (GimpUndoType undo_type) case GIMP_UNDO_GROUP_PARASITE_REMOVE: return GIMP_DIRTY_IMAGE_META | GIMP_DIRTY_ITEM_META; - case GIMP_UNDO_GROUP_VECTORS_IMPORT: - return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_VECTORS; + case GIMP_UNDO_GROUP_PATHS_IMPORT: + return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_PATH; case GIMP_UNDO_GROUP_MISC: return GIMP_DIRTY_ALL; diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index be371daf0a..666e9ca69d 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -5890,11 +5890,11 @@ gimp_image_remove_channel (GimpImage *image, /* path */ gboolean -gimp_image_add_path (GimpImage *image, - GimpPath *path, - GimpPath *parent, - gint position, - gboolean push_undo) +gimp_image_add_path (GimpImage *image, + GimpPath *path, + GimpPath *parent, + gint position, + gboolean push_undo) { GimpImagePrivate *private; GList *list = NULL; @@ -5930,10 +5930,10 @@ gimp_image_add_path (GimpImage *image, } void -gimp_image_remove_path (GimpImage *image, - GimpPath *path, - gboolean push_undo, - GList *new_selected) +gimp_image_remove_path (GimpImage *image, + GimpPath *path, + gboolean push_undo, + GList *new_selected) { GimpImagePrivate *private; GList *selected_path; @@ -5956,7 +5956,7 @@ gimp_image_remove_path (GimpImage *image, if (push_undo) gimp_image_undo_push_path_remove (image, C_("undo-type", "Remove Path"), path, - gimp_vectors_get_parent (path), + gimp_path_get_parent (path), gimp_item_get_index (GIMP_ITEM (path)), selected_path); diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c index bed8f64e6d..915b0bd71e 100644 --- a/app/dialogs/dialogs-constructors.c +++ b/app/dialogs/dialogs-constructors.c @@ -64,7 +64,7 @@ #include "widgets/gimptoolpresetfactoryview.h" #include "widgets/gimptoolpreseteditor.h" #include "widgets/gimpundoeditor.h" -#include "widgets/gimpvectorstreeview.h" +#include "widgets/gimppathtreeview.h" #include "display/gimpcursorview.h" #include "display/gimpnavigationeditor.h" @@ -774,7 +774,7 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory, if (view_size < 1) view_size = context->gimp->config->layer_preview_size; - return gimp_item_tree_view_new (GIMP_TYPE_VECTORS_TREE_VIEW, + return gimp_item_tree_view_new (GIMP_TYPE_PATH_TREE_VIEW, view_size, 1, TRUE, gimp_context_get_image (context), menus_get_global_menu_factory (context->gimp), diff --git a/app/dialogs/meson.build b/app/dialogs/meson.build index c137d4f7c9..2555e12752 100644 --- a/app/dialogs/meson.build +++ b/app/dialogs/meson.build @@ -41,6 +41,9 @@ libappdialogs_sources = [ 'metadata-rotation-import-dialog.c', 'module-dialog.c', 'palette-import-dialog.c', + 'path-export-dialog.c', + 'path-import-dialog.c', + 'path-options-dialog.c', 'preferences-dialog-utils.c', 'preferences-dialog.c', 'print-size-dialog.c', @@ -53,9 +56,6 @@ libappdialogs_sources = [ 'tips-dialog.c', 'tips-parser.c', 'user-install-dialog.c', - 'vectors-export-dialog.c', - 'vectors-import-dialog.c', - 'vectors-options-dialog.c', 'welcome-dialog.c', gitversion_h, welcome_dialog_data_c, diff --git a/app/dialogs/vectors-export-dialog.c b/app/dialogs/path-export-dialog.c similarity index 68% rename from app/dialogs/vectors-export-dialog.c rename to app/dialogs/path-export-dialog.c index a757eaab88..115e9fcc00 100644 --- a/app/dialogs/vectors-export-dialog.c +++ b/app/dialogs/path-export-dialog.c @@ -28,46 +28,46 @@ #include "widgets/gimpwidgets-utils.h" -#include "vectors-export-dialog.h" +#include "path-export-dialog.h" #include "gimp-intl.h" -typedef struct _VectorsExportDialog VectorsExportDialog; +typedef struct _PathExportDialog PathExportDialog; -struct _VectorsExportDialog +struct _PathExportDialog { - GimpImage *image; - gboolean active_only; - GimpVectorsExportCallback callback; - gpointer user_data; + GimpImage *image; + gboolean active_only; + GimpPathExportCallback callback; + gpointer user_data; }; /* local function prototypes */ #ifdef G_OS_WIN32 -static void vectors_export_dialog_realize (GtkWidget *dialog, - VectorsExportDialog *data); +static void path_export_dialog_realize (GtkWidget *dialog, + PathExportDialog *data); #endif -static void vectors_export_dialog_free (VectorsExportDialog *private); -static void vectors_export_dialog_response (GtkWidget *widget, - gint response_id, - VectorsExportDialog *private); +static void path_export_dialog_free (PathExportDialog *private); +static void path_export_dialog_response (GtkWidget *widget, + gint response_id, + PathExportDialog *private); /* public function */ GtkWidget * -vectors_export_dialog_new (GimpImage *image, - GtkWidget *parent, - GFile *export_folder, - gboolean active_only, - GimpVectorsExportCallback callback, - gpointer user_data) +path_export_dialog_new (GimpImage *image, + GtkWidget *parent, + GFile *export_folder, + gboolean active_only, + GimpPathExportCallback callback, + gpointer user_data) { - VectorsExportDialog *private; - GtkWidget *dialog; - GtkWidget *combo; + PathExportDialog *private; + GtkWidget *dialog; + GtkWidget *combo; g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); @@ -75,7 +75,7 @@ vectors_export_dialog_new (GimpImage *image, NULL); g_return_val_if_fail (callback != NULL, NULL); - private = g_slice_new0 (VectorsExportDialog); + private = g_slice_new0 (PathExportDialog); private->image = image; private->active_only = active_only; @@ -92,9 +92,9 @@ vectors_export_dialog_new (GimpImage *image, gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog), - GTK_RESPONSE_OK, - GTK_RESPONSE_CANCEL, - -1); + GTK_RESPONSE_OK, + GTK_RESPONSE_CANCEL, + -1); gtk_window_set_role (GTK_WINDOW (dialog), "gimp-vectors-export"); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); @@ -109,7 +109,7 @@ vectors_export_dialog_new (GimpImage *image, export_folder, NULL); g_object_weak_ref (G_OBJECT (dialog), - (GWeakNotify) vectors_export_dialog_free, private); + (GWeakNotify) path_export_dialog_free, private); g_signal_connect_object (image, "disconnect", G_CALLBACK (gtk_widget_destroy), @@ -117,7 +117,7 @@ vectors_export_dialog_new (GimpImage *image, #ifdef G_OS_WIN32 g_signal_connect (dialog, "realize", - G_CALLBACK (vectors_export_dialog_realize), + G_CALLBACK (path_export_dialog_realize), private); #endif g_signal_connect (dialog, "delete-event", @@ -125,7 +125,7 @@ vectors_export_dialog_new (GimpImage *image, NULL); g_signal_connect (dialog, "response", - G_CALLBACK (vectors_export_dialog_response), + G_CALLBACK (path_export_dialog_response), private); combo = gimp_int_combo_box_new (_("Export the selected paths"), TRUE, @@ -147,23 +147,23 @@ vectors_export_dialog_new (GimpImage *image, #ifdef G_OS_WIN32 static void -vectors_export_dialog_realize (GtkWidget *dialog, - VectorsExportDialog *data) +path_export_dialog_realize (GtkWidget *dialog, + PathExportDialog *data) { gimp_window_set_title_bar_theme (data->image->gimp, dialog); } #endif static void -vectors_export_dialog_free (VectorsExportDialog *private) +path_export_dialog_free (PathExportDialog *private) { - g_slice_free (VectorsExportDialog, private); + g_slice_free (PathExportDialog, private); } static void -vectors_export_dialog_response (GtkWidget *dialog, - gint response_id, - VectorsExportDialog *private) +path_export_dialog_response (GtkWidget *dialog, + gint response_id, + PathExportDialog *private) { if (response_id == GTK_RESPONSE_OK) { diff --git a/app/dialogs/path-export-dialog.h b/app/dialogs/path-export-dialog.h new file mode 100644 index 0000000000..91a7b699e8 --- /dev/null +++ b/app/dialogs/path-export-dialog.h @@ -0,0 +1,38 @@ +/* GIMP - The GNU 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 3 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, see . + */ + +#ifndef __PATH_EXPORT_DIALOG_H__ +#define __PATH_EXPORT_DIALOG_H__ + + +typedef void (* GimpPathExportCallback) (GtkWidget *dialog, + GimpImage *image, + GFile *file, + GFile *export_folder, + gboolean active_only, + gpointer user_data); + + +GtkWidget * path_export_dialog_new (GimpImage *image, + GtkWidget *parent, + GFile *export_folder, + gboolean active_only, + GimpPathExportCallback callback, + gpointer user_data); + + +#endif /* __PATH_EXPORT_DIALOG_H__ */ diff --git a/app/dialogs/vectors-import-dialog.c b/app/dialogs/path-import-dialog.c similarity index 66% rename from app/dialogs/vectors-import-dialog.c rename to app/dialogs/path-import-dialog.c index 57ab7b3ce5..43ade5f0f1 100644 --- a/app/dialogs/vectors-import-dialog.c +++ b/app/dialogs/path-import-dialog.c @@ -28,50 +28,50 @@ #include "widgets/gimpwidgets-utils.h" -#include "vectors-import-dialog.h" +#include "path-import-dialog.h" #include "gimp-intl.h" -typedef struct _VectorsImportDialog VectorsImportDialog; +typedef struct _PathImportDialog PathImportDialog; -struct _VectorsImportDialog +struct _PathImportDialog { - GimpImage *image; - gboolean merge_vectors; - gboolean scale_vectors; - GimpVectorsImportCallback callback; - gpointer user_data; + GimpImage *image; + gboolean merge_path; + gboolean scale_path; + GimpPathImportCallback callback; + gpointer user_data; }; /* local function prototypes */ #ifdef G_OS_WIN32 -static void vectors_import_dialog_realize (GtkWidget *dialog, - VectorsImportDialog *data); +static void path_import_dialog_realize (GtkWidget *dialog, + PathImportDialog *data); #endif -static void vectors_import_dialog_free (VectorsImportDialog *private); -static void vectors_import_dialog_response (GtkWidget *dialog, - gint response_id, - VectorsImportDialog *private); +static void path_import_dialog_free (PathImportDialog *private); +static void path_import_dialog_response (GtkWidget *dialog, + gint response_id, + PathImportDialog *private); /* public function */ GtkWidget * -vectors_import_dialog_new (GimpImage *image, - GtkWidget *parent, - GFile *import_folder, - gboolean merge_vectors, - gboolean scale_vectors, - GimpVectorsImportCallback callback, - gpointer user_data) +path_import_dialog_new (GimpImage *image, + GtkWidget *parent, + GFile *import_folder, + gboolean merge_path, + gboolean scale_path, + GimpPathImportCallback callback, + gpointer user_data) { - VectorsImportDialog *private; - GtkWidget *dialog; - GtkWidget *vbox; - GtkWidget *button; - GtkFileFilter *filter; + PathImportDialog *private; + GtkWidget *dialog; + GtkWidget *vbox; + GtkWidget *button; + GtkFileFilter *filter; g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); @@ -79,13 +79,13 @@ vectors_import_dialog_new (GimpImage *image, NULL); g_return_val_if_fail (callback != NULL, NULL); - private = g_slice_new0 (VectorsImportDialog); + private = g_slice_new0 (PathImportDialog); - private->image = image; - private->merge_vectors = merge_vectors; - private->scale_vectors = scale_vectors; - private->callback = callback; - private->user_data = user_data; + private->image = image; + private->merge_path = merge_path; + private->scale_path = scale_path; + private->callback = callback; + private->user_data = user_data; dialog = gtk_file_chooser_dialog_new (_("Import Paths from SVG"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN, @@ -111,7 +111,7 @@ vectors_import_dialog_new (GimpImage *image, import_folder, NULL); g_object_weak_ref (G_OBJECT (dialog), - (GWeakNotify) vectors_import_dialog_free, private); + (GWeakNotify) path_import_dialog_free, private); g_signal_connect_object (image, "disconnect", G_CALLBACK (gtk_widget_destroy), @@ -119,7 +119,7 @@ vectors_import_dialog_new (GimpImage *image, #ifdef G_OS_WIN32 g_signal_connect (dialog, "realize", - G_CALLBACK (vectors_import_dialog_realize), + G_CALLBACK (path_import_dialog_realize), private); #endif g_signal_connect (dialog, "delete-event", @@ -127,7 +127,7 @@ vectors_import_dialog_new (GimpImage *image, NULL); g_signal_connect (dialog, "response", - G_CALLBACK (vectors_import_dialog_response), + G_CALLBACK (path_import_dialog_response), private); filter = gtk_file_filter_new (); @@ -149,24 +149,24 @@ vectors_import_dialog_new (GimpImage *image, button = gtk_check_button_new_with_mnemonic (_("_Merge imported paths")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), - private->merge_vectors); + private->merge_path); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "toggled", G_CALLBACK (gimp_toggle_button_update), - &private->merge_vectors); + &private->merge_path); button = gtk_check_button_new_with_mnemonic (_("_Scale imported paths " "to fit image")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), - private->scale_vectors); + private->scale_path); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "toggled", G_CALLBACK (gimp_toggle_button_update), - &private->scale_vectors); + &private->scale_path); return dialog; } @@ -176,23 +176,23 @@ vectors_import_dialog_new (GimpImage *image, #ifdef G_OS_WIN32 static void -vectors_import_dialog_realize (GtkWidget *dialog, - VectorsImportDialog *data) +path_import_dialog_realize (GtkWidget *dialog, + PathImportDialog *data) { gimp_window_set_title_bar_theme (data->image->gimp, dialog); } #endif static void -vectors_import_dialog_free (VectorsImportDialog *private) +path_import_dialog_free (PathImportDialog *private) { - g_slice_free (VectorsImportDialog, private); + g_slice_free (PathImportDialog, private); } static void -vectors_import_dialog_response (GtkWidget *dialog, - gint response_id, - VectorsImportDialog *private) +path_import_dialog_response (GtkWidget *dialog, + gint response_id, + PathImportDialog *private) { if (response_id == GTK_RESPONSE_OK) { @@ -211,8 +211,8 @@ vectors_import_dialog_response (GtkWidget *dialog, private->image, file, folder, - private->merge_vectors, - private->scale_vectors, + private->merge_path, + private->scale_path, private->user_data); if (folder) diff --git a/app/dialogs/path-import-dialog.h b/app/dialogs/path-import-dialog.h new file mode 100644 index 0000000000..73be031faa --- /dev/null +++ b/app/dialogs/path-import-dialog.h @@ -0,0 +1,40 @@ +/* GIMP - The GNU 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 3 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, see . + */ + +#ifndef __PATH_IMPORT_DIALOG_H__ +#define __PATH_IMPORT_DIALOG_H__ + + +typedef void (* GimpPathImportCallback) (GtkWidget *dialog, + GimpImage *image, + GFile *file, + GFile *import_folder, + gboolean merge_vectors, + gboolean scale_vectors, + gpointer user_data); + + +GtkWidget * path_import_dialog_new (GimpImage *image, + GtkWidget *parent, + GFile *import_folder, + gboolean merge_path, + gboolean scale_path, + GimpPathImportCallback callback, + gpointer user_data); + + +#endif /* __PATH_IMPORT_DIALOG_H__ */ diff --git a/app/dialogs/path-options-dialog.c b/app/dialogs/path-options-dialog.c new file mode 100644 index 0000000000..c7e5af04aa --- /dev/null +++ b/app/dialogs/path-options-dialog.c @@ -0,0 +1,161 @@ +/* GIMP - The GNU 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 3 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, see . + */ + +#include "config.h" + +#include +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "dialogs-types.h" + +#include "core/gimpcontext.h" +#include "core/gimpimage.h" + +#include "vectors/gimppath.h" + +#include "item-options-dialog.h" +#include "path-options-dialog.h" + +#include "gimp-intl.h" + + +typedef struct _PathOptionsDialog PathOptionsDialog; + +struct _PathOptionsDialog +{ + GimpPathOptionsCallback callback; + gpointer user_data; +}; + + +/* local function prototypes */ + +static void path_options_dialog_free (PathOptionsDialog *private); +static void path_options_dialog_callback (GtkWidget *dialog, + GimpImage *image, + GimpItem *item, + GimpContext *context, + const gchar *item_name, + gboolean item_visible, + GimpColorTag item_color_tag, + gboolean item_lock_content, + gboolean item_lock_position, + gboolean item_lock_visibility, + gpointer user_data); + + +/* public functions */ + +GtkWidget * +path_options_dialog_new (GimpImage *image, + GimpPath *path, + GimpContext *context, + GtkWidget *parent, + const gchar *title, + const gchar *role, + const gchar *icon_name, + const gchar *desc, + const gchar *help_id, + const gchar *path_name, + gboolean path_visible, + GimpColorTag path_color_tag, + gboolean path_lock_content, + gboolean path_lock_position, + gboolean path_lock_visibility, + GimpPathOptionsCallback callback, + gpointer user_data) +{ + PathOptionsDialog *private; + GtkWidget *dialog; + + g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); + g_return_val_if_fail (path == NULL || GIMP_IS_PATH (path), NULL); + g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); + g_return_val_if_fail (title != NULL, NULL); + g_return_val_if_fail (role != NULL, NULL); + g_return_val_if_fail (icon_name != NULL, NULL); + g_return_val_if_fail (desc != NULL, NULL); + g_return_val_if_fail (help_id != NULL, NULL); + g_return_val_if_fail (callback != NULL, NULL); + + private = g_slice_new0 (PathOptionsDialog); + + private->callback = callback; + private->user_data = user_data; + + dialog = item_options_dialog_new (image, GIMP_ITEM (path), context, + parent, title, role, + icon_name, desc, help_id, + _("Path _name:"), + GIMP_ICON_LOCK_CONTENT, + _("Lock path _strokes"), + _("Lock path _position"), + _("Lock path _visibility"), + path_name, + path_visible, + path_color_tag, + path_lock_content, + path_lock_position, + path_lock_visibility, + path_options_dialog_callback, + private); + + g_object_weak_ref (G_OBJECT (dialog), + (GWeakNotify) path_options_dialog_free, private); + + return dialog; +} + + +/* private functions */ + +static void +path_options_dialog_free (PathOptionsDialog *private) +{ + g_slice_free (PathOptionsDialog, private); +} + +static void +path_options_dialog_callback (GtkWidget *dialog, + GimpImage *image, + GimpItem *item, + GimpContext *context, + const gchar *item_name, + gboolean item_visible, + GimpColorTag item_color_tag, + gboolean item_lock_content, + gboolean item_lock_position, + gboolean item_lock_visibility, + gpointer user_data) +{ + PathOptionsDialog *private = user_data; + + private->callback (dialog, + image, + GIMP_PATH (item), + context, + item_name, + item_visible, + item_color_tag, + item_lock_content, + item_lock_position, + item_lock_visibility, + private->user_data); +} diff --git a/app/dialogs/vectors-options-dialog.h b/app/dialogs/path-options-dialog.h similarity index 56% rename from app/dialogs/vectors-options-dialog.h rename to app/dialogs/path-options-dialog.h index 137c628c5b..ba0916b7a8 100644 --- a/app/dialogs/vectors-options-dialog.h +++ b/app/dialogs/path-options-dialog.h @@ -15,40 +15,40 @@ * along with this program. If not, see . */ -#ifndef __VECTORS_OPTIONS_DIALOG_H__ -#define __VECTORS_OPTIONS_DIALOG_H__ +#ifndef __PATH_OPTIONS_DIALOG_H__ +#define __PATH_OPTIONS_DIALOG_H__ -typedef void (* GimpVectorsOptionsCallback) (GtkWidget *dialog, - GimpImage *image, - GimpPath *vectors, - GimpContext *context, - const gchar *vectors_name, - gboolean vectors_visible, - GimpColorTag vectors_color_tag, - gboolean vectors_lock_content, - gboolean vectors_lock_position, - gboolean vectors_lock_visibility, - gpointer user_data); +typedef void (* GimpPathOptionsCallback) (GtkWidget *dialog, + GimpImage *image, + GimpPath *path, + GimpContext *context, + const gchar *path_name, + gboolean path_visible, + GimpColorTag path_color_tag, + gboolean path_lock_content, + gboolean path_lock_position, + gboolean path_lock_visibility, + gpointer user_data); -GtkWidget * vectors_options_dialog_new (GimpImage *image, - GimpPath *vectors, - GimpContext *context, - GtkWidget *parent, - const gchar *title, - const gchar *role, - const gchar *icon_name, - const gchar *desc, - const gchar *help_id, - const gchar *vectors_name, - gboolean vectors_visible, - GimpColorTag vectors_color_tag, - gboolean vectors_lock_content, - gboolean vectors_lock_position, - gboolean vectors_lock_visibility, - GimpVectorsOptionsCallback callback, - gpointer user_data); +GtkWidget * path_options_dialog_new (GimpImage *image, + GimpPath *path, + GimpContext *context, + GtkWidget *parent, + const gchar *title, + const gchar *role, + const gchar *icon_name, + const gchar *desc, + const gchar *help_id, + const gchar *path_name, + gboolean path_visible, + GimpColorTag path_color_tag, + gboolean path_lock_content, + gboolean path_lock_position, + gboolean path_lock_visibility, + GimpPathOptionsCallback callback, + gpointer user_data); -#endif /* __VECTORS_OPTIONS_DIALOG_H__ */ +#endif /* __PATH_OPTIONS_DIALOG_H__ */ diff --git a/app/dialogs/vectors-export-dialog.h b/app/dialogs/vectors-export-dialog.h deleted file mode 100644 index 236b6e56aa..0000000000 --- a/app/dialogs/vectors-export-dialog.h +++ /dev/null @@ -1,38 +0,0 @@ -/* GIMP - The GNU 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 3 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, see . - */ - -#ifndef __VECTORS_EXPORT_DIALOG_H__ -#define __VECTORS_EXPORT_DIALOG_H__ - - -typedef void (* GimpVectorsExportCallback) (GtkWidget *dialog, - GimpImage *image, - GFile *file, - GFile *export_folder, - gboolean active_only, - gpointer user_data); - - -GtkWidget * vectors_export_dialog_new (GimpImage *image, - GtkWidget *parent, - GFile *export_folder, - gboolean active_only, - GimpVectorsExportCallback callback, - gpointer user_data); - - -#endif /* __VECTORS_EXPORT_DIALOG_H__ */ diff --git a/app/dialogs/vectors-import-dialog.h b/app/dialogs/vectors-import-dialog.h deleted file mode 100644 index b8928d4633..0000000000 --- a/app/dialogs/vectors-import-dialog.h +++ /dev/null @@ -1,40 +0,0 @@ -/* GIMP - The GNU 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 3 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, see . - */ - -#ifndef __VECTORS_IMPORT_DIALOG_H__ -#define __VECTORS_IMPORT_DIALOG_H__ - - -typedef void (* GimpVectorsImportCallback) (GtkWidget *dialog, - GimpImage *image, - GFile *file, - GFile *import_folder, - gboolean merge_vectors, - gboolean scale_vectors, - gpointer user_data); - - -GtkWidget * vectors_import_dialog_new (GimpImage *image, - GtkWidget *parent, - GFile *import_folder, - gboolean merge_vectors, - gboolean scale_vectors, - GimpVectorsImportCallback callback, - gpointer user_data); - - -#endif /* __VECTORS_IMPORT_DIALOG_H__ */ diff --git a/app/dialogs/vectors-options-dialog.c b/app/dialogs/vectors-options-dialog.c deleted file mode 100644 index 21a008ca90..0000000000 --- a/app/dialogs/vectors-options-dialog.c +++ /dev/null @@ -1,161 +0,0 @@ -/* GIMP - The GNU 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 3 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, see . - */ - -#include "config.h" - -#include -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "dialogs-types.h" - -#include "core/gimpcontext.h" -#include "core/gimpimage.h" - -#include "vectors/gimppath.h" - -#include "item-options-dialog.h" -#include "vectors-options-dialog.h" - -#include "gimp-intl.h" - - -typedef struct _VectorsOptionsDialog VectorsOptionsDialog; - -struct _VectorsOptionsDialog -{ - GimpVectorsOptionsCallback callback; - gpointer user_data; -}; - - -/* local function prototypes */ - -static void vectors_options_dialog_free (VectorsOptionsDialog *private); -static void vectors_options_dialog_callback (GtkWidget *dialog, - GimpImage *image, - GimpItem *item, - GimpContext *context, - const gchar *item_name, - gboolean item_visible, - GimpColorTag item_color_tag, - gboolean item_lock_content, - gboolean item_lock_position, - gboolean item_lock_visibility, - gpointer user_data); - - -/* public functions */ - -GtkWidget * -vectors_options_dialog_new (GimpImage *image, - GimpPath *vectors, - GimpContext *context, - GtkWidget *parent, - const gchar *title, - const gchar *role, - const gchar *icon_name, - const gchar *desc, - const gchar *help_id, - const gchar *vectors_name, - gboolean vectors_visible, - GimpColorTag vectors_color_tag, - gboolean vectors_lock_content, - gboolean vectors_lock_position, - gboolean vectors_lock_visibility, - GimpVectorsOptionsCallback callback, - gpointer user_data) -{ - VectorsOptionsDialog *private; - GtkWidget *dialog; - - g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); - g_return_val_if_fail (vectors == NULL || GIMP_IS_PATH (vectors), NULL); - g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); - g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); - g_return_val_if_fail (title != NULL, NULL); - g_return_val_if_fail (role != NULL, NULL); - g_return_val_if_fail (icon_name != NULL, NULL); - g_return_val_if_fail (desc != NULL, NULL); - g_return_val_if_fail (help_id != NULL, NULL); - g_return_val_if_fail (callback != NULL, NULL); - - private = g_slice_new0 (VectorsOptionsDialog); - - private->callback = callback; - private->user_data = user_data; - - dialog = item_options_dialog_new (image, GIMP_ITEM (vectors), context, - parent, title, role, - icon_name, desc, help_id, - _("Path _name:"), - GIMP_ICON_LOCK_CONTENT, - _("Lock path _strokes"), - _("Lock path _position"), - _("Lock path _visibility"), - vectors_name, - vectors_visible, - vectors_color_tag, - vectors_lock_content, - vectors_lock_position, - vectors_lock_visibility, - vectors_options_dialog_callback, - private); - - g_object_weak_ref (G_OBJECT (dialog), - (GWeakNotify) vectors_options_dialog_free, private); - - return dialog; -} - - -/* private functions */ - -static void -vectors_options_dialog_free (VectorsOptionsDialog *private) -{ - g_slice_free (VectorsOptionsDialog, private); -} - -static void -vectors_options_dialog_callback (GtkWidget *dialog, - GimpImage *image, - GimpItem *item, - GimpContext *context, - const gchar *item_name, - gboolean item_visible, - GimpColorTag item_color_tag, - gboolean item_lock_content, - gboolean item_lock_position, - gboolean item_lock_visibility, - gpointer user_data) -{ - VectorsOptionsDialog *private = user_data; - - private->callback (dialog, - image, - GIMP_PATH (item), - context, - item_name, - item_visible, - item_color_tag, - item_lock_content, - item_lock_position, - item_lock_visibility, - private->user_data); -} diff --git a/app/display/gimpcanvasitem-utils.c b/app/display/gimpcanvasitem-utils.c index 6b47b785a8..a231767ad3 100644 --- a/app/display/gimpcanvasitem-utils.c +++ b/app/display/gimpcanvasitem-utils.c @@ -129,7 +129,7 @@ gimp_canvas_item_on_vectors_handle (GimpCanvasItem *item, if (ret_anchor) *ret_anchor = NULL; if (ret_stroke) *ret_stroke = NULL; - while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke))) + while ((stroke = gimp_path_stroke_get_next (vectors, stroke))) { GList *anchor_list; GList *list; @@ -250,7 +250,7 @@ gimp_canvas_item_on_vectors_curve (GimpCanvasItem *item, min_dist = -1.0; - while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke))) + while ((stroke = gimp_path_stroke_get_next (vectors, stroke))) { cur_dist = gimp_stroke_nearest_point_get (stroke, coord, 1.0, &cur_coords, diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c index f5b9d45f3a..d4ac826a17 100644 --- a/app/display/gimpdisplayshell-dnd.c +++ b/app/display/gimpdisplayshell-dnd.c @@ -47,7 +47,7 @@ #include "text/gimptextlayer.h" #include "vectors/gimppath.h" -#include "vectors/gimpvectors-import.h" +#include "vectors/gimppath-import.h" #include "widgets/gimpdnd.h" @@ -319,11 +319,11 @@ gimp_display_shell_drop_svg (GtkWidget *widget, if (! image) return; - if (! gimp_vectors_import_buffer (image, - (const gchar *) svg_data, svg_data_len, - TRUE, FALSE, - GIMP_IMAGE_ACTIVE_PARENT, -1, - NULL, &error)) + if (! gimp_path_import_buffer (image, + (const gchar *) svg_data, svg_data_len, + TRUE, FALSE, + GIMP_IMAGE_ACTIVE_PARENT, -1, + NULL, &error)) { gimp_message_literal (shell->display->gimp, G_OBJECT (shell->display), GIMP_MESSAGE_ERROR, diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c index 266a500c9c..7af627e46b 100644 --- a/app/display/gimpdisplayshell-handlers.c +++ b/app/display/gimpdisplayshell-handlers.c @@ -1000,7 +1000,7 @@ gimp_display_shell_path_thaw_handler (GimpPath *path, item = gimp_canvas_proxy_group_get_item (group, path); - gimp_canvas_path_set (item, gimp_vectors_get_bezier (path)); + gimp_canvas_path_set (item, gimp_path_get_bezier (path)); } static void @@ -1025,7 +1025,7 @@ gimp_display_shell_path_add_handler (GimpContainer *container, GimpCanvasItem *item; item = gimp_canvas_path_new (shell, - gimp_vectors_get_bezier (path), + gimp_path_get_bezier (path), 0, 0, FALSE, GIMP_PATH_STYLE_VECTORS); diff --git a/app/display/gimptoolpath.c b/app/display/gimptoolpath.c index dacdcd0120..9ea8196e20 100644 --- a/app/display/gimptoolpath.c +++ b/app/display/gimptoolpath.c @@ -64,7 +64,7 @@ #define INSDEL_MASK gimp_get_toggle_behavior_mask () -/* possible vector functions */ +/* possible path functions */ typedef enum { VECTORS_SELECT_VECTOR, @@ -83,7 +83,7 @@ typedef enum VECTORS_DELETE_SEGMENT, VECTORS_CONVERT_EDGE, VECTORS_FINISHED -} GimpVectorFunction; +} GimpPathFunction; enum { @@ -103,11 +103,11 @@ enum struct _GimpToolPathPrivate { - GimpPath *vectors; /* the current Path data */ + GimpPath *vectors; /* the current Path data */ GimpVectorMode edit_mode; gboolean polygonal; - GimpVectorFunction function; /* function we're performing */ + GimpPathFunction function; /* function we're performing */ GimpAnchorFeatureType restriction; /* movement restriction */ gboolean modifier_lock; /* can we toggle the Shift key? */ GdkModifierType saved_state; /* modifier state at button_press */ @@ -183,7 +183,7 @@ static GimpUIManager * gimp_tool_path_get_popup (GimpToolWidget *widget, GdkModifierType state, const gchar **ui_path); -static GimpVectorFunction +static GimpPathFunction gimp_tool_path_get_function (GimpToolPath *path, const GimpCoords *coords, GdkModifierType state); @@ -398,18 +398,18 @@ gimp_tool_path_changed (GimpToolWidget *widget) private->items = NULL; } - if (vectors && gimp_vectors_get_bezier (vectors)) + if (vectors && gimp_path_get_bezier (vectors)) { GimpStroke *cur_stroke; gimp_canvas_path_set (private->path, - gimp_vectors_get_bezier (vectors)); + gimp_path_get_bezier (vectors)); gimp_canvas_item_set_visible (private->path, ! gimp_item_get_visible (GIMP_ITEM (vectors))); - for (cur_stroke = gimp_vectors_stroke_get_next (vectors, NULL); + for (cur_stroke = gimp_path_stroke_get_next (vectors, NULL); cur_stroke; - cur_stroke = gimp_vectors_stroke_get_next (vectors, cur_stroke)) + cur_stroke = gimp_path_stroke_get_next (vectors, cur_stroke)) { GimpCanvasItem *item; GArray *coords; @@ -614,7 +614,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget, GimpImage *image = gimp_display_get_image (shell->display); GimpPath *vectors; - vectors = gimp_vectors_new (image, _("Unnamed")); + vectors = gimp_path_new (image, _("Unnamed")); g_object_ref_sink (vectors); /* Undo step gets added implicitly */ @@ -629,7 +629,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget, } - gimp_vectors_freeze (private->vectors); + gimp_path_freeze (private->vectors); /* create a new stroke */ @@ -640,7 +640,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget, private->undo_motion = TRUE; private->cur_stroke = gimp_bezier_stroke_new (); - gimp_vectors_stroke_add (private->vectors, private->cur_stroke); + gimp_path_stroke_add (private->vectors, private->cur_stroke); g_object_unref (private->cur_stroke); private->sel_stroke = private->cur_stroke; @@ -719,10 +719,10 @@ gimp_tool_path_button_press (GimpToolWidget *widget, { if (! private->cur_anchor->selected) { - gimp_vectors_anchor_select (private->vectors, - private->cur_stroke, - private->cur_anchor, - TRUE, TRUE); + gimp_path_anchor_select (private->vectors, + private->cur_stroke, + private->cur_anchor, + TRUE, TRUE); private->undo_motion = TRUE; } @@ -748,10 +748,10 @@ gimp_tool_path_button_press (GimpToolWidget *widget, if (! private->cur_anchor->selected) { - gimp_vectors_anchor_select (private->vectors, - private->cur_stroke, - private->cur_anchor, - TRUE, TRUE); + gimp_path_anchor_select (private->vectors, + private->cur_stroke, + private->cur_anchor, + TRUE, TRUE); private->undo_motion = TRUE; } } @@ -766,11 +766,11 @@ gimp_tool_path_button_press (GimpToolWidget *widget, if (state & TOGGLE_MASK) { - gimp_vectors_anchor_select (private->vectors, - private->cur_stroke, - private->cur_anchor, - !private->cur_anchor->selected, - FALSE); + gimp_path_anchor_select (private->vectors, + private->cur_stroke, + private->cur_anchor, + !private->cur_anchor->selected, + FALSE); private->undo_motion = TRUE; if (private->cur_anchor->selected == FALSE) @@ -790,18 +790,18 @@ 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_vectors_anchor_select (private->vectors, - private->cur_stroke, - private->cur_anchor, TRUE, TRUE); + gimp_path_anchor_select (private->vectors, + private->cur_stroke, + private->cur_anchor, TRUE, TRUE); private->undo_motion = TRUE; } if (private->cur_position > 1.0 / 6.0) { - gimp_vectors_anchor_select (private->vectors, - private->cur_stroke, - private->cur_anchor2, TRUE, - (private->cur_position >= 5.0 / 6.0)); + gimp_path_anchor_select (private->vectors, + private->cur_stroke, + private->cur_anchor2, TRUE, + (private->cur_position >= 5.0 / 6.0)); private->undo_motion = TRUE; } @@ -824,16 +824,16 @@ gimp_tool_path_button_press (GimpToolWidget *widget, if (private->cur_stroke != private->sel_stroke && gimp_stroke_is_empty (private->cur_stroke)) { - gimp_vectors_stroke_remove (private->vectors, - private->cur_stroke); + gimp_path_stroke_remove (private->vectors, + private->cur_stroke); } private->sel_anchor = private->cur_anchor; private->cur_stroke = private->sel_stroke; - gimp_vectors_anchor_select (private->vectors, - private->sel_stroke, - private->sel_anchor, TRUE, TRUE); + gimp_path_anchor_select (private->vectors, + private->sel_stroke, + private->sel_anchor, TRUE, TRUE); private->function = VECTORS_FINISHED; } @@ -865,9 +865,9 @@ gimp_tool_path_button_press (GimpToolWidget *widget, if (private->cur_anchor->type == GIMP_ANCHOR_ANCHOR) { - gimp_vectors_anchor_select (private->vectors, - private->cur_stroke, - private->cur_anchor, TRUE, TRUE); + gimp_path_anchor_select (private->vectors, + private->cur_stroke, + private->cur_anchor, TRUE, TRUE); private->function = VECTORS_MOVE_ANCHOR; } @@ -894,8 +894,8 @@ gimp_tool_path_button_press (GimpToolWidget *widget, private->cur_anchor); if (gimp_stroke_is_empty (private->cur_stroke)) - gimp_vectors_stroke_remove (private->vectors, - private->cur_stroke); + gimp_path_stroke_remove (private->vectors, + private->cur_stroke); private->cur_stroke = NULL; private->cur_anchor = NULL; @@ -917,7 +917,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget, private->cur_anchor); if (new_stroke) { - gimp_vectors_stroke_add (private->vectors, new_stroke); + gimp_path_stroke_add (private->vectors, new_stroke); g_object_unref (new_stroke); } @@ -929,7 +929,7 @@ gimp_tool_path_button_press (GimpToolWidget *widget, private->last_x = coords->x; private->last_y = coords->y; - gimp_vectors_thaw (private->vectors); + gimp_path_thaw (private->vectors); return 1; } @@ -977,7 +977,7 @@ gimp_tool_path_motion (GimpToolWidget *widget, position.x = coords->x; position.y = coords->y; - gimp_vectors_freeze (private->vectors); + gimp_path_freeze (private->vectors); if ((private->saved_state & TOGGLE_MASK) != (state & TOGGLE_MASK)) private->modifier_lock = FALSE; @@ -1064,7 +1064,7 @@ gimp_tool_path_motion (GimpToolWidget *widget, break; } - gimp_vectors_thaw (private->vectors); + gimp_path_thaw (private->vectors); private->last_x = coords->x; private->last_y = coords->y; @@ -1163,7 +1163,7 @@ gimp_tool_path_key_press (GimpToolWidget *widget, ydist = FUNSCALEY (shell, pixels); gimp_tool_path_begin_change (path, _("Move Anchors")); - gimp_vectors_freeze (private->vectors); + gimp_path_freeze (private->vectors); switch (kevent->keyval) { @@ -1187,7 +1187,7 @@ gimp_tool_path_key_press (GimpToolWidget *widget, break; } - gimp_vectors_thaw (private->vectors); + gimp_path_thaw (private->vectors); gimp_tool_path_end_change (path, TRUE); break; @@ -1325,7 +1325,7 @@ gimp_tool_path_get_popup (GimpToolWidget *widget, } -static GimpVectorFunction +static GimpPathFunction gimp_tool_path_get_function (GimpToolPath *path, const GimpCoords *coords, GdkModifierType state) @@ -1338,7 +1338,7 @@ gimp_tool_path_get_function (GimpToolPath *path, gboolean on_handle = FALSE; gboolean on_curve = FALSE; gboolean on_vectors = FALSE; - GimpVectorFunction function = VECTORS_FINISHED; + GimpPathFunction function = VECTORS_FINISHED; private->modifier_lock = FALSE; @@ -1779,8 +1779,8 @@ gimp_tool_path_verify_state (GimpToolPath *path) return; } - while ((cur_stroke = gimp_vectors_stroke_get_next (private->vectors, - cur_stroke))) + while ((cur_stroke = gimp_path_stroke_get_next (private->vectors, + cur_stroke))) { GList *anchors; GList *list; @@ -1852,8 +1852,8 @@ gimp_tool_path_move_selected_anchors (GimpToolPath *path, offset.x = x; offset.y = y; - while ((cur_stroke = gimp_vectors_stroke_get_next (private->vectors, - cur_stroke))) + while ((cur_stroke = gimp_path_stroke_get_next (private->vectors, + cur_stroke))) { /* anchors */ anchors = gimp_stroke_get_draw_anchors (cur_stroke); @@ -1883,10 +1883,10 @@ gimp_tool_path_delete_selected_anchors (GimpToolPath *path) GList *list; gboolean have_undo = FALSE; - gimp_vectors_freeze (private->vectors); + gimp_path_freeze (private->vectors); - while ((cur_stroke = gimp_vectors_stroke_get_next (private->vectors, - cur_stroke))) + while ((cur_stroke = gimp_path_stroke_get_next (private->vectors, + cur_stroke))) { /* anchors */ anchors = gimp_stroke_get_draw_anchors (cur_stroke); @@ -1907,7 +1907,7 @@ gimp_tool_path_delete_selected_anchors (GimpToolPath *path) if (gimp_stroke_is_empty (cur_stroke)) { - gimp_vectors_stroke_remove (private->vectors, cur_stroke); + gimp_path_stroke_remove (private->vectors, cur_stroke); cur_stroke = NULL; } } @@ -1919,7 +1919,7 @@ gimp_tool_path_delete_selected_anchors (GimpToolPath *path) if (have_undo) gimp_tool_path_end_change (path, TRUE); - gimp_vectors_thaw (private->vectors); + gimp_path_thaw (private->vectors); } @@ -2008,14 +2008,14 @@ gimp_tool_path_delete_anchor (GimpToolPath *path) g_return_if_fail (private->cur_stroke != NULL); g_return_if_fail (private->cur_anchor != NULL); - gimp_vectors_freeze (private->vectors); + gimp_path_freeze (private->vectors); gimp_tool_path_begin_change (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_vectors_stroke_remove (private->vectors, - private->cur_stroke); + gimp_path_stroke_remove (private->vectors, + private->cur_stroke); } else { @@ -2025,7 +2025,7 @@ gimp_tool_path_delete_anchor (GimpToolPath *path) } gimp_tool_path_end_change (path, TRUE); - gimp_vectors_thaw (private->vectors); + gimp_path_thaw (private->vectors); } void @@ -2035,11 +2035,11 @@ gimp_tool_path_shift_start (GimpToolPath *path) g_return_if_fail (private->cur_stroke != NULL); g_return_if_fail (private->cur_anchor != NULL); - gimp_vectors_freeze (private->vectors); + gimp_path_freeze (private->vectors); gimp_tool_path_begin_change (path, _("Shift start")); gimp_stroke_shift_start (private->cur_stroke, private->cur_anchor); gimp_tool_path_end_change (path, TRUE); - gimp_vectors_thaw (private->vectors); + gimp_path_thaw (private->vectors); } void @@ -2050,13 +2050,13 @@ gimp_tool_path_insert_anchor (GimpToolPath *path) g_return_if_fail (private->cur_anchor != NULL); g_return_if_fail (private->cur_position >= 0.0); - gimp_vectors_freeze (private->vectors); + gimp_path_freeze (private->vectors); gimp_tool_path_begin_change (path, _("Insert Anchor")); private->cur_anchor = gimp_stroke_anchor_insert (private->cur_stroke, private->cur_anchor, private->cur_position); gimp_tool_path_end_change (path, TRUE); - gimp_vectors_thaw (private->vectors); + gimp_path_thaw (private->vectors); } void @@ -2067,18 +2067,18 @@ gimp_tool_path_delete_segment (GimpToolPath *path) g_return_if_fail (private->cur_stroke != NULL); g_return_if_fail (private->cur_anchor != NULL); - gimp_vectors_freeze (private->vectors); + gimp_path_freeze (private->vectors); gimp_tool_path_begin_change (path, _("Delete Segment")); new_stroke = gimp_stroke_open (private->cur_stroke, private->cur_anchor); if (new_stroke) { - gimp_vectors_stroke_add (private->vectors, new_stroke); + gimp_path_stroke_add (private->vectors, new_stroke); g_object_unref (new_stroke); } gimp_tool_path_end_change (path, TRUE); - gimp_vectors_thaw (private->vectors); + gimp_path_thaw (private->vectors); } void @@ -2087,9 +2087,9 @@ gimp_tool_path_reverse_stroke (GimpToolPath *path) GimpToolPathPrivate *private = path->private; g_return_if_fail (private->cur_stroke != NULL); - gimp_vectors_freeze (private->vectors); + gimp_path_freeze (private->vectors); gimp_tool_path_begin_change (path, _("Insert Anchor")); gimp_stroke_reverse (private->cur_stroke); gimp_tool_path_end_change (path, TRUE); - gimp_vectors_thaw (private->vectors); + gimp_path_thaw (private->vectors); } diff --git a/app/gimpcore.def b/app/gimpcore.def index cafbf8d019..23427a4180 100644 --- a/app/gimpcore.def +++ b/app/gimpcore.def @@ -95,9 +95,9 @@ EXPORTS gimp_channel_select_channel gimp_channel_select_component gimp_channel_select_ellipse + gimp_channel_select_path gimp_channel_select_polygon gimp_channel_select_rectangle - gimp_channel_select_vectors gimp_channel_set_color gimp_channel_sharpen gimp_channel_shrink @@ -487,6 +487,18 @@ EXPORTS gimp_parameters_append_valist gimp_parameters_free gimp_path_get_type + gimp_path_anchor_select + gimp_path_bounds + gimp_path_export_file + gimp_path_export_string + gimp_path_freeze + gimp_path_import_buffer + gimp_path_import_file + gimp_path_new + gimp_path_stroke_add + gimp_path_stroke_get_next + gimp_path_stroke_remove + gimp_path_thaw gimp_pattern_get_standard gimp_pattern_get_type gimp_pencil_options_get_type @@ -546,7 +558,7 @@ EXPORTS gimp_text_layer_new gimp_text_layer_set gimp_text_undo_get_type - gimp_text_vectors_new + gimp_text_path_new gimp_tool_info_get_standard gimp_tool_info_get_type gimp_tool_info_new @@ -570,18 +582,6 @@ EXPORTS gimp_undo_stack_peek gimp_undo_stack_pop_undo gimp_unset_busy - gimp_vectors_anchor_select - gimp_vectors_bounds - gimp_vectors_export_file - gimp_vectors_export_string - gimp_vectors_freeze - gimp_vectors_import_buffer - gimp_vectors_import_file - gimp_vectors_new - gimp_vectors_stroke_add - gimp_vectors_stroke_get_next - gimp_vectors_stroke_remove - gimp_vectors_thaw gimp_viewable_calc_preview_size gimp_viewable_get_description gimp_viewable_get_new_preview @@ -680,7 +680,7 @@ gimp_gradient_segment_split_midpoint gimp_image_resize_with_layers gimp_image_update_sample_point gimp_palette_set_columns -gimp_vectors_warp_vectors +gimp_path_warp_path gimp_buffer_new_from_pixbuf gimp_container_is_empty gimp_data_factory_data_refresh @@ -949,6 +949,7 @@ gimp_marshal_VOID__DOUBLE gimp_marshal_VOID__DOUBLE_DOUBLE_DOUBLE_DOUBLE gimp_operation_hue_saturation_map gimp_operation_levels_map_input +gimp_path_make_bezier gimp_perspective_clone_set_transform gimp_posterize_config_get_type gimp_recent_list_load @@ -958,4 +959,3 @@ gimp_threshold_config_get_type gimp_threshold_config_to_cruft gimp_tool_info_build_options_filename gimp_use_gegl -gimp_vectors_make_bezier diff --git a/app/paint/gimppaintcore-stroke.c b/app/paint/gimppaintcore-stroke.c index 2958785abf..bced7bb04c 100644 --- a/app/paint/gimppaintcore-stroke.c +++ b/app/paint/gimppaintcore-stroke.c @@ -230,13 +230,13 @@ gimp_paint_core_stroke_boundary (GimpPaintCore *core, } gboolean -gimp_paint_core_stroke_vectors (GimpPaintCore *core, - GimpDrawable *drawable, - GimpPaintOptions *paint_options, - gboolean emulate_dynamics, - GimpPath *path, - gboolean push_undo, - GError **error) +gimp_paint_core_stroke_path (GimpPaintCore *core, + GimpDrawable *drawable, + GimpPaintOptions *paint_options, + gboolean emulate_dynamics, + GimpPath *path, + gboolean push_undo, + GError **error) { GList *drawables; GList *stroke; diff --git a/app/paint/gimppaintcore-stroke.h b/app/paint/gimppaintcore-stroke.h index 0506f80791..09a3d09ffb 100644 --- a/app/paint/gimppaintcore-stroke.h +++ b/app/paint/gimppaintcore-stroke.h @@ -36,7 +36,7 @@ gboolean gimp_paint_core_stroke_boundary (GimpPaintCore *core, gint offset_y, gboolean push_undo, GError **error); -gboolean gimp_paint_core_stroke_vectors (GimpPaintCore *core, +gboolean gimp_paint_core_stroke_path (GimpPaintCore *core, GimpDrawable *drawable, GimpPaintOptions *paint_options, gboolean emulate_dynamics, diff --git a/app/pdb/gimppdb-utils.c b/app/pdb/gimppdb-utils.c index 98b6ab3a09..e57a86ce9a 100644 --- a/app/pdb/gimppdb-utils.c +++ b/app/pdb/gimppdb-utils.c @@ -805,7 +805,7 @@ gimp_pdb_get_path_stroke (GimpPath *path, if (! modify || gimp_pdb_item_is_modifiable (GIMP_ITEM (path), modify, error)) { - stroke = gimp_vectors_stroke_get_by_id (path, stroke_id); + stroke = gimp_path_stroke_get_by_id (path, stroke_id); if (! stroke) g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT, diff --git a/app/pdb/path-cmds.c b/app/pdb/path-cmds.c index 85a720f002..587b7d5a66 100644 --- a/app/pdb/path-cmds.c +++ b/app/pdb/path-cmds.c @@ -36,14 +36,14 @@ #include "core/gimplayer.h" #include "core/gimplist.h" #include "core/gimpparamspecs.h" -#include "text/gimptext-vectors.h" +#include "text/gimptext-path.h" #include "text/gimptextlayer.h" #include "vectors/gimpanchor.h" #include "vectors/gimpbezierstroke.h" +#include "vectors/gimppath-export.h" +#include "vectors/gimppath-import.h" #include "vectors/gimppath.h" #include "vectors/gimpstroke-new.h" -#include "vectors/gimpvectors-export.h" -#include "vectors/gimpvectors-import.h" #include "gimppdb.h" #include "gimppdb-utils.h" @@ -72,7 +72,7 @@ path_new_invoker (GimpProcedure *procedure, if (success) { - path = gimp_vectors_new (image, name); + path = gimp_path_new (image, name); } return_vals = gimp_procedure_get_return_values (procedure, success, @@ -107,7 +107,7 @@ path_new_from_text_layer_invoker (GimpProcedure *procedure, { gint x, y; - path = gimp_text_vectors_new (image, + path = gimp_text_path_new (image, gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer))); gimp_item_get_offset (GIMP_ITEM (layer), &x, &y); @@ -179,7 +179,7 @@ path_get_strokes_invoker (GimpProcedure *procedure, if (success) { - num_strokes = gimp_vectors_get_n_strokes (path); + num_strokes = gimp_path_get_n_strokes (path); if (num_strokes) { @@ -188,9 +188,9 @@ path_get_strokes_invoker (GimpProcedure *procedure, stroke_ids = g_new (gint32, num_strokes); - for (cur_stroke = gimp_vectors_stroke_get_next (path, NULL); + for (cur_stroke = gimp_path_stroke_get_next (path, NULL); cur_stroke; - cur_stroke = gimp_vectors_stroke_get_next (path, cur_stroke)) + cur_stroke = gimp_path_stroke_get_next (path, cur_stroke)) { stroke_ids[i] = gimp_stroke_get_id (cur_stroke); i++; @@ -330,7 +330,7 @@ path_remove_stroke_invoker (GimpProcedure *procedure, _("Remove path stroke"), path); - gimp_vectors_stroke_remove (path, stroke); + gimp_path_stroke_remove (path, stroke); } else success = FALSE; @@ -367,9 +367,9 @@ path_stroke_close_invoker (GimpProcedure *procedure, _("Close path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_close (stroke); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -406,9 +406,9 @@ path_stroke_reverse_invoker (GimpProcedure *procedure, _("Reverse path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_reverse (stroke); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -451,9 +451,9 @@ path_stroke_translate_invoker (GimpProcedure *procedure, _("Translate path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_translate (stroke, off_x, off_y); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -496,9 +496,9 @@ path_stroke_scale_invoker (GimpProcedure *procedure, _("Scale path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_scale (stroke, scale_x, scale_y); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -543,9 +543,9 @@ path_stroke_rotate_invoker (GimpProcedure *procedure, _("Rotate path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_rotate (stroke, center_x, center_y, angle); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -588,9 +588,9 @@ path_stroke_flip_invoker (GimpProcedure *procedure, _("Flip path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_flip (stroke, flip_type, axis); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -637,9 +637,9 @@ path_stroke_flip_free_invoker (GimpProcedure *procedure, _("Flip path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_flip_free (stroke, x1, y1, x2, y2); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -768,7 +768,7 @@ path_stroke_new_from_points_invoker (GimpProcedure *procedure, _("Add path stroke"), path); - gimp_vectors_stroke_add (path, stroke); + gimp_path_stroke_add (path, stroke); g_object_unref (stroke); stroke_id = gimp_stroke_get_id (stroke); @@ -892,7 +892,7 @@ path_bezier_stroke_new_moveto_invoker (GimpProcedure *procedure, _("Add path stroke"), path); - gimp_vectors_stroke_add (path, stroke); + gimp_path_stroke_add (path, stroke); g_object_unref (stroke); stroke_id = gimp_stroke_get_id (stroke); @@ -946,9 +946,9 @@ path_bezier_stroke_lineto_invoker (GimpProcedure *procedure, _("Extend path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_bezier_stroke_lineto (stroke, &coord0); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -1002,9 +1002,9 @@ path_bezier_stroke_conicto_invoker (GimpProcedure *procedure, _("Extend path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_bezier_stroke_conicto (stroke, &coord0, &coord1); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -1066,9 +1066,9 @@ path_bezier_stroke_cubicto_invoker (GimpProcedure *procedure, _("Extend path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_bezier_stroke_cubicto (stroke, &coord0, &coord1, &coord2); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -1122,7 +1122,7 @@ path_bezier_stroke_new_ellipse_invoker (GimpProcedure *procedure, _("Add path stroke"), path); - gimp_vectors_stroke_add (path, stroke); + gimp_path_stroke_add (path, stroke); g_object_unref (stroke); stroke_id = gimp_stroke_get_id (stroke); @@ -1167,9 +1167,9 @@ path_import_from_file_invoker (GimpProcedure *procedure, GList *path_list = NULL; /* FIXME tree */ - success = gimp_vectors_import_file (image, file, - merge, scale, NULL, -1, - &path_list, error); + success = gimp_path_import_file (image, file, + merge, scale, NULL, -1, + &path_list, error); if (success) { @@ -1235,9 +1235,9 @@ path_import_from_string_invoker (GimpProcedure *procedure, GList *path_list = NULL; /* FIXME tree */ - success = gimp_vectors_import_buffer (image, string, length, - merge, scale, NULL, -1, - &path_list, error); + success = gimp_path_import_buffer (image, string, length, + merge, scale, NULL, -1, + &path_list, error); if (success) { @@ -1298,7 +1298,7 @@ path_export_to_file_invoker (GimpProcedure *procedure, if (path != NULL) path_list = g_list_prepend (path_list, path); - success = gimp_vectors_export_file (image, path_list, file, error); + success = gimp_path_export_file (image, path_list, file, error); g_list_free (path_list); } @@ -1331,7 +1331,7 @@ path_export_to_string_invoker (GimpProcedure *procedure, if (path != NULL) path_list = g_list_prepend (path_list, path); - string = gimp_vectors_export_string (image, path_list); + string = gimp_path_export_string (image, path_list); g_list_free (path_list); success = (string != NULL); @@ -2382,7 +2382,7 @@ register_path_procs (GimpPDB *pdb) "gimp-path-import-from-string"); gimp_procedure_set_static_help (procedure, "Import paths from an SVG string.", - "This procedure works like 'gimp-vectors-import-from-file' but takes a string rather than reading the SVG from a file. This allows you to write scripts that generate SVG and feed it to GIMP.", + "This procedure works like 'gimp-path-import-from-file' but takes a string rather than reading the SVG from a file. This allows you to write scripts that generate SVG and feed it to GIMP.", NULL); gimp_procedure_set_static_attribution (procedure, "Simon Budig", diff --git a/app/tests/test-xcf.c b/app/tests/test-xcf.c index 133efe2cbc..178a925ef7 100644 --- a/app/tests/test-xcf.c +++ b/app/tests/test-xcf.c @@ -529,11 +529,11 @@ gimp_create_mainimage (Gimp *gimp, FALSE /*push_undo*/); /* Vectors 1 */ - vectors = gimp_vectors_new (image, - GIMP_MAINIMAGE_VECTORS1_NAME); + vectors = gimp_path_new (image, + GIMP_MAINIMAGE_VECTORS1_NAME); /* The XCF file can save vectors in two kind of ways, one old way * and a new way. Parameterize the way so we can test both variants, - * i.e. gimp_vectors_compat_is_compatible() must return both TRUE + * i.e. gimp_path_compat_is_compatible() must return both TRUE * and FALSE. */ if (! compat_paths) @@ -548,7 +548,7 @@ gimp_create_mainimage (Gimp *gimp, stroke = gimp_bezier_stroke_new_from_coords (vectors1_coords, G_N_ELEMENTS (vectors1_coords), TRUE /*closed*/); - gimp_vectors_stroke_add (vectors, stroke); + gimp_path_stroke_add (vectors, stroke); gimp_image_add_path (image, vectors, NULL /*parent*/, @@ -556,13 +556,13 @@ gimp_create_mainimage (Gimp *gimp, FALSE /*push_undo*/); /* Vectors 2 */ - vectors = gimp_vectors_new (image, - GIMP_MAINIMAGE_VECTORS2_NAME); + vectors = gimp_path_new (image, + GIMP_MAINIMAGE_VECTORS2_NAME); stroke = gimp_bezier_stroke_new_from_coords (vectors2_coords, G_N_ELEMENTS (vectors2_coords), TRUE /*closed*/); - gimp_vectors_stroke_add (vectors, stroke); + gimp_path_stroke_add (vectors, stroke); gimp_image_add_path (image, vectors, NULL /*parent*/, @@ -694,7 +694,7 @@ gimp_assert_vectors (GimpImage *image, gint i = 0; vectors = gimp_image_get_path_by_name (image, name); - stroke = gimp_vectors_stroke_get_next (vectors, NULL); + stroke = gimp_path_stroke_get_next (vectors, NULL); g_assert_true (stroke != NULL); control_points = gimp_stroke_control_points_get (stroke, &closed); diff --git a/app/text/gimptext-vectors.c b/app/text/gimptext-path.c similarity index 88% rename from app/text/gimptext-vectors.c rename to app/text/gimptext-path.c index 8fb22bf245..938419c553 100644 --- a/app/text/gimptext-vectors.c +++ b/app/text/gimptext-path.c @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * GimpText-vectors + * GimpText-path * Copyright (C) 2003 Sven Neumann * * This program is free software: you can redistribute it and/or modify @@ -34,34 +34,34 @@ #include "vectors/gimppath.h" #include "gimptext.h" -#include "gimptext-vectors.h" +#include "gimptext-path.h" #include "gimptextlayout.h" #include "gimptextlayout-render.h" typedef struct { - GimpPath *vectors; + GimpPath *path; GimpStroke *stroke; GimpAnchor *anchor; } RenderContext; -static void gimp_text_render_vectors (cairo_t *cr, - RenderContext *context); +static void gimp_text_render_path (cairo_t *cr, + RenderContext *context); GimpPath * -gimp_text_vectors_new (GimpImage *image, - GimpText *text) +gimp_text_path_new (GimpImage *image, + GimpText *text) { - GimpPath *vectors; + GimpPath *path; RenderContext context = { NULL, }; g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_TEXT (text), NULL); - vectors = gimp_vectors_new (image, NULL); + path = gimp_path_new (image, NULL); if (text->text || text->markup) { @@ -73,9 +73,9 @@ gimp_text_vectors_new (GimpImage *image, GError *error = NULL; if (text->text) - gimp_object_set_name_safe (GIMP_OBJECT (vectors), text->text); + gimp_object_set_name_safe (GIMP_OBJECT (path), text->text); - context.vectors = vectors; + context.path = path; surface = cairo_recording_surface_create (CAIRO_CONTENT_ALPHA, NULL); cr = cairo_create (surface); @@ -91,7 +91,7 @@ gimp_text_vectors_new (GimpImage *image, gimp_text_layout_render (layout, cr, text->base_dir, TRUE); g_object_unref (layout); - gimp_text_render_vectors (cr, &context); + gimp_text_render_path (cr, &context); cairo_destroy (cr); cairo_surface_destroy (surface); @@ -100,7 +100,7 @@ gimp_text_vectors_new (GimpImage *image, gimp_stroke_close (context.stroke); } - return vectors; + return path; } @@ -135,7 +135,7 @@ moveto (RenderContext *context, context->stroke = gimp_bezier_stroke_new_moveto (&start); - gimp_vectors_stroke_add (context->vectors, context->stroke); + gimp_path_stroke_add (context->path, context->stroke); g_object_unref (context->stroke); return 0; @@ -209,8 +209,8 @@ closepath (RenderContext *context) } static void -gimp_text_render_vectors (cairo_t *cr, - RenderContext *context) +gimp_text_render_path (cairo_t *cr, + RenderContext *context) { cairo_path_t *path; gint i; diff --git a/app/text/gimptext-vectors.h b/app/text/gimptext-path.h similarity index 77% rename from app/text/gimptext-vectors.h rename to app/text/gimptext-path.h index 3eeddb0a29..808edbc6f4 100644 --- a/app/text/gimptext-vectors.h +++ b/app/text/gimptext-path.h @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * GimpText-vectors + * GimpText-path * Copyright (C) 2003 Sven Neumann * * This program is free software: you can redistribute it and/or modify @@ -18,12 +18,12 @@ * along with this program. If not, see . */ -#ifndef __GIMP_TEXT_VECTORS_H__ -#define __GIMP_TEXT_VECTORS_H__ +#ifndef __GIMP_TEXT_PATH_H__ +#define __GIMP_TEXT_PATH_H__ -GimpPath * gimp_text_vectors_new (GimpImage *image, - GimpText *text); +GimpPath * gimp_text_path_new (GimpImage *image, + GimpText *text); -#endif /* __GIMP_TEXT_VECTORS_H__ */ +#endif /* __GIMP_TEXT_PATH_H__ */ diff --git a/app/text/meson.build b/app/text/meson.build index 98bd6c548c..8b1605657c 100644 --- a/app/text/meson.build +++ b/app/text/meson.build @@ -22,7 +22,7 @@ libapptext_sources = [ 'gimpfontfactory.c', 'gimptext-compat.c', 'gimptext-parasite.c', - 'gimptext-vectors.c', + 'gimptext-path.c', 'gimptext-xlfd.c', 'gimptext.c', 'gimptextlayer-transform.c', diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index 4afdc413af..012e6043ad 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -51,14 +51,14 @@ #include "menus/menus.h" #include "text/gimptext.h" -#include "text/gimptext-vectors.h" +#include "text/gimptext-path.h" #include "text/gimptextlayer.h" #include "text/gimptextlayout.h" #include "text/gimptextundo.h" #include "vectors/gimpstroke.h" #include "vectors/gimppath.h" -#include "vectors/gimpvectors-warp.h" +#include "vectors/gimppath-warp.h" #include "widgets/gimpdialogfactory.h" #include "widgets/gimpdockcontainer.h" @@ -2320,7 +2320,7 @@ gimp_text_tool_create_vectors (GimpTextTool *text_tool) if (! text_tool->text || ! text_tool->image) return; - path = gimp_text_vectors_new (text_tool->image, text_tool->text); + path = gimp_text_path_new (text_tool->image, text_tool->text); if (text_tool->layer) { @@ -2374,7 +2374,7 @@ gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool, return FALSE; } - vectors = gimp_text_vectors_new (text_tool->image, text_tool->text); + vectors = gimp_text_path_new (text_tool->image, text_tool->text); offset = 0; dir = gimp_text_tool_get_direction (text_tool); @@ -2391,7 +2391,7 @@ gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool, { GimpStroke *stroke = NULL; - while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke))) + while ((stroke = gimp_path_stroke_get_next (vectors, stroke))) { gimp_stroke_rotate (stroke, 0, 0, 270); gimp_stroke_translate (stroke, 0, box_width); @@ -2401,7 +2401,7 @@ gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool, break; } - gimp_vectors_warp_vectors (vectors0->data, vectors, offset); + gimp_path_warp_path (vectors0->data, vectors, offset); gimp_item_set_visible (GIMP_ITEM (vectors), TRUE, FALSE); diff --git a/app/tools/gimptransformgridtool.c b/app/tools/gimptransformgridtool.c index af34668675..06fbc8b366 100644 --- a/app/tools/gimptransformgridtool.c +++ b/app/tools/gimptransformgridtool.c @@ -50,8 +50,8 @@ #include "core/gimptoolinfo.h" #include "core/gimpviewable.h" -#include "vectors/gimpstroke.h" #include "vectors/gimppath.h" +#include "vectors/gimpstroke.h" #include "widgets/gimpwidgets-utils.h" @@ -835,7 +835,7 @@ gimp_transform_grid_tool_draw (GimpDrawTool *draw_tool) GimpPath *path = iter->data; GimpStroke *stroke = NULL; - while ((stroke = gimp_vectors_stroke_get_next (path, stroke))) + while ((stroke = gimp_path_stroke_get_next (path, stroke))) { GArray *coords; gboolean closed; diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index cf576d06aa..30fbe0fd43 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -749,7 +749,7 @@ gimp_transform_tool_check_selected_objects (GimpTransformTool *tr_tool, locked_message = _("The selected path's strokes are locked."); else if (gimp_item_is_position_locked (item, &locked_item)) locked_message = _("The selected path's position is locked."); - else if (! gimp_vectors_get_n_strokes (GIMP_PATH (item))) + else if (! gimp_path_get_n_strokes (GIMP_PATH (item))) locked_message = _("The selected path has no strokes."); } break; diff --git a/app/vectors/gimpvectors-compat.c b/app/vectors/gimppath-compat.c similarity index 74% rename from app/vectors/gimpvectors-compat.c rename to app/vectors/gimppath-compat.c index f78b9ec245..fda4b14df4 100644 --- a/app/vectors/gimpvectors-compat.c +++ b/app/vectors/gimppath-compat.c @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * gimpvectors-compat.c + * gimppath-compat.c * Copyright (C) 2003 Michael Natterer * * This program is free software: you can redistribute it and/or modify @@ -30,14 +30,14 @@ #include "gimpanchor.h" #include "gimpbezierstroke.h" #include "gimppath.h" -#include "gimpvectors-compat.h" +#include "gimppath-compat.h" enum { - GIMP_VECTORS_COMPAT_ANCHOR = 1, - GIMP_VECTORS_COMPAT_CONTROL = 2, - GIMP_VECTORS_COMPAT_NEW_STROKE = 3 + GIMP_PATH_COMPAT_ANCHOR = 1, + GIMP_PATH_COMPAT_CONTROL = 2, + GIMP_PATH_COMPAT_NEW_STROKE = 3 }; @@ -45,13 +45,13 @@ static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES; GimpPath * -gimp_vectors_compat_new (GimpImage *image, - const gchar *name, - GimpVectorsCompatPoint *points, - gint n_points, - gboolean closed) +gimp_path_compat_new (GimpImage *image, + const gchar *name, + GimpPathCompatPoint *points, + gint n_points, + gboolean closed) { - GimpPath *vectors; + GimpPath *path; GimpStroke *stroke; GimpCoords *coords; GimpCoords *curr_stroke; @@ -63,7 +63,7 @@ gimp_vectors_compat_new (GimpImage *image, g_return_val_if_fail (points != NULL || n_points == 0, NULL); g_return_val_if_fail (n_points >= 0, NULL); - vectors = gimp_vectors_new (image, name); + path = gimp_path_new (image, name); coords = g_new0 (GimpCoords, n_points + 1); @@ -84,7 +84,7 @@ gimp_vectors_compat_new (GimpImage *image, *curr_stroke = *curr_coord; /* found new stroke start */ - if (points[i].type == GIMP_VECTORS_COMPAT_NEW_STROKE) + if (points[i].type == GIMP_PATH_COMPAT_NEW_STROKE) { /* copy the last control point to the beginning of the stroke */ *curr_stroke = *(curr_coord - 1); @@ -93,7 +93,7 @@ gimp_vectors_compat_new (GimpImage *image, gimp_bezier_stroke_new_from_coords (curr_stroke, curr_coord - curr_stroke - 1, TRUE); - gimp_vectors_stroke_add (vectors, stroke); + gimp_path_stroke_add (path, stroke); g_object_unref (stroke); /* start a new stroke */ @@ -116,16 +116,16 @@ gimp_vectors_compat_new (GimpImage *image, stroke = gimp_bezier_stroke_new_from_coords (curr_stroke, curr_coord - curr_stroke, closed); - gimp_vectors_stroke_add (vectors, stroke); + gimp_path_stroke_add (path, stroke); g_object_unref (stroke); g_free (coords); - return vectors; + return path; } gboolean -gimp_vectors_compat_is_compatible (GimpImage *image) +gimp_path_compat_is_compatible (GimpImage *image) { GList *list; @@ -135,14 +135,14 @@ gimp_vectors_compat_is_compatible (GimpImage *image) list; list = g_list_next (list)) { - GimpPath *vectors = GIMP_PATH (list->data); - GList *strokes; - gint open_count = 0; + GimpPath *path = GIMP_PATH (list->data); + GList *strokes; + gint open_count = 0; - if (gimp_item_get_visible (GIMP_ITEM (vectors))) + if (gimp_item_get_visible (GIMP_ITEM (path))) return FALSE; - for (strokes = vectors->strokes->head; + for (strokes = path->strokes->head; strokes; strokes = g_list_next (strokes)) { @@ -162,19 +162,19 @@ gimp_vectors_compat_is_compatible (GimpImage *image) return TRUE; } -GimpVectorsCompatPoint * -gimp_vectors_compat_get_points (GimpPath *vectors, - gint32 *n_points, - gint32 *closed) +GimpPathCompatPoint * +gimp_path_compat_get_points (GimpPath *path, + gint32 *n_points, + gint32 *closed) { - GimpVectorsCompatPoint *points; - GList *strokes; - gint i; - GList *postponed = NULL; /* for the one open stroke... */ - gint open_count; - gboolean first_stroke = TRUE; + GimpPathCompatPoint *points; + GList *strokes; + gint i; + GList *postponed = NULL; /* for the one open stroke... */ + gint open_count; + gboolean first_stroke = TRUE; - g_return_val_if_fail (GIMP_IS_PATH (vectors), NULL); + g_return_val_if_fail (GIMP_IS_PATH (path), NULL); g_return_val_if_fail (n_points != NULL, NULL); g_return_val_if_fail (closed != NULL, NULL); @@ -183,7 +183,7 @@ gimp_vectors_compat_get_points (GimpPath *vectors, open_count = 0; - for (strokes = vectors->strokes->head; + for (strokes = path->strokes->head; strokes; strokes = g_list_next (strokes)) { @@ -198,7 +198,7 @@ gimp_vectors_compat_get_points (GimpPath *vectors, if (open_count >= 2) { - g_warning ("gimp_vectors_compat_get_points(): convert failed"); + g_warning ("gimp_path_compat_get_points(): convert failed"); *n_points = 0; return NULL; } @@ -212,11 +212,11 @@ gimp_vectors_compat_get_points (GimpPath *vectors, *n_points += n_anchors; } - points = g_new0 (GimpVectorsCompatPoint, *n_points); + points = g_new0 (GimpPathCompatPoint, *n_points); i = 0; - for (strokes = vectors->strokes->head; + for (strokes = path->strokes->head; strokes || postponed; strokes = g_list_next (strokes)) { @@ -251,13 +251,13 @@ gimp_vectors_compat_get_points (GimpPath *vectors, { case GIMP_ANCHOR_ANCHOR: if (anchors->prev == stroke->anchors->head && ! first_stroke) - points[i].type = GIMP_VECTORS_COMPAT_NEW_STROKE; + points[i].type = GIMP_PATH_COMPAT_NEW_STROKE; else - points[i].type = GIMP_VECTORS_COMPAT_ANCHOR; + points[i].type = GIMP_PATH_COMPAT_ANCHOR; break; case GIMP_ANCHOR_CONTROL: - points[i].type = GIMP_VECTORS_COMPAT_CONTROL; + points[i].type = GIMP_PATH_COMPAT_CONTROL; break; } @@ -271,7 +271,7 @@ gimp_vectors_compat_get_points (GimpPath *vectors, { anchor = g_queue_peek_head (stroke->anchors); - points[i].type = GIMP_VECTORS_COMPAT_CONTROL; + points[i].type = GIMP_PATH_COMPAT_CONTROL; points[i].x = anchor->position.x; points[i].y = anchor->position.y; diff --git a/app/vectors/gimppath-compat.h b/app/vectors/gimppath-compat.h new file mode 100644 index 0000000000..6a0b26810a --- /dev/null +++ b/app/vectors/gimppath-compat.h @@ -0,0 +1,48 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimppath-compat.h + * Copyright (C) 2003 Michael Natterer + * + * 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 3 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, see . + */ + +#ifndef __GIMP_PATH_COMPAT_H__ +#define __GIMP_PATH_COMPAT_H__ + + +typedef struct _GimpPathCompatPoint GimpPathCompatPoint; + +struct _GimpPathCompatPoint +{ + guint32 type; + gdouble x; + gdouble y; +}; + + +GimpPath * gimp_path_compat_new (GimpImage *image, + const gchar *name, + GimpPathCompatPoint *points, + gint n_points, + gboolean closed); + +gboolean gimp_path_compat_is_compatible (GimpImage *image); + +GimpPathCompatPoint * gimp_path_compat_get_points (GimpPath *path, + gint32 *n_points, + gint32 *closed); + + +#endif /* __GIMP_PATH_COMPAT_H__ */ diff --git a/app/vectors/gimpvectors-export.c b/app/vectors/gimppath-export.c similarity index 83% rename from app/vectors/gimpvectors-export.c rename to app/vectors/gimppath-export.c index 4b7d470f5f..17a96ba576 100644 --- a/app/vectors/gimpvectors-export.c +++ b/app/vectors/gimppath-export.c @@ -30,29 +30,29 @@ #include "gimpanchor.h" #include "gimpbezierstroke.h" #include "gimppath.h" +#include "gimppath-export.h" #include "gimpstroke.h" -#include "gimpvectors-export.h" #include "gimp-intl.h" -static GString * gimp_vectors_export (GimpImage *image, - GList *vectors); -static void gimp_vectors_export_image_size (GimpImage *image, - GString *str); -static void gimp_vectors_export_path (GimpPath *vectors, - GString *str); -static gchar * gimp_vectors_export_path_data (GimpPath *vectors); +static GString * gimp_path_export (GimpImage *image, + GList *paths); +static void gimp_path_export_image_size (GimpImage *image, + GString *str); +static void gimp_path_export_path (GimpPath *paths, + GString *str); +static gchar * gimp_path_export_path_data (GimpPath *paths); /** - * gimp_vectors_export_file: + * gimp_path_export_file: * @image: the #GimpImage from which to export * @path_list: a #GList of #GimpPath objects or %NULL to export all paths in @image * @file: the file to write * @error: return location for errors * - * Exports one or more vectors aka path to an SVG file aka XML doc. + * Exports one or more paths to an SVG file aka XML doc. * * When @path_list is %NULL aka empty list, exports all paths in image. * @@ -65,10 +65,10 @@ static gchar * gimp_vectors_export_path_data (GimpPath *vectors); * %FALSE when there was an error writing the file **/ gboolean -gimp_vectors_export_file (GimpImage *image, - GList *path_list, - GFile *file, - GError **error) +gimp_path_export_file (GimpImage *image, + GList *path_list, + GFile *file, + GError **error) { GOutputStream *output; GString *string; @@ -84,7 +84,7 @@ gimp_vectors_export_file (GimpImage *image, if (! output) return FALSE; - string = gimp_vectors_export (image, path_list); + string = gimp_path_export (image, path_list); if (! g_output_stream_write_all (output, string->str, string->len, NULL, NULL, &my_error)) @@ -113,11 +113,11 @@ gimp_vectors_export_file (GimpImage *image, } /** - * gimp_vectors_export_string: + * gimp_path_export_string: * @image: the #GimpImage from which to export * @path_list: a #GList of #GimpPath objects, or %NULL to export all paths in @image * - * Exports one or more vectors aka path to a SVG string. + * Exports one or more paths to a SVG string. * * When @path_list is %NULL aka empty list, exports all paths in image. * @@ -127,17 +127,17 @@ gimp_vectors_export_file (GimpImage *image, * Returns: a NULL-terminated string that holds a complete XML document **/ gchar * -gimp_vectors_export_string (GimpImage *image, - GList *path_list) +gimp_path_export_string (GimpImage *image, + GList *path_list) { g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); - return g_string_free (gimp_vectors_export (image, path_list), FALSE); + return g_string_free (gimp_path_export (image, path_list), FALSE); } static GString * -gimp_vectors_export (GimpImage *image, - GList *vectors) +gimp_path_export (GimpImage *image, + GList *path) { GString *str = g_string_new (NULL); GList *list; @@ -150,7 +150,7 @@ gimp_vectors_export (GimpImage *image, "next) - gimp_vectors_export_path (GIMP_PATH (list->data), str); + for (list = path; list; list = list->next) + gimp_path_export_path (GIMP_PATH (list->data), str); g_string_append (str, "\n"); @@ -170,8 +170,8 @@ gimp_vectors_export (GimpImage *image, } static void -gimp_vectors_export_image_size (GimpImage *image, - GString *str) +gimp_path_export_image_size (GimpImage *image, + GString *str) { GimpUnit unit; const gchar *abbrev; @@ -210,11 +210,11 @@ gimp_vectors_export_image_size (GimpImage *image, } static void -gimp_vectors_export_path (GimpPath *vectors, - GString *str) +gimp_path_export_path (GimpPath *path, + GString *str) { - const gchar *name = gimp_object_get_name (vectors); - gchar *data = gimp_vectors_export_path_data (vectors); + const gchar *name = gimp_object_get_name (path); + gchar *data = gimp_path_export_path_data (path); gchar *esc_name; esc_name = g_markup_escape_text (name, strlen (name)); @@ -233,7 +233,7 @@ gimp_vectors_export_path (GimpPath *vectors, #define NEWLINE "\n " static gchar * -gimp_vectors_export_path_data (GimpPath *vectors) +gimp_path_export_path_data (GimpPath *path) { GString *str; GList *strokes; @@ -243,7 +243,7 @@ gimp_vectors_export_path_data (GimpPath *vectors) str = g_string_new (NULL); - for (strokes = vectors->strokes->head; + for (strokes = path->strokes->head; strokes; strokes = strokes->next) { diff --git a/app/vectors/gimpvectors-export.h b/app/vectors/gimppath-export.h similarity index 61% rename from app/vectors/gimpvectors-export.h rename to app/vectors/gimppath-export.h index 8def7acf83..96416e7e02 100644 --- a/app/vectors/gimpvectors-export.h +++ b/app/vectors/gimppath-export.h @@ -15,16 +15,16 @@ * along with this program. If not, see . */ -#ifndef __GIMP_VECTORS_EXPORT_H__ -#define __GIMP_VECTORS_EXPORT_H__ +#ifndef __GIMP_PATH_EXPORT_H__ +#define __GIMP_PATH_EXPORT_H__ -gboolean gimp_vectors_export_file (GimpImage *image, - GList *vectors, - GFile *file, - GError **error); -gchar * gimp_vectors_export_string (GimpImage *image, - GList *vectors); +gboolean gimp_path_export_file (GimpImage *image, + GList *path_list, + GFile *file, + GError **error); +gchar * gimp_path_export_string (GimpImage *image, + GList *path_list); -#endif /* __GIMP_VECTORS_IMPORT_H__ */ +#endif /* __GIMP_PATH_IMPORT_H__ */ diff --git a/app/vectors/gimpvectors-import.c b/app/vectors/gimppath-import.c similarity index 92% rename from app/vectors/gimpvectors-import.c rename to app/vectors/gimppath-import.c index 09ac4f3995..2331c57133 100644 --- a/app/vectors/gimpvectors-import.c +++ b/app/vectors/gimppath-import.c @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * GimpVectors Import + * GimpPath Import * Copyright (C) 2003-2004 Sven Neumann * * Some code here is based on code from librsvg that was originally @@ -50,7 +50,7 @@ #include "gimpbezierstroke.h" #include "gimpstroke.h" #include "gimppath.h" -#include "gimpvectors-import.h" +#include "gimppath-import.h" #include "gimp-intl.h" @@ -105,16 +105,16 @@ typedef struct } SvgPath; -static gboolean gimp_vectors_import (GimpImage *image, - GFile *file, - const gchar *str, - gsize len, - gboolean merge, - gboolean scale, - GimpPath *parent, - gint position, - GList **ret_vectors, - GError **error); +static gboolean gimp_path_import (GimpImage *image, + GFile *file, + const gchar *str, + gsize len, + gboolean merge, + gboolean scale, + GimpPath *parent, + gint position, + GList **ret_paths, + GError **error); static void svg_parser_start_element (GMarkupParseContext *context, const gchar *element_name, @@ -196,12 +196,12 @@ static GList * parse_path_data (const gchar *data); /** - * gimp_vectors_import_file: + * gimp_path_import_file: * @image: the #GimpImage to add the paths to * @file: a SVG file * @merge: should multiple paths be merged into a single #GimpPath object * @scale: should the SVG be scaled to fit the image dimensions - * @position: position in the image's vectors stack where to add the vectors + * @position: position in the image's path stack where to add the paths * @error: location to store possible errors * * Imports one or more paths and basic shapes from a SVG file. @@ -209,14 +209,14 @@ static GList * parse_path_data (const gchar *data); * Returns: %TRUE on success, %FALSE if an error occurred **/ gboolean -gimp_vectors_import_file (GimpImage *image, - GFile *file, - gboolean merge, - gboolean scale, - GimpPath *parent, - gint position, - GList **ret_vectors, - GError **error) +gimp_path_import_file (GimpImage *image, + GFile *file, + gboolean merge, + gboolean scale, + GimpPath *parent, + gint position, + GList **ret_paths, + GError **error) { g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE); g_return_val_if_fail (G_IS_FILE (file), FALSE); @@ -234,16 +234,16 @@ gimp_vectors_import_file (GimpImage *image, parent == GIMP_IMAGE_ACTIVE_PARENT || gimp_viewable_get_children (GIMP_VIEWABLE (parent)), FALSE); - g_return_val_if_fail (ret_vectors == NULL || *ret_vectors == NULL, FALSE); + g_return_val_if_fail (ret_paths == NULL || *ret_paths == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - return gimp_vectors_import (image, file, NULL, 0, merge, scale, - parent, position, - ret_vectors, error); + return gimp_path_import (image, file, NULL, 0, merge, scale, + parent, position, + ret_paths, error); } /** - * gimp_vectors_import_string: + * gimp_path_import_string: * @image: the #GimpImage to add the paths to * @buffer: a character buffer to parse * @len: number of bytes in @str or -1 if @str is %NUL-terminated @@ -256,15 +256,15 @@ gimp_vectors_import_file (GimpImage *image, * Returns: %TRUE on success, %FALSE if an error occurred **/ gboolean -gimp_vectors_import_buffer (GimpImage *image, - const gchar *buffer, - gsize len, - gboolean merge, - gboolean scale, - GimpPath *parent, - gint position, - GList **ret_vectors, - GError **error) +gimp_path_import_buffer (GimpImage *image, + const gchar *buffer, + gsize len, + gboolean merge, + gboolean scale, + GimpPath *parent, + gint position, + GList **ret_paths, + GError **error) { g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE); g_return_val_if_fail (buffer != NULL || len == 0, FALSE); @@ -282,25 +282,25 @@ gimp_vectors_import_buffer (GimpImage *image, parent == GIMP_IMAGE_ACTIVE_PARENT || gimp_viewable_get_children (GIMP_VIEWABLE (parent)), FALSE); - g_return_val_if_fail (ret_vectors == NULL || *ret_vectors == NULL, FALSE); + g_return_val_if_fail (ret_paths == NULL || *ret_paths == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - return gimp_vectors_import (image, NULL, buffer, len, merge, scale, - parent, position, - ret_vectors, error); + return gimp_path_import (image, NULL, buffer, len, merge, scale, + parent, position, + ret_paths, error); } static gboolean -gimp_vectors_import (GimpImage *image, - GFile *file, - const gchar *str, - gsize len, - gboolean merge, - gboolean scale, - GimpPath *parent, - gint position, - GList **ret_vectors, - GError **error) +gimp_path_import (GimpImage *image, + GFile *file, + const gchar *str, + gsize len, + gboolean merge, + gboolean scale, + GimpPath *parent, + gint position, + GList **ret_paths, + GError **error) { GimpXmlParser *xml_parser; SvgParser parser; @@ -334,48 +334,48 @@ gimp_vectors_import (GimpImage *image, { if (base->paths) { - GimpPath *vectors = NULL; + GimpPath *path = NULL; base->paths = g_list_reverse (base->paths); merge = merge && base->paths->next; - gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_VECTORS_IMPORT, + gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_PATHS_IMPORT, _("Import Paths")); for (paths = base->paths; paths; paths = paths->next) { - SvgPath *path = paths->data; + SvgPath *svg_path = paths->data; GList *list; - if (! merge || ! vectors) + if (! merge || ! path) { - vectors = gimp_vectors_new (image, - ((merge || ! path->id) ? - _("Imported Path") : path->id)); - gimp_image_add_path (image, vectors, + path = gimp_path_new (image, + ((merge || ! svg_path->id) ? + _("Imported Path") : svg_path->id)); + gimp_image_add_path (image, path, parent, position, TRUE); - gimp_vectors_freeze (vectors); + gimp_path_freeze (path); - if (ret_vectors) - *ret_vectors = g_list_prepend (*ret_vectors, vectors); + if (ret_paths) + *ret_paths = g_list_prepend (*ret_paths, path); if (position != -1) position++; } - for (list = path->strokes; list; list = list->next) - gimp_vectors_stroke_add (vectors, GIMP_STROKE (list->data)); + for (list = svg_path->strokes; list; list = list->next) + gimp_path_stroke_add (path, GIMP_STROKE (list->data)); if (! merge) - gimp_vectors_thaw (vectors); + gimp_path_thaw (path); - g_list_free_full (path->strokes, g_object_unref); - path->strokes = NULL; + g_list_free_full (svg_path->strokes, g_object_unref); + svg_path->strokes = NULL; } if (merge) - gimp_vectors_thaw (vectors); + gimp_path_thaw (path); gimp_image_undo_group_end (image); } @@ -407,17 +407,17 @@ gimp_vectors_import (GimpImage *image, { for (paths = base->paths; paths; paths = paths->next) { - SvgPath *path = paths->data; + SvgPath *svg_path = paths->data; GList *list; - g_free (path->id); + g_free (svg_path->id); - for (list = path->strokes; list; list = list->next) + for (list = svg_path->strokes; list; list = list->next) g_object_unref (list->data); - g_list_free (path->strokes); + g_list_free (svg_path->strokes); - g_slice_free (SvgPath, path); + g_slice_free (SvgPath, svg_path); } g_list_free (base->paths); @@ -494,10 +494,10 @@ svg_parser_end_element (GMarkupParseContext *context, { for (paths = handler->paths; paths; paths = paths->next) { - SvgPath *path = paths->data; + SvgPath *svg_path = paths->data; GList *list; - for (list = path->strokes; list; list = list->next) + for (list = svg_path->strokes; list; list = list->next) gimp_stroke_transform (GIMP_STROKE (list->data), handler->transform, NULL); } diff --git a/app/vectors/gimppath-import.h b/app/vectors/gimppath-import.h new file mode 100644 index 0000000000..951b50a619 --- /dev/null +++ b/app/vectors/gimppath-import.h @@ -0,0 +1,44 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * GimpPath Import + * Copyright (C) 2003 Sven Neumann + * + * 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 3 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, see . + */ + +#ifndef __GIMP_PATH_IMPORT_H__ +#define __GIMP_PATH_IMPORT_H__ + + +gboolean gimp_path_import_file (GimpImage *image, + GFile *file, + gboolean merge, + gboolean scale, + GimpPath *parent, + gint position, + GList **ret_paths, + GError **error); +gboolean gimp_path_import_buffer (GimpImage *image, + const gchar *buffer, + gsize len, + gboolean merge, + gboolean scale, + GimpPath *parent, + gint position, + GList **ret_paths, + GError **error); + + +#endif /* __GIMP_PATH_IMPORT_H__ */ diff --git a/app/vectors/gimpvectors-preview.c b/app/vectors/gimppath-preview.c similarity index 82% rename from app/vectors/gimpvectors-preview.c rename to app/vectors/gimppath-preview.c index 2320a51e51..24b620f88b 100644 --- a/app/vectors/gimpvectors-preview.c +++ b/app/vectors/gimppath-preview.c @@ -29,28 +29,28 @@ #include "core/gimpimage.h" #include "core/gimptempbuf.h" -#include "gimppath.h" #include "gimpstroke.h" -#include "gimpvectors-preview.h" +#include "gimppath.h" +#include "gimppath-preview.h" /* public functions */ GimpTempBuf * -gimp_vectors_get_new_preview (GimpViewable *viewable, - GimpContext *context, - gint width, - gint height) +gimp_path_get_new_preview (GimpViewable *viewable, + GimpContext *context, + gint width, + gint height) { - GimpPath *vectors; + GimpPath *path; GimpItem *item; GimpStroke *cur_stroke; gdouble xscale, yscale; guchar *data; GimpTempBuf *temp_buf; - vectors = GIMP_PATH (viewable); - item = GIMP_ITEM (viewable); + path = GIMP_PATH (viewable); + item = GIMP_ITEM (viewable); xscale = ((gdouble) width) / gimp_image_get_width (gimp_item_get_image (item)); yscale = ((gdouble) height) / gimp_image_get_height (gimp_item_get_image (item)); @@ -59,9 +59,9 @@ gimp_vectors_get_new_preview (GimpViewable *viewable, data = gimp_temp_buf_get_data (temp_buf); memset (data, 255, width * height); - for (cur_stroke = gimp_vectors_stroke_get_next (vectors, NULL); + for (cur_stroke = gimp_path_stroke_get_next (path, NULL); cur_stroke; - cur_stroke = gimp_vectors_stroke_get_next (vectors, cur_stroke)) + cur_stroke = gimp_path_stroke_get_next (path, cur_stroke)) { GArray *coords; gboolean closed; diff --git a/app/vectors/gimpvectors-preview.h b/app/vectors/gimppath-preview.h similarity index 63% rename from app/vectors/gimpvectors-preview.h rename to app/vectors/gimppath-preview.h index f934d8ee8e..5050773107 100644 --- a/app/vectors/gimpvectors-preview.h +++ b/app/vectors/gimppath-preview.h @@ -15,18 +15,18 @@ * along with this program. If not, see . */ -#ifndef __GIMP_VECTORS_PREVIEW_H__ -#define __GIMP_VECTORS_PREVIEW_H__ +#ifndef __GIMP_PATH_PREVIEW_H__ +#define __GIMP_PATH_PREVIEW_H__ /* - * virtual function of GimpVectors -- don't call directly + * virtual function of GimpPath -- don't call directly */ -GimpTempBuf * gimp_vectors_get_new_preview (GimpViewable *viewable, - GimpContext *context, - gint width, - gint height); +GimpTempBuf * gimp_path_get_new_preview (GimpViewable *viewable, + GimpContext *context, + gint width, + gint height); -#endif /* __GIMP_VECTORS_PREVIEW_H__ */ +#endif /* __GIMP_PATH_PREVIEW_H__ */ diff --git a/app/vectors/gimpvectors-warp.c b/app/vectors/gimppath-warp.c similarity index 82% rename from app/vectors/gimpvectors-warp.c rename to app/vectors/gimppath-warp.c index b9d003f26a..b465f59263 100644 --- a/app/vectors/gimpvectors-warp.c +++ b/app/vectors/gimppath-warp.c @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * gimpvectors-warp.c + * gimppath-warp.c * Copyright (C) 2005 Bill Skaggs * * This program is free software: you can redistribute it and/or modify @@ -31,9 +31,9 @@ #include "core/gimpcoords.h" #include "gimpanchor.h" -#include "gimppath.h" #include "gimpstroke.h" -#include "gimpvectors-warp.h" +#include "gimppath.h" +#include "gimppath-warp.h" #define EPSILON 0.2 @@ -47,16 +47,16 @@ static void gimp_stroke_warp_point (GimpStroke *stroke, gdouble y_offset, gdouble x_len); -static void gimp_vectors_warp_stroke (GimpPath *vectors, +static void gimp_path_warp_stroke (GimpPath *path, GimpStroke *stroke, gdouble y_offset); void -gimp_vectors_warp_point (GimpPath *vectors, - GimpCoords *point, - GimpCoords *point_warped, - gdouble y_offset) +gimp_path_warp_point (GimpPath *path, + GimpCoords *point, + GimpCoords *point_warped, + gdouble y_offset) { gdouble x = point->x; gdouble y = point->y; @@ -64,13 +64,13 @@ gimp_vectors_warp_point (GimpPath *vectors, GList *list; GimpStroke *stroke; - for (list = vectors->strokes->head; + for (list = path->strokes->head; list; list = g_list_next (list)) { stroke = list->data; - len = gimp_vectors_stroke_get_length (vectors, stroke); + len = gimp_path_stroke_get_length (path, stroke); if (x < len || ! list->next) break; @@ -176,9 +176,9 @@ gimp_stroke_warp_point (GimpStroke *stroke, } static void -gimp_vectors_warp_stroke (GimpPath *vectors, - GimpStroke *stroke, - gdouble y_offset) +gimp_path_warp_stroke (GimpPath *path, + GimpStroke *stroke, + gdouble y_offset) { GList *list; @@ -186,25 +186,25 @@ gimp_vectors_warp_stroke (GimpPath *vectors, { GimpAnchor *anchor = list->data; - gimp_vectors_warp_point (vectors, - &anchor->position, &anchor->position, - y_offset); + gimp_path_warp_point (path, + &anchor->position, &anchor->position, + y_offset); } } void -gimp_vectors_warp_vectors (GimpPath *vectors, - GimpPath *vectors_in, - gdouble y_offset) +gimp_path_warp_path (GimpPath *path, + GimpPath *path_in, + gdouble y_offset) { GList *list; - for (list = vectors_in->strokes->head; + for (list = path_in->strokes->head; list; list = g_list_next (list)) { GimpStroke *stroke = list->data; - gimp_vectors_warp_stroke (vectors, stroke, y_offset); + gimp_path_warp_stroke (path, stroke, y_offset); } } diff --git a/app/vectors/gimpvectors-warp.h b/app/vectors/gimppath-warp.h similarity index 62% rename from app/vectors/gimpvectors-warp.h rename to app/vectors/gimppath-warp.h index 155c6addbc..1c455ce708 100644 --- a/app/vectors/gimpvectors-warp.h +++ b/app/vectors/gimppath-warp.h @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * gimpvectors-warp.h + * gimppath-warp.h * Copyright (C) 2005 Bill Skaggs * * This program is free software: you can redistribute it and/or modify @@ -18,19 +18,19 @@ * along with this program. If not, see . */ -#ifndef __GIMP_VECTORS_WARP_H__ -#define __GIMP_VECTORS_WARP_H__ +#ifndef __GIMP_PATH_WARP_H__ +#define __GIMP_PATH_WARP_H__ -void gimp_vectors_warp_point (GimpPath *vectors, - GimpCoords *point, - GimpCoords *point_warped, - gdouble y_offset); +void gimp_path_warp_point (GimpPath *path, + GimpCoords *point, + GimpCoords *point_warped, + gdouble y_offset); -void gimp_vectors_warp_vectors (GimpPath *vectors, - GimpPath *vectors_in, - gdouble yoffset); +void gimp_path_warp_path (GimpPath *path, + GimpPath *path_in, + gdouble yoffset); -#endif /* __GIMP_VECTORS_WARP_H__ */ +#endif /* __GIMP_PATH_WARP_H__ */ diff --git a/app/vectors/gimppath.c b/app/vectors/gimppath.c index c8a985aab1..1f723c873d 100644 --- a/app/vectors/gimppath.c +++ b/app/vectors/gimppath.c @@ -48,8 +48,8 @@ #include "gimpanchor.h" #include "gimppath.h" +#include "gimppath-preview.h" #include "gimpstroke.h" -#include "gimpvectors-preview.h" #include "gimp-intl.h" @@ -62,53 +62,53 @@ enum }; -static void gimp_vectors_finalize (GObject *object); +static void gimp_path_finalize (GObject *object); -static gint64 gimp_vectors_get_memsize (GimpObject *object, +static gint64 gimp_path_get_memsize (GimpObject *object, gint64 *gui_size); -static gboolean gimp_vectors_is_attached (GimpItem *item); -static GimpItemTree * gimp_vectors_get_tree (GimpItem *item); -static gboolean gimp_vectors_bounds (GimpItem *item, +static gboolean gimp_path_is_attached (GimpItem *item); +static GimpItemTree * gimp_path_get_tree (GimpItem *item); +static gboolean gimp_path_bounds (GimpItem *item, gdouble *x, gdouble *y, gdouble *width, gdouble *height); -static GimpItem * gimp_vectors_duplicate (GimpItem *item, +static GimpItem * gimp_path_duplicate (GimpItem *item, GType new_type); -static void gimp_vectors_convert (GimpItem *item, +static void gimp_path_convert (GimpItem *item, GimpImage *dest_image, GType old_type); -static void gimp_vectors_translate (GimpItem *item, +static void gimp_path_translate (GimpItem *item, gdouble offset_x, gdouble offset_y, gboolean push_undo); -static void gimp_vectors_scale (GimpItem *item, +static void gimp_path_scale (GimpItem *item, gint new_width, gint new_height, gint new_offset_x, gint new_offset_y, GimpInterpolationType interp_type, GimpProgress *progress); -static void gimp_vectors_resize (GimpItem *item, +static void gimp_path_resize (GimpItem *item, GimpContext *context, GimpFillType fill_type, gint new_width, gint new_height, gint offset_x, gint offset_y); -static void gimp_vectors_flip (GimpItem *item, +static void gimp_path_flip (GimpItem *item, GimpContext *context, GimpOrientationType flip_type, gdouble axis, gboolean clip_result); -static void gimp_vectors_rotate (GimpItem *item, +static void gimp_path_rotate (GimpItem *item, GimpContext *context, GimpRotationType rotate_type, gdouble center_x, gdouble center_y, gboolean clip_result); -static void gimp_vectors_transform (GimpItem *item, +static void gimp_path_transform (GimpItem *item, GimpContext *context, const GimpMatrix3 *matrix, GimpTransformDirection direction, @@ -116,56 +116,56 @@ static void gimp_vectors_transform (GimpItem *item, GimpTransformResize clip_result, GimpProgress *progress); static GimpTransformResize - gimp_vectors_get_clip (GimpItem *item, + gimp_path_get_clip (GimpItem *item, GimpTransformResize clip_result); -static gboolean gimp_vectors_fill (GimpItem *item, +static gboolean gimp_path_fill (GimpItem *item, GimpDrawable *drawable, GimpFillOptions *fill_options, gboolean push_undo, GimpProgress *progress, GError **error); -static gboolean gimp_vectors_stroke (GimpItem *item, +static gboolean gimp_path_stroke (GimpItem *item, GimpDrawable *drawable, GimpStrokeOptions *stroke_options, gboolean push_undo, GimpProgress *progress, GError **error); -static void gimp_vectors_to_selection (GimpItem *item, +static void gimp_path_to_selection (GimpItem *item, GimpChannelOps op, gboolean antialias, gboolean feather, gdouble feather_radius_x, gdouble feather_radius_y); -static void gimp_vectors_real_freeze (GimpPath *vectors); -static void gimp_vectors_real_thaw (GimpPath *vectors); -static void gimp_vectors_real_stroke_add (GimpPath *vectors, +static void gimp_path_real_freeze (GimpPath *path); +static void gimp_path_real_thaw (GimpPath *path); +static void gimp_path_real_stroke_add (GimpPath *path, GimpStroke *stroke); -static void gimp_vectors_real_stroke_remove (GimpPath *vectors, +static void gimp_path_real_stroke_remove (GimpPath *path, GimpStroke *stroke); -static GimpStroke * gimp_vectors_real_stroke_get (GimpPath *vectors, +static GimpStroke * gimp_path_real_stroke_get (GimpPath *path, const GimpCoords *coord); -static GimpStroke *gimp_vectors_real_stroke_get_next(GimpPath *vectors, +static GimpStroke *gimp_path_real_stroke_get_next (GimpPath *path, GimpStroke *prev); -static gdouble gimp_vectors_real_stroke_get_length (GimpPath *vectors, +static gdouble gimp_path_real_stroke_get_length (GimpPath *path, GimpStroke *prev); -static GimpAnchor * gimp_vectors_real_anchor_get (GimpPath *vectors, +static GimpAnchor * gimp_path_real_anchor_get (GimpPath *path, const GimpCoords *coord, GimpStroke **ret_stroke); -static void gimp_vectors_real_anchor_delete (GimpPath *vectors, +static void gimp_path_real_anchor_delete (GimpPath *path, GimpAnchor *anchor); -static gdouble gimp_vectors_real_get_length (GimpPath *vectors, +static gdouble gimp_path_real_get_length (GimpPath *path, const GimpAnchor *start); -static gdouble gimp_vectors_real_get_distance (GimpPath *vectors, +static gdouble gimp_path_real_get_distance (GimpPath *path, const GimpCoords *coord); -static gint gimp_vectors_real_interpolate (GimpPath *vectors, +static gint gimp_path_real_interpolate (GimpPath *path, GimpStroke *stroke, gdouble precision, gint max_points, GimpCoords *ret_coords); -static GimpBezierDesc * gimp_vectors_make_bezier (GimpPath *vectors); -static GimpBezierDesc * gimp_vectors_real_make_bezier (GimpPath *vectors); +static GimpBezierDesc * gimp_path_make_bezier (GimpPath *path); +static GimpBezierDesc * gimp_path_real_make_bezier (GimpPath *path); G_DEFINE_TYPE (GimpPath, gimp_path, GIMP_TYPE_ITEM) @@ -199,28 +199,28 @@ gimp_path_class_init (GimpPathClass *klass) NULL, NULL, NULL, G_TYPE_NONE, 0); - object_class->finalize = gimp_vectors_finalize; + object_class->finalize = gimp_path_finalize; - gimp_object_class->get_memsize = gimp_vectors_get_memsize; + gimp_object_class->get_memsize = gimp_path_get_memsize; - viewable_class->get_new_preview = gimp_vectors_get_new_preview; + viewable_class->get_new_preview = gimp_path_get_new_preview; viewable_class->default_icon_name = "gimp-path"; - item_class->is_attached = gimp_vectors_is_attached; - item_class->get_tree = gimp_vectors_get_tree; - item_class->bounds = gimp_vectors_bounds; - item_class->duplicate = gimp_vectors_duplicate; - item_class->convert = gimp_vectors_convert; - item_class->translate = gimp_vectors_translate; - item_class->scale = gimp_vectors_scale; - item_class->resize = gimp_vectors_resize; - item_class->flip = gimp_vectors_flip; - item_class->rotate = gimp_vectors_rotate; - item_class->transform = gimp_vectors_transform; - item_class->get_clip = gimp_vectors_get_clip; - item_class->fill = gimp_vectors_fill; - item_class->stroke = gimp_vectors_stroke; - item_class->to_selection = gimp_vectors_to_selection; + item_class->is_attached = gimp_path_is_attached; + item_class->get_tree = gimp_path_get_tree; + item_class->bounds = gimp_path_bounds; + item_class->duplicate = gimp_path_duplicate; + item_class->convert = gimp_path_convert; + item_class->translate = gimp_path_translate; + item_class->scale = gimp_path_scale; + item_class->resize = gimp_path_resize; + item_class->flip = gimp_path_flip; + item_class->rotate = gimp_path_rotate; + item_class->transform = gimp_path_transform; + item_class->get_clip = gimp_path_get_clip; + item_class->fill = gimp_path_fill; + item_class->stroke = gimp_path_stroke; + item_class->to_selection = gimp_path_to_selection; item_class->default_name = _("Path"); item_class->rename_desc = C_("undo-type", "Rename Path"); item_class->translate_desc = C_("undo-type", "Move Path"); @@ -240,23 +240,23 @@ gimp_path_class_init (GimpPathClass *klass) item_class->raise_failed = _("Path cannot be raised higher."); item_class->lower_failed = _("Path cannot be lowered more."); - klass->freeze = gimp_vectors_real_freeze; - klass->thaw = gimp_vectors_real_thaw; + klass->freeze = gimp_path_real_freeze; + klass->thaw = gimp_path_real_thaw; - klass->stroke_add = gimp_vectors_real_stroke_add; - klass->stroke_remove = gimp_vectors_real_stroke_remove; - klass->stroke_get = gimp_vectors_real_stroke_get; - klass->stroke_get_next = gimp_vectors_real_stroke_get_next; - klass->stroke_get_length = gimp_vectors_real_stroke_get_length; + klass->stroke_add = gimp_path_real_stroke_add; + klass->stroke_remove = gimp_path_real_stroke_remove; + klass->stroke_get = gimp_path_real_stroke_get; + klass->stroke_get_next = gimp_path_real_stroke_get_next; + klass->stroke_get_length = gimp_path_real_stroke_get_length; - klass->anchor_get = gimp_vectors_real_anchor_get; - klass->anchor_delete = gimp_vectors_real_anchor_delete; + klass->anchor_get = gimp_path_real_anchor_get; + klass->anchor_delete = gimp_path_real_anchor_delete; - klass->get_length = gimp_vectors_real_get_length; - klass->get_distance = gimp_vectors_real_get_distance; - klass->interpolate = gimp_vectors_real_interpolate; + klass->get_length = gimp_path_real_get_length; + klass->get_distance = gimp_path_real_get_distance; + klass->interpolate = gimp_path_real_interpolate; - klass->make_bezier = gimp_vectors_real_make_bezier; + klass->make_bezier = gimp_path_real_make_bezier; } static void @@ -275,42 +275,42 @@ gimp_path_init (GimpPath *path) } static void -gimp_vectors_finalize (GObject *object) +gimp_path_finalize (GObject *object) { - GimpPath *vectors = GIMP_PATH (object); + GimpPath *path = GIMP_PATH (object); - if (vectors->bezier_desc) + if (path->bezier_desc) { - gimp_bezier_desc_free (vectors->bezier_desc); - vectors->bezier_desc = NULL; + gimp_bezier_desc_free (path->bezier_desc); + path->bezier_desc = NULL; } - if (vectors->strokes) + if (path->strokes) { - g_queue_free_full (vectors->strokes, (GDestroyNotify) g_object_unref); - vectors->strokes = NULL; + g_queue_free_full (path->strokes, (GDestroyNotify) g_object_unref); + path->strokes = NULL; } - if (vectors->stroke_to_list) + if (path->stroke_to_list) { - g_hash_table_destroy (vectors->stroke_to_list); - vectors->stroke_to_list = NULL; + g_hash_table_destroy (path->stroke_to_list); + path->stroke_to_list = NULL; } G_OBJECT_CLASS (parent_class)->finalize (object); } static gint64 -gimp_vectors_get_memsize (GimpObject *object, - gint64 *gui_size) +gimp_path_get_memsize (GimpObject *object, + gint64 *gui_size) { - GimpPath *vectors; - GList *list; - gint64 memsize = 0; + GimpPath *path; + GList *list; + gint64 memsize = 0; - vectors = GIMP_PATH (object); + path = GIMP_PATH (object); - for (list = vectors->strokes->head; list; list = g_list_next (list)) + for (list = path->strokes->head; list; list = g_list_next (list)) memsize += (gimp_object_get_memsize (GIMP_OBJECT (list->data), gui_size) + sizeof (GList)); @@ -319,7 +319,7 @@ gimp_vectors_get_memsize (GimpObject *object, } static gboolean -gimp_vectors_is_attached (GimpItem *item) +gimp_path_is_attached (GimpItem *item) { GimpImage *image = gimp_item_get_image (item); @@ -329,7 +329,7 @@ gimp_vectors_is_attached (GimpItem *item) } static GimpItemTree * -gimp_vectors_get_tree (GimpItem *item) +gimp_path_get_tree (GimpItem *item) { if (gimp_item_is_attached (item)) { @@ -342,25 +342,25 @@ gimp_vectors_get_tree (GimpItem *item) } static gboolean -gimp_vectors_bounds (GimpItem *item, - gdouble *x, - gdouble *y, - gdouble *width, - gdouble *height) +gimp_path_bounds (GimpItem *item, + gdouble *x, + gdouble *y, + gdouble *width, + gdouble *height) { - GimpPath *vectors = GIMP_PATH (item); + GimpPath *path = GIMP_PATH (item); - if (! vectors->bounds_valid) + if (! path->bounds_valid) { GimpStroke *stroke; - vectors->bounds_empty = TRUE; - vectors->bounds_x1 = vectors->bounds_x2 = 0.0; - vectors->bounds_y1 = vectors->bounds_y2 = 0.0; + path->bounds_empty = TRUE; + path->bounds_x1 = path->bounds_x2 = 0.0; + path->bounds_y1 = path->bounds_y2 = 0.0; - for (stroke = gimp_vectors_stroke_get_next (vectors, NULL); + for (stroke = gimp_path_stroke_get_next (path, NULL); stroke; - stroke = gimp_vectors_stroke_get_next (vectors, stroke)) + stroke = gimp_path_stroke_get_next (path, stroke)) { GArray *stroke_coords; gboolean closed; @@ -372,44 +372,44 @@ gimp_vectors_bounds (GimpItem *item, GimpCoords point; gint i; - if (vectors->bounds_empty && stroke_coords->len > 0) + if (path->bounds_empty && stroke_coords->len > 0) { point = g_array_index (stroke_coords, GimpCoords, 0); - vectors->bounds_x1 = vectors->bounds_x2 = point.x; - vectors->bounds_y1 = vectors->bounds_y2 = point.y; + path->bounds_x1 = path->bounds_x2 = point.x; + path->bounds_y1 = path->bounds_y2 = point.y; - vectors->bounds_empty = FALSE; + path->bounds_empty = FALSE; } for (i = 0; i < stroke_coords->len; i++) { point = g_array_index (stroke_coords, GimpCoords, i); - vectors->bounds_x1 = MIN (vectors->bounds_x1, point.x); - vectors->bounds_y1 = MIN (vectors->bounds_y1, point.y); - vectors->bounds_x2 = MAX (vectors->bounds_x2, point.x); - vectors->bounds_y2 = MAX (vectors->bounds_y2, point.y); + path->bounds_x1 = MIN (path->bounds_x1, point.x); + path->bounds_y1 = MIN (path->bounds_y1, point.y); + path->bounds_x2 = MAX (path->bounds_x2, point.x); + path->bounds_y2 = MAX (path->bounds_y2, point.y); } g_array_free (stroke_coords, TRUE); } } - vectors->bounds_valid = TRUE; + path->bounds_valid = TRUE; } - *x = vectors->bounds_x1; - *y = vectors->bounds_y1; - *width = vectors->bounds_x2 - vectors->bounds_x1; - *height = vectors->bounds_y2 - vectors->bounds_y1; + *x = path->bounds_x1; + *y = path->bounds_y1; + *width = path->bounds_x2 - path->bounds_x1; + *height = path->bounds_y2 - path->bounds_y1; - return ! vectors->bounds_empty; + return ! path->bounds_empty; } static GimpItem * -gimp_vectors_duplicate (GimpItem *item, - GType new_type) +gimp_path_duplicate (GimpItem *item, + GType new_type) { GimpItem *new_item; @@ -419,19 +419,19 @@ gimp_vectors_duplicate (GimpItem *item, if (GIMP_IS_PATH (new_item)) { - GimpPath *vectors = GIMP_PATH (item); - GimpPath *new_vectors = GIMP_PATH (new_item); + GimpPath *path = GIMP_PATH (item); + GimpPath *new_path = GIMP_PATH (new_item); - gimp_vectors_copy_strokes (vectors, new_vectors); + gimp_path_copy_strokes (path, new_path); } return new_item; } static void -gimp_vectors_convert (GimpItem *item, - GimpImage *dest_image, - GType old_type) +gimp_path_convert (GimpItem *item, + GimpImage *dest_image, + GType old_type) { gimp_item_set_size (item, gimp_image_get_width (dest_image), @@ -441,15 +441,15 @@ gimp_vectors_convert (GimpItem *item, } static void -gimp_vectors_translate (GimpItem *item, - gdouble offset_x, - gdouble offset_y, - gboolean push_undo) +gimp_path_translate (GimpItem *item, + gdouble offset_x, + gdouble offset_y, + gboolean push_undo) { GimpPath *path = GIMP_PATH (item); GList *list; - gimp_vectors_freeze (path); + gimp_path_freeze (path); if (push_undo) gimp_image_undo_push_path_mod (gimp_item_get_image (item), @@ -463,23 +463,23 @@ gimp_vectors_translate (GimpItem *item, gimp_stroke_translate (stroke, offset_x, offset_y); } - gimp_vectors_thaw (path); + gimp_path_thaw (path); } static void -gimp_vectors_scale (GimpItem *item, - gint new_width, - gint new_height, - gint new_offset_x, - gint new_offset_y, - GimpInterpolationType interpolation_type, - GimpProgress *progress) +gimp_path_scale (GimpItem *item, + gint new_width, + gint new_height, + gint new_offset_x, + gint new_offset_y, + GimpInterpolationType interpolation_type, + GimpProgress *progress) { GimpPath *path = GIMP_PATH (item); GimpImage *image = gimp_item_get_image (item); GList *list; - gimp_vectors_freeze (path); + gimp_path_freeze (path); if (gimp_item_is_attached (item)) gimp_image_undo_push_path_mod (image, NULL, path); @@ -500,23 +500,23 @@ gimp_vectors_scale (GimpItem *item, 0, 0, interpolation_type, progress); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } static void -gimp_vectors_resize (GimpItem *item, - GimpContext *context, - GimpFillType fill_type, - gint new_width, - gint new_height, - gint offset_x, - gint offset_y) +gimp_path_resize (GimpItem *item, + GimpContext *context, + GimpFillType fill_type, + gint new_width, + gint new_height, + gint offset_x, + gint offset_y) { GimpPath *path = GIMP_PATH (item); GimpImage *image = gimp_item_get_image (item); GList *list; - gimp_vectors_freeze (path); + gimp_path_freeze (path); if (gimp_item_is_attached (item)) gimp_image_undo_push_path_mod (image, NULL, path); @@ -533,15 +533,15 @@ gimp_vectors_resize (GimpItem *item, gimp_image_get_height (image), 0, 0); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } static void -gimp_vectors_flip (GimpItem *item, - GimpContext *context, - GimpOrientationType flip_type, - gdouble axis, - gboolean clip_result) +gimp_path_flip (GimpItem *item, + GimpContext *context, + GimpOrientationType flip_type, + gdouble axis, + gboolean clip_result) { GimpPath *path = GIMP_PATH (item); GList *list; @@ -550,7 +550,7 @@ gimp_vectors_flip (GimpItem *item, gimp_matrix3_identity (&matrix); gimp_transform_matrix_flip (&matrix, flip_type, axis); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_image_undo_push_path_mod (gimp_item_get_image (item), _("Flip Path"), @@ -563,16 +563,16 @@ gimp_vectors_flip (GimpItem *item, gimp_stroke_transform (stroke, &matrix, NULL); } - gimp_vectors_thaw (path); + gimp_path_thaw (path); } static void -gimp_vectors_rotate (GimpItem *item, - GimpContext *context, - GimpRotationType rotate_type, - gdouble center_x, - gdouble center_y, - gboolean clip_result) +gimp_path_rotate (GimpItem *item, + GimpContext *context, + GimpRotationType rotate_type, + gdouble center_x, + gdouble center_y, + gboolean clip_result) { GimpPath *path = GIMP_PATH (item); GList *list; @@ -581,7 +581,7 @@ gimp_vectors_rotate (GimpItem *item, gimp_matrix3_identity (&matrix); gimp_transform_matrix_rotate (&matrix, rotate_type, center_x, center_y); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_image_undo_push_path_mod (gimp_item_get_image (item), _("Rotate Path"), @@ -594,24 +594,24 @@ gimp_vectors_rotate (GimpItem *item, gimp_stroke_transform (stroke, &matrix, NULL); } - gimp_vectors_thaw (path); + gimp_path_thaw (path); } static void -gimp_vectors_transform (GimpItem *item, - GimpContext *context, - const GimpMatrix3 *matrix, - GimpTransformDirection direction, - GimpInterpolationType interpolation_type, - GimpTransformResize clip_result, - GimpProgress *progress) +gimp_path_transform (GimpItem *item, + GimpContext *context, + const GimpMatrix3 *matrix, + GimpTransformDirection direction, + GimpInterpolationType interpolation_type, + GimpTransformResize clip_result, + GimpProgress *progress) { GimpPath *path = GIMP_PATH (item); GimpMatrix3 local_matrix; GQueue strokes; GList *list; - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_image_undo_push_path_mod (gimp_item_get_image (item), _("Transform Path"), @@ -630,7 +630,7 @@ gimp_vectors_transform (GimpItem *item, g_object_ref (stroke); - gimp_vectors_stroke_remove (path, stroke); + gimp_path_stroke_remove (path, stroke); gimp_stroke_transform (stroke, &local_matrix, &strokes); @@ -643,56 +643,56 @@ gimp_vectors_transform (GimpItem *item, { GimpStroke *stroke = list->data; - gimp_vectors_stroke_add (path, stroke); + gimp_path_stroke_add (path, stroke); g_object_unref (stroke); } g_queue_clear (&strokes); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } static GimpTransformResize -gimp_vectors_get_clip (GimpItem *item, - GimpTransformResize clip_result) +gimp_path_get_clip (GimpItem *item, + GimpTransformResize clip_result) { return GIMP_TRANSFORM_RESIZE_ADJUST; } static gboolean -gimp_vectors_fill (GimpItem *item, - GimpDrawable *drawable, - GimpFillOptions *fill_options, - gboolean push_undo, - GimpProgress *progress, - GError **error) +gimp_path_fill (GimpItem *item, + GimpDrawable *drawable, + GimpFillOptions *fill_options, + gboolean push_undo, + GimpProgress *progress, + GError **error) { - GimpPath *vectors = GIMP_PATH (item); + GimpPath *path = GIMP_PATH (item); - if (g_queue_is_empty (vectors->strokes)) + if (g_queue_is_empty (path->strokes)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("Not enough points to fill")); return FALSE; } - return gimp_drawable_fill_vectors (drawable, fill_options, - vectors, push_undo, error); + return gimp_drawable_fill_path (drawable, fill_options, + path, push_undo, error); } static gboolean -gimp_vectors_stroke (GimpItem *item, - GimpDrawable *drawable, - GimpStrokeOptions *stroke_options, - gboolean push_undo, - GimpProgress *progress, - GError **error) +gimp_path_stroke (GimpItem *item, + GimpDrawable *drawable, + GimpStrokeOptions *stroke_options, + gboolean push_undo, + GimpProgress *progress, + GError **error) { - GimpPath *vectors = GIMP_PATH (item); - gboolean retval = FALSE; + GimpPath *path = GIMP_PATH (item); + gboolean retval = FALSE; - if (g_queue_is_empty (vectors->strokes)) + if (g_queue_is_empty (path->strokes)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("Not enough points to stroke")); @@ -702,8 +702,8 @@ gimp_vectors_stroke (GimpItem *item, switch (gimp_stroke_options_get_method (stroke_options)) { case GIMP_STROKE_LINE: - retval = gimp_drawable_stroke_vectors (drawable, stroke_options, - vectors, push_undo, error); + retval = gimp_drawable_stroke_path (drawable, stroke_options, + path, push_undo, error); break; case GIMP_STROKE_PAINT_METHOD: @@ -720,10 +720,10 @@ gimp_vectors_stroke (GimpItem *item, paint_options = gimp_stroke_options_get_paint_options (stroke_options); emulate_dynamics = gimp_stroke_options_get_emulate_dynamics (stroke_options); - retval = gimp_paint_core_stroke_vectors (core, drawable, - paint_options, - emulate_dynamics, - vectors, push_undo, error); + retval = gimp_paint_core_stroke_path (core, drawable, + paint_options, + emulate_dynamics, + path, push_undo, error); g_object_unref (core); } @@ -737,237 +737,237 @@ gimp_vectors_stroke (GimpItem *item, } static void -gimp_vectors_to_selection (GimpItem *item, - GimpChannelOps op, - gboolean antialias, - gboolean feather, - gdouble feather_radius_x, - gdouble feather_radius_y) +gimp_path_to_selection (GimpItem *item, + GimpChannelOps op, + gboolean antialias, + gboolean feather, + gdouble feather_radius_x, + gdouble feather_radius_y) { GimpPath *path = GIMP_PATH (item); GimpImage *image = gimp_item_get_image (item); - gimp_channel_select_vectors (gimp_image_get_mask (image), - GIMP_ITEM_GET_CLASS (item)->to_selection_desc, - path, - op, antialias, - feather, feather_radius_x, feather_radius_x, - TRUE); + gimp_channel_select_path (gimp_image_get_mask (image), + GIMP_ITEM_GET_CLASS (item)->to_selection_desc, + path, + op, antialias, + feather, feather_radius_x, feather_radius_x, + TRUE); } static void -gimp_vectors_real_freeze (GimpPath *vectors) +gimp_path_real_freeze (GimpPath *path) { /* release cached bezier representation */ - if (vectors->bezier_desc) + if (path->bezier_desc) { - gimp_bezier_desc_free (vectors->bezier_desc); - vectors->bezier_desc = NULL; + gimp_bezier_desc_free (path->bezier_desc); + path->bezier_desc = NULL; } /* invalidate bounds */ - vectors->bounds_valid = FALSE; + path->bounds_valid = FALSE; } static void -gimp_vectors_real_thaw (GimpPath *vectors) +gimp_path_real_thaw (GimpPath *path) { - gimp_viewable_invalidate_preview (GIMP_VIEWABLE (vectors)); + gimp_viewable_invalidate_preview (GIMP_VIEWABLE (path)); } /* public functions */ GimpPath * -gimp_vectors_new (GimpImage *image, - const gchar *name) +gimp_path_new (GimpImage *image, + const gchar *name) { - GimpPath *vectors; + GimpPath *path; g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); - vectors = GIMP_PATH (gimp_item_new (GIMP_TYPE_PATH, - image, name, - 0, 0, - gimp_image_get_width (image), - gimp_image_get_height (image))); + path = GIMP_PATH (gimp_item_new (GIMP_TYPE_PATH, + image, name, + 0, 0, + gimp_image_get_width (image), + gimp_image_get_height (image))); - return vectors; + return path; } GimpPath * -gimp_vectors_get_parent (GimpPath *vectors) +gimp_path_get_parent (GimpPath *path) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), NULL); + g_return_val_if_fail (GIMP_IS_PATH (path), NULL); - return GIMP_PATH (gimp_viewable_get_parent (GIMP_VIEWABLE (vectors))); + return GIMP_PATH (gimp_viewable_get_parent (GIMP_VIEWABLE (path))); } void -gimp_vectors_freeze (GimpPath *vectors) +gimp_path_freeze (GimpPath *path) { - g_return_if_fail (GIMP_IS_PATH (vectors)); + g_return_if_fail (GIMP_IS_PATH (path)); - vectors->freeze_count++; + path->freeze_count++; - if (vectors->freeze_count == 1) - g_signal_emit (vectors, gimp_path_signals[FREEZE], 0); + if (path->freeze_count == 1) + g_signal_emit (path, gimp_path_signals[FREEZE], 0); } void -gimp_vectors_thaw (GimpPath *vectors) +gimp_path_thaw (GimpPath *path) { - g_return_if_fail (GIMP_IS_PATH (vectors)); - g_return_if_fail (vectors->freeze_count > 0); + g_return_if_fail (GIMP_IS_PATH (path)); + g_return_if_fail (path->freeze_count > 0); - vectors->freeze_count--; + path->freeze_count--; - if (vectors->freeze_count == 0) - g_signal_emit (vectors, gimp_path_signals[THAW], 0); + if (path->freeze_count == 0) + g_signal_emit (path, gimp_path_signals[THAW], 0); } void -gimp_vectors_copy_strokes (GimpPath *src_vectors, - GimpPath *dest_vectors) +gimp_path_copy_strokes (GimpPath *src_path, + GimpPath *dest_path) { - g_return_if_fail (GIMP_IS_PATH (src_vectors)); - g_return_if_fail (GIMP_IS_PATH (dest_vectors)); + g_return_if_fail (GIMP_IS_PATH (src_path)); + g_return_if_fail (GIMP_IS_PATH (dest_path)); - gimp_vectors_freeze (dest_vectors); + gimp_path_freeze (dest_path); - g_queue_free_full (dest_vectors->strokes, (GDestroyNotify) g_object_unref); - dest_vectors->strokes = g_queue_new (); - g_hash_table_remove_all (dest_vectors->stroke_to_list); + g_queue_free_full (dest_path->strokes, (GDestroyNotify) g_object_unref); + dest_path->strokes = g_queue_new (); + g_hash_table_remove_all (dest_path->stroke_to_list); - dest_vectors->last_stroke_id = 0; + dest_path->last_stroke_id = 0; - gimp_vectors_add_strokes (src_vectors, dest_vectors); + gimp_path_add_strokes (src_path, dest_path); - gimp_vectors_thaw (dest_vectors); + gimp_path_thaw (dest_path); } void -gimp_vectors_add_strokes (GimpPath *src_vectors, - GimpPath *dest_vectors) +gimp_path_add_strokes (GimpPath *src_path, + GimpPath *dest_path) { GList *stroke; - g_return_if_fail (GIMP_IS_PATH (src_vectors)); - g_return_if_fail (GIMP_IS_PATH (dest_vectors)); + g_return_if_fail (GIMP_IS_PATH (src_path)); + g_return_if_fail (GIMP_IS_PATH (dest_path)); - gimp_vectors_freeze (dest_vectors); + gimp_path_freeze (dest_path); - for (stroke = src_vectors->strokes->head; + for (stroke = src_path->strokes->head; stroke != NULL; stroke = g_list_next (stroke)) { GimpStroke *newstroke = gimp_stroke_duplicate (stroke->data); - g_queue_push_tail (dest_vectors->strokes, newstroke); + g_queue_push_tail (dest_path->strokes, newstroke); /* Also add to {stroke: GList node} map */ - g_hash_table_insert (dest_vectors->stroke_to_list, + g_hash_table_insert (dest_path->stroke_to_list, newstroke, - g_queue_peek_tail_link (dest_vectors->strokes)); + g_queue_peek_tail_link (dest_path->strokes)); - dest_vectors->last_stroke_id++; + dest_path->last_stroke_id++; gimp_stroke_set_id (newstroke, - dest_vectors->last_stroke_id); + dest_path->last_stroke_id); } - gimp_vectors_thaw (dest_vectors); + gimp_path_thaw (dest_path); } void -gimp_vectors_stroke_add (GimpPath *vectors, - GimpStroke *stroke) +gimp_path_stroke_add (GimpPath *path, + GimpStroke *stroke) { - g_return_if_fail (GIMP_IS_PATH (vectors)); + g_return_if_fail (GIMP_IS_PATH (path)); g_return_if_fail (GIMP_IS_STROKE (stroke)); - gimp_vectors_freeze (vectors); + gimp_path_freeze (path); - GIMP_PATH_GET_CLASS (vectors)->stroke_add (vectors, stroke); + GIMP_PATH_GET_CLASS (path)->stroke_add (path, stroke); - gimp_vectors_thaw (vectors); + gimp_path_thaw (path); } static void -gimp_vectors_real_stroke_add (GimpPath *vectors, - GimpStroke *stroke) +gimp_path_real_stroke_add (GimpPath *path, + GimpStroke *stroke) { /* - * Don't prepend into vector->strokes. See ChangeLog 2003-05-21 + * Don't prepend into path->strokes. See ChangeLog 2003-05-21 * --Mitch */ - g_queue_push_tail (vectors->strokes, g_object_ref (stroke)); + g_queue_push_tail (path->strokes, g_object_ref (stroke)); /* Also add to {stroke: GList node} map */ - g_hash_table_insert (vectors->stroke_to_list, + g_hash_table_insert (path->stroke_to_list, stroke, - g_queue_peek_tail_link (vectors->strokes)); + g_queue_peek_tail_link (path->strokes)); - vectors->last_stroke_id++; - gimp_stroke_set_id (stroke, vectors->last_stroke_id); + path->last_stroke_id++; + gimp_stroke_set_id (stroke, path->last_stroke_id); } void -gimp_vectors_stroke_remove (GimpPath *vectors, - GimpStroke *stroke) +gimp_path_stroke_remove (GimpPath *path, + GimpStroke *stroke) { - g_return_if_fail (GIMP_IS_PATH (vectors)); + g_return_if_fail (GIMP_IS_PATH (path)); g_return_if_fail (GIMP_IS_STROKE (stroke)); - gimp_vectors_freeze (vectors); + gimp_path_freeze (path); - GIMP_PATH_GET_CLASS (vectors)->stroke_remove (vectors, stroke); + GIMP_PATH_GET_CLASS (path)->stroke_remove (path, stroke); - gimp_vectors_thaw (vectors); + gimp_path_thaw (path); } static void -gimp_vectors_real_stroke_remove (GimpPath *vectors, - GimpStroke *stroke) +gimp_path_real_stroke_remove (GimpPath *path, + GimpStroke *stroke) { - GList *list = g_hash_table_lookup (vectors->stroke_to_list, stroke); + GList *list = g_hash_table_lookup (path->stroke_to_list, stroke); if (list) { - g_queue_delete_link (vectors->strokes, list); - g_hash_table_remove (vectors->stroke_to_list, stroke); + g_queue_delete_link (path->strokes, list); + g_hash_table_remove (path->stroke_to_list, stroke); g_object_unref (stroke); } } gint -gimp_vectors_get_n_strokes (GimpPath *vectors) +gimp_path_get_n_strokes (GimpPath *path) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), 0); + g_return_val_if_fail (GIMP_IS_PATH (path), 0); - return g_queue_get_length (vectors->strokes); + return g_queue_get_length (path->strokes); } GimpStroke * -gimp_vectors_stroke_get (GimpPath *vectors, - const GimpCoords *coord) +gimp_path_stroke_get (GimpPath *path, + const GimpCoords *coord) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), NULL); + g_return_val_if_fail (GIMP_IS_PATH (path), NULL); - return GIMP_PATH_GET_CLASS (vectors)->stroke_get (vectors, coord); + return GIMP_PATH_GET_CLASS (path)->stroke_get (path, coord); } static GimpStroke * -gimp_vectors_real_stroke_get (GimpPath *vectors, - const GimpCoords *coord) +gimp_path_real_stroke_get (GimpPath *path, + const GimpCoords *coord) { GimpStroke *minstroke = NULL; gdouble mindist = G_MAXDOUBLE; GList *list; - for (list = vectors->strokes->head; list; list = g_list_next (list)) + for (list = path->strokes->head; list; list = g_list_next (list)) { GimpStroke *stroke = list->data; GimpAnchor *anchor = gimp_stroke_anchor_get (stroke, coord); @@ -989,14 +989,14 @@ gimp_vectors_real_stroke_get (GimpPath *vectors, } GimpStroke * -gimp_vectors_stroke_get_by_id (GimpPath *vectors, - gint id) +gimp_path_stroke_get_by_id (GimpPath *path, + gint id) { GList *list; - g_return_val_if_fail (GIMP_IS_PATH (vectors), NULL); + g_return_val_if_fail (GIMP_IS_PATH (path), NULL); - for (list = vectors->strokes->head; list; list = g_list_next (list)) + for (list = path->strokes->head; list; list = g_list_next (list)) { if (gimp_stroke_get_id (list->data) == id) return list->data; @@ -1007,25 +1007,25 @@ gimp_vectors_stroke_get_by_id (GimpPath *vectors, GimpStroke * -gimp_vectors_stroke_get_next (GimpPath *vectors, - GimpStroke *prev) +gimp_path_stroke_get_next (GimpPath *path, + GimpStroke *prev) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), NULL); + g_return_val_if_fail (GIMP_IS_PATH (path), NULL); - return GIMP_PATH_GET_CLASS (vectors)->stroke_get_next (vectors, prev); + return GIMP_PATH_GET_CLASS (path)->stroke_get_next (path, prev); } static GimpStroke * -gimp_vectors_real_stroke_get_next (GimpPath *vectors, - GimpStroke *prev) +gimp_path_real_stroke_get_next (GimpPath *path, + GimpStroke *prev) { if (! prev) { - return g_queue_peek_head (vectors->strokes); + return g_queue_peek_head (path->strokes); } else { - GList *stroke = g_hash_table_lookup (vectors->stroke_to_list, prev); + GList *stroke = g_hash_table_lookup (path->stroke_to_list, prev); g_return_val_if_fail (stroke != NULL, NULL); @@ -1035,47 +1035,47 @@ gimp_vectors_real_stroke_get_next (GimpPath *vectors, gdouble -gimp_vectors_stroke_get_length (GimpPath *vectors, - GimpStroke *stroke) +gimp_path_stroke_get_length (GimpPath *path, + GimpStroke *stroke) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), 0.0); + g_return_val_if_fail (GIMP_IS_PATH (path), 0.0); g_return_val_if_fail (GIMP_IS_STROKE (stroke), 0.0); - return GIMP_PATH_GET_CLASS (vectors)->stroke_get_length (vectors, stroke); + return GIMP_PATH_GET_CLASS (path)->stroke_get_length (path, stroke); } static gdouble -gimp_vectors_real_stroke_get_length (GimpPath *vectors, - GimpStroke *stroke) +gimp_path_real_stroke_get_length (GimpPath *path, + GimpStroke *stroke) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), 0.0); + g_return_val_if_fail (GIMP_IS_PATH (path), 0.0); g_return_val_if_fail (GIMP_IS_STROKE (stroke), 0.0); - return gimp_stroke_get_length (stroke, vectors->precision); + return gimp_stroke_get_length (stroke, path->precision); } GimpAnchor * -gimp_vectors_anchor_get (GimpPath *vectors, - const GimpCoords *coord, - GimpStroke **ret_stroke) +gimp_path_anchor_get (GimpPath *path, + const GimpCoords *coord, + GimpStroke **ret_stroke) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), NULL); + g_return_val_if_fail (GIMP_IS_PATH (path), NULL); - return GIMP_PATH_GET_CLASS (vectors)->anchor_get (vectors, coord, + return GIMP_PATH_GET_CLASS (path)->anchor_get (path, coord, ret_stroke); } static GimpAnchor * -gimp_vectors_real_anchor_get (GimpPath *vectors, - const GimpCoords *coord, - GimpStroke **ret_stroke) +gimp_path_real_anchor_get (GimpPath *path, + const GimpCoords *coord, + GimpStroke **ret_stroke) { GimpAnchor *minanchor = NULL; gdouble mindist = -1; GList *list; - for (list = vectors->strokes->head; list; list = g_list_next (list)) + for (list = path->strokes->head; list; list = g_list_next (list)) { GimpStroke *stroke = list->data; GimpAnchor *anchor = gimp_stroke_anchor_get (stroke, coord); @@ -1101,32 +1101,32 @@ gimp_vectors_real_anchor_get (GimpPath *vectors, void -gimp_vectors_anchor_delete (GimpPath *vectors, - GimpAnchor *anchor) +gimp_path_anchor_delete (GimpPath *path, + GimpAnchor *anchor) { - g_return_if_fail (GIMP_IS_PATH (vectors)); + g_return_if_fail (GIMP_IS_PATH (path)); g_return_if_fail (anchor != NULL); - GIMP_PATH_GET_CLASS (vectors)->anchor_delete (vectors, anchor); + GIMP_PATH_GET_CLASS (path)->anchor_delete (path, anchor); } static void -gimp_vectors_real_anchor_delete (GimpPath *vectors, - GimpAnchor *anchor) +gimp_path_real_anchor_delete (GimpPath *path, + GimpAnchor *anchor) { } void -gimp_vectors_anchor_select (GimpPath *vectors, - GimpStroke *target_stroke, - GimpAnchor *anchor, - gboolean selected, - gboolean exclusive) +gimp_path_anchor_select (GimpPath *path, + GimpStroke *target_stroke, + GimpAnchor *anchor, + gboolean selected, + gboolean exclusive) { GList *list; - for (list = vectors->strokes->head; list; list = g_list_next (list)) + for (list = path->strokes->head; list; list = g_list_next (list)) { GimpStroke *stroke = list->data; @@ -1138,89 +1138,89 @@ gimp_vectors_anchor_select (GimpPath *vectors, gdouble -gimp_vectors_get_length (GimpPath *vectors, - const GimpAnchor *start) +gimp_path_get_length (GimpPath *path, + const GimpAnchor *start) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), 0.0); + g_return_val_if_fail (GIMP_IS_PATH (path), 0.0); - return GIMP_PATH_GET_CLASS (vectors)->get_length (vectors, start); + return GIMP_PATH_GET_CLASS (path)->get_length (path, start); } static gdouble -gimp_vectors_real_get_length (GimpPath *vectors, - const GimpAnchor *start) +gimp_path_real_get_length (GimpPath *path, + const GimpAnchor *start) { - g_printerr ("gimp_vectors_get_length: default implementation\n"); + g_printerr ("gimp_path_get_length: default implementation\n"); return 0; } gdouble -gimp_vectors_get_distance (GimpPath *vectors, - const GimpCoords *coord) +gimp_path_get_distance (GimpPath *path, + const GimpCoords *coord) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), 0.0); + g_return_val_if_fail (GIMP_IS_PATH (path), 0.0); - return GIMP_PATH_GET_CLASS (vectors)->get_distance (vectors, coord); + return GIMP_PATH_GET_CLASS (path)->get_distance (path, coord); } static gdouble -gimp_vectors_real_get_distance (GimpPath *vectors, - const GimpCoords *coord) +gimp_path_real_get_distance (GimpPath *path, + const GimpCoords *coord) { - g_printerr ("gimp_vectors_get_distance: default implementation\n"); + g_printerr ("gimp_path_get_distance: default implementation\n"); return 0; } gint -gimp_vectors_interpolate (GimpPath *vectors, - GimpStroke *stroke, - gdouble precision, - gint max_points, - GimpCoords *ret_coords) +gimp_path_interpolate (GimpPath *path, + GimpStroke *stroke, + gdouble precision, + gint max_points, + GimpCoords *ret_coords) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), 0); + g_return_val_if_fail (GIMP_IS_PATH (path), 0); - return GIMP_PATH_GET_CLASS (vectors)->interpolate (vectors, stroke, - precision, max_points, - ret_coords); + return GIMP_PATH_GET_CLASS (path)->interpolate (path, stroke, + precision, max_points, + ret_coords); } static gint -gimp_vectors_real_interpolate (GimpPath *vectors, - GimpStroke *stroke, - gdouble precision, - gint max_points, - GimpCoords *ret_coords) +gimp_path_real_interpolate (GimpPath *path, + GimpStroke *stroke, + gdouble precision, + gint max_points, + GimpCoords *ret_coords) { - g_printerr ("gimp_vectors_interpolate: default implementation\n"); + g_printerr ("gimp_path_interpolate: default implementation\n"); return 0; } const GimpBezierDesc * -gimp_vectors_get_bezier (GimpPath *vectors) +gimp_path_get_bezier (GimpPath *path) { - g_return_val_if_fail (GIMP_IS_PATH (vectors), NULL); + g_return_val_if_fail (GIMP_IS_PATH (path), NULL); - if (! vectors->bezier_desc) + if (! path->bezier_desc) { - vectors->bezier_desc = gimp_vectors_make_bezier (vectors); + path->bezier_desc = gimp_path_make_bezier (path); } - return vectors->bezier_desc; + return path->bezier_desc; } static GimpBezierDesc * -gimp_vectors_make_bezier (GimpPath *vectors) +gimp_path_make_bezier (GimpPath *path) { - return GIMP_PATH_GET_CLASS (vectors)->make_bezier (vectors); + return GIMP_PATH_GET_CLASS (path)->make_bezier (path); } static GimpBezierDesc * -gimp_vectors_real_make_bezier (GimpPath *vectors) +gimp_path_real_make_bezier (GimpPath *path) { GimpStroke *stroke; GArray *cmd_array; @@ -1228,9 +1228,9 @@ gimp_vectors_real_make_bezier (GimpPath *vectors) cmd_array = g_array_new (FALSE, FALSE, sizeof (cairo_path_data_t)); - for (stroke = gimp_vectors_stroke_get_next (vectors, NULL); + for (stroke = gimp_path_stroke_get_next (path, NULL); stroke; - stroke = gimp_vectors_stroke_get_next (vectors, stroke)) + stroke = gimp_path_stroke_get_next (path, stroke)) { GimpBezierDesc *bezdesc = gimp_stroke_make_bezier (stroke); diff --git a/app/vectors/gimppath.h b/app/vectors/gimppath.h index cafea618ee..c4b7f26c75 100644 --- a/app/vectors/gimppath.h +++ b/app/vectors/gimppath.h @@ -95,47 +95,47 @@ struct _GimpPathClass GType gimp_path_get_type (void) G_GNUC_CONST; -GimpPath * gimp_vectors_new (GimpImage *image, - const gchar *name); +GimpPath * gimp_path_new (GimpImage *image, + const gchar *name); -GimpPath * gimp_vectors_get_parent (GimpPath *path); +GimpPath * gimp_path_get_parent (GimpPath *path); -void gimp_vectors_freeze (GimpPath *path); -void gimp_vectors_thaw (GimpPath *path); +void gimp_path_freeze (GimpPath *path); +void gimp_path_thaw (GimpPath *path); -void gimp_vectors_copy_strokes (GimpPath *src_vectors, - GimpPath *dest_vectors); -void gimp_vectors_add_strokes (GimpPath *src_vectors, - GimpPath *dest_vectors); +void gimp_path_copy_strokes (GimpPath *src_path, + GimpPath *dest_path); +void gimp_path_add_strokes (GimpPath *src_path, + GimpPath *dest_path); /* accessing / modifying the anchors */ -GimpAnchor * gimp_vectors_anchor_get (GimpPath *path, +GimpAnchor * gimp_path_anchor_get (GimpPath *path, const GimpCoords *coord, GimpStroke **ret_stroke); /* prev == NULL: "first" anchor */ -GimpAnchor * gimp_vectors_anchor_get_next (GimpPath *path, +GimpAnchor * gimp_path_anchor_get_next (GimpPath *path, const GimpAnchor *prev); /* type will be an xorable enum: * VECTORS_NONE, VECTORS_FIX_ANGLE, VECTORS_FIX_RATIO, VECTORS_RESTRICT_ANGLE * or so. */ -void gimp_vectors_anchor_move_relative (GimpPath *path, +void gimp_path_anchor_move_relative (GimpPath *path, GimpAnchor *anchor, const GimpCoords *deltacoord, gint type); -void gimp_vectors_anchor_move_absolute (GimpPath *path, +void gimp_path_anchor_move_absolute (GimpPath *path, GimpAnchor *anchor, const GimpCoords *coord, gint type); -void gimp_vectors_anchor_delete (GimpPath *path, +void gimp_path_anchor_delete (GimpPath *path, GimpAnchor *anchor); -void gimp_vectors_anchor_select (GimpPath *path, +void gimp_path_anchor_select (GimpPath *path, GimpStroke *target_stroke, GimpAnchor *anchor, gboolean selected, @@ -144,32 +144,32 @@ void gimp_vectors_anchor_select (GimpPath *path, /* GimpStroke is a connected component of a GimpPath object */ -void gimp_vectors_stroke_add (GimpPath *path, +void gimp_path_stroke_add (GimpPath *path, GimpStroke *stroke); -void gimp_vectors_stroke_remove (GimpPath *path, +void gimp_path_stroke_remove (GimpPath *path, GimpStroke *stroke); -gint gimp_vectors_get_n_strokes (GimpPath *path); -GimpStroke * gimp_vectors_stroke_get (GimpPath *path, +gint gimp_path_get_n_strokes (GimpPath *path); +GimpStroke * gimp_path_stroke_get (GimpPath *path, const GimpCoords *coord); -GimpStroke * gimp_vectors_stroke_get_by_id (GimpPath *path, +GimpStroke * gimp_path_stroke_get_by_id (GimpPath *path, gint id); /* prev == NULL: "first" stroke */ -GimpStroke * gimp_vectors_stroke_get_next (GimpPath *path, +GimpStroke * gimp_path_stroke_get_next (GimpPath *path, GimpStroke *prev); -gdouble gimp_vectors_stroke_get_length (GimpPath *path, +gdouble gimp_path_stroke_get_length (GimpPath *path, GimpStroke *stroke); /* accessing the shape of the curve */ -gdouble gimp_vectors_get_length (GimpPath *path, +gdouble gimp_path_get_length (GimpPath *path, const GimpAnchor *start); -gdouble gimp_vectors_get_distance (GimpPath *path, +gdouble gimp_path_get_distance (GimpPath *path, const GimpCoords *coord); /* returns the number of valid coordinates */ -gint gimp_vectors_interpolate (GimpPath *path, +gint gimp_path_interpolate (GimpPath *path, GimpStroke *stroke, gdouble precision, gint max_points, @@ -178,7 +178,7 @@ gint gimp_vectors_interpolate (GimpPath *path, /* usually overloaded */ /* returns a bezier representation */ -const GimpBezierDesc * gimp_vectors_get_bezier (GimpPath *path); +const GimpBezierDesc * gimp_path_get_bezier (GimpPath *path); -#endif /* __GIMP_VECTORS_H__ */ +#endif /* __GIMP_PATH_H__ */ diff --git a/app/vectors/gimppathmodundo.c b/app/vectors/gimppathmodundo.c new file mode 100644 index 0000000000..933f2a78d4 --- /dev/null +++ b/app/vectors/gimppathmodundo.c @@ -0,0 +1,141 @@ +/* GIMP - The GNU 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 3 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, see . + */ + +#include "config.h" + +#include +#include + +#include "vectors-types.h" + +#include "gimppath.h" +#include "gimppathmodundo.h" + + +static void gimp_path_mod_undo_constructed (GObject *object); + +static gint64 gimp_path_mod_undo_get_memsize (GimpObject *object, + gint64 *gui_size); + +static void gimp_path_mod_undo_pop (GimpUndo *undo, + GimpUndoMode undo_mode, + GimpUndoAccumulator *accum); +static void gimp_path_mod_undo_free (GimpUndo *undo, + GimpUndoMode undo_mode); + + +G_DEFINE_TYPE (GimpPathModUndo, gimp_path_mod_undo, GIMP_TYPE_ITEM_UNDO) + +#define parent_class gimp_path_mod_undo_parent_class + + +static void +gimp_path_mod_undo_class_init (GimpPathModUndoClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass); + GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass); + + object_class->constructed = gimp_path_mod_undo_constructed; + + gimp_object_class->get_memsize = gimp_path_mod_undo_get_memsize; + + undo_class->pop = gimp_path_mod_undo_pop; + undo_class->free = gimp_path_mod_undo_free; +} + +static void +gimp_path_mod_undo_init (GimpPathModUndo *undo) +{ +} + +static void +gimp_path_mod_undo_constructed (GObject *object) +{ + GimpPathModUndo *path_mod_undo = GIMP_PATH_MOD_UNDO (object); + GimpPath *path; + + G_OBJECT_CLASS (parent_class)->constructed (object); + + gimp_assert (GIMP_IS_PATH (GIMP_ITEM_UNDO (object)->item)); + + path = GIMP_PATH (GIMP_ITEM_UNDO (object)->item); + + path_mod_undo->path = + GIMP_PATH (gimp_item_duplicate (GIMP_ITEM (path), + G_TYPE_FROM_INSTANCE (path))); +} + +static gint64 +gimp_path_mod_undo_get_memsize (GimpObject *object, + gint64 *gui_size) +{ + GimpPathModUndo *path_mod_undo = GIMP_PATH_MOD_UNDO (object); + gint64 memsize = 0; + + memsize += gimp_object_get_memsize (GIMP_OBJECT (path_mod_undo->path), + gui_size); + + return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, + gui_size); +} + +static void +gimp_path_mod_undo_pop (GimpUndo *undo, + GimpUndoMode undo_mode, + GimpUndoAccumulator *accum) +{ + GimpPathModUndo *path_mod_undo = GIMP_PATH_MOD_UNDO (undo); + GimpPath *path = GIMP_PATH (GIMP_ITEM_UNDO (undo)->item); + GimpPath *temp; + gint offset_x; + gint offset_y; + + GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum); + + temp = path_mod_undo->path; + + path_mod_undo->path = + GIMP_PATH (gimp_item_duplicate (GIMP_ITEM (path), + G_TYPE_FROM_INSTANCE (path))); + + gimp_path_freeze (path); + + gimp_path_copy_strokes (temp, path); + + gimp_item_get_offset (GIMP_ITEM (temp), &offset_x, &offset_y); + gimp_item_set_offset (GIMP_ITEM (path), offset_x, offset_y); + + gimp_item_set_size (GIMP_ITEM (path), + gimp_item_get_width (GIMP_ITEM (temp)), + gimp_item_get_height (GIMP_ITEM (temp))); + + g_object_unref (temp); + + gimp_path_thaw (path); +} + +static void +gimp_path_mod_undo_free (GimpUndo *undo, + GimpUndoMode undo_mode) +{ + GimpPathModUndo *path_mod_undo = GIMP_PATH_MOD_UNDO (undo); + + g_clear_object (&path_mod_undo->path); + + GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode); +} diff --git a/app/vectors/gimppathmodundo.h b/app/vectors/gimppathmodundo.h new file mode 100644 index 0000000000..9e31d77549 --- /dev/null +++ b/app/vectors/gimppathmodundo.h @@ -0,0 +1,52 @@ +/* GIMP - The GNU 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 3 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, see . + */ + +#ifndef __GIMP_PATH_MOD_UNDO_H__ +#define __GIMP_PATH_MOD_UNDO_H__ + + +#include "core/gimpitemundo.h" + + +#define GIMP_TYPE_PATH_MOD_UNDO (gimp_path_mod_undo_get_type ()) +#define GIMP_PATH_MOD_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PATH_MOD_UNDO, GimpPathModUndo)) +#define GIMP_PATH_MOD_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATH_MOD_UNDO, GimpPathModUndoClass)) +#define GIMP_IS_PATH_MOD_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PATH_MOD_UNDO)) +#define GIMP_IS_PATH_MOD_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATH_MOD_UNDO)) +#define GIMP_PATH_MOD_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PATH_MOD_UNDO, GimpPathModUndoClass)) + + +typedef struct _GimpPathModUndo GimpPathModUndo; +typedef struct _GimpPathModUndoClass GimpPathModUndoClass; + +struct _GimpPathModUndo +{ + GimpItemUndo parent_instance; + + GimpPath *path; +}; + +struct _GimpPathModUndoClass +{ + GimpItemUndoClass parent_class; +}; + + +GType gimp_path_mod_undo_get_type (void) G_GNUC_CONST; + + +#endif /* __GIMP_PATH_MOD_UNDO_H__ */ diff --git a/app/vectors/gimpvectorspropundo.c b/app/vectors/gimppathpropundo.c similarity index 55% rename from app/vectors/gimpvectorspropundo.c rename to app/vectors/gimppathpropundo.c index 69527eb7f9..694ab79ec0 100644 --- a/app/vectors/gimpvectorspropundo.c +++ b/app/vectors/gimppathpropundo.c @@ -25,47 +25,47 @@ #include "core/gimpimage.h" #include "gimppath.h" -#include "gimpvectorspropundo.h" +#include "gimppathpropundo.h" -static void gimp_vectors_prop_undo_constructed (GObject *object); +static void gimp_path_prop_undo_constructed (GObject *object); -static void gimp_vectors_prop_undo_pop (GimpUndo *undo, - GimpUndoMode undo_mode, - GimpUndoAccumulator *accum); +static void gimp_path_prop_undo_pop (GimpUndo *undo, + GimpUndoMode undo_mode, + GimpUndoAccumulator *accum); -G_DEFINE_TYPE (GimpVectorsPropUndo, gimp_vectors_prop_undo, GIMP_TYPE_ITEM_UNDO) +G_DEFINE_TYPE (GimpPathPropUndo, gimp_path_prop_undo, GIMP_TYPE_ITEM_UNDO) -#define parent_class gimp_vectors_prop_undo_parent_class +#define parent_class gimp_path_prop_undo_parent_class static void -gimp_vectors_prop_undo_class_init (GimpVectorsPropUndoClass *klass) +gimp_path_prop_undo_class_init (GimpPathPropUndoClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass); - object_class->constructed = gimp_vectors_prop_undo_constructed; + object_class->constructed = gimp_path_prop_undo_constructed; - undo_class->pop = gimp_vectors_prop_undo_pop; + undo_class->pop = gimp_path_prop_undo_pop; } static void -gimp_vectors_prop_undo_init (GimpVectorsPropUndo *undo) +gimp_path_prop_undo_init (GimpPathPropUndo *undo) { } static void -gimp_vectors_prop_undo_constructed (GObject *object) +gimp_path_prop_undo_constructed (GObject *object) { - /* GimpVectors *vectors; */ + /* GimpPath *path; */ G_OBJECT_CLASS (parent_class)->constructed (object); gimp_assert (GIMP_IS_PATH (GIMP_ITEM_UNDO (object)->item)); - /* vectors = GIMP_PATH (GIMP_ITEM_UNDO (object)->item); */ + /* path = GIMP_PATH (GIMP_ITEM_UNDO (object)->item); */ switch (GIMP_UNDO (object)->undo_type) { @@ -75,13 +75,13 @@ gimp_vectors_prop_undo_constructed (GObject *object) } static void -gimp_vectors_prop_undo_pop (GimpUndo *undo, - GimpUndoMode undo_mode, - GimpUndoAccumulator *accum) +gimp_path_prop_undo_pop (GimpUndo *undo, + GimpUndoMode undo_mode, + GimpUndoAccumulator *accum) { #if 0 - GimpVectorsPropUndo *vectors_prop_undo = GIMP_VECTORS_PROP_UNDO (undo); - GimpPath *vectors = GIMP_PATH (GIMP_ITEM_UNDO (undo)->item); + GimpPathPropUndo *path_prop_undo = GIMP_PATH_PROP_UNDO (undo); + GimpPath *path = GIMP_PATH (GIMP_ITEM_UNDO (undo)->item); #endif GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum); diff --git a/app/vectors/gimppathpropundo.h b/app/vectors/gimppathpropundo.h new file mode 100644 index 0000000000..b3432a8eec --- /dev/null +++ b/app/vectors/gimppathpropundo.h @@ -0,0 +1,50 @@ +/* GIMP - The GNU 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 3 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, see . + */ + +#ifndef __GIMP_PATH_PROP_UNDO_H__ +#define __GIMP_PATH_PROP_UNDO_H__ + + +#include "core/gimpitemundo.h" + + +#define GIMP_TYPE_PATH_PROP_UNDO (gimp_path_prop_undo_get_type ()) +#define GIMP_PATH_PROP_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PATH_PROP_UNDO, GimpPathPropUndo)) +#define GIMP_PATH_PROP_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATH_PROP_UNDO, GimpPathPropUndoClass)) +#define GIMP_IS_PATH_PROP_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PATH_PROP_UNDO)) +#define GIMP_IS_PATH_PROP_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATH_PROP_UNDO)) +#define GIMP_PATH_PROP_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PATH_PROP_UNDO, GimpPathPropUndoClass)) + + +typedef struct _GimpPathPropUndo GimpPathPropUndo; +typedef struct _GimpPathPropUndoClass GimpPathPropUndoClass; + +struct _GimpPathPropUndo +{ + GimpItemUndo parent_instance; +}; + +struct _GimpPathPropUndoClass +{ + GimpItemUndoClass parent_class; +}; + + +GType gimp_path_prop_undo_get_type (void) G_GNUC_CONST; + + +#endif /* __GIMP_PATH_PROP_UNDO_H__ */ diff --git a/app/vectors/gimppathundo.c b/app/vectors/gimppathundo.c new file mode 100644 index 0000000000..5549384964 --- /dev/null +++ b/app/vectors/gimppathundo.c @@ -0,0 +1,228 @@ +/* GIMP - The GNU 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 3 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, see . + */ + +#include "config.h" + +#include +#include + +#include "vectors-types.h" + +#include "libgimpbase/gimpbase.h" + +#include "core/gimpimage.h" + +#include "gimppath.h" +#include "gimppathundo.h" + + +enum +{ + PROP_0, + PROP_PREV_PARENT, + PROP_PREV_POSITION, + PROP_PREV_PATHS +}; + + +static void gimp_path_undo_constructed (GObject *object); +static void gimp_path_undo_finalize (GObject *object); +static void gimp_path_undo_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_path_undo_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); + +static gint64 gimp_path_undo_get_memsize (GimpObject *object, + gint64 *gui_size); + +static void gimp_path_undo_pop (GimpUndo *undo, + GimpUndoMode undo_mode, + GimpUndoAccumulator *accum); + + +G_DEFINE_TYPE (GimpPathUndo, gimp_path_undo, GIMP_TYPE_ITEM_UNDO) + +#define parent_class gimp_path_undo_parent_class + + +static void +gimp_path_undo_class_init (GimpPathUndoClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass); + GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass); + + object_class->constructed = gimp_path_undo_constructed; + object_class->finalize = gimp_path_undo_finalize; + object_class->set_property = gimp_path_undo_set_property; + object_class->get_property = gimp_path_undo_get_property; + + gimp_object_class->get_memsize = gimp_path_undo_get_memsize; + + undo_class->pop = gimp_path_undo_pop; + + g_object_class_install_property (object_class, PROP_PREV_PARENT, + g_param_spec_object ("prev-parent", + NULL, NULL, + GIMP_TYPE_PATH, + GIMP_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, PROP_PREV_POSITION, + g_param_spec_int ("prev-position", NULL, NULL, + 0, G_MAXINT, 0, + GIMP_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, PROP_PREV_PATHS, + g_param_spec_pointer ("prev-paths", NULL, NULL, + GIMP_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); +} + +static void +gimp_path_undo_init (GimpPathUndo *undo) +{ + undo->prev_paths = NULL; +} + +static void +gimp_path_undo_constructed (GObject *object) +{ + G_OBJECT_CLASS (parent_class)->constructed (object); + + gimp_assert (GIMP_IS_PATH (GIMP_ITEM_UNDO (object)->item)); +} + +static void +gimp_path_undo_finalize (GObject *object) +{ + GimpPathUndo *undo = GIMP_PATH_UNDO (object); + + g_clear_pointer (&undo->prev_paths, g_list_free); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +gimp_path_undo_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GimpPathUndo *path_undo = GIMP_PATH_UNDO (object); + + switch (property_id) + { + case PROP_PREV_PARENT: + path_undo->prev_parent = g_value_get_object (value); + break; + case PROP_PREV_POSITION: + path_undo->prev_position = g_value_get_int (value); + break; + case PROP_PREV_PATHS: + path_undo->prev_paths = g_list_copy (g_value_get_pointer (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gimp_path_undo_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GimpPathUndo *path_undo = GIMP_PATH_UNDO (object); + + switch (property_id) + { + case PROP_PREV_PARENT: + g_value_set_object (value, path_undo->prev_parent); + break; + case PROP_PREV_POSITION: + g_value_set_int (value, path_undo->prev_position); + break; + case PROP_PREV_PATHS: + g_value_set_pointer (value, path_undo->prev_paths); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static gint64 +gimp_path_undo_get_memsize (GimpObject *object, + gint64 *gui_size) +{ + GimpItemUndo *item_undo = GIMP_ITEM_UNDO (object); + gint64 memsize = 0; + + if (! gimp_item_is_attached (item_undo->item)) + memsize += gimp_object_get_memsize (GIMP_OBJECT (item_undo->item), + gui_size); + + return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, + gui_size); +} + +static void +gimp_path_undo_pop (GimpUndo *undo, + GimpUndoMode undo_mode, + GimpUndoAccumulator *accum) +{ + GimpPathUndo *path_undo = GIMP_PATH_UNDO (undo); + GimpPath *path = GIMP_PATH (GIMP_ITEM_UNDO (undo)->item); + + GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum); + + if ((undo_mode == GIMP_UNDO_MODE_UNDO && + undo->undo_type == GIMP_UNDO_PATH_ADD) || + (undo_mode == GIMP_UNDO_MODE_REDO && + undo->undo_type == GIMP_UNDO_PATH_REMOVE)) + { + /* remove path */ + + /* record the current parent and position */ + path_undo->prev_parent = gimp_path_get_parent (path); + path_undo->prev_position = gimp_item_get_index (GIMP_ITEM (path)); + + gimp_image_remove_path (undo->image, path, FALSE, + path_undo->prev_paths); + } + else + { + /* restore path */ + + /* record the active path */ + g_clear_pointer (&path_undo->prev_paths, g_list_free); + path_undo->prev_paths = g_list_copy (gimp_image_get_selected_paths (undo->image)); + + gimp_image_add_path (undo->image, path, + path_undo->prev_parent, + path_undo->prev_position, FALSE); + } +} diff --git a/app/vectors/gimppathundo.h b/app/vectors/gimppathundo.h new file mode 100644 index 0000000000..2090c477c6 --- /dev/null +++ b/app/vectors/gimppathundo.h @@ -0,0 +1,54 @@ +/* GIMP - The GNU 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 3 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, see . + */ + +#ifndef __GIMP_PATH_UNDO_H__ +#define __GIMP_PATH_UNDO_H__ + + +#include "core/gimpitemundo.h" + + +#define GIMP_TYPE_PATH_UNDO (gimp_path_undo_get_type ()) +#define GIMP_PATH_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PATH_UNDO, GimpPathUndo)) +#define GIMP_PATH_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATH_UNDO, GimpPathUndoClass)) +#define GIMP_IS_PATH_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PATH_UNDO)) +#define GIMP_IS_PATH_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATH_UNDO)) +#define GIMP_PATH_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PATH_UNDO, GimpPathUndoClass)) + + +typedef struct _GimpPathUndo GimpPathUndo; +typedef struct _GimpPathUndoClass GimpPathUndoClass; + +struct _GimpPathUndo +{ + GimpItemUndo parent_instance; + + GimpPath *prev_parent; + gint prev_position; /* former position in list */ + GList *prev_paths; /* previous selected path */ +}; + +struct _GimpPathUndoClass +{ + GimpItemUndoClass parent_class; +}; + + +GType gimp_path_undo_get_type (void) G_GNUC_CONST; + + +#endif /* __GIMP_PATH_UNDO_H__ */ diff --git a/app/vectors/gimpvectors-compat.h b/app/vectors/gimpvectors-compat.h deleted file mode 100644 index f14e6c38a5..0000000000 --- a/app/vectors/gimpvectors-compat.h +++ /dev/null @@ -1,48 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpvectors-compat.h - * Copyright (C) 2003 Michael Natterer - * - * 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 3 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, see . - */ - -#ifndef __GIMP_VECTORS_COMPAT_H__ -#define __GIMP_VECTORS_COMPAT_H__ - - -typedef struct _GimpVectorsCompatPoint GimpVectorsCompatPoint; - -struct _GimpVectorsCompatPoint -{ - guint32 type; - gdouble x; - gdouble y; -}; - - -GimpPath * gimp_vectors_compat_new (GimpImage *image, - const gchar *name, - GimpVectorsCompatPoint *points, - gint n_points, - gboolean closed); - -gboolean gimp_vectors_compat_is_compatible (GimpImage *image); - -GimpVectorsCompatPoint * gimp_vectors_compat_get_points (GimpPath *vectors, - gint32 *n_points, - gint32 *closed); - - -#endif /* __GIMP_VECTORS_COMPAT_H__ */ diff --git a/app/vectors/gimpvectors-import.h b/app/vectors/gimpvectors-import.h deleted file mode 100644 index 1c66ae84b3..0000000000 --- a/app/vectors/gimpvectors-import.h +++ /dev/null @@ -1,44 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * GimpVectors Import - * Copyright (C) 2003 Sven Neumann - * - * 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 3 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, see . - */ - -#ifndef __GIMP_VECTORS_IMPORT_H__ -#define __GIMP_VECTORS_IMPORT_H__ - - -gboolean gimp_vectors_import_file (GimpImage *image, - GFile *file, - gboolean merge, - gboolean scale, - GimpPath *parent, - gint position, - GList **ret_vectors, - GError **error); -gboolean gimp_vectors_import_buffer (GimpImage *image, - const gchar *buffer, - gsize len, - gboolean merge, - gboolean scale, - GimpPath *parent, - gint position, - GList **ret_vectors, - GError **error); - - -#endif /* __GIMP_VECTORS_IMPORT_H__ */ diff --git a/app/vectors/gimpvectorsmodundo.c b/app/vectors/gimpvectorsmodundo.c deleted file mode 100644 index 851a06b60a..0000000000 --- a/app/vectors/gimpvectorsmodundo.c +++ /dev/null @@ -1,141 +0,0 @@ -/* GIMP - The GNU 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 3 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, see . - */ - -#include "config.h" - -#include -#include - -#include "vectors-types.h" - -#include "gimppath.h" -#include "gimpvectorsmodundo.h" - - -static void gimp_vectors_mod_undo_constructed (GObject *object); - -static gint64 gimp_vectors_mod_undo_get_memsize (GimpObject *object, - gint64 *gui_size); - -static void gimp_vectors_mod_undo_pop (GimpUndo *undo, - GimpUndoMode undo_mode, - GimpUndoAccumulator *accum); -static void gimp_vectors_mod_undo_free (GimpUndo *undo, - GimpUndoMode undo_mode); - - -G_DEFINE_TYPE (GimpVectorsModUndo, gimp_vectors_mod_undo, GIMP_TYPE_ITEM_UNDO) - -#define parent_class gimp_vectors_mod_undo_parent_class - - -static void -gimp_vectors_mod_undo_class_init (GimpVectorsModUndoClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass); - GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass); - - object_class->constructed = gimp_vectors_mod_undo_constructed; - - gimp_object_class->get_memsize = gimp_vectors_mod_undo_get_memsize; - - undo_class->pop = gimp_vectors_mod_undo_pop; - undo_class->free = gimp_vectors_mod_undo_free; -} - -static void -gimp_vectors_mod_undo_init (GimpVectorsModUndo *undo) -{ -} - -static void -gimp_vectors_mod_undo_constructed (GObject *object) -{ - GimpVectorsModUndo *vectors_mod_undo = GIMP_VECTORS_MOD_UNDO (object); - GimpPath *vectors; - - G_OBJECT_CLASS (parent_class)->constructed (object); - - gimp_assert (GIMP_IS_PATH (GIMP_ITEM_UNDO (object)->item)); - - vectors = GIMP_PATH (GIMP_ITEM_UNDO (object)->item); - - vectors_mod_undo->vectors = - GIMP_PATH (gimp_item_duplicate (GIMP_ITEM (vectors), - G_TYPE_FROM_INSTANCE (vectors))); -} - -static gint64 -gimp_vectors_mod_undo_get_memsize (GimpObject *object, - gint64 *gui_size) -{ - GimpVectorsModUndo *vectors_mod_undo = GIMP_VECTORS_MOD_UNDO (object); - gint64 memsize = 0; - - memsize += gimp_object_get_memsize (GIMP_OBJECT (vectors_mod_undo->vectors), - gui_size); - - return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, - gui_size); -} - -static void -gimp_vectors_mod_undo_pop (GimpUndo *undo, - GimpUndoMode undo_mode, - GimpUndoAccumulator *accum) -{ - GimpVectorsModUndo *vectors_mod_undo = GIMP_VECTORS_MOD_UNDO (undo); - GimpPath *vectors = GIMP_PATH (GIMP_ITEM_UNDO (undo)->item); - GimpPath *temp; - gint offset_x; - gint offset_y; - - GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum); - - temp = vectors_mod_undo->vectors; - - vectors_mod_undo->vectors = - GIMP_PATH (gimp_item_duplicate (GIMP_ITEM (vectors), - G_TYPE_FROM_INSTANCE (vectors))); - - gimp_vectors_freeze (vectors); - - gimp_vectors_copy_strokes (temp, vectors); - - gimp_item_get_offset (GIMP_ITEM (temp), &offset_x, &offset_y); - gimp_item_set_offset (GIMP_ITEM (vectors), offset_x, offset_y); - - gimp_item_set_size (GIMP_ITEM (vectors), - gimp_item_get_width (GIMP_ITEM (temp)), - gimp_item_get_height (GIMP_ITEM (temp))); - - g_object_unref (temp); - - gimp_vectors_thaw (vectors); -} - -static void -gimp_vectors_mod_undo_free (GimpUndo *undo, - GimpUndoMode undo_mode) -{ - GimpVectorsModUndo *vectors_mod_undo = GIMP_VECTORS_MOD_UNDO (undo); - - g_clear_object (&vectors_mod_undo->vectors); - - GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode); -} diff --git a/app/vectors/gimpvectorsmodundo.h b/app/vectors/gimpvectorsmodundo.h deleted file mode 100644 index 16fe21df23..0000000000 --- a/app/vectors/gimpvectorsmodundo.h +++ /dev/null @@ -1,52 +0,0 @@ -/* GIMP - The GNU 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 3 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, see . - */ - -#ifndef __GIMP_VECTORS_MOD_UNDO_H__ -#define __GIMP_VECTORS_MOD_UNDO_H__ - - -#include "core/gimpitemundo.h" - - -#define GIMP_TYPE_VECTORS_MOD_UNDO (gimp_vectors_mod_undo_get_type ()) -#define GIMP_VECTORS_MOD_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS_MOD_UNDO, GimpVectorsModUndo)) -#define GIMP_VECTORS_MOD_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTORS_MOD_UNDO, GimpVectorsModUndoClass)) -#define GIMP_IS_VECTORS_MOD_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS_MOD_UNDO)) -#define GIMP_IS_VECTORS_MOD_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VECTORS_MOD_UNDO)) -#define GIMP_VECTORS_MOD_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VECTORS_MOD_UNDO, GimpVectorsModUndoClass)) - - -typedef struct _GimpVectorsModUndo GimpVectorsModUndo; -typedef struct _GimpVectorsModUndoClass GimpVectorsModUndoClass; - -struct _GimpVectorsModUndo -{ - GimpItemUndo parent_instance; - - GimpPath *vectors; -}; - -struct _GimpVectorsModUndoClass -{ - GimpItemUndoClass parent_class; -}; - - -GType gimp_vectors_mod_undo_get_type (void) G_GNUC_CONST; - - -#endif /* __GIMP_VECTORS_MOD_UNDO_H__ */ diff --git a/app/vectors/gimpvectorspropundo.h b/app/vectors/gimpvectorspropundo.h deleted file mode 100644 index 8909226835..0000000000 --- a/app/vectors/gimpvectorspropundo.h +++ /dev/null @@ -1,50 +0,0 @@ -/* GIMP - The GNU 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 3 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, see . - */ - -#ifndef __GIMP_VECTORS_PROP_UNDO_H__ -#define __GIMP_VECTORS_PROP_UNDO_H__ - - -#include "core/gimpitemundo.h" - - -#define GIMP_TYPE_VECTORS_PROP_UNDO (gimp_vectors_prop_undo_get_type ()) -#define GIMP_VECTORS_PROP_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS_PROP_UNDO, GimpVectorsPropUndo)) -#define GIMP_VECTORS_PROP_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTORS_PROP_UNDO, GimpVectorsPropUndoClass)) -#define GIMP_IS_VECTORS_PROP_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS_PROP_UNDO)) -#define GIMP_IS_VECTORS_PROP_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VECTORS_PROP_UNDO)) -#define GIMP_VECTORS_PROP_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VECTORS_PROP_UNDO, GimpVectorsPropUndoClass)) - - -typedef struct _GimpVectorsPropUndo GimpVectorsPropUndo; -typedef struct _GimpVectorsPropUndoClass GimpVectorsPropUndoClass; - -struct _GimpVectorsPropUndo -{ - GimpItemUndo parent_instance; -}; - -struct _GimpVectorsPropUndoClass -{ - GimpItemUndoClass parent_class; -}; - - -GType gimp_vectors_prop_undo_get_type (void) G_GNUC_CONST; - - -#endif /* __GIMP_VECTORS_PROP_UNDO_H__ */ diff --git a/app/vectors/gimpvectorsundo.c b/app/vectors/gimpvectorsundo.c deleted file mode 100644 index c42a1f6742..0000000000 --- a/app/vectors/gimpvectorsundo.c +++ /dev/null @@ -1,228 +0,0 @@ -/* GIMP - The GNU 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 3 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, see . - */ - -#include "config.h" - -#include -#include - -#include "vectors-types.h" - -#include "libgimpbase/gimpbase.h" - -#include "core/gimpimage.h" - -#include "gimppath.h" -#include "gimpvectorsundo.h" - - -enum -{ - PROP_0, - PROP_PREV_PARENT, - PROP_PREV_POSITION, - PROP_PREV_VECTORS -}; - - -static void gimp_vectors_undo_constructed (GObject *object); -static void gimp_vectors_undo_finalize (GObject *object); -static void gimp_vectors_undo_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_vectors_undo_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); - -static gint64 gimp_vectors_undo_get_memsize (GimpObject *object, - gint64 *gui_size); - -static void gimp_vectors_undo_pop (GimpUndo *undo, - GimpUndoMode undo_mode, - GimpUndoAccumulator *accum); - - -G_DEFINE_TYPE (GimpVectorsUndo, gimp_vectors_undo, GIMP_TYPE_ITEM_UNDO) - -#define parent_class gimp_vectors_undo_parent_class - - -static void -gimp_vectors_undo_class_init (GimpVectorsUndoClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass); - GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass); - - object_class->constructed = gimp_vectors_undo_constructed; - object_class->finalize = gimp_vectors_undo_finalize; - object_class->set_property = gimp_vectors_undo_set_property; - object_class->get_property = gimp_vectors_undo_get_property; - - gimp_object_class->get_memsize = gimp_vectors_undo_get_memsize; - - undo_class->pop = gimp_vectors_undo_pop; - - g_object_class_install_property (object_class, PROP_PREV_PARENT, - g_param_spec_object ("prev-parent", - NULL, NULL, - GIMP_TYPE_PATH, - GIMP_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - - g_object_class_install_property (object_class, PROP_PREV_POSITION, - g_param_spec_int ("prev-position", NULL, NULL, - 0, G_MAXINT, 0, - GIMP_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - - g_object_class_install_property (object_class, PROP_PREV_VECTORS, - g_param_spec_pointer ("prev-vectors", NULL, NULL, - GIMP_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); -} - -static void -gimp_vectors_undo_init (GimpVectorsUndo *undo) -{ - undo->prev_vectors = NULL; -} - -static void -gimp_vectors_undo_constructed (GObject *object) -{ - G_OBJECT_CLASS (parent_class)->constructed (object); - - gimp_assert (GIMP_IS_PATH (GIMP_ITEM_UNDO (object)->item)); -} - -static void -gimp_vectors_undo_finalize (GObject *object) -{ - GimpVectorsUndo *undo = GIMP_VECTORS_UNDO (object); - - g_clear_pointer (&undo->prev_vectors, g_list_free); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gimp_vectors_undo_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - GimpVectorsUndo *vectors_undo = GIMP_VECTORS_UNDO (object); - - switch (property_id) - { - case PROP_PREV_PARENT: - vectors_undo->prev_parent = g_value_get_object (value); - break; - case PROP_PREV_POSITION: - vectors_undo->prev_position = g_value_get_int (value); - break; - case PROP_PREV_VECTORS: - vectors_undo->prev_vectors = g_list_copy (g_value_get_pointer (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -gimp_vectors_undo_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - GimpVectorsUndo *vectors_undo = GIMP_VECTORS_UNDO (object); - - switch (property_id) - { - case PROP_PREV_PARENT: - g_value_set_object (value, vectors_undo->prev_parent); - break; - case PROP_PREV_POSITION: - g_value_set_int (value, vectors_undo->prev_position); - break; - case PROP_PREV_VECTORS: - g_value_set_pointer (value, vectors_undo->prev_vectors); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static gint64 -gimp_vectors_undo_get_memsize (GimpObject *object, - gint64 *gui_size) -{ - GimpItemUndo *item_undo = GIMP_ITEM_UNDO (object); - gint64 memsize = 0; - - if (! gimp_item_is_attached (item_undo->item)) - memsize += gimp_object_get_memsize (GIMP_OBJECT (item_undo->item), - gui_size); - - return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, - gui_size); -} - -static void -gimp_vectors_undo_pop (GimpUndo *undo, - GimpUndoMode undo_mode, - GimpUndoAccumulator *accum) -{ - GimpVectorsUndo *vectors_undo = GIMP_VECTORS_UNDO (undo); - GimpPath *path = GIMP_PATH (GIMP_ITEM_UNDO (undo)->item); - - GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum); - - if ((undo_mode == GIMP_UNDO_MODE_UNDO && - undo->undo_type == GIMP_UNDO_VECTORS_ADD) || - (undo_mode == GIMP_UNDO_MODE_REDO && - undo->undo_type == GIMP_UNDO_VECTORS_REMOVE)) - { - /* remove path */ - - /* record the current parent and position */ - vectors_undo->prev_parent = gimp_vectors_get_parent (path); - vectors_undo->prev_position = gimp_item_get_index (GIMP_ITEM (path)); - - gimp_image_remove_path (undo->image, path, FALSE, - vectors_undo->prev_vectors); - } - else - { - /* restore path */ - - /* record the active path */ - g_clear_pointer (&vectors_undo->prev_vectors, g_list_free); - vectors_undo->prev_vectors = g_list_copy (gimp_image_get_selected_paths (undo->image)); - - gimp_image_add_path (undo->image, path, - vectors_undo->prev_parent, - vectors_undo->prev_position, FALSE); - } -} diff --git a/app/vectors/gimpvectorsundo.h b/app/vectors/gimpvectorsundo.h deleted file mode 100644 index 6113581892..0000000000 --- a/app/vectors/gimpvectorsundo.h +++ /dev/null @@ -1,54 +0,0 @@ -/* GIMP - The GNU 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 3 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, see . - */ - -#ifndef __GIMP_VECTORS_UNDO_H__ -#define __GIMP_VECTORS_UNDO_H__ - - -#include "core/gimpitemundo.h" - - -#define GIMP_TYPE_VECTORS_UNDO (gimp_vectors_undo_get_type ()) -#define GIMP_VECTORS_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS_UNDO, GimpVectorsUndo)) -#define GIMP_VECTORS_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTORS_UNDO, GimpVectorsUndoClass)) -#define GIMP_IS_VECTORS_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS_UNDO)) -#define GIMP_IS_VECTORS_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VECTORS_UNDO)) -#define GIMP_VECTORS_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VECTORS_UNDO, GimpVectorsUndoClass)) - - -typedef struct _GimpVectorsUndo GimpVectorsUndo; -typedef struct _GimpVectorsUndoClass GimpVectorsUndoClass; - -struct _GimpVectorsUndo -{ - GimpItemUndo parent_instance; - - GimpPath *prev_parent; - gint prev_position; /* former position in list */ - GList *prev_vectors; /* previous selected vectors */ -}; - -struct _GimpVectorsUndoClass -{ - GimpItemUndoClass parent_class; -}; - - -GType gimp_vectors_undo_get_type (void) G_GNUC_CONST; - - -#endif /* __GIMP_VECTORS_UNDO_H__ */ diff --git a/app/vectors/meson.build b/app/vectors/meson.build index 05aa729eb8..46cb025d43 100644 --- a/app/vectors/meson.build +++ b/app/vectors/meson.build @@ -2,16 +2,16 @@ libappvectors_sources = [ 'gimpanchor.c', 'gimpbezierstroke.c', 'gimppath.c', + 'gimppath-compat.c', + 'gimppath-export.c', + 'gimppath-import.c', + 'gimppath-preview.c', + 'gimppath-warp.c', + 'gimppathmodundo.c', + 'gimppathpropundo.c', + 'gimppathundo.c', 'gimpstroke-new.c', 'gimpstroke.c', - 'gimpvectors-compat.c', - 'gimpvectors-export.c', - 'gimpvectors-import.c', - 'gimpvectors-preview.c', - 'gimpvectors-warp.c', - 'gimpvectorsmodundo.c', - 'gimpvectorspropundo.c', - 'gimpvectorsundo.c', ] libappvectors = static_library('appvectors', diff --git a/app/widgets/gimpdnd.h b/app/widgets/gimpdnd.h index d4735e2a99..94f2c0d2a7 100644 --- a/app/widgets/gimpdnd.h +++ b/app/widgets/gimpdnd.h @@ -62,7 +62,7 @@ { "application/x-gimp-layer-mask-id", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_LAYER_MASK } #define GIMP_TARGET_PATH \ - { "application/x-gimp-vectors-id", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_VECTORS } + { "application/x-gimp-path-id", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_VECTORS } #define GIMP_TARGET_BRUSH \ { "application/x-gimp-brush-name", 0, GIMP_DND_TYPE_BRUSH } diff --git a/app/widgets/gimpvectorstreeview.c b/app/widgets/gimppathtreeview.c similarity index 72% rename from app/widgets/gimpvectorstreeview.c rename to app/widgets/gimppathtreeview.c index 6f75e69ec0..9903c84ff2 100644 --- a/app/widgets/gimpvectorstreeview.c +++ b/app/widgets/gimppathtreeview.c @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * gimpvectorstreeview.c + * gimppathstreeview.c * Copyright (C) 2001-2009 Michael Natterer * * This program is free software: you can redistribute it and/or modify @@ -35,57 +35,57 @@ #include "core/gimpimage.h" #include "vectors/gimppath.h" -#include "vectors/gimpvectors-export.h" -#include "vectors/gimpvectors-import.h" +#include "vectors/gimppath-export.h" +#include "vectors/gimppath-import.h" #include "gimpactiongroup.h" #include "gimpcontainerview.h" #include "gimpdnd.h" #include "gimphelp-ids.h" #include "gimpuimanager.h" -#include "gimpvectorstreeview.h" +#include "gimppathtreeview.h" #include "gimpwidgets-utils.h" #include "gimp-intl.h" -static void gimp_vectors_tree_view_view_iface_init (GimpContainerViewInterface *iface); +static void gimp_path_tree_view_view_iface_init (GimpContainerViewInterface *iface); -static void gimp_vectors_tree_view_constructed (GObject *object); +static void gimp_path_tree_view_constructed (GObject *object); -static void gimp_vectors_tree_view_set_container (GimpContainerView *view, - GimpContainer *container); -static void gimp_vectors_tree_view_drop_svg (GimpContainerTreeView *tree_view, - const gchar *svg_data, - gsize svg_data_len, - GimpViewable *dest_viewable, - GtkTreeViewDropPosition drop_pos); -static GimpItem * gimp_vectors_tree_view_item_new (GimpImage *image); -static guchar * gimp_vectors_tree_view_drag_svg (GtkWidget *widget, - gsize *svg_data_len, - gpointer data); +static void gimp_path_tree_view_set_container (GimpContainerView *view, + GimpContainer *container); +static void gimp_path_tree_view_drop_svg (GimpContainerTreeView *tree_view, + const gchar *svg_data, + gsize svg_data_len, + GimpViewable *dest_viewable, + GtkTreeViewDropPosition drop_pos); +static GimpItem * gimp_path_tree_view_item_new (GimpImage *image); +static guchar * gimp_path_tree_view_drag_svg (GtkWidget *widget, + gsize *svg_data_len, + gpointer data); -G_DEFINE_TYPE_WITH_CODE (GimpVectorsTreeView, gimp_vectors_tree_view, +G_DEFINE_TYPE_WITH_CODE (GimpPathTreeView, gimp_path_tree_view, GIMP_TYPE_ITEM_TREE_VIEW, G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, - gimp_vectors_tree_view_view_iface_init)) + gimp_path_tree_view_view_iface_init)) -#define parent_class gimp_vectors_tree_view_parent_class +#define parent_class gimp_path_tree_view_parent_class static GimpContainerViewInterface *parent_view_iface = NULL; static void -gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass) +gimp_path_tree_view_class_init (GimpPathTreeViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpContainerTreeViewClass *view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass); GimpItemTreeViewClass *iv_class = GIMP_ITEM_TREE_VIEW_CLASS (klass); - object_class->constructed = gimp_vectors_tree_view_constructed; + object_class->constructed = gimp_path_tree_view_constructed; - view_class->drop_svg = gimp_vectors_tree_view_drop_svg; + view_class->drop_svg = gimp_path_tree_view_drop_svg; iv_class->item_type = GIMP_TYPE_PATH; iv_class->signal_name = "selected-paths-changed"; @@ -95,7 +95,7 @@ gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass) iv_class->set_selected_items = (GimpSetItemsFunc) gimp_image_set_selected_paths; iv_class->add_item = (GimpAddItemFunc) gimp_image_add_path; iv_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_path; - iv_class->new_item = gimp_vectors_tree_view_item_new; + iv_class->new_item = gimp_path_tree_view_item_new; iv_class->action_group = "vectors"; iv_class->activate_action = "vectors-edit"; @@ -116,24 +116,24 @@ gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass) } static void -gimp_vectors_tree_view_view_iface_init (GimpContainerViewInterface *iface) +gimp_path_tree_view_view_iface_init (GimpContainerViewInterface *iface) { parent_view_iface = g_type_interface_peek_parent (iface); - iface->set_container = gimp_vectors_tree_view_set_container; + iface->set_container = gimp_path_tree_view_set_container; } static void -gimp_vectors_tree_view_init (GimpVectorsTreeView *view) +gimp_path_tree_view_init (GimpPathTreeView *view) { } static void -gimp_vectors_tree_view_constructed (GObject *object) +gimp_path_tree_view_constructed (GObject *object) { GimpEditor *editor = GIMP_EDITOR (object); GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (object); - GimpVectorsTreeView *view = GIMP_VECTORS_TREE_VIEW (object); + GimpPathTreeView *view = GIMP_PATH_TREE_VIEW (object); GdkModifierType extend_mask; GdkModifierType modify_mask; @@ -185,8 +185,8 @@ gimp_vectors_tree_view_constructed (GObject *object) } static void -gimp_vectors_tree_view_set_container (GimpContainerView *view, - GimpContainer *container) +gimp_path_tree_view_set_container (GimpContainerView *view, + GimpContainer *container) { GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view); GimpContainer *old_container; @@ -203,17 +203,17 @@ gimp_vectors_tree_view_set_container (GimpContainerView *view, if (! old_container && container) { gimp_dnd_svg_source_add (GTK_WIDGET (tree_view->view), - gimp_vectors_tree_view_drag_svg, + gimp_path_tree_view_drag_svg, tree_view); } } static void -gimp_vectors_tree_view_drop_svg (GimpContainerTreeView *tree_view, - const gchar *svg_data, - gsize svg_data_len, - GimpViewable *dest_viewable, - GtkTreeViewDropPosition drop_pos) +gimp_path_tree_view_drop_svg (GimpContainerTreeView *tree_view, + const gchar *svg_data, + gsize svg_data_len, + GimpViewable *dest_viewable, + GtkTreeViewDropPosition drop_pos) { GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (tree_view); GimpImage *image = gimp_item_tree_view_get_image (item_view); @@ -228,8 +228,8 @@ gimp_vectors_tree_view_drop_svg (GimpContainerTreeView *tree_view, drop_pos, (GimpViewable **) &parent); - if (! gimp_vectors_import_buffer (image, svg_data, svg_data_len, - TRUE, FALSE, parent, index, NULL, &error)) + if (! gimp_path_import_buffer (image, svg_data, svg_data_len, + TRUE, FALSE, parent, index, NULL, &error)) { gimp_message_literal (image->gimp, G_OBJECT (tree_view), GIMP_MESSAGE_ERROR, @@ -243,11 +243,11 @@ gimp_vectors_tree_view_drop_svg (GimpContainerTreeView *tree_view, } static GimpItem * -gimp_vectors_tree_view_item_new (GimpImage *image) +gimp_path_tree_view_item_new (GimpImage *image) { GimpPath *new_path; - new_path = gimp_vectors_new (image, _("Path")); + new_path = gimp_path_new (image, _("Path")); gimp_image_add_path (image, new_path, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE); @@ -256,9 +256,9 @@ gimp_vectors_tree_view_item_new (GimpImage *image) } static guchar * -gimp_vectors_tree_view_drag_svg (GtkWidget *widget, - gsize *svg_data_len, - gpointer data) +gimp_path_tree_view_drag_svg (GtkWidget *widget, + gsize *svg_data_len, + gpointer data) { GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (data); GimpImage *image = gimp_item_tree_view_get_image (view); @@ -271,7 +271,7 @@ gimp_vectors_tree_view_drag_svg (GtkWidget *widget, if (items) { - svg_data = gimp_vectors_export_string (image, items); + svg_data = gimp_path_export_string (image, items); if (svg_data) *svg_data_len = strlen (svg_data); diff --git a/app/widgets/gimpvectorstreeview.h b/app/widgets/gimppathtreeview.h similarity index 50% rename from app/widgets/gimpvectorstreeview.h rename to app/widgets/gimppathtreeview.h index 1eb5cb9a86..c62771da7d 100644 --- a/app/widgets/gimpvectorstreeview.h +++ b/app/widgets/gimppathtreeview.h @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * gimpvectorstreeview.h + * gimppathtreeview.h * Copyright (C) 2001-2003 Michael Natterer * * This program is free software: you can redistribute it and/or modify @@ -18,24 +18,24 @@ * along with this program. If not, see . */ -#ifndef __GIMP_VECTORS_TREE_VIEW_H__ -#define __GIMP_VECTORS_TREE_VIEW_H__ +#ifndef __GIMP_PATH_TREE_VIEW_H__ +#define __GIMP_PATH_TREE_VIEW_H__ #include "gimpitemtreeview.h" -#define GIMP_TYPE_VECTORS_TREE_VIEW (gimp_vectors_tree_view_get_type ()) -#define GIMP_VECTORS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS_TREE_VIEW, GimpVectorsTreeView)) -#define GIMP_VECTORS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTORS_TREE_VIEW, GimpVectorsTreeViewClass)) -#define GIMP_IS_VECTORS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS_TREE_VIEW)) -#define GIMP_IS_VECTORS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VECTORS_TREE_VIEW)) -#define GIMP_VECTORS_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VECTORS_TREE_VIEW, GimpVectorsTreeViewClass)) +#define GIMP_TYPE_PATH_TREE_VIEW (gimp_path_tree_view_get_type ()) +#define GIMP_PATH_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PATH_TREE_VIEW, GimpPathTreeView)) +#define GIMP_PATH_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATH_TREE_VIEW, GimpPathTreeViewClass)) +#define GIMP_IS_PATH_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PATH_TREE_VIEW)) +#define GIMP_IS_PATH_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATH_TREE_VIEW)) +#define GIMP_PATH_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PATH_TREE_VIEW, GimpPathTreeViewClass)) -typedef struct _GimpVectorsTreeViewClass GimpVectorsTreeViewClass; +typedef struct _GimpPathTreeViewClass GimpPathTreeViewClass; -struct _GimpVectorsTreeView +struct _GimpPathTreeView { GimpItemTreeView parent_instance; @@ -44,13 +44,13 @@ struct _GimpVectorsTreeView GtkWidget *stroke_button; }; -struct _GimpVectorsTreeViewClass +struct _GimpPathTreeViewClass { GimpItemTreeViewClass parent_class; }; -GType gimp_vectors_tree_view_get_type (void) G_GNUC_CONST; +GType gimp_path_tree_view_get_type (void) G_GNUC_CONST; -#endif /* __GIMP_VECTORS_TREE_VIEW_H__ */ +#endif /* __GIMP_PATH_TREE_VIEW_H__ */ diff --git a/app/widgets/gimpviewrenderer-utils.c b/app/widgets/gimpviewrenderer-utils.c index a0cb0cc7c7..87f7ea7967 100644 --- a/app/widgets/gimpviewrenderer-utils.c +++ b/app/widgets/gimpviewrenderer-utils.c @@ -45,7 +45,7 @@ #include "gimpviewrendererimage.h" #include "gimpviewrendererimagefile.h" #include "gimpviewrendererpalette.h" -#include "gimpviewrenderervectors.h" +#include "gimpviewrendererpath.h" GType @@ -83,7 +83,7 @@ gimp_view_renderer_type_from_viewable_type (GType viewable_type) } else if (g_type_is_a (viewable_type, GIMP_TYPE_PATH)) { - type = GIMP_TYPE_VIEW_RENDERER_VECTORS; + type = GIMP_TYPE_VIEW_RENDERER_PATH; } else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGEFILE)) { diff --git a/app/widgets/gimpviewrenderervectors.c b/app/widgets/gimpviewrendererpath.c similarity index 61% rename from app/widgets/gimpviewrenderervectors.c rename to app/widgets/gimpviewrendererpath.c index a16820a053..5ce8b8b932 100644 --- a/app/widgets/gimpviewrenderervectors.c +++ b/app/widgets/gimpviewrendererpath.c @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * gimpviewrenderervectors.c + * gimpviewrendererpath.c * Copyright (C) 2003 Michael Natterer * Simon Budig * @@ -35,43 +35,43 @@ #include "vectors/gimppath.h" #include "vectors/gimpstroke.h" -#include "gimpviewrenderervectors.h" +#include "gimpviewrendererpath.h" -static void gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer, - GtkWidget *widget, - cairo_t *cr, - gint available_width, - gint available_height); +static void gimp_view_renderer_path_draw (GimpViewRenderer *renderer, + GtkWidget *widget, + cairo_t *cr, + gint available_width, + gint available_height); -G_DEFINE_TYPE (GimpViewRendererVectors, gimp_view_renderer_vectors, +G_DEFINE_TYPE (GimpViewRendererPath, gimp_view_renderer_path, GIMP_TYPE_VIEW_RENDERER) -#define parent_class gimp_view_renderer_vectors_parent_class +#define parent_class gimp_view_renderer_path_parent_class static void -gimp_view_renderer_vectors_class_init (GimpViewRendererVectorsClass *klass) +gimp_view_renderer_path_class_init (GimpViewRendererPathClass *klass) { GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - renderer_class->draw = gimp_view_renderer_vectors_draw; + renderer_class->draw = gimp_view_renderer_path_draw; } static void -gimp_view_renderer_vectors_init (GimpViewRendererVectors *renderer) +gimp_view_renderer_path_init (GimpViewRendererPath *renderer) { } static void -gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer, - GtkWidget *widget, - cairo_t *cr, - gint available_width, - gint available_height) +gimp_view_renderer_path_draw (GimpViewRenderer *renderer, + GtkWidget *widget, + cairo_t *cr, + gint available_width, + gint available_height) { - GimpPath *vectors = GIMP_PATH (renderer->viewable); + GimpPath *path = GIMP_PATH (renderer->viewable); const GimpBezierDesc *desc; cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); @@ -83,7 +83,7 @@ gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer, cairo_clip_preserve (cr); cairo_fill (cr); - desc = gimp_vectors_get_bezier (vectors); + desc = gimp_path_get_bezier (path); if (desc) { @@ -91,9 +91,9 @@ gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer, gdouble yscale; xscale = ((gdouble) renderer->width / - (gdouble) gimp_item_get_width (GIMP_ITEM (vectors))); + (gdouble) gimp_item_get_width (GIMP_ITEM (path))); yscale = ((gdouble) renderer->height / - (gdouble) gimp_item_get_height (GIMP_ITEM (vectors))); + (gdouble) gimp_item_get_height (GIMP_ITEM (path))); cairo_scale (cr, xscale, yscale); diff --git a/app/widgets/gimpviewrendererpath.h b/app/widgets/gimpviewrendererpath.h new file mode 100644 index 0000000000..279eecf282 --- /dev/null +++ b/app/widgets/gimpviewrendererpath.h @@ -0,0 +1,51 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimpviewrendererpath.h + * Copyright (C) 2003 Michael Natterer + * Simon Budig + * + * 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 3 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, see . + */ + +#ifndef __GIMP_VIEW_RENDERER_PATH_H__ +#define __GIMP_VIEW_RENDERER_PATH_H__ + +#include "gimpviewrenderer.h" + +#define GIMP_TYPE_VIEW_RENDERER_PATH (gimp_view_renderer_path_get_type ()) +#define GIMP_VIEW_RENDERER_PATH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VIEW_RENDERER_PATH, GimpViewRendererPath)) +#define GIMP_VIEW_RENDERER_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VIEW_RENDERER_PATH, GimpViewRendererPathClass)) +#define GIMP_IS_VIEW_RENDERER_PATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_VIEW_RENDERER_PATH)) +#define GIMP_IS_VIEW_RENDERER_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VIEW_RENDERER_PATH)) +#define GIMP_VIEW_RENDERER_PATH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VIEW_RENDERER_PATH, GimpViewRendererPathClass)) + + +typedef struct _GimpViewRendererPathClass GimpViewRendererPathClass; + +struct _GimpViewRendererPath +{ + GimpViewRenderer parent_instance; +}; + +struct _GimpViewRendererPathClass +{ + GimpViewRendererClass parent_class; +}; + + +GType gimp_view_renderer_path_get_type (void) G_GNUC_CONST; + + +#endif /* __GIMP_VIEW_RENDERER_PATH_H__ */ diff --git a/app/widgets/gimpviewrenderervectors.h b/app/widgets/gimpviewrenderervectors.h deleted file mode 100644 index f6c981fc27..0000000000 --- a/app/widgets/gimpviewrenderervectors.h +++ /dev/null @@ -1,51 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpviewrenderervectors.h - * Copyright (C) 2003 Michael Natterer - * Simon Budig - * - * 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 3 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, see . - */ - -#ifndef __GIMP_VIEW_RENDERER_VECTORS_H__ -#define __GIMP_VIEW_RENDERER_VECTORS_H__ - -#include "gimpviewrenderer.h" - -#define GIMP_TYPE_VIEW_RENDERER_VECTORS (gimp_view_renderer_vectors_get_type ()) -#define GIMP_VIEW_RENDERER_VECTORS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VIEW_RENDERER_VECTORS, GimpViewRendererVectors)) -#define GIMP_VIEW_RENDERER_VECTORS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VIEW_RENDERER_VECTORS, GimpViewRendererVectorsClass)) -#define GIMP_IS_VIEW_RENDERER_VECTORS(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_VIEW_RENDERER_VECTORS)) -#define GIMP_IS_VIEW_RENDERER_VECTORS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VIEW_RENDERER_VECTORS)) -#define GIMP_VIEW_RENDERER_VECTORS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VIEW_RENDERER_VECTORS, GimpViewRendererVectorsClass)) - - -typedef struct _GimpViewRendererVectorsClass GimpViewRendererVectorsClass; - -struct _GimpViewRendererVectors -{ - GimpViewRenderer parent_instance; -}; - -struct _GimpViewRendererVectorsClass -{ - GimpViewRendererClass parent_class; -}; - - -GType gimp_view_renderer_vectors_get_type (void) G_GNUC_CONST; - - -#endif /* __GIMP_VIEW_RENDERER_VECTORS_H__ */ diff --git a/app/widgets/meson.build b/app/widgets/meson.build index cb772cf895..a495a2081f 100644 --- a/app/widgets/meson.build +++ b/app/widgets/meson.build @@ -221,7 +221,7 @@ libappwidgets_sources = [ 'gimptranslationstore.c', 'gimpuimanager.c', 'gimpundoeditor.c', - 'gimpvectorstreeview.c', + 'gimppathtreeview.c', 'gimpview-popup.c', 'gimpview.c', 'gimpviewablebox.c', @@ -238,7 +238,7 @@ libappwidgets_sources = [ 'gimpviewrendererimagefile.c', 'gimpviewrendererlayer.c', 'gimpviewrendererpalette.c', - 'gimpviewrenderervectors.c', + 'gimpviewrendererpath.c', 'gimpwidgets-constructors.c', 'gimpwidgets-utils.c', 'gimpwindow.c', diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h index cbbeee0595..9d3ccf0e9a 100644 --- a/app/widgets/widgets-types.h +++ b/app/widgets/widgets-types.h @@ -95,7 +95,7 @@ typedef struct _GimpContainerView GimpContainerView; /* dummy typedef typedef struct _GimpDrawableTreeView GimpDrawableTreeView; typedef struct _GimpItemTreeView GimpItemTreeView; typedef struct _GimpLayerTreeView GimpLayerTreeView; -typedef struct _GimpVectorsTreeView GimpVectorsTreeView; +typedef struct _GimpPathTreeView GimpPathTreeView; typedef struct _GimpContainerPopup GimpContainerPopup; typedef struct _GimpViewableButton GimpViewableButton; @@ -266,7 +266,7 @@ typedef struct _GimpViewRendererImage GimpViewRendererImage; typedef struct _GimpViewRendererImagefile GimpViewRendererImagefile; typedef struct _GimpViewRendererLayer GimpViewRendererLayer; typedef struct _GimpViewRendererPalette GimpViewRendererPalette; -typedef struct _GimpViewRendererVectors GimpViewRendererVectors; +typedef struct _GimpViewRendererPath GimpViewRendererPath; /* cell renderers */ diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c index 8a19aa160b..6e06ed60a6 100644 --- a/app/xcf/xcf-load.c +++ b/app/xcf/xcf-load.c @@ -73,7 +73,7 @@ #include "vectors/gimpstroke.h" #include "vectors/gimpbezierstroke.h" #include "vectors/gimppath.h" -#include "vectors/gimpvectors-compat.h" +#include "vectors/gimppath-compat.h" #include "xcf-private.h" #include "xcf-load.h" @@ -3428,7 +3428,7 @@ xcf_load_path (XcfInfo *info, GIMP_LOG (XCF, "Path name='%s'", name); /* create a new path */ - vectors = gimp_vectors_new (image, name); + vectors = gimp_path_new (image, name); g_free (name); if (! vectors) return NULL; @@ -3540,7 +3540,7 @@ xcf_load_path (XcfInfo *info, "control-points", control_points, NULL); - gimp_vectors_stroke_add (vectors, stroke); + gimp_path_stroke_add (vectors, stroke); g_object_unref (stroke); gimp_value_array_unref (control_points); @@ -4232,7 +4232,7 @@ xcf_load_old_path (XcfInfo *info, guint32 version; /* changed from num_paths */ GimpTattoo tattoo = 0; GimpPath *vectors; - GimpVectorsCompatPoint *points; + GimpPathCompatPoint *points; gint i; xcf_read_string (info, &name, 1); @@ -4272,7 +4272,7 @@ xcf_load_old_path (XcfInfo *info, return FALSE; } - points = g_new0 (GimpVectorsCompatPoint, num_points); + points = g_new0 (GimpPathCompatPoint, num_points); for (i = 0; i < num_points; i++) { @@ -4302,7 +4302,7 @@ xcf_load_old_path (XcfInfo *info, } } - vectors = gimp_vectors_compat_new (image, name, points, num_points, closed); + vectors = gimp_path_compat_new (image, name, points, num_points, closed); g_free (name); g_free (points); @@ -4404,7 +4404,7 @@ xcf_load_old_vector (XcfInfo *info, name, tattoo, visible, linked, num_parasites, num_strokes); #endif - vectors = gimp_vectors_new (image, name); + vectors = gimp_path_new (image, name); g_free (name); gimp_item_set_visible (GIMP_ITEM (vectors), visible, FALSE); @@ -4520,7 +4520,7 @@ xcf_load_old_vector (XcfInfo *info, "control-points", control_points, NULL); - gimp_vectors_stroke_add (vectors, stroke); + gimp_path_stroke_add (vectors, stroke); g_object_unref (stroke); gimp_value_array_unref (control_points); diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c index 7dd28d282e..ec77dfad0f 100644 --- a/app/xcf/xcf-save.c +++ b/app/xcf/xcf-save.c @@ -69,7 +69,7 @@ #include "vectors/gimpbezierstroke.h" #include "vectors/gimppath.h" #include "vectors/gimpstroke.h" -#include "vectors/gimpvectors-compat.h" +#include "vectors/gimppath-compat.h" #include "xcf-private.h" #include "xcf-read.h" @@ -525,7 +525,7 @@ xcf_save_image_props (XcfInfo *info, if (gimp_container_get_n_children (gimp_image_get_paths (image)) > 0 && info->file_version < 18) { - if (gimp_vectors_compat_is_compatible (image)) + if (gimp_path_compat_is_compatible (image)) xcf_check_error (xcf_save_prop (info, image, PROP_PATHS, error), ;); else xcf_check_error (xcf_save_prop (info, image, PROP_VECTORS, error), ;); @@ -2942,7 +2942,7 @@ xcf_save_old_paths (XcfInfo *info, guint32 version; guint32 pathtype; guint32 tattoo; - GimpVectorsCompatPoint *points; + GimpPathCompatPoint *points; guint32 num_points; guint32 closed; gint i; @@ -2959,9 +2959,9 @@ xcf_save_old_paths (XcfInfo *info, * then each point. */ - points = gimp_vectors_compat_get_points (vectors, - (gint32 *) &num_points, - (gint32 *) &closed); + points = gimp_path_compat_get_points (vectors, + (gint32 *) &num_points, + (gint32 *) &closed); /* if no points are generated because of a faulty path we should * skip saving the path - this is unfortunately impossible, because diff --git a/devel-docs/GIMP3-plug-in-porting-guide/removed_functions.md b/devel-docs/GIMP3-plug-in-porting-guide/removed_functions.md index 5138273c9d..5f676b6989 100644 --- a/devel-docs/GIMP3-plug-in-porting-guide/removed_functions.md +++ b/devel-docs/GIMP3-plug-in-porting-guide/removed_functions.md @@ -166,14 +166,14 @@ possible in the previous API is obviously still possible. | `gimp_path_delete()` | `gimp_image_remove_path()` | | `gimp_path_get_current()` | `gimp_image_get_selected_paths()` | | `gimp_path_get_locked()` | *N/A* | -| `gimp_path_get_points()` | `gimp_vectors_stroke_get_points()` | -| `gimp_path_get_point_at_dist()` | `gimp_vectors_stroke_get_point_at_dist()` | +| `gimp_path_get_points()` | `gimp_path_stroke_get_points()` | +| `gimp_path_get_point_at_dist()` | `gimp_path_stroke_get_point_at_dist()` | | `gimp_path_get_tattoo()` | `gimp_item_get_tattoo()` | -| `gimp_path_import()` | `gimp_vectors_import_from_file()` | +| `gimp_path_import()` | `gimp_path_import_from_file()` | | `gimp_path_list()` | `gimp_image_get_paths()` | | `gimp_path_set_current()` | `gimp_image_set_selected_paths()` | | `gimp_path_set_locked()` | *N/A* | -| `gimp_path_set_points()` | `gimp_vectors_stroke_new_from_points()` | +| `gimp_path_set_points()` | `gimp_path_stroke_new_from_points()` | | `gimp_path_set_tattoo()` | `gimp_item_set_tattoo()` | | `gimp_path_stroke_current()` | `gimp_edit_stroke_vectors()` | | `gimp_path_to_selection()` | `gimp_image_select_item()` | diff --git a/libgimp/gimp.def b/libgimp/gimp.def index b80160fdf5..1e0db11d38 100644 --- a/libgimp/gimp.def +++ b/libgimp/gimp.def @@ -847,6 +847,9 @@ EXPORTS gimp_procedure_add_parasite_argument gimp_procedure_add_parasite_aux_argument gimp_procedure_add_parasite_return_value + gimp_procedure_add_path_argument + gimp_procedure_add_path_aux_argument + gimp_procedure_add_path_return_value gimp_procedure_add_pattern_argument gimp_procedure_add_pattern_aux_argument gimp_procedure_add_pattern_return_value @@ -871,9 +874,6 @@ EXPORTS gimp_procedure_add_unit_argument gimp_procedure_add_unit_aux_argument gimp_procedure_add_unit_return_value - gimp_procedure_add_vectors_argument - gimp_procedure_add_vectors_aux_argument - gimp_procedure_add_vectors_return_value gimp_procedure_config_get_choice_id gimp_procedure_config_get_procedure gimp_procedure_config_get_type diff --git a/libgimp/gimpitemcombobox.c b/libgimp/gimpitemcombobox.c index 0726c63245..c132dd8829 100644 --- a/libgimp/gimpitemcombobox.c +++ b/libgimp/gimpitemcombobox.c @@ -65,7 +65,7 @@ struct _GimpItemComboBoxPrivate typedef struct _GimpDrawableComboBoxClass GimpDrawableComboBoxClass; typedef struct _GimpChannelComboBoxClass GimpChannelComboBoxClass; typedef struct _GimpLayerComboBoxClass GimpLayerComboBoxClass; -typedef struct _GimpVectorsComboBoxClass GimpVectorsComboBoxClass; +typedef struct _GimpPathComboBoxClass GimpPathComboBoxClass; struct _GimpDrawableComboBox { @@ -97,12 +97,12 @@ struct _GimpLayerComboBoxClass GimpIntComboBoxClass parent_class; }; -struct _GimpVectorsComboBox +struct _GimpPathComboBox { GimpIntComboBox parent_instance; }; -struct _GimpVectorsComboBoxClass +struct _GimpPathComboBoxClass { GimpIntComboBoxClass parent_class; }; @@ -135,7 +135,7 @@ static const GtkTargetEntry targets[] = { { "application/x-gimp-channel-id", 0 }, { "application/x-gimp-layer-id", 0 }, - { "application/x-gimp-vectors-id", 0 } + { "application/x-gimp-path-id", 0 } }; @@ -293,11 +293,11 @@ gimp_layer_combo_box_new (GimpItemConstraintFunc constraint, } -G_DEFINE_TYPE (GimpVectorsComboBox, gimp_vectors_combo_box, +G_DEFINE_TYPE (GimpPathComboBox, gimp_path_combo_box, GIMP_TYPE_INT_COMBO_BOX) static void -gimp_vectors_combo_box_class_init (GimpVectorsComboBoxClass *klass) +gimp_path_combo_box_class_init (GimpPathComboBoxClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); @@ -305,7 +305,7 @@ gimp_vectors_combo_box_class_init (GimpVectorsComboBoxClass *klass) } static void -gimp_vectors_combo_box_init (GimpVectorsComboBox *combo_box) +gimp_path_combo_box_init (GimpPathComboBox *combo_box) { gtk_drag_dest_set (GTK_WIDGET (combo_box), GTK_DEST_DEFAULT_HIGHLIGHT | @@ -321,31 +321,31 @@ gimp_vectors_combo_box_init (GimpVectorsComboBox *combo_box) /** - * gimp_vectors_combo_box_new: + * gimp_path_combo_box_new: * @constraint: (nullable): A #GimpItemConstraintFunc or %NULL * @data: (closure constraint): A pointer that is passed to @constraint * @data_destroy: (destroy data): Destroy function for @data * * Creates a new #GimpIntComboBox filled with all currently opened - * vectors objects. If a @constraint function is specified, it is called for - * each vectors object and only if the function returns %TRUE, the vectors + * path objects. If a @constraint function is specified, it is called for + * each path object and only if the function returns %TRUE, the path * object is added to the combobox. * * You should use gimp_int_combo_box_connect() to initialize and connect * the combo. Use gimp_int_combo_box_set_active() to set the active - * vectors ID and gimp_int_combo_box_get_active() to retrieve the ID - * of the selected vectors object. + * path ID and gimp_int_combo_box_get_active() to retrieve the ID + * of the selected path object. * * Returns: a new #GimpIntComboBox. * * Since: 2.4 **/ GtkWidget * -gimp_vectors_combo_box_new (GimpItemConstraintFunc constraint, +gimp_path_combo_box_new (GimpItemConstraintFunc constraint, gpointer data, GDestroyNotify data_destroy) { - return gimp_item_combo_box_new (GIMP_TYPE_VECTORS_COMBO_BOX, + return gimp_item_combo_box_new (GIMP_TYPE_PATH_COMBO_BOX, constraint, data, data_destroy); } @@ -416,7 +416,7 @@ gimp_item_combo_box_populate (GimpIntComboBox *combo_box) g_list_free (items); } - if (GIMP_IS_VECTORS_COMBO_BOX (combo_box)) + if (GIMP_IS_PATH_COMBO_BOX (combo_box)) { items = gimp_image_list_paths (image); gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model), @@ -476,7 +476,7 @@ gimp_item_combo_box_model_add (GimpIntComboBox *combo_box, g_free (item_name); g_free (image_name); - if (GIMP_IS_VECTORS_COMBO_BOX (combo_box)) + if (GIMP_IS_PATH_COMBO_BOX (combo_box)) thumb = NULL; else thumb = gimp_drawable_get_thumbnail (GIMP_DRAWABLE (item), diff --git a/libgimp/gimpitemcombobox.h b/libgimp/gimpitemcombobox.h index bb71edc25e..de107755cb 100644 --- a/libgimp/gimpitemcombobox.h +++ b/libgimp/gimpitemcombobox.h @@ -44,15 +44,15 @@ G_BEGIN_DECLS #define GIMP_LAYER_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER_COMBO_BOX, GimpLayerComboBox)) #define GIMP_IS_LAYER_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER_COMBO_BOX)) -#define GIMP_TYPE_VECTORS_COMBO_BOX (gimp_vectors_combo_box_get_type ()) -#define GIMP_VECTORS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS_COMBO_BOX, GimpVectorsComboBox)) -#define GIMP_IS_VECTORS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS_COMBO_BOX)) +#define GIMP_TYPE_PATH_COMBO_BOX (gimp_path_combo_box_get_type ()) +#define GIMP_PATH_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PATH_COMBO_BOX, GimpPathComboBox)) +#define GIMP_IS_PATH_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PATH_COMBO_BOX)) GType gimp_drawable_combo_box_get_type (void) G_GNUC_CONST; GType gimp_channel_combo_box_get_type (void) G_GNUC_CONST; GType gimp_layer_combo_box_get_type (void) G_GNUC_CONST; -GType gimp_vectors_combo_box_get_type (void) G_GNUC_CONST; +GType gimp_path_combo_box_get_type (void) G_GNUC_CONST; /** * GimpItemConstraintFunc: @@ -73,7 +73,7 @@ GtkWidget * gimp_channel_combo_box_new (GimpItemConstraintFunc constraint, GtkWidget * gimp_layer_combo_box_new (GimpItemConstraintFunc constraint, gpointer data, GDestroyNotify data_destroy); -GtkWidget * gimp_vectors_combo_box_new (GimpItemConstraintFunc constraint, +GtkWidget * gimp_path_combo_box_new (GimpItemConstraintFunc constraint, gpointer data, GDestroyNotify data_destroy); diff --git a/libgimp/gimppath_pdb.c b/libgimp/gimppath_pdb.c index 907c3aa353..1b8ce85502 100644 --- a/libgimp/gimppath_pdb.c +++ b/libgimp/gimppath_pdb.c @@ -1137,8 +1137,8 @@ gimp_path_import_from_file (GimpImage *image, * * Import paths from an SVG string. * - * This procedure works like gimp_vectors_import_from_file() but takes - * a string rather than reading the SVG from a file. This allows you to + * This procedure works like gimp_path_import_from_file() but takes a + * string rather than reading the SVG from a file. This allows you to * write scripts that generate SVG and feed it to GIMP. * * Returns: TRUE on success. diff --git a/libgimp/gimpprocedure-params.c b/libgimp/gimpprocedure-params.c index b1913a42db..ad6f1bd441 100644 --- a/libgimp/gimpprocedure-params.c +++ b/libgimp/gimpprocedure-params.c @@ -2197,7 +2197,7 @@ gimp_procedure_add_selection_return_value (GimpProcedure *procedure, } /** - * gimp_procedure_add_vectors_argument: + * gimp_procedure_add_path_argument: * @procedure: the #GimpProcedure. * @name: the name of the argument to be created. * @nick: the label used in #GimpProcedureDialog. @@ -2205,17 +2205,17 @@ gimp_procedure_add_selection_return_value (GimpProcedure *procedure, * @none_ok: Whether no is a valid value. * @flags: argument flags. * - * Add a new #GimpVectors argument to @procedure. + * Add a new #GimpPath argument to @procedure. * * Since: 3.0 **/ void -gimp_procedure_add_vectors_argument (GimpProcedure *procedure, - const gchar *name, - const gchar *nick, - const gchar *blurb, - gboolean none_ok, - GParamFlags flags) +gimp_procedure_add_path_argument (GimpProcedure *procedure, + const gchar *name, + const gchar *nick, + const gchar *blurb, + gboolean none_ok, + GParamFlags flags) { _gimp_procedure_add_argument (procedure, gimp_param_spec_path (name, nick, blurb, @@ -2223,7 +2223,7 @@ gimp_procedure_add_vectors_argument (GimpProcedure *procedure, } /** - * gimp_procedure_add_vectors_aux_argument: + * gimp_procedure_add_path_aux_argument: * @procedure: the #GimpProcedure. * @name: the name of the argument to be created. * @nick: the label used in #GimpProcedureDialog. @@ -2231,17 +2231,17 @@ gimp_procedure_add_vectors_argument (GimpProcedure *procedure, * @none_ok: Whether no is a valid value. * @flags: argument flags. * - * Add a new #GimpVectors auxiliary argument to @procedure. + * Add a new #GimpPath auxiliary argument to @procedure. * * Since: 3.0 **/ void -gimp_procedure_add_vectors_aux_argument (GimpProcedure *procedure, - const gchar *name, - const gchar *nick, - const gchar *blurb, - gboolean none_ok, - GParamFlags flags) +gimp_procedure_add_path_aux_argument (GimpProcedure *procedure, + const gchar *name, + const gchar *nick, + const gchar *blurb, + gboolean none_ok, + GParamFlags flags) { _gimp_procedure_add_aux_argument (procedure, gimp_param_spec_path (name, nick, blurb, @@ -2249,7 +2249,7 @@ gimp_procedure_add_vectors_aux_argument (GimpProcedure *procedure, } /** - * gimp_procedure_add_vectors_return_value: + * gimp_procedure_add_path_return_value: * @procedure: the #GimpProcedure. * @name: the name of the argument to be created. * @nick: the label used in #GimpProcedureDialog. @@ -2257,17 +2257,17 @@ gimp_procedure_add_vectors_aux_argument (GimpProcedure *procedure, * @none_ok: Whether no is a valid value. * @flags: argument flags. * - * Add a new #GimpVectors return value to @procedure. + * Add a new #GimpPath return value to @procedure. * * Since: 3.0 **/ void -gimp_procedure_add_vectors_return_value (GimpProcedure *procedure, - const gchar *name, - const gchar *nick, - const gchar *blurb, - gboolean none_ok, - GParamFlags flags) +gimp_procedure_add_path_return_value (GimpProcedure *procedure, + const gchar *name, + const gchar *nick, + const gchar *blurb, + gboolean none_ok, + GParamFlags flags) { _gimp_procedure_add_return_value (procedure, gimp_param_spec_path (name, nick, blurb, diff --git a/libgimp/gimpprocedure-params.h b/libgimp/gimpprocedure-params.h index c54cb9cb13..042cd6faac 100644 --- a/libgimp/gimpprocedure-params.h +++ b/libgimp/gimpprocedure-params.h @@ -363,7 +363,7 @@ G_BEGIN_DECLS g_value_set_object (gimp_value_array_index (args, n), value) -/* vectors */ +/* path */ #define GIMP_VALUES_GET_PATH(args, n) \ g_value_get_object (gimp_value_array_index (args, n)) @@ -956,19 +956,19 @@ void gimp_procedure_add_selection_return_value (GimpProcedure *procedure gboolean none_ok, GParamFlags flags); -void gimp_procedure_add_vectors_argument (GimpProcedure *procedure, +void gimp_procedure_add_path_argument (GimpProcedure *procedure, const gchar *name, const gchar *nick, const gchar *blurb, gboolean none_ok, GParamFlags flags); -void gimp_procedure_add_vectors_aux_argument (GimpProcedure *procedure, +void gimp_procedure_add_path_aux_argument (GimpProcedure *procedure, const gchar *name, const gchar *nick, const gchar *blurb, gboolean none_ok, GParamFlags flags); -void gimp_procedure_add_vectors_return_value (GimpProcedure *procedure, +void gimp_procedure_add_path_return_value (GimpProcedure *procedure, const gchar *name, const gchar *nick, const gchar *blurb, diff --git a/libgimp/gimpui.def b/libgimp/gimpui.def index fecaeb2432..059ac0c527 100644 --- a/libgimp/gimpui.def +++ b/libgimp/gimpui.def @@ -31,6 +31,8 @@ EXPORTS gimp_layer_combo_box_new gimp_palette_chooser_get_type gimp_palette_chooser_new + gimp_path_combo_box_get_type + gimp_path_combo_box_new gimp_pattern_chooser_get_type gimp_pattern_chooser_new gimp_proc_browser_dialog_get_selected @@ -95,8 +97,6 @@ EXPORTS gimp_ui_init gimp_vector_load_procedure_dialog_get_type gimp_vector_load_procedure_dialog_new - gimp_vectors_combo_box_get_type - gimp_vectors_combo_box_new gimp_window_set_transient gimp_window_set_transient_for_display gimp_zoom_preview_get_drawable diff --git a/libgimp/gimpuitypes.h b/libgimp/gimpuitypes.h index 6f0ff82c6b..1ddfdef2cb 100644 --- a/libgimp/gimpuitypes.h +++ b/libgimp/gimpuitypes.h @@ -41,7 +41,7 @@ typedef struct _GimpZoomPreview GimpZoomPreview; typedef struct _GimpDrawableComboBox GimpDrawableComboBox; typedef struct _GimpChannelComboBox GimpChannelComboBox; typedef struct _GimpLayerComboBox GimpLayerComboBox; -typedef struct _GimpVectorsComboBox GimpVectorsComboBox; +typedef struct _GimpPathComboBox GimpPathComboBox; typedef struct _GimpImageComboBox GimpImageComboBox; typedef struct _GimpDrawableChooser GimpDrawableChooser; diff --git a/pdb/groups/path.pdb b/pdb/groups/path.pdb index 960546a450..c680a75f5a 100644 --- a/pdb/groups/path.pdb +++ b/pdb/groups/path.pdb @@ -40,7 +40,7 @@ HELP %invoke = ( code => <<'CODE' { - path = gimp_vectors_new (image, name); + path = gimp_path_new (image, name); } CODE ); @@ -75,7 +75,7 @@ HELP { gint x, y; - path = gimp_text_vectors_new (image, + path = gimp_text_path_new (image, gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer))); gimp_item_get_offset (GIMP_ITEM (layer), &x, &y); @@ -146,7 +146,7 @@ HELP %invoke = ( code => <<"CODE" { - num_strokes = gimp_vectors_get_n_strokes (path); + num_strokes = gimp_path_get_n_strokes (path); if (num_strokes) { @@ -155,9 +155,9 @@ HELP stroke_ids = g_new (gint32, num_strokes); - for (cur_stroke = gimp_vectors_stroke_get_next (path, NULL); + for (cur_stroke = gimp_path_stroke_get_next (path, NULL); cur_stroke; - cur_stroke = gimp_vectors_stroke_get_next (path, cur_stroke)) + cur_stroke = gimp_path_stroke_get_next (path, cur_stroke)) { stroke_ids[i] = gimp_stroke_get_id (cur_stroke); i++; @@ -287,7 +287,7 @@ HELP _("Remove path stroke"), path); - gimp_vectors_stroke_remove (path, stroke); + gimp_path_stroke_remove (path, stroke); } else success = FALSE; @@ -325,9 +325,9 @@ HELP _("Close path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_close (stroke); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -366,9 +366,9 @@ HELP _("Reverse path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_reverse (stroke); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -413,9 +413,9 @@ HELP _("Translate path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_translate (stroke, off_x, off_y); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -459,9 +459,9 @@ HELP _("Scale path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_scale (stroke, scale_x, scale_y); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -506,9 +506,9 @@ HELP _("Rotate path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_rotate (stroke, center_x, center_y, angle); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -552,9 +552,9 @@ HELP _("Flip path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_flip (stroke, flip_type, axis); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -603,9 +603,9 @@ HELP _("Flip path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_stroke_flip_free (stroke, x1, y1, x2, y2); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -810,7 +810,7 @@ HELP _("Add path stroke"), path); - gimp_vectors_stroke_add (path, stroke); + gimp_path_stroke_add (path, stroke); g_object_unref (stroke); stroke_id = gimp_stroke_get_id (stroke); @@ -868,7 +868,7 @@ HELP _("Add path stroke"), path); - gimp_vectors_stroke_add (path, stroke); + gimp_path_stroke_add (path, stroke); g_object_unref (stroke); stroke_id = gimp_stroke_get_id (stroke); @@ -918,9 +918,9 @@ HELP _("Extend path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_bezier_stroke_lineto (stroke, &coord0); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -977,9 +977,9 @@ HELP _("Extend path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_bezier_stroke_conicto (stroke, &coord0, &coord1); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -1042,9 +1042,9 @@ HELP _("Extend path stroke"), path); - gimp_vectors_freeze (path); + gimp_path_freeze (path); gimp_bezier_stroke_cubicto (stroke, &coord0, &coord1, &coord2); - gimp_vectors_thaw (path); + gimp_path_thaw (path); } else success = FALSE; @@ -1103,7 +1103,7 @@ HELP _("Add path stroke"), path); - gimp_vectors_stroke_add (path, stroke); + gimp_path_stroke_add (path, stroke); g_object_unref (stroke); stroke_id = gimp_stroke_get_id (stroke); @@ -1144,15 +1144,15 @@ HELP ); %invoke = ( - headers => [ qw("vectors/gimpvectors-import.h") ], + headers => [ qw("vectors/gimppath-import.h") ], code => <<'CODE' { GList *path_list = NULL; /* FIXME tree */ - success = gimp_vectors_import_file (image, file, - merge, scale, NULL, -1, - &path_list, error); + success = gimp_path_import_file (image, file, + merge, scale, NULL, -1, + &path_list, error); if (success) { @@ -1184,7 +1184,7 @@ sub path_import_from_string { $blurb = 'Import paths from an SVG string.'; $help = <<'HELP'; -This procedure works like gimp_vectors_import_from_file() but takes a string +This procedure works like gimp_path_import_from_file() but takes a string rather than reading the SVG from a file. This allows you to write scripts that generate SVG and feed it to GIMP. HELP @@ -1213,15 +1213,15 @@ HELP ); %invoke = ( - headers => [ qw("vectors/gimpvectors-import.h") ], + headers => [ qw("vectors/gimppath-import.h") ], code => <<'CODE' { GList *path_list = NULL; /* FIXME tree */ - success = gimp_vectors_import_buffer (image, string, length, - merge, scale, NULL, -1, - &path_list, error); + success = gimp_path_import_buffer (image, string, length, + merge, scale, NULL, -1, + &path_list, error); if (success) { @@ -1272,7 +1272,7 @@ HELP ); %invoke = ( - headers => [ qw("vectors/gimpvectors-export.h") ], + headers => [ qw("vectors/gimppath-export.h") ], code => <<'CODE' { GList *path_list = NULL; @@ -1280,7 +1280,7 @@ HELP if (path != NULL) path_list = g_list_prepend (path_list, path); - success = gimp_vectors_export_file (image, path_list, file, error); + success = gimp_path_export_file (image, path_list, file, error); g_list_free (path_list); } @@ -1314,7 +1314,7 @@ HELP ); %invoke = ( - headers => [ qw("vectors/gimpvectors-export.h") ], + headers => [ qw("vectors/gimppath-export.h") ], code => <<'CODE' { GList *path_list = NULL; @@ -1322,7 +1322,7 @@ HELP if (path != NULL) path_list = g_list_prepend (path_list, path); - string = gimp_vectors_export_string (image, path_list); + string = gimp_path_export_string (image, path_list); g_list_free (path_list); success = (string != NULL); @@ -1336,8 +1336,8 @@ CODE "core/gimplist.h" "core/gimpimage.h" "core/gimpimage-undo-push.h" - "text/gimptext-vectors.h" - "text/gimptextlayer.h" + "text/gimptext-path.h" + "text/gimptextlayer.h" "vectors/gimpanchor.h" "vectors/gimpstroke-new.h" "vectors/gimpbezierstroke.h" @@ -1346,7 +1346,7 @@ CODE "gimp-intl.h"); @procs = qw(path_new - path_new_from_text_layer + path_new_from_text_layer path_copy path_get_strokes path_stroke_get_length diff --git a/plug-ins/file-psd/psd-export.c b/plug-ins/file-psd/psd-export.c index 3a114eeec8..f66163b1e0 100644 --- a/plug-ins/file-psd/psd-export.c +++ b/plug-ins/file-psd/psd-export.c @@ -2558,7 +2558,7 @@ save_dialog (GimpImage *image, } vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - combo = gimp_vectors_combo_box_new (NULL, NULL, NULL); + combo = gimp_path_combo_box_new (NULL, NULL, NULL); /* Alert user if they have more than 998 paths */ if (g_list_length (paths) > 998) diff --git a/plug-ins/script-fu/libscriptfu/script-fu-arg.c b/plug-ins/script-fu/libscriptfu/script-fu-arg.c index 98fc9420df..7c0f2ba2a8 100644 --- a/plug-ins/script-fu/libscriptfu/script-fu-arg.c +++ b/plug-ins/script-fu/libscriptfu/script-fu-arg.c @@ -277,10 +277,10 @@ script_fu_arg_add_argument (SFArg *arg, break; case SF_VECTORS: - gimp_procedure_add_vectors_argument (procedure, name, - nick, arg->label, - TRUE, - G_PARAM_READWRITE); + gimp_procedure_add_path_argument (procedure, name, + nick, arg->label, + TRUE, + G_PARAM_READWRITE); break; case SF_DISPLAY: diff --git a/plug-ins/script-fu/libscriptfu/script-fu-interface.c b/plug-ins/script-fu/libscriptfu/script-fu-interface.c index 6d0321b097..bbb3e0ae31 100644 --- a/plug-ins/script-fu/libscriptfu/script-fu-interface.c +++ b/plug-ins/script-fu/libscriptfu/script-fu-interface.c @@ -251,7 +251,7 @@ script_fu_interface_dialog (SFScript *script, break; case SF_VECTORS: - widget = gimp_vectors_combo_box_new (NULL, NULL, NULL); + widget = gimp_path_combo_box_new (NULL, NULL, NULL); ID_ptr = &arg->value.sfa_vectors; break; diff --git a/po/POTFILES.in b/po/POTFILES.in index e6bbdcdede..ae414a9624 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -245,9 +245,9 @@ app/dialogs/template-options-dialog.c app/dialogs/tips-dialog.c app/dialogs/tips-parser.c app/dialogs/user-install-dialog.c -app/dialogs/vectors-export-dialog.c -app/dialogs/vectors-import-dialog.c -app/dialogs/vectors-options-dialog.c +app/dialogs/path-export-dialog.c +app/dialogs/path-import-dialog.c +app/dialogs/path-options-dialog.c app/dialogs/welcome-dialog.c app/display/display-enums.c @@ -530,8 +530,8 @@ app/tools/gimpwarptool.c app/tools/tools-enums.c app/vectors/gimppath.c -app/vectors/gimpvectors-export.c -app/vectors/gimpvectors-import.c +app/vectors/gimppath-export.c +app/vectors/gimppath-import.c app/widgets/gimpactioneditor.c app/widgets/gimpactiongroup.c @@ -641,7 +641,7 @@ app/widgets/gimptoolpreseteditor.c app/widgets/gimptranslationstore.c app/widgets/gimpuimanager.c app/widgets/gimpundoeditor.c -app/widgets/gimpvectorstreeview.c +app/widgets/gimppathtreeview.c app/widgets/gimpviewablebox.c app/widgets/gimpwidgets-constructors.c app/widgets/gimpwidgets-utils.c