mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
added possibility to draw a debug grid in views
This commit is contained in:
parent
5146f15e44
commit
6872e29fe6
1
HISTORY
1
HISTORY
@ -288,4 +288,5 @@ Version 0.4.2
|
||||
|
||||
- fixed bug that datetime was not drawn correctly in menus
|
||||
- fixed bug that string tokens are not evaluated in area conditions
|
||||
- added possibility to draw a debug grid in views
|
||||
|
||||
|
@ -22,6 +22,7 @@ cSDDisplayChannel::cSDDisplayChannel(cTemplate *channelTemplate, bool WithInfo)
|
||||
doOutput = false;
|
||||
return;
|
||||
}
|
||||
channelView->DrawDebugGrid();
|
||||
}
|
||||
|
||||
cSDDisplayChannel::~cSDDisplayChannel() {
|
||||
|
@ -21,6 +21,7 @@ cSDDisplayMenu::cSDDisplayMenu(cTemplate *menuTemplate) {
|
||||
return;
|
||||
}
|
||||
SetCurrentRecording();
|
||||
rootView->DrawDebugGrid();
|
||||
}
|
||||
|
||||
cSDDisplayMenu::~cSDDisplayMenu() {
|
||||
|
@ -14,6 +14,7 @@ cSDDisplayMessage::cSDDisplayMessage(cTemplate *messageTemplate) {
|
||||
doOutput = false;
|
||||
return;
|
||||
}
|
||||
messageView->DrawDebugGrid();
|
||||
messageView->DrawBackground();
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ cSkinDisplayPlugin::cSkinDisplayPlugin(cTemplate *pluginTemplate, int subViewID)
|
||||
doOutput = false;
|
||||
return;
|
||||
}
|
||||
pluginView->DrawDebugGrid();
|
||||
}
|
||||
|
||||
cSkinDisplayPlugin::~cSkinDisplayPlugin(void) {
|
||||
|
@ -17,6 +17,7 @@ cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) {
|
||||
doOutput = false;
|
||||
return;
|
||||
}
|
||||
replayView->DrawDebugGrid();
|
||||
}
|
||||
|
||||
cSDDisplayReplay::~cSDDisplayReplay() {
|
||||
|
@ -18,6 +18,7 @@ cSDDisplayTracks::cSDDisplayTracks(cTemplate *audiotracksTemplate, const char *T
|
||||
doOutput = false;
|
||||
return;
|
||||
}
|
||||
tracksView->DrawDebugGrid();
|
||||
tracksView->DrawBackground();
|
||||
|
||||
cDisplayMenuListView *list = tracksView->GetListView();
|
||||
|
@ -16,6 +16,7 @@ cSDDisplayVolume::cSDDisplayVolume(cTemplate *volumeTemplate) {
|
||||
if (!volumeView->createOsd()) {
|
||||
doOutput = false;
|
||||
} else {
|
||||
volumeView->DrawDebugGrid();
|
||||
volumeView->DrawBackground();
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT background (area|areascroll)*>
|
||||
|
@ -16,6 +16,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT background (area)*>
|
||||
|
@ -13,6 +13,7 @@
|
||||
width CDATA #REQUIRED
|
||||
height CDATA #REQUIRED
|
||||
fadetime CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT background (area)*>
|
||||
@ -177,6 +178,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menumain (background | header | datetime | time | colorbuttons | scrollbar | sortmode | timers |
|
||||
@ -192,6 +194,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menusetup (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
|
||||
@ -205,6 +208,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menuschedules (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
|
||||
@ -218,6 +222,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menutimers (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
|
||||
@ -231,6 +236,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menuchannels (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
|
||||
@ -244,6 +250,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menurecordings (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
|
||||
@ -257,6 +264,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menudetailedepg (background | header | datetime | time | colorbuttons | scrollbar |
|
||||
@ -271,6 +279,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menudetailedrecording (background | header | datetime | time | colorbuttons | scrollbar |
|
||||
@ -285,6 +294,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menudetailedtext (background | header | datetime | time | colorbuttons | scrollbar |
|
||||
@ -299,6 +309,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT menuitems (listelement,currentelement?)>
|
||||
|
@ -13,6 +13,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT background (area)*>
|
||||
|
@ -13,6 +13,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT background (area)*>
|
||||
|
@ -14,6 +14,7 @@
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
hideroot CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT viewelement (area|areascroll)*>
|
||||
|
@ -17,6 +17,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT background (area)*>
|
||||
|
@ -13,6 +13,7 @@
|
||||
scaletvy CDATA #IMPLIED
|
||||
scaletvwidth CDATA #IMPLIED
|
||||
scaletvheight CDATA #IMPLIED
|
||||
debuggrid CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT background (area)*>
|
||||
|
@ -49,6 +49,10 @@ void cTemplateFunction::SetParameters(vector<pair<string, string> > params) {
|
||||
debug = true;
|
||||
}
|
||||
continue;
|
||||
} else if (!name.compare("debuggrid")) {
|
||||
string value = it->second;
|
||||
SetDebugGrid(value);
|
||||
continue;
|
||||
} else if (!name.compare("condition")) {
|
||||
p.first = ptCond;
|
||||
} else if (!name.compare("name")) {
|
||||
@ -429,6 +433,8 @@ int cTemplateFunction::GetNumericParameter(eParamType type) {
|
||||
return 0;
|
||||
else if (type == ptBackground)
|
||||
return 0;
|
||||
else if (type == ptDrawDebugGrid)
|
||||
return 0;
|
||||
else if (type == ptDirection)
|
||||
return diBottomUp;
|
||||
return -1;
|
||||
@ -1119,6 +1125,25 @@ bool cTemplateFunction::SetDirection(string value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void cTemplateFunction::SetDebugGrid(string value) {
|
||||
int numGridsX = 0;
|
||||
int numGridsY = 0;
|
||||
size_t posSep = value.find("x");
|
||||
if (posSep != string::npos) {
|
||||
string x = value.substr(0, posSep);
|
||||
string y = value.substr(posSep+1);
|
||||
numGridsX = atoi(x.c_str());
|
||||
numGridsY = atoi(y.c_str());
|
||||
}
|
||||
if (numGridsX < 1)
|
||||
numGridsX = 10;
|
||||
if (numGridsY < 1)
|
||||
numGridsY = 10;
|
||||
numericParameters.insert(pair<eParamType, int>(ptDebugGridX, numGridsX));
|
||||
numericParameters.insert(pair<eParamType, int>(ptDebugGridY, numGridsY));
|
||||
numericParameters.insert(pair<eParamType, int>(ptDrawDebugGrid, 1));
|
||||
}
|
||||
|
||||
void cTemplateFunction::ParseStringParameters(void) {
|
||||
//first replace stringtokens in Text (drawText)
|
||||
stringstream text;
|
||||
|
@ -41,6 +41,9 @@ enum eParamType {
|
||||
ptCond,
|
||||
ptName,
|
||||
ptMode,
|
||||
ptDrawDebugGrid,
|
||||
ptDebugGridX,
|
||||
ptDebugGridY,
|
||||
ptX,
|
||||
ptY,
|
||||
ptWidth,
|
||||
@ -165,6 +168,7 @@ protected:
|
||||
bool SetDetached(string value);
|
||||
bool SetBackground(string value);
|
||||
bool SetDirection(string value);
|
||||
void SetDebugGrid(string value);
|
||||
void ParseStringParameters(void);
|
||||
void ParseNumericalParameters(void);
|
||||
void CalculateAlign(int elementWidth, int elementHeight);
|
||||
|
@ -212,6 +212,41 @@ bool cTemplateView::HideView(void) {
|
||||
return parameters->GetNumericParameter(ptHideRoot);
|
||||
}
|
||||
|
||||
bool cTemplateView::DrawGebugGrid(void) {
|
||||
if (!parameters)
|
||||
return false;
|
||||
return parameters->GetNumericParameter(ptDrawDebugGrid);
|
||||
}
|
||||
|
||||
int cTemplateView::DebugGridX(void) {
|
||||
if (!parameters)
|
||||
return 0;
|
||||
return parameters->GetNumericParameter(ptDebugGridX);
|
||||
}
|
||||
|
||||
int cTemplateView::DebugGridY(void) {
|
||||
if (!parameters)
|
||||
return 0;
|
||||
return parameters->GetNumericParameter(ptDebugGridY);
|
||||
}
|
||||
|
||||
tColor cTemplateView::DebugGridColor(void) {
|
||||
tColor col = 0xFFFF0000;
|
||||
if (!globals)
|
||||
return col;
|
||||
string colName = "{clrDebugGrid}";
|
||||
globals->GetColor(colName, col);
|
||||
return col;
|
||||
}
|
||||
|
||||
tColor cTemplateView::DebugGridFontColor(void) {
|
||||
tColor col = 0xFFFF0000;
|
||||
if (!globals)
|
||||
return col;
|
||||
string colName = "{clrFontDebugGrid}";
|
||||
globals->GetColor(colName, col);
|
||||
return col;
|
||||
}
|
||||
|
||||
bool cTemplateView::ExecuteView(eViewElement ve) {
|
||||
map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve);
|
||||
@ -829,6 +864,7 @@ cTemplateViewChannel::cTemplateViewChannel(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
|
||||
|
||||
SetViewElements();
|
||||
@ -995,6 +1031,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("width");
|
||||
attributes.insert("height");
|
||||
attributes.insert("fadetime");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
|
||||
|
||||
string subViewName = "menudefault";
|
||||
@ -1009,6 +1046,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
subViewName = "menumain";
|
||||
@ -1023,6 +1061,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
subViewName = "menusetup";
|
||||
@ -1037,6 +1076,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
subViewName = "menuschedules";
|
||||
@ -1051,6 +1091,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
subViewName = "menuchannels";
|
||||
@ -1065,6 +1106,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
subViewName = "menutimers";
|
||||
@ -1079,6 +1121,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
subViewName = "menurecordings";
|
||||
@ -1093,6 +1136,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
subViewName = "menudetailedepg";
|
||||
@ -1107,6 +1151,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
subViewName = "menudetailedrecording";
|
||||
@ -1121,6 +1166,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
subViewName = "menudetailedtext";
|
||||
@ -1135,6 +1181,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
|
||||
|
||||
//definition of allowed parameters for menuitems viewlist
|
||||
@ -1182,6 +1229,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >("menuplugin", attributes));
|
||||
|
||||
SetSubViews();
|
||||
@ -1516,6 +1564,7 @@ cTemplateViewMessage::cTemplateViewMessage(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
|
||||
|
||||
SetViewElements();
|
||||
@ -1590,6 +1639,7 @@ cTemplateViewReplay::cTemplateViewReplay(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
|
||||
|
||||
//definition of allowed parameters for onpause and onpausemodeonly viewelement
|
||||
@ -1772,6 +1822,7 @@ cTemplateViewVolume::cTemplateViewVolume(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
|
||||
|
||||
SetViewElements();
|
||||
@ -1846,6 +1897,7 @@ cTemplateViewAudioTracks::cTemplateViewAudioTracks(void) {
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
|
||||
|
||||
//definition of allowed parameters for menuitems viewlist
|
||||
@ -1968,6 +2020,7 @@ cTemplateViewPlugin::cTemplateViewPlugin(string pluginName, int viewID) {
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
attributes.insert("hideroot");
|
||||
attributes.insert("debuggrid");
|
||||
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
|
||||
|
||||
//definition of allowed parameters for viewtab
|
||||
|
@ -112,6 +112,11 @@ public:
|
||||
cRect GetOsdSize(void);
|
||||
int GetNumPixmaps(void);
|
||||
int GetNumPixmapsViewElement(eViewElement ve);
|
||||
bool DrawGebugGrid(void);
|
||||
int DebugGridX(void);
|
||||
int DebugGridY(void);
|
||||
tColor DebugGridColor(void);
|
||||
tColor DebugGridFontColor(void);
|
||||
bool HideView(void);
|
||||
bool ExecuteView(eViewElement ve);
|
||||
bool DetachViewElement(eViewElement ve);
|
||||
|
@ -422,6 +422,7 @@ cFont *cDisplayMenuRootView::GetTextAreaFont(void) {
|
||||
void cDisplayMenuRootView::Render(void) {
|
||||
if (!view)
|
||||
return;
|
||||
view->DrawDebugGrid();
|
||||
if (!view->DrawBackground()) {
|
||||
defaultBackgroundDrawn = true;
|
||||
DrawBackground();
|
||||
|
56
views/view.c
56
views/view.c
@ -5,7 +5,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
cView::cView(cTemplateView *tmplView) : cPixmapContainer(tmplView->GetNumPixmaps()) {
|
||||
cView::cView(cTemplateView *tmplView) : cPixmapContainer(tmplView->DrawGebugGrid() ? tmplView->GetNumPixmaps() + 1 : tmplView->GetNumPixmaps()) {
|
||||
this->tmplView = tmplView;
|
||||
tvScaled = tmplView->GetScalingWindow(scalingWindow);
|
||||
if (tvScaled) {
|
||||
@ -42,6 +42,12 @@ cView::~cView() {
|
||||
}
|
||||
}
|
||||
|
||||
void cView::DrawDebugGrid(void) {
|
||||
if (tmplView && tmplView->DrawGebugGrid()) {
|
||||
DoDrawDebugGrid();
|
||||
}
|
||||
}
|
||||
|
||||
void cView::Init(void) {
|
||||
viewInit = true;
|
||||
scrolling = false;
|
||||
@ -483,6 +489,54 @@ void cView::DebugTokens(string viewElement, map<string,string> *stringTokens, ma
|
||||
* Private Functions
|
||||
*****************************************************************/
|
||||
|
||||
void cView::DoDrawDebugGrid(void) {
|
||||
int stepsX = tmplView->DebugGridX();
|
||||
int stepsY = tmplView->DebugGridY();
|
||||
cRect osdSize = tmplView->GetOsdSize();
|
||||
tColor col = tmplView->DebugGridColor();
|
||||
tColor colFont = tmplView->DebugGridFontColor();
|
||||
|
||||
cRect size(0, 0, osdSize.Width(), osdSize.Height());
|
||||
//use last pixmap as grid pixmap
|
||||
int numGridPixmap = NumPixmaps() - 1;
|
||||
CreatePixmap(numGridPixmap, 7, size);
|
||||
|
||||
int width = size.Width();
|
||||
int height = size.Height();
|
||||
float stepWidthX = (double)width / (double)stepsX;
|
||||
float stepWidthY = (double)height / (double)stepsY;
|
||||
int fontSize = height / stepsY / 5;
|
||||
|
||||
for (int i = 0; i <= stepsX; i++) {
|
||||
int x = (float)i * stepWidthX;
|
||||
if (i==stepsX)
|
||||
x = x-1;
|
||||
cRect line(x, 0, 1, height);
|
||||
DrawRectangle(numGridPixmap, line, col);
|
||||
if (i==stepsX)
|
||||
continue;
|
||||
float percent = (float)i / (float)stepsX * 100.0;
|
||||
cPoint textPosPerc(x+2, 2);
|
||||
cPoint textPosAbs(x+2, fontSize + 4);
|
||||
DrawText(numGridPixmap, textPosPerc, *cString::sprintf("%.1f%%", percent), colFont, 0x00000000, "vdrOsd", fontSize);
|
||||
DrawText(numGridPixmap, textPosAbs, *cString::sprintf("%dpx", x), colFont, 0x00000000, "vdrOsd", fontSize);
|
||||
}
|
||||
for (int i = 0; i <= stepsY; i++) {
|
||||
int y = (float)i * stepWidthY;
|
||||
if (i==stepsY)
|
||||
y = y-1;
|
||||
cRect line(0, y, width, 1);
|
||||
DrawRectangle(numGridPixmap, line, col);
|
||||
if (i==0 || i==stepsY)
|
||||
continue;
|
||||
float percent = (float)i / (float)stepsY * 100.0;
|
||||
cPoint textPosPerc(2, y + 2);
|
||||
cPoint textPosAbs(2, y + fontSize + 4);
|
||||
DrawText(numGridPixmap, textPosPerc, *cString::sprintf("%.1f%%", percent), colFont, 0x00000000, "vdrOsd", fontSize);
|
||||
DrawText(numGridPixmap, textPosAbs, *cString::sprintf("%dpx", y), colFont, 0x00000000, "vdrOsd", fontSize);
|
||||
}
|
||||
}
|
||||
|
||||
void cView::DoFill(int num, cTemplateFunction *func) {
|
||||
tColor col = func->GetColorParameter(ptColor);
|
||||
Fill(num, col);
|
||||
|
@ -13,6 +13,7 @@ class cViewElement;
|
||||
class cView : public cPixmapContainer {
|
||||
private:
|
||||
void Init(void);
|
||||
void DoDrawDebugGrid(void);
|
||||
void DoFill(int num, cTemplateFunction *func);
|
||||
void DoDrawText(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
|
||||
void DoDrawTextVertical(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
|
||||
@ -61,6 +62,7 @@ public:
|
||||
cView(cTemplateView *tmplView);
|
||||
cView(cTemplateViewElement *tmplViewElement);
|
||||
cView(cTemplateViewTab *tmplTab);
|
||||
void DrawDebugGrid(void);
|
||||
virtual ~cView();
|
||||
virtual void Stop(void);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user