Commit Graph

520 Commits

Author SHA1 Message Date
Patric Stout
1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
2023-04-15 13:58:55 +02:00
Patric Stout
5e1bcee39b Codechange: introduce a framework for all our timers
IntervalTimer and TimeoutTimer use RAII, and can be used to replace
all the time-based timeouts, lag-detection, "execute every N" we
have.
As it uses RAII, you can safely use it as static variable, class
member, temporary variable, etc. As soon as it goes out-of-scope,
it will be safely removed.
This allows for much easier to read code when it comes to intervals.
2023-04-15 13:58:55 +02:00
glx22
b080f24bd8 Codechange: move windows common to AI and GS out of ai_gui 2023-02-05 19:27:25 +01:00
Rubidium
4e65ec1dc4 Codechange: do not declare functions in blocks 2023-01-29 20:28:45 +01:00
rubidium42
6ba55e663e Codechange: do not hide variables with other variables 2023-01-29 07:21:34 +01:00
Rubidium
f001e84e5e Codechange: use RAII to automatically restore _cur_dpi after use 2023-01-28 20:33:02 +01:00
Rubidium
bcfe0fb076 Codechange: introduce GetMainWindow() to properly account for nullptr checks
Some nullptr checks have been removed as they were not triggered with nullptr
with the null video driver and in dedicated server mode.
2023-01-14 21:15:23 +01:00
PeterN
23eec0b7b3
Fix #8971: Resize QueryStrings with interface scale change. (#10281)
* Fix: Use width of caret symbol '_' for text entry.

This replaces an arbitrary pixel width with the space actually required.

