Commit cdf2a90b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/core/Makefile.am app/core/core-types.h new base class for something

2002-02-25  Michael Natterer  <mitch@gimp.org>

	* app/core/Makefile.am
	* app/core/core-types.h
	* app/core/gimpitem.[ch]: new base class for something which is a
	child of an image, has a PDB ID, a tattoo, parasites and emits
	a "removed" signal.

	* app/core/gimpdrawable.[ch]
	* app/vectors/gimpvectors.[ch]: derive from GimpItem. Removed
	lots of stuff from GimpDrawable.

	* app/core/gimp.[ch]: changed gimp->drawable_table and
	gimp->next_drawable_ID to gimp->item_table and gimp->next_item_id.

	* app/undo.[ch]: s/undo_push_drawable_parasite/undo_push_item_parasite/,
	minor cleanups.

	* app/core/gimplayer.[ch]: changed gimp_layer_new_from_tiles() and
	gimp_layer_new_from_drawable() to take the "dest_gimage" as
	second, not first parameter.

	* app/image_map.c
	* app/core/gimpchannel.c
	* app/core/gimpdrawable-blend.c
	* app/core/gimpdrawable-bucket-fill.c
	* app/core/gimpdrawable-histogram.c
	* app/core/gimpdrawable-offset.c
	* app/core/gimpdrawable-preview.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimpedit.c
	* app/core/gimpimage-duplicate.c
	* app/core/gimpimage-mask.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-pick-color.c
	* app/core/gimpimage.c
	* app/core/gimplayer-floating-sel.c
	* app/display/gimpdisplayshell-dnd.c
	* app/file/file-save.c
	* app/gui/channels-commands.c
	* app/gui/file-save-dialog.c
	* app/gui/layers-commands.c
	* app/gui/offset-dialog.c
	* app/gui/paths-dialog.c
	* app/gui/toolbox.c
	* app/paint/gimpairbrush.c
	* app/paint/gimpclone.c
	* app/paint/gimpconvolve.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimperaser.c
	* app/paint/gimppaintbrush.c
	* app/paint/gimppaintcore.c
	* app/paint/gimppencil.c
	* app/paint/gimpsmudge.c
	* app/plug-in/plug-in.c
	* app/tools/gimpbezierselecttool.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpinktool.c
	* app/tools/gimppainttool.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* app/widgets/gimpdrawablepreview.c: changed accordingly.

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpitemlistview.[ch]: new widget implementing most
	of the stuff formerly done by GimpDrawableListView.

	* app/widgets/gimpchannellistview.c
	* app/widgets/gimpdrawablelistitem.c
	* app/widgets/gimpdrawablelistview.[ch]
	* app/widgets/gimplayerlistview.c: changed accordingly.

	* app/widgets/gimpdnd.[ch]: added a vectors DND type.

	* app/gui/menus.c
	* app/gui/dialogs.c
	* app/gui/dialogs-constructors.[ch]: added a vectors dialog and
	a vectors item_factory.

	* app/gui/Makefile.am
	* app/gui/vectors-commands.[ch]: new files implementing the
	callbacks for the new vectors dialog and item_factory.

	* app/pdb/pdb_glue.h: some more ugly hacks to keep intermediate
	perl code working...

	* tools/pdbgen/pdb.pl: added a vectors type, use GimpItem for all
	ID lookups.

	* tools/pdbgen/pdb/channel.pdb
	* tools/pdbgen/pdb/color.pdb
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/edit.pdb
	* tools/pdbgen/pdb/image.pdb
	* tools/pdbgen/pdb/layer.pdb
	* tools/pdbgen/pdb/misc_tools.pdb
	* tools/pdbgen/pdb/parasite.pdb
	* tools/pdbgen/pdb/selection.pdb
	* tools/pdbgen/pdb/selection_tools.pdb: misc changes according to
	stuff above.

	* app/pdb/channel_cmds.c
	* app/pdb/color_cmds.c
	* app/pdb/drawable_cmds.c
	* app/pdb/edit_cmds.c
	* app/pdb/floating_sel_cmds.c
	* app/pdb/image_cmds.c
	* app/pdb/layer_cmds.c
	* app/pdb/misc_tools_cmds.c
	* app/pdb/paint_tools_cmds.c
	* app/pdb/parasite_cmds.c
	* app/pdb/selection_cmds.c
	* app/pdb/selection_tools_cmds.c
	* app/pdb/text_tool_cmds.c
	* app/pdb/transform_tools_cmds.c: regenerated.
