Remove some face colors from theme.xml using the center slide instead

This commit is contained in:
David Capello 2017-02-10 17:49:37 -03:00
parent f7903a74de
commit 97809952eb
11 changed files with 55 additions and 94 deletions

View File

@ -37,11 +37,8 @@
<color id="link_text" value="#2c4c91" /> <color id="link_text" value="#2c4c91" />
<color id="link_hover" value="#ff5555" /> <color id="link_hover" value="#ff5555" />
<color id="button_normal_text" value="#000000" /> <color id="button_normal_text" value="#000000" />
<color id="button_normal_face" value="#c6c6c6" />
<color id="button_hot_text" value="#000000" /> <color id="button_hot_text" value="#000000" />
<color id="button_hot_face" value="#ffffff" />
<color id="button_selected_text" value="#ffffff" /> <color id="button_selected_text" value="#ffffff" />
<color id="button_selected_face" value="#7c909f" />
<color id="check_hot_face" value="#ffebb6" /> <color id="check_hot_face" value="#ffebb6" />
<color id="check_focus_face" value="#c6c6c6" /> <color id="check_focus_face" value="#c6c6c6" />
<color id="radio_hot_face" value="#ffebb6" /> <color id="radio_hot_face" value="#ffebb6" />
@ -64,16 +61,11 @@
<color id="listitem_selected_text" value="#ffffff" /> <color id="listitem_selected_text" value="#ffffff" />
<color id="listitem_selected_face" value="#ff5555" /> <color id="listitem_selected_face" value="#ff5555" />
<color id="slider_empty_text" value="#000000" /> <color id="slider_empty_text" value="#000000" />
<color id="slider_empty_face" value="#aecbdf" />
<color id="slider_full_text" value="#ffffff" /> <color id="slider_full_text" value="#ffffff" />
<color id="slider_full_face" value="#7d929e" />
<color id="tab_normal_text" value="#000000" /> <color id="tab_normal_text" value="#000000" />
<color id="tab_normal_face" value="#c6c6c6" />
<color id="tab_active_text" value="#ffffff" /> <color id="tab_active_text" value="#ffffff" />
<color id="tab_active_face" value="#7d929e" /> <color id="tab_active_face" value="#7d929e" />
<color id="splitter_normal_face" value="#7d929e" /> <color id="splitter_normal_face" value="#7d929e" />
<color id="scrollbar_bg_face" value="#7d929e" />
<color id="scrollbar_thumb_face" value="#c6c6c6" />
<color id="popup_window_border" value="#000000" /> <color id="popup_window_border" value="#000000" />
<color id="tooltip_text" value="#000000" /> <color id="tooltip_text" value="#000000" />
<color id="tooltip_face" value="#ffff7d" /> <color id="tooltip_face" value="#ffff7d" />
@ -474,10 +466,10 @@
<!-- scrollbar --> <!-- scrollbar -->
<style id="scrollbar"> <style id="scrollbar">
<background color="scrollbar_bg_face" part="scrollbar_bg" /> <background part="scrollbar_bg" repeat="repeat" />
</style> </style>
<style id="scrollbar_thumb"> <style id="scrollbar_thumb">
<background color="scrollbar_thumb_face" part="scrollbar_thumb" /> <background part="scrollbar_thumb" repeat="repeat" />
</style> </style>
<!-- mini_scrollbar --> <!-- mini_scrollbar -->
@ -761,11 +753,11 @@
<!-- tab --> <!-- tab -->
<style id="tab"> <style id="tab">
<background part="tab_normal" color="tab_normal_face" repeat="repeat-x" /> <background part="tab_normal" repeat="repeat" />
<text color="tab_normal_text" align="left" valign="middle" padding-left="4" padding-top="2" /> <text color="tab_normal_text" align="left" valign="middle" padding-left="4" padding-top="2" />
</style> </style>
<style id="tab:active"> <style id="tab:active">
<background part="tab_active" color="tab_active_face" /> <background part="tab_active" repeat="repeat" />
<text color="tab_active_text" /> <text color="tab_active_text" />
</style> </style>
@ -779,7 +771,7 @@
<!-- tab_bottom --> <!-- tab_bottom -->
<style id="tab_bottom"> <style id="tab_bottom">
<background part="tab_bottom_normal" color="tab_normal_face" repeat="repeat-x" /> <background part="tab_bottom_normal" repeat="repeat-x" />
</style> </style>
<style id="tab_bottom:active"> <style id="tab_bottom:active">
<background part="tab_bottom_active" color="tab_active_face" /> <background part="tab_bottom_active" color="tab_active_face" />
@ -787,7 +779,7 @@
<!-- tab_filler --> <!-- tab_filler -->
<style id="tab_filler"> <style id="tab_filler">
<background part="tab_filler" color="window_face" repeat="repeat-x" /> <background part="tab_filler" repeat="repeat-x" />
</style> </style>
<!-- tab_icon --> <!-- tab_icon -->

