Lumiera  0.pre.03
»edityourfreedom«
Track Class Referenceabstract

#include "gui/widget/timeline/timeline-track.hpp"

Description

Timeline tracks are created by the timeline widget to correspond to model tracks.

Timeline tracks are used to store UI specific state data.

Definition at line 64 of file timeline-track.hpp.

Public Types

enum  ExpandDirection {
  None,
  Expand,
  Collapse
}
 An enum used by the branch expand/collapse animation. More...
 

Public Member Functions

 Track (TimelineWidget &owner, shared_ptr< model::Track > track)
 
virtual ~Track ()
 this is an abstract base class More...
 
virtual void draw_track (Cairo::RefPtr< Cairo::Context > cairo, TimelineViewWindow *const window) const =0
 Draw the track. More...
 
void expand_collapse (ExpandDirection direction)
 Expands or collapses this branch. More...
 
float get_expand_animation_state () const
 The current expand state. More...
 
bool get_expanded () const
 Gets whether the descendant tracks are expanded or collapsed. More...
 
Gtk::ExpanderStyle get_expander_style () const
 Calculates the expander style, given the animation state. More...
 
Gtk::Widget & get_header_widget ()
 
int get_height () const
 Return the visual height of the track in pixels. More...
 
virtual shared_ptr< timeline::ClipgetClipAt (Time position) const
 Gets the clip that is occupying the given time. More...
 
shared_ptr< model::TrackgetModelTrack () const
 
bool is_expand_animating () const
 Gets whether the branch is animation. More...
 
void show_header_context_menu (guint button, guint32 time)
 
void tick_expand_animation ()
 When this track is being animated, tick_expand_animation must be called repeatedly to cause the animation to progress. More...
 

Friends

class TimelineHeaderWidget
 

Protected Attributes

shared_ptr< model::TrackmodelTrack
 
TimelineWidgettimelineWidget
 

Private Member Functions

void on_remove_track ()
 Event handler for when the user requested to remove the track. More...
 
void on_set_name ()
 Event handler for when the user requested a name change. More...
 
void onEnabledChanged (bool)
 Event handler for when the enabled status changes. More...
 
void onLockedChanged (bool)
 Event handler for when the locked status changes. More...
 
void onNameChanged (std::string)
 Event handler for when the track name changes. More...
 
void onToggleEnabled ()
 Event handler for when the user pressed the Enable button. More...
 
void onToggleLocked ()
 Event handler for when the user pressed the Lock button. More...
 
void updateEnableButton ()
 
void updateLockButton ()
 
void updateName ()
 

Private Attributes

ButtonBar buttonBar
 
Gtk::Menu contextMenu
 
MiniButton enableButton
 
std::unique_ptr< Glib::Timer > expand_timer
 An internal timer used for the expand/collapse animation. More...
 
double expandAnimationState
 The current expand state. More...
 
ExpandDirection expandDirection
 This enum specifies which direction the expand/collapse animation is moving - if any. More...
 
bool expanded
 This bool is true if this branch is expanded. More...
 
Gtk::VBox headerBox
 
timeline::TimelineHeaderWidget headerWidget
 
MiniButton lockButton
 
Gtk::Entry titleBox
 
MenuButton titleMenuButton
 

Static Private Attributes

static const float ExpandAnimationPeriod
 Specifies the period of the expand animation in seconds. More...
 

Member Enumeration Documentation

◆ ExpandDirection

An enum used by the branch expand/collapse animation.

ExpandDirection represents whether the branch us being expanded or collapsed, or neither.

Enumerator
None 
Expand 
Collapse 

Definition at line 73 of file timeline-track.hpp.

Constructor & Destructor Documentation

◆ Track()

◆ ~Track()

~Track ( )
virtual

this is an abstract base class

Definition at line 106 of file timeline-track.cpp.

References Track::headerBox, and Track::headerWidget.

Member Function Documentation

◆ get_header_widget()

Gtk::Widget & get_header_widget ( )

Definition at line 113 of file timeline-track.cpp.

References Track::headerWidget.

◆ getModelTrack()

shared_ptr< model::Track > getModelTrack ( ) const

Definition at line 120 of file timeline-track.cpp.

References Track::modelTrack.

Referenced by TimelineHeaderWidget::on_expose_event().

+ Here is the caller graph for this function:

◆ get_height()

int get_height ( ) const

Return the visual height of the track in pixels.

Returns
The visual height of the track in pixels.

Definition at line 127 of file timeline-track.cpp.

Referenced by ClipTrack::draw_track().

