mirror of https://github.com/GNOME/gimp.git
app: "vectors-copy" and "vectors-export" are now multi-paths aware.
This commit is contained in:
parent
fde780daeb
commit
9fc8260c7c
|
@ -140,7 +140,7 @@ static const GimpActionEntry vectors_actions[] =
|
|||
GIMP_HELP_PATH_STROKE },
|
||||
|
||||
{ "vectors-copy", GIMP_ICON_EDIT_COPY,
|
||||
NC_("vectors-action", "Co_py Path"), "", NULL,
|
||||
NC_("vectors-action", "Co_py Paths"), "", NULL,
|
||||
vectors_copy_cmd_callback,
|
||||
GIMP_HELP_PATH_COPY },
|
||||
|
||||
|
@ -150,7 +150,7 @@ static const GimpActionEntry vectors_actions[] =
|
|||
GIMP_HELP_PATH_PASTE },
|
||||
|
||||
{ "vectors-export", GIMP_ICON_DOCUMENT_SAVE,
|
||||
NC_("vectors-action", "E_xport Path..."), "", NULL,
|
||||
NC_("vectors-action", "E_xport Paths..."), "", NULL,
|
||||
vectors_export_cmd_callback,
|
||||
GIMP_HELP_PATH_EXPORT },
|
||||
|
||||
|
@ -431,9 +431,9 @@ vectors_actions_update (GimpActionGroup *group,
|
|||
SET_SENSITIVE ("vectors-lower", n_selected_vectors > 0 && have_next);
|
||||
SET_SENSITIVE ("vectors-lower-to-bottom", n_selected_vectors > 0 && have_next);
|
||||
|
||||
SET_SENSITIVE ("vectors-copy", n_selected_vectors == 1);
|
||||
SET_SENSITIVE ("vectors-copy", n_selected_vectors > 0);
|
||||
SET_SENSITIVE ("vectors-paste", image);
|
||||
SET_SENSITIVE ("vectors-export", n_selected_vectors == 1);
|
||||
SET_SENSITIVE ("vectors-export", n_selected_vectors > 0);
|
||||
SET_SENSITIVE ("vectors-import", image);
|
||||
|
||||
SET_SENSITIVE ("vectors-selection-to-vectors", image && !mask_empty);
|
||||
|
|
|
@ -590,9 +590,9 @@ vectors_copy_cmd_callback (GimpAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpVectors *vectors;
|
||||
GList *vectors;
|
||||
gchar *svg;
|
||||
return_if_no_vectors (image, vectors, data);
|
||||
return_if_no_vectors_list (image, vectors, data);
|
||||
|
||||
svg = gimp_vectors_export_string (image, vectors);
|
||||
|
||||
|
@ -645,10 +645,10 @@ vectors_export_cmd_callback (GimpAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpVectors *vectors;
|
||||
GList *vectors;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *dialog;
|
||||
return_if_no_vectors (image, vectors, data);
|
||||
return_if_no_vectors_list (image, vectors, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
#define EXPORT_DIALOG_KEY "gimp-vectors-export-dialog"
|
||||
|
@ -903,7 +903,7 @@ vectors_export_callback (GtkWidget *dialog,
|
|||
gpointer user_data)
|
||||
{
|
||||
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
||||
GimpVectors *vectors = NULL;
|
||||
GList *vectors = NULL;
|
||||
gchar *path = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
|
@ -919,7 +919,7 @@ vectors_export_callback (GtkWidget *dialog,
|
|||
g_free (path);
|
||||
|
||||
if (config->vectors_export_active_only)
|
||||
vectors = gimp_image_get_active_vectors (image);
|
||||
vectors = gimp_image_get_selected_vectors (image);
|
||||
|
||||
if (! gimp_vectors_export_file (image, vectors, file, &error))
|
||||
{
|
||||
|
|
|
@ -441,7 +441,7 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
|
|||
|
||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_VECTORS_EXPORT_ACTIVE_ONLY,
|
||||
"path-export-active-only",
|
||||
"Default export only the active path",
|
||||
"Default export only the selected paths",
|
||||
VECTORS_EXPORT_ACTIVE_ONLY_BLURB,
|
||||
TRUE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
|
|
@ -650,7 +650,7 @@ _("Sets the default path name for the 'New Path' dialog.")
|
|||
_("Sets the default folder path for the 'Export Path' dialog.")
|
||||
|
||||
#define VECTORS_EXPORT_ACTIVE_ONLY_BLURB \
|
||||
_("Sets the default 'Export the active path' state for the 'Export Path' dialog.")
|
||||
_("Sets the default 'Export the selected paths' state for the 'Export Path' dialog.")
|
||||
|
||||
#define VECTORS_IMPORT_PATH_BLURB \
|
||||
_("Sets the default folder path for the 'Import Path' dialog.")
|
||||
|
|
|
@ -2540,7 +2540,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||
GTK_GRID (grid), 0, size_group);
|
||||
|
||||
prefs_check_button_add (object, "path-export-active-only",
|
||||
_("Export the active path only"),
|
||||
_("Export the selected paths only"),
|
||||
GTK_BOX (vbox2));
|
||||
|
||||
/* Import Path Dialog */
|
||||
|
|
|
@ -118,7 +118,7 @@ vectors_export_dialog_new (GimpImage *image,
|
|||
G_CALLBACK (vectors_export_dialog_response),
|
||||
private);
|
||||
|
||||
combo = gimp_int_combo_box_new (_("Export the active path"), TRUE,
|
||||
combo = gimp_int_combo_box_new (_("Export the selected paths"), TRUE,
|
||||
_("Export all paths from this image"), FALSE,
|
||||
NULL);
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
|
||||
static GString * gimp_vectors_export (GimpImage *image,
|
||||
GimpVectors *vectors);
|
||||
GList *vectors);
|
||||
static void gimp_vectors_export_image_size (GimpImage *image,
|
||||
GString *str);
|
||||
static void gimp_vectors_export_path (GimpVectors *vectors,
|
||||
|
@ -48,7 +48,7 @@ static gchar * gimp_vectors_export_path_data (GimpVectors *vectors);
|
|||
/**
|
||||
* gimp_vectors_export_file:
|
||||
* @image: the #GimpImage from which to export vectors
|
||||
* @vectors: a #GimpVectors object or %NULL to export all vectors in @image
|
||||
* @vectors: a #GList of #GimpVectors objects or %NULL to export all vectors in @image
|
||||
* @file: the file to write
|
||||
* @error: return location for errors
|
||||
*
|
||||
|
@ -59,7 +59,7 @@ static gchar * gimp_vectors_export_path_data (GimpVectors *vectors);
|
|||
**/
|
||||
gboolean
|
||||
gimp_vectors_export_file (GimpImage *image,
|
||||
GimpVectors *vectors,
|
||||
GList *vectors,
|
||||
GFile *file,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -68,7 +68,6 @@ gimp_vectors_export_file (GimpImage *image,
|
|||
GError *my_error = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
g_return_val_if_fail (vectors == NULL || GIMP_IS_VECTORS (vectors), FALSE);
|
||||
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
|
@ -117,19 +116,19 @@ gimp_vectors_export_file (GimpImage *image,
|
|||
**/
|
||||
gchar *
|
||||
gimp_vectors_export_string (GimpImage *image,
|
||||
GimpVectors *vectors)
|
||||
GList *vectors)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (vectors == NULL || GIMP_IS_VECTORS (vectors), NULL);
|
||||
|
||||
return g_string_free (gimp_vectors_export (image, vectors), FALSE);
|
||||
}
|
||||
|
||||
static GString *
|
||||
gimp_vectors_export (GimpImage *image,
|
||||
GimpVectors *vectors)
|
||||
GList *vectors)
|
||||
{
|
||||
GString *str = g_string_new (NULL);
|
||||
GList *list;
|
||||
|
||||
g_string_append_printf (str,
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
|
||||
|
@ -147,21 +146,11 @@ gimp_vectors_export (GimpImage *image,
|
|||
gimp_image_get_width (image),
|
||||
gimp_image_get_height (image));
|
||||
|
||||
if (vectors)
|
||||
{
|
||||
gimp_vectors_export_path (vectors, str);
|
||||
}
|
||||
else
|
||||
{
|
||||
GList *list;
|
||||
if (! vectors)
|
||||
vectors = gimp_image_get_vectors_iter (image);
|
||||
|
||||
for (list = gimp_image_get_vectors_iter (image);
|
||||
list;
|
||||
list = list->next)
|
||||
{
|
||||
for (list = vectors; list; list = list->next)
|
||||
gimp_vectors_export_path (GIMP_VECTORS (list->data), str);
|
||||
}
|
||||
}
|
||||
|
||||
g_string_append (str, "</svg>\n");
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
|
||||
gboolean gimp_vectors_export_file (GimpImage *image,
|
||||
GimpVectors *vectors,
|
||||
GList *vectors,
|
||||
GFile *file,
|
||||
GError **error);
|
||||
gchar * gimp_vectors_export_string (GimpImage *image,
|
||||
GimpVectors *vectors);
|
||||
GList *vectors);
|
||||
|
||||
|
||||
#endif /* __GIMP_VECTORS_IMPORT_H__ */
|
||||
|
|
|
@ -264,16 +264,16 @@ gimp_vectors_tree_view_drag_svg (GtkWidget *widget,
|
|||
{
|
||||
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (data);
|
||||
GimpImage *image = gimp_item_tree_view_get_image (view);
|
||||
GimpItem *item;
|
||||
GList *items;
|
||||
gchar *svg_data = NULL;
|
||||
|
||||
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (image);
|
||||
items = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_selected_items (image);
|
||||
|
||||
*svg_data_len = 0;
|
||||
|
||||
if (item)
|
||||
if (items)
|
||||
{
|
||||
svg_data = gimp_vectors_export_string (image, GIMP_VECTORS (item));
|
||||
svg_data = gimp_vectors_export_string (image, items);
|
||||
|
||||
if (svg_data)
|
||||
*svg_data_len = strlen (svg_data);
|
||||
|
|
Loading…
Reference in New Issue