diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | Docs/Reference.txt | 4 | ||||
-rw-r--r-- | Docs/Tutorial.txt | 2 | ||||
-rw-r--r-- | HISTORY | 169 | ||||
-rw-r--r-- | Makefile | 69 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | README.de | 60 | ||||
-rw-r--r-- | cache.h | 1 | ||||
-rw-r--r-- | common.c | 161 | ||||
-rw-r--r-- | common.h | 40 | ||||
-rw-r--r-- | display.c | 232 | ||||
-rw-r--r-- | display.h | 6 | ||||
-rw-r--r-- | font.c | 5 | ||||
-rw-r--r-- | graphtft/font.c | 16 | ||||
-rw-r--r-- | graphtft/font.h | 4 | ||||
-rw-r--r-- | i18n.c | 41 | ||||
-rw-r--r-- | i18n.h | 11 | ||||
-rw-r--r-- | loader.c | 4 | ||||
-rw-r--r-- | menu.c | 16 | ||||
-rw-r--r-- | po/de_DE.po | 31 | ||||
-rw-r--r-- | po/fi_FI.po | 31 | ||||
-rw-r--r-- | po/it_IT.po | 35 | ||||
-rw-r--r-- | render.c | 64 | ||||
-rw-r--r-- | render.h | 14 | ||||
-rw-r--r-- | setup.c | 1 | ||||
-rw-r--r-- | setup.h | 2 | ||||
-rw-r--r-- | status.c | 220 | ||||
-rw-r--r-- | status.h | 34 | ||||
-rw-r--r-- | text2skin.c | 10 | ||||
-rw-r--r-- | xml/object.c | 7 | ||||
-rw-r--r-- | xml/string.c | 3 | ||||
-rw-r--r-- | xml/string.h | 4 | ||||
-rw-r--r-- | xml/type.h | 1 | ||||
-rw-r--r-- | xml/xml.c | 2 |
34 files changed, 694 insertions, 617 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c915306 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.dependencies +*.o +*.so* +*.pot +*.tgz +*~ +debian diff --git a/Docs/Reference.txt b/Docs/Reference.txt index cc2ea2a..eca00f8 100644 --- a/Docs/Reference.txt +++ b/Docs/Reference.txt @@ -821,7 +821,7 @@ True, if one parameter is true. --------- True, if both parameters are true. - equal('Kanäle', trans('Channels')) + equal('Kanäle', trans('Channels')) 3.5 ne --------- @@ -868,7 +868,7 @@ Returns the parameter, if the file exists in the skin directory. --------- Rreturn the translation (i18n) of the parameter, false, if no translation is found. - equal('Kanäle', trans('Channels')) + equal('Kanäle', trans('Channels')) 4. Attributes diff --git a/Docs/Tutorial.txt b/Docs/Tutorial.txt index 1b95588..b173824 100644 --- a/Docs/Tutorial.txt +++ b/Docs/Tutorial.txt @@ -231,7 +231,7 @@ The same applies to "{MenuTitle:clean}" if a logo for the current menu page is w * file - returns the parameter, if the file exists in the skin directory (e.g. "file('logos/{ChannelName}.png')" ) * trans - return the translation (i18n) of the parameter, false, if no translation is found - (e.g. "equal('Kanäle', trans('Channels'))" ) + (e.g. "equal('Kanäle', trans('Channels'))" ) Normally strings in function are quoted in quotation marks, only if the simply consists of a token the quotation marks can be omitted. (e.g. "not({MenuText})" instead of "not('{MenuText}')" ) @@ -1,112 +1,77 @@ VDR Plugin 'text2skin' Revision History --------------------------------------- -2006-12-03: Version 1.1-cvs_ext-0.10 (vdr-text2skin-1.1-cvs_ext-0.10.diff) - -- set EditableWidth. This is important for plugins like 'rotor' or - 'extrecmenu' -- now setting the locale setting LC_TIME according to the language-selection - in VDR - -2006-11-19: Version 1.1-cvs_ext-0.9a (vdr-text2skin-1.1-cvs_ext-0.9a.diff) - -- added APIVERSION to the Makefile for vdr-1.3.47 -- fixed possible buffer overflow in xml reading (updated to cvs-version - of text2skin) - -2006-11-19: Version 1.1-cvs_ext-0.9 (vdr-text2skin-1.1-cvs_ext-0.9.diff) - -- added a test-feature to search for reruns of a program and add the - information to the extended epg-info (trigger DEVELOPMENT_FEATURES). - This uses a service-interface of the epgsearch-plugin - "Epgsearch-searchresults-v1.0" -- the timer-conflicts are now checked with epgsearch (service-interface - "Epgsearch-lastconflictinfo-v1.0", as it works more reliable and is - supported by the plugin author -- the extended epg-info and the recording-info are extended by AUX-Infos - (configurable) - there is also an option to strip known tags -- the tab-widths are scaled for taking into account that different TT-Fonts - have a different width than the default font from VDR -- added tokens for signal-info: - FrontendSTR, FrontendSNR, FrontendHasLock, FrontendHasSignal -- changed token TimerConflict to TimerConflicts -- added token PresentEventID for EPG-images -- added tokens for recordings: - RecordingFilename, RecordingPriority, RecordingLifetime -- removed Text2skin.diff from the rotor-plugin - -2006-02-04: Version 1.1-cvs_ext-0.8 (vdr-text2skin-1.1-cvs_ext-0.8.diff) - -- added a configuration option for showing the scrollbar in the menus and - finished implementation - -2006-02-04: Version 1.1-cvs_ext-0.7 (vdr-text2skin-1.1-cvs_ext-0.7.diff) - -- changed the routines to determine the next timers -- added the possibility to have a scrollbar in every menu - not fully - implemented yet (to position in menu-lists is not necessarily correct, - if there are more items with the same osd-text) - -2006-01-10: Version 1.1-cvs_ext-0.6 (vdr-text2skin-1.1-cvs_ext-0.6.diff) - -- updated to cvs-version of text2skin -- since vdr-1.3.38 it is possible to exactly identify the replayed - recording, so the replay-tokens work now -- switched the search-order for the fonts to priorise the skin-folder - (this avoids error-messages in the log) - -2006-01-07: Version 1.1-cvs_ext-0.5 (vdr-text2skin-1.1-cvs_ext-0.5.diff) - -- modifications to compile with vdr-versions >= 1.3.18 -- added tokens: - OsdWidth, OsdHeight -- activating the token ReplayVideoAR - -2005-12-18: Version 1.1-cvs_ext-0.4 (vdr-text2skin-1.1-cvs_ext-0.4.diff) - -- modified the way, the current replayed recording is determined (status.c: - cText2SkinStatus::Replaying) - There remains a problem that recordings with the same name cannot be - distinguished, so information optained from mReplay are not necessarily - correct (all the ones added in vdr-text2skin-1.1-cvs_ext-0.2.diff) - -2005-12-11: Version 1.1-cvs_ext-0.3 (vdr-text2skin-1.1-cvs_ext-0.3.diff) - -- added recording-tokens: - RecordingLength, RecordingCuttedLength - -2005-11-19: Version 1.1-cvs_ext-0.2 (vdr-text2skin-1.1-cvs_ext-0.2.diff) - -- removed the previously introduced tokens NextTimerName, NextTimerStart, - NextTimerChannel, CurrentRecordingsCount and added tokens for the next - 3 timers: CurrentEventsTitle[123], CurrentEventsStartDateTime[123], - CurrentEventsStopDateTime[123], CurrentEventsChannelNumber[123], - CurrentEventsChannelName[123], CurrentEventsIsRecording[123] -- added audio- and video-tokens: - PresentLanguageCode, PresentLanguageDescription, PresentVideoAR and - implemented the missing code for the Language-token -- added tokens for replay: - ReplayName, ReplayDateTime, ReplayShortText, ReplayDescription, - ReplayLanguageCode, ReplayLanguageDescription, ReplayVideoAR - (not activated yet) -- additional recording-tokens: - RecordingVideoAR, RecordingSize -- added a reset for scrolling text (configurable) -- included Text2skin.diff from the rotor-plugin - -2005-10-22: Version 1.1-cvs_ext-0.1 (vdr-text2skin-1.1-cvs_ext-0.1.diff) - -- added several tokens: - NextTimerName, NextTimerStart, NextTimerChannel, TimerConflict, - CurrentRecordingsCount, using the service "CheckTimerConflict-v1.0" to - check timer conflicts. A patch for the timeline-plugin is included in - Enigma-0.4pre2 (timeline_CheckTimerConflictService-0.1.diff) +____-__-__: Version 1.3 + +- Added Italian language texts (thanks to Diego Pierotto / closes #134) +- Added brougs78-extensions (thanks to Andreas Brugger / references #39) + - added tokens for the next 3 timers: + CurrentEventsTitle[123], CurrentEventsStartDateTime[123], + CurrentEventsStopDateTime[123], CurrentEventsChannelNumber[123], + CurrentEventsChannelName[123], CurrentEventsIsRecording[123] + - added audio- and video-tokens: + PresentLanguageCode, PresentLanguageDescription, PresentVideoAR and + implemented the missing code for the Language-token + - added tokens for replay: + ReplayName, ReplayDateTime, ReplayShortText, ReplayDescription, + ReplayLanguageCode, ReplayLanguageDescription, ReplayVideoAR + - additional recording-tokens: + RecordingVideoAR, RecordingSize + - added a reset for scrolling text (configurable) + - added recording-tokens: + RecordingLength, RecordingCuttedLength + - added tokens: + OsdWidth, OsdHeight + - switched the search-order for the fonts to priorise the skin-folder + (this avoids error-messages in the log) + - added the possibility to have a scrollbar in every menu - not fully + implemented yet (to position in menu-lists is not necessarily correct, + if there are more items with the same osd-text) + - added a configuration option for showing the scrollbar in the menus + - added token TimerConflicts using the service interface of the epgsearch + plugin "Epgsearch-lastconflictinfo-v1.0" + - added a test-feature to search for reruns of a program and add the + information to the extended epg-info (trigger DEVELOPMENT_FEATURES). + This uses a service interface of the epgsearch plugin + "Epgsearch-searchresults-v1.0" + - the extended epg-info and the recording-info are extended by AUX-Infos + (configurable) + there is also an option to strip known tags + - the tab-widths are scaled for taking into account that different TT-Fonts + have a different width than the default font from VDR + - added tokens for signal-info: + FrontendSTR, FrontendSNR, FrontendHasLock, FrontendHasSignal + - added token PresentEventID for EPG-images + - added tokens for recordings: + RecordingFilename, RecordingPriority, RecordingLifetime + - set EditableWidth. This is important for plugins like 'rotor' or + 'extrecmenu' + +2009-06-01: Version 1.2 + +- Moved to http://projects.vdr-developer.org/projects/show/plg-text2skin + as community maintained project using a GIT archive +- adopted to newer VDR >= 1.3.38 +- fixed possible buffer overflow in xml reading +- Fix build with gcc 4.3's cleaned up C++ headers +- Make compatible with VDR >= 1.5.4 +- Added gettext support (VDR >= 1.5.7) + The skins have to be patched, too. The patches for DeepBlue, Enigma and + enElchi are ready for download from http://toms-cafe.de/vdr/download/. + To patch other skins the Makefile from these patches could be used + without any changes, missing translation entries should be added to the + *.skin file (e.g. as comments <!-- trans('Volume') -->) +- Fix font problems with libfreetype6 >= 2.2.1 +- Replaced 'uint64' with 'uint64_t' to avoid problems on 64-bit machines +- Quick fix for VDR >= 1.7.3 +- Use pkg-config +- Convert docs to UTF-8 +- Updated project homepage url in README 2005-06-xx: Version 1.1 - fixed crash due to uninitialized pointer (thanks to Frank Enderle) -- patch for PresentRemaining by Björn (VDR-Portal) +- patch for PresentRemaining by Björn (VDR-Portal) - fixed a race condition (thanks to Reinhard Nissl for pointing this out) - updated finnish translations (thanks to Rolf Ahrenberg) - fixed displaying of partial channel numbers while changing channels (thanks to @@ -22,6 +22,8 @@ HAVE_FREETYPE=1 # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. # By default the main source file also carries this name. +# IMPORTANT: the presence of this macro is important for the Make.config +# file. So it must be defined, even if it is not used here! # PLUGIN = text2skin @@ -32,32 +34,28 @@ VERSION = $(shell grep 'const char \*cText2SkinPlugin::VERSION *=' $(PLUGIN).c | ### The C++ compiler and options: CXX ?= g++ -CXXFLAGS ?= -Wall -Woverloaded-virtual +CXXFLAGS ?= -fPIC -Wall -Woverloaded-virtual ### The directory environment: -DVBDIR = ../../../../DVB VDRDIR = ../../.. LIBDIR = ../../lib TMPDIR = /tmp -### The version number of VDR (taken from VDR's "config.h"): +### Allow user defined options to overwrite defaults: -VDRVERSION = $(shell sed -ne '/define VDRVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h) -APIVERSION = $(shell sed -ne '/define APIVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h) -ifeq ($(APIVERSION),) - APIVERSION = $(VDRVERSION) -endif +-include $(VDRDIR)/Make.config + +### The version number of VDR's plugin API (taken from VDR's "config.h"): + +APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' \ + $(VDRDIR)/config.h) ### The name of the distribution archive: ARCHIVE = $(PLUGIN)-$(VERSION) PACKAGE = vdr-$(ARCHIVE) -### Allow user defined options to overwrite defaults: - --include $(VDRDIR)/Make.config - ### The object files (add further files here): OBJS = $(PLUGIN).o loader.o display.o render.o common.o bitmap.o \ @@ -80,7 +78,8 @@ endif ifdef HAVE_IMAGEMAGICK DEFINES += -DHAVE_IMAGEMAGICK - LIBS += -lMagick -lMagick++ + INCLUDES += `pkg-config --cflags ImageMagick++` + LIBS += `pkg-config --libs ImageMagick++` # LIBS += $(shell Magick++-config --ldflags --libs) endif @@ -106,31 +105,55 @@ ifdef BENCH endif endif -INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/linux/include -I$(DVBDIR)/include -I. +INCLUDES += -I$(VDRDIR)/include -I. DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +### The main target: + +all: libvdr-$(PLUGIN).so i18n + ### Implicit rules: %.o: %.c $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< -# Dependencies: +### Dependencies: -MAKEDEP = g++ -MM -MG +MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ -include $(DEPFILE) -### Targets: +### Internationalization (I18N): + +PODIR = po +LOCALEDIR = $(VDRDIR)/locale +I18Npo = $(notdir $(wildcard $(PODIR)/*.po)) +I18Npot = $(PODIR)/$(PLUGIN).pot + +$(I18Npot): $(wildcard *.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP \ + --msgid-bugs-address='<sascha@akv-soft.de>' -o $@ $^ + +%.po: $(I18Npot) + msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ -all: libvdr-$(PLUGIN).so +$(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.po + @mkdir -p $(dir $@) + msgfmt -c -o $@ $< + +.PHONY: i18n +i18n: $(I18Npo:%.po=$(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo) + +### Targets: libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@ - @cp $@ $(LIBDIR)/$@.$(APIVERSION) + @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) ifndef DEBUG strip $(LIBDIR)/$@.$(APIVERSION) endif @@ -139,10 +162,10 @@ dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) - @ln -s $(ARCHIVE) $(TMPDIR)/$(PLUGIN) - @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) $(PLUGIN) - @-rm -rf $(TMPDIR)/$(ARCHIVE) $(TMPDIR)/$(PLUGIN) + @tar czf $(PACKAGE).tgz -C $(TMPDIR) \ + --exclude debian --exclude CVS --exclude .svn $(ARCHIVE) + @-rm -rf $(TMPDIR)/$(ARCHIVE) @echo Distribution package created as $(PACKAGE).tgz clean: - @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ SKINS SKINS.de + @-rm -f $(OBJS) $(DEPFILE) *.so $(I18Npot) *.tgz core* *~ SKINS SKINS.de @@ -2,9 +2,9 @@ This is a "plugin" for the Video Disk Recorder (VDR). Written by: Sascha Volkenandt <sascha@akv-soft.de> -Project's homepage: http://www.magoa.net/linux/contrib/ +Project's homepage: http://linux.kompiliert.net/index.php?view=text2skin -Latest version available at: http://www.magoa.net/linux/contrib/ +Latest version available at: http://projects.vdr-developer.org/projects/show/plg-text2skin See the file COPYING for license information. @@ -1,12 +1,12 @@ -Dies ist ein "plugin" für den Video Disk Recorder (VDR). +Dies ist ein "plugin" für den Video Disk Recorder (VDR). Geschrieben von: Sascha Volkenandt <sascha@akv-soft.de> -Projekthomepage: http://www.magoa.net/linux/contrib/ +Projekthomepage: http://linux.kompiliert.net/index.php?view=text2skin -Letzte Version verfügbar auf: http://www.magoa.net/linux/contrib/ +Letzte Version verfügbar auf: http://projects.vdr-developer.org/projects/show/plg-text2skin -Siehe COPYING für Linzensierungsinformationen. +Siehe COPYING für Linzensierungsinformationen. Beschreibung: @@ -14,41 +14,41 @@ Beschreibung: Dieses Plugin wurde designed um eine Reihe von Dateien zu laden und zu interpretieren, die das Aussehen des On Screen Display beschreiben, und diese -dem VDR via Einstellungen -> OSD zur Verfügung zu stellen. Natürlich ist es -möglich mehrere textbasierte Skins auf diesem Wege zu laden, und unter diesen -bei laufendem VDR auszuwählen. Alle Skins können Themeable (die Farbvarianten -können geändert werden) und Übersetzbar sein, wenn der Autor des Skins dies -möchte. +dem VDR via Einstellungen -> OSD zur Verfügung zu stellen. Natürlich ist es +möglich mehrere textbasierte Skins auf diesem Wege zu laden, und unter diesen +bei laufendem VDR auszuwählen. Alle Skins können Themeable (die Farbvarianten +können geändert werden) und Übersetzbar sein, wenn der Autor des Skins dies +möchte. Voraussetzungen: ---------------- Um andere Bildformate als einfaches XPM zu laden, brauchen Sie eine -Grafikbibliothek. Es werden zwei Bibliotheken unterstützt, aus der Sie eine -zu benutzende wählen können. Dies sind ImageMagick oder Imlib2, wobei erstere -standardmäßig herangezogen wird. Sie können beeinflussen, welche Bibliothek -(wenn überhaupt eine) genutzt werden soll, indem Sie die ersten paar Zeilen -der Datei Makefile ändern. Hier ist eine Übersicht über Möglichkeiten und -Nachteile jeder möglichen Lösung: +Grafikbibliothek. Es werden zwei Bibliotheken unterstützt, aus der Sie eine +zu benutzende wählen können. Dies sind ImageMagick oder Imlib2, wobei erstere +standardmäßig herangezogen wird. Sie können beeinflussen, welche Bibliothek +(wenn überhaupt eine) genutzt werden soll, indem Sie die ersten paar Zeilen +der Datei Makefile ändern. Hier ist eine Übersicht über Möglichkeiten und +Nachteile jeder möglichen Lösung: Keine Bibliothek - - Sie können nur XPM Dateien laden - - XPMs haben weder Teiltransparenzen noch Alphakanäle + - Sie können nur XPM Dateien laden + - XPMs haben weder Teiltransparenzen noch Alphakanäle ImageMagick - + Sie können viele verschiedene Bildformate laden + + Sie können viele verschiedene Bildformate laden - ist aber etwas langsamer als Imlib2 Imlib2 - + Sie können viele verschiedene Bildformate laden - - STÜRZT AB, WENN ES ZUSAMMEN MIT DEM GRAPHTFT-PLUGIN ZUM EINSATZ KOMMT! + + Sie können viele verschiedene Bildformate laden + - STÜRZT AB, WENN ES ZUSAMMEN MIT DEM GRAPHTFT-PLUGIN ZUM EINSATZ KOMMT! Beide Bibliotheken gleichzeitig zu benutzen macht keinen Sinn. HINWEIS: Obwohl das Handbuch von ImageMagick behauptet, dass die hier benutzte Bibliothek Magick++ integraler Bestandteil der Quellen sind, muss auf manchen -Distributionen das Paket Magick++ zusätzlich installiert werden. +Distributionen das Paket Magick++ zusätzlich installiert werden. Installation: @@ -66,7 +66,7 @@ root@linux # cd ../.. root@linux # make plugins root@linux # ./vdr -P text2skin -Wenn Sie VDR 1.3.9 benutzen, müssen Sie auch noch einen Patch anwenden. Dieser +Wenn Sie VDR 1.3.9 benutzen, müssen Sie auch noch einen Patch anwenden. Dieser Patch wird in VDR 1.3.10 aber enthalten sein. root@linux # patch -p1 < PLUGINS/src/text2skin/patches/vdr-1.3.9-osd.diff @@ -74,19 +74,19 @@ root@linux # make vdr root@linux # ./vdr -P text2skin -Wo die Skins hingehören: +Wo die Skins hingehören: ------------------------ Wie Sie vielleicht wissen, hat VDR einen Unterordner "plugins" innerhalb seines -Konfigurationsordners, in dem alle Dateien, die zu Plugins gehören, enthalten -sein sollten. Wenn Sie nicht wissen, wo das sein könnte, schauen Sie in dem -Ordner nach, den Sie VDR beim Starten mit -v (oder -c, falls gegeben) übergeben +Konfigurationsordners, in dem alle Dateien, die zu Plugins gehören, enthalten +sein sollten. Wenn Sie nicht wissen, wo das sein könnte, schauen Sie in dem +Ordner nach, den Sie VDR beim Starten mit -v (oder -c, falls gegeben) übergeben haben. "plugins" sollte in diesem Ordner enthalten sein. Innerhalb dieses "plugins" Ordners erstellen Sie einen Ordner namens "text2skin". In "text2skin" erstellen Sie einen weiteren Ordner pro Skin. Diese -Skin-Ordner müssen den gleichen Namen tragen wie die Skins in ihnen. Jedes -Skin muss mindestens eine Datei enthalten, die denselben Namen trägt, aber mit +Skin-Ordner müssen den gleichen Namen tragen wie die Skins in ihnen. Jedes +Skin muss mindestens eine Datei enthalten, die denselben Namen trägt, aber mit der Endung ".skin". Beispiel (das Skin heisst myskin): @@ -95,8 +95,8 @@ Beispiel (das Skin heisst myskin): /video0/plugins/text2skin/msykin/msykin.skin /video0/plugins/text2skin/myskin/channeldisplay.png -Die anderen Dateien in dem Skin-Ordner sind weitere Beschreibungsdateien (für -Farben und Übersetzungen) sowie Bilder, Logos und Symbole. +Die anderen Dateien in dem Skin-Ordner sind weitere Beschreibungsdateien (für +Farben und Übersetzungen) sowie Bilder, Logos und Symbole. Wenn Sie ein Skin herunterladen, wechseln Sie normalerweise einfach in den plugins/text2skin Ordner und entpacken es dort. @@ -5,6 +5,7 @@ #ifndef VDR_TEXT2SKIN_CACHE_HPP #define VDR_TEXT2SKIN_CACHE_HPP +#include <cstdlib> #include <map> #include <vector> #include <string> @@ -4,7 +4,6 @@ #include "common.h" #include <sstream> -#include <locale.h> #include <vdr/plugin.h> #include <vdr/device.h> #include <sys/ioctl.h> @@ -39,7 +38,7 @@ const char *ChannelName(const cChannel *Channel, int Number) if (Channel) snprintf(buffer, sizeof(buffer), "%s", Channel->Name()); else if (!Number) - snprintf(buffer, sizeof(buffer), "%s", tr("*** Invalid Channel ***")); + snprintf(buffer, sizeof(buffer), "%s", trVDR("*** Invalid Channel ***")); #if VDRVERSNUM < 10315 char *ptr; @@ -61,7 +60,7 @@ const char *ChannelShortName(const cChannel *Channel, int Number) snprintf(buffer, sizeof(buffer), "%s", Channel->ShortName(true)); #endif else if (!Number) - snprintf(buffer, sizeof(buffer), "%s", tr("*** Invalid Channel ***")); + snprintf(buffer, sizeof(buffer), "%s", trVDR("*** Invalid Channel ***")); #if VDRVERSNUM < 10315 char *ptr; @@ -77,7 +76,7 @@ const char *ChannelShortName(const cChannel *Channel, int Number) return buffer; } -const char *EventType(uint Number) +const char *EventType(uint Number) { static char buffer[25]; buffer[0] = '\0'; @@ -139,7 +138,7 @@ int GetFrontendSTR(void) { uint16_t value = 0; char *dev = NULL; - + asprintf(&dev, FRONTEND_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); int fe = open(dev, O_RDONLY | O_NONBLOCK); free(dev); @@ -154,7 +153,7 @@ int GetFrontendSNR(void) { uint16_t value = 0; char *dev = NULL; - + asprintf(&dev, FRONTEND_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); int fe = open(dev, O_RDONLY | O_NONBLOCK); free(dev); @@ -169,7 +168,7 @@ bool GetFrontendHasLock(void) { uint16_t value = 0; char *dev = NULL; - + asprintf(&dev, FRONTEND_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); int fe = open(dev, O_RDONLY | O_NONBLOCK); free(dev); @@ -184,7 +183,7 @@ bool GetFrontendHasSignal(void) { uint16_t value = 0; char *dev = NULL; - + asprintf(&dev, FRONTEND_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); int fe = open(dev, O_RDONLY | O_NONBLOCK); free(dev); @@ -199,10 +198,10 @@ std::string AddExtInfoToDescription(const char *Title, const char *ShortText, co { // max. width so lines don't get wrapped #define MAX_CHARS 50 - + // prepare the description std::stringstream desc(""); - + if (!isempty(Description)) { // it seems that sometimes the description ends with a newline // and sometimes it does not @@ -210,7 +209,7 @@ std::string AddExtInfoToDescription(const char *Title, const char *ShortText, co while (!buf.empty() && buf[buf.size() - 1] == '\n') buf.erase(buf.size() - 1); desc << buf << "\n"; // keep one newline } - + #ifdef DEVELOPMENT_FEATURES // try to find a rerun of the show using epgsearch-service if (!isempty(Title)) { @@ -228,7 +227,7 @@ std::string AddExtInfoToDescription(const char *Title, const char *ShortText, co if (!desc.str().empty()) desc << "\n"; desc << tr("RERUNS OF THIS SHOW") << ":\n"; int i = 0; - for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = + for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = list->First(); r && i < 5; r = list->Next(r)) { i++; std::stringstream buf; @@ -242,27 +241,30 @@ std::string AddExtInfoToDescription(const char *Title, const char *ShortText, co } } } -#endif // DEVELOPMENT_FEATURES - +#endif // DEVELOPMENT_FEATURES + // Add the AUX-Info of the Recording if (Aux) { if (StripAux) { std::string auxRaw(Aux); std::string auxEpgsearch = StripXmlTag(auxRaw, "epgsearch"); if (!auxEpgsearch.empty()) { - if (!desc.str().empty()) desc << "\n"; + if (!desc.str().empty()) + desc << "\n"; desc << tr("AUXILIARY INFOS") << ":\n"; std::stringstream buf; buf << " - " << tr("Search timer") << ": " << StripXmlTag(auxRaw, "Search timer"); desc << FitToWidth(buf, MAX_CHARS) << "\n"; } - } else { - if (!desc.str().empty()) desc << "\n"; + } + else { + if (!desc.str().empty()) + desc << "\n"; desc << tr("AUXILIARY INFOS") << ":\n"; desc << Aux << "\n"; } } - + return desc.str(); } @@ -277,7 +279,7 @@ int GetRecordingSize(const char *FileName) // use our own approach { if (FileName != NULL) { - bool bRet=false; + bool bRet = false; long long size = 0; int nFiles; struct stat fileinfo; // Holds file information structure @@ -286,38 +288,33 @@ int GetRecordingSize(const char *FileName) cReadLine reader; #endif asprintf(&cmd, "find '%s' -follow -type f -name '*.*'|sort ", FileName); - + FILE *p = popen(cmd, "r"); - int ret=0; - if (p) - { + int ret = 0; + if (p) { char *s; - + #if VDRVERSNUM >= 10318 - while ((s = reader.Read(p)) != NULL) + while ((s = reader.Read(p)) != NULL) { #else - while ((s = readline(p)) != NULL) + while ((s = readline(p)) != NULL) { #endif - { - if ((ret=stat(s, &fileinfo)) != -1) - { + if ((ret=stat(s, &fileinfo)) != -1) { size += (long long)fileinfo.st_size; nFiles++; } } - - bRet=true; + + bRet = true; } - + pclose(p); delete cmd; - + return (int)(size / 1024 / 1024); // [MB] } else - { return 0; - } } #endif @@ -325,7 +322,7 @@ int GetRecordingLength(const char *FileName) { // based on the enAIO-Patch for VDR #define INDEXFILESUFFIX "/index.vdr" - + struct tIndex { int offset; uchar type; uchar number; short reserved; }; tIndex *index; char RecLength[21]; @@ -333,36 +330,36 @@ int GetRecordingLength(const char *FileName) int last = -1; index = NULL; if (FileName) { - filename = MALLOC(char, strlen(FileName) + strlen(INDEXFILESUFFIX) + 1); - if (filename) { - strcpy(filename, FileName); - char *pFileExt = filename + strlen(filename); - strcpy(pFileExt, INDEXFILESUFFIX); - int delta = 0; - if (access(filename, R_OK) == 0) { - struct stat buf; - if (stat(filename, &buf) == 0) { - delta = buf.st_size % sizeof(tIndex); - if (delta) { - delta = sizeof(tIndex) - delta; - esyslog("ERROR: invalid file size (%ld) in '%s'", buf.st_size, filename); - } - last = (buf.st_size + delta) / sizeof(tIndex) - 1; - char hour[2], min[3]; + filename = MALLOC(char, strlen(FileName) + strlen(INDEXFILESUFFIX) + 1); + if (filename) { + strcpy(filename, FileName); + char *pFileExt = filename + strlen(filename); + strcpy(pFileExt, INDEXFILESUFFIX); + int delta = 0; + if (access(filename, R_OK) == 0) { + struct stat buf; + if (stat(filename, &buf) == 0) { + delta = buf.st_size % sizeof(tIndex); + if (delta) { + delta = sizeof(tIndex) - delta; + esyslog("ERROR: invalid file size (%ld) in '%s'", (long)buf.st_size, filename); + } + last = (buf.st_size + delta) / sizeof(tIndex) - 1; + char hour[2], min[3]; #if VDRVERSNUM >= 10318 - snprintf(RecLength, sizeof(RecLength), "%s", *IndexToHMSF(last, true)); + snprintf(RecLength, sizeof(RecLength), "%s", *IndexToHMSF(last, true)); #else - snprintf(RecLength, sizeof(RecLength), "%s", IndexToHMSF(last, true)); + snprintf(RecLength, sizeof(RecLength), "%s", IndexToHMSF(last, true)); #endif - snprintf(hour, sizeof(hour), "%c", RecLength[0]); - snprintf(min, sizeof(min), "%c%c", RecLength[2], RecLength[3]); - return (atoi(hour) * 60) + atoi(min); - } - } - free(filename); - } - } - + snprintf(hour, sizeof(hour), "%c", RecLength[0]); + snprintf(min, sizeof(min), "%c%c", RecLength[2], RecLength[3]); + return (atoi(hour) * 60) + atoi(min); + } + } + free(filename); + } + } + return 0; } @@ -372,32 +369,27 @@ int GetRecordingCuttedLength(const char *FileName) double length = 0; int totalLength = GetRecordingLength(FileName); const double diffIFrame = FRAMESPERSEC / 2; // approx. 1/2 sec. - + marks.Load(FileName); - - if (marks.Count()) - { + + if (marks.Count()) { int start = 1; // first frame bool isStart = true; - - for (cMark *m = marks.First(); m; m = marks.GetNext(m->position)) - { + + for (cMark *m = marks.First(); m; m = marks.GetNext(m->position)) { if (isStart) - { start = m->position; - } else - { length += (double)(m->position - start + 1 + diffIFrame) / (FRAMESPERSEC * 60); // [min] - } - + isStart = !isStart; } - + // if there is no end-mark the last segment goes to the end of the rec. - if (!isStart) length += totalLength - (double)(start - 1 - diffIFrame) / (FRAMESPERSEC * 60); // [min] + if (!isStart) + length += totalLength - (double)(start - 1 - diffIFrame) / (FRAMESPERSEC * 60); // [min] } - + // just to avoid, that the cutted length is bigger than the total length return (int)length > totalLength ? totalLength : (int)length; } @@ -410,7 +402,6 @@ cxType TimeType(time_t Time, const std::string &Format) if (Time > 0) { if (Format.length() > 0) { - setlocale(LC_TIME, tr("en_US")); strftime(result, sizeof(result), Format.c_str(), tm); cxType r = result; @@ -552,7 +543,8 @@ void SkipQuotes(std::string &Value) { esyslog("ERROR: text2skin: missing closing %c", quote); } -std::string FitToWidth(std::string &Line, uint Width) { +std::string FitToWidth(std::string &Line, uint Width) +{ std::string buf(Line); if (buf.size() > Width) { buf.erase(Width - 3); @@ -561,7 +553,8 @@ std::string FitToWidth(std::string &Line, uint Width) { return buf; } -std::string FitToWidth(std::stringstream &Line, uint Width) { +std::string FitToWidth(std::stringstream &Line, uint Width) +{ std::string buf(Line.str()); if (buf.size() > Width) { buf.erase(Width - 3); @@ -570,7 +563,8 @@ std::string FitToWidth(std::stringstream &Line, uint Width) { return buf; } -std::string StripXmlTag(std::string &Line, const char *Tag) { +std::string StripXmlTag(std::string &Line, const char *Tag) +{ // set the search strings std::stringstream strStart, strStop; strStart << "<" << Tag << ">"; @@ -578,7 +572,8 @@ std::string StripXmlTag(std::string &Line, const char *Tag) { // find the strings std::string::size_type locStart = Line.find(strStart.str()); std::string::size_type locStop = Line.find(strStop.str()); - if (locStart == std::string::npos || locStop == std::string::npos) return ""; + if (locStart == std::string::npos || locStop == std::string::npos) + return ""; // extract relevant text int pos = locStart + strStart.str().size(); int len = locStop - pos; @@ -11,13 +11,16 @@ #include <vdr/config.h> #include <vdr/epg.h> +// from recording.h (VDR <= 1.7.2) +#define FRAMESPERSEC 25 + #if defined(DEBUG) || defined(BENCH) # ifdef DEBUG # define Dprintf(x...) fprintf(stderr, x) # else # define Dprintf(x...) # endif -# define Dbench(x) uint64 bench_##x = time_ms() +# define Dbench(x) uint64_t bench_##x = time_ms() # define Ddiff(t,x) fprintf(stderr, "%s took %llu ms\n", t, time_ms() - bench_##x) #else # define Dprintf(x...) @@ -25,7 +28,7 @@ # define Ddiff(t,x) #endif -#define DStartBench(x) uint64 bench_##x = time_ms() +#define DStartBench(x) uint64_t bench_##x = time_ms() #define DShowBench(t,x) fprintf(stderr, "%s took %llu ms\n", t, time_ms() - bench_##x) #if VDRVERSNUM >= 10318 @@ -78,35 +81,32 @@ std::string FitToWidth(std::stringstream &Line, uint Width); std::string StripXmlTag(std::string &Line, const char *Tag); // Data structure for service "Epgsearch-searchresults-v1.0" -struct Epgsearch_searchresults_v1_0 -{ +struct Epgsearch_searchresults_v1_0 { // in - char* query; // search term - int mode; // search mode (0=phrase, 1=and, 2=or, 3=regular expression) - int channelNr; // channel number to search in (0=any) - bool useTitle; // search in title - bool useSubTitle; // search in subtitle - bool useDescription; // search in description + char* query; // search term + int mode; // search mode (0=phrase, 1=and, 2=or, 3=regular expression) + int channelNr; // channel number to search in (0=any) + bool useTitle; // search in title + bool useSubTitle; // search in subtitle + bool useDescription; // search in description // out - class cServiceSearchResult : public cListObject - { + class cServiceSearchResult : public cListObject { public: - const cEvent* event; - cServiceSearchResult(const cEvent* Event) : event(Event) {} + const cEvent* event; + cServiceSearchResult(const cEvent* Event) : event(Event) {} }; - cList<cServiceSearchResult>* pResultList; // pointer to the results + cList<cServiceSearchResult>* pResultList; // pointer to the results }; // Data structure for service "Epgsearch-lastconflictinfo-v1.0" -struct Epgsearch_lastconflictinfo_v1_0 -{ +struct Epgsearch_lastconflictinfo_v1_0 { // in // out - time_t nextConflict; // next conflict date, 0 if none - int relevantConflicts; // number of relevant conflicts - int totalConflicts; // total number of conflicts + time_t nextConflict; // next conflict date, 0 if none + int relevantConflicts; // number of relevant conflicts + int totalConflicts; // total number of conflicts }; #endif // VDR_TEXT2SKIN_COMMON_H @@ -245,10 +245,10 @@ cxType cText2SkinDisplayChannel::GetTokenData(const txToken &Token) cDevice *dev = cDevice::PrimaryDevice(); eTrackType trackType = dev->GetCurrentAudioTrack(); const tTrackId *track = dev->GetTrack(trackType); - if (track) - { + if (track) { std::string buffer(track->language); - if (trackType >= ttDolby) buffer.append("DD"); + if (trackType >= ttDolby) + buffer.append("DD"); return (cxType)buffer.c_str(); } return (cxType)false; @@ -597,10 +597,10 @@ cxType cText2SkinDisplayReplay::GetTokenData(const txToken &Token) cDevice *dev = cDevice::PrimaryDevice(); eTrackType trackType = dev->GetCurrentAudioTrack(); const tTrackId *track = dev->GetTrack(trackType); - if (track) - { + if (track) { std::string buffer(track->language); - if (trackType >= ttDolby) buffer.append("DD"); + if (trackType >= ttDolby) + buffer.append("DD"); return (cxType)buffer.c_str(); } return (cxType)false; @@ -876,8 +876,9 @@ void cText2SkinDisplayMenu::SetItem(const char *Text, int Index, bool Current, b mCurrentItem = Index; SetDirty(); } - - if (Current) mRender->mMenuScrollbar.currentOnScreen = (uint)Index; + + if (Current) + mRender->mMenuScrollbar.currentOnScreen = (uint)Index; UpdateUnlock(); } @@ -1096,9 +1097,9 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token) #if VDRVERSNUM >= 10344 // find corresponding timer const char *aux = NULL; - for (cTimer *tim = Timers.First(); tim; tim = Timers.Next(tim)) { - if (tim->Event() == mEvent) aux = tim->Aux(); - } + for (cTimer *tim = Timers.First(); tim; tim = Timers.Next(tim)) + if (tim->Event() == mEvent) + aux = tim->Aux(); ExtPresentDescription = AddExtInfoToDescription(mEvent->Title(), mEvent->ShortText(), mEvent->Description(), aux, Text2SkinSetup.StripAux); #else ExtPresentDescription = AddExtInfoToDescription(mEvent->Title(), mEvent->ShortText(), mEvent->Description()); @@ -1110,24 +1111,24 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token) #if VDRVERSNUM >= 10318 case tPresentLanguageCode: - if (mEvent) - { + if (mEvent) { const cComponents *components = mEvent->Components(); - if (components) - { + if (components) { int index = Token.Attrib.Number; - + // don't return language-code for the video-stream - for (int i = 0; i < components->NumComponents(); i++) - { - const tComponent *c = components->Component(i); - if (c->stream != 2) index++; // only audio-streams - if (i == index) - { + for (int i = 0; i < components->NumComponents(); i++) { + const tComponent *c = components->Component(i); + if (c->stream != 2) // only audio-streams + index++; + if (i == index) { std::string buffer(c->language); - if (c->type == 1) buffer.append("MONO"); - if ((c->type == 2) || (c->type == 4)) buffer.append("DUAL"); - if (c->type == 5) buffer.append("DD"); + if (c->type == 1) + buffer.append("MONO"); + if ((c->type == 2) || (c->type == 4)) + buffer.append("DUAL"); + if (c->type == 5) + buffer.append("DD"); return (cxType)buffer.c_str(); } } @@ -1135,40 +1136,36 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token) } return false; - case tPresentLanguageDescription: - if (mEvent) - { + case tPresentLanguageDescription: + if (mEvent) { const cComponents *components = mEvent->Components(); - if (components) - { + if (components) { int index = Token.Attrib.Number; - + // don't return language-code for the video-stream - for (int i = 0; i < components->NumComponents(); i++) - { - const tComponent *c = components->Component(i); - if (c->stream != 2) index++; // only audio-streams - if (i == index) return (cxType)c->description; + for (int i = 0; i < components->NumComponents(); i++) { + const tComponent *c = components->Component(i); + if (c->stream != 2) // only audio-streams + index++; + if (i == index) + return (cxType)c->description; } } } return false; - case tPresentVideoAR: - if (mEvent) - { + case tPresentVideoAR: + if (mEvent) { const cComponents *components = mEvent->Components(); - if (components) - { - for (int i = 0; i < components->NumComponents(); i++) - { - const tComponent *c = components->Component(i); - if (c->stream == 1) - { - switch (c->type) - { - case 1: return "4:3"; - case 3: return "16:9"; + if (components) { + for (int i = 0; i < components->NumComponents(); i++) { + const tComponent *c = components->Component(i); + if (c->stream == 1) { + switch (c->type) { + case 1: + return "4:3"; + case 3: + return "16:9"; } } } @@ -1181,7 +1178,7 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token) return mEvent != NULL ? (cxType)EventType(mEvent->EventID()) : (cxType)false; - + case tHasVPS: case tChannelHasVPS: return mEvent != NULL && mEvent->Vps() != 0; @@ -1189,31 +1186,35 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token) case tChannelName: if (mEvent) { // extended EPG cChannel *channel = Channels.GetByChannelID(mEvent->ChannelID(), true); - return channel != NULL - ? (cxType)ChannelName(channel, 0) - : (cxType)false; - } else if (mRecording) { // recording Info + return channel != NULL + ? (cxType)ChannelName(channel, 0) + : (cxType)false; + } + else if (mRecording) { // recording Info cRecordingInfo *recInfo = const_cast<cRecordingInfo*>(mRecording->Info()); cChannel *channel = Channels.GetByChannelID(recInfo->ChannelID(), true); - return channel != NULL - ? (cxType)ChannelName(channel, 0) - : (cxType)false; - } else return (cxType)false; + return channel != NULL + ? (cxType)ChannelName(channel, 0) + : (cxType)false; + } else + return (cxType)false; case tChannelShortName: if (mEvent) { // extended EPG cChannel *channel = Channels.GetByChannelID(mEvent->ChannelID(), true); - return channel != NULL - ? (cxType)ChannelShortName(channel, 0) - : (cxType)false; - } else if (mRecording) { // recording Info + return channel != NULL + ? (cxType)ChannelShortName(channel, 0) + : (cxType)false; + } + else if (mRecording) { // recording Info cRecordingInfo *recInfo = const_cast<cRecordingInfo*>(mRecording->Info()); cChannel *channel = Channels.GetByChannelID(recInfo->ChannelID(), true); - return channel != NULL - ? (cxType)ChannelShortName(channel, 0) - : (cxType)false; - } else return (cxType)false; - + return channel != NULL + ? (cxType)ChannelShortName(channel, 0) + : (cxType)false; + } else + return (cxType)false; + case tPresentHasVPS: return mEvent != NULL && mEvent->Vps() != 0 && mEvent->Vps() != mEvent->StartTime(); @@ -1266,77 +1267,72 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token) case tRecordingDescription: if (mRecording) { - if (ExtRecordingDescription == "") { + if (ExtRecordingDescription == "") #if VDRVERSNUM >= 10344 ExtRecordingDescription = AddExtInfoToDescription(mRecording->Info()->Title(), mRecording->Info()->ShortText(), mRecording->Info()->Description(), Text2SkinSetup.ShowAux ? mRecording->Info()->Aux() : NULL, Text2SkinSetup.StripAux); #else ExtRecordingDescription = AddExtInfoToDescription(mRecording->Info()->Title(), mRecording->Info()->ShortText(), mRecording->Info()->Description()); #endif - } return (cxType)ExtRecordingDescription; } else return (cxType)false; - case tRecordingLanguageCode: - if (mRecording) - { + case tRecordingLanguageCode: + if (mRecording) { const cComponents *components = mRecording->Info()->Components(); - if (components) - { + if (components) { int index = Token.Attrib.Number; - + // don't return language-code for the video-stream - for (int i = 0; i < components->NumComponents(); i++) - { - const tComponent *c = components->Component(i); - if (c->stream != 2) index++; // only audio-streams - if (i == index) - { + for (int i = 0; i < components->NumComponents(); i++) { + const tComponent *c = components->Component(i); + if (c->stream != 2) // only audio-streams + index++; + if (i == index) { std::string buffer(c->language); - if (c->type == 1) buffer.append("MONO"); - if ((c->type == 2) || (c->type == 4)) buffer.append("DUAL"); - if (c->type == 5) buffer.append("DD"); + if (c->type == 1) + buffer.append("MONO"); + if ((c->type == 2) || (c->type == 4)) + buffer.append("DUAL"); + if (c->type == 5) + buffer.append("DD"); return (cxType)buffer.c_str(); } } } } return false; - + case tRecordingLanguageDescription: - if (mRecording) - { + if (mRecording) { const cComponents *components = mRecording->Info()->Components(); - if (components) - { + if (components) { int index = Token.Attrib.Number; - + // don't return language-code for the video-stream - for (int i = 0; i < components->NumComponents(); i++) - { - const tComponent *c = components->Component(i); - if (c->stream != 2) index++; // only audio-streams - if (i == index) return (cxType)c->description; + for (int i = 0; i < components->NumComponents(); i++) { + const tComponent *c = components->Component(i); + if (c->stream != 2) // only audio-streams + index++; + if (i == index) + return (cxType)c->description; } } } return false; - case tRecordingVideoAR: - if (mRecording) - { + case tRecordingVideoAR: + if (mRecording) { const cComponents *components = mRecording->Info()->Components(); - if (components) - { - for (int i = 0; i < components->NumComponents(); i++) - { - const tComponent *c = components->Component(i); - if (c->stream == 1) - { - switch (c->type) - { - case 1: return "4:3"; - case 3: return "16:9"; + if (components) { + for (int i = 0; i < components->NumComponents(); i++) { + const tComponent *c = components->Component(i); + if (c->stream == 1) { + switch (c->type) { + case 1: + return "4:3"; + case 3: + return "16:9"; } } } @@ -1345,21 +1341,21 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token) return false; #endif - case tRecordingSize: + case tRecordingSize: return mRecording != NULL ? (cxType)GetRecordingSize(mRecording->FileName()) : (cxType)false; - - case tRecordingLength: + + case tRecordingLength: return mRecording != NULL ? (cxType)GetRecordingLength(mRecording->FileName()) - : (cxType)false; - - case tRecordingCuttedLength: + : (cxType)false; + + case tRecordingCuttedLength: return mRecording != NULL ? (cxType)GetRecordingCuttedLength(mRecording->FileName()) - : (cxType)false; - + : (cxType)false; + default: return cText2SkinRender::GetTokenData(Token); } @@ -142,10 +142,10 @@ private: // detailed event view const cEvent *mEvent; - std::string ExtPresentDescription; + std::string ExtPresentDescription; // detailed recording const cRecording *mRecording; - std::string ExtRecordingDescription; + std::string ExtRecordingDescription; // long text std::string mText; @@ -172,7 +172,7 @@ protected: virtual int MaxItems(void) { return mMaxItems; } virtual void SetMaxItems(int MaxItems) { mMaxItems = MaxItems; } virtual int GetMaxItems(void) { return mMaxItems; } - + public: cText2SkinDisplayMenu(cText2SkinLoader *Loader); virtual ~cText2SkinDisplayMenu(); @@ -31,8 +31,13 @@ const cFont *cText2SkinFont::Load(const std::string &Path, const std::string &Fi const cFont *res = NULL; #ifdef HAVE_FREETYPE char *cachename; +#if VDRVERSNUM >= 10507 + asprintf(&cachename, "%s_%d_%d_%d", Filename.c_str(), Size, Width, I18nCurrentLanguage()); + if (mFontCache.Load(Path + "/" + Filename, cachename, Size, I18nCurrentLanguage(), Width)) +#else asprintf(&cachename, "%s_%d_%d_%d", Filename.c_str(), Size, Width, Setup.OSDLanguage); if (mFontCache.Load(Path + "/" + Filename, cachename, Size, Setup.OSDLanguage, Width)) +#endif res = mFontCache.GetFont(cachename); else esyslog("ERROR: Text2Skin: Couldn't load font %s:%d", Filename.c_str(), Size); diff --git a/graphtft/font.c b/graphtft/font.c index 9cfa812..d61a4b3 100644 --- a/graphtft/font.c +++ b/graphtft/font.c @@ -41,6 +41,7 @@ bool cGraphtftFont::Load(string Filename, string CacheName, int Size, int Langua if ( _cache.find(CacheName) != _cache.end() ) return true; +#if VDRVERSNUM < 10503 int error = FT_New_Face(_library, Filename.c_str(), format, &_face); // every thing ok? @@ -138,7 +139,7 @@ bool cGraphtftFont::Load(string Filename, string CacheName, int Size, int Langua //Load the char error = FT_Load_Glyph( _face, glyph_index, FT_LOAD_DEFAULT ); if ( error ) continue; /* ignore errors */ - + // now, convert to vdr font data int width = (_slot->metrics.horiAdvance / 64) + 1; int bearingX = (_slot->metrics.horiBearingX / 64) +1; @@ -187,6 +188,17 @@ bool cGraphtftFont::Load(string Filename, string CacheName, int Size, int Langua delete(font_data); // Something went wrong! return false; +#else +#if VDRVERSNUM < 10504 + cFont* newFont = new cFreetypeFont(*AddDirectory(FONTDIR, Filename.c_str()), Size); +#else + cFont* newFont = cFont::CreateFont(Filename.c_str(), Size); +#endif + if ( newFont == NULL ) + return false; + _cache[CacheName] = newFont; + return true; +#endif } const cFont* cGraphtftFont::GetFont(string CacheName){ @@ -210,10 +222,12 @@ void cGraphtftFont::Clear() delete((*it).second); _cache.clear(); +#if VDRVERSNUM < 10503 del_map::iterator del_it = _del.begin(); for (; del_it != _del.end(); ++del_it) delete((*del_it).second); _del.clear(); +#endif } cGraphtftFont GraphtftFont; diff --git a/graphtft/font.h b/graphtft/font.h index 2d2eee1..041baef 100644 --- a/graphtft/font.h +++ b/graphtft/font.h @@ -24,7 +24,9 @@ class cGraphtftFont { private: typedef map<string,cFont*> cache_map; +#if VDRVERSNUM < 10503 typedef map<string,cFont::tPixelData*> del_map; +#endif public: cGraphtftFont(); @@ -40,7 +42,9 @@ private: FT_Face _face; FT_GlyphSlot _slot; cache_map _cache; +#if VDRVERSNUM < 10503 del_map _del; +#endif }; @@ -5,6 +5,7 @@ #include "i18n.h" #include <vdr/config.h> +#if VDRVERSNUM < 10507 const tI18nPhrase Phrases[] = { /* { "English", @@ -79,15 +80,15 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "Flush image cache", - "Bildspeicher leeren", + { "Flushing image cache...", + "Bildspeicher wird geleert...", "", "", "", "", "", "", - "Tyhjennä kuvat välimuistista", + "Tyhjennetään välimuistia...", "", "", "", @@ -454,41 +455,24 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "en_US", - "de_DE", - "sl_SI", - "it_IT", - "nl_NL", - "pt_PT", - "fr_FR", - "no_NO", - "fi_FI", - "pl_PL", - "es_ES", - "el_GR", - "sv_SE", - "ro_RO", - "hu_HU", - "ca_AD", - "ru_RU", - "hr_HR", -#if VDRVERSNUM >= 10313 - "et_EE", -#endif -#if VDRVERSNUM >= 10316 - "da_DK", -#endif - }, { NULL } }; +#endif +#if VDRVERSNUM >= 10507 +cText2SkinI18n::cText2SkinI18n(const char *Skin) { + mIdentity = std::string("vdr-"PLUGIN_NAME_I18N"-") + Skin; + I18nRegister(mIdentity.substr(mIdentity.find('-') + 1).c_str()); +#else cText2SkinI18n::cText2SkinI18n(const char *Skin): cText2SkinFile(Skin) { mIdentity = (std::string)"text2skin_" + Skin; mNumPhrases = 0; mPhrases = (tI18nPhrase*)malloc(sizeof(tI18nPhrase)); memset(mPhrases[mNumPhrases], 0, sizeof(tI18nPhrase)); +#endif } +#if VDRVERSNUM < 10507 cText2SkinI18n::~cText2SkinI18n() { for (int i = 0; mPhrases[i][0]; ++i) { for (int j = 0; j < I18nNumLanguages; ++j) @@ -544,3 +528,4 @@ bool cText2SkinI18n::Load(const std::string &Filename) { } return false; } +#endif @@ -9,22 +9,33 @@ #include "file.h" #include <vdr/i18n.h> +#if VDRVERSNUM < 10507 +#define trNOOP(s) (s) +#define trVDR(s) tr(s) + extern const tI18nPhrase Phrases[]; class cText2SkinI18n: public cText2SkinFile { +#else +class cText2SkinI18n { +#endif private: std::string mIdentity; +#if VDRVERSNUM < 10507 tI18nPhrase *mPhrases; int mNumPhrases; protected: virtual bool Parse(const char *Text); +#endif public: cText2SkinI18n(const char *Skin); +#if VDRVERSNUM < 10507 virtual ~cText2SkinI18n(); virtual bool Load(const std::string &Filename); +#endif std::string Translate(const std::string &Text) { return I18nTranslate(Text.c_str(), mIdentity.c_str()); } }; @@ -34,6 +34,9 @@ void cText2SkinLoader::Start(void) { } void cText2SkinLoader::Load(const char *Skin) { +#if VDRVERSNUM >= 10507 + cText2SkinI18n *translations = new cText2SkinI18n(Skin); +#else cText2SkinI18n *translations = NULL; std::string transfile = SkinPath() + "/" + Skin + "/" + Skin + ".trans"; if (access(transfile.c_str(), F_OK) == 0) { @@ -41,6 +44,7 @@ void cText2SkinLoader::Load(const char *Skin) { if (!translations->Load(transfile)) DELETENULL(translations); } +#endif cText2SkinTheme *theme = new cText2SkinTheme(Skin); std::string themefile = SkinPath() + "/" + Skin + "/" + Skin + ".colors"; @@ -15,20 +15,21 @@ cText2SkinSetupPage::cText2SkinSetupPage(void) { void cText2SkinSetupPage::Setup(void) { int current = Current(); Clear(); - + Add(new cMenuEditBoolItem(tr("Show scrollbar in the menus"), &mData.MenuScrollbar, tr("no"), tr("yes"))); Add(new cMenuEditBoolItem(tr("Scrolling behaviour"), &mData.MarqueeLeftRight, tr("to the left"), tr("left and right"))); Add(new cMenuEditBoolItem(tr("Reset Marquee for new item"), &mData.MarqueeReset, tr("no"), tr("yes"))); #if VDRVERSNUM >= 10344 Add(new cMenuEditBoolItem(tr("Show auxiliary infos of recordings"), &mData.ShowAux, tr("no"), tr("yes"))); - if (mData.ShowAux) Add(new cMenuEditBoolItem(tr(" Extract known tags"), &mData.StripAux, tr("no"), tr("yes"))); + if (mData.ShowAux) + Add(new cMenuEditBoolItem(tr(" Extract known tags"), &mData.StripAux, tr("no"), tr("yes"))); #endif #if VDRVERSNUM >= 10330 Add(new cMenuEditBoolItem(tr("Use 'timeline' to check timer-conflicts"), &mData.CheckTimerConflict, tr("no"), tr("yes"))); #endif Add(new cOsdItem(tr("Flush image cache"), osUser1)); Add(new cMenuEditIntItem(tr("Max. image cache size"), &mData.MaxCacheFill)); - + SetCurrent(Get(current)); Display(); } @@ -53,7 +54,7 @@ void cText2SkinSetupPage::Store(void) { eOSState cText2SkinSetupPage::ProcessKey(eKeys Key) { int oldShowAux = mData.ShowAux; - + eOSState state = cMenuSetupPage::ProcessKey(Key); if (state == osUser1) { Skins.Message(mtInfo, tr("Flushing image cache...")); @@ -61,9 +62,10 @@ eOSState cText2SkinSetupPage::ProcessKey(eKeys Key) { Skins.Message(mtInfo, NULL); return osContinue; } - - if (mData.ShowAux != oldShowAux) Setup(); - + + if (mData.ShowAux != oldShowAux) + Setup(); + return state; } diff --git a/po/de_DE.po b/po/de_DE.po new file mode 100644 index 0000000..287601e --- /dev/null +++ b/po/de_DE.po @@ -0,0 +1,31 @@ +# German translations for vdr-text2skin package. +# Copyright (C) Sascha Volkenandt <sascha@akv-soft.de> +# This file is distributed under the same license as the vdr-text2skin package. +# Sascha Volkenandt <sascha@akv-soft.de>, 2004, 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: vdr-text2skin 1.2\n" +"Report-Msgid-Bugs-To: <sascha@akv-soft.de>\n" +"POT-Creation-Date: 2009-06-01 17:47+0200\n" +"PO-Revision-Date: 2009-06-01 17:47+0200\n" +"Last-Translator: Sascha Volkenandt <sascha@akv-soft.de>\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 "Skin too large or incorrectly aligned" +msgstr "Skin zu groß oder nicht korrekt ausgerichtet" + +msgid "Flush image cache" +msgstr "Bildspeicher leeren" + +msgid "Max. image cache size" +msgstr "Max. Größe des Bildspeichers" + +msgid "Flushing image cache..." +msgstr "Bildspeicher wird geleert..." + +msgid "Loader for text-based skins" +msgstr "Lader für textbasierte Skins" diff --git a/po/fi_FI.po b/po/fi_FI.po new file mode 100644 index 0000000..a8f268c --- /dev/null +++ b/po/fi_FI.po @@ -0,0 +1,31 @@ +# Finnish translations for vdr-text2skin package. +# Copyright (C) Sascha Volkenandt <sascha@akv-soft.de> +# This file is distributed under the same license as the vdr-text2skin package. +# Rolf Ahrenberg <rahrenbe@cc.hut.fi>, 2004, 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: vdr-text2skin 1.2\n" +"Report-Msgid-Bugs-To: <sascha@akv-soft.de>\n" +"POT-Creation-Date: 2009-06-01 17:47+0200\n" +"PO-Revision-Date: 2009-06-01 17:47+0200\n" +"Last-Translator: Rolf Ahrenberg <rahrenbe@cc.hut.fi>\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 "Skin too large or incorrectly aligned" +msgstr "Ulkoasu on liian suuri tai väärin asemoitu" + +msgid "Flush image cache" +msgstr "Tyhjennä kuvat välimuistista" + +msgid "Max. image cache size" +msgstr "Välimuistin maksimikoko" + +msgid "Flushing image cache..." +msgstr "Tyhjennetään välimuistia..." + +msgid "Loader for text-based skins" +msgstr "Helposti muokattavat ulkoasut" diff --git a/po/it_IT.po b/po/it_IT.po new file mode 100644 index 0000000..3487a9d --- /dev/null +++ b/po/it_IT.po @@ -0,0 +1,35 @@ +# Italian translations for vdr-text2skin package. +# Copyright (C) Sascha Volkenandt <sascha@akv-soft.de> +# This file is distributed under the same license as the vdr-text2skin package. +# Diego Pierotto <vdr-italian@tiscali.it>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: vdr-text2skin 1.2\n" +"Report-Msgid-Bugs-To: <sascha@akv-soft.de>\n" +"POT-Creation-Date: 2009-06-01 17:47+0200\n" +"PO-Revision-Date: 2009-06-02 16:11+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=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Italian\n" +"X-Poedit-Country: ITALY\n" +"X-Poedit-SourceCharset: utf-8\n" + +msgid "Skin too large or incorrectly aligned" +msgstr "Interfaccia troppo grande o allineamento incorretto" + +msgid "Flush image cache" +msgstr "Svuota cache immagini" + +msgid "Max. image cache size" +msgstr "Dim. massima cache immagini" + +msgid "Flushing image cache..." +msgstr "Svuotamento cache immagini..." + +msgid "Loader for text-based skins" +msgstr "Gestore di stili interfaccia basati su testo" + @@ -228,7 +228,7 @@ void cText2SkinRender::DrawObject(const cxObject *Object) uint maxitems = areasize.h / itemheight; uint yoffset = 0; bool initialEditableWidthSet = false; - + mMenuScrollbar.maxItems = maxitems; SetMaxItems(maxitems); //Dprintf("setmaxitems %d\n", maxitems); for (uint i = 0; i < maxitems; ++i, yoffset += itemheight) { @@ -262,14 +262,14 @@ void cText2SkinRender::DrawObject(const cxObject *Object) ++n; nexttab = GetTab(n); } - + // set initial EditableWidth // this is for plugins like 'extrecmenu' and 'rotor' if ((obj.Type() == cxObject::text || obj.Type() == cxObject::marquee || obj.Type() == cxObject::blink) && !initialEditableWidthSet) { initialEditableWidthSet = true; SetEditableWidth(obj.Size().w); } - + if (t >= 0 && nexttab > 0 && nexttab < obj.mPos1.x + obj.Size().w - 1) // there is a "next tab" with text obj.mPos2.x = Object->mPos1.x + o->mPos1.x + nexttab; @@ -278,7 +278,7 @@ void cText2SkinRender::DrawObject(const cxObject *Object) obj.mPos2.x += Object->mPos1.x; /* not used anymore due to change to fontOsd but could be usefull if someone uses a differnt font - + if ((obj.Type() == cxObject::text || obj.Type() == cxObject::marquee || obj.Type() == cxObject::blink) && t == 1) { // VDR assumes, that the font in the menu is fontOsd, // so the EditableWidth is not necessarily correct @@ -383,30 +383,27 @@ void cText2SkinRender::DrawMarquee(const txPoint &Pos, const txSize &Size, const uint Delay, uint Index) { bool scrolling = Font->Width(Text.c_str()) > Size.w; - + tState &state = mStates[Index]; if (state.text != Text) { state = tState(); state.text = Text; } - - if (Text2SkinSetup.MarqueeReset && mUpdate.resetMarquee && mUpdate.currentItem.find(Text, 0) != std::string::npos) - { + + if (Text2SkinSetup.MarqueeReset && mUpdate.resetMarquee && mUpdate.currentItem.find(Text, 0) != std::string::npos) { state.offset = 0; state.direction = 1; state.nexttime = 0; state.scrolling = false; mUpdate.foundFirstItem = true; } - else - { - if (mUpdate.foundFirstItem) - { + else { + if (mUpdate.foundFirstItem) { mUpdate.resetMarquee = false; mUpdate.foundFirstItem = false; } } - + if (state.nexttime == 0) state.nexttime = mNow + 1500; else if (mNow >= state.nexttime) { @@ -592,21 +589,18 @@ void cText2SkinRender::DrawScrollbar(const txPoint &Pos, const txSize &Size, con DrawRectangle(sp, ss, Fg); } } - else if (mMenuScrollbar.Available()) - { + else if (mMenuScrollbar.Available()) { DrawRectangle(Pos, Size, Bg); txPoint sbPoint = Pos; txSize sbSize = Size; - if (sbSize.h > sbSize.w) - { + if (sbSize.h > sbSize.w) { // -1 to get at least 1 pixel height double top = double(mMenuScrollbar.Top()) / mMenuScrollbar.total * (sbSize.h - 1); double bottom = double(mMenuScrollbar.Bottom()) / mMenuScrollbar.total * (sbSize.h - 1); sbPoint.y += (uint)top; sbSize.h -= (uint)top + (uint)bottom; } - else - { + else { // -1 to get at least 1 pixel height double left = double(mMenuScrollbar.Top()) / mMenuScrollbar.total * (sbSize.w - 1); double right = double(mMenuScrollbar.Bottom()) / mMenuScrollbar.total * (sbSize.w - 1); @@ -639,8 +633,8 @@ std::string cText2SkinRender::ImagePath(const std::string &Filename) { if (mRender) return (*Filename.data() == '/') - ? Filename - : mRender->mBasePath + "/" + Filename; + ? Filename + : mRender->mBasePath + "/" + Filename; return ""; } @@ -729,25 +723,25 @@ cxType cText2SkinRender::GetTokenData(const txToken &Token) case tDateTime: return TimeType(time(NULL), Token.Attrib.Text); case tCanScrollUp: - { - if (mScroller) return mScroller->CanScrollUp(); - else if (mMenuScrollbar.Available()) return mMenuScrollbar.CanScrollUp(); - else return false; - } + if (mScroller) + return mScroller->CanScrollUp(); + if (mMenuScrollbar.Available()) + return mMenuScrollbar.CanScrollUp(); + return false; case tCanScrollDown: - { - if (mScroller) return mScroller->CanScrollDown(); - else if (mMenuScrollbar.Available()) return mMenuScrollbar.CanScrollDown(); - else return false; - } - + if (mScroller) + return mScroller->CanScrollDown(); + if (mMenuScrollbar.Available()) + return mMenuScrollbar.CanScrollDown(); + return false; + case tIsRecording: return cRecordControls::Active(); - + case tOsdWidth: return (cxType)mBaseSize.w; - + case tOsdHeight: return (cxType)mBaseSize.h; - + #if VDRVERSNUM >=10318 case tAudioTrack: { cDevice *dev = cDevice::PrimaryDevice(); @@ -137,16 +137,15 @@ public: static bool ItemColor(const std::string &Color, tColor &Result); static std::string ImagePath(const std::string &Filename); static cxType GetToken(const txToken &Token); - + // provide scrollbar in every menu - struct tMenuScrollbar - { + struct tMenuScrollbar { uint current; // overall (0 ... toal-1) uint currentOnScreen; // on the current screen (0 ... maxItems-1) uint total; uint maxItems; // viewable on current screen std::vector<std::string> items; - + tMenuScrollbar(void) : current(0), currentOnScreen(0), total(0), maxItems(0) {} bool Available(void) { return Text2SkinSetup.MenuScrollbar ? total > maxItems : false; } uint Top(void) { return current - currentOnScreen; } @@ -154,16 +153,15 @@ public: bool CanScrollUp(void) { return Text2SkinSetup.MenuScrollbar ? Top() > 0 : false; } bool CanScrollDown(void) { return Text2SkinSetup.MenuScrollbar ? Bottom() > 0 : false; } } mMenuScrollbar; - + // update infos (e.g. timerConflict) - struct tUpdate - { + struct tUpdate { bool timerConflict; bool events; std::string currentItem; bool resetMarquee; bool foundFirstItem; - + tUpdate(void) : timerConflict(true), events(true), currentItem(""), resetMarquee(true), foundFirstItem(false) {} } mUpdate; }; @@ -35,7 +35,6 @@ bool cText2SkinSetup::SetupParse(const char *Name, const char *Value) { #endif else if (strcmp(Name, "MaxCacheFill") == 0) MaxCacheFill = atoi(Value); else return false; - return true; } @@ -12,7 +12,7 @@ public: cText2SkinSetup(void); bool SetupParse(const char *Name, const char *Value); - + int MenuScrollbar; int MarqueeLeftRight; int MarqueeReset; @@ -33,11 +33,8 @@ void cText2SkinStatus::SetRender(cText2SkinRender *Render) mNextRecording = 0; } -#if VDRVERSNUM >= 10338 -void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name, const char *FileName, bool On) -#else -void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name) -#endif +void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name, + const char *FileName, bool On) { Dprintf("cText2SkinStatus::Replaying(%s)\n", Name); eReplayMode oldMode = mReplayMode; @@ -45,7 +42,7 @@ void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name) if (mRender != NULL) mRender->UpdateLock(); - if (Name != NULL) { + if (On) { mReplayMode = replayMPlayer; if (strlen(Name) > 6 && Name[0]=='[' && Name[3]==']' && Name[5]=='(') { int i; @@ -60,14 +57,12 @@ void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name) } } #if VDRVERSNUM >= 10338 - else if (const cRecording *rec = GetRecordingByFileName(FileName)) - { + else if (const cRecording *rec = GetRecordingByFileName(FileName)) { mReplay = rec; mReplayMode = replayNormal; } #else - else if (const cRecording *rec = GetRecordingByName(Name)) - { + else if (const cRecording *rec = GetRecordingByName(Name)) { mReplay = rec; mReplayMode = replayNormal; } @@ -103,11 +98,8 @@ void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name) } } -#if VDRVERSNUM >= 10338 -void cText2SkinStatus::Recording(const cDevice *Device, const char *Name, const char *FileName, bool On) -#else -void cText2SkinStatus::Recording(const cDevice *Device, const char *Name) -#endif +void cText2SkinStatus::Recording(const cDevice *Device, const char *Name, + const char *FileName, bool On) { if (mRender != NULL) mRender->UpdateLock(); @@ -130,38 +122,37 @@ void cText2SkinStatus::Recording(const cDevice *Device, const char *Name) void cText2SkinStatus::OsdClear(void) { +#if VDRVERSNUM >= 10507 + if (I18nCurrentLanguage() != mLastLanguage) { + mLastLanguage = I18nCurrentLanguage(); +#else if (Setup.OSDLanguage != mLastLanguage) { mLastLanguage = Setup.OSDLanguage; +#endif cxString::Reparse(); } - + if (mRender != NULL) - { mRender->mMenuScrollbar.total = 0; - } } void cText2SkinStatus::OsdCurrentItem(const char *Text) { - if (mRender && Text) - { + if (mRender && Text) { // update infos cText2SkinRender::tUpdate *u = &mRender->mUpdate; //static std::string lastItem; - + //lastItem = u->currentItem; u->currentItem = Text; u->resetMarquee = true; u->foundFirstItem = false; - + // find current item in scrollbar - if (Text2SkinSetup.MenuScrollbar) - { + if (Text2SkinSetup.MenuScrollbar) { cText2SkinRender::tMenuScrollbar *sb = &mRender->mMenuScrollbar; - for (uint i = 0; i < sb->total; i++) - { - if (sb->items[i] == Text) - { + for (uint i = 0; i < sb->total; i++) { + if (sb->items[i] == Text) { sb->current = i; break; } @@ -172,62 +163,53 @@ void cText2SkinStatus::OsdCurrentItem(const char *Text) void cText2SkinStatus::OsdItem(const char *Text, int Index) { - if (mRender && Text2SkinSetup.MenuScrollbar && Text) - { + if (mRender && Text2SkinSetup.MenuScrollbar && Text) { uint curr = (uint)Index; cText2SkinRender::tMenuScrollbar *sb = &mRender->mMenuScrollbar; - + if (curr < sb->items.size()) - { sb->items[curr] = Text; - } - else - { + else { sb->items.push_back(Text); sb->total = curr + 1; } - - if (curr + 1 > sb->total) sb->total = curr + 1; + + if (curr + 1 > sb->total) + sb->total = curr + 1; } } void cText2SkinStatus::UpdateEvents(void) { - if (mRender->mUpdate.events) - { + if (mRender->mUpdate.events) { mRender->mUpdate.events = false; - + mEvents.Clear(); Timers.IncBeingEdited(); - - for (cTimer *tim = Timers.First(); tim; tim = Timers.Next(tim)) - { - if (tim->HasFlags(tfActive)) - { + + for (cTimer *tim = Timers.First(); tim; tim = Timers.Next(tim)) { + if (tim->HasFlags(tfActive)) { int i = 0; cTimer dummy; dummy = *tim; - - do - { + + do { mEvents.Add(new tEvent(&dummy)); - - if (!dummy.IsSingleEvent()) // add 4 additional rep. timer - { + + if (!dummy.IsSingleEvent()) { // add 4 additional rep. timer int j = 0; - do - { + do { j++; // just to avoid a endless loop dummy.Skip(); dummy.Matches(); // Refresh start- and end-time } while (!dummy.DayMatches(dummy.StartTime()) && (j < 7)); } - + i++; } while (!dummy.IsSingleEvent() && i < 5); } } - + Timers.DecBeingEdited(); mEvents.Sort(); } @@ -236,23 +218,23 @@ void cText2SkinStatus::UpdateEvents(void) cxType cText2SkinStatus::GetTokenData(const txToken &Token) { int event = 0; - + switch (Token.Type) { case tReplayMode: return ReplayNames[mReplayMode]; - + case tFrontendSTR: return GetFrontendSTR(); - + case tFrontendSNR: return GetFrontendSNR(); - + case tFrontendHasLock: return GetFrontendHasLock(); - + case tFrontendHasSignal: return GetFrontendHasSignal(); - + case tCurrentEventsTitle3: event++; case tCurrentEventsTitle2: @@ -260,9 +242,9 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) case tCurrentEventsTitle1: UpdateEvents(); return mEvents.Count() > event - ? (cxType)mEvents.Get(event)->title.c_str() - : (cxType)false; - + ? (cxType)mEvents.Get(event)->title.c_str() + : (cxType)false; + case tCurrentEventsStartDateTime3: event++; case tCurrentEventsStartDateTime2: @@ -270,9 +252,9 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) case tCurrentEventsStartDateTime1: UpdateEvents(); return mEvents.Count() > event - ? (cxType)TimeType(mEvents.Get(event)->startTime, Token.Attrib.Text) - : (cxType)false; - + ? (cxType)TimeType(mEvents.Get(event)->startTime, Token.Attrib.Text) + : (cxType)false; + case tCurrentEventsStopDateTime3: event++; case tCurrentEventsStopDateTime2: @@ -280,8 +262,8 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) case tCurrentEventsStopDateTime1: UpdateEvents(); return mEvents.Count() > event - ? (cxType)TimeType(mEvents.Get(event)->stopTime, Token.Attrib.Text) - : (cxType)false; + ? (cxType)TimeType(mEvents.Get(event)->stopTime, Token.Attrib.Text) + : (cxType)false; case tCurrentEventsChannelNumber3: event++; @@ -290,8 +272,8 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) case tCurrentEventsChannelNumber1: UpdateEvents(); return mEvents.Count() > event - ? (cxType)mEvents.Get(event)->channelNumber - : (cxType)false; + ? (cxType)mEvents.Get(event)->channelNumber + : (cxType)false; case tCurrentEventsChannelName3: event++; @@ -300,8 +282,8 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) case tCurrentEventsChannelName1: UpdateEvents(); return mEvents.Count() > event - ? (cxType)mEvents.Get(event)->channelName.c_str() - : (cxType)false; + ? (cxType)mEvents.Get(event)->channelName.c_str() + : (cxType)false; case tCurrentEventsIsRecording3: event++; @@ -310,28 +292,25 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) case tCurrentEventsIsRecording1: UpdateEvents(); return mEvents.Count() > event - ? (cxType)mEvents.Get(event)->isRecording - : (cxType)false; - + ? (cxType)mEvents.Get(event)->isRecording + : (cxType)false; + case tTimerConflicts: #if VDRVERSNUM >= 10330 if (Text2SkinSetup.CheckTimerConflict) { - if (mRender->mUpdate.timerConflict) { + if (mRender->mUpdate.timerConflict) { Epgsearch_lastconflictinfo_v1_0 conflict; mRender->mUpdate.timerConflict = false; - - if (cPluginManager::CallFirstService("Epgsearch-lastconflictinfo-v1.0", &conflict)) { + + if (cPluginManager::CallFirstService("Epgsearch-lastconflictinfo-v1.0", &conflict)) mTimerConflicts = conflict.relevantConflicts; - } else { + else mTimerConflicts = 0; - } } return mTimerConflicts; } else #endif - { return 0; - } #if VDRVERSNUM >= 10325 #if VDRVERSNUM >= 10338 @@ -360,32 +339,33 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) case tReplayDateTime: return (cxType)false; - + case tReplayShortText: return (cxType)false; case tReplayDescription: return (cxType)false; #endif - + case tReplayLanguageCode: - if (mReplay) - { + if (mReplay) { const cComponents *components = mReplay->Info()->Components(); - if (components) - { + if (components) { int index = Token.Attrib.Number; - + // don't return language-code for the video-stream - for (int i = 0; i < components->NumComponents(); i++) - { - const tComponent *c = components->Component(i); - if (c->stream != 2) index++; // only audio-streams + for (int i = 0; i < components->NumComponents(); i++) { + const tComponent *c = components->Component(i); + if (c->stream != 2) // only audio-streams + index++; { std::string buffer(c->language); - if (c->type == 1) buffer.append("MONO"); - if ((c->type == 2) || (c->type == 4)) buffer.append("DUAL"); - if (c->type == 5) buffer.append("DD"); + if (c->type == 1) + buffer.append("MONO"); + if ((c->type == 2) || (c->type == 4)) + buffer.append("DUAL"); + if (c->type == 5) + buffer.append("DD"); return (cxType)buffer.c_str(); } } @@ -393,40 +373,36 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) } return false; - case tReplayLanguageDescription: - if (mReplay) - { + case tReplayLanguageDescription: + if (mReplay) { const cComponents *components = mReplay->Info()->Components(); - if (components) - { + if (components) { int index = Token.Attrib.Number; - + // don't return language-code for the video-stream - for (int i = 0; i < components->NumComponents(); i++) - { - const tComponent *c = components->Component(i); - if (c->stream != 2) index++; // only audio-streams - if (i == index) return (cxType)c->description; + for (int i = 0; i < components->NumComponents(); i++) { + const tComponent *c = components->Component(i); + if (c->stream != 2) // only audio-streams + index++; + if (i == index) + return (cxType)c->description; } } } return false; - case tReplayVideoAR: - if (mReplay) - { + case tReplayVideoAR: + if (mReplay) { const cComponents *components = mReplay->Info()->Components(); - if (components) - { - for (int i = 0; i < components->NumComponents(); i++) - { - const tComponent *c = components->Component(i); - if (c->stream == 1) - { - switch (c->type) - { - case 1: return "4:3"; - case 3: return "16:9"; + if (components) { + for (int i = 0; i < components->NumComponents(); i++) { + const tComponent *c = components->Component(i); + if (c->stream == 1) { + switch (c->type) { + case 1: + return "4:3"; + case 3: + return "16:9"; } } } @@ -8,7 +8,6 @@ #include "common.h" #include <vdr/status.h> - class cText2SkinRender; class cText2SkinStatus: public cStatus { @@ -28,8 +27,7 @@ public: typedef std::string tRecordingInfo; typedef std::vector<tRecordingInfo> tRecordings; - struct tEvent : public cListObject - { + struct tEvent : public cListObject { time_t startTime; time_t stopTime; int channelNumber; @@ -37,7 +35,7 @@ public: int priority; bool isRecording; std::string title; - + tEvent(cTimer *timer) : startTime(timer->StartTime()), stopTime(timer->StopTime()), @@ -46,21 +44,21 @@ public: priority(timer->Priority()), isRecording(timer->Recording()), title(timer->File()) {} - - virtual int Compare(const cListObject &listObj) const - { + + virtual int Compare(const cListObject &listObj) const { tEvent *e = (tEvent *)&listObj; int r = startTime - e->startTime; - if (r == 0) r = e->priority - priority; + if (r == 0) + r = e->priority - priority; return r; } }; - + typedef std::vector<tEvent> tEvents; - + private: void UpdateEvents(void); - + cText2SkinRender *mRender; eReplayMode mReplayMode; bool mReplayIsLoop; @@ -75,17 +73,15 @@ private: int mTimerConflicts; protected: -#if VDRVERSNUM >= 10338 - virtual void Replaying(const cControl *Control, const char *Name, const char *FileName, bool On); - virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On); -#else - virtual void Replaying(const cControl *Control, const char *Name); - virtual void Recording(const cDevice *Device, const char *Name); -#endif + virtual void Replaying(const cControl *Control, const char *Name, + const char *FileName, bool On); + virtual void Recording(const cDevice *Device, const char *Name, + const char *FileName, bool On); virtual void OsdClear(void); + virtual void OsdCurrentItem(const char *Text); virtual void OsdItem(const char *Text, int Index); - + public: cText2SkinStatus(void); diff --git a/text2skin.c b/text2skin.c index dc41f15..30c806b 100644 --- a/text2skin.c +++ b/text2skin.c @@ -14,9 +14,9 @@ #include "loader.h" #include "status.h" -const char *cText2SkinPlugin::VERSION = "1.1-cvs_ext-0.10"; +const char *cText2SkinPlugin::VERSION = "1.2"; const char *cText2SkinPlugin::SKINVERSION = "1.0"; -const char *cText2SkinPlugin::DESCRIPTION = "Loader for text-based skins"; +const char *cText2SkinPlugin::DESCRIPTION = trNOOP("Loader for text-based skins"); cText2SkinPlugin::cText2SkinPlugin(void) { } @@ -33,7 +33,7 @@ const char **cText2SkinPlugin::SVDRPHelpPages(void) " current version should be loaded).", NULL }; - return HelpPages; + return HelpPages; } cString cText2SkinPlugin::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) @@ -48,8 +48,12 @@ cString cText2SkinPlugin::SVDRPCommand(const char *Command, const char *Option, #endif bool cText2SkinPlugin::Start(void) { +#if VDRVERSNUM < 10507 RegisterI18n(Phrases); Text2SkinStatus.SetLanguage(Setup.OSDLanguage); +#else + Text2SkinStatus.SetLanguage(I18nCurrentLanguage()); +#endif cText2SkinLoader::Start(); return true; } diff --git a/xml/object.c b/xml/object.c index c63c2ea..4a3beec 100644 --- a/xml/object.c +++ b/xml/object.c @@ -147,11 +147,10 @@ const cFont *cxObject::Font(void) const if ((font = cText2SkinFont::Load(SkinPath() + "/" + mSkin->Name(), mFontFace, mFontSize, mFontWidth)) != NULL) return font; - - if ((font = cText2SkinFont::Load(SkinPath() + "/fonts", mFontFace, mFontSize, mFontWidth)) - != NULL) + + if ((font = cText2SkinFont::Load(SkinPath() + "/fonts", mFontFace, mFontSize, mFontWidth)) != NULL) return font; - + return cFont::GetFont(fontOsd); } diff --git a/xml/string.c b/xml/string.c index 7568b37..3f671bd 100644 --- a/xml/string.c +++ b/xml/string.c @@ -11,7 +11,8 @@ static const char *Tokens[__COUNT_TOKEN__] = { // Channel Display "ChannelNumber", "ChannelName", "ChannelShortName", "ChannelBouquet", "ChannelPortal", "ChannelSource", "ChannelID", "PresentStartDateTime", "PresentVPSDateTime", - "CurrentEventsTitle1", "CurrentEventsStartDateTime1", "CurrentEventsStopDateTime1", "CurrentEventsChannelNumber1", "CurrentEventsChannelName1", "CurrentEventsIsRecording1", "CurrentEventsTitle2", "CurrentEventsStartDateTime2", "CurrentEventsStopDateTime2", "CurrentEventsChannelNumber2", "CurrentEventsChannelName2", "CurrentEventsIsRecording2", + "CurrentEventsTitle1", "CurrentEventsStartDateTime1", "CurrentEventsStopDateTime1", "CurrentEventsChannelNumber1", "CurrentEventsChannelName1", "CurrentEventsIsRecording1", + "CurrentEventsTitle2", "CurrentEventsStartDateTime2", "CurrentEventsStopDateTime2", "CurrentEventsChannelNumber2", "CurrentEventsChannelName2", "CurrentEventsIsRecording2", "CurrentEventsTitle3", "CurrentEventsStartDateTime3", "CurrentEventsStopDateTime3", "CurrentEventsChannelNumber3", "CurrentEventsChannelName3", "CurrentEventsIsRecording3", "TimerConflicts", "PresentEndDateTime", "PresentDuration", "PresentProgress", "PresentRemaining", diff --git a/xml/string.h b/xml/string.h index 55adbcf..a459253 100644 --- a/xml/string.h +++ b/xml/string.h @@ -111,7 +111,7 @@ enum exToken { tReplayName, tReplayDateTime, tReplayShortText, - tReplayDescription, + tReplayDescription, tReplayLanguageCode, tReplayLanguageDescription, tReplayVideoAR, @@ -171,7 +171,7 @@ enum exToken { tButtonBlue, tCanScrollUp, tCanScrollDown, - + #define __COUNT_TOKEN__ (tCanScrollDown + 1) }; @@ -5,6 +5,7 @@ #ifndef VDR_TEXT2SKIN_XML_TYPE_H #define VDR_TEXT2SKIN_XML_TYPE_H +#include <cstdlib> #include <string> #include <vdr/tools.h> #include <stdio.h> @@ -35,7 +35,7 @@ XML::XML(const string &file) { ifstream f(file.c_str(), ios::in|ios::binary|ios::ate); size = f.tellg(); f.seekg(0, ios::beg); - buffer = new char [size+1]; + buffer = new char [size]; f.read(buffer, size); f.close(); data.assign(buffer, size); |