From e79be651465bbc5eaf00d1ccf6c87a400672c2e6 Mon Sep 17 00:00:00 2001 From: lordjaxom Date: Sun, 16 Jan 2005 20:55:20 +0000 Subject: - implemented scrolling in audio tracks menu --- display.c | 26 +++++++++++++++++--------- display.h | 5 ++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/display.c b/display.c index 31ecbb6..1a6d2c1 100644 --- a/display.c +++ b/display.c @@ -1,5 +1,5 @@ /* - * $Id: display.c,v 1.10 2005/01/15 21:00:57 lordjaxom Exp $ + * $Id: display.c,v 1.11 2005/01/16 20:55:20 lordjaxom Exp $ */ #include "render.h" @@ -1016,25 +1016,33 @@ cxType cText2SkinDisplayTracks::GetTokenData(const txToken &Token) break; } + int index = Token.Index; + if (index >= 0 && mCurrentItem >= (uint)mMaxItems) { + int offset = mCurrentItem - mMaxItems + 1; + index += offset; + } + switch (Token.Type) { case tMenuTitle: return mTitle; - case tMenuItem: - return mItems.size() > (uint)Token.Index && mCurrentItem != (uint)Token.Index - ? (cxType)mItems[Token.Index].text + case tMenuItem: { + return mItems.size() > (uint)index && mCurrentItem != (uint)index + ? (cxType)((std::string)(const char*)itoa(index) + " " + mItems[index].text) : (cxType)false; + } case tIsMenuItem: - return mItems.size() > (uint)Token.Index && mCurrentItem != (uint)Token.Index; + return mItems.size() > (uint)index && mCurrentItem != (uint)index; - case tMenuCurrent: - return mItems.size() > (uint)Token.Index && mCurrentItem == (uint)Token.Index - ? (cxType)mItems[Token.Index].text + case tMenuCurrent: { + return mItems.size() > (uint)index && mCurrentItem == (uint)index + ? (cxType)((std::string)(const char*)itoa(index) + " " + mItems[index].text) : (cxType)false; + } case tIsMenuCurrent: - return mItems.size() > (uint)Token.Index && mCurrentItem == (uint)Token.Index; + return mItems.size() > (uint)index && mCurrentItem == (uint)index; case tAudioChannel: return ChannelName(mAudioChannel); diff --git a/display.h b/display.h index e97ad6d..ef3fee0 100644 --- a/display.h +++ b/display.h @@ -1,5 +1,5 @@ /* - * $Id: display.h,v 1.7 2005/01/11 17:59:04 lordjaxom Exp $ + * $Id: display.h,v 1.8 2005/01/16 20:55:20 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_SKIN_H @@ -190,6 +190,8 @@ inline bool cText2SkinDisplayMenu::HasTabText(int Index, int n) #if VDRVERSNUM >= 10318 class cText2SkinDisplayTracks: public cSkinDisplayTracks, public cText2SkinRender { private: + int mMaxItems; + std::string mTitle; struct tListItem { @@ -208,6 +210,7 @@ private: protected: virtual cxType GetTokenData(const txToken &Token); virtual bool HasTabText(int Index, int n); + virtual void SetMaxItems(int MaxItems) { mMaxItems = MaxItems; } public: static const std::string &ChannelName(int AudioChannel); -- cgit v1.2.3