View File

@ -70,7 +70,7 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev)
SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
Graphics* g = ev.graphics(); Graphics* g = ev.graphics();
gfx::Rect rc = clientBounds(); gfx::Rect rc = clientBounds();
gfx::Color fg, bg; gfx::Color fg;
SkinPartPtr nw; SkinPartPtr nw;
gfx::Rect boxRc, textRc, iconRc; gfx::Rect boxRc, textRc, iconRc;
gfx::Size iconSize; gfx::Size iconSize;
@ -98,20 +98,17 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev)
if (hasCapture()) { if (hasCapture()) {
nw = theme->parts.toolbuttonPushed(); nw = theme->parts.toolbuttonPushed();
fg = theme->colors.buttonSelectedText(); fg = theme->colors.buttonSelectedText();
bg = theme->colors.buttonSelectedFace();
} }
else { else {
nw = (hasFocus() ? theme->parts.toolbuttonHotFocused(): nw = (hasFocus() ? theme->parts.toolbuttonHotFocused():
theme->parts.toolbuttonHot()); theme->parts.toolbuttonHot());
fg = theme->colors.buttonHotText(); fg = theme->colors.buttonHotText();
bg = theme->colors.buttonHotFace();
} }
} }
else { else {
nw = (hasFocus() ? theme->parts.toolbuttonFocused(): nw = (hasFocus() ? theme->parts.toolbuttonFocused():
theme->parts.toolbuttonLast()); theme->parts.toolbuttonLast());
fg = theme->colors.buttonNormalText(); fg = theme->colors.buttonNormalText();
bg = theme->colors.buttonNormalFace();
} }
if (!isLastCol) if (!isLastCol)
@ -124,7 +121,7 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev)
rc.h += 3*guiscale(); rc.h += 3*guiscale();
} }
theme->drawRect(g, rc, nw.get(), bg); theme->drawRect(g, rc, nw.get());
if (m_icon) { if (m_icon) {
she::Surface* bmp = m_icon->bitmap(0); she::Surface* bmp = m_icon->bitmap(0);

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2001-2016 David Capello // Copyright (C) 2001-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
@ -120,7 +120,7 @@ void ColorBar::ScrollableView::onPaint(ui::PaintEvent& ev)
g, clientBounds(), g, clientBounds(),
(hasFocus() ? theme->parts.editorSelected().get(): (hasFocus() ? theme->parts.editorSelected().get():
theme->parts.editorNormal().get()), theme->parts.editorNormal().get()),
gfx::ColorNone); false); // Do not fill the center portion
} }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2001-2016 David Capello // Copyright (C) 2001-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
@ -71,7 +71,7 @@ void ColorSpectrum::onPaint(ui::PaintEvent& ev)
theme->drawRect(g, clientBounds(), theme->drawRect(g, clientBounds(),
theme->parts.editorNormal().get(), theme->parts.editorNormal().get(),
bgColor()); false); // Do not fill the center
gfx::Rect rc = clientChildrenBounds(); gfx::Rect rc = clientChildrenBounds();
if (rc.isEmpty()) if (rc.isEmpty())

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2016 David Capello // Copyright (C) 2016-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
@ -76,7 +76,7 @@ void ColorTintShadeTone::onPaint(ui::PaintEvent& ev)
theme->drawRect(g, clientBounds(), theme->drawRect(g, clientBounds(),
theme->parts.editorNormal().get(), theme->parts.editorNormal().get(),
bgColor()); false); // Do not fill the center
gfx::Rect rc = clientChildrenBounds(); gfx::Rect rc = clientChildrenBounds();
if (rc.isEmpty()) if (rc.isEmpty())

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2001-2016 David Capello // Copyright (C) 2001-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
@ -210,7 +210,7 @@ void ColorWheel::onPaint(ui::PaintEvent& ev)
theme->drawRect(g, clientBounds(), theme->drawRect(g, clientBounds(),
theme->parts.editorNormal().get(), theme->parts.editorNormal().get(),
bgColor()); false); // Do not fill the center
const gfx::Rect& rc = m_clientBounds; const gfx::Rect& rc = m_clientBounds;

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2001-2016 David Capello // Copyright (C) 2001-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
@ -47,7 +47,7 @@ EditorView::EditorView(EditorView::Type type)
int b = theme->parts.editorSelected()->bitmapS()->height(); int b = theme->parts.editorSelected()->bitmapS()->height();
setBorder(gfx::Border(l, t, r, b)); setBorder(gfx::Border(l, t, r, b));
setBgColor(gfx::rgba(0, 0, 0)); setBgColor(gfx::rgba(0, 0, 0)); // TODO Move this color to theme.xml
setupScrollbars(); setupScrollbars();
m_scrollSettingsConn = m_scrollSettingsConn =
@ -75,12 +75,13 @@ void EditorView::onPaint(PaintEvent& ev)
} }
g->fillRect(bgColor(), clientBounds());
theme->drawRect( theme->drawRect(
g, clientBounds(), g, clientBounds(),
(selected ? (selected ?
theme->parts.editorSelected().get(): theme->parts.editorSelected().get():
theme->parts.editorNormal().get()), theme->parts.editorNormal().get()),
bgColor()); false); // Do not fill the center portion
} }
void EditorView::onResize(ResizeEvent& ev) void EditorView::onResize(ResizeEvent& ev)

