Commit Graph

89 Commits

Author SHA1 Message Date
David Capello 32a099dcb6 Fix crashes with ill-formed fmt format strings (fix #2274)
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.
2024-06-20 20:49:10 -03:00
David Capello b28550faf5 Use new ScopedValue w/o old arg + C++17 class template argument deduction (CTAD) 2023-04-14 13:43:36 -03:00
Joshua Ogunyinka ed26fdd806 Add missing language strings in other uncategorized sections 2022-10-12 14:57:23 -03:00
Joshua Ogunyinka de44545930 Add missing language strings for keyboard shortcuts
Co-authored-by: David Capello <david@igara.com>
2022-10-12 13:20:35 -03:00
David Capello 8f44b521b6 Merge branch 'main' into beta 2022-06-10 10:31:13 -03:00
David Capello a39e235b23 Don't store a Command* pointer in AppMenuItem (fix #3359, fix #3360)
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.
2022-06-07 14:47:40 -03:00
David Capello 684d06ede8 Merge branch 'main' into beta 2022-05-23 18:04:55 -03:00
David Capello 1366a6948c Fix performance issues adding/deleting widgets (related to #3281) 2022-05-20 11:03:12 -03:00
David Capello 46626bb5ce Merge branch 'main' into beta 2022-04-13 23:01:12 -03:00
David Capello e4c2995326 Extensions now support defining keyboard shortcuts (#1403, #3239) 2022-04-13 22:46:48 -03:00
David Capello 721e401052 Fix some memory leaks & simplify code sending UI messages 2022-04-13 21:04:54 -03:00
David Capello 4ce2d1a340 Add option to simulate mouse wheel using key shortcut+drag mouse (fix #3195)
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).
2022-03-08 20:40:11 -03:00
David Capello 7e76d81fcc Merge branch 'main' into beta 2022-02-18 19:32:33 -03:00
David Capello 2d3de1728c Add SkinTheme::get() to avoid using SkinTheme::instance() as much as possible
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.
2022-02-18 19:01:46 -03:00
David Capello fb88a5c1f1 Message::setPropagateToChildren() receives a bool argument 2021-06-07 17:17:18 -03:00
David Capello eec9ed0bcc Fix a couple of minor leaked ui::Messages 2021-06-07 15:20:45 -03:00
David Capello 56ae29a9b4 Add different names to SelectPaletteColors and possibility to assign keyboard shortcuts to these items
Now we can assign keyboard shortcuts to the whole Palette menu.
2021-05-20 17:28:32 -03:00
David Capello bcd69495ce Fix several issues locating windows with multiple UI windows
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.
2021-03-19 18:57:56 -03:00
David Capello 35bb3af6e2 Replace all base::Bind() with lambda functions 2021-03-05 20:09:42 -03:00
David Capello c3d52f0bbe Add ui::Display to support multiple windows in the future
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
2021-02-18 12:34:42 -03:00
David Capello 8a3f32b47f Replace all base::Bind() with lambda functions 2020-07-03 21:51:46 -03:00
David Capello b628e21e76 Replace MIN/MAX() macros with std::min/max() functions 2020-04-08 12:20:53 -03:00
David Capello d32fd97da5 Replace base::SharedPtr with std::shared_ptr
We can remove our smart pointer (base::SharedPtr) as we're already
using C++11 compilers on all platforms.
2019-08-01 19:16:16 -03:00
David Capello 54883012bb Put "Reopen Closed File" and "Clear Recent Files" options inside "File > Open Recent" menu 2019-05-27 23:53:57 -03:00
David Capello 271865e13d Remove unused Command::clone() member function 2019-01-07 17:03:38 -03:00
David Capello e63187a5f6 Save keyboard shortcuts dialog layout
From: https://community.aseprite.org/t/2276
2018-11-26 18:46:13 -03:00
David Capello 65bc54904d Reset mouse wheel customization section correctly 2018-07-24 13:42:59 -03:00
David Capello 413603a71a Don't use KeyboardShortcuts singleton for temporal changes in Keyboard Shortcuts dialog
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
2018-07-23 15:15:04 -03:00
David Capello c5fda62173 Don't access to KeyboardShortcuts singleton from SelectAccelerator 2018-07-20 14:32:55 -03:00
David Capello 7740f6a710 Add mouse wheel customization for sprite editor
Fix #680, #970, https://community.aseprite.org/t/668
and possibility to change alpha with mouse wheel:
https://github.com/aseprite/aseprite/issues/680#issuecomment-344721509
2018-07-19 23:05:14 -03:00
David Capello f33091dbfa Add KeyPtr as std::shared_ptr<Key> 2018-07-17 23:53:08 -03:00
David Capello e025d1a40a Improve widget class generator including only required .h files
Instead of including "ui/ui.h" we can include the specific header file
for the used widgets in the .xml widget.
2018-06-08 15:52:10 -03:00
David Capello dee6ff6c7e Refactor: Use new base::paths type for list of filenames/extensions 2018-02-21 11:06:58 -03:00
David Capello e0a60b6748 Generate the list of command IDs from en.ini file 2017-12-01 15:10:21 -03:00
David Capello ccee49c02b Move command friendly names to the strings file
Related to #124
2017-11-30 23:41:45 -03:00
David Capello 5f33b55a11 Add new commands to show color bar menus/options
Added QuickCommand class to create commands in the relevant
place (e.g. the ColorBar commands can be created in
ColorBar::registerCommands()).
2017-11-30 14:51:13 -03:00
David Capello 519715224e Fix displaying several keyboard shortcuts for the same command 2017-11-29 15:28:04 -03:00
David Capello 0ee5dbea7a Improve keyboard shortcuts list with resizable headers 2017-10-24 10:20:21 -03:00
David Capello 9171c59745 Show KeyContext in the keyboard shortcut dialog 2017-10-23 13:10:30 -03:00
David Capello a9b183729f Translate all alerts to the en.ini file (#124) 2017-10-17 18:00:45 -03:00
David Capello 0154a73d36 Add native macOS menus (fix #135)
* 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+,)
2017-09-01 13:32:23 -03:00
David Capello 14ba0ab411 Add addition/subtract/divide blending modes
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
2017-07-24 15:25:13 -03:00
David Capello 5d2ed8ce4b Update tooltips when keyboard shortcuts are modified
This was implemented only for ContextBar and ColorBar at the moment.
2017-06-23 10:16:37 -03:00
David Capello 1350d6d7f7 Add possibility to open multiple files at once (fix #1163) 2017-04-08 00:06:25 -03:00
David Capello b6cf0f218c Add search field on Font Popup
Added support to set child visibility property to ListBox items.
2017-03-15 14:24:42 -03:00
David Capello bc4f8ad3e1 Rename newStyles -> styles 2017-03-13 22:31:57 -03:00
David Capello ff01a08b9e Fix style of mini-buttons in keyboard shortcuts list 2017-03-08 17:04:02 -03:00
David Capello 921c5c8ad1 Move ui::Separator drawing code to new styles 2017-02-17 18:23:21 -03:00
David Capello 17151cddcd Move mnemonic key as a property of ui::Widget
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.
2017-02-14 14:16:37 -03:00
David Capello 47f3d540b7 Fix drawing UI text with TrueType fonts (related to #124) 2017-02-06 17:58:55 -03:00