vdr  2.0.2
skinlcars.c
Go to the documentation of this file.
1 /*
2  * skinlcars.c: A VDR skin with Star Trek's "LCARS" layout
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: skinlcars.c 2.21.1.1 2013/05/19 12:08:52 kls Exp $
8  */
9 
10 // "Star Trek: The Next Generation"(R) is a registered trademark of Paramount Pictures,
11 // registered in the United States Patent and Trademark Office, all rights reserved.
12 // The LCARS system is based upon the designs of Michael Okuda and his Okudagrams.
13 //
14 // "LCARS" is short for "Library Computer Access and Retrieval System".
15 // Some resources used for writing this skin can be found at
16 // http://www.lcars.org.uk
17 // http://www.lcarsdeveloper.com
18 // http://www.lcarscom.net
19 // http://lds-jedi.deviantart.com/art/LCARS-Swept-Tutorial-213936938
20 // http://lds-jedi.deviantart.com/art/LCARS-Button-Tutorial-210783437
21 // http://zelldenver.deviantart.com/art/LCARS-Color-Standard-179565780
22 // http://www.lcars47.com
23 // http://www.bracercom.com/tutorial/content/CoherentLCARSInterface/LCARSCoherentInterface.html
24 // http://www.bracercom.com/tutorial/content/lcars_manifesto/the_lcars_manifesto.html
25 
26 #include "skinlcars.h"
27 #include "font.h"
28 #include "menu.h"
29 #include "osd.h"
30 #include "themes.h"
31 #include "videodir.h"
32 
33 #include "symbols/arrowdown.xpm"
34 #include "symbols/arrowup.xpm"
35 #include "symbols/audio.xpm"
36 #include "symbols/audioleft.xpm"
37 #include "symbols/audioright.xpm"
38 #include "symbols/audiostereo.xpm"
39 #include "symbols/dolbydigital.xpm"
40 #include "symbols/encrypted.xpm"
41 #include "symbols/ffwd.xpm"
42 #include "symbols/ffwd1.xpm"
43 #include "symbols/ffwd2.xpm"
44 #include "symbols/ffwd3.xpm"
45 #include "symbols/frew.xpm"
46 #include "symbols/frew1.xpm"
47 #include "symbols/frew2.xpm"
48 #include "symbols/frew3.xpm"
49 #include "symbols/mute.xpm"
50 #include "symbols/pause.xpm"
51 #include "symbols/play.xpm"
52 #include "symbols/radio.xpm"
53 #include "symbols/recording.xpm"
54 #include "symbols/sfwd.xpm"
55 #include "symbols/sfwd1.xpm"
56 #include "symbols/sfwd2.xpm"
57 #include "symbols/sfwd3.xpm"
58 #include "symbols/srew.xpm"
59 #include "symbols/srew1.xpm"
60 #include "symbols/srew2.xpm"
61 #include "symbols/srew3.xpm"
62 #include "symbols/teletext.xpm"
63 #include "symbols/volume.xpm"
64 
65 #define Gap (Setup.FontOsdSize / 5 & ~1) // must be even
66 #define TextFrame (Setup.FontOsdSize / TEXT_ALIGN_BORDER)
67 #define TextSpacing (2 * TextFrame)
68 #define SymbolSpacing TextSpacing
69 #define ShowSeenExtent (Setup.FontOsdSize / 5) // pixels by which the "seen" bar extends out of the frame
70 
71 #define DISKUSAGEALERTLIMIT 95 // percent of disk usage above which the display goes into alert mode
72 #define SIGNALDISPLAYDELTA 2 // seconds between subsequent device signal displays
73 
74 static cTheme Theme;
75 
76 // Color domains:
77 
78 #define CLR_BACKGROUND 0x99000000
79 #define CLR_MAIN_FRAME 0xFFFF9966
80 #define CLR_CHANNEL_FRAME 0xFF8A9EC9
81 #define CLR_REPLAY_FRAME 0xFFCC6666
82 #define CLR_DATE 0xFF99CCFF
83 #define CLR_MENU_ITEMS 0xFF9999FF
84 #define CLR_TIMER 0xFF99CCFF
85 #define CLR_DEVICE 0xFFF1B1AF
86 #define CLR_CHANNEL_NAME 0xFF99CCFF
87 #define CLR_EVENT_TITLE 0xFF99CCFF
88 #define CLR_EVENT_TIME 0xFFFFCC66
89 #define CLR_EVENT_SHORTTEXT 0xFFFFCC66
90 #define CLR_TEXT 0xFF99CCFF
91 #define CLR_TRACK 0xFFFFCC66
92 #define CLR_SEEN 0xFFCC99CC
93 #define CLR_ALERT 0xFFFF0000
94 #define CLR_EXPOSED 0xFF990000
95 #define CLR_WHITE 0xFFFFFFFF
96 #define CLR_RED 0xFFCC6666
97 #define CLR_GREEN 0xFFA0FF99
98 #define CLR_YELLOW 0xFFF1DF60
99 #define CLR_BLUE 0xFF9A99FF
100 #define CLR_BLACK 0xFF000000
101 
102 // General colors:
103 
105 THEME_CLR(Theme, clrDateFg, CLR_BLACK);
106 THEME_CLR(Theme, clrDateBg, CLR_DATE);
107 THEME_CLR(Theme, clrTimerFg, CLR_BLACK);
108 THEME_CLR(Theme, clrTimerBg, CLR_TIMER);
109 THEME_CLR(Theme, clrDeviceFg, CLR_BLACK);
110 THEME_CLR(Theme, clrDeviceBg, CLR_DEVICE);
111 THEME_CLR(Theme, clrSignalValue, CLR_GREEN);
112 THEME_CLR(Theme, clrSignalRest, CLR_RED);
113 THEME_CLR(Theme, clrSeen, CLR_SEEN);
114 THEME_CLR(Theme, clrTrackName, CLR_TRACK);
115 THEME_CLR(Theme, clrAlertFg, CLR_WHITE);
116 THEME_CLR(Theme, clrAlertBg, CLR_ALERT);
117 THEME_CLR(Theme, clrChannelName, CLR_CHANNEL_NAME);
118 THEME_CLR(Theme, clrEventTitle, CLR_EVENT_TITLE);
119 THEME_CLR(Theme, clrEventTime, CLR_EVENT_TIME);
120 THEME_CLR(Theme, clrEventShortText, CLR_EVENT_SHORTTEXT);
121 THEME_CLR(Theme, clrEventDescription, CLR_TEXT);
122 
123 // Buttons:
124 
125 THEME_CLR(Theme, clrButtonRedFg, CLR_BLACK);
126 THEME_CLR(Theme, clrButtonRedBg, CLR_RED);
127 THEME_CLR(Theme, clrButtonGreenFg, CLR_BLACK);
128 THEME_CLR(Theme, clrButtonGreenBg, CLR_GREEN);
129 THEME_CLR(Theme, clrButtonYellowFg, CLR_BLACK);
130 THEME_CLR(Theme, clrButtonYellowBg, CLR_YELLOW);
131 THEME_CLR(Theme, clrButtonBlueFg, CLR_BLACK);
132 THEME_CLR(Theme, clrButtonBlueBg, CLR_BLUE);
133 
134 // Messages:
135 
136 THEME_CLR(Theme, clrMessageStatusFg, CLR_BLACK);
137 THEME_CLR(Theme, clrMessageStatusBg, CLR_BLUE);
138 THEME_CLR(Theme, clrMessageInfoFg, CLR_BLACK);
139 THEME_CLR(Theme, clrMessageInfoBg, CLR_GREEN);
140 THEME_CLR(Theme, clrMessageWarningFg, CLR_BLACK);
141 THEME_CLR(Theme, clrMessageWarningBg, CLR_YELLOW);
142 THEME_CLR(Theme, clrMessageErrorFg, CLR_BLACK);
143 THEME_CLR(Theme, clrMessageErrorBg, CLR_RED);
144 
145 // Volume:
146 
147 THEME_CLR(Theme, clrVolumeFrame, CLR_MAIN_FRAME);
148 THEME_CLR(Theme, clrVolumeSymbol, CLR_BLACK);
149 THEME_CLR(Theme, clrVolumeBarUpper, RgbShade(CLR_MAIN_FRAME, -0.2));
150 THEME_CLR(Theme, clrVolumeBarLower, CLR_GREEN);
151 
152 // Channel display:
153 
154 THEME_CLR(Theme, clrChannelFrameFg, CLR_BLACK);
155 THEME_CLR(Theme, clrChannelFrameBg, CLR_CHANNEL_FRAME);
156 THEME_CLR(Theme, clrChannelSymbolOn, CLR_BLACK);
157 THEME_CLR(Theme, clrChannelSymbolOff, RgbShade(CLR_CHANNEL_FRAME, -0.2));
158 THEME_CLR(Theme, clrChannelSymbolRecFg, CLR_WHITE);
159 THEME_CLR(Theme, clrChannelSymbolRecBg, CLR_RED);
160 
161 // Menu:
162 
163 THEME_CLR(Theme, clrMenuFrameFg, CLR_BLACK);
164 THEME_CLR(Theme, clrMenuFrameBg, CLR_MAIN_FRAME);
165 THEME_CLR(Theme, clrMenuTitle, CLR_MAIN_FRAME);
166 THEME_CLR(Theme, clrMenuMainBracket, CLR_MENU_ITEMS);
167 THEME_CLR(Theme, clrMenuTimerRecording, CLR_DEVICE);
168 THEME_CLR(Theme, clrMenuDeviceRecording, CLR_TIMER);
169 THEME_CLR(Theme, clrMenuItemCurrentFg, CLR_MAIN_FRAME);
170 THEME_CLR(Theme, clrMenuItemCurrentBg, RgbShade(CLR_MENU_ITEMS, -0.5));
171 THEME_CLR(Theme, clrMenuItemSelectable, CLR_MENU_ITEMS);
172 THEME_CLR(Theme, clrMenuItemNonSelectable, CLR_TEXT);
173 THEME_CLR(Theme, clrMenuScrollbarTotal, RgbShade(CLR_MAIN_FRAME, 0.2));
174 THEME_CLR(Theme, clrMenuScrollbarShown, CLR_SEEN);
175 THEME_CLR(Theme, clrMenuScrollbarArrow, CLR_BLACK);
176 THEME_CLR(Theme, clrMenuText, CLR_TEXT);
177 
178 // Replay display:
179 
180 THEME_CLR(Theme, clrReplayFrameFg, CLR_BLACK);
181 THEME_CLR(Theme, clrReplayFrameBg, CLR_REPLAY_FRAME);
182 THEME_CLR(Theme, clrReplayPosition, CLR_SEEN);
183 THEME_CLR(Theme, clrReplayJumpFg, CLR_BLACK);
184 THEME_CLR(Theme, clrReplayJumpBg, CLR_SEEN);
185 THEME_CLR(Theme, clrReplayProgressSeen, CLR_SEEN);
186 THEME_CLR(Theme, clrReplayProgressRest, RgbShade(CLR_WHITE, -0.2));
187 THEME_CLR(Theme, clrReplayProgressSelected, CLR_EXPOSED);
188 THEME_CLR(Theme, clrReplayProgressMark, CLR_BLACK);
189 THEME_CLR(Theme, clrReplayProgressCurrent, CLR_EXPOSED);
190 
191 // Track display:
192 
193 THEME_CLR(Theme, clrTrackFrameFg, CLR_BLACK);
194 THEME_CLR(Theme, clrTrackFrameBg, CLR_TRACK);
195 THEME_CLR(Theme, clrTrackItemFg, CLR_BLACK);
196 THEME_CLR(Theme, clrTrackItemBg, RgbShade(CLR_TRACK, 0.5));
197 THEME_CLR(Theme, clrTrackItemCurrentFg, CLR_BLACK);
198 THEME_CLR(Theme, clrTrackItemCurrentBg, CLR_TRACK);
199 
200 // --- Helper functions ------------------------------------------------------
201 
202 static bool TwoColors = false;
203 
204 static cOsd *CreateOsd(int Left, int Top, int x0, int y0, int x1, int y1)
205 {
206  cOsd *Osd = cOsdProvider::NewOsd(Left, Top);
207  int Bpp[] = { 32, 8, 4, 2, 1 };
208  tArea Area = { x0, y0, x1, y1, 0 };
209  for (unsigned int i = 0; i < sizeof(Bpp) / sizeof(int); i++) {
210  Area.bpp = Bpp[i];
211  if (Osd->CanHandleAreas(&Area, 1) == oeOk) {
212  Osd->SetAreas(&Area, 1);
213  Osd->SetAntiAliasGranularity(20, 16);
214  TwoColors = Area.bpp == 1;
215  break;
216  }
217  }
218  return Osd;
219 }
220 
221 static cFont *CreateTinyFont(int LineHeight)
222 {
223  // Creates a font that is not higher than half of LineHeight.
224  LineHeight /= 2;
225  int Height = LineHeight;
226  for (;;) {
227  cFont *TinyFont = cFont::CreateFont(Setup.FontOsd, Height);
228  if (Height < 2 || TinyFont->Height() <= LineHeight)
229  return TinyFont;
230  delete TinyFont;
231  Height -= 1;
232  }
233 }
234 
235 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)
236 {
237  cString DeviceType = Device->DeviceType();
238  cCamSlot *CamSlot = Device->CamSlot();
239  if (Initial || strcmp(DeviceType, LastDeviceType) || CamSlot != LastCamSlot) {
240  const cFont *font = cFont::GetFont(fontOsd);
241  tColor ColorFg = Theme.Color(clrDeviceFg);
242  tColor ColorBg = Theme.Color(clrDeviceBg);
243  Osd->DrawRectangle(x0, y0, x1 - 1, y1 - 1, ColorBg);
244  int x = x0;
245  // Device number:
246  cString Nr = itoa(Device->DeviceNumber() + 1);
247  int w = max(font->Width(Nr), y1 - y0);
248  Osd->DrawText(x, y0, Nr, ColorFg, ColorBg, font, w, y1 - y0, taCenter);
249  x += w;
250  // Device type:
251  Osd->DrawText(x, y0, DeviceType, ColorFg, ColorBg, TinyFont);
252  xs = max(xs, x + TinyFont->Width(DeviceType));
253  LastDeviceType = DeviceType;
254  // CAM:
255  if (CamSlot) {
256  cString s = cString::sprintf("CAM %d", CamSlot->SlotNumber());
257  Osd->DrawText(x, y1 - TinyFont->Height(), s, ColorFg, ColorBg, TinyFont);
258  xs = max(xs, x + TinyFont->Width(s));
259  }
260  LastCamSlot = CamSlot;
261  return true;
262  }
263  return false;
264 }
265 
266 static void DrawDeviceSignal(cOsd *Osd, const cDevice *Device, int x0, int y0, int x1, int y1, int &LastSignalStrength, int &LastSignalQuality, bool Initial)
267 {
268  int SignalStrength = Device->SignalStrength();
269  int SignalQuality = Device->SignalQuality();
270  int d = max((y1 - y0) / 10, 1);
271  int x00 = x0 + d;
272  int x01 = x1 - d;
273  int h = (y1 - y0 - 3 * d) / 2;
274  int w = x01 - x00;
275  int y00 = y0 + d;
276  int y01 = y00 + h;
277  int y03 = y1 - d;
278  int y02 = y03 - h;
279  tColor ColorSignalValue, ColorSignalRest;
280  if (TwoColors) {
281  ColorSignalValue = Theme.Color(clrBackground);
282  ColorSignalRest = Theme.Color(clrMenuFrameBg);
283  }
284  else {
285  ColorSignalValue = Theme.Color(clrSignalValue);
286  ColorSignalRest = Theme.Color(clrSignalRest);
287  }
288  if (SignalStrength >= 0 && (Initial || SignalStrength != LastSignalStrength)) {
289  int s = SignalStrength * w / 100;
290  Osd->DrawRectangle(x00, y00, x00 + s - 1, y01 - 1, ColorSignalValue);
291  Osd->DrawRectangle(x00 + s, y00, x01 - 1, y01 - 1, ColorSignalRest);
292  LastSignalStrength = SignalStrength;
293  }
294  if (SignalQuality >= 0 && (Initial || SignalQuality != LastSignalQuality)) {
295  int q = SignalQuality * w / 100;
296  Osd->DrawRectangle(x00, y02, x00 + q - 1, y03 - 1, ColorSignalValue);
297  Osd->DrawRectangle(x00 + q, y02, x01 - 1, y03 - 1, ColorSignalRest);
298  LastSignalQuality = SignalQuality;
299  }
300 }
301 
302 // --- cSkinLCARSDisplayChannel ----------------------------------------------
303 
305 private:
309  int xs; // starting column for signal display
310  bool withInfo;
315  bool message;
316  const cEvent *present;
317  bool initial;
319  int lastSeen;
328  void DrawDate(void);
329  void DrawTrack(void);
330  void DrawSeen(int Current, int Total);
331  void DrawDevice(void);
332  void DrawSignal(void);
333 public:
334  cSkinLCARSDisplayChannel(bool WithInfo);
335  virtual ~cSkinLCARSDisplayChannel();
336  virtual void SetChannel(const cChannel *Channel, int Number);
337  virtual void SetEvents(const cEvent *Present, const cEvent *Following);
338  virtual void SetMessage(eMessageType Type, const char *Text);
339  virtual void Flush(void);
340  };
341 
348 
350 {
352  initial = true;
353  present = NULL;
354  lastSeen = -1;
355  lastDeviceNumber = -1;
356  lastCamSlot = NULL;
357  lastSignalStrength = -1;
358  lastSignalQuality = -1;
359  lastSignalDisplay = 0;
360  memset(&lastTrackId, 0, sizeof(lastTrackId));
361  const cFont *font = cFont::GetFont(fontOsd);
362  withInfo = WithInfo;
363  lineHeight = font->Height();
365  frameColor = Theme.Color(clrChannelFrameBg);
366  message = false;
367  int d = 5 * lineHeight;
368  xc00 = 0;
369  xc01 = xc00 + d / 2;
370  xc02 = xc00 + d;
371  xc03 = xc02 + lineHeight;
372  xc04 = xc02 + d / 4;
373  xc05 = xc02 + d;
374  xc06 = xc05 + Gap;
375  xc15 = cOsd::OsdWidth();
376  xc14 = xc15 - lineHeight;
377  xc13 = xc14 - Gap;
378  xc07 = (xc15 + xc00) / 2;
379  xc08 = xc07 + Gap;
380  xc09 = xc08 + lineHeight;
381  xc10 = xc09 + Gap;
382  xc11 = (xc10 + xc13 + Gap) / 2;
383  xc12 = xc11 + Gap;
384 
385  yc00 = 0;
386  yc01 = yc00 + lineHeight;
387  yc02 = yc01 + lineHeight;
388  yc03 = yc02 + Gap;
389  yc04 = yc03 + 2 * lineHeight;
390  yc05 = yc04 + Gap;
391  yc06 = yc05 + 2 * lineHeight;
392 
393  yc07 = yc06 + Gap;
394  yc12 = yc07 + 3 * lineHeight + Gap / 2;
395  yc11 = yc12 - lineHeight;
396  yc10 = yc11 - lineHeight;
397  yc09 = yc11 - d / 4;
398  yc08 = yc12 - d / 2;
399 
400  xs = 0;
401 
402  int y1 = withInfo ? yc12 : yc02;
403  int y0 = cOsd::OsdTop() + (Setup.ChannelInfoPos ? 0 : cOsd::OsdHeight() - y1);
404  osd = CreateOsd(cOsd::OsdLeft(), y0, xc00, yc00, xc15 - 1, y1 - 1);
405  osd->DrawRectangle(xc00, yc00, xc15 - 1, y1 - 1, Theme.Color(clrBackground));
406  // Rectangles:
407  osd->DrawRectangle(xc00, yc00, xc02 - 1, yc02 - 1, frameColor);
408  if (withInfo) {
409  osd->DrawRectangle(xc00, yc03, xc02 - 1, yc04 - 1, frameColor);
410  osd->DrawRectangle(xc00, yc05, xc02 - 1, yc06 - 1, frameColor);
411  // Elbow:
412  osd->DrawRectangle(xc00, yc07, xc01 - 1, yc08 - 1, frameColor);
414  osd->DrawEllipse (xc00, yc08, xc01 - 1, yc12 - 1, frameColor, 3);
415  osd->DrawRectangle(xc01, yc07, xc02 - 1, yc12 - 1, frameColor);
416  osd->DrawEllipse (xc02, yc09, xc04 - 1, yc11 - 1, frameColor, -3);
417  osd->DrawRectangle(xc02, yc11, xc05 - 1, yc12 - 1, frameColor);
418  // Status area:
419  osd->DrawRectangle(xc06, yc11 + lineHeight / 2, xc07 - 1, yc12 - 1, frameColor);
420  osd->DrawRectangle(xc08, yc11, xc09 - 1, yc12 - 1, frameColor);
421  osd->DrawRectangle(xc10, yc11, xc11 - 1, yc12 - 1, Theme.Color(clrDeviceBg));
422  osd->DrawRectangle(xc12, yc11, xc13 - 1, yc12 - 1, Theme.Color(clrDateBg));
423  osd->DrawRectangle(xc14, yc11, xc14 + lineHeight / 2 - 1, yc12 - 1, frameColor);
424  osd->DrawRectangle(xc14 + lineHeight / 2, yc11 + lineHeight / 2, xc15 - 1, yc12 - 1, clrTransparent);
425  osd->DrawEllipse (xc14 + lineHeight / 2, yc11, xc15 - 1, yc12 - 1, frameColor, 5);
426  }
427  // Icons:
428  osd->DrawRectangle(xc14, yc00, xc14 + lineHeight / 2 - 1, yc01 - 1, frameColor);
429  osd->DrawRectangle(xc14 + lineHeight / 2, yc00, xc15 - 1, yc00 + lineHeight / 2 - 1, clrTransparent);
430  osd->DrawEllipse (xc14 + lineHeight / 2, yc00, xc15 - 1, yc01 - 1, frameColor, 5);
431 }
432 
434 {
435  delete tallFont;
436  delete tinyFont;
437  delete osd;
438 }
439 
441 {
442  cString s = DayDateTime();
443  if (initial || strcmp(s, lastDate)) {
444  osd->DrawText(xc12, yc11, s, Theme.Color(clrDateFg), Theme.Color(clrDateBg), cFont::GetFont(fontOsd), xc13 - xc12, lineHeight, taRight | taBorder);
445  lastDate = s;
446  }
447 }
448 
450 {
451  cDevice *Device = cDevice::PrimaryDevice();
452  const tTrackId *Track = Device->GetTrack(Device->GetCurrentAudioTrack());
453  if (!Track && *lastTrackId.description || Track && strcmp(lastTrackId.description, Track->description)) {
454  osd->DrawText(xc03, yc07, Track ? Track->description : "", Theme.Color(clrTrackName), Theme.Color(clrBackground), cFont::GetFont(fontOsd), xc07 - xc03);
455  strn0cpy(lastTrackId.description, Track ? Track->description : "", sizeof(lastTrackId.description));
456  }
457 }
458 
459 void cSkinLCARSDisplayChannel::DrawSeen(int Current, int Total)
460 {
461  int Seen = (Total > 0) ? min(xc07 - xc06, int((xc07 - xc06) * double(Current) / Total)) : 0;
462  if (initial || Seen != lastSeen) {
463  int y0 = yc11 - ShowSeenExtent;
464  int y1 = yc11 + lineHeight / 2 - Gap / 2;
465  osd->DrawRectangle(xc06, y0, xc06 + Seen - 1, y1 - 1, Theme.Color(clrSeen));
466  osd->DrawRectangle(xc06 + Seen, y0, xc07 - 1, y1 - 1, Theme.Color(clrBackground));
467  lastSeen = Seen;
468  }
469 }
470 
472 {
473  const cDevice *Device = cDevice::ActualDevice();
475  lastDeviceNumber = Device->DeviceNumber();
476  // Make sure signal meters are redrawn:
477  lastSignalStrength = -1;
478  lastSignalQuality = -1;
479  lastSignalDisplay = 0;
480  }
481 }
482 
484 {
485  time_t Now = time(NULL);
486  if (Now != lastSignalDisplay) {
488  lastSignalDisplay = Now;
489  }
490 }
491 
492 void cSkinLCARSDisplayChannel::SetChannel(const cChannel *Channel, int Number)
493 {
494  int x = xc13;
495  int xi = x - SymbolSpacing -
501  osd->DrawRectangle(xi, yc00, xc13 - 1, yc01 - 1, frameColor);
502  if (Channel && !Channel->GroupSep()) {
503  bool rec = cRecordControls::Active();
505  osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmRecording.Height()) / 2, bmRecording, Theme.Color(rec ? clrChannelSymbolRecFg : clrChannelSymbolOff), rec ? Theme.Color(clrChannelSymbolRecBg) : frameColor);
507  osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmEncrypted.Height()) / 2, bmEncrypted, Theme.Color(Channel->Ca() ? clrChannelSymbolOn : clrChannelSymbolOff), frameColor);
509  osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmDolbyDigital.Height()) / 2, bmDolbyDigital, Theme.Color(Channel->Dpid(0) ? clrChannelSymbolOn : clrChannelSymbolOff), frameColor);
510  x -= bmAudio.Width() + SymbolSpacing;
511  osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmAudio.Height()) / 2, bmAudio, Theme.Color(Channel->Apid(1) ? clrChannelSymbolOn : clrChannelSymbolOff), frameColor);
512  if (Channel->Vpid()) {
513  x -= bmTeletext.Width() + SymbolSpacing;
514  osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmTeletext.Height()) / 2, bmTeletext, Theme.Color(Channel->Tpid() ? clrChannelSymbolOn : clrChannelSymbolOff), frameColor);
515  }
516  else if (Channel->Apid(0)) {
517  x -= bmRadio.Width() + SymbolSpacing;
518  osd->DrawBitmap(x, yc00 + (yc01 - yc00 - bmRadio.Height()) / 2, bmRadio, Theme.Color(clrChannelSymbolOn), frameColor);
519  }
520  }
521  cString ChNumber("");
522  cString ChName("");
523  if (Channel) {
524  ChName = Channel->Name();
525  if (!Channel->GroupSep())
526  ChNumber = cString::sprintf("%d%s", Channel->Number(), Number ? "-" : "");
527  }
528  else if (Number)
529  ChNumber = cString::sprintf("%d-", Number);
530  else
531  ChName = ChannelString(NULL, 0);
532  osd->DrawText(xc00, yc00, ChNumber, Theme.Color(clrChannelFrameFg), frameColor, tallFont, xc02 - xc00, yc02 - yc00, taTop | taRight | taBorder);
533  osd->DrawText(xc03, yc00, ChName, Theme.Color(clrChannelName), Theme.Color(clrBackground), tallFont, xi - xc03 - lineHeight, 0, taTop | taLeft);
534  lastSignalDisplay = 0;
535  if (withInfo)
536  DrawDevice();
537 }
538 
539 void cSkinLCARSDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Following)
540 {
541  if (!withInfo)
542  return;
543  if (present != Present)
544  lastSeen = -1;
545  present = Present;
546  for (int i = 0; i < 2; i++) {
547  const cEvent *e = !i ? Present : Following;
548  int y = !i ? yc03 : yc05;
549  if (e) {
550  osd->DrawText(xc00, y, e->GetTimeString(), Theme.Color(clrChannelFrameFg), frameColor, cFont::GetFont(fontOsd), xc02 - xc00, 0, taRight | taBorder);
551  osd->DrawText(xc03, y, e->Title(), Theme.Color(clrEventTitle), Theme.Color(clrBackground), cFont::GetFont(fontOsd), xc13 - xc03);
552  osd->DrawText(xc03, y + lineHeight, e->ShortText(), Theme.Color(clrEventShortText), Theme.Color(clrBackground), cFont::GetFont(fontSml), xc13 - xc03);
553  }
554  else {
556  osd->DrawRectangle(xc02, y, xc13 - 1, y + 2 * lineHeight, Theme.Color(clrBackground));
557  }
558  }
559 }
560 
562 {
563  if (Text) {
564  int x0, x1, y0, y1, y2;
565  if (withInfo) {
566  x0 = xc06;
567  x1 = xc13;
568  y0 = yc11 - ShowSeenExtent;
569  y1 = yc11;
570  y2 = yc12;
571  }
572  else {
573  x0 = xc03;
574  x1 = xc13;
575  y0 = y1 = yc00;
576  y2 = yc02;
577  }
578  osd->SaveRegion(x0, y0, x1 - 1, y2 - 1);
579  if (withInfo)
580  osd->DrawRectangle(xc06, y0, xc07, y1 - 1, Theme.Color(clrBackground)); // clears the "seen" bar
581  osd->DrawText(x0, y1, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), cFont::GetFont(fontSml), x1 - x0, y2 - y1, taCenter);
582  message = true;
583  }
584  else {
585  osd->RestoreRegion();
586  message = false;
587  }
588 }
589 
591 {
592  if (withInfo) {
593  if (!message) {
594  DrawDate();
595  DrawTrack();
596  DrawDevice();
597  DrawSignal();
598  int Current = 0;
599  int Total = 0;
600  if (present) {
601  time_t t = time(NULL);
602  if (t > present->StartTime())
603  Current = t - present->StartTime();
604  Total = present->Duration();
605  }
606  DrawSeen(Current, Total);
607  }
608  }
609  osd->Flush();
610  initial = false;
611 }
612 
613 // --- cSkinLCARSDisplayMenu -------------------------------------------------
614 
616 private:
626  int xi00, xi01, xi02, xi03;
627  int yi00, yi01;
631  int xs; // starting column for signal display
643  bool initial;
658  int lastSeen;
660  void DrawMainFrameUpper(tColor Color);
661  void DrawMainFrameLower(void);
662  void DrawMainButton(const char *Text, int x0, int x1, int x2, int x3, int y0, int y1, tColor ColorFg, tColor ColorBg, const cFont *Font);
663  void DrawMenuFrame(void);
664  void DrawMainBracket(void);
665  void DrawStatusElbows(void);
666  void DrawDate(void);
667  void DrawDisk(void);
668  void DrawLoad(void);
669  void DrawFrameDisplay(void);
670  void DrawScrollbar(int Total, int Offset, int Shown, bool CanScrollUp, bool CanScrollDown);
671  void DrawTimer(const cTimer *Timer, int y, bool MultiRec);
672  void DrawTimers(void);
673  void DrawDevice(const cDevice *Device);
674  void DrawDevices(void);
675  void DrawLiveIndicator(void);
676  void DrawSignals(void);
677  void DrawLive(const cChannel *Channel);
678  void DrawPlay(cControl *Control);
679  void DrawInfo(const cEvent *Event, bool WithTime);
680  void DrawSeen(int Current, int Total);
681  void DrawTextScrollbar(void);
682 public:
683  cSkinLCARSDisplayMenu(void);
684  virtual ~cSkinLCARSDisplayMenu();
685  virtual void Scroll(bool Up, bool Page);
686  virtual int MaxItems(void);
687  virtual void Clear(void);
689  virtual void SetTitle(const char *Title);
690  virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
691  virtual void SetMessage(eMessageType Type, const char *Text);
692  virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable);
693  virtual void SetScrollbar(int Total, int Offset);
694  virtual void SetEvent(const cEvent *Event);
695  virtual void SetRecording(const cRecording *Recording);
696  virtual void SetText(const char *Text, bool FixedFont);
697  virtual int GetTextAreaWidth(void) const;
698  virtual const cFont *GetTextAreaFont(bool FixedFont) const;
699  virtual void Flush(void);
700  };
701 
705 
707 {
709  initial = true;
711  lastChannel = NULL;
712  lastEvent = NULL;
713  lastRecording = NULL;
714  lastSeen = -1;
715  lastTimersState = -1;
716  lastSignalDisplay = 0;
717  lastLiveIndicatorY = -1;
719  lastDiskUsageState = -1;
720  lastDiskAlert = false;
721  lastSystemLoad = -1;
722  const cFont *font = cFont::GetFont(fontOsd);
723  lineHeight = font->Height();
725  frameColor = Theme.Color(clrMenuFrameBg);
726  currentIndex = -1;
727  // The outer frame:
728  int d = 5 * lineHeight;
729  xa00 = 0;
730  xa01 = xa00 + d / 2;
731  xa02 = xa00 + d;
732  xa03 = xa02 + lineHeight;
733  xa04 = xa02 + d / 4;
734  xa05 = xa02 + d;
735  xa06 = xa05 + Gap;
736  xa09 = cOsd::OsdWidth();
737  xa08 = xa09 - lineHeight;
738  xa07 = xa08 - Gap;
739 
740  yt00 = 0;
741  yt01 = yt00 + lineHeight;
742  yt02 = yt01 + lineHeight;
743  yt03 = yt01 + d / 4;
744  yt04 = yt02 + Gap;
745  yt05 = yt00 + d / 2;
746  yt06 = yt04 + 2 * lineHeight;
747 
748  yc00 = yt06 + Gap;
749  yc05 = yc00 + 3 * lineHeight + Gap / 2;
750  yc04 = yc05 - lineHeight;
751  yc03 = yc04 - lineHeight;
752  yc02 = yc04 - d / 4;
753  yc01 = yc05 - d / 2;
754 
755  yc06 = yc05 + Gap;
756  yc07 = yc06 + lineHeight;
757  yc08 = yc07 + lineHeight;
758  yc09 = yc07 + d / 4;
759  yc10 = yc06 + d / 2;
760  yc11 = yc06 + 3 * lineHeight + Gap / 2;
761 
762  yb00 = yc11 + Gap;
763  yb01 = yb00 + 2 * lineHeight;
764  yb02 = yb01 + Gap;
765  yb03 = yb02 + 2 * lineHeight;
766  yb04 = yb03 + Gap;
767  yb05 = yb04 + 2 * lineHeight;
768  yb06 = yb05 + Gap;
769  yb07 = yb06 + 2 * lineHeight;
770  yb08 = yb07 + Gap;
771 
772  yb15 = cOsd::OsdHeight();
773  yb14 = yb15 - lineHeight;
774  yb13 = yb14 - lineHeight;
775  yb12 = yb14 - d / 4;
776  yb11 = yb15 - d / 2;
777  yb10 = yb13 - Gap - 2 * lineHeight;
778  yb09 = yb10 - Gap;
779 
780  // Compensate for large font size:
781  if (yb09 - yb08 < 2 * lineHeight) {
782  yb08 = yb06;
783  yb06 = 0; // drop empty rectangle
784  }
785  if (yb09 - yb08 < 2 * lineHeight) {
786  yb05 = yb09;
787  yb08 = 0; // drop "LCARS" display
788  }
789  if (yb05 - yb04 < 2 * lineHeight) {
790  yb03 = yb09;
791  yb04 = 0; // drop "LOAD" display
792  }
793  if (yb03 - yb02 < 2 * lineHeight) {
794  yb01 = yb09;
795  yb02 = 0; // drop "DISK" display
796  }
797  // Anything else is just insanely large...
798 
799  // The main command menu:
800  xm00 = xa03;
801  xm01 = xa05;
802  xm02 = xa06;
803  xm08 = (xa09 + xa00) / 2;
804  xm07 = xm08 - lineHeight;
805  xm06 = xm07 - lineHeight / 2;
806  xm05 = xm06 - lineHeight / 2;
807  xm04 = xm05 - lineHeight;
808  xm03 = xm04 - Gap;
809  ym00 = yc08;
810  ym01 = ym00 + lineHeight / 2;
811  ym02 = ym01 + lineHeight / 2;
812  ym03 = ym02 + Gap;
813  ym07 = yb15;
814  ym06 = ym07 - lineHeight / 2;
815  ym05 = ym06 - lineHeight / 2;
816  ym04 = ym05 - Gap;
817 
818  // The status area:
819  xs00 = xm08 + Gap + lineHeight + Gap;
820  xs13 = xa09;
821  xs12 = xa08;
822  xs11 = xa07;
823  xs05 = (xs00 + xs11 + Gap) / 2;
824  xs04 = xs05 - lineHeight / 2;
825  xs03 = xs04 - lineHeight / 2;
826  xs02 = xs03 - 2 * lineHeight;
827  xs01 = xs02 - Gap;
828  xs06 = xs05 + Gap;
829  xs07 = xs06 + lineHeight / 2;
830  xs08 = xs07 + lineHeight / 2;
831  xs09 = xs08 + 2 * lineHeight;
832  xs10 = xs09 + Gap;
833  ys00 = yc06;
834  ys01 = ys00 + lineHeight;
835  ys02 = ys01 + lineHeight / 2;
836  ys04 = ys01 + lineHeight;
837  ys03 = ys04 - Gap;
838  ys05 = yb15;
839 
840  // The color buttons in submenus:
841  xb00 = xa06;
842  xb15 = xa07;
843  int w = (xa08 - xa06) / 4;
844  xb01 = xb00 + lineHeight / 2;
845  xb02 = xb01 + Gap;
846  xb04 = xb00 + w;
847  xb03 = xb04 - Gap;
848  xb05 = xb04 + lineHeight / 2;
849  xb06 = xb05 + Gap;
850  xb08 = xb04 + w;
851  xb07 = xb08 - Gap;
852  xb09 = xb08 + lineHeight / 2;
853  xb10 = xb09 + Gap;
854  xb12 = xb08 + w;
855  xb11 = xb12 - Gap;
856  xb13 = xb12 + lineHeight / 2;
857  xb14 = xb13 + Gap;;
858 
859  // The color buttons in the main menu:
860  int r = lineHeight;
861  xd07 = xa09;
862  xd06 = xd07 - r;
863  xd05 = xd06 - 4 * r;
864  xd04 = xd05 - r;
865  xd03 = xd04 - Gap;
866  xd02 = xd03 - r;
867  xd01 = xd02 - 4 * r;
868  xd00 = xd01 - r;
869  yd00 = yt00;
870  yd05 = yc04 - Gap;
871  yd04 = yd05 - 2 * r;
872  yd03 = yd04 - Gap;
873  yd02 = yd03 - 2 * r;
874  yd01 = yd02 - Gap;
875 
876  xs = 0;
877 
879 }
880 
882 {
883  delete tallFont;
884  delete tinyFont;
885  delete osd;
886 }
887 
889 {
890  if (initial || MenuCategory != cSkinDisplayMenu::MenuCategory()) {
891  cSkinDisplayMenu::SetMenuCategory(MenuCategory);
892  initial = true;
893  osd->DrawRectangle(xa00, yt00, xa09 - 1, yb15 - 1, Theme.Color(clrBackground));
894  if (MenuCategory == mcMain) {
895  yi00 = ym03;
896  yi01 = ym04;
897  xi00 = xm00;
898  xi01 = xm03;
899  xi02 = xm04;
900  xi03 = xm05;
901  lastTimersState = -1;
903  DrawMainBracket();
905  }
906  else {
907  yi00 = yt02;
908  yi01 = yb13;
909  xi00 = xa03;
910  xi01 = xa07;
911  xi02 = xa08;
912  xi03 = xa09;
913  DrawMenuFrame();
914  }
915  }
916 }
917 
919 {
920  // Top left rectangles:
921  osd->DrawRectangle(xa00, yt00, xa02 - 1, yt02 - 1, Color);
922  osd->DrawRectangle(xa00, yt04, xa02 - 1, yt06 - 1, Color);
923  // Upper elbow:
924  osd->DrawRectangle(xa00, yc00, xa01 - 1, yc01 - 1, Color);
925  osd->DrawEllipse (xa00, yc01, xa01 - 1, yc05 - 1, Color, 3);
926  osd->DrawRectangle(xa01, yc00, xa02 - 1, yc05 - 1, Color);
927  osd->DrawEllipse (xa02, yc02, xa04 - 1, yc04 - 1, Color, -3);
928  osd->DrawRectangle(xa02, yc04, xa05 - 1, yc05 - 1, Color);
929  // Upper delimiter:
930  osd->DrawRectangle(xa06, yc04 + lineHeight / 2, xm08 - 1, yc05 - 1, Color);
931  osd->DrawRectangle(xm08 + Gap, yc04, xs00 - Gap - 1, yc05 - 1, Color);
932  osd->DrawRectangle(xs00, yc04, xs05 - 1, yc05 - 1, Color);
933  osd->DrawRectangle(xs06, yc04, xa07 - 1, yc05 - 1, Color);
934  osd->DrawRectangle(xa08, yc04, xa09 - 1, yc05 - 1, Color);
935 }
936 
938 {
939  const cFont *font = cFont::GetFont(fontOsd);
940  // Lower elbow:
941  osd->DrawRectangle(xa00, yc10, xa01 - 1, yc11 - 1, frameColor);
942  osd->DrawEllipse (xa00, yc06, xa01 - 1, yc10 - 1, frameColor, 2);
943  osd->DrawRectangle(xa01, yc06, xa02 - 1, yc11 - 1, frameColor);
944  osd->DrawEllipse (xa02, yc07, xa04 - 1, yc09 - 1, frameColor, -2);
945  osd->DrawRectangle(xa02, yc06, xa05 - 1, yc07 - 1, frameColor);
946  // Lower delimiter:
947  osd->DrawRectangle(xa06, yc06, xm08 - 1, yc07 - lineHeight / 2 - 1, frameColor);
948  osd->DrawRectangle(xm08 + Gap, yc06, xs00 - Gap - 1, yc07 - 1, frameColor);
949  osd->DrawRectangle(xa08, yc06, xa09 - 1, yc07 - 1, frameColor);
950  // VDR version:
951  osd->DrawRectangle(xa00, yb10, xa02 - 1, yb15 - 1, frameColor);
952  osd->DrawText(xa00, yb10, "VDR", Theme.Color(clrMenuFrameFg), frameColor, tallFont, xa02 - xa00, yb11 - yb10, taTop | taRight | taBorder);
953  osd->DrawText(xa00, yb15 - lineHeight, VDRVERSION, Theme.Color(clrMenuFrameFg), frameColor, font, xa02 - xa00, lineHeight, taBottom | taRight | taBorder);
954 }
955 
956 void cSkinLCARSDisplayMenu::DrawMainButton(const char *Text, int x0, int x1, int x2, int x3, int y0, int y1, tColor ColorFg, tColor ColorBg, const cFont *Font)
957 {
958  int h = y1 - y0;
959  osd->DrawEllipse(x0, y0, x1 - 1, y1 - 1, ColorBg, 7);
960  osd->DrawText(x1, y0, Text, ColorFg, ColorBg, Font, x2 - x1, h, taBottom | taRight);
961  osd->DrawEllipse(x2, y0, x3 - 1, y1 - 1, ColorBg, 5);
962 }
963 
965 {
966  // Upper elbow:
967  osd->DrawRectangle(xa00, yt05, xa01 - 1, yt06 - 1, frameColor);
969  osd->DrawEllipse (xa00, yt00, xa01 - 1, yt05 - 1, frameColor, 2);
970  osd->DrawRectangle(xa01, yt00, xa02 - 1, yt06 - 1, frameColor);
971  osd->DrawEllipse (xa02, yt01, xa04 - 1, yt03 - 1, frameColor, -2);
972  osd->DrawRectangle(xa02, yt00, xa05 - 1, yt01 - 1, frameColor);
973  osd->DrawRectangle(xa06, yt00, xa07 - 1, yt01 - 1, frameColor);
974  osd->DrawRectangle(xa08, yt00, xa08 + lineHeight / 2 - 1, yt01 - 1, frameColor);
976  osd->DrawEllipse (xa08 + lineHeight / 2, yt00, xa09 - 1, yt01 - 1, frameColor, 5);
977  // Center part:
978  osd->DrawRectangle(xa00, yc00, xa02 - 1, yc11 - 1, frameColor);
979  // Lower elbow:
980  osd->DrawRectangle(xa00, yb10, xa02 - 1, yb11 - 1, frameColor);
982  osd->DrawEllipse (xa00, yb11, xa01 - 1, yb15 - 1, frameColor, 3);
983  osd->DrawRectangle(xa01, yb11, xa02 - 1, yb15 - 1, frameColor);
984  osd->DrawEllipse (xa02, yb12, xa04 - 1, yb14 - 1, frameColor, -3);
985  osd->DrawRectangle(xa02, yb14, xa05 - 1, yb15 - 1, frameColor);
986  osd->DrawRectangle(xa08, yb14, xa08 + lineHeight / 2 - 1, yb15 - 1, frameColor);
988  osd->DrawEllipse (xa08 + lineHeight / 2, yb14, xa09 - 1, yb15 - 1, frameColor, 5);
989  osd->DrawText(xa00, yb10, "VDR", Theme.Color(clrMenuFrameFg), frameColor, tallFont, xa02 - xa00, yb11 - yb10, taTop | taRight | taBorder);
990  // Color buttons:
991  tColor lutBg[] = { clrButtonRedBg, clrButtonGreenBg, clrButtonYellowBg, clrButtonBlueBg };
992  osd->DrawRectangle(xb00, yb14, xb01 - 1, yb15 - 1, Theme.Color(lutBg[Setup.ColorKey0]));
993  osd->DrawRectangle(xb04, yb14, xb05 - 1, yb15 - 1, Theme.Color(lutBg[Setup.ColorKey1]));
994  osd->DrawRectangle(xb08, yb14, xb09 - 1, yb15 - 1, Theme.Color(lutBg[Setup.ColorKey2]));
995  osd->DrawRectangle(xb12, yb14, xb13 - 1, yb15 - 1, Theme.Color(lutBg[Setup.ColorKey3]));
996 }
997 
999 {
1000  cString s = DayDateTime();
1001  if (initial || strcmp(s, lastDate)) {
1002  const cFont *font = cFont::GetFont(fontOsd);
1003  tColor ColorFg = Theme.Color(clrDateFg);
1004  tColor ColorBg = Theme.Color(clrDateBg);
1005  lastDate = s;
1006  const char *t = strrchr(s, ' ');
1007  osd->DrawText(xa00, yb01 - lineHeight, t, ColorFg, ColorBg, font, xa02 - xa00, lineHeight, taBottom | taRight | taBorder);
1008  s.Truncate(t - s);
1009  osd->DrawText(xa00, yb00, s, ColorFg, ColorBg, font, xa02 - xa00, yb01 - yb00 - lineHeight, taTop | taRight | taBorder);
1010  }
1011 }
1012 
1014 {
1015  if (yb02) {
1016  if (cVideoDiskUsage::HasChanged(lastDiskUsageState) || initial) { // must call HasChanged() first, or it shows an outdated value in the 'initial' case!
1017  const cFont *font = cFont::GetFont(fontOsd);
1018  int DiskUsage = cVideoDiskUsage::UsedPercent();
1019  bool DiskAlert = DiskUsage > DISKUSAGEALERTLIMIT;
1020  tColor ColorFg = DiskAlert ? Theme.Color(clrAlertFg) : Theme.Color(clrMenuFrameFg);
1021  tColor ColorBg = DiskAlert ? Theme.Color(clrAlertBg) : frameColor;
1022  if (initial || DiskAlert != lastDiskAlert)
1023  osd->DrawText(xa00, yb02, tr("DISK"), ColorFg, ColorBg, tinyFont, xa02 - xa00, yb03 - yb02, taTop | taLeft | taBorder);
1024  osd->DrawText(xa01, yb02, itoa(DiskUsage), ColorFg, ColorBg, font, xa02 - xa01, lineHeight, taBottom | taRight | taBorder);
1025  osd->DrawText(xa00, yb03 - lineHeight, cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60), ColorFg, ColorBg, font, xa02 - xa00, 0, taBottom | taRight | taBorder);
1026  lastDiskAlert = DiskAlert;
1027  }
1028  }
1029 }
1030 
1032 {
1033  if (yb04) {
1034  tColor ColorFg = Theme.Color(clrMenuFrameFg);
1035  tColor ColorBg = frameColor;
1036  if (initial)
1037  osd->DrawText(xa00, yb04, tr("LOAD"), ColorFg, ColorBg, tinyFont, xa02 - xa00, yb05 - yb04, taTop | taLeft | taBorder);
1038  double SystemLoad;
1039  if (getloadavg(&SystemLoad, 1) > 0) {
1040  if (initial || SystemLoad != lastSystemLoad) {
1041  osd->DrawText(xa00, yb05 - lineHeight, cString::sprintf("%.1f", SystemLoad), ColorFg, ColorBg, cFont::GetFont(fontOsd), xa02 - xa00, lineHeight, taBottom | taRight | taBorder);
1042  lastSystemLoad = SystemLoad;
1043  }
1044  }
1045  }
1046 }
1047 
1049 {
1050  tColor Color = Theme.Color(clrMenuMainBracket);
1051  osd->DrawRectangle(xm00, ym00, xm01 - 1, ym01 - 1, Color);
1052  osd->DrawRectangle(xm02, ym00, xm07 - 1, ym01 - 1, Color);
1053  osd->DrawEllipse (xm07, ym00, xm08 - 1, ym02 - 1, Color, 1);
1054  osd->DrawEllipse (xm06, ym01, xm07 - 1, ym02 - 1, Color, -1);
1055  osd->DrawRectangle(xm07, ym03, xm08 - 1, ym04 - 1, Color);
1056  osd->DrawEllipse (xm06, ym05, xm07 - 1, ym06 - 1, Color, -4);
1057  osd->DrawEllipse (xm07, ym05, xm08 - 1, ym07 - 1, Color, 4);
1058  osd->DrawRectangle(xm02, ym06, xm07 - 1, ym07 - 1, Color);
1059  osd->DrawRectangle(xm00, ym06, xm01 - 1, ym07 - 1, Color);
1060 }
1061 
1063 {
1064  const cFont *font = cFont::GetFont(fontOsd);
1065  osd->DrawText (xs00, ys00, tr("TIMERS"), Theme.Color(clrMenuFrameFg), frameColor, font, xs01 - xs00, lineHeight, taBottom | taLeft | taBorder);
1066  osd->DrawRectangle(xs02, ys00, xs03 - 1, ys01 - 1, frameColor);
1067  osd->DrawEllipse (xs03, ys00, xs05 - 1, ys01 - 1, frameColor, 1);
1068  osd->DrawEllipse (xs03, ys01, xs04 - 1, ys02 - 1, frameColor, -1);
1069  osd->DrawRectangle(xs04, ys01, xs05 - 1, ys03 - 1, frameColor);
1070  osd->DrawRectangle(xs04, ys04, xs05 - 1, ys05 - 1, frameColor);
1071  osd->DrawText (xs10, ys00, tr("DEVICES"), Theme.Color(clrMenuFrameFg), frameColor, font, xs11 - xs10, lineHeight, taBottom | taRight | taBorder);
1072  osd->DrawRectangle(xs08, ys00, xs09 - 1, ys01 - 1, frameColor);
1073  osd->DrawEllipse (xs06, ys00, xs08 - 1, ys01 - 1, frameColor, 2);
1074  osd->DrawEllipse (xs07, ys01, xs08 - 1, ys02 - 1, frameColor, -2);
1075  osd->DrawRectangle(xs06, ys01, xs07 - 1, ys03 - 1, frameColor);
1076  osd->DrawRectangle(xs06, ys04, xs07 - 1, ys05 - 1, frameColor);
1077  osd->DrawRectangle(xs12, ys00, xs13 - 1, ys01 - 1, frameColor);
1078 }
1079 
1081 {
1082  DrawDate();
1083  DrawDisk();
1084  DrawLoad();
1085  if (initial) {
1086  if (yb06)
1087  osd->DrawRectangle(xa00, yb06, xa02 - 1, yb07 - 1, frameColor);
1088  if (yb08) {
1089  const cFont *font = cFont::GetFont(fontOsd);
1090  osd->DrawRectangle(xa00, yb08, xa02 - 1, yb09 - 1, frameColor);
1091  osd->DrawText(xa00, yb09 - lineHeight, "LCARS", Theme.Color(clrMenuFrameFg), frameColor, font, xa02 - xa00, lineHeight, taBottom | taRight | taBorder);
1092  }
1093  }
1094 }
1095 
1096 void cSkinLCARSDisplayMenu::DrawScrollbar(int Total, int Offset, int Shown, bool CanScrollUp, bool CanScrollDown)
1097 {
1098  int x0, x1, tt, tb;
1099  tColor ClearColor;
1100  if (MenuCategory() == mcMain) {
1101  x0 = xm07;
1102  x1 = xm08;
1103  tt = ym03;
1104  tb = ym04;
1105  ClearColor = Theme.Color(clrMenuMainBracket);
1106  }
1107  else {
1108  x0 = xa02 + Gap;
1109  x1 = x0 + lineHeight / 2;
1110  tt = yc00;
1111  tb = yc11;
1112  ClearColor = Theme.Color(clrBackground);
1113  int d = TextFrame;
1114  if (CanScrollUp)
1115  osd->DrawBitmap(xa02 - bmArrowUp.Width() - d, yc00 + d, bmArrowUp, Theme.Color(clrMenuScrollbarArrow), frameColor);
1116  else
1117  osd->DrawRectangle(xa02 - bmArrowUp.Width() - d, yc00 + d, xa02 - d - 1, yc00 + d + bmArrowUp.Height() - 1, frameColor);
1118  if (CanScrollDown)
1119  osd->DrawBitmap(xa02 - bmArrowDown.Width() - d, yc11 - d - bmArrowDown.Height(), bmArrowDown, Theme.Color(clrMenuScrollbarArrow), frameColor);
1120  else
1121  osd->DrawRectangle(xa02 - bmArrowDown.Width() - d, yc11 - d - bmArrowDown.Height(), xa02 - d - 1, yc11 - d - 1, frameColor);
1122  }
1123  if (Total > 0 && Total > Shown) {
1124  int sw = x1 - x0;
1125  int sh = max(int((tb - tt) * double(Shown) / Total + 0.5), sw);
1126  int st = min(int(tt + (tb - tt) * double(Offset) / Total + 0.5), tb - sh);
1127  int sb = min(st + sh, tb);
1128  osd->DrawRectangle(x0, tt, x1 - 1, tb - 1, Theme.Color(clrMenuScrollbarTotal));
1129  osd->DrawRectangle(x0, st, x1 - 1, sb - 1, Theme.Color(clrMenuScrollbarShown));
1130  }
1131  else if (MenuCategory() != mcMain)
1132  osd->DrawRectangle(x0, tt, x1 - 1, tb - 1, ClearColor);
1133 }
1134 
1135 void cSkinLCARSDisplayMenu::DrawTimer(const cTimer *Timer, int y, bool MultiRec)
1136 {
1137  // The timer data:
1138  bool Alert = !Timer->Recording() && Timer->Pending();
1139  tColor ColorFg = Alert ? Theme.Color(clrAlertFg) : Theme.Color(clrTimerFg);
1140  tColor ColorBg = Alert ? Theme.Color(clrAlertBg) : Theme.Color(clrTimerBg);
1141  osd->DrawRectangle(xs00, y, xs03 - 1, y + lineHeight - 1, ColorBg);
1142  cString Date;
1143  if (Timer->Recording())
1144  Date = cString::sprintf("-%s", *TimeString(Timer->StopTime()));
1145  else {
1146  time_t Now = time(NULL);
1147  cString Today = WeekDayName(Now);
1148  cString Time = TimeString(Timer->StartTime());
1149  cString Day = WeekDayName(Timer->StartTime());
1150  if (Timer->StartTime() > Now + 6 * SECSINDAY)
1151  Date = DayDateTime(Timer->StartTime());
1152  else if (strcmp(Day, Today) != 0)
1153  Date = cString::sprintf("%s %s", *Day, *Time);
1154  else
1155  Date = Time;
1156  }
1157  if (Timer->Flags() & tfVps)
1158  Date = cString::sprintf("VPS %s", *Date);
1159  const cChannel *Channel = Timer->Channel();
1160  const cEvent *Event = Timer->Event();
1161  int d = max(TextFrame / 2, 1);
1162  if (Channel) {
1163  osd->DrawText(xs00 + d, y, Channel->Name(), ColorFg, ColorBg, tinyFont, xs03 - xs00 - d);
1164  osd->DrawText(xs03 - tinyFont->Width(Date) - d, y, Date, ColorFg, ColorBg, tinyFont);
1165  }
1166  if (Event)
1167  osd->DrawText(xs00 + d, y + lineHeight - tinyFont->Height(), Event->Title(), ColorFg, ColorBg, tinyFont, xs03 - xs00 - 2 * d);
1168  // The timer recording indicator:
1169  if (Timer->Recording())
1170  osd->DrawRectangle(xs03 + Gap, y - (MultiRec ? Gap : 0), xs04 - Gap / 2 - 1, y + lineHeight - 1, Theme.Color(clrMenuTimerRecording));
1171 }
1172 
1174 {
1177  const cFont *font = cFont::GetFont(fontOsd);
1178  osd->DrawRectangle(xs00, ys04, xs04 - 1, ys05 - 1, Theme.Color(clrBackground));
1179  osd->DrawRectangle(xs07, ys04, xs13 - 1, ys05 - 1, Theme.Color(clrBackground));
1180  cSortedTimers SortedTimers;
1181  cVector<int> FreeDeviceSlots;
1182  int NumDevices = 0;
1183  int y = ys04;
1184  // Timers and recording devices:
1185  while (1) {
1186  int NumTimers = 0;
1187  const cDevice *Device = NULL;
1188  for (int i = 0; i < SortedTimers.Size(); i++) {
1189  if (y + lineHeight > ys05)
1190  break;
1191  if (const cTimer *Timer = SortedTimers[i]) {
1192  if (Timer->Recording()) {
1193  if (cRecordControl *RecordControl = cRecordControls::GetRecordControl(Timer)) {
1194  if (!Device || Device == RecordControl->Device()) {
1195  DrawTimer(Timer, y, NumTimers > 0);
1196  NumTimers++;
1197  if (!Device) {
1198  Device = RecordControl->Device();
1199  deviceOffset[Device->DeviceNumber()] = y;
1200  deviceRecording[Device->DeviceNumber()] = true;
1201  NumDevices++;
1202  }
1203  else
1204  FreeDeviceSlots.Append(y);
1205  y += lineHeight + Gap;
1206  }
1207  else
1208  continue;
1209  }
1210  SortedTimers[i] = NULL;
1211  }
1212  else if (!Device && Timer->HasFlags(tfActive)) {
1213  DrawTimer(Timer, y, false);
1214  FreeDeviceSlots.Append(y);
1215  y += lineHeight + Gap;
1216  SortedTimers[i] = NULL;
1217  }
1218  }
1219  }
1220  if (!Device)
1221  break;
1222  }
1223  // Devices currently not recording:
1224  int Slot = 0;
1225  for (int i = 0; i < cDevice::NumDevices(); i++) {
1226  if (const cDevice *Device = cDevice::GetDevice(i)) {
1227  if (Device->NumProvidedSystems()) {
1228  if (!deviceRecording[Device->DeviceNumber()]) {
1229  if (Slot < FreeDeviceSlots.Size()) {
1230  y = FreeDeviceSlots[Slot];
1231  Slot++;
1232  }
1233  if (y + lineHeight > ys05)
1234  break;
1235  deviceOffset[Device->DeviceNumber()] = y;
1236  y += lineHeight + Gap;
1237  NumDevices++;
1238  }
1239  }
1240  }
1241  }
1242  // Total number of active timers:
1243  int NumTimers = 0;
1244  for (cTimer *Timer = Timers.First(); Timer; Timer = Timers.Next(Timer)) {
1245  if (Timer->HasFlags(tfActive))
1246  NumTimers++;
1247  }
1248  osd->DrawText(xs02, ys00, itoa(NumTimers), Theme.Color(clrMenuFrameFg), frameColor, font, xs03 - xs02, ys01 - ys00, taBottom | taLeft | taBorder);
1249  osd->DrawText(xs08, ys00, itoa(NumDevices), Theme.Color(clrMenuFrameFg), frameColor, font, xs09 - xs08, ys01 - ys00, taBottom | taRight | taBorder);
1250  lastSignalDisplay = 0;
1251  initial = true; // forces redrawing of devices
1252  }
1253 }
1254 
1256 {
1257  int dn = Device->DeviceNumber();
1258  int y = deviceOffset[dn];
1259  if (y + lineHeight <= ys05) {
1260  if (DrawDeviceData(osd, Device, xs08, y, xs11, y + lineHeight, xs, tinyFont, lastDeviceType[dn], lastCamSlot[dn], initial)) {
1261  // Make sure signal meters are redrawn:
1262  lastSignalStrength[dn] = -1;
1263  lastSignalQuality[dn] = -1;
1264  lastSignalDisplay = 0;
1265  }
1266  // The device recording indicator:
1267  if (deviceRecording[dn])
1268  osd->DrawRectangle(xs07 + Gap / 2, y, xs08 - Gap - 1, y + lineHeight - 1, Theme.Color(clrMenuDeviceRecording));
1269  }
1270 }
1271 
1273 {
1274  for (int i = 0; i < cDevice::NumDevices(); i++) {
1275  if (const cDevice *Device = cDevice::GetDevice(i)) {
1276  if (Device->NumProvidedSystems())
1277  DrawDevice(Device);
1278  }
1279  }
1280 }
1281 
1283 {
1284  cDevice *Device = cDevice::PrimaryDevice();
1285  int y = -1;
1286  bool Transferring = Device->Transferring();
1287  if (!Device->Replaying() || Transferring)
1289  if (initial || y != lastLiveIndicatorY || Transferring != lastLiveIndicatorTransferring) {
1290  if (lastLiveIndicatorY >= 0)
1292  if (y >= 0) {
1293  tColor ColorBg = Theme.Color(clrChannelFrameBg);
1294  osd->DrawRectangle(xs12, y, xs12 + lineHeight / 2 - 1, y + lineHeight - 1, ColorBg);
1295  osd->DrawEllipse (xs12 + lineHeight / 2, y, xs13 - 1, y + lineHeight - 1, ColorBg, 5);
1296  if (Transferring) {
1297  int w = bmTransferMode.Width();
1298  int h = bmTransferMode.Height();
1299  int b = w * w + h * h; // the diagonal of the bitmap (squared)
1300  int c = lineHeight * lineHeight; // the diameter of the circle (squared)
1301  const cBitmap *bm = &bmTransferMode;
1302  if (b > c) {
1303  // the bitmap doesn't fit, so scale it down:
1304  double f = sqrt(double(c) / (2 * b));
1305  bm = bmTransferMode.Scaled(f, f);
1306  }
1307  osd->DrawBitmap((xs12 + xs13 - bm->Width()) / 2, y + (lineHeight - bm->Height()) / 2, *bm, Theme.Color(clrChannelFrameFg), ColorBg);
1308  if (bm != &bmTransferMode)
1309  delete bm;
1310  }
1311  }
1312  lastLiveIndicatorY = y;
1313  lastLiveIndicatorTransferring = Transferring;
1314  }
1315 }
1316 
1318 {
1319  time_t Now = time(NULL);
1320  if (initial || Now - lastSignalDisplay >= SIGNALDISPLAYDELTA) {
1321  for (int i = 0; i < cDevice::NumDevices(); i++) {
1322  if (const cDevice *Device = cDevice::GetDevice(i)) {
1323  if (Device->NumProvidedSystems()) {
1324  if (int y = deviceOffset[i])
1326  }
1327  }
1328  }
1329  lastSignalDisplay = Now;
1330  }
1331 }
1332 
1334 {
1335  if (lastMode != cmLive) {
1336  initial = true;
1337  lastMode = cmLive;
1338  }
1339  if (initial) {
1340  DrawMainFrameUpper(Theme.Color(clrChannelFrameBg));
1341  osd->DrawText(xd00, yd00, tr("LIVE"), Theme.Color(clrChannelFrameBg), Theme.Color(clrBackground), tallFont, xd07 - xd00, yd01 - yd00, taTop | taRight | taBorder);
1342  }
1343  if (!Channel)
1344  return;
1345  if (initial || Channel != lastChannel) {
1346  osd->DrawText(xa00, yt00, itoa(Channel->Number()), Theme.Color(clrChannelFrameFg), Theme.Color(clrChannelFrameBg), tallFont, xa02 - xa00, yt02 - yt00, taTop | taRight | taBorder);
1347  osd->DrawText(xa03, yt00, Channel->Name(), Theme.Color(clrChannelName), Theme.Color(clrBackground), tallFont, xd00 - xa03, yd01 - yd00, taTop | taLeft);
1348  lastChannel = Channel;
1349  DrawSeen(0, 0);
1350  }
1351  // The current programme:
1352  cSchedulesLock SchedulesLock;
1353  if (const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock)) {
1354  if (const cSchedule *Schedule = Schedules->GetSchedule(Channel)) {
1355  const cEvent *Event = Schedule->GetPresentEvent();
1356  if (initial || Event != lastEvent) {
1357  DrawInfo(Event, true);
1358  lastEvent = Event;
1359  lastSeen = -1;
1360  }
1361  int Current = 0;
1362  int Total = 0;
1363  if (Event) {
1364  time_t t = time(NULL);
1365  if (t > Event->StartTime())
1366  Current = t - Event->StartTime();
1367  Total = Event->Duration();
1368  }
1369  DrawSeen(Current, Total);
1370  }
1371  }
1372 }
1373 
1375 {
1376  if (lastMode != cmPlay) {
1377  initial = true;
1378  lastMode = cmPlay;
1379  }
1380  if (initial) {
1381  DrawMainFrameUpper(Theme.Color(clrReplayFrameBg));
1382  osd->DrawText(xd00, yd00, tr("PLAY"), Theme.Color(clrReplayFrameBg), Theme.Color(clrBackground), tallFont, xd07 - xd00, yd01 - yd00, taTop | taRight | taBorder);
1383  }
1384  // The current progress:
1385  int Current = 0;
1386  int Total = 0;
1387  if (Control->GetIndex(Current, Total))
1388  DrawSeen(Current, Total);
1389  // The current programme:
1390  if (const cRecording *Recording = Control->GetRecording()) {
1391  if (initial || Recording != lastRecording) {
1392  const cFont *font = cFont::GetFont(fontOsd);
1393  if (const cRecordingInfo *Info = Recording->Info()) {
1394  osd->DrawText(xa03, yt00, Info->ChannelName(), Theme.Color(clrChannelName), Theme.Color(clrBackground), tallFont, xd00 - xa03, yd01 - yd00, taTop | taLeft);
1395  DrawInfo(Info->GetEvent(), false);
1396  }
1397  else
1398  osd->DrawText(xa03, yt04, Recording->Name(), Theme.Color(clrEventTitle), Theme.Color(clrBackground), font, xd00 - xa03, 0, taTop | taLeft);
1399  osd->DrawText(xa00, yt04, ShortDateString(Recording->Start()), Theme.Color(clrReplayFrameFg), Theme.Color(clrReplayFrameBg), font, xa02 - xa00, 0, taTop | taRight | taBorder);
1400  osd->DrawText(xa00, yt06 - lineHeight, TimeString(Recording->Start()), Theme.Color(clrReplayFrameFg), Theme.Color(clrReplayFrameBg), font, xa02 - xa00, 0, taBottom | taRight | taBorder);
1401  lastRecording = Recording;
1402  }
1403  }
1404  else {
1405  cString Header = Control->GetHeader();
1406  if (!*lastHeader || strcmp(Header, lastHeader)) {
1407  osd->DrawText(xa03, yt00, Header, Theme.Color(clrMenuText), Theme.Color(clrBackground), tallFont, xd00 - xa03, yd01 - yd00, taTop | taLeft);
1408  lastHeader = Header;
1409  }
1410  }
1411 }
1412 
1413 void cSkinLCARSDisplayMenu::DrawInfo(const cEvent *Event, bool WithTime)
1414 {
1415  if (Event) {
1416  const cFont *font = cFont::GetFont(fontOsd);
1417  int y = yt04;
1418  osd->DrawText(xa03, y, Event->Title(), Theme.Color(clrEventTitle), Theme.Color(clrBackground), font, xd00 - xa03 - lineHeight, lineHeight, taBottom | taLeft);
1419  y += lineHeight;
1420  osd->DrawText(xa03, y, Event->ShortText(), Theme.Color(clrEventShortText), Theme.Color(clrBackground), cFont::GetFont(fontSml), xd00 - xa03 - lineHeight, lineHeight, taTop | taLeft);
1421  if (WithTime) {
1422  osd->DrawText(xa00, yt04, Event->GetTimeString(), Theme.Color(clrChannelFrameFg), Theme.Color(clrChannelFrameBg), font, xa02 - xa00, lineHeight, taTop | taRight | taBorder);
1423  osd->DrawText(xa00, yt06 - lineHeight, cString::sprintf("-%s", *Event->GetEndTimeString()), Theme.Color(clrChannelFrameFg), Theme.Color(clrChannelFrameBg), font, xa02 - xa00, lineHeight, taBottom | taRight | taBorder);
1424  }
1425  }
1426 }
1427 
1428 void cSkinLCARSDisplayMenu::DrawSeen(int Current, int Total)
1429 {
1430  int Seen = (Total > 0) ? min(xm08 - xm02, int((xm08 - xm02) * double(Current) / Total)) : 0;
1431  if (initial || Seen != lastSeen) {
1432  int y0 = yc04 - ShowSeenExtent;
1433  int y1 = yc04 + lineHeight / 2 - Gap / 2;
1434  osd->DrawRectangle(xm02, y0, xm02 + Seen - 1, y1 - 1, Theme.Color(clrSeen));
1435  osd->DrawRectangle(xm02 + Seen, y0, xm08 - 1, y1 - 1, Theme.Color(clrBackground));
1436  lastSeen = Seen;
1437  }
1438 }
1439 
1441 {
1442  if (textScroller.CanScroll())
1444 }
1445 
1446 void cSkinLCARSDisplayMenu::Scroll(bool Up, bool Page)
1447 {
1448  cSkinDisplayMenu::Scroll(Up, Page);
1450 }
1451 
1453 {
1454  if (MenuCategory() == mcMain)
1455  return (ym04 - ym03) / lineHeight;
1456  else
1457  return (yb13 - yt02) / lineHeight;
1458 }
1459 
1461 {
1462  textScroller.Reset();
1463  osd->DrawRectangle(xi00, yi00, xi03 - 1, yi01 - 1, Theme.Color(clrBackground));
1464 }
1465 
1466 void cSkinLCARSDisplayMenu::SetTitle(const char *Title)
1467 {
1468  if (MenuCategory() != mcMain) {
1469  const cFont *font = cFont::GetFont(fontOsd);
1470  int w = font->Width(Title);
1471  osd->DrawRectangle(xa06, yt00, xa07 - w - Gap - 1, yt01 - 1, frameColor);
1472  osd->DrawText(xa07 - w - Gap, yt00, Title, Theme.Color(clrMenuTitle), Theme.Color(clrBackground), font, w + Gap, yt01 - yt00, taRight);
1473  }
1474 }
1475 
1476 void cSkinLCARSDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue)
1477 {
1478  const char *lutText[] = { Red, Green, Yellow, Blue };
1479  tColor lutFg[] = { clrButtonRedFg, clrButtonGreenFg, clrButtonYellowFg, clrButtonBlueFg };
1480  tColor lutBg[] = { clrButtonRedBg, clrButtonGreenBg, clrButtonYellowBg, clrButtonBlueBg };
1481  const cFont *font = cFont::GetFont(fontSml);
1482  if (MenuCategory() == mcMain) {
1483  DrawMainButton(lutText[Setup.ColorKey0], xd00, xd01, xd02, xd03, yd02, yd03, Theme.Color(lutFg[Setup.ColorKey0]), Theme.Color(lutBg[Setup.ColorKey0]), font);
1484  DrawMainButton(lutText[Setup.ColorKey1], xd04, xd05, xd06, xd07, yd02, yd03, Theme.Color(lutFg[Setup.ColorKey1]), Theme.Color(lutBg[Setup.ColorKey1]), font);
1485  DrawMainButton(lutText[Setup.ColorKey2], xd00, xd01, xd02, xd03, yd04, yd05, Theme.Color(lutFg[Setup.ColorKey2]), Theme.Color(lutBg[Setup.ColorKey2]), font);
1486  DrawMainButton(lutText[Setup.ColorKey3], xd04, xd05, xd06, xd07, yd04, yd05, Theme.Color(lutFg[Setup.ColorKey3]), Theme.Color(lutBg[Setup.ColorKey3]), font);
1487  }
1488  else {
1489  int h = yb15 - yb14;
1490  osd->DrawText(xb02, yb14, lutText[Setup.ColorKey0], Theme.Color(lutFg[Setup.ColorKey0]), Theme.Color(lutBg[Setup.ColorKey0]), font, xb03 - xb02, h, taLeft | taBorder);
1491  osd->DrawText(xb06, yb14, lutText[Setup.ColorKey1], Theme.Color(lutFg[Setup.ColorKey1]), Theme.Color(lutBg[Setup.ColorKey1]), font, xb07 - xb06, h, taLeft | taBorder);
1492  osd->DrawText(xb10, yb14, lutText[Setup.ColorKey2], Theme.Color(lutFg[Setup.ColorKey2]), Theme.Color(lutBg[Setup.ColorKey2]), font, xb11 - xb10, h, taLeft | taBorder);
1493  osd->DrawText(xb14, yb14, lutText[Setup.ColorKey3], Theme.Color(lutFg[Setup.ColorKey3]), Theme.Color(lutBg[Setup.ColorKey3]), font, xb15 - xb14, h, taLeft | taBorder);
1494  }
1495 }
1496 
1498 {
1499  if (Text) {
1500  osd->SaveRegion(xb00, yb14, xb15 - 1, yb15 - 1);
1501  osd->DrawText(xb00, yb14, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), cFont::GetFont(fontSml), xb15 - xb00, yb15 - yb14, taCenter);
1502  }
1503  else
1504  osd->RestoreRegion();
1505 }
1506 
1507 void cSkinLCARSDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable)
1508 {
1509  int y = yi00 + Index * lineHeight;
1510  tColor ColorFg, ColorBg;
1511  if (Current) {
1512  if (TwoColors) {
1513  ColorFg = Theme.Color(clrBackground);
1514  ColorBg = Theme.Color(clrMenuFrameBg);
1515  }
1516  else {
1517  ColorFg = Theme.Color(clrMenuItemCurrentFg);
1518  ColorBg = Theme.Color(clrMenuItemCurrentBg);
1519  }
1520  osd->DrawRectangle(xi00, y, xi01 - 1, y + lineHeight - 1, ColorBg);
1521  osd->DrawRectangle(xi02, y, xi02 + lineHeight / 2 - 1, y + lineHeight - 1, ColorBg);
1522  osd->DrawEllipse (xi02 + lineHeight / 2, y, xi03 - 1, y + lineHeight - 1, ColorBg, 5);
1523  currentIndex = Index;
1524  }
1525  else {
1526  ColorFg = Theme.Color(Selectable ? clrMenuItemSelectable : clrMenuItemNonSelectable);
1527  ColorBg = Theme.Color(clrBackground);
1528  if (currentIndex == Index)
1529  osd->DrawRectangle(xi00, y, xi03 - 1, y + lineHeight - 1, Theme.Color(clrBackground));
1530  }
1531  const cFont *font = cFont::GetFont(fontOsd);
1532  for (int i = 0; i < MaxTabs; i++) {
1533  const char *s = GetTabbedText(Text, i);
1534  if (s) {
1535  int xt = xi00 + TextSpacing + Tab(i);
1536  osd->DrawText(xt, y, s, ColorFg, ColorBg, font, xi01 - xt);
1537  }
1538  if (!Tab(i + 1))
1539  break;
1540  }
1542 }
1543 
1544 void cSkinLCARSDisplayMenu::SetScrollbar(int Total, int Offset)
1545 {
1546  DrawScrollbar(Total, Offset, MaxItems(), Offset > 0, Offset + MaxItems() < Total);
1547 }
1548 
1550 {
1551  if (!Event)
1552  return;
1553  const cFont *font = cFont::GetFont(fontOsd);
1554  int xl = xi00;
1555  int y = yi00;
1556  cTextScroller ts;
1557  char t[32];
1558  snprintf(t, sizeof(t), "%s %s - %s", *Event->GetDateString(), *Event->GetTimeString(), *Event->GetEndTimeString());
1559  ts.Set(osd, xl, y, xi01 - xl, yi01 - y, t, font, Theme.Color(clrEventTime), Theme.Color(clrBackground));
1560  if (Event->Vps() && Event->Vps() != Event->StartTime()) {
1561  cString buffer = cString::sprintf(" VPS: %s ", *Event->GetVpsString());
1562  const cFont *font = cFont::GetFont(fontSml);
1563  int w = font->Width(buffer);
1564  osd->DrawText(xi01 - w, y, buffer, Theme.Color(clrMenuFrameFg), frameColor, font, w);
1565  int yb = y + font->Height();
1566  osd->DrawRectangle(xi02, y, xi02 + lineHeight / 2 - 1, yb - 1, frameColor);
1567  osd->DrawEllipse (xi02 + lineHeight / 2, y, xi03 - 1, yb - 1, frameColor, 5);
1568  }
1569  y += ts.Height();
1570  if (Event->ParentalRating()) {
1571  cString buffer = cString::sprintf(" %s ", *Event->GetParentalRatingString());
1572  const cFont *font = cFont::GetFont(fontSml);
1573  int w = font->Width(buffer);
1574  osd->DrawText(xi01 - w, y, buffer, Theme.Color(clrMenuFrameFg), frameColor, font, w);
1575  int yb = y + font->Height();
1576  osd->DrawRectangle(xi02, y, xi02 + lineHeight / 2 - 1, yb - 1, frameColor);
1577  osd->DrawEllipse (xi02 + lineHeight / 2, y, xi03 - 1, yb - 1, frameColor, 5);
1578  }
1579  y += font->Height();
1580  ts.Set(osd, xl, y, xi01 - xl, yi01 - y, Event->Title(), font, Theme.Color(clrEventTitle), Theme.Color(clrBackground));
1581  y += ts.Height();
1582  if (!isempty(Event->ShortText())) {
1583  const cFont *font = cFont::GetFont(fontSml);
1584  ts.Set(osd, xl, y, xi01 - xl, yi01 - y, Event->ShortText(), font, Theme.Color(clrEventShortText), Theme.Color(clrBackground));
1585  y += ts.Height();
1586  }
1587  y += font->Height();
1588  if (!isempty(Event->Description())) {
1589  int yt = y;
1590  int yb = yi01;
1591  textScroller.Set(osd, xl, yt, xi01 - xl, yb - yt, Event->Description(), font, Theme.Color(clrEventDescription), Theme.Color(clrBackground));
1593  }
1594 }
1595 
1597 {
1598  if (!Recording)
1599  return;
1600  const cRecordingInfo *Info = Recording->Info();
1601  const cFont *font = cFont::GetFont(fontOsd);
1602  int xl = xi00;
1603  int y = yi00;
1604  cTextScroller ts;
1605  cString t = cString::sprintf("%s %s %s", *DateString(Recording->Start()), *TimeString(Recording->Start()), Info->ChannelName() ? Info->ChannelName() : "");
1606  ts.Set(osd, xl, y, xi01 - xl, yi01 - y, t, font, Theme.Color(clrEventTime), Theme.Color(clrBackground));
1607  y += ts.Height();
1608  if (Info->GetEvent()->ParentalRating()) {
1609  cString buffer = cString::sprintf(" %s ", *Info->GetEvent()->GetParentalRatingString());
1610  const cFont *font = cFont::GetFont(fontSml);
1611  int w = font->Width(buffer);
1612  osd->DrawText(xi01 - w, y, buffer, Theme.Color(clrMenuFrameFg), frameColor, font, w);
1613  int yb = y + font->Height();
1614  osd->DrawRectangle(xi02, y, xi02 + lineHeight / 2 - 1, yb - 1, frameColor);
1615  osd->DrawEllipse (xi02 + lineHeight / 2, y, xi03 - 1, yb - 1, frameColor, 5);
1616  }
1617  y += font->Height();
1618  const char *Title = Info->Title();
1619  if (isempty(Title))
1620  Title = Recording->Name();
1621  ts.Set(osd, xl, y, xi01 - xl, yi01 - y, Title, font, Theme.Color(clrEventTitle), Theme.Color(clrBackground));
1622  y += ts.Height();
1623  if (!isempty(Info->ShortText())) {
1624  const cFont *font = cFont::GetFont(fontSml);
1625  ts.Set(osd, xl, y, xi01 - xl, yi01 - y, Info->ShortText(), font, Theme.Color(clrEventShortText), Theme.Color(clrBackground));
1626  y += ts.Height();
1627  }
1628  y += font->Height();
1629  if (!isempty(Info->Description())) {
1630  int yt = y;
1631  int yb = yi01;
1632  textScroller.Set(osd, xl, yt, xi01 - xl, yb - yt, Info->Description(), font, Theme.Color(clrEventDescription), Theme.Color(clrBackground));
1634  }
1635 }
1636 
1637 void cSkinLCARSDisplayMenu::SetText(const char *Text, bool FixedFont)
1638 {
1639  textScroller.Set(osd, xi00, yi00, GetTextAreaWidth(), yi01 - yi00, Text, GetTextAreaFont(FixedFont), Theme.Color(clrMenuText), Theme.Color(clrBackground));
1641 }
1642 
1644 {
1645  return xi01 - xi00;
1646 }
1647 
1648 const cFont *cSkinLCARSDisplayMenu::GetTextAreaFont(bool FixedFont) const
1649 {
1650  const cFont *font = cFont::GetFont(FixedFont ? fontFix : fontOsd);
1651  //XXX -> make a way to let the text define which font to use
1652  return font;
1653 }
1654 
1656 {
1657  if (MenuCategory() == mcMain) {
1658  cDevice *Device = cDevice::PrimaryDevice();
1659  if (!Device->Replaying() || Device->Transferring()) {
1660  const cChannel *Channel = Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
1661  DrawLive(Channel);
1662  }
1663  else if (cControl *Control = cControl::Control(true))
1664  DrawPlay(Control);
1665  DrawTimers();
1666  DrawDevices();
1668  DrawSignals();
1669  }
1670  DrawFrameDisplay();
1671  osd->Flush();
1672  initial = false;
1673 }
1674 
1675 // --- cSkinLCARSDisplayReplay -----------------------------------------------
1676 
1678 private:
1682  bool modeOnly;
1689  void DrawDate(void);
1690  void DrawTrack(void);
1691 public:
1692  cSkinLCARSDisplayReplay(bool ModeOnly);
1693  virtual ~cSkinLCARSDisplayReplay();
1694  virtual void SetRecording(const cRecording *Recording);
1695  virtual void SetTitle(const char *Title);
1696  virtual void SetMode(bool Play, bool Forward, int Speed);
1697  virtual void SetProgress(int Current, int Total);
1698  virtual void SetCurrent(const char *Current);
1699  virtual void SetTotal(const char *Total);
1700  virtual void SetJump(const char *Jump);
1701  virtual void SetMessage(eMessageType Type, const char *Text);
1702  virtual void Flush(void);
1703  };
1704 
1706 {
1707  const cFont *font = cFont::GetFont(fontOsd);
1708  modeOnly = ModeOnly;
1709  lineHeight = font->Height();
1710  frameColor = Theme.Color(clrReplayFrameBg);
1711  lastCurrentWidth = 0;
1712  lastTotalWidth = 0;
1713  int d = 5 * lineHeight;
1714  xp00 = 0;
1715  xp01 = xp00 + d / 2;
1716  xp02 = xp00 + d;
1717  xp03 = xp02 + lineHeight;
1718  xp04 = xp02 + d / 4;
1719  xp05 = xp02 + d;
1720  xp06 = xp05 + Gap;
1721  xp15 = cOsd::OsdWidth();
1722  xp14 = xp15 - lineHeight;
1723  xp13 = xp14 - Gap;
1724  xp07 = (xp15 + xp00) / 2;
1725  xp08 = xp07 + Gap;
1726  xp09 = xp08 + lineHeight;
1727  xp10 = xp09 + Gap;
1728  xp11 = (xp10 + xp13 + Gap) / 2;
1729  xp12 = xp11 + Gap;
1730 
1731  yp00 = 0;
1732  yp01 = yp00 + 2 * lineHeight;
1733  yp02 = yp01 + Gap;
1734  yp03 = yp02 + 2 * lineHeight;
1735 
1736  yp04 = yp03 + Gap;
1737  yp09 = yp04 + 3 * lineHeight + Gap / 2;
1738  yp08 = yp09 - lineHeight;
1739  yp07 = yp08 - lineHeight;
1740  yp06 = yp08 - d / 4;
1741  yp05 = yp09 - d / 2;
1742 
1745  // Rectangles:
1746  if (!modeOnly)
1747  osd->DrawRectangle(xp00, yp00, xp02 - 1, yp01 - 1, frameColor);
1748  osd->DrawRectangle(xp00, yp02, xp02 - 1, yp03 - 1, frameColor);
1749  if (!modeOnly) {
1750  // Elbow:
1751  osd->DrawRectangle(xp00, yp04, xp01 - 1, yp05 - 1, frameColor);
1753  osd->DrawEllipse (xp00, yp05, xp01 - 1, yp09 - 1, frameColor, 3);
1754  osd->DrawRectangle(xp01, yp04, xp02 - 1, yp09 - 1, frameColor);
1755  osd->DrawEllipse (xp02, yp06, xp04 - 1, yp08 - 1, frameColor, -3);
1756  osd->DrawRectangle(xp02, yp08, xp05 - 1, yp09 - 1, frameColor);
1757  // Status area:
1758  osd->DrawRectangle(xp06, yp08, xp07 - 1, yp09 - 1, frameColor);
1759  osd->DrawRectangle(xp08, yp08, xp09 - 1, yp09 - 1, frameColor);
1760  osd->DrawRectangle(xp10, yp08, xp11 - 1, yp09 - 1, frameColor);
1761  osd->DrawRectangle(xp12, yp08, xp13 - 1, yp09 - 1, Theme.Color(clrDateBg));
1762  osd->DrawRectangle(xp14, yp08, xp14 + lineHeight / 2 - 1, yp09 - 1, frameColor);
1763  osd->DrawRectangle(xp14 + lineHeight / 2, yp08 + lineHeight / 2, xp15 - 1, yp09 - 1, clrTransparent);
1764  osd->DrawEllipse (xp14 + lineHeight / 2, yp08, xp15 - 1, yp09 - 1, frameColor, 5);
1765  }
1766 }
1767 
1769 {
1770  delete osd;
1771 }
1772 
1774 {
1775  cString s = DayDateTime();
1776  if (!*lastDate || strcmp(s, lastDate)) {
1777  osd->DrawText(xp12, yp08, s, Theme.Color(clrDateFg), Theme.Color(clrDateBg), cFont::GetFont(fontOsd), xp13 - xp12, lineHeight, taRight | taBorder);
1778  lastDate = s;
1779  }
1780 }
1781 
1783 {
1784  cDevice *Device = cDevice::PrimaryDevice();
1785  const tTrackId *Track = Device->GetTrack(Device->GetCurrentAudioTrack());
1786  if (!Track && *lastTrackId.description || Track && strcmp(lastTrackId.description, Track->description)) {
1787  osd->DrawText(xp03, yp04, Track ? Track->description : "", Theme.Color(clrTrackName), Theme.Color(clrBackground), cFont::GetFont(fontOsd), xp07 - xp03);
1788  strn0cpy(lastTrackId.description, Track ? Track->description : "", sizeof(lastTrackId.description));
1789  }
1790 }
1791 
1793 {
1794  const cRecordingInfo *RecordingInfo = Recording->Info();
1795  SetTitle(RecordingInfo->Title());
1796  osd->DrawText(xp03, yp01 - lineHeight, RecordingInfo->ShortText(), Theme.Color(clrEventShortText), Theme.Color(clrBackground), cFont::GetFont(fontSml), xp13 - xp03);
1797  osd->DrawText(xp00, yp00, ShortDateString(Recording->Start()), Theme.Color(clrReplayFrameFg), frameColor, cFont::GetFont(fontOsd), xp02 - xp00, 0, taTop | taRight | taBorder);
1798  osd->DrawText(xp00, yp01 - lineHeight, TimeString(Recording->Start()), Theme.Color(clrReplayFrameFg), frameColor, cFont::GetFont(fontOsd), xp02 - xp00, 0, taBottom | taRight | taBorder);
1799 }
1800 
1801 void cSkinLCARSDisplayReplay::SetTitle(const char *Title)
1802 {
1803  osd->DrawText(xp03, yp00, Title, Theme.Color(clrEventTitle), Theme.Color(clrBackground), cFont::GetFont(fontOsd), xp13 - xp03);
1804 }
1805 
1806 static const char *const *ReplaySymbols[2][2][5] = {
1807  { { pause_xpm, srew_xpm, srew1_xpm, srew2_xpm, srew3_xpm },
1808  { pause_xpm, sfwd_xpm, sfwd1_xpm, sfwd2_xpm, sfwd3_xpm }, },
1809  { { play_xpm, frew_xpm, frew1_xpm, frew2_xpm, frew3_xpm },
1810  { play_xpm, ffwd_xpm, ffwd1_xpm, ffwd2_xpm, ffwd3_xpm } }
1811  };
1812 
1813 void cSkinLCARSDisplayReplay::SetMode(bool Play, bool Forward, int Speed)
1814 {
1815  Speed = constrain(Speed, -1, 3);
1816  cBitmap bm(ReplaySymbols[Play][Forward][Speed + 1]);
1817  osd->DrawBitmap(xp01 - bm.Width() / 2, (yp02 + yp03 - bm.Height()) / 2, bm, Theme.Color(clrReplayFrameFg), frameColor);
1818 }
1819 
1820 void cSkinLCARSDisplayReplay::SetProgress(int Current, int Total)
1821 {
1822  cProgressBar pb(xp13 - xp03, lineHeight, Current, Total, marks, Theme.Color(clrReplayProgressSeen), Theme.Color(clrReplayProgressRest), Theme.Color(clrReplayProgressSelected), Theme.Color(clrReplayProgressMark), Theme.Color(clrReplayProgressCurrent));
1823  osd->DrawBitmap(xp03, yp02, pb);
1824 }
1825 
1826 void cSkinLCARSDisplayReplay::SetCurrent(const char *Current)
1827 {
1828  const cFont *font = cFont::GetFont(fontOsd);
1829  int w = font->Width(Current);
1830  osd->DrawText(xp03, yp03 - lineHeight, Current, Theme.Color(clrReplayPosition), Theme.Color(clrBackground), font, max(lastCurrentWidth, w), 0, taLeft);
1831  lastCurrentWidth = w;
1832 }
1833 
1834 void cSkinLCARSDisplayReplay::SetTotal(const char *Total)
1835 {
1836  const cFont *font = cFont::GetFont(fontOsd);
1837  int w = font->Width(Total);
1838  osd->DrawText(xp13 - w, yp03 - lineHeight, Total, Theme.Color(clrReplayPosition), Theme.Color(clrBackground), font, max(lastTotalWidth, w), 0, taRight);
1839  lastTotalWidth = w;
1840 }
1841 
1842 void cSkinLCARSDisplayReplay::SetJump(const char *Jump)
1843 {
1844  osd->DrawText(xp06, yp08, Jump, Theme.Color(clrReplayJumpFg), Jump ? Theme.Color(clrReplayJumpBg) : frameColor, cFont::GetFont(fontOsd), xp07 - xp06, 0, taCenter);
1845 }
1846 
1848 {
1849  if (Text) {
1850  osd->SaveRegion(xp06, yp08, xp13 - 1, yp09 - 1);
1851  osd->DrawText(xp06, yp08, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), cFont::GetFont(fontSml), xp13 - xp06, yp09 - yp08, taCenter);
1852  }
1853  else
1854  osd->RestoreRegion();
1855 }
1856 
1858 {
1859  if (!modeOnly) {
1860  DrawDate();
1861  DrawTrack();
1862  }
1863  osd->Flush();
1864 }
1865 
1866 // --- cSkinLCARSDisplayVolume -----------------------------------------------
1867 
1869 private:
1871  int x0, x1, x2, x3, x4, x5, x6, x7;
1872  int y0, y1;
1874  int mute;
1875 public:
1877  virtual ~cSkinLCARSDisplayVolume();
1878  virtual void SetVolume(int Current, int Total, bool Mute);
1879  virtual void Flush(void);
1880  };
1881 
1883 {
1884  const cFont *font = cFont::GetFont(fontOsd);
1885  int lineHeight = font->Height();
1886  frameColor = Theme.Color(clrVolumeFrame);
1887  mute = -1;
1888  x0 = 0;
1889  x1 = lineHeight / 2;
1890  x2 = lineHeight;
1891  x3 = x2 + Gap;
1892  x7 = cOsd::OsdWidth();
1893  x6 = x7 - lineHeight / 2;
1894  x5 = x6 - lineHeight / 2;
1895  x4 = x5 - Gap;
1896  y0 = 0;
1897  y1 = lineHeight;
1898  osd = CreateOsd(cOsd::OsdLeft(), cOsd::OsdTop() + cOsd::OsdHeight() - y1, x0, y0, x7 - 1, y1 - 1);
1899  osd->DrawRectangle(x0, y0, x7 - 1, y1 - 1, Theme.Color(clrBackground));
1900  osd->DrawRectangle(x0, y0, x1 - 1, y1 - 1, clrTransparent);
1901  osd->DrawEllipse (x0, y0, x1 - 1, y1 - 1, frameColor, 7);
1902  osd->DrawRectangle(x1, y0, x2 - 1, y1 - 1, frameColor);
1903  osd->DrawRectangle(x3, y0, x4 - 1, y1 - 1, frameColor);
1904  osd->DrawRectangle(x5, y0, x6 - 1, y1 - 1, frameColor);
1905  osd->DrawRectangle(x6, y0, x7 - 1, y1 - 1, clrTransparent);
1906  osd->DrawEllipse (x6, y0, x7 - 1, y1 - 1, frameColor, 5);
1907 }
1908 
1910 {
1911  delete osd;
1912 }
1913 
1914 void cSkinLCARSDisplayVolume::SetVolume(int Current, int Total, bool Mute)
1915 {
1916  int xl = x3 + TextSpacing;
1917  int xr = x4 - TextSpacing;
1918  int yt = y0 + TextFrame;
1919  int yb = y1 - TextFrame;
1920  if (mute != Mute) {
1921  osd->DrawRectangle(x3, y0, x4 - 1, y1 - 1, frameColor);
1922  mute = Mute;
1923  }
1924  cBitmap bm(Mute ? mute_xpm : volume_xpm);
1925  osd->DrawBitmap(xl, y0 + (y1 - y0 - bm.Height()) / 2, bm, Theme.Color(clrVolumeSymbol), frameColor);
1926  if (!Mute) {
1927  xl += bm.Width() + TextSpacing;
1928  int w = (y1 - y0) / 3;
1929  int d = TextFrame;
1930  int n = (xr - xl + d) / (w + d);
1931  int x = xr - n * (w + d);
1932  tColor Color = Theme.Color(clrVolumeBarLower);
1933  for (int i = 0; i < n; i++) {
1934  if (Total * i >= Current * n)
1935  Color = Theme.Color(clrVolumeBarUpper);
1936  osd->DrawRectangle(x, yt, x + w - 1, yb - 1, Color);
1937  x += w + d;
1938  }
1939  }
1940 }
1941 
1943 {
1944  osd->Flush();
1945 }
1946 
1947 // --- cSkinLCARSDisplayTracks -----------------------------------------------
1948 
1950 private:
1958  void SetItem(const char *Text, int Index, bool Current);
1959 public:
1960  cSkinLCARSDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks);
1961  virtual ~cSkinLCARSDisplayTracks();
1962  virtual void SetTrack(int Index, const char * const *Tracks);
1963  virtual void SetAudioChannel(int AudioChannel);
1964  virtual void Flush(void);
1965  };
1966 
1970 
1971 cSkinLCARSDisplayTracks::cSkinLCARSDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks)
1972 {
1973  const cFont *font = cFont::GetFont(fontOsd);
1974  lineHeight = font->Height();
1975  frameColor = Theme.Color(clrTrackFrameBg);
1976  currentIndex = -1;
1977  xt00 = 0;
1978  xt01 = xt00 + lineHeight / 2;
1979  xt02 = xt01 + Gap;
1980  xt03 = xt00 + 2 * lineHeight;
1981  int ItemsWidth = font->Width(Title) + xt03 - xt02;
1982  for (int i = 0; i < NumTracks; i++)
1983  ItemsWidth = max(ItemsWidth, font->Width(Tracks[i]) + 2 * TextFrame);
1984  xt04 = xt02 + ItemsWidth;
1985  xt05 = xt04 + Gap;
1986  xt06 = xt04 + lineHeight;
1987  xt07 = xt05 + lineHeight;
1988  xt08 = xt07 + lineHeight;
1989  xt09 = xt08 + Gap;
1990  xt10 = xt09 + lineHeight / 2;
1991  xt11 = xt10 + Gap;
1992  xt12 = xt11 + lineHeight;
1993  yt00 = 0;
1994  yt01 = yt00 + lineHeight;
1995  yt02 = yt01 + lineHeight;
1996  yt03 = yt02 + Gap;
1997  yt04 = yt03 + NumTracks * lineHeight + (NumTracks - 1) * Gap;
1998  yt05 = yt04 + Gap;
1999  yt06 = yt05 + lineHeight;
2000  yt07 = yt06 + lineHeight;
2001  while (yt07 > cOsd::OsdHeight()) {
2002  yt04 -= lineHeight + Gap;
2003  yt05 = yt04 + Gap;
2004  yt06 = yt05 + lineHeight;
2005  yt07 = yt06 + lineHeight;
2006  }
2008  // The upper elbow:
2009  osd->DrawRectangle(xt00, yt00, xt12 - 1, yt07 - 1, Theme.Color(clrBackground));
2011  osd->DrawEllipse (xt00, yt00, xt03 - 1, yt02 - 1, frameColor, 2);
2012  osd->DrawRectangle(xt03, yt00, xt04 - 1, yt02 - 1, frameColor);
2013  osd->DrawRectangle(xt04, yt00, xt08 - 1, yt01 - 1, frameColor);
2014  osd->DrawEllipse (xt04, yt01, xt06 - 1, yt02 - 1, frameColor, -2);
2015  osd->DrawRectangle(xt09, yt00, xt10 - 1, yt01 - 1, frameColor);
2016  osd->DrawRectangle(xt11, yt00, xt11 + lineHeight / 2 - 1, yt01 - 1, frameColor);
2017  osd->DrawRectangle(xt11 + lineHeight / 2, yt00, xt12 - 1, yt00 + lineHeight / 2 - 1, clrTransparent);
2018  osd->DrawEllipse (xt11 + lineHeight / 2, yt00, xt12 - 1, yt01 - 1, frameColor, 5);
2019  osd->DrawText(xt03, yt00, Title, Theme.Color(clrTrackFrameFg), frameColor, font, xt04 - xt03, 0, taTop | taRight);
2020  // The items:
2021  for (int i = 0; i < NumTracks; i++)
2022  SetItem(Tracks[i], i, false);
2023  // The lower elbow:
2024  osd->DrawRectangle(xt00, yt05, xt03 - 1, yt07 - 1, clrTransparent);
2025  osd->DrawEllipse (xt00, yt05, xt03 - 1, yt07 - 1, frameColor, 3);
2026  osd->DrawRectangle(xt03, yt05, xt04 - 1, yt07 - 1, frameColor);
2027  osd->DrawRectangle(xt04, yt06, xt08 - 1, yt07 - 1, frameColor);
2028  osd->DrawEllipse (xt04, yt05, xt06 - 1, yt06 - 1, frameColor, -3);
2029  osd->DrawRectangle(xt09, yt06, xt10 - 1, yt07 - 1, frameColor);
2030  osd->DrawRectangle(xt11, yt06, xt11 + lineHeight / 2 - 1, yt07 - 1, frameColor);
2031  osd->DrawRectangle(xt11 + lineHeight / 2, yt06 + lineHeight / 2, xt12 - 1, yt07 - 1, clrTransparent);
2032  osd->DrawEllipse (xt11 + lineHeight / 2, yt06, xt12 - 1, yt07 - 1, frameColor, 5);
2033 }
2034 
2036 {
2037  delete osd;
2038 }
2039 
2040 void cSkinLCARSDisplayTracks::SetItem(const char *Text, int Index, bool Current)
2041 {
2042  int y0 = yt03 + Index * (lineHeight + Gap);
2043  int y1 = y0 + lineHeight;
2044  if (y1 > yt04)
2045  return;
2046  tColor ColorFg, ColorBg;
2047  if (Current) {
2048  ColorFg = Theme.Color(clrTrackItemCurrentFg);
2049  ColorBg = Theme.Color(clrTrackItemCurrentBg);
2050  osd->DrawRectangle(xt00, y0, xt01 - 1, y1 - 1, frameColor);
2051  osd->DrawRectangle(xt02, y0, xt04 - 1, y1 - 1, ColorBg);
2052  osd->DrawRectangle(xt05, y0, xt05 + lineHeight / 2 - 1, y1 - 1, ColorBg);
2053  osd->DrawEllipse (xt05 + lineHeight / 2, y0, xt07 - 1, y1 - 1, ColorBg, 5);
2054  currentIndex = Index;
2055  }
2056  else {
2057  ColorFg = Theme.Color(clrTrackItemFg);
2058  ColorBg = Theme.Color(clrTrackItemBg);
2059  osd->DrawRectangle(xt00, y0, xt01 - 1, y1 - 1, frameColor);
2060  osd->DrawRectangle(xt02, y0, xt04 - 1, y1 - 1, ColorBg);
2061  if (currentIndex == Index)
2062  osd->DrawRectangle(xt05, y0, xt07 - 1, y1 - 1, Theme.Color(clrBackground));
2063  }
2064  const cFont *font = cFont::GetFont(fontOsd);
2065  osd->DrawText(xt02, y0, Text, ColorFg, ColorBg, font, xt04 - xt02, y1 - y0, taTop | taLeft | taBorder);
2066 }
2067 
2068 void cSkinLCARSDisplayTracks::SetTrack(int Index, const char * const *Tracks)
2069 {
2070  if (currentIndex >= 0)
2071  SetItem(Tracks[currentIndex], currentIndex, false);
2072  SetItem(Tracks[Index], Index, true);
2073 }
2074 
2076 {
2077  cBitmap *bm = NULL;
2078  switch (AudioChannel) {
2079  case 0: bm = &bmAudioStereo; break;
2080  case 1: bm = &bmAudioLeft; break;
2081  case 2: bm = &bmAudioRight; break;
2082  default: ;
2083  }
2084  if (bm)
2085  osd->DrawBitmap(xt04 - bm->Width(), (yt06 + yt07 - bm->Height()) / 2, *bm, Theme.Color(clrTrackFrameFg), frameColor);
2086  else
2087  osd->DrawRectangle(xt03, yt06, xt04 - 1, yt07 - 1, frameColor);
2088 }
2089 
2091 {
2092  osd->Flush();
2093 }
2094 
2095 // --- cSkinLCARSDisplayMessage ----------------------------------------------
2096 
2098 private:
2100  int x0, x1, x2, x3, x4, x5, x6, x7;
2101  int y0, y1;
2102 public:
2104  virtual ~cSkinLCARSDisplayMessage();
2105  virtual void SetMessage(eMessageType Type, const char *Text);
2106  virtual void Flush(void);
2107  };
2108 
2110 {
2111  const cFont *font = cFont::GetFont(fontOsd);
2112  int lineHeight = font->Height();
2113  x0 = 0;
2114  x1 = lineHeight / 2;
2115  x2 = lineHeight;
2116  x3 = x2 + Gap;
2117  x7 = cOsd::OsdWidth();
2118  x6 = x7 - lineHeight / 2;
2119  x5 = x6 - lineHeight / 2;
2120  x4 = x5 - Gap;
2121  y0 = 0;
2122  y1 = lineHeight;
2123  osd = CreateOsd(cOsd::OsdLeft(), cOsd::OsdTop() + cOsd::OsdHeight() - y1, x0, y0, x7 - 1, y1 - 1);
2124 }
2125 
2127 {
2128  delete osd;
2129 }
2130 
2132 {
2133  tColor ColorFg = Theme.Color(clrMessageStatusFg + 2 * Type);
2134  tColor ColorBg = Theme.Color(clrMessageStatusBg + 2 * Type);
2135  osd->DrawRectangle(x0, y0, x7 - 1, y1 - 1, Theme.Color(clrBackground));
2136  osd->DrawRectangle(x0, y0, x1 - 1, y1 - 1, clrTransparent);
2137  osd->DrawEllipse (x0, y0, x1 - 1, y1 - 1, ColorBg, 7);
2138  osd->DrawRectangle(x1, y0, x2 - 1, y1 - 1, ColorBg);
2139  osd->DrawText(x3, y0, Text, ColorFg, ColorBg, cFont::GetFont(fontSml), x4 - x3, y1 - y0, taCenter);
2140  osd->DrawRectangle(x5, y0, x6 - 1, y1 - 1, ColorBg);
2141  osd->DrawRectangle(x6, y0, x7 - 1, y1 - 1, clrTransparent);
2142  osd->DrawEllipse (x6, y0, x7 - 1, y1 - 1, ColorBg, 5);
2143 }
2144 
2146 {
2147  osd->Flush();
2148 }
2149 
2150 // --- cSkinLCARS ------------------------------------------------------------
2151 
2153 :cSkin("lcars", &::Theme)
2154 {
2155 }
2156 
2157 const char *cSkinLCARS::Description(void)
2158 {
2159  return "LCARS";
2160 }
2161 
2163 {
2164  return new cSkinLCARSDisplayChannel(WithInfo);
2165 }
2166 
2168 {
2169  return new cSkinLCARSDisplayMenu;
2170 }
2171 
2173 {
2174  return new cSkinLCARSDisplayReplay(ModeOnly);
2175 }
2176 
2178 {
2179  return new cSkinLCARSDisplayVolume;
2180 }
2181 
2182 cSkinDisplayTracks *cSkinLCARS::DisplayTracks(const char *Title, int NumTracks, const char * const *Tracks)
2183 {
2184  return new cSkinLCARSDisplayTracks(Title, NumTracks, Tracks);
2185 }
2186 
2188 {
2189  return new cSkinLCARSDisplayMessage;
2190 }
2191