summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2021-04-19 09:29:49 +0100
committerPeterN <peter@fuzzle.org>2021-04-30 17:08:15 +0100
commit56a6f66903de5b999c686008b1d3243f0c61f5f4 (patch)
treed8f3050d35deebe42feaa64399a5f958111bf6df
parent63cc340dc189d3613a8604c8287fc8e647d5cb01 (diff)
downloadopenttd-56a6f66903de5b999c686008b1d3243f0c61f5f4.tar.xz
Codechange: Use text lines instead of pixel height of font for link graph widgets.
-rw-r--r--src/linkgraph/linkgraph_gui.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp
index 2d715aaf5..e0986fdb5 100644
--- a/src/linkgraph/linkgraph_gui.cpp
+++ b/src/linkgraph/linkgraph_gui.cpp
@@ -383,7 +383,8 @@ NWidgetBase *MakeSaturationLegendLinkGraphGUI(int *biggest_index)
NWidgetVertical *panel = new NWidgetVertical(NC_EQUALSIZE);
for (uint i = 0; i < lengthof(LinkGraphOverlay::LINK_COLOURS); ++i) {
NWidgetBackground * wid = new NWidgetBackground(WWT_PANEL, COLOUR_DARK_GREEN, i + WID_LGL_SATURATION_FIRST);
- wid->SetMinimalSize(50, FONT_HEIGHT_SMALL);
+ wid->SetMinimalSize(50, 0);
+ wid->SetMinimalTextLines(1, 0, FS_SMALL);
wid->SetFill(1, 1);
wid->SetResize(0, 0);
panel->Add(wid);
@@ -403,14 +404,16 @@ NWidgetBase *MakeCargoesLegendLinkGraphGUI(int *biggest_index)
row = new NWidgetHorizontal(NC_EQUALSIZE);
}
NWidgetBackground * wid = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, i + WID_LGL_CARGO_FIRST);
- wid->SetMinimalSize(25, FONT_HEIGHT_SMALL);
+ wid->SetMinimalSize(25, 0);
+ wid->SetMinimalTextLines(1, 0, FS_SMALL);
wid->SetFill(1, 1);
wid->SetResize(0, 0);
row->Add(wid);
}
/* Fill up last row */
for (uint i = 0; i < 4 - (NUM_CARGO - 1) % 5; ++i) {
- NWidgetSpacer *spc = new NWidgetSpacer(25, FONT_HEIGHT_SMALL);
+ NWidgetSpacer *spc = new NWidgetSpacer(25, 0);
+ spc->SetMinimalTextLines(1, 0, FS_SMALL);
spc->SetFill(1, 1);
spc->SetResize(0, 0);
row->Add(spc);