56 Commits

Author SHA1 Message Date
Le Philousophe bbf0d1f9da GUI: Remove RTL hack
The hack was here because the RTL aware code was incomplete.
Fix everything and remove useless code.
2025-06-03 12:55:47 +02:00
sluicebox 66d1f6d56a GUI: Make EditableWidget::caretVisualPos const 2024-05-13 09:04:07 -07: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
Eugene Sandulenko 2b22b9c581 GUI: Further fixes to keymapper code 2023-10-28 21:01:18 +02:00
polyesterswing 611fd6cd5f GUI: FIX conflicting mappings between EditableWidget and GUI elements
EditableWidget took over keyboard events targeted towards Debugger and
List. This commit fixes it by reverting some part of the code to its
original state.

Fixes issues caused by PR #5366
2023-10-28 18:39:55 +02:00
Kurian Jojo 595a3d7724 GUI: Use Keymapper for EditableWidget 2023-10-24 19:01:12 +02:00
PushmePullyu 4867e14d60 GUI: EditableWidget: Clear selection when handling backspace/delete
Clear the selection after deleting a character.

Not doing so can result in out-of-bounds reads in
EditTextWidget::drawWidget(), where _selCaretPos and _selOffset are
used as offsets, and to a failed assertion when calling
EditableWidget::defaultKeyDownHandler():

