mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-06 23:09:58 +00:00
8adbae888f
This bug was introduced in e730b90958
to fix memory leaks in "app". Now a new UndoCommand::dispose() member
function was added to fix this problem.
Also std::function<> and std::tr1::function<> was removed from the test.
We're in the middle of a transition between OS X SDK 10.4 to 10.9/10
and this brings some problems.
59 lines
1.2 KiB
C++
59 lines
1.2 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 version 2 as
|
|
// published by the Free Software Foundation.
|
|
|
|
#ifndef APP_CMD_H_INCLUDED
|
|
#define APP_CMD_H_INCLUDED
|
|
#pragma once
|
|
|
|
#include "base/disable_copying.h"
|
|
#include "doc/sprite_position.h"
|
|
#include "undo/undo_command.h"
|
|
|
|
#include <string>
|
|
|
|
namespace app {
|
|
class Context;
|
|
|
|
class Cmd : public undo::UndoCommand {
|
|
public:
|
|
Cmd();
|
|
virtual ~Cmd();
|
|
|
|
void execute(Context* ctx);
|
|
|
|
// undo::UndoCommand impl
|
|
void undo() override;
|
|
void redo() override;
|
|
void dispose() override;
|
|
|
|
std::string label() const;
|
|
size_t memSize() const;
|
|
|
|
Context* context() const { return m_ctx; }
|
|
|
|
protected:
|
|
virtual void onExecute();
|
|
virtual void onUndo();
|
|
virtual void onRedo();
|
|
virtual void onFireNotifications();
|
|
virtual std::string onLabel() const;
|
|
virtual size_t onMemSize() const;
|
|
|
|
private:
|
|
Context* m_ctx;
|
|
#if _DEBUG
|
|
enum class State { NotExecuted, Executed, Undone, Redone };
|
|
State m_state;
|
|
#endif
|
|
|
|
DISABLE_COPYING(Cmd);
|
|
};
|
|
|
|
} // namespace app
|
|
|
|
#endif
|