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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <allegro/file.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 <cassert>
|
2009-06-01 02:59:15 +00:00
|
|
|
|
2009-12-11 14:53:05 +00:00
|
|
|
#include "app.h"
|
2009-06-01 02:59:15 +00:00
|
|
|
#include "modules/editors.h"
|
|
|
|
#include "raster/sprite.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/ui_settings_impl.h"
|
|
|
|
#include "ui_context.h"
|
2009-06-01 02:59:15 +00:00
|
|
|
#include "widgets/tabs.h"
|
|
|
|
|
2009-10-09 01:34:06 +00:00
|
|
|
UIContext* UIContext::m_instance = NULL;
|
2009-06-01 02:59:15 +00:00
|
|
|
|
2009-10-09 01:34:06 +00:00
|
|
|
UIContext::UIContext()
|
- 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
|
|
|
: Context(new UISettingsImpl)
|
2009-06-01 02:59:15 +00:00
|
|
|
{
|
2009-10-09 01:34:06 +00:00
|
|
|
assert(m_instance == NULL);
|
|
|
|
m_instance = this;
|
2009-06-01 02:59:15 +00:00
|
|
|
}
|
|
|
|
|
2009-10-09 01:34:06 +00:00
|
|
|
UIContext::~UIContext()
|
2009-06-01 02:59:15 +00:00
|
|
|
{
|
2009-10-09 01:34:06 +00:00
|
|
|
assert(m_instance == this);
|
|
|
|
m_instance = NULL;
|
2009-06-01 02:59:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void UIContext::on_add_sprite(Sprite* sprite)
|
|
|
|
{
|
|
|
|
// base method
|
|
|
|
Context::on_add_sprite(sprite);
|
|
|
|
|
|
|
|
// add the tab for this sprite
|
|
|
|
tabs_append_tab(app_get_tabsbar(),
|
2010-03-31 00:43:18 +00:00
|
|
|
get_filename(sprite->getFilename()), sprite);
|
2009-06-01 02:59:15 +00:00
|
|
|
|
|
|
|
// rebuild the menu list of sprites
|
|
|
|
app_realloc_sprite_list();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UIContext::on_remove_sprite(Sprite* sprite)
|
|
|
|
{
|
|
|
|
// base method
|
|
|
|
Context::on_remove_sprite(sprite);
|
|
|
|
|
|
|
|
// remove this sprite from tabs
|
|
|
|
tabs_remove_tab(app_get_tabsbar(), sprite);
|
|
|
|
|
|
|
|
// rebuild the menu list of sprites
|
|
|
|
app_realloc_sprite_list();
|
|
|
|
|
|
|
|
// select other sprites in the editors where are this sprite
|
|
|
|
editors_hide_sprite(sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UIContext::on_set_current_sprite(Sprite* sprite)
|
|
|
|
{
|
|
|
|
// base method
|
|
|
|
Context::on_set_current_sprite(sprite);
|
|
|
|
|
|
|
|
// select the sprite in the tabs
|
|
|
|
tabs_select_tab(app_get_tabsbar(), sprite);
|
|
|
|
}
|