-
Notifications
You must be signed in to change notification settings - Fork 0
/
Display.pas
1812 lines (1575 loc) · 57.3 KB
/
Display.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Graphic Display Functions
// Date 26.05.22
// 25.07.17 nk opt for XE3 (AnsiString <-> string)
// 25.07.17 nk opt use string instead of ShortString (e.g. old=string[MAXBUFF])
unit Display;
interface
uses
Forms, Types, Controls, Graphics, Math, SysUtils, ExtCtrls, USystem,
SYS, LCD, Global, Data, FLog;
const
NORMPOS = 0; // text position
LEFTPOS = 10;
MIDPOS = 11;
RIGHTPOS = 12;
POSSPACE = 10;
POSMINUS = 11;
POSERROR = 14;
TINYCHAR = 1; // character font
SMALLCHAR = 2;
BOLDCHAR = 3;
BIGCHAR = 4;
TINYNUMS = 5;
SMALLNUMS = 6;
BOLDNUMS = 7;
BIGNUMS = 8;
LARGENUMS = 9;
MAXFONTS = 10; // max number of fonts defined
FONTDEFS = 6; // number of font definitions
MAXCHARS = 5; // max number of character fonts
CHARDEFS = 49; // number of characters/font
MAXNUMBS = 5; // max number of numerical fonts
MAXSYMBS = 52; // max number of symbols defined
SYMBDEFS = 5; // number of symbol definitions
MAXICONS = 9; // max number of icons defined
ICONDEFS = 6; // number of icon definitions
ROW2CHAR = 100; // characters defined in the 2nd row
SYMBCODE = 126; // ascii code for symbol definitions
BEARSYMBOL = 24; // symbol number for bearing arrows
MOONSYMBOL = 38; // symbol number for moon phases
ICONNONE = 0; // icon number if undefined
ICONWAITING = 1; // icon number for waiting
ICONDANGER = 2; // icon number for danger
ICONWARNING = 3; // icon number for warning
ICONQUESTION = 4; // icon number for question
ICONOKSIGN = 5; // icon number for ok
ICONTHUMBUP = 6; // icon number for thumb up
ICONCLOCK = 7; // icon number for clock
ICONINFO = 8; // icon number for info sign
ICONMORTAL = 9; // icon number for mortal danger
var
BITMAP00: TImage;
BITMAP01: TImage;
BITMAP02: TImage;
BITMAP03: TImage;
WINDOW00: TImage;
WINDOW01: TImage;
WINDOW02: TImage;
WINDOW03: TImage;
WINDOW04: TImage;
WINDOW05: TImage;
WINDOW06: TImage;
WINDOW07: TImage;
FONT01: TImage;
FONT02: TImage;
FONT03: TImage;
FONT04: TImage;
FONT05: TImage;
FONT06: TImage;
FONT07: TImage;
FONT08: TImage;
FONT09: TImage;
GraBuff: string; //old=[MAXBUFF];
CharDim: array[0..MAXCHARS, 0..CHARDEFS] of Byte; // character dimension table
FontDef: array[0..MAXFONTS, 0..FONTDEFS] of Byte; // font definition table
SymbDef: array[0..MAXSYMBS, 0..SYMBDEFS] of Byte; // symbol definition table
IconDef: array[0..ICONDEFS] of Byte; // icon definition table
procedure InitGraphics;
procedure InitScreen(Win: Byte);
procedure ClearBox(Box: Word);
procedure DispNumValue(Box: Word; Value: Long);
procedure DispText(Box: Word; Text: string; Mode: Byte);
procedure DispSymbol(Box: Word; Symbol: Byte);
procedure DispBitmap(Box, Xof, Yof: Word);
procedure DispWindow(Win, Ps, Pe: Byte);
procedure DispBarValue(Box: Word; Value: Long);
procedure DrawBox(Box: Word);
procedure DrawLine(Box: Word);
procedure DrawLineFrom(Px, Py, Mode: Byte);
procedure DrawLineTo(Px, Py, Dx, Dy: Byte);
procedure DrawDot(Px, Py, Mode: Byte);
procedure GetFont(Font, Anum: Byte; var Fpos, Fdim, Fcor: Byte);
procedure GetBearSymbol(BearDir: Long; var BearCode: Byte);
implementation
uses FMain, FGui;
//------------------------------------------------------------------------------
// INITGRAPHICS - Initialize graphic workspace and load fonts and symbols
//------------------------------------------------------------------ 17.02.07 --
procedure InitGraphics;
var
i, j: Long;
begin
try // 02.03.07 nk opt - load bitmaps from resource file 'Tiger.res'
GraBuff := 'Loading bitmaps';
BITMAP00 := TImage.Create(Gui);
BITMAP00.Picture.Bitmap.LoadFromResourceName(HInstance, 'BITMAP00');
BITMAP01 := TImage.Create(Gui);
BITMAP01.Picture.Bitmap.LoadFromResourceName(HInstance, 'BITMAP01');
BITMAP02 := TImage.Create(Gui);
BITMAP02.Picture.Bitmap.LoadFromResourceName(HInstance, 'BITMAP02');
BITMAP03 := TImage.Create(Gui);
BITMAP03.Picture.Bitmap.LoadFromResourceName(HInstance, 'BITMAP03');
GraBuff := 'Loading windows';
WINDOW00 := TImage.Create(Gui);
WINDOW00.Picture.Bitmap.LoadFromResourceName(HInstance, 'WINDOW00');
WINDOW01 := TImage.Create(Gui);
WINDOW01.Picture.Bitmap.LoadFromResourceName(HInstance, 'WINDOW01');
WINDOW02 := TImage.Create(Gui);
WINDOW02.Picture.Bitmap.LoadFromResourceName(HInstance, 'WINDOW02');
WINDOW03 := TImage.Create(Gui);
WINDOW03.Picture.Bitmap.LoadFromResourceName(HInstance, 'WINDOW03');
WINDOW04 := TImage.Create(Gui);
WINDOW04.Picture.Bitmap.LoadFromResourceName(HInstance, 'WINDOW04');
WINDOW05 := TImage.Create(Gui);
WINDOW05.Picture.Bitmap.LoadFromResourceName(HInstance, 'WINDOW05');
WINDOW06 := TImage.Create(Gui);
WINDOW06.Picture.Bitmap.LoadFromResourceName(HInstance, 'WINDOW06');
WINDOW07 := TImage.Create(Gui);
WINDOW07.Picture.Bitmap.LoadFromResourceName(HInstance, 'WINDOW07');
GraBuff := 'Loading fonts';
FONT01 := TImage.Create(Gui);
FONT01.Picture.Bitmap.LoadFromResourceName(HInstance, 'FONT01');
FONT02 := TImage.Create(Gui);
FONT02.Picture.Bitmap.LoadFromResourceName(HInstance, 'FONT02');
FONT03 := TImage.Create(Gui);
FONT03.Picture.Bitmap.LoadFromResourceName(HInstance, 'FONT03');
FONT04 := TImage.Create(Gui);
FONT04.Picture.Bitmap.LoadFromResourceName(HInstance, 'FONT04');
FONT05 := TImage.Create(Gui);
FONT05.Picture.Bitmap.LoadFromResourceName(HInstance, 'FONT05');
FONT06 := TImage.Create(Gui);
FONT06.Picture.Bitmap.LoadFromResourceName(HInstance, 'FONT06');
FONT07 := TImage.Create(Gui);
FONT07.Picture.Bitmap.LoadFromResourceName(HInstance, 'FONT07');
FONT08 := TImage.Create(Gui);
FONT08.Picture.Bitmap.LoadFromResourceName(HInstance, 'FONT08');
FONT09 := TImage.Create(Gui);
FONT09.Picture.Bitmap.LoadFromResourceName(HInstance, 'FONT09');
except
LogError('InitGraphics', GraBuff, 'failed!', $A0);
Main.Close; // fatal error - abort program
WaitDuration(DISPDELAY);
Halt;
end;
// clear definition tables
for i := 0 to MAXCHARS - 1 do begin
for j := 0 to CHARDEFS - 1 do begin
CharDim[i, j] := cCLEAR;
end;
end;
for i := 0 to MAXFONTS - 1 do begin
for j := 0 to FONTDEFS - 1 do begin
FontDef[i, j] := cCLEAR;
end;
end;
for i := 0 to MAXSYMBS - 1 do begin
for j := 0 to SYMBDEFS - 1 do begin
SymbDef[i, j] := cCLEAR;
end;
end;
for j := 0 to ICONDEFS - 1 do begin
IconDef[j] := cCLEAR;
end;
// TINY character font #1 3x5 dots (width in dots)
CharDim[1, 0] := 3; // Numbers
CharDim[1, 1] := 3; // A
CharDim[1, 2] := 3; // B
CharDim[1, 3] := 3; // C
CharDim[1, 4] := 3; // D
CharDim[1, 5] := 3; // E
CharDim[1, 6] := 3; // F
CharDim[1, 7] := 3; // G
CharDim[1, 8] := 3; // H
CharDim[1, 9] := 3; // I
CharDim[1, 10] := 3; // J
CharDim[1, 11] := 3; // K
CharDim[1, 12] := 3; // L
CharDim[1, 13] := 3; // M
CharDim[1, 14] := 3; // N
CharDim[1, 15] := 3; // O
CharDim[1, 16] := 3; // P
CharDim[1, 17] := 3; // Q
CharDim[1, 18] := 3; // R
CharDim[1, 19] := 3; // S
CharDim[1, 20] := 3; // T
CharDim[1, 21] := 3; // U
CharDim[1, 22] := 3; // V
CharDim[1, 23] := 3; // W
CharDim[1, 24] := 3; // X
CharDim[1, 25] := 3; // Y
CharDim[1, 26] := 3; // Z
CharDim[1, 27] := 2; // _
CharDim[1, 28] := 2; // (
CharDim[1, 29] := 2; // )
CharDim[1, 30] := 3; // %
CharDim[1, 31] := 1; // .
CharDim[1, 32] := 1; // :
CharDim[1, 33] := 3; // -
CharDim[1, 34] := 3; // +
CharDim[1, 35] := 3; // °
CharDim[1, 36] := 1; // '
CharDim[1, 37] := 1; // !
CharDim[1, 38] := 3; // ?
CharDim[1, 39] := 3; // /
CharDim[1, 40] := 1; // | (US date delimiter)
CharDim[1, 41] := 1; // (ISO date delimiter)
CharDim[1, 42] := 3; // left arrow
CharDim[1, 43] := 3; // right arrow
CharDim[1, 44] := 0; // 0=NOT YET DEFINED
// SMALL character font #2 5x5 dots (width in dots)
CharDim[2, 0] := 3; // Numbers and small characters
CharDim[2, 1] := 4; // A
CharDim[2, 2] := 4; // B
CharDim[2, 3] := 4; // C
CharDim[2, 4] := 4; // D
CharDim[2, 5] := 4; // E
CharDim[2, 6] := 4; // F
CharDim[2, 7] := 4; // G
CharDim[2, 8] := 4; // H
CharDim[2, 9] := 3; // I
CharDim[2, 10] := 4; // J
CharDim[2, 11] := 4; // K
CharDim[2, 12] := 3; // L
CharDim[2, 13] := 5; // M
CharDim[2, 14] := 4; // N
CharDim[2, 15] := 4; // O
CharDim[2, 16] := 4; // P
CharDim[2, 17] := 4; // Q
CharDim[2, 18] := 4; // R
CharDim[2, 19] := 4; // S
CharDim[2, 20] := 3; // T
CharDim[2, 21] := 4; // U
CharDim[2, 22] := 4; // V
CharDim[2, 23] := 5; // W
CharDim[2, 24] := 4; // X
CharDim[2, 25] := 4; // Y
CharDim[2, 26] := 4; // Z
CharDim[2, 27] := 2; // _
CharDim[2, 28] := 2; // (
CharDim[2, 29] := 2; // )
CharDim[2, 30] := 3; // %
CharDim[2, 31] := 1; // .
CharDim[2, 32] := 1; // :
CharDim[2, 33] := 3; // -
CharDim[2, 34] := 3; // +
CharDim[2, 35] := 3; // °
CharDim[2, 36] := 1; // '
CharDim[2, 37] := 1; // !
CharDim[2, 38] := 3; // ?
CharDim[2, 39] := 3; // /
CharDim[2, 40] := 1; // | (US date delimiter)
CharDim[2, 41] := 1; // (ISO date delimiter)
CharDim[2, 42] := 5; // left arrow
CharDim[2, 43] := 5; // right arrow
CharDim[2, 44] := 5; // Ft (feet symbol ~1)
CharDim[2, 45] := 5; // lb (pound symbol ~2)
CharDim[2, 46] := 5; // in (inch symbol ~3)
CharDim[2, 47] := 5; // X (off symbol ~4)
CharDim[2, 48] := 4; // / (on symbol ~5)
// BOLD character font #3 5x5 dots, (width in dots)
CharDim[3, 0] := 4; // Numbers
CharDim[3, 1] := 4; // A
CharDim[3, 2] := 4; // B
CharDim[3, 3] := 4; // C
CharDim[3, 4] := 4; // D
CharDim[3, 5] := 4; // E
CharDim[3, 6] := 4; // F
CharDim[3, 7] := 4; // G
CharDim[3, 8] := 4; // H
CharDim[3, 9] := 4; // I
CharDim[3, 10] := 4; // J
CharDim[3, 11] := 5; // K
CharDim[3, 12] := 4; // L
CharDim[3, 13] := 5; // M
CharDim[3, 14] := 4; // N
CharDim[3, 15] := 4; // O
CharDim[3, 16] := 4; // P
CharDim[3, 17] := 4; // Q
CharDim[3, 18] := 4; // R
CharDim[3, 19] := 4; // S
CharDim[3, 20] := 4; // T
CharDim[3, 21] := 4; // U
CharDim[3, 22] := 4; // V
CharDim[3, 23] := 5; // W
CharDim[3, 24] := 4; // X
CharDim[3, 25] := 4; // Y
CharDim[3, 26] := 4; // Z
CharDim[3, 27] := 3; // _
CharDim[3, 28] := 0; // 0=NOT YET DEFINED
// BIG character font #4 7x7 dots (width in dots)
CharDim[4, 0] := 5; // Numbers
CharDim[4, 1] := 6; // A
CharDim[4, 2] := 6; // B
CharDim[4, 3] := 5; // C
CharDim[4, 4] := 6; // D
CharDim[4, 5] := 6; // E
CharDim[4, 6] := 6; // F
CharDim[4, 7] := 6; // G
CharDim[4, 8] := 6; // H
CharDim[4, 9] := 4; // I
CharDim[4, 10] := 5; // J
CharDim[4, 11] := 7; // K
CharDim[4, 12] := 6; // L
CharDim[4, 13] := 7; // M
CharDim[4, 14] := 6; // N
CharDim[4, 15] := 6; // O
CharDim[4, 16] := 6; // P
CharDim[4, 17] := 7; // Q
CharDim[4, 18] := 6; // R
CharDim[4, 19] := 6; // S
CharDim[4, 20] := 6; // T
CharDim[4, 21] := 6; // U
CharDim[4, 22] := 6; // V
CharDim[4, 23] := 7; // W
CharDim[4, 24] := 6; // X
CharDim[4, 25] := 6; // Y
CharDim[4, 26] := 6; // Z
CharDim[4, 27] := 3; // _
CharDim[4, 28] := 3; // (
CharDim[4, 29] := 3; // )
CharDim[4, 30] := 7; // %
CharDim[4, 31] := 1; // .
CharDim[4, 32] := 1; // :
CharDim[4, 33] := 3; // -
CharDim[4, 34] := 3; // +
CharDim[4, 35] := 3; // °
CharDim[4, 36] := 1; // '
CharDim[4, 37] := 1; // !
CharDim[4, 38] := 3; // ?
CharDim[4, 39] := 3; // /
CharDim[4, 40] := 3; // | (US date delimiter)
CharDim[4, 41] := 3; // (ISO date delimiter)
CharDim[4, 42] := 4; // left arrow
CharDim[4, 43] := 4; // right arrow
CharDim[4, 44] := 6; // Ft (feet symbol ~1)
CharDim[4, 45] := 7; // lb (pound symbol ~2)
CharDim[4, 46] := 5; // in (inch symbol ~3)
CharDim[4, 47] := 5; // X (off symbol ~4)
CharDim[4, 48] := 6; // / (on symbol ~5)
GraBuff := IntToStr(MAXCHARS);
LogEvent('InitGraphics', 'Character sets initialized', GraBuff);
FontDef[1, 1] := 3; // fx TINY character font 3x5 dots
FontDef[1, 2] := 5; // fy ABCDE...XYZ_()%.:-+°'!?/|-{}
FontDef[1, 3] := 22; // lx font table length/LCDBYTE
FontDef[1, 4] := 7; // ly font tabel height
FontDef[1, 5] := 1; // fs
FontDef[2, 1] := 5; // fx SMALL character / numeric font 5x5 dots
FontDef[2, 2] := 5; // fy ABCDE...XYZ_()%.:-+°'!?/|-{} Ft lb in on off
FontDef[2, 3] := 37; // lx abcde...xyz0123456789
FontDef[2, 4] := 14; // ly
FontDef[2, 5] := 1; // fs
FontDef[3, 1] := 5; // fx BOLD character font 5x5 dots
FontDef[3, 2] := 5; // fy ABCDE...XYZ_
FontDef[3, 3] := 20; // lx
FontDef[3, 4] := 7; // ly
FontDef[3, 5] := 1; // fs
FontDef[4, 1] := 7; // fx BIG character font 7x7 dots
FontDef[4, 2] := 7; // fy ABCDE...XYZ_()%.:-+°'!?/|-{} Ft lb in on off
FontDef[4, 3] := 49; // lx 0123456789 // and numbers in 2nd row
FontDef[4, 4] := 18; // ly
FontDef[4, 5] := 1; // fs
FontDef[5, 1] := 3; // fx TINY numeric font 3x5 dots
FontDef[5, 2] := 5; // fy 0123456789_-.:!
FontDef[5, 3] := 8; // lx last sign is pseudo delimiter for leading zeors
FontDef[5, 4] := 7; // ly
FontDef[5, 5] := 1; // fs
FontDef[6, 1] := 4; // fx SMALL numeric font 4x7 dots
FontDef[6, 2] := 7; // fy 0123456789_-.:!
FontDef[6, 3] := 10; // lx
FontDef[6, 4] := 9; // ly
FontDef[6, 5] := 1; // fs
FontDef[7, 1] := 5; // fx BOLD numeric font 5x7 dots
FontDef[7, 2] := 7; // fy 0123456789_-.:!
FontDef[7, 3] := 12; // lx
FontDef[7, 4] := 9; // ly
FontDef[7, 5] := 1; // fs
FontDef[8, 1] := 6; // fx BIG numeric font 6x9 dots
FontDef[8, 2] := 9; // fy 0123456789_-.:!
FontDef[8, 3] := 15; // lx
FontDef[8, 4] := 11; // ly
FontDef[8, 5] := 2; // fs
FontDef[9, 1] := 8; // fx HUGE numeric font 8x12 dots
FontDef[9, 2] := 12; // fy 0123456789_-.:!
FontDef[9, 3] := 19; // lx
FontDef[9, 4] := 14; // ly
FontDef[9, 5] := 2; // fs
GraBuff := IntToStr(MAXFONTS);
LogEvent('InitGraphics', 'Fonts initialized', GraBuff);
IconDef[0] := 3; // bm number of icon bitmap file (Bitmap03.bmp)
IconDef[1] := 20; // lx icon tabel length/LCDBYTE
IconDef[2] := 18; // ly icon tabel height
IconDef[3] := MAXICONS; // number of icons defined
IconDef[4] := 16; // bx x-dimension of icons [dots]
IconDef[5] := 16; // by y-dimension of icons [dots]
GraBuff := IntToStr(MAXICONS);
LogEvent('InitGraphics', 'Icons initialized', GraBuff);
SymbDef[0, 1] := 14; // lx symbol tabel length/LCDBYTE
SymbDef[0, 2] := 48; // ly symbol tabel height
SymbDef[0, 3] := MAXSYMBS; // number of symbols defined
SymbDef[0, 4] := 0;
SymbDef[1, 1] := 1; // px big arrow up
SymbDef[1, 2] := 1; // py
SymbDef[1, 3] := 7; // fx
SymbDef[1, 4] := 9; // fy
SymbDef[2, 1] := 11; // px big arrow down
SymbDef[2, 2] := 1; // py
SymbDef[2, 3] := 7; // fx
SymbDef[2, 4] := 9; // fy
SymbDef[3, 1] := 21; // px minus sign [-]
SymbDef[3, 2] := 1; // py
SymbDef[3, 3] := 7; // fx
SymbDef[3, 4] := 9; // fy
SymbDef[4, 1] := 30; // px plus sign [+]
SymbDef[4, 2] := 1; // py
SymbDef[4, 3] := 7; // fx
SymbDef[4, 4] := 9; // fy
SymbDef[5, 1] := 40; // px small arrow rigth
SymbDef[5, 2] := 1; // py
SymbDef[5, 3] := 7; // fx
SymbDef[5, 4] := 5; // fy
SymbDef[6, 1] := 50; // px small arrow up
SymbDef[6, 2] := 1; // py
SymbDef[6, 3] := 7; // fx
SymbDef[6, 4] := 7; // fy
SymbDef[7, 1] := 60; // px percent sign [%]
SymbDef[7, 2] := 1; // py
SymbDef[7, 3] := 7; // fx
SymbDef[7, 4] := 7; // fy
SymbDef[8, 1] := 70; // px centigrade [°C]
SymbDef[8, 2] := 1; // py
SymbDef[8, 3] := 8; // fx
SymbDef[8, 4] := 7; // fy
SymbDef[9, 1] := 81; // px fahrenheit [°F]
SymbDef[9, 2] := 1; // py
SymbDef[9, 3] := 8; // fx
SymbDef[9, 4] := 7; // fy
SymbDef[10, 1] := 92; // px degree sign [°]
SymbDef[10, 2] := 1; // py
SymbDef[10, 3] := 3; // fx
SymbDef[10, 4] := 3; // fy
SymbDef[11, 1] := 1; // px pointer up
SymbDef[11, 2] := 12; // py
SymbDef[11, 3] := 7; // fx
SymbDef[11, 4] := 7; // fy
SymbDef[12, 1] := 11; // px pointer down
SymbDef[12, 2] := 12; // py
SymbDef[12, 3] := 7; // fx
SymbDef[12, 4] := 7; // fy
SymbDef[13, 1] := 1; // px meter [M] symbol
SymbDef[13, 2] := 29; // py
SymbDef[13, 3] := 5; // fx
SymbDef[13, 4] := 5; // fy
SymbDef[14, 1] := 9; // px feet [Ft] symbol
SymbDef[14, 2] := 29; // py
SymbDef[14, 3] := 5; // fx
SymbDef[14, 4] := 5; // fy
SymbDef[15, 1] := 17; // px yard [yd] symbol
SymbDef[15, 2] := 29; // py
SymbDef[15, 3] := 6; // fx
SymbDef[15, 4] := 5; // fy
SymbDef[16, 1] := 22; // px arrow left/right (select)
SymbDef[16, 2] := 12; // py
SymbDef[16, 3] := 7; // fx
SymbDef[16, 4] := 5; // fy
SymbDef[17, 1] := 48; // px heading pointer
SymbDef[17, 2] := 12; // py
SymbDef[17, 3] := 7; // fx
SymbDef[17, 4] := 4; // fy
SymbDef[18, 1] := 58; // px surface symbol
SymbDef[18, 2] := 11; // py
SymbDef[18, 3] := 7; // fx
SymbDef[18, 4] := 7; // fy
SymbDef[19, 1] := 68; // px not fly symbol
SymbDef[19, 2] := 11; // py
SymbDef[19, 3] := 7; // fx
SymbDef[19, 4] := 7; // fy
SymbDef[20, 1] := 98; // px small percent sign [%]
SymbDef[20, 2] := 3; // py
SymbDef[20, 3] := 4; // fx
SymbDef[20, 4] := 4; // fy
SymbDef[21, 1] := 32; // px pointer left
SymbDef[21, 2] := 12; // py
SymbDef[21, 3] := 4; // fx
SymbDef[21, 4] := 5; // fy
SymbDef[22, 1] := 40; // px pointer right
SymbDef[22, 2] := 12; // py
SymbDef[22, 3] := 4; // fx
SymbDef[22, 4] := 5; // fy
SymbDef[23, 1] := 98; // px desaturation symbol
SymbDef[23, 2] := 11; // py
SymbDef[23, 3] := 7; // fx
SymbDef[23, 4] := 7; // fy
SymbDef[24, 1] := 1; // px bearing symbol #0 (arrow down) - BEARSYMBOL=24
SymbDef[24, 2] := 20; // py
SymbDef[24, 3] := 11; // fx
SymbDef[24, 4] := 7; // fy
SymbDef[25, 1] := 14; // px bearing symbol #1 (dbl arrow left)
SymbDef[25, 2] := 20; // py
SymbDef[25, 3] := 11; // fx
SymbDef[25, 4] := 7; // fy
SymbDef[26, 1] := 27; // px bearing symbol #2 (arrow left)
SymbDef[26, 2] := 20; // py
SymbDef[26, 3] := 11; // fx
SymbDef[26, 4] := 7; // fy
SymbDef[27, 1] := 40; // px bearing symbol #3 (arrow up)
SymbDef[27, 2] := 20; // py
SymbDef[27, 3] := 11; // fx
SymbDef[27, 4] := 7; // fy
SymbDef[28, 1] := 53; // px bearing symbol #4 (arrow right)
SymbDef[28, 2] := 20; // py
SymbDef[28, 3] := 11; // fx
SymbDef[28, 4] := 7; // fy
SymbDef[29, 1] := 66; // px bearing symbol #5 (dbl arrow right)
SymbDef[29, 2] := 20; // py
SymbDef[29, 3] := 11; // fx
SymbDef[29, 4] := 7; // fy
SymbDef[30, 1] := 26; // px bar [BAR] symbol
SymbDef[30, 2] := 29; // py
SymbDef[30, 3] := 11; // fx
SymbDef[30, 4] := 5; // fy
SymbDef[31, 1] := 40; // px psi [PSI] symbol
SymbDef[31, 2] := 29; // py
SymbDef[31, 3] := 11; // fx
SymbDef[31, 4] := 5; // fy
SymbDef[32, 1] := 54; // px hekto pascal [hPa] symbol
SymbDef[32, 2] := 29; // py
SymbDef[32, 3] := 9; // fx
SymbDef[32, 4] := 7; // fy
SymbDef[33, 1] := 65; // px inch mercury [inHg] symbol
SymbDef[33, 2] := 29; // py
SymbDef[33, 3] := 9; // fx
SymbDef[33, 4] := 7; // fy
SymbDef[34, 1] := 75; // px oxygen [O2] symbol
SymbDef[34, 2] := 29; // py
SymbDef[34, 3] := 8; // fx
SymbDef[34, 4] := 7; // fy
SymbDef[35, 1] := 84; // px clock alarm symbol
SymbDef[35, 2] := 29; // py
SymbDef[35, 3] := 6; // fx
SymbDef[35, 4] := 7; // fy
SymbDef[36, 1] := 78; // px warning symbol
SymbDef[36, 2] := 11; // py
SymbDef[36, 3] := 7; // fx
SymbDef[36, 4] := 7; // fy
SymbDef[37, 1] := 88; // px cursor pointer
SymbDef[37, 2] := 11; // py
SymbDef[37, 3] := 6; // fx
SymbDef[37, 4] := 6; // fy
SymbDef[38, 1] := 1; // px moon symbol #0 (new moon) - MOONSYMBOL=38
SymbDef[38, 2] := 37; // py
SymbDef[38, 3] := 7; // fx
SymbDef[38, 4] := 7; // fy
SymbDef[39, 1] := 10; // px moon symbol #1
SymbDef[39, 2] := 37; // py
SymbDef[39, 3] := 7; // fx
SymbDef[39, 4] := 7; // fy
SymbDef[40, 1] := 19; // px moon symbol #2
SymbDef[40, 2] := 37; // py
SymbDef[40, 3] := 7; // fx
SymbDef[40, 4] := 7; // fy
SymbDef[41, 1] := 28; // px moon symbol #3 (half moon)
SymbDef[41, 2] := 37; // py
SymbDef[41, 3] := 7; // fx
SymbDef[41, 4] := 7; // fy
SymbDef[42, 1] := 37; // px moon symbol #4
SymbDef[42, 2] := 37; // py
SymbDef[42, 3] := 7; // fx
SymbDef[42, 4] := 7; // fy
SymbDef[43, 1] := 46; // px moon symbol #5
SymbDef[43, 2] := 37; // py
SymbDef[43, 3] := 7; // fx
SymbDef[43, 4] := 7; // fy
SymbDef[44, 1] := 55; // px moon symbol #6 [full moon)
SymbDef[44, 2] := 37; // py
SymbDef[44, 3] := 7; // fx
SymbDef[44, 4] := 7; // fy
SymbDef[45, 1] := 64; // px moon symbol #7
SymbDef[45, 2] := 37; // py
SymbDef[45, 3] := 7; // fx
SymbDef[45, 4] := 7; // fy
SymbDef[46, 1] := 73; // px moon symbol #8
SymbDef[46, 2] := 37; // py
SymbDef[46, 3] := 7; // fx
SymbDef[46, 4] := 7; // fy
SymbDef[47, 1] := 82; // px moon symbol #9 [half moon)
SymbDef[47, 2] := 37; // py
SymbDef[47, 3] := 7; // fx
SymbDef[47, 4] := 7; // fy
SymbDef[48, 1] := 91; // px moon symbol #10
SymbDef[48, 2] := 37; // py
SymbDef[48, 3] := 7; // fx
SymbDef[48, 4] := 7; // fy
SymbDef[49, 1] :=100; // px moon symbol #11
SymbDef[49, 2] := 37; // py
SymbDef[49, 3] := 7; // fx
SymbDef[49, 4] := 7; // fy
SymbDef[50, 1] := 91; // px no sonar symbol 02.06.07 nk add ff
SymbDef[50, 2] := 29; // py
SymbDef[50, 3] := 6; // fx
SymbDef[50, 4] := 6; // fy
GraBuff := IntToStr(MAXSYMBS);
LogEvent('InitGraphics', 'Symbols initialized', GraBuff);
end;
//------------------------------------------------------------------------------
// INITSCREEN - Initialize graphic display buffer with background pattern
//------------------------------------------------------------------ 17.02.07 --
procedure InitScreen(Win: Byte);
begin
case Win of
0: LcdBuffer.Picture.Assign(WINDOW00.Picture);
1: LcdBuffer.Picture.Assign(WINDOW01.Picture);
2: LcdBuffer.Picture.Assign(WINDOW02.Picture);
3: LcdBuffer.Picture.Assign(WINDOW03.Picture);
4: LcdBuffer.Picture.Assign(WINDOW04.Picture);
5: LcdBuffer.Picture.Assign(WINDOW05.Picture);
6: LcdBuffer.Picture.Assign(WINDOW06.Picture);
7: LcdBuffer.Picture.Assign(WINDOW07.Picture);
else
GraBuff := IntToStr(Win);
LogError('InitScreen', 'Unsupported window', GraBuff, $90);
end;
end;
//------------------------------------------------------------------------------
// CLEARBOX - Fast function to clear a box (or fill it with white dots)
// dot=0 means white dots instead of DOTOFF=1 !
//------------------------------------------------------------------ 17.02.07 --
procedure ClearBox(Box: Word);
var
dx, dy, bx, by, wx, wy, dot, win: Byte;
begin
win := BoxSpec[Box, 1]; // actual window
wx := WinSpec[win, 1];
wy := WinSpec[win, 2];
bx := BoxSpec[Box, 2];
by := BoxSpec[Box, 3];
dx := BoxSpec[Box, 4];
dy := BoxSpec[Box, 5];
dot := BoxSpec[Box, 9] mod 10;
// show inverse boxes for debugging
if DebugFlag = cON then begin
if Box = BoxNum then Exit;
InvertBit(dot);
BoxNum := Box;
end;
GraphicFillMask(LCDXRANGE, LCDYRANGE, wx + bx, wy + by, dx, dy, dot)
end;
//------------------------------------------------------------------------------
// DISPNUMVALUE - Display given integer value with optional delimiter in a box
//------------------------------------------------------------------------------
// Specify type of font in BoxSpec[Box, 7]:
// font 5 - tiny numeric font 3x5 dots
// font 6 - small numeric font 4x7 dots
// font 7 - bold numeric font 5x7 dots
// font 8 - big numeric font 6x9 dots
// font 9 - large numeric font 8x12 dots
// pos 0-9 = digits
// pos 10 = space
// pos 11 = minus sign
// pos 12 = decimal point delimiter
// pos 13 = double point delimiter
// pos 14 = error sign (!) for range over-/underflow
// dmod - 0=COPY, 2=OR, 3=AND, 3=INV
// lead - 0=SPACE, 1=ZERO
//------------------------------------------------------------------ 17.02.07 --
procedure DispNumValue(Box: Word; Value: Long);
var
d, ds, fd, fs, ly, bx, by, px, py, fx, fy, wx, wy, win: Byte;
dnum, dmax, dpos, ddel, dmod, digit, fpos, first, lead: Byte;
lx, fptr: Word;
mpos, dval, tval, tmax: Long;
begin
py := cCLEAR;
px := cCLEAR;
win := BoxSpec[Box, 1]; // actual window
wx := WinSpec[win, 1]; // start x-pos of window
wy := WinSpec[win, 2]; // start y-pos of window
bx := BoxSpec[Box, 2]; // start x-pos of box
by := BoxSpec[Box, 3]; // start y-pos of box
fd := BoxSpec[Box, 7]; // font definition
lead := BoxSpec[Box, 6]; // leading zero
dmax := BoxSpec[Box, 8] div 10; // total number of digits
dnum := BoxSpec[Box, 8] mod 10; // digits after decimal point
tmax := Round(Power(10, dmax)); // max value to display
if Value < 0 then begin // negative value
tval := -Value; // position of minus sign
mpos := dmax - dnum - Trunc(Log10(tval)) - 1;
end else begin
tval := Value;
mpos := cNEG;
end;
if tval >= tmax then begin // display range overflow
tmax := POSERROR; // special error sign (!)
GraBuff := IntToStr(Box);
LogError('DispNumValue', 'Display range overflow in box', GraBuff, $98);
end else begin
tmax := cOFF;
end;
ddel := BoxSpec[Box, 9] div 10 + POSMINUS; // delimiter character
dmod := BoxSpec[Box, 9] mod 10; // drawing mode
fs := FontDef[fd, 5]; // font space
fx := FontDef[fd, 1] + fs; // font x-dim + x-space
fy := FontDef[fd, 2] + 2; // font y-dim + y-space
lx := FontDef[fd, 3] * LCDBYTE; // font file length
ly := FontDef[fd, 4]; // font file height
first := cOFF;
dval := Round(Power(10, (dmax - 1)));
// show inverse boxes for debugging
if DebugFlag = cON then begin
ClearBox(Box);
if dmod = LCDDOTON then begin
dmod := LCDDOTNEG;
end else begin
dmod := LCDDOTON;
end;
end;
if dmod > LCDDOTNEG then begin
dmod := LCDDOTON; // unsupported dot mode
end;
if dnum = cOFF then begin // no delimiter
dpos := MAXBYTE;
end else begin
dpos := dmax - dnum; // position of delimiter
end;
if (tval = 0) and (dnum = 0) then begin // disp value = 0
first := cON;
px := fx * (dmax - 1);
dmax := 1;
end;
if dnum = 0 then begin
ds := 1;
end else begin
ds := 0;
end;
for d := ds to dmax do begin // from left to right digit
if dval <> 0 then begin
digit := tval div dval;
end else begin
digit := 0;
end;
if digit > 0 then begin
first := cON;
end;
if (digit = 0) and (first = cOFF) then begin
if d = mpos then begin
fpos := POSMINUS; // minus sign
mpos := cNEG;
end else begin // fill left digits..
if lead = cON then begin
fpos := 0; // ..with zero character
end else begin
fpos := POSSPACE; // ..with space character
end;
end;
end else begin
fpos := digit;
end;
if d = dpos then begin
first := cON;
fpos := ddel; // digit delimiter
end;
if tmax <> cOFF then begin
fpos := POSERROR; // display range overflow
end;
fptr := fpos * fx; // pointer to digit in font table
case fd of // select font
5: GraphicCopy(FONT05, LCDXRANGE, LCDYRANGE, wx + bx + px, wy + by + py, lx, ly, fptr, 0, fx, fy, dmod);
6: GraphicCopy(FONT06, LCDXRANGE, LCDYRANGE, wx + bx + px, wy + by + py, lx, ly, fptr, 0, fx, fy, dmod);
7: GraphicCopy(FONT07, LCDXRANGE, LCDYRANGE, wx + bx + px, wy + by + py, lx, ly, fptr, 0, fx, fy, dmod);
8: GraphicCopy(FONT08, LCDXRANGE, LCDYRANGE, wx + bx + px, wy + by + py, lx, ly, fptr, 0, fx, fy, dmod);
9: GraphicCopy(FONT09, LCDXRANGE, LCDYRANGE, wx + bx + px, wy + by + py, lx, ly, fptr, 0, fx, fy, dmod);
else
GraBuff := IntToStr(fd) + ' in box ' + IntToStr(Box);
LogError('DispNumValue', 'Unsupported font', GraBuff, $91);
Exit;
end;
if fpos <= POSMINUS then begin // numbers or minus sign
px := px + fx; // position of next digit
tval := tval - (digit * dval);
dval := dval div 10;
end else begin
px := px + 2 * fs; // space for delimiter
end;
end;
end;
//------------------------------------------------------------------------------
// DISPTEXT - Display text string of numbers, characters, and symbols in a box
//------------------------------------------------------------------------------
// Specify type of font in BoxSpec[Box, 7]:
// font 1 - tiny character font 3x5 dots
// font 2 - small character font 5x5 dots
// font 3 - bold character font 5x5 dots
// font 4 - big character font 7x7 dots
// tpos - text position 0=left, 1=mid, 2=right
// dmod - 0=COPY, 1=OR, 2=AND, 3=INV
// Mode - overload tpos 10=left, 11=mid, 12=right
//------------------------------------------------------------------ 17.02.07 --
procedure DispText(Box: Word; Text: string; Mode: Byte);
var
d, dx, cx, ox, oy, fd, fs, ly, bx, by, px, py, fx, fy, ft, wx, wy: Byte;
Anum, dmax, dpos, dmod, don, dof, tpos, fpos, fcor, fdim, fmid, sym, win: Byte;
lx, fptr: Word;
c: Char;
label
NEXTCHAR;
begin
ox := cCLEAR;
oy := cCLEAR;
py := cCLEAR;
px := cCLEAR;
win := BoxSpec[Box, 1]; // actual window
wx := WinSpec[win, 1]; // start x-pos of window
wy := WinSpec[win, 2]; // start y-pos of window
bx := BoxSpec[Box, 2]; // start x-pos of box
by := BoxSpec[Box, 3]; // start y-pos of box
dx := BoxSpec[Box, 4]; // x-dimension of box
fd := BoxSpec[Box, 7]; // font definition
dmax := Length(Text); // total number of characters
tpos := BoxSpec[Box, 6]; // text position
dmod := BoxSpec[Box, 9] mod 10; // drawing mode
if Mode >= LEFTPOS then begin
tpos := Mode - LEFTPOS; // overload text position
end;
fs := FontDef[fd, 5]; // font space
cx := FontDef[fd, 1] + fs; // font x-dim + x-space
fy := FontDef[fd, 2] + 2; // font y-dim + y-space
lx := FontDef[fd, 3] * LCDBYTE; // font file length
ly := FontDef[fd, 4]; // font file height
// show inverse boxes for debugging
if DebugFlag = cON then begin
ClearBox(Box);
if dmod = LCDDOTON then begin
dmod := LCDDOTNEG;
end else begin
dmod := LCDDOTON;
end;
end;
if dmod > LCDDOTNEG then begin
dmod := LCDDOTON; // unsupported dot mode
end;