mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Add option to disable the separator between palette entries
This commit is contained in:
parent
3ec3f75d91
commit
4919740861
@ -189,6 +189,7 @@
|
||||
<option id="wheel_model" type="int" default="0" />
|
||||
<option id="harmony" type="int" default="0" />
|
||||
<option id="show_invalid_fg_bg_color_alert" type="bool" default="true" />
|
||||
<option id="entries_separator" type="bool" default="true" />
|
||||
</section>
|
||||
<section id="updater">
|
||||
<option id="inits" type="int" default="0" migrate="Updater.Inits" />
|
||||
|
@ -914,6 +914,7 @@ expand_menu_bar_items_on_mouseover_tooltip = <<<END
|
||||
Check this option to get
|
||||
this old menus behavior.
|
||||
END
|
||||
color_bar_entries_separator = Draw a separation between each palette entry
|
||||
auto_save_recovery_data = Automatically save recovery data every
|
||||
auto_save_recovery_data_tooltip = <<<END
|
||||
With this option you can recover your documents
|
||||
|
@ -63,6 +63,10 @@
|
||||
<check id="expand_menubar_on_mouseover"
|
||||
text="@.expand_menu_bar_items_on_mouseover"
|
||||
tooltip="@.expand_menu_bar_items_on_mouseover" />
|
||||
<check id="color_bar_entries_separator"
|
||||
text="@.color_bar_entries_separator"
|
||||
tooltip="@.color_bar_entries_separator"
|
||||
pref="color_bar.entries_separator" />
|
||||
<hbox>
|
||||
<check id="enable_data_recovery"
|
||||
text="@.auto_save_recovery_data"
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -271,6 +271,7 @@ ColorBar::ColorBar(int align, TooltipManager* tooltipManager)
|
||||
m_afterCmdConn = UIContext::instance()->AfterCommandExecution.connect(&ColorBar::onAfterExecuteCommand, this);
|
||||
m_fgConn = Preferences::instance().colorBar.fgColor.AfterChange.connect(base::Bind<void>(&ColorBar::onFgColorChangeFromPreferences, this));
|
||||
m_bgConn = Preferences::instance().colorBar.bgColor.AfterChange.connect(base::Bind<void>(&ColorBar::onBgColorChangeFromPreferences, this));
|
||||
m_sepConn = Preferences::instance().colorBar.entriesSeparator.AfterChange.connect(base::Bind<void>(&ColorBar::invalidate, this));
|
||||
m_paletteView.FocusOrClick.connect(&ColorBar::onFocusPaletteView, this);
|
||||
m_appPalChangeConn = App::instance()->PaletteChange.connect(&ColorBar::onAppPaletteChange, this);
|
||||
KeyboardShortcuts::instance()->UserChange.connect(
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -191,6 +191,7 @@ namespace app {
|
||||
obs::scoped_connection m_afterCmdConn;
|
||||
obs::scoped_connection m_fgConn;
|
||||
obs::scoped_connection m_bgConn;
|
||||
obs::scoped_connection m_sepConn;
|
||||
obs::scoped_connection m_appPalChangeConn;
|
||||
ui::MouseButtons m_lastButtons;
|
||||
|
||||
|
@ -459,10 +459,12 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
|
||||
int fgIndex = -1;
|
||||
int bgIndex = -1;
|
||||
int transparentIndex = -1;
|
||||
bool hotColor = (m_hot.part == Hit::COLOR ||
|
||||
m_hot.part == Hit::POSSIBLE_COLOR);
|
||||
bool dragging = (m_state == State::DRAGGING_OUTLINE && hotColor);
|
||||
bool resizing = (m_state == State::RESIZING_PALETTE && hotColor);
|
||||
const bool hotColor = (m_hot.part == Hit::COLOR ||
|
||||
m_hot.part == Hit::POSSIBLE_COLOR);
|
||||
const bool dragging = (m_state == State::DRAGGING_OUTLINE && hotColor);
|
||||
const bool resizing = (m_state == State::RESIZING_PALETTE && hotColor);
|
||||
const bool withSeparator =
|
||||
Preferences::instance().colorBar.entriesSeparator();
|
||||
|
||||
if (m_style == FgBgColors && m_delegate) {
|
||||
fgIndex = findExactIndex(m_delegate->onPaletteViewGetForegroundIndex());
|
||||
@ -495,7 +497,7 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
|
||||
}
|
||||
|
||||
gfx::Rect box = getPaletteEntryBounds(i + boxOffset);
|
||||
gfx::Color gfxColor = drawEntry(g, box, i + idxOffset);
|
||||
gfx::Color gfxColor = drawEntry(g, box, i + idxOffset, withSeparator);
|
||||
const int boxsize = int(m_boxsize * guiscale());
|
||||
|
||||
switch (m_style) {
|
||||
@ -564,7 +566,7 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
|
||||
// Draw color being dragged + label
|
||||
if (dragging) {
|
||||
gfx::Rect box2 = getPaletteEntryBounds(k);
|
||||
gfx::Color gfxColor = drawEntry(g, box2, i); // Draw color entry
|
||||
gfx::Color gfxColor = drawEntry(g, box2, i, withSeparator); // Draw color entry
|
||||
|
||||
gfx::Color neg = color_utils::blackandwhite_neg(gfxColor);
|
||||
os::Font* minifont = theme->getMiniFont();
|
||||
@ -1014,7 +1016,10 @@ void PaletteView::setNewPalette(doc::Palette* oldPalette,
|
||||
manager()->invalidate();
|
||||
}
|
||||
|
||||
gfx::Color PaletteView::drawEntry(ui::Graphics* g, const gfx::Rect& box, int palIdx)
|
||||
gfx::Color PaletteView::drawEntry(ui::Graphics* g,
|
||||
const gfx::Rect& box,
|
||||
const int palIdx,
|
||||
const bool withSeparator)
|
||||
{
|
||||
doc::color_t palColor =
|
||||
(palIdx < currentPalette()->size() ? currentPalette()->getEntry(palIdx):
|
||||
@ -1031,10 +1036,12 @@ gfx::Color PaletteView::drawEntry(ui::Graphics* g, const gfx::Rect& box, int pal
|
||||
rgba_geta(palColor));
|
||||
|
||||
gfx::Rect box2(box);
|
||||
box2.enlarge(1);
|
||||
for (int i=1; i<=guiscale(); ++i, box2.enlarge(1))
|
||||
g->drawRect(gfx::rgba(0, 0, 0), box2);
|
||||
draw_color(g, box, appColor, doc::ColorMode::RGB);
|
||||
box2.enlarge(guiscale());
|
||||
if (withSeparator) {
|
||||
for (int i=0; i<guiscale(); ++i, box2.shrink(1))
|
||||
g->drawRect(gfx::rgba(0, 0, 0), box2);
|
||||
}
|
||||
draw_color(g, box2, appColor, doc::ColorMode::RGB);
|
||||
return gfxColor;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,10 @@ namespace app {
|
||||
int findExactIndex(const app::Color& color) const;
|
||||
void setNewPalette(doc::Palette* oldPalette, doc::Palette* newPalette,
|
||||
PaletteViewModification mod);
|
||||
gfx::Color drawEntry(ui::Graphics* g, const gfx::Rect& box, int palIdx);
|
||||
gfx::Color drawEntry(ui::Graphics* g,
|
||||
const gfx::Rect& box,
|
||||
const int palIdx,
|
||||
const bool withSeparator);
|
||||
|
||||
State m_state;
|
||||
bool m_editable;
|
||||
|
Loading…
Reference in New Issue
Block a user