mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Avoid including ColorBar in PaletteView
This commit is contained in:
parent
23a4cb3a0b
commit
ae048f5756
@ -466,6 +466,16 @@ void ColorBar::onPaletteViewPasteColors(
|
||||
setPalette(&newPalette, "Paste Colors");
|
||||
}
|
||||
|
||||
app::Color ColorBar::onPaletteViewGetForegroundIndex()
|
||||
{
|
||||
return getFgColor();
|
||||
}
|
||||
|
||||
app::Color ColorBar::onPaletteViewGetBackgroundIndex()
|
||||
{
|
||||
return getBgColor();
|
||||
}
|
||||
|
||||
void ColorBar::onFgColorChangeFromPreferences()
|
||||
{
|
||||
if (m_syncingWithPref)
|
||||
|
@ -92,6 +92,8 @@ namespace app {
|
||||
void onPaletteViewRemapColors(const doc::Remap& remap, const doc::Palette* newPalette) override;
|
||||
void onPaletteViewChangeSize(int boxsize) override;
|
||||
void onPaletteViewPasteColors(const Palette* fromPal, const doc::PalettePicks& from, const doc::PalettePicks& to) override;
|
||||
app::Color onPaletteViewGetForegroundIndex() override;
|
||||
app::Color onPaletteViewGetBackgroundIndex() override;
|
||||
|
||||
private:
|
||||
void destroyRemap();
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/modules/palettes.h"
|
||||
#include "app/ui/color_bar.h" // TODO avoid depending on ColorBar
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/palette_view.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
@ -407,9 +406,9 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
|
||||
int fgIndex = -1;
|
||||
int bgIndex = -1;
|
||||
|
||||
if (m_style == FgBgColors) {
|
||||
fgIndex = findExactIndex(ColorBar::instance()->getFgColor());
|
||||
bgIndex = findExactIndex(ColorBar::instance()->getBgColor());
|
||||
if (m_style == FgBgColors && m_delegate) {
|
||||
fgIndex = findExactIndex(m_delegate->onPaletteViewGetForegroundIndex());
|
||||
bgIndex = findExactIndex(m_delegate->onPaletteViewGetBackgroundIndex());
|
||||
}
|
||||
|
||||
g->fillRect(gfx::rgba(0, 0, 0), bounds);
|
||||
|
@ -34,6 +34,8 @@ namespace app {
|
||||
virtual void onPaletteViewChangeSize(int boxsize) { }
|
||||
virtual void onPaletteViewPasteColors(
|
||||
const doc::Palette* fromPal, const doc::PalettePicks& from, const doc::PalettePicks& to) { }
|
||||
virtual app::Color onPaletteViewGetForegroundIndex() { return app::Color::fromMask(); }
|
||||
virtual app::Color onPaletteViewGetBackgroundIndex() { return app::Color::fromMask(); }
|
||||
};
|
||||
|
||||
class PaletteView : public ui::Widget
|
||||
|
Loading…
x
Reference in New Issue
Block a user