Merge branch 'main' into beta

This commit is contained in:
David Capello 2022-02-18 19:23:48 -03:00
commit 7e76d81fcc
62 changed files with 320 additions and 233 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Aseprite -->
<!-- Copyright (C) 2018-2021 Igara Studio S.A. -->
<!-- Copyright (C) 2018-2022 Igara Studio S.A. -->
<!-- Copyright (C) 2014-2018 David Capello -->
<preferences>
@ -218,7 +218,7 @@
<option id="use_native_clipboard" type="bool" default="true" />
<option id="use_native_file_dialog" type="bool" default="false" />
<option id="one_finger_as_mouse_movement" type="bool" default="true" />
<option id="load_wintab_driver" type="bool" default="true" />
<option id="load_wintab_driver" type="bool" default="false" />
<option id="flash_layer" type="bool" default="false" />
<option id="nonactive_layers_opacity" type="int" default="255" />
</section>

2
laf

@ -1 +1 @@
Subproject commit d47ccc7887a2d900e5297e032e8cf9fcfd75451c
Subproject commit f473cc6f8c68629ef0e8c480afbba5659ef5de75

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2021 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -233,7 +233,7 @@ private:
}
void updateIcons() {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
int sel = dir()->selectedItem();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -84,7 +84,7 @@ public:
, m_contextLabel("Context") {
setBorder(gfx::Border(0));
auto theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
m_actionLabel.setStyle(theme->styles.listHeaderLabel());
m_keyLabel.setStyle(theme->styles.listHeaderLabel());
m_contextLabel.setStyle(theme->styles.listHeaderLabel());
@ -301,7 +301,7 @@ private:
void onPaint(PaintEvent& ev) override {
Graphics* g = ev.graphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Rect bounds = clientBounds();
gfx::Color fg, bg;
@ -383,6 +383,8 @@ private:
int dh = textSize().h + 4*guiscale();
int maxi = (accels && accels->size() > 1 ? accels->size(): 1);
auto theme = SkinTheme::get(this);
for (int i=0; i<maxi; ++i, y += dh) {
int w = Graphics::measureUITextLength(
(accels && i < (int)accels->size() ? getAccelText((*accels)[i]).c_str(): ""),
@ -403,13 +405,13 @@ private:
m_changeConn = obs::connection();
m_changeButton.reset(new Button(""));
m_changeConn = m_changeButton->Click.connect([this, i]{ onChangeAccel(i); });
m_changeButton->setStyle(SkinTheme::instance()->styles.miniButton());
m_changeButton->setStyle(theme->styles.miniButton());
addChild(m_changeButton.get());
m_deleteConn = obs::connection();
m_deleteButton.reset(new Button(""));
m_deleteConn = m_deleteButton->Click.connect([this, i]{ onDeleteAccel(i); });
m_deleteButton->setStyle(SkinTheme::instance()->styles.miniButton());
m_deleteButton->setStyle(theme->styles.miniButton());
addChild(m_deleteButton.get());
m_changeButton->setBgColor(gfx::ColorNone);
@ -436,7 +438,7 @@ private:
m_addConn = obs::connection();
m_addButton.reset(new Button(""));
m_addConn = m_addButton->Click.connect([this]{ onAddAccel(); });
m_addButton->setStyle(SkinTheme::instance()->styles.miniButton());
m_addButton->setStyle(theme->styles.miniButton());
addChild(m_addButton.get());
itemBounds.w = 8*guiscale() + Graphics::measureUITextLength("Add", font());

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -1273,7 +1273,7 @@ private:
if (themeList()->getItemsCount() > 0)
return;
auto theme = skin::SkinTheme::instance();
auto theme = skin::SkinTheme::get(this);
auto userFolder = userThemeFolder();
auto folders = themeFolders();
std::sort(folders.begin(), folders.end());
@ -1408,7 +1408,7 @@ private:
const bool recreateVariantsFields = true) {
try {
if (themeName != m_pref.theme.selected()) {
auto theme = static_cast<skin::SkinTheme*>(ui::get_theme());
auto theme = skin::SkinTheme::get(this);
// Change theme name from preferences
m_pref.theme.selected(themeName);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2021 Igara Studio S.A.
// Copyright (C) 2021-2022 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -193,7 +193,7 @@ protected:
}
void onPaint(PaintEvent& ev) override {
auto theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Graphics* g = ev.graphics();
View* view = View::getView(this);
gfx::Color linesBg = theme->colors.textboxCodeFace();
@ -496,7 +496,7 @@ public:
m_state == State::ProcessingCommand);
bool canRunCommands = (m_state == State::WaitingNextCommand);
auto theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
control()->getItem(0)->setIcon(
(isRunning ? theme->parts.debugPause() :
theme->parts.debugContinue()));

View File

@ -125,7 +125,7 @@ private:
}
m_panel.outlineType()->setSelectedItem(commonMatrix, false);
auto theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
auto emptyIcon = theme->parts.outlineEmptyPixel();
auto pixelIcon = theme->parts.outlineFullPixel();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -162,7 +162,11 @@ void draw_color_button(ui::Graphics* g,
const bool hot,
const bool drag)
{
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::instance();
ASSERT(theme);
if (!theme)
return;
int scale = ui::guiscale();
// Draw background (the color)
@ -234,7 +238,11 @@ void draw_tile_button(ui::Graphics* g,
const bool hot,
const bool drag)
{
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::instance();
ASSERT(theme);
if (!theme)
return;
int scale = ui::guiscale();
// Draw background (the tile)

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2016-2017 David Capello
//
// This program is distributed under the terms of
@ -230,9 +230,9 @@ private:
void onPaint(PaintEvent& ev) override {
Graphics* g = ev.graphics();
gfx::Rect rc = clientBounds();
auto skin = (SkinTheme*)theme();
auto theme = SkinTheme::get(this);
g->fillRect(skin->colors.textboxFace(), rc);
g->fillRect(theme->colors.textboxFace(), rc);
}
bool onProcessMessage(Message* msg) override {
@ -265,7 +265,9 @@ private:
void onInitTheme(InitThemeEvent& ev) override {
Widget::onInitTheme(ev);
setBgColor(SkinTheme::instance()->colors.textboxFace());
auto theme = SkinTheme::get(this);
setBgColor(theme->colors.textboxFace());
setBorder(gfx::Border(4*guiscale()));
}
@ -460,6 +462,8 @@ private:
}
void addText(const std::string& content) {
auto theme = SkinTheme::get(this);
std::vector<std::string> words;
base::split_string(content, words, " ");
for (const auto& word : words)
@ -469,7 +473,7 @@ private:
if (word.size() > 4 &&
std::strncmp(word.c_str(), "http", 4) == 0) {
label = new LinkLabel(word);
label->setStyle(SkinTheme::instance()->styles.browserLink());
label->setStyle(theme->styles.browserLink());
}
else
label = new Label(word);
@ -482,8 +486,9 @@ private:
}
void addCodeInline(const std::string& content) {
auto theme = SkinTheme::get(this);
auto label = new Label(content);
label->setBgColor(SkinTheme::instance()->colors.textboxCodeFace());
label->setBgColor(theme->colors.textboxCodeFace());
addChild(label);
}
@ -491,7 +496,8 @@ private:
auto textBox = new TextBox(content, LEFT);
textBox->InitTheme.connect(
[textBox]{
textBox->setBgColor(SkinTheme::instance()->colors.textboxCodeFace());
auto theme = SkinTheme::get(textBox);
textBox->setBgColor(theme->colors.textboxCodeFace());
textBox->setBorder(gfx::Border(4*guiscale()));
});
textBox->initTheme();
@ -502,7 +508,8 @@ private:
auto label = new LinkLabel(url, text);
label->InitTheme.connect(
[label]{
label->setStyle(SkinTheme::instance()->styles.browserLink());
auto theme = SkinTheme::get(label);
label->setStyle(theme->styles.browserLink());
});
label->initTheme();
@ -546,7 +553,8 @@ BrowserView::BrowserView()
m_view.setExpansive(true);
m_view.InitTheme.connect(
[this]{
m_view.setStyle(SkinTheme::instance()->styles.workspaceView());
auto theme = SkinTheme::get(this);
m_view.setStyle(theme->styles.workspaceView());
});
m_view.initTheme();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -150,7 +150,8 @@ public:
: m_popup(popup)
, m_brushes(App::instance()->brushes())
, m_slot(slot) {
setIcon(SkinTheme::instance()->parts.iconArrowDown(), true);
auto theme = skin::SkinTheme::get(this);
setIcon(theme->parts.iconArrowDown(), true);
}
private:
@ -277,7 +278,8 @@ private:
class NewBrushOptionsItem : public ButtonSet::Item {
public:
NewBrushOptionsItem() {
setIcon(SkinTheme::instance()->parts.iconArrowDown(), true);
auto theme = skin::SkinTheme::get(this);
setIcon(theme->parts.iconArrowDown(), true);
}
private:

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -74,7 +74,7 @@ ButtonSet* ButtonSet::Item::buttonSet()
void ButtonSet::Item::onPaint(ui::PaintEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Graphics* g = ev.graphics();
gfx::Rect rc = clientBounds();
gfx::Color fg;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -105,7 +105,9 @@ public:
protected:
void onInitTheme(ui::InitThemeEvent& ev) {
ui::Button::onInitTheme(ev);
setStyle(skin::SkinTheme::instance()->styles.warningBox());
auto theme = skin::SkinTheme::get(this);
setStyle(theme->styles.warningBox());
}
};
@ -126,7 +128,8 @@ void ColorBar::ScrollableView::onInitTheme(InitThemeEvent& ev)
View::onInitTheme(ev);
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setStyle(theme->styles.colorbarView());
hbar->setStyle(theme->styles.miniScrollbar());
@ -183,7 +186,7 @@ ColorBar::ColorBar(int align, TooltipManager* tooltipManager)
{
m_instance = this;
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
m_editPal.addItem(theme->parts.timelineOpenPadlockActive());
m_buttons.addItem(theme->parts.palSort());
@ -290,7 +293,7 @@ ColorBar::ColorBar(int align, TooltipManager* tooltipManager)
InitTheme.connect(
[this, fgBox, bgBox]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setBorder(gfx::Border(2*guiscale(), 0, 0, 0));
setChildSpacing(2*guiscale());
@ -514,7 +517,7 @@ bool ColorBar::inEditMode() const
void ColorBar::setEditMode(bool state)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
ButtonSet::Item* item = m_editPal.getItem(0);
m_editMode = state;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -118,7 +118,9 @@ app::Color ColorButton::getColorByPosition(const gfx::Point& pos)
void ColorButton::onInitTheme(InitThemeEvent& ev)
{
ButtonBase::onInitTheme(ev);
setStyle(SkinTheme::instance()->styles.colorButton());
auto theme = SkinTheme::get(this);
setStyle(theme->styles.colorButton());
if (m_window)
m_window->initTheme();
@ -209,7 +211,8 @@ bool ColorButton::onProcessMessage(Message* msg)
case kSetCursorMessage:
if (hasCapture()) {
ui::set_mouse_cursor(kCustomCursor, SkinTheme::instance()->cursors.eyedropper());
auto theme = SkinTheme::get(this);
ui::set_mouse_cursor(kCustomCursor, theme->cursors.eyedropper());
return true;
}
break;
@ -235,7 +238,7 @@ void ColorButton::onSizeHint(SizeHintEvent& ev)
void ColorButton::onPaint(PaintEvent& ev)
{
Graphics* g = ev.graphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Rect rc = clientBounds();
gfx::Color bg = bgColor();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -71,7 +71,7 @@ public:
void onPaint(PaintEvent& ev) override {
Graphics* g = ev.graphics();
skin::SkinTheme* theme = skin::SkinTheme::instance();
auto theme = skin::SkinTheme::get(this);
gfx::Rect rc = clientBounds();
Button::onPaint(ev);
@ -96,8 +96,9 @@ public:
Item* item = new Item(colorPopup, color);
item->InitTheme.connect(
[item]{
auto theme = skin::SkinTheme::get(item);
item->setSizeHint(gfx::Size(16, 16)*ui::guiscale());
item->setStyle(skin::SkinTheme::instance()->styles.simpleColor());
item->setStyle(theme->styles.simpleColor());
});
item->initTheme();
addChild(item);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2016-2018 David Capello
//
// This program is distributed under the terms of
@ -335,7 +335,8 @@ bool ColorSelector::onProcessMessage(ui::Message* msg)
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
app::Color color = getColorByPosition(mouseMsg->position());
if (color.getType() != app::Color::MaskType) {
ui::set_mouse_cursor(kCustomCursor, SkinTheme::instance()->cursors.eyedropper());
auto theme = skin::SkinTheme::get(this);
ui::set_mouse_cursor(kCustomCursor, theme->cursors.eyedropper());
return true;
}
break;
@ -386,7 +387,7 @@ bool ColorSelector::onProcessMessage(ui::Message* msg)
void ColorSelector::onInitTheme(ui::InitThemeEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Widget::onInitTheme(ev);
setBorder(theme->calcBorder(this, theme->styles.editorView()));
@ -404,7 +405,7 @@ void ColorSelector::onResize(ui::ResizeEvent& ev)
void ColorSelector::onPaint(ui::PaintEvent& ev)
{
ui::Graphics* g = ev.graphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
theme->drawRect(g, clientBounds(),
theme->parts.editorNormal().get(),
@ -480,7 +481,7 @@ void ColorSelector::paintColorIndicator(ui::Graphics* g,
const gfx::Point& pos,
const bool white)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
os::Surface* icon = theme->parts.colorWheelIndicator()->bitmap(0);
g->drawColoredRgbaSurface(
@ -500,7 +501,7 @@ int ColorSelector::getCurrentAlphaForNewColor() const
gfx::Rect ColorSelector::bottomBarBounds() const
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
const gfx::Rect rc = childrenBounds();
const int size = theme->dimensions.colorSelectorBarSize();
if (rc.h > 2*size) {
@ -515,7 +516,7 @@ gfx::Rect ColorSelector::bottomBarBounds() const
gfx::Rect ColorSelector::alphaBarBounds() const
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
const gfx::Rect rc = childrenBounds();
const int size = theme->dimensions.colorSelectorBarSize();
if (rc.h > 3*size)

View File

@ -100,7 +100,7 @@ void ColorShades::onInitTheme(ui::InitThemeEvent& ev)
{
Widget::onInitTheme(ev);
auto theme = skin::SkinTheme::instance();
auto theme = skin::SkinTheme::get(this);
switch (m_click) {
case ClickEntries:
@ -247,7 +247,7 @@ void ColorShades::onSizeHint(ui::SizeHintEvent& ev)
void ColorShades::onPaint(ui::PaintEvent& ev)
{
auto theme = skin::SkinTheme::instance();
auto theme = skin::SkinTheme::get(this);
ui::Graphics* g = ev.graphics();
gfx::Rect bounds = clientBounds();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -360,6 +360,8 @@ void ColorSliders::addSlider(const Channel channel,
const int absMin, const int absMax,
const int relMin, const int relMax)
{
auto theme = skin::SkinTheme::get(this);
Item& item = m_items[channel];
ASSERT(!item.label);
item.label = new Label(labelText);
@ -387,7 +389,7 @@ void ColorSliders::addSlider(const Channel channel,
item.relSlider->setVisible(false);
gfx::Size sz(std::numeric_limits<int>::max(),
SkinTheme::instance()->dimensions.colorSliderHeight());
theme->dimensions.colorSliderHeight());
item.label->setMaxSize(sz);
item.box->setMaxSize(sz);
item.entry->setMaxSize(sz);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -60,7 +60,7 @@ ColorWheel::ColorWheel()
InitTheme.connect(
[this]{
SkinTheme* theme = SkinTheme::instance();
auto theme = skin::SkinTheme::get(this);
m_options.setStyle(theme->styles.colorWheelOptions());
m_bgColor = theme->colors.editorFace();
});

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -204,7 +204,7 @@ protected:
}
void onSizeHint(SizeHintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
ev.setSizeHint(Size(theme->dimensions.brushTypeWidth(),
theme->dimensions.contextBarHeight()));
}
@ -362,7 +362,7 @@ public:
protected:
void onInitTheme(InitThemeEvent& ev) override {
CheckBox::onInitTheme(ev);
setStyle(SkinTheme::instance()->styles.miniCheckBox());
setStyle(SkinTheme::get(this)->styles.miniCheckBox());
}
void onClick(Event& ev) override {
@ -378,7 +378,7 @@ protected:
class ContextBar::PaintBucketSettingsField : public ButtonSet {
public:
PaintBucketSettingsField() : ButtonSet(1) {
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
addItem(theme->parts.timelineGear());
}
@ -464,7 +464,7 @@ class ContextBar::InkTypeField : public ButtonSet {
public:
InkTypeField(ContextBar* owner) : ButtonSet(1)
, m_owner(owner) {
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
addItem(theme->parts.inkSimple());
}
@ -484,7 +484,7 @@ public:
}
void setInkTypeIcon(InkType inkType) {
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
SkinPartPtr part = theme->parts.inkSimple();
switch (inkType) {
@ -518,7 +518,7 @@ protected:
class ContextBar::InkShadesField : public HBox {
public:
InkShadesField(ColorBar* colorBar)
: m_button(SkinTheme::instance()->parts.iconArrowDown())
: m_button(SkinTheme::get(this)->parts.iconArrowDown())
, m_shade(Shade(), ColorShades::DragAndDropEntries)
, m_loaded(false) {
addChild(&m_button);
@ -569,7 +569,7 @@ public:
private:
void onInitTheme(InitThemeEvent& ev) override {
HBox::onInitTheme(ev);
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
noBorderNoChildSpacing();
m_shade.setStyle(theme->styles.topShadeView());
m_button.setBgColor(theme->colors.workspace());
@ -593,7 +593,7 @@ private:
save.Click.connect([this]{ onSaveShade(); });
if (!m_shades.empty()) {
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
menu.addChild(new MenuSeparator);
@ -610,7 +610,7 @@ private:
close->InitTheme.connect(
[close]{
close->setBgColor(
SkinTheme::instance()->colors.menuitemNormalFace());
SkinTheme::get(close)->colors.menuitemNormalFace());
});
close->initTheme();
close->Click.connect(
@ -767,7 +767,7 @@ public:
: m_icon(1)
, m_maskColor(app::Color::fromMask(), IMAGE_RGB, ColorButtonOptions())
, m_owner(owner) {
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
addChild(&m_icon);
addChild(&m_maskColor);
@ -831,7 +831,7 @@ private:
void onOpaqueChange() {
bool opaque = Preferences::instance().selection.opaque();
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
SkinPartPtr part = (opaque ? theme->parts.selectionOpaque():
theme->parts.selectionMasked());
m_icon.getItem(0)->setIcon(part);
@ -860,7 +860,7 @@ class ContextBar::PivotField : public ButtonSet {
public:
PivotField()
: ButtonSet(1) {
addItem(SkinTheme::instance()->parts.pivotCenter());
addItem(SkinTheme::get(this)->parts.pivotCenter());
Preferences::instance().selection.pivotPosition.AfterChange.connect(
[this]{ onPivotChange(); });
@ -873,7 +873,7 @@ private:
void onItemChange(Item* item) override {
ButtonSet::onItemChange(item);
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Rect bounds = this->bounds();
Menu menu;
@ -917,7 +917,7 @@ private:
}
void onPivotChange() {
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
SkinPartPtr part;
switch (Preferences::instance().selection.pivotPosition()) {
case app::gen::PivotPosition::NORTHWEST: part = theme->parts.pivotNorthwest(); break;
@ -1138,7 +1138,7 @@ public:
DynamicsField(ContextBar* ctxBar)
: ButtonSet(1)
, m_ctxBar(ctxBar) {
addItem(SkinTheme::instance()->parts.dynamics());
addItem(SkinTheme::get(this)->parts.dynamics());
}
void switchPopup() {
@ -1238,7 +1238,7 @@ public:
protected:
void onInitTheme(InitThemeEvent& ev) override {
CheckBox::onInitTheme(ev);
setStyle(SkinTheme::instance()->styles.miniCheckBox());
setStyle(SkinTheme::get(this)->styles.miniCheckBox());
}
void onClick(Event& ev) override {
@ -1266,7 +1266,7 @@ protected:
class ContextBar::GradientTypeField : public ButtonSet {
public:
GradientTypeField() : ButtonSet(2) {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
addItem(theme->parts.linearGradient());
addItem(theme->parts.radialGradient());
@ -1287,7 +1287,7 @@ public:
class ContextBar::DropPixelsField : public ButtonSet {
public:
DropPixelsField() : ButtonSet(2) {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
addItem(theme->parts.dropPixelsOk());
addItem(theme->parts.dropPixelsCancel());
@ -1371,7 +1371,7 @@ public:
protected:
void onInitTheme(InitThemeEvent& ev) override {
CheckBox::onInitTheme(ev);
setStyle(SkinTheme::instance()->styles.miniCheckBox());
setStyle(SkinTheme::get(this)->styles.miniCheckBox());
}
void onClick(Event& ev) override {
@ -1394,7 +1394,7 @@ class ContextBar::SymmetryField : public ButtonSet {
public:
SymmetryField() : ButtonSet(3) {
setMultiMode(MultiMode::Set);
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
addItem(theme->parts.horizontalSymmetry());
addItem(theme->parts.verticalSymmetry());
addItem("...");
@ -1517,7 +1517,7 @@ public:
, m_combobox(this)
, m_action(2)
{
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
m_sel.addItem("All");
m_sel.addItem("None");
@ -1794,7 +1794,7 @@ void ContextBar::onInitTheme(ui::InitThemeEvent& ev)
{
Box::onInitTheme(ev);
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Border border = this->border();
border.bottom(2*guiscale());
setBorder(border);
@ -1806,7 +1806,7 @@ void ContextBar::onInitTheme(ui::InitThemeEvent& ev)
void ContextBar::onSizeHint(SizeHintEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
ev.setSizeHint(gfx::Size(0, theme->dimensions.contextBarHeight()));
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2021 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -247,7 +247,7 @@ DataRecoveryView::DataRecoveryView(crash::DataRecovery* dataRecovery)
InitTheme.connect(
[this, hbox]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
m_openButton.mainButton()->resetSizeHint();
gfx::Size hint = m_openButton.mainButton()->sizeHint();
@ -330,7 +330,8 @@ void DataRecoveryView::fillListWith(const bool crashes)
Strings::recover_files_old_sessions()), HORIZONTAL);
sep->InitTheme.connect(
[sep]{
sep->setStyle(skin::SkinTheme::instance()->styles.separatorInViewReverse());
auto theme = skin::SkinTheme::get(sep);
sep->setStyle(theme->styles.separatorInViewReverse());
sep->setBorder(sep->border() + gfx::Border(0, 8, 0, 8)*guiscale());
});
sep->initTheme();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -89,7 +89,7 @@ DevConsoleView::DevConsoleView()
InitTheme.connect(
[this]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
m_view.setStyle(theme->styles.workspaceView());
});
initTheme();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2021 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2017 David Capello
//
// This program is distributed under the terms of
@ -130,7 +130,7 @@ private:
void onPaint(PaintEvent& ev) override {
Graphics* g = ev.graphics();
skin::SkinTheme* theme = static_cast<skin::SkinTheme*>(this->theme());
auto theme = skin::SkinTheme::get(this);
gfx::Color fg, bg;
if (isSelected()) {

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -35,7 +36,7 @@ DropDownButton::DropDownButton(const char* text)
InitTheme.connect(
[this]{
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
m_button->setStyle(theme->styles.dropDownButton());
m_dropDown->setStyle(theme->styles.dropDownExpandButton());
setChildSpacing(0);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -67,7 +67,7 @@ public:
private:
void onInitTheme(InitThemeEvent& ev) override {
Widget::onInitTheme(ev);
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setBorder(
gfx::Border(
theme->parts.miniSliderEmpty()->bitmapW()->width(),
@ -84,7 +84,7 @@ private:
void onPaint(PaintEvent& ev) override {
Graphics* g = ev.graphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Rect rc = clientBounds();
gfx::Color bgcolor = bgColor();
g->fillRect(bgcolor, rc);
@ -309,7 +309,7 @@ tools::DynamicsOptions DynamicsPopup::getDynamics() const
void DynamicsPopup::setCheck(int i, bool state)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
m_dynamics->values()
->getItem(i)
->setIcon(state ? theme->parts.dropPixelsOk(): nullptr);
@ -317,7 +317,7 @@ void DynamicsPopup::setCheck(int i, bool state)
bool DynamicsPopup::isCheck(int i) const
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
return (m_dynamics->values()
->getItem(i)
->icon() == theme->parts.dropPixelsOk());
@ -325,7 +325,7 @@ bool DynamicsPopup::isCheck(int i) const
void DynamicsPopup::onValuesChange(ButtonSet::Item* item)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
const skin::SkinPartPtr& ok = theme->parts.dropPixelsOk();
const int i = (item ? m_dynamics->values()->getItemIndex(item): -1);

View File

@ -293,8 +293,9 @@ void DrawingState::onCommitMouseMove(Editor* editor,
bool DrawingState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
{
if (m_toolLoop->getInk()->isEyedropper()) {
auto theme = skin::SkinTheme::get(editor);
editor->showMouseCursor(
kCustomCursor, skin::SkinTheme::instance()->cursors.eyedropper());
kCustomCursor, theme->cursors.eyedropper());
}
else {
editor->showBrushPreview(mouseScreenPos);

View File

@ -826,7 +826,7 @@ void Editor::drawBackground(ui::Graphics* g)
if (!(m_flags & kShowOutside))
return;
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Size canvas = canvasSize();
gfx::Rect rc(0, 0, canvas.w, canvas.h);
@ -1099,7 +1099,7 @@ void Editor::drawSlices(ui::Graphics* g)
if (!isVisible() || !m_document)
return;
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Point mainOffset(mainTilePosition());
for (auto slice : m_sprite->slices()) {
@ -2142,7 +2142,7 @@ void Editor::onPaint(ui::PaintEvent& ev)
Graphics* g = ev.graphics();
gfx::Rect rc = clientBounds();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
// Editor without sprite
if (!m_sprite) {

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -46,7 +46,7 @@ EditorView::EditorView(EditorView::Type type)
InitTheme.connect(
[this]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setBgColor(gfx::rgba(0, 0, 0)); // TODO Move this color to theme.xml
setStyle(theme->styles.editorView());
setupScrollbars();
@ -148,7 +148,7 @@ void EditorView::setupScrollbars()
hideScrollBars();
}
else {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
int barsize = theme->dimensions.miniScrollbarSize();
horizontalBar()->setBarWidth(barsize);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2017-2018 David Capello
//
// This program is distributed under the terms of
@ -144,8 +144,9 @@ bool MovingSelectionState::onMouseMove(Editor* editor, MouseMessage* msg)
bool MovingSelectionState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
{
auto theme = skin::SkinTheme::get(editor);
editor->showMouseCursor(
kCustomCursor, skin::SkinTheme::instance()->cursors.moveSelection());
kCustomCursor, theme->cursors.moveSelection());
return true;
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -170,8 +170,9 @@ bool PlayState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
tools::Ink* ink = editor->getCurrentEditorInk();
if (ink) {
if (ink->isZoom()) {
auto theme = skin::SkinTheme::get(editor);
editor->showMouseCursor(
kCustomCursor, skin::SkinTheme::instance()->cursors.magnifier());
kCustomCursor, theme->cursors.magnifier());
return true;
}
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -323,8 +323,9 @@ void SelectBoxState::postRenderDecorator(EditorPostRender* render)
vp = editor->screenToEditor(vp);
// Paint a grid generated by the box
const gfx::Color rulerColor = skin::SkinTheme::instance()->colors.selectBoxRuler();
const gfx::Color gridColor = skin::SkinTheme::instance()->colors.selectBoxGrid();
auto theme = skin::SkinTheme::get(editor);
const gfx::Color rulerColor = theme->colors.selectBoxRuler();
const gfx::Color gridColor = theme->colors.selectBoxGrid();
const gfx::Point mainOffset = editor->mainTilePosition();
gfx::Rect rc = getBoxBounds();
gfx::Size padding;

View File

@ -411,12 +411,14 @@ bool StandbyState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
if (m_decorator->onSetCursor(ink, editor, mouseScreenPos))
return true;
auto theme = skin::SkinTheme::get(editor);
if (ink) {
// If the current tool change selection (e.g. rectangular marquee, etc.)
if (ink->isSelection()) {
if (overSelectionEdges(editor, mouseScreenPos)) {
editor->showMouseCursor(
kCustomCursor, skin::SkinTheme::instance()->cursors.moveSelection());
kCustomCursor, theme->cursors.moveSelection());
return true;
}
@ -435,12 +437,12 @@ bool StandbyState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
}
else if (ink->isEyedropper()) {
editor->showMouseCursor(
kCustomCursor, skin::SkinTheme::instance()->cursors.eyedropper());
kCustomCursor, theme->cursors.eyedropper());
return true;
}
else if (ink->isZoom()) {
editor->showMouseCursor(
kCustomCursor, skin::SkinTheme::instance()->cursors.magnifier());
kCustomCursor, theme->cursors.magnifier());
return true;
}
else if (ink->isScrollMovement()) {
@ -906,7 +908,7 @@ bool StandbyState::Decorator::onSetCursor(tools::Ink* ink, Editor* editor, const
editor->document()->isMaskVisible() &&
(!Preferences::instance().selection.modifiersDisableHandles() ||
os::instance()->keyModifiers() == kKeyNoneModifier)) {
auto theme = skin::SkinTheme::instance();
auto theme = skin::SkinTheme::get(editor);
const Transformation transformation(m_standbyState->getTransformation(editor));
TransformHandles* tr = getTransformHandles(editor);
HandleType handle = tr->getHandleAtPoint(
@ -1040,7 +1042,7 @@ void StandbyState::Decorator::postRenderDecorator(EditorPostRender* render)
// Draw transformation handles (if the mask is visible and isn't frozen).
Handles handles;
if (StandbyState::Decorator::getSymmetryHandles(editor, handles)) {
skin::SkinTheme* theme = static_cast<skin::SkinTheme*>(ui::get_theme());
auto theme = skin::SkinTheme::get(editor);
os::Surface* part = theme->parts.transformationHandle()->bitmap(0);
ScreenGraphics g(editor->display());
for (const auto& handle : handles)
@ -1071,7 +1073,7 @@ bool StandbyState::Decorator::getSymmetryHandles(Editor* editor, Handles& handle
gfx::Rect canvasBounds(gfx::Point(0, 0),
editor->canvasSize());
gfx::RectF editorViewport(View::getView(editor)->viewportBounds());
skin::SkinTheme* theme = static_cast<skin::SkinTheme*>(ui::get_theme());
auto theme = skin::SkinTheme::get(editor);
os::Surface* part = theme->parts.transformationHandle()->bitmap(0);
if (int(mode) & int(app::gen::SymmetryMode::HORIZONTAL)) {

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -55,7 +55,7 @@ static struct HandlesInfo {
HandleType TransformHandles::getHandleAtPoint(Editor* editor, const gfx::Point& pt, const Transformation& transform)
{
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(editor);
os::Surface* gfx = theme->parts.transformationHandle()->bitmap(0);
double angle = transform.angle();
@ -132,7 +132,7 @@ void TransformHandles::drawHandles(Editor* editor, ui::Graphics* g,
}
// Mouse active areas
{
auto theme = SkinTheme::instance();
auto theme = SkinTheme::get(editor);
auto gfx = theme->parts.transformationHandle()->bitmap(0);
int handle_rs[2] = { gfx->width()*2, gfx->width()*3 };
@ -153,7 +153,7 @@ void TransformHandles::drawHandles(Editor* editor, ui::Graphics* g,
// Draw corner handle
for (size_t c=0; c<HANDLES; ++c) {
drawHandle(
g,
editor, g,
(screenPoints[handles_info[c].i1].x+screenPoints[handles_info[c].i2].x)/2 - origin.x,
(screenPoints[handles_info[c].i1].y+screenPoints[handles_info[c].i2].y)/2 - origin.y,
angle + handles_info[c].angle);
@ -162,7 +162,7 @@ void TransformHandles::drawHandles(Editor* editor, ui::Graphics* g,
// Draw the pivot
if (visiblePivot(angle)) {
gfx::Rect pivotBounds = getPivotHandleBounds(editor, transform, corners);
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(editor);
os::Surface* part = theme->parts.pivotHandle()->bitmap(0);
g->drawRgbaSurface(part,
@ -173,7 +173,7 @@ void TransformHandles::drawHandles(Editor* editor, ui::Graphics* g,
void TransformHandles::invalidateHandles(Editor* editor, const Transformation& transform)
{
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(editor);
double angle = transform.angle();
auto corners = transform.transformedCorners();
@ -207,7 +207,7 @@ gfx::Rect TransformHandles::getPivotHandleBounds(Editor* editor,
const Transformation& transform,
const Transformation::Corners& corners)
{
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(editor);
gfx::Size partSize = theme->parts.pivotHandle()->size();
gfx::Point screenPivotPos = editor->editorToScreen(gfx::Point(transform.pivot()));
@ -229,9 +229,9 @@ bool TransformHandles::inHandle(const gfx::Point& pt, int x, int y, int gfx_w, i
pt.y >= y && pt.y < y+gfx_h);
}
void TransformHandles::drawHandle(Graphics* g, int x, int y, double angle)
void TransformHandles::drawHandle(Editor* editor, Graphics* g, int x, int y, double angle)
{
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(editor);
os::Surface* part = theme->parts.transformationHandle()->bitmap(0);
adjustHandle(x, y, part->width(), part->height(), angle);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -40,7 +40,7 @@ namespace app {
const Transformation::Corners& corners);
bool inHandle(const gfx::Point& pt, int x, int y, int gfx_w, int gfx_h, double angle);
void drawHandle(ui::Graphics* g, int x, int y, double angle);
void drawHandle(Editor* editor, ui::Graphics* g, int x, int y, double angle);
void adjustHandle(int& x, int& y, int handle_w, int handle_h, double angle);
bool visiblePivot(double angle) const;
void getScreenPoints(

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2021 Igara Studio S.A.
// Copyright (C) 2021-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -83,8 +83,9 @@ bool ZoomingState::onMouseMove(Editor* editor, MouseMessage* msg)
bool ZoomingState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
{
auto theme = skin::SkinTheme::get(editor);
editor->showMouseCursor(
kCustomCursor, skin::SkinTheme::instance()->cursors.magnifier());
kCustomCursor, theme->cursors.magnifier());
return true;
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -423,7 +423,7 @@ bool FileList::onProcessMessage(Message* msg)
void FileList::onPaint(ui::PaintEvent& ev)
{
Graphics* g = ev.graphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Rect bounds = clientBounds();
g->fillRect(theme->colors.background(), bounds);
@ -442,8 +442,17 @@ void FileList::onPaint(ui::PaintEvent& ev)
// Paint main selected index (so if the filename label is bigger it
// will appear over other items).
if (m_selected)
paintItem(g, m_selected, selectedIndex);
if (m_selected) {
ASSERT(selectedIndex >= 0);
if (selectedIndex >= 0)
paintItem(g, m_selected, selectedIndex);
else {
// Strange run-time state where the "m_selected" is not in the
// list. The previous assert should fail on Debug so this is
// here only for Release mode.
return;
}
}
// Draw main thumbnail for the selected item when there are no
// thumbnails per item.
@ -468,7 +477,7 @@ void FileList::paintItem(ui::Graphics* g, IFileItem* fi, const int i)
if ((g->getClipBounds() & info.bounds).isEmpty())
return;
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
const bool evenRow = ((i & 1) == 0);
gfx::Rect tbounds = info.thumbnail;
@ -745,7 +754,7 @@ FileList::ItemInfo FileList::calcFileItemInfo(int i) const
int len = 0;
if (fi->isFolder() && isListView()) {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
len += theme->parts.folderIconSmall()->bitmap(0)->width() + 2*guiscale();
}
@ -778,6 +787,16 @@ FileList::ItemInfo FileList::calcFileItemInfo(int i) const
return info;
}
FileList::ItemInfo FileList::getFileItemInfo(int i) const
{
ASSERT(i >= 0 && i < int(m_info.size()));
if (i >= 0 && i < int(m_info.size()))
return m_info[i];
else
return ItemInfo();
}
void FileList::makeSelectedFileitemVisible()
{
int i = selectedIndex();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -84,7 +84,7 @@ namespace app {
void onMonitoringTick();
void recalcAllFileItemInfo();
ItemInfo calcFileItemInfo(int i) const;
ItemInfo getFileItemInfo(int i) const { return m_info[i]; }
ItemInfo getFileItemInfo(int i) const;
void makeSelectedFileitemVisible();
void regenerateList();
int selectedIndex() const;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -94,7 +94,7 @@ void FilenameField::onInitTheme(ui::InitThemeEvent& ev)
HBox::onInitTheme(ev);
setChildSpacing(0);
auto theme = skin::SkinTheme::instance();
auto theme = skin::SkinTheme::get(this);
ui::Style* style = theme->styles.miniButton();
if (style)
m_button.setStyle(style);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -101,7 +101,7 @@ private:
if (!listbox)
return;
app::skin::SkinTheme* theme = app::skin::SkinTheme::instance();
auto theme = app::skin::SkinTheme::get(this);
gfx::Color color = theme->colors.text();
try {

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2021 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -90,7 +90,7 @@ HomeView::HomeView()
InitTheme.connect(
[this]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setBgColor(theme->colors.workspace());
setChildSpacing(8 * guiscale());
});
@ -112,7 +112,7 @@ void HomeView::dataRecoverySessionsAreReady()
#ifdef ENABLE_DATA_RECOVERY
if (App::instance()->dataRecovery()->hasRecoverySessions()) {
// We highlight the "Recover Files" options because we came from a crash
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
recoverSprites()->setStyle(theme->styles.workspaceUpdateLink());
layout();
}
@ -231,7 +231,7 @@ void HomeView::onNewUpdate(const std::string& url, const std::string& version)
checkUpdate()->setVisible(true);
checkUpdate()->InitTheme.connect(
[this]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
checkUpdate()->setStyle(theme->styles.workspaceUpdateLink());
});
checkUpdate()->initTheme();
@ -257,7 +257,7 @@ void HomeView::onRecoverSprites()
// it).
m_dataRecoveryView->Empty.connect(
[this]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
recoverSprites()->setStyle(theme->styles.workspaceLink());
layout();
});

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -32,7 +33,9 @@ IconButton::IconButton(const SkinPartPtr& part)
void IconButton::onInitTheme(InitThemeEvent& ev)
{
Button::onInitTheme(ev);
setBgColor(SkinTheme::instance()->colors.menuitemNormalFace());
auto theme = SkinTheme::get(this);
setBgColor(theme->colors.menuitemNormalFace());
}
void IconButton::onSizeHint(SizeHintEvent& ev)
@ -45,7 +48,7 @@ void IconButton::onSizeHint(SizeHintEvent& ev)
void IconButton::onPaint(PaintEvent& ev)
{
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
Graphics* g = ev.graphics();
gfx::Color fg, bg;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -129,7 +129,7 @@ public:
protected:
void onSizeHint(SizeHintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
ui::Style* style = theme->styles.newsItem();
setTextQuiet(m_title);
@ -142,7 +142,7 @@ protected:
}
void onPaint(PaintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Graphics* g = ev.graphics();
gfx::Rect bounds = clientBounds();
ui::Style* style = theme->styles.newsItem();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -41,7 +41,7 @@ private:
Notifications::Notifications()
: Button("")
, m_flagStyle(skin::SkinTheme::instance()->styles.flag())
, m_flagStyle(skin::SkinTheme::get(this)->styles.flag())
, m_red(false)
{
}

View File

@ -782,7 +782,7 @@ bool PaletteView::onProcessMessage(Message* msg)
void PaletteView::onPaint(ui::PaintEvent& ev)
{
auto theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
const int outlineWidth = theme->dimensions.paletteOutlineWidth();
ui::Graphics* g = ev.graphics();
gfx::Rect bounds = clientBounds();
@ -1067,7 +1067,7 @@ gfx::Rect PaletteView::getPaletteEntryBounds(int index) const
PaletteView::Hit PaletteView::hitTest(const gfx::Point& pos)
{
auto theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
const int outlineWidth = theme->dimensions.paletteOutlineWidth();
const int size = m_adapter->size();
@ -1337,7 +1337,7 @@ int PaletteView::boxSizePx() const
void PaletteView::updateBorderAndChildSpacing()
{
auto theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
const int dim = theme->dimensions.paletteEntriesSeparator();
setBorder(gfx::Border(dim));
setChildSpacing(m_withSeparator ? dim: 0);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -60,7 +60,7 @@ class PalettesListItem : public ResourceListItem {
class CommentButton : public IconButton {
public:
CommentButton(const std::string& comment)
: IconButton(SkinTheme::instance()->parts.iconUserData())
: IconButton(SkinTheme::get(this)->parts.iconUserData())
, m_comment(comment) {
setFocusStop(false);
initTheme();
@ -69,8 +69,9 @@ class PalettesListItem : public ResourceListItem {
private:
void onInitTheme(InitThemeEvent& ev) override {
IconButton::onInitTheme(ev);
setBgColor(
SkinTheme::instance()->colors.listitemNormalFace());
auto theme = SkinTheme::get(this);
setBgColor(theme->colors.listitemNormalFace());
}
void onClick(Event& ev) override {
@ -151,8 +152,9 @@ void PalettesListBox::onResourceChange(Resource* resource)
void PalettesListBox::onPaintResource(Graphics* g, gfx::Rect& bounds, Resource* resource)
{
auto theme = SkinTheme::get(this);
doc::Palette* palette = static_cast<PaletteResource*>(resource)->palette();
os::Surface* tick = SkinTheme::instance()->parts.checkSelected()->bitmap(0);
os::Surface* tick = theme->parts.checkSelected()->bitmap(0);
// Draw tick (to say "this palette matches the active sprite
// palette").

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -55,11 +55,13 @@ public:
protected:
void onInitTheme(ui::InitThemeEvent& ev) override {
CheckBox::onInitTheme(ev);
setStyle(SkinTheme::instance()->styles.windowCenterButton());
auto theme = SkinTheme::get(this);
setStyle(theme->styles.windowCenterButton());
}
void onSetDecorativeWidgetBounds() override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Widget* window = parent();
gfx::Rect rect(0, 0, 0, 0);
gfx::Size centerSize = this->sizeHint();
@ -121,7 +123,7 @@ private:
}
void onSetDecorativeWidgetBounds() override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Widget* window = parent();
gfx::Rect rect(0, 0, 0, 0);
gfx::Size playSize = this->sizeHint();
@ -164,7 +166,7 @@ private:
}
void setupIcons() {
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
if (m_isPlaying)
setStyle(theme->styles.windowStopButton());
else
@ -225,7 +227,7 @@ bool PreviewEditorWindow::onProcessMessage(ui::Message* msg)
Display* mainDisplay = manager->display();
gfx::Rect defaultBounds(mainDisplay->size() / 4);
SkinTheme* theme = SkinTheme::instance();
auto theme = SkinTheme::get(this);
gfx::Rect mainWindow = manager->bounds();
int extra = theme->dimensions.miniScrollbarSize();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -67,11 +67,12 @@ public:
protected:
void onInitTheme(InitThemeEvent& ev) override {
LinkLabel::onInitTheme(ev);
setStyle(SkinTheme::instance()->styles.recentItem());
auto theme = SkinTheme::get(this);
setStyle(theme->styles.recentItem());
}
void onSizeHint(SizeHintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
ui::Style* style = theme->styles.recentFile();
ui::Style* styleDetail = theme->styles.recentFileDetail();
@ -132,7 +133,7 @@ protected:
}
void onPaint(PaintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Graphics* g = ev.graphics();
gfx::Rect bounds = clientBounds();
ui::Style* style = theme->styles.recentFile();
@ -204,7 +205,7 @@ protected:
private:
gfx::Rect pinBounds(const gfx::Rect& bounds) {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
ui::Style* pinStyle = theme->styles.recentFilePin();
ui::View* view = View::getView(parent());
const gfx::Size pinSize = theme->calcSizeHint(this, pinStyle);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -46,7 +46,7 @@ bool ResourceListItem::onProcessMessage(ui::Message* msg)
void ResourceListItem::onPaint(PaintEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Graphics* g = ev.graphics();
gfx::Rect bounds = clientBounds();
gfx::Color bgcolor, fgcolor;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (c) 2020 Igara Studio S.A.
// Copyright (c) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2015 David Capello
//
// This program is distributed under the terms of
@ -52,7 +52,7 @@ bool SearchEntry::onProcessMessage(ui::Message* msg)
void SearchEntry::onPaint(ui::PaintEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
theme->paintEntry(ev);
os::Surface* icon = theme->parts.iconSearch()->bitmap(0);
@ -76,7 +76,7 @@ void SearchEntry::onSizeHint(SizeHintEvent& ev)
Entry::onSizeHint(ev);
Size sz = ev.sizeHint();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
auto icon = theme->parts.iconSearch()->bitmap(0);
sz.h = std::max(sz.h, icon->height()+border().height());
@ -85,7 +85,7 @@ void SearchEntry::onSizeHint(SizeHintEvent& ev)
Rect SearchEntry::onGetEntryTextBounds() const
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Rect bounds = Entry::onGetEntryTextBounds();
auto icon1 = theme->parts.iconSearch()->bitmap(0);
auto icon2 = theme->parts.iconClose()->bitmap(0);
@ -96,7 +96,7 @@ Rect SearchEntry::onGetEntryTextBounds() const
Rect SearchEntry::getCloseIconBounds() const
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Rect bounds = clientBounds();
auto icon = theme->parts.iconClose()->bitmap(0);
bounds.x += bounds.w - border().right() - childSpacing() - icon->width();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -22,7 +22,7 @@ using namespace ui;
SelectionModeField::SelectionModeField()
: ButtonSet(4)
{
auto theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
addItem(theme->parts.selectionReplace());
addItem(theme->parts.selectionAdd());

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2022 Igara Studio S.A.
// Copyright (C) 2017 David Capello
//
// This program is distributed under the terms of
@ -20,7 +21,8 @@ public:
: Separator(text, align) {
InitTheme.connect(
[this]{
setStyle(skin::SkinTheme::instance()->styles.separatorInView());
auto theme = skin::SkinTheme::get(this);
setStyle(theme->styles.separatorInView());
if (this->text().empty())
setBorder(border() + gfx::Border(0, 2, 0, 2)*ui::guiscale());
});

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2021 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -217,7 +217,19 @@ static FontData* load_font(std::map<std::string, FontData*>& fonts,
// static
SkinTheme* SkinTheme::instance()
{
return static_cast<SkinTheme*>(ui::Manager::getDefault()->theme());
if (auto mgr = ui::Manager::getDefault())
return SkinTheme::get(mgr);
else
return nullptr;
}
// static
SkinTheme* SkinTheme::get(const ui::Widget* widget)
{
ASSERT(widget);
ASSERT(widget->theme());
ASSERT(dynamic_cast<SkinTheme*>(widget->theme()));
return static_cast<SkinTheme*>(widget->theme());
}
SkinTheme::SkinTheme()
@ -930,7 +942,7 @@ void SkinTheme::initWidget(Widget* widget)
if (TipWindow* window = dynamic_cast<TipWindow*>(widget)) {
window->setStyle(styles.tooltipWindow());
window->setArrowStyle(styles.tooltipWindowArrow());
window->textBox()->setStyle(SkinTheme::instance()->styles.tooltipText());
window->textBox()->setStyle(styles.tooltipText());
}
else if (dynamic_cast<TransparentPopupWindow*>(widget)) {
widget->setStyle(styles.transparentPopupWindow());
@ -952,11 +964,11 @@ void SkinTheme::initWidget(Widget* widget)
break;
case kWindowTitleLabelWidget:
widget->setStyle(SkinTheme::instance()->styles.windowTitleLabel());
widget->setStyle(styles.windowTitleLabel());
break;
case kWindowCloseButtonWidget:
widget->setStyle(SkinTheme::instance()->styles.windowCloseButton());
widget->setStyle(styles.windowCloseButton());
break;
default:
@ -1030,8 +1042,10 @@ public:
gfx::Color& fg,
gfx::Color& bg,
const gfx::Rect& charBounds) override {
auto theme = SkinTheme::get(m_widget);
// Normal text
auto& colors = SkinTheme::instance()->colors;
auto& colors = theme->colors;
bg = ColorNone;
fg = colors.text();
@ -1081,7 +1095,8 @@ public:
m_index == m_caret &&
m_widget->hasFocus() &&
m_widget->isEnabled()) {
SkinTheme::instance()->drawEntryCaret(
auto theme = SkinTheme::get(m_widget);
theme->drawEntryCaret(
m_graphics, m_widget,
m_charStartX-m_widget->bounds().x, m_y);
m_caretDrawn = true;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -42,6 +42,7 @@ namespace app {
static const char* kThemesFolderName;
static SkinTheme* instance();
static SkinTheme* get(const ui::Widget* widget);
SkinTheme();
~SkinTheme();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -80,7 +80,7 @@ public:
InitTheme.connect(
[this]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
ui::Style* style = theme->styles.workspaceLink();
noBorderNoChildSpacing();
m_label.setStyle(style);
@ -132,7 +132,7 @@ class StatusBar::Indicators : public HBox {
private:
void onPaint(ui::PaintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Color textColor = theme->colors.statusBarText();
Rect rc = clientBounds();
Graphics* g = ev.graphics();
@ -178,7 +178,7 @@ class StatusBar::Indicators : public HBox {
}
void onPaint(ui::PaintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Color textColor = theme->colors.statusBarText();
Rect rc = clientBounds();
Graphics* g = ev.graphics();
@ -374,10 +374,11 @@ public:
void showBackupIcon(BackupIcon icon) {
m_backupIcon = icon;
if (m_backupIcon != BackupIcon::None) {
auto theme = SkinTheme::get(this);
SkinPartPtr part =
(m_backupIcon == BackupIcon::Normal ?
SkinTheme::instance()->parts.iconSave():
SkinTheme::instance()->parts.iconSaveSmall());
theme->parts.iconSave():
theme->parts.iconSaveSmall());
m_rightArea.setVisible(true);
if (m_rightArea.children().empty()) {
@ -428,7 +429,7 @@ public:
}
IndicatorsGeneration& add(const char* text) {
auto theme = SkinTheme::instance();
auto theme = SkinTheme::get(m_indicators);
for (auto i = text; *i; ) {
// Icon
@ -471,7 +472,7 @@ public:
}
IndicatorsGeneration& add(const app::Color& color) {
auto theme = SkinTheme::instance();
auto theme = SkinTheme::get(m_indicators);
// Eyedropper icon
add(theme->getToolPart("eyedropper"), false);
@ -491,7 +492,7 @@ public:
}
IndicatorsGeneration& add(doc::tile_t tile) {
auto theme = SkinTheme::instance();
auto theme = SkinTheme::get(m_indicators);
// Eyedropper icon
add(theme->getToolPart("eyedropper"), false);
@ -529,7 +530,7 @@ public:
}
IndicatorsGeneration& add(tools::Tool* tool) {
auto theme = SkinTheme::instance();
auto theme = SkinTheme::get(m_indicators);
// Tool icon + text
add(theme->getToolPart(tool->getId().c_str()), false);
@ -902,7 +903,7 @@ void StatusBar::onInitTheme(ui::InitThemeEvent& ev)
{
HBox::onInitTheme(ev);
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setBgColor(theme->colors.statusBarFace());
setBorder(gfx::Border(6*guiscale(), 0, 6*guiscale(), 0));
setMinSize(Size(0, textHeight()+8*guiscale()));

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -149,7 +149,7 @@ void Tabs::removeTab(TabView* tabView, bool with_animation)
void Tabs::updateTabs()
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
double availWidth = bounds().w - m_border*ui::guiscale();
double defTabWidth = theme->dimensions.tabsWidth();
double tabWidth = defTabWidth;
@ -465,7 +465,7 @@ bool Tabs::onProcessMessage(Message* msg)
void Tabs::onInitTheme(ui::InitThemeEvent& ev)
{
Widget::onInitTheme(ev);
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
if (m_docked) {
m_tabsHeight = theme->dimensions.dockedTabsHeight();
@ -481,7 +481,7 @@ void Tabs::onInitTheme(ui::InitThemeEvent& ev)
void Tabs::onPaint(PaintEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
Graphics* g = ev.graphics();
gfx::Rect rect = clientBounds();
gfx::Rect box(rect.x, rect.y, rect.w,
@ -580,7 +580,7 @@ void Tabs::drawTab(Graphics* g, const gfx::Rect& _box,
if (box.w < ui::guiscale()*8)
box.w = ui::guiscale()*8;
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
int clipTextRightSide;
gfx::Rect closeBox = getTabCloseButtonBounds(tab, box);
@ -706,7 +706,7 @@ void Tabs::drawTab(Graphics* g, const gfx::Rect& _box,
void Tabs::drawFiller(ui::Graphics* g, const gfx::Rect& box)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
gfx::Rect rect = clientBounds();
theme->paintWidgetPart(
@ -787,7 +787,7 @@ void Tabs::calculateHot()
gfx::Rect Tabs::getTabCloseButtonBounds(Tab* tab, const gfx::Rect& box)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
int iconW = theme->dimensions.tabsCloseIconWidth();
int iconH = theme->dimensions.tabsCloseIconHeight();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -66,7 +66,7 @@ TaskWidget::TaskWidget(const Type type,
InitTheme.connect(
[this]{
auto theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setTransparent(true);
setBgColor(gfx::ColorNone);
m_cancelButton.setTransparent(true);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (c) 2020-2021 Igara Studio S.A.
// Copyright (c) 2020-2022 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -73,7 +73,7 @@ doc::tile_t TileButton::getTileByPosition(const gfx::Point& pos)
void TileButton::onInitTheme(InitThemeEvent& ev)
{
ButtonBase::onInitTheme(ev);
setStyle(SkinTheme::instance()->styles.colorButton());
setStyle(SkinTheme::get(this)->styles.colorButton());
}
bool TileButton::onProcessMessage(Message* msg)
@ -131,7 +131,8 @@ bool TileButton::onProcessMessage(Message* msg)
case kSetCursorMessage:
if (hasCapture()) {
ui::set_mouse_cursor(kCustomCursor, SkinTheme::instance()->cursors.eyedropper());
auto theme = SkinTheme::get(this);
ui::set_mouse_cursor(kCustomCursor, theme->cursors.eyedropper());
return true;
}
break;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -42,7 +42,7 @@ enum AniAction {
AniControls::AniControls(TooltipManager* tooltipManager)
: ButtonSet(5)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
addItem(theme->parts.aniFirst());
addItem(theme->parts.aniPrevious());
@ -61,14 +61,14 @@ AniControls::AniControls(TooltipManager* tooltipManager)
InitTheme.connect(
[this]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setBgColor(theme->colors.workspace());
});
}
void AniControls::updateUsingEditor(Editor* editor)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
getItem(ACTION_PLAY)->setIcon(
(editor && editor->isPlaying() ?
theme->parts.aniStop():

View File

@ -1573,7 +1573,7 @@ void Timeline::onInitTheme(ui::InitThemeEvent& ev)
{
Widget::onInitTheme(ev);
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
int barsize = theme->dimensions.miniScrollbarSize();
m_hbar.setBarWidth(barsize);
m_vbar.setBarWidth(barsize);
@ -4104,7 +4104,7 @@ DocumentPreferences& Timeline::docPref() const
skin::SkinTheme* Timeline::skinTheme() const
{
return static_cast<SkinTheme*>(theme());
return SkinTheme::get(this);
}
gfx::Size Timeline::celBoxSize() const

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -66,7 +66,7 @@ private:
static Size getToolIconSize(Widget* widget)
{
SkinTheme* theme = static_cast<SkinTheme*>(widget->theme());
auto theme = SkinTheme::get(widget);
os::Surface* icon = theme->getToolIcon("configuration");
if (icon)
return Size(icon->width(), icon->height());
@ -296,7 +296,7 @@ void ToolBar::onPaint(ui::PaintEvent& ev)
{
gfx::Rect bounds = clientBounds();
Graphics* g = ev.graphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
ToolBox* toolbox = App::instance()->toolBox();
Tool* activeTool = App::instance()->activeTool();
ToolGroupList::iterator it = toolbox->begin_group();
@ -701,7 +701,7 @@ void ToolBar::ToolStrip::onSizeHint(SizeHintEvent& ev)
void ToolBar::ToolStrip::onPaint(PaintEvent& ev)
{
Graphics* g = ev.graphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
ToolBox* toolbox = App::instance()->toolBox();
Tool* activeTool = App::instance()->activeTool();
Rect toolrc;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -47,7 +47,7 @@ Workspace::Workspace()
InitTheme.connect(
[this]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setBgColor(theme->colors.workspace());
});
initTheme();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -51,7 +51,7 @@ WorkspacePanel::WorkspacePanel(PanelType panelType)
enableFlags(IGNORE_MOUSE);
InitTheme.connect(
[this]{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
auto theme = SkinTheme::get(this);
setBgColor(theme->colors.workspace());
});
initTheme();
@ -282,7 +282,8 @@ DropViewAtResult WorkspacePanel::dropViewAt(const gfx::Point& pos, WorkspacePane
splitter->setExpansive(true);
splitter->InitTheme.connect(
[splitter]{
splitter->setStyle(SkinTheme::instance()->styles.workspaceSplitter());
auto theme = SkinTheme::get(splitter);
splitter->setStyle(theme->styles.workspaceSplitter());
});
splitter->initTheme();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -655,7 +655,7 @@ void WidgetLoader::fillWidgetWithXmlElementAttributes(const TiXmlElement* elem,
std::string styleIdStr = styleid;
widget->InitTheme.connect(
[widget, styleIdStr]{
SkinTheme* theme = static_cast<SkinTheme*>(widget->theme());
auto theme = SkinTheme::get(widget);
ui::Style* style = theme->getStyleById(styleIdStr);
if (style)
widget->setStyle(style);