When we are in pixels-movement loop, drop pixels when the user selects other tool (that is not marquee, lasso, or magic wand).

This commit is contained in:
David Capello 2010-08-12 00:29:51 -03:00
parent 9f68fd459d
commit f8bbc19b22
2 changed files with 19 additions and 0 deletions

View File

@ -195,6 +195,7 @@ public:
protected:
bool onProcessMessage(JMessage msg);
void onCurrentToolChange();
private:
void drawGrid(const Rect& gridBounds, color_t color);

View File

@ -104,6 +104,8 @@ Editor::Editor()
m_pixelsMovement = NULL;
jwidget_focusrest(this, true);
App::instance()->CurrentToolChange.connect(&Editor::onCurrentToolChange, this);
}
Editor::~Editor()
@ -1508,6 +1510,22 @@ bool Editor::onProcessMessage(JMessage msg)
return Widget::onProcessMessage(msg);
}
// When the current tool is changed
void Editor::onCurrentToolChange()
{
UIContext* context = UIContext::instance();
Tool* current_tool = context->getSettings()->getCurrentTool();
// If the user changed the tool when he/she is moving pixels,
// we have to drop the pixels only if the new tool is not selection...
if (m_pixelsMovement &&
(!current_tool->getInk(0)->isSelection() ||
!current_tool->getInk(1)->isSelection())) {
// We have to drop pixels
dropPixels();
}
}
/**
* Returns size for the editor viewport
*/