Commit Graph

562 Commits

Author SHA1 Message Date
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
glx 410b81537c Fix 801cbea9c: operator< is not always the best idea
Also removes unused and anyway broken SmallMap::SortByKey() function.
2019-04-13 21:05:25 +02:00
glx 801cbea9cc Codechange: use std::sort() for all std::vector types 2019-04-13 12:49:18 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson 81315939b9 Codechange: Replaced SmallVector::Find() non-const with std::find() 2019-03-26 20:15:57 +00:00
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 2019-03-26 20:15:57 +00:00
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 2019-03-26 20:15:57 +00:00
peter1138 f5f33da126 Codechange: Implement OnTooltip event for custom window tooltips.
This avoids windows from needing to know or care about tooltip delay settings.
2019-03-20 23:00:32 +00:00
Patric Stout e3c639a09f Remove: ENABLE_NETWORK switch
This switch has been a pain for years. Often disabling broke
compilation, as no developer compiles OpenTTD without, neither do
any of our official binaries.

Additionaly, it has grown so hugely in our codebase, that it
clearly shows that the current solution was a poor one. 350+
instances of "#ifdef ENABLE_NETWORK" were in the code, of which
only ~30 in the networking code itself. The rest were all around
the code to do the right thing, from GUI to NewGRF.

A more proper solution would be to stub all the functions, and
make sure the rest of the code can simply assume network is
available. This was also partially done, and most variables were
correct if networking was disabled. Despite that, often the #ifdefs
were still used.

With the recent removal of DOS, there is also no platform anymore
which we support where networking isn't working out-of-the-box.

