Commit Graph

4813 Commits

Author SHA1 Message Date
Eugene Sandulenko
96b0274fcc
GUI: Scale fonts for classic theme 2023-06-23 12:08:56 +02:00
Lars Sundström
40c376fd3a GUI: Change ThemeLayout::setPadding input types to int16
The theme layout padding values are parsed and stored as 16 bit
signed integers. However ThemeLayout::setPadding treated the
values as 8 bit signed integeres.

The padding values parsed from the STX file suited for the screen
resolution are multiplied with the device content scale factor.
The scale factor determines how content is mapped from the logical
coordinate space (measured in points) to the device coordinate
space (measured in pixels).

If the scale factor and the padding value results in a value
greater than 255 it will wrap since the 8 bit type can't hold
bigger values than that.

Running the iOS backend in debug configuration on an iPhone 12
mini, having the content scale factor value 3, and drawing the
launcher in vertical mode where the bottom padding value is 92,
the result became 3 * 92 = 276 which would wrap to 20.
That resulted in incorrect layout where the GameList was too
high and the buttons in the bottom would not fit on the screen.

Change the input type to int16 in ThemeLayout::setPadding to
conform with the padding type used everywhere else.
2023-06-23 12:32:51 +03:00
Le Philousophe
bfc87720de GUI: Fix bug #7124
A fake mouse moved event is generated to force a refresh of the current
hovered widget
2023-06-18 20:39:59 +02:00
Le Philousophe
c276e89888 GUI: Don't display tooltips while dragging mouse
Displaying it cancels the dragging.
2023-06-18 20:39:59 +02:00
Le Philousophe
0492a0e222 GUI: Update themes
Latest changes were not applied to zip and include
2023-06-18 16:18:14 +02:00
antoniou79
68c293a004 GUI: Ommit aspect ratio checkbox if this feature is missing
Also fix compilation when building for --disable-aspect (buggy end bracket in backends/graphics/surfacesdl/surfacesdl-graphics.cpp)
2023-06-17 20:21:29 +02:00
Miro Kropacek
e4dcd46b43 GUI: Don't parse all available engines and games on startup
When statically linked, this makes about 8000 variants.

This change takes only engines and games present in a domain into
account. This speeds up loading time on slower backends quite
noticeably.
2023-06-10 23:27:57 +02:00
Miro Kropacek
09a5e47636 GUI: Add debug outputs for easier profiling 2023-06-10 23:27:57 +02:00
Miro Kropacek
650ccb6ded GUI: Don't assume ManagedSurface's pitch
This caused corruption with small scale's cursor (18px) if
ManagedSurface's inner surface used a different pitch than w *
format.bytesPerPixel.
2023-06-10 23:27:57 +02:00
Misty De Meo
f208f8e00b
GUI: remove unused variable 2023-06-01 14:30:50 -07:00
Thierry Crozat
7b9ae88050 UPDATES: Fix saving the updates_check frequency in opt-in wizard
When ScummVM is started, if the updates_check value is not defined
in the config file and ScummVM was compiled with the Updates feature
(on macOS or Windows), an opt-in dialog asks the user if he wants
to check for available updates periodically. This should only be
shown once. However as ConfMan was not flushed to disk, it was
asked again the next time ScummVM is started, and again, until the
user accessed the options to change something else and this was
finally flushed to disk.
2023-05-25 22:26:37 +01:00
Donovan Watteau
51ac525263 GUI: Fix builds without USE_TRANSLATION 2023-05-15 18:06:35 +02:00
Abhinav Chennubhotla
7bbd62e846 GUI: Add message and about dialogs to dumpAllDialogs()
- Add arguement message with default arguement "test"
 - Create separate .png files for all dialogs
2023-05-14 22:47:22 +02:00
Abhinav Chennubhotla
f96eb9a7f1 GUI: Dump .png files of launcher to check UI for various translations
- Each resolution needs to be cycled manually in the code, default is
    800x640.
  - Dumps .png files in a snapshots folder for all languages at a given
    resolution.

TODO:
  - Cycle resolutions automatically through code.
  - Add more dialogs to the dumper.
2023-05-14 22:47:22 +02:00
Cameron Cawley
7ef8da53d7 GUI: Account for the scroll bar size in ScrollContainerWidget objects 2023-05-14 22:43:57 +02:00
elasota
6c8ceeae25 BACKENDS: Refactor some things to make getDoubleClickTime behavior with event recorder simpler. 2023-05-14 22:42:59 +02:00
elasota
74ddbe5eaa BACKENDS: Add double-click time feature to support OS-configurable double-click intervals, implement it for Windows. 2023-05-14 22:42:59 +02:00
Miro Kropacek
b5dc9dd949 GUI: Fix sliding up of the console
#4953 optimized redrawing of the top dialog in commit f824f8a. This
however broke console's sliding up as the code in question depended on
the fact that it was internally equivalent to a full redraw.
2023-05-11 23:53:17 +02:00
Miro Kropacek
6fff1690a5 GUI: Don't redraw whole dialog in Widget::setEnabled()
Until now, every (even the tiniest) widget's change of the enabled state
resulted in a redraw of a complete *dialog*. Why this was needed and how
it has been fixed requires a bit of explanation.

