Commit Graph

44 Commits

Author SHA1 Message Date
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Peter Nelson 7737aa6640 Codechange: Make all NWidgetPart arrays constexpr.
This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
2024-01-16 21:57:05 +00:00
Peter Nelson a0dfb76e34 Codechange: Replace mishmash of types for widget index with WidgetID.
Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
2023-12-30 00:23:57 +00:00
Peter Nelson 6c5aeae01b
Fix #11577: Extra viewport opened in wrong location. (#11578)
ExtraViewportWindow calls IninitializeViewport() with focus as 0, which is ambiguous as focus should be either a TileIndex or a VehicleID.

Instead, pass the tile and let InitializeViewport() handle setting all the coordinates.
2023-12-13 02:19:16 +00:00
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
2023-11-02 22:25:01 +00:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Peter Nelson e8015e497d Codechange: Use begin/end of nwidget parts of begin/length.
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.

And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
PeterN 5f99c8c4aa
Fix: Extra viewport cannot be scrolled with right-click-close. (#10644) 2023-04-12 19:14:48 +00: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
Bouke Haarsma 93d2d4590f Fix #9995: Adjust viewport zoom level for HiDPI displays
On HiDPI screens the zoom level is increased for detailed rendering. This causes hard-coded zoom levels to be off by this adjustment. To fix these default zoom levels, we scale the zoom level based on `_gui_zoom` to get the scaled zoom level.
2022-10-18 22:03:21 +02: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
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
peter1138 317f69c152 Codechange: Use override specifier in Window-derived classes. 2019-03-24 16:10:04 +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
frosch ae815ecf1b (svn r27743) -Fix [FS#6537]: Extra viewports did not center on the selected tile. (hackalittlebit) 2017-02-05 17:54:46 +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
frosch 4e4e635916 (svn r25294) -Feature: Add another button to window title bars to resize the window to its default size. 2013-05-26 19:30:07 +00:00
frosch 8157a8afd8 (svn r25290) -Add: Assign string names to notable windows. 2013-05-26 19:25:01 +00:00
frosch 56e4a8c4d6 (svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction. 2013-05-26 19:23:42 +00:00
frosch 03736af2ae (svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default. 2012-11-11 16:10:43 +00:00
rubidium b6a303387c (svn r23532) -Codechange: unify widget naming of (extra) viewport 2011-12-16 16:29:53 +00:00
truebrain 2aa774e831 (svn r23528) -Codechange: move widget enums to widgets/NNN_type.h 2011-12-15 22:22:55 +00:00
peter1138 3e1aaa1235 (svn r23321) -Fix (r23316): Extra viewports and waypoint detail opened up at wrong zoom level. 2011-11-24 18:55:56 +00:00
frosch ec9540a12a (svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData(). 2011-03-13 21:31:29 +00:00
frosch 9e1695aa1e (svn r21977) -Codechange: Always cal Window::OnMouseWheel(), independent of viewport scroll/zoom settings. 2011-02-05 16:36:37 +00:00
rubidium 7eba2bf4d3 (svn r21890) -Cleanup: remove some unneeded includes 2011-01-22 14:52:20 +00:00
rubidium 561449992a (svn r21838) -Change: allow LMB scrolling with the mouse outside of the extra viewport instead of canceling scrolling when going slightly over the edge 2011-01-18 21:09:13 +00:00
alberth f5c6fd1a25 (svn r21331) -Codechange: Make drawing the widgets default behaviour in OnPaint(). 2010-11-26 15:22:18 +00:00
frosch 12a7e2fde0 (svn r20962) -Fix [FS#4166](r20956): Determine tile under cursor before opening the new viewport. It might appear just below the cursor. 2010-10-17 13:54:05 +00:00
frosch 918da8432a (svn r20956) -Feature: Center new extra viewports on the tile below the mouse. Only center on center of main viewport if mouse is not in any viewport. 2010-10-16 23:13:05 +00:00
rubidium e356cb9405 (svn r20281) -Codechange: unify case scope closure + break coding style 2010-08-01 18:53:30 +00:00
frosch 88019e64e1 (svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick(). 2010-01-30 18:34:48 +00:00
yexo 9143b65785 (svn r18730) -Fix [FS#3414]: new viewports didn't center on the correct position 2010-01-05 14:26:15 +00:00
alberth 91872aca48 (svn r18588) -Feature [FS#2943]: Add shading and unshading of windows. 2009-12-21 16:24:29 +00:00
rubidium 293dfd7c3e (svn r18322) -Codechange: remove the WDP duplication; no need to tell the same twice. 2009-11-28 14:42:35 +00:00
rubidium 8d6e323ef8 (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input 2009-11-24 21:13:36 +00:00
rubidium 14300d309c (svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions 2009-11-24 18:05:55 +00:00
rubidium 69b6d9309a (svn r18274) -Codechange: remove the unused WDF flags 2009-11-24 17:28:29 +00:00
alberth 2b6f792513 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool. 2009-11-22 18:26:01 +00:00
rubidium 5f2ddfbc5a (svn r18152) -Codechange: remove the 'minimum window size' from the WindowDesc; it's determined from the (nested) widgets 2009-11-17 19:16:48 +00:00
rubidium 3d2d7af88f (svn r18086) -Codechange: remove 'widget' from WindowDesc 2009-11-15 10:26:01 +00:00
rubidium ca0521f89f (svn r17853) -Codechange: remove the 'delta' parameter from OnResize; it was used in ways that aren't always wanted, causing bugs and the like. Also with nested widgets most reasons for handling OnResize have gone. 2009-10-24 14:53:55 +00:00
smatz bfedac1166 (svn r17822) -Codechange: move 'extra viewport' code from smallmap_gui.cpp to viewport_gui.cpp 2009-10-20 18:38:38 +00:00