aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/frame.c7
-rw-r--r--src/frame.h2
-rw-r--r--src/mainwindow.c8
3 files changed, 12 insertions, 5 deletions
diff --git a/src/frame.c b/src/frame.c
index 56e8f77..4fa7531 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -62,6 +62,7 @@ struct frame *frame_new()
n->pl = NULL;
n->contents = NULL;
+ n->sc = NULL;
return n;
}
@@ -125,13 +126,13 @@ struct frame *sc_unpack(const char *sc)
return NULL;
}
- show_heirarchy(fr, "");
+ show_hierarchy(fr, "");
return fr;
}
-void show_heirarchy(struct frame *fr, const char *t)
+void show_hierarchy(struct frame *fr, const char *t)
{
int i;
char tn[1024];
@@ -143,7 +144,7 @@ void show_heirarchy(struct frame *fr, const char *t)
fr->pix_w, fr->pix_h, fr->w, fr->h);
for ( i=0; i<fr->num_children; i++ ) {
- show_heirarchy(fr->children[i], tn);
+ show_hierarchy(fr->children[i], tn);
}
}
diff --git a/src/frame.h b/src/frame.h
index 5fb5297..4762b77 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -115,6 +115,6 @@ struct frame
extern struct frame *frame_new(void);
extern struct frame *add_subframe(struct frame *fr);
extern struct frame *sc_unpack(const char *sc);
-extern void show_heirarchy(struct frame *fr, const char *t);
+extern void show_hierarchy(struct frame *fr, const char *t);
#endif /* FRAME_H */
diff --git a/src/mainwindow.c b/src/mainwindow.c
index d43b926..23a0692 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -1081,6 +1081,7 @@ static gboolean button_release_sig(GtkWidget *da, GdkEventButton *event,
p->drag_corner_x - p->start_corner_x,
p->drag_corner_y - p->start_corner_y);
fr->sc = strdup("");
+ fr->sc_len = 1;
rerender_slide(p);
set_selection(p, fr);
break;
@@ -1368,22 +1369,27 @@ static void dnd_receive(GtkWidget *widget, GdkDragContext *drag_context,
struct frame *fr;
char *sc;
+ size_t len;
gtk_drag_finish(drag_context, TRUE, FALSE, time);
chomp(filename);
- sc = malloc(strlen(filename)+10);
+ len = strlen(filename)+10;
+ sc = malloc(len);
if ( sc == NULL ) {
free(filename);
fprintf(stderr, "Failed to allocate SC\n");
return;
}
+ snprintf(sc, len, "\\image{%s}", filename);
fr = create_frame(p, p->start_corner_x,
p->start_corner_y,
p->drag_corner_x - p->start_corner_x,
p->drag_corner_y - p->start_corner_y);
fr->sc = sc;
+ fr->sc_len = len;
+ show_hierarchy(fr, "");
rerender_slide(p);
set_selection(p, fr);
redraw_editor(p);