[gnome-builder] libide: improve shrink theatric animation
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: improve shrink theatric animation
- Date: Tue, 24 Mar 2015 00:03:41 +0000 (UTC)
commit 5d378b7b38d2a863399ed450a050054822efd257
Author: Christian Hergert <christian hergert me>
Date: Fri Mar 6 13:21:14 2015 -0800
libide: improve shrink theatric animation
libide/ide-source-view.c | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 485258a..7bf4533 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -312,6 +312,7 @@ animate_shrink (IdeSourceView *self,
GtkTextIter copy_begin;
GtkTextIter copy_end;
gboolean is_whole_line;
+ gboolean is_single_line;
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (begin);
@@ -323,8 +324,14 @@ animate_shrink (IdeSourceView *self,
copy_begin = *begin;
copy_end = *end;
+
gtk_text_iter_order (©_begin, ©_end);
- is_whole_line = gtk_text_iter_starts_line (©_begin) && gtk_text_iter_ends_line (©_end);
+
+ is_single_line = (gtk_text_iter_get_line (©_begin) == gtk_text_iter_get_line (©_end));
+ is_whole_line = ((gtk_text_iter_get_line (©_begin) + 1 ==
+ gtk_text_iter_get_line (©_end)) &&
+ (gtk_text_iter_starts_line (©_begin) &&
+ gtk_text_iter_starts_line (©_end)));
theatric = g_object_new (IDE_TYPE_BOX_THEATRIC,
"alpha", 0.3,
@@ -347,9 +354,9 @@ animate_shrink (IdeSourceView *self,
"width", rect.width,
"y", rect.y,
"height", 0,
- "alpha", 0.0,
+ "alpha", 0.3,
NULL);
- else
+ else if (is_single_line)
ide_object_animate_full (theatric,
IDE_ANIMATION_EASE_OUT_QUAD,
150,
@@ -360,7 +367,20 @@ animate_shrink (IdeSourceView *self,
"width", 0,
"y", rect.y,
"height", rect.height,
- "alpha", 0.0,
+ "alpha", 0.3,
+ NULL);
+ else
+ ide_object_animate_full (theatric,
+ IDE_ANIMATION_EASE_OUT_QUAD,
+ 250,
+ gtk_widget_get_frame_clock (GTK_WIDGET (self)),
+ g_object_unref,
+ theatric,
+ "x", rect.x + (rect.width / 2),
+ "width", 0,
+ "y", rect.y + (rect.height / 2),
+ "height", 0,
+ "alpha", 0.3,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]