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

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

Description

Implementation of the timeline body subwidget.

This widget is displayed in the centre of the timeline widget, and displays the content of all timeline tracks.

Definition at line 62 of file timeline-body.hpp.

Public Member Functions

 TimelineBody (gui::widget::TimelineWidget &timeline_widget)
 Constructor. More...
 
virtual ~TimelineBody ()
 
ToolType get_tool () const
 Returns the type of the currently selected timeline tool. More...
 
TimelineWidgetgetTimelineWidget () const
 
void set_tool (ToolType tool_type, bool force=false)
 Selects a tool of a specified type. More...
 

Friends

class ArrowTool
 
class IBeamTool
 
class Tool
 

Protected Member Functions

bool on_button_press_event (GdkEventButton *event)
 The event handler for button press events. More...
 
bool on_button_release_event (GdkEventButton *event)
 The event handler for button release events. More...
 
bool on_expose_event (GdkEventExpose *event)
 An event handler for when the window must be redrawn. More...
 
bool on_motion_notify_event (GdkEventMotion *event)
 The event handler for mouse move events. More...
 
void on_realize ()
 An event handler for when the widget is realized. More...
 
bool on_scroll_event (GdkEventScroll *event)
 
void on_state_changed (shared_ptr< TimelineState > newState)
 The event handler for when the TimelineWidget's state is switched. More...
 
void on_update_view ()
 An event handler for when the view window of the timeline changes. More...
 

Private Types

enum  DragType {
  None,
  Shift
}
 

Private Member Functions

void begin_shift_drag ()
 
void draw_playback_point (Cairo::RefPtr< Cairo::Context > cr)
 Draws the current playback point, if any. More...
 
void draw_selection (Cairo::RefPtr< Cairo::Context > cr)
 Draws the selected timeline period. More...
 
void draw_track (Cairo::RefPtr< Cairo::Context > cr, shared_ptr< timeline::Track > timeline_track, const int view_width) const
 
void draw_tracks (Cairo::RefPtr< Cairo::Context > cr)
 Draws the timeline tracks. More...
 
int get_vertical_offset () const
 
void propagateStateChange ()
 adjust to the new timeline state More...
 
void read_styles ()
 Reads styles from the present stylesheet. More...
 
void register_styles () const
 Registers all the styles that this class will respond to. More...
 
void set_vertical_offset (int offset)
 
TimelineViewWindowviewWindow () const
 Access the current timeline view window. More...
 

Private Attributes

Cairo::RefPtr< Cairo::SolidPattern > backgroundColour
 
TimeVar beginShiftTimeOffset
 
int beginShiftVerticalOffset
 
DragType dragType
 
double mouseDownX
 
double mouseDownY
 
Cairo::RefPtr< Cairo::SolidPattern > playbackPointColour
 
float selectionAlpha
 
Cairo::RefPtr< Cairo::SolidPattern > selectionColour
 
shared_ptr< TimelineStatetimelineState
 
gui::widget::TimelineWidgettimelineWidget
 
std::unique_ptr< timeline::Tooltool
 

Member Enumeration Documentation

◆ DragType

enum DragType
private
Enumerator
None 
Shift 

Definition at line 186 of file timeline-body.hpp.

Constructor & Destructor Documentation

◆ TimelineBody()

TimelineBody ( gui::widget::TimelineWidget timeline_widget)

Constructor.

Parameters
timeline_widgetA reference to the owner widget of this ruler.

Definition at line 52 of file timeline-body.cpp.

References gui::widget::timeline::Arrow, TimelineBody::on_state_changed(), TimelineBody::propagateStateChange(), TimelineBody::register_styles(), TimelineBody::set_tool(), and TimelineWidget::state_changed_signal().

+ Here is the call graph for this function:

◆ ~TimelineBody()

~TimelineBody ( )
virtual

Definition at line 76 of file timeline-body.cpp.

References TimelineBody::tool.

Member Function Documentation

◆ getTimelineWidget()

TimelineWidget & getTimelineWidget ( ) const

Definition at line 89 of file timeline-body.cpp.

References TimelineBody::timelineWidget.

Referenced by ArrowTool::getHoveringTrack(), and ArrowTool::on_button_press_event().

+ Here is the caller graph for this function:

◆ get_tool()

ToolType get_tool ( ) const

Returns the type of the currently selected timeline tool.

Definition at line 95 of file timeline-body.cpp.

References TimelineBody::tool.

Referenced by TimelineWidget::get_tool(), and TimelineBody::propagateStateChange().

+ Here is the caller graph for this function:

◆ set_tool()

void set_tool ( timeline::ToolType  tool_type,
bool  force = false 
)