parent 7112b206
2002-02-25 Michael Natterer <mitch@gimp.org>
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitem.[ch]: new base class for something which is a
child of an image, has a PDB ID, a tattoo, parasites and emits
a "removed" signal.
* app/core/gimpdrawable.[ch]
* app/vectors/gimpvectors.[ch]: derive from GimpItem. Removed
lots of stuff from GimpDrawable.
* app/core/gimp.[ch]: changed gimp->drawable_table and
gimp->next_drawable_ID to gimp->item_table and gimp->next_item_id.
* app/undo.[ch]: s/undo_push_drawable_parasite/undo_push_item_parasite/,
minor cleanups.
* app/core/gimplayer.[ch]: changed gimp_layer_new_from_tiles() and
gimp_layer_new_from_drawable() to take the "dest_gimage" as
second, not first parameter.
* app/image_map.c
* app/core/gimpchannel.c
* app/core/gimpdrawable-blend.c
* app/core/gimpdrawable-bucket-fill.c
* app/core/gimpdrawable-histogram.c
* app/core/gimpdrawable-offset.c
* app/core/gimpdrawable-preview.c
* app/core/gimpdrawable-transform.c
* app/core/gimpedit.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-pick-color.c
* app/core/gimpimage.c
* app/core/gimplayer-floating-sel.c
* app/display/gimpdisplayshell-dnd.c
* app/file/file-save.c
* app/gui/channels-commands.c
* app/gui/file-save-dialog.c
* app/gui/layers-commands.c
* app/gui/offset-dialog.c
* app/gui/paths-dialog.c
* app/gui/toolbox.c
* app/paint/gimpairbrush.c
* app/paint/gimpclone.c
* app/paint/gimpconvolve.c
* app/paint/gimpdodgeburn.c
* app/paint/gimperaser.c
* app/paint/gimppaintbrush.c
* app/paint/gimppaintcore.c
* app/paint/gimppencil.c
* app/paint/gimpsmudge.c
* app/plug-in/plug-in.c
* app/tools/gimpbezierselecttool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpinktool.c
* app/tools/gimppainttool.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/widgets/gimpdrawablepreview.c: changed accordingly.
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimpitemlistview.[ch]: new widget implementing most
of the stuff formerly done by GimpDrawableListView.
* app/widgets/gimpchannellistview.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimpdrawablelistview.[ch]
* app/widgets/gimplayerlistview.c: changed accordingly.
* app/widgets/gimpdnd.[ch]: added a vectors DND type.
* app/gui/menus.c
* app/gui/dialogs.c
* app/gui/dialogs-constructors.[ch]: added a vectors dialog and
a vectors item_factory.
* app/gui/Makefile.am
* app/gui/vectors-commands.[ch]: new files implementing the
callbacks for the new vectors dialog and item_factory.
* app/pdb/pdb_glue.h: some more ugly hacks to keep intermediate
perl code working...
* tools/pdbgen/pdb.pl: added a vectors type, use GimpItem for all
ID lookups.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/color.pdb
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/layer.pdb
* tools/pdbgen/pdb/misc_tools.pdb
* tools/pdbgen/pdb/parasite.pdb
* tools/pdbgen/pdb/selection.pdb
* tools/pdbgen/pdb/selection_tools.pdb: misc changes according to
stuff above.
* app/pdb/channel_cmds.c
* app/pdb/color_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/edit_cmds.c
* app/pdb/floating_sel_cmds.c
* app/pdb/image_cmds.c
* app/pdb/layer_cmds.c
* app/pdb/misc_tools_cmds.c
* app/pdb/paint_tools_cmds.c
* app/pdb/parasite_cmds.c
* app/pdb/selection_cmds.c
* app/pdb/selection_tools_cmds.c
* app/pdb/text_tool_cmds.c
* app/pdb/transform_tools_cmds.c: regenerated.
2002-02-25 Simon Budig <simon@gimp.org>
* app/vectors/gimpbezierstroke.c
......
......@@ -531,7 +531,7 @@ channels_edit_channel_query (GimpChannel *channel)
options = g_new0 (EditChannelOptions, 1);
options->channel = channel;
options->gimage = gimp_drawable_gimage (GIMP_DRAWABLE (channel));
options->gimage = gimp_item_get_image (GIMP_ITEM (channel));
channel_color = channel->color;
......
......@@ -283,7 +283,7 @@ layers_invert_cmd_callback (GtkWidget *widget,
procedural_db_run_proc (gimage->gimp,
"gimp_invert",
&nreturn_vals,
GIMP_PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
GIMP_PDB_DRAWABLE, gimp_item_get_ID (GIMP_ITEM (drawable)),
GIMP_PDB_END);
if (!return_vals || return_vals[0].value.pdb_int != GIMP_PDB_SUCCESS)
......@@ -775,10 +775,10 @@ layers_edit_layer_query (GimpLayer *layer)
GtkWidget *hbox;
GtkWidget *label;
/* The new options structure */
options = g_new (EditLayerOptions, 1);
options = g_new0 (EditLayerOptions, 1);
options->layer = layer;
options->gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer));
options->gimage = gimp_item_get_image (GIMP_ITEM (layer));
/* The dialog */
options->query_box =
......@@ -861,8 +861,7 @@ add_mask_query_ok_callback (GtkWidget *widget,
options = (AddMaskOptions *) data;
if ((layer = (options->layer)) &&
(gimage = GIMP_DRAWABLE (layer)->gimage))
if ((layer = (options->layer)) && (gimage = GIMP_ITEM (layer)->gimage))
{
mask = gimp_layer_create_mask (layer, options->add_mask_type);
gimp_layer_add_mask (layer, mask, TRUE);
......@@ -884,7 +883,7 @@ layers_add_mask_query (GimpLayer *layer)
options->layer = layer;
options->add_mask_type = ADD_WHITE_MASK;
gimage = GIMP_DRAWABLE (layer)->gimage;
gimage = gimp_item_get_image (GIMP_ITEM (layer));
/* The dialog */
options->query_box =
......@@ -990,7 +989,6 @@ scale_layer_query_ok_callback (GtkWidget *widget,
gpointer data)
{
ScaleLayerOptions *options;
GimpImage *gimage;
GimpLayer *layer;
options = (ScaleLayerOptions *) data;
......@@ -998,9 +996,13 @@ scale_layer_query_ok_callback (GtkWidget *widget,
if (options->resize->width > 0 && options->resize->height > 0 &&
(layer = (options->layer)))
{
GimpImage *gimage;
gtk_widget_set_sensitive (options->resize->resize_shell, FALSE);
if ((gimage = GIMP_DRAWABLE (layer)->gimage) != NULL)
gimage = gimp_item_get_image (GIMP_ITEM (layer));
if (gimage)
{
undo_push_group_start (gimage, LAYER_SCALE_UNDO_GROUP);
......@@ -1079,7 +1081,6 @@ resize_layer_query_ok_callback (GtkWidget *widget,
gpointer data)
{
ResizeLayerOptions *options;
GimpImage *gimage;
GimpLayer *layer;
options = (ResizeLayerOptions *) data;
......@@ -1087,9 +1088,13 @@ resize_layer_query_ok_callback (GtkWidget *widget,
if (options->resize->width > 0 && options->resize->height > 0 &&
(layer = (options->layer)))
{
GimpImage *gimage;
gtk_widget_set_sensitive (options->resize->resize_shell, FALSE);
if ((gimage = GIMP_DRAWABLE (layer)->gimage) != NULL)
gimage = gimp_item_get_image (GIMP_ITEM (layer));
if (gimage)
{
undo_push_group_start (gimage, LAYER_RESIZE_UNDO_GROUP);
......
......@@ -1386,7 +1386,7 @@ plug_in_repeat (gboolean with_interface)
args[0].value.pdb_int = (with_interface ?
GIMP_RUN_INTERACTIVE : GIMP_RUN_WITH_LAST_VALS);
args[1].value.pdb_int = gimp_image_get_ID (gdisplay->gimage);
args[2].value.pdb_int = gimp_drawable_get_ID (gimp_image_active_drawable (gdisplay->gimage));
args[2].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (gimp_image_active_drawable (gdisplay->gimage)));
/* run the plug-in procedure */
plug_in_run (last_plug_in, args, 3, FALSE, TRUE, gdisplay->ID);
......@@ -1676,9 +1676,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_info = msg.data;
if (tile_info->shadow)
tm = gimp_drawable_shadow (gimp_drawable_get_by_ID (the_gimp, tile_info->drawable_ID));
tm = gimp_drawable_shadow ((GimpDrawable *) gimp_item_get_by_ID (the_gimp, tile_info->drawable_ID));
else
tm = gimp_drawable_data (gimp_drawable_get_by_ID (the_gimp, tile_info->drawable_ID));
tm = gimp_drawable_data ((GimpDrawable *) gimp_item_get_by_ID (the_gimp, tile_info->drawable_ID));
if (!tm)
{
......@@ -1713,9 +1713,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
else
{
if (tile_req->shadow)
tm = gimp_drawable_shadow (gimp_drawable_get_by_ID (the_gimp, tile_req->drawable_ID));
tm = gimp_drawable_shadow ((GimpDrawable *) gimp_item_get_by_ID (the_gimp, tile_req->drawable_ID));
else
tm = gimp_drawable_data (gimp_drawable_get_by_ID (the_gimp, tile_req->drawable_ID));
tm = gimp_drawable_data ((GimpDrawable *) gimp_item_get_by_ID (the_gimp, tile_req->drawable_ID));
if (!tm)
{
......@@ -2696,7 +2696,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = GIMP_RUN_INTERACTIVE;
args[1].value.pdb_int = gimp_image_get_ID (gdisplay->gimage);
args[2].value.pdb_int = gimp_drawable_get_ID (gimp_image_active_drawable (gdisplay->gimage));
args[2].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (gimp_image_active_drawable (gdisplay->gimage)));
argc = 3;
}
else
......@@ -2719,7 +2719,7 @@ plug_in_callback (GtkWidget *widget,
gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = gimp_image_get_ID (gdisplay->gimage);
args[2].value.pdb_int = gimp_drawable_get_ID (gimp_image_active_drawable (gdisplay->gimage));
args[2].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (gimp_image_active_drawable (gdisplay->gimage)));
argc = 3;
}
else
......
/* The GIMP -- an 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplist.h"
#include "vectors/gimpvectors.h"
#include "display/gimpdisplay-foreach.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "vectors-commands.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
/* public functions */
void
vectors_new_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
vectors_new_vectors_query (gimage, NULL);
}
void
vectors_raise_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
if (gimp_image_get_active_vectors (gimage))
{
gimp_image_raise_vectors (gimage, gimp_image_get_active_vectors (gimage));
gdisplays_flush ();
}
}
void
vectors_lower_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
if (gimp_image_get_active_vectors (gimage))
{
gimp_image_lower_vectors (gimage, gimp_image_get_active_vectors (gimage));
gdisplays_flush ();
}
}
void
vectors_duplicate_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
GimpVectors *new_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
new_vectors = NULL; /*gimp_vectors_copy (active_vectors,
G_TYPE_FROM_INSTANCE (active_vectors),
TRUE);*/
gimp_image_add_vectors (gimage, new_vectors, -1);
gdisplays_flush ();
}
}
void
vectors_delete_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
gimp_image_remove_vectors (gimage, active_vectors);
gdisplays_flush ();
}
}
void
vectors_vectors_to_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
GimpChannel *vectors_mask;
vectors_mask = NULL; /*gimp_vectors_to_channel (active_vectors);*/
gimp_image_mask_load (gimage, vectors_mask);
g_object_unref (G_OBJECT (vectors_mask));
gdisplays_flush ();
}
}
void
vectors_add_vectors_to_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
GimpChannel *vectors_mask;
GimpChannel *new_mask;
vectors_mask = NULL; /*gimp_vectors_to_channel (active_vectors);*/
new_mask = gimp_channel_copy (gimp_image_get_mask (gimage),
G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)),
TRUE);
gimp_channel_combine_mask (new_mask,
vectors_mask,
CHANNEL_OP_ADD,
0, 0); /* off x/y */
gimp_image_mask_load (gimage, new_mask);
g_object_unref (G_OBJECT (new_mask));
gdisplays_flush ();
}
}
void
vectors_sub_vectors_from_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
GimpChannel *vectors_mask;
GimpChannel *new_mask;
vectors_mask = NULL; /*gimp_vectors_to_channel (active_vectors);*/
new_mask = gimp_channel_copy (gimp_image_get_mask (gimage),
G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)),
TRUE);
gimp_channel_combine_mask (new_mask,
vectors_mask,
CHANNEL_OP_SUB,
0, 0); /* off x/y */
gimp_image_mask_load (gimage, new_mask);
g_object_unref (G_OBJECT (new_mask));
gdisplays_flush ();
}
}
void
vectors_intersect_vectors_with_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
GimpChannel *vectors_mask;
GimpChannel *new_mask;
vectors_mask = NULL; /*gimp_vectors_to_channel (active_vectors);*/
new_mask = gimp_channel_copy (gimp_image_get_mask (gimage),
G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)),
TRUE);
gimp_channel_combine_mask (new_mask,
vectors_mask,
CHANNEL_OP_INTERSECT,
0, 0); /* off x/y */
gimp_image_mask_load (gimage, new_mask);
g_object_unref (G_OBJECT (new_mask));
gdisplays_flush ();
}
}
void
vectors_sel_to_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_edit_vectors_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
vectors_edit_vectors_query (active_vectors);
}
}
/**********************************/
/* The new vectors query dialog */
/**********************************/
typedef struct _NewVectorsOptions NewVectorsOptions;
struct _NewVectorsOptions
{
GtkWidget *query_box;
GtkWidget *name_entry;
GimpImage *gimage;
};
static gchar *vectors_name = NULL;
static void
new_vectors_query_ok_callback (GtkWidget *widget,
gpointer data)
{
NewVectorsOptions *options;
GimpVectors *new_vectors;
GimpImage *gimage;
options = (NewVectorsOptions *) data;
if (vectors_name)
g_free (vectors_name);
vectors_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
if ((gimage = options->gimage))
{
new_vectors = g_object_new (GIMP_TYPE_VECTORS, NULL);
gimp_image_add_vectors (gimage, new_vectors, -1);
gimp_object_set_name (GIMP_OBJECT (new_vectors), vectors_name);
gdisplays_flush ();
}
gtk_widget_destroy (options->query_box);
}
void
vectors_new_vectors_query (GimpImage *gimage,
GimpVectors *template)
{
NewVectorsOptions *options;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *label;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! template || GIMP_IS_VECTORS (template));