2009-06-01 02:59:15 +00:00
|
|
|
/* ASE - Allegro Sprite Editor
|
2010-02-01 21:25:40 +00:00
|
|
|
* Copyright (C) 2001-2010 David Capello
|
2009-06-01 02:59:15 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2009-08-17 21:38:00 +00:00
|
|
|
#ifndef CONTEXT_H_INCLUDED
|
|
|
|
#define CONTEXT_H_INCLUDED
|
2009-06-01 02:59:15 +00:00
|
|
|
|
|
|
|
#include <list>
|
2009-10-09 01:34:06 +00:00
|
|
|
#include "ase_exception.h"
|
2010-09-29 20:50:46 +00:00
|
|
|
#include "base/disable_copying.h"
|
- All tools stuff refactored in various files/components.
- Added classes: IToolLoop, Tool, ToolGroup, ToolInk, ToolController, ToolPointShape, ToolIntertwine, ToolBox, etc.
- Added ToolLoopManager.
- Removed old src/modules/tools.cpp.
- Added ISettings and UISettingsImpl, adding the tools settings (onion skinning, grid, tiled mode, etc.).
- Added App::PenSizeBeforeChange, PenSizeAfterChange, CurrentToolChange signals.
- Renamed Context::get_bg/fg_color to getBg/FgColor.
- Refactored Brush class to Pen and added PenType.
- Renamed tiled_t to TiledMode.
- get_config_rect now uses the new Rect class imported from Vaca instead of old jrect.
- Added default_skin.xml to load tool icons.
- Added pen preview in Editor::cursor stuff.
- Added Editor::decorators.
Note: This big patch is from some time ago. I did my best to pre-commit other small changes before this big one.
2010-03-07 19:47:45 +00:00
|
|
|
#include "settings/settings.h"
|
2009-06-01 02:59:15 +00:00
|
|
|
|
|
|
|
class Sprite;
|
2009-06-11 15:11:11 +00:00
|
|
|
class SpriteReader;
|
2009-10-09 01:34:06 +00:00
|
|
|
class Command;
|
|
|
|
class Params;
|
2009-06-01 02:59:15 +00:00
|
|
|
|
|
|
|
typedef std::list<Sprite*> SpriteList;
|
|
|
|
|
2010-03-07 18:21:09 +00:00
|
|
|
class CommandPreconditionException : public ase_exception
|
2009-10-09 01:34:06 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-03-07 18:21:09 +00:00
|
|
|
CommandPreconditionException() throw()
|
2009-10-09 01:34:06 +00:00
|
|
|
: ase_exception("Cannot execute the command because its pre-conditions are false.") { }
|
|
|
|
};
|
|
|
|
|
2010-09-29 20:50:46 +00:00
|
|
|
class Context
|
2009-06-01 02:59:15 +00:00
|
|
|
{
|
- All tools stuff refactored in various files/components.
- Added classes: IToolLoop, Tool, ToolGroup, ToolInk, ToolController, ToolPointShape, ToolIntertwine, ToolBox, etc.
- Added ToolLoopManager.
- Removed old src/modules/tools.cpp.
- Added ISettings and UISettingsImpl, adding the tools settings (onion skinning, grid, tiled mode, etc.).
- Added App::PenSizeBeforeChange, PenSizeAfterChange, CurrentToolChange signals.
- Renamed Context::get_bg/fg_color to getBg/FgColor.
- Refactored Brush class to Pen and added PenType.
- Renamed tiled_t to TiledMode.
- get_config_rect now uses the new Rect class imported from Vaca instead of old jrect.
- Added default_skin.xml to load tool icons.
- Added pen preview in Editor::cursor stuff.
- Added Editor::decorators.
Note: This big patch is from some time ago. I did my best to pre-commit other small changes before this big one.
2010-03-07 19:47:45 +00:00
|
|
|
public:
|
2009-06-01 02:59:15 +00:00
|
|
|
virtual ~Context();
|
|
|
|
|
2009-06-11 15:11:11 +00:00
|
|
|
virtual bool is_ui_available() const { return false; }
|
|
|
|
virtual bool is_recording_macro() const { return false; }
|
|
|
|
virtual bool is_executing_macro() const { return false; }
|
|
|
|
virtual bool is_executing_script() const { return false; }
|
|
|
|
|
- All tools stuff refactored in various files/components.
- Added classes: IToolLoop, Tool, ToolGroup, ToolInk, ToolController, ToolPointShape, ToolIntertwine, ToolBox, etc.
- Added ToolLoopManager.
- Removed old src/modules/tools.cpp.
- Added ISettings and UISettingsImpl, adding the tools settings (onion skinning, grid, tiled mode, etc.).
- Added App::PenSizeBeforeChange, PenSizeAfterChange, CurrentToolChange signals.
- Renamed Context::get_bg/fg_color to getBg/FgColor.
- Refactored Brush class to Pen and added PenType.
- Renamed tiled_t to TiledMode.
- get_config_rect now uses the new Rect class imported from Vaca instead of old jrect.
- Added default_skin.xml to load tool icons.
- Added pen preview in Editor::cursor stuff.
- Added Editor::decorators.
Note: This big patch is from some time ago. I did my best to pre-commit other small changes before this big one.
2010-03-07 19:47:45 +00:00
|
|
|
ISettings* getSettings() { return m_settings; }
|
2009-10-09 01:34:06 +00:00
|
|
|
|
2009-06-01 02:59:15 +00:00
|
|
|
const SpriteList& get_sprite_list() const;
|
|
|
|
Sprite* get_first_sprite() const;
|
|
|
|
Sprite* get_next_sprite(Sprite* sprite) const;
|
|
|
|
|
|
|
|
void add_sprite(Sprite* sprite);
|
|
|
|
void remove_sprite(Sprite* sprite);
|
|
|
|
void send_sprite_to_top(Sprite* sprite);
|
|
|
|
|
|
|
|
Sprite* get_current_sprite() const;
|
|
|
|
void set_current_sprite(Sprite* sprite);
|
|
|
|
|
2009-10-09 01:34:06 +00:00
|
|
|
virtual void execute_command(Command* command, Params* params = NULL);
|
|
|
|
|
2009-06-01 02:59:15 +00:00
|
|
|
protected:
|
|
|
|
|
2010-04-10 19:56:26 +00:00
|
|
|
// The "settings" are deleted automatically in the ~Context destructor
|
|
|
|
Context(ISettings* settings);
|
|
|
|
|
2009-06-01 02:59:15 +00:00
|
|
|
virtual void on_add_sprite(Sprite* sprite);
|
|
|
|
virtual void on_remove_sprite(Sprite* sprite);
|
|
|
|
virtual void on_set_current_sprite(Sprite* sprite);
|
|
|
|
|
2010-04-10 19:56:26 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
// Without default constructor
|
|
|
|
Context();
|
|
|
|
|
|
|
|
// List of all sprites.
|
|
|
|
SpriteList m_sprites;
|
|
|
|
|
|
|
|
// Current selected sprite to operate.
|
|
|
|
Sprite* m_currentSprite;
|
|
|
|
|
|
|
|
// Settings in this context.
|
|
|
|
ISettings* m_settings;
|
|
|
|
|
2010-09-29 20:50:46 +00:00
|
|
|
DISABLE_COPYING(Context);
|
|
|
|
|
2009-06-01 02:59:15 +00:00
|
|
|
};
|
|
|
|
|
2009-08-17 21:38:00 +00:00
|
|
|
#endif
|