diff options
Diffstat (limited to 'PLUGINS/src/skincurses')
-rw-r--r-- | PLUGINS/src/skincurses/HISTORY | 5 | ||||
-rwxr-xr-x | PLUGINS/src/skincurses/po/it_IT.po | 28 | ||||
-rw-r--r-- | PLUGINS/src/skincurses/skincurses.c | 53 |
3 files changed, 65 insertions, 21 deletions
diff --git a/PLUGINS/src/skincurses/HISTORY b/PLUGINS/src/skincurses/HISTORY index e5bfa49..45b79bb 100644 --- a/PLUGINS/src/skincurses/HISTORY +++ b/PLUGINS/src/skincurses/HISTORY @@ -65,3 +65,8 @@ VDR Plugin 'skincurses' Revision History 2008-01-19: - Updated the Makefile of the skincurses plugin (thanks to Rolf Ahrenberg). + +2008-02-15: Version 0.1.5 + +- Using cString::sprintf() instead of asprintf(). +- Implemented cSkinCursesDisplayMenu::SetScrollbar(). diff --git a/PLUGINS/src/skincurses/po/it_IT.po b/PLUGINS/src/skincurses/po/it_IT.po new file mode 100755 index 0000000..8dc4556 --- /dev/null +++ b/PLUGINS/src/skincurses/po/it_IT.po @@ -0,0 +1,28 @@ +# VDR plugin language source file. +# Copyright (C) 2007 Klaus Schmidinger <kls@cadsoft.de> +# This file is distributed under the same license as the VDR package. +# Diego Pierotto <vdr-italian@tiscali.it>, 2008 +# +msgid "" +msgstr "" +"Project-Id-Version: VDR 1.5.7\n" +"Report-Msgid-Bugs-To: <vdr-bugs@cadsoft.de>\n" +"POT-Creation-Date: 2007-08-15 16:04+0200\n" +"PO-Revision-Date: 2008-01-27 20:35+0100\n" +"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" +"Language-Team: <vdr@linuxtv.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "A text only skin" +msgstr "Una interfaccia solo testo" + +msgid "Key$Mute" +msgstr "Muto" + +msgid "Volume " +msgstr "Volume " + +msgid "Text mode" +msgstr "Modalità testo" diff --git a/PLUGINS/src/skincurses/skincurses.c b/PLUGINS/src/skincurses/skincurses.c index b9a4fc0..2f0bea9 100644 --- a/PLUGINS/src/skincurses/skincurses.c +++ b/PLUGINS/src/skincurses/skincurses.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: skincurses.c 1.18 2007/08/26 20:16:59 kls Exp $ + * $Id: skincurses.c 1.20 2008/02/17 14:28:19 kls Exp $ */ #include <ncurses.h> @@ -11,7 +11,7 @@ #include <vdr/plugin.h> #include <vdr/skins.h> -static const char *VERSION = "0.1.4"; +static const char *VERSION = "0.1.5"; static const char *DESCRIPTION = trNOOP("A text only skin"); static const char *MAINMENUENTRY = NULL; @@ -166,7 +166,7 @@ void cCursesOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Co } SetColor(ColorFg, ColorBg); wmove(window, y, x); // ncurses wants 'y' before 'x'! - waddnstr(window, s, ScOsdWidth - x); + waddnstr(window, s, Width ? Width : ScOsdWidth - x); } void cCursesOsd::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color) @@ -261,7 +261,8 @@ void cSkinCursesDisplayChannel::Flush(void) class cSkinCursesDisplayMenu : public cSkinDisplayMenu { private: cOsd *osd; - void SetScrollbar(void); + void DrawScrollbar(int Total, int Offset, int Shown, int Top, int Height, bool CanScrollUp, bool CanScrollDown); + void SetTextScrollbar(void); public: cSkinCursesDisplayMenu(void); virtual ~cSkinCursesDisplayMenu(); @@ -272,6 +273,7 @@ public: 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); @@ -290,25 +292,31 @@ cSkinCursesDisplayMenu::~cSkinCursesDisplayMenu() delete osd; } -void cSkinCursesDisplayMenu::SetScrollbar(void) +void cSkinCursesDisplayMenu::DrawScrollbar(int Total, int Offset, int Shown, int Top, int Height, bool CanScrollUp, bool CanScrollDown) { - if (textScroller.CanScroll()) { - int yt = textScroller.Top(); - int yb = yt + textScroller.Height() - 1; + if (Total > 0 && Total > Shown) { + int yt = Top; + int yb = yt + Height - 1; int st = yt; int sb = yb; - int tt = st + (sb - st) * textScroller.Offset() / textScroller.Total(); - int tb = tt + (sb - st) * textScroller.Shown() / textScroller.Total(); + int tt = st + (sb - st + 1) * Offset / Total; + int tb = tt + (sb - st + 1) * Shown / Total; int xl = ScOsdWidth - 1; - osd->DrawRectangle(xl, st, xl, sb, clrCyan); - osd->DrawRectangle(xl, tt, xl, tb, clrWhite); + osd->DrawRectangle(xl, st, xl, sb, clrWhite); + osd->DrawRectangle(xl, tt, xl, tb, clrCyan); } } +void cSkinCursesDisplayMenu::SetTextScrollbar(void) +{ + if (textScroller.CanScroll()) + DrawScrollbar(textScroller.Total(), textScroller.Offset(), textScroller.Shown(), textScroller.Top(), textScroller.Height(), textScroller.CanScrollUp(), textScroller.CanScrollDown()); +} + void cSkinCursesDisplayMenu::Scroll(bool Up, bool Page) { cSkinDisplayMenu::Scroll(Up, Page); - SetScrollbar(); + SetTextScrollbar(); } int cSkinCursesDisplayMenu::MaxItems(void) @@ -366,12 +374,17 @@ void cSkinCursesDisplayMenu::SetItem(const char *Text, int Index, bool Current, const char *s = GetTabbedText(Text, i); if (s) { int xt = Tab(i) / 12;// Tab() is in "pixel" - see also skins.c!!! - osd->DrawText(xt, y, s, ColorFg, ColorBg, &Font, ScOsdWidth - xt); + osd->DrawText(xt, y, s, ColorFg, ColorBg, &Font, ScOsdWidth - 2 - xt); } if (!Tab(i + 1)) break; } - SetEditableWidth(ScOsdWidth - Tab(1) / 12); // Tab() is in "pixel" - see also skins.c!!! + SetEditableWidth(ScOsdWidth - 2 - Tab(1) / 12); // Tab() is in "pixel" - see also skins.c!!! +} + +void cSkinCursesDisplayMenu::SetScrollbar(int Total, int Offset) +{ + DrawScrollbar(Total, Offset, MaxItems(), 2, MaxItems(), Offset > 0, Offset + MaxItems() < Total); } void cSkinCursesDisplayMenu::SetEvent(const cEvent *Event) @@ -384,10 +397,8 @@ void cSkinCursesDisplayMenu::SetEvent(const cEvent *Event) snprintf(t, sizeof(t), "%s %s - %s", *Event->GetDateString(), *Event->GetTimeString(), *Event->GetEndTimeString()); ts.Set(osd, 0, y, ScOsdWidth, ScOsdHeight - y - 2, t, &Font, clrYellow, clrBackground); if (Event->Vps() && Event->Vps() != Event->StartTime()) { - char *buffer; - asprintf(&buffer, " VPS: %s", *Event->GetVpsString()); + cString buffer = cString::sprintf(" VPS: %s", *Event->GetVpsString()); osd->DrawText(ScOsdWidth - Utf8StrLen(buffer), y, buffer, clrBlack, clrYellow, &Font); - free(buffer); } y += ts.Height(); y += 1; @@ -400,7 +411,7 @@ void cSkinCursesDisplayMenu::SetEvent(const cEvent *Event) y += 1; if (!isempty(Event->Description())) { textScroller.Set(osd, 0, y, ScOsdWidth - 2, ScOsdHeight - y - 2, Event->Description(), &Font, clrCyan, clrBackground); - SetScrollbar(); + SetTextScrollbar(); } } @@ -428,14 +439,14 @@ void cSkinCursesDisplayMenu::SetRecording(const cRecording *Recording) y += 1; if (!isempty(Info->Description())) { textScroller.Set(osd, 0, y, ScOsdWidth - 2, ScOsdHeight - y - 2, Info->Description(), &Font, clrCyan, clrBackground); - SetScrollbar(); + SetTextScrollbar(); } } void cSkinCursesDisplayMenu::SetText(const char *Text, bool FixedFont) { textScroller.Set(osd, 0, 2, ScOsdWidth - 2, ScOsdHeight - 4, Text, &Font, clrWhite, clrBackground); - SetScrollbar(); + SetTextScrollbar(); } void cSkinCursesDisplayMenu::Flush(void) |