From 6046749f190ef07e9bab77e3b4349a04c6a1c38a Mon Sep 17 00:00:00 2001 From: "Michael R. Fisher" Date: Sat, 22 Oct 2011 04:29:55 -0500 Subject: [PATCH] Integrating time::Control into ibeam tool. --- src/gui/widgets/timeline-widget.cpp | 4 ++-- src/gui/widgets/timeline/timeline-body.cpp | 6 ++++++ src/gui/widgets/timeline/timeline-body.hpp | 4 ++++ src/gui/widgets/timeline/timeline-ibeam-tool.cpp | 7 ++----- src/gui/widgets/timeline/timeline-ibeam-tool.hpp | 7 ++++++- src/gui/widgets/timeline/timeline-state.hpp | 2 +- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/gui/widgets/timeline-widget.cpp b/src/gui/widgets/timeline-widget.cpp index c3442902f..52008f0cc 100644 --- a/src/gui/widgets/timeline-widget.cpp +++ b/src/gui/widgets/timeline-widget.cpp @@ -62,7 +62,7 @@ TimelineWidget::TimelineWidget(shared_ptr source_state) ENSURE(headerContainer != NULL); ruler = manage(new TimelineRuler(*this)); ENSURE(ruler != NULL); - + horizontalAdjustment.signal_value_changed().connect( sigc::mem_fun( this, &TimelineWidget::on_scroll) ); verticalAdjustment.signal_value_changed().connect( sigc::mem_fun( @@ -71,7 +71,7 @@ TimelineWidget::TimelineWidget(shared_ptr source_state) this, &TimelineWidget::on_motion_in_body_notify_event) ); update_tracks(); - + attach(*body, 1, 2, 1, 2, FILL|EXPAND, FILL|EXPAND); attach(*ruler, 1, 2, 0, 1, FILL|EXPAND, SHRINK); attach(*headerContainer, 0, 1, 1, 2, SHRINK, FILL|EXPAND); diff --git a/src/gui/widgets/timeline/timeline-body.cpp b/src/gui/widgets/timeline/timeline-body.cpp index d546ada65..369b894ed 100644 --- a/src/gui/widgets/timeline/timeline-body.cpp +++ b/src/gui/widgets/timeline/timeline-body.cpp @@ -82,6 +82,12 @@ TimelineBody::getTimelineWidget () const return timelineWidget; } +TimeSpan +TimelineBody::get_selection() +{ + return timelineWidget.get_state()->get_selection(); +} + ToolType TimelineBody::get_tool() const { diff --git a/src/gui/widgets/timeline/timeline-body.hpp b/src/gui/widgets/timeline/timeline-body.hpp index 25125f2cc..16b3b13e7 100644 --- a/src/gui/widgets/timeline/timeline-body.hpp +++ b/src/gui/widgets/timeline/timeline-body.hpp @@ -46,6 +46,7 @@ class TimelineWidget; namespace timeline { using lib::time::TimeVar; +using lib::time::TimeSpan; class Track; @@ -73,6 +74,9 @@ public: TimelineWidget& getTimelineWidget () const; + TimeSpan + get_selection(); + /** * Returns the type of the currently selected timeline tool. */ diff --git a/src/gui/widgets/timeline/timeline-ibeam-tool.cpp b/src/gui/widgets/timeline/timeline-ibeam-tool.cpp index 71aeef656..c8becb870 100644 --- a/src/gui/widgets/timeline/timeline-ibeam-tool.cpp +++ b/src/gui/widgets/timeline/timeline-ibeam-tool.cpp @@ -24,8 +24,6 @@ #include "gui/widgets/timeline-widget.hpp" #include "lib/time/mutation.hpp" -#include - using namespace gui::widgets; using lib::time::Mutation; @@ -45,12 +43,11 @@ const int IBeamTool::ScrollSlideEventInterval = 40; IBeamTool::IBeamTool(TimelineBody &timeline_body) : Tool(timeline_body), + selectionControl(), dragType(None), pinnedDragTime(), scrollSlideRate(0) -{ - -} +{ } IBeamTool::~IBeamTool() { diff --git a/src/gui/widgets/timeline/timeline-ibeam-tool.hpp b/src/gui/widgets/timeline/timeline-ibeam-tool.hpp index 291305cde..22cf6862f 100644 --- a/src/gui/widgets/timeline/timeline-ibeam-tool.hpp +++ b/src/gui/widgets/timeline/timeline-ibeam-tool.hpp @@ -30,14 +30,17 @@ #include "gui/widgets/timeline/timeline-tool.hpp" #include "lib/time/timevalue.hpp" +#include "lib/time/timequant.hpp" +#include "lib/time/control.hpp" -#include namespace gui { namespace widgets { namespace timeline { using lib::time::TimeVar; +using lib::time::TimeSpan; +using lib::time::Control; /** * A helper class to implement the timeline i-beam tool @@ -159,6 +162,8 @@ private: }; /* ==== Internals ===== */ + Control selectionControl; + /** * Specifies the type of drag currently taking place. */ diff --git a/src/gui/widgets/timeline/timeline-state.hpp b/src/gui/widgets/timeline/timeline-state.hpp index 5542b1520..6446e7790 100644 --- a/src/gui/widgets/timeline/timeline-state.hpp +++ b/src/gui/widgets/timeline/timeline-state.hpp @@ -70,7 +70,7 @@ public: */ timeline::TimelineViewWindow& get_view_window(); - + TimeSpan get_selection() const { return selection_; } Time getSelectionStart() const { return selection_.start();} Time getSelectionEnd() const { return selection_.end(); } Time getPlaybackPeriodStart() const { return selection_.start();}