mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
implemented function drawslope
This commit is contained in:
parent
ee39eb8066
commit
0b9e3787a2
2
HISTORY
2
HISTORY
@ -32,4 +32,6 @@ Version 0.0.2
|
|||||||
- fixed bug that x and y of subviews was not respected
|
- fixed bug that x and y of subviews was not respected
|
||||||
- if a subview is completely not set in a skin, the default menu is used
|
- if a subview is completely not set in a skin, the default menu is used
|
||||||
- fixed a bug if displaydetailedtext is called without correct menucat (mailbox plugin)
|
- fixed a bug if displaydetailedtext is called without correct menucat (mailbox plugin)
|
||||||
|
- implemented function drawslope, see Wiki for documentation
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!ELEMENT area (loop|fill|drawtext|drawtextbox|drawimage|drawrectangle|drawellipse)*>
|
<!ELEMENT area (loop|fill|drawtext|drawtextbox|drawimage|drawrectangle|drawellipse|drawslope)*>
|
||||||
<!ATTLIST area
|
<!ATTLIST area
|
||||||
x CDATA #IMPLIED
|
x CDATA #IMPLIED
|
||||||
y CDATA #IMPLIED
|
y CDATA #IMPLIED
|
||||||
@ -10,7 +10,7 @@
|
|||||||
debug (true|false) #IMPLIED
|
debug (true|false) #IMPLIED
|
||||||
>
|
>
|
||||||
|
|
||||||
<!ELEMENT areascroll (loop|fill|drawtext|drawtextbox|drawimage|drawrectangle|drawellipse)*>
|
<!ELEMENT areascroll (loop|fill|drawtext|drawtextbox|drawimage|drawrectangle|drawellipse|drawslope)*>
|
||||||
<!ATTLIST areascroll
|
<!ATTLIST areascroll
|
||||||
x CDATA #IMPLIED
|
x CDATA #IMPLIED
|
||||||
y CDATA #IMPLIED
|
y CDATA #IMPLIED
|
||||||
@ -27,7 +27,7 @@
|
|||||||
debug (true|false) #IMPLIED
|
debug (true|false) #IMPLIED
|
||||||
>
|
>
|
||||||
|
|
||||||
<!ELEMENT loop (drawtext|drawtextbox|drawimage|drawrectangle|drawellipse)+>
|
<!ELEMENT loop (drawtext|drawtextbox|drawimage|drawrectangle|drawellipse|drawslope)+>
|
||||||
<!ATTLIST loop
|
<!ATTLIST loop
|
||||||
x CDATA #REQUIRED
|
x CDATA #REQUIRED
|
||||||
y CDATA #REQUIRED
|
y CDATA #REQUIRED
|
||||||
@ -101,8 +101,8 @@
|
|||||||
|
|
||||||
<!ELEMENT drawellipse EMPTY>
|
<!ELEMENT drawellipse EMPTY>
|
||||||
<!ATTLIST drawellipse
|
<!ATTLIST drawellipse
|
||||||
x CDATA #REQUIRED
|
x CDATA #IMPLIED
|
||||||
y CDATA #REQUIRED
|
y CDATA #IMPLIED
|
||||||
width CDATA #IMPLIED
|
width CDATA #IMPLIED
|
||||||
height CDATA #IMPLIED
|
height CDATA #IMPLIED
|
||||||
align (left|center|right) #IMPLIED
|
align (left|center|right) #IMPLIED
|
||||||
@ -114,6 +114,21 @@
|
|||||||
debug NMTOKEN #IMPLIED
|
debug NMTOKEN #IMPLIED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!ELEMENT drawslope EMPTY>
|
||||||
|
<!ATTLIST drawslope
|
||||||
|
x CDATA #IMPLIED
|
||||||
|
y CDATA #IMPLIED
|
||||||
|
width CDATA #REQUIRED
|
||||||
|
height CDATA #REQUIRED
|
||||||
|
align (left|center|right) #IMPLIED
|
||||||
|
valign (top|center|bottom) #IMPLIED
|
||||||
|
color CDATA #REQUIRED
|
||||||
|
type CDATA #REQUIRED
|
||||||
|
name NMTOKEN #IMPLIED
|
||||||
|
condition CDATA #IMPLIED
|
||||||
|
debug NMTOKEN #IMPLIED
|
||||||
|
>
|
||||||
|
|
||||||
<!ELEMENT drawimage EMPTY>
|
<!ELEMENT drawimage EMPTY>
|
||||||
<!ATTLIST drawimage
|
<!ATTLIST drawimage
|
||||||
x CDATA #IMPLIED
|
x CDATA #IMPLIED
|
||||||
|
@ -136,6 +136,15 @@ void cPixmapContainer::DrawEllipse(int num, const cRect &Rect, tColor Color, int
|
|||||||
pixmaps[num]->DrawEllipse(Rect, Color, Quadrants);
|
pixmaps[num]->DrawEllipse(Rect, Color, Quadrants);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cPixmapContainer::DrawSlope(int num, const cRect &Rect, tColor Color, int Type) {
|
||||||
|
if (checkRunning && !Running())
|
||||||
|
return;
|
||||||
|
cMutexLock MutexLock(&mutex);
|
||||||
|
if (!pixmaps[num])
|
||||||
|
return;
|
||||||
|
pixmaps[num]->DrawSlope(Rect, Color, Type);
|
||||||
|
}
|
||||||
|
|
||||||
void cPixmapContainer::DrawImage(int num, const cPoint &Point, const cImage &Image) {
|
void cPixmapContainer::DrawImage(int num, const cPoint &Point, const cImage &Image) {
|
||||||
if (checkRunning && !Running())
|
if (checkRunning && !Running())
|
||||||
return;
|
return;
|
||||||
|
@ -35,6 +35,7 @@ protected:
|
|||||||
void DrawText(int num, const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, std::string fontName, int fontSize);
|
void DrawText(int num, const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, std::string fontName, int fontSize);
|
||||||
void DrawRectangle(int num, const cRect &Rect, tColor Color);
|
void DrawRectangle(int num, const cRect &Rect, tColor Color);
|
||||||
void DrawEllipse(int num, const cRect &Rect, tColor Color, int Quadrants = 0);
|
void DrawEllipse(int num, const cRect &Rect, tColor Color, int Quadrants = 0);
|
||||||
|
void DrawSlope(int num, const cRect &Rect, tColor Color, int Type);
|
||||||
void DrawImage(int num, const cPoint &Point, const cImage &Image);
|
void DrawImage(int num, const cPoint &Point, const cImage &Image);
|
||||||
void DrawBitmap(int num, const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false);
|
void DrawBitmap(int num, const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false);
|
||||||
void Fill(int num, tColor Color);
|
void Fill(int num, tColor Color);
|
||||||
|
@ -83,6 +83,8 @@ void cTemplateFunction::SetParameters(vector<pair<string, string> > params) {
|
|||||||
p.first = ptTransparency;
|
p.first = ptTransparency;
|
||||||
} else if (!name.compare("quadrant")) {
|
} else if (!name.compare("quadrant")) {
|
||||||
p.first = ptQuadrant;
|
p.first = ptQuadrant;
|
||||||
|
} else if (!name.compare("type")) {
|
||||||
|
p.first = ptType;
|
||||||
} else if (!name.compare("align")) {
|
} else if (!name.compare("align")) {
|
||||||
p.first = ptAlign;
|
p.first = ptAlign;
|
||||||
} else if (!name.compare("valign")) {
|
} else if (!name.compare("valign")) {
|
||||||
@ -215,6 +217,7 @@ bool cTemplateFunction::CalculateParameters(void) {
|
|||||||
case ptLayer:
|
case ptLayer:
|
||||||
case ptTransparency:
|
case ptTransparency:
|
||||||
case ptQuadrant:
|
case ptQuadrant:
|
||||||
|
case ptType:
|
||||||
case ptNumElements:
|
case ptNumElements:
|
||||||
case ptFloatWidth:
|
case ptFloatWidth:
|
||||||
case ptFloatHeight:
|
case ptFloatHeight:
|
||||||
@ -301,6 +304,9 @@ void cTemplateFunction::CompleteParameters(void) {
|
|||||||
case ftDrawEllipse:
|
case ftDrawEllipse:
|
||||||
CalculateAlign(GetNumericParameter(ptWidth), GetNumericParameter(ptHeight));
|
CalculateAlign(GetNumericParameter(ptWidth), GetNumericParameter(ptHeight));
|
||||||
break;
|
break;
|
||||||
|
case ftDrawSlope:
|
||||||
|
CalculateAlign(GetNumericParameter(ptWidth), GetNumericParameter(ptHeight));
|
||||||
|
break;
|
||||||
case ftDrawText:
|
case ftDrawText:
|
||||||
CalculateAlign(GetWidth(), GetHeight());
|
CalculateAlign(GetWidth(), GetHeight());
|
||||||
break;
|
break;
|
||||||
@ -439,6 +445,7 @@ int cTemplateFunction::GetWidth(bool cutted) {
|
|||||||
case ftDrawImage:
|
case ftDrawImage:
|
||||||
case ftDrawRectangle:
|
case ftDrawRectangle:
|
||||||
case ftDrawEllipse:
|
case ftDrawEllipse:
|
||||||
|
case ftDrawSlope:
|
||||||
case ftDrawTextBox:
|
case ftDrawTextBox:
|
||||||
funcWidth = GetNumericParameter(ptWidth);
|
funcWidth = GetNumericParameter(ptWidth);
|
||||||
break;
|
break;
|
||||||
@ -459,6 +466,7 @@ int cTemplateFunction::GetHeight(void) {
|
|||||||
case ftDrawImage:
|
case ftDrawImage:
|
||||||
case ftDrawRectangle:
|
case ftDrawRectangle:
|
||||||
case ftDrawEllipse:
|
case ftDrawEllipse:
|
||||||
|
case ftDrawSlope:
|
||||||
funcHeight = GetNumericParameter(ptHeight);
|
funcHeight = GetNumericParameter(ptHeight);
|
||||||
break;
|
break;
|
||||||
case ftDrawTextBox: {
|
case ftDrawTextBox: {
|
||||||
@ -1265,6 +1273,9 @@ string cTemplateFunction::GetFuncName(void) {
|
|||||||
case ftDrawEllipse:
|
case ftDrawEllipse:
|
||||||
name = "Function DrawEllipse";
|
name = "Function DrawEllipse";
|
||||||
break;
|
break;
|
||||||
|
case ftDrawSlope:
|
||||||
|
name = "Function DrawSlope";
|
||||||
|
break;
|
||||||
case ftNone:
|
case ftNone:
|
||||||
name = "Undefined";
|
name = "Undefined";
|
||||||
break;
|
break;
|
||||||
@ -1332,6 +1343,9 @@ string cTemplateFunction::GetParamName(eParamType pt) {
|
|||||||
case ptQuadrant:
|
case ptQuadrant:
|
||||||
name = "Quadrant";
|
name = "Quadrant";
|
||||||
break;
|
break;
|
||||||
|
case ptType:
|
||||||
|
name = "Type";
|
||||||
|
break;
|
||||||
case ptAlign:
|
case ptAlign:
|
||||||
name = "Align";
|
name = "Align";
|
||||||
break;
|
break;
|
||||||
|
@ -32,6 +32,7 @@ enum eFuncType {
|
|||||||
ftDrawImage,
|
ftDrawImage,
|
||||||
ftDrawRectangle,
|
ftDrawRectangle,
|
||||||
ftDrawEllipse,
|
ftDrawEllipse,
|
||||||
|
ftDrawSlope,
|
||||||
ftNone
|
ftNone
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ enum eParamType {
|
|||||||
ptLayer,
|
ptLayer,
|
||||||
ptTransparency,
|
ptTransparency,
|
||||||
ptQuadrant,
|
ptQuadrant,
|
||||||
|
ptType,
|
||||||
ptAlign,
|
ptAlign,
|
||||||
ptValign,
|
ptValign,
|
||||||
ptScrollMode,
|
ptScrollMode,
|
||||||
|
@ -107,6 +107,8 @@ void cTemplatePixmap::AddFunction(string name, vector<pair<string, string> > &pa
|
|||||||
type = ftDrawRectangle;
|
type = ftDrawRectangle;
|
||||||
} else if (!name.compare("drawellipse")) {
|
} else if (!name.compare("drawellipse")) {
|
||||||
type = ftDrawEllipse;
|
type = ftDrawEllipse;
|
||||||
|
} else if (!name.compare("drawslope")) {
|
||||||
|
type = ftDrawSlope;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == ftNone) {
|
if (type == ftNone) {
|
||||||
|
@ -558,6 +558,20 @@ void cTemplateView::SetFunctionDefinitions(void) {
|
|||||||
attributes.insert("quadrant");
|
attributes.insert("quadrant");
|
||||||
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
|
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
|
||||||
|
|
||||||
|
name = "drawslope";
|
||||||
|
attributes.clear();
|
||||||
|
attributes.insert("debug");
|
||||||
|
attributes.insert("condition");
|
||||||
|
attributes.insert("name");
|
||||||
|
attributes.insert("x");
|
||||||
|
attributes.insert("y");
|
||||||
|
attributes.insert("align");
|
||||||
|
attributes.insert("valign");
|
||||||
|
attributes.insert("width");
|
||||||
|
attributes.insert("height");
|
||||||
|
attributes.insert("color");
|
||||||
|
attributes.insert("type");
|
||||||
|
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
|
29
views/view.c
29
views/view.c
@ -251,6 +251,9 @@ void cView::DrawPixmap(int num, cTemplatePixmap *pix, map < string, vector< map<
|
|||||||
case ftDrawEllipse:
|
case ftDrawEllipse:
|
||||||
DoDrawEllipse(num, func);
|
DoDrawEllipse(num, func);
|
||||||
break;
|
break;
|
||||||
|
case ftDrawSlope:
|
||||||
|
DoDrawSlope(num, func);
|
||||||
|
break;
|
||||||
case ftDrawImage:
|
case ftDrawImage:
|
||||||
DoDrawImage(num, func);
|
DoDrawImage(num, func);
|
||||||
break;
|
break;
|
||||||
@ -348,6 +351,9 @@ void cView::DrawLoop(int numPixmap, cTemplateFunction *func, map < string, vecto
|
|||||||
case ftDrawEllipse:
|
case ftDrawEllipse:
|
||||||
DoDrawEllipse(numPixmap, func, x0, y0);
|
DoDrawEllipse(numPixmap, func, x0, y0);
|
||||||
break;
|
break;
|
||||||
|
case ftDrawSlope:
|
||||||
|
DoDrawSlope(numPixmap, func, x0, y0);
|
||||||
|
break;
|
||||||
case ftDrawImage:
|
case ftDrawImage:
|
||||||
DoDrawImage(numPixmap, func, x0, y0);
|
DoDrawImage(numPixmap, func, x0, y0);
|
||||||
break;
|
break;
|
||||||
@ -634,9 +640,32 @@ void cView::DoDrawEllipse(int num, cTemplateFunction *func, int x0, int y0) {
|
|||||||
cRect size(x, y, w, h);
|
cRect size(x, y, w, h);
|
||||||
tColor clr = func->GetColorParameter(ptColor);
|
tColor clr = func->GetColorParameter(ptColor);
|
||||||
int quadrant = func->GetNumericParameter(ptQuadrant);
|
int quadrant = func->GetNumericParameter(ptQuadrant);
|
||||||
|
if (quadrant < -4 || quadrant > 8) {
|
||||||
|
esyslog("skindesigner: wrong quadrant %d for drawellipse, allowed values are from -4 to 8", quadrant);
|
||||||
|
quadrant = 0;
|
||||||
|
}
|
||||||
DrawEllipse(num, size, clr, quadrant);
|
DrawEllipse(num, size, clr, quadrant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cView::DoDrawSlope(int num, cTemplateFunction *func, int x0, int y0) {
|
||||||
|
int x = func->GetNumericParameter(ptX);
|
||||||
|
int y = func->GetNumericParameter(ptY);
|
||||||
|
if (x < 0) x = 0;
|
||||||
|
x += x0;
|
||||||
|
if (y < 0) y = 0;
|
||||||
|
y += y0;
|
||||||
|
int w = func->GetNumericParameter(ptWidth);
|
||||||
|
int h = func->GetNumericParameter(ptHeight);
|
||||||
|
cRect size(x, y, w, h);
|
||||||
|
tColor clr = func->GetColorParameter(ptColor);
|
||||||
|
int type = func->GetNumericParameter(ptType);
|
||||||
|
if (type < 0 || type > 7) {
|
||||||
|
esyslog("skindesigner: wrong type %d for drawslope, allowed values are from 0 to 7", type);
|
||||||
|
type = 0;
|
||||||
|
}
|
||||||
|
DrawSlope(num, size, clr, type);
|
||||||
|
}
|
||||||
|
|
||||||
void cView::DoDrawImage(int num, cTemplateFunction *func, int x0, int y0) {
|
void cView::DoDrawImage(int num, cTemplateFunction *func, int x0, int y0) {
|
||||||
int x = func->GetNumericParameter(ptX);
|
int x = func->GetNumericParameter(ptX);
|
||||||
int y = func->GetNumericParameter(ptY);
|
int y = func->GetNumericParameter(ptY);
|
||||||
|
@ -17,6 +17,7 @@ private:
|
|||||||
void DoDrawFloatingTextBox(int num, cTemplateFunction *func);
|
void DoDrawFloatingTextBox(int num, cTemplateFunction *func);
|
||||||
void DoDrawRectangle(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
|
void DoDrawRectangle(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
|
||||||
void DoDrawEllipse(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
|
void DoDrawEllipse(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
|
||||||
|
void DoDrawSlope(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
|
||||||
void DoDrawImage(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
|
void DoDrawImage(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
|
||||||
void ActivateScrolling(void);
|
void ActivateScrolling(void);
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user