From 19d75662491c2d7ef29d7aee0b982d52232f6595 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 30 Apr 2021 11:31:02 -0300 Subject: [PATCH] Fix bug where F5 was resetting the color bar box size/zoom --- src/app/ui/color_bar.cpp | 4 ++-- src/app/ui/color_bar.h | 4 ++-- src/app/ui/palette_view.cpp | 4 ++-- src/app/ui/palette_view.h | 6 ++++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/app/ui/color_bar.cpp b/src/app/ui/color_bar.cpp index 2618b780c..e12d4f5f0 100644 --- a/src/app/ui/color_bar.cpp +++ b/src/app/ui/color_bar.cpp @@ -1016,9 +1016,9 @@ void ColorBar::setTransparentIndex(int index) } } -void ColorBar::onPaletteViewChangeSize(int boxsize) +void ColorBar::onPaletteViewChangeSize(PaletteView* paletteView, int boxsize) { - if (tilemapMode() == TilemapMode::Tiles) + if (paletteView == &m_tilesView) Preferences::instance().colorBar.tilesBoxSize(boxsize); else Preferences::instance().colorBar.boxSize(boxsize); diff --git a/src/app/ui/color_bar.h b/src/app/ui/color_bar.h index 50471fc90..bf45858c7 100644 --- a/src/app/ui/color_bar.h +++ b/src/app/ui/color_bar.h @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2020 Igara Studio S.A. +// Copyright (C) 2018-2021 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -154,7 +154,7 @@ namespace app { // PaletteViewDelegate impl void onPaletteViewIndexChange(int index, ui::MouseButton button) override; void onPaletteViewModification(const doc::Palette* newPalette, PaletteViewModification mod) override; - void onPaletteViewChangeSize(int boxsize) override; + void onPaletteViewChangeSize(PaletteView* paletteView, 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; diff --git a/src/app/ui/palette_view.cpp b/src/app/ui/palette_view.cpp index 58b7dc6c1..6d19cc786 100644 --- a/src/app/ui/palette_view.cpp +++ b/src/app/ui/palette_view.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2020 Igara Studio S.A. +// Copyright (C) 2018-2021 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -534,7 +534,7 @@ void PaletteView::setBoxSize(double boxsize) m_boxsize = base::clamp(boxsize, 4.0, 32.0); if (m_delegate) - m_delegate->onPaletteViewChangeSize(int(m_boxsize)); + m_delegate->onPaletteViewChangeSize(this, int(m_boxsize)); View* view = View::getView(this); if (view) diff --git a/src/app/ui/palette_view.h b/src/app/ui/palette_view.h index 8302f703a..96c465d41 100644 --- a/src/app/ui/palette_view.h +++ b/src/app/ui/palette_view.h @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2020 Igara Studio S.A. +// Copyright (C) 2018-2021 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -38,12 +38,14 @@ namespace app { RESIZE, }; + class PaletteView; + class PaletteViewDelegate { public: virtual ~PaletteViewDelegate() { } virtual void onPaletteViewIndexChange(int index, ui::MouseButton button) { } virtual void onPaletteViewModification(const doc::Palette* newPalette, PaletteViewModification mod) { } - virtual void onPaletteViewChangeSize(int boxsize) { } + virtual void onPaletteViewChangeSize(PaletteView* paletteView, 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(); }