Commit Graph

310 Commits (0a9c44d1a2b3b5de76595dfc74938fca34b3448a)

Author SHA1 Message Date
Jonathan G Rennison 0a9c44d1a2 Merge branch 'master' into jgrpp
# Conflicts:
#	src/airport_gui.cpp
#	src/blitter/32bpp_anim_sse4.cpp
#	src/console_cmds.cpp
#	src/linkgraph/linkgraph_gui.cpp
#	src/newgrf_object.h
#	src/road_gui.cpp
#	src/widgets/road_widget.h
#	src/window.cpp
2 years ago
Peter Nelson ba94efba87 Change: Add flag to apply resize to largest resize step first.
Resize step is normally allocated equally amongst all resizable widgets.
With this flag, we allocate as much as possible from the largest
resize step first.
2 years ago
Peter Nelson 296af146fb Change: Default widget text colour to black.
TC_FROMSTRING really means blue, and we almost never actually use
blue text.
2 years ago
Jonathan G Rennison ffef1c9e44 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/saveload/cargopacket_sl.cpp
#	src/saveload/cheat_sl.cpp
#	src/saveload/company_sl.cpp
#	src/saveload/engine_sl.cpp
#	src/saveload/map_sl.cpp
#	src/saveload/order_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/station_sl.cpp
#	src/saveload/vehicle_sl.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/stdafx.h
#	src/table/settings/settings.ini
#	src/town_cmd.cpp
#	src/vehicle.cpp
3 years ago
Patric Stout 28e90769f7 Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
3 years ago
PeterN d274a81d3f Fix: Apply unscaled padding to Viewport inside WWT_INSET. (#9219)
Since pixel dimensions in SetPadding() are scaled by GUI size, padding for inset viewports was excessive.

Instead, automatically apply padding for WWT_INSET at widget level. This applies to all widgets inside a WWT_INSET, which in all instances is a NWID_VIEWPORT.

(cherry picked from commit 330a305c99)
3 years ago
PeterN 330a305c99
Fix: Apply unscaled padding to Viewport inside WWT_INSET. (#9219)
Since pixel dimensions in SetPadding() are scaled by GUI size, padding for inset viewports was excessive.

Instead, automatically apply padding for WWT_INSET at widget level. This applies to all widgets inside a WWT_INSET, which in all instances is a NWID_VIEWPORT.
3 years ago
Peter Nelson b414060f7c Codechange: Make GetCurrentRect() conform to usual Rect bounds, and reuse it.
Similar code is already repeated in other locations.

(cherry picked from commit d8e06e590a)
3 years ago
Peter Nelson 065ae3964a Codechange: Don't update window contents if scrollbar position has not moved.
(cherry picked from commit 52b16237ad)
3 years ago
Peter Nelson d8e06e590a Codechange: Make GetCurrentRect() conform to usual Rect bounds, and reuse it.
Similar code is already repeated in other locations.
3 years ago
Peter Nelson 52b16237ad Codechange: Don't update window contents if scrollbar position has not moved. 3 years ago
PeterN f9a03c4e63 Fix: Crash when extra viewport height is zero with sign in view. (#9175)
If a viewport sign straddles the top of a viewport, a crash will occur if the viewport height is zero. This is resolved by simply not attempting to draw the viewport in this situation, consistent with other widgets.

(cherry picked from commit 256dbee255)
3 years ago
Peter Nelson a469b4f395 Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed.
(cherry picked from commit 4791ff2862)
3 years ago
Peter Nelson 43a3a233df Cleanup: Set unchanging scrollbar properties in constructor.
(cherry picked from commit 6fe5353da2)
3 years ago
Peter Nelson 1a4a6f579e Cleanup: Call SetMinimalSize instead of setting min_y directly.
(cherry picked from commit 03a43b8247)
3 years ago
Peter Nelson 23938cb583 Fix: Specify width when width is required instead of top.
(cherry picked from commit f5569763c9)
3 years ago
Peter Nelson bdd55aad07 Cleanup: Remove fairly redundant DrawDropdown() function.
(cherry picked from commit 4c6cca459a)
3 years ago
Peter Nelson dc6055bd82 Cleanup: Horizontal widget size is commonly width rather than length.
(cherry picked from commit 5153e1b6e3)
3 years ago
PeterN 256dbee255
Fix: Crash when extra viewport height is zero with sign in view. (#9175)
If a viewport sign straddles the top of a viewport, a crash will occur if the viewport height is zero. This is resolved by simply not attempting to draw the viewport in this situation, consistent with other widgets.
3 years ago
Peter Nelson 4791ff2862 Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed. 3 years ago
Peter Nelson 6fe5353da2 Cleanup: Set unchanging scrollbar properties in constructor. 3 years ago
Peter Nelson 03a43b8247 Cleanup: Call SetMinimalSize instead of setting min_y directly. 3 years ago
Peter Nelson f5569763c9 Fix: Specify width when width is required instead of top. 3 years ago
Peter Nelson 4c6cca459a Cleanup: Remove fairly redundant DrawDropdown() function. 3 years ago
Peter Nelson 5153e1b6e3 Cleanup: Horizontal widget size is commonly width rather than length. 3 years ago
Jonathan G Rennison 253772e9af Merge branch 'master' into jgrpp
# Conflicts:
#	CMakeLists.txt
#	COMPILING.md
#	src/console.cpp
#	src/console_cmds.cpp
#	src/console_internal.h
#	src/rev.cpp.in
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
Peter Nelson 2a0365b3d9 Cleanup: Remove unnecessary parameter of GetScrolledRowFromWidget()
Line height defaults to the resize height of the relevant widget, which is
set in all cases. Therefore it is not necessary to specify this value every time.

Additionally fixes scrolled padding for the framerate window.
3 years ago
Rubidium bf4fe19a66 Codechange: merge duplicated logic to scroll in lists by key into a single function 3 years ago
Jonathan G Rennison edfa04286b Merge branch 'master' into jgrpp
# Conflicts:
#	.github/workflows/release.yml
#	bin/CMakeLists.txt
#	src/dock_gui.cpp
#	src/lang/brazilian_portuguese.txt
#	src/lang/catalan.txt
#	src/lang/czech.txt
#	src/lang/dutch.txt
#	src/lang/english.txt
#	src/lang/english_US.txt
#	src/lang/estonian.txt
#	src/lang/finnish.txt
#	src/lang/french.txt
#	src/lang/german.txt
#	src/lang/hungarian.txt
#	src/lang/indonesian.txt
#	src/lang/italian.txt
#	src/lang/japanese.txt
#	src/lang/korean.txt
#	src/lang/lithuanian.txt
#	src/lang/luxembourgish.txt
#	src/lang/norwegian_bokmal.txt
#	src/lang/polish.txt
#	src/lang/portuguese.txt
#	src/lang/romanian.txt
#	src/lang/russian.txt
#	src/lang/serbian.txt
#	src/lang/simplified_chinese.txt
#	src/lang/slovak.txt
#	src/lang/spanish.txt
#	src/lang/spanish_MX.txt
#	src/lang/swedish.txt
#	src/lang/tamil.txt
#	src/lang/ukrainian.txt
#	src/lang/vietnamese.txt
#	src/newgrf.cpp
#	src/newgrf_gui.cpp
#	src/object_gui.cpp
#	src/pathfinder/yapf/yapf_costrail.hpp
#	src/pathfinder/yapf/yapf_node_rail.hpp
#	src/rail_cmd.cpp
#	src/roadveh_cmd.cpp
#	src/town_cmd.cpp
#	src/vehicle.cpp
#	src/water_cmd.cpp
3 years ago
Jonathan G Rennison 5e14b54a0c Merge branch 'master' into jgrpp 3 years ago
Charles Pigott dd798d688b
Fix #8919: Release builds with asserts enabled (#8925) 3 years ago
Patric Stout fece1c57ca
Codechange: Suppress warnings when asserts are disabled (#8917) 3 years ago
Tyler Trahan de891238d6
Change: Recolour graph windows to brown (#8700) 3 years ago
PeterN 9fdc881005
Fix: Scale PIP-padding the same as regular padding. (#8829) 3 years ago
Jonathan G Rennison b7ddd486cf Merge branch 'master' into jgrpp
# Conflicts:
#	cmake/CompileFlags.cmake
#	src/aircraft_cmd.cpp
#	src/blitter/32bpp_anim.cpp
#	src/cargopacket.cpp
#	src/cheat_gui.cpp
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/core/pool_func.hpp
#	src/date.cpp
#	src/economy.cpp
#	src/error_gui.cpp
#	src/ground_vehicle.cpp
#	src/ground_vehicle.hpp
#	src/group_gui.cpp
#	src/industry_cmd.cpp
#	src/lang/dutch.txt
#	src/lang/french.txt
#	src/lang/german.txt
#	src/linkgraph/linkgraph_gui.cpp
#	src/linkgraph/mcf.cpp
#	src/network/network_content.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/newgrf_engine.cpp
#	src/newgrf_station.cpp
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/pathfinder/follow_track.hpp
#	src/pathfinder/yapf/yapf_common.hpp
#	src/saveload/saveload.cpp
#	src/settings_gui.cpp
#	src/station_cmd.cpp
#	src/station_kdtree.h
#	src/string_func.h
#	src/table/settings.ini
#	src/tgp.cpp
#	src/timetable_cmd.cpp
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/train_cmd.cpp
#	src/train_gui.cpp
#	src/tree_gui.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
#	src/viewport.cpp
#	src/viewport_sprite_sorter_sse4.cpp
#	src/window.cpp
3 years ago
Patric Stout af22a4f2cd Add: show in the tooltip of disabled toolbar buttons why they are disabled 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Jonathan G Rennison 8071976b0e Fix wrong flag set in NWidgetBase::SetDirty 4 years ago
Jonathan G Rennison 5b78090a61 Merge branch 'master' into jgrpp
# Conflicts:
#	CMakeLists.txt
#	src/saveload/town_sl.cpp
#	src/screenshot.h
#	src/script/api/ai/ai_date.hpp.sq
#	src/script/api/ai/ai_marine.hpp.sq
#	src/script/api/ai/ai_station.hpp.sq
#	src/script/api/game/game_date.hpp.sq
#	src/script/api/game/game_marine.hpp.sq
#	src/script/api/game/game_station.hpp.sq
#	src/script/api/game/game_window.hpp.sq
#	src/script/api/script_window.hpp
#	src/script/api/template/template_window.hpp.sq
#	src/signal.cpp
#	src/statusbar_gui.cpp
#	src/toolbar_gui.cpp
#	src/viewport.cpp
#	src/viewport_func.h
4 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
TechGeekNZ 8652a4db76 Cleanup: Give `SetDirtyBlocks` a more descriptive name. 4 years ago
Jonathan G Rennison 0a6a38886d Viewport: Fix viewport updates being applied to shaded windows 4 years ago
Jonathan G Rennison 8f442500ea Change how dirty screen, window and viewport areas are tracked for later redrawing
Track dirty viewport areas seperately form general screen redraws.
Maintain a dirty block grid per viewport, with a smaller block size.
Use even smaller block size in viewport map mode.

Use a rectangle array for general screen redraws instead of a block grid.

Add a dirty bit to windows and widgets, to simplify the common case
of repainting a whole window or widget, without catching
neighbouring windows or viewports.
4 years ago
Jonathan G Rennison 3517068e30 Clip widget draw calls which are outside _cur_dpi 4 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
glx 1f418555a1 Fix #7742, 66dd7c3: widget position can be negative 5 years ago
Niels Martin Hansen 62dec9f174 Fix: Scale all min size and padding by UI scale 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago