mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Destroy ColorMap remap information when Undo/Redo is executed
This commit is contained in:
parent
11d86bb7c5
commit
e60236640a
@ -16,6 +16,7 @@
|
||||
#include "app/cmd/remap_colors.h"
|
||||
#include "app/cmd/set_palette.h"
|
||||
#include "app/color.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/commands.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/console.h"
|
||||
@ -185,6 +186,7 @@ ColorBar::ColorBar(int align)
|
||||
onColorButtonChange(getFgColor());
|
||||
|
||||
UIContext::instance()->addObserver(this);
|
||||
m_conn = UIContext::instance()->BeforeCommandExecution.connect(&ColorBar::onBeforeExecuteCommand, this);
|
||||
}
|
||||
|
||||
ColorBar::~ColorBar()
|
||||
@ -241,6 +243,13 @@ void ColorBar::onActiveSiteChange(const doc::Site& site)
|
||||
}
|
||||
}
|
||||
|
||||
void ColorBar::onBeforeExecuteCommand(Command* command)
|
||||
{
|
||||
if (command->id() == CommandId::Undo ||
|
||||
command->id() == CommandId::Redo)
|
||||
destroyRemap();
|
||||
}
|
||||
|
||||
// Switches the palette-editor
|
||||
void ColorBar::onPaletteButtonClick()
|
||||
{
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "app/ui/color_button.h"
|
||||
#include "app/ui/palette_popup.h"
|
||||
#include "app/ui/palette_view.h"
|
||||
#include "base/connection.h"
|
||||
#include "base/signal.h"
|
||||
#include "base/unique_ptr.h"
|
||||
#include "doc/context_observer.h"
|
||||
@ -25,6 +26,7 @@
|
||||
|
||||
namespace app {
|
||||
class ColorButton;
|
||||
class Command;
|
||||
class PalettesLoader;
|
||||
class PaletteIndexChangeEvent;
|
||||
|
||||
@ -59,6 +61,7 @@ namespace app {
|
||||
Signal1<void, const app::Color&> BgColorChange;
|
||||
|
||||
protected:
|
||||
void onBeforeExecuteCommand(Command* command);
|
||||
void onPaletteButtonClick();
|
||||
void onRemapButtonClick();
|
||||
void onPaletteIndexChange(PaletteIndexChangeEvent& ev);
|
||||
@ -100,6 +103,7 @@ namespace app {
|
||||
doc::Remap* m_remap;
|
||||
const doc::Document* m_lastDocument;
|
||||
bool m_ascending;
|
||||
ScopedConnection m_conn;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
Loading…
x
Reference in New Issue
Block a user