mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Palette editor now is redrawn when the palette changes externally (e.g. by undo/redo actions).
This commit is contained in:
parent
f09cf4db4b
commit
e8f4c61fa7
@ -90,6 +90,7 @@ private:
|
|||||||
void setNewPalette(Palette* palette, const char* operationName);
|
void setNewPalette(Palette* palette, const char* operationName);
|
||||||
void updateCurrentSpritePalette(const char* operationName);
|
void updateCurrentSpritePalette(const char* operationName);
|
||||||
void updateColorBar();
|
void updateColorBar();
|
||||||
|
void onPalChange();
|
||||||
|
|
||||||
Box m_vbox;
|
Box m_vbox;
|
||||||
Box m_topBox;
|
Box m_topBox;
|
||||||
@ -114,6 +115,8 @@ private:
|
|||||||
|
|
||||||
int m_redrawTimerId;
|
int m_redrawTimerId;
|
||||||
bool m_redrawAll;
|
bool m_redrawAll;
|
||||||
|
|
||||||
|
Signal0<void>::SlotType* m_palChangeSlot;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
@ -128,8 +131,8 @@ public:
|
|||||||
Command* clone() { return new PaletteEditorCommand(*this); }
|
Command* clone() { return new PaletteEditorCommand(*this); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onLoadParams(Params* params);
|
void onLoadParams(Params* params) OVERRIDE;
|
||||||
void onExecute(Context* context);
|
void onExecute(Context* context) OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_open;
|
bool m_open;
|
||||||
@ -304,6 +307,10 @@ PaletteEntryEditor::PaletteEntryEditor()
|
|||||||
// We hook App::Exit signal to destroy the g_frame singleton at exit.
|
// We hook App::Exit signal to destroy the g_frame singleton at exit.
|
||||||
App::instance()->Exit.connect(&PaletteEntryEditor::onExit, this);
|
App::instance()->Exit.connect(&PaletteEntryEditor::onExit, this);
|
||||||
|
|
||||||
|
// Hook for palette change to redraw the palette editor frame
|
||||||
|
m_palChangeSlot =
|
||||||
|
App::instance()->PaletteChange.connect(&PaletteEntryEditor::onPalChange, this);
|
||||||
|
|
||||||
initTheme();
|
initTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,6 +318,8 @@ PaletteEntryEditor::~PaletteEntryEditor()
|
|||||||
{
|
{
|
||||||
jmanager_remove_timer(m_redrawTimerId);
|
jmanager_remove_timer(m_redrawTimerId);
|
||||||
m_redrawTimerId = -1;
|
m_redrawTimerId = -1;
|
||||||
|
|
||||||
|
App::instance()->PaletteChange.disconnect(m_palChangeSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaletteEntryEditor::setColor(const Color& color)
|
void PaletteEntryEditor::setColor(const Color& color)
|
||||||
@ -725,6 +734,15 @@ void PaletteEntryEditor::updateColorBar()
|
|||||||
app_get_colorbar()->invalidate();
|
app_get_colorbar()->invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaletteEntryEditor::onPalChange()
|
||||||
|
{
|
||||||
|
PaletteView* palette_editor = app_get_colorbar()->getPaletteView();
|
||||||
|
setColor(Color::fromIndex(palette_editor->getSelectedEntry()));
|
||||||
|
|
||||||
|
// Redraw the window
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// CommandFactory
|
// CommandFactory
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user