Selects a tool of a specified type.

Parameters
tool_typeThe type of tool to set.

Definition at line 102 of file timeline-body.cpp.

References gui::widget::timeline::Arrow, TimelineBody::ArrowTool, gui::widget::timeline::IBeam, TimelineBody::IBeamTool, and TimelineBody::tool.

Referenced by TimelineBody::propagateStateChange(), TimelineWidget::set_tool(), and TimelineBody::TimelineBody().

+ Here is the caller graph for this function:

◆ on_update_view()

void on_update_view ( )
protected

An event handler for when the view window of the timeline changes.

Definition at line 132 of file timeline-body.cpp.

Referenced by TimelineBody::propagateStateChange().

+ Here is the caller graph for this function:

◆ on_realize()

void on_realize ( )
protected

An event handler for when the widget is realized.

Definition at line 138 of file timeline-body.cpp.

References TimelineBody::tool.

◆ on_expose_event()

bool on_expose_event ( GdkEventExpose *  event)
protected

An event handler for when the window must be redrawn.

Todo:
looks like this was the main drawing hook, and happens to be discontinued in GTK3. ///////////////////TICKET #937 : custom timeline widget draw function not invoked anymore

Definition at line 154 of file timeline-body.cpp.

References TimelineBody::draw_playback_point(), TimelineBody::draw_selection(), TimelineBody::draw_tracks(), NULL, TimelineBody::read_styles(), and TimelineBody::timelineState.

+ Here is the call graph for this function:

◆ on_scroll_event()

bool on_scroll_event ( GdkEventScroll *  event)
protected

Definition at line 184 of file timeline-body.cpp.

References NULL, TimelineViewWindow::shift_view(), TimelineBody::timelineState, TimelineBody::viewWindow(), and TimelineViewWindow::zoom_view().

+ Here is the call graph for this function:

◆ on_button_press_event()

bool on_button_press_event ( GdkEventButton *  event)
protected

The event handler for button press events.

Definition at line 235 of file timeline-body.cpp.

References TimelineBody::begin_shift_drag(), TimelineBody::dragType, TimelineBody::mouseDownX, TimelineBody::mouseDownY, TimelineBody::None, and TimelineBody::tool.

+ Here is the call graph for this function:

◆ on_button_release_event()

bool on_button_release_event ( GdkEventButton *  event)
protected

The event handler for button release events.

Definition at line 258 of file timeline-body.cpp.

References TimelineBody::dragType, TimelineBody::None, and TimelineBody::tool.

◆ on_motion_notify_event()

◆ on_state_changed()

void on_state_changed ( shared_ptr< TimelineState newState)
protected

The event handler for when the TimelineWidget's state is switched.

Definition at line 313 of file timeline-body.cpp.

References TimelineBody::propagateStateChange(), and TimelineBody::timelineState.

Referenced by TimelineBody::TimelineBody().

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

◆ viewWindow()

TimelineViewWindow & viewWindow ( ) const
private

Access the current timeline view window.

Warning
must not be called unless the TimlineWidget has a valid state.

Definition at line 82 of file timeline-body.cpp.

References TimelineBody::timelineState.

Referenced by TimelineBody::begin_shift_drag(), TimelineBody::draw_playback_point(), TimelineBody::draw_track(), TimelineBody::on_motion_notify_event(), TimelineBody::on_scroll_event(), and TimelineBody::propagateStateChange().

+ Here is the caller graph for this function:

◆ draw_tracks()

void draw_tracks ( Cairo::RefPtr< Cairo::Context >  cr)
private

Draws the timeline tracks.

Parameters
crThe cairo context to draw into.

Definition at line 338 of file timeline-body.cpp.

References Tree< T, tree_node_allocator >::begin(), TimelineBody::draw_track(), Tree< T, tree_node_allocator >::empty(), Tree< T, tree_node_allocator >::end(), TimelineLayoutHelper::get_layout_tree(), TimelineLayoutHelper::get_track_header_rect(), TimelineWidget::layoutHelper, TimelineWidget::lookup_timeline_track(), and TimelineBody::timelineWidget.

Referenced by TimelineBody::on_expose_event().

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

◆ draw_track()

void draw_track ( Cairo::RefPtr< Cairo::Context >  cr,
shared_ptr< timeline::Track timeline_track,
const int  view_width 
) const
private

Definition at line 385 of file timeline-body.cpp.

References TimelineBody::backgroundColour, NULL, and TimelineBody::viewWindow().

Referenced by TimelineBody::draw_tracks().

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

◆ draw_selection()

void draw_selection ( Cairo::RefPtr< Cairo::Context >  cr)
private

