There is a third-party translation (and can happen with our own
translations) that a fmt format string is ill-formed in the .ini file
of the translation (this could happen even if the en.ini file was
manually modified/broken by hand).
This patch includes a refactor of the Strings class so we can:
1) Static check at compile-time about the number of required arguments
to format a string (no need to call fmt::format() directly with
arbitrary number of args)
2) If a string is not valid for the fmt library, the runtime exception
is caught and the default (English) string is returned.
Instead of storing a Command* we can store the command ID, which it's
less problematic in extreme cases where the Command that is being
referenced is deleted or recreated, i.e. when a plugin is
disabled/re-enabled.
Now we can change several values (zoom, brush size, etc.) pressing a
keyboard shortcuts and dragging the mouse in a specific vector
direction (DragVector). It allows the modification of one, two, or
even more parameters at the same time (e.g. X axis to change the brush
size, Y axis the alpha value of the ink).
This was done to avoid some nullptr references using
SkinTheme::instance() (mainly from
StatusBar::IndicatorsGeneration::add()) when the application is being
closed because an exception was thrown. This might be useful to detect
certain kind of crashes from Sentry.
We've refactored the code to support locating windows (and popups
windows + hot regions) correctly in both modes: with one ui::Display
and with multiple ui::Displays.
For this we've added a new ui::fit_bounds() function that works in
both modes.
This ui::Display is related to one native os::Window, so the dirty
region/invalid region is now part of a ui::Display instead of a
ui::Manager.
* Replaced ui::display_w/h() functions with ui::Display::size()
and ui::get_desktop_size()
* The ui::Manager contains the main ui::Display, and in the future an
ui::Window will have its own ui::Display
Main changes:
- Improve the "Keyboard Shortcuts" dialog because instead of changing
global shortcuts/menu keys and rollback everything if we select
"Cancel", here we make a copy of all shortcuts, modify them in the
dialog UI, and finally "commit" to the global shortcuts if the user
confirms the dialog.
- Fix "Reset" button in "Keyboard Shortcuts" dialog for mouse wheel
customization
* This implements the Cmd+H and Cmd+M keys too:
https://community.aseprite.org/t/279
* Also Cmd+, has more priority on macOS than Cmd+K to open the
preferences (so macOS menu shows Cmd+,)
Changes:
* Added SeparatorInView() to add separators inside a ListBox or ComboBox.
* Added BlendModeItem() to represent each item in the blending modes
ComboBox.
* Now a ComboBox can contain any kind of widgets as children (not just
ListItem). This is required to add separators in the blending modes
ComboBox.
Feature request:
https://community.aseprite.org/t/additive-blending-feature/121
In this was we can process the text string just one time to remove the
character preceded by '&' that will be finally acts as a mnemonic. This
simplifies the rendering and text measure code too.