diff options
author | Andreas Mair <amair.sob@googlemail.com> | 2009-04-24 14:32:32 +0200 |
---|---|---|
committer | Andreas Mair <amair.sob@googlemail.com> | 2009-04-24 14:32:32 +0200 |
commit | 95977e11c0a5c1170351f2fafe400519d7b1086b (patch) | |
tree | 92259a6c6b8a7dc50ed9a0c3a2a172b204a4f54c /config.c | |
parent | 7b34d920b0043281d7877d1e0ece8642d27f212d (diff) | |
download | vdr-plugin-skinenigmang-95977e11c0a5c1170351f2fafe400519d7b1086b.tar.gz vdr-plugin-skinenigmang-95977e11c0a5c1170351f2fafe400519d7b1086b.tar.bz2 |
2009-04-25: Version 0.1.0v0.1.0
- Fixed: Calculating width of events' start times in channel info OSD (Reported by tomglx @vdr-poprtal.de).
- Changed: pause scrolling when text has scrolled all to the left in scroll behaviour "to the left" (Reported by Andreas Brugger).
- Reworked: (simplified) font loading/caching.
- Updated Italian translation (Provided by Diego Pierotto).
- Removed: ENABLE_COPYFONT define.
- Changed: Reduced number of font recreations (Reported by balta @vdr-portal.de).
- Added: more CA systems to text mappings in channel info OSD (Submitted by free-x @vdr-portal.de).
- Added: symbol in channel info OSD if current channel has subtitles.
- Changed: background colors for the DarkBlue theme (Submitted by zulu @vdr-portal.de).
- Added: New option "Show CA system as text".
- Changed: Reduced number of locks while drawing to OSD which increases display speed especially in menu OSD.
- Added: show signal strength and signal-to-noise ratio in channel info OSD (can be disabled by setting SKINENIGMA_DISABLE_SIGNALINFO to 1).
- Fixed: compiler error with certain gcc versions (Reported by C-3PO @ vdr-portal.de).
- Changed: smooth scrolling text (based on skinelchi by Christoph Haubrich <christoph.haubrich (AT) web.de>).
- Removed: SKINENIGMA_DISABLE_ANIMATED_TEXT define.
- Changed: Replace "/" by "~" in channel logo names.
- Added: new setting "Show scrollbar in menu".
- Added: Override VDR's SetTabs() to adopt column widths in menu OSD to selected font size.
- Added: Support subtitle tracks in tracks OSD: logo will only be shown if icons/subtitle/subtitle.xpm exists.
- Fixed: missing logo in tracks OSD while using single area.
- Minor bugfixes and enhancements.
- Requires at least VDR v1.6.0.
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 175 |
1 files changed, 25 insertions, 150 deletions
@@ -23,15 +23,7 @@ const char *imageExtensionTexts[NUM_IMAGEEXTENSIONTEXTS] = { "xpm", "jpg", "png" cEnigmaConfig EnigmaConfig; -#ifdef HAVE_FREETYPE -# if VDRVERSNUM != 10503 cGraphtftFont FontCache; -# endif -#endif - -#ifndef DISABLE_ANIMATED_TEXT -const cFont *vdrFonts[eDvbFontSize]; -#endif FontConfig allFontConfig[FONT_NUMFONTS] = { @@ -65,13 +57,11 @@ cEnigmaConfig::cEnigmaConfig() : showAuxInfo(1), showLogo(1), showVps(1), showSy imageWidth(120), imageHeight(80), imageExtension(0), fullTitleWidth(0), useTextEffects(0), scrollDelay(50), scrollPause(1500), scrollMode(0), blinkPause(1000), scrollInfo(1), scrollListItem(1), scrollOther(1), scrollTitle(1), - dynOsd(0), statusLineMode(0), showWssSymbols(0), showStatusSymbols(1) + dynOsd(0), statusLineMode(0), showWssSymbols(0), showStatusSymbols(1), showScrollbar(1), + showSignalInfo(1), showCaMode(0) { memset(logoDir, 0, sizeof(logoDir)); memset(strImagesDir, 0, sizeof(strImagesDir)); -#ifdef HAVE_FREETYPE - memset(strFontsDir, 0, sizeof(strFontsDir)); -#endif for (int id = 0; id < FONT_NUMFONTS; id++) { switch (id) { @@ -93,16 +83,10 @@ cEnigmaConfig::cEnigmaConfig() : showAuxInfo(1), showLogo(1), showVps(1), showSy allFonts[id].Width = 100; allFonts[id].Size = 26; } - -#ifndef DISABLE_ANIMATED_TEXT - for (int id = 0; id < eDvbFontSize; id++) - vdrFonts[id] = NULL; -#endif } cEnigmaConfig::~cEnigmaConfig() { - INIT_FONTS; // free allocated fonts } void cEnigmaConfig::SetLogoDir(const char *logodirP) @@ -130,140 +114,46 @@ const char *cEnigmaConfig::GetImageExtension(void) #endif } -#ifdef HAVE_FREETYPE -void cEnigmaConfig::SetFontsDir(const char *dir) -{ - if (dir) { - debug("cEnigmaConfig::SetFontsDir(%s)", dir); - strncpy(strFontsDir, dir, sizeof(strFontsDir)); - } -} -#endif - -#ifndef DISABLE_ANIMATED_TEXT -void cEnigmaConfig::InitFonts(void) -{ - for (int id = 0; id < eDvbFontSize; id++) { - if (vdrFonts[id]) { - delete vdrFonts[id]; - vdrFonts[id] = NULL; - } - } -} -#endif - const cFont *cEnigmaConfig::GetFont(int id) { const cFont *res = NULL; + eDvbFont nVdrId = (eDvbFont)allFonts[id].VdrId; if (::Setup.UseSmallFont == 1) { // if "Use small font" == "skin dependent" - if (allFonts[id].VdrId == FONT_TRUETYPE) { + if (nVdrId == FONT_TRUETYPE) { if (!isempty(allFonts[id].Name)) { -#ifdef HAVE_FREETYPE - char *cachename; -#if VDRVERSNUM < 10503 - asprintf(&cachename, "%s_%d_%d_%d", allFonts[id].Name, allFonts[id].Size, allFonts[id].Width, Setup.OSDLanguage); - if (FontCache.Load(string(strFontsDir) + "/" + string(allFonts[id].Name), cachename, allFonts[id].Size, Setup.OSDLanguage, allFonts[id].Width)) { -#else - asprintf(&cachename, "%s_%d_%d_%s", allFonts[id].Name, allFonts[id].Size, allFonts[id].Width, Setup.OSDLanguage); - if (FontCache.Load(string(allFonts[id].Name), cachename, allFonts[id].Size, allFonts[id].Width)) { -#endif - res = FontCache.GetFont(cachename); - } else { - error("ERROR: EnigmaNG: Couldn't load font %s:%d", allFonts[id].Name, allFonts[id].Size); - } - free(cachename); -#else - error("ERROR: EnigmaNG: Font engine not enabled at compile time!"); -#endif + res = FontCache.GetFont(allFonts[id].Name, allFonts[id].Size, allFonts[id].Width); } - } else if (allFonts[id].VdrId > FONT_TRUETYPE) { -#ifdef DISABLE_ANIMATED_TEXT - res = cFont::GetFont((eDvbFont)(allFonts[id].VdrId - 1)); -#else - res = CopyFont((eDvbFont)(allFonts[id].VdrId - 1)); -#endif } else { -#ifdef DISABLE_ANIMATED_TEXT - res = cFont::GetFont((eDvbFont)allFonts[id].VdrId); -#else - res = CopyFont((eDvbFont)allFonts[id].VdrId); -#endif + if (nVdrId > FONT_TRUETYPE) + nVdrId = (eDvbFont)(nVdrId - 1); } + } else { + if (allFonts[id].Default == fontFix) + nVdrId = fontFix; + if (::Setup.UseSmallFont == 2) + nVdrId = fontSml; + else + nVdrId = fontOsd; + } - if (res == NULL) { -#ifdef DISABLE_ANIMATED_TEXT - res = cFont::GetFont((eDvbFont)allFonts[id].Default); -#else - res = CopyFont((eDvbFont)allFonts[id].Default); -#endif + if (res == NULL) { + switch (nVdrId) { + case fontOsd: res = FontCache.GetFont(Setup.FontOsd, Setup.FontOsdSize); break; + case fontSml: res = FontCache.GetFont(Setup.FontSml, Setup.FontSmlSize); break; + case fontFix: res = FontCache.GetFont(Setup.FontFix, Setup.FontFixSize); break; } } if (res) return res; - else { -#ifdef DISABLE_ANIMATED_TEXT - return cFont::GetFont(::Setup.UseSmallFont == 2 ? fontSml : fontOsd); -#else - return CopyFont(::Setup.UseSmallFont == 2 ? fontSml : fontOsd); -#endif - } -} - -#ifndef DISABLE_ANIMATED_TEXT -const cFont *cEnigmaConfig::CopyFont(eDvbFont vdrId) -{ -# ifdef ENABLE_COPYFONT - if (vdrFonts[vdrId]) { - return vdrFonts[vdrId]; - } - - const cFont *res = NULL; -# if VDRVERSNUM < 10503 - const cFont *src = cFont::GetFont(vdrId); - - int num_rows_global = src->Height(); - int num_rows = num_rows_global + 2; - cFont::tPixelData* font_data = new cFont::tPixelData[225 * num_rows]; - - for (int i = 0; i < 225; i++) { - for (int j = 0; j < num_rows; j++) { - font_data[i * num_rows + j] = 0x0000000000000000; - } - } - font_data[0 + 0] = src->CharData(0)->width; - font_data[0 + 1] = num_rows_global; - - for (int num_char = 33, i = 1; num_char < cFont::NUMCHARS; i++, num_char++) { - const cFont::tCharData *char_data = src->CharData(num_char); - font_data[i * num_rows + 0] = char_data->width; - font_data[i * num_rows + 1] = char_data->height; - for(int j = 0; j < (int)char_data->height; j++) { - cFont::tPixelData Data = (cFont::tPixelData)char_data->lines[j]; - font_data[i * num_rows + 2 + j] = Data; - } - } - - res = new cFont(font_data); -# else - switch (vdrId) { - case fontSml: res = cFont::CreateFont(Setup.FontSml, Setup.FontSmlSize); break; - case fontFix: res = cFont::CreateFont(Setup.FontFix, Setup.FontFixSize); break; - default: res = cFont::CreateFont(Setup.FontOsd, Setup.FontOsdSize); break; - } -# endif - vdrFonts[vdrId] = res; - return res; -# else - return cFont::GetFont(vdrId); -# endif + else + return cFont::GetFont(nVdrId); } -#endif void cEnigmaConfig::SetFont(int id, const char *font) { if (id >= 0 && id < FONT_NUMFONTS && font) { - char *tmp = strrchr(font, ':'); + const char *tmp = strrchr(font, ':'); if (tmp) { strncpy(allFonts[id].Name, font, std::min((int)sizeof(allFonts[id].Name), (int)(tmp - font))); allFonts[id].Size = atoi(tmp + 1); @@ -294,28 +184,13 @@ void cEnigmaConfig::GetOsdSize(struct EnigmaOsdSize *size) size->w = Setup.OSDWidth; size->h = Setup.OSDHeight; -#if VDRVERSNUM >= 10504 if (dynOsd) { size->y = cOsd::OsdTop(); size->x = cOsd::OsdLeft(); size->w = cOsd::OsdWidth(); size->h = cOsd::OsdHeight(); } -#else -# ifdef USE_PLUGIN_AVARDS - if (dynOsd) { - cPlugin *p = cPluginManager::GetPlugin("avards"); - if (p) { - avards_MaxOSDsize_v1_0 OSDsize; - if (p->Service(AVARDS_MAXOSDSIZE_SERVICE_STRING_ID, &OSDsize)) { - size->y = OSDsize.top; - size->x = OSDsize.left; - size->w = OSDsize.width; - size->h = OSDsize.height; - } - } - } -# endif -#endif //VDRVERSNUM >= 10504 + + debug("cEnigmaConfig::GetOsdSize() x=%d(%d) y=%d(%d) w=%d(%d) h=%d(%d)", size->x, Setup.OSDLeft, size->y, Setup.OSDTop, size->w, Setup.OSDWidth, size->h, Setup.OSDHeight); } // vim:et:sw=2:ts=2: |