Debian Codegraph @

src/pt2_textout.c

raw symbols SCIP
1 #include <stdint.h>
2 #include <stdbool.h>
3 #include <string.h>
4 #include "pt2_tables.h"
5 #include "pt2_structs.h"
6 #include "pt2_bmp.h"
7
8 void charOut(uint32_t xPos, uint32_t yPos, char ch, uint32_t color)
9 {
10 if (ch == '\0' || ch == ' ')
11 return;
12
13 int32_t h = FONT_CHAR_H;
14 if (ch == 5 || ch == 6) // arrow up/down has 1 more scanline
15 h++;
16
17 const uint8_t *srcPtr = &fontBMP[(ch & 0x7F) << 3];
18 uint32_t *dstPtr = &video.frameBuffer[(yPos * SCREEN_W) + xPos];
19
20 for (int32_t y = 0; y < h; y++)
21 {
22 for (int32_t x = 0; x < FONT_CHAR_W; x++)
23 {
24 if (srcPtr[x])
25 dstPtr[x] = color;
26 }
27
28 srcPtr += 127*FONT_CHAR_W;
29 dstPtr += SCREEN_W;
30 }
31 }
32
33 void charOut2(uint32_t xPos, uint32_t yPos, char ch) // for static GUI text
34 {
35 if (ch == '\0' || ch == ' ')
36 return;
37
38 int32_t h = FONT_CHAR_H;
39 if (ch == 5 || ch == 6) // arrow up/down has 1 more scanline
40 h++;
41
42 const uint8_t *srcPtr = &fontBMP[(ch & 0x7F) << 3];
43 uint32_t *dstPtr = &video.frameBuffer[(yPos * SCREEN_W) + xPos];
44
45 const uint32_t fgColor = video.palette[PAL_BORDER];
46 const uint32_t bgColor = video.palette[PAL_GENBKG2];
47
48 for (int32_t y = 0; y < h; y++)
49 {
50 for (int32_t x = 0; x < FONT_CHAR_W; x++)
51 {
52 if (srcPtr[x])
53 {
54 dstPtr[x+(SCREEN_W+1)] = bgColor;
55 dstPtr[x] = fgColor;
56 }
57 }
58
59 srcPtr += 127*FONT_CHAR_W;
60 dstPtr += SCREEN_W;
61 }
62 }
63
64 void charOutBg(uint32_t xPos, uint32_t yPos, char ch, uint32_t fgColor, uint32_t bgColor)
65 {
66 uint32_t colors[2];
67
68 if (ch == '\0')
69 return;
70
71 int32_t h = FONT_CHAR_H;
72 if (ch == 5 || ch == 6) // arrow up/down has 1 more scanline
73 h++;
74
75 const uint8_t *srcPtr = &fontBMP[(ch & 0x7F) << 3];
76 uint32_t *dstPtr = &video.frameBuffer[(yPos * SCREEN_W) + xPos];
77
78 colors[0] = bgColor;
79 colors[1] = fgColor;
80
81 for (int32_t y = 0; y < h; y++)
82 {
83 for (int32_t x = 0; x < FONT_CHAR_W; x++)
84 dstPtr[x] = colors[srcPtr[x]];
85
86 srcPtr += 127*FONT_CHAR_W;
87 dstPtr += SCREEN_W;
88 }
89 }
90
91 void charOutBig(uint32_t xPos, uint32_t yPos, char ch, uint32_t color)
92 {
93 if (ch == '\0' || ch == ' ')
94 return;
95
96 int32_t h = FONT_CHAR_H;
97 if (ch == 5 || ch == 6) // arrow up/down has 1 more scanline
98 h++;
99
100 const uint8_t *srcPtr = &fontBMP[(ch & 0x7F) << 3];
101 uint32_t *dstPtr1 = &video.frameBuffer[(yPos * SCREEN_W) + xPos];
102 uint32_t *dstPtr2 = dstPtr1 + SCREEN_W;
103
104 for (int32_t y = 0; y < h; y++)
105 {
106 for (int32_t x = 0; x < FONT_CHAR_W; x++)
107 {
108 if (srcPtr[x])
109 {
110 dstPtr1[x] = color;
111 dstPtr2[x] = color;
112 }
113 }
114
115 srcPtr += 127*FONT_CHAR_W;
116 dstPtr1 += SCREEN_W*2;
117 dstPtr2 += SCREEN_W*2;
118 }
119 }
120
121 void charOutBigBg(uint32_t xPos, uint32_t yPos, char ch, uint32_t fgColor, uint32_t bgColor)
122 {
123 uint32_t colors[2];
124
125 if (ch == '\0')
126 return;
127
128 const uint8_t *srcPtr = &fontBMP[(ch & 0x7F) << 3];
129 uint32_t *dstPtr1 = &video.frameBuffer[(yPos * SCREEN_W) + xPos];
130 uint32_t *dstPtr2 = dstPtr1 + SCREEN_W;
131
132 colors[0] = bgColor;
133 colors[1] = fgColor;
134
135 for (int32_t y = 0; y < FONT_CHAR_H; y++)
136 {
137 for (int32_t x = 0; x < FONT_CHAR_W; x++)
138 {
139 const uint32_t pixel = colors[srcPtr[x]];
140 dstPtr1[x] = pixel;
141 dstPtr2[x] = pixel;
142 }
143
144 srcPtr += 127*FONT_CHAR_W;
145 dstPtr1 += SCREEN_W*2;
146 dstPtr2 += SCREEN_W*2;
147 }
148 }
149
150 void textOut(uint32_t xPos, uint32_t yPos, const char *text, uint32_t color)
151 {
152 ASSERT(text != NULL);
153
154 uint32_t x = xPos;
155 while (*text != '\0')
156 {
157 charOut(x, yPos, *text++, color);
158 x += FONT_CHAR_W;
159 }
160 }
161
162 void textOutN(uint32_t xPos, uint32_t yPos, const char *text, uint32_t n, uint32_t color)
163 {
164 ASSERT(text != NULL);
165
166 uint32_t x = xPos;
167 uint32_t i = 0;
168
169 while (*text != '\0' && i++ < n)
170 {
171 charOut(x, yPos, *text++, color);
172 x += FONT_CHAR_W;
173 }
174 }
175
176 void textOut2(uint32_t xPos, uint32_t yPos, const char *text) // for static GUI text
177 {
178 ASSERT(text != NULL);
179
180 uint32_t x = xPos;
181 while (*text != '\0')
182 {
183 charOut2(x, yPos, *text++);
184 x += FONT_CHAR_W-1;
185 }
186 }
187
188 void textOutTight(uint32_t xPos, uint32_t yPos, const char *text, uint32_t color)
189 {
190 ASSERT(text != NULL);
191
192 uint32_t x = xPos;
193 while (*text != '\0')
194 {
195 charOut(x, yPos, *text++, color);
196 x += FONT_CHAR_W-1;
197 }
198 }
199
200 void textOutTightN(uint32_t xPos, uint32_t yPos, const char *text, uint32_t n, uint32_t color)
201 {
202 ASSERT(text != NULL);
203
204 uint32_t x = xPos;
205 uint32_t i = 0;
206
207 while (*text != '\0' && i++ < n)
208 {
209 charOut(x, yPos, *text++, color);
210 x += FONT_CHAR_W-1;
211 }
212 }
213
214 void textOutBg(uint32_t xPos, uint32_t yPos, const char *text, uint32_t fgColor, uint32_t bgColor)
215 {
216 ASSERT(text != NULL);
217
218 uint32_t x = xPos;
219 while (*text != '\0')
220 {
221 charOutBg(x, yPos, *text++, fgColor, bgColor);
222 x += FONT_CHAR_W;
223 }
224 }
225
226 void textOutBig(uint32_t xPos, uint32_t yPos, const char *text, uint32_t color)
227 {
228 ASSERT(text != NULL);
229
230 uint32_t x = xPos;
231 while (*text != '\0')
232 {
233 charOutBig(x, yPos, *text++, color);
234 x += FONT_CHAR_W;
235 }
236 }
237
238 void textOutBigBg(uint32_t xPos, uint32_t yPos, const char *text, uint32_t fgColor, uint32_t bgColor)
239 {
240 ASSERT(text != NULL);
241
242 uint32_t x = xPos;
243 while (*text != '\0')
244 {
245 charOutBigBg(x, yPos, *text++, fgColor, bgColor);
246 x += FONT_CHAR_W;
247 }
248 }
249
250 void printTwoDecimals(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
251 {
252 if (value == 0)
253 {
254 textOut(x, y, "00", fontColor);
255 }
256 else
257 {
258 if (value > 99)
259 value = 99;
260
261 charOut(x + (FONT_CHAR_W * 1), y, '0' + (value % 10), fontColor); value /= 10;
262 charOut(x + (FONT_CHAR_W * 0), y, '0' + (value % 10), fontColor);
263 }
264 }
265
266 void printTwoDecimalsBig(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
267 {
268 if (value == 0)
269 {
270 textOutBig(x, y, "00", fontColor);
271 }
272 else
273 {
274 if (value > 99)
275 value = 99;
276
277 charOutBig(x + (FONT_CHAR_W * 1), y, '0' + (value % 10), fontColor); value /= 10;
278 charOutBig(x + (FONT_CHAR_W * 0), y, '0' + (value % 10), fontColor);
279 }
280 }
281
282 void printThreeDecimals(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
283 {
284 if (value == 0)
285 {
286 textOut(x, y, "000", fontColor);
287 }
288 else
289 {
290 if (value > 999)
291 value = 999;
292
293 charOut(x + (FONT_CHAR_W * 2), y, '0' + (value % 10), fontColor); value /= 10;
294 charOut(x + (FONT_CHAR_W * 1), y, '0' + (value % 10), fontColor); value /= 10;
295 charOut(x + (FONT_CHAR_W * 0), y, '0' + (value % 10), fontColor);
296 }
297 }
298
299 void printFourDecimals(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
300 {
301 if (value == 0)
302 {
303 textOut(x, y, "0000", fontColor);
304 }
305 else
306 {
307 if (value > 9999)
308 value = 9999;
309
310 charOut(x + (FONT_CHAR_W * 3), y, '0' + (value % 10), fontColor); value /= 10;
311 charOut(x + (FONT_CHAR_W * 2), y, '0' + (value % 10), fontColor); value /= 10;
312 charOut(x + (FONT_CHAR_W * 1), y, '0' + (value % 10), fontColor); value /= 10;
313 charOut(x + (FONT_CHAR_W * 0), y, '0' + (value % 10), fontColor);
314 }
315 }
316
317 void printFiveDecimals(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
318 {
319 if (value == 0)
320 {
321 textOut(x, y, "00000", fontColor);
322 }
323 else
324 {
325 if (value > 99999)
326 value = 99999;
327
328 charOut(x + (FONT_CHAR_W * 4), y, '0' + (value % 10), fontColor); value /= 10;
329 charOut(x + (FONT_CHAR_W * 3), y, '0' + (value % 10), fontColor); value /= 10;
330 charOut(x + (FONT_CHAR_W * 2), y, '0' + (value % 10), fontColor); value /= 10;
331 charOut(x + (FONT_CHAR_W * 1), y, '0' + (value % 10), fontColor); value /= 10;
332 charOut(x + (FONT_CHAR_W * 0), y, '0' + (value % 10), fontColor);
333 }
334 }
335
336 // this one is used for module size and sampler screen display length (zeroes are padded with space)
337 void printSixDecimals(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
338 {
339 char numberText[7];
340
341 if (value == 0)
342 {
343 textOut(x, y, " 0", fontColor);
344 }
345 else
346 {
347 if (value > 999999)
348 value = 999999;
349
350 numberText[6] = 0;
351 numberText[5] = '0' + (value % 10); value /= 10;
352 numberText[4] = '0' + (value % 10); value /= 10;
353 numberText[3] = '0' + (value % 10); value /= 10;
354 numberText[2] = '0' + (value % 10); value /= 10;
355 numberText[1] = '0' + (value % 10); value /= 10;
356 numberText[0] = '0' + (value % 10);
357
358 int32_t i = 0;
359 while (numberText[i] == '0')
360 numberText[i++] = ' ';
361
362 textOut(x, y, numberText, fontColor);
363 }
364 }
365
366 void printOneHex(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
367 {
368 charOut(x, y, hexTable[value & 15], fontColor);
369 }
370
371 void printOneHexBig(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
372 {
373 charOutBig(x, y, hexTable[value & 15], fontColor);
374 }
375
376 void printTwoHex(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
377 {
378 if (value == 0)
379 {
380 textOut(x, y, "00", fontColor);
381 }
382 else
383 {
384 value &= 0xFF;
385
386 charOut(x + (FONT_CHAR_W * 0), y, hexTable[value >> 4], fontColor);
387 charOut(x + (FONT_CHAR_W * 1), y, hexTable[value & 15], fontColor);
388 }
389 }
390
391 void printTwoHexBig(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
392 {
393 if (value == 0)
394 {
395 textOutBig(x, y, "00", fontColor);
396 }
397 else
398 {
399 value &= 0xFF;
400
401 charOutBig(x + (FONT_CHAR_W * 0), y, hexTable[value >> 4], fontColor);
402 charOutBig(x + (FONT_CHAR_W * 1), y, hexTable[value & 15], fontColor);
403 }
404 }
405
406 void printThreeHex(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
407 {
408 if (value == 0)
409 {
410 textOut(x, y, "000", fontColor);
411 }
412 else
413 {
414 value &= 0xFFF;
415
416 charOut(x + (FONT_CHAR_W * 0), y, hexTable[value >> 8], fontColor);
417 charOut(x + (FONT_CHAR_W * 1), y, hexTable[(value & (15 << 4)) >> 4], fontColor);
418 charOut(x + (FONT_CHAR_W * 2), y, hexTable[value & 15], fontColor);
419 }
420 }
421
422 void printFourHex(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
423 {
424 if (value == 0)
425 {
426 textOut(x, y, "0000", fontColor);
427 }
428 else
429 {
430 value &= 0xFFFF;
431
432 charOut(x + (FONT_CHAR_W * 0), y, hexTable[value >> 12], fontColor);
433 charOut(x + (FONT_CHAR_W * 1), y, hexTable[(value & (15 << 8)) >> 8], fontColor);
434 charOut(x + (FONT_CHAR_W * 2), y, hexTable[(value & (15 << 4)) >> 4], fontColor);
435 charOut(x + (FONT_CHAR_W * 3), y, hexTable[value & 15], fontColor);
436 }
437 }
438
439 void printFiveHex(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor)
440 {
441 if (value == 0)
442 {
443 textOut(x, y, "00000", fontColor);
444 }
445 else
446 {
447 value &= 0xFFFFF;
448
449 charOut(x + (FONT_CHAR_W * 0), y, hexTable[value >> 16], fontColor);
450 charOut(x + (FONT_CHAR_W * 1), y, hexTable[(value & (15 << 12)) >> 12], fontColor);
451 charOut(x + (FONT_CHAR_W * 2), y, hexTable[(value & (15 << 8)) >> 8], fontColor);
452 charOut(x + (FONT_CHAR_W * 3), y, hexTable[(value & (15 << 4)) >> 4], fontColor);
453 charOut(x + (FONT_CHAR_W * 4), y, hexTable[value & 15], fontColor);
454 }
455 }
456
457 void printTwoDecimalsBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
458 {
459 if (value == 0)
460 {
461 textOutBg(x, y, "00", fontColor, backColor);
462 }
463 else
464 {
465 if (value > 99)
466 value = 99;
467
468 charOutBg(x + (FONT_CHAR_W * 1), y, '0' + (value % 10), fontColor, backColor); value /= 10;
469 charOutBg(x + (FONT_CHAR_W * 0), y, '0' + (value % 10), fontColor, backColor);
470 }
471 }
472
473 void printTwoDecimalsBigBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
474 {
475 if (value == 0)
476 {
477 textOutBigBg(x, y, "00", fontColor, backColor);
478 }
479 else
480 {
481 if (value > 99)
482 value = 99;
483
484 charOutBigBg(x + (FONT_CHAR_W * 1), y, '0' + (value % 10), fontColor, backColor); value /= 10;
485 charOutBigBg(x + (FONT_CHAR_W * 0), y, '0' + (value % 10), fontColor, backColor);
486 }
487 }
488
489 void printThreeDecimalsBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
490 {
491 if (value == 0)
492 {
493 textOutBg(x, y, "000", fontColor, backColor);
494 }
495 else
496 {
497 if (value > 999)
498 value = 999;
499
500 charOutBg(x + (FONT_CHAR_W * 2), y, '0' + (value % 10), fontColor, backColor); value /= 10;
501 charOutBg(x + (FONT_CHAR_W * 1), y, '0' + (value % 10), fontColor, backColor); value /= 10;
502 charOutBg(x + (FONT_CHAR_W * 0), y, '0' + (value % 10), fontColor, backColor);
503 }
504 }
505
506 void printFourDecimalsBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
507 {
508 if (value == 0)
509 {
510 textOutBg(x, y, "0000", fontColor, backColor);
511 }
512 else
513 {
514 if (value > 9999)
515 value = 9999;
516
517 charOutBg(x + (FONT_CHAR_W * 3), y, '0' + (value % 10), fontColor, backColor); value /= 10;
518 charOutBg(x + (FONT_CHAR_W * 2), y, '0' + (value % 10), fontColor, backColor); value /= 10;
519 charOutBg(x + (FONT_CHAR_W * 1), y, '0' + (value % 10), fontColor, backColor); value /= 10;
520 charOutBg(x + (FONT_CHAR_W * 0), y, '0' + (value % 10), fontColor, backColor);
521 }
522 }
523
524 // this one is used for "DISP:" in the sampler screen (zeroes are padded with space)
525 void printFiveDecimalsBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
526 {
527 char numberText[6];
528
529 if (value == 0)
530 {
531 textOutBg(x, y, " 0", fontColor, backColor);
532 }
533 else
534 {
535 if (value > 99999)
536 value = 99999;
537
538 numberText[5] = 0;
539 numberText[4] = '0' + (value % 10); value /= 10;
540 numberText[3] = '0' + (value % 10); value /= 10;
541 numberText[2] = '0' + (value % 10); value /= 10;
542 numberText[1] = '0' + (value % 10); value /= 10;
543 numberText[0] = '0' + (value % 10);
544
545 int32_t i = 0;
546 while (numberText[i] == '0')
547 numberText[i++] = ' ';
548
549 textOutBg(x, y, numberText, fontColor, backColor);
550 }
551 }
552
553 // this one is used for module size (zeroes are padded with space)
554 void printSixDecimalsBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
555 {
556 char numberText[7];
557
558 if (value == 0)
559 {
560 textOutBg(x, y, " 0", fontColor, backColor);
561 }
562 else
563 {
564 if (value > 999999)
565 value = 999999;
566
567 numberText[6] = 0;
568 numberText[5] = '0' + (value % 10); value /= 10;
569 numberText[4] = '0' + (value % 10); value /= 10;
570 numberText[3] = '0' + (value % 10); value /= 10;
571 numberText[2] = '0' + (value % 10); value /= 10;
572 numberText[1] = '0' + (value % 10); value /= 10;
573 numberText[0] = '0' + (value % 10);
574
575 int32_t i = 0;
576 while (numberText[i] == '0')
577 numberText[i++] = ' ';
578
579 textOutBg(x, y, numberText, fontColor, backColor);
580 }
581 }
582
583 void printOneHexBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
584 {
585 charOutBg(x, y, hexTable[value & 0xF], fontColor, backColor);
586 }
587
588 void printOneHexBigBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
589 {
590 charOutBigBg(x, y, hexTable[value & 0xF], fontColor, backColor);
591 }
592
593 void printTwoHexBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
594 {
595 if (value == 0)
596 {
597 textOutBg(x, y, "00", fontColor, backColor);
598 }
599 else
600 {
601 value &= 0xFF;
602
603 charOutBg(x + (FONT_CHAR_W * 0), y, hexTable[value >> 4], fontColor, backColor);
604 charOutBg(x + (FONT_CHAR_W * 1), y, hexTable[value & 15], fontColor, backColor);
605 }
606 }
607
608 void printTwoHexBigBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
609 {
610 if (value == 0)
611 {
612 textOutBigBg(x, y, "00", fontColor, backColor);
613 }
614 else
615 {
616 value &= 0xFF;
617
618 charOutBigBg(x + (FONT_CHAR_W * 0), y, hexTable[value >> 4], fontColor, backColor);
619 charOutBigBg(x + (FONT_CHAR_W * 1), y, hexTable[value & 15], fontColor, backColor);
620 }
621 }
622
623 void printThreeHexBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
624 {
625 if (value == 0)
626 {
627 textOutBg(x, y, "000", fontColor, backColor);
628 }
629 else
630 {
631 value &= 0xFFF;
632
633 charOutBg(x + (FONT_CHAR_W * 0), y, hexTable[value >> 8], fontColor, backColor);
634 charOutBg(x + (FONT_CHAR_W * 1), y, hexTable[(value & (15 << 4)) >> 4], fontColor, backColor);
635 charOutBg(x + (FONT_CHAR_W * 2), y, hexTable[value & 15], fontColor, backColor);
636 }
637 }
638
639 void printFourHexBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
640 {
641 if (value == 0)
642 {
643 textOutBg(x, y, "0000", fontColor, backColor);
644 }
645 else
646 {
647 value &= 0xFFFF;
648
649 charOutBg(x + (FONT_CHAR_W * 0), y, hexTable[value >> 12], fontColor, backColor);
650 charOutBg(x + (FONT_CHAR_W * 1), y, hexTable[(value & (15 << 8)) >> 8], fontColor, backColor);
651 charOutBg(x + (FONT_CHAR_W * 2), y, hexTable[(value & (15 << 4)) >> 4], fontColor, backColor);
652 charOutBg(x + (FONT_CHAR_W * 3), y, hexTable[value & 15], fontColor, backColor);
653 }
654 }
655
656 void printFiveHexBg(uint32_t x, uint32_t y, uint32_t value, uint32_t fontColor, uint32_t backColor)
657 {
658 if (value == 0)
659 {
660 textOutBg(x, y, "00000", fontColor, backColor);
661 }
662 else
663 {
664 value &= 0xFFFFF;
665
666 charOutBg(x + (FONT_CHAR_W * 0), y, hexTable[value >> 16], fontColor, backColor);
667 charOutBg(x + (FONT_CHAR_W * 1), y, hexTable[(value & (15 << 12)) >> 12], fontColor, backColor);
668 charOutBg(x + (FONT_CHAR_W * 2), y, hexTable[(value & (15 << 8)) >> 8], fontColor, backColor);
669 charOutBg(x + (FONT_CHAR_W * 3), y, hexTable[(value & (15 << 4)) >> 4], fontColor, backColor);
670 charOutBg(x + (FONT_CHAR_W * 4), y, hexTable[value & 15], fontColor, backColor);
671 }
672 }
673
674 void setPrevStatusMessage(void)
675 {
676 strcpy(ui.statusMessage, ui.prevStatusMessage);
677 ui.updateStatusText = true;
678 }
679
680 void setStatusMessage(const char *msg, bool carry)
681 {
682 ASSERT(msg != NULL);
683
684 if (carry)
685 strcpy(ui.prevStatusMessage, msg);
686
687 strcpy(ui.statusMessage, msg);
688 ui.updateStatusText = true;
689 }
690
691 void displayMsg(const char *msg)
692 {
693 ASSERT(msg != NULL);
694
695 editor.errorMsgActive = true;
696 editor.errorMsgBlock = false;
697 editor.errorMsgCounter = 0;
698
699 if (*msg != '\0')
700 setStatusMessage(msg, NO_CARRY);
701 }
702
703 void displayErrorMsg(const char *msg)
704 {
705 ASSERT(msg != NULL);
706
707 editor.errorMsgActive = true;
708 editor.errorMsgBlock = true;
709 editor.errorMsgCounter = 0;
710
711 if (*msg != '\0')
712 setStatusMessage(msg, NO_CARRY);
713
714 setErrPointer();
715 }