113 Commits

Author SHA1 Message Date
Torbjörn Andersson 02b6e11e1c GUI: When filtering a list, also reset the fluid scroller's position
Turns out my initial fix for bug #16698 was only enough to keep the
search result in view. Clicking on it didn't work. Now it should.
2026-05-15 10:53:54 +02:00
Torbjörn Andersson 1bee3bca11 GUI: When filtering a list, make sure the result is in view (bug #16698)
This may be a regression from the recent scroll changes.
2026-05-14 18:50:15 +03:00
Mohit Bankar c041092694 GUI: Centralize scroll step size logic in FluidScroller 2026-04-20 23:33:23 +02:00
Mohit Bankar a2abc4c1e5 GUI: Centralize mouse wheel handling in FluidScroller 2026-04-20 23:33:23 +02:00
Mohit Bankar cb71d7b6cf GUI: Implement Fluid scroll in Launcher List 2026-04-20 23:33:23 +02:00
Mohit Bankar af56d299da GUI: Implement drag to scroll in List 2026-04-20 23:33:23 +02:00
sluicebox 8d363cf465 GUI: Fix ListWidget SHIFT+UP multi-selection
SHIFT+UP after starting ScummVM or after removing a game would cause
the visual selection and the internal selection to be out of sync.

The problem was that ListWidget::_lastSelectionStartItem was only
initialized on certain code paths. Now it is initialized when marking
an item as selected, if it isn't already.

Fixes bug #16635
2026-03-25 12:20:27 +02:00
sluicebox 0836f8badb GUI: Fix SHIFT+UP/DOWN multi-selecting on single-select lists 2026-03-24 21:17:45 -05:00
Eugene Sandulenko a2e7c91049 GUI: Properly process setSelected(-1)
We should invalidate selection and not just crash.

Used by file browser dialog

Fixes #16600
2026-03-20 13:28:20 +01:00
Eugene Sandulenko 8299ae1266 GUI: Make Home/End button modify the selection
Partially fixes #16600
2026-03-20 13:13:25 +01:00
Eugene Sandulenko e14d381e76 GUI: Made PgUp/PgDown in the grouped list skip the groups 2026-03-20 13:00:10 +01:00
Eugene Sandulenko 971a065998 GUI: Fix speed selection with letters in ListWidget
Also, fx Home and End keys
2026-03-20 02:32:35 +01:00
Eugene Sandulenko bfeaa30c49 GUI: Fix selection visibility during PgUp/PgDown in ListWidget
Fixes one of the issues mentioned in #16600
2026-03-20 00:25:49 +01:00
Mohit Bankar a1c7b9f3f3 JANITORIAL: GUI: code cleanup 2026-02-13 19:53:40 +01:00
Mohit Bankar 72b9bc70fb GUI: Fix scrolling over collapsed groups in List
Navigation/Selection with arrow keys now scrolls at the top/bottom of the list, if there are no unselectable items.
2026-02-13 19:53:40 +01:00
Mohit Bankar 0a5743bbc9 GUI: Fix Arrow key navigation in Grouped List
up/down arrow key navigation or selection in Grouped List now completely skips Group Headers
2026-02-13 10:44:56 +01:00
Mohit Bankar 39028096bb GUI: Refractor scroll logic in UP/DOWN key navigation in List
Move visibility check and scroll outside if/else blocks to apply
consistently to both shift selection and regular navigation.
2026-02-12 11:24:20 +01:00
Mohit Bankar 2cf0713e29 GUI: Scroll to selected item on UP/DOWN key navigation in List
Auto-scroll list when navigating with keyboard to keep selection visible.
2026-02-12 11:24:20 +01:00
Mohit Bankar b72707b61e GUI: Unify ListWidget and GroupedListWidget setSelected implementation
Remove duplicate setSelected() and findDataIndex() from GroupedListWidget
and use inherited implementation from ListWidget.
2026-02-12 11:24:20 +01:00
Mohit Bankar e3b56d8714 GUI: Mark selected item in multi-selection array for all widgets
Update ListWidget, GridWidget, and GroupedListWidget setSelected() to
clear all selections and mark only the newly selected item when
multi-select is enabled.
2026-02-01 13:12:50 +03:00
Eugene Sandulenko 346e5da5cb GUI: Fix up/down key behavior in list.cpp
The introduced change was not logical as it was forcing the
multiselection mode. Now, in order to keep the selection,
you need to hold the Shift key
2026-01-31 23:39:56 +01:00
Mohit Bankar 8e99bd35c0 GUI: Improve translation compatibility in game removal dialog
Replace dynamic plural formatting with static (s) notation to simplify
translation. Minor indentation fix.
2026-01-31 12:46:29 +03:00
Mohit Bankar 2fbfc34b51 GUI: Simplify selection restoration after game removal
Add getVisualPos() method to ListWidget to convert real data indices to
visual indices in filtered/grouped lists. Simplify selection restoration
in both LauncherSimple and LauncherGrid using MIN() to handle out-of-bounds
cases cleanly. Move _lastSelectionStartItem to public for direct access.
2026-01-31 12:46:29 +03:00
Mohit Bankar 77fe2d4c5a GUI: Fix unwanted scrolling during multi-select keyboard operations
Move scrollToCurrent() from end of handleKeyDown() to specific actions
only. Prevents list from jumping to current item during Ctrl+Click or
Shift+Click multi-select operations, keeping the view stable.
2026-01-31 12:46:29 +03:00
Mohit Bankar 74592508f8 GUI: Fix list item visual deselection in multi-select mode
Remove _selectedItem check from highlight condition in ListWidget and
GroupedListWidget draw methods. This ensures visual state immediately
reflects the actual selection array when items are deselected via
Ctrl+Click, rather than waiting for the next redraw cycle.
2026-01-31 12:46:29 +03:00
Mohit Bankar 21bbca9c5b GUI: Refactor selection methods in list and grid widgets
Replace duplicate addSelectedItem() and removeSelectedItem() methods with
a single markSelectedItem(int item, bool state) method in both ListWidget
and GridWidget. Update all callers across list.cpp, grid.cpp, groupedlist.cpp,
and launcher.cpp to use the new unified method.
2026-01-31 12:46:29 +03:00
Mohit Bankar 3bf41f2e66 GUI: Implement bool array selection for ListWidget and GridWidget
- Replace int array _selectedEntries with bool array _selectedItems in GridWidget
- Rename getSelectedItemsBool() to getSelectedItems() in ListWidget
- Update performGameRemoval() to accept bool array parameter
- Simplify selection logic and improve deletion efficiency
2026-01-31 12:46:29 +03:00
Mohit Bankar 473bf9b28f GUI: Optimize multi-selection in ListWidget
Switch ListWidget multi-selection tracking from Common::Array<int> to Common::Array<bool> for add, remove, and lookup operations.
Update all selection-related methods and launcher integration
2026-01-31 12:46:29 +03:00
Mohit Bankar 9ef4aac9ab GUI: Add multi-selection with arrow keys in list view
Arrow up/down after a simple click now adds adjacent items to the selection,
without toggling. Updates highlight and last selection position.
2026-01-31 12:46:29 +03:00
Mohit Bankar 8a27ced298 GUI: Fix selection logic for filtered and grouped list views
Update ListWidget and GroupedListWidget to correctly map visual (filtered/grouped) indices to real data indices for all selection operations. This ensures that selection, multi-selection, and highlighting work as expected when filtering or grouping is active in the list view.
2026-01-31 12:46:29 +03:00
Mohit Bankar adc0b6beed GUI: Refactor removal logic, fix list shift-click anchor
Refactor game removal logic to reduce duplication between grid and list views.
Fix an issue in ListWidget where shift-click multi-selection updated the anchor
before selecting the range. The anchor is now updated after the range selection,
ensuring multi-selection works as expected.
2026-01-31 12:46:29 +03:00
Mohit Bankar df0f3a9bd3 GUI: Preserve selection when shift-clicking
Prevent Shift+Click from clearing existing selections.
2026-01-31 12:46:29 +03:00
Eugene Sandulenko e9eeebee95 GUI: Use proper and consistent data types
Introduced in e6d6426d
2026-01-18 00:32:06 +01:00
Orgad Shaneh e6d6426d7d JANITORIAL: Fix compiler warnings
In member function 'MidiParser_HMP::HmpVersion MidiParser_HMP::determineVersion(const byte*)',
    inlined from 'virtual int32 MidiParser_HMP::determineDataSize(Common::SeekableReadStream*)' at audio/midiparser_hmp.cpp:132:39:
audio/midiparser_hmp.cpp:161:129: warning: 'versionBytes' may be used uninitialized [-Wmaybe-uninitialized]
  161 |                 warning("Unknown HMP version '%c%c%c%c%c%c' - assuming version 1", pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);
      |                                                                                                                            ~~~~~^
audio/midiparser_hmp.cpp: In member function 'virtual int32 MidiParser_HMP::determineDataSize(Common::SeekableReadStream*)':
audio/midiparser_hmp.cpp:130:14: note: 'versionBytes' declared here
  130 |         byte versionBytes[6];
      |              ^~~~~~~~~~~~
gui/widgets/list.cpp: In member function 'void GUI::ListWidget::addSelectedItem(int)':
gui/widgets/list.cpp:228:27: warning: comparison of integer expressions of different signedness: 'int' and 'Common::Array<int>::size_type' {aka 'unsigned int'} [-Wsign-compare]
  228 |         for (int i = 0; i < _selectedItems.size(); ++i) {
      |                         ~~^~~~~~~~~~~~~~~~~~~~~~~
gui/widgets/list.cpp: In member function 'void GUI::ListWidget::removeSelectedItem(int)':
gui/widgets/list.cpp:248:27: warning: comparison of integer expressions of different signedness: 'int' and 'Common::Array<int>::size_type' {aka 'unsigned int'} [-Wsign-compare]
  248 |         for (int i = 0; i < _selectedItems.size(); ++i) {
      |                         ~~^~~~~~~~~~~~~~~~~~~~~~~
2026-01-17 21:56:30 +02:00
Mohit Bankar ea316313b5 GUI: Allow Enter activation with single selection
Only suppress Enter activation when multi-select is enabled and more than one item is selected; if exactly one item is selected, Enter activates it even when multi-select is on.
2026-01-07 01:01:47 +03:00
Mohit Bankar da8592a469 GUI: Disable Enter key activation when multi-selection is enabled 2026-01-07 01:01:47 +03:00
Mohit Bankar d32433346e GUI: Limit multi-selection to launcher dialog only
- Added _multiSelectEnabled flag to ListWidget and GridWidget (default: false)

- Added setMultiSelectEnabled() and isMultiSelectEnabled() methods

- Gated Ctrl+Click and Shift+Click logic behind _multiSelectEnabled check

- GroupedListWidget inherits this behavior from ListWidget
2026-01-07 01:01:47 +03:00
Mohit Bankar cbf8a88b31 GUI: Add multi-selection, batch removal, and improved button states in launcher
• Enable multi-selection in the launcher list widget (mouse, Ctrl+Click, Shift+Click).

• Update button states: disable Start, Load, and Game Options when multiple entries are selected.

• Add batch removal confirmation dialog listing selected entries.

• Refactor selection logic and highlighting in both filtered and grouped views.

• Fix group header fold indicator rendering for better UI consistency.
2026-01-07 01:01:47 +03:00
Eugene Sandulenko b125830b85 GUI: Gracefully exit when saves have bad format
Patches the bug #16432, but not really fixes it, as the save is broken
2026-01-02 21:24:58 +01:00
Le Philousophe 64b133a1da GUI: Add item spacing to lists
This let the theme define inter item spacing.
The selection box has the same height as the item height and the text in
vertically centered.
The edition caret is vertically centered.
2025-11-03 21:10:21 +01:00
sluicebox 5f434f2a1b GUI: Only scroll list to selected item if necessary
Fixes launcher scrolling when removing a game
2025-06-10 08:06:41 +03:00
Filippos Karapetis e157b7044e GUI: Use C++ 11 range-based for loops 2025-03-27 13:47:57 +08:00
Cameron Cawley 58a9aa6a2c COMMON: Deprecate U32String constructors that accept a uint32 array 2024-11-29 01:14:36 +02:00
sluicebox 4308849811 GUI: Add ListWidget commands: single click and edit start
These commands allow greater control over editable ListWidgets, although
the save dialog's list is currently the only one.

kListItemSingleClickedCmd allows clients to respond to selection changes
based on the method used (mouse vs keyboard) and allows responding to
clicking on an already selected item. In the next commit, this will fix
multiple save issues.

kListItemEditModeStartedCmd allows clients to initialize edit mode
consistently. The save dialog has been doing custom initialization after
calling startEditMode, but this is incorrect because ListWidget calls
startEditMode in response to Enter, so the initialization is skipped.
2024-05-22 21:47:07 -04:00
sluicebox 7fb6052aa7 GUI: Allow delete/backspace on editable ListWidgets
Fixes the delete/backspace hotkey on the save list dialog; it was only
working on the load list even though they both have the same delete
functionality.

This is a check from 17 years ago that I believe was confused and had
no effect at the time. I believe the intent was to ignore these keys
while in edit mode, which makes sense, but instead this code ignored
these keys on all editable lists when *not* in edit mode. This wasn't
noticeable because there's only one editable ListWidget in ScummVM,
the save list, and it didn't listen for kListItemRemovalRequestCmd
until three years ago: aac1eb12bf
2024-05-22 21:47:07 -04:00
sluicebox d4c41f6214 GUI: Fix ListWidget drawing caret on disabled items
When in edit mode on the save dialog, clicking on a disabled item, such
as the Autosave slot 0, would draw the stale caret on the disabled item
at the x position of the previous item.
2024-05-13 09:04:07 -07:00
sluicebox 6ec7d5b811 GUI: Move Mass Add list code into MassAddListWidget
Fixes list colors in other dialogs that use ListWidget

See: e9f2468df9
2024-05-10 12:16:11 +02:00
Torbjörn Andersson a46913545f GUI: Keep caret visible in editable widgets while moving it
This was actually the intention all along. But if a redraw of the widget
itself was triggered at the same time, it would draw over the caret,
effectively erasing it. To get around this, the caret is now also drawn
as part of the widget, when necessary.
2024-04-25 00:57:04 +02:00
HectorRecloud e9f2468df9 GUI: Skip games during Mass Add
Use [x] for selected games, as well as enabled list items.

Co-Authored-By: Filippos Karapetis <bluegr@gmail.com>
2024-04-07 14:06:33 +02:00
hax0kartik 6a4e2b2694 GUI: Disable text selection in list widget 2023-04-14 14:10:20 +02:00