* Added AppShortcut::fitsBetterThan() to compare shortcuts and decide
which one is better depending on the current key context and the ones
where shortcuts are defined
* Added Key::fitsContext() to known if this key definition makes sense
for a given current key context, e.g. Normal context can be used in
SelectionTool context, and SelectionTool can be used in Transformation
* Added KeyboardShortcuts::findBestKeyFromMessage() to centralize the
keyboard shortcuts matching moving some code from
CustomizedGuiManager::processKey()
* Added more keyboard shortcuts tests (including some for #5390)
We need a list of shorcuts (AppShortcuts) similar to ui::Shortcuts but
including the key source to compare later where the shortcut was
defined and give more priority to the user-defined shortcuts. This
logic is not yet added, this patch is only a refactor.
This was a pending refactor, where "user.aseprite-keys" files were
already using the "shortcut" attribute (instead of "accelerator").
This will include a refactor in the Weblate projects/all translations
to change [select_accelerator] section to [select_shortcut]. But that
must be coordinated after this commit is merged.
Introduced Key::isListed() and Command::isListed() to customize when a
command should be displayed in the list of shortcuts.
Removed commands:
'Launch'
'OpenBrowser'
And removed unnecessary commands:
'Change Color Mode: Indexed'
'Contract Selection'
'Export Sprite Sheet'
'Flip Canvas Horizontally'
'Frame Properties'
'Load Palette'
'Open Sprite'
'Playback Speed 1x'
'Run Script'
'Save Palette'
'Select Used Colors'
'Set Palette Entry Size'
'Tileset Mode: Auto'
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).
Before this fix, Alt+mouse wheel to scroll through tiles didn't work as it did in the color palette.
Also, fixed tile deselection when user removes the focus of the tileset (for example, doing click in the editor).
This is the first version of the feature, it still needs some
fixes (e.g. avoid skew transform when the pivot is in the same side of
the skew handle which can calculate a division by zero).
For example, before this change we were depending on the order of the
wheel actions. If an action were associated to <Ctrl> and other one to
<Ctrl+Shift>, when we pressed <Ctrl+Shift> we weren't returning the
action with most modifiers pressed (in this case <Ctrl+Shift>), but
instead the one that was checked first in the for loop (which could
be the one with <Ctrl>).
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