add EventMove command, fix extra signal call in map border resize

This commit is contained in:
garakmon
2020-07-30 16:35:48 -04:00
committed by garak
parent fb1eec1755
commit a0dc347ad3
10 changed files with 290 additions and 160 deletions

View File

@@ -2,10 +2,13 @@
#define EDITCOMMANDS_H
#include <QUndoCommand>
#include <QList>
class MapPixmapItem;
class Map;
class Blockdata;
class Event;
class DraggablePixmapItem;
enum CommandId {
ID_PaintMetatile, // - done
@@ -14,10 +17,11 @@ enum CommandId {
ID_ShiftMetatiles, // - done
ID_ResizeMap, // - done
ID_PaintBorder, // - done
ID_EventMove, // -
ID_EventMove, // - done
ID_EventShift, // -
ID_EventCreate, // -
ID_EventDelete, // -
ID_EventSetData, // -
ID_EventSetData, // - ?
// Tileset editor history commands
// Region map editor history commands
};
@@ -165,4 +169,28 @@ private:
Blockdata *oldBorder;
};
///
class EventMove : public QUndoCommand {
public:
EventMove(QList<Event *> events,
int deltaX, int deltaY, unsigned actionId,
QUndoCommand *parent = nullptr);
~EventMove();
void undo() override;
void redo() override;
bool mergeWith(const QUndoCommand *command) override;
int id() const override { return CommandId::ID_EventMove; }
private:
QList<Event *> events;
int deltaX;
int deltaY;
unsigned actionId;
};
#endif // EDITCOMMANDS_H

View File

@@ -22,6 +22,7 @@ public:
static QString HealLocation;
};
class DraggablePixmapItem;
class Project;
class Event
{
@@ -97,6 +98,9 @@ public:
int frame = 0;
bool hFlip = false;
bool usingSprite;
DraggablePixmapItem *pixmapItem = nullptr;
void setPixmapItem(DraggablePixmapItem *item) { pixmapItem = item; }
};
#endif // EVENT_H