mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-05 18:40:37 +00:00
Fix #472 - Undo and redo change the size of spray tool
This commit is contained in:
parent
21b0f64a34
commit
0e7f424406
@ -38,6 +38,7 @@
|
|||||||
#include "app/ui/skin/skin_theme.h"
|
#include "app/ui/skin/skin_theme.h"
|
||||||
#include "app/ui_context.h"
|
#include "app/ui_context.h"
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
|
#include "base/scoped_value.h"
|
||||||
#include "base/unique_ptr.h"
|
#include "base/unique_ptr.h"
|
||||||
#include "raster/brush.h"
|
#include "raster/brush.h"
|
||||||
#include "raster/conversion_she.h"
|
#include "raster/conversion_she.h"
|
||||||
@ -63,6 +64,8 @@ using namespace gfx;
|
|||||||
using namespace ui;
|
using namespace ui;
|
||||||
using namespace tools;
|
using namespace tools;
|
||||||
|
|
||||||
|
static bool g_updatingFromTool = false;
|
||||||
|
|
||||||
class ContextBar::BrushTypeField : public ButtonSet {
|
class ContextBar::BrushTypeField : public ButtonSet {
|
||||||
public:
|
public:
|
||||||
BrushTypeField()
|
BrushTypeField()
|
||||||
@ -184,6 +187,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void onValueChange() override {
|
void onValueChange() override {
|
||||||
IntEntry::onValueChange();
|
IntEntry::onValueChange();
|
||||||
|
if (g_updatingFromTool)
|
||||||
|
return;
|
||||||
|
|
||||||
ISettings* settings = UIContext::instance()->settings();
|
ISettings* settings = UIContext::instance()->settings();
|
||||||
Tool* currentTool = settings->getCurrentTool();
|
Tool* currentTool = settings->getCurrentTool();
|
||||||
@ -205,6 +210,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void onValueChange() override {
|
void onValueChange() override {
|
||||||
IntEntry::onValueChange();
|
IntEntry::onValueChange();
|
||||||
|
if (g_updatingFromTool)
|
||||||
|
return;
|
||||||
|
|
||||||
ISettings* settings = UIContext::instance()->settings();
|
ISettings* settings = UIContext::instance()->settings();
|
||||||
Tool* currentTool = settings->getCurrentTool();
|
Tool* currentTool = settings->getCurrentTool();
|
||||||
@ -230,6 +237,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void onValueChange() override {
|
void onValueChange() override {
|
||||||
IntEntry::onValueChange();
|
IntEntry::onValueChange();
|
||||||
|
if (g_updatingFromTool)
|
||||||
|
return;
|
||||||
|
|
||||||
ISettings* settings = UIContext::instance()->settings();
|
ISettings* settings = UIContext::instance()->settings();
|
||||||
Tool* currentTool = settings->getCurrentTool();
|
Tool* currentTool = settings->getCurrentTool();
|
||||||
@ -334,6 +343,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void onValueChange() override {
|
void onValueChange() override {
|
||||||
IntEntry::onValueChange();
|
IntEntry::onValueChange();
|
||||||
|
if (g_updatingFromTool)
|
||||||
|
return;
|
||||||
|
|
||||||
ISettings* settings = UIContext::instance()->settings();
|
ISettings* settings = UIContext::instance()->settings();
|
||||||
Tool* currentTool = settings->getCurrentTool();
|
Tool* currentTool = settings->getCurrentTool();
|
||||||
@ -351,6 +362,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void onValueChange() override {
|
void onValueChange() override {
|
||||||
IntEntry::onValueChange();
|
IntEntry::onValueChange();
|
||||||
|
if (g_updatingFromTool)
|
||||||
|
return;
|
||||||
|
|
||||||
ISettings* settings = UIContext::instance()->settings();
|
ISettings* settings = UIContext::instance()->settings();
|
||||||
Tool* currentTool = settings->getCurrentTool();
|
Tool* currentTool = settings->getCurrentTool();
|
||||||
@ -368,6 +381,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void onValueChange() override {
|
void onValueChange() override {
|
||||||
IntEntry::onValueChange();
|
IntEntry::onValueChange();
|
||||||
|
if (g_updatingFromTool)
|
||||||
|
return;
|
||||||
|
|
||||||
ISettings* settings = UIContext::instance()->settings();
|
ISettings* settings = UIContext::instance()->settings();
|
||||||
Tool* currentTool = settings->getCurrentTool();
|
Tool* currentTool = settings->getCurrentTool();
|
||||||
@ -841,6 +856,8 @@ void ContextBar::onDropPixels(ContextBarObserver::DropAction action)
|
|||||||
|
|
||||||
void ContextBar::updateFromTool(tools::Tool* tool)
|
void ContextBar::updateFromTool(tools::Tool* tool)
|
||||||
{
|
{
|
||||||
|
base::ScopedValue<bool> lockFlag(g_updatingFromTool, true, false);
|
||||||
|
|
||||||
ISettings* settings = UIContext::instance()->settings();
|
ISettings* settings = UIContext::instance()->settings();
|
||||||
IToolSettings* toolSettings = settings->getToolSettings(tool);
|
IToolSettings* toolSettings = settings->getToolSettings(tool);
|
||||||
IBrushSettings* brushSettings = toolSettings->getBrush();
|
IBrushSettings* brushSettings = toolSettings->getBrush();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user