X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-presentation-timer.c;h=6c5b93097dffedb645341ed6a072e96255423338;hb=f28e9ccf4400e87da3fa9960becc6feb2ed041cb;hp=abf5d6d8fceebc143db58a2d9ddef3120678c418;hpb=924ff63b3a76744b4b0f6c98fc4dd3382f219023;p=evince.git diff --git a/shell/ev-presentation-timer.c b/shell/ev-presentation-timer.c index abf5d6d8..6c5b9309 100644 --- a/shell/ev-presentation-timer.c +++ b/shell/ev-presentation-timer.c @@ -33,7 +33,8 @@ struct _EvPresentationTimerPrivate { - cairo_surface_t *surface; + guint page; + guint pages; }; #define EV_PRESENTATION_TIMER_GET_PRIVATE(object) \ @@ -45,21 +46,41 @@ G_DEFINE_TYPE (EvPresentationTimer, ev_presentation_timer, GTK_TYPE_DRAWING_AREA static gboolean ev_presentation_timer_draw(GtkWidget *timer, cairo_t *cr) { - cairo_set_source_rgb(cr, 0, 0, 0); - cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, + EvPresentationTimer *ev_timer = EV_PRESENTATION_TIMER(timer); + GtkAllocation allocation; + gtk_widget_get_allocation (timer, &allocation); + //cairo_translate(cr,allocation.x,allocation.y); + cairo_set_source_rgb (cr, 0, 0, 0); + cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); - cairo_set_font_size(cr, 40.0); + cairo_set_font_size (cr, 40); + guint pos = (allocation.width/ev_timer->priv->pages)*ev_timer->priv->page; + cairo_move_to (cr, pos, 40); + cairo_show_text (cr, "Disziplin ist Macht."); - cairo_move_to(cr, 10.0, 50.0); - cairo_show_text(cr, "Disziplin ist Macht."); return FALSE; } +void +ev_presentation_timer_set_pages (EvPresentationTimer *ev_timer, guint pages) +{ + ev_timer->priv->pages = pages; +} + +void +ev_presentation_timer_set_page (EvPresentationTimer *ev_timer, guint page) +{ + ev_timer->priv->page = page; + gtk_widget_queue_draw(GTK_WIDGET(ev_timer)); +} + static void ev_presentation_timer_init (EvPresentationTimer *ev_timer) { -// ev_timer->priv = EV_DSCWINDOW_GET_PRIVATE (ev_timer); + ev_timer->priv = EV_PRESENTATION_TIMER_GET_PRIVATE (ev_timer); + ev_timer->priv->page = 0; + ev_timer->priv->pages = 0; } static void