Four columns get margins that suit four columns
The wrapped layout inherited the three-column fractions, which are generous for three and wrong for four. At 800x600 that put the last column hard against the frame - 19px of slack across the whole right edge, with the longest vehicle name needing all but 2px of its 160px column. The wrapped case now spreads its four columns evenly on its own margins, and the unwrapped case keeps the proportions it always had. At 800x600 the columns go to 168px with 40px of slack; 1024x768 and 1280x720 land comfortably too. 640x480 cannot be made to fit: four columns of long names want more width than there is, so names there are drawn with an ellipsis rather than sliced through a glyph. That applies everywhere, so any window too narrow for its content degrades the same readable way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+29
-6
@@ -641,11 +641,6 @@ namespace
|
||||
if (row_h < 18) row_h = 18;
|
||||
if (row_h > 30) row_h = 30;
|
||||
|
||||
int col_w = client_w / 5;
|
||||
int col1 = client_w / 14;
|
||||
int col2 = col1 + col_w + client_w / 28;
|
||||
int col3 = col2 + col_w + client_w / 28;
|
||||
int col4 = col3 + col_w + client_w / 28;
|
||||
int top = client_h / 7;
|
||||
|
||||
//---------------------------------------------------------------
|
||||
@@ -665,6 +660,31 @@ namespace
|
||||
int vehicle_split = wrap_vehicles
|
||||
? (vehicle_count + 1) / 2 // balanced, not filled-then-spilled
|
||||
: vehicle_count;
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Three columns can afford generous margins; four cannot. Keeping
|
||||
// the three-column fractions for a fourth column left the last one
|
||||
// hard against the frame - 19px of slack at 800x600, with the
|
||||
// longest vehicle name needing all but 2px of its column. So the
|
||||
// wrapped layout spreads its four columns evenly instead, and the
|
||||
// unwrapped one keeps the proportions it always had.
|
||||
//---------------------------------------------------------------
|
||||
int col_w, col1, gap;
|
||||
if (wrap_vehicles)
|
||||
{
|
||||
col1 = client_w / 20;
|
||||
gap = client_w / 50;
|
||||
col_w = (client_w - 2 * col1 - 3 * gap) / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
col1 = client_w / 14;
|
||||
gap = client_w / 28;
|
||||
col_w = client_w / 5;
|
||||
}
|
||||
int col2 = col1 + col_w + gap;
|
||||
int col3 = col2 + col_w + gap;
|
||||
int col4 = col3 + col_w + gap;
|
||||
int loadout_col = wrap_vehicles ? col4 : col3;
|
||||
|
||||
int y = top;
|
||||
@@ -905,8 +925,11 @@ namespace
|
||||
}
|
||||
RECT text = row;
|
||||
text.left += 6;
|
||||
// On a narrow window the longest names (Screaming Broccoli,
|
||||
// Blacker Tarantula) outrun their column. Ellipsis rather than
|
||||
// a glyph sliced down the middle.
|
||||
DrawTextA(mem, ItemName(item->group, item->index), -1, &text,
|
||||
DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||||
DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
|
||||
}
|
||||
|
||||
// pilot-name header
|
||||
|
||||
Reference in New Issue
Block a user