@@ -51,8 +51,6 @@ class ItemObj : public ZoneObject
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);
5654};
5755
5856// Constructors
@@ -76,126 +74,24 @@ ItemObj::ItemObj(int seat_no, int font_id)
7674}
7775
7876// 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-
15677int ItemObj::Render (Terminal *t)
15778{
15879 FnTrace (" ItemObj::Render()" );
15980 genericChar str[STRLENGTH ];
160- genericChar str2[STRLENGTH ];
81+
82+ int frame_type = selected ? ZF_DOUBLE : ZF_RAISED ;
83+ int texture = selected ? IMAGE_YELLOW_TEXTURE : IMAGE_SAND ;
84+ t->RenderButton (x, y, w, h, frame_type, texture);
16185
16286 if (seat >= 0 )
16387 {
164- // Render Seat Item
165- if (selected)
166- t->RenderButton (x, y, w, h, ZF_RAISED , IMAGE_LIT_SAND );
167- else
168- t->RenderButton (x, y, w, h, ZF_RAISED , IMAGE_WOOD );
169-
17088 SeatName (seat, str);
171- t->RenderText (str, x + (w/2 ), y + 22 , COLOR_WHITE ,
172- font, ALIGN_CENTER );
89+ t->RenderText (str, x + (w/2 ), y + (h/2 ), COLOR_BLACK , font, ALIGN_CENTER );
17390 }
17491 else if (order)
17592 {
176- // Render Order Item
177- if (selected)
178- t->RenderButton (x, y, w, h, ZF_RAISED , IMAGE_LIT_SAND );
179- else
180- t->RenderButton (x, y, w, h, ZF_RAISED , IMAGE_SAND );
181-
182- int col = COLOR_DK_BLUE ;
183- if (order->status & ORDER_SENT )
184- col = COLOR_BLACK ;
185-
186- int ty = y + 8 ;
18793 order->Description (t, str);
188- if (order->item_type == ITEM_POUND )
189- {
190- vt::cpp23::format_to_buffer (str2, STRLENGTH , " {} {:.2f} {}" , str,
191- order->count / 100.0 , t->Translate (" Lb." ));
192- vt_safe_string::safe_copy (str, STRLENGTH , str2);
193- }
194-
195- int available_width = w - 12 ;
196-
197- // Render order description with text wrapping
198- ty = RenderWrappedText (t, str, x + 8 , ty, available_width, col, font);
94+ t->RenderText (str, x + 8 , y + (h/2 ), COLOR_BLACK , font, ALIGN_LEFT );
19995 }
20096 return 0 ;
20197}
@@ -321,45 +217,26 @@ int CheckObj::Layout(Terminal *t, int lx, int ly, int lw, int lh)
321217int CheckObj::Render (Terminal *t)
322218{
323219 FnTrace (" CheckObj::Render()" );
324- Page *p = t->page ;
325- t->RenderButton (x, y, w, h, p->default_frame [0 ], p->default_texture [0 ]);
326220
327- if (page >= max_pages)
328- page = 0 ;
221+ t->RenderButton (x, y, w, h, ZF_DOUBLE , IMAGE_SAND );
329222
330223 genericChar str[256 ];
331- if (sub)
224+ if (sub) {
332225 vt_safe_string::safe_format (str, 256 , " %s %d" , t->Translate (" Check" ), sub->number );
333- else
334- vt_safe_string::safe_copy (str, 256 , GlobalTranslate (" Blank Check" ));
226+ t->RenderText (str, x + (w/2 ), y + 20 , COLOR_BLACK , font, ALIGN_CENTER );
335227
336- t->RenderText (str, x + (w/2 ), y + 16 , COLOR_BLACK ,
337- font, ALIGN_CENTER );
338-
339- if (sub)
340- {
341- int hh = y + h - 44 ;
342- int tax = sub->TotalTax ();
343- if (tax > 0 )
344- {
345- t->RenderText (t->FormatPrice (tax), x + w - 8 , hh, COLOR_BLACK ,
346- font, ALIGN_RIGHT );
347- t->RenderText (t->Translate (" Tax" ), x + w - 80 , hh, COLOR_BLACK ,
348- font, ALIGN_RIGHT );
349- hh += 20 ;
228+ // Show tax amount above total if there's tax
229+ int tax_amount = sub->TotalTax ();
230+ if (tax_amount > 0 ) {
231+ vt_safe_string::safe_format (str, 256 , " %s %s" , t->Translate (" Tax" ), t->FormatPrice (tax_amount));
232+ t->RenderText (str, x + (w/2 ), y + h - 64 , COLOR_BLACK , FONT_TIMES_20B , ALIGN_CENTER );
350233 }
351234
352- t->RenderText (t->FormatPrice (sub->total_sales + tax), x + w - 8 , hh,
353- COLOR_BLACK , font, ALIGN_RIGHT );
354- t->RenderText (t->Translate (" Total" ), x + w - 80 , hh, COLOR_BLACK ,
355- font, ALIGN_RIGHT );
356-
357- if (max_pages > 1 )
358- t->RenderText (t->PageNo (page + 1 , max_pages), x + 8 , y + h - 24 ,
359- COLOR_RED , font);
235+ t->RenderText (t->FormatPrice (sub->total_cost ), x + (w/2 ), y + h - 40 , COLOR_BLACK , FONT_TIMES_20B , ALIGN_CENTER );
236+ } else {
237+ t->RenderText (t->Translate (" New Check" ), x + (w/2 ), y + (h/2 ), COLOR_GRAY , font, ALIGN_CENTER );
360238 }
361239
362- // Render Items
363240 items.Render (t);
364241 return 0 ;
365242}
@@ -371,12 +248,17 @@ RenderResult SplitCheckZone::Render(Terminal *t, int update_flag)
371248{
372249 FnTrace (" SplitCheckZone::Render()" );
373250 RenderZone (t, nullptr , update_flag);
251+
374252 if (t->check == nullptr || t->check ->SubList () == nullptr )
253+ {
254+ t->RenderText (t->Translate (" Add items to your order first" ), x + (w/2 ), y + (h/2 ), COLOR_BLACK , font, ALIGN_CENTER );
375255 return RENDER_OKAY ;
256+ }
376257
377258 Settings *s = t->GetSettings ();
378259 if (s == nullptr )
379260 return RENDER_ERROR ;
261+
380262 if (update_flag)
381263 {
382264 start_check = 0 ;
@@ -386,8 +268,13 @@ RenderResult SplitCheckZone::Render(Terminal *t, int update_flag)
386268 CreateChecks (t);
387269 }
388270
271+ // Render instruction header
272+ RenderInstructions (t);
273+
274+ // Render checks
389275 LayoutChecks (t);
390276 checks.Render (t);
277+
391278 return RENDER_OKAY ;
392279}
393280
@@ -501,7 +388,7 @@ SignalResult SplitCheckZone::Touch(Terminal *t, int tx, int ty)
501388 FnTrace (" SplitCheckZone::Touch()" );
502389 if (t->check == nullptr )
503390 return SIGNAL_IGNORED ;
504-
391+
505392 ZoneObject *zo = checks.Find (tx, ty);
506393 if (zo)
507394 {
@@ -679,6 +566,12 @@ int SplitCheckZone::MoveItems(Terminal *t, CheckObj *target, int move_amount)
679566 return 0 ;
680567}
681568
569+ void SplitCheckZone::RenderInstructions (Terminal *t)
570+ {
571+ FnTrace (" SplitCheckZone::RenderInstructions()" );
572+ t->RenderText (t->Translate (" Select items, then tap destination check" ), x + (w/2 ), y + 25 , COLOR_BLACK , font, ALIGN_CENTER );
573+ }
574+
682575int SplitCheckZone::PrintReceipts (Terminal *t)
683576{
684577 FnTrace (" SplitCheckZone::PrintReceipts()" );
0 commit comments