added gimp_display_shell_drop_svg() (untested because there is no place to

2003-12-21  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell-dnd.[ch]: added
	gimp_display_shell_drop_svg() (untested because there is no place
	to drag an SVG from yet...).

	* app/display/gimpdisplayshell.c (gimp_display_shell_init):
	connect SVG drops to the new callback.
This commit is contained in:
Michael Natterer
2003-12-21 22:09:03 +00:00
committed by Michael Natterer
parent dfba90fe46
commit 92a3a65e8e
5 changed files with 51 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2003-12-21 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-dnd.[ch]: added
gimp_display_shell_drop_svg() (untested because there is no place
to drag an SVG from yet...).
* app/display/gimpdisplayshell.c (gimp_display_shell_init):
connect SVG drops to the new callback.
2003-12-21 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdnd.[ch]: changed "svg_data" from guchar* to

View File

@ -36,6 +36,7 @@
#include "core/gimptoolinfo.h"
#include "vectors/gimpvectors.h"
#include "vectors/gimpvectors-import.h"
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
@ -130,6 +131,37 @@ gimp_display_shell_drop_vectors (GtkWidget *widget,
}
}
void
gimp_display_shell_drop_svg (GtkWidget *widget,
const gchar *svg_data,
gint svg_data_len,
gpointer data)
{
GimpDisplay *gdisp;
GError *error = NULL;
gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
if (gdisp->gimage->gimp->busy)
return;
g_print ("drop SVG on canvas\n");
if (! gimp_vectors_import_buffer (gdisp->gimage, svg_data, svg_data_len,
TRUE, TRUE, &error))
{
g_message (error->message);
g_clear_error (&error);
}
else
{
gimp_image_flush (gdisp->gimage);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
}
}
static void
gimp_display_shell_bucket_fill (GimpImage *gimage,
GimpBucketFillMode fill_mode,

View File

@ -26,6 +26,10 @@ void gimp_display_shell_drop_drawable (GtkWidget *widget,
void gimp_display_shell_drop_vectors (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
void gimp_display_shell_drop_svg (GtkWidget *widget,
const gchar *svg_data,
gint svg_data_length,
gpointer data);
void gimp_display_shell_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);

View File

@ -325,6 +325,9 @@ gimp_display_shell_init (GimpDisplayShell *shell)
gimp_dnd_viewable_dest_add (GTK_WIDGET (shell), GIMP_TYPE_CHANNEL,
gimp_display_shell_drop_drawable,
shell);
gimp_dnd_svg_dest_add (GTK_WIDGET (shell),
gimp_display_shell_drop_svg,
shell);
gimp_dnd_viewable_dest_add (GTK_WIDGET (shell), GIMP_TYPE_VECTORS,
gimp_display_shell_drop_vectors,
shell);

View File

@ -325,6 +325,9 @@ gimp_display_shell_init (GimpDisplayShell *shell)
gimp_dnd_viewable_dest_add (GTK_WIDGET (shell), GIMP_TYPE_CHANNEL,
gimp_display_shell_drop_drawable,
shell);
gimp_dnd_svg_dest_add (GTK_WIDGET (shell),
gimp_display_shell_drop_svg,
shell);
gimp_dnd_viewable_dest_add (GTK_WIDGET (shell), GIMP_TYPE_VECTORS,
gimp_display_shell_drop_vectors,
shell);