diff --git a/src/gui/widgets/timeline/timeline-header-container.cpp b/src/gui/widgets/timeline/timeline-header-container.cpp index cd00a97cc..9b9f55dca 100644 --- a/src/gui/widgets/timeline/timeline-header-container.cpp +++ b/src/gui/widgets/timeline/timeline-header-container.cpp @@ -457,43 +457,13 @@ TimelineHeaderContainer::draw_header_decoration( else if(hoveringExpander == timeline_track) state_type = STATE_PRELIGHT; - 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, state_type, clip_rect, *this, "", box.get_x() + expand_button_size / 2 + margin, box.get_y() + box.get_height() / 2, - expander_style); + timeline_track->get_expander_style()); } shared_ptr diff --git a/src/gui/widgets/timeline/timeline-track.cpp b/src/gui/widgets/timeline/timeline-track.cpp index 45921e006..910b0e237 100644 --- a/src/gui/widgets/timeline/timeline-track.cpp +++ b/src/gui/widgets/timeline/timeline-track.cpp @@ -165,6 +165,37 @@ Track::tick_expand_animation() expandAnimationState == NoAnimationState); } +Gtk::ExpanderStyle +Track::get_expander_style() const +{ + const int notch = Track::MaxExpandAnimation / 3; + if(expanded) + { + if(expandAnimationState == Track::NoAnimationState) + return EXPANDER_EXPANDED; + else if(expandAnimationState >= notch * 2) + return EXPANDER_SEMI_EXPANDED; + else if(expandAnimationState >= notch) + return EXPANDER_SEMI_COLLAPSED; + else + return EXPANDER_COLLAPSED; + } + else + { + if(expandAnimationState == Track::NoAnimationState) + return EXPANDER_COLLAPSED; + else if(expandAnimationState <= notch) + return EXPANDER_SEMI_COLLAPSED; + else if(expandAnimationState <= notch * 2) + return EXPANDER_SEMI_EXPANDED; + else + return EXPANDER_EXPANDED; + } + + ERROR(gui, "Track::get_expander_style() final return reached"); + return EXPANDER_COLLAPSED; // This should never happen +} + void Track::show_header_context_menu(guint button, guint32 time) { diff --git a/src/gui/widgets/timeline/timeline-track.hpp b/src/gui/widgets/timeline/timeline-track.hpp index ad3c814d5..9a33b9ce6 100644 --- a/src/gui/widgets/timeline/timeline-track.hpp +++ b/src/gui/widgets/timeline/timeline-track.hpp @@ -66,6 +66,8 @@ public: void tick_expand_animation(); + Gtk::ExpanderStyle get_expander_style() const; + void show_header_context_menu(guint button, guint32 time); virtual void draw_track(Cairo::RefPtr cairo,