mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-15 11:42:30 +00:00
Undoers were little objects to swap/revert an action. They didn't execute the action itself, they just revert its previous state. Now undoers were replaced with cmds: A cmd is an object that executes/undoes/redoes just one action. Changes: * Remove old undo library and app/objects_container_impl.cpp (now we use the doc::ObjectId directly to store undo info) * Remove all Undoers from app/undoers/ * Replace DocumentApi impl with little Cmds in app/cmd/, these cmds handle execute/undo/redo of each action at the logic layer * Remove doc::Dirty object * Remove doc::Settings: all undo configuration is in the app side * Move undo options from app:ISettings to app::Preferences * Rename UndoTransaction to Transaction * Create a CmdSequence to store a sequence of Cmds (as now the new undo library doesn't support open/close groups) * Add doc::get<T>(ObjectId) function to get any kind of object from the doc library by its ID * Add Cel::document() and Sprite::document() members * Add Sprite::cels(frame_t) to get all cels in the given frame * Add Layer::displaceFrames() member function * Move the "allow non-linear history" flag from undo2::UndoHistory to app::DocumentUndo
64 lines
1.7 KiB
C++
64 lines
1.7 KiB
C++
/* Aseprite
|
|
* Copyright (C) 2001-2015 David Capello
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifndef APP_CMD_SET_PIXEL_FORMAT_H_INCLUDED
|
|
#define APP_CMD_SET_PIXEL_FORMAT_H_INCLUDED
|
|
#pragma once
|
|
|
|
#include "app/cmd_sequence.h"
|
|
#include "app/cmd/with_sprite.h"
|
|
#include "doc/pixel_format.h"
|
|
#include "doc/dithering_method.h"
|
|
|
|
namespace doc {
|
|
class Sprite;
|
|
}
|
|
|
|
namespace app {
|
|
namespace cmd {
|
|
using namespace doc;
|
|
|
|
class SetPixelFormat : public Cmd
|
|
, public WithSprite {
|
|
public:
|
|
SetPixelFormat(Sprite* sprite,
|
|
PixelFormat newFormat,
|
|
DitheringMethod dithering);
|
|
|
|
protected:
|
|
void onExecute() override;
|
|
void onUndo() override;
|
|
void onRedo() override;
|
|
size_t onMemSize() const override {
|
|
return sizeof(*this) + m_seq.memSize();
|
|
}
|
|
|
|
private:
|
|
void setFormat(PixelFormat format);
|
|
|
|
PixelFormat m_oldFormat;
|
|
PixelFormat m_newFormat;
|
|
DitheringMethod m_dithering;
|
|
CmdSequence m_seq;
|
|
};
|
|
|
|
} // namespace cmd
|
|
} // namespace app
|
|
|
|
#endif
|