There are two buffers to render the widgets in: Backbuffer and Screen
(selected by ThemeEngine::drawToBackbuffer() and
ThemeEngine::drawToScreen() respectively, setting
VectorRenderer::_activeSurface). Then there are two layers/flags:
kDrawLayerBackground and kDrawLayerForeground
(selected in Dialog::drawDialog(), setting ThemeEngine::_layerToDraw).

When asked for a complete dialog rebuild in GuiManager::redraw()
(kRedrawCloseDialog, kRedrawFull) the widgets of every dialog,
regardless of their layer, are drawn into Backbuffer and then copied
into Screen.

When asked for a partial dialog rebuild (kRedrawOpenDialog,
kRedrawTopDialog) the widgets of the topmost dialog marked with
kDrawLayerBackground are drawn into Backbuffer, then copied into Screen
and finally the widgets marked with kDrawLayerForeground are drawn into
Screen *only*.

When redraw() is called just within the GuiManager's event loop the
widgets of the topmost dialog are drawn into Screen *only*. And this is
where the layers become important.

When rebuilding the dialog, it doesn't really matter which layer has
been defined for a widget: Backbuffer contains the ones with
kDrawLayerBackground and Screen will supply the rest with
kDrawLayerForeground, if needed. But which layer is taken into account
when calling Dialog::drawWidgets() ?

It is important to realize that the content of Backbuffer is
defined by the widget's initial state (idle or disabled): so Backbuffer
will contain either "idle color" or "disabled color" after dialog's
creation.

ThemeEngine::drawDD() does two checks:

1. if widget has kDrawLayerBackground set *and* _activeSurface is
  Screen, copy the widget from Backbuffer to Screen

2. if widget's layer is the same as _layerToDraw, draw the widget into
  _activeSurface

This is what happens in redraw(kRedrawDisabled) for kDrawLayerBackground
widgets:

- Backbuffer contains an idle/disabled (depending on its initial state)
  rendition of the widget
- widget is copied from Backbuffer to Screen (1st check in drawDD())
- widget is not drawn into Screen as _layerToDraw is
  kDrawLayerForeground (2nd check in drawDD())

Summary: when switching between idle/disabled state, widget's color is
not updated.

This is what happens in redraw(kRedrawDisabled) for kDrawLayerForeground
widgets:

- Backbuffer contains an idle/disabled (depending on its initial state)
  rendition of the widget
- widget is not copied from Backbuffer to Screen as widget has
  kDrawLayerForeground set (1st check in drawDD())
- widget is drawn into Screen as _layerToDraw is still
  kDrawLayerForeground from the last redraw() (2nd check in drawDD())

Summary: when switching between idle/disabled state, widget's color is
correctly updated and not restored from Backbuffer.

Initially, I set up "button idle" to be rendered in the foreground
layer, same as "button disabled". However @lephilousophe suggested a
great improvement: render "button idle" still in the background but make
"button disabled" its child (in the foreground). Worked like a charm as
it just mimics the hovering behaviour.

And this is why hovering doesn't require scheduleTopDialogRedraw():

- Backbuffer contains an idle [kDrawLayerBackground] rendition of the
  widget
- when highlighted [kDrawLayerForeground], widget is not copied from
  Backbuffer to Screen
- widget is drawn into Screen

Unhovering:

- Backbuffer contains an idle [kDrawLayerBackground] rendition of the
  widget
- when idle [kDrawLayerBackground], widget is copied from Backbuffer to
  Screen
- widget is not drawn into Screen
2023-05-10 22:52:48 +02:00
Miro Kropacek
6e4d7798f9 GUI: Remove redundant redraw calls
When calling any of:

- Widget::setEnabled
- EditTextWidget::setEditString
- EditableWidget::setEditString
- StaticTextWidget::setLabel

there is no need to call neither GuiManager::scheduleTopDialogRedraw nor
Widget::markAsDirty afterwards -- they set up the call by themselves.

Also, refactor a couple of code blocks into calling just
GuiManager::redrawFull as it does the same thing.
2023-05-10 22:52:48 +02:00
Le Philousophe
f2166b8e8a GUI: Reorganize GuiManager::redraw() to make it more readable 2023-05-10 22:52:48 +02:00
Miro Kropacek
915dce50ea Revert "GUI: Don't enforce full redraw upon closing tool tip"
Unfortunately, it is not that simple. Tooltip may be placed also outside
of the dialog. Current implementation leaves tooltip leftovers over
the dialog below the topmost one, so reverting until I find a correct
way to achieve the goal.

