Change current palette after undo/redo

This commit is contained in:
David Capello 2014-06-01 18:10:26 -03:00
parent c56d3d1170
commit 76afcfedac
4 changed files with 12 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include "app/ini_file.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
#include "app/ui/editor/editor.h"
#include "app/ui/status_bar.h"
#include "base/thread.h"
@ -117,6 +118,7 @@ void UndoCommand::onExecute(Context* context)
document->destroyExtraCel(); // Regenerate extras
update_screen_for_document(document);
set_current_palette(writer.palette(), false);
}
Command* CommandFactory::createUndoCommand()

View File

@ -51,6 +51,10 @@ namespace app {
return m_location.image(x, y, opacity);
}
Palette* palette() const {
return m_location.palette();
}
protected:
ContextAccess(const Context* context)
: m_context(context)

View File

@ -84,4 +84,9 @@ Image* DocumentLocation::image(int* x, int* y, int* opacity) const
return image;
}
Palette* DocumentLocation::palette() const
{
return (m_sprite ? m_sprite->getPalette(m_frame): NULL);
}
} // namespace app

View File

@ -67,6 +67,7 @@ namespace app {
void layerIndex(LayerIndex layerIndex);
Palette* palette();
Image* image(int* x = NULL, int* y = NULL, int* opacity = NULL) const;
Palette* palette() const;
private:
Document* m_document;