Skip to content

Commit 2c09e2b

Browse files
committed
feat: enhance split check interface usability
- Add dynamic font responsiveness to split check buttons - Implement text wrapping instead of truncation for long item names - Increase button widths (order: 250px→280px, seat: 120px→150px) - Double button heights (order: 40px→80px, seat: 84px→168px) - Remove modifier display for cleaner interface - Update changelog with detailed change documentation This improves the split check zone readability and user experience by allowing longer item names to be displayed clearly with proper text wrapping, responsive fonts, and better button sizing.
1 parent e5c5a50 commit 2c09e2b

2 files changed

Lines changed: 126 additions & 41 deletions

File tree

‎docs/changelog.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
77
## [Unreleased]
88

99
### Fixed
10+
- **Split Check Interface: Enhanced Button Display and Usability (2026-01-20)**
11+
- Improved the split check zone interface for better readability and user experience
12+
- **Changes Made**:
13+
- Added dynamic font responsiveness - buttons now properly inherit font sizes from zone settings
14+
- Implemented text wrapping instead of truncation - long item names now wrap to multiple lines within buttons
15+
- Increased button widths - order item buttons from 250px to 280px, seat buttons from 120px to 150px
16+
- Doubled button heights - order buttons from 40px to 80px, seat buttons from 84px to 168px
17+
- Removed modifier display from split check buttons for cleaner interface
18+
- **Root Cause**: Split check buttons had hardcoded fonts, truncated text, cramped dimensions, and cluttered display with modifiers
19+
- **Solution**:
20+
- Modified ItemObj constructors to accept font_id parameters and use dynamic fonts
21+
- Added RenderWrappedText helper method for word-based text wrapping
22+
- Increased button dimensions for better text accommodation
23+
- Removed modifier rendering loop and dynamic height calculation
24+
- **Files modified**:
25+
- `zone/split_check_zone.cc` (main implementation)
26+
- `zone/split_check_zone.hh` (method declaration)
27+
- **Impact**: Split check interface now displays longer item names clearly with proper text wrapping, responsive fonts, and improved button sizing for better usability
28+
1029
- **Build Warnings: Compiler Warning Fixes (2026-01-20)**
1130
- Fixed various C++ compiler warnings to achieve clean builds
1231
- **Issues Fixed**:

‎zone/split_check_zone.cc‎

Lines changed: 107 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -46,42 +46,113 @@ class ItemObj : public ZoneObject
4646
int seat;
4747

4848
// Constructors
49-
ItemObj(Order *o);
50-
ItemObj(int seat_no);
49+
ItemObj(Order *o, int font_id = FONT_DEFAULT);
50+
ItemObj(int seat_no, int font_id = FONT_DEFAULT);
5151

5252
// Member Function
5353
int Render(Terminal *t) override;
54+
int RenderWrappedText(Terminal *t, const genericChar *text, int x_pos, int y_pos,
55+
int max_width, int color, int font_id);
5456
};
5557

5658
// Constructors
57-
ItemObj::ItemObj(Order *o)
59+
ItemObj::ItemObj(Order *o, int font_id)
5860
{
5961
FnTrace("ItemObj::ItemObj()");
6062
order = o;
6163
seat = -1;
62-
w = 196;
63-
h = 40;
64-
65-
if (o)
66-
{
67-
Order *mod = o->modifier_list;
68-
while (mod)
69-
{
70-
h += 20;
71-
mod = mod->next;
72-
}
73-
}
64+
w = 280;
65+
h = 80;
66+
font = font_id;
7467
}
7568

76-
ItemObj::ItemObj(int seat_no)
69+
ItemObj::ItemObj(int seat_no, int font_id)
7770
{
7871
order = nullptr;
7972
seat = seat_no;
80-
w = 84;
81-
h = 84;
73+
w = 150;
74+
h = 168;
75+
font = font_id;
8276
}
8377

