mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
possibility to move viewelements when starting view
This commit is contained in:
parent
918a331de3
commit
c5edc10fbd
2
HISTORY
2
HISTORY
@ -307,3 +307,5 @@ Version 0.4.3
|
||||
- fixed bug that tokens in image pathes are not replaced correctly
|
||||
|
||||
Version 0.4.4
|
||||
|
||||
- feature: possibility to move viewelements when starting view
|
||||
|
@ -96,6 +96,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
mode CDATA #IMPLIED
|
||||
@ -106,6 +109,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -115,6 +121,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -124,6 +133,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -133,6 +145,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -148,6 +163,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
|
@ -63,6 +63,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -72,6 +75,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -81,6 +87,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
mode CDATA #IMPLIED
|
||||
@ -91,6 +100,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -100,6 +112,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -109,6 +124,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -118,6 +136,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -127,6 +148,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -136,6 +160,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
@ -145,6 +172,9 @@
|
||||
detached CDATA #IMPLIED
|
||||
delay CDATA #IMPLIED
|
||||
fadetime CDATA #IMPLIED
|
||||
shifttime CDATA #IMPLIED
|
||||
startx CDATA #IMPLIED
|
||||
starty CDATA #IMPLIED
|
||||
debug CDATA #IMPLIED
|
||||
condition CDATA #IMPLIED
|
||||
>
|
||||
|
@ -20,6 +20,7 @@ cPixmapContainer::cPixmapContainer(int numPixmaps) {
|
||||
mutex.Unlock();
|
||||
checkRunning = false;
|
||||
fadeTime = 0;
|
||||
shiftTime = 0;
|
||||
deleteOsdOnExit = false;
|
||||
}
|
||||
|
||||
@ -122,7 +123,7 @@ void cPixmapContainer::CreatePixmap(int num, int Layer, const cRect &ViewPort, c
|
||||
if (!pixmaps[num])
|
||||
return;
|
||||
pixmaps[num]->Fill(clrTransparent);
|
||||
if (pixContainerInit && fadeTime) {
|
||||
if (pixContainerInit && (fadeTime || shiftTime)) {
|
||||
pixmaps[num]->SetAlpha(0);
|
||||
} else if (pixmapsTransparency[num] > 0) {
|
||||
int alpha = (100 - pixmapsTransparency[num])*255/100;
|
||||
@ -256,6 +257,16 @@ void cPixmapContainer::Pos(int num, cPoint &pos) {
|
||||
pos.SetY(pixmaps[num]->ViewPort().Y());
|
||||
}
|
||||
|
||||
cRect cPixmapContainer::ViewPort(int num) {
|
||||
cRect vp;
|
||||
if (checkRunning && !Running())
|
||||
return vp;
|
||||
cMutexLock MutexLock(&mutex);
|
||||
if (!pixmaps[num])
|
||||
return vp;
|
||||
return pixmaps[num]->ViewPort();
|
||||
}
|
||||
|
||||
int cPixmapContainer::Width(int num) {
|
||||
if (checkRunning && !Running())
|
||||
return 0;
|
||||
@ -331,8 +342,13 @@ void cPixmapContainer::SetDrawPortPoint(int num, const cPoint &Point) {
|
||||
****************************************************************************/
|
||||
|
||||
void cPixmapContainer::FadeIn(void) {
|
||||
if (!fadeTime)
|
||||
if (!fadeTime) {
|
||||
for (int i = 0; i < numPixmaps; i++) {
|
||||
if (PixmapExists(i))
|
||||
SetAlpha(i, ALPHA_OPAQUE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
uint64_t Start = cTimeMs::Now();
|
||||
int FadeFrameTime = fadeTime / 10;
|
||||
while (Running()) {
|
||||
@ -386,6 +402,49 @@ void cPixmapContainer::FadeOut(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void cPixmapContainer::ShiftIn(void) {
|
||||
if (shiftTime < 1)
|
||||
return;
|
||||
cPoint destPos[numPixmaps];
|
||||
for (int i = 0; i < numPixmaps; i++) {
|
||||
if (!PixmapExists(i))
|
||||
continue;
|
||||
cPoint pos;
|
||||
Pos(i, pos);
|
||||
destPos[i] = pos;
|
||||
cRect r = ViewPort(i);
|
||||
r.SetPoint(startPos);
|
||||
SetViewPort(i, r);
|
||||
SetAlpha(i, ALPHA_OPAQUE);
|
||||
}
|
||||
DoFlush();
|
||||
|
||||
int frames = shiftTime / 20;
|
||||
if (frames <= 0) frames = 1;
|
||||
uint64_t Start = cTimeMs::Now();
|
||||
int frameTime = shiftTime / frames;
|
||||
while (true) {
|
||||
uint64_t Now = cTimeMs::Now();
|
||||
double t = min(double(Now - Start) / shiftTime, 1.0);
|
||||
for (int i = 0; i < numPixmaps; i++) {
|
||||
if (!PixmapExists(i))
|
||||
continue;
|
||||
int x = startPos.X() + t * (destPos[i].X() - startPos.X());
|
||||
int y = startPos.Y() + t * (destPos[i].Y() - startPos.Y());
|
||||
cRect r = ViewPort(i);
|
||||
r.SetPoint(x, y);
|
||||
SetViewPort(i, r);
|
||||
}
|
||||
DoFlush();
|
||||
int Delta = cTimeMs::Now() - Now;
|
||||
if (Delta < frameTime)
|
||||
cCondWait::SleepMs(frameTime - Delta);
|
||||
if ((int)(Now - Start) > shiftTime)
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* scrollSpeed: 1 slow
|
||||
* 2 medium
|
||||
|
@ -23,6 +23,8 @@ private:
|
||||
int *pixmapsLayer;
|
||||
bool checkRunning;
|
||||
int fadeTime;
|
||||
int shiftTime;
|
||||
cPoint startPos;
|
||||
bool deleteOsdOnExit;
|
||||
protected:
|
||||
void SetInitFinished(void) { pixContainerInit = false; };
|
||||
@ -46,6 +48,7 @@ protected:
|
||||
void SetViewPort(int num, const cRect &rect);
|
||||
int Layer(int num);
|
||||
void Pos(int num, cPoint &pos);
|
||||
cRect ViewPort(int num);
|
||||
int Width(int num);
|
||||
int Height(int num);
|
||||
int DrawportWidth(int num);
|
||||
@ -57,8 +60,12 @@ protected:
|
||||
void UnsetCheckRunning(void) { checkRunning = false; };
|
||||
//HELPERS -- do not access the pixmaps array directly, use wrapper functions
|
||||
void SetFadeTime(int fade) { fadeTime = fade; };
|
||||
void SetShiftTime(int shift) { shiftTime = shift; };
|
||||
void SetStartPos(int posX, int posY) { startPos.SetX(posX); startPos.SetY(posY); };
|
||||
bool IsAnimated(void) { return (shiftTime > 0); };
|
||||
void FadeIn(void);
|
||||
void FadeOut(void);
|
||||
void ShiftIn(void);
|
||||
void ScrollVertical(int num, int scrollDelay, int scrollSpeed);
|
||||
void ScrollHorizontal(int num, int scrollDelay, int scrollSpeed, int scrollMode);
|
||||
void CancelSave(void);
|
||||
|
@ -73,6 +73,12 @@ void cTemplateFunction::SetParameters(vector<pair<string, string> > params) {
|
||||
p.first = ptDetached;
|
||||
} else if (!name.compare("fadetime")) {
|
||||
p.first = ptFadeTime;
|
||||
} else if (!name.compare("shifttime")) {
|
||||
p.first = ptShiftTime;
|
||||
} else if (!name.compare("startx")) {
|
||||
p.first = ptStartX;
|
||||
} else if (!name.compare("starty")) {
|
||||
p.first = ptStartY;
|
||||
} else if (!name.compare("imagetype")) {
|
||||
p.first = ptImageType;
|
||||
} else if (!name.compare("path")) {
|
||||
@ -230,7 +236,10 @@ bool cTemplateFunction::CalculateParameters(void) {
|
||||
case ptHeight:
|
||||
case ptMenuItemWidth:
|
||||
case ptFadeTime:
|
||||
case ptShiftTime:
|
||||
case ptDelay:
|
||||
case ptStartX:
|
||||
case ptStartY:
|
||||
case ptFontSize:
|
||||
case ptLayer:
|
||||
case ptTransparency:
|
||||
@ -780,6 +789,7 @@ bool cTemplateFunction::SetNumericParameter(eParamType type, string value) {
|
||||
param.SetGlobals(globals);
|
||||
switch (type) {
|
||||
case ptX:
|
||||
case ptStartX:
|
||||
case ptWidth:
|
||||
case ptMenuItemWidth:
|
||||
case ptScaleTvX:
|
||||
@ -787,6 +797,7 @@ bool cTemplateFunction::SetNumericParameter(eParamType type, string value) {
|
||||
param.SetHorizontal();
|
||||
break;
|
||||
case ptY:
|
||||
case ptStartY:
|
||||
case ptHeight:
|
||||
case ptScaleTvY:
|
||||
case ptScaleTvHeight:
|
||||
@ -1591,6 +1602,15 @@ string cTemplateFunction::GetParamName(eParamType pt) {
|
||||
case ptFadeTime:
|
||||
name = "Fade Time";
|
||||
break;
|
||||
case ptShiftTime:
|
||||
name = "Shift Time";
|
||||
break;
|
||||
case ptStartX:
|
||||
name = "Startpos X";
|
||||
break;
|
||||
case ptStartY:
|
||||
name = "Startpos Y";
|
||||
break;
|
||||
case ptDelay:
|
||||
name = "Delay";
|
||||
break;
|
||||
|
@ -51,6 +51,9 @@ enum eParamType {
|
||||
ptMenuItemWidth,
|
||||
ptDetached,
|
||||
ptFadeTime,
|
||||
ptShiftTime,
|
||||
ptStartX,
|
||||
ptStartY,
|
||||
ptDelay,
|
||||
ptImageType,
|
||||
ptPath,
|
||||
|
@ -667,6 +667,9 @@ void cTemplateView::SetFunctionDefinitions(void) {
|
||||
attributes.insert("detached");
|
||||
attributes.insert("delay");
|
||||
attributes.insert("fadetime");
|
||||
attributes.insert("shifttime");
|
||||
attributes.insert("startx");
|
||||
attributes.insert("starty");
|
||||
attributes.insert("name");
|
||||
attributes.insert("condition");
|
||||
attributes.insert("mode");
|
||||
|
@ -186,7 +186,7 @@
|
||||
{devices[channelid]} ID of the currently tuned channel
|
||||
{devices[source]} source of the currently tuned channel
|
||||
-->
|
||||
<devices condition="{showdevices}" detached="true" delay="100" fadetime="{fadetime}">
|
||||
<devices condition="{showdevices}" detached="true" delay="300" shifttime="500" startx="100%" starty="30%">
|
||||
<area x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1" background="true">
|
||||
<fill color="{clrTransBlack}"/>
|
||||
</area>
|
||||
@ -224,20 +224,20 @@
|
||||
{pressure} pressure in HPo
|
||||
{ozone} ozone value in DU
|
||||
-->
|
||||
<currentweather>
|
||||
<currentweather detached="true" delay="100" shifttime="300" startx="100%" starty="15%" >
|
||||
<area background="true" x="70%" y="15%" width="30%" height="13%" layer="1">
|
||||
<fill color="{clrTransBlack}" />
|
||||
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
|
||||
</area>
|
||||
<area x="70%" y="15%" width="13%" height="13%" layer="2">
|
||||
<drawimage imagetype="icon" path="{icon}" align="center" valign="center" width="{areaheight}*0.8" height="{areaheight}*0.8"/>
|
||||
<area x="70%" y="15%" width="30%" height="13%" layer="2">
|
||||
<drawimage name="weathericon" imagetype="icon" path="{icon}" x="0.43*{areawidth}/2 - {width(weathericon)}/2" valign="center" width="{areaheight}*0.8" height="{areaheight}*0.8"/>
|
||||
</area>
|
||||
<area x="85%" y="15%" width="13%" height="13%" layer="2">
|
||||
<drawtext x="0" y="0" font="{light}" fontsize="25%" color="{clrWhite}" text="{mintemperature}°C" />
|
||||
<drawtext x="0" y="75%" font="{light}" fontsize="25%" color="{clrWhite}" text="{maxtemperature}°C" />
|
||||
<area x="70%" y="15%" width="30%" height="13%" layer="2">
|
||||
<drawtext x="50%" y="0" font="{light}" fontsize="25%" color="{clrWhite}" text="{mintemperature}°C" />
|
||||
<drawtext x="50%" y="75%" font="{light}" fontsize="25%" color="{clrWhite}" text="{maxtemperature}°C" />
|
||||
</area>
|
||||
<area x="85%" y="15%" width="13%" height="13%" layer="3">
|
||||
<drawtext align="right" valign="center" font="{light}" fontsize="60%" color="{clrWhite}" text="{temperature}°C" />
|
||||
<area x="70%" y="15%" width="30%" height="13%" layer="3">
|
||||
<drawtext x="50%" valign="center" font="{light}" fontsize="60%" color="{clrWhite}" text="{temperature}°C" />
|
||||
</area>
|
||||
</currentweather>
|
||||
|
||||
@ -277,17 +277,17 @@
|
||||
{monthnameshort} 3 letter abbrivation of month name
|
||||
{year} year in yyyy
|
||||
-->
|
||||
<datetime>
|
||||
<datetime detached="true" delay="100" shifttime="300" startx="100%" starty="0">
|
||||
<area background="true" x="70%" y="0" width="30%" height="13%" layer="1">
|
||||
<fill color="{clrTransBlack}" />
|
||||
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
|
||||
</area>
|
||||
<area x="70%" y="0" width="13%" height="13%" layer="2">
|
||||
<drawtext align="right" y="0" font="{light}" fontsize="50%" color="{clrWhite}" text="{dayname}" />
|
||||
<drawtext align="right" y="48%" font="{light}" fontsize="50%" color="{clrWhite}" text="{day}. {monthnameshort}" />
|
||||
<area x="70%" y="0" width="30%" height="13%" layer="2">
|
||||
<drawtext align="right" y="0" font="{light}" fontsize="50%" color="{clrWhite}" text="{dayname} " />
|
||||
<drawtext align="right" y="48%" font="{light}" fontsize="50%" color="{clrWhite}" text="{day}. {monthnameshort} " />
|
||||
</area>
|
||||
<area x="85%" y="0" width="13%" height="13%" layer="2">
|
||||
<drawtext align="center" valign="center" font="{light}" fontsize="90%" color="{clrWhite}" text="{time}" />
|
||||
<area x="70%" y="0" width="30%" height="13%" layer="2">
|
||||
<drawtext x="1%" valign="center" font="{light}" fontsize="90%" color="{clrWhite}" text="{time}" />
|
||||
</area>
|
||||
</datetime>
|
||||
<!-- Available Variables message:
|
||||
|
@ -121,7 +121,7 @@
|
||||
{timers[channellogoexists]} true if channel logo exists
|
||||
{timers[isremotetimer]} true if timer is a remote timer from remotetimers plugin
|
||||
-->
|
||||
<timers detached="true" delay="100" fadetime="0">
|
||||
<timers detached="true" delay="100" shifttime="500" startx="0" starty="100%">
|
||||
<area x="0" y="75%" width="{areawidth}/8 - 5" height="25%" layer="1">
|
||||
<fill color="{clrTransBlack}" />
|
||||
</area>
|
||||
|
10
views/view.c
10
views/view.c
@ -1048,6 +1048,8 @@ cViewElement::cViewElement(cTemplateViewElement *tmplViewElement) : cView(tmplVi
|
||||
tmplViewElement->SetPixOffset(0);
|
||||
delay = tmplViewElement->GetNumericParameter(ptDelay);
|
||||
SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime));
|
||||
SetShiftTime(tmplViewElement->GetNumericParameter(ptShiftTime));
|
||||
SetStartPos(tmplViewElement->GetNumericParameter(ptStartX), tmplViewElement->GetNumericParameter(ptStartY));
|
||||
}
|
||||
|
||||
cViewElement::~cViewElement() {
|
||||
@ -1055,10 +1057,14 @@ cViewElement::~cViewElement() {
|
||||
}
|
||||
|
||||
void cViewElement::Action(void) {
|
||||
SetInitFinished();
|
||||
DoSleep(delay);
|
||||
Render();
|
||||
FadeIn();
|
||||
SetInitFinished();
|
||||
if (IsAnimated()) {
|
||||
ShiftIn();
|
||||
} else {
|
||||
FadeIn();
|
||||
}
|
||||
DoFlush();
|
||||
if (scrolling) {
|
||||
DoSleep(scrollDelay);
|
||||
|
Loading…
Reference in New Issue
Block a user