gui/widgets/editable.cpp:566:
bool GUI::EditableWidget::setCaretPos(int):
Assertion `newPos >= 0 && newPos <= (int)_editString.size()' failed.

Fixes #14584
2023-08-22 13:23:19 +03:00
Thierry Crozat 530a972d4c GUI: Clear the selection when calling EditableWidget::setEditString
This fixes a crash (assert) due to an invalid selection in the EditableWidget
when typing anything in the widget after setEditString was called while some
text was selected.
Here is one way to get the crash (before this commit):
1. In the launcher search box type some text.
2. Select the text or part of the text.
3. Click the clear button.
4. Type something or use the backspace/delete key.
2023-07-20 00:46:48 +01:00
hax0kartik bf0845a1d6 GUI: Modify inversion only if text selection is not disabled 2023-04-14 14:10:20 +02:00
hax0kartik 4d10720b5e GUI: Do not modify inversion directly in editable widget 2023-04-14 14:10:20 +02:00
hax0kartik 337960dc5f JANITORIAL: Remove trailing whitespaces in editable.cpp 2023-04-14 14:10:20 +02:00
Donovan Watteau b9e7168d01 GUI: Fix -Wimplicit-fallthrough warning with GCC on OSX 2023-04-11 11:06:23 +02:00
Thierry Crozat b1fcd15cad GUI: Allow scaling dialog and widget sizes in constructors
The resize() function has the option to do the scaling, but
adding it to the construtor avoids having to then call resize().
Also this makes more explicit that by default the sizes are not
scaled. The reason for not scaling by default is because values
with get from the ThemeEngine are already scaled.
2023-03-25 11:27:02 +01:00
hax0kartik e101f5397c GUI: Limit text selection feature for RTL languages 2023-03-01 18:42:34 +01:00
hax0kartik bd52062fa7 GUI: Make text selectable 2023-03-01 18:42:34 +01:00
Orgad Shaneh aba347ed9e GUI: Make character validation less ugly 2022-11-02 22:15:16 +00:00
Le Philousophe ea560b5dab GUI: Redraw editable widget and move its caret when text is set by code 2022-08-25 17:57:38 +02:00
BLooperZ b67b88e6d9 GUI: Support unicode and BiDi in editable widget 2022-08-02 22:04:54 +02:00
Thunderforge fd129ebc0c JANITORIAL: "Mac OS X" and "OS X" to "macOS" in comments
Apple's desktop operating system was formerly called "Mac OS X" and "OS X", but since 2016 it has been called "macOS" (starting with version 10.12).

Changing across all comments and documentation to use this current terminology, except in cases where the historical versions are explicitly referenced. No code changes are made; we should consider changing those in future PRs.
2022-01-29 14:15:05 +01:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Eugene Sandulenko 109beb4f86 GUI: Explicitely use Common:: namespace 2021-11-12 14:46:34 +01:00
Le Philousophe 58c5c29f88 Revert "GUI: Fix int/int32 build failures"
This reverts commit c2bd0cfb90.
2021-07-07 19:10:32 +02:00
Le Philousophe c2bd0cfb90 GUI: Fix int/int32 build failures
All of this is because Rect and Surface have moved to int32
2021-07-05 23:21:55 +02:00
aryanrawlani28 d3e64b2df4 GUI: U32: Use const-references for tooltips 2020-08-30 14:43:41 +02:00
aryanrawlani28 4506bcd9f3 GUI: U32: Fix compilation errors
After rebasing to get even with master, some compilation errors occured. This commit fixes that.
2020-08-30 14:43:41 +02:00
aryanrawlani28 49c36c2b45 GUI: U32: Begin converting texts in clipboards to u32strings
With this commit the base class variables and the parts where getClipboard and setClipboard are used is changed accordingly.
2020-08-30 14:43:41 +02:00
aryanrawlani28 f800ca4ada GUI: U32: Convert majority of code to use U32
This commit also includes some additional major changes.

- Return U32String from TransMan getTranslation()
- Change tooltips to be U32Strings
- Remove temporary code of convertToU32String
- U32 Support various dialogs (Browser, FileBrowser, Messages, Chooser, etc)
- U32 for music plugins
- U32 for OSD messages
- Add some helper functions to ustr.cpp
- Change default tooltips from nullptr & 0 -> ""
- Some runtime exceptions may occur when changing languages due to incorrect String::Format
2020-08-30 14:43:41 +02:00
aryanrawlani28 5f2af6b93e GUI: U32: Add u32 support to Editables and Dialogs
- Editable widgets
- Lists
- SaveLoad Dialogs
- Browser Dialogs
2020-08-30 14:43:41 +02:00
aryanrawlani28 2a239efa80 GUI: Always mark editable as dirty when press home or end
- Before, the implementation used to fetch this value based on setCaretPos.
- That would return true only if string needed scrolling.
- Thus, the small issue arised that 2 chars would be wobbled together. This commit fixes that.
2020-07-25 00:32:34 +02:00
aryanrawlani28 5a093e4e95 GUI: RTL: Improve right align text drawing
- Fix last chars being eaten
- Add support for input in right-align mode editables
- Fix issue with dirtyness of editables after clicking
- Improve spacing for lists and popup
- Make numbers reversed in lists
2020-06-22 00:03:02 +02:00
aryanrawlani28 c2708e350f GUI: RTL: Change alignment of editable to right in RTL 2020-06-22 00:03:02 +02:00
aryanrawlani28 0420dc4f6d GUI: Fix review issues, code cleanup 2020-06-22 00:03:02 +02:00
aryanrawlani28 1bd2701597 GUI: RTL: Fix caret position 2020-06-22 00:03:02 +02:00
Cameron Cawley 014bef9eab BACKENDS: Add a default clipboard implementation 2019-09-21 22:16:01 +03:00
Thierry Crozat 6ab6d76792 GUI: Add copy to clipboard shortcut for EditableWidget 2018-04-29 21:47:10 +01:00
Bastien Bouclet 4d29ce21d0 GUI: Unify clip and non-clip draw calls 2018-04-19 19:18:39 +02:00
Bastien Bouclet 0496ede62f GUI: Implement dirty-checking for widget redraws 2018-01-27 18:12:34 +01:00
Alexander Tkachev b9bba9bd4b ALL: Move Clipboard support to OSystem
Commit adds kFeatureClipboardSupport. hasTextInClipboard() and
getTextFromClipboard().

OSystem_SDL has this feature if SDL2 is used.

EditableWidget and StorageWizardDialog use g_system to access clipboard
now.
2016-08-24 16:07:55 +06:00
Alexander Tkachev 75fbecf616 GUI: Add Ctrl+V handling in EditableWidget
In SDL2 there is SDL_GetClipboardText(), so EditableWidget could support
pasting into it.

No copying yet, as there is no selecting.
2016-08-24 16:07:55 +06:00
Alexander Tkachev 3d636617d0 GUI: Use clipping everywhere 2016-07-03 12:24:46 +02:00
Alexander Tkachev f22d11953d GUI: Add drawSquareClip() 2016-07-03 12:21:09 +02:00
Eugene Sandulenko 6f44d4f7e1 GUI: Make disabled EditTextWidget not allowing to edit the string 2015-11-07 13:26:55 +01:00
Johannes Schickel f5dfe6725a GUI: Make GPL headers consistent in themselves. 2014-02-18 02:39:35 +01:00
Johannes Schickel fe7f28bf6c GUI: Do not draw text outside edit rect in EditableWidget. 2013-11-24 01:15:27 +01:00
Johannes Schickel b487c1fc38 GUI: Fix undrawing caret glitch when the edit text is inversed.
This is prominently visible in the list based save/load chooser since the
edit string is drawn on a special green background there. When the caret is
at the end of the edit string this would result in the green color missing
at the place of the (undrawn) caret. To avoid this we simply draw a fake
space now.
2013-11-24 00:38:47 +01:00
Johannes Schickel 3be846cfd7 GUI: Draw caret over the whole height of the edit rect.
This improves the look of the editable widgets.
2013-11-24 00:15:48 +01:00
Johannes Schickel bb4a730a88 GUI: Fix out-of-bounds check in EditableWidget::drawCaret.
The line "y + editRect.height() + 2" is not included in drawing anymore. Thus
it is allowed to equal EditableWidget::_h.
2013-11-24 00:15:48 +01:00
Johannes Schickel aaad08c9fe GUI: Fix character redrawing behind caret in EditTextWidgets.
This fixes an ugly y position change when the caret is moved to a character in
an edit text widget.
2013-11-24 00:15:48 +01:00
Narek Mailian 887a99e211 GRAPHICS: Added changes and improved code from inisider/scummvm (partial text)
Includes code from https://github.com/inisider/scummvm/ , which has been
squashed and bugfixed
2013-08-16 20:54:08 +02:00
Johannes Schickel 9f3fbe1bd7 GRAPHICS/GUI: Implement kerning support for Font.
This adapts the related graphics code, which is the generic Font API and the
TTF font implementation.

It furthermore adapts the GUI to properly take care of kerning in text input
widgets.
2012-01-29 16:26:20 +01:00