aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-10-13 23:31:15 +0200
committerThomas White <taw@bitwiz.org.uk>2011-10-13 23:31:15 +0200
commit2e0f09d78f28c576d9a10dfcd1eeaae81e3baa07 (patch)
tree9be7b14eefb4451ac6c2a2dccce24625dc3bf7af /src/mainwindow.c
parent7c54f36c7a5352dfd34322397ed322bb377b1abb (diff)
Add image handling basics
Diffstat (limited to 'src/mainwindow.c')
-rw-r--r--src/mainwindow.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index e111662..d02268f 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -30,6 +30,7 @@
#include <gtk/gtk.h>
#include <assert.h>
#include <gdk/gdkkeysyms.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
#include "presentation.h"
#include "mainwindow.h"
@@ -40,6 +41,7 @@
#include "loadsave.h"
#include "tool_select.h"
#include "tool_text.h"
+#include "tool_image.h"
static void add_ui_sig(GtkUIManager *ui, GtkWidget *widget,
@@ -983,11 +985,27 @@ static void dnd_receive(GtkWidget *widget, GdkDragContext *drag_context,
} else {
- printf("Drop: '%s'\n", seldata->data);
- gtk_drag_finish(drag_context, TRUE, FALSE, time);
+ gchar *uri;
+ char *filename;
+ GError *error = NULL;
+
+ uri = (gchar *)seldata->data;
- /* FIXME: Create a new image object according to image size and
- * current margins, consistent with box drawn for the preview */
+ filename = g_filename_from_uri(uri, NULL, &error);
+ if ( filename != NULL ) {
+
+ gtk_drag_finish(drag_context, TRUE, FALSE, time);
+ chomp(filename);
+ add_image_object(p->view_slide,
+ p->start_corner_x, p->start_corner_y,
+ p->import_width, p->import_height,
+ filename,
+ p->ss->styles[0], p->image_store,
+ p->image_tool);
+
+ /* Don't free "filename" - it's now owned by the
+ * image store. */
+ }
}
}
@@ -1047,6 +1065,7 @@ int open_mainwindow(struct presentation *p)
p->select_tool = initialise_select_tool();
p->text_tool = initialise_text_tool(p->drawingarea);
+ p->image_tool = initialise_image_tool();
p->cur_tool = p->select_tool;
gtk_widget_set_can_focus(GTK_WIDGET(p->drawingarea), TRUE);