diff options
author | lordjaxom <lordjaxom> | 2004-07-14 16:49:10 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2004-07-14 16:49:10 +0000 |
commit | 5071a1754f3db0adcf477ecf8e5b2a818d1935bd (patch) | |
tree | 210c39c7871d0192ec5aad51096ea39fa47ccd9e /scroller.c | |
parent | f2a4ea2dc8c0d915e0f2af6f4ec1a228e1e94453 (diff) | |
download | vdr-plugin-text2skin-5071a1754f3db0adcf477ecf8e5b2a818d1935bd.tar.gz vdr-plugin-text2skin-5071a1754f3db0adcf477ecf8e5b2a818d1935bd.tar.bz2 |
- fixed display of scrollbar if there is no text presentv0.0.8
- fixed animation delay if update takes longer than the delay
- using backgrounds also in 8-bit fullscreen mode to improve performance
- implemented screen layer to improve performance
- corrected offsets and tab widths in main menu
- implemented parameters "current", "mark" and "selected" to choose mark colors
in replay display (defaults to the old values)
- implemented color value "None" to be able to unset a color
Diffstat (limited to 'scroller.c')
-rw-r--r-- | scroller.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/scroller.c b/scroller.c new file mode 100644 index 0000000..465dcde --- /dev/null +++ b/scroller.c @@ -0,0 +1,69 @@ +/* + * $Id: scroller.c,v 1.1 2004/07/05 17:55:34 lordjaxom Exp $ + */ + +#include "scroller.h" +#include "screen.h" +#include <vdr/tools.h> + +cText2SkinScroller::cText2SkinScroller(void) { + mScreen = NULL; + mLeft = mTop = mWidth = mHeight = 0; + mFont = NULL; + mColorFg = 0; + mColorBg = 0; + mOffset = 0; + mShown = 0; +} + +cText2SkinScroller::cText2SkinScroller(cText2SkinScreen *Screen, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg) { + Set(Screen, Left, Top, Width, Height, Text, Font, ColorFg, ColorBg); +} + +void cText2SkinScroller::Set(cText2SkinScreen *Screen, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg) +{ + mScreen = Screen; + mLeft = Left; + mTop = Top; + mWidth = Width; + mHeight = Height; + mFont = Font; + mColorFg = ColorFg; + mColorBg = ColorBg; + mOffset = 0; + // sets mHeight to the actually used mHeight, which may be less than Height + mWrapper.Set(Text, Font, Width); + mShown = min(Total(), mHeight / mFont->Height()); + mHeight = mShown * mFont->Height(); + DrawText(); +} + +void cText2SkinScroller::Reset(void) { + mScreen = NULL; // just makes sure it won't draw anything +} + +void cText2SkinScroller::DrawText(void) { + if (mScreen) { + for (int i = 0; i < mShown; i++) + mScreen->DrawText(mLeft, mTop + i * mFont->Height(), mWrapper.GetLine(mOffset + i), mColorFg, mColorBg, mFont, mWidth); + } +} + +void cText2SkinScroller::Scroll(bool Up, bool Page) +{ + if (Up) { + if (CanScrollUp()) { + mOffset -= Page ? mShown : 1; + if (mOffset < 0) + mOffset = 0; + DrawText(); + } + } else { + if (CanScrollDown()) { + mOffset += Page ? mShown : 1; + if (mOffset + mShown > Total()) + mOffset = Total() - mShown; + DrawText(); + } + } +} |