diff options
-rw-r--r-- | baserender.c | 21 | ||||
-rw-r--r-- | baserender.h | 3 | ||||
-rw-r--r-- | displaymenu.c | 15 |
3 files changed, 29 insertions, 10 deletions
diff --git a/baserender.c b/baserender.c index 8d8d0486..fc9abc22 100644 --- a/baserender.c +++ b/baserender.c @@ -8,7 +8,8 @@ cFlatBaseRender::cFlatBaseRender(void) { fontHeight = font->Height(); fontSmlHeight = fontSml->Height(); - + fontFixedHeight = fontFixed->Height(); + topBarTitle = ""; tobBarTitleExtra1 = ""; tobBarTitleExtra2 = ""; @@ -260,21 +261,26 @@ void cFlatBaseRender::MessageClear(void) { DecorBorderClear(Config.decorBorderMessageSize, top, osdWidth - Config.decorBorderMessageSize*2, messageHeight, Config.decorBorderMessageSize); } -void cFlatBaseRender::ContentCreate(int Left, int Top, int Width, int Height) { +void cFlatBaseRender::ContentCreate(int Left, int Top, int Width, int Height, bool FixedFont) { contentHasScrollbar = false; contentShown = false; + contentFixedFont = FixedFont; contentLeft = Left; contentTop = Top; contentWidth = Width; contentHeight = Height; int lines = ContentVisibleLines(); + contentHeight = lines * fontHeight; + if( contentFixedFont ) + contentHeight = lines * fontFixedHeight; + } void cFlatBaseRender::ContentSet(const char *Text, bool FixedFont, tColor ColorFg, tColor ColorBg) { contentFixedFont = FixedFont; - if( FixedFont ) + if( contentFixedFont ) contentWrapper.Set(Text, fontFixed, contentWidth - marginItem*2); else contentWrapper.Set(Text, font, contentWidth - marginItem*2); @@ -283,7 +289,9 @@ void cFlatBaseRender::ContentSet(const char *Text, bool FixedFont, tColor ColorF contentColorBg = ColorBg; int contentWrapperHeight = (contentWrapper.Lines()+1) * fontHeight; - + if( contentFixedFont ) + contentWrapperHeight = (contentWrapper.Lines()+1) * fontFixedHeight; + if( contentWrapperHeight > contentHeight ) { contentDrawPortHeight = contentWrapperHeight; contentHasScrollbar = true; @@ -327,7 +335,10 @@ int cFlatBaseRender::ContentScrollOffset(void) { } int cFlatBaseRender::ContentVisibleLines(void) { - return contentHeight / fontHeight; + if( contentFixedFont ) + return contentHeight / fontFixedHeight; + else + return contentHeight / fontHeight; } bool cFlatBaseRender::ContentScroll(bool Up, bool Page) { diff --git a/baserender.h b/baserender.h index 7e4bf650..89075d77 100644 --- a/baserender.h +++ b/baserender.h @@ -27,6 +27,7 @@ class cFlatBaseRender cFont *fontFixed; int fontHeight; int fontSmlHeight; + int fontFixedHeight; // TopBar cPixmap *topBarPixmap; @@ -125,7 +126,7 @@ class cFlatBaseRender void ScrollbarDraw(cPixmap *Pixmap, int Left, int Top, int Height, int Total, int Offset, int Shown, bool CanScrollUp, bool CanScrollDown); int ScrollBarWidth(void); - void ContentCreate(int Left, int Top, int Width, int Height); + void ContentCreate(int Left, int Top, int Width, int Height, bool FixedFont); void ContentSet(const char *Text, bool FixedFont, tColor ColorFg, tColor ColorBg); bool ContentIsShown(void); bool ContentScrollable(void); diff --git a/displaymenu.c b/displaymenu.c index d7bfec18..e31c83dd 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -33,7 +33,7 @@ cFlatDisplayMenu::cFlatDisplayMenu(void) { cHeight = osdHeight - (topBarHeight + Config.decorBorderTopBarSize*2 + buttonsHeight + Config.decorBorderButtonSize*2 + marginItem*3 + chHeight + Config.decorBorderMenuContentHeadSize*2 + Config.decorBorderMenuContentSize*2); - ContentCreate(cLeft, cTop, cWidth, cHeight); + ContentCreate(cLeft, cTop, cWidth, cHeight, false); scrollbarPixmap = osd->CreatePixmap(2, cRect(osdWidth - scrollBarWidth, scrollBarTop, scrollBarWidth, scrollBarHeight)); @@ -401,11 +401,18 @@ void cFlatDisplayMenu::SetText(const char *Text, bool FixedFont) { return; contentHeadPixmap->Fill(clrTransparent); - ContentSet( Text, false, Theme.Color(clrMenuTextFont), Theme.Color(clrMenuTextBg) ); + int Left = Config.decorBorderMenuContentSize; + int Top = topBarHeight + marginItem + Config.decorBorderTopBarSize*2 + Config.decorBorderMenuContentHeadSize; + int Width = menuWidth - Config.decorBorderMenuContentSize*2; + int Height = osdHeight - (topBarHeight + Config.decorBorderTopBarSize*2 + + buttonsHeight + Config.decorBorderButtonSize*2 + marginItem*3); + ContentCreate(Left, Top, Width, Height, FixedFont); + + ContentSet( Text, FixedFont, Theme.Color(clrMenuTextFont), Theme.Color(clrMenuTextBg) ); if( ContentScrollable() ) - SetScrollbar( ContentScrollTotal(), 0 ); + DrawScrollbar(ContentScrollTotal(), ContentScrollOffset(), ContentVisibleLines(), contentTop - scrollBarTop, ContentGetHeight(), ContentScrollOffset() > 0, ContentScrollOffset() + ContentVisibleLines() < ContentScrollTotal()); - DecorBorderDraw(cLeft, cTop, cWidth, ContentGetHeight(), Config.decorBorderMenuContentSize, Config.decorBorderMenuContentType, + DecorBorderDraw(Left, Top, Width, ContentGetHeight(), Config.decorBorderMenuContentSize, Config.decorBorderMenuContentType, Config.decorBorderMenuContentFg, Config.decorBorderMenuContentBg); } |