-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskinlcars.c
2265 lines (2110 loc) · 86.2 KB
/
skinlcars.c
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
/*
* skinlcars.c: A VDR skin with Star Trek's "LCARS" layout
*
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skinlcars.c 3.6 2013/11/16 13:20:19 kls Exp $
*/
// "Star Trek: The Next Generation"(R) is a registered trademark of Paramount Pictures,
// registered in the United States Patent and Trademark Office, all rights reserved.
// The LCARS system is based upon the designs of Michael Okuda and his Okudagrams.
//
// "LCARS" is short for "Library Computer Access and Retrieval System".
// Some resources used for writing this skin can be found at
// http://www.lcars.org.uk
// http://www.lcarsdeveloper.com
// http://www.lcarscom.net
// http://lds-jedi.deviantart.com/art/LCARS-Swept-Tutorial-213936938
// http://lds-jedi.deviantart.com/art/LCARS-Button-Tutorial-210783437
// http://zelldenver.deviantart.com/art/LCARS-Color-Standard-179565780
// http://www.lcars47.com
// http://www.bracercom.com/tutorial/content/CoherentLCARSInterface/LCARSCoherentInterface.html
// http://www.bracercom.com/tutorial/content/lcars_manifesto/the_lcars_manifesto.html
#include "skinlcars.h"
#include "font.h"
#include "menu.h"
#include "osd.h"
#include "positioner.h"
#include "themes.h"
#include "videodir.h"
#include "symbols/arrowdown.xpm"
#include "symbols/arrowup.xpm"
#include "symbols/audio.xpm"
#include "symbols/audioleft.xpm"
#include "symbols/audioright.xpm"
#include "symbols/audiostereo.xpm"
#include "symbols/dolbydigital.xpm"
#include "symbols/encrypted.xpm"
#include "symbols/ffwd.xpm"
#include "symbols/ffwd1.xpm"
#include "symbols/ffwd2.xpm"
#include "symbols/ffwd3.xpm"
#include "symbols/frew.xpm"
#include "symbols/frew1.xpm"
#include "symbols/frew2.xpm"
#include "symbols/frew3.xpm"
#include "symbols/mute.xpm"
#include "symbols/pause.xpm"
#include "symbols/play.xpm"
#include "symbols/radio.xpm"
#include "symbols/recording.xpm"
#include "symbols/sfwd.xpm"
#include "symbols/sfwd1.xpm"
#include "symbols/sfwd2.xpm"
#include "symbols/sfwd3.xpm"
#include "symbols/srew.xpm"
#include "symbols/srew1.xpm"
#include "symbols/srew2.xpm"
#include "symbols/srew3.xpm"
#include "symbols/teletext.xpm"
#include "symbols/volume.xpm"
#define Gap (Setup.FontOsdSize / 5 & ~1) // must be even
#define TextFrame (Setup.FontOsdSize / TEXT_ALIGN_BORDER)
#define TextSpacing (2 * TextFrame)
#define SymbolSpacing TextSpacing
#define ShowSeenExtent (Setup.FontOsdSize / 5) // pixels by which the "seen" bar extends out of the frame
#define DISKUSAGEALERTLIMIT 95 // percent of disk usage above which the display goes into alert mode
#define SIGNALDISPLAYDELTA 2 // seconds between subsequent device signal displays
static cTheme Theme;
// Color domains:
#define CLR_BACKGROUND 0x99000000
#define CLR_MAIN_FRAME 0xFFFF9966
#define CLR_CHANNEL_FRAME 0xFF8A9EC9
#define CLR_REPLAY_FRAME 0xFFCC6666
#define CLR_DATE 0xFF99CCFF
#define CLR_MENU_ITEMS 0xFF9999FF
#define CLR_TIMER 0xFF99CCFF
#define CLR_DEVICE 0xFFF1B1AF
#define CLR_CHANNEL_NAME 0xFF99CCFF
#define CLR_EVENT_TITLE 0xFF99CCFF
#define CLR_EVENT_TIME 0xFFFFCC66
#define CLR_EVENT_SHORTTEXT 0xFFFFCC66
#define CLR_TEXT 0xFF99CCFF
#define CLR_TRACK 0xFFFFCC66
#define CLR_SEEN 0xFFCC99CC
#define CLR_ALERT 0xFFFF0000
#define CLR_EXPOSED 0xFF990000
#define CLR_WHITE 0xFFFFFFFF
#define CLR_RED 0xFFCC6666
#define CLR_GREEN 0xFFA0FF99
#define CLR_YELLOW 0xFFF1DF60
#define CLR_BLUE 0xFF9A99FF
#define CLR_BLACK 0xFF000000
// General colors:
THEME_CLR(Theme, clrBackground, CLR_BACKGROUND);
THEME_CLR(Theme, clrDateFg, CLR_BLACK);
THEME_CLR(Theme, clrDateBg, CLR_DATE);
THEME_CLR(Theme, clrTimerFg, CLR_BLACK);
THEME_CLR(Theme, clrTimerBg, CLR_TIMER);
THEME_CLR(Theme, clrDeviceFg, CLR_BLACK);
THEME_CLR(Theme, clrDeviceBg, CLR_DEVICE);
THEME_CLR(Theme, clrSignalValue, CLR_GREEN);
THEME_CLR(Theme, clrSignalRest, CLR_RED);
THEME_CLR(Theme, clrSeen, CLR_SEEN);
THEME_CLR(Theme, clrTrackName, CLR_TRACK);
THEME_CLR(Theme, clrAlertFg, CLR_WHITE);
THEME_CLR(Theme, clrAlertBg, CLR_ALERT);
THEME_CLR(Theme, clrChannelName, CLR_CHANNEL_NAME);
THEME_CLR(Theme, clrEventTitle, CLR_EVENT_TITLE);
THEME_CLR(Theme, clrEventTime, CLR_EVENT_TIME);
THEME_CLR(Theme, clrEventShortText, CLR_EVENT_SHORTTEXT);
THEME_CLR(Theme, clrEventDescription, CLR_TEXT);
// Buttons:
THEME_CLR(Theme, clrButtonRedFg, CLR_BLACK);
THEME_CLR(Theme, clrButtonRedBg, CLR_RED);
THEME_CLR(Theme, clrButtonGreenFg, CLR_BLACK);
THEME_CLR(Theme, clrButtonGreenBg, CLR_GREEN);
THEME_CLR(Theme, clrButtonYellowFg, CLR_BLACK);
THEME_CLR(Theme, clrButtonYellowBg, CLR_YELLOW);
THEME_CLR(Theme, clrButtonBlueFg, CLR_BLACK);
THEME_CLR(Theme, clrButtonBlueBg, CLR_BLUE);
// Messages:
THEME_CLR(Theme, clrMessageStatusFg, CLR_BLACK);
THEME_CLR(Theme, clrMessageStatusBg, CLR_BLUE);
THEME_CLR(Theme, clrMessageInfoFg, CLR_BLACK);
THEME_CLR(Theme, clrMessageInfoBg, CLR_GREEN);
THEME_CLR(Theme, clrMessageWarningFg, CLR_BLACK);
THEME_CLR(Theme, clrMessageWarningBg, CLR_YELLOW);
THEME_CLR(Theme, clrMessageErrorFg, CLR_BLACK);
THEME_CLR(Theme, clrMessageErrorBg, CLR_RED);
// Volume:
THEME_CLR(Theme, clrVolumeFrame, CLR_MAIN_FRAME);
THEME_CLR(Theme, clrVolumeSymbol, CLR_BLACK);
THEME_CLR(Theme, clrVolumeBarUpper, RgbShade(CLR_MAIN_FRAME, -0.2));
THEME_CLR(Theme, clrVolumeBarLower, CLR_GREEN);
// Channel display:
THEME_CLR(Theme, clrChannelFrameFg, CLR_BLACK);
THEME_CLR(Theme, clrChannelFrameBg, CLR_CHANNEL_FRAME);
THEME_CLR(Theme, clrChannelSymbolOn, CLR_BLACK);
THEME_CLR(Theme, clrChannelSymbolOff, RgbShade(CLR_CHANNEL_FRAME, -0.2));
THEME_CLR(Theme, clrChannelSymbolRecFg, CLR_WHITE);
THEME_CLR(Theme, clrChannelSymbolRecBg, CLR_RED);
// Menu:
THEME_CLR(Theme, clrMenuFrameFg, CLR_BLACK);
THEME_CLR(Theme, clrMenuFrameBg, CLR_MAIN_FRAME);
THEME_CLR(Theme, clrMenuTitle, CLR_MAIN_FRAME);
THEME_CLR(Theme, clrMenuMainBracket, CLR_MENU_ITEMS);
THEME_CLR(Theme, clrMenuTimerRecording, CLR_DEVICE);
THEME_CLR(Theme, clrMenuDeviceRecording, CLR_TIMER);
THEME_CLR(Theme, clrMenuItemCurrentFg, CLR_MAIN_FRAME);
THEME_CLR(Theme, clrMenuItemCurrentBg, RgbShade(CLR_MENU_ITEMS, -0.5));
THEME_CLR(Theme, clrMenuItemSelectable, CLR_MENU_ITEMS);
THEME_CLR(Theme, clrMenuItemNonSelectable, CLR_TEXT);
THEME_CLR(Theme, clrMenuScrollbarTotal, RgbShade(CLR_MAIN_FRAME, 0.2));
THEME_CLR(Theme, clrMenuScrollbarShown, CLR_SEEN);
THEME_CLR(Theme, clrMenuScrollbarArrow, CLR_BLACK);
THEME_CLR(Theme, clrMenuText, CLR_TEXT);
// Replay display:
THEME_CLR(Theme, clrReplayFrameFg, CLR_BLACK);
THEME_CLR(Theme, clrReplayFrameBg, CLR_REPLAY_FRAME);
THEME_CLR(Theme, clrReplayPosition, CLR_SEEN);
THEME_CLR(Theme, clrReplayJumpFg, CLR_BLACK);
THEME_CLR(Theme, clrReplayJumpBg, CLR_SEEN);
THEME_CLR(Theme, clrReplayProgressSeen, CLR_SEEN);
THEME_CLR(Theme, clrReplayProgressRest, RgbShade(CLR_WHITE, -0.2));
THEME_CLR(Theme, clrReplayProgressSelected, CLR_EXPOSED);
THEME_CLR(Theme, clrReplayProgressMark, CLR_BLACK);
THEME_CLR(Theme, clrReplayProgressCurrent, CLR_EXPOSED);
// Track display:
THEME_CLR(Theme, clrTrackFrameFg, CLR_BLACK);
THEME_CLR(Theme, clrTrackFrameBg, CLR_TRACK);
THEME_CLR(Theme, clrTrackItemFg, CLR_BLACK);
THEME_CLR(Theme, clrTrackItemBg, RgbShade(CLR_TRACK, 0.5));
THEME_CLR(Theme, clrTrackItemCurrentFg, CLR_BLACK);
THEME_CLR(Theme, clrTrackItemCurrentBg, CLR_TRACK);
// --- Helper functions ------------------------------------------------------
static bool TwoColors = false;
static cOsd *CreateOsd(int Left, int Top, int x0, int y0, int x1, int y1)
{
cOsd *Osd = cOsdProvider::NewOsd(Left, Top);
int Bpp[] = { 32, 8, 4, 2, 1 };
tArea Area = { x0, y0, x1, y1, 0 };
for (unsigned int i = 0; i < sizeof(Bpp) / sizeof(int); i++) {
Area.bpp = Bpp[i];
if (Osd->CanHandleAreas(&Area, 1) == oeOk) {
Osd->SetAreas(&Area, 1);
Osd->SetAntiAliasGranularity(20, 16);
TwoColors = Area.bpp == 1;
break;
}
}
return Osd;
}
static cFont *CreateTinyFont(int LineHeight)
{
// Creates a font that is not higher than half of LineHeight.
LineHeight /= 2;
int Height = LineHeight;
for (;;) {
cFont *TinyFont = cFont::CreateFont(Setup.FontOsd, Height);
if (Height < 2 || TinyFont->Height() <= LineHeight)
return TinyFont;
delete TinyFont;
Height -= 1;
}
}
static bool DrawDeviceData(cOsd *Osd, const cDevice *Device, int x0, int y0, int x1, int y1, int &xs, const cFont *TinyFont, cString &LastDeviceType, cCamSlot *&LastCamSlot, bool Initial)
{
cString DeviceType = Device->DeviceType();
cCamSlot *CamSlot = Device->CamSlot();
if (Initial || strcmp(DeviceType, LastDeviceType) || CamSlot != LastCamSlot) {
const cFont *font = cFont::GetFont(fontOsd);
tColor ColorFg = Theme.Color(clrDeviceFg);
tColor ColorBg = Theme.Color(clrDeviceBg);
Osd->DrawRectangle(x0, y0, x1 - 1, y1 - 1, ColorBg);
int x = x0;
// Device number:
cString Nr = itoa(Device->DeviceNumber() + 1);
int w = max(font->Width(Nr), y1 - y0);
Osd->DrawText(x, y0, Nr, ColorFg, ColorBg, font, w, y1 - y0, taCenter);
x += w;
// Device type:
Osd->DrawText(x, y0, DeviceType, ColorFg, ColorBg, TinyFont);
xs = max(xs, x + TinyFont->Width(DeviceType));
LastDeviceType = DeviceType;
// CAM:
if (CamSlot) {
cString s = cString::sprintf("CAM %d", CamSlot->SlotNumber());
Osd->DrawText(x, y1 - TinyFont->Height(), s, ColorFg, ColorBg, TinyFont);
xs = max(xs, x + TinyFont->Width(s));
}
LastCamSlot = CamSlot;
return true;
}
return false;
}
static void DrawDeviceSignal(cOsd *Osd, const cDevice *Device, int x0, int y0, int x1, int y1, int &LastSignalStrength, int &LastSignalQuality, bool Initial)
{
int SignalStrength = Device->SignalStrength();
int SignalQuality = Device->SignalQuality();
int d = max((y1 - y0) / 10, 1);
int x00 = x0 + d;
int x01 = x1 - d;
int h = (y1 - y0 - 3 * d) / 2;
int w = x01 - x00;
int y00 = y0 + d;
int y01 = y00 + h;
int y03 = y1 - d;
int y02 = y03 - h;
tColor ColorSignalValue, ColorSignalRest;
if (TwoColors) {
ColorSignalValue = Theme.Color(clrBackground);
ColorSignalRest = Theme.Color(clrMenuFrameBg);
}
else {
ColorSignalValue = Theme.Color(clrSignalValue);
ColorSignalRest = Theme.Color(clrSignalRest);
}
if (SignalStrength >= 0 && (Initial || SignalStrength != LastSignalStrength)) {
int s = SignalStrength * w / 100;
Osd->DrawRectangle(x00, y00, x00 + s - 1, y01 - 1, ColorSignalValue);
Osd->DrawRectangle(x00 + s, y00, x01 - 1, y01 - 1, ColorSignalRest);
LastSignalStrength = SignalStrength;
}
if (SignalQuality >= 0 && (Initial || SignalQuality != LastSignalQuality)) {
int q = SignalQuality * w / 100;
Osd->DrawRectangle(x00, y02, x00 + q - 1, y03 - 1, ColorSignalValue);
Osd->DrawRectangle(x00 + q, y02, x01 - 1, y03 - 1, ColorSignalRest);
LastSignalQuality = SignalQuality;
}
}
static void DrawDevicePosition(cOsd *Osd, const cPositioner *Positioner, int x0, int y0, int x1, int y1, int &LastCurrent)
{
int HorizonLeft = Positioner->HorizonLongitude(cPositioner::pdLeft);
int HorizonRight = Positioner->HorizonLongitude(cPositioner::pdRight);
int HardLimitLeft = cPositioner::NormalizeAngle(HorizonLeft - Positioner->HardLimitLongitude(cPositioner::pdLeft));
int HardLimitRight = cPositioner::NormalizeAngle(Positioner->HardLimitLongitude(cPositioner::pdRight) - HorizonRight);
int HorizonDelta = cPositioner::NormalizeAngle(HorizonLeft - HorizonRight);
int Current = cPositioner::NormalizeAngle(HorizonLeft - Positioner->CurrentLongitude());
int Target = cPositioner::NormalizeAngle(HorizonLeft - Positioner->TargetLongitude());
int d = (y1 - y0) / 2;
int w = x1 - x0 - 2 * d;
int l = max(x0 + d, x0 + d + w * HardLimitLeft / HorizonDelta);
int r = min(x1 - d, x1 - d - w * HardLimitRight / HorizonDelta) - 1;
int c = constrain(x0 + d + w * Current / HorizonDelta, l, r);
int t = constrain(x0 + d + w * Target / HorizonDelta, l, r);
if (c == LastCurrent)
return;
if (c > t)
swap(c, t);
tColor ColorRange, ColorMove;
if (TwoColors) {
ColorRange = Theme.Color(clrChannelFrameBg);
ColorMove = Theme.Color(clrBackground);
}
else {
ColorRange = Theme.Color(clrChannelFrameBg);
ColorMove = Theme.Color(clrDeviceBg);
}
Osd->DrawRectangle(x0, y0, x1 - 1, y1 - 1, Theme.Color(clrBackground));
Osd->DrawEllipse(l - d, y0, l, y1 - 1, ColorRange, 7);
Osd->DrawRectangle(l, y0, r, y1 - 1, ColorRange);
Osd->DrawEllipse(r, y0, r + d, y1 - 1, ColorRange, 5);
Osd->DrawEllipse(c - d, y0, c, y1 - 1, ColorMove, 7);
Osd->DrawRectangle(c, y0, t, y1 - 1, ColorMove);
Osd->DrawEllipse(t, y0, t + d, y1 - 1, ColorMove, 5);
LastCurrent = c;
}
// --- cSkinLCARSDisplayChannel ----------------------------------------------
class cSkinLCARSDisplayChannel : public cSkinDisplayChannel {
private:
cOsd *osd;
int xc00, xc01, xc02, xc03, xc04, xc05, xc06, xc07, xc08, xc09, xc10, xc11, xc12, xc13, xc14, xc15;
int yc00, yc01, yc02, yc03, yc04, yc05, yc06, yc07, yc08, yc09, yc10, yc11, yc12;
int xs; // starting column for signal display
bool withInfo;
int lineHeight;
cFont *tinyFont;
cFont *tallFont;
tColor frameColor;
bool message;
const cEvent *present;
bool initial;
cString lastDate;
int lastSeen;
int lastCurrentPosition;
int lastDeviceNumber;
cString lastDeviceType;
cCamSlot *lastCamSlot;
int lastSignalStrength;
int lastSignalQuality;
time_t lastSignalDisplay;
tTrackId lastTrackId;
static cBitmap bmTeletext, bmRadio, bmAudio, bmDolbyDigital, bmEncrypted, bmRecording;
void DrawDate(void);
void DrawTrack(void);
void DrawSeen(int Current, int Total);
void DrawDevice(void);
void DrawSignal(void);
public:
cSkinLCARSDisplayChannel(bool WithInfo);
virtual ~cSkinLCARSDisplayChannel();
virtual void SetChannel(const cChannel *Channel, int Number);
virtual void SetEvents(const cEvent *Present, const cEvent *Following);
virtual void SetMessage(eMessageType Type, const char *Text);
virtual void SetPositioner(const cPositioner *Positioner);
virtual void Flush(void);
};
cBitmap cSkinLCARSDisplayChannel::bmTeletext(teletext_xpm);
cBitmap cSkinLCARSDisplayChannel::bmRadio(radio_xpm);
cBitmap cSkinLCARSDisplayChannel::bmAudio(audio_xpm);
cBitmap cSkinLCARSDisplayChannel::bmDolbyDigital(dolbydigital_xpm);
cBitmap cSkinLCARSDisplayChannel::bmEncrypted(encrypted_xpm);
cBitmap cSkinLCARSDisplayChannel::bmRecording(recording_xpm);
cSkinLCARSDisplayChannel::cSkinLCARSDisplayChannel(bool WithInfo)
{
tallFont = cFont::CreateFont(Setup.FontOsd, Setup.FontOsdSize * 1.8);
initial = true;
present = NULL;
lastSeen = -1;
lastCurrentPosition = -1;
lastDeviceNumber = -1;
lastCamSlot = NULL;
lastSignalStrength = -1;
lastSignalQuality = -1;
lastSignalDisplay = 0;
memset(&lastTrackId, 0, sizeof(lastTrackId));
const cFont *font = cFont::GetFont(fontOsd);
withInfo = WithInfo;
lineHeight = font->Height();
tinyFont = CreateTinyFont(lineHeight);
frameColor = Theme.Color(clrChannelFrameBg);
message = false;
int d = 5 * lineHeight;
xc00 = 0;
xc01 = xc00 + d / 2;
xc02 = xc00 + d;
xc03 = xc02 + lineHeight;
xc04 = xc02 + d / 4;
xc05 = xc02 + d;
xc06 = xc05 + Gap;
xc15 = cOsd::OsdWidth();
xc14 = xc15 - lineHeight;
xc13 = xc14 - Gap;
xc07 = (xc15 + xc00) / 2;
xc08 = xc07 + Gap;
xc09 = xc08 + lineHeight;
xc10 = xc09 + Gap;
xc11 = (xc10 + xc13 + Gap) / 2;
xc12 = xc11 + Gap;
yc00 = 0;
yc01 = yc00 + lineHeight;
yc02 = yc01 + lineHeight;
yc03 = yc02 + Gap;
yc04 = yc03 + 2 * lineHeight;
yc05 = yc04 + Gap;
yc06 = yc05 + 2 * lineHeight;
yc07 = yc06 + Gap;
yc12 = yc07 + 3 * lineHeight + Gap / 2;
yc11 = yc12 - lineHeight;
yc10 = yc11 - lineHeight;
yc09 = yc11 - d / 4;
yc08 = yc12 - d / 2;
xs = 0;
int y1 = withInfo ? yc12 : yc02;
int y0 = cOsd::OsdTop() + (Setup.ChannelInfoPos ? 0 : cOsd::OsdHeight() - y1);
osd = CreateOsd(cOsd::OsdLeft(), y0, xc00, yc00, xc15 - 1, y1 - 1);
osd->DrawRectangle(xc00, yc00, xc15 - 1, y1 - 1, Theme.Color(clrBackground));
// Rectangles:
osd->DrawRectangle(xc00, yc00, xc02 - 1, yc02 - 1, frameColor);
if (withInfo) {
osd->DrawRectangle(xc00, yc03, xc02 - 1, yc04 - 1, frameColor);
osd->DrawRectangle(xc00, yc05, xc02 - 1, yc06 - 1, frameColor);
// Elbow:
osd->DrawRectangle(xc00, yc07, xc01 - 1, yc08 - 1, frameColor);
osd->DrawRectangle(xc00, yc08, xc01 - 1, yc12 - 1, clrTransparent);
osd->DrawEllipse (xc00, yc08, xc01 - 1, yc12 - 1, frameColor, 3);
osd->DrawRectangle(xc01, yc07, xc02 - 1, yc12 - 1, frameColor);
osd->DrawEllipse (xc02, yc09, xc04 - 1, yc11 - 1, frameColor, -3);
osd->DrawRectangle(xc02, yc11, xc05 - 1, yc12 - 1, frameColor);
// Status area:
osd->DrawRectangle(xc06, yc11 + lineHeight / 2, xc07 - 1, yc12 - 1, frameColor);
osd->DrawRectangle(xc08, yc11, xc09 - 1, yc12 - 1, frameColor);
osd->DrawRectangle(xc10, yc11, xc11 - 1, yc12 - 1, Theme.Color(clrDeviceBg));
osd->DrawRectangle(xc12, yc11, xc13 - 1, yc12 - 1, Theme.Color(clrDateBg));
osd->DrawRectangle(xc14, yc11, xc14 + lineHeight / 2 - 1, yc12 - 1, frameColor);
osd->DrawRectangle(xc14 + lineHeight / 2, yc11 + lineHeight / 2, xc15 - 1, yc12 - 1, clrTransparent);
osd->DrawEllipse (xc14 + lineHeight / 2, yc11, xc15 - 1, yc12 - 1, frameColor, 5);
}
// Icons:
osd->DrawRectangle(xc14, yc00, xc14 + lineHeight / 2 - 1, yc01 - 1, frameColor);
osd->DrawRectangle(xc14 + lineHeight / 2, yc00, xc15 - 1, yc00 + lineHeight / 2 - 1, clrTransparent);
osd->DrawEllipse (xc14 + lineHeight / 2, yc00, xc15 - 1, yc01 - 1, frameColor, 5);
}
cSkinLCARSDisplayChannel::~cSkinLCARSDisplayChannel()
{
delete tallFont;
delete tinyFont;
delete osd;
}
void cSkinLCARSDisplayChannel::DrawDate(void)
{
cString s = DayDateTime();
if (initial || strcmp(s, lastDate)) {
osd->DrawText(xc12, yc11, s, Theme.Color(clrDateFg), Theme.Color(clrDateBg), cFont::GetFont(fontOsd), xc13 - xc12, lineHeight, taRight | taBorder);
lastDate = s;
}
}
void cSkinLCARSDisplayChannel::DrawTrack(void)
{
cDevice *Device = cDevice::PrimaryDevice();
const tTrackId *Track = Device->GetTrack(Device->GetCurrentAudioTrack());
if (Track ? strcmp(lastTrackId.description, Track->description) : *lastTrackId.description) {
osd->DrawText(xc03, yc07, Track ? Track->description : "", Theme.Color(clrTrackName), Theme.Color(clrBackground), cFont::GetFont(fontOsd), xc07 - xc03);
strn0cpy(lastTrackId.description, Track ? Track->description : "", sizeof(lastTrackId.description));
}
}
void cSkinLCARSDisplayChannel::DrawSeen(int Current, int Total)
{
if (lastCurrentPosition >= 0)
return; // to not interfere with SetPositioner()
int Seen = (Total > 0) ? min(xc07 - xc06, int((xc07 - xc06) * double(Current) / Total)) : 0;
if (initial || Seen != lastSeen) {
int y0 = yc11 - ShowSeenExtent;
int y1 = yc11 + lineHeight / 2 - Gap / 2;
osd->DrawRectangle(xc06, y0, xc06 + Seen - 1, y1 - 1, Theme.Color(clrSeen));
osd->DrawRectangle(xc06 + Seen, y0, xc07 - 1, y1 - 1, Theme.Color(clrBackground));
lastSeen = Seen;
}
}
void cSkinLCARSDisplayChannel::DrawDevice(void)
{
const cDevice *Device = cDevice::ActualDevice();
if (DrawDeviceData(osd, Device, xc10, yc11, xc11, yc12, xs, tinyFont, lastDeviceType, lastCamSlot, Device->DeviceNumber() != lastDeviceNumber)) {
lastDeviceNumber = Device->DeviceNumber();
// Make sure signal meters are redrawn:
lastSignalStrength = -1;
lastSignalQuality = -1;
lastSignalDisplay = 0;
}
}
void cSkinLCARSDisplayChannel::DrawSignal(void)
{
time_t Now = time(NULL);
if (Now != lastSignalDisplay) {
DrawDeviceSignal(osd, cDevice::ActualDevice(), xs + lineHeight / 2, yc11, xc11, yc12, lastSignalStrength, lastSignalQuality, initial);
lastSignalDisplay = Now;
}
}
void cSkinLCARSDisplayChannel::SetChannel(const cChannel *Channel, int Number)
{
int x = xc13;
int xi = x - SymbolSpacing -
bmRecording.Width() - SymbolSpacing -
bmEncrypted.Width() - SymbolSpacing -
bmDolbyDigital.Width() - SymbolSpacing -
bmAudio.Width() - SymbolSpacing -
max(bmTeletext.Width(), bmRadio.Width()) - SymbolSpacing;
osd->DrawRectangle(xi, yc00, xc13 - 1, yc01 - 1, frameColor);
if (Channel && !Channel->GroupSep()) {
bool rec = cRecordControls::Active();
x -= bmRecording.Width() + SymbolSpacing;
osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmRecording.Height()) / 2, bmRecording, Theme.Color(rec ? clrChannelSymbolRecFg : clrChannelSymbolOff), rec ? Theme.Color(clrChannelSymbolRecBg) : frameColor);
x -= bmEncrypted.Width() + SymbolSpacing;
osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmEncrypted.Height()) / 2, bmEncrypted, Theme.Color(Channel->Ca() ? clrChannelSymbolOn : clrChannelSymbolOff), frameColor);
x -= bmDolbyDigital.Width() + SymbolSpacing;
osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmDolbyDigital.Height()) / 2, bmDolbyDigital, Theme.Color(Channel->Dpid(0) ? clrChannelSymbolOn : clrChannelSymbolOff), frameColor);
x -= bmAudio.Width() + SymbolSpacing;
osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmAudio.Height()) / 2, bmAudio, Theme.Color(Channel->Apid(1) ? clrChannelSymbolOn : clrChannelSymbolOff), frameColor);
if (Channel->Vpid()) {
x -= bmTeletext.Width() + SymbolSpacing;
osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmTeletext.Height()) / 2, bmTeletext, Theme.Color(Channel->Tpid() ? clrChannelSymbolOn : clrChannelSymbolOff), frameColor);
}
else if (Channel->Apid(0)) {
x -= bmRadio.Width() + SymbolSpacing;
osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmRadio.Height()) / 2, bmRadio, Theme.Color(clrChannelSymbolOn), frameColor);
}
}
cString ChNumber("");
cString ChName("");
if (Channel) {
ChName = Channel->Name();
if (!Channel->GroupSep())
ChNumber = cString::sprintf("%d%s", Channel->Number(), Number ? "-" : "");
}
else if (Number)
ChNumber = cString::sprintf("%d-", Number);
else
ChName = ChannelString(NULL, 0);
osd->DrawText(xc00, yc00, ChNumber, Theme.Color(clrChannelFrameFg), frameColor, tallFont, xc02 - xc00, yc02 - yc00, taTop | taRight | taBorder);
osd->DrawText(xc03, yc00, ChName, Theme.Color(clrChannelName), Theme.Color(clrBackground), tallFont, xi - xc03 - lineHeight, 0, taTop | taLeft);
lastSignalDisplay = 0;
if (withInfo) {
if (Channel) {
int x = xc00 + (yc10 - yc09); // compensate for the arc
osd->DrawText(x, yc07, cSource::ToString(Channel->Source()), Theme.Color(clrChannelFrameFg), frameColor, cFont::GetFont(fontOsd), xc02 - x, yc10 - yc07, taTop | taRight | taBorder);
}
DrawDevice();
}
}
void cSkinLCARSDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Following)
{
if (!withInfo)
return;
if (present != Present)
lastSeen = -1;
present = Present;
for (int i = 0; i < 2; i++) {
const cEvent *e = !i ? Present : Following;
int y = !i ? yc03 : yc05;
if (e) {
osd->DrawText(xc00, y, e->GetTimeString(), Theme.Color(clrChannelFrameFg), frameColor, cFont::GetFont(fontOsd), xc02 - xc00, 0, taRight | taBorder);
osd->DrawText(xc03, y, e->Title(), Theme.Color(clrEventTitle), Theme.Color(clrBackground), cFont::GetFont(fontOsd), xc13 - xc03);
osd->DrawText(xc03, y + lineHeight, e->ShortText(), Theme.Color(clrEventShortText), Theme.Color(clrBackground), cFont::GetFont(fontSml), xc13 - xc03);
}
else {
osd->DrawRectangle(xc00, y, xc02 - 1, y + lineHeight, frameColor);
osd->DrawRectangle(xc02, y, xc13 - 1, y + 2 * lineHeight, Theme.Color(clrBackground));
}
}
}
void cSkinLCARSDisplayChannel::SetMessage(eMessageType Type, const char *Text)
{
if (Text) {
int x0, x1, y0, y1, y2;
if (withInfo) {
x0 = xc06;
x1 = xc13;
y0 = yc11 - ShowSeenExtent;
y1 = yc11;
y2 = yc12;
}
else {
x0 = xc03;
x1 = xc13;
y0 = y1 = yc00;
y2 = yc02;
}
osd->SaveRegion(x0, y0, x1 - 1, y2 - 1);
if (withInfo)
osd->DrawRectangle(xc06, y0, xc07, y1 - 1, Theme.Color(clrBackground)); // clears the "seen" bar
osd->DrawText(x0, y1, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), cFont::GetFont(fontSml), x1 - x0, y2 - y1, taCenter);
message = true;
}
else {
osd->RestoreRegion();
message = false;
}
}
void cSkinLCARSDisplayChannel::SetPositioner(const cPositioner *Positioner)
{
if (Positioner) {
int y0 = yc11 - ShowSeenExtent;
int y1 = yc11 + lineHeight / 2 - Gap / 2;
DrawDevicePosition(osd, Positioner, xc06, y0, xc07, y1, lastCurrentPosition);
}
else {
lastCurrentPosition = -1;
initial = true; // to have DrawSeen() refresh the progress bar
}
return;
}
void cSkinLCARSDisplayChannel::Flush(void)
{
if (withInfo) {
if (!message) {
DrawDate();
DrawTrack();
DrawDevice();
DrawSignal();
int Current = 0;
int Total = 0;
if (present) {
time_t t = time(NULL);
if (t > present->StartTime())
Current = t - present->StartTime();
Total = present->Duration();
}
DrawSeen(Current, Total);
}
}
osd->Flush();
initial = false;
}
// --- cSkinLCARSDisplayMenu -------------------------------------------------
class cSkinLCARSDisplayMenu : public cSkinDisplayMenu {
private:
cOsd *osd;
int xa00, xa01, xa02, xa03, xa04, xa05, xa06, xa07, xa08, xa09;
int yt00, yt01, yt02, yt03, yt04, yt05, yt06;
int yc00, yc01, yc02, yc03, yc04, yc05, yc06, yc07, yc08, yc09, yc10, yc11;
int yb00, yb01, yb02, yb03, yb04, yb05, yb06, yb07, yb08, yb09, yb10, yb11, yb12, yb13, yb14, yb15;
int xm00, xm01, xm02, xm03, xm04, xm05, xm06, xm07, xm08;
int ym00, ym01, ym02, ym03, ym04, ym05, ym06, ym07;
int xs00, xs01, xs02, xs03, xs04, xs05, xs06, xs07, xs08, xs09, xs10, xs11, xs12, xs13;
int ys00, ys01, ys02, ys03, ys04, ys05;
int xi00, xi01, xi02, xi03;
int yi00, yi01;
int xb00, xb01, xb02, xb03, xb04, xb05, xb06, xb07, xb08, xb09, xb10, xb11, xb12, xb13, xb14, xb15;
int xd00, xd01, xd02, xd03, xd04, xd05, xd06, xd07;
int yd00, yd01, yd02, yd03, yd04, yd05;
int xs; // starting column for signal display
int lineHeight;
cFont *tinyFont;
cFont *tallFont;
tColor frameColor;
int currentIndex;
cVector<int> deviceOffset;
cVector<bool> deviceRecording;
cString lastDeviceType[MAXDEVICES];
cVector<cCamSlot *> lastCamSlot;
cVector<int> lastSignalStrength;
cVector<int> lastSignalQuality;
bool initial;
enum eCurrentMode { cmUnknown, cmLive, cmPlay };
eCurrentMode lastMode;
cString lastDate;
int lastDiskUsageState;
bool lastDiskAlert;
double lastSystemLoad;
int lastTimersState;
time_t lastSignalDisplay;
int lastLiveIndicatorY;
bool lastLiveIndicatorTransferring;
const cChannel *lastChannel;
const cEvent *lastEvent;
const cRecording *lastRecording;
cString lastHeader;
int lastSeen;
static cBitmap bmArrowUp, bmArrowDown, bmTransferMode;
void DrawMainFrameUpper(tColor Color);
void DrawMainFrameLower(void);
void DrawMainButton(const char *Text, int x0, int x1, int x2, int x3, int y0, int y1, tColor ColorFg, tColor ColorBg, const cFont *Font);
void DrawMenuFrame(void);
void DrawMainBracket(void);
void DrawStatusElbows(void);
void DrawDate(void);
void DrawDisk(void);
void DrawLoad(void);
void DrawFrameDisplay(void);
void DrawScrollbar(int Total, int Offset, int Shown, bool CanScrollUp, bool CanScrollDown);
void DrawTimer(const cTimer *Timer, int y, bool MultiRec);
void DrawTimers(void);
void DrawDevice(const cDevice *Device);
void DrawDevices(void);
void DrawLiveIndicator(void);
void DrawSignals(void);
void DrawLive(const cChannel *Channel);
void DrawPlay(cControl *Control);
void DrawInfo(const cEvent *Event, bool WithTime);
void DrawSeen(int Current, int Total);
void DrawTextScrollbar(void);
public:
cSkinLCARSDisplayMenu(void);
virtual ~cSkinLCARSDisplayMenu();
virtual void Scroll(bool Up, bool Page);
virtual int MaxItems(void);
virtual void Clear(void);
virtual void SetMenuCategory(eMenuCategory MenuCategory);
virtual void SetTitle(const char *Title);
virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
virtual void SetMessage(eMessageType Type, const char *Text);
virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable);
virtual void SetScrollbar(int Total, int Offset);
virtual void SetEvent(const cEvent *Event);
virtual void SetRecording(const cRecording *Recording);
virtual void SetText(const char *Text, bool FixedFont);
virtual int GetTextAreaWidth(void) const;
virtual const cFont *GetTextAreaFont(bool FixedFont) const;
virtual void Flush(void);
};
cBitmap cSkinLCARSDisplayMenu::bmArrowUp(arrowup_xpm);
cBitmap cSkinLCARSDisplayMenu::bmArrowDown(arrowdown_xpm);
cBitmap cSkinLCARSDisplayMenu::bmTransferMode(play_xpm);
cSkinLCARSDisplayMenu::cSkinLCARSDisplayMenu(void)
{
tallFont = cFont::CreateFont(Setup.FontOsd, Setup.FontOsdSize * 1.8);
initial = true;
lastMode = cmUnknown;
lastChannel = NULL;
lastEvent = NULL;
lastRecording = NULL;
lastSeen = -1;
lastTimersState = -1;
lastSignalDisplay = 0;
lastLiveIndicatorY = -1;
lastLiveIndicatorTransferring = false;
lastDiskUsageState = -1;
lastDiskAlert = false;
lastSystemLoad = -1;
const cFont *font = cFont::GetFont(fontOsd);
lineHeight = font->Height();
tinyFont = CreateTinyFont(lineHeight);
frameColor = Theme.Color(clrMenuFrameBg);
currentIndex = -1;
// The outer frame:
int d = 5 * lineHeight;
xa00 = 0;
xa01 = xa00 + d / 2;
xa02 = xa00 + d;
xa03 = xa02 + lineHeight;
xa04 = xa02 + d / 4;
xa05 = xa02 + d;
xa06 = xa05 + Gap;
xa09 = cOsd::OsdWidth();
xa08 = xa09 - lineHeight;
xa07 = xa08 - Gap;
yt00 = 0;
yt01 = yt00 + lineHeight;
yt02 = yt01 + lineHeight;
yt03 = yt01 + d / 4;
yt04 = yt02 + Gap;
yt05 = yt00 + d / 2;
yt06 = yt04 + 2 * lineHeight;
yc00 = yt06 + Gap;
yc05 = yc00 + 3 * lineHeight + Gap / 2;
yc04 = yc05 - lineHeight;
yc03 = yc04 - lineHeight;
yc02 = yc04 - d / 4;
yc01 = yc05 - d / 2;
yc06 = yc05 + Gap;
yc07 = yc06 + lineHeight;
yc08 = yc07 + lineHeight;
yc09 = yc07 + d / 4;
yc10 = yc06 + d / 2;
yc11 = yc06 + 3 * lineHeight + Gap / 2;
yb00 = yc11 + Gap;
yb01 = yb00 + 2 * lineHeight;
yb02 = yb01 + Gap;
yb03 = yb02 + 2 * lineHeight;
yb04 = yb03 + Gap;
yb05 = yb04 + 2 * lineHeight;
yb06 = yb05 + Gap;
yb07 = yb06 + 2 * lineHeight;
yb08 = yb07 + Gap;
yb15 = cOsd::OsdHeight();
yb14 = yb15 - lineHeight;
yb13 = yb14 - lineHeight;
yb12 = yb14 - d / 4;
yb11 = yb15 - d / 2;
yb10 = yb13 - Gap - 2 * lineHeight;
yb09 = yb10 - Gap;
// Compensate for large font size:
if (yb09 - yb08 < 2 * lineHeight) {
yb08 = yb06;
yb06 = 0; // drop empty rectangle
}
if (yb09 - yb08 < 2 * lineHeight) {
yb05 = yb09;
yb08 = 0; // drop "LCARS" display
}
if (yb05 - yb04 < 2 * lineHeight) {
yb03 = yb09;
yb04 = 0; // drop "LOAD" display
}
if (yb03 - yb02 < 2 * lineHeight) {
yb01 = yb09;
yb02 = 0; // drop "DISK" display
}
// Anything else is just insanely large...
// The main command menu:
xm00 = xa03;
xm01 = xa05;
xm02 = xa06;
xm08 = (xa09 + xa00) / 2;
xm07 = xm08 - lineHeight;
xm06 = xm07 - lineHeight / 2;
xm05 = xm06 - lineHeight / 2;
xm04 = xm05 - lineHeight;
xm03 = xm04 - Gap;
ym00 = yc08;
ym01 = ym00 + lineHeight / 2;
ym02 = ym01 + lineHeight / 2;
ym03 = ym02 + Gap;
ym07 = yb15;
ym06 = ym07 - lineHeight / 2;
ym05 = ym06 - lineHeight / 2;
ym04 = ym05 - Gap;
// The status area:
xs00 = xm08 + Gap + lineHeight + Gap;
xs13 = xa09;
xs12 = xa08;
xs11 = xa07;
xs05 = (xs00 + xs11 + Gap) / 2;
xs04 = xs05 - lineHeight / 2;
xs03 = xs04 - lineHeight / 2;
xs02 = xs03 - 2 * lineHeight;
xs01 = xs02 - Gap;
xs06 = xs05 + Gap;
xs07 = xs06 + lineHeight / 2;
xs08 = xs07 + lineHeight / 2;
xs09 = xs08 + 2 * lineHeight;
xs10 = xs09 + Gap;
ys00 = yc06;
ys01 = ys00 + lineHeight;
ys02 = ys01 + lineHeight / 2;
ys04 = ys01 + lineHeight;
ys03 = ys04 - Gap;
ys05 = yb15;
// The item area (just to have them initialized, actual setting will be done in SetMenuCategory():
xi00 = 0;
xi01 = 0;
xi02 = 0;
xi03 = 1;
yi00 = 0;
yi01 = 1;
// The color buttons in submenus:
xb00 = xa06;
xb15 = xa07;
int w = (xa08 - xa06) / 4;
xb01 = xb00 + lineHeight / 2;
xb02 = xb01 + Gap;
xb04 = xb00 + w;
xb03 = xb04 - Gap;
xb05 = xb04 + lineHeight / 2;
xb06 = xb05 + Gap;
xb08 = xb04 + w;
xb07 = xb08 - Gap;
xb09 = xb08 + lineHeight / 2;
xb10 = xb09 + Gap;
xb12 = xb08 + w;
xb11 = xb12 - Gap;
xb13 = xb12 + lineHeight / 2;
xb14 = xb13 + Gap;
// The color buttons in the main menu:
int r = lineHeight;
xd07 = xa09;
xd06 = xd07 - r;
xd05 = xd06 - 4 * r;
xd04 = xd05 - r;
xd03 = xd04 - Gap;
xd02 = xd03 - r;
xd01 = xd02 - 4 * r;
xd00 = xd01 - r;
yd00 = yt00;
yd05 = yc04 - Gap;
yd04 = yd05 - 2 * r;
yd03 = yd04 - Gap;
yd02 = yd03 - 2 * r;
yd01 = yd02 - Gap;
xs = 0;
osd = CreateOsd(cOsd::OsdLeft(), cOsd::OsdTop(), xa00, yt00, xa09 - 1, yb15 - 1);
}
cSkinLCARSDisplayMenu::~cSkinLCARSDisplayMenu()
{
delete tallFont;
delete tinyFont;
delete osd;
}
void cSkinLCARSDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory)
{
if (initial || MenuCategory != cSkinDisplayMenu::MenuCategory()) {
cSkinDisplayMenu::SetMenuCategory(MenuCategory);
initial = true;
osd->DrawRectangle(xa00, yt00, xa09 - 1, yb15 - 1, Theme.Color(clrBackground));
if (MenuCategory == mcMain) {
yi00 = ym03;
yi01 = ym04;
xi00 = xm00;
xi01 = xm03;
xi02 = xm04;
xi03 = xm05;
lastTimersState = -1;
DrawMainFrameLower();
DrawMainBracket();
DrawStatusElbows();
}
else {
yi00 = yt02;
yi01 = yb13;
xi00 = xa03;
xi01 = xa07;
xi02 = xa08;
xi03 = xa09;
DrawMenuFrame();
}
}
}
void cSkinLCARSDisplayMenu::DrawMainFrameUpper(tColor Color)
{
// Top left rectangles:
osd->DrawRectangle(xa00, yt00, xa02 - 1, yt02 - 1, Color);
osd->DrawRectangle(xa00, yt04, xa02 - 1, yt06 - 1, Color);
// Upper elbow:
osd->DrawRectangle(xa00, yc00, xa01 - 1, yc01 - 1, Color);
osd->DrawEllipse (xa00, yc01, xa01 - 1, yc05 - 1, Color, 3);
osd->DrawRectangle(xa01, yc00, xa02 - 1, yc05 - 1, Color);
osd->DrawEllipse (xa02, yc02, xa04 - 1, yc04 - 1, Color, -3);
osd->DrawRectangle(xa02, yc04, xa05 - 1, yc05 - 1, Color);