61 Commits

Author SHA1 Message Date
Christian Kaiser
261cb59da1 *WIP* TextEdit implementation 2025-02-28 10:30:01 -03:00
David Capello
09538f9a1a clang-format all files 2024-12-16 14:52:19 -03:00
David Capello
a71909d0ca Add a simple ui::Theme impl
Now ui::Theme is not an abstract class anymore and can be used for
simple tests/benchmarks. Some member functions are empty, but can be
implemented later if needed.
2024-11-30 09:38:04 -03:00
David Capello
ab599c5863 Simplify Font ptrs management in ui-lib returning FontRefs
We can return "const text::FontRef&" to avoid adding a new reference
to an existing FontRef just to access a Style/Widget font.
2024-11-30 09:38:04 -03:00
David Capello
7e780bf3bf Move Theme::fontMgr() impl from app-lib to ui-lib 2024-11-30 09:38:04 -03:00
David Capello
3f591aa5df Try to use TextBlobs to paint ui::Style's text layers 2024-11-30 09:34:51 -03:00
David Capello
ab18cd986c Update to new laf draw_text() API
As the new text::draw_text() can draw text with "native" (Skia) fonts,
we have to pass the font manager (text::FontMgr) to it, which is in
SkiaTheme. So we've added a new abstract fontMgr() member function to
ui::Theme to get the active font manager.
2024-03-07 19:23:38 -03:00
David Capello
4cfb3cfa3f Merge branch 'main' into beta 2024-03-05 19:22:23 -03:00
David Capello
32a1b327a6 Fix typo 2024-02-28 10:16:36 -03:00
Gaspar Capello
f22603caea Fix crash when trying to access a property of a Style which is nullptr (fix #4015)
Before this fix, an incomplete custom theme or an outdated official
theme could cause a crash during Aseprite startup.

This fix does not alert the artist the problem of the theme.
Simply avoid the crash.
2024-02-26 10:07:44 -03:00
David Capello
9fb61c8a01 Use new laf-text module 2024-02-20 18:18:36 -03:00
David Capello
3280b87a53 Minor change: replace macro with inline function
Always prefer functions or template functions instead of macros.
2023-03-13 11:11:05 -03:00
Martín Capello
7a338250a3 Fix alignment of several controls when UI scaling is 200% and Screen scaling is 100% to make them look the same as when US scaling is 100% and Screen scaling is 200% 2023-03-13 10:52:01 -03:00
Martín Capello
5325f56f67 Allow overriding the icon part used by icon layers with the icon provided by a widget 2023-02-27 09:43:48 -03:00
Martín Capello
1783704a53 Fix positioning of text and icon layers to avoid setting values that are not a multiple of the gui scale 2023-02-27 09:43:48 -03:00
Martín Capello
d3f01ebe17 Add width, height, minwidth, minheight, maxwidth, and maxheight attributes to styles 2023-02-27 09:43:48 -03:00
Gaspar Capello
55885ee266 Fix regression: TextBox isn't rendering text (doesn't update the bounds area of the text box)
Regression in dd0c29620974e56d9e62653804b996740a89e88a (Use
tooltip_text style & color to paint tooltip windows #2554).

Prior this fix, text box does not update its bounds area because it
has not a style assigned.

Fix #3442, fix #3443
2022-08-02 16:39:18 -03:00
David Capello
dd0c296209 Use tooltip_text style & color to paint tooltip windows (fix #2554) 2022-07-18 16:00:13 -03:00
David Capello
5a6bd465f5 Cache mouse cursors to avoid re-generating them on each setCursor()
This should improve the mouse movement, where a new mouse cursor was
created on each mouse movement with black & white pixels. It's a
regression introduced in ef4f691459d13b45459c56383ab3673ca6fbec0a
(which was originally introduced to improve the mouse movement
perception in a 100Hz monitor).

This might be a possible fix for:
https://github.com/aseprite/aseprite/issues/2713
2021-07-09 10:21:16 -03:00
David Capello
cc7bdbcec4 Add a slider style in theme
We've added some code to handle backward compatibility with themes. In
this way we can still load old themes in the latest version but should
look as in previous versions (this will not be done with previous
properties or parts migrated to styles, so we start from now on).
2020-05-01 23:31:10 -03:00
David Capello
5cb2d984f0 Rename she -> os 2018-08-09 12:58:43 -03:00
David Capello
432eedcb97 Support changing theme and UI scaling w/o restart (fix #471) 2017-08-15 10:39:06 -03:00
David Capello
a9e688989f Implement Add/Uninstall extension (#1403)
- Added libarchive to uncompress .zip extensions
- Moved ListItem painting code to styles because we needed a selected+disabled state.
2017-06-12 12:38:53 -03:00
David Capello
73999c5415 Fix several issues with UI Scaling > 100% (fix #1456) 2017-04-15 08:13:20 -03:00
David Capello
e5c15161e8 Add a new mouse cursor to move selection edges
With this change the app-specific cursors were removed from the ui library. Maybe it needs some clean-up for following versions.
2017-04-06 18:41:18 -03:00
David Capello
043489e532 Color frame tag lines (related to #920) 2017-03-27 12:32:39 -03:00
David Capello
bc01f16a4e Move painting code for checkbox & radio button to theme styles 2017-03-17 15:43:42 -03:00
David Capello
be3c9c1bcc Convert timeline widget to new styles
And remove the old skin::Style.
2017-03-13 18:13:38 -03:00
David Capello
ca2aae6349 Convert tabs painting code to new styles 2017-03-13 13:47:37 -03:00
David Capello
aabdb11779 Change scrollbar to new theme styles 2017-03-10 22:42:15 -03:00
David Capello
e2a94b094a Fix bug drawing box/grids bgcolor on tooltip windows 2017-03-09 15:12:39 -03:00
David Capello
921c5c8ad1 Move ui::Separator drawing code to new styles 2017-02-17 18:23:21 -03:00
David Capello
86f138a714 Move ui::Splitter painting code to new styles 2017-02-17 16:17:00 -03:00
David Capello
cc20f0a21e Remove Theme::paintDesktop() 2017-02-17 14:37:58 -03:00
David Capello
a62f12ad09 Move all code to draw windows to ui-lib w/new styles 2017-02-17 14:18:47 -03:00
David Capello
235011e169 Add "const" to several Theme and Widget function members 2017-02-15 16:44:50 -03:00
David Capello
7cb41729ab Convert label and view into new styles
In this way the WidgetLoader looks for new styles only.
2017-02-14 14:55:45 -03:00
David Capello
bb4faca1d1 New Style class in "ui" layer to paint widgets (only button at this moment)
This new ui::Style should finally replace the old app::skin::SkinStyle
class. At this moment both implementations are working to avoid an
huge refactor in just one commit.

- Added new ui::Style property in ui::Widget.
- Removed old code to set the button "bevel" (removed
  app::setup_bevels() functions).
- Removed setup_look() function and Left/RightButtonLooks.
- Removed check_button_new() function.
- Removed ui::Theme::paintButton/ComboBoxButton() functions.
2017-02-13 18:34:23 -03:00
David Capello
f7903a74de Add ui::Theme::drawSlices() member function 2017-02-09 17:01:43 -03:00
David Capello
7e6fc5a815 Move drawTextBox() function inside Theme class 2017-02-08 15:00:07 -03:00
David Capello
6c9c0066a0 Replace ui::CurrentTheme with ui::set/get_theme() 2017-02-08 14:50:58 -03:00
David Capello
9016d8635b Fix problems on ui::Entry() with TrueType fonts
Fixed several problems drawing and selecting text with TrueType fonts.
2017-02-07 19:05:47 -03:00
David Capello
d323b4affc Remove public variable members from ui::Theme class 2015-08-12 16:48:40 -03:00
David Capello
eeb6d6e1b5 Fix problem resetting fonts after F5 for widgets with "mini font" (after theme is reloaded)
There are some widgets (e.g. fg/bg color buttons in the ColorBar, and
ContextBar's check-boxes) that use a "mini font". We could setup the mini
font in onInitTheme(), but the whole program is not ready to do something
like that (there are too much child_spacing/borders values that are set
outside onInitTheme).

A better way is to ask to the theme itself (Theme::getWidgetFont())
about what font to use for each specific widget. And the Widget::m_font
field can act as a cache of this requested font. So now the "mini font"
is specified in a SkinProperty's flag.
2015-05-05 19:14:33 -03:00
David Capello
0350ac4bbe Initial work on Skia backend (WIP) 2015-03-16 15:05:13 -03:00
David Capello
ca9df1a05e Rename ui::jguiscale() to ui::guiscale()
* Change Theme::guiscale member to Theme::m_guiscale
2014-11-25 22:33:45 -03:00
David Capello
5bbff161b9 Now ui::Graphics uses she::Surface instead of Allegro BITMAP 2014-06-26 22:14:39 -03:00
David Capello
dbad153698 Add she::Font class (wrapper of Allegro FONT)
This is an huge refactor to avoid handling Allegro FONT directly. Some
changes:
* Add she::System::defaultDisplay/Font, createRgbaSurface, loadSurface,
  and loadRgbaSurface.
* Rename she::CreateSystem/Instance to she::create_system/instance.
* Remove ui/font.cpp and move ui/fontbmp.cpp to she library.
* ui::IButtonIcon uses she::Surface instead of BITMAP.
* Rename she::LockedSurface::drawAlphaSurface -> drawRgbaSurface
* Rename ui::SetDisplay -> set_display
* Rename _ji_font_text_len -> ui::Graphics::measureUIStringLength
2014-06-22 18:53:14 -03:00
David Capello
78ce233756 Fix header of files distributed under the terms of the MIT license 2014-03-29 20:08:05 -03:00
David Capello
f4b2b47a2c Add #pragma once 2014-03-29 19:40:17 -03:00