This reverts commit 19b7b2aa20.
2023-05-01 03:37:26 +02:00
antoniou79
531bffa423 GUI: Fix syntax in a sentence 2023-04-29 22:36:48 +03:00
Miro Kropacek
19b7b2aa20 GUI: Don't enforce full redraw upon closing tool tip 2023-04-29 13:44:40 +02:00
eientei
83fd89d461 GUI: Correct some grammar in the cloud connection wizard 2023-04-29 13:26:54 +02:00
su-xingyu
630fe0e8d0 GUI: Fix inconsistent game title display for list and grid layout 2023-04-29 13:12:06 +02:00
Miro Kropacek
f824f8ad13 GUI: Don't redraw whole dialog stack with kRedrawTopDialog 2023-04-29 12:00:49 +02:00
Eugene Sandulenko
1a5442bb24
GUI: Merge multiline sentences into one string for easier translation 2023-04-23 16:29:49 +02:00
su-xingyu
c577b1d616
GUI: Fix hard shadow under HiDPI rendering (#4908) 2023-04-15 02:04:16 +02:00
hax0kartik
6a4e2b2694 GUI: Disable text selection in list widget 2023-04-14 14:10:20 +02: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
Thierry Crozat
059781c89c GUI: Add guard to prevent recursive call of handleMouseWheel in dialogs
This fixes bug #14404.

The rercusive call was introduced with commit 325260f that changed
the implementation of Widget::handleMouseWheel to call handleMouseWheel
on the widget boss. If the widget boss is a dialog, its implementation
is to call handleMouseWheel on the widget under the cursor. And
we can end up with an infinite loop.

As indicated in bug #13106, which was fixed by commit 325260f, a
similar infinite loop when using the mouse wheel to scroll tabs in
the options dialog was caused by the commit and quickly fixed. But
the fix was only for that particular case. Here the fix should
be more global.
2023-04-12 23:34:10 +01:00
wyatt-radkiewicz
660fcf329d GUI: Collapsed game groups are persisted
GroupedListWidget and GridWidget can save what groups they have
collapsed to the config file and reload them. "launcher.cpp" uses those
functions to persist those collapsed groups through
  - changing how the games are grouped by
  - going from list to grid mode and vice versa
  - quitting scummvm and starting it again
2023-04-12 16:07:58 +02:00
Donovan Watteau
b9e7168d01 GUI: Fix -Wimplicit-fallthrough warning with GCC on OSX 2023-04-11 11:06:23 +02:00
Orgad Shaneh
e4ec99fc62 GUI: Fix GCC/MinGW warning
textviewer.cpp:84:64: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'int64' {aka 'long long int'} [-Wformat=]
   84 |         warning("TextViewerDialog::loadFile(): File size is: %ld", stream->size());
      |                                                              ~~^   ~~~~~~~~~~~~~~
      |                                                                |               |
      |                                                                long int        int64 {aka long long int}
      |                                                              %lld
2023-04-09 23:55:16 +03:00
Cameron Cawley
fb2503d02e GUI: Only use a transparent colour for BMP images 2023-04-09 12:54:38 +02:00
elasota
eab1a92a6d GUI: Fix signed/unsigned mismatches 2023-04-09 12:50:01 +02:00
Alexander Tkachov
77d4b45b15 GUI: Fix CloudConnectionWizard on 3ds 2023-04-08 18:04:26 +02:00
Alexander Tkachov
7798c2af9f CLOUD: Prepare #4860 to merge
- regenerate themes .zips;
- minor cleanup.
2023-04-08 16:20:11 +02:00
Alexander Tkachov
14b85a41dc GUI: CloudConnectionWizard I18N 2023-04-08 16:20:11 +02:00
Alexander Tkachov
cc38b31ae7 CLOUD: Janitorial
- rename JSON::getPreparedContents() to JSON::untaintContents();
- minor changes to ConnectCloudClientHandler and CloudConnectionWizard.
2023-04-08 16:20:11 +02:00
Alexander Tkachov
67580ee293 GUI: Regenerate themes .zips 2023-04-08 16:20:11 +02:00
Alexander Tkachov
538303e408 GUI: Fix CloudConnectionWizard warnings 2023-04-08 16:20:11 +02:00
Alexander Tkachov
f3149a9b5d CLOUD: Add new connection wizard
- remove Options widgets of the old wizard;
- add CloudConnectionWizard dialog;
- remove old widgets and add new ones in the layouts;
- update local webserver to allow passing a callback that needs to be called if storage was connected via /connect_cloud.
2023-04-08 16:20:11 +02:00
Little Cat
f66f3b4a08 GUI: Bump and regenerate themes for new dialog. 2023-04-08 00:39:38 +02:00
D G Turner
0cfc163515 GUI: Fix Signed vs. Unsigned Comparison GCC Compiler Warning 2023-03-28 23:27:10 +01:00
Eugene Sandulenko
8952ceaa2f
GUI: Process empty log path and gracefully process unreadable paths 2023-03-27 00:24:46 +02:00
Eugene Sandulenko
071ce9ef29
GUI: Add I18N comments to the launcher buttons 2023-03-26 18:02:27 +02:00