1 /* ev-transition-effect.c
2 * this file is part of evince, a gnome document viewer
4 * Copyright (C) 2007 Carlos Garnacho <carlos@imendio.com>
6 * Evince is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * Evince is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "ev-transition-effect.h"
25 #include "ev-document-type-builtins.h"
27 #define EV_TRANSITION_EFFECT_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EV_TYPE_TRANSITION_EFFECT, EvTransitionEffectPrivate))
29 typedef struct EvTransitionEffectPrivate EvTransitionEffectPrivate;
31 struct EvTransitionEffectPrivate {
32 EvTransitionEffectType type;
33 EvTransitionEffectAlignment alignment;
34 EvTransitionEffectDirection direction;
40 guint rectangular : 1;
54 G_DEFINE_TYPE (EvTransitionEffect, ev_transition_effect, G_TYPE_OBJECT)
57 ev_transition_effect_set_property (GObject *object,
62 EvTransitionEffectPrivate *priv;
64 priv = EV_TRANSITION_EFFECT_GET_PRIV (object);
68 priv->type = g_value_get_enum (value);
71 priv->alignment = g_value_get_enum (value);
74 priv->direction = g_value_get_enum (value);
77 priv->duration = g_value_get_int (value);
80 priv->angle = g_value_get_int (value);
83 priv->scale = g_value_get_double (value);
85 case PROP_RECTANGULAR:
86 priv->rectangular = g_value_get_boolean (value);
89 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
95 ev_transition_effect_get_property (GObject *object,
100 EvTransitionEffectPrivate *priv;
102 priv = EV_TRANSITION_EFFECT_GET_PRIV (object);
106 g_value_set_enum (value, priv->type);
109 g_value_set_enum (value, priv->alignment);
112 g_value_set_enum (value, priv->direction);
115 g_value_set_int (value, priv->duration);
118 g_value_set_int (value, priv->angle);
121 g_value_set_double (value, priv->scale);
123 case PROP_RECTANGULAR:
124 g_value_set_enum (value, priv->rectangular);
127 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
133 ev_transition_effect_init (EvTransitionEffect *effect)
135 EvTransitionEffectPrivate *priv;
137 priv = EV_TRANSITION_EFFECT_GET_PRIV (effect);
143 ev_transition_effect_class_init (EvTransitionEffectClass *klass)
145 GObjectClass *object_class = G_OBJECT_CLASS (klass);
147 object_class->set_property = ev_transition_effect_set_property;
148 object_class->get_property = ev_transition_effect_get_property;
150 g_object_class_install_property (object_class,
152 g_param_spec_enum ("type",
154 "Page transition effect type",
155 EV_TYPE_TRANSITION_EFFECT_TYPE,
156 EV_TRANSITION_EFFECT_REPLACE,
158 g_object_class_install_property (object_class,
160 g_param_spec_enum ("alignment",
162 "Alignment for the effect",
163 EV_TYPE_TRANSITION_EFFECT_ALIGNMENT,
164 EV_TRANSITION_ALIGNMENT_HORIZONTAL,
166 g_object_class_install_property (object_class,
168 g_param_spec_enum ("direction",
170 "Direction for the effect",
171 EV_TYPE_TRANSITION_EFFECT_DIRECTION,
172 EV_TRANSITION_DIRECTION_INWARD,
174 g_object_class_install_property (object_class,
176 g_param_spec_int ("duration",
178 "Effect duration in seconds",
181 g_object_class_install_property (object_class,
183 g_param_spec_int ("angle",
185 "Effect angle in degrees, counted "
186 "counterclockwise from left to right",
189 g_object_class_install_property (object_class,
191 g_param_spec_double ("scale",
193 "Scale at which the effect is applied",
196 g_object_class_install_property (object_class,
198 g_param_spec_boolean ("rectangular",
200 "Whether the covered area is rectangular",
204 g_type_class_add_private (klass, sizeof (EvTransitionEffectPrivate));
208 ev_transition_effect_new (EvTransitionEffectType type,
209 const gchar *first_property_name,
215 object = g_object_new (EV_TYPE_TRANSITION_EFFECT,
219 va_start (args, first_property_name);
220 g_object_set_valist (object, first_property_name, args);
223 return EV_TRANSITION_EFFECT (object);