+ Here is the caller graph for this function:

◆ get_expanded()

bool get_expanded ( ) const

Gets whether the descendant tracks are expanded or collapsed.

Returns
Returns true if the branch is expanded, false if it's collapsed.
See also
expand_collapse

Definition at line 134 of file timeline-track.cpp.

References Track::expanded.

Referenced by TimelineHeaderWidget::on_button_release_event().

+ Here is the caller graph for this function:

◆ expand_collapse()

void expand_collapse ( ExpandDirection  direction)

Expands or collapses this branch.

Parameters
directionSpecifies whether this branch should be expanded or collapse. direction must not equal None

Definition at line 149 of file timeline-track.cpp.

References Track::Expand, Track::expand_timer, Track::expandAnimationState, Track::expandDirection, Track::expanded, and Track::None.

Referenced by TimelineHeaderWidget::on_button_release_event().

+ Here is the caller graph for this function:

◆ get_expand_animation_state()

float get_expand_animation_state ( ) const

The current expand state.

Returns
Returns the expand state value, this value is a number between 0 and 1.0, and is recalculated by tick_expand_animation().
Remarks
A value of 1.0 is given when the branch is fully expanded (and animating), 0.0 is given when the branch is fully collapsed (and animating). When the branch is not animating this value has an indeterminate value.
See also
tick_expand_animation

Definition at line 177 of file timeline-track.cpp.

References ENSURE(), and Track::expandAnimationState.

+ Here is the call graph for this function:

◆ is_expand_animating()

bool is_expand_animating ( ) const

Gets whether the branch is animation.

Returns
Returns true if the branch is animating, false if not.

Definition at line 186 of file timeline-track.cpp.

References Track::expandDirection, and Track::None.

◆ tick_expand_animation()

void tick_expand_animation ( )

When this track is being animated, tick_expand_animation must be called repeatedly to cause the animation to progress.

Definition at line 193 of file timeline-track.cpp.

References Track::Expand, Track::expand_timer, Track::ExpandAnimationPeriod, Track::expandAnimationState, Track::expandDirection, and Track::None.

◆ get_expander_style()

Gtk::ExpanderStyle get_expander_style ( ) const

Calculates the expander style, given the animation state.

Definition at line 222 of file timeline-track.cpp.

References Track::expandAnimationState, Track::expandDirection, Track::expanded, and Track::None.

Referenced by TimelineHeaderWidget::on_expose_event().

+ Here is the caller graph for this function:

◆ show_header_context_menu()

void show_header_context_menu ( guint  button,
guint32  time 
)

Definition at line 254 of file timeline-track.cpp.

References Track::contextMenu.

◆ draw_track()

virtual void draw_track ( Cairo::RefPtr< Cairo::Context >  cairo,
TimelineViewWindow *const  window 
) const
pure virtual

Draw the track.

Implemented in ClipTrack, and GroupTrack.

◆ getClipAt()

shared_ptr< timeline::Clip > getClipAt ( Time  position) const
virtual

Gets the clip that is occupying the given time.

The default implementation simply returns an empty pointer.

Parameters
thegiven time

Reimplemented in ClipTrack.

Definition at line 141 of file timeline-track.cpp.

◆ onEnabledChanged()

void onEnabledChanged ( bool  )
private

Event handler for when the enabled status changes.

Definition at line 261 of file timeline-track.cpp.

References Track::updateEnableButton().

Referenced by Track::Track().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onNameChanged()

void onNameChanged ( std::string  )
private

Event handler for when the track name changes.

Definition at line 290 of file timeline-track.cpp.

References Track::updateName().

Referenced by Track::Track().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_remove_track()

void on_remove_track ( )
private

Event handler for when the user requested to remove the track.

Definition at line 297 of file timeline-track.cpp.

References TimelineWidget::get_state(), Track::modelTrack, and Track::timelineWidget.

Referenced by Track::Track().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onLockedChanged()

void onLockedChanged ( bool  )
private

Event handler for when the locked status changes.

Definition at line 268 of file timeline-track.cpp.

References Track::updateLockButton().

Referenced by Track::Track().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_set_name()

void on_set_name ( )
private

Event handler for when the user requested a name change.

Definition at line 275 of file timeline-track.cpp.

References _, Track::modelTrack, NULL, and Track::timelineWidget.

Referenced by Track::Track().

+ Here is the caller graph for this function:

◆ onToggleEnabled()

void onToggleEnabled ( )
private

Event handler for when the user pressed the Enable button.

Definition at line 308 of file timeline-track.cpp.

References Track::modelTrack.