8478
// Member Functions
79+
int ItemObj::RenderWrappedText(Terminal *t, const genericChar *text, int x_pos, int y_pos,
80+
int max_width, int color, int font_id)
81+
{
82+
if (!text || !*text) return y_pos;
83+
84+
genericChar line[STRLENGTH];
85+
genericChar word[STRLENGTH];
86+
int line_len = 0;
87+
int word_len = 0;
88+
int current_y = y_pos;
89+
const genericChar *ptr = text;
90+
91+
line[0] = '\0';
92+
93+
while (*ptr)
94+
{
95+
// Extract next word
96+
word_len = 0;
97+
while (*ptr && *ptr != ' ' && word_len < STRLENGTH - 1)
98+
{
99+
word[word_len++] = *ptr++;
100+
}
101+
word[word_len] = '\0';
102+
103+
// Skip spaces
104+
while (*ptr == ' ') ptr++;
105+
106+
// Check if word fits on current line
107+
int test_len = line_len + (line_len > 0 ? 1 : 0) + word_len;
108+
genericChar test_line[STRLENGTH];
109+
if (line_len > 0)
110+
{
111+
vt_safe_string::safe_copy(test_line, STRLENGTH, line);
112+
vt_safe_string::safe_concat(test_line, STRLENGTH, " ");
113+
vt_safe_string::safe_concat(test_line, STRLENGTH, word);
114+
}
115+
else
116+
{
117+
vt_safe_string::safe_copy(test_line, STRLENGTH, word);
118+
}
119+
120+
if (t->TextWidth(test_line, strlen(test_line), font_id) <= max_width)
121+
{
122+
// Word fits, add it to current line
123+
if (line_len > 0)
124+
{
125+
vt_safe_string::safe_concat(line, STRLENGTH, " ");
126+
line_len++;
127+
}
128+
vt_safe_string::safe_concat(line, STRLENGTH, word);
129+
line_len += word_len;
130+
}
131+
else
132+
{
133+
// Word doesn't fit, render current line and start new one
134+
if (line_len > 0)
135+
{
136+
t->RenderText(line, x_pos, current_y, color, font_id, ALIGN_LEFT, max_width);
137+
current_y += 18; // Line height
138+
}
139+
140+
// Start new line with current word
141+
vt_safe_string::safe_copy(line, STRLENGTH, word);
142+
line_len = word_len;
143+
}
144+
}
145+
146+
// Render final line
147+
if (line_len > 0)
148+
{
149+
t->RenderText(line, x_pos, current_y, color, font_id, ALIGN_LEFT, max_width);
150+
current_y += 18; // Line height
151+
}
152+
153+
return current_y;
154+
}
155+
85156
int ItemObj::Render(Terminal *t)
86157
{
87158
FnTrace("ItemObj::Render()");
@@ -98,7 +169,7 @@ int ItemObj::Render(Terminal *t)
98169

99170
SeatName(seat, str);
100171
t->RenderText(str, x + (w/2), y + 22, COLOR_WHITE,
101-
FONT_TIMES_34B, ALIGN_CENTER);
172+
font, ALIGN_CENTER);
102173
}
103174
else if (order)
104175
{
@@ -121,16 +192,10 @@ int ItemObj::Render(Terminal *t)
121192
vt_safe_string::safe_copy(str, STRLENGTH, str2);
122193
}
123194

124-
t->RenderText(str, x + 8, ty, col, FONT_TIMES_20, ALIGN_LEFT, w - 12);
195+
int available_width = w - 12;
125196

126-
Order *mod = order->modifier_list;
127-
while (mod)
128-
{
129-
ty += 20;
130-
mod->Description(t, str);
131-
t->RenderText(str, x + 24, ty, col, FONT_TIMES_20, ALIGN_LEFT, w - 28);
132-
mod = mod->next;
133-
}
197+
// Render order description with text wrapping
198+
ty = RenderWrappedText(t, str, x + 8, ty, available_width, col, font);
134199
}
135200
return 0;
136201
}
@@ -145,7 +210,7 @@ class CheckObj : public ZoneObject
145210
SubCheck *sub;
146211

147212
// Constructor
148-
CheckObj(SubCheck *sc, int seat_mode = 0);
213+
CheckObj(SubCheck *sc, int seat_mode = 0, int font_id = FONT_DEFAULT);
149214

