Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TimelineViewWindow Class Reference

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

Description

TimelineViewWindow is a helper class for TimelineWidget which manages the view window of the timeline: the zoom and shift.

The class also provides utility functions for handling time in the timeline.

Definition at line 57 of file timeline-view-window.hpp.

Public Member Functions

 TimelineViewWindow (Offset offset, int64_t scale)
 
sigc::signal< void > changed_signal () const
 A signal to indicate that the scale or offset have been changed. More...
 
double get_smoothed_time_scale () const
 get the current time scale with zoom smoothing applied More...
 
Offset get_time_offset () const
 Gets the time offset. More...
 
int64_t get_time_scale () const
 Gets the time scale value. More...
 
void set_time_offset (TimeValue const &)
 Sets the time offset. More...
 
void set_time_scale (int64_t time_scale)
 Sets the time scale value. More...
 
void set_time_scale (double ratio)
 
void shift_view (int view_width, int shift_size)
 Scrolls the view horizontally as a proportion of the view area. More...
 
int time_to_x (TimeValue const &) const
 Converts time values to x coordinates in pixels. More...
 
Time x_to_time (int x) const
 Converts x coordinates in pixels to time values. More...
 
void zoom_view (int point, 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...
 

Static Public Attributes

static const int64_t MaxScale
 The maximum scale for timeline display. More...
 
static const double ZoomIncrement
 
static const double ZoomSmoothing
 

Private Attributes

sigc::signal< void > changedSignal
 
TimeVar timeOffset
 
int64_t timeScale
 The scale of the Timeline Body. More...
 

Constructor & Destructor Documentation

TimelineViewWindow ( Offset  offset,
int64_t  scale 
)
Parameters
offsetinitial view offset.
scaleinitial view scale.

Definition at line 52 of file timeline-view-window.cpp.

Member Function Documentation

Offset get_time_offset ( ) const

Gets the time offset.

This is the time value displayed at the left-hand edge of the timeline body area.

Todo:
obviously this must be switched to use the relevant time grid from the session / current timeline to be displayed. It doesn't make sense to display raw time values here, as each timeline might turn out to have a different origin; this is the result of resolving a placement, and only the session has the necessary information...

Definition at line 59 of file timeline-view-window.cpp.

References TimelineViewWindow::timeOffset.

Referenced by TimelineBody::begin_shift_drag(), and TimelineWidget::on_view_window_changed().

+ Here is the caller graph for this function:

void set_time_offset ( TimeValue const &  offset)

Sets the time offset.

This is the time value displayed at the left-hand edge of the timeline body area.

Todo:
this is private detail that shouldn't be exposed to the outside //////////////////TICKET# 795

Definition at line 66 of file timeline-view-window.cpp.

References TimelineViewWindow::changedSignal, and TimelineViewWindow::timeOffset.

Referenced by TimelineBody::on_motion_notify_event(), TimelineViewWindow::shift_view(), and TimelineViewWindow::zoom_view().

+ Here is the caller graph for this function:

int64_t get_time_scale ( ) const

Gets the time scale value.

Returns
The scale factor, which is the number of microseconds per screen pixel.
Todo:
this is private detail that shouldn't be exposed to the outside //////////////////TICKET# 795

Definition at line 74 of file timeline-view-window.cpp.

References TimelineViewWindow::timeScale.

Referenced by TimelineRuler::calculate_major_spacing(), TimelineBody::on_motion_notify_event(), TimelineWidget::on_view_window_changed(), and TimelineWidget::update_scroll().

+ Here is the caller graph for this function:

void set_time_scale ( int64_t  time_scale)

Sets the time scale value.

Parameters
time_scaleThe scale factor, which is the number of microseconds per screen pixel. This value must be greater than zero

Definition at line 81 of file timeline-view-window.cpp.

References TimelineViewWindow::changedSignal, and TimelineViewWindow::timeScale.

Referenced by TimelineViewWindow::set_time_scale(), TimelineState::TimelineState(), and TimelineViewWindow::zoom_view().

+ Here is the caller graph for this function:

void set_time_scale ( double  ratio)

Definition at line 89 of file timeline-view-window.cpp.

References lib::meta::max(), TimelineViewWindow::MaxScale, lib::meta::min(), and TimelineViewWindow::set_time_scale().

+ Here is the call graph for this function:

double get_smoothed_time_scale ( ) const

get the current time scale with zoom smoothing applied

Definition at line 110 of file timeline-view-window.cpp.

References TimelineViewWindow::MaxScale, TimelineViewWindow::timeScale, and TimelineViewWindow::ZoomSmoothing.

void zoom_view ( int  point,
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
new_time_scaleThe number of steps to zoom by. The scale factor is 1.25^(-new_time_scale).

Definition at line 120 of file timeline-view-window.cpp.

References TimelineViewWindow::MaxScale, TimelineViewWindow::set_time_offset(), TimelineViewWindow::set_time_scale(), TimelineViewWindow::timeOffset, TimelineViewWindow::timeScale, and TimelineViewWindow::ZoomSmoothing.

Referenced by TimelineBody::on_scroll_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void shift_view ( int  view_width,
int  shift_size 
)

Scrolls the view horizontally as a proportion of the view area.

Parameters
shift_sizesize of the shift in 1/256ths of the view width.

Definition at line 143 of file timeline-view-window.cpp.

References TimelineViewWindow::set_time_offset(), TimelineViewWindow::timeOffset, and TimelineViewWindow::timeScale.

Referenced by TimelineBody::on_scroll_event(), and IBeamTool::on_scroll_slide_timer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int time_to_x ( TimeValue const &  time) const

Converts time values to x coordinates in pixels.

Parameters
timeThe time value to convert.
Returns
x-value as pixels from the left hand edge of the timeline body.

Definition at line 150 of file timeline-view-window.cpp.

References TimelineViewWindow::timeOffset, and TimelineViewWindow::timeScale.

Referenced by BasicDrawStrategy::draw(), TimelineRuler::draw_playback_period(), TimelineRuler::draw_playback_point(), TimelineBody::draw_playback_point(), TimelineRuler::draw_selection(), TimelineBody::draw_selection(), ClipTrack::draw_track(), IBeamTool::is_mouse_in_end_drag_zone(), and IBeamTool::is_mouse_in_start_drag_zone().

+ Here is the caller graph for this function:

Time x_to_time ( int  x) const

Converts x coordinates in pixels to time values.

Parameters
xcoordinate to convert (given in pixels from the left hand edge of the timeline body)
Returns
the time at the given coordinate.
Todo:
5/11 this is good for now, but on the long run I'm tinking we rather should treat that like a special frame grid (display coordinate system) and then use the same framework we use for timecodes and frame counts.

Definition at line 157 of file timeline-view-window.cpp.

References TimelineViewWindow::timeOffset, and TimelineViewWindow::timeScale.

Referenced by ArrowTool::on_button_press_event(), TimelineRuler::on_button_press_event(), and TimelineWidget::on_motion_in_body_notify_event().

+ Here is the caller graph for this function:

sigc::signal< void > changed_signal ( ) const

A signal to indicate that the scale or offset have been changed.

Definition at line 165 of file timeline-view-window.cpp.

References TimelineViewWindow::changedSignal.

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

+ Here is the caller graph for this function:

Member Data Documentation

const int64_t MaxScale
static

The maximum scale for timeline display.

Remarks
At MaxScale, every pixel on the timeline is equivalent to 30000000 lumiera::Time increments.

Definition at line 66 of file timeline-view-window.hpp.

Referenced by TimelineViewWindow::get_smoothed_time_scale(), TimelineViewWindow::set_time_scale(), and TimelineViewWindow::zoom_view().

const double ZoomSmoothing
static
const double ZoomIncrement
static

Definition at line 68 of file timeline-view-window.hpp.

int64_t timeScale
private

The scale of the Timeline Body.

Remarks
This value represents the time span that is visible in the TimelineBodyWidget. Smaller numbers here will "zoom in" while larger numbers will "zoom out"

Definition at line 164 of file timeline-view-window.hpp.

Referenced by TimelineViewWindow::get_smoothed_time_scale(), TimelineViewWindow::get_time_scale(), TimelineViewWindow::set_time_scale(), TimelineViewWindow::shift_view(), TimelineViewWindow::time_to_x(), TimelineViewWindow::x_to_time(), and TimelineViewWindow::zoom_view().

sigc::signal<void> changedSignal
private
+ Collaboration diagram for TimelineViewWindow:

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