The tool also needs updated on TimelineState Change

This commit is contained in:
Michael R. Fisher 2011-10-23 09:52:12 -05:00
parent 1bb584f895
commit 65a29244af
2 changed files with 11 additions and 5 deletions

View file

@ -57,9 +57,12 @@ TimelineBody::TimelineBody (TimelineWidget &timelineWidget)
timelineWidget.state_changed_signal().connect( timelineWidget.state_changed_signal().connect(
sigc::mem_fun(this, &TimelineBody::on_state_changed) ); sigc::mem_fun(this, &TimelineBody::on_state_changed) );
// Set a default Tool
this->set_tool(Arrow);
// Install style properties // Install style properties
register_styles(); register_styles();
// Reset the state // Reset the state
propagateStateChange(); propagateStateChange();
} }
@ -96,10 +99,10 @@ TimelineBody::get_tool() const
} }
void void
TimelineBody::set_tool(timeline::ToolType tool_type) TimelineBody::set_tool(timeline::ToolType tool_type, bool force)
{ {
// Tidy up old tool // Tidy up old tool
if(tool) if(tool && !force)
{ {
// Do we need to change tools? // Do we need to change tools?
if(tool->get_type() == tool_type) if(tool->get_type() == tool_type)
@ -322,7 +325,10 @@ TimelineBody::propagateStateChange()
viewWindow().changed_signal().connect( viewWindow().changed_signal().connect(
sigc::mem_fun(this, &TimelineBody::on_update_view) ); sigc::mem_fun(this, &TimelineBody::on_update_view) );
} }
// Need to reload the current tool...
set_tool (get_tool(), true);
// Redraw // Redraw
queue_draw(); queue_draw();
} }

View file

@ -88,7 +88,7 @@ public:
* @param tool_type The type of tool to set. * @param tool_type The type of tool to set.
*/ */
void void
set_tool(ToolType tool_type); set_tool(ToolType tool_type, bool force=false);
/* ===== Events ===== */ /* ===== Events ===== */
protected: protected: