From 1adc490d552edde21b8b7a42657bc053f7a842a5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 6 Dec 2013 23:13:26 +0100 Subject: More re-ordering fixes --- src/mainwindow.c | 2 +- src/mainwindow.h | 1 + src/slide_sorter.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mainwindow.c b/src/mainwindow.c index fcd49a1..1b6c4b3 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -129,7 +129,7 @@ static void show_error(struct presentation *p, const char *message) } -static void update_toolbar(struct presentation *p) +void update_toolbar(struct presentation *p) { GtkWidget *d; int cur_slide_number; diff --git a/src/mainwindow.h b/src/mainwindow.h index ae8209a..b406492 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -34,6 +34,7 @@ extern int open_mainwindow(struct presentation *p); extern void change_edit_slide(struct presentation *p, struct slide *np); extern void redraw_editor(struct presentation *p); extern void update_titlebar(struct presentation *p); +extern void update_toolbar(struct presentation *p); #endif /* MAINWINDOW_H */ diff --git a/src/slide_sorter.c b/src/slide_sorter.c index e313016..3828e3b 100644 --- a/src/slide_sorter.c +++ b/src/slide_sorter.c @@ -313,6 +313,18 @@ static gboolean dnd_drop(GtkWidget *widget, GdkDragContext *drag_context, } +/* Normally, we don't need to explicitly render proj because the editor always + * gets there first. When re-arranging slides, this might not happen */ +static void fixup_proj(struct presentation *p, struct slide *s) +{ + if ( s->rendered_proj != NULL ) return; + + s->rendered_proj = render_slide(s, s->parent->proj_slide_width, + p->slide_width, p->slide_height, + p->is, ISZ_SLIDESHOW); +} + + static void dnd_receive(GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *seldata, guint info, guint time, struct slide_sorter *n) @@ -356,9 +368,14 @@ static void dnd_receive(GtkWidget *widget, GdkDragContext *drag_context, if ( n->dragging_cur_edit_slide ) { change_edit_slide(n->p, s); + } else { + /* Slide order has changed, so slide change + * buttons might need to be greyed out */ + update_toolbar(n->p); } if ( n->dragging_cur_proj_slide ) { + fixup_proj(n->p, s); change_proj_slide(n->p, s); } @@ -443,6 +460,7 @@ static void dnd_delete(GtkWidget *widget, GdkDragContext *drag_context, } change_edit_slide(n->p, n->p->slides[ct]); + update_toolbar(n->p); } -- cgit v1.2.3