mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +00:00
Add SetGridBounds::setGrid() to avoid some duplicated code
This commit is contained in:
parent
f85f24e847
commit
1f6c6951af
@ -30,21 +30,23 @@ SetGridBounds::SetGridBounds(Sprite* sprite, const gfx::Rect& bounds)
|
||||
|
||||
void SetGridBounds::onExecute()
|
||||
{
|
||||
Sprite* spr = sprite();
|
||||
spr->setGridBounds(m_newBounds);
|
||||
Doc* doc = static_cast<Doc*>(spr->document());
|
||||
auto& docPref = Preferences::instance().document(doc);
|
||||
docPref.grid.bounds(m_newBounds);
|
||||
spr->incrementVersion();
|
||||
setGrid(m_newBounds);
|
||||
}
|
||||
|
||||
void SetGridBounds::onUndo()
|
||||
{
|
||||
setGrid(m_oldBounds);
|
||||
}
|
||||
|
||||
void SetGridBounds::setGrid(const gfx::Rect& grid)
|
||||
{
|
||||
Sprite* spr = sprite();
|
||||
spr->setGridBounds(m_oldBounds);
|
||||
spr->setGridBounds(grid);
|
||||
|
||||
Doc* doc = static_cast<Doc*>(spr->document());
|
||||
auto& docPref = Preferences::instance().document(doc);
|
||||
docPref.grid.bounds(m_oldBounds);
|
||||
docPref.grid.bounds(grid);
|
||||
|
||||
spr->incrementVersion();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@ namespace cmd {
|
||||
}
|
||||
|
||||
private:
|
||||
void setGrid(const gfx::Rect& grid);
|
||||
|
||||
gfx::Rect m_oldBounds;
|
||||
gfx::Rect m_newBounds;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user