diff options
author | Søren Sandmann <sandmann@redhat.com> | 2008-06-07 17:52:24 -0400 |
---|---|---|
committer | Søren Sandmann <sandmann@redhat.com> | 2008-06-07 17:52:24 -0400 |
commit | 7d738b3680bcb36a6b245615dddff2d2d37dec24 (patch) | |
tree | 92e590e7b9dfd9abec39004e6c5851c29350f9cc | |
parent | 7b9a2aa438c2eed48c81846750a02ba8be5cd1db (diff) |
Move more stuff to deck.[ch]
-rw-r--r-- | deck.c | 8 | ||||
-rw-r--r-- | deck.h | 2 | ||||
-rw-r--r-- | main.c | 32 |
3 files changed, 20 insertions, 22 deletions
@@ -89,3 +89,11 @@ deck_get_slide_location (Deck *deck, return nth_slide * (MARGIN + slide_height) + MARGIN; } + +int +deck_get_height (Deck *deck, GdkRectangle *viewport) +{ + int slide_height = get_slide_height (deck, viewport); + + return N_SLIDES * slide_height + (N_SLIDES + 1) * MARGIN; +} @@ -23,3 +23,5 @@ int deck_get_slide_location (Deck *deck, GdkRectangle *viewport, int nth_slide); +int +deck_get_height (Deck *deck, GdkRectangle *viewport); @@ -66,30 +66,18 @@ on_main_paint (FooScrollArea *scroll_area, static void on_main_viewport_size_changed (FooScrollArea *scroll_area, - GdkRectangle *viewport, - GdkRectangle *old_viewport) + GdkRectangle *new_viewport, + GdkRectangle *old_viewport, + gpointer data) { - int total_height; - int nth_slide; - double old_y; - double new_y; - - /* Compute the y-coordinate of the first visible top edge of a slide */ - nth_slide = - (old_viewport->y - MARGIN) / (MARGIN + (double)slide_height) + 1; - - old_y = nth_slide * (MARGIN + (double)slide_height) + MARGIN; - - slide_width = viewport->width - 2 * MARGIN; - slide_height = slide_width / RATIO; - - new_y = nth_slide * (MARGIN + (double)slide_height) + MARGIN; - - total_height = N_SLIDES * slide_height + (N_SLIDES + 1) * MARGIN; + App *app = data; + int nth_slide = deck_get_view_slide (app->deck, old_viewport); + int old_location = deck_get_slide_location (app->deck, old_viewport, nth_slide); + int new_location = deck_get_slide_location (app->deck, new_viewport, nth_slide); + int height = deck_get_height (app->deck, new_viewport); - foo_scroll_area_set_size_fixed_y (scroll_area, viewport->width, - total_height, - old_y + 0.5, new_y + 0.5); + foo_scroll_area_set_size_fixed_y (scroll_area, new_viewport->width, + height, old_location, new_location); foo_scroll_area_invalidate (scroll_area); } |