Destroy ColorMap remap information when Undo/Redo is executed

This commit is contained in:
David Capello 2015-05-09 16:18:27 -03:00
parent 11d86bb7c5
commit e60236640a
2 changed files with 13 additions and 0 deletions

View File

@ -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()
{

View File

@ -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