Integrating time::Control into ibeam tool.

This commit is contained in:
Michael R. Fisher 2011-10-22 04:29:55 -05:00 committed by Ichthyostega
parent b39edad306
commit 6046749f19
6 changed files with 21 additions and 9 deletions

View file

@ -62,7 +62,7 @@ TimelineWidget::TimelineWidget(shared_ptr<timeline::TimelineState> 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<timeline::TimelineState> 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);

View file

@ -82,6 +82,12 @@ TimelineBody::getTimelineWidget () const
return timelineWidget;
}
TimeSpan
TimelineBody::get_selection()
{
return timelineWidget.get_state()->get_selection();
}
ToolType
TimelineBody::get_tool() const
{

View file

@ -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.
*/

View file

@ -24,8 +24,6 @@
#include "gui/widgets/timeline-widget.hpp"
#include "lib/time/mutation.hpp"
#include <boost/shared_ptr.hpp>
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()
{

View file

@ -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 <gtkmm.h>
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<TimeSpan> selectionControl;
/**
* Specifies the type of drag currently taking place.
*/

View file

@ -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();}