Lumiera  0.pre.03
»edityourfreedom«
TimelineWidget Class Reference

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

Description

Core timeline display (custom widget).

Remarks
This widget is a composite of several widgets contained within the timeline namespace.

Definition at line 77 of file widget/timeline-widget.hpp.

Public Types

using HoveringTrackChangedSignal = sigc::signal< void, shared_ptr< timeline::Track > >
 
using TimelineStateChangeSignal = sigc::signal< void, shared_ptr< timeline::TimelineState > >
 

Public Member Functions

 TimelineWidget (shared_ptr< timeline::TimelineState > source_state)
 
virtual ~TimelineWidget ()
 
shared_ptr< timeline::Trackget_hovering_track () const
 
shared_ptr< timeline::TimelineStateget_state ()
 Gets a pointer to the current state object. More...
 
timeline::ToolType get_tool () const
 Gets the type of the tool currently active. More...
 
HoveringTrackChangedSignal hovering_track_changed_signal () const
 
sigc::signal< void, lib::time::Timemouse_hover_signal () const
 
sigc::signal< void > playback_period_drag_released_signal () const
 
void set_state (shared_ptr< timeline::TimelineState > new_state)
 Replaces the current TimelineState object with another. More...
 
void set_tool (timeline::ToolType tool_type)
 Sets the type of the tool currently active. More...
 
TimelineStateChangeSignal state_changed_signal () const
 
void zoom_view (double timescale_ratio)
 Zooms the view in or out as by a number of steps while keeping a given point on the timeline still. More...
 

Friends

class timeline::GroupTrack
 
class timeline::TimelineBody
 
class timeline::TimelineHeaderContainer
 
class timeline::TimelineHeaderWidget
 
class timeline::TimelineLayoutHelper
 
class timeline::TimelineRuler
 

Protected Member Functions

void on_add_track_command ()
 
void on_body_changed ()
 
void on_scroll ()
 
void on_size_allocate (Gtk::Allocation &allocation)
 
void on_view_window_changed ()
 

Protected Attributes

timeline::TimelineBodybody
 
timeline::TimelineHeaderContainerheaderContainer
 
Glib::RefPtr< Gtk::Adjustment > horizontalAdjustment
 
Gtk::HScrollbar horizontalScroll
 
shared_ptr< timeline::TrackhoveringTrack
 
HoveringTrackChangedSignal hoveringTrackChangedSignal
 
timeline::TimelineLayoutHelper layoutHelper
 
sigc::signal< void, TimemouseHoverSignal
 
sigc::signal< void > playbackPeriodDragReleasedSignal
 
timeline::TimelineRulerruler
 
shared_ptr< timeline::TimelineStatestate
 The state that will be used as the data source for this timeline widget. More...
 
TimelineStateChangeSignal stateChangedSignal
 
std::map< shared_ptr< model::Track >,shared_ptr< timeline::Track > > trackMap
 The trackMap maps model tracks to timeline widget tracks which are responsible for the UI representation of a track. More...
 
bool update_tracks_frozen
 
Glib::RefPtr< Gtk::Adjustment > verticalAdjustment
 
Gtk::VScrollbar verticalScroll
 

Static Protected Attributes

static const int HeaderIndentWidth
 
static const int HeaderWidth
 
static const int TrackPadding
 

Private Member Functions

shared_ptr< timeline::Trackcreate_timeline_track_from_modelTrack (shared_ptr< model::Track > modelTrack)
 Creates a timeline UI track to correspond to a model track. More...
 
void create_timeline_tracks ()
 Ensures timeline UI tracks have been created for every model track present in sequence. More...
 
void create_timeline_tracks_from_branch (shared_ptr< model::Track > modelTrack)
 Iterates through a branch of tracks, recursing into each sub-branch creating UI timeline tracks for each model track if they don't already exist in trackMap. More...
 
void freeze_update_tracks ()
 
int get_y_scroll_offset () const
 
shared_ptr< timeline::Tracklookup_timeline_track (shared_ptr< model::Track > modelTrack) const
 Looks up a timeline UI track in trackMap that corresponds to a given modelTrack. More...
 
void on_layout_changed ()
 
bool on_motion_in_body_notify_event (GdkEventMotion *event)
 
void on_playback_period_drag_released ()
 
void on_track_list_changed ()
 An event handler that receives notifications for when the sequence's track tree has been changed. More...
 
void remove_orphaned_tracks ()
 Removes any UI tracks which no longer have corresponding model tracks present in the sequence. More...
 
