Use Tx instead of Transaction on PixelsMovement

This commit is contained in:
David Capello 2019-07-12 14:36:28 -03:00
parent 1ae29dfc3c
commit 04d547ce37
2 changed files with 11 additions and 11 deletions

View File

@ -61,7 +61,7 @@ PixelsMovement::PixelsMovement(
, m_document(site.document()) , m_document(site.document())
, m_sprite(site.sprite()) , m_sprite(site.sprite())
, m_layer(site.layer()) , m_layer(site.layer())
, m_transaction(context, operationName) , m_tx(context, operationName)
, m_setMaskCmd(nullptr) , m_setMaskCmd(nullptr)
, m_isDragging(false) , m_isDragging(false)
, m_adjustPivot(false) , m_adjustPivot(false)
@ -197,7 +197,7 @@ void PixelsMovement::trim()
// (Ctrl+V) and cut (Ctrl+X) the floating pixels. // (Ctrl+V) and cut (Ctrl+X) the floating pixels.
if (writer.cel() && if (writer.cel() &&
writer.cel()->layer()->isTransparent()) writer.cel()->layer()->isTransparent())
m_transaction.execute(new cmd::TrimCel(writer.cel())); m_tx(new cmd::TrimCel(writer.cel()));
} }
void PixelsMovement::cutMask() void PixelsMovement::cutMask()
@ -205,7 +205,7 @@ void PixelsMovement::cutMask()
{ {
ContextWriter writer(m_reader, 1000); ContextWriter writer(m_reader, 1000);
if (writer.cel()) { if (writer.cel()) {
m_transaction.execute(new cmd::ClearMask(writer.cel())); m_tx(new cmd::ClearMask(writer.cel()));
// Do not trim here so we don't lost the information about all // Do not trim here so we don't lost the information about all
// linked cels related to "writer.cel()" // linked cels related to "writer.cel()"
@ -515,7 +515,7 @@ void PixelsMovement::stampImage()
// portion of sprite. // portion of sprite.
ExpandCelCanvas expand( ExpandCelCanvas expand(
m_site, m_site.layer(), m_site, m_site.layer(),
TiledMode::NONE, m_transaction, TiledMode::NONE, m_tx,
ExpandCelCanvas::None); ExpandCelCanvas::None);
// We cannot use cel->bounds() because cel->image() is nullptr // We cannot use cel->bounds() because cel->image() is nullptr
@ -589,7 +589,7 @@ void PixelsMovement::dropImage()
stampImage(); stampImage();
// This is the end of the whole undo transaction. // This is the end of the whole undo transaction.
m_transaction.commit(); m_tx.commit();
// Destroy the extra cel (this cel will be used by the drawing // Destroy the extra cel (this cel will be used by the drawing
// cursor surely). // cursor surely).
@ -604,10 +604,10 @@ void PixelsMovement::discardImage(const CommitChangesOption commit,
// Deselect the mask (here we don't stamp the image) // Deselect the mask (here we don't stamp the image)
if (keepMask == DontKeepMask) if (keepMask == DontKeepMask)
m_transaction.execute(new cmd::DeselectMask(m_document)); m_tx(new cmd::DeselectMask(m_document));
if (commit == CommitChanges) if (commit == CommitChanges)
m_transaction.commit(); m_tx.commit();
// Destroy the extra cel and regenerate the mask boundaries (we've // Destroy the extra cel and regenerate the mask boundaries (we've
// just deselect the mask). // just deselect the mask).
@ -811,7 +811,7 @@ void PixelsMovement::updateDocumentMask()
{ {
if (!m_setMaskCmd) { if (!m_setMaskCmd) {
m_setMaskCmd = new cmd::SetMask(m_document, m_currentMask); m_setMaskCmd = new cmd::SetMask(m_document, m_currentMask);
m_transaction.execute(m_setMaskCmd); m_tx(m_setMaskCmd);
} }
else else
m_setMaskCmd->setNewMask(m_currentMask); m_setMaskCmd->setNewMask(m_currentMask);

View File

@ -12,7 +12,7 @@
#include "app/context_access.h" #include "app/context_access.h"
#include "app/extra_cel.h" #include "app/extra_cel.h"
#include "app/site.h" #include "app/site.h"
#include "app/transaction.h" #include "app/tx.h"
#include "app/ui/editor/handle_type.h" #include "app/ui/editor/handle_type.h"
#include "base/shared_ptr.h" #include "base/shared_ptr.h"
#include "doc/algorithm/flip_type.h" #include "doc/algorithm/flip_type.h"
@ -105,7 +105,7 @@ namespace app {
// Rotates the image and the mask the given angle. It's used to // Rotates the image and the mask the given angle. It's used to
// simulate RotateCommand when we're inside MovingPixelsState. // simulate RotateCommand when we're inside MovingPixelsState.
void rotate(double angle); void rotate(double angle);
void shift(int dx, int dy); void shift(int dx, int dy);
const Transformation& getTransformation() const { return m_currentData; } const Transformation& getTransformation() const { return m_currentData; }
@ -127,7 +127,7 @@ namespace app {
Doc* m_document; Doc* m_document;
Sprite* m_sprite; Sprite* m_sprite;
Layer* m_layer; Layer* m_layer;
Transaction m_transaction; Tx m_tx;
cmd::SetMask* m_setMaskCmd; cmd::SetMask* m_setMaskCmd;
bool m_isDragging; bool m_isDragging;
bool m_adjustPivot; bool m_adjustPivot;