mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-02 13:14:01 +00:00
Add IDocumentSettings to separate document related settings from ISettings
This is the first step to have settings per document. Currently IDocumentSettings is implemented as a global instance so all documents share the configuration (as it was already working). But in the future a project will be able to provide an alternative implementation to save the configuration of each document in the same project.
This commit is contained in:
parent
b029faf832
commit
b381d3a7b3
@ -34,6 +34,7 @@
|
||||
#include "raster/mask.h"
|
||||
#include "raster/pen.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "settings/settings.h"
|
||||
#include "skin/skin_parts.h"
|
||||
#include "tools/ink.h"
|
||||
@ -235,6 +236,8 @@ private:
|
||||
Slider* m_tolerance;
|
||||
Slider* m_sprayWidth;
|
||||
Slider* m_airSpeed;
|
||||
ISettings* m_settings;
|
||||
IDocumentSettings* m_docSettings;
|
||||
|
||||
void onWindowClose();
|
||||
void onTiledClick();
|
||||
@ -259,10 +262,15 @@ ConfigureTools::ConfigureTools()
|
||||
"Configure Tools",
|
||||
CmdUIOnlyFlag)
|
||||
{
|
||||
m_settings = NULL;
|
||||
m_docSettings = NULL;
|
||||
}
|
||||
|
||||
void ConfigureTools::onExecute(Context* context)
|
||||
{
|
||||
m_settings = UIContext::instance()->getSettings();
|
||||
m_docSettings = m_settings->getDocumentSettings(NULL);
|
||||
|
||||
Button* set_grid;
|
||||
Widget* brush_preview_box;
|
||||
Widget* brush_type_box;
|
||||
@ -272,7 +280,7 @@ void ConfigureTools::onExecute(Context* context)
|
||||
window = app::load_widget<Window>("tools_configuration.xml", "configure_tool");
|
||||
first_time = true;
|
||||
}
|
||||
/* if the window is opened, close it */
|
||||
// If the window is opened, close it
|
||||
else if (window->isVisible()) {
|
||||
window->closeWindow(NULL);
|
||||
return;
|
||||
@ -314,9 +322,8 @@ void ConfigureTools::onExecute(Context* context)
|
||||
}
|
||||
|
||||
// Current settings
|
||||
ISettings* settings = UIContext::instance()->getSettings();
|
||||
Tool* current_tool = settings->getCurrentTool();
|
||||
IToolSettings* tool_settings = settings->getToolSettings(current_tool);
|
||||
Tool* current_tool = m_settings->getCurrentTool();
|
||||
IToolSettings* tool_settings = m_settings->getToolSettings(current_tool);
|
||||
|
||||
/* brush-type */
|
||||
if (first_time) {
|
||||
@ -333,16 +340,16 @@ void ConfigureTools::onExecute(Context* context)
|
||||
m_brushType = window->findChildT<ButtonSet>("brush_type");
|
||||
}
|
||||
|
||||
if (settings->getTiledMode() != TILED_NONE) {
|
||||
if (m_docSettings->getTiledMode() != TILED_NONE) {
|
||||
m_tiled->setSelected(true);
|
||||
if (settings->getTiledMode() & TILED_X_AXIS) m_tiledX->setSelected(true);
|
||||
if (settings->getTiledMode() & TILED_Y_AXIS) m_tiledY->setSelected(true);
|
||||
if (m_docSettings->getTiledMode() & TILED_X_AXIS) m_tiledX->setSelected(true);
|
||||
if (m_docSettings->getTiledMode() & TILED_Y_AXIS) m_tiledY->setSelected(true);
|
||||
}
|
||||
|
||||
if (settings->getSnapToGrid()) m_snapToGrid->setSelected(true);
|
||||
if (settings->getGridVisible()) m_viewGrid->setSelected(true);
|
||||
if (settings->getPixelGridVisible()) m_pixelGrid->setSelected(true);
|
||||
if (settings->getUseOnionskin()) m_onionSkin->setSelected(true);
|
||||
if (m_docSettings->getSnapToGrid()) m_snapToGrid->setSelected(true);
|
||||
if (m_docSettings->getGridVisible()) m_viewGrid->setSelected(true);
|
||||
if (m_docSettings->getPixelGridVisible()) m_pixelGrid->setSelected(true);
|
||||
if (m_docSettings->getUseOnionskin()) m_onionSkin->setSelected(true);
|
||||
|
||||
if (first_time) {
|
||||
// Append children
|
||||
@ -396,13 +403,8 @@ void ConfigureTools::onBrushTypeChange()
|
||||
{
|
||||
PenType type = (PenType)m_brushType->getSelectedItem();
|
||||
|
||||
Tool* current_tool = UIContext::instance()
|
||||
->getSettings()
|
||||
->getCurrentTool();
|
||||
|
||||
UIContext::instance()
|
||||
->getSettings()
|
||||
->getToolSettings(current_tool)
|
||||
Tool* current_tool = m_settings->getCurrentTool();
|
||||
m_settings->getToolSettings(current_tool)
|
||||
->getPen()
|
||||
->setType(type);
|
||||
|
||||
@ -418,13 +420,8 @@ void ConfigureTools::onBrushTypeChange()
|
||||
|
||||
void ConfigureTools::onBrushSizeSliderChange()
|
||||
{
|
||||
Tool* current_tool = UIContext::instance()
|
||||
->getSettings()
|
||||
->getCurrentTool();
|
||||
|
||||
UIContext::instance()
|
||||
->getSettings()
|
||||
->getToolSettings(current_tool)
|
||||
Tool* current_tool = m_settings->getCurrentTool();
|
||||
m_settings->getToolSettings(current_tool)
|
||||
->getPen()
|
||||
->setSize(m_brushSize->getValue());
|
||||
|
||||
@ -433,13 +430,8 @@ void ConfigureTools::onBrushSizeSliderChange()
|
||||
|
||||
void ConfigureTools::onBrushAngleSliderChange()
|
||||
{
|
||||
Tool* current_tool = UIContext::instance()
|
||||
->getSettings()
|
||||
->getCurrentTool();
|
||||
|
||||
UIContext::instance()
|
||||
->getSettings()
|
||||
->getToolSettings(current_tool)
|
||||
Tool* current_tool = m_settings->getCurrentTool();
|
||||
m_settings->getToolSettings(current_tool)
|
||||
->getPen()
|
||||
->setAngle(m_brushAngle->getValue());
|
||||
|
||||
@ -448,41 +440,37 @@ void ConfigureTools::onBrushAngleSliderChange()
|
||||
|
||||
void ConfigureTools::onOpacitySliderChange()
|
||||
{
|
||||
ISettings* settings = UIContext::instance()->getSettings();
|
||||
Tool* current_tool = settings->getCurrentTool();
|
||||
Tool* current_tool = m_settings->getCurrentTool();
|
||||
|
||||
settings->getToolSettings(current_tool)->setOpacity(m_opacity->getValue());
|
||||
m_settings->getToolSettings(current_tool)->setOpacity(m_opacity->getValue());
|
||||
}
|
||||
|
||||
void ConfigureTools::onToleranceSliderChange()
|
||||
{
|
||||
ISettings* settings = UIContext::instance()->getSettings();
|
||||
Tool* current_tool = settings->getCurrentTool();
|
||||
Tool* current_tool = m_settings->getCurrentTool();
|
||||
|
||||
settings->getToolSettings(current_tool)->setTolerance(m_tolerance->getValue());
|
||||
m_settings->getToolSettings(current_tool)->setTolerance(m_tolerance->getValue());
|
||||
}
|
||||
|
||||
void ConfigureTools::onSprayWidthSliderChange()
|
||||
{
|
||||
ISettings* settings = UIContext::instance()->getSettings();
|
||||
Tool* current_tool = settings->getCurrentTool();
|
||||
Tool* current_tool = m_settings->getCurrentTool();
|
||||
|
||||
settings->getToolSettings(current_tool)->setSprayWidth(m_sprayWidth->getValue());
|
||||
m_settings->getToolSettings(current_tool)->setSprayWidth(m_sprayWidth->getValue());
|
||||
}
|
||||
|
||||
void ConfigureTools::onAirSpeedSliderChange()
|
||||
{
|
||||
ISettings* settings = UIContext::instance()->getSettings();
|
||||
Tool* current_tool = settings->getCurrentTool();
|
||||
Tool* current_tool = m_settings->getCurrentTool();
|
||||
|
||||
settings->getToolSettings(current_tool)->setSpraySpeed(m_airSpeed->getValue());
|
||||
m_settings->getToolSettings(current_tool)->setSpraySpeed(m_airSpeed->getValue());
|
||||
}
|
||||
|
||||
void ConfigureTools::onTiledClick()
|
||||
{
|
||||
bool flag = m_tiled->isSelected();
|
||||
|
||||
UIContext::instance()->getSettings()->setTiledMode(flag ? TILED_BOTH: TILED_NONE);
|
||||
m_docSettings->setTiledMode(flag ? TILED_BOTH: TILED_NONE);
|
||||
|
||||
m_tiledX->setSelected(flag);
|
||||
m_tiledY->setSelected(flag);
|
||||
@ -490,7 +478,7 @@ void ConfigureTools::onTiledClick()
|
||||
|
||||
void ConfigureTools::onTiledXYClick(int tiled_axis, CheckBox* checkbox)
|
||||
{
|
||||
int tiled_mode = UIContext::instance()->getSettings()->getTiledMode();
|
||||
int tiled_mode = m_docSettings->getTiledMode();
|
||||
|
||||
if (checkbox->isSelected())
|
||||
tiled_mode |= tiled_axis;
|
||||
@ -499,23 +487,23 @@ void ConfigureTools::onTiledXYClick(int tiled_axis, CheckBox* checkbox)
|
||||
|
||||
checkbox->findSibling("tiled")->setSelected(tiled_mode != TILED_NONE);
|
||||
|
||||
UIContext::instance()->getSettings()->setTiledMode((TiledMode)tiled_mode);
|
||||
m_docSettings->setTiledMode((TiledMode)tiled_mode);
|
||||
}
|
||||
|
||||
void ConfigureTools::onSnapToGridClick()
|
||||
{
|
||||
UIContext::instance()->getSettings()->setSnapToGrid(m_snapToGrid->isSelected());
|
||||
m_docSettings->setSnapToGrid(m_snapToGrid->isSelected());
|
||||
}
|
||||
|
||||
void ConfigureTools::onViewGridClick()
|
||||
{
|
||||
UIContext::instance()->getSettings()->setGridVisible(m_viewGrid->isSelected());
|
||||
m_docSettings->setGridVisible(m_viewGrid->isSelected());
|
||||
refresh_all_editors();
|
||||
}
|
||||
|
||||
void ConfigureTools::onPixelGridClick()
|
||||
{
|
||||
UIContext::instance()->getSettings()->setPixelGridVisible(m_pixelGrid->isSelected());
|
||||
m_docSettings->setPixelGridVisible(m_pixelGrid->isSelected());
|
||||
refresh_all_editors();
|
||||
}
|
||||
|
||||
@ -528,9 +516,9 @@ void ConfigureTools::onSetGridClick()
|
||||
if (document && document->isMaskVisible()) {
|
||||
const Mask* mask(document->getMask());
|
||||
|
||||
UIContext::instance()->getSettings()->setGridBounds(mask->getBounds());
|
||||
m_docSettings->setGridBounds(mask->getBounds());
|
||||
|
||||
if (UIContext::instance()->getSettings()->getGridVisible())
|
||||
if (m_docSettings->getGridVisible())
|
||||
refresh_all_editors();
|
||||
}
|
||||
else {
|
||||
@ -547,7 +535,7 @@ void ConfigureTools::onSetGridClick()
|
||||
|
||||
void ConfigureTools::onOnionSkinClick()
|
||||
{
|
||||
UIContext::instance()->getSettings()->setUseOnionskin(m_onionSkin->isSelected());
|
||||
m_docSettings->setUseOnionskin(m_onionSkin->isSelected());
|
||||
refresh_all_editors();
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "commands/command.h"
|
||||
#include "context.h"
|
||||
#include "modules/editors.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "settings/settings.h"
|
||||
#include "ui/window.h"
|
||||
#include "ui_context.h"
|
||||
@ -52,17 +53,18 @@ public:
|
||||
protected:
|
||||
bool onChecked(Context* context)
|
||||
{
|
||||
ISettings* settings = context->getSettings();
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
|
||||
|
||||
return settings->getGridVisible();
|
||||
return docSettings->getGridVisible();
|
||||
}
|
||||
|
||||
void onExecute(Context* context)
|
||||
{
|
||||
ISettings* settings = context->getSettings();
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
|
||||
|
||||
settings->setGridVisible(settings->getGridVisible() ? false: true);
|
||||
refresh_all_editors();
|
||||
docSettings->setGridVisible(docSettings->getGridVisible() ? false: true);
|
||||
|
||||
refresh_all_editors(); // TODO this should be done by "setGridVisible" impl
|
||||
}
|
||||
};
|
||||
|
||||
@ -84,21 +86,20 @@ public:
|
||||
protected:
|
||||
bool onChecked(Context* context)
|
||||
{
|
||||
ISettings* settings = context->getSettings();
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
|
||||
|
||||
return settings->getSnapToGrid();
|
||||
return docSettings->getSnapToGrid();
|
||||
}
|
||||
|
||||
void onExecute(Context* context)
|
||||
{
|
||||
ISettings* settings = context->getSettings();
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
|
||||
char buf[512];
|
||||
|
||||
settings->setSnapToGrid(settings->getSnapToGrid() ? false: true);
|
||||
refresh_all_editors();
|
||||
docSettings->setSnapToGrid(docSettings->getSnapToGrid() ? false: true);
|
||||
|
||||
usprintf(buf, "Snap to grid: %s",
|
||||
(settings->getSnapToGrid() ? "On": "Off"));
|
||||
(docSettings->getSnapToGrid() ? "On": "Off"));
|
||||
|
||||
StatusBar::instance()->setStatusText(250, buf);
|
||||
}
|
||||
@ -139,7 +140,8 @@ void GridSettingsCommand::onExecute(Context* context)
|
||||
Widget* grid_w = app::find_widget<Widget>(window, "grid_w");
|
||||
Widget* grid_h = app::find_widget<Widget>(window, "grid_h");
|
||||
|
||||
Rect bounds = UIContext::instance()->getSettings()->getGridBounds();
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
|
||||
Rect bounds = docSettings->getGridBounds();
|
||||
|
||||
grid_x->setTextf("%d", bounds.x);
|
||||
grid_y->setTextf("%d", bounds.y);
|
||||
@ -156,10 +158,10 @@ void GridSettingsCommand::onExecute(Context* context)
|
||||
bounds.w = MAX(bounds.w, 1);
|
||||
bounds.h = MAX(bounds.h, 1);
|
||||
|
||||
UIContext::instance()->getSettings()->setGridBounds(bounds);
|
||||
docSettings->setGridBounds(bounds);
|
||||
|
||||
if (UIContext::instance()->getSettings()->getGridVisible())
|
||||
refresh_all_editors();
|
||||
if (docSettings->getGridVisible())
|
||||
refresh_all_editors(); // TODO this should be done by "setGridBounds" impl
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "ini_file.h"
|
||||
#include "modules/editors.h"
|
||||
#include "raster/image.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "ui/gui.h"
|
||||
#include "util/render.h"
|
||||
#include "widgets/color_button.h"
|
||||
@ -66,7 +67,7 @@ OptionsCommand::OptionsCommand()
|
||||
|
||||
void OptionsCommand::onExecute(Context* context)
|
||||
{
|
||||
/* load the window widget */
|
||||
// Load the window widget
|
||||
UniquePtr<Window> window(app::load_widget<Window>("options.xml", "options"));
|
||||
Widget* check_smooth = app::find_widget<Widget>(window, "smooth");
|
||||
Widget* move_click2 = app::find_widget<Widget>(window, "move_click2");
|
||||
@ -88,13 +89,16 @@ void OptionsCommand::onExecute(Context* context)
|
||||
cursor_color->setId("cursor_color");
|
||||
cursor_color_box->addChild(cursor_color);
|
||||
|
||||
// Get global settings for documents
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(NULL);
|
||||
|
||||
// Grid color
|
||||
ColorButton* grid_color = new ColorButton(context->getSettings()->getGridColor(), IMAGE_RGB);
|
||||
ColorButton* grid_color = new ColorButton(docSettings->getGridColor(), IMAGE_RGB);
|
||||
grid_color->setId("grid_color");
|
||||
grid_color_box->addChild(grid_color);
|
||||
|
||||
// Pixel grid color
|
||||
ColorButton* pixel_grid_color = new ColorButton(context->getSettings()->getPixelGridColor(), IMAGE_RGB);
|
||||
ColorButton* pixel_grid_color = new ColorButton(docSettings->getPixelGridColor(), IMAGE_RGB);
|
||||
pixel_grid_color->setId("pixel_grid_color");
|
||||
pixel_grid_color_box->addChild(pixel_grid_color);
|
||||
|
||||
@ -143,8 +147,8 @@ void OptionsCommand::onExecute(Context* context)
|
||||
int undo_size_limit_value;
|
||||
|
||||
Editor::set_cursor_color(cursor_color->getColor());
|
||||
context->getSettings()->setGridColor(grid_color->getColor());
|
||||
context->getSettings()->setPixelGridColor(pixel_grid_color->getColor());
|
||||
docSettings->setGridColor(grid_color->getColor());
|
||||
docSettings->setPixelGridColor(pixel_grid_color->getColor());
|
||||
|
||||
set_config_bool("Options", "MoveSmooth", check_smooth->isSelected());
|
||||
set_config_bool("Options", "MoveClick2", move_click2->isSelected());
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "raster/image.h"
|
||||
#include "raster/palette.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "widgets/editor/editor.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -74,7 +75,8 @@ void PlayAnimationCommand::onExecute(Context* context)
|
||||
Sprite* sprite(document->getSprite());
|
||||
int msecs;
|
||||
bool done = false;
|
||||
bool onionskin_state = context->getSettings()->getUseOnionskin();
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(document);
|
||||
bool onionskin_state = docSettings->getUseOnionskin();
|
||||
Palette *oldpal, *newpal;
|
||||
PALETTE rgbpal;
|
||||
|
||||
@ -82,7 +84,7 @@ void PlayAnimationCommand::onExecute(Context* context)
|
||||
return;
|
||||
|
||||
// desactivate the onionskin
|
||||
context->getSettings()->setUseOnionskin(false);
|
||||
docSettings->setUseOnionskin(false);
|
||||
|
||||
ui::jmouse_hide();
|
||||
|
||||
@ -136,15 +138,16 @@ void PlayAnimationCommand::onExecute(Context* context)
|
||||
gui_feedback();
|
||||
}
|
||||
|
||||
// restore onionskin flag
|
||||
context->getSettings()->setUseOnionskin(onionskin_state);
|
||||
// Restore onionskin flag
|
||||
docSettings->setUseOnionskin(onionskin_state);
|
||||
|
||||
/* if right-click or ESC */
|
||||
if (mouse_b == 2 || (keypressed() && (readkey()>>8) == KEY_ESC))
|
||||
/* return to the old frame position */
|
||||
// If right-click or ESC
|
||||
if (mouse_b == 2 || (keypressed() && (readkey()>>8) == KEY_ESC)) {
|
||||
// Return to the old frame position
|
||||
sprite->setCurrentFrame(old_frame);
|
||||
}
|
||||
|
||||
/* refresh all */
|
||||
// Refresh all
|
||||
newpal = sprite->getPalette(sprite->getCurrentFrame());
|
||||
set_current_palette(newpal, true);
|
||||
ui::Manager::getDefault()->invalidate();
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "raster/image.h"
|
||||
#include "raster/palette.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "util/render.h"
|
||||
#include "widgets/editor/editor.h"
|
||||
#include "widgets/status_bar.h"
|
||||
@ -90,7 +91,8 @@ void PreviewCommand::onExecute(Context* context)
|
||||
View* view = View::getView(editor);
|
||||
int u, v, x, y;
|
||||
int index_bg_color = -1;
|
||||
TiledMode tiled = context->getSettings()->getTiledMode();
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(document);
|
||||
TiledMode tiled = docSettings->getTiledMode();
|
||||
|
||||
// Free mouse
|
||||
editor->getManager()->freeMouse();
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "commands/params.h"
|
||||
#include "document_wrappers.h"
|
||||
#include "modules/editors.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "settings/settings.h"
|
||||
#include "ui/view.h"
|
||||
#include "widgets/editor/editor.h"
|
||||
@ -95,10 +96,11 @@ bool ScrollCommand::onEnabled(Context* context)
|
||||
|
||||
void ScrollCommand::onExecute(Context* context)
|
||||
{
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
|
||||
ui::View* view = ui::View::getView(current_editor);
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
gfx::Rect gridBounds = context->getSettings()->getGridBounds();
|
||||
gfx::Rect gridBounds = docSettings->getGridBounds();
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
int pixels = 0;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "ini_file.h"
|
||||
#include "raster/mask.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "ui/button.h"
|
||||
#include "ui/label.h"
|
||||
#include "ui/listbox.h"
|
||||
@ -187,7 +188,8 @@ void ConvolutionMatrixCommand::onExecute(Context* context)
|
||||
|
||||
// Create the filter and setup initial settings
|
||||
ConvolutionMatrixFilter filter;
|
||||
filter.setTiledMode(context->getSettings()->getTiledMode());
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
|
||||
filter.setTiledMode(docSettings->getTiledMode());
|
||||
if (matrix != 0)
|
||||
filter.setMatrix(matrix);
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "ini_file.h"
|
||||
#include "raster/mask.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "settings/settings.h"
|
||||
#include "ui/button.h"
|
||||
#include "ui/entry.h"
|
||||
@ -113,8 +114,10 @@ bool DespeckleCommand::onEnabled(Context* context)
|
||||
|
||||
void DespeckleCommand::onExecute(Context* context)
|
||||
{
|
||||
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
|
||||
|
||||
MedianFilter filter;
|
||||
filter.setTiledMode(context->getSettings()->getTiledMode());
|
||||
filter.setTiledMode(docSettings->getTiledMode());
|
||||
filter.setSize(get_config_int(ConfigSection, "Width", 3),
|
||||
get_config_int(ConfigSection, "Height", 3));
|
||||
|
||||
@ -128,7 +131,6 @@ void DespeckleCommand::onExecute(Context* context)
|
||||
if (window.doModal()) {
|
||||
set_config_int(ConfigSection, "Width", filter.getWidth());
|
||||
set_config_int(ConfigSection, "Height", filter.getHeight());
|
||||
context->getSettings()->setTiledMode(filter.getTiledMode());
|
||||
}
|
||||
}
|
||||
|
||||
|
79
src/settings/document_settings.h
Normal file
79
src/settings/document_settings.h
Normal file
@ -0,0 +1,79 @@
|
||||
/* ASEPRITE
|
||||
* Copyright (C) 2001-2012 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 SETTINGS_DOCUMENT_SETTINGS_H_INCLUDED
|
||||
#define SETTINGS_DOCUMENT_SETTINGS_H_INCLUDED
|
||||
|
||||
#include "app/color.h"
|
||||
#include "filters/tiled_mode.h"
|
||||
#include "gfx/point.h"
|
||||
#include "gfx/rect.h"
|
||||
|
||||
enum SnapBehavior {
|
||||
NormalSnap = 0,
|
||||
SnapInRightBottom = 1
|
||||
};
|
||||
|
||||
class IDocumentSettings
|
||||
{
|
||||
public:
|
||||
virtual ~IDocumentSettings() { }
|
||||
|
||||
// Tiled mode
|
||||
|
||||
virtual TiledMode getTiledMode() = 0;
|
||||
virtual void setTiledMode(TiledMode mode) = 0;
|
||||
|
||||
// Grid settings
|
||||
|
||||
virtual bool getSnapToGrid() = 0;
|
||||
virtual bool getGridVisible() = 0;
|
||||
virtual gfx::Rect getGridBounds() = 0;
|
||||
virtual Color getGridColor() = 0;
|
||||
|
||||
virtual void setSnapToGrid(bool state) = 0;
|
||||
virtual void setGridVisible(bool state) = 0;
|
||||
virtual void setGridBounds(const gfx::Rect& rect) = 0;
|
||||
virtual void setGridColor(const Color& color) = 0;
|
||||
|
||||
virtual void snapToGrid(gfx::Point& point, SnapBehavior snapBehavior) const = 0;
|
||||
|
||||
// Pixel grid
|
||||
|
||||
virtual bool getPixelGridVisible() = 0;
|
||||
virtual Color getPixelGridColor() = 0;
|
||||
|
||||
virtual void setPixelGridVisible(bool state) = 0;
|
||||
virtual void setPixelGridColor(const Color& color) = 0;
|
||||
|
||||
// Onionskin settings
|
||||
|
||||
virtual bool getUseOnionskin() = 0;
|
||||
virtual int getOnionskinPrevFrames() = 0;
|
||||
virtual int getOnionskinNextFrames() = 0;
|
||||
virtual int getOnionskinOpacityBase() = 0;
|
||||
virtual int getOnionskinOpacityStep() = 0;
|
||||
|
||||
virtual void setUseOnionskin(bool state) = 0;
|
||||
virtual void setOnionskinPrevFrames(int frames) = 0;
|
||||
virtual void setOnionskinNextFrames(int frames) = 0;
|
||||
virtual void setOnionskinOpacityBase(int base) = 0;
|
||||
virtual void setOnionskinOpacityStep(int step) = 0;
|
||||
};
|
||||
|
||||
#endif
|
@ -20,22 +20,17 @@
|
||||
#define SETTINGS_SETTINGS_H_INCLUDED
|
||||
|
||||
#include "app/color.h"
|
||||
#include "filters/tiled_mode.h"
|
||||
#include "gfx/point.h"
|
||||
#include "gfx/rect.h"
|
||||
#include "raster/pen_type.h"
|
||||
|
||||
class Document;
|
||||
class IDocumentSettings;
|
||||
class IToolSettings;
|
||||
class IPenSettings;
|
||||
|
||||
namespace tools { class Tool; }
|
||||
|
||||
enum SnapBehavior {
|
||||
NormalSnap = 0,
|
||||
SnapInRightBottom = 1
|
||||
};
|
||||
|
||||
// Settings used in tool <-> drawing <-> editor stuff
|
||||
class ISettings
|
||||
{
|
||||
public:
|
||||
@ -46,51 +41,17 @@ public:
|
||||
virtual Color getFgColor() = 0;
|
||||
virtual Color getBgColor() = 0;
|
||||
virtual tools::Tool* getCurrentTool() = 0;
|
||||
virtual TiledMode getTiledMode() = 0;
|
||||
|
||||
virtual void setFgColor(const Color& color) = 0;
|
||||
virtual void setBgColor(const Color& color) = 0;
|
||||
virtual void setCurrentTool(tools::Tool* tool) = 0;
|
||||
virtual void setTiledMode(TiledMode mode) = 0;
|
||||
|
||||
// Grid settings
|
||||
|
||||
virtual bool getSnapToGrid() = 0;
|
||||
virtual bool getGridVisible() = 0;
|
||||
virtual gfx::Rect getGridBounds() = 0;
|
||||
virtual Color getGridColor() = 0;
|
||||
|
||||
virtual void setSnapToGrid(bool state) = 0;
|
||||
virtual void setGridVisible(bool state) = 0;
|
||||
virtual void setGridBounds(const gfx::Rect& rect) = 0;
|
||||
virtual void setGridColor(const Color& color) = 0;
|
||||
|
||||
virtual void snapToGrid(gfx::Point& point, SnapBehavior snapBehavior) const = 0;
|
||||
|
||||
// Pixel grid
|
||||
|
||||
virtual bool getPixelGridVisible() = 0;
|
||||
virtual Color getPixelGridColor() = 0;
|
||||
|
||||
virtual void setPixelGridVisible(bool state) = 0;
|
||||
virtual void setPixelGridColor(const Color& color) = 0;
|
||||
|
||||
// Onionskin settings
|
||||
|
||||
virtual bool getUseOnionskin() = 0;
|
||||
virtual int getOnionskinPrevFrames() = 0;
|
||||
virtual int getOnionskinNextFrames() = 0;
|
||||
virtual int getOnionskinOpacityBase() = 0;
|
||||
virtual int getOnionskinOpacityStep() = 0;
|
||||
|
||||
virtual void setUseOnionskin(bool state) = 0;
|
||||
virtual void setOnionskinPrevFrames(int frames) = 0;
|
||||
virtual void setOnionskinNextFrames(int frames) = 0;
|
||||
virtual void setOnionskinOpacityBase(int base) = 0;
|
||||
virtual void setOnionskinOpacityStep(int step) = 0;
|
||||
|
||||
// Tools settings
|
||||
// Returns the specific settings for the given document. If the
|
||||
// document is null, it should return an interface for
|
||||
// global/default settings.
|
||||
virtual IDocumentSettings* getDocumentSettings(const Document* document) = 0;
|
||||
|
||||
// Specific configuration for the given tool.
|
||||
virtual IToolSettings* getToolSettings(tools::Tool* tool) = 0;
|
||||
|
||||
};
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "app.h"
|
||||
#include "ini_file.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "tools/point_shape.h"
|
||||
#include "tools/tool.h"
|
||||
#include "tools/tool_box.h"
|
||||
@ -33,44 +34,113 @@
|
||||
|
||||
using namespace gfx;
|
||||
|
||||
class UIDocumentSettingsImpl : public IDocumentSettings
|
||||
{
|
||||
public:
|
||||
UIDocumentSettingsImpl()
|
||||
: m_tiledMode((TiledMode)get_config_int("Tools", "Tiled", (int)TILED_NONE))
|
||||
, m_use_onionskin(get_config_bool("Onionskin", "Enabled", false))
|
||||
, m_prev_frames_onionskin(get_config_int("Onionskin", "PrevFrames", 1))
|
||||
, m_next_frames_onionskin(get_config_int("Onionskin", "NextFrames", 0))
|
||||
, m_onionskin_opacity_base(get_config_int("Onionskin", "OpacityBase", 128))
|
||||
, m_onionskin_opacity_step(get_config_int("Onionskin", "OpacityStep", 32))
|
||||
, m_snapToGrid(get_config_bool("Grid", "SnapTo", false))
|
||||
, m_gridVisible(get_config_bool("Grid", "Visible", false))
|
||||
, m_gridBounds(get_config_rect("Grid", "Bounds", Rect(0, 0, 16, 16)))
|
||||
, m_gridColor(get_config_color("Grid", "Color", Color::fromRgb(0, 0, 255)))
|
||||
, m_pixelGridColor(get_config_color("PixelGrid", "Color", Color::fromRgb(200, 200, 200)))
|
||||
, m_pixelGridVisible(get_config_bool("PixelGrid", "Visible", false))
|
||||
{
|
||||
m_tiledMode = (TiledMode)MID(0, (int)m_tiledMode, (int)TILED_BOTH);
|
||||
}
|
||||
|
||||
~UIDocumentSettingsImpl()
|
||||
{
|
||||
set_config_int("Tools", "Tiled", m_tiledMode);
|
||||
set_config_bool("Grid", "SnapTo", m_snapToGrid);
|
||||
set_config_bool("Grid", "Visible", m_gridVisible);
|
||||
set_config_rect("Grid", "Bounds", m_gridBounds);
|
||||
set_config_color("Grid", "Color", m_gridColor);
|
||||
set_config_bool("PixelGrid", "Visible", m_pixelGridVisible);
|
||||
set_config_color("PixelGrid", "Color", m_pixelGridColor);
|
||||
|
||||
set_config_bool("Onionskin", "Enabled", m_use_onionskin);
|
||||
set_config_int("Onionskin", "PrevFrames", m_prev_frames_onionskin);
|
||||
set_config_int("Onionskin", "NextFrames", m_next_frames_onionskin);
|
||||
set_config_int("Onionskin", "OpacityBase", m_onionskin_opacity_base);
|
||||
set_config_int("Onionskin", "OpacityStep", m_onionskin_opacity_step);
|
||||
}
|
||||
|
||||
// Tiled mode
|
||||
|
||||
virtual TiledMode getTiledMode() OVERRIDE;
|
||||
virtual void setTiledMode(TiledMode mode) OVERRIDE;
|
||||
|
||||
// Grid settings
|
||||
|
||||
virtual bool getSnapToGrid() OVERRIDE;
|
||||
virtual bool getGridVisible() OVERRIDE;
|
||||
virtual gfx::Rect getGridBounds() OVERRIDE;
|
||||
virtual Color getGridColor() OVERRIDE;
|
||||
|
||||
virtual void setSnapToGrid(bool state) OVERRIDE;
|
||||
virtual void setGridVisible(bool state) OVERRIDE;
|
||||
virtual void setGridBounds(const gfx::Rect& rect) OVERRIDE;
|
||||
virtual void setGridColor(const Color& color) OVERRIDE;
|
||||
|
||||
virtual void snapToGrid(gfx::Point& point, SnapBehavior snapBehavior) const OVERRIDE;
|
||||
|
||||
// Pixel grid
|
||||
|
||||
virtual bool getPixelGridVisible() OVERRIDE;
|
||||
virtual Color getPixelGridColor() OVERRIDE;
|
||||
|
||||
virtual void setPixelGridVisible(bool state) OVERRIDE;
|
||||
virtual void setPixelGridColor(const Color& color) OVERRIDE;
|
||||
|
||||
// Onionskin settings
|
||||
|
||||
virtual bool getUseOnionskin() OVERRIDE;
|
||||
virtual int getOnionskinPrevFrames() OVERRIDE;
|
||||
virtual int getOnionskinNextFrames() OVERRIDE;
|
||||
virtual int getOnionskinOpacityBase() OVERRIDE;
|
||||
virtual int getOnionskinOpacityStep() OVERRIDE;
|
||||
|
||||
virtual void setUseOnionskin(bool state) OVERRIDE;
|
||||
virtual void setOnionskinPrevFrames(int frames) OVERRIDE;
|
||||
virtual void setOnionskinNextFrames(int frames) OVERRIDE;
|
||||
virtual void setOnionskinOpacityBase(int base) OVERRIDE;
|
||||
virtual void setOnionskinOpacityStep(int step) OVERRIDE;
|
||||
|
||||
private:
|
||||
TiledMode m_tiledMode;
|
||||
bool m_use_onionskin;
|
||||
int m_prev_frames_onionskin;
|
||||
int m_next_frames_onionskin;
|
||||
int m_onionskin_opacity_base;
|
||||
int m_onionskin_opacity_step;
|
||||
bool m_snapToGrid;
|
||||
bool m_gridVisible;
|
||||
gfx::Rect m_gridBounds;
|
||||
Color m_gridColor;
|
||||
bool m_pixelGridVisible;
|
||||
Color m_pixelGridColor;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// UISettingsImpl
|
||||
|
||||
UISettingsImpl::UISettingsImpl()
|
||||
: m_currentTool(NULL)
|
||||
, m_tiledMode((TiledMode)get_config_int("Tools", "Tiled", (int)TILED_NONE))
|
||||
, m_use_onionskin(get_config_bool("Onionskin", "Enabled", false))
|
||||
, m_prev_frames_onionskin(get_config_int("Onionskin", "PrevFrames", 1))
|
||||
, m_next_frames_onionskin(get_config_int("Onionskin", "NextFrames", 0))
|
||||
, m_onionskin_opacity_base(get_config_int("Onionskin", "OpacityBase", 128))
|
||||
, m_onionskin_opacity_step(get_config_int("Onionskin", "OpacityStep", 32))
|
||||
, m_snapToGrid(get_config_bool("Grid", "SnapTo", false))
|
||||
, m_gridVisible(get_config_bool("Grid", "Visible", false))
|
||||
, m_gridBounds(get_config_rect("Grid", "Bounds", Rect(0, 0, 16, 16)))
|
||||
, m_gridColor(get_config_color("Grid", "Color", Color::fromRgb(0, 0, 255)))
|
||||
, m_pixelGridColor(get_config_color("PixelGrid", "Color", Color::fromRgb(200, 200, 200)))
|
||||
, m_pixelGridVisible(get_config_bool("PixelGrid", "Visible", false))
|
||||
, m_globalDocumentSettings(new UIDocumentSettingsImpl)
|
||||
{
|
||||
m_tiledMode = (TiledMode)MID(0, (int)m_tiledMode, (int)TILED_BOTH);
|
||||
}
|
||||
|
||||
UISettingsImpl::~UISettingsImpl()
|
||||
{
|
||||
set_config_int("Tools", "Tiled", m_tiledMode);
|
||||
set_config_bool("Grid", "SnapTo", m_snapToGrid);
|
||||
set_config_bool("Grid", "Visible", m_gridVisible);
|
||||
set_config_rect("Grid", "Bounds", m_gridBounds);
|
||||
set_config_color("Grid", "Color", m_gridColor);
|
||||
set_config_bool("PixelGrid", "Visible", m_pixelGridVisible);
|
||||
set_config_color("PixelGrid", "Color", m_pixelGridColor);
|
||||
delete m_globalDocumentSettings;
|
||||
|
||||
set_config_bool("Onionskin", "Enabled", m_use_onionskin);
|
||||
set_config_int("Onionskin", "PrevFrames", m_prev_frames_onionskin);
|
||||
set_config_int("Onionskin", "NextFrames", m_next_frames_onionskin);
|
||||
set_config_int("Onionskin", "OpacityBase", m_onionskin_opacity_base);
|
||||
set_config_int("Onionskin", "OpacityStep", m_onionskin_opacity_step);
|
||||
|
||||
// delete all tool settings
|
||||
// Delete all tool settings.
|
||||
std::map<std::string, IToolSettings*>::iterator it;
|
||||
for (it = m_toolSettings.begin(); it != m_toolSettings.end(); ++it)
|
||||
delete it->second;
|
||||
@ -97,11 +167,6 @@ tools::Tool* UISettingsImpl::getCurrentTool()
|
||||
return m_currentTool;
|
||||
}
|
||||
|
||||
TiledMode UISettingsImpl::getTiledMode()
|
||||
{
|
||||
return m_tiledMode;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setFgColor(const Color& color)
|
||||
{
|
||||
ColorBar::instance()->setFgColor(color);
|
||||
@ -126,55 +191,65 @@ void UISettingsImpl::setCurrentTool(tools::Tool* tool)
|
||||
}
|
||||
}
|
||||
|
||||
void UISettingsImpl::setTiledMode(TiledMode mode)
|
||||
IDocumentSettings* UISettingsImpl::getDocumentSettings(const Document* document)
|
||||
{
|
||||
return m_globalDocumentSettings;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// IDocumentSettings implementation
|
||||
|
||||
TiledMode UIDocumentSettingsImpl::getTiledMode()
|
||||
{
|
||||
return m_tiledMode;
|
||||
}
|
||||
|
||||
void UIDocumentSettingsImpl::setTiledMode(TiledMode mode)
|
||||
{
|
||||
m_tiledMode = mode;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Grid settings
|
||||
|
||||
bool UISettingsImpl::getSnapToGrid()
|
||||
bool UIDocumentSettingsImpl::getSnapToGrid()
|
||||
{
|
||||
return m_snapToGrid;
|
||||
}
|
||||
|
||||
bool UISettingsImpl::getGridVisible()
|
||||
bool UIDocumentSettingsImpl::getGridVisible()
|
||||
{
|
||||
return m_gridVisible;
|
||||
}
|
||||
|
||||
Rect UISettingsImpl::getGridBounds()
|
||||
Rect UIDocumentSettingsImpl::getGridBounds()
|
||||
{
|
||||
return m_gridBounds;
|
||||
}
|
||||
|
||||
Color UISettingsImpl::getGridColor()
|
||||
Color UIDocumentSettingsImpl::getGridColor()
|
||||
{
|
||||
return m_gridColor;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setSnapToGrid(bool state)
|
||||
void UIDocumentSettingsImpl::setSnapToGrid(bool state)
|
||||
{
|
||||
m_snapToGrid = state;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setGridVisible(bool state)
|
||||
void UIDocumentSettingsImpl::setGridVisible(bool state)
|
||||
{
|
||||
m_gridVisible = state;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setGridBounds(const Rect& rect)
|
||||
void UIDocumentSettingsImpl::setGridBounds(const Rect& rect)
|
||||
{
|
||||
m_gridBounds = rect;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setGridColor(const Color& color)
|
||||
void UIDocumentSettingsImpl::setGridColor(const Color& color)
|
||||
{
|
||||
m_gridColor = color;
|
||||
}
|
||||
|
||||
void UISettingsImpl::snapToGrid(gfx::Point& point, SnapBehavior snapBehavior) const
|
||||
void UIDocumentSettingsImpl::snapToGrid(gfx::Point& point, SnapBehavior snapBehavior) const
|
||||
{
|
||||
register int w = m_gridBounds.w;
|
||||
register int h = m_gridBounds.h;
|
||||
@ -191,78 +266,72 @@ void UISettingsImpl::snapToGrid(gfx::Point& point, SnapBehavior snapBehavior) co
|
||||
point.y = dy.rem + d.quot*h + ((d.rem > h/2)? h-adjust: 0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Pixel grid
|
||||
|
||||
bool UISettingsImpl::getPixelGridVisible()
|
||||
bool UIDocumentSettingsImpl::getPixelGridVisible()
|
||||
{
|
||||
return m_pixelGridVisible;
|
||||
}
|
||||
|
||||
Color UISettingsImpl::getPixelGridColor()
|
||||
Color UIDocumentSettingsImpl::getPixelGridColor()
|
||||
{
|
||||
return m_pixelGridColor;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setPixelGridVisible(bool state)
|
||||
void UIDocumentSettingsImpl::setPixelGridVisible(bool state)
|
||||
{
|
||||
m_pixelGridVisible = state;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setPixelGridColor(const Color& color)
|
||||
void UIDocumentSettingsImpl::setPixelGridColor(const Color& color)
|
||||
{
|
||||
m_pixelGridColor = color;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Onionskin settings
|
||||
|
||||
bool UISettingsImpl::getUseOnionskin()
|
||||
bool UIDocumentSettingsImpl::getUseOnionskin()
|
||||
{
|
||||
return m_use_onionskin;
|
||||
}
|
||||
|
||||
int UISettingsImpl::getOnionskinPrevFrames()
|
||||
int UIDocumentSettingsImpl::getOnionskinPrevFrames()
|
||||
{
|
||||
return m_prev_frames_onionskin;
|
||||
}
|
||||
|
||||
int UISettingsImpl::getOnionskinNextFrames()
|
||||
int UIDocumentSettingsImpl::getOnionskinNextFrames()
|
||||
{
|
||||
return m_next_frames_onionskin;
|
||||
}
|
||||
|
||||
int UISettingsImpl::getOnionskinOpacityBase()
|
||||
int UIDocumentSettingsImpl::getOnionskinOpacityBase()
|
||||
{
|
||||
return m_onionskin_opacity_base;
|
||||
}
|
||||
|
||||
int UISettingsImpl::getOnionskinOpacityStep()
|
||||
int UIDocumentSettingsImpl::getOnionskinOpacityStep()
|
||||
{
|
||||
return m_onionskin_opacity_step;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setUseOnionskin(bool state)
|
||||
void UIDocumentSettingsImpl::setUseOnionskin(bool state)
|
||||
{
|
||||
m_use_onionskin = state;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setOnionskinPrevFrames(int frames)
|
||||
void UIDocumentSettingsImpl::setOnionskinPrevFrames(int frames)
|
||||
{
|
||||
m_prev_frames_onionskin = frames;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setOnionskinNextFrames(int frames)
|
||||
void UIDocumentSettingsImpl::setOnionskinNextFrames(int frames)
|
||||
{
|
||||
m_next_frames_onionskin = frames;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setOnionskinOpacityBase(int base)
|
||||
void UIDocumentSettingsImpl::setOnionskinOpacityBase(int base)
|
||||
{
|
||||
m_onionskin_opacity_base = base;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setOnionskinOpacityStep(int step)
|
||||
void UIDocumentSettingsImpl::setOnionskinOpacityStep(int step)
|
||||
{
|
||||
m_onionskin_opacity_step = step;
|
||||
}
|
||||
|
@ -32,70 +32,25 @@ public:
|
||||
|
||||
// General settings
|
||||
|
||||
Color getFgColor();
|
||||
Color getBgColor();
|
||||
tools::Tool* getCurrentTool();
|
||||
TiledMode getTiledMode();
|
||||
Color getFgColor() OVERRIDE;
|
||||
Color getBgColor() OVERRIDE;
|
||||
tools::Tool* getCurrentTool() OVERRIDE;
|
||||
|
||||
void setFgColor(const Color& color);
|
||||
void setBgColor(const Color& color);
|
||||
void setCurrentTool(tools::Tool* tool);
|
||||
void setTiledMode(TiledMode mode);
|
||||
void setFgColor(const Color& color) OVERRIDE;
|
||||
void setBgColor(const Color& color) OVERRIDE;
|
||||
void setCurrentTool(tools::Tool* tool) OVERRIDE;
|
||||
|
||||
// Grid settings
|
||||
// Document settings
|
||||
|
||||
bool getSnapToGrid();
|
||||
bool getGridVisible();
|
||||
gfx::Rect getGridBounds();
|
||||
Color getGridColor();
|
||||
|
||||
void setSnapToGrid(bool state);
|
||||
void setGridVisible(bool state);
|
||||
void setGridBounds(const gfx::Rect& rect);
|
||||
void setGridColor(const Color& color);
|
||||
|
||||
void snapToGrid(gfx::Point& point, SnapBehavior snapBehavior) const OVERRIDE;
|
||||
|
||||
// Pixel grid
|
||||
|
||||
bool getPixelGridVisible();
|
||||
Color getPixelGridColor();
|
||||
|
||||
void setPixelGridVisible(bool state);
|
||||
void setPixelGridColor(const Color& color);
|
||||
|
||||
// Onionskin settings
|
||||
|
||||
bool getUseOnionskin();
|
||||
int getOnionskinPrevFrames();
|
||||
int getOnionskinNextFrames();
|
||||
int getOnionskinOpacityBase();
|
||||
int getOnionskinOpacityStep();
|
||||
|
||||
void setUseOnionskin(bool state);
|
||||
void setOnionskinPrevFrames(int frames);
|
||||
void setOnionskinNextFrames(int frames);
|
||||
void setOnionskinOpacityBase(int base);
|
||||
void setOnionskinOpacityStep(int step);
|
||||
IDocumentSettings* getDocumentSettings(const Document* document) OVERRIDE;
|
||||
|
||||
// Tools settings
|
||||
|
||||
IToolSettings* getToolSettings(tools::Tool* tool);
|
||||
IToolSettings* getToolSettings(tools::Tool* tool) OVERRIDE;
|
||||
|
||||
private:
|
||||
tools::Tool* m_currentTool;
|
||||
TiledMode m_tiledMode;
|
||||
bool m_use_onionskin;
|
||||
int m_prev_frames_onionskin;
|
||||
int m_next_frames_onionskin;
|
||||
int m_onionskin_opacity_base;
|
||||
int m_onionskin_opacity_step;
|
||||
bool m_snapToGrid;
|
||||
bool m_gridVisible;
|
||||
gfx::Rect m_gridBounds;
|
||||
Color m_gridColor;
|
||||
bool m_pixelGridVisible;
|
||||
Color m_pixelGridColor;
|
||||
IDocumentSettings* m_globalDocumentSettings;
|
||||
std::map<std::string, IToolSettings*> m_toolSettings;
|
||||
};
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "raster/palette.h"
|
||||
#include "raster/rgbmap.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "settings/document_settings.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Ink Processing
|
||||
@ -219,7 +220,7 @@ namespace {
|
||||
static void ink_hline32_blur(int x1, int y, int x2, ToolLoop* loop)
|
||||
{
|
||||
int opacity = loop->getOpacity();
|
||||
TiledMode tiledMode = loop->getTiledMode();
|
||||
TiledMode tiledMode = loop->getDocumentSettings()->getTiledMode();
|
||||
const Image* src = loop->getSrcImage();
|
||||
BlurGetPixelsDelegateRgba delegate;
|
||||
|
||||
@ -252,7 +253,7 @@ static void ink_hline32_blur(int x1, int y, int x2, ToolLoop* loop)
|
||||
static void ink_hline16_blur(int x1, int y, int x2, ToolLoop* loop)
|
||||
{
|
||||
int opacity = loop->getOpacity();
|
||||
TiledMode tiledMode = loop->getTiledMode();
|
||||
TiledMode tiledMode = loop->getDocumentSettings()->getTiledMode();
|
||||
const Image* src = loop->getSrcImage();
|
||||
BlurGetPixelsDelegateGrayscale delegate;
|
||||
|
||||
@ -283,7 +284,7 @@ static void ink_hline8_blur(int x1, int y, int x2, ToolLoop* loop)
|
||||
const Palette *pal = get_current_palette();
|
||||
RgbMap* rgbmap = loop->getSprite()->getRgbMap();
|
||||
int opacity = loop->getOpacity();
|
||||
TiledMode tiledMode = loop->getTiledMode();
|
||||
TiledMode tiledMode = loop->getDocumentSettings()->getTiledMode();
|
||||
const Image* src = loop->getSrcImage();
|
||||
BlurGetPixelsDelegateIndexed delegate(pal);
|
||||
|
||||
@ -393,7 +394,7 @@ static void ink_hline32_jumble(int x1, int y, int x2, ToolLoop* loop)
|
||||
{
|
||||
int opacity = loop->getOpacity();
|
||||
Point speed(loop->getSpeed() / 4);
|
||||
TiledMode tiled = loop->getTiledMode();
|
||||
TiledMode tiled = loop->getDocumentSettings()->getTiledMode();
|
||||
int u, v, color;
|
||||
|
||||
DEFINE_INK_PROCESSING_SRCDST
|
||||
@ -409,7 +410,7 @@ static void ink_hline16_jumble(int x1, int y, int x2, ToolLoop* loop)
|
||||
{
|
||||
int opacity = loop->getOpacity();
|
||||
Point speed(loop->getSpeed() / 4);
|
||||
TiledMode tiled = loop->getTiledMode();
|
||||
TiledMode tiled = loop->getDocumentSettings()->getTiledMode();
|
||||
int u, v, color;
|
||||
|
||||
DEFINE_INK_PROCESSING_SRCDST
|
||||
@ -428,7 +429,7 @@ static void ink_hline8_jumble(int x1, int y, int x2, ToolLoop* loop)
|
||||
uint32_t c, tc;
|
||||
int opacity = loop->getOpacity();
|
||||
Point speed(loop->getSpeed() / 4);
|
||||
TiledMode tiled = loop->getTiledMode();
|
||||
TiledMode tiled = loop->getDocumentSettings()->getTiledMode();
|
||||
int u, v, color;
|
||||
|
||||
DEFINE_INK_PROCESSING_SRCDST
|
||||
|
@ -55,8 +55,8 @@ public:
|
||||
case WithBg:
|
||||
{
|
||||
int color = color_utils::color_for_layer(m_type == WithFg ?
|
||||
loop->getContext()->getSettings()->getFgColor():
|
||||
loop->getContext()->getSettings()->getBgColor(),
|
||||
loop->getSettings()->getFgColor():
|
||||
loop->getSettings()->getBgColor(),
|
||||
loop->getLayer());
|
||||
loop->setPrimaryColor(color);
|
||||
loop->setSecondaryColor(color);
|
||||
@ -168,18 +168,18 @@ public:
|
||||
case ReplaceFgWithBg:
|
||||
m_proc = ink_processing[INK_REPLACE][MID(0, loop->getSprite()->getPixelFormat(), 2)];
|
||||
|
||||
loop->setPrimaryColor(color_utils::color_for_layer(loop->getContext()->getSettings()->getFgColor(),
|
||||
loop->setPrimaryColor(color_utils::color_for_layer(loop->getSettings()->getFgColor(),
|
||||
loop->getLayer()));
|
||||
loop->setSecondaryColor(color_utils::color_for_layer(loop->getContext()->getSettings()->getBgColor(),
|
||||
loop->setSecondaryColor(color_utils::color_for_layer(loop->getSettings()->getBgColor(),
|
||||
loop->getLayer()));
|
||||
break;
|
||||
|
||||
case ReplaceBgWithFg:
|
||||
m_proc = ink_processing[INK_REPLACE][MID(0, loop->getSprite()->getPixelFormat(), 2)];
|
||||
|
||||
loop->setPrimaryColor(color_utils::color_for_layer(loop->getContext()->getSettings()->getBgColor(),
|
||||
loop->setPrimaryColor(color_utils::color_for_layer(loop->getSettings()->getBgColor(),
|
||||
loop->getLayer()));
|
||||
loop->setSecondaryColor(color_utils::color_for_layer(loop->getContext()->getSettings()->getFgColor(),
|
||||
loop->setSecondaryColor(color_utils::color_for_layer(loop->getSettings()->getFgColor(),
|
||||
loop->getLayer()));
|
||||
break;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "tools/point_shape.h"
|
||||
|
||||
#include "raster/image.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "tools/ink.h"
|
||||
#include "tools/tool_loop.h"
|
||||
|
||||
@ -28,11 +29,12 @@ using namespace tools;
|
||||
|
||||
void PointShape::doInkHline(int x1, int y, int x2, ToolLoop* loop)
|
||||
{
|
||||
register TiledMode tiledMode = loop->getDocumentSettings()->getTiledMode();
|
||||
register int w, size; // width or height
|
||||
register int x;
|
||||
|
||||
// Tiled in Y axis
|
||||
if (loop->getTiledMode() & TILED_Y_AXIS) {
|
||||
if (tiledMode & TILED_Y_AXIS) {
|
||||
size = loop->getDstImage()->h; // size = image height
|
||||
if (y < 0)
|
||||
y = size - (-(y+1) % size) - 1;
|
||||
@ -43,7 +45,7 @@ void PointShape::doInkHline(int x1, int y, int x2, ToolLoop* loop)
|
||||
return;
|
||||
|
||||
// Tiled in X axis
|
||||
if (loop->getTiledMode() & TILED_X_AXIS) {
|
||||
if (tiledMode & TILED_X_AXIS) {
|
||||
if (x1 > x2)
|
||||
return;
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
class Context;
|
||||
class Document;
|
||||
class ISettings;
|
||||
class IDocumentSettings;
|
||||
class Image;
|
||||
class Layer;
|
||||
class Mask;
|
||||
@ -45,6 +47,8 @@ class Tool;
|
||||
//
|
||||
// All this information should be provided by the editor and consumed
|
||||
// by the tool (+controller+intertwiner+pointshape+ink).
|
||||
//
|
||||
// TODO This interface is huge, it should be refactored.
|
||||
class ToolLoop
|
||||
{
|
||||
public:
|
||||
@ -52,9 +56,6 @@ public:
|
||||
|
||||
virtual ~ToolLoop() { }
|
||||
|
||||
// Returns the context where we want to draw on (generally UIContext::instance() singleton)
|
||||
virtual Context* getContext() = 0;
|
||||
|
||||
// Returns the tool to use to draw or use
|
||||
virtual Tool* getTool() = 0;
|
||||
|
||||
@ -109,13 +110,21 @@ public:
|
||||
// Returns the tolerance to be used by the ink (Ink).
|
||||
virtual int getTolerance() = 0;
|
||||
|
||||
// Returns true if each scanline generated by a PointShape must
|
||||
// be "tiled". See the method PointShape::doInkHline to check
|
||||
// how this member is used. When tiled mode is activated, each
|
||||
// scanline can be divided in various sub-lines if they pass the
|
||||
// image bounds. For each of these scanlines a Ink::inkHline
|
||||
// is called
|
||||
virtual TiledMode getTiledMode() = 0;
|
||||
// Returns the current settings. Used to know current
|
||||
// foreground/background color (certain tools needs to know the
|
||||
// exact foreground/background color, they cannot used the
|
||||
// primary/secondary).
|
||||
virtual ISettings* getSettings() = 0;
|
||||
|
||||
// Returns the document settings (tiled mode, grid bounds, etc.).
|
||||
// It's used to know the preferred "tiled" mode of the document.
|
||||
// See the method PointShape::doInkHline to check how this member is
|
||||
// used. When tiled mode is activated, each scanline can be divided
|
||||
// in various sub-lines if they pass the image bounds. For each of
|
||||
// these scanlines a Ink::inkHline is called
|
||||
// Also it's used to know the grid/snap-to-grid settings/behavior
|
||||
// (see ToolLoopManager::snapToGrid).
|
||||
virtual IDocumentSettings* getDocumentSettings() = 0;
|
||||
|
||||
// Returns true if the figure must be filled when we release the
|
||||
// mouse (e.g. a filled rectangle, etc.)
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "context.h"
|
||||
#include "raster/image.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "tools/controller.h"
|
||||
#include "tools/ink.h"
|
||||
#include "tools/intertwine.h"
|
||||
@ -203,10 +204,10 @@ void ToolLoopManager::doLoopStep(bool last_step)
|
||||
void ToolLoopManager::snapToGrid(bool flexible, Point& point)
|
||||
{
|
||||
if (!m_toolLoop->getController()->canSnapToGrid() ||
|
||||
!m_toolLoop->getContext()->getSettings()->getSnapToGrid())
|
||||
!m_toolLoop->getDocumentSettings()->getSnapToGrid())
|
||||
return;
|
||||
|
||||
m_toolLoop->getContext()->getSettings()
|
||||
m_toolLoop->getDocumentSettings()
|
||||
->snapToGrid(point, (flexible ? SnapInRightBottom: NormalSnap));
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "document.h"
|
||||
#include "ini_file.h"
|
||||
#include "raster/raster.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "settings/settings.h"
|
||||
#include "ui_context.h"
|
||||
|
||||
@ -410,8 +411,8 @@ Image* RenderEngine::renderSprite(const Document* document,
|
||||
image_clear(image, bg_color);
|
||||
|
||||
// Onion-skin feature: draw the previous frame
|
||||
ISettings* settings = UIContext::instance()->getSettings();
|
||||
if (settings->getUseOnionskin()) {
|
||||
IDocumentSettings* docSettings = UIContext::instance()->getSettings()->getDocumentSettings(document);
|
||||
if (docSettings->getUseOnionskin()) {
|
||||
// Draw background layer of the current frame with opacity=255
|
||||
global_opacity = 255;
|
||||
renderLayer(document, sprite, sprite->getFolder(), image,
|
||||
@ -419,10 +420,10 @@ Image* RenderEngine::renderSprite(const Document* document,
|
||||
|
||||
// Draw transparent layers of the previous/next frames with different opacity (<255) (it is the onion-skinning)
|
||||
{
|
||||
int prevs = settings->getOnionskinPrevFrames();
|
||||
int nexts = settings->getOnionskinNextFrames();
|
||||
int opacity_base = settings->getOnionskinOpacityBase();
|
||||
int opacity_step = settings->getOnionskinOpacityStep();
|
||||
int prevs = docSettings->getOnionskinPrevFrames();
|
||||
int nexts = docSettings->getOnionskinNextFrames();
|
||||
int opacity_base = docSettings->getOnionskinOpacityBase();
|
||||
int opacity_step = docSettings->getOnionskinOpacityStep();
|
||||
|
||||
for (FrameNumber f=frame.previous(prevs); f <= frame.next(nexts); ++f) {
|
||||
if (f == frame || f < 0 || f > sprite->getLastFrame())
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "modules/gui.h"
|
||||
#include "modules/palettes.h"
|
||||
#include "raster/raster.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "settings/settings.h"
|
||||
#include "skin/skin_theme.h"
|
||||
#include "tools/ink.h"
|
||||
@ -466,19 +467,20 @@ void Editor::drawSprite(int x1, int y1, int x2, int y2)
|
||||
}
|
||||
|
||||
// Draw grids
|
||||
ISettings* settings = UIContext::instance()->getSettings();
|
||||
IDocumentSettings* docSettings =
|
||||
UIContext::instance()->getSettings()->getDocumentSettings(m_document);
|
||||
|
||||
// Draw the pixel grid
|
||||
if (settings->getPixelGridVisible()) {
|
||||
if (docSettings->getPixelGridVisible()) {
|
||||
if (m_zoom > 1)
|
||||
this->drawGrid(Rect(0, 0, 1, 1),
|
||||
settings->getPixelGridColor());
|
||||
docSettings->getPixelGridColor());
|
||||
}
|
||||
|
||||
// Draw the grid
|
||||
if (settings->getGridVisible())
|
||||
this->drawGrid(settings->getGridBounds(),
|
||||
settings->getGridColor());
|
||||
if (docSettings->getGridVisible())
|
||||
this->drawGrid(docSettings->getGridBounds(),
|
||||
docSettings->getGridColor());
|
||||
|
||||
// Draw the mask
|
||||
if (m_document->getBoundariesSegments())
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "raster/mask.h"
|
||||
#include "raster/rotate.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "ui_context.h"
|
||||
#include "util/expand_cel_canvas.h"
|
||||
|
||||
@ -205,7 +206,7 @@ gfx::Rect PixelsMovement::moveImage(int x, int y, MoveModifier moveModifier)
|
||||
if ((moveModifier & SnapToGridMovement) == SnapToGridMovement) {
|
||||
// Snap the x1,y1 point to the grid.
|
||||
gfx::Point gridOffset(x1, y1);
|
||||
UIContext::instance()->getSettings()->snapToGrid(gridOffset, NormalSnap);
|
||||
UIContext::instance()->getSettings()->getDocumentSettings(documentWriter)->snapToGrid(gridOffset, NormalSnap);
|
||||
|
||||
// Now we calculate the difference from x1,y1 point and we can
|
||||
// use it to adjust all coordinates (x1, y1, x2, y2).
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "raster/mask.h"
|
||||
#include "raster/pen.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "settings/document_settings.h"
|
||||
#include "settings/settings.h"
|
||||
#include "tools/ink.h"
|
||||
#include "tools/tool.h"
|
||||
@ -59,7 +60,8 @@ class ToolLoopImpl : public tools::ToolLoop
|
||||
bool m_previewFilled;
|
||||
int m_sprayWidth;
|
||||
int m_spraySpeed;
|
||||
TiledMode m_tiled_mode;
|
||||
ISettings* m_settings;
|
||||
IDocumentSettings* m_docSettings;
|
||||
bool m_useMask;
|
||||
Mask* m_mask;
|
||||
gfx::Point m_maskOrigin;
|
||||
@ -91,7 +93,8 @@ public:
|
||||
, m_sprite(sprite)
|
||||
, m_layer(layer)
|
||||
, m_canceled(false)
|
||||
, m_tiled_mode(m_context->getSettings()->getTiledMode())
|
||||
, m_settings(m_context->getSettings())
|
||||
, m_docSettings(m_settings->getDocumentSettings(m_document))
|
||||
, m_button(button)
|
||||
, m_primary_color(color_utils::color_for_layer(primary_color, layer))
|
||||
, m_secondary_color(color_utils::color_for_layer(secondary_color, layer))
|
||||
@ -101,11 +104,11 @@ public:
|
||||
getInk()->isEyedropper() ||
|
||||
getInk()->isScrollMovement()) ? undo::DoesntModifyDocument:
|
||||
undo::ModifyDocument))
|
||||
, m_expandCelCanvas(document, sprite, layer, m_tiled_mode, m_undoTransaction)
|
||||
, m_expandCelCanvas(document, sprite, layer, m_docSettings->getTiledMode(), m_undoTransaction)
|
||||
{
|
||||
// Settings
|
||||
ISettings* settings = m_context->getSettings();
|
||||
IToolSettings* toolSettings = m_settings->getToolSettings(m_tool);
|
||||
|
||||
// Settings
|
||||
switch (tool->getFill(m_button)) {
|
||||
case tools::FillNone:
|
||||
m_filled = false;
|
||||
@ -114,16 +117,16 @@ public:
|
||||
m_filled = true;
|
||||
break;
|
||||
case tools::FillOptional:
|
||||
m_filled = settings->getToolSettings(m_tool)->getFilled();
|
||||
m_filled = toolSettings->getFilled();
|
||||
break;
|
||||
}
|
||||
m_previewFilled = settings->getToolSettings(m_tool)->getPreviewFilled();
|
||||
m_previewFilled = toolSettings->getPreviewFilled();
|
||||
|
||||
m_sprayWidth = settings->getToolSettings(m_tool)->getSprayWidth();
|
||||
m_spraySpeed = settings->getToolSettings(m_tool)->getSpraySpeed();
|
||||
m_sprayWidth = toolSettings->getSprayWidth();
|
||||
m_spraySpeed = toolSettings->getSpraySpeed();
|
||||
|
||||
// Create the pen
|
||||
IPenSettings* pen_settings = settings->getToolSettings(m_tool)->getPen();
|
||||
IPenSettings* pen_settings = toolSettings->getPen();
|
||||
ASSERT(pen_settings != NULL);
|
||||
|
||||
m_pen = new Pen(pen_settings->getType(),
|
||||
@ -146,8 +149,8 @@ public:
|
||||
m_mask->getBounds().y-y1):
|
||||
gfx::Point(0, 0));
|
||||
|
||||
m_opacity = settings->getToolSettings(m_tool)->getOpacity();
|
||||
m_tolerance = settings->getToolSettings(m_tool)->getTolerance();
|
||||
m_opacity = toolSettings->getOpacity();
|
||||
m_tolerance = toolSettings->getTolerance();
|
||||
m_speed.x = 0;
|
||||
m_speed.y = 0;
|
||||
|
||||
@ -179,42 +182,42 @@ public:
|
||||
}
|
||||
|
||||
// IToolLoop interface
|
||||
Context* getContext() { return m_context; }
|
||||
tools::Tool* getTool() { return m_tool; }
|
||||
Pen* getPen() { return m_pen; }
|
||||
Document* getDocument() { return m_document; }
|
||||
Sprite* getSprite() { return m_sprite; }
|
||||
Layer* getLayer() { return m_layer; }
|
||||
Image* getSrcImage() { return m_expandCelCanvas.getSourceCanvas(); }
|
||||
Image* getDstImage() { return m_expandCelCanvas.getDestCanvas(); }
|
||||
bool useMask() { return m_useMask; }
|
||||
Mask* getMask() { return m_mask; }
|
||||
gfx::Point getMaskOrigin() { return m_maskOrigin; }
|
||||
ToolLoop::Button getMouseButton() { return m_button; }
|
||||
int getPrimaryColor() { return m_primary_color; }
|
||||
void setPrimaryColor(int color) { m_primary_color = color; }
|
||||
int getSecondaryColor() { return m_secondary_color; }
|
||||
void setSecondaryColor(int color) { m_secondary_color = color; }
|
||||
int getOpacity() { return m_opacity; }
|
||||
int getTolerance() { return m_tolerance; }
|
||||
TiledMode getTiledMode() { return m_tiled_mode; }
|
||||
bool getFilled() { return m_filled; }
|
||||
bool getPreviewFilled() { return m_previewFilled; }
|
||||
int getSprayWidth() { return m_sprayWidth; }
|
||||
int getSpraySpeed() { return m_spraySpeed; }
|
||||
gfx::Point getOffset() { return m_offset; }
|
||||
void setSpeed(const gfx::Point& speed) { m_speed = speed; }
|
||||
gfx::Point getSpeed() { return m_speed; }
|
||||
tools::Ink* getInk() { return m_tool->getInk(m_button); }
|
||||
tools::Controller* getController() { return m_tool->getController(m_button); }
|
||||
tools::PointShape* getPointShape() { return m_tool->getPointShape(m_button); }
|
||||
tools::Intertwine* getIntertwine() { return m_tool->getIntertwine(m_button); }
|
||||
tools::TracePolicy getTracePolicy() { return m_tool->getTracePolicy(m_button); }
|
||||
tools::Tool* getTool() OVERRIDE { return m_tool; }
|
||||
Pen* getPen() OVERRIDE { return m_pen; }
|
||||
Document* getDocument() OVERRIDE { return m_document; }
|
||||
Sprite* getSprite() OVERRIDE { return m_sprite; }
|
||||
Layer* getLayer() OVERRIDE { return m_layer; }
|
||||
Image* getSrcImage() OVERRIDE { return m_expandCelCanvas.getSourceCanvas(); }
|
||||
Image* getDstImage() OVERRIDE { return m_expandCelCanvas.getDestCanvas(); }
|
||||
bool useMask() OVERRIDE { return m_useMask; }
|
||||
Mask* getMask() OVERRIDE { return m_mask; }
|
||||
gfx::Point getMaskOrigin() OVERRIDE { return m_maskOrigin; }
|
||||
ToolLoop::Button getMouseButton() OVERRIDE { return m_button; }
|
||||
int getPrimaryColor() OVERRIDE { return m_primary_color; }
|
||||
void setPrimaryColor(int color) OVERRIDE { m_primary_color = color; }
|
||||
int getSecondaryColor() OVERRIDE { return m_secondary_color; }
|
||||
void setSecondaryColor(int color) OVERRIDE { m_secondary_color = color; }
|
||||
int getOpacity() OVERRIDE { return m_opacity; }
|
||||
int getTolerance() OVERRIDE { return m_tolerance; }
|
||||
ISettings* getSettings() OVERRIDE { return m_settings; }
|
||||
IDocumentSettings* getDocumentSettings() OVERRIDE { return m_docSettings; }
|
||||
bool getFilled() OVERRIDE { return m_filled; }
|
||||
bool getPreviewFilled() OVERRIDE { return m_previewFilled; }
|
||||
int getSprayWidth() OVERRIDE { return m_sprayWidth; }
|
||||
int getSpraySpeed() OVERRIDE { return m_spraySpeed; }
|
||||
gfx::Point getOffset() OVERRIDE { return m_offset; }
|
||||
void setSpeed(const gfx::Point& speed) OVERRIDE { m_speed = speed; }
|
||||
gfx::Point getSpeed() OVERRIDE { return m_speed; }
|
||||
tools::Ink* getInk() OVERRIDE { return m_tool->getInk(m_button); }
|
||||
tools::Controller* getController() OVERRIDE { return m_tool->getController(m_button); }
|
||||
tools::PointShape* getPointShape() OVERRIDE { return m_tool->getPointShape(m_button); }
|
||||
tools::Intertwine* getIntertwine() OVERRIDE { return m_tool->getIntertwine(m_button); }
|
||||
tools::TracePolicy getTracePolicy() OVERRIDE { return m_tool->getTracePolicy(m_button); }
|
||||
|
||||
void cancel() { m_canceled = true; }
|
||||
bool isCanceled() { return m_canceled; }
|
||||
void cancel() OVERRIDE { m_canceled = true; }
|
||||
bool isCanceled() OVERRIDE { return m_canceled; }
|
||||
|
||||
gfx::Point screenToSprite(const gfx::Point& screenPoint)
|
||||
gfx::Point screenToSprite(const gfx::Point& screenPoint) OVERRIDE
|
||||
{
|
||||
gfx::Point spritePoint;
|
||||
m_editor->screenToEditor(screenPoint.x, screenPoint.y,
|
||||
@ -222,7 +225,7 @@ public:
|
||||
return spritePoint;
|
||||
}
|
||||
|
||||
void updateArea(const gfx::Rect& dirty_area)
|
||||
void updateArea(const gfx::Rect& dirty_area) OVERRIDE
|
||||
{
|
||||
int x1 = dirty_area.x-m_offset.x;
|
||||
int y1 = dirty_area.y-m_offset.y;
|
||||
@ -234,7 +237,7 @@ public:
|
||||
release_bitmap(ji_screen);
|
||||
}
|
||||
|
||||
void updateStatusBar(const char* text)
|
||||
void updateStatusBar(const char* text) OVERRIDE
|
||||
{
|
||||
StatusBar::instance()->setStatusText(0, text);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user