void search_orphaned_tracks_in_branch (shared_ptr< model::Track > modelTrack, std::map< shared_ptr< model::Track >, shared_ptr< timeline::Track >> &orphan_track_map)
 
shared_ptr< model::Sequencesequence () const
 Helper to get the sequence object from the state. More...
 
void set_hovering_track (shared_ptr< timeline::Track > hovering_track)
 
void set_y_scroll_offset (const int offset)
 
void thaw_update_tracks ()
 
void update_scroll ()
 
void update_tracks ()
 Updates the timeline widget to match the state of the track tree. More...
 

Member Typedef Documentation

◆ TimelineStateChangeSignal

Definition at line 130 of file widget/timeline-widget.hpp.

◆ HoveringTrackChangedSignal

using HoveringTrackChangedSignal = sigc::signal<void, shared_ptr<timeline::Track> >

Definition at line 131 of file widget/timeline-widget.hpp.

Constructor & Destructor Documentation

◆ TimelineWidget()

Parameters
source_statestate to be used used as the data source (model) for this timeline widget.

Definition at line 57 of file widget/timeline-widget.cpp.

References gui::widget::timeline::Arrow, TimelineWidget::body, ENSURE(), TimelineWidget::headerContainer, TimelineWidget::horizontalAdjustment, TimelineWidget::horizontalScroll, NULL, TimelineWidget::on_motion_in_body_notify_event(), TimelineWidget::on_scroll(), TimelineWidget::ruler, TimelineWidget::set_state(), TimelineWidget::set_tool(), TimelineWidget::update_tracks(), TimelineWidget::verticalAdjustment, and TimelineWidget::verticalScroll.

+ Here is the call graph for this function:

◆ ~TimelineWidget()

~TimelineWidget ( )
virtual

Definition at line 97 of file widget/timeline-widget.cpp.

References TimelineHeaderContainer::clear_headers(), TimelineWidget::headerContainer, and TimelineWidget::trackMap.

+ Here is the call graph for this function:

Member Function Documentation

◆ get_state()

Gets a pointer to the current state object.

Returns
The state object that the timeline widget is currently working with.

Definition at line 111 of file widget/timeline-widget.cpp.

References TimelineWidget::state.

Referenced by Tool::get_state(), ArrowTool::on_button_press_event(), and Track::on_remove_track().

+ Here is the caller graph for this function:

◆ set_state()

void set_state ( shared_ptr< timeline::TimelineState new_state)

Replaces the current TimelineState object with another.

Parameters
new_stateThe new state to swap in.

Definition at line 118 of file widget/timeline-widget.cpp.

References TimelineWidget::on_body_changed(), TimelineWidget::on_track_list_changed(), TimelineWidget::on_view_window_changed(), TimelineWidget::state, TimelineWidget::stateChangedSignal, TimelineWidget::trackMap, and TimelineWidget::update_tracks().

Referenced by TimelineWidget::TimelineWidget().

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

◆ zoom_view()

void zoom_view ( double  timescale_ratio)

Zooms the view in or out as by a number of steps while keeping a given point on the timeline still.

Parameters
zoom_sizeThe number of steps to zoom by. The scale factor is 1.25^(-zoom_size).

Definition at line 148 of file widget/timeline-widget.cpp.

References TimelineWidget::body, and TimelineWidget::state.

◆ get_tool()

ToolType get_tool ( ) const

Gets the type of the tool currently active.

Definition at line 158 of file widget/timeline-widget.cpp.

References TimelineWidget::body, TimelineBody::get_tool(), and NULL.

+ Here is the call graph for this function:

◆ set_tool()

void set_tool ( timeline::ToolType  tool_type)

Sets the type of the tool currently active.

Definition at line 165 of file widget/timeline-widget.cpp.

References TimelineWidget::body, NULL, and TimelineBody::set_tool().

Referenced by TimelineWidget::TimelineWidget().

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

◆ get_hovering_track()

shared_ptr< timeline::Track > get_hovering_track ( ) const

Definition at line 172 of file widget/timeline-widget.cpp.

References TimelineWidget::hoveringTrack.

Referenced by ArrowTool::getHoveringTrack(), and TimelineBody::on_motion_notify_event().

+ Here is the caller graph for this function:

◆ mouse_hover_signal()

sigc::signal< void, Time > mouse_hover_signal ( ) const

Definition at line 181 of file widget/timeline-widget.cpp.

References TimelineWidget::mouseHoverSignal.

◆ playback_period_drag_released_signal()

sigc::signal< void > playback_period_drag_released_signal ( ) const

◆ hovering_track_changed_signal()

