Added ToolInk::isCelMovement(). Now "Move" tool moves cel.

This commit is contained in:
David Capello 2010-04-24 16:10:48 -03:00
parent bb6815524f
commit 20c4ac5235
3 changed files with 11 additions and 3 deletions

View File

@ -119,12 +119,16 @@ public:
class MoveInk : public ToolInk class MoveInk : public ToolInk
{ {
public: public:
bool isCelMovement() const { return true; }
void prepareInk(IToolLoop* loop) void prepareInk(IToolLoop* loop)
{ {
// Do nothing
} }
void inkHline(int x1, int y, int x2, IToolLoop* loop) void inkHline(int x1, int y, int x2, IToolLoop* loop)
{ {
// Do nothing
} }
}; };

View File

@ -84,6 +84,9 @@ public:
// Returns true if this ink moves the scroll only // Returns true if this ink moves the scroll only
virtual bool isScrollMovement() const { return false; } virtual bool isScrollMovement() const { return false; }
// Returns true if this ink moves cels
virtual bool isCelMovement() const { return false; }
// It is called when the tool-loop start (generally when the user // It is called when the tool-loop start (generally when the user
// presses a mouse button over a sprite editor) // presses a mouse button over a sprite editor)
virtual void prepareInk(IToolLoop* loop) { } virtual void prepareInk(IToolLoop* loop) { }

View File

@ -898,11 +898,12 @@ bool Editor::msg_proc(JMessage msg)
editor_setcursor(msg->mouse.x, msg->mouse.y); editor_setcursor(msg->mouse.x, msg->mouse.y);
} }
/* move frames position */ // Move frames position
else if (m_ctrl_pressed) { else if (m_ctrl_pressed ||
current_tool->getInk(msg->mouse.right ? 1: 0)->isCelMovement()) {
if ((m_sprite->getCurrentLayer()) && if ((m_sprite->getCurrentLayer()) &&
(m_sprite->getCurrentLayer()->type == GFXOBJ_LAYER_IMAGE)) { (m_sprite->getCurrentLayer()->type == GFXOBJ_LAYER_IMAGE)) {
/* TODO you can move the `Background' with tiled mode */ // TODO you can move the `Background' with tiled mode
if (m_sprite->getCurrentLayer()->is_background()) { if (m_sprite->getCurrentLayer()->is_background()) {
jalert(_(PACKAGE jalert(_(PACKAGE
"<<You can't move the `Background' layer." "<<You can't move the `Background' layer."