summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2008-06-10 03:38:48 -0400
committerSøren Sandmann <sandmann@redhat.com>2008-06-10 03:38:48 -0400
commitb8d937f6877a64726d2147478c7409ea0b593582 (patch)
tree925064b7455a78ec4c524cbea7d8fd43128dd8c1 /main.c
parentd25600cd73d18044f83f1b3803e96f11c2adcf83 (diff)
Maintain a width in the deck
Diffstat (limited to 'main.c')
-rw-r--r--main.c63
1 files changed, 44 insertions, 19 deletions
diff --git a/main.c b/main.c
index bbbe44d..0230d69 100644
--- a/main.c
+++ b/main.c
@@ -44,7 +44,7 @@ on_thumbs_paint (FooScrollArea *scroll_area,
foo_scroll_area_get_viewport (app->thumbnails, &viewport);
- deck_paint (app->deck, cr, 0, 0, viewport.width);
+ deck_paint_thumbs (app->deck, cr, 0, 0);
}
static void
@@ -54,9 +54,12 @@ on_thumbs_viewport_size_changed (FooScrollArea *scroll_area,
gpointer data)
{
App *app = data;
- int height = deck_get_height (app->deck, viewport->width);
- foo_scroll_area_set_size (scroll_area, viewport->width, height);
+ deck_set_thumb_width (app->deck, viewport->width);
+
+ foo_scroll_area_set_size (scroll_area,
+ viewport->width,
+ deck_get_thumb_height (app->deck));
}
static gboolean
@@ -98,6 +101,15 @@ invalidate_toolbar (App *app, GdkRectangle *viewport)
app->main_area, viewport->x, viewport->y);
}
+static int
+get_toolbar_width (App *app)
+{
+ if (is_maximized (app))
+ return toolbar_get_width (app->toolbar) + 12;
+ else
+ return toolbar_get_width (app->toolbar) + 6;
+}
+
static void
on_main_paint (FooScrollArea *scroll_area,
cairo_t *cr,
@@ -112,9 +124,7 @@ on_main_paint (FooScrollArea *scroll_area,
cairo_save (cr);
- cairo_translate (cr, 72 + 12, 0);
-
- deck_paint (app->deck, cr, 0, 0, viewport.width - (72 + 12) );
+ deck_paint_main (app->deck, cr, get_toolbar_width (app), 0);
cairo_restore (cr);
paint_toolbar (app, scroll_area, cr);
@@ -127,7 +137,11 @@ on_main_viewport_size_changed (FooScrollArea *scroll_area,
gpointer data)
{
App *app = data;
- int height = deck_get_height (app->deck, new_viewport->width);
+ int new_height;
+ int toolbar_width = get_toolbar_width (app);
+ int deck_width = new_viewport->width - toolbar_width;
+
+ /* Ugh, fixme */
static int first = 1;
if (first)
{
@@ -135,21 +149,32 @@ on_main_viewport_size_changed (FooScrollArea *scroll_area,
first = 0;
}
+ deck_set_main_width (app->deck, deck_width);
+ new_height = deck_get_main_height (app->deck);
+
if (old_viewport)
{
- int nth_slide = app->nth_slide; /* deck_get_view_slide (app->deck, old_viewport); */
- int old_location = deck_get_slide_location (app->deck,
- old_viewport->width,
- nth_slide);
- int new_location = deck_get_slide_location (app->deck,
- new_viewport->width,
- nth_slide);
- foo_scroll_area_set_size_fixed_y (scroll_area, new_viewport->width,
- height, old_location, new_location);
+ int nth_slide, old_location, new_location;
+
+ nth_slide = app->nth_slide;
+
+ deck_set_main_width (app->deck, old_viewport->width - toolbar_width);
+ old_location = deck_get_main_slide_location (app->deck, nth_slide);
+
+ deck_set_main_width (app->deck, deck_width);
+ new_location = deck_get_main_slide_location (app->deck, nth_slide);
+
+ foo_scroll_area_set_size_fixed_y (scroll_area,
+ new_viewport->width, new_height,
+ old_location, new_location);
}
else
{
- foo_scroll_area_set_size (scroll_area, new_viewport->width, height);
+ deck_set_main_width (app->deck, deck_width);
+
+ foo_scroll_area_set_size (scroll_area,
+ new_viewport->width,
+ new_height);
foo_scroll_area_set_viewport_pos (scroll_area, 0, 0);
}
@@ -167,8 +192,8 @@ make_thumbnail_viewable (App *app)
foo_scroll_area_get_viewport (area, &viewport);
- top = deck_get_slide_location (app->deck, viewport.width, app->nth_slide);
- height = deck_get_slide_height (app->deck, viewport.width);
+ top = deck_get_thumb_slide_location (app->deck, app->nth_slide);
+ height = deck_get_thumb_slide_height (app->deck);
if (top - margin < viewport.y)
viewport.y = top - margin;