sigc::signal< void, shared_ptr< timeline::Track > > hovering_track_changed_signal ( ) const

Definition at line 193 of file widget/timeline-widget.cpp.

References TimelineWidget::hoveringTrackChangedSignal.

Referenced by TimelineHeaderContainer::TimelineHeaderContainer().

+ Here is the caller graph for this function:

◆ state_changed_signal()

TimelineWidget::TimelineStateChangeSignal state_changed_signal ( ) const

Definition at line 199 of file widget/timeline-widget.cpp.

References TimelineWidget::stateChangedSignal.

Referenced by TimelineBody::TimelineBody(), and TimelineRuler::TimelineRuler().

+ Here is the caller graph for this function:

◆ on_scroll()

void on_scroll ( )
protected

Definition at line 209 of file widget/timeline-widget.cpp.

References TimelineWidget::horizontalAdjustment, and TimelineWidget::state.

Referenced by TimelineWidget::TimelineWidget().

+ Here is the caller graph for this function:

◆ on_size_allocate()

void on_size_allocate ( Gtk::Allocation &  allocation)
protected

Definition at line 219 of file widget/timeline-widget.cpp.

References TimelineWidget::update_scroll().

+ Here is the call graph for this function:

◆ on_view_window_changed()

void on_view_window_changed ( )
protected

Definition at line 228 of file widget/timeline-widget.cpp.

References TimelineWidget::body, TimelineViewWindow::get_time_offset(), TimelineViewWindow::get_time_scale(), TimelineWidget::horizontalAdjustment, NULL, TimelineWidget::ruler, and TimelineWidget::state.

Referenced by TimelineWidget::set_state().

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

◆ on_body_changed()

void on_body_changed ( )
protected

Definition at line 247 of file widget/timeline-widget.cpp.

References TimelineWidget::body, NULL, and TimelineWidget::ruler.

Referenced by TimelineWidget::set_state().

+ Here is the caller graph for this function:

◆ on_add_track_command()

void on_add_track_command ( )
protected

Definition at line 257 of file widget/timeline-widget.cpp.

References TimelineWidget::sequence().

Referenced by TimelineHeaderContainer::TimelineHeaderContainer().

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

◆ update_tracks()

void update_tracks ( )
private

Updates the timeline widget to match the state of the track tree.

Definition at line 271 of file widget/timeline-widget.cpp.

References TimelineLayoutHelper::clone_tree_from_sequence(), TimelineWidget::create_timeline_tracks(), TimelineWidget::layoutHelper, TimelineWidget::remove_orphaned_tracks(), TimelineWidget::state, TimelineWidget::trackMap, TimelineLayoutHelper::update_layout(), and TimelineWidget::update_tracks_frozen.

Referenced by TimelineWidget::on_track_list_changed(), TimelineWidget::set_state(), and TimelineWidget::TimelineWidget().

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

◆ freeze_update_tracks()

void freeze_update_tracks ( )
private

Definition at line 294 of file widget/timeline-widget.cpp.

References TimelineWidget::update_tracks_frozen.

Referenced by TimelineLayoutHelper::apply_drop_to_modelTree().

+ Here is the caller graph for this function:

◆ thaw_update_tracks()

void thaw_update_tracks ( )
private

Definition at line 301 of file widget/timeline-widget.cpp.

References TimelineWidget::update_tracks_frozen.

Referenced by TimelineLayoutHelper::apply_drop_to_modelTree().

+ Here is the caller graph for this function:

◆ create_timeline_tracks()

void create_timeline_tracks ( )
private

Ensures timeline UI tracks have been created for every model track present in sequence.

Definition at line 308 of file widget/timeline-widget.cpp.

References TimelineWidget::create_timeline_tracks_from_branch(), TimelineWidget::headerContainer, NULL, TimelineWidget::sequence(), TimelineWidget::state, and TimelineHeaderContainer::update_headers().

Referenced by TimelineWidget::update_tracks().

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

◆ create_timeline_tracks_from_branch()

void create_timeline_tracks_from_branch ( shared_ptr< model::Track modelTrack)
private

Iterates through a branch of tracks, recursing into each sub-branch creating UI timeline tracks for each model track if they don't already exist in trackMap.

Parameters
listThe parent track of the branch.

Definition at line 324 of file widget/timeline-widget.cpp.

References util::contains(), TimelineWidget::create_timeline_track_from_modelTrack(), and TimelineWidget::trackMap.

Referenced by TimelineWidget::create_timeline_tracks().

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

◆ create_timeline_track_from_modelTrack()

