Replaced gavl_time_ts with lumiera::Times

This commit is contained in:
Joel Holdsworth 2009-08-30 16:26:27 +01:00
parent 2c68137be4
commit 5bfdf73f7d
12 changed files with 57 additions and 50 deletions

View file

@ -39,6 +39,7 @@
#include <boost/scoped_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include "lib/util.hpp"
#include "lib/lumitime.hpp"
#include "window-manager.hpp"

View file

@ -30,6 +30,7 @@ using namespace std;
using namespace boost;
using namespace util;
using namespace gui::widgets::timeline;
using namespace lumiera;
namespace gui {
namespace widgets {
@ -157,7 +158,7 @@ TimelineWidget::get_hovering_track() const
/* ===== Signals ===== */
sigc::signal<void, gavl_time_t>
sigc::signal<void, lumiera::Time>
TimelineWidget::mouse_hover_signal() const
{
return mouseHoverSignal;
@ -187,7 +188,7 @@ TimelineWidget::on_scroll()
{
if(state)
state->get_view_window().set_time_offset(
horizontalAdjustment.get_value());
Time((gavl_time_t)horizontalAdjustment.get_value()));
}
void

View file

@ -106,7 +106,7 @@ public:
public:
/* ===== Signals ===== */
sigc::signal<void, gavl_time_t> mouse_hover_signal() const;
sigc::signal<void, lumiera::Time> mouse_hover_signal() const;
sigc::signal<void> playback_period_drag_released_signal() const;
@ -264,7 +264,7 @@ protected:
Gtk::VScrollbar verticalScroll;
// Signals
sigc::signal<void, gavl_time_t> mouseHoverSignal;
sigc::signal<void, lumiera::Time> mouseHoverSignal;
sigc::signal<void> playbackPeriodDragReleasedSignal;
sigc::signal<void, boost::shared_ptr<timeline::Track> >
hoveringTrackChangedSignal;
@ -277,7 +277,7 @@ public:
/**
* The maximum scale for timeline display.
* @remarks At MaxScale, every pixel on the timeline is equivalent
* to 30000000 gavl_time_t increments.
* to 30000000 lumiera::Time increments.
*/
static const int64_t MaxScale;

View file

@ -34,6 +34,7 @@
using namespace Gtk;
using namespace std;
using namespace boost;
using namespace lumiera;
namespace gui {
namespace widgets {
@ -255,8 +256,8 @@ TimelineBody::on_motion_notify_event(GdkEventMotion *event)
TimelineViewWindow &window = view_window();
const int64_t scale = window.get_time_scale();
gavl_time_t offset = beginShiftTimeOffset +
(int64_t)(mouseDownX - event->x) * scale;
Time offset(beginShiftTimeOffset +
(int64_t)(mouseDownX - event->x) * scale);
window.set_time_offset(offset);
set_vertical_offset((int)(mouseDownY - event->y) +

View file

@ -25,6 +25,7 @@
using namespace boost;
using namespace gui::widgets;
using namespace lumiera;
namespace gui {
namespace widgets {
@ -95,7 +96,7 @@ IBeamTool::on_button_press_event(GdkEventButton* event)
if(event->button == 1)
{
const gavl_time_t time =
const Time time =
state->get_view_window().x_to_time(event->x);
if(is_mouse_in_start_drag_zone())
@ -187,7 +188,7 @@ IBeamTool::set_leading_x(const int x)
shared_ptr<TimelineState> state = get_state();
const bool set_playback_period = dragType == Selection;
const gavl_time_t time = state->get_view_window().x_to_time(x);
const Time time = state->get_view_window().x_to_time(x);
if(time > pinnedDragTime)
state->set_selection(pinnedDragTime, time, set_playback_period);
else

View file

@ -164,7 +164,7 @@ private:
* the mouse, the other is pinned. pinnedDragTime specifies the time
* of that point.
*/
gavl_time_t pinnedDragTime;
lumiera::Time pinnedDragTime;
/**
* This connection is used to represent the timer which causes scroll

View file

@ -37,6 +37,7 @@ using namespace boost;
using namespace gui;
using namespace gui::widgets;
using namespace gui::widgets::timeline;
using namespace lumiera;
namespace gui {
namespace widgets {
@ -235,7 +236,7 @@ TimelineRuler::set_leading_x(const int x)
if(state)
{
const gavl_time_t time = view_window().x_to_time(x);
const Time time = view_window().x_to_time(x);
if(time > pinnedDragTime)
state->set_playback_period(pinnedDragTime, time);
else

View file

@ -198,7 +198,7 @@ private:
* the mouse, the other is pinned. pinnedDragTime specifies the time
* of that point.
*/
gavl_time_t pinnedDragTime;
lumiera::Time pinnedDragTime;
// Indicated values
/**

View file

@ -25,6 +25,7 @@
using namespace boost;
using namespace Gtk;
using namespace sigc;
using namespace lumiera;
namespace gui {
namespace widgets {
@ -33,17 +34,17 @@ namespace timeline {
TimelineState::TimelineState(
boost::shared_ptr<model::Sequence> source_sequence) :
sequence(source_sequence),
viewWindow(0, 1),
viewWindow(Time(0), 1),
selectionStart(0),
selectionEnd(0),
playbackPeriodStart(0),
playbackPeriodEnd(0),
playbackPoint(GAVL_TIME_UNDEFINED)
playbackPoint(Time(GAVL_TIME_UNDEFINED))
{
REQUIRE(sequence);
viewWindow.set_time_scale(GAVL_TIME_SCALE / 200);
set_selection(2000000, 4000000);
set_selection(Time(2000000), Time(4000000));
}
boost::shared_ptr<model::Sequence>
@ -58,20 +59,20 @@ TimelineState::get_view_window()
return viewWindow;
}
gavl_time_t
Time
TimelineState::get_selection_start() const
{
return selectionStart;
}
gavl_time_t
Time
TimelineState::get_selection_end() const
{
return selectionEnd;
}
void
TimelineState::set_selection(gavl_time_t start, gavl_time_t end,
TimelineState::set_selection(Time start, Time end,
bool reset_playback_period)
{
if(start < end)
@ -95,20 +96,20 @@ TimelineState::set_selection(gavl_time_t start, gavl_time_t end,
selectionChangedSignal.emit();
}
gavl_time_t
Time
TimelineState::get_playback_period_start() const
{
return playbackPeriodStart;
}
gavl_time_t
Time
TimelineState::get_playback_period_end() const
{
return playbackPeriodEnd;
}
void
TimelineState::set_playback_period(gavl_time_t start, gavl_time_t end)
TimelineState::set_playback_period(Time start, Time end)
{
if(start < end)
@ -127,13 +128,13 @@ TimelineState::set_playback_period(gavl_time_t start, gavl_time_t end)
}
void
TimelineState::set_playback_point(gavl_time_t point)
TimelineState::set_playback_point(Time point)
{
playbackPoint = point;
playbackChangedSignal.emit();
}
gavl_time_t
Time
TimelineState::get_playback_point() const
{
return playbackPoint;

View file

@ -70,12 +70,12 @@ public:
/**
* Gets the time at which the selection begins.
*/
gavl_time_t get_selection_start() const;
lumiera::Time get_selection_start() const;
/**
* Gets the time at which the selection begins.
*/
gavl_time_t get_selection_end() const;
lumiera::Time get_selection_end() const;
/**
* Sets the period of the selection.
@ -84,39 +84,39 @@ public:
* @param reset_playback_period Specifies whether to set the playback
* period to the same as this new selection.
*/
void set_selection(gavl_time_t start, gavl_time_t end,
void set_selection(lumiera::Time start, lumiera::Time end,
bool reset_playback_period = true);
/**
* Gets the time at which the playback period begins.
*/
gavl_time_t get_playback_period_start() const;
lumiera::Time get_playback_period_start() const;
/**
* Gets the time at which the playback period ends.
*/
gavl_time_t get_playback_period_end() const;
lumiera::Time get_playback_period_end() const;
/**
* Sets the playback period.
* @param start The start time.
* @param end The end time.
*/
void set_playback_period(gavl_time_t start, gavl_time_t end);
void set_playback_period(lumiera::Time start, lumiera::Time end);
/**
* Sets the time which is currenty being played back.
* @param point The time index being played. This value may be
* GAVL_TIME_UNDEFINED, if there is no playback point.
*/
void set_playback_point(gavl_time_t point);
void set_playback_point(lumiera::Time point);
/**
* Gets the current playback point.
* @return The time index of the playback point. This value may be
* GAVL_TIME_UNDEFINED, if there is no playback point.
*/
gavl_time_t get_playback_point() const;
lumiera::Time get_playback_point() const;
/**
* A signal to notify when the selected period has changed.
@ -150,27 +150,27 @@ private:
/**
* The start time of the selection period.
**/
gavl_time_t selectionStart;
lumiera::Time selectionStart;
/**
* The end time of the selection period.
**/
gavl_time_t selectionEnd;
lumiera::Time selectionEnd;
/**
* The start time of the playback period.
**/
gavl_time_t playbackPeriodStart;
lumiera::Time playbackPeriodStart;
/**
* The end time of the playback period.
**/
gavl_time_t playbackPeriodEnd;
lumiera::Time playbackPeriodEnd;
/**
* The time of the playback point.
**/
gavl_time_t playbackPoint;
lumiera::Time playbackPoint;
// Signals

View file

@ -25,26 +25,27 @@
using namespace Gtk;
using namespace gui::widgets;
using namespace lumiera;
namespace gui {
namespace widgets {
namespace timeline {
TimelineViewWindow::TimelineViewWindow(
gavl_time_t offset, int64_t scale) :
Time offset, int64_t scale) :
timeOffset(offset),
timeScale(scale)
{
}
gavl_time_t
Time
TimelineViewWindow::get_time_offset() const
{
return timeOffset;
}
void
TimelineViewWindow::set_time_offset(gavl_time_t offset)
TimelineViewWindow::set_time_offset(Time offset)
{
timeOffset = offset;
changedSignal.emit();
@ -80,8 +81,8 @@ TimelineViewWindow::zoom_view(int point, int zoom_size)
new_time_scale = TimelineWidget::MaxScale;
// The view must be shifted so that the zoom is centred on the cursor
set_time_offset(get_time_offset() +
(timeScale - new_time_scale) * point);
set_time_offset(Time((gavl_time_t)get_time_offset() +
(timeScale - new_time_scale) * point));
// Apply the new scale
set_time_scale(new_time_scale);
@ -90,8 +91,8 @@ TimelineViewWindow::zoom_view(int point, int zoom_size)
void
TimelineViewWindow::shift_view(int view_width, int shift_size)
{
set_time_offset(get_time_offset() +
shift_size * timeScale * view_width / 256);
set_time_offset(Time((gavl_time_t)get_time_offset() +
shift_size * timeScale * view_width / 256));
}
int
@ -100,10 +101,10 @@ TimelineViewWindow::time_to_x(gavl_time_t time) const
return (int)((time - timeOffset) / timeScale);
}
gavl_time_t
Time
TimelineViewWindow::x_to_time(int x) const
{
return (gavl_time_t)((int64_t)x * timeScale + timeOffset);
return Time((gavl_time_t)((int64_t)x * timeScale + timeOffset));
}
sigc::signal<void>

View file

@ -50,19 +50,19 @@ public:
* @param offset The initial view offset.
* @param scale The initial scale.
**/
TimelineViewWindow(gavl_time_t offset, int64_t scale);
TimelineViewWindow(lumiera::Time offset, int64_t scale);
/**
* Gets the time offset. This is the time value displaid at the
* left-hand edge of the timeline body area.
*/
gavl_time_t get_time_offset() const;
lumiera::Time get_time_offset() const;
/**
* Sets the time offset. This is the time value displaid at the
* left-hand edge of the timeline body area.
*/
void set_time_offset(gavl_time_t time_offset);
void set_time_offset(lumiera::Time time_offset);
/**
* Gets the time scale value.
@ -108,7 +108,7 @@ public:
* the timeline body) to convert.
* @return Returns the time at the coordinate.
**/
gavl_time_t x_to_time(int x) const;
lumiera::Time x_to_time(int x) const;
/**
* A signal to indicate that the scale or offset have been changed.
@ -116,7 +116,7 @@ public:
sigc::signal<void> changed_signal() const;
private:
gavl_time_t timeOffset;
lumiera::Time timeOffset;
int64_t timeScale;
sigc::signal<void> changedSignal;