* Fix #8971: Update QueryString sizes with interface scale change.
2022-12-25 00:40:55 +00:00
PeterN
a044e8e007
Fix: Scale minimum visible caption by interface scale. (#10180) 2022-11-17 22:45:15 +00:00
Peter Nelson
890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson
b5693becdc Add: Define scaled WidgetDimensions.
Includes RectPadding container.
2022-11-12 18:28:39 +00:00
Jonathan G Rennison
64b437fa89 Fix: Data race with mixer thread performance measurements 2022-11-11 23:48:24 +01:00
Nicolas Chappe
864771ca09 Feature: [Linkgraph] Show a tooltip with statistics when hovering a link 2022-10-18 22:03:39 +02:00
Nicolas Chappe
7c79a2a767 Change: Do not generate hover events at each frame 2022-10-18 22:03:39 +02:00
Nicolas Chappe
e660860d4b Codechange: Simplify logic of mouse loop 2022-10-18 22:03:39 +02:00
Bouke Haarsma
45d98f689a Fix #9993: Handle DPI changes on macOS and Windows 2022-10-16 16:52:14 +02:00
PeterN
69527abb6f
Fix 9aef7b8c: Don't dispatch hover event if already hovering. (#10042)
This fixes the timed tooltip window being (invisibly) destroyed and
reconstructed every frame.

This also affects the unused OnHover() window event.
2022-09-22 20:38:11 +01:00
Danny de Bruijne
753b1d7e15 Feature: Add selected toolbar buttons to MacBook Pro Touch Bar 2021-09-23 21:03:00 +02:00
Patric Stout
fa1e27994d Feature: allow the use of TURN to connect client and server together
TURN is a last resort, used only if all other methods failed.
TURN is a relay approach to connect client and server together, where
openttd.org (by default) is the middleman.

It is very unlikely either the client or server cannot connect to
the STUN server, as they are both already connected to the Game
Coordinator. But in the odd case it does fail, estabilishing the
connection fails without any further possibility to recover.
2021-07-20 19:57:23 +02:00
Patric Stout
66dc0ce196 Codechange: C++-ify the usage of IniFile in settings.cpp
Instead of creating the object on heap and use a pointer, create
the object on stack and use a guaranteed-not-null pointer.
The size of IniFile doesn't warrent the forcing to heap.

Additionally, use a subclass instead of a function to do some
initial bookkeeping on an IniFile meant to read a configuration.
2021-07-02 14:30:14 +02:00
rubidium42
55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
glx22
5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
glx22
994bf19aef Fix f6d5c01: Delay deletion when closing windows 2021-05-29 21:08:25 +02:00
glx22
e66e25ff71 Fix #9269, f6d5c01: Hide windows without abusing WC_INVALID 2021-05-15 21:08:49 +02:00
Rubidium
7755f81bb8 Codechange: make explicit that virtual functions in a con/destructor are resolved statically
This as during construction the sub class has not been initialized yet, and
during destruction the sub class has already been destroyed, so the overriding
virtual function would be accessing uninitialized data.
2021-05-13 10:03:26 +02:00
frosch
f6d5c0136e Codechange: make Window destruction not rely on undefined behavior. 2021-05-12 23:22:41 +02:00
frosch
f96f113951 Codechange: use IterateFromBack/Front only if the order is important.
Use Iterate if the order does not matter.
2021-05-12 23:22:41 +02:00
frosch
22567a1f43 Codechange: use iterators instead of 'subranges' when iterating from a specific window.
Using iterators makes it easier to include or exclude the start window in the iteration.
2021-05-12 23:22:41 +02:00
frosch
95abdfdef9 Cleanup: remove unneeded labels and gotos.
The window list supports deletion of arbitrary windows, while iterating over it.
2021-05-12 23:22:41 +02:00
Peter Nelson
d8e06e590a Codechange: Make GetCurrentRect() conform to usual Rect bounds, and reuse it.
Similar code is already repeated in other locations.
2021-05-08 09:53:55 +01:00
Peter Nelson
52b16237ad Codechange: Don't update window contents if scrollbar position has not moved. 2021-05-08 09:52:54 +01:00
Peter Nelson
8321ef0061 Codechange: Set specific widgets dirty instead of window. 2021-05-08 09:52:54 +01:00
Peter Nelson
4791ff2862 Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed. 2021-04-30 17:08:15 +01:00
glx22
14e92bd8e2 Codechange: Replace window related FOR_ALL with range-based for loops 2021-04-29 21:08:24 +02:00
Didac Perez Parera
0cb99c5523
Codechange: nullptr deletion in DeleteWindowById (#8941) 2021-04-10 10:19:14 +01:00
Patric Stout
853bfc3562 Codechange: replace _realtime_tick with std::chrono for mouse events 2021-02-27 00:36:14 +01:00
Michael Lutz
8906e9e0fd Codechange: Consistently use screen size and not driver resolution for determining window sizes. 2021-02-14 11:50:18 +01:00
glx
c0d7949d7c Fix: Don't use a timer for hundredth tick determination 2021-01-10 14:07:17 +01:00
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Michael Lutz
dd138fc460 Codechange: Stringify config file paths. 2020-12-27 13:19:25 +01:00
Charles Pigott
cfa1b1e006 Fix: Compile warnings when asserts are disabled 2020-12-06 19:27:39 +00:00
TechGeekNZ
a10013dd00 Codechange: Spell 'Viewport' consistently
Some places in the codebase misspell 'Viewport' as 'ViewPort' or 'view_port'.
This patch makes everything consistent.
2020-07-27 17:31:29 +01:00
TechGeekNZ
ee570e1b6d Cleanup: Fix typos in code comments. 2020-06-09 13:15:47 +01:00
TechGeekNZ
8652a4db76 Cleanup: Give SetDirtyBlocks a more descriptive name. 2020-06-09 13:15:47 +01:00
glx
341941af85 Fix #7952: don't try to access destroyed QueryStrings 2020-01-22 19:53:27 +00:00
S. D. Cloudt
13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Jonathan G Rennison
1dba06656d Codechange: Add utility function for whether the focused window is a console 2019-11-10 17:58:42 +00:00
Jonathan G Rennison
81f159434d Codechange: Add EditBoxGainedFocus method to VideoDriver base class 2019-11-10 17:58:42 +00:00
JMcKiern
04f659e768 Fix: Some typos found using codespell 2019-09-29 21:27:32 +01:00
peter1138
82989ef076 Fix: Clicking on scrollbar 'thumb' moved position up instantly. 2019-05-02 22:16:26 +01:00