shared_ptr< timeline::Track > create_timeline_track_from_modelTrack ( shared_ptr< model::Track modelTrack)
private

Creates a timeline UI track to correspond to a model track.

Parameters
modelTrackThe model track to create a timeline track from.
Returns
The timeline track created, or an empty shared_ptr if modelTrack has an unreckognised type (this is an error condition).

Definition at line 347 of file widget/timeline-widget.cpp.

References NULL.

Referenced by TimelineWidget::create_timeline_tracks_from_branch().

+ Here is the caller graph for this function:

◆ remove_orphaned_tracks()

void remove_orphaned_tracks ( )
private

Removes any UI tracks which no longer have corresponding model tracks present in the sequence.

Definition at line 368 of file widget/timeline-widget.cpp.

References ENSURE(), TimelineWidget::search_orphaned_tracks_in_branch(), TimelineWidget::sequence(), and TimelineWidget::trackMap.

Referenced by TimelineWidget::update_tracks().

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

◆ search_orphaned_tracks_in_branch()

void search_orphaned_tracks_in_branch ( shared_ptr< model::Track modelTrack,
std::map< shared_ptr< model::Track >, shared_ptr< timeline::Track >> &  orphan_track_map 
)
private

Definition at line 393 of file widget/timeline-widget.cpp.

References util::contains().

Referenced by TimelineWidget::remove_orphaned_tracks().

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

◆ lookup_timeline_track()

shared_ptr< timeline::Track > lookup_timeline_track ( shared_ptr< model::Track modelTrack) const
private

Looks up a timeline UI track in trackMap that corresponds to a given modelTrack.

Parameters
modelTrackThe model track to look up.
Returns
The timeline UI track found, or an empty shared_ptr if modelTrack has no corresponding timeline UI track (this is an error condition).

Definition at line 413 of file widget/timeline-widget.cpp.

References ENSURE(), NULL, TimelineWidget::sequence(), and TimelineWidget::trackMap.

Referenced by TimelineBody::draw_tracks(), TimelineHeaderContainer::lookup_timeline_track(), and TimelineLayoutHelper::lookup_timeline_track().

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

◆ on_layout_changed()

void on_layout_changed ( )
private

Definition at line 437 of file widget/timeline-widget.cpp.

References TimelineWidget::body, TimelineWidget::headerContainer, NULL, TimelineHeaderContainer::on_layout_changed(), and TimelineWidget::update_scroll().

Referenced by TimelineLayoutHelper::update_layout().

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

◆ update_scroll()

void update_scroll ( )
private

Definition at line 449 of file widget/timeline-widget.cpp.

References TimelineWidget::body, TimelineViewWindow::get_time_scale(), TimelineLayoutHelper::get_total_height(), TimelineWidget::horizontalAdjustment, TimelineWidget::layoutHelper, NULL, TimelineWidget::state, TimelineWidget::verticalAdjustment, and TimelineWidget::verticalScroll.

Referenced by TimelineWidget::on_layout_changed(), and TimelineWidget::on_size_allocate().

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

◆ get_y_scroll_offset()

int get_y_scroll_offset ( ) const
private

Definition at line 496 of file widget/timeline-widget.cpp.

References TimelineWidget::verticalAdjustment.

Referenced by TimelineLayoutHelper::begin_dragging_track(), TimelineLayoutHelper::drag_to_point(), TimelineLayoutHelper::get_track_header_rect(), TimelineLayoutHelper::header_from_point(), TimelineHeaderContainer::on_scroll_slide_timer(), and TimelineLayoutHelper::track_from_y().

+ Here is the caller graph for this function:

◆ set_y_scroll_offset()

void set_y_scroll_offset ( const int  offset)
private

Definition at line 503 of file widget/timeline-widget.cpp.

References TimelineWidget::verticalAdjustment.

Referenced by TimelineHeaderContainer::on_scroll_slide_timer().

+ Here is the caller graph for this function:

◆ on_track_list_changed()

void on_track_list_changed ( )
private

An event handler that receives notifications for when the sequence's track tree has been changed.

Definition at line 538 of file widget/timeline-widget.cpp.

References TimelineWidget::update_tracks().

Referenced by GroupTrack::on_child_list_changed(), and TimelineWidget::set_state().

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

◆ on_playback_period_drag_released()

void on_playback_period_drag_released ( )
private

Definition at line 545 of file widget/timeline-widget.cpp.

References TimelineWidget::playbackPeriodDragReleasedSignal.

Referenced by TimelineRuler::on_button_release_event().

+ Here is the caller graph for this function:

◆ on_motion_in_body_notify_event()

