mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-06 06:50:07 +00:00
Move ui::Splitter painting code to new styles
This commit is contained in:
parent
cc20f0a21e
commit
86f138a714
@ -65,7 +65,6 @@
|
|||||||
<color id="tab_normal_text" value="#000000" />
|
<color id="tab_normal_text" value="#000000" />
|
||||||
<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="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" />
|
||||||
@ -1014,6 +1013,14 @@
|
|||||||
<style id="color_button" extends="mini_button" border="5">
|
<style id="color_button" extends="mini_button" border="5">
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style id="splitter">
|
||||||
|
<background color="face" />
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style id="workspace_splitter">
|
||||||
|
<background color="workspace" />
|
||||||
|
</style>
|
||||||
|
|
||||||
</styles>
|
</styles>
|
||||||
|
|
||||||
</theme>
|
</theme>
|
||||||
|
@ -20,8 +20,10 @@
|
|||||||
</vbox>
|
</vbox>
|
||||||
</hbox>
|
</hbox>
|
||||||
<splitter horizontal="true" noborders="true" childspacing="2"
|
<splitter horizontal="true" noborders="true" childspacing="2"
|
||||||
expansive="true" by="percetage" position="50" >
|
expansive="true" by="percetage" position="50"
|
||||||
<splitter vertical="true" noborders="true" childspacing="2">
|
style="workspace_splitter">
|
||||||
|
<splitter vertical="true" noborders="true" childspacing="2"
|
||||||
|
style="workspace_splitter">
|
||||||
<vbox id="files_placeholder">
|
<vbox id="files_placeholder">
|
||||||
<label text="@home_view.recent_files" style="workspace_label" />
|
<label text="@home_view.recent_files" style="workspace_label" />
|
||||||
<view id="files_view" expansive="true" style="workspace_view" />
|
<view id="files_view" expansive="true" style="workspace_view" />
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!-- Aseprite -->
|
<!-- Aseprite -->
|
||||||
<!-- Copyright (C) 2001-2015 by David Capello -->
|
<!-- Copyright (C) 2001-2017 by David Capello -->
|
||||||
<gui>
|
<gui>
|
||||||
<window id="main_window" noborders="true" desktop="true">
|
<window id="main_window" noborders="true" desktop="true">
|
||||||
<vbox noborders="true" expansive="true">
|
<vbox noborders="true" expansive="true">
|
||||||
@ -7,14 +7,16 @@
|
|||||||
<hbox noborders="true" id="tabs_placeholder" />
|
<hbox noborders="true" id="tabs_placeholder" />
|
||||||
<splitter id="color_bar_splitter"
|
<splitter id="color_bar_splitter"
|
||||||
horizontal="true" expansive="true"
|
horizontal="true" expansive="true"
|
||||||
by="pixel">
|
by="pixel"
|
||||||
|
style="workspace_splitter">
|
||||||
<vbox noborders="true" id="color_bar_placeholder" />
|
<vbox noborders="true" id="color_bar_placeholder" />
|
||||||
<vbox noborders="true" expansive="true">
|
<vbox noborders="true" expansive="true">
|
||||||
<vbox noborders="true" id="context_bar_placeholder" />
|
<vbox noborders="true" id="context_bar_placeholder" />
|
||||||
<hbox noborders="true" expansive="true">
|
<hbox noborders="true" expansive="true">
|
||||||
<splitter id="timeline_splitter"
|
<splitter id="timeline_splitter"
|
||||||
vertical="true" expansive="true"
|
vertical="true" expansive="true"
|
||||||
by="percetage" position="100">
|
by="percetage" position="100"
|
||||||
|
style="workspace_splitter">
|
||||||
<hbox noborders="true" id="workspace_placeholder" expansive="true" />
|
<hbox noborders="true" id="workspace_placeholder" expansive="true" />
|
||||||
<vbox noborders="true" id="timeline_placeholder" expansive="true" />
|
<vbox noborders="true" id="timeline_placeholder" expansive="true" />
|
||||||
</splitter>
|
</splitter>
|
||||||
|
@ -160,6 +160,7 @@ ColorBar::ColorBar(int align)
|
|||||||
m_splitter.setId("palette_spectrum_splitter");
|
m_splitter.setId("palette_spectrum_splitter");
|
||||||
m_splitter.setPosition(80);
|
m_splitter.setPosition(80);
|
||||||
m_splitter.setExpansive(true);
|
m_splitter.setExpansive(true);
|
||||||
|
m_splitter.setStyle(theme->newStyles.workspaceSplitter());
|
||||||
m_splitter.addChild(&m_palettePlaceholder);
|
m_splitter.addChild(&m_palettePlaceholder);
|
||||||
m_splitter.addChild(&m_selectorPlaceholder);
|
m_splitter.addChild(&m_selectorPlaceholder);
|
||||||
|
|
||||||
|
@ -755,8 +755,8 @@ void SkinTheme::initWidget(Widget* widget)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kSplitterWidget:
|
case kSplitterWidget:
|
||||||
BORDER(0);
|
|
||||||
widget->setChildSpacing(3 * scale);
|
widget->setChildSpacing(3 * scale);
|
||||||
|
widget->setStyle(newStyles.splitter());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kRadioWidget:
|
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)
|
void SkinTheme::paintRadioButton(PaintEvent& ev)
|
||||||
{
|
{
|
||||||
Graphics* g = ev.graphics();
|
Graphics* g = ev.graphics();
|
||||||
|
@ -63,7 +63,6 @@ namespace app {
|
|||||||
void paintListItem(ui::PaintEvent& ev) override;
|
void paintListItem(ui::PaintEvent& ev) override;
|
||||||
void paintMenu(ui::PaintEvent& ev) override;
|
void paintMenu(ui::PaintEvent& ev) override;
|
||||||
void paintMenuItem(ui::PaintEvent& ev) override;
|
void paintMenuItem(ui::PaintEvent& ev) override;
|
||||||
void paintSplitter(ui::PaintEvent& ev) override;
|
|
||||||
void paintRadioButton(ui::PaintEvent& ev) override;
|
void paintRadioButton(ui::PaintEvent& ev) override;
|
||||||
void paintSeparator(ui::PaintEvent& ev) override;
|
void paintSeparator(ui::PaintEvent& ev) override;
|
||||||
void paintSlider(ui::PaintEvent& ev) override;
|
void paintSlider(ui::PaintEvent& ev) override;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2015 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.
|
||||||
@ -267,6 +267,7 @@ DropViewAtResult WorkspacePanel::dropViewAt(const gfx::Point& pos, WorkspacePane
|
|||||||
|
|
||||||
Splitter* splitter = new Splitter(Splitter::ByPercentage, splitterAlign);
|
Splitter* splitter = new Splitter(Splitter::ByPercentage, splitterAlign);
|
||||||
splitter->setExpansive(true);
|
splitter->setExpansive(true);
|
||||||
|
splitter->setStyle(SkinTheme::instance()->newStyles.workspaceSplitter());
|
||||||
|
|
||||||
Widget* parent = this->parent();
|
Widget* parent = this->parent();
|
||||||
if (parent->type() == kBoxWidget) {
|
if (parent->type() == kBoxWidget) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// 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.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// 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) \
|
#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.x = rc.x; \
|
||||||
pos.y = rc.y; \
|
pos.y = rc.y; \
|
||||||
@ -201,7 +201,7 @@ void Splitter::onResize(ResizeEvent& ev)
|
|||||||
child1->setBounds(pos); \
|
child1->setBounds(pos); \
|
||||||
gfx::Rect child1Pos = child1->bounds(); \
|
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.y = rc.y; \
|
||||||
pos.w = avail - child1Pos.w; \
|
pos.w = avail - child1Pos.w; \
|
||||||
pos.h = rc.h; \
|
pos.h = rc.h; \
|
||||||
@ -233,11 +233,6 @@ void Splitter::onResize(ResizeEvent& ev)
|
|||||||
child2->setBounds(rc);
|
child2->setBounds(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Splitter::onPaint(PaintEvent& ev)
|
|
||||||
{
|
|
||||||
theme()->paintSplitter(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Splitter::onSizeHint(SizeHintEvent& ev)
|
void Splitter::onSizeHint(SizeHintEvent& ev)
|
||||||
{
|
{
|
||||||
#define GET_CHILD_SIZE(w, h) \
|
#define GET_CHILD_SIZE(w, h) \
|
||||||
@ -249,7 +244,7 @@ void Splitter::onSizeHint(SizeHintEvent& ev)
|
|||||||
#define FINAL_SIZE(w) \
|
#define FINAL_SIZE(w) \
|
||||||
do { \
|
do { \
|
||||||
w *= visibleChildren; \
|
w *= visibleChildren; \
|
||||||
w += this->childSpacing() * (visibleChildren-1); \
|
w += childSpacing() * (visibleChildren-1); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
int visibleChildren;
|
int visibleChildren;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// 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.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -25,7 +25,6 @@ namespace ui {
|
|||||||
// Events
|
// Events
|
||||||
bool onProcessMessage(Message* msg) override;
|
bool onProcessMessage(Message* msg) override;
|
||||||
void onResize(ResizeEvent& ev) override;
|
void onResize(ResizeEvent& ev) override;
|
||||||
void onPaint(PaintEvent& ev) override;
|
|
||||||
void onSizeHint(SizeHintEvent& ev) override;
|
void onSizeHint(SizeHintEvent& ev) override;
|
||||||
void onLoadLayout(LoadLayoutEvent& ev) override;
|
void onLoadLayout(LoadLayoutEvent& ev) override;
|
||||||
void onSaveLayout(SaveLayoutEvent& ev) override;
|
void onSaveLayout(SaveLayoutEvent& ev) override;
|
||||||
|
@ -61,7 +61,6 @@ namespace ui {
|
|||||||
virtual void paintListItem(PaintEvent& ev) = 0;
|
virtual void paintListItem(PaintEvent& ev) = 0;
|
||||||
virtual void paintMenu(PaintEvent& ev) = 0;
|
virtual void paintMenu(PaintEvent& ev) = 0;
|
||||||
virtual void paintMenuItem(PaintEvent& ev) = 0;
|
virtual void paintMenuItem(PaintEvent& ev) = 0;
|
||||||
virtual void paintSplitter(PaintEvent& ev) = 0;
|
|
||||||
virtual void paintRadioButton(PaintEvent& ev) = 0;
|
virtual void paintRadioButton(PaintEvent& ev) = 0;
|
||||||
virtual void paintSeparator(PaintEvent& ev) = 0;
|
virtual void paintSeparator(PaintEvent& ev) = 0;
|
||||||
virtual void paintSlider(PaintEvent& ev) = 0;
|
virtual void paintSlider(PaintEvent& ev) = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user