mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
implemented cSDDisplayMenu::GetTextAreaFont()
This commit is contained in:
parent
2e4a9b86ed
commit
8b8389d975
2
HISTORY
2
HISTORY
@ -21,3 +21,5 @@ Version 0.0.2
|
|||||||
- changed display of menu lists, do flush first after complete rendering
|
- changed display of menu lists, do flush first after complete rendering
|
||||||
- added support for custom tokens in dislaychannel
|
- added support for custom tokens in dislaychannel
|
||||||
- added vps token in menudetailepg
|
- added vps token in menudetailepg
|
||||||
|
- implemented cSDDisplayMenu::GetTextAreaFont()
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "libcore/helpers.h"
|
#include "libcore/helpers.h"
|
||||||
|
|
||||||
cSDDisplayMenu::cSDDisplayMenu(cTemplate *menuTemplate) {
|
cSDDisplayMenu::cSDDisplayMenu(cTemplate *menuTemplate) {
|
||||||
|
textAreaFont = NULL;
|
||||||
doOutput = true;
|
doOutput = true;
|
||||||
state = vsInit;
|
state = vsInit;
|
||||||
if (!menuTemplate) {
|
if (!menuTemplate) {
|
||||||
@ -20,6 +21,8 @@ cSDDisplayMenu::~cSDDisplayMenu() {
|
|||||||
if (!doOutput)
|
if (!doOutput)
|
||||||
return;
|
return;
|
||||||
delete rootView;
|
delete rootView;
|
||||||
|
if (textAreaFont)
|
||||||
|
delete textAreaFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSDDisplayMenu::Scroll(bool Up, bool Page) {
|
void cSDDisplayMenu::Scroll(bool Up, bool Page) {
|
||||||
@ -180,7 +183,10 @@ int cSDDisplayMenu::GetTextAreaWidth(void) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cFont *cSDDisplayMenu::GetTextAreaFont(bool FixedFont) const {
|
const cFont *cSDDisplayMenu::GetTextAreaFont(bool FixedFont) const {
|
||||||
return NULL;
|
if (textAreaFont)
|
||||||
|
return textAreaFont;
|
||||||
|
textAreaFont = rootView->GetTextAreaFont();
|
||||||
|
return textAreaFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSDDisplayMenu::SetScrollbar(int Total, int Offset) {
|
void cSDDisplayMenu::SetScrollbar(int Total, int Offset) {
|
||||||
|
@ -18,6 +18,7 @@ private:
|
|||||||
cDisplayMenuRootView *rootView;
|
cDisplayMenuRootView *rootView;
|
||||||
eViewState state;
|
eViewState state;
|
||||||
bool doOutput;
|
bool doOutput;
|
||||||
|
mutable cFont *textAreaFont;
|
||||||
protected:
|
protected:
|
||||||
int Tab(int n);
|
int Tab(int n);
|
||||||
public:
|
public:
|
||||||
|
@ -108,6 +108,12 @@ cFont *cFontManager::Font(string fontName, int fontSize) {
|
|||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cFont *cFontManager::FontUncached(string fontName, int fontSize) {
|
||||||
|
cMutexLock MutexLock(&mutex);
|
||||||
|
cFont *font = CreateFont(fontName, fontSize);
|
||||||
|
return font;
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
@ -28,6 +28,7 @@ class cFontManager {
|
|||||||
int Width(string fontName, int fontSize, const char *text);
|
int Width(string fontName, int fontSize, const char *text);
|
||||||
int Height(string fontName, int fontSize);
|
int Height(string fontName, int fontSize);
|
||||||
cFont *Font(string fontName, int fontSize);
|
cFont *Font(string fontName, int fontSize);
|
||||||
|
cFont *FontUncached(string fontName, int fontSize);
|
||||||
void Debug(void);
|
void Debug(void);
|
||||||
void ListAvailableFonts(void);
|
void ListAvailableFonts(void);
|
||||||
};
|
};
|
||||||
|
@ -115,6 +115,54 @@ int cTemplateViewList::GetAverageFontWidth(void) {
|
|||||||
return averageFontWidth;
|
return averageFontWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cFont *cTemplateViewList::GetTextAreaFont(void) {
|
||||||
|
if (!listElement)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
int fontWidth = 0;
|
||||||
|
int numItems = GetNumericParameter(ptNumElements);
|
||||||
|
int listHeight = GetNumericParameter(ptHeight);
|
||||||
|
if (listHeight <= 0)
|
||||||
|
return NULL;
|
||||||
|
int itemHeight = (double)listHeight / (double)numItems;
|
||||||
|
string fontFuncName = parameters->GetParameter(ptDeterminateFont);
|
||||||
|
|
||||||
|
cTemplateFunction *fontFunc = listElement->GetFunction(fontFuncName);
|
||||||
|
if (!fontFunc)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
string fontNameToken = fontFunc->GetParameter(ptFont);
|
||||||
|
string paramFontSize = fontFunc->GetParameter(ptFontSize);
|
||||||
|
|
||||||
|
string fontName = "";
|
||||||
|
if ((fontNameToken.find("{") == 0) && (fontNameToken.find("}") == (fontNameToken.size()-1))) {
|
||||||
|
fontNameToken = fontNameToken.substr(1, fontNameToken.size()-2);
|
||||||
|
map<string,string>::iterator hit = globals->fonts.find(fontNameToken);
|
||||||
|
if (hit != globals->fonts.end()) {
|
||||||
|
fontName = hit->second;
|
||||||
|
} else {
|
||||||
|
map<string,string>::iterator def = globals->fonts.find("vdrOsd");
|
||||||
|
if (def == globals->fonts.end())
|
||||||
|
return NULL;
|
||||||
|
fontName = def->second;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//if no token, directly use input
|
||||||
|
fontName = fontNameToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
cNumericParameter pFontSize(paramFontSize);
|
||||||
|
pFontSize.SetGlobals(globals);
|
||||||
|
pFontSize.SetAreaSize(1000, itemHeight);
|
||||||
|
pFontSize.SetVertical();
|
||||||
|
int fontSize = pFontSize.Parse(paramFontSize);
|
||||||
|
if (!pFontSize.Valid())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return fontManager->FontUncached(fontName, fontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int cTemplateViewList::GetMenuItemWidth(void) {
|
int cTemplateViewList::GetMenuItemWidth(void) {
|
||||||
return GetNumericParameter(ptMenuItemWidth);
|
return GetNumericParameter(ptMenuItemWidth);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ public:
|
|||||||
cTemplateViewElement *GetListElement(void) { return listElement; };
|
cTemplateViewElement *GetListElement(void) { return listElement; };
|
||||||
cTemplateViewElement *GetListElementCurrent(void) { return currentElement; };
|
cTemplateViewElement *GetListElementCurrent(void) { return currentElement; };
|
||||||
int GetAverageFontWidth(void);
|
int GetAverageFontWidth(void);
|
||||||
|
cFont *GetTextAreaFont(void);
|
||||||
int GetMenuItemWidth(void);
|
int GetMenuItemWidth(void);
|
||||||
int GetNumPixmaps(void);
|
int GetNumPixmaps(void);
|
||||||
void Debug(void);
|
void Debug(void);
|
||||||
|
@ -288,15 +288,29 @@ int cDisplayMenuRootView::GetListViewWidth(void) {
|
|||||||
int cDisplayMenuRootView::GetTextAreaWidth(void) {
|
int cDisplayMenuRootView::GetTextAreaWidth(void) {
|
||||||
if (!tmplView)
|
if (!tmplView)
|
||||||
return 1900;
|
return 1900;
|
||||||
cTemplateView *tempSubView = tmplView->GetSubView(svMenuDefault);
|
cTemplateView *tmplSubView = tmplView->GetSubView(svMenuDefault);
|
||||||
if (!tempSubView)
|
if (!tmplSubView)
|
||||||
return 1900;
|
return 1900;
|
||||||
int areaWidth = tempSubView->GetNumericParameter(ptWidth);
|
int areaWidth = tmplSubView->GetNumericParameter(ptWidth);
|
||||||
if (areaWidth > 0)
|
if (areaWidth > 0)
|
||||||
return areaWidth;
|
return areaWidth;
|
||||||
return 1900;
|
return 1900;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cFont *cDisplayMenuRootView::GetTextAreaFont(void) {
|
||||||
|
if (!tmplView)
|
||||||
|
return NULL;
|
||||||
|
cTemplateView *tmplSubViewDefault = tmplView->GetSubView(svMenuDefault);
|
||||||
|
if (!tmplSubViewDefault)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
cTemplateViewList *tmplViewList = tmplSubViewDefault->GetViewList(vlMenuItem);
|
||||||
|
if (!tmplViewList)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return tmplViewList->GetTextAreaFont();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void cDisplayMenuRootView::Render(void) {
|
void cDisplayMenuRootView::Render(void) {
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
int GetMaxItems(void);
|
int GetMaxItems(void);
|
||||||
int GetListViewWidth(void);
|
int GetListViewWidth(void);
|
||||||
int GetTextAreaWidth(void);
|
int GetTextAreaWidth(void);
|
||||||
|
cFont *GetTextAreaFont(void);
|
||||||
bool SubViewAvailable(void) { return subViewAvailable; };
|
bool SubViewAvailable(void) { return subViewAvailable; };
|
||||||
cDisplayMenuListView *GetListView(void) { return listView; };
|
cDisplayMenuListView *GetListView(void) { return listView; };
|
||||||
void Render(void);
|
void Render(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user