From 18d7290c616065540ef8dc8590b0e1cb7b8e342d Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 3 Jan 2009 17:36:33 +0000 Subject: [PATCH] Added expander button animation --- .../timeline/timeline-header-container.cpp | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/timeline/timeline-header-container.cpp b/src/gui/widgets/timeline/timeline-header-container.cpp index d2bcef5ba..cd00a97cc 100644 --- a/src/gui/widgets/timeline/timeline-header-container.cpp +++ b/src/gui/widgets/timeline/timeline-header-container.cpp @@ -457,9 +457,35 @@ TimelineHeaderContainer::draw_header_decoration( else if(hoveringExpander == timeline_track) state_type = STATE_PRELIGHT; - const ExpanderStyle expander_style = - timeline_track->get_expanded() ? + ExpanderStyle expander_style; + const int animation_state = + timeline_track->get_expand_animation_state(); + + if(animation_state == Track::NoAnimationState) + expander_style = timeline_track->get_expanded() ? EXPANDER_EXPANDED : EXPANDER_COLLAPSED; + else + { + const int notch = Track::MaxExpandAnimation / 3; + if(timeline_track->get_expanded()) + { + if(animation_state >= notch * 2) + expander_style = EXPANDER_SEMI_EXPANDED; + else if(animation_state >= notch) + expander_style = EXPANDER_SEMI_COLLAPSED; + else + expander_style = EXPANDER_COLLAPSED; + } + else + { + if(animation_state <= notch) + expander_style = EXPANDER_COLLAPSED; + else if(animation_state <= notch * 2) + expander_style = EXPANDER_SEMI_COLLAPSED; + else + expander_style = EXPANDER_SEMI_EXPANDED; + } + } if(!model_track->get_child_tracks().empty()) style->paint_expander (gdkWindow,