Draws the selected timeline period.

Parameters
crThe cairo context to draw into.

Definition at line 409 of file timeline-body.cpp.

References TimelineBody::selectionAlpha, TimelineBody::selectionColour, TimelineViewWindow::time_to_x(), and TimelineBody::timelineState.

Referenced by TimelineBody::on_expose_event().

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

◆ draw_playback_point()

void draw_playback_point ( Cairo::RefPtr< Cairo::Context >  cr)
private

Draws the current playback point, if any.

Parameters
crThe cairo context to draw into.

Definition at line 452 of file timeline-body.cpp.

References TimelineBody::playbackPointColour, TimelineViewWindow::time_to_x(), TimelineBody::timelineState, and TimelineBody::viewWindow().

Referenced by TimelineBody::on_expose_event().

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

◆ begin_shift_drag()

void begin_shift_drag ( )
private

Definition at line 479 of file timeline-body.cpp.

References TimelineBody::beginShiftTimeOffset, TimelineBody::beginShiftVerticalOffset, TimelineBody::dragType, TimelineViewWindow::get_time_offset(), TimelineBody::get_vertical_offset(), TimelineBody::Shift, TimelineBody::timelineState, and TimelineBody::viewWindow().

Referenced by TimelineBody::on_button_press_event().

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

◆ get_vertical_offset()

int get_vertical_offset ( ) const
private

Definition at line 490 of file timeline-body.cpp.

References TimelineBody::timelineWidget, and TimelineWidget::verticalAdjustment.

Referenced by TimelineBody::begin_shift_drag().

+ Here is the caller graph for this function:

◆ set_vertical_offset()

void set_vertical_offset ( int  offset)
private

Definition at line 496 of file timeline-body.cpp.

References TimelineBody::timelineWidget, and TimelineWidget::verticalAdjustment.

Referenced by TimelineBody::on_motion_notify_event().

+ Here is the caller graph for this function:

◆ propagateStateChange()

void propagateStateChange ( )
private

adjust to the new timeline state

Definition at line 321 of file timeline-body.cpp.

References TimelineViewWindow::changed_signal(), TimelineBody::get_tool(), TimelineBody::on_update_view(), TimelineBody::set_tool(), TimelineBody::timelineState, and TimelineBody::viewWindow().

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

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

◆ register_styles()

void register_styles ( ) const
private

Registers all the styles that this class will respond to.

Definition at line 502 of file timeline-body.cpp.

Referenced by TimelineBody::TimelineBody().

+ Here is the caller graph for this function:

◆ read_styles()

void read_styles ( )
private

Reads styles from the present stylesheet.

Definition at line 532 of file timeline-body.cpp.

References TimelineBody::backgroundColour, TimelineBody::playbackPointColour, UIStyle::readStyleColourProperty(), TimelineBody::selectionAlpha, and TimelineBody::selectionColour.

Referenced by TimelineBody::on_expose_event().

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

Member Data Documentation

◆ tool

◆ mouseDownX

double mouseDownX
private

◆ mouseDownY

double mouseDownY
private

◆ dragType

◆ beginShiftTimeOffset

TimeVar beginShiftTimeOffset
private

◆ beginShiftVerticalOffset

int beginShiftVerticalOffset
private

◆ backgroundColour

Cairo::RefPtr<Cairo::SolidPattern> backgroundColour
private

Definition at line 201 of file timeline-body.hpp.

Referenced by TimelineBody::draw_track(), and TimelineBody::read_styles().

◆ selectionColour

Cairo::RefPtr<Cairo::SolidPattern> selectionColour
private

Definition at line 202 of file timeline-body.hpp.

Referenced by TimelineBody::draw_selection(), and TimelineBody::read_styles().

◆ selectionAlpha

float selectionAlpha
private

Definition at line 203 of file timeline-body.hpp.

Referenced by TimelineBody::draw_selection(), and TimelineBody::read_styles().

◆ playbackPointColour

Cairo::RefPtr<Cairo::SolidPattern> playbackPointColour
private

◆ timelineWidget

◆ timelineState

Friends And Related Function Documentation

◆ Tool

friend class Tool
friend

Definition at line 210 of file timeline-body.hpp.

◆ ArrowTool

friend class ArrowTool
friend

Definition at line 211 of file timeline-body.hpp.

Referenced by TimelineBody::set_tool().

◆ IBeamTool

friend class IBeamTool
friend

Definition at line 212 of file timeline-body.hpp.

Referenced by TimelineBody::set_tool().

+ Inheritance diagram for TimelineBody:
+ Collaboration diagram for TimelineBody:

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