Referenced by Track::Track().

+ Here is the caller graph for this function:

◆ onToggleLocked()

void onToggleLocked ( )
private

Event handler for when the user pressed the Lock button.

Definition at line 316 of file timeline-track.cpp.

References Track::modelTrack.

Referenced by Track::Track().

+ Here is the caller graph for this function:

◆ updateEnableButton()

void updateEnableButton ( )
private

Definition at line 324 of file timeline-track.cpp.

References _, Track::enableButton, UIStyle::MenuIconSize, Track::modelTrack, and MiniWrapper< T >::setStockID().

Referenced by Track::onEnabledChanged(), and Track::Track().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLockButton()

void updateLockButton ( )
private

Definition at line 342 of file timeline-track.cpp.

References _, Track::lockButton, UIStyle::MenuIconSize, Track::modelTrack, and MiniWrapper< T >::setStockID().

Referenced by Track::onLockedChanged(), and Track::Track().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateName()

void updateName ( )
private

Definition at line 360 of file timeline-track.cpp.

References Track::modelTrack, and Track::titleMenuButton.

Referenced by Track::onNameChanged(), and Track::Track().

+ Here is the caller graph for this function:

Member Data Documentation

◆ ExpandAnimationPeriod

const float ExpandAnimationPeriod
staticprivate

Specifies the period of the expand animation in seconds.

Definition at line 168 of file timeline-track.hpp.

Referenced by Track::tick_expand_animation().

◆ timelineWidget

◆ modelTrack

◆ expanded

bool expanded
private

This bool is true if this branch is expanded.

false if it is collapsed.

Definition at line 221 of file timeline-track.hpp.

Referenced by Track::expand_collapse(), Track::get_expanded(), and Track::get_expander_style().

◆ expandDirection

ExpandDirection expandDirection
private

This enum specifies which direction the expand/collapse animation is moving - if any.

Remarks
If no animation is occuring, expandDirection is set to None.

Definition at line 229 of file timeline-track.hpp.

Referenced by Track::expand_collapse(), Track::get_expander_style(), Track::is_expand_animating(), and Track::tick_expand_animation().

◆ expandAnimationState

double expandAnimationState
private

The current expand state.

Remarks
This value is a number between 0 and 1.0, and is recalculated by tick_expand_animation(). This variable is set to 1.0 when the branch is fully expanded (and animating) and 0.0 when the branch is fully collapsed (and animating). When the branch is not animating this value has an indeterminate value.
See also
tick_expand_animation

Definition at line 240 of file timeline-track.hpp.

Referenced by Track::expand_collapse(), Track::get_expand_animation_state(), Track::get_expander_style(), and Track::tick_expand_animation().

◆ expand_timer

std::unique_ptr<Glib::Timer> expand_timer
private

An internal timer used for the expand/collapse animation.

Definition at line 245 of file timeline-track.hpp.

Referenced by Track::expand_collapse(), and Track::tick_expand_animation().

◆ headerWidget

timeline::TimelineHeaderWidget headerWidget
private

Definition at line 249 of file timeline-track.hpp.

Referenced by Track::get_header_widget(), Track::Track(), and Track::~Track().

◆ headerBox

Gtk::VBox headerBox
private

Definition at line 251 of file timeline-track.hpp.

Referenced by Track::Track(), and Track::~Track().

◆ titleMenuButton

MenuButton titleMenuButton
private

Definition at line 253 of file timeline-track.hpp.

Referenced by Track::Track(), and Track::updateName().

◆ enableButton

MiniButton enableButton
private

Definition at line 255 of file timeline-track.hpp.

Referenced by Track::Track(), and Track::updateEnableButton().

◆ lockButton

MiniButton lockButton
private

Definition at line 256 of file timeline-track.hpp.

Referenced by Track::Track(), and Track::updateLockButton().

◆ titleBox

Gtk::Entry titleBox
private

Definition at line 258 of file timeline-track.hpp.

◆ buttonBar

ButtonBar buttonBar
private

Definition at line 259 of file timeline-track.hpp.

Referenced by Track::Track().

◆ contextMenu

Gtk::Menu contextMenu
private

Definition at line 261 of file timeline-track.hpp.

Referenced by Track::show_header_context_menu(), and Track::Track().

Friends And Related Function Documentation

◆ TimelineHeaderWidget

friend class TimelineHeaderWidget
friend

Definition at line 263 of file timeline-track.hpp.

+ Inheritance diagram for Track:
+ Collaboration diagram for Track:

The documentation for this class was generated from the following files: