mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 12:44:53 +00:00
Fix issue 347: Eyedropper tool changes in gui.xml (pick_fg ink) not working
This commit is contained in:
parent
f2bdf38cc6
commit
43b2be4f0d
@ -141,6 +141,7 @@ add_library(app-library
|
|||||||
shell.cpp
|
shell.cpp
|
||||||
thumbnail_generator.cpp
|
thumbnail_generator.cpp
|
||||||
tools/intertwine.cpp
|
tools/intertwine.cpp
|
||||||
|
tools/pick_ink.cpp
|
||||||
tools/point_shape.cpp
|
tools/point_shape.cpp
|
||||||
tools/shade_table.cpp
|
tools/shade_table.cpp
|
||||||
tools/tool_box.cpp
|
tools/tool_box.cpp
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "app/document.h"
|
#include "app/document.h"
|
||||||
#include "app/document_undo.h"
|
#include "app/document_undo.h"
|
||||||
#include "app/settings/settings.h"
|
#include "app/settings/settings.h"
|
||||||
|
#include "app/tools/pick_ink.h"
|
||||||
#include "app/undoers/set_mask.h"
|
#include "app/undoers/set_mask.h"
|
||||||
#include "raster/mask.h"
|
#include "raster/mask.h"
|
||||||
|
|
||||||
@ -111,31 +112,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PickInk : public Ink {
|
|
||||||
public:
|
|
||||||
enum Target { Fg, Bg };
|
|
||||||
|
|
||||||
private:
|
|
||||||
Target m_target;
|
|
||||||
|
|
||||||
public:
|
|
||||||
PickInk(Target target) : m_target(target) { }
|
|
||||||
|
|
||||||
bool isEyedropper() const { return true; }
|
|
||||||
|
|
||||||
void prepareInk(ToolLoop* loop)
|
|
||||||
{
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
void inkHline(int x1, int y, int x2, ToolLoop* loop)
|
|
||||||
{
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ScrollInk : public Ink {
|
class ScrollInk : public Ink {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
48
src/app/tools/pick_ink.cpp
Normal file
48
src/app/tools/pick_ink.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/* Aseprite
|
||||||
|
* Copyright (C) 2001-2014 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "app/tools/pick_ink.h"
|
||||||
|
|
||||||
|
namespace app {
|
||||||
|
namespace tools {
|
||||||
|
|
||||||
|
PickInk::PickInk(Target target) : m_target(target)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PickInk::isEyedropper() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PickInk::prepareInk(ToolLoop* loop)
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
void PickInk::inkHline(int x1, int y, int x2, ToolLoop* loop)
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace tools
|
||||||
|
} // namespace app
|
48
src/app/tools/pick_ink.h
Normal file
48
src/app/tools/pick_ink.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/* Aseprite
|
||||||
|
* Copyright (C) 2001-2013 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 APP_TOOLS_PICK_INK_H_INCLUDED
|
||||||
|
#define APP_TOOLS_PICK_INK_H_INCLUDED
|
||||||
|
|
||||||
|
#include "app/tools/ink.h"
|
||||||
|
#include "base/compiler_specific.h"
|
||||||
|
|
||||||
|
namespace app {
|
||||||
|
namespace tools {
|
||||||
|
|
||||||
|
class PickInk : public Ink {
|
||||||
|
public:
|
||||||
|
enum Target { Fg, Bg };
|
||||||
|
|
||||||
|
public:
|
||||||
|
PickInk(Target target);
|
||||||
|
|
||||||
|
Target target() const { return m_target; }
|
||||||
|
|
||||||
|
bool isEyedropper() const OVERRIDE;
|
||||||
|
void prepareInk(ToolLoop* loop) OVERRIDE;
|
||||||
|
void inkHline(int x1, int y, int x2, ToolLoop* loop) OVERRIDE;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Target m_target;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace tools
|
||||||
|
} // namespace app
|
||||||
|
|
||||||
|
#endif // APP_TOOLS_PICK_INK_H_INCLUDED
|
@ -30,6 +30,7 @@
|
|||||||
#include "app/ini_file.h"
|
#include "app/ini_file.h"
|
||||||
#include "app/settings/settings.h"
|
#include "app/settings/settings.h"
|
||||||
#include "app/tools/ink.h"
|
#include "app/tools/ink.h"
|
||||||
|
#include "app/tools/pick_ink.h"
|
||||||
#include "app/tools/tool.h"
|
#include "app/tools/tool.h"
|
||||||
#include "app/ui/color_bar.h"
|
#include "app/ui/color_bar.h"
|
||||||
#include "app/ui/editor/drawing_state.h"
|
#include "app/ui/editor/drawing_state.h"
|
||||||
@ -226,9 +227,10 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
|
|||||||
if (clickedInk->isEyedropper()) {
|
if (clickedInk->isEyedropper()) {
|
||||||
Command* eyedropper_cmd =
|
Command* eyedropper_cmd =
|
||||||
CommandsModule::instance()->getCommandByName(CommandId::Eyedropper);
|
CommandsModule::instance()->getCommandByName(CommandId::Eyedropper);
|
||||||
|
bool fg = (static_cast<tools::PickInk*>(clickedInk)->target() == tools::PickInk::Target::Fg);
|
||||||
|
|
||||||
Params params;
|
Params params;
|
||||||
params.set("target", msg->right() ? "background": "foreground");
|
params.set("target", fg ? "foreground": "background");
|
||||||
|
|
||||||
UIContext::instance()->executeCommand(eyedropper_cmd, ¶ms);
|
UIContext::instance()->executeCommand(eyedropper_cmd, ¶ms);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user