mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-02 21:19:10 +00:00
Move active brush information to ContextBar
This commit is contained in:
parent
303bd120dc
commit
b08b226aef
@ -16,7 +16,6 @@
|
||||
#include "app/settings/settings.h"
|
||||
#include "app/tools/tool_box.h"
|
||||
#include "app/ui/context_bar.h"
|
||||
#include "app/ui/editor/tool_loop_impl.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "app/util/new_image_from_mask.h"
|
||||
@ -42,17 +41,14 @@ DiscardBrushCommand::DiscardBrushCommand()
|
||||
|
||||
bool DiscardBrushCommand::onEnabled(Context* context)
|
||||
{
|
||||
return is_tool_loop_brush_image();
|
||||
ContextBar* ctxBar = App::instance()->getMainWindow()->getContextBar();
|
||||
return (ctxBar->activeBrush()->type() == kImageBrushType);
|
||||
}
|
||||
|
||||
void DiscardBrushCommand::onExecute(Context* context)
|
||||
{
|
||||
discard_tool_loop_brush_image();
|
||||
|
||||
// Update context bar
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
App::instance()->getMainWindow()->getContextBar()
|
||||
->updateFromTool(settings->getCurrentTool());
|
||||
ContextBar* ctxBar = App::instance()->getMainWindow()->getContextBar();
|
||||
ctxBar->discardActiveBrush();
|
||||
}
|
||||
|
||||
Command* CommandFactory::createDiscardBrushCommand()
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "app/ui/context_bar.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/editor/select_box_state.h"
|
||||
#include "app/ui/editor/tool_loop_impl.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "app/util/new_image_from_mask.h"
|
||||
@ -136,9 +135,14 @@ void NewBrushCommand::createBrush(const Mask* mask)
|
||||
if (!image)
|
||||
return;
|
||||
|
||||
// Set brush
|
||||
set_tool_loop_brush_image(
|
||||
image.get(), mask->bounds().getOrigin());
|
||||
// New brush
|
||||
doc::BrushRef brush(new doc::Brush());
|
||||
brush->setImage(image.get());
|
||||
brush->setPatternOrigin(mask->bounds().getOrigin());
|
||||
|
||||
// TODO add a active stock property in app::Context
|
||||
ContextBar* ctxBar = App::instance()->getMainWindow()->getContextBar();
|
||||
ctxBar->setActiveBrush(brush);
|
||||
}
|
||||
|
||||
Command* CommandFactory::createNewBrushCommand()
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "app/ui/brush_popup.h"
|
||||
#include "app/ui/button_set.h"
|
||||
#include "app/ui/color_button.h"
|
||||
#include "app/ui/editor/tool_loop_impl.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "base/bind.h"
|
||||
@ -62,8 +61,9 @@ static bool g_updatingFromTool = false;
|
||||
|
||||
class ContextBar::BrushTypeField : public ButtonSet {
|
||||
public:
|
||||
BrushTypeField()
|
||||
: ButtonSet(1) {
|
||||
BrushTypeField(ContextBar* owner)
|
||||
: ButtonSet(1)
|
||||
, m_owner(owner) {
|
||||
m_bitmap = she::instance()->createRgbaSurface(8, 8);
|
||||
she::ScopedSurfaceLock lock(m_bitmap);
|
||||
lock->clear();
|
||||
@ -77,15 +77,16 @@ public:
|
||||
m_bitmap->dispose();
|
||||
}
|
||||
|
||||
void setBrushSettings(IBrushSettings* brushSettings) {
|
||||
base::SharedPtr<doc::Brush> brush = get_tool_loop_brush(
|
||||
brushSettings, 10);
|
||||
void updateBrush(tools::Tool* tool = nullptr) {
|
||||
doc::BrushRef brush = m_owner->activeBrush(tool);
|
||||
if (brush->type() != kImageBrushType && brush->size() > 10) {
|
||||
brush.reset(new Brush(*brush));
|
||||
brush->setSize(10);
|
||||
}
|
||||
|
||||
Image* image = brush->image();
|
||||
|
||||
if (m_bitmap)
|
||||
m_bitmap->dispose();
|
||||
|
||||
m_bitmap = she::instance()->createRgbaSurface(
|
||||
std::min(10, image->width()),
|
||||
std::min(10, image->height()));
|
||||
@ -130,7 +131,7 @@ private:
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
Tool* currentTool = settings->getCurrentTool();
|
||||
IBrushSettings* brushSettings = settings->getToolSettings(currentTool)->getBrush();
|
||||
base::SharedPtr<doc::Brush> brush = get_tool_loop_brush(brushSettings);
|
||||
doc::BrushRef brush = m_owner->activeBrush();
|
||||
|
||||
m_popupWindow.setBounds(rc);
|
||||
m_popupWindow.setBrush(brush.get());
|
||||
@ -154,14 +155,11 @@ private:
|
||||
IBrushSettings* brushSettings = settings->getToolSettings(currentTool)->getBrush();
|
||||
brushSettings->setType(m_brushType);
|
||||
|
||||
setBrushSettings(brushSettings);
|
||||
|
||||
{
|
||||
Command* cmd = CommandsModule::instance()->getCommandByName(CommandId::DiscardBrush);
|
||||
UIContext::instance()->executeCommand(cmd);
|
||||
}
|
||||
m_owner->setActiveBrush(ContextBar::createBrushFromSettings(
|
||||
brushSettings));
|
||||
}
|
||||
|
||||
ContextBar* m_owner;
|
||||
she::Surface* m_bitmap;
|
||||
BrushType m_brushType;
|
||||
BrushPopup m_popupWindow;
|
||||
@ -209,9 +207,7 @@ protected:
|
||||
->getBrush()
|
||||
->setAngle(getValue());
|
||||
|
||||
IToolSettings* toolSettings = settings->getToolSettings(currentTool);
|
||||
IBrushSettings* brushSettings = toolSettings->getBrush();
|
||||
m_brushType->setBrushSettings(brushSettings);
|
||||
m_brushType->updateBrush();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -789,7 +785,7 @@ ContextBar::ContextBar()
|
||||
m_selectionOptionsBox->addChild(m_transparentColor = new TransparentColorField);
|
||||
m_selectionOptionsBox->addChild(m_rotAlgo = new RotAlgorithmField());
|
||||
|
||||
addChild(m_brushType = new BrushTypeField());
|
||||
addChild(m_brushType = new BrushTypeField(this));
|
||||
addChild(m_brushSize = new BrushSizeField());
|
||||
addChild(m_brushAngle = new BrushAngleField(m_brushType));
|
||||
addChild(m_brushPatternField = new BrushPatternField());
|
||||
@ -853,7 +849,7 @@ ContextBar::ContextBar()
|
||||
App::instance()->CurrentToolChange.connect(&ContextBar::onCurrentToolChange, this);
|
||||
m_dropPixels->DropPixels.connect(&ContextBar::onDropPixels, this);
|
||||
|
||||
onCurrentToolChange();
|
||||
setActiveBrush(createBrushFromSettings());
|
||||
}
|
||||
|
||||
ContextBar::~ContextBar()
|
||||
@ -879,30 +875,24 @@ void ContextBar::onSetOpacity(int newOpacity)
|
||||
|
||||
void ContextBar::onBrushSizeChange()
|
||||
{
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
Tool* currentTool = settings->getCurrentTool();
|
||||
IToolSettings* toolSettings = settings->getToolSettings(currentTool);
|
||||
IBrushSettings* brushSettings = toolSettings->getBrush();
|
||||
|
||||
m_brushType->setBrushSettings(brushSettings);
|
||||
m_brushSize->setTextf("%d", brushSettings->getSize());
|
||||
if (m_activeBrush->type() != kImageBrushType)
|
||||
discardActiveBrush();
|
||||
}
|
||||
|
||||
void ContextBar::onBrushAngleChange()
|
||||
{
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
Tool* currentTool = settings->getCurrentTool();
|
||||
IToolSettings* toolSettings = settings->getToolSettings(currentTool);
|
||||
IBrushSettings* brushSettings = toolSettings->getBrush();
|
||||
|
||||
m_brushType->setBrushSettings(brushSettings);
|
||||
m_brushAngle->setTextf("%d", brushSettings->getAngle());
|
||||
if (m_activeBrush->type() != kImageBrushType)
|
||||
discardActiveBrush();
|
||||
}
|
||||
|
||||
void ContextBar::onCurrentToolChange()
|
||||
{
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
updateFromTool(settings->getCurrentTool());
|
||||
if (m_activeBrush->type() != kImageBrushType)
|
||||
setActiveBrush(ContextBar::createBrushFromSettings());
|
||||
else {
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
updateFromTool(settings->getCurrentTool());
|
||||
}
|
||||
}
|
||||
|
||||
void ContextBar::onDropPixels(ContextBarObserver::DropAction action)
|
||||
@ -923,7 +913,7 @@ void ContextBar::updateFromTool(tools::Tool* tool)
|
||||
m_toolSettings = toolSettings;
|
||||
m_toolSettings->addObserver(this);
|
||||
|
||||
m_brushType->setBrushSettings(brushSettings);
|
||||
m_brushType->updateBrush(tool);
|
||||
m_brushSize->setTextf("%d", brushSettings->getSize());
|
||||
m_brushAngle->setTextf("%d", brushSettings->getAngle());
|
||||
m_brushPatternField->setBrushPattern(
|
||||
@ -949,7 +939,7 @@ void ContextBar::updateFromTool(tools::Tool* tool)
|
||||
tool->getInk(1)->isEffect());
|
||||
|
||||
// True if we have an image as brush
|
||||
bool hasImageBrush = (is_tool_loop_brush_image() ? true: false);
|
||||
bool hasImageBrush = (activeBrush()->type() == kImageBrushType);
|
||||
|
||||
// True if the current tool is eyedropper.
|
||||
bool isEyedropper =
|
||||
@ -1031,4 +1021,50 @@ void ContextBar::updateAutoSelectLayer(bool state)
|
||||
m_autoSelectLayer->setSelected(state);
|
||||
}
|
||||
|
||||
void ContextBar::setActiveBrush(const doc::BrushRef& brush)
|
||||
{
|
||||
m_activeBrush = brush;
|
||||
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
updateFromTool(settings->getCurrentTool());
|
||||
}
|
||||
|
||||
doc::BrushRef ContextBar::activeBrush(tools::Tool* tool) const
|
||||
{
|
||||
if (!tool ||
|
||||
(tool->getInk(0)->isPaint() &&
|
||||
m_activeBrush->type() == kImageBrushType)) {
|
||||
m_activeBrush->setPattern(App::instance()->preferences().brush.pattern());
|
||||
return m_activeBrush;
|
||||
}
|
||||
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
IToolSettings* toolSettings = settings->getToolSettings(tool);
|
||||
return ContextBar::createBrushFromSettings(toolSettings->getBrush());
|
||||
}
|
||||
|
||||
void ContextBar::discardActiveBrush()
|
||||
{
|
||||
setActiveBrush(ContextBar::createBrushFromSettings());
|
||||
}
|
||||
|
||||
// static
|
||||
doc::BrushRef ContextBar::createBrushFromSettings(IBrushSettings* brushSettings)
|
||||
{
|
||||
if (brushSettings == nullptr) {
|
||||
ISettings* settings = UIContext::instance()->settings();
|
||||
tools::Tool* tool = settings->getCurrentTool();
|
||||
IToolSettings* toolSettings = settings->getToolSettings(tool);
|
||||
brushSettings = toolSettings->getBrush();
|
||||
}
|
||||
|
||||
doc::BrushRef brush;
|
||||
brush.reset(
|
||||
new Brush(
|
||||
brushSettings->getType(),
|
||||
brushSettings->getSize(),
|
||||
brushSettings->getAngle()));
|
||||
return brush;
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "app/settings/settings_observers.h"
|
||||
#include "app/ui/context_bar_observer.h"
|
||||
#include "base/observable.h"
|
||||
#include "doc/brush.h"
|
||||
#include "ui/box.h"
|
||||
|
||||
namespace ui {
|
||||
@ -26,6 +27,7 @@ namespace tools {
|
||||
|
||||
namespace app {
|
||||
|
||||
class IBrushSettings;
|
||||
class IToolSettings;
|
||||
|
||||
class ContextBar : public ui::Box,
|
||||
@ -40,6 +42,13 @@ namespace app {
|
||||
void updateSelectionMode(SelectionMode mode);
|
||||
void updateAutoSelectLayer(bool state);
|
||||
|
||||
void setActiveBrush(const doc::BrushRef& brush);
|
||||
doc::BrushRef activeBrush(tools::Tool* tool = nullptr) const;
|
||||
void discardActiveBrush();
|
||||
|
||||
static doc::BrushRef createBrushFromSettings(
|
||||
IBrushSettings* brushSettings = nullptr);
|
||||
|
||||
protected:
|
||||
bool onProcessMessage(ui::Message* msg) override;
|
||||
void onPreferredSize(ui::PreferredSizeEvent& ev) override;
|
||||
@ -94,6 +103,7 @@ namespace app {
|
||||
TransparentColorField* m_transparentColor;
|
||||
RotAlgorithmField* m_rotAlgo;
|
||||
DropPixelsField* m_dropPixels;
|
||||
doc::BrushRef m_activeBrush;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
@ -23,7 +23,9 @@
|
||||
#include "app/tools/point_shape.h"
|
||||
#include "app/tools/tool.h"
|
||||
#include "app/tools/tool_loop.h"
|
||||
#include "app/ui/context_bar.h"
|
||||
#include "app/ui/editor/tool_loop_impl.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "app/util/boundary.h"
|
||||
#include "base/memory.h"
|
||||
@ -118,8 +120,8 @@ void Editor::set_cursor_color(const app::Color& color)
|
||||
// Slots for App signals
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
static gfx::Rect lastBrushBounds;
|
||||
static int brush_size_thick = 0;
|
||||
static base::SharedPtr<Brush> current_brush;
|
||||
|
||||
static void on_palette_change_update_cursor_color()
|
||||
{
|
||||
@ -144,26 +146,9 @@ static void on_brush_after_change()
|
||||
}
|
||||
}
|
||||
|
||||
static Brush* editor_get_current_brush(Editor* editor)
|
||||
static Brush* get_current_brush()
|
||||
{
|
||||
// Create the current brush from settings
|
||||
tools::Tool* tool = editor->getCurrentEditorTool();
|
||||
IBrushSettings* brush_settings = UIContext::instance()
|
||||
->settings()
|
||||
->getToolSettings(tool)
|
||||
->getBrush();
|
||||
|
||||
ASSERT(brush_settings != NULL);
|
||||
|
||||
if (!current_brush ||
|
||||
current_brush->type() != brush_settings->getType() ||
|
||||
current_brush->size() != brush_settings->getSize() ||
|
||||
current_brush->angle() != brush_settings->getAngle() ||
|
||||
is_tool_loop_brush_image()) {
|
||||
current_brush = get_tool_loop_brush(brush_settings);
|
||||
}
|
||||
|
||||
return current_brush.get();
|
||||
return App::instance()->getMainWindow()->getContextBar()->activeBrush().get();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -188,8 +173,6 @@ void Editor::editor_cursor_exit()
|
||||
|
||||
if (cursor_bound.seg != NULL)
|
||||
base_free(cursor_bound.seg);
|
||||
|
||||
current_brush.reset();
|
||||
}
|
||||
|
||||
// Draws the brush cursor inside the specified editor.
|
||||
@ -248,7 +231,7 @@ void Editor::drawBrushPreview(const gfx::Point& pos, bool refresh)
|
||||
->settings()
|
||||
->getToolSettings(tool);
|
||||
|
||||
Brush* brush = editor_get_current_brush(this);
|
||||
Brush* brush = get_current_brush();
|
||||
gfx::Rect brushBounds = brush->bounds();
|
||||
brushBounds.offset(spritePos);
|
||||
|
||||
@ -299,7 +282,7 @@ void Editor::drawBrushPreview(const gfx::Point& pos, bool refresh)
|
||||
|
||||
if (refresh) {
|
||||
m_document->notifySpritePixelsModified
|
||||
(m_sprite, gfx::Region(brushBounds));
|
||||
(m_sprite, gfx::Region(lastBrushBounds = brushBounds));
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,12 +327,14 @@ void Editor::moveBrushPreview(const gfx::Point& pos, bool refresh)
|
||||
}
|
||||
|
||||
if (cursor_type & CURSOR_THINCROSS && m_state->requireBrushPreview()) {
|
||||
Brush* brush = editor_get_current_brush(this);
|
||||
gfx::Rect brushBounds = brush->bounds();
|
||||
gfx::Rect rc1(oldEditorPos.x+brushBounds.x, oldEditorPos.y+brushBounds.y, brushBounds.w, brushBounds.h);
|
||||
gfx::Rect rc2(newEditorPos.x+brushBounds.x, newEditorPos.y+brushBounds.y, brushBounds.w, brushBounds.h);
|
||||
Brush* brush = get_current_brush();
|
||||
|
||||
gfx::Rect newBrushBounds = brush->bounds();
|
||||
newBrushBounds.offset(newEditorPos);
|
||||
|
||||
m_document->notifySpritePixelsModified
|
||||
(m_sprite, gfx::Region(rc1.createUnion(rc2)));
|
||||
(m_sprite, gfx::Region(lastBrushBounds.createUnion(newBrushBounds)));
|
||||
lastBrushBounds = newBrushBounds;
|
||||
}
|
||||
|
||||
// Save area and draw the cursor
|
||||
@ -391,18 +376,10 @@ void Editor::clearBrushPreview(bool refresh)
|
||||
|
||||
// Clean pixel/brush preview
|
||||
if (cursor_type & CURSOR_THINCROSS && m_state->requireBrushPreview()) {
|
||||
Brush* brush = editor_get_current_brush(this);
|
||||
gfx::Rect brushBounds = brush->bounds();
|
||||
|
||||
m_document->destroyExtraCel();
|
||||
|
||||
if (refresh) {
|
||||
m_document->notifySpritePixelsModified
|
||||
(m_sprite,
|
||||
gfx::Region(gfx::Rect(
|
||||
pos.x+brushBounds.x,
|
||||
pos.y+brushBounds.y,
|
||||
brushBounds.w, brushBounds.h)));
|
||||
(m_sprite, gfx::Region(lastBrushBounds));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,9 @@
|
||||
#include "app/tools/tool_loop.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
#include "app/ui/context_bar.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/util/expand_cel_canvas.h"
|
||||
#include "doc/brush.h"
|
||||
@ -47,57 +49,6 @@ namespace app {
|
||||
|
||||
using namespace ui;
|
||||
|
||||
// TODO improve the design of the brush image
|
||||
|
||||
static base::SharedPtr<Brush> special_brush;
|
||||
static base::SharedPtr<Brush> last_brush;
|
||||
static gfx::Point brush_origin;
|
||||
|
||||
void set_tool_loop_brush_image(const doc::Image* image,
|
||||
const gfx::Point& origin)
|
||||
{
|
||||
special_brush.reset(new Brush());
|
||||
special_brush->setImage(image);
|
||||
special_brush->setPatternOrigin(brush_origin = origin);
|
||||
}
|
||||
|
||||
bool is_tool_loop_brush_image()
|
||||
{
|
||||
return (special_brush ? true: false);
|
||||
}
|
||||
|
||||
void discard_tool_loop_brush_image()
|
||||
{
|
||||
special_brush.reset();
|
||||
}
|
||||
|
||||
Image* get_tool_loop_brush_image()
|
||||
{
|
||||
if (special_brush)
|
||||
return special_brush->image();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
base::SharedPtr<Brush> get_tool_loop_brush(IBrushSettings* brushSettings, int sizeLimit)
|
||||
{
|
||||
base::SharedPtr<Brush> brush;
|
||||
|
||||
if (special_brush) {
|
||||
brush = special_brush;
|
||||
brush->setPattern(App::instance()->preferences().brush.pattern());
|
||||
brush->setPatternOrigin(brush_origin);
|
||||
}
|
||||
else {
|
||||
brush.reset(
|
||||
new Brush(
|
||||
brushSettings->getType(),
|
||||
std::min(sizeLimit, brushSettings->getSize()),
|
||||
brushSettings->getAngle()));
|
||||
}
|
||||
return brush;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// For ToolLoopController
|
||||
|
||||
@ -106,7 +57,7 @@ class ToolLoopImpl : public tools::ToolLoop,
|
||||
Editor* m_editor;
|
||||
Context* m_context;
|
||||
tools::Tool* m_tool;
|
||||
base::SharedPtr<Brush> m_brush;
|
||||
BrushRef m_brush;
|
||||
Document* m_document;
|
||||
Sprite* m_sprite;
|
||||
Layer* m_layer;
|
||||
@ -196,15 +147,9 @@ public:
|
||||
}
|
||||
|
||||
m_previewFilled = m_toolSettings->getPreviewFilled();
|
||||
|
||||
m_sprayWidth = m_toolSettings->getSprayWidth();
|
||||
m_spraySpeed = m_toolSettings->getSpraySpeed();
|
||||
|
||||
// Create the brush
|
||||
IBrushSettings* brush_settings = m_toolSettings->getBrush();
|
||||
ASSERT(brush_settings != NULL);
|
||||
|
||||
m_brush = get_tool_loop_brush(brush_settings);
|
||||
m_brush = App::instance()->getMainWindow()->getContextBar()->activeBrush();
|
||||
|
||||
if (m_ink->isSelection())
|
||||
m_useMask = false;
|
||||
@ -451,7 +396,7 @@ class PreviewToolLoopImpl : public tools::ToolLoop,
|
||||
Editor* m_editor;
|
||||
Context* m_context;
|
||||
tools::Tool* m_tool;
|
||||
base::SharedPtr<Brush> m_brush;
|
||||
BrushRef m_brush;
|
||||
Document* m_document;
|
||||
Sprite* m_sprite;
|
||||
Layer* m_layer;
|
||||
@ -505,11 +450,7 @@ public:
|
||||
, m_shadeTable(NULL)
|
||||
, m_image(image)
|
||||
{
|
||||
// Create the brush
|
||||
IBrushSettings* brush_settings = m_toolSettings->getBrush();
|
||||
ASSERT(brush_settings != NULL);
|
||||
|
||||
m_brush = get_tool_loop_brush(brush_settings);
|
||||
m_brush = App::instance()->getMainWindow()->getContextBar()->activeBrush();
|
||||
m_opacity = m_toolSettings->getOpacity();
|
||||
m_tolerance = m_toolSettings->getTolerance();
|
||||
m_contiguous = m_toolSettings->getContiguous();
|
||||
|
@ -9,34 +9,21 @@
|
||||
#define APP_UI_EDITOR_TOOL_LOOP_IMPL_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/shared_ptr.h"
|
||||
#include "doc/image_ref.h"
|
||||
#include "gfx/fwd.h"
|
||||
|
||||
namespace doc {
|
||||
class Brush;
|
||||
class Image;
|
||||
}
|
||||
|
||||
namespace app {
|
||||
class Context;
|
||||
class Editor;
|
||||
class IBrushSettings;
|
||||
|
||||
namespace tools {
|
||||
class ToolLoop;
|
||||
}
|
||||
|
||||
void set_tool_loop_brush_image(
|
||||
const doc::Image* image,
|
||||
const gfx::Point& origin);
|
||||
bool is_tool_loop_brush_image();
|
||||
void discard_tool_loop_brush_image();
|
||||
doc::Image* get_tool_loop_brush_image();
|
||||
|
||||
base::SharedPtr<doc::Brush> get_tool_loop_brush(
|
||||
IBrushSettings* brushSettings, int sizeLimit = 0xffff);
|
||||
|
||||
tools::ToolLoop* create_tool_loop(
|
||||
Editor* editor, Context* context);
|
||||
|
||||
|
@ -44,6 +44,7 @@ Brush::Brush(const Brush& brush)
|
||||
m_type = brush.m_type;
|
||||
m_size = brush.m_size;
|
||||
m_angle = brush.m_angle;
|
||||
m_image = brush.m_image;
|
||||
m_pattern = brush.m_pattern;
|
||||
m_patternOrigin = brush.m_patternOrigin;
|
||||
|
||||
|
@ -62,6 +62,8 @@ namespace doc {
|
||||
gfx::Point m_patternOrigin; // From what position the brush was taken
|
||||
};
|
||||
|
||||
typedef base::SharedPtr<Brush> BrushRef;
|
||||
|
||||
} // namespace doc
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user