]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-presentation-timer.c
[dualscreen] timer continue, maybe I should remove that text... [dualscreen] cleanup
[evince.git] / shell / ev-presentation-timer.c
index abf5d6d8fceebc143db58a2d9ddef3120678c418..6c5b93097dffedb645341ed6a072e96255423338 100644 (file)
@@ -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