diff --git a/src/gui/gtk-lumiera.hpp b/src/gui/gtk-lumiera.hpp index 3a9b17159..fec25c9b3 100644 --- a/src/gui/gtk-lumiera.hpp +++ b/src/gui/gtk-lumiera.hpp @@ -39,6 +39,7 @@ #include #include #include "lib/util.hpp" +#include "lib/lumitime.hpp" #include "window-manager.hpp" diff --git a/src/gui/widgets/timeline-widget.cpp b/src/gui/widgets/timeline-widget.cpp index f4922c03e..721467536 100644 --- a/src/gui/widgets/timeline-widget.cpp +++ b/src/gui/widgets/timeline-widget.cpp @@ -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 +sigc::signal 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 diff --git a/src/gui/widgets/timeline-widget.hpp b/src/gui/widgets/timeline-widget.hpp index 4ce4d9e72..41e368947 100644 --- a/src/gui/widgets/timeline-widget.hpp +++ b/src/gui/widgets/timeline-widget.hpp @@ -106,7 +106,7 @@ public: public: /* ===== Signals ===== */ - sigc::signal mouse_hover_signal() const; + sigc::signal mouse_hover_signal() const; sigc::signal playback_period_drag_released_signal() const; @@ -264,7 +264,7 @@ protected: Gtk::VScrollbar verticalScroll; // Signals - sigc::signal mouseHoverSignal; + sigc::signal mouseHoverSignal; sigc::signal playbackPeriodDragReleasedSignal; sigc::signal > 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; diff --git a/src/gui/widgets/timeline/timeline-body.cpp b/src/gui/widgets/timeline/timeline-body.cpp index b3077f00d..44eb9a472 100644 --- a/src/gui/widgets/timeline/timeline-body.cpp +++ b/src/gui/widgets/timeline/timeline-body.cpp @@ -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) + diff --git a/src/gui/widgets/timeline/timeline-ibeam-tool.cpp b/src/gui/widgets/timeline/timeline-ibeam-tool.cpp index 5aa9a3883..7e243ef7c 100644 --- a/src/gui/widgets/timeline/timeline-ibeam-tool.cpp +++ b/src/gui/widgets/timeline/timeline-ibeam-tool.cpp @@ -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 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 diff --git a/src/gui/widgets/timeline/timeline-ibeam-tool.hpp b/src/gui/widgets/timeline/timeline-ibeam-tool.hpp index b1ee49378..5d05b14ba 100644 --- a/src/gui/widgets/timeline/timeline-ibeam-tool.hpp +++ b/src/gui/widgets/timeline/timeline-ibeam-tool.hpp @@ -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 diff --git a/src/gui/widgets/timeline/timeline-ruler.cpp b/src/gui/widgets/timeline/timeline-ruler.cpp index 23d3103ac..cce311007 100644 --- a/src/gui/widgets/timeline/timeline-ruler.cpp +++ b/src/gui/widgets/timeline/timeline-ruler.cpp @@ -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 diff --git a/src/gui/widgets/timeline/timeline-ruler.hpp b/src/gui/widgets/timeline/timeline-ruler.hpp index 11f5be709..e47038ab1 100644 --- a/src/gui/widgets/timeline/timeline-ruler.hpp +++ b/src/gui/widgets/timeline/timeline-ruler.hpp @@ -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 /** diff --git a/src/gui/widgets/timeline/timeline-state.cpp b/src/gui/widgets/timeline/timeline-state.cpp index c15f095b5..e6a6e92c5 100644 --- a/src/gui/widgets/timeline/timeline-state.cpp +++ b/src/gui/widgets/timeline/timeline-state.cpp @@ -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 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 @@ -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; diff --git a/src/gui/widgets/timeline/timeline-state.hpp b/src/gui/widgets/timeline/timeline-state.hpp index 2c9c07043..431173240 100644 --- a/src/gui/widgets/timeline/timeline-state.hpp +++ b/src/gui/widgets/timeline/timeline-state.hpp @@ -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 diff --git a/src/gui/widgets/timeline/timeline-view-window.cpp b/src/gui/widgets/timeline/timeline-view-window.cpp index 3eb469b7e..e5283a24a 100644 --- a/src/gui/widgets/timeline/timeline-view-window.cpp +++ b/src/gui/widgets/timeline/timeline-view-window.cpp @@ -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 diff --git a/src/gui/widgets/timeline/timeline-view-window.hpp b/src/gui/widgets/timeline/timeline-view-window.hpp index d1e1039ad..8689b6ce6 100644 --- a/src/gui/widgets/timeline/timeline-view-window.hpp +++ b/src/gui/widgets/timeline/timeline-view-window.hpp @@ -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 changed_signal() const; private: - gavl_time_t timeOffset; + lumiera::Time timeOffset; int64_t timeScale; sigc::signal changedSignal;