From 924ff63b3a76744b4b0f6c98fc4dd3382f219023 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Bezdi=C4=8Dka?= <255993@mail.muni.cz> Date: Thu, 28 Apr 2011 19:53:28 +0200 Subject: [PATCH] [dualscreen] timer skeleton --- shell/ev-presentation-timer.c | 84 +++++++++++++++++++++++++++++++++++ shell/ev-presentation-timer.h | 55 +++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 shell/ev-presentation-timer.c create mode 100644 shell/ev-presentation-timer.h diff --git a/shell/ev-presentation-timer.c b/shell/ev-presentation-timer.c new file mode 100644 index 00000000..abf5d6d8 --- /dev/null +++ b/shell/ev-presentation-timer.c @@ -0,0 +1,84 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ +/* this file is part of evince, a gnome document viewer + * + * + * Author: + * Lukas Bezdicka <255993@mail.muni.cz> + * + * Evince is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Evince is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "ev-presentation-timer.h" + +struct _EvPresentationTimerPrivate +{ + cairo_surface_t *surface; +}; + +#define EV_PRESENTATION_TIMER_GET_PRIVATE(object) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_PRESENTATION_TIMER, EvPresentationTimerPrivate)) + +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, + CAIRO_FONT_WEIGHT_NORMAL); + cairo_set_font_size(cr, 40.0); + + cairo_move_to(cr, 10.0, 50.0); + cairo_show_text(cr, "Disziplin ist Macht."); + + return FALSE; +} + +static void +ev_presentation_timer_init (EvPresentationTimer *ev_timer) +{ +// ev_timer->priv = EV_DSCWINDOW_GET_PRIVATE (ev_timer); +} + +static void +ev_presentation_timer_class_init (EvPresentationTimerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + //GtkDrawingAreaClass *drawing_area_class = GTK_DRAWING_AREA_CLASS (klass); + g_type_class_add_private (object_class, sizeof (EvPresentationTimerPrivate)); + widget_class->draw = ev_presentation_timer_draw; + + /*object_class->finalize = ev_presentation_timer_finalize;*/ +} + +GtkWidget * +ev_presentation_timer_new (void) +{ + EvPresentationTimer *ev_timer; + + ev_timer = g_object_new (EV_TYPE_PRESENTATION_TIMER, NULL); + return GTK_WIDGET (ev_timer); +} diff --git a/shell/ev-presentation-timer.h b/shell/ev-presentation-timer.h new file mode 100644 index 00000000..3dc5208b --- /dev/null +++ b/shell/ev-presentation-timer.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ +/* this file is part of evince, a gnome document viewer + * + * + * Author: + * Lukas Bezdicka <255993@mail.muni.cz> + * + * Evince is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Evince is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _EV_PRESENTATION_TIMER_H_ +#define _EV_PRESENTATION_TIMER_H_ + +G_BEGIN_DECLS + +typedef struct _EvPresentationTimerClass EvPresentationTimerClass; +typedef struct _EvPresentationTimer EvPresentationTimer; +typedef struct _EvPresentationTimerPrivate EvPresentationTimerPrivate; + +#define EV_TYPE_PRESENTATION_TIMER (ev_presentation_timer_get_type ()) +#define EV_PRESENTATION_TIMER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), EV_TYPE_PRESENTATION_TIMER, EvPresentationTimer)) +#define EV_PRESENTATION_TIMER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_PRESENTATION_TIMER, EvPresentationTimerClass)) +#define EV_IS_PRESENTATION_TIMER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), EV_TYPE_PRESENTATION_TIMER)) +#define EV_IS_PRESENTATION_TIMER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_PRESENTATION_TIMER)) +#define EV_PRESENTATION_TIMER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), EV_TYPE_PRESENTATION_TIMER, EvPresentationTimerClass)) + +struct _EvPresentationTimerClass +{ + GtkDrawingAreaClass parent_class; +}; + +struct _EvPresentationTimer +{ + GtkDrawingArea parent_instance; + EvPresentationTimerPrivate *priv; +}; + +GType ev_presentation_timer_get_type (void); +GtkWidget *ev_presentation_timer_new (void); + +G_END_DECLS + +#endif /* _EV_PRESENTATION_TIMER_H_ */ -- 2.39.3