11 #include <vdr/plugin.h> 12 #include <vdr/skins.h> 13 #include <vdr/videodir.h> 23 virtual int Width(
void)
const {
return 1; }
24 virtual int Width(uint c)
const {
return 1; }
26 virtual int Height(
void)
const {
return 1; }
35 #define clrBackground COLOR_BLACK 36 #define clrTransparent clrBackground 37 #define clrBlack clrBackground 38 #define clrRed COLOR_RED 39 #define clrGreen COLOR_GREEN 40 #define clrYellow COLOR_YELLOW 41 #define clrBlue COLOR_BLUE 42 #define clrMagenta COLOR_MAGENTA 43 #define clrCyan COLOR_CYAN 44 #define clrWhite COLOR_WHITE 64 enum { MaxColorPairs = 16 };
65 int colorPairs[MaxColorPairs];
70 virtual void SaveRegion(
int x1,
int y1,
int x2,
int y2);
71 virtual void RestoreRegion(
void);
73 virtual void DrawRectangle(
int x1,
int y1,
int x2,
int y2,
tColor Color);
74 virtual void Flush(
void);
84 leaveok(stdscr,
true);
102 int color = (colorBg << 16) | colorFg | 0x80000000;
106 init_pair(i + 1, colorFg, colorBg);
108 wattrset(
window, COLOR_PAIR(i + 1));
112 wattrset(
window, COLOR_PAIR(i + 1));
124 savedRegion = newwin(y2 - y1 + 1, x2 - x1 + 1, y1, x1);
143 int w = Font->
Width(s);
145 if (Width || Height) {
146 int cw = Width ? Width : w;
147 int ch = Height ? Height : h;
150 if ((Alignment &
taLeft) != 0)
152 else if ((Alignment &
taRight) != 0) {
158 x += (Width - w) / 2;
162 if ((Alignment &
taTop) != 0)
164 else if ((Alignment &
taBottom) != 0) {
170 y += (Height - h) / 2;
182 for (
int y = y1; y <= y2; y++) {
184 whline(
window,
' ', x2 - x1 + 1);
204 virtual void SetChannel(
const cChannel *Channel,
int Number);
205 virtual void SetEvents(
const cEvent *Present,
const cEvent *Following);
206 virtual void SetMessage(
eMessageType Type,
const char *Text);
207 virtual void Flush(
void);
212 int Lines = WithInfo ? 5 : 1;
215 timeWidth = strlen(
"00:00");
232 osd->DrawRectangle(0, 1, timeWidth - 1, 4,
clrRed);
234 for (
int i = 0; i < 2; i++) {
235 const cEvent *e = !i ? Present : Following;
252 osd->RestoreRegion();
273 void DrawTitle(
void);
274 void DrawScrollbar(
int Total,
int Offset,
int Shown,
int Top,
int Height,
bool CanScrollUp,
bool CanScrollDown);
275 void SetTextScrollbar(
void);
279 virtual void Scroll(
bool Up,
bool Page);
280 virtual int MaxItems(
void);
281 virtual void Clear(
void);
282 virtual void SetTitle(
const char *Title);
283 virtual void SetButtons(
const char *Red,
const char *Green = NULL,
const char *Yellow = NULL,
const char *Blue = NULL);
284 virtual void SetMessage(
eMessageType Type,
const char *Text);
285 virtual void SetItem(
const char *Text,
int Index,
bool Current,
bool Selectable);
286 virtual void SetScrollbar(
int Total,
int Offset);
287 virtual void SetEvent(
const cEvent *Event);
288 virtual void SetRecording(
const cRecording *Recording);
289 virtual void SetText(
const char *Text,
bool FixedFont);
291 virtual void Flush(
void);
297 lastDiskUsageState = -1;
308 if (Total > 0 && Total > Shown) {
313 int th =
max(
int((sb - st) *
double(Shown) / Total + 0.5), 1);
314 int tt =
min(
int(st + (sb - st) *
double(Offset) / Total + 0.5), sb - th);
315 int tb =
min(tt + th, sb);
317 osd->DrawRectangle(xl, st, xl, sb - 1,
clrWhite);
318 osd->DrawRectangle(xl, tt, xl, tb - 1,
clrCyan);
324 if (textScroller.CanScroll())
325 DrawScrollbar(textScroller.Total(), textScroller.Offset(), textScroller.Shown(), textScroller.Top(), textScroller.Height(), textScroller.CanScrollUp(), textScroller.CanScrollDown());
342 textScroller.Reset();
383 int ColorFg, ColorBg;
392 for (
int i = 0; i < MaxTabs; i++) {
393 const char *s = GetTabbedText(Text, i);
395 int xt = Tab(i) / AvgCharWidth();
396 osd->DrawText(xt, y, s, ColorFg, ColorBg, &Font,
ScOsdWidth - 2 - xt);
401 SetEditableWidth(
ScOsdWidth - 2 - Tab(1) / AvgCharWidth());
406 DrawScrollbar(Total, Offset, MaxItems(), 2, MaxItems(), Offset > 0, Offset + MaxItems() < Total);
433 for (
int i = 0; Event->
Contents(i); i++) {
462 const char *Title = Info->
Title();
464 Title = Recording->
Name();
509 virtual void SetTitle(
const char *Title);
510 virtual void SetMode(
bool Play,
bool Forward,
int Speed);
511 virtual void SetProgress(
int Current,
int Total);
512 virtual void SetCurrent(
const char *Current);
513 virtual void SetTotal(
const char *Total);
514 virtual void SetJump(
const char *Jump);
515 virtual void SetMessage(
eMessageType Type,
const char *Text);
516 virtual void Flush(
void);
540 if (Speed == -1) Mode = Play ?
" > " :
" || ";
541 else if (Play) Mode = Forward ?
" X>> " :
" <<X ";
542 else Mode = Forward ?
" X|> " :
" <|X ";
545 char *p = strchr(buf,
'X');
547 *p = Speed > 0 ?
'1' + Speed - 1 :
' ';
554 int p = Total > 0 ?
ScOsdWidth * Current / Total : 0;
555 osd->DrawRectangle(0, 1, p, 1,
clrGreen);
582 osd->RestoreRegion();
600 virtual void SetVolume(
int Current,
int Total,
bool Mute);
601 virtual void Flush(
void);
622 const char *Prompt =
tr(
"Volume ");
626 osd->DrawRectangle(l, 0, l + p - 1, 0,
clrGreen);
643 void SetItem(
const char *Text,
int Index,
bool Current);
647 virtual void SetTrack(
int Index,
const char *
const *Tracks);
649 virtual void Flush(
void);
655 itemsWidth = Font.
Width(Title);
656 for (
int i = 0; i < NumTracks; i++)
657 itemsWidth =
max(itemsWidth, Font.
Width(Tracks[i]));
662 for (
int i = 0; i < NumTracks; i++)
663 SetItem(Tracks[i], i,
false);
674 int ColorFg, ColorBg;
678 currentIndex = Index;
684 osd->DrawText(0, y, Text, ColorFg, ColorBg, &Font, itemsWidth);
689 if (currentIndex >= 0)
690 SetItem(Tracks[currentIndex], currentIndex,
false);
691 SetItem(Tracks[Index], Index,
true);
707 virtual void SetMessage(
eMessageType Type,
const char *Text);
708 virtual void Flush(
void);
736 virtual const char *Description(
void);
741 virtual cSkinDisplayTracks *DisplayTracks(
const char *Title,
int NumTracks,
const char *
const *Tracks);
752 return tr(
"Text mode");
795 virtual const char *CommandLineHelp(
void);
796 virtual bool ProcessArgs(
int argc,
char *argv[]);
797 virtual bool Initialize(
void);
798 virtual bool Start(
void);
799 virtual void Housekeeping(
void);
803 virtual bool SetupParse(
const char *
Name,
const char *Value);
834 WINDOW *w = initscr();
837 getmaxyx(w,maxy,maxx);
838 getbegyx(w,begy,begx);
virtual cSkinDisplayVolume * DisplayVolume(void)
Creates and returns a new object for displaying the current volume.
virtual void SetTrack(int Index, const char *const *Tracks)
< This class implements the track display.
virtual void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width=0, int Height=0, int Alignment=taDefault)
Draws the given string at coordinates (x, y) with the given foreground and background color and font...
VDRPLUGINCREATOR(cPluginSkinCurses)
cCursesOsd(int Left, int Top)
virtual bool SetupParse(const char *Name, const char *Value)
virtual ~cPluginSkinCurses()
static cString String(void)
Returns a localized string of the form "Disk nn% - hh:mm free".
const cRecordingInfo * Info(void) const
const char * ShortText(void) const
virtual void DrawText(cPixmap *Pixmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const
static const char * VERSION
static const char * ContentToString(uchar Content)
cString GetParentalRatingString(void) const
static cString sprintf(const char *fmt,...) __attribute__((format(printf
void Set(cOsd *Osd, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg)
virtual void Flush(void)
Actually draws the OSD display to the output device.
virtual const char * Description(void)
Returns a user visible, single line description of this skin, which may consist of arbitrary text and...
uchar Contents(int i=0) const
virtual void SetChannel(const cChannel *Channel, int Number)
Sets the current channel to Channel.
cSkinCursesDisplayReplay(bool ModeOnly)
virtual const char * CommandLineHelp(void)
time_t StartTime(void) const
virtual void Flush(void)
Actually draws the OSD display to the output device.
cString ChannelString(const cChannel *Channel, int Number)
virtual cSkinDisplayMenu * DisplayMenu(void)
Creates and returns a new object for displaying a menu.
virtual void SetTitle(const char *Title)
Sets the title of the recording.
virtual int Width(void) const =0
Returns the original character width as requested when the font was created, or 0 if the default widt...
virtual void Flush(void)
Actually draws the OSD display to the output device.
virtual bool ProcessArgs(int argc, char *argv[])
virtual ~cSkinCursesDisplayVolume()
virtual cOsdObject * MainMenuAction(void)
virtual cMenuSetupPage * SetupMenu(void)
void SetColor(int colorFg, int colorBg=clrBackground)
virtual const char * MainMenuEntry(void)
virtual void DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const
Draws the given text into the Bitmap at position (x, y) with the given colors.
virtual const char * Version(void)
cString GetVpsString(void) const
virtual void Flush(void)
Actually draws the OSD display to the output device.
virtual const char * Description(void)
virtual void SaveRegion(int x1, int y1, int x2, int y2)
Saves the region defined by the given coordinates for later restoration through RestoreRegion().
int ParentalRating(void) const
virtual void SetCurrent(const char *Current)
Sets the current position within the recording, as a user readable string if the form "h:mm:ss...
virtual cSkinDisplayChannel * DisplayChannel(bool WithInfo)
Creates and returns a new object for displaying the current channel.
virtual void SetMessage(eMessageType Type, const char *Text)
< This class implements a simple message display.
virtual bool Initialize(void)
virtual int Height(void) const
Returns the height of this font in pixel (all characters have the same height).
cSkinCursesDisplayTracks(const char *Title, int NumTracks, const char *const *Tracks)
virtual void SetAudioChannel(int AudioChannel)
Sets the audio channel indicator.
virtual void Flush(void)
Actually draws the OSD display to the output device.
cSkinCursesDisplayChannel(bool WithInfo)
virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color)
Draws a filled rectangle defined by the upper left (x1, y1) and lower right (x2, y2) corners with the...
static bool HasChanged(int &State)
Returns true if the usage of the video disk space has changed since the last call to this function wi...
virtual ~cSkinCursesDisplayReplay()
static const cCursesFont Font
virtual int Width(void) const
Returns the original character width as requested when the font was created, or 0 if the default widt...
The cOsd class is the interface to the "On Screen Display".
static const char * DESCRIPTION
void SetItem(const char *Text, int Index, bool Current)
virtual ~cSkinCursesDisplayChannel()
cSkinCursesDisplayVolume(void)
virtual void Housekeeping(void)
const char * Title(void) const
virtual void RestoreRegion(void)
Restores the region previously saved by a call to SaveRegion().
cString GetEndTimeString(void) const
virtual void SetMessage(eMessageType Type, const char *Text)
Sets a one line message Text, with the given Type.
virtual void SetEvents(const cEvent *Present, const cEvent *Following)
Sets the Present and Following EPG events.
virtual void SetMessage(eMessageType Type, const char *Text)
Sets a one line message Text, with the given Type.
virtual void SetTotal(const char *Total)
Sets the total length of the recording, as a user readable string if the form "h:mm:ss".
virtual int Width(uint c) const
Returns the width of the given character in pixel.
virtual void SetJump(const char *Jump)
Sets the prompt that allows the user to enter a jump point.
virtual void SetVolume(int Current, int Total, bool Mute)
< This class implements the volume/mute display.
virtual int Width(const char *s) const
Returns the width of the given string in pixel.
cSkinCursesDisplayMessage(void)
cString GetTimeString(void) const
const cEvent * GetEvent(void) const
const char * Description(void) const
const char * Name(void) const
Returns the full name of the recording (without the video directory).
virtual void SetMode(bool Play, bool Forward, int Speed)
Sets the current replay mode, which can be used to display some indicator, showing the user whether w...
const char * Title(void) const
const char * Description(void) const
virtual void Flush(void)
Actually commits all data to the OSD hardware.
virtual int Height(void) const =0
Returns the height of this font in pixel (all characters have the same height).
const char * ChannelName(void) const
virtual void SetProgress(int Current, int Total)
This function will be called whenever the position in or the total length of the recording has change...
int colorPairs[MaxColorPairs]
cString GetDateString(void) const
const char * ShortText(void) const
static const char * MAINMENUENTRY
bool SetCurrent(const char *Name=NULL)
Sets the current skin to the one indicated by name.
virtual cSkinDisplayMessage * DisplayMessage(void)
Creates and returns a new object for displaying a message.
virtual cSkinDisplayTracks * DisplayTracks(const char *Title, int NumTracks, const char *const *Tracks)
Creates and returns a new object for displaying the available tracks.
virtual ~cSkinCursesDisplayTracks()
virtual ~cSkinCursesDisplayMessage()
virtual cSkinDisplayReplay * DisplayReplay(bool ModeOnly)
Creates and returns a new object for displaying replay progress.