Commit Graph

307 Commits (feb94d233d8fdceff193a4c59298960d8148d470)

Author SHA1 Message Date
Peter Nelson feb94d233d
Codechange: Remove deferred nested_array initialization path. (#11640)
Having two ways (`FillNestedArray` and `SetupSmallestSize`) to initialize
`Window::nested_array` introduces confusion.

Instead, make `FillNestedArray` the canonical way, always call it, and remove
init_array from `SetupSmallestSize`.
5 months ago
Peter Nelson 3317e29847 Fix #11516: Adjust window size by interface scale during ReInit.
To simplify this and ensure that scaling only occurs once, regardless of
resize nesting, each window now remembers interface scale.
6 months ago
Peter Nelson 60565da8f9
Codechange: Add specific WidgetDimension for dropdown list window. (#11554)
This avoids contorting fullbevel dimensions.
6 months ago
Peter Nelson 58c252b81a Cleanup: Remove unnecessary pressed button offset code. 6 months ago
Peter Nelson d4008850e3 Codechange: Ensure function opening `{` is on new line. 7 months ago
Peter Nelson 55adbe10b7 Add: WidgetDimensions for 'sparse' widget windows.
These are for windows that have space between widgets instead of being clumped together.
7 months ago
Peter Nelson ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
7 months ago
Peter Nelson 665902f5ba Codechange: Add widget dimensions to standardise picker winodws. 7 months ago
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
7 months ago
Peter Nelson f379b31e28 Add: data parameter in Window::Close method.
This allows passing data when closing a window, e.g. to indicate how it was closed.
8 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 9 months ago
Rubidium 7ef22af2bb Codechange: introduce and use function to raise and dirty a set of widgets when they are lowered 9 months ago
Rubidium 8ab0936491 Codechange: use parameter pack/folding instead of va_arg macros for widget states 9 months ago
Rubidium 8c742b456f Codechange: use Textbuf directly, instead via several virtual functions in Window 9 months ago
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.
9 months ago
Patric Stout 07730584d7
Codechange: make explicit when a TileIndex is cast to its basetype (#11190)
This prevents people accidentially assigning a TileIndex to a Date
or any other type they shouldn't.
10 months ago
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
11 months ago
Rubidium 836541b41c Codechange: use SetDParam and CopyOutDParam for tooltips 12 months ago
PeterN f51f117b00
Change: Add window description flag to disallow interactive window closing. (#11008)
This replaces/simplifies testing for a closebox to allow closing a window with right-click, and testing for specific window classes when closing all windows by hotkey.

This allows right-click closing of dropdowns and the high-score window.
12 months ago
PeterN ebc451b071
Fix #10987: Double-close of dropdown stopped land-info tool working as default. (#11000)
Clicking and releasing on the query toolbar icon is meant to select the land-info tool.

This did not work as during closing a window, OnFocusLost() is called, which then closes the window again. These two calls toggled the land-info tool one and off in the same action.

Resolve by not calling Window::Close in OnFocusLost() if the window is already closing.
12 months ago
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 1 year ago
Peter Nelson c38df2d589 Codechange: Use std::map instead of custom SmallMap. 1 year ago
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 1 year ago
Patric Stout 60399e17bd Codechange: C++-ify the Layouter and related functions
They all now access a std::string_view, instead of a "const char *"
or std::string (in some cases).

Additionally, GetCharAtPosition and friends now return an index
instead of a "const char *", as it makes for a more clear interface.
1 year ago
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
1 year ago
Peter Nelson 35ba49bfb4 Change: Rename text colour NWidgetPart to SetTextStyle and add font size.
This allows to set both text colour and size for any widget with default
drawing.
1 year ago
Peter Nelson e8df28d7f3 Add: parameter for ReInit() to reposition window to default. 1 year ago
Patric Stout 1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
1 year ago
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.
1 year ago
Bernard Teo 8a78fa7121
Feature: Contextual actions for vehicles grouped by shared orders (#8425) 2 years ago
Peter Nelson ecb5393c55 Change: Standardize progress bar layout.
Progress bars are drawn differently depending on when it was added, with
different layouts and sizes.

This change adds a standard padding size to use, and makes all progress
bars visually similar, with scaled padding.
2 years ago
Peter Nelson e554fd7808 Change: Hide WidgetDrawDistances from general use. 2 years ago
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2 years ago
Peter Nelson 23a8222200 Change: Split vscroll and hscroll padding.
Vertical and horizontal scrollbars are different sizes, this allows
different padding for each type.
2 years ago
Peter Nelson b5693becdc Add: Define scaled WidgetDimensions.
Includes RectPadding container.
2 years ago
Peter Nelson 17d1fe26c2 Codechange: Helpers to allow passing a Rect to some functions. 2 years ago
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 3 years ago
glx22 994bf19aef Fix f6d5c01: Delay deletion when closing windows 3 years ago
frosch f6d5c0136e Codechange: make Window destruction not rely on undefined behavior. 3 years ago
frosch f96f113951 Codechange: use IterateFromBack/Front only if the order is important.
Use Iterate if the order does not matter.
3 years ago
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.
3 years ago
frosch aba239479b Codechange: remove excessive templating in favour of a single const_cast.
The const_cast will be removed again in a later commit.
3 years ago
glx22 14e92bd8e2 Codechange: Replace window related FOR_ALL with range-based for loops 3 years ago
Peter Nelson 51b4bd6c38 Codechange: Add widget text colour override property. 3 years ago
Peter Nelson 636e37d183 Codechange: Add internal widget alignment property, along with widget part. 3 years ago
Jonathan G Rennison 3ede756d23 Fix: Viewport drag tooltips not being removed when dragging over other windows 3 years ago
glx c0d7949d7c Fix: Don't use a timer for hundredth tick determination 3 years ago
Niels Martin Hansen 2d9fa81bd0 Feature: Plant clumps of trees in editor by dragging on the landscape 3 years ago
TechGeekNZ a10013dd00 Codechange: Spell 'Viewport' consistently
Some places in the codebase misspell 'Viewport' as 'ViewPort' or 'view_port'.
This patch makes everything consistent.
4 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago