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_hover" value="#ff5555" />
<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_face" 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_focus_face" value="#c6c6c6" />
<color id="radio_hot_face" value="#ffebb6" />
@ -64,16 +61,11 @@
<color id="listitem_selected_text" value="#ffffff" />
<color id="listitem_selected_face" value="#ff5555" />
<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_face" value="#7d929e" />
<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_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="tooltip_text" value="#000000" />
<color id="tooltip_face" value="#ffff7d" />
@ -474,10 +466,10 @@
<!-- scrollbar -->
<style id="scrollbar">
<background color="scrollbar_bg_face" part="scrollbar_bg" />
<background part="scrollbar_bg" repeat="repeat" />
</style>
<style id="scrollbar_thumb">
<background color="scrollbar_thumb_face" part="scrollbar_thumb" />
<background part="scrollbar_thumb" repeat="repeat" />
</style>
<!-- mini_scrollbar -->
@ -761,11 +753,11 @@
<!-- 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" />
</style>
<style id="tab:active">
<background part="tab_active" color="tab_active_face" />
<background part="tab_active" repeat="repeat" />
<text color="tab_active_text" />
</style>
@ -779,7 +771,7 @@
<!-- 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 id="tab_bottom:active">
<background part="tab_bottom_active" color="tab_active_face" />
@ -787,7 +779,7 @@
<!-- tab_filler -->
<style id="tab_filler">
<background part="tab_filler" color="window_face" repeat="repeat-x" />
<background part="tab_filler" repeat="repeat-x" />
</style>
<!-- tab_icon -->

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2016 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -47,7 +47,7 @@ EditorView::EditorView(EditorView::Type type)
int b = theme->parts.editorSelected()->bitmapS()->height();
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();
m_scrollSettingsConn =
@ -75,12 +75,13 @@ void EditorView::onPaint(PaintEvent& ev)
}
g->fillRect(bgColor(), clientBounds());
theme->drawRect(
g, clientBounds(),
(selected ?
theme->parts.editorSelected().get():
theme->parts.editorNormal().get()),
bgColor());
false); // Do not fill the center portion
}
void EditorView::onResize(ResizeEvent& ev)

View File

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

View File

@ -40,10 +40,10 @@ void BackgroundRule::onPaint(ui::Graphics* g, const gfx::Rect& bounds, const cha
SkinTheme* theme = SkinTheme::instance();
if (m_part && m_part->countBitmaps() > 0) {
if (m_part->countBitmaps() == 1) {
if (!gfx::is_transparent(m_color))
g->fillRect(m_color, bounds);
if (!gfx::is_transparent(m_color))
g->fillRect(m_color, bounds);
if (m_part->countBitmaps() == 1) {
she::Surface* bmp = m_part->bitmap(0);
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) {
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)) {

View File

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