Refactored creating Track::get_expander_style()
This commit is contained in:
parent
18d7290c61
commit
c401207dba
3 changed files with 34 additions and 31 deletions
|
|
@ -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<timeline::Track>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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::Context> cairo,
|
||||
|
|
|
|||
Loading…
Reference in a new issue