bool on_motion_in_body_notify_event ( GdkEventMotion *  event)
private

Definition at line 510 of file widget/timeline-widget.cpp.

References TimelineWidget::mouseHoverSignal, NULL, TimelineWidget::ruler, TimelineRuler::set_mouse_chevron_offset(), TimelineWidget::state, and TimelineViewWindow::x_to_time().

Referenced by TimelineWidget::TimelineWidget().

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

◆ sequence()

shared_ptr< model::Sequence > sequence ( ) const
private

Helper to get the sequence object from the state.

Returns
Returns a shared pointer to the sequence.

Definition at line 527 of file widget/timeline-widget.cpp.

References ENSURE(), and TimelineWidget::state.

Referenced by TimelineWidget::create_timeline_tracks(), TimelineWidget::lookup_timeline_track(), TimelineWidget::on_add_track_command(), and TimelineWidget::remove_orphaned_tracks().

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

◆ set_hovering_track()

void set_hovering_track ( shared_ptr< timeline::Track hovering_track)
private

Definition at line 552 of file widget/timeline-widget.cpp.

References TimelineWidget::hoveringTrack, and TimelineWidget::hoveringTrackChangedSignal.

Referenced by TimelineBody::on_motion_notify_event().

+ Here is the caller graph for this function:

Member Data Documentation

◆ state

◆ trackMap

std::map<shared_ptr<model::Track> ,shared_ptr<timeline::Track> > trackMap
protected

The trackMap maps model tracks to timeline widget tracks which are responsible for the UI representation of a track.

Remarks
The tree structure is maintained by the model, and as the widget is updated with update_tracks, timeline tracks are added and removed from the map in correspondence with the tree.

Definition at line 274 of file widget/timeline-widget.hpp.

Referenced by TimelineHeaderContainer::clear_headers(), TimelineWidget::create_timeline_tracks_from_branch(), TimelineHeaderContainer::forall_vfunc(), TimelineWidget::lookup_timeline_track(), TimelineHeaderContainer::on_remove(), TimelineWidget::remove_orphaned_tracks(), TimelineWidget::set_state(), TimelineHeaderContainer::update_headers(), TimelineWidget::update_tracks(), and TimelineWidget::~TimelineWidget().

◆ hoveringTrack

◆ layoutHelper

◆ headerContainer

◆ body

◆ ruler

◆ horizontalAdjustment

Glib::RefPtr<Gtk::Adjustment> horizontalAdjustment
protected

◆ verticalAdjustment

◆ horizontalScroll

Gtk::HScrollbar horizontalScroll
protected

Definition at line 287 of file widget/timeline-widget.hpp.

Referenced by TimelineWidget::TimelineWidget().

◆ verticalScroll

Gtk::VScrollbar verticalScroll
protected

◆ mouseHoverSignal

sigc::signal<void, Time> mouseHoverSignal
protected

◆ playbackPeriodDragReleasedSignal

sigc::signal<void> playbackPeriodDragReleasedSignal
protected

◆ hoveringTrackChangedSignal

◆ stateChangedSignal

TimelineStateChangeSignal stateChangedSignal
protected

◆ update_tracks_frozen

bool update_tracks_frozen
protected

◆ TrackPadding

const int TrackPadding
staticprotected

◆ HeaderWidth

const int HeaderWidth
staticprotected

◆ HeaderIndentWidth

const int HeaderIndentWidth
staticprotected

Definition at line 302 of file widget/timeline-widget.hpp.

Referenced by TimelineLayoutHelper::update_layout().

Friends And Related Function Documentation

◆ timeline::TimelineBody

friend class timeline::TimelineBody
friend

Definition at line 304 of file widget/timeline-widget.hpp.

◆ timeline::TimelineHeaderContainer

friend class timeline::TimelineHeaderContainer
friend

Definition at line 305 of file widget/timeline-widget.hpp.

◆ timeline::TimelineHeaderWidget

friend class timeline::TimelineHeaderWidget
friend

Definition at line 306 of file widget/timeline-widget.hpp.

◆ timeline::TimelineLayoutHelper

friend class timeline::TimelineLayoutHelper
friend

Definition at line 307 of file widget/timeline-widget.hpp.

◆ timeline::TimelineRuler

friend class timeline::TimelineRuler
friend

Definition at line 308 of file widget/timeline-widget.hpp.

◆ timeline::GroupTrack

friend class timeline::GroupTrack
friend

Definition at line 309 of file widget/timeline-widget.hpp.

+ Inheritance diagram for TimelineWidget:
+ Collaboration diagram for TimelineWidget:

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