Move ui::Splitter painting code to new styles

This commit is contained in:
David Capello 2017-02-17 16:17:00 -03:00
parent cc20f0a21e
commit 86f138a714
10 changed files with 26 additions and 28 deletions

View File

@ -65,7 +65,6 @@
<color id="tab_normal_text" value="#000000" />
<color id="tab_active_text" value="#ffffff" />
<color id="tab_active_face" value="#7d929e" />
<color id="splitter_normal_face" value="#7d929e" />
<color id="popup_window_border" value="#000000" />
<color id="tooltip_text" value="#000000" />
<color id="tooltip_face" value="#ffff7d" />
@ -1014,6 +1013,14 @@
<style id="color_button" extends="mini_button" border="5">
</style>
<style id="splitter">
<background color="face" />
</style>
<style id="workspace_splitter">
<background color="workspace" />
</style>
</styles>
</theme>

View File

@ -20,8 +20,10 @@
</vbox>
</hbox>
<splitter horizontal="true" noborders="true" childspacing="2"
expansive="true" by="percetage" position="50" >
<splitter vertical="true" noborders="true" childspacing="2">
expansive="true" by="percetage" position="50"
style="workspace_splitter">
<splitter vertical="true" noborders="true" childspacing="2"
style="workspace_splitter">
<vbox id="files_placeholder">
<label text="@home_view.recent_files" style="workspace_label" />
<view id="files_view" expansive="true" style="workspace_view" />

View File

@ -1,5 +1,5 @@
<!-- Aseprite -->
<!-- Copyright (C) 2001-2015 by David Capello -->
<!-- Copyright (C) 2001-2017 by David Capello -->
<gui>
<window id="main_window" noborders="true" desktop="true">
<vbox noborders="true" expansive="true">
@ -7,14 +7,16 @@
<hbox noborders="true" id="tabs_placeholder" />
<splitter id="color_bar_splitter"
horizontal="true" expansive="true"
by="pixel">
by="pixel"
style="workspace_splitter">
<vbox noborders="true" id="color_bar_placeholder" />
<vbox noborders="true" expansive="true">
<vbox noborders="true" id="context_bar_placeholder" />
<hbox noborders="true" expansive="true">
<splitter id="timeline_splitter"
vertical="true" expansive="true"
by="percetage" position="100">
by="percetage" position="100"
style="workspace_splitter">
<hbox noborders="true" id="workspace_placeholder" expansive="true" />
<vbox noborders="true" id="timeline_placeholder" expansive="true" />
</splitter>

View File

@ -160,6 +160,7 @@ ColorBar::ColorBar(int align)
m_splitter.setId("palette_spectrum_splitter");
m_splitter.setPosition(80);
m_splitter.setExpansive(true);
m_splitter.setStyle(theme->newStyles.workspaceSplitter());
m_splitter.addChild(&m_palettePlaceholder);
m_splitter.addChild(&m_selectorPlaceholder);

View File

@ -755,8 +755,8 @@ void SkinTheme::initWidget(Widget* widget)
break;
case kSplitterWidget:
BORDER(0);
widget->setChildSpacing(3 * scale);
widget->setStyle(newStyles.splitter());
break;
case kRadioWidget:
@ -1271,13 +1271,6 @@ void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
}
}
void SkinTheme::paintSplitter(PaintEvent& ev)
{
Graphics* g = ev.graphics();
g->fillRect(colors.splitterNormalFace(), g->getClipBounds());
}
void SkinTheme::paintRadioButton(PaintEvent& ev)
{
Graphics* g = ev.graphics();

View File

@ -63,7 +63,6 @@ namespace app {
void paintListItem(ui::PaintEvent& ev) override;
void paintMenu(ui::PaintEvent& ev) override;
void paintMenuItem(ui::PaintEvent& ev) override;
void paintSplitter(ui::PaintEvent& ev) override;
void paintRadioButton(ui::PaintEvent& ev) override;
void paintSeparator(ui::PaintEvent& ev) override;
void paintSlider(ui::PaintEvent& ev) override;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -267,6 +267,7 @@ DropViewAtResult WorkspacePanel::dropViewAt(const gfx::Point& pos, WorkspacePane
Splitter* splitter = new Splitter(Splitter::ByPercentage, splitterAlign);
splitter->setExpansive(true);
splitter->setStyle(SkinTheme::instance()->newStyles.workspaceSplitter());
Widget* parent = this->parent();
if (parent->type() == kBoxWidget) {

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2016 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -181,7 +181,7 @@ void Splitter::onResize(ResizeEvent& ev)
{
#define LAYOUT_TWO_CHILDREN(x, y, w, h, l, t, r, b) \
{ \
avail = rc.w - this->childSpacing(); \
avail = rc.w - childSpacing(); \
\
pos.x = rc.x; \
pos.y = rc.y; \
@ -201,7 +201,7 @@ void Splitter::onResize(ResizeEvent& ev)
child1->setBounds(pos); \
gfx::Rect child1Pos = child1->bounds(); \
\
pos.x = child1Pos.x + child1Pos.w + this->childSpacing(); \
pos.x = child1Pos.x + child1Pos.w + childSpacing(); \
pos.y = rc.y; \
pos.w = avail - child1Pos.w; \
pos.h = rc.h; \
@ -233,11 +233,6 @@ void Splitter::onResize(ResizeEvent& ev)
child2->setBounds(rc);
}
void Splitter::onPaint(PaintEvent& ev)
{
theme()->paintSplitter(ev);
}
void Splitter::onSizeHint(SizeHintEvent& ev)
{
#define GET_CHILD_SIZE(w, h) \
@ -249,7 +244,7 @@ void Splitter::onSizeHint(SizeHintEvent& ev)
#define FINAL_SIZE(w) \
do { \
w *= visibleChildren; \
w += this->childSpacing() * (visibleChildren-1); \
w += childSpacing() * (visibleChildren-1); \
} while(0)
int visibleChildren;

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2013, 2015 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -25,7 +25,6 @@ namespace ui {
// Events
bool onProcessMessage(Message* msg) override;
void onResize(ResizeEvent& ev) override;
void onPaint(PaintEvent& ev) override;
void onSizeHint(SizeHintEvent& ev) override;
void onLoadLayout(LoadLayoutEvent& ev) override;
void onSaveLayout(SaveLayoutEvent& ev) override;

View File

@ -61,7 +61,6 @@ namespace ui {
virtual void paintListItem(PaintEvent& ev) = 0;
virtual void paintMenu(PaintEvent& ev) = 0;
virtual void paintMenuItem(PaintEvent& ev) = 0;
virtual void paintSplitter(PaintEvent& ev) = 0;
virtual void paintRadioButton(PaintEvent& ev) = 0;
virtual void paintSeparator(PaintEvent& ev) = 0;
virtual void paintSlider(PaintEvent& ev) = 0;