View File

@ -806,7 +806,7 @@ void SkinTheme::paintButton(PaintEvent& ev)
ButtonBase* widget = static_cast<ButtonBase*>(ev.getSource()); ButtonBase* widget = static_cast<ButtonBase*>(ev.getSource());
IButtonIcon* iconInterface = widget->iconInterface(); IButtonIcon* iconInterface = widget->iconInterface();
gfx::Rect box, text, icon; gfx::Rect box, text, icon;
gfx::Color fg, bg; gfx::Color fg;
SkinPartPtr part_nw; SkinPartPtr part_nw;
widget->getTextIconInfo(&box, &text, &icon, widget->getTextIconInfo(&box, &text, &icon,
@ -823,7 +823,6 @@ void SkinTheme::paintButton(PaintEvent& ev)
// Selected // Selected
if (widget->isSelected()) { if (widget->isSelected()) {
fg = colors.buttonSelectedText(); fg = colors.buttonSelectedText();
bg = colors.buttonSelectedFace();
part_nw = (look == MiniLook ? parts.toolbuttonNormal(): part_nw = (look == MiniLook ? parts.toolbuttonNormal():
look == LeftButtonLook ? parts.dropDownButtonLeftSelected(): look == LeftButtonLook ? parts.dropDownButtonLeftSelected():
look == RightButtonLook ? parts.dropDownButtonRightSelected(): look == RightButtonLook ? parts.dropDownButtonRightSelected():
@ -832,7 +831,6 @@ void SkinTheme::paintButton(PaintEvent& ev)
// With mouse // With mouse
else if (widget->isEnabled() && widget->hasMouseOver()) { else if (widget->isEnabled() && widget->hasMouseOver()) {
fg = colors.buttonHotText(); fg = colors.buttonHotText();
bg = colors.buttonHotFace();
part_nw = (look == MiniLook ? parts.toolbuttonHot(): part_nw = (look == MiniLook ? parts.toolbuttonHot():
look == LeftButtonLook ? parts.dropDownButtonLeftHot(): look == LeftButtonLook ? parts.dropDownButtonLeftHot():
look == RightButtonLook ? parts.dropDownButtonRightHot(): look == RightButtonLook ? parts.dropDownButtonRightHot():
@ -841,7 +839,6 @@ void SkinTheme::paintButton(PaintEvent& ev)
// Without mouse // Without mouse
else { else {
fg = colors.buttonNormalText(); fg = colors.buttonNormalText();
bg = colors.buttonNormalFace();
if (widget->hasFocus()) if (widget->hasFocus())
part_nw = (look == MiniLook ? parts.toolbuttonHot(): part_nw = (look == MiniLook ? parts.toolbuttonHot():
@ -860,7 +857,7 @@ void SkinTheme::paintButton(PaintEvent& ev)
// draw borders // draw borders
if (part_nw) if (part_nw)
drawRect(g, widget->clientBounds(), part_nw.get(), bg); drawRect(g, widget->clientBounds(), part_nw.get());
// text // text
drawText(g, NULL, fg, ColorNone, widget, drawText(g, NULL, fg, ColorNone, widget,
@ -919,7 +916,7 @@ void SkinTheme::paintCheckBox(PaintEvent& ev)
(widget->hasFocus() || (iconInterface && (widget->hasFocus() || (iconInterface &&
widget->text().empty() && widget->text().empty() &&
widget->hasMouseOver()))) { widget->hasMouseOver()))) {
drawRect(g, bounds, parts.checkFocus().get(), gfx::ColorNone); drawRect(g, bounds, parts.checkFocus().get());
} }
} }
@ -946,12 +943,10 @@ void SkinTheme::paintEntry(PaintEvent& ev)
if (skinPropery) if (skinPropery)
isMiniLook = (skinPropery->getLook() == MiniLook); isMiniLook = (skinPropery->getLook() == MiniLook);
gfx::Color bg = colors.background();
drawRect(g, bounds, drawRect(g, bounds,
(widget->hasFocus() ? (widget->hasFocus() ?
(isMiniLook ? parts.sunkenMiniFocused().get(): parts.sunkenFocused().get()): (isMiniLook ? parts.sunkenMiniFocused().get(): parts.sunkenFocused().get()):
(isMiniLook ? parts.sunkenMiniNormal().get() : parts.sunkenNormal().get())), (isMiniLook ? parts.sunkenMiniNormal().get() : parts.sunkenNormal().get())));
bg);
drawEntryText(g, widget); drawEntryText(g, widget);
} }
@ -1346,7 +1341,7 @@ void SkinTheme::paintRadioButton(PaintEvent& ev)
// Focus // Focus
if (widget->hasFocus()) if (widget->hasFocus())
drawRect(g, bounds, parts.radioFocus().get(), gfx::ColorNone); drawRect(g, bounds, parts.radioFocus().get());
} }
void SkinTheme::paintSeparator(ui::PaintEvent& ev) void SkinTheme::paintSeparator(ui::PaintEvent& ev)
@ -1442,7 +1437,7 @@ void SkinTheme::paintSlider(PaintEvent& ev)
// Draw borders // Draw borders
if (rc.h > 4*guiscale()) { if (rc.h > 4*guiscale()) {
rc.shrink(Border(3, 0, 3, 1) * guiscale()); rc.shrink(Border(3, 0, 3, 1) * guiscale());
drawRect(g, rc, nw.get(), gfx::ColorNone); drawRect(g, rc, nw.get());
} }
// Draw background (using the customized ISliderBgPainter implementation) // Draw background (using the customized ISliderBgPainter implementation)
@ -1471,14 +1466,12 @@ void SkinTheme::paintSlider(PaintEvent& ev)
} }
if (value == min) if (value == min)
drawRect(g, rc, empty_part.get(), colors.sliderEmptyFace()); drawRect(g, rc, empty_part.get());
else if (value == max) else if (value == max)
drawRect(g, rc, full_part.get(), colors.sliderFullFace()); drawRect(g, rc, full_part.get());
else else
drawRect2(g, rc, x, drawRect2(g, rc, x,
full_part.get(), empty_part.get(), full_part.get(), empty_part.get());
colors.sliderFullFace(),
colors.sliderEmptyFace());
// Draw text // Draw text
std::string old_text = widget->text(); std::string old_text = widget->text();
@ -1515,12 +1508,10 @@ void SkinTheme::paintComboBoxEntry(ui::PaintEvent& ev)
// Outside borders // Outside borders
g->fillRect(BGCOLOR, bounds); g->fillRect(BGCOLOR, bounds);
gfx::Color bg = colors.background();
drawRect(g, bounds, drawRect(g, bounds,
(widget->hasFocus() ? (widget->hasFocus() ?
parts.sunken2Focused().get(): parts.sunken2Focused().get():
parts.sunken2Normal().get()), bg); parts.sunken2Normal().get()));
drawEntryText(g, widget); drawEntryText(g, widget);
} }
@ -1531,20 +1522,16 @@ void SkinTheme::paintComboBoxButton(PaintEvent& ev)
Graphics* g = ev.graphics(); Graphics* g = ev.graphics();
IButtonIcon* iconInterface = widget->iconInterface(); IButtonIcon* iconInterface = widget->iconInterface();
SkinPartPtr part_nw; SkinPartPtr part_nw;
gfx::Color bg;
if (widget->isSelected()) { if (widget->isSelected()) {
bg = colors.buttonSelectedFace();
part_nw = parts.toolbuttonPushed(); part_nw = parts.toolbuttonPushed();
} }
// With mouse // With mouse
else if (widget->isEnabled() && widget->hasMouseOver()) { else if (widget->isEnabled() && widget->hasMouseOver()) {
bg = colors.buttonHotFace();
part_nw = parts.toolbuttonHot(); part_nw = parts.toolbuttonHot();
} }
// Without mouse // Without mouse
else { else {
bg = colors.buttonNormalFace();
part_nw = parts.toolbuttonLast(); part_nw = parts.toolbuttonLast();
} }
@ -1554,7 +1541,7 @@ void SkinTheme::paintComboBoxButton(PaintEvent& ev)
g->fillRect(BGCOLOR, rc); g->fillRect(BGCOLOR, rc);
// draw borders // draw borders
drawRect(g, rc, part_nw.get(), bg); drawRect(g, rc, part_nw.get());
// Paint the icon // Paint the icon
if (iconInterface) { if (iconInterface) {
@ -1957,35 +1944,22 @@ void SkinTheme::drawRect(Graphics* g, const Rect& rc,
} }
} }
void SkinTheme::drawRect(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart, gfx::Color bg) void SkinTheme::drawRect(ui::Graphics* g, const gfx::Rect& rc,
SkinPart* skinPart, const bool drawCenter)
{ {
const gfx::Rect& sprite = skinPart->spriteBounds(); Theme::drawSlices(g, m_sheet, rc,
const gfx::Rect& slices = skinPart->slicesBounds(); skinPart->spriteBounds(),
skinPart->slicesBounds(), drawCenter);
Theme::drawSlices(g, m_sheet, rc, sprite, slices, false);
// Center
if (!is_transparent(bg)) {
gfx::Rect inside = rc;
inside.x += slices.x;
inside.y += slices.y;
inside.w -= sprite.w - slices.w;
inside.h -= sprite.h - slices.h;
IntersectClip clip(g, inside);
if (clip)
g->fillRect(bg, inside);
}
} }
void SkinTheme::drawRect2(Graphics* g, const Rect& rc, int x_mid, void SkinTheme::drawRect2(Graphics* g, const Rect& rc, int x_mid,
SkinPart* nw1, SkinPart* nw2, SkinPart* nw1, SkinPart* nw2)
gfx::Color bg1, gfx::Color bg2)
{ {
Rect rc2(rc.x, rc.y, x_mid-rc.x+1, rc.h); Rect rc2(rc.x, rc.y, x_mid-rc.x+1, rc.h);
{ {
IntersectClip clip(g, rc2); IntersectClip clip(g, rc2);
if (clip) if (clip)
drawRect(g, rc, nw1, bg1); drawRect(g, rc, nw1);
} }
rc2.x += rc2.w; rc2.x += rc2.w;
@ -1993,7 +1967,7 @@ void SkinTheme::drawRect2(Graphics* g, const Rect& rc, int x_mid,
IntersectClip clip(g, rc2); IntersectClip clip(g, rc2);
if (clip) if (clip)
drawRect(g, rc, nw2, bg2); drawRect(g, rc, nw2);
} }
void SkinTheme::drawHline(ui::Graphics* g, const gfx::Rect& rc, SkinPart* part) void SkinTheme::drawHline(ui::Graphics* g, const gfx::Rect& rc, SkinPart* part)

View File

@ -93,8 +93,8 @@ namespace app {
she::Surface* nw, she::Surface* n, she::Surface* ne, she::Surface* nw, she::Surface* n, she::Surface* ne,
she::Surface* e, she::Surface* se, she::Surface* s, she::Surface* e, she::Surface* se, she::Surface* s,
she::Surface* sw, she::Surface* w); she::Surface* sw, she::Surface* w);
void drawRect(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart, gfx::Color bg = gfx::ColorNone); void drawRect(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart, const bool drawCenter = true);
void drawRect2(ui::Graphics* g, const gfx::Rect& rc, int x_mid, SkinPart* nw1, SkinPart* nw2, gfx::Color bg1, gfx::Color bg2); void drawRect2(ui::Graphics* g, const gfx::Rect& rc, int x_mid, SkinPart* nw1, SkinPart* nw2);
void drawHline(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart); void drawHline(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart);
void drawVline(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart); void drawVline(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart);
void paintProgressBar(ui::Graphics* g, const gfx::Rect& rc, double progress); void paintProgressBar(ui::Graphics* g, const gfx::Rect& rc, double progress);

View File

@ -40,10 +40,10 @@ void BackgroundRule::onPaint(ui::Graphics* g, const gfx::Rect& bounds, const cha
SkinTheme* theme = SkinTheme::instance(); SkinTheme* theme = SkinTheme::instance();
if (m_part && m_part->countBitmaps() > 0) { if (m_part && m_part->countBitmaps() > 0) {
if (m_part->countBitmaps() == 1) {
if (!gfx::is_transparent(m_color)) if (!gfx::is_transparent(m_color))
g->fillRect(m_color, bounds); g->fillRect(m_color, bounds);
if (m_part->countBitmaps() == 1) {
she::Surface* bmp = m_part->bitmap(0); she::Surface* bmp = m_part->bitmap(0);
if (m_repeat == BackgroundRepeat::NO_REPEAT) { if (m_repeat == BackgroundRepeat::NO_REPEAT) {
@ -66,7 +66,13 @@ void BackgroundRule::onPaint(ui::Graphics* g, const gfx::Rect& bounds, const cha
} }
} }
else if (m_part->countBitmaps() == 8) { else if (m_part->countBitmaps() == 8) {
theme->drawRect(g, bounds, m_part.get(), m_color); theme->drawRect(
g, bounds, m_part.get(),
// This is a hack (we could use a new property but anyway we
// have plans to change the whole theme structure). If
// "repeat" is REPEAT, the center will be filled with the
// center slice of the part.
m_repeat == BackgroundRepeat::REPEAT);
} }
} }
else if (!gfx::is_transparent(m_color)) { else if (!gfx::is_transparent(m_color)) {

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2001-2016 David Capello // Copyright (C) 2001-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
@ -293,8 +293,6 @@ void ToolBar::onPaint(ui::PaintEvent& ev)
gfx::Rect bounds = clientBounds(); gfx::Rect bounds = clientBounds();
Graphics* g = ev.graphics(); Graphics* g = ev.graphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
gfx::Color normalFace = theme->colors.buttonNormalFace();
gfx::Color hotFace = theme->colors.buttonHotFace();
ToolBox* toolbox = App::instance()->toolBox(); ToolBox* toolbox = App::instance()->toolBox();
Tool* activeTool = App::instance()->activeTool(); Tool* activeTool = App::instance()->activeTool();
ToolGroupList::iterator it = toolbox->begin_group(); ToolGroupList::iterator it = toolbox->begin_group();
@ -306,22 +304,19 @@ void ToolBar::onPaint(ui::PaintEvent& ev)
for (int c=0; c<groups; ++c, ++it) { for (int c=0; c<groups; ++c, ++it) {
ToolGroup* tool_group = *it; ToolGroup* tool_group = *it;
Tool* tool = m_selectedInGroup[tool_group]; Tool* tool = m_selectedInGroup[tool_group];
gfx::Color face;
SkinPartPtr nw; SkinPartPtr nw;
if (activeTool == tool || m_hotIndex == c) { if (activeTool == tool || m_hotIndex == c) {
nw = theme->parts.toolbuttonHot(); nw = theme->parts.toolbuttonHot();
face = hotFace;
} }
else { else {
nw = c >= 0 && c < groups-1 ? theme->parts.toolbuttonNormal(): nw = c >= 0 && c < groups-1 ? theme->parts.toolbuttonNormal():
theme->parts.toolbuttonLast(); theme->parts.toolbuttonLast();
face = normalFace;
} }
toolrc = getToolGroupBounds(c); toolrc = getToolGroupBounds(c);
toolrc.offset(-origin()); toolrc.offset(-origin());
theme->drawRect(g, toolrc, nw.get(), face); theme->drawRect(g, toolrc, nw.get());
// Draw the tool icon // Draw the tool icon
she::Surface* icon = theme->getToolIcon(tool->getId().c_str()); she::Surface* icon = theme->getToolIcon(tool->getId().c_str());
@ -341,8 +336,7 @@ void ToolBar::onPaint(ui::PaintEvent& ev)
g, g,
toolrc, toolrc,
(isHot ? theme->parts.toolbuttonHot().get(): (isHot ? theme->parts.toolbuttonHot().get():
theme->parts.toolbuttonLast().get()), theme->parts.toolbuttonLast().get()));
(isHot ? hotFace: normalFace));
she::Surface* icon = theme->getToolIcon("minieditor"); she::Surface* icon = theme->getToolIcon("minieditor");
if (icon) { if (icon) {
@ -706,21 +700,18 @@ void ToolBar::ToolStrip::onPaint(PaintEvent& ev)
for (ToolIterator it = toolbox->begin(); it != toolbox->end(); ++it) { for (ToolIterator it = toolbox->begin(); it != toolbox->end(); ++it) {
Tool* tool = *it; Tool* tool = *it;
if (tool->getGroup() == m_group) { if (tool->getGroup() == m_group) {
gfx::Color face;
SkinPartPtr nw; SkinPartPtr nw;
if (activeTool == tool || m_hotTool == tool) { if (activeTool == tool || m_hotTool == tool) {
nw = theme->parts.toolbuttonHot(); nw = theme->parts.toolbuttonHot();
face = theme->colors.buttonHotFace();
} }
else { else {
nw = theme->parts.toolbuttonLast(); nw = theme->parts.toolbuttonLast();
face = theme->colors.buttonNormalFace();
} }
toolrc = getToolBounds(index++); toolrc = getToolBounds(index++);
toolrc.offset(-bounds().x, -bounds().y); toolrc.offset(-bounds().x, -bounds().y);
theme->drawRect(g, toolrc, nw.get(), face); theme->drawRect(g, toolrc, nw.get());
// Draw the tool icon // Draw the tool icon
she::Surface* icon = theme->getToolIcon(tool->getId().c_str()); she::Surface* icon = theme->getToolIcon(tool->getId().c_str());