From 3d738f9c8a5d48bb22b3330c036b6887b0f9d6c1 Mon Sep 17 00:00:00 2001 From: lordjaxom Date: Sun, 13 Jun 2004 18:40:59 +0000 Subject: - added parameter alpha for images - added ReplayMode as Logo to display a replaylogo (normal, vcd, mp3, dvd, ...) - added some german and finnish (thx to Rolf Ahrenberg) translations - fixed VPSTime which was displayed although is was equal to the StartTime - fixed MenuItems which displayed non-Text items periodically - fixed calculation of the editable width in the main menu - fixed animation delay (specified in 1/100th, used 1/1000th) - flushing cache when entering a new display (now the cache basically holds all items necessary in one display) - removed "flush image cache" from setup menu - added "max. cache size" to setup menu --- HISTORY | 14 ++++++++++++ Makefile | 4 ++-- SKINS | 4 ++++ SKINS.de | 4 ++++ bitmap.c | 36 ++++++++++++++++++++--------- bitmap.h | 10 ++++---- common.c | 7 ++++-- common.h | 20 ++++++++++++---- data.c | 4 +++- data.h | 4 +++- display.c | 3 ++- i18n.c | 29 ++++------------------- render.c | 76 +++++++++++++++++++++++++++++++++++++++---------------------- render.h | 7 +++--- setup.c | 33 +++++++++++++++++++-------- setup.h | 19 +++++++++++++--- status.c | 42 ++++++++++++++++++++++++++++++++++ status.h | 26 +++++++++++++++++++++ text2skin.c | 6 ++--- 19 files changed, 251 insertions(+), 97 deletions(-) create mode 100644 status.c create mode 100644 status.h diff --git a/HISTORY b/HISTORY index cda9fb0..243fedb 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,20 @@ VDR Plugin 'text2skin' Revision History --------------------------------------- +2004-06-13: Version 0.0.4 + +- added parameter alpha for images +- added ReplayMode as Logo to display a replaylogo (normal, vcd, mp3, dvd, ...) +- added some german and finnish (thx to Rolf Ahrenberg) translations +- fixed VPSTime which was displayed although is was equal to the StartTime +- fixed MenuItems which displayed non-Text items periodically +- fixed calculation of the editable width in the main menu +- fixed animation delay (specified in 1/100th, used 1/1000th) +- flushing cache when entering a new display (now the cache basically holds + all items necessary in one display) +- removed "flush image cache" from setup menu +- added "max. cache size" to setup menu + 2004-06-11: Version 0.0.3 - fixed VPSTime which was displayed on channels that didn't even have VPS diff --git a/Makefile b/Makefile index 934dce2..ddf7267 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ HAVE_IMAGEMAGICK=1 # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING # ------------------------------------------------------------- # -# $Id: Makefile,v 1.9 2004/06/08 20:45:52 lordjaxom Exp $ +# $Id: Makefile,v 1.10 2004/06/12 18:00:05 lordjaxom Exp $ # # The official name of this plugin. @@ -70,7 +70,7 @@ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' ### The object files (add further files here): OBJS = $(PLUGIN).o loader.o data.o display.o render.o common.o bitmap.o \ - file.o i18n.o theme.o cache.o setup.o + file.o i18n.o theme.o cache.o setup.o status.o ### Implicit rules: diff --git a/SKINS b/SKINS index 2880e71..da5ea09 100644 --- a/SKINS +++ b/SKINS @@ -1,4 +1,8 @@ + +THIS DOCUMENT IS NOT UP-TO-DATE (sorry) + + How To create text-based skins ------------------------------ diff --git a/SKINS.de b/SKINS.de index 63c7aae..2e1cc8e 100644 --- a/SKINS.de +++ b/SKINS.de @@ -1,4 +1,8 @@ + +DIESES DOKUMENT IST NICHT AUF DEM NEUESTEN STAND (sorry) + + Wie man textbasierte Skins erstellt ----------------------------------- diff --git a/bitmap.c b/bitmap.c index dc297e4..9e7c02b 100644 --- a/bitmap.c +++ b/bitmap.c @@ -1,8 +1,9 @@ /* - * $Id: bitmap.c,v 1.13 2004/06/11 15:01:58 lordjaxom Exp $ + * $Id: bitmap.c,v 1.15 2004/06/12 19:16:11 lordjaxom Exp $ */ #include "bitmap.h" +#include "setup.h" #include #define X_DISPLAY_MISSING #ifdef HAVE_IMLIB2 @@ -20,9 +21,9 @@ void cImageCache::Delete(string &key, cText2SkinBitmap *&value) { delete value; } -cImageCache cText2SkinBitmap::mCache(10); +cImageCache cText2SkinBitmap::mCache(Text2SkinSetup.MaxCacheFill); -cText2SkinBitmap::cText2SkinBitmap(void)/*: cBitmap(1, 1, 1)*/ { +cText2SkinBitmap::cText2SkinBitmap(void) { mCurrent = 0; mLastGet = 0; } @@ -39,6 +40,7 @@ cBitmap &cText2SkinBitmap::Get(int &UpdateIn) { time_t upd, cur = time_ms(); int diff; if (mLastGet == 0) { + Dprintf("lastget was %d\n", mLastGet); mLastGet = cur; upd = mDelay; } else if ((diff = cur - mLastGet) >= mDelay) { @@ -49,13 +51,16 @@ cBitmap &cText2SkinBitmap::Get(int &UpdateIn) { upd = mDelay - diff; } + Dprintf("delay: %d, diff %d\n", mDelay, diff); + if (UpdateIn == 0 || UpdateIn > upd) UpdateIn = upd; + Dprintf("Get: returning frame %d\n", mCurrent); return *mBitmaps[mCurrent]; } -cText2SkinBitmap *cText2SkinBitmap::Load(const char *Filename) { +cText2SkinBitmap *cText2SkinBitmap::Load(const char *Filename, int Alpha) { if (mCache.Contains(Filename)) { return mCache[Filename]; } else { @@ -64,13 +69,13 @@ cText2SkinBitmap *cText2SkinBitmap::Load(const char *Filename) { bool result = false; if (len > 4) { if (strcmp(Filename + len - 4, ".xpm") == 0) - result = bmp->LoadXpm(Filename); + result = bmp->LoadXpm(Filename, Alpha); else { #ifdef HAVE_IMLIB2 - result = bmp->LoadImlib(Filename); + result = bmp->LoadImlib(Filename, Alpha); #else # ifdef HAVE_IMAGEMAGICK - result = bmp->LoadMagick(Filename); + result = bmp->LoadMagick(Filename, Alpha); # endif #endif } @@ -85,9 +90,14 @@ cText2SkinBitmap *cText2SkinBitmap::Load(const char *Filename) { return false; } -bool cText2SkinBitmap::LoadXpm(const char *Filename) { +bool cText2SkinBitmap::LoadXpm(const char *Filename, int Alpha) { cBitmap *bmp = new cBitmap(1,1,1); if (bmp->LoadXpm(Filename)) { + int count; + if (Alpha && bmp->Colors(count)) { + for (int i = 0; i < count; ++i) + bmp->SetColor(i, (bmp->Color(i) & 0x00FFFFFF) | (Alpha << 24)); + } mBitmaps.push_back(bmp); return true; } @@ -96,7 +106,7 @@ bool cText2SkinBitmap::LoadXpm(const char *Filename) { } #ifdef HAVE_IMLIB2 -bool cText2SkinBitmap::LoadImlib(const char *Filename) { +bool cText2SkinBitmap::LoadImlib(const char *Filename, int Alpha) { Imlib_Image image; cBitmap *bmp = NULL; image = imlib_load_image(Filename); @@ -111,6 +121,8 @@ bool cText2SkinBitmap::LoadImlib(const char *Filename) { for (int y = 0; y < bmp->Height(); ++y) { for (int x = 0; x < bmp->Width(); ++x) { tColor col = (data[pos + 3] << 24) | (data[pos + 2] << 16) | (data[pos + 1] << 8) | data[pos + 0]; + if (Alpha) + col = (col & 0x00FFFFFF) | (Alpha << 24); int res = bmp->Index(col); if (pal > 0 && res == 0) ;//esyslog("ERROR: text2skin: Too many colors used in palette"); @@ -127,7 +139,7 @@ bool cText2SkinBitmap::LoadImlib(const char *Filename) { #endif #ifdef HAVE_IMAGEMAGICK -bool cText2SkinBitmap::LoadMagick(const char *Filename) { +bool cText2SkinBitmap::LoadMagick(const char *Filename, int Alpha) { vector images; cBitmap *bmp = NULL; try { @@ -138,7 +150,7 @@ bool cText2SkinBitmap::LoadMagick(const char *Filename) { esyslog("ERROR: text2skin: Couldn't load %s", Filename); return false; } - mDelay = images[0].animationDelay(); + mDelay = images[0].animationDelay() * 10; for (it = images.begin(); it != images.end(); ++it) { w = (*it).columns(); h = (*it).rows(); @@ -148,6 +160,8 @@ bool cText2SkinBitmap::LoadMagick(const char *Filename) { for (int iy = 0; iy < h; ++iy) { for (int ix = 0; ix < w; ++ix) { tColor col = (((~ptr->opacity & 0xFF00) << 16) | ((ptr->red & 0xFF00) << 8) | (ptr->green & 0xFF00) | ((ptr->blue & 0xFF00) >> 8)); + if (Alpha) + col = (col & 0x00FFFFFF) | (Alpha << 24); bmp->DrawPixel(ix, iy, col); ++ptr; } diff --git a/bitmap.h b/bitmap.h index 1945056..ac0f0e4 100644 --- a/bitmap.h +++ b/bitmap.h @@ -1,5 +1,5 @@ /* - * $Id: bitmap.h,v 1.9 2004/06/08 20:45:52 lordjaxom Exp $ + * $Id: bitmap.h,v 1.10 2004/06/12 18:00:05 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_BITMAP_H @@ -25,7 +25,7 @@ private: cText2SkinBitmap(void); public: - static cText2SkinBitmap *Load(const char *Filename); + static cText2SkinBitmap *Load(const char *Filename, int Alpha = 0); static void FlushCache(void) { mCache.Flush(); } virtual ~cText2SkinBitmap(); @@ -33,12 +33,12 @@ public: cBitmap &Get(int &UpdateIn); void SetColor(int Index, tColor Color) { mBitmaps[mCurrent]->SetColor(Index, Color); } - bool LoadXpm(const char *Filename); + bool LoadXpm(const char *Filename, int Alpha); #ifdef HAVE_IMLIB2 - bool LoadImlib(const char *Filename); + bool LoadImlib(const char *Filename, int Alpha); #endif #ifdef HAVE_IMAGEMAGICK - bool LoadMagick(const char *Filename); + bool LoadMagick(const char *Filename, int Alpha); #endif }; diff --git a/common.c b/common.c index 5903f47..4643b9f 100644 --- a/common.c +++ b/common.c @@ -1,5 +1,5 @@ /* - * $Id: common.c,v 1.8 2004/06/11 15:01:58 lordjaxom Exp $ + * $Id: common.c,v 1.9 2004/06/12 18:00:05 lordjaxom Exp $ */ #include "data.h" @@ -28,7 +28,10 @@ const string DisplayNames[__DISPLAY_COUNT__] = "MessageStatus", "MessageInfo", "MessageWarning", "MessageError", "MenuTitle", "MenuRed", "MenuGreen", "MenuYellow", "MenuBlue", "MenuText", "MenuRecording", "MenuScrollUp", "MenuScrollDown", "MenuItems", - "MenuCurrent", "MenuGroups" }; + "MenuCurrent", "MenuGroups", "ReplayMode" }; + +const string ReplayNames[__REPLAY_COUNT__] = + { "", "normal", "mp3", "mplayer", "dvd", "vcd" }; const char *SkinPath(void) { return cPlugin::ConfigDirectory(PLUGIN_NAME_I18N); diff --git a/common.h b/common.h index ef13be0..64163d9 100644 --- a/common.h +++ b/common.h @@ -1,5 +1,5 @@ /* - * $Id: common.h,v 1.8 2004/06/11 15:01:58 lordjaxom Exp $ + * $Id: common.h,v 1.9 2004/06/12 18:00:05 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_COMMON_H @@ -112,15 +112,27 @@ enum eSkinDisplay { displayMenuRecording, // exc: text displayMenuScrollUp, // exc: symbol displayMenuScrollDown, // exc: symbol - displayMenuItems, - displayMenuCurrent, - displayMenuGroups, + displayMenuItems, // exc: text (TODO: logo?) + displayMenuCurrent, // exc: text (TODO: logo?) + displayMenuGroups, // exc: text (TODO: logo?) + displayReplayMode, // exc: text, logo __DISPLAY_COUNT__ }; + +enum eReplayMode { + replayNone, + replayNormal, + replayMP3, + replayMPlayer, + replayDVD, + replayVCD, + __REPLAY_COUNT__ +}; extern const string SectionNames[__SECTION_COUNT__]; extern const string ItemNames[__ITEM_COUNT__]; extern const string DisplayNames[__DISPLAY_COUNT__]; +extern const string ReplayNames[__REPLAY_COUNT__]; // geometrical structures diff --git a/data.c b/data.c index fa127d9..8e44dae 100644 --- a/data.c +++ b/data.c @@ -1,5 +1,5 @@ /* - * $Id: data.c,v 1.17 2004/06/11 15:01:58 lordjaxom Exp $ + * $Id: data.c,v 1.18 2004/06/12 18:00:05 lordjaxom Exp $ */ #include "data.h" @@ -14,6 +14,7 @@ cText2SkinItem::cText2SkinItem(void) { mSize.h = 0; mBpp = 4; mArc = 0; + mAlpha = 0; mFont = cFont::GetFont(fontOsd); mAlign = taDefault; } @@ -53,6 +54,7 @@ bool cText2SkinItem::ParseItem(const char *Text) { ParseVar(Text, "height", &mSize.h); ParseVar(Text, "bpp", &mBpp); ParseVar(Text, "arc", &mArc); + ParseVar(Text, "alpha", &mAlpha); ParseVar(Text, "fg", mFg); ParseVar(Text, "bg", mBg); ParseVar(Text, "font", &mFont); diff --git a/data.h b/data.h index ae66568..17ab6bf 100644 --- a/data.h +++ b/data.h @@ -1,5 +1,5 @@ /* - * $Id: data.h,v 1.15 2004/06/11 15:01:58 lordjaxom Exp $ + * $Id: data.h,v 1.16 2004/06/12 18:00:05 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_DATA_H @@ -21,6 +21,7 @@ private: SIZE mSize; int mBpp; int mArc; + int mAlpha; string mFg; string mBg; const cFont *mFont; @@ -48,6 +49,7 @@ public: const SIZE &Size(void) const { return mSize; } int Bpp(void) const { return mBpp; } int Arc(void) const { return mArc; } + int Alpha(void) const { return mAlpha; } const string &Fg(void) const { return mFg; } const string &Bg(void) const { return mBg; } const cFont *Font(void) const { return mFont; } diff --git a/display.c b/display.c index c823838..50f042d 100644 --- a/display.c +++ b/display.c @@ -1,5 +1,5 @@ /* - * $Id: display.c,v 1.15 2004/06/07 19:08:42 lordjaxom Exp $ + * $Id: display.c,v 1.16 2004/06/12 18:00:05 lordjaxom Exp $ */ #include "render.h" @@ -246,6 +246,7 @@ void cText2SkinDisplayMenu::Clear(void) { mRender->mMenuEvent = NULL; mRender->mMenuRecording = NULL; mRender->mMenuText = ""; + //mRender->mMessageText = ""; DELETENULL(mRender->mScroller); mRender->Unlock(); mDirty = true; diff --git a/i18n.c b/i18n.c index 5b9cceb..4493b3b 100644 --- a/i18n.c +++ b/i18n.c @@ -1,12 +1,12 @@ /* - * $Id: i18n.c,v 1.5 2004/06/08 20:45:52 lordjaxom Exp $ + * $Id: i18n.c,v 1.6 2004/06/12 21:16:18 lordjaxom Exp $ */ #include "i18n.h" const tI18nPhrase Phrases[] = { { "Loader for text-based skins", - "", + "Lader für textbasierte Skins", "", "", "", @@ -24,34 +24,15 @@ const tI18nPhrase Phrases[] = { "", "" }, - { "Flush image cache", - "Bildspeicher leeren", - "", - "", - "", - "", - "", - "", - "Tyhjennä kuvat välimuistista", - "", - "", - "", - "", - "", - "", - "", - "", - "" - }, - { "Flushing image cache...", - "Bildspeicher wird geleert...", + { "Max. image cache size", + "Max. Größe des Bildspeichers", "", "", "", "", "", "", - "Tyhjennetään välimuistia...", + "Välimuistin maksimikoko", "", "", "", diff --git a/render.c b/render.c index 6c758ef..03ad7eb 100644 --- a/render.c +++ b/render.c @@ -1,5 +1,5 @@ /* - * $Id: render.c,v 1.26 2004/06/11 15:02:57 lordjaxom Exp $ + * $Id: render.c,v 1.30 2004/06/13 18:19:18 lordjaxom Exp $ */ #include "render.h" @@ -7,6 +7,7 @@ #include "i18n.h" #include "theme.h" #include "bitmap.h" +#include "status.h" #include #include #include @@ -47,6 +48,8 @@ cText2SkinRender::cText2SkinRender(cText2SkinLoader *Loader, eSkinSection Sectio mActive = false; mUpdateIn = 0; + cText2SkinBitmap::FlushCache(); + cText2SkinData::tIterator it = mData->First(mSection); for (; it != mData->Last(mSection); ++it) { if ((*it)->Item() == itemBackground) { @@ -200,6 +203,9 @@ void cText2SkinRender::Update(void) { case displaySlowRew: DisplayReplaySymbol(*it); break; + case displayReplayMode: + DisplayReplayMode(*it); + break; case displayMessage: case displayMessageStatus: case displayMessageInfo: @@ -236,12 +242,12 @@ void cText2SkinRender::Update(void) { mOsd->Flush(); } -void cText2SkinRender::DrawBackground(const POINT &Pos, const SIZE &Size, const tColor *Bg, const tColor *Fg, const string &Path) { +void cText2SkinRender::DrawBackground(const POINT &Pos, const SIZE &Size, const tColor *Bg, const tColor *Fg, int Alpha, const string &Path) { cText2SkinBitmap *bmp = NULL; if (Path != "") { char *p; asprintf(&p, "%s/%s/%s", SkinPath(), mData->Skin().c_str(), Path.c_str()); - if ((bmp = cText2SkinBitmap::Load(p)) != NULL) { + if ((bmp = cText2SkinBitmap::Load(p, Alpha)) != NULL) { if (Bg) bmp->SetColor(0, *Bg); if (Fg) bmp->SetColor(1, *Fg); } @@ -254,12 +260,12 @@ void cText2SkinRender::DrawBackground(const POINT &Pos, const SIZE &Size, const mOsd->DrawRectangle(Pos.x, Pos.y, Pos.x + Size.w - 1, Pos.y + Size.h - 1, Bg ? *Bg : 0); } -void cText2SkinRender::DrawImage(const POINT &Pos, const SIZE &Size, const tColor *Bg, const tColor *Fg, const string &Path) { +void cText2SkinRender::DrawImage(const POINT &Pos, const SIZE &Size, const tColor *Bg, const tColor *Fg, int Alpha, const string &Path) { cText2SkinBitmap *bmp; char *p; asprintf(&p, "%s/%s/%s", SkinPath(), mData->Skin().c_str(), Path.c_str()); Dprintf("Trying to load image: %s\n", p); - if ((bmp = cText2SkinBitmap::Load(p)) != NULL) { + if ((bmp = cText2SkinBitmap::Load(p, Alpha)) != NULL) { if (Bg) bmp->SetColor(0, *Bg); if (Fg) bmp->SetColor(1, *Fg); mOsd->DrawBitmap(Pos.x, Pos.y, bmp->Get(mUpdateIn)); @@ -370,7 +376,7 @@ void cText2SkinRender::DisplayItem(cText2SkinItem *Item, const ItemData *Data) { if (Data == NULL) Data = &dummyData; switch (Item->Item()) { case itemBackground: - DrawBackground(Item->Pos(), Item->Size(), ItemBg(Item), ItemFg(Item), Item->Path()); + DrawBackground(Item->Pos(), Item->Size(), ItemBg(Item), ItemFg(Item), Item->Alpha(), Item->Path()); break; case itemText: DrawText(Item->Pos(), Item->Size(), ItemFg(Item), ItemText(Item, Data->text), Item->Font(), Item->Align()); @@ -379,11 +385,11 @@ void cText2SkinRender::DisplayItem(cText2SkinItem *Item, const ItemData *Data) { DrawScrollText(Item->Pos(), Item->Size(), ItemFg(Item), Data->text, Item->Font(), Item->Align()); break; case itemImage: - DrawImage(Item->Pos(), Item->Size(), ItemBg(Item), ItemFg(Item), Item->Path()); + DrawImage(Item->Pos(), Item->Size(), ItemBg(Item), ItemFg(Item), Item->Alpha(), Item->Path()); break; case itemLogo: case itemSymbol: - DrawImage(Item->Pos(), Item->Size(), ItemBg(Item), ItemFg(Item), Data->path); + DrawImage(Item->Pos(), Item->Size(), ItemBg(Item), ItemFg(Item), Item->Alpha(), Data->path); break; case itemRectangle: DrawRectangle(Item->Pos(), Item->Size(), ItemFg(Item)); @@ -488,7 +494,7 @@ void cText2SkinRender::DisplayPresentTime(cText2SkinItem *Item) { t = event->StartTime(); break; case displayPresentVPSTime: - t = event->Vps(); + t = event->StartTime() != event->Vps() ? event->Vps() : 0; break; case displayPresentEndTime: t = event->EndTime(); @@ -774,6 +780,15 @@ void cText2SkinRender::DisplayReplaySymbol(cText2SkinItem *Item) { DisplayItem(Item, &data); } +void cText2SkinRender::DisplayReplayMode(cText2SkinItem *Item) { + if (cText2SkinStatus::ReplayMode() != replayNone) { + ItemData data; + Dprintf("Replay Type is %s\n", ReplayNames[cText2SkinStatus::ReplayMode()].c_str()); + data.path = Item->Path() + "/" + ReplayNames[cText2SkinStatus::ReplayMode()] + "." + Item->Type(); + DisplayItem(Item, &data); + } +} + void cText2SkinRender::DisplayMessage(cText2SkinItem *Item) { if (mMessageText != "" && (Item->Display() == displayMessage || (Item->Display() - displayMessageStatus) == mMessageType)) { ItemData data; @@ -877,17 +892,29 @@ void cText2SkinRender::DisplayMenuItems(cText2SkinItem *Item) { POINT itempos = pos; itempos.y += i * item->Size().h; itempos += Item->Pos(); - for (int t = 0; t < cSkinDisplayMenu::MaxTabs; ++t) { - if (mMenuItems[i].tabs[t] != "") { - POINT abspos = { itempos.x + mMenuTabs[t], itempos.y }; - ItemData data; - cText2SkinItem cur = *Item; - cur.mPos = abspos; - data.text = mMenuItems[i].tabs[t]; - DisplayItem(&cur, &data); + if (Item->Item() == itemText) { // draw tabs + for (int t = 0; t < cSkinDisplayMenu::MaxTabs; ++t) { + if (mMenuItems[i].tabs[t] != "") { + ItemData data; + cText2SkinItem cur = *Item; + cur.mPos = itempos; + cur.mPos.x += mMenuTabs[t]; + cur.mSize.w -= mMenuTabs[t]; + /*if (t == cSkinDisplayMenu::MaxTabs || !mMenuTabs[t + 1]) + cur.mSize.w -= mMenuTabs[t]; + else + cur.mSize.w = mMenuTabs[t + 1] - mMenuTabs[t];*/ + data.text = mMenuItems[i].tabs[t]; + DisplayItem(&cur, &data); + } + if (!mMenuTabs[t + 1]) + break; } - if (!mMenuTabs[t + 1]) - break; + } else { + ItemData data; + cText2SkinItem cur = *Item; + cur.mPos = itempos; + DisplayItem(&cur, &data); } } } @@ -934,12 +961,7 @@ tColor *cText2SkinRender::ItemBg(cText2SkinItem *Item) { } int cText2SkinRender::GetEditableWidth(MenuItem Item, bool Current) { - /*cText2SkinItem *current; - if (Current) - current = mData->Get(sectionMenu, itemMenuCurrent); - else - current = mData->Get(sectionMenu, itemMenuItem); - return current->Size().w - mMenuTabs[1]; - */ - return 0; + cText2SkinItem *item; + item = mData->Get(sectionMenu, itemMenuItem); + return item->Size().w - mMenuTabs[1]; } diff --git a/render.h b/render.h index 6903ff8..2433dbf 100644 --- a/render.h +++ b/render.h @@ -1,5 +1,5 @@ /* - * $Id: render.h,v 1.20 2004/06/11 15:01:58 lordjaxom Exp $ + * $Id: render.h,v 1.21 2004/06/12 18:00:05 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_RENDER_H @@ -105,8 +105,8 @@ protected: virtual void Action(void); // Basic operations - void DrawBackground(const POINT &Pos, const SIZE &Size, const tColor *Bg, const tColor *Fg, const string &Path); - void DrawImage(const POINT &Pos, const SIZE &Size, const tColor *Bg, const tColor *Fg, const string &Path); + void DrawBackground(const POINT &Pos, const SIZE &Size, const tColor *Bg, const tColor *Fg, int Alpha, const string &Path); + void DrawImage(const POINT &Pos, const SIZE &Size, const tColor *Bg, const tColor *Fg, int Alpha, const string &Path); void DrawText(const POINT &Pos, const SIZE &Size, const tColor *Fg, const string &Text, const cFont *Font, int Align); void DrawRectangle(const POINT &Pos, const SIZE &Size, const tColor *Fg); void DrawEllipse(const POINT &Pos, const SIZE &Size, const tColor *Fg, int Arc); @@ -135,6 +135,7 @@ protected: void DisplayReplayTitle(cText2SkinItem *Item); void DisplayReplayPrompt(cText2SkinItem *Item); void DisplayReplaySymbol(cText2SkinItem *Item); + void DisplayReplayMode(cText2SkinItem *Item); void DisplayMessage(cText2SkinItem *Item); void DisplayMenuTitle(cText2SkinItem *Item); void DisplayMenuButton(cText2SkinItem *Item); diff --git a/setup.c b/setup.c index 11ecb89..45b4ee8 100644 --- a/setup.c +++ b/setup.c @@ -1,23 +1,36 @@ /* - * $Id: setup.c,v 1.1 2004/06/07 19:09:20 lordjaxom Exp $ + * $Id: setup.c,v 1.3 2004/06/12 21:16:18 lordjaxom Exp $ */ #include "setup.h" #include "bitmap.h" +cText2SkinSetup Text2SkinSetup; + +// --- cText2SkinSetup -------------------------------------------------------- + +cText2SkinSetup::cText2SkinSetup(void) { + MaxCacheFill = 25; +} + +bool cText2SkinSetup::SetupParse(const char *Name, const char *Value) { + if (strcmp(Name, "MaxCacheFill") == 0) MaxCacheFill = atoi(Value); + else return false; + return true; +} + +// --- cText2SkinSetupPage ---------------------------------------------------- + cText2SkinSetupPage::cText2SkinSetupPage(void) { - Add(new cOsdItem(tr("Flush image cache"), osUser1)); + mData = Text2SkinSetup; + Add(new cMenuEditIntItem(tr("Max. image cache size"), &mData.MaxCacheFill)); } cText2SkinSetupPage::~cText2SkinSetupPage() { } -eOSState cText2SkinSetupPage::ProcessKey(eKeys Key) { - eOSState state = cMenuSetupPage::ProcessKey(Key); - if (state == osUser1) { - Skins.Message(mtInfo, tr("Flushing image cache...")); - cText2SkinBitmap::FlushCache(); - return osContinue; - } - return state; +void cText2SkinSetupPage::Store(void) { + SetupStore("MaxCacheFill", mData.MaxCacheFill); + Text2SkinSetup = mData; } + diff --git a/setup.h b/setup.h index 43f89fe..b60c60c 100644 --- a/setup.h +++ b/setup.h @@ -1,5 +1,5 @@ /* - * $Id: setup.h,v 1.1 2004/06/07 19:09:20 lordjaxom Exp $ + * $Id: setup.h,v 1.2 2004/06/12 19:16:11 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_SETUP_H @@ -8,13 +8,26 @@ #include "common.h" #include +class cText2SkinSetup { +public: + cText2SkinSetup(void); + + bool SetupParse(const char *Name, const char *Value); + + int MaxCacheFill; +}; + class cText2SkinSetupPage: public cMenuSetupPage { +private: + cText2SkinSetup mData; + public: cText2SkinSetupPage(void); virtual ~cText2SkinSetupPage(); - virtual void Store(void) {} - virtual eOSState ProcessKey(eKeys Key); + virtual void Store(void); }; +extern cText2SkinSetup Text2SkinSetup; + #endif // VDR_TEXT2SKIN_SETUP_H diff --git a/status.c b/status.c new file mode 100644 index 0000000..fb2002d --- /dev/null +++ b/status.c @@ -0,0 +1,42 @@ +/* + * $Id: status.c,v 1.2 2004/06/12 19:17:06 lordjaxom Exp $ + */ + +#include "status.h" + +cText2SkinStatus cText2SkinStatus::mStatus; + +cText2SkinStatus::cText2SkinStatus(void) { + mReplayMode = replayNone; +} + +void cText2SkinStatus::Replaying(const cControl *Control, const char *Name) { + if (Name != NULL) { + mReplayMode = replayNormal; + if (strlen(Name) > 6 && Name[0]=='[' && Name[3]==']' && Name[5]=='(') { + int i; + for (i = 6; Name[i]; ++i) { + if (Name[i] == ' ' && Name[i-1] == ')') + break; + } + if (Name[i]) // replaying mp3 + mReplayMode = replayMP3; + } else if (strcmp(Name, "DVD") == 0) + mReplayMode = replayDVD; + else if (strcmp(Name, "VCD") == 0) + mReplayMode = replayVCD; + else if (access(Name, F_OK) == 0) + mReplayMode = replayMPlayer; + else if (strlen(Name) > 7) { + int i, n; + for (i = 0, n = 0; Name[i]; ++i) { + if (Name[i] == ' ' && Name[i-1] == ',' && ++n == 4) + break; + } + if (Name[i]) { // replaying DVD + mReplayMode = replayDVD; + } + } + } else + mReplayMode = replayNone; +} diff --git a/status.h b/status.h new file mode 100644 index 0000000..a67e3e3 --- /dev/null +++ b/status.h @@ -0,0 +1,26 @@ +/* + * $Id: status.h,v 1.2 2004/06/12 19:17:06 lordjaxom Exp $ + */ + +#ifndef VDR_TEXT2SKIN_STATUS_H +#define VDR_TEXT2SKIN_STATUS_H + +#include "common.h" +#include + +class cText2SkinStatus: public cStatus { +private: + static cText2SkinStatus mStatus; + + eReplayMode mReplayMode; + +protected: + cText2SkinStatus(void); + + virtual void Replaying(const cControl *Control, const char *Name); + +public: + static eReplayMode ReplayMode(void) { return mStatus.mReplayMode; } +}; + +#endif // VDR_TEXT2SKIN_STATUS_H diff --git a/text2skin.c b/text2skin.c index fecbe52..8ded7a4 100644 --- a/text2skin.c +++ b/text2skin.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: text2skin.c,v 1.15 2004/06/11 15:02:57 lordjaxom Exp $ + * $Id: text2skin.c,v 1.19 2004/06/13 18:20:17 lordjaxom Exp $ */ #include "text2skin.h" @@ -11,7 +11,7 @@ #include "i18n.h" #include "loader.h" -const char *cText2SkinPlugin::VERSION = "0.0.3"; +const char *cText2SkinPlugin::VERSION = "0.0.4"; const char *cText2SkinPlugin::THEMEVERSION = "0.0.2"; const char *cText2SkinPlugin::DESCRIPTION = "Loader for text-based skins"; @@ -37,7 +37,7 @@ cMenuSetupPage *cText2SkinPlugin::SetupMenu(void) bool cText2SkinPlugin::SetupParse(const char *Name, const char *Value) { - return false; + return Text2SkinSetup.SetupParse(Name, Value); } VDRPLUGINCREATOR(cText2SkinPlugin); // Don't touch this! -- cgit v1.2.3