Adding TimeSpan param to SelectionListener's signal
This commit is contained in:
parent
3811183546
commit
b87b6078ad
3 changed files with 18 additions and 14 deletions
|
|
@ -49,8 +49,7 @@ IBeamTool::IBeamTool(TimelineBody &timeline_body) :
|
||||||
scrollSlideRate(0)
|
scrollSlideRate(0)
|
||||||
{
|
{
|
||||||
// Connect the timlinebody selection to the selectionControl
|
// Connect the timlinebody selection to the selectionControl
|
||||||
// TODO: Create a virtual initialize function in the base class
|
get_state()->set_selection_control (selectionControl);
|
||||||
get_state()->set_selection_control(selectionControl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IBeamTool::~IBeamTool()
|
IBeamTool::~IBeamTool()
|
||||||
|
|
@ -122,8 +121,7 @@ IBeamTool::on_button_press_event(GdkEventButton* event)
|
||||||
// User began the drag in clear space, begin a Select drag
|
// User began the drag in clear space, begin a Select drag
|
||||||
dragType = Selection;
|
dragType = Selection;
|
||||||
pinnedDragTime = time;
|
pinnedDragTime = time;
|
||||||
selectionControl (TimeSpan(time, Duration::NIL)); //TODO: TimelineState Needs a listener for selection changes
|
selectionControl (TimeSpan(time, Duration::NIL));
|
||||||
state->selection_changed_signal().emit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -194,16 +192,17 @@ IBeamTool::set_leading_x(const int x)
|
||||||
{
|
{
|
||||||
shared_ptr<TimelineState> state = get_state();
|
shared_ptr<TimelineState> state = get_state();
|
||||||
|
|
||||||
const bool set_playback_period = dragType == Selection;
|
// The line below needs handled differently now;
|
||||||
|
//
|
||||||
|
//const bool set_playback_period = dragType == Selection;
|
||||||
|
|
||||||
TimeVar newStartPoint (state->get_view_window().x_to_time(x));
|
TimeVar newStartPoint (state->get_view_window().x_to_time(x));
|
||||||
Offset selectionLength (pinnedDragTime, newStartPoint);
|
Offset selectionLength (pinnedDragTime, newStartPoint);
|
||||||
|
|
||||||
if (newStartPoint > pinnedDragTime)
|
if (newStartPoint > pinnedDragTime)
|
||||||
newStartPoint=pinnedDragTime; // use the smaller one as selection start
|
newStartPoint=pinnedDragTime; // use the smaller one as selection start
|
||||||
|
|
||||||
//TODO: TimelineState Needs a listener for selection changes
|
|
||||||
selectionControl (TimeSpan (newStartPoint, Duration(selectionLength)));
|
selectionControl (TimeSpan (newStartPoint, Duration(selectionLength)));
|
||||||
state->selection_changed_signal().emit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,10 @@ TimelineState::TimelineState (shared_ptr<model::Sequence> source_sequence)
|
||||||
, isPlayback_(false)
|
, isPlayback_(false)
|
||||||
{
|
{
|
||||||
REQUIRE(sequence);
|
REQUIRE(sequence);
|
||||||
|
|
||||||
|
// Initialize the listener
|
||||||
|
selectionListener (TimeSpan (Time::ZERO, Duration::NIL));
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////TICKET #798: how to handle GUI default state
|
////////////////////////////////////////////////////////////TICKET #798: how to handle GUI default state
|
||||||
const int64_t DEFAULT_TIMELINE_SCALE =21000000;
|
const int64_t DEFAULT_TIMELINE_SCALE =21000000;
|
||||||
|
|
||||||
|
|
@ -123,7 +126,7 @@ TimelineState::playback_changed_signal() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineState::on_selection_changed()
|
TimelineState::on_selection_changed (TimeSpan selection)
|
||||||
{
|
{
|
||||||
selectionChangedSignal.emit();
|
selectionChangedSignal.emit();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,27 +48,29 @@ typedef Control<TimeSpan> SelectionControl;
|
||||||
/**
|
/**
|
||||||
* SelectionListener is a template class which emits a signal when
|
* SelectionListener is a template class which emits a signal when
|
||||||
* the value is changed by it's associated time::Control object.
|
* the value is changed by it's associated time::Control object.
|
||||||
|
* SelectionListener wraps a sigc::signal that emits every time
|
||||||
|
* the selection is changed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<class TI>
|
template<class TI>
|
||||||
class SelectionListener
|
class SelectionListener
|
||||||
: boost::noncopyable
|
: boost::noncopyable
|
||||||
{
|
{
|
||||||
sigc::signal<void> valueChangedSignal;
|
sigc::signal<void, TI> valueChangedSignal;
|
||||||
public:
|
public:
|
||||||
SelectionListener()
|
SelectionListener()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
operator() (TI const& changeValue) const
|
operator() (TI const& changeValue) const
|
||||||
{
|
{
|
||||||
valueChangedSignal.emit();
|
valueChangedSignal.emit(changeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void connect (const sigc::slot<void> &connection)
|
void connect (const sigc::slot<void, TI> &connection)
|
||||||
{
|
{
|
||||||
valueChangedSignal.connect (connection);
|
valueChangedSignal.connect (connection);
|
||||||
}
|
}
|
||||||
|
|
@ -160,7 +162,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* Event handler for when the selection is changed
|
* Event handler for when the selection is changed
|
||||||
*/
|
*/
|
||||||
void on_selection_changed();
|
void on_selection_changed (TimeSpan selection);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue