[glide] Animation comboboxes work now...this whole animation stuff is a little nasty
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Animation comboboxes work now...this whole animation stuff is a little nasty
- Date: Wed, 28 Apr 2010 07:03:16 +0000 (UTC)
commit 400c18f3c5edbd81c111f4caeb02bbf579d03609
Author: Robert Carr <racarr Valentine localdomain>
Date: Wed Apr 28 03:03:11 2010 -0400
Animation comboboxes work now...this whole animation stuff is a little nasty
src/glide-animation-manager.c | 1 +
src/glide-vala-animations.vala | 26 +++++++++++++++++++++++-
src/glide-window.c | 43 ++++++++++++++++++++++++++--------------
3 files changed, 54 insertions(+), 16 deletions(-)
---
diff --git a/src/glide-animation-manager.c b/src/glide-animation-manager.c
index 4437887..9ec986e 100644
--- a/src/glide-animation-manager.c
+++ b/src/glide-animation-manager.c
@@ -298,6 +298,7 @@ void
glide_animation_manager_register_animations ()
{
glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_fade, NULL, "Fade");
+ glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_fall, NULL, "Fall");
glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_drop, NULL, "Drop");
glide_animation_manager_register_animation (glide_animations_animate_zoom, NULL, "Zoom");
glide_animation_manager_register_animation (glide_animations_animate_zoom_contents, NULL, "Zoom Contents");
diff --git a/src/glide-vala-animations.vala b/src/glide-vala-animations.vala
index 3c657d0..28ba7a5 100644
--- a/src/glide-vala-animations.vala
+++ b/src/glide-vala-animations.vala
@@ -1,4 +1,5 @@
namespace Glide {
+
public static
Clutter.Timeline animate_fade (AnimationInfo info,
Clutter.Actor a,
@@ -147,5 +148,28 @@ namespace Glide {
}
-
+ public static
+ Clutter.Timeline animate_fall (AnimationInfo info,
+ Clutter.Actor a,
+ Clutter.Actor b)
+ {
+ Clutter.Alpha animation_alpha;
+ var timeline = new Clutter.Timeline(info.duration);
+ b.show_all();
+ a.raise (b);
+ a.depth = 1;
+
+ animation_alpha = new Clutter.Alpha.full(timeline, Clutter.AnimationMode.EASE_IN_QUART);
+ timeline.new_frame.connect((m) => {
+ a.set_rotation(Clutter.RotateAxis.X_AXIS, -90.0 * animation_alpha.alpha, 0, a.height, 0);
+ });
+ timeline.completed.connect((m) => {
+ a.set_rotation (Clutter.RotateAxis.X_AXIS, 0, 0, a.height, 0);
+ a.hide_all ();
+ });
+
+ timeline.start ();
+
+ return timeline;
+ }
}
\ No newline at end of file
diff --git a/src/glide-window.c b/src/glide-window.c
index f729112..8c99185 100644
--- a/src/glide-window.c
+++ b/src/glide-window.c
@@ -142,7 +142,6 @@ glide_window_enable_document_actions (GlideWindow *w)
glide_window_enable_widget (w, "animation-combobox");
glide_window_enable_widget (w, "text-color-button");
-
}
static void
@@ -165,18 +164,27 @@ static void
glide_window_animation_box_set_animation_option (GlideWindow *w,
const GlideAnimationInfo *info)
{
- GtkComboBox *c = GTK_COMBO_BOX (GLIDE_WINDOW_UI_OBJECT (w, "animation-option-combobox"));
+ GtkComboBox *c = GTK_COMBO_BOX (GLIDE_WINDOW_UI_OBJECT (w, "animation-option-combobox"));
GtkTreeModel *m = gtk_combo_box_get_model (c);
GtkTreeIter iter;
const gchar *option;
- if (!info || !info->option)
- option = "None";
+ if (!info)
+ return;
+ else if (!info->option && info->animation->list_options)
+ {
+ gtk_tree_model_get_iter_first (m, &iter);
+ gtk_combo_box_set_active_iter (c, &iter);
+
+ return;
+ }
else
option = info->option;
- if (!gtk_tree_model_get_iter_first (m, &iter))
+ if (!info->animation->list_options)
return;
+
+ gtk_tree_model_get_iter_first (m, &iter);
do {
gchar *e;
@@ -216,7 +224,7 @@ glide_window_animation_box_set_animation (GlideWindow *w,
if (!strcmp (e, animation))
{
gtk_combo_box_set_active_iter (c, &iter);
- glide_window_animation_box_set_animation_option (w, info);
+ // glide_window_animation_box_set_animation_option (w, info);
g_free (e);
return;
@@ -744,6 +752,9 @@ glide_window_update_animation_options_box (GlideWindow *w,
GtkListStore *store;
GtkTreeIter iter;
GList *options, *o;
+ GlideSlide *s = glide_document_get_nth_slide (w->priv->document,
+ glide_stage_manager_get_current_slide (w->priv->manager));
+ GlideAnimationInfo *info = glide_slide_get_animation (s);
store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_combo_box_set_model (c, GTK_TREE_MODEL (store));
@@ -762,11 +773,8 @@ glide_window_update_animation_options_box (GlideWindow *w,
-1);
}
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
- gtk_combo_box_set_active_iter (c, &iter);
-
glide_animation_manager_free_options (options);
-
+ glide_window_animation_box_set_animation_option (w, info);
}
void
@@ -801,6 +809,7 @@ glide_window_animations_box_changed_cb (GtkWidget *cbox,
GlideSlide *s = glide_document_get_nth_slide (w->priv->document,
glide_stage_manager_get_current_slide (w->priv->manager));
GlideAnimationInfo info;
+ GlideAnimationInfo *old_info;
const GlideAnimation *ga;
if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX (cbox), &iter))
@@ -811,14 +820,20 @@ glide_window_animations_box_changed_cb (GtkWidget *cbox,
gtk_tree_model_get(model, &iter, 0, &animation, -1);
}
+ old_info = glide_slide_get_animation (s);
+
ga = glide_animation_manager_get_animation (animation);
info.duration = 1000;
info.animation = ga;
- info.option = NULL;
-
- glide_window_update_animation_options_box (w, ga);
+ if (old_info && old_info->animation &&
+ !strcmp (old_info->animation->name, info.animation->name))
+ info.option = g_strdup (old_info->option);
+ else
+ info.option = NULL;
glide_slide_set_animation (s, &info);
+ glide_window_update_animation_options_box (w, ga);
+
g_free (animation);
}
@@ -1351,8 +1366,6 @@ glide_window_file_open_response_callback (GtkDialog *dialog,
{
gchar *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- g_message("Loading file: %s \n", filename);
-
glide_window_close_document (w);
glide_window_open_document (w, filename);
g_free (filename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]