diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-10-17 22:13:51 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2011-10-17 22:13:51 +0100 |
commit | a11196f4e47c312ff787d3990e0aa8edefa3e395 (patch) | |
tree | b43a99972750dc62aae39380e3bbdc2e9b856984 /src/slideshow.c | |
parent | c124f153354b6f63aa5f40dbe8e99b6b23cb416b (diff) |
New slide redraw logic
This way is much more straightforward, and allows rendering in many different sizes
Diffstat (limited to 'src/slideshow.c')
-rw-r--r-- | src/slideshow.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/slideshow.c b/src/slideshow.c index f5e2fd1..d702513 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -51,8 +51,6 @@ static gboolean ss_expose_sig(GtkWidget *da, GdkEventExpose *event, GtkAllocation allocation; double xoff, yoff; - check_redraw_slide(p->view_slide); - cr = gdk_cairo_create(da->window); /* Overall background */ @@ -71,7 +69,7 @@ static gboolean ss_expose_sig(GtkWidget *da, GdkEventExpose *event, /* Draw the slide from the cache */ cairo_rectangle(cr, event->area.x, event->area.y, event->area.width, event->area.height); - cairo_set_source_surface(cr, p->view_slide->render_cache, + cairo_set_source_surface(cr, p->cur_proj_slide->rendered_proj, xoff, yoff); cairo_fill(cr); @@ -91,14 +89,16 @@ void notify_slideshow_slide_changed(struct presentation *p) static gint prev_slide_sig(GtkWidget *widget, struct presentation *p) { - if ( p->view_slide_number == 0 ) return FALSE; + int cur_slide_number; + + cur_slide_number = slide_number(p, p->cur_proj_slide); + + if ( cur_slide_number == 0 ) return FALSE; - p->view_slide_number--; p->ss_blank = 0; - p->view_slide = p->slides[p->view_slide_number]; + p->cur_proj_slide = p->slides[cur_slide_number-1]; notify_slideshow_slide_changed(p); - notify_slide_changed(p); return FALSE; } @@ -106,14 +106,16 @@ static gint prev_slide_sig(GtkWidget *widget, struct presentation *p) static gint next_slide_sig(GtkWidget *widget, struct presentation *p) { - if ( p->view_slide_number == p->num_slides-1 ) return FALSE; + int cur_slide_number; + + cur_slide_number = slide_number(p, p->cur_proj_slide); + + if ( cur_slide_number == p->num_slides-1 ) return FALSE; - p->view_slide_number++; p->ss_blank = 0; - p->view_slide = p->slides[p->view_slide_number]; + p->cur_proj_slide = p->slides[cur_slide_number+1]; notify_slideshow_slide_changed(p); - notify_slide_changed(p); return FALSE; } @@ -124,6 +126,7 @@ void end_slideshow(struct presentation *p) gtk_widget_destroy(p->ss_drawingarea); gtk_widget_destroy(p->slideshow); p->slideshow = NULL; + p->cur_proj_slide = NULL; notify_slide_changed(p); } @@ -214,4 +217,7 @@ void try_start_slideshow(struct presentation *p) p->slideshow = n; gtk_window_fullscreen(GTK_WINDOW(n)); gtk_widget_show_all(GTK_WIDGET(n)); + + p->cur_proj_slide = p->cur_edit_slide; + redraw_slide(p->cur_proj_slide); } |