All in all, it is time to remove the ENABLE_NETWORK switch. No
replacement is planned, but if you feel we really need this option,
we welcome any Pull Request which implements this in a way that
doesn't crawl through the code like this diff shows we used to.
2019-03-20 19:24:55 +01:00
peter1138 56a6d7aec8 Fix #7227: Don't apply mouse-hasn't-moved test to scrollbars. 2019-02-22 21:32:12 +00:00
Peter Nelson de9f54ccc1 Codechange: Change scrolling_scrollbar to mouse_capture_widget, and dispatch OnClick() event if widget is not a scrollbar.
This allows any widget to support mouse capture.
2019-02-21 08:11:35 +00:00
Joan Josep 548ec05a48 Add: News menu entry and shortcut for deleting all messages. (#7240) 2019-02-16 23:15:58 +00:00
Peter Nelson 9dc36057eb Fix #7058, Fix #7161: Network chat messages did not expire. 2019-02-02 16:58:04 +00:00
J0an Josep 9ce92521c1 Fix: If screen size changes, windows are relocated and dropdown may not fit the screen. 2019-01-20 21:43:00 +00:00
nikolas d8ccad91f9 Fix: Some code and comment typos
Found with codespell
2019-01-17 22:01:07 +00:00
PeterN 89f0017a67 Fix #7050: Missing guard around network chat message function for compiling with networking disabled. (#7058) 2019-01-13 16:50:21 +00:00
PeterN 5ff0c24993 Fix #6780: Some windows didn't get updated from OnTick() (#7048) 2019-01-12 23:23:23 +00:00
Peter Nelson c693463c29 Fix: Always draw dirty blocks, else fast-forward is super fast. 2019-01-11 11:56:21 +00:00
Peter Nelson 806e7d25dd Change: Use GUITimer class instead of bare int/uints. 2019-01-11 11:56:21 +00:00
Peter Nelson 59fe4f28c8 Change: Animate text effects by real time instead of game ticks. 2019-01-11 11:56:21 +00:00
Peter Nelson ead9c9eab5 Change: Switch various window timers to real time instead of game ticks. 2019-01-11 11:56:21 +00:00
Peter Nelson 2a8fa5fef9 Change: Split up Window::OnTick into OnGameTick and OnRealtimeTick. Adjust timers to work with milliseconds instead of ticks. 2019-01-11 11:56:21 +00:00
Juanjo 9e30054de9 Codechange: Use window class as expected. 2019-01-04 23:55:07 +01:00
Charles Pigott ca5f73b196 Codechange: Turn a define into a constant 2018-10-31 12:41:49 +01:00
Charles Pigott b5028efc1f Fix: Protect against a few out of bounds or uninitialised usage errors 2018-10-31 12:41:49 +01:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00
Niels Martin Hansen 2a868b9f3b Feature: Framerate display window (#6822)
Frame rate and various game loop/graphics timing measurements and graphs. Accessible via the Help menu, and can print some stats in the console via the fps command.
2018-07-19 21:17:07 +02:00
Alexander Weiss 2406500140 Fix: [OSX] Minor 2D scrolling fixes (#6793)
* Codechange: Check for scrollwheel_scrolling first when scrolling viewport instead of first setting normal values and then overwriting them.

* Fix #6558: [OSX] Reset 2D scrolling values when not scrolling to prevent unintended window focus changes

* Change: [OSX] Include initial scrolling movement when using 2D scrolling to make it more responsive

* Fix: [OSX] 2D scrolling not working when setting viewport scroll behaviour to use left mouse button
2018-05-29 09:44:33 +01:00
Alexander Weiss e1a164b531 Change: [OSX] Setting mouse-wheel to scroll the map does not disable pinch to zoom 2018-05-24 21:31:37 +02:00
PeterN cfe6a8ea4f
Add: Replace independment map scrolling GUI settings with single option, and add choice to not lock cursor position when scrolling. (#6756) 2018-04-28 22:27:14 +01:00
michi_cc e856e3cca8 (svn r27934) -Fix (r27900): Warning about unsigned unary minus. 2017-12-09 19:21:41 +00:00
frosch 09abccd316 (svn r27901) -Codechange: GetWindowZPriority only needs a WindowClass; this way it can also be used for WindowDesc before a Window instance is created. (3298) 2017-08-27 13:14:37 +00:00
frosch 80dffae130 (svn r27900) -Change [FS#6568]: Remove the gap between windows when positioning them after opening.
-Fix: Make automatic window-positioning RTL-aware.
-Fix: Automatic window-positioning now uses GUI-scale/style dependent sizes/distances instead of fixed pixel values.
2017-08-27 11:48:38 +00:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
peter1138 65d77ff317 (svn r27826) -Fix (r27825): Wrong code style 2017-03-24 19:25:01 +00:00
peter1138 d934ef9b00 (svn r27825) -Feature [FS#4950]: Add option to close windows with right click (Flamefire) 2017-03-24 18:55:16 +00:00
peter1138 73ea8cdb21 (svn r27816) -Fix [FS#6421]: Do not search directories when opening ini files as we already have their full path. 2017-03-20 19:30:49 +00:00
frosch 3419bff4ed (svn r27712) -Codechange: Reduce recursions in DrawOverlappedWindow by limiting the area to the window bounds first. (adf88) 2016-12-25 17:56:57 +00:00
frosch 3cb7d9703b (svn r27628) -Codechange: Prepare for drawing cursors consisting of multiple sprites. 2016-08-15 18:33:08 +00:00
frosch cade383f9b (svn r27579) -Change [FS#6402]: Performance improvement for dedicated servers by skipping drawing calls earlier in the process. (JGR) 2016-05-22 11:30:25 +00:00
frosch 44d1fc4253 (svn r27425) -Fix [FS#5842]: Crash when switching to or taking over companies, when an order window of a vehicle of the new company was opened. Now close those windows. 2015-10-30 17:23:16 +00:00
rubidium 06d7d63216 (svn r27185) -Fix: prevent the compiler from optimizing an assignment away which caused GCC 5 to actually crash 2015-03-13 20:54:35 +00:00
frosch 1cf09f804b (svn r27147) -Fix: Scale (non-custom) default window sizes according to GUI zoom. 2015-02-13 21:25:48 +00:00
frosch e113f5e4a1 (svn r27146) -Fix: Make statusbar and chat-entry window use the same width as the toolbar. Otherwise they lack a size definition. 2015-02-13 21:13:45 +00:00
peter1138 253c91b17d (svn r26990) -Feature: Add option to choose normal, double or quad-size interface. 2014-10-11 13:22:37 +00:00
planetmaker 61e129cc22 (svn r26815) -Change: Allow to set the granularity of the tooltip hover time in milliseconds instead of seconds. New default value is 250ms 2014-09-13 13:30:31 +00:00
alberth 8755c26793 (svn r26610) -Feature: Select an editable preset name for saving. 2014-05-24 19:11:20 +00:00
rubidium b476086c39 (svn r26538) -Codechange: remove double accounting of the drivers 2014-04-28 21:06:51 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
alberth aee9444c1b (svn r26392) -Fix[FS#5933] No need to call OnFocus twice (MJP) 2014-03-05 21:21:55 +00:00
rubidium 2618d960e3 (svn r26209) -Codechange: remove some template magic and simplify some code 2014-01-02 22:41:58 +00:00
rubidium 79ccf48636 (svn r26122) -Fix-ish: remove essentially dead code; if nested_array were NULL there, it would segfault in RaiseWidget 2013-11-26 13:23:31 +00:00
frosch c08259fe92 (svn r25884) -Fix: Resizing the window did not properly resize the viewport window, resulting in the link graph glitching. 2013-10-19 15:28:54 +00:00
michi_cc d15c1c5d4a (svn r25692) -Add: Replacement of a part of the edit box text with a new string. 2013-08-05 20:37:57 +00:00
michi_cc 30867c487f (svn r25691) -Add: [OSX] Support for mouse selection in the IME composition string. 2013-08-05 20:37:53 +00:00
michi_cc e2ec0ddb03 (svn r25690) -Change: [OSX] Position the candidate window at the caret position. 2013-08-05 20:37:48 +00:00