150215
// Member Functions
151216
int Layout(Terminal *t, int lx, int ly, int lw, int lh) override;
@@ -154,13 +219,14 @@ class CheckObj : public ZoneObject
154219
};
155220

156221
// Constructor
157-
CheckObj::CheckObj(SubCheck *sc, int seat_mode)
222+
CheckObj::CheckObj(SubCheck *sc, int seat_mode, int font_id)
158223
{
159224
FnTrace("CheckObj::CheckObj()");
160225
sub = sc;
161226
page = 0;
162227
max_pages = 0;
163228
active = 0;
229+
font = font_id;
164230
int i;
165231

166232
if (sc == nullptr)
@@ -184,7 +250,7 @@ CheckObj::CheckObj(SubCheck *sc, int seat_mode)
184250
for (i = 0; i < 32; ++i)
185251
{
186252
if (seat_count[i] > 0)
187-
items.Add(new ItemObj(i)); // Add new seat item
253+
items.Add(new ItemObj(i, font_id)); // Add new seat item
188254
}
189255
}
190256
else
@@ -193,12 +259,12 @@ CheckObj::CheckObj(SubCheck *sc, int seat_mode)
193259
{
194260
if (o->item_type == ITEM_POUND)
195261
{
196-
items.Add(new ItemObj(o));
262+
items.Add(new ItemObj(o, font_id));
197263
}
198264
else
199265
{
200266
for (i = 0; i < o->count; ++i)
201-
items.Add(new ItemObj(o));
267+
items.Add(new ItemObj(o, font_id));
202268
}
203269
}
204270
}
@@ -268,7 +334,7 @@ int CheckObj::Render(Terminal *t)
268334
vt_safe_string::safe_copy(str, 256, GlobalTranslate("Blank Check"));
269335

270336
t->RenderText(str, x + (w/2), y + 16, COLOR_BLACK,
271-
FONT_TIMES_20B, ALIGN_CENTER);
337+
font, ALIGN_CENTER);
272338

273339
if (sub)
274340
{
@@ -277,20 +343,20 @@ int CheckObj::Render(Terminal *t)
277343
if (tax > 0)
278344
{
279345
t->RenderText(t->FormatPrice(tax), x + w - 8, hh, COLOR_BLACK,
280-
FONT_TIMES_20, ALIGN_RIGHT);
346+
font, ALIGN_RIGHT);
281347
t->RenderText(t->Translate("Tax"), x + w - 80, hh, COLOR_BLACK,
282-
FONT_TIMES_20, ALIGN_RIGHT);
348+
font, ALIGN_RIGHT);
283349
hh += 20;
284350
}
285351

286352
t->RenderText(t->FormatPrice(sub->total_sales + tax), x + w - 8, hh,
287-
COLOR_BLACK, FONT_TIMES_20, ALIGN_RIGHT);
353+
COLOR_BLACK, font, ALIGN_RIGHT);
288354
t->RenderText(t->Translate("Total"), x + w - 80, hh, COLOR_BLACK,
289-
FONT_TIMES_20, ALIGN_RIGHT);
355+
font, ALIGN_RIGHT);
290356

291357
if (max_pages > 1)
292358
t->RenderText(t->PageNo(page + 1, max_pages), x + 8, y + h - 24,
293-
COLOR_RED, FONT_TIMES_20);
359+
COLOR_RED, font);
294360
}
295361

296362
// Render Items
@@ -472,11 +538,11 @@ int SplitCheckZone::CreateChecks(Terminal *t)
472538
for (SubCheck *sc = check->SubList(); sc != nullptr; sc = sc->next)
473539
{
474540
if (sc->status == CHECK_OPEN)
475-
checks.Add(new CheckObj(sc, seat_mode));
541+
checks.Add(new CheckObj(sc, seat_mode, font));
476542
}
477543

478544
// Add Blank Check
479-
checks.Add(new CheckObj(nullptr));
545+
checks.Add(new CheckObj(nullptr, 0, font));
480546
return 0;
481547
}
482548

0 commit comments

Comments
 (0)