mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Fix for PaletteView: redraw it when the palette is changed
This commit is contained in:
parent
cf0df20a13
commit
c56d3d1170
@ -73,6 +73,13 @@ PaletteView::PaletteView(bool editable)
|
||||
this->border_width.l = this->border_width.r = 1 * jguiscale();
|
||||
this->border_width.t = this->border_width.b = 1 * jguiscale();
|
||||
this->child_spacing = 1 * jguiscale();
|
||||
|
||||
m_slot = App::instance()->PaletteChange.connect(&PaletteView::onAppPaletteChange, this);
|
||||
}
|
||||
|
||||
PaletteView::~PaletteView()
|
||||
{
|
||||
App::instance()->PaletteChange.disconnect(m_slot);
|
||||
}
|
||||
|
||||
void PaletteView::setColumns(int columns)
|
||||
@ -391,4 +398,9 @@ void PaletteView::update_scroll(int color)
|
||||
view->setViewScroll(scroll);
|
||||
}
|
||||
|
||||
void PaletteView::onAppPaletteChange()
|
||||
{
|
||||
invalidate();
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/signal.h"
|
||||
#include "base/slot.h"
|
||||
#include "ui/widget.h"
|
||||
|
||||
#include <allegro/color.h>
|
||||
@ -34,6 +35,7 @@ namespace app {
|
||||
typedef std::vector<bool> SelectedEntries;
|
||||
|
||||
PaletteView(bool editable);
|
||||
~PaletteView();
|
||||
|
||||
int getColumns() const { return m_columns; }
|
||||
void setColumns(int columns);
|
||||
@ -61,6 +63,7 @@ namespace app {
|
||||
private:
|
||||
void request_size(int* w, int* h);
|
||||
void update_scroll(int color);
|
||||
void onAppPaletteChange();
|
||||
|
||||
bool m_editable;
|
||||
int m_columns;
|
||||
@ -69,6 +72,7 @@ namespace app {
|
||||
int m_rangeAnchor;
|
||||
SelectedEntries m_selectedEntries;
|
||||
bool m_isUpdatingColumns;
|
||||
Slot0<void>* m_slot;
|
||||
};
|
||||
|
||||
ui::WidgetType palette_view_type();
|
||||
|
Loading…
Reference in New Issue
Block a user