mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
fixed line breaks
This commit is contained in:
@@ -1,347 +1,347 @@
|
||||
#include "animation.h"
|
||||
#include <math.h>
|
||||
|
||||
/******************************************************************
|
||||
* cAnimation
|
||||
******************************************************************/
|
||||
cAnimation::cAnimation(cScrollable *scrollable) : cThread("scroller") {
|
||||
this->scrollable = scrollable;
|
||||
this->detachable = NULL;
|
||||
this->fadable = NULL;
|
||||
this->shiftable = NULL;
|
||||
this->blinkable = NULL;
|
||||
waitOnWakeup = false;
|
||||
doAnimation = true;
|
||||
modeIn = false;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
cAnimation::cAnimation(cDetachable *detachable, bool wait, bool animation) : cThread("detached") {
|
||||
this->scrollable = NULL;
|
||||
this->detachable = detachable;
|
||||
this->fadable = NULL;
|
||||
this->shiftable = NULL;
|
||||
this->blinkable = NULL;
|
||||
waitOnWakeup = wait;
|
||||
doAnimation = animation;
|
||||
modeIn = false;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
cAnimation::cAnimation(cFadable *fadable, bool fadein) : cThread("fadable") {
|
||||
this->scrollable = NULL;
|
||||
this->detachable = NULL;
|
||||
this->fadable = fadable;
|
||||
this->shiftable = NULL;
|
||||
this->blinkable = NULL;
|
||||
waitOnWakeup = false;
|
||||
doAnimation = true;
|
||||
modeIn = fadein;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
cAnimation::cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin) : cThread("shiftable") {
|
||||
this->scrollable = NULL;
|
||||
this->detachable = NULL;
|
||||
this->fadable = NULL;
|
||||
this->shiftable = shiftable;
|
||||
this->blinkable = NULL;
|
||||
waitOnWakeup = false;
|
||||
doAnimation = true;
|
||||
modeIn = shiftin;
|
||||
shiftstart = start;
|
||||
shiftend = end;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
cAnimation::cAnimation(cBlinkable *blinkable, int func) : cThread("blinking") {
|
||||
this->scrollable = NULL;
|
||||
this->detachable = NULL;
|
||||
this->fadable = NULL;
|
||||
this->shiftable = NULL;
|
||||
this->blinkable = blinkable;
|
||||
waitOnWakeup = false;
|
||||
doAnimation = true;
|
||||
modeIn = false;
|
||||
blinkFunc = func;
|
||||
}
|
||||
|
||||
cAnimation::~cAnimation(void) {
|
||||
sleepWait.Signal();
|
||||
Cancel(2);
|
||||
}
|
||||
|
||||
void cAnimation::WakeUp(void) {
|
||||
sleepWait.Signal();
|
||||
}
|
||||
|
||||
void cAnimation::Stop(bool deletePixmaps) {
|
||||
sleepWait.Signal();
|
||||
Cancel(2);
|
||||
if (scrollable && deletePixmaps)
|
||||
scrollable->StopScrolling();
|
||||
}
|
||||
|
||||
void cAnimation::Action(void) {
|
||||
if (scrollable) {
|
||||
Scroll();
|
||||
} else if (detachable) {
|
||||
Detach();
|
||||
} else if (fadable) {
|
||||
Fade();
|
||||
} else if (shiftable) {
|
||||
Shift();
|
||||
} else if (blinkable) {
|
||||
Blink();
|
||||
}
|
||||
}
|
||||
|
||||
void cAnimation::Sleep(int duration) {
|
||||
//sleep should wake up itself, so no infinit wait allowed
|
||||
if (duration <= 0)
|
||||
return;
|
||||
sleepWait.Wait(duration);
|
||||
}
|
||||
|
||||
void cAnimation::Wait(void) {
|
||||
//wait has to be waked up from outside
|
||||
sleepWait.Wait(0);
|
||||
}
|
||||
|
||||
void cAnimation::Scroll(void) {
|
||||
int delay = scrollable->ScrollDelay();
|
||||
Sleep(delay);
|
||||
if (!Running()) return;
|
||||
|
||||
eOrientation orientation = scrollable->ScrollOrientation();
|
||||
int scrollTotal = 0;
|
||||
if (orientation == eOrientation::horizontal) {
|
||||
scrollTotal = scrollable->ScrollWidth();
|
||||
} else if (orientation == eOrientation::vertical) {
|
||||
scrollTotal = scrollable->ScrollHeight();
|
||||
}
|
||||
|
||||
eScrollMode mode = scrollable->ScrollMode();
|
||||
bool carriageReturn = (mode == eScrollMode::carriagereturn) ? true : false;
|
||||
|
||||
eScrollSpeed speed = scrollable->ScrollSpeed();
|
||||
int frameTime = 30;
|
||||
if (speed == eScrollSpeed::slow)
|
||||
frameTime = 50;
|
||||
else if (speed == eScrollSpeed::medium)
|
||||
frameTime = 30;
|
||||
else if (speed == eScrollSpeed::fast)
|
||||
frameTime = 15;
|
||||
|
||||
if (!Running()) return;
|
||||
|
||||
scrollable->StartScrolling();
|
||||
|
||||
int drawPortX = 0;
|
||||
int drawPortY = 0;
|
||||
int scrollDelta = 1;
|
||||
|
||||
bool doSleep = false;
|
||||
while (Running()) {
|
||||
if (doSleep) {
|
||||
Sleep(delay);
|
||||
doSleep = false;
|
||||
}
|
||||
if (!Running()) return;
|
||||
uint64_t now = cTimeMs::Now();
|
||||
|
||||
cPoint drawPortPoint(0,0);
|
||||
if (orientation == eOrientation::horizontal) {
|
||||
|
||||
drawPortX -= scrollDelta;
|
||||
if (abs(drawPortX) > scrollTotal) {
|
||||
Sleep(delay);
|
||||
if (carriageReturn) {
|
||||
drawPortX = 0;
|
||||
doSleep = true;
|
||||
} else {
|
||||
scrollDelta *= -1;
|
||||
drawPortX -= scrollDelta;
|
||||
}
|
||||
}
|
||||
drawPortPoint.SetX(drawPortX);
|
||||
|
||||
} else if (orientation == eOrientation::vertical) {
|
||||
|
||||
drawPortY -= scrollDelta;
|
||||
if (abs(drawPortY) > scrollTotal) {
|
||||
Sleep(delay);
|
||||
drawPortY = 0;
|
||||
doSleep = true;
|
||||
}
|
||||
drawPortPoint.SetY(drawPortY);
|
||||
|
||||
}
|
||||
|
||||
if (!Running()) return;
|
||||
scrollable->SetDrawPort(drawPortPoint);
|
||||
|
||||
if (!Running()) return;
|
||||
scrollable->Flush();
|
||||
|
||||
if (orientation == eOrientation::horizontal && !carriageReturn && (drawPortX == 0)) {
|
||||
scrollDelta *= -1;
|
||||
doSleep = true;
|
||||
}
|
||||
|
||||
int delta = cTimeMs::Now() - now;
|
||||
if (delta < frameTime)
|
||||
Sleep(frameTime - delta);
|
||||
}
|
||||
}
|
||||
|
||||
void cAnimation::Detach(void) {
|
||||
if (waitOnWakeup) {
|
||||
Wait();
|
||||
int delay = 100 + detachable->Delay();
|
||||
Sleep(delay);
|
||||
} else {
|
||||
int delay = detachable->Delay();
|
||||
Sleep(delay);
|
||||
}
|
||||
if (!Running()) return;
|
||||
detachable->ParseDetached();
|
||||
if (!Running()) return;
|
||||
detachable->RenderDetached();
|
||||
if (!Running()) return;
|
||||
detachable->Flush();
|
||||
if (!Running()) return;
|
||||
if (doAnimation) {
|
||||
detachable->StartAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
void cAnimation::Fade(void) {
|
||||
int fadetime = fadable->FadeTime();
|
||||
int frametime = 1000 / FPS;
|
||||
int step = 100.0f / ((double)fadetime / (double)frametime);
|
||||
uint64_t start = cTimeMs::Now();
|
||||
int transparency = 0;
|
||||
if (modeIn) {
|
||||
transparency = 100 - step;
|
||||
} else {
|
||||
transparency = step;
|
||||
}
|
||||
//wait configured delay if not already done by detacher
|
||||
if (!fadable->Detached()) {
|
||||
int delay = fadable->Delay();
|
||||
if (delay > 0)
|
||||
Sleep(delay);
|
||||
}
|
||||
while (Running() || !modeIn) {
|
||||
uint64_t now = cTimeMs::Now();
|
||||
if (Running() || !modeIn)
|
||||
fadable->SetTransparency(transparency, !modeIn);
|
||||
if (Running() || !modeIn)
|
||||
fadable->Flush();
|
||||
int delta = cTimeMs::Now() - now;
|
||||
if ((Running() || !modeIn) && (delta < frametime)) {
|
||||
Sleep(frametime - delta);
|
||||
}
|
||||
if ((int)(now - start) > fadetime) {
|
||||
if ((Running() && modeIn) && transparency > 0) {
|
||||
fadable->SetTransparency(0);
|
||||
fadable->Flush();
|
||||
} else if (!modeIn && transparency < 100) {
|
||||
fadable->SetTransparency(100, true);
|
||||
fadable->Flush();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (modeIn) {
|
||||
transparency -= step;
|
||||
if (transparency < 0)
|
||||
transparency = 0;
|
||||
} else {
|
||||
transparency += step;
|
||||
if (transparency > 100)
|
||||
transparency = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cAnimation::Shift(void) {
|
||||
int shifttime = shiftable->ShiftTime();
|
||||
eShiftMode mode = (eShiftMode)shiftable->ShiftMode();
|
||||
//in shiftmode slowedDown shifting is done starting with slowratio % faster
|
||||
//at start. Then speed reduces linear to (100 - slowratio)% at end
|
||||
//for me 60 is a nice value :-)
|
||||
int slowRatio = 60;
|
||||
|
||||
int frametime = 1000 / FPS;
|
||||
int steps = (double)shifttime / (double)frametime;
|
||||
int stepXLinear = 0;
|
||||
int stepYLinear = 0;
|
||||
if (shiftstart.X() == shiftend.X()) {
|
||||
stepYLinear = (shiftend.Y() - shiftstart.Y()) / steps;
|
||||
} else if (shiftstart.Y() == shiftend.Y()) {
|
||||
stepXLinear = (shiftend.X() - shiftstart.X()) / steps;
|
||||
} else {
|
||||
stepXLinear = (shiftend.X() - shiftstart.X()) / steps;
|
||||
stepYLinear = (shiftend.Y() - shiftstart.Y()) / steps;
|
||||
}
|
||||
int stepX = stepXLinear;
|
||||
int stepY = stepYLinear;
|
||||
|
||||
cPoint pos;
|
||||
if (modeIn)
|
||||
pos = shiftstart;
|
||||
else
|
||||
pos = shiftend;
|
||||
|
||||
//wait configured delay if not already done by detacher
|
||||
if (!shiftable->Detached()) {
|
||||
int delay = shiftable->Delay();
|
||||
if (delay > 0)
|
||||
Sleep(delay);
|
||||
}
|
||||
uint64_t start = cTimeMs::Now();
|
||||
while (Running() || !modeIn) {
|
||||
uint64_t now = cTimeMs::Now();
|
||||
if (Running() || !modeIn)
|
||||
shiftable->SetPosition(pos, shiftend);
|
||||
if (Running() || !modeIn)
|
||||
shiftable->Flush();
|
||||
int delta = cTimeMs::Now() - now;
|
||||
if ((Running() || !modeIn) && (delta < frametime)) {
|
||||
cCondWait::SleepMs(frametime - delta);
|
||||
}
|
||||
if ((int)(now - start) > shifttime) {
|
||||
if ((Running() && modeIn) && pos != shiftend) {
|
||||
shiftable->SetPosition(shiftend, shiftend);
|
||||
shiftable->Flush();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (mode == eShiftMode::slowedDown) {
|
||||
double t = (double)(now - start) / (double)shifttime;
|
||||
double factor = 1.0f + (double)slowRatio / 100.0f - 2.0f * ((double)slowRatio / 100.0f) * t;
|
||||
stepX = stepXLinear * factor;
|
||||
stepY = stepYLinear * factor;
|
||||
}
|
||||
if (modeIn) {
|
||||
pos.Set(pos.X() + stepX, pos.Y() + stepY);
|
||||
} else {
|
||||
pos.Set(pos.X() - stepX, pos.Y() - stepY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void cAnimation::Blink(void) {
|
||||
int freq = blinkable->BlinkFreq(blinkFunc);
|
||||
bool blinkOn = false;
|
||||
while (Running()) {
|
||||
Sleep(freq);
|
||||
if (Running()) {
|
||||
blinkable->DoBlink(blinkFunc, blinkOn);
|
||||
blinkable->Flush();
|
||||
}
|
||||
blinkOn = !blinkOn;
|
||||
}
|
||||
}
|
||||
#include "animation.h"
|
||||
#include <math.h>
|
||||
|
||||
/******************************************************************
|
||||
* cAnimation
|
||||
******************************************************************/
|
||||
cAnimation::cAnimation(cScrollable *scrollable) : cThread("scroller") {
|
||||
this->scrollable = scrollable;
|
||||
this->detachable = NULL;
|
||||
this->fadable = NULL;
|
||||
this->shiftable = NULL;
|
||||
this->blinkable = NULL;
|
||||
waitOnWakeup = false;
|
||||
doAnimation = true;
|
||||
modeIn = false;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
cAnimation::cAnimation(cDetachable *detachable, bool wait, bool animation) : cThread("detached") {
|
||||
this->scrollable = NULL;
|
||||
this->detachable = detachable;
|
||||
this->fadable = NULL;
|
||||
this->shiftable = NULL;
|
||||
this->blinkable = NULL;
|
||||
waitOnWakeup = wait;
|
||||
doAnimation = animation;
|
||||
modeIn = false;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
cAnimation::cAnimation(cFadable *fadable, bool fadein) : cThread("fadable") {
|
||||
this->scrollable = NULL;
|
||||
this->detachable = NULL;
|
||||
this->fadable = fadable;
|
||||
this->shiftable = NULL;
|
||||
this->blinkable = NULL;
|
||||
waitOnWakeup = false;
|
||||
doAnimation = true;
|
||||
modeIn = fadein;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
cAnimation::cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin) : cThread("shiftable") {
|
||||
this->scrollable = NULL;
|
||||
this->detachable = NULL;
|
||||
this->fadable = NULL;
|
||||
this->shiftable = shiftable;
|
||||
this->blinkable = NULL;
|
||||
waitOnWakeup = false;
|
||||
doAnimation = true;
|
||||
modeIn = shiftin;
|
||||
shiftstart = start;
|
||||
shiftend = end;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
cAnimation::cAnimation(cBlinkable *blinkable, int func) : cThread("blinking") {
|
||||
this->scrollable = NULL;
|
||||
this->detachable = NULL;
|
||||
this->fadable = NULL;
|
||||
this->shiftable = NULL;
|
||||
this->blinkable = blinkable;
|
||||
waitOnWakeup = false;
|
||||
doAnimation = true;
|
||||
modeIn = false;
|
||||
blinkFunc = func;
|
||||
}
|
||||
|
||||
cAnimation::~cAnimation(void) {
|
||||
sleepWait.Signal();
|
||||
Cancel(2);
|
||||
}
|
||||
|
||||
void cAnimation::WakeUp(void) {
|
||||
sleepWait.Signal();
|
||||
}
|
||||
|
||||
void cAnimation::Stop(bool deletePixmaps) {
|
||||
sleepWait.Signal();
|
||||
Cancel(2);
|
||||
if (scrollable && deletePixmaps)
|
||||
scrollable->StopScrolling();
|
||||
}
|
||||
|
||||
void cAnimation::Action(void) {
|
||||
if (scrollable) {
|
||||
Scroll();
|
||||
} else if (detachable) {
|
||||
Detach();
|
||||
} else if (fadable) {
|
||||
Fade();
|
||||
} else if (shiftable) {
|
||||
Shift();
|
||||
} else if (blinkable) {
|
||||
Blink();
|
||||
}
|
||||
}
|
||||
|
||||
void cAnimation::Sleep(int duration) {
|
||||
//sleep should wake up itself, so no infinit wait allowed
|
||||
if (duration <= 0)
|
||||
return;
|
||||
sleepWait.Wait(duration);
|
||||
}
|
||||
|
||||
void cAnimation::Wait(void) {
|
||||
//wait has to be waked up from outside
|
||||
sleepWait.Wait(0);
|
||||
}
|
||||
|
||||
void cAnimation::Scroll(void) {
|
||||
int delay = scrollable->ScrollDelay();
|
||||
Sleep(delay);
|
||||
if (!Running()) return;
|
||||
|
||||
eOrientation orientation = scrollable->ScrollOrientation();
|
||||
int scrollTotal = 0;
|
||||
if (orientation == eOrientation::horizontal) {
|
||||
scrollTotal = scrollable->ScrollWidth();
|
||||
} else if (orientation == eOrientation::vertical) {
|
||||
scrollTotal = scrollable->ScrollHeight();
|
||||
}
|
||||
|
||||
eScrollMode mode = scrollable->ScrollMode();
|
||||
bool carriageReturn = (mode == eScrollMode::carriagereturn) ? true : false;
|
||||
|
||||
eScrollSpeed speed = scrollable->ScrollSpeed();
|
||||
int frameTime = 30;
|
||||
if (speed == eScrollSpeed::slow)
|
||||
frameTime = 50;
|
||||
else if (speed == eScrollSpeed::medium)
|
||||
frameTime = 30;
|
||||
else if (speed == eScrollSpeed::fast)
|
||||
frameTime = 15;
|
||||
|
||||
if (!Running()) return;
|
||||
|
||||
scrollable->StartScrolling();
|
||||
|
||||
int drawPortX = 0;
|
||||
int drawPortY = 0;
|
||||
int scrollDelta = 1;
|
||||
|
||||
bool doSleep = false;
|
||||
while (Running()) {
|
||||
if (doSleep) {
|
||||
Sleep(delay);
|
||||
doSleep = false;
|
||||
}
|
||||
if (!Running()) return;
|
||||
uint64_t now = cTimeMs::Now();
|
||||
|
||||
cPoint drawPortPoint(0,0);
|
||||
if (orientation == eOrientation::horizontal) {
|
||||
|
||||
drawPortX -= scrollDelta;
|
||||
if (abs(drawPortX) > scrollTotal) {
|
||||
Sleep(delay);
|
||||
if (carriageReturn) {
|
||||
drawPortX = 0;
|
||||
doSleep = true;
|
||||
} else {
|
||||
scrollDelta *= -1;
|
||||
drawPortX -= scrollDelta;
|
||||
}
|
||||
}
|
||||
drawPortPoint.SetX(drawPortX);
|
||||
|
||||
} else if (orientation == eOrientation::vertical) {
|
||||
|
||||
drawPortY -= scrollDelta;
|
||||
if (abs(drawPortY) > scrollTotal) {
|
||||
Sleep(delay);
|
||||
drawPortY = 0;
|
||||
doSleep = true;
|
||||
}
|
||||
drawPortPoint.SetY(drawPortY);
|
||||
|
||||
}
|
||||
|
||||
if (!Running()) return;
|
||||
scrollable->SetDrawPort(drawPortPoint);
|
||||
|
||||
if (!Running()) return;
|
||||
scrollable->Flush();
|
||||
|
||||
if (orientation == eOrientation::horizontal && !carriageReturn && (drawPortX == 0)) {
|
||||
scrollDelta *= -1;
|
||||
doSleep = true;
|
||||
}
|
||||
|
||||
int delta = cTimeMs::Now() - now;
|
||||
if (delta < frameTime)
|
||||
Sleep(frameTime - delta);
|
||||
}
|
||||
}
|
||||
|
||||
void cAnimation::Detach(void) {
|
||||
if (waitOnWakeup) {
|
||||
Wait();
|
||||
int delay = 100 + detachable->Delay();
|
||||
Sleep(delay);
|
||||
} else {
|
||||
int delay = detachable->Delay();
|
||||
Sleep(delay);
|
||||
}
|
||||
if (!Running()) return;
|
||||
detachable->ParseDetached();
|
||||
if (!Running()) return;
|
||||
detachable->RenderDetached();
|
||||
if (!Running()) return;
|
||||
detachable->Flush();
|
||||
if (!Running()) return;
|
||||
if (doAnimation) {
|
||||
detachable->StartAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
void cAnimation::Fade(void) {
|
||||
int fadetime = fadable->FadeTime();
|
||||
int frametime = 1000 / FPS;
|
||||
int step = 100.0f / ((double)fadetime / (double)frametime);
|
||||
uint64_t start = cTimeMs::Now();
|
||||
int transparency = 0;
|
||||
if (modeIn) {
|
||||
transparency = 100 - step;
|
||||
} else {
|
||||
transparency = step;
|
||||
}
|
||||
//wait configured delay if not already done by detacher
|
||||
if (!fadable->Detached()) {
|
||||
int delay = fadable->Delay();
|
||||
if (delay > 0)
|
||||
Sleep(delay);
|
||||
}
|
||||
while (Running() || !modeIn) {
|
||||
uint64_t now = cTimeMs::Now();
|
||||
if (Running() || !modeIn)
|
||||
fadable->SetTransparency(transparency, !modeIn);
|
||||
if (Running() || !modeIn)
|
||||
fadable->Flush();
|
||||
int delta = cTimeMs::Now() - now;
|
||||
if ((Running() || !modeIn) && (delta < frametime)) {
|
||||
Sleep(frametime - delta);
|
||||
}
|
||||
if ((int)(now - start) > fadetime) {
|
||||
if ((Running() && modeIn) && transparency > 0) {
|
||||
fadable->SetTransparency(0);
|
||||
fadable->Flush();
|
||||
} else if (!modeIn && transparency < 100) {
|
||||
fadable->SetTransparency(100, true);
|
||||
fadable->Flush();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (modeIn) {
|
||||
transparency -= step;
|
||||
if (transparency < 0)
|
||||
transparency = 0;
|
||||
} else {
|
||||
transparency += step;
|
||||
if (transparency > 100)
|
||||
transparency = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cAnimation::Shift(void) {
|
||||
int shifttime = shiftable->ShiftTime();
|
||||
eShiftMode mode = (eShiftMode)shiftable->ShiftMode();
|
||||
//in shiftmode slowedDown shifting is done starting with slowratio % faster
|
||||
//at start. Then speed reduces linear to (100 - slowratio)% at end
|
||||
//for me 60 is a nice value :-)
|
||||
int slowRatio = 60;
|
||||
|
||||
int frametime = 1000 / FPS;
|
||||
int steps = (double)shifttime / (double)frametime;
|
||||
int stepXLinear = 0;
|
||||
int stepYLinear = 0;
|
||||
if (shiftstart.X() == shiftend.X()) {
|
||||
stepYLinear = (shiftend.Y() - shiftstart.Y()) / steps;
|
||||
} else if (shiftstart.Y() == shiftend.Y()) {
|
||||
stepXLinear = (shiftend.X() - shiftstart.X()) / steps;
|
||||
} else {
|
||||
stepXLinear = (shiftend.X() - shiftstart.X()) / steps;
|
||||
stepYLinear = (shiftend.Y() - shiftstart.Y()) / steps;
|
||||
}
|
||||
int stepX = stepXLinear;
|
||||
int stepY = stepYLinear;
|
||||
|
||||
cPoint pos;
|
||||
if (modeIn)
|
||||
pos = shiftstart;
|
||||
else
|
||||
pos = shiftend;
|
||||
|
||||
//wait configured delay if not already done by detacher
|
||||
if (!shiftable->Detached()) {
|
||||
int delay = shiftable->Delay();
|
||||
if (delay > 0)
|
||||
Sleep(delay);
|
||||
}
|
||||
uint64_t start = cTimeMs::Now();
|
||||
while (Running() || !modeIn) {
|
||||
uint64_t now = cTimeMs::Now();
|
||||
if (Running() || !modeIn)
|
||||
shiftable->SetPosition(pos, shiftend);
|
||||
if (Running() || !modeIn)
|
||||
shiftable->Flush();
|
||||
int delta = cTimeMs::Now() - now;
|
||||
if ((Running() || !modeIn) && (delta < frametime)) {
|
||||
cCondWait::SleepMs(frametime - delta);
|
||||
}
|
||||
if ((int)(now - start) > shifttime) {
|
||||
if ((Running() && modeIn) && pos != shiftend) {
|
||||
shiftable->SetPosition(shiftend, shiftend);
|
||||
shiftable->Flush();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (mode == eShiftMode::slowedDown) {
|
||||
double t = (double)(now - start) / (double)shifttime;
|
||||
double factor = 1.0f + (double)slowRatio / 100.0f - 2.0f * ((double)slowRatio / 100.0f) * t;
|
||||
stepX = stepXLinear * factor;
|
||||
stepY = stepYLinear * factor;
|
||||
}
|
||||
if (modeIn) {
|
||||
pos.Set(pos.X() + stepX, pos.Y() + stepY);
|
||||
} else {
|
||||
pos.Set(pos.X() - stepX, pos.Y() - stepY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void cAnimation::Blink(void) {
|
||||
int freq = blinkable->BlinkFreq(blinkFunc);
|
||||
bool blinkOn = false;
|
||||
while (Running()) {
|
||||
Sleep(freq);
|
||||
if (Running()) {
|
||||
blinkable->DoBlink(blinkFunc, blinkOn);
|
||||
blinkable->Flush();
|
||||
}
|
||||
blinkOn = !blinkOn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,126 +1,126 @@
|
||||
#ifndef __ANIMATION_H
|
||||
#define __ANIMATION_H
|
||||
|
||||
#include <vdr/skins.h>
|
||||
#include <vdr/thread.h>
|
||||
#include "definitions.h"
|
||||
|
||||
#define FPS 50
|
||||
|
||||
/******************************************************************
|
||||
* cScrollable
|
||||
******************************************************************/
|
||||
class cScrollable {
|
||||
protected:
|
||||
cScrollable(void) {};
|
||||
~cScrollable(void) {};
|
||||
public:
|
||||
virtual int ScrollDelay(void) = 0;
|
||||
virtual int ScrollWidth(void) = 0;
|
||||
virtual int ScrollHeight(void) = 0;
|
||||
virtual eScrollMode ScrollMode(void) = 0;
|
||||
virtual eScrollSpeed ScrollSpeed(void) = 0;
|
||||
virtual eOrientation ScrollOrientation(void) = 0;
|
||||
virtual void StartScrolling(void) = 0;
|
||||
virtual void StopScrolling(void) = 0;
|
||||
virtual void SetDrawPort(cPoint &point) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cDetachable
|
||||
******************************************************************/
|
||||
class cDetachable {
|
||||
protected:
|
||||
cDetachable(void) {};
|
||||
~cDetachable(void) {};
|
||||
public:
|
||||
virtual int Delay(void) = 0;
|
||||
virtual void ParseDetached(void) = 0;
|
||||
virtual void RenderDetached(void) = 0;
|
||||
virtual void StartAnimation(void) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cFadable
|
||||
******************************************************************/
|
||||
class cFadable {
|
||||
protected:
|
||||
cFadable(void) {};
|
||||
~cFadable(void) {};
|
||||
public:
|
||||
virtual bool Detached(void) = 0;
|
||||
virtual int Delay(void) = 0;
|
||||
virtual int FadeTime(void) = 0;
|
||||
virtual void SetTransparency(int transparency, bool force = false) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cShiftable
|
||||
******************************************************************/
|
||||
class cShiftable {
|
||||
protected:
|
||||
cShiftable(void) {};
|
||||
~cShiftable(void) {};
|
||||
public:
|
||||
virtual bool Detached(void) = 0;
|
||||
virtual int Delay(void) = 0;
|
||||
virtual int ShiftTime(void) = 0;
|
||||
virtual int ShiftMode(void) = 0;
|
||||
virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cBlinkable
|
||||
******************************************************************/
|
||||
class cBlinkable {
|
||||
protected:
|
||||
cBlinkable(void) {};
|
||||
~cBlinkable(void) {};
|
||||
public:
|
||||
virtual int BlinkFreq(int func) = 0;
|
||||
virtual void DoBlink(int func, bool on) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cAnimation
|
||||
******************************************************************/
|
||||
class cAnimation : public cThread, public cListObject {
|
||||
private:
|
||||
cCondWait sleepWait;
|
||||
cScrollable *scrollable;
|
||||
cDetachable *detachable;
|
||||
cFadable *fadable;
|
||||
cShiftable *shiftable;
|
||||
cBlinkable *blinkable;
|
||||
bool waitOnWakeup;
|
||||
bool doAnimation;
|
||||
bool modeIn;
|
||||
int blinkFunc;
|
||||
cPoint shiftstart;
|
||||
cPoint shiftend;
|
||||
void Sleep(int duration);
|
||||
void Wait(void);
|
||||
void Scroll(void);
|
||||
void Detach(void);
|
||||
void Blink(void);
|
||||
protected:
|
||||
virtual void Action(void);
|
||||
public:
|
||||
cAnimation(cScrollable *scrollable);
|
||||
cAnimation(cDetachable *detachable, bool wait, bool animation);
|
||||
cAnimation(cFadable *fadable, bool fadein);
|
||||
cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin);
|
||||
cAnimation(cBlinkable *blinkable, int func);
|
||||
~cAnimation(void);
|
||||
void WakeUp(void);
|
||||
void Fade(void);
|
||||
void Shift(void);
|
||||
void Stop(bool deletePixmaps);
|
||||
};
|
||||
|
||||
#ifndef __ANIMATION_H
|
||||
#define __ANIMATION_H
|
||||
|
||||
#include <vdr/skins.h>
|
||||
#include <vdr/thread.h>
|
||||
#include "definitions.h"
|
||||
|
||||
#define FPS 50
|
||||
|
||||
/******************************************************************
|
||||
* cScrollable
|
||||
******************************************************************/
|
||||
class cScrollable {
|
||||
protected:
|
||||
cScrollable(void) {};
|
||||
~cScrollable(void) {};
|
||||
public:
|
||||
virtual int ScrollDelay(void) = 0;
|
||||
virtual int ScrollWidth(void) = 0;
|
||||
virtual int ScrollHeight(void) = 0;
|
||||
virtual eScrollMode ScrollMode(void) = 0;
|
||||
virtual eScrollSpeed ScrollSpeed(void) = 0;
|
||||
virtual eOrientation ScrollOrientation(void) = 0;
|
||||
virtual void StartScrolling(void) = 0;
|
||||
virtual void StopScrolling(void) = 0;
|
||||
virtual void SetDrawPort(cPoint &point) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cDetachable
|
||||
******************************************************************/
|
||||
class cDetachable {
|
||||
protected:
|
||||
cDetachable(void) {};
|
||||
~cDetachable(void) {};
|
||||
public:
|
||||
virtual int Delay(void) = 0;
|
||||
virtual void ParseDetached(void) = 0;
|
||||
virtual void RenderDetached(void) = 0;
|
||||
virtual void StartAnimation(void) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cFadable
|
||||
******************************************************************/
|
||||
class cFadable {
|
||||
protected:
|
||||
cFadable(void) {};
|
||||
~cFadable(void) {};
|
||||
public:
|
||||
virtual bool Detached(void) = 0;
|
||||
virtual int Delay(void) = 0;
|
||||
virtual int FadeTime(void) = 0;
|
||||
virtual void SetTransparency(int transparency, bool force = false) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cShiftable
|
||||
******************************************************************/
|
||||
class cShiftable {
|
||||
protected:
|
||||
cShiftable(void) {};
|
||||
~cShiftable(void) {};
|
||||
public:
|
||||
virtual bool Detached(void) = 0;
|
||||
virtual int Delay(void) = 0;
|
||||
virtual int ShiftTime(void) = 0;
|
||||
virtual int ShiftMode(void) = 0;
|
||||
virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cBlinkable
|
||||
******************************************************************/
|
||||
class cBlinkable {
|
||||
protected:
|
||||
cBlinkable(void) {};
|
||||
~cBlinkable(void) {};
|
||||
public:
|
||||
virtual int BlinkFreq(int func) = 0;
|
||||
virtual void DoBlink(int func, bool on) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cAnimation
|
||||
******************************************************************/
|
||||
class cAnimation : public cThread, public cListObject {
|
||||
private:
|
||||
cCondWait sleepWait;
|
||||
cScrollable *scrollable;
|
||||
cDetachable *detachable;
|
||||
cFadable *fadable;
|
||||
cShiftable *shiftable;
|
||||
cBlinkable *blinkable;
|
||||
bool waitOnWakeup;
|
||||
bool doAnimation;
|
||||
bool modeIn;
|
||||
int blinkFunc;
|
||||
cPoint shiftstart;
|
||||
cPoint shiftend;
|
||||
void Sleep(int duration);
|
||||
void Wait(void);
|
||||
void Scroll(void);
|
||||
void Detach(void);
|
||||
void Blink(void);
|
||||
protected:
|
||||
virtual void Action(void);
|
||||
public:
|
||||
cAnimation(cScrollable *scrollable);
|
||||
cAnimation(cDetachable *detachable, bool wait, bool animation);
|
||||
cAnimation(cFadable *fadable, bool fadein);
|
||||
cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin);
|
||||
cAnimation(cBlinkable *blinkable, int func);
|
||||
~cAnimation(void);
|
||||
void WakeUp(void);
|
||||
void Fade(void);
|
||||
void Shift(void);
|
||||
void Stop(bool deletePixmaps);
|
||||
};
|
||||
|
||||
#endif //__ANIMATION_H
|
||||
1534
coreengine/area.c
1534
coreengine/area.c
File diff suppressed because it is too large
Load Diff
@@ -1,178 +1,178 @@
|
||||
#ifndef __TEMPLATEAREA_H
|
||||
#define __TEMPLATEAREA_H
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "osdwrapper.h"
|
||||
#include "definitions.h"
|
||||
#include "globals.h"
|
||||
#include "../libskindesignerapi/tokencontainer.h"
|
||||
#include "attributes.h"
|
||||
#include "functions.h"
|
||||
#include "animation.h"
|
||||
|
||||
class cArea;
|
||||
/******************************************************************
|
||||
* cAreaNode
|
||||
******************************************************************/
|
||||
class cAreaNode : public cListObject {
|
||||
protected:
|
||||
cGlobals *globals;
|
||||
cRect container;
|
||||
bool isTab;
|
||||
bool activeTab;
|
||||
public:
|
||||
cAreaNode(void);
|
||||
virtual ~cAreaNode(void);
|
||||
virtual void SetGlobals(cGlobals *globals) {};
|
||||
virtual void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {};
|
||||
virtual void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer) {};
|
||||
void SetContainer(int x, int y, int width, int height);
|
||||
virtual void SetAttributes(vector<stringpair> &attributes) {};
|
||||
virtual void SetX(int x) {};
|
||||
virtual void SetY(int y) {};
|
||||
virtual void SetWidth(int width) {};
|
||||
virtual void SetHeight(int height) {};
|
||||
void SetTab(void) { isTab = true; };
|
||||
bool IsTab(void) { return isTab; };
|
||||
void SetActiveTab(bool active) { activeTab = active; };
|
||||
bool ActiveTab(void) { return activeTab; };
|
||||
virtual int GetWidth(void) { return 0; };
|
||||
virtual void Cache(void) {};
|
||||
virtual void Close(void) {};
|
||||
virtual void Clear(void) {};
|
||||
virtual void Hide(void) {};
|
||||
virtual void Show(void) {};
|
||||
virtual void Render(void) {};
|
||||
virtual bool Execute(void) { return true; };
|
||||
virtual void SetTransparency(int transparency, bool absolute = false) {};
|
||||
virtual void SetViewPort(cRect &vp) {};
|
||||
virtual void SetPosition(cPoint &pos, cPoint &ref) {};
|
||||
virtual cRect CoveringArea(void) { return cRect::Null; };
|
||||
virtual bool Scrolling(void) { return false; };
|
||||
virtual cArea *ScrollingArea(void) { return NULL; };
|
||||
virtual cFunction *GetFunction(const char *name) { return NULL; };
|
||||
virtual const char *Name(void) { return NULL; };
|
||||
virtual bool BackgroundArea(void) { return false; };
|
||||
virtual void Debug(bool full = false) {};
|
||||
};
|
||||
|
||||
class cAreaContainer;
|
||||
/******************************************************************
|
||||
* cArea
|
||||
******************************************************************/
|
||||
class cArea : public cAreaNode, public cScrollable, public cBlinkable {
|
||||
private:
|
||||
cSdOsd *sdOsd;
|
||||
bool init;
|
||||
bool isBackgroundArea;
|
||||
cPixmap *pix;
|
||||
cAreaAttribs *attribs;
|
||||
cAreaContainer *areaContainer;
|
||||
cList<cFunction> functions;
|
||||
bool scrolling;
|
||||
bool isScrolling;
|
||||
cFunction *scrollFunc;
|
||||
cList<cAnimation> blinkers;
|
||||
bool blinking;
|
||||
void InitFunctions(void);
|
||||
void CreatePixmap(cRect drawPort = cRect::Null);
|
||||
void SetScrollFunc(void);
|
||||
void StartBlinkers(void);
|
||||
void StopBlinkers(void);
|
||||
public:
|
||||
cArea(void);
|
||||
cArea(const cArea &other);
|
||||
virtual ~cArea(void);
|
||||
void SetOsd(cSdOsd *osd) { sdOsd = osd; };
|
||||
void SetGlobals(cGlobals *globals);
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void SetAttributes(vector<stringpair> &attributes);
|
||||
void SetScrolling(void) { scrolling = true; };
|
||||
void SetAreaContainer(cAreaContainer *ac) { areaContainer = ac; };
|
||||
bool ValidFunction(const char *func);
|
||||
cFunction *AddFunction(const char *name, vector<stringpair> attribs, cFuncLoop *loopFunc = NULL);
|
||||
cFunction *GetFunction(const char *name);
|
||||
void SetX(int x);
|
||||
void SetY(int y);
|
||||
void SetWidth(int width);
|
||||
void SetHeight(int height);
|
||||
void Cache(void);
|
||||
int GetWidth(void) { return attribs->Width(); };
|
||||
void Close(void);
|
||||
void Clear(void);
|
||||
void Hide(void);
|
||||
void Show(void);
|
||||
void Render(void);
|
||||
bool Execute(void);
|
||||
void SetTransparency(int transparency, bool absolute = false);
|
||||
cRect CoveringArea(void);
|
||||
//Scrollable
|
||||
bool Scrolling(void);
|
||||
int ScrollWidth(void);
|
||||
int ScrollHeight(void);
|
||||
int ScrollDelay(void);
|
||||
eScrollMode ScrollMode(void);
|
||||
eScrollSpeed ScrollSpeed(void);
|
||||
eOrientation ScrollOrientation(void);
|
||||
cArea *ScrollingArea(void) { return this; };
|
||||
void StartScrolling(void);
|
||||
void StopScrolling(void);
|
||||
cRect ViewPort(void);
|
||||
void SetDrawPort(cPoint &point);
|
||||
void SetViewPort(cRect &vp);
|
||||
void SetPosition(cPoint &pos, cPoint &ref);
|
||||
cRect DrawPort(void);
|
||||
int ScrollStep(void) { return attribs->ScrollStep(); };
|
||||
//Blinkable
|
||||
int BlinkFreq(int func);
|
||||
void DoBlink(int func, bool on);
|
||||
//Common
|
||||
const char *Name(void) { return attribs->Name(); };
|
||||
bool BackgroundArea(void) { return attribs->BackgroundArea(); };
|
||||
void Flush(void);
|
||||
void Debug(bool full = false);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cAreaContainer
|
||||
******************************************************************/
|
||||
class cAreaContainer : public cAreaNode {
|
||||
private:
|
||||
cAreaContainerAttribs *attribs;
|
||||
cList<cArea> areas;
|
||||
public:
|
||||
cAreaContainer(void);
|
||||
cAreaContainer(const cAreaContainer &other);
|
||||
virtual ~cAreaContainer(void);
|
||||
void SetGlobals(cGlobals *globals);
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void SetAttributes(vector<stringpair> &attributes);
|
||||
void AddArea(cArea *area);
|
||||
cFunction *GetFunction(const char *name);
|
||||
void SetX(int x);
|
||||
void SetY(int y);
|
||||
void SetWidth(int width);
|
||||
void SetHeight(int height);
|
||||
void Cache(void);
|
||||
void Close(void);
|
||||
void Clear(void);
|
||||
void Hide(void);
|
||||
void Show(void);
|
||||
void Render(void);
|
||||
bool Execute(void);
|
||||
void SetTransparency(int transparency, bool absolute = false);
|
||||
void SetViewPort(cRect &vp);
|
||||
void SetPosition(cPoint &pos, cPoint &ref);
|
||||
cRect CoveringArea(void);
|
||||
bool Scrolling(void);
|
||||
cArea *ScrollingArea(void);
|
||||
void Debug(bool full = false);
|
||||
};
|
||||
|
||||
#ifndef __TEMPLATEAREA_H
|
||||
#define __TEMPLATEAREA_H
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "osdwrapper.h"
|
||||
#include "definitions.h"
|
||||
#include "globals.h"
|
||||
#include "../libskindesignerapi/tokencontainer.h"
|
||||
#include "attributes.h"
|
||||
#include "functions.h"
|
||||
#include "animation.h"
|
||||
|
||||
class cArea;
|
||||
/******************************************************************
|
||||
* cAreaNode
|
||||
******************************************************************/
|
||||
class cAreaNode : public cListObject {
|
||||
protected:
|
||||
cGlobals *globals;
|
||||
cRect container;
|
||||
bool isTab;
|
||||
bool activeTab;
|
||||
public:
|
||||
cAreaNode(void);
|
||||
virtual ~cAreaNode(void);
|
||||
virtual void SetGlobals(cGlobals *globals) {};
|
||||
virtual void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {};
|
||||
virtual void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer) {};
|
||||
void SetContainer(int x, int y, int width, int height);
|
||||
virtual void SetAttributes(vector<stringpair> &attributes) {};
|
||||
virtual void SetX(int x) {};
|
||||
virtual void SetY(int y) {};
|
||||
virtual void SetWidth(int width) {};
|
||||
virtual void SetHeight(int height) {};
|
||||
void SetTab(void) { isTab = true; };
|
||||
bool IsTab(void) { return isTab; };
|
||||
void SetActiveTab(bool active) { activeTab = active; };
|
||||
bool ActiveTab(void) { return activeTab; };
|
||||
virtual int GetWidth(void) { return 0; };
|
||||
virtual void Cache(void) {};
|
||||
virtual void Close(void) {};
|
||||
virtual void Clear(void) {};
|
||||
virtual void Hide(void) {};
|
||||
virtual void Show(void) {};
|
||||
virtual void Render(void) {};
|
||||
virtual bool Execute(void) { return true; };
|
||||
virtual void SetTransparency(int transparency, bool absolute = false) {};
|
||||
virtual void SetViewPort(cRect &vp) {};
|
||||
virtual void SetPosition(cPoint &pos, cPoint &ref) {};
|
||||
virtual cRect CoveringArea(void) { return cRect::Null; };
|
||||
virtual bool Scrolling(void) { return false; };
|
||||
virtual cArea *ScrollingArea(void) { return NULL; };
|
||||
virtual cFunction *GetFunction(const char *name) { return NULL; };
|
||||
virtual const char *Name(void) { return NULL; };
|
||||
virtual bool BackgroundArea(void) { return false; };
|
||||
virtual void Debug(bool full = false) {};
|
||||
};
|
||||
|
||||
class cAreaContainer;
|
||||
/******************************************************************
|
||||
* cArea
|
||||
******************************************************************/
|
||||
class cArea : public cAreaNode, public cScrollable, public cBlinkable {
|
||||
private:
|
||||
cSdOsd *sdOsd;
|
||||
bool init;
|
||||
bool isBackgroundArea;
|
||||
cPixmap *pix;
|
||||
cAreaAttribs *attribs;
|
||||
cAreaContainer *areaContainer;
|
||||
cList<cFunction> functions;
|
||||
bool scrolling;
|
||||
bool isScrolling;
|
||||
cFunction *scrollFunc;
|
||||
cList<cAnimation> blinkers;
|
||||
bool blinking;
|
||||
void InitFunctions(void);
|
||||
void CreatePixmap(cRect drawPort = cRect::Null);
|
||||
void SetScrollFunc(void);
|
||||
void StartBlinkers(void);
|
||||
void StopBlinkers(void);
|
||||
public:
|
||||
cArea(void);
|
||||
cArea(const cArea &other);
|
||||
virtual ~cArea(void);
|
||||
void SetOsd(cSdOsd *osd) { sdOsd = osd; };
|
||||
void SetGlobals(cGlobals *globals);
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void SetAttributes(vector<stringpair> &attributes);
|
||||
void SetScrolling(void) { scrolling = true; };
|
||||
void SetAreaContainer(cAreaContainer *ac) { areaContainer = ac; };
|
||||
bool ValidFunction(const char *func);
|
||||
cFunction *AddFunction(const char *name, vector<stringpair> attribs, cFuncLoop *loopFunc = NULL);
|
||||
cFunction *GetFunction(const char *name);
|
||||
void SetX(int x);
|
||||
void SetY(int y);
|
||||
void SetWidth(int width);
|
||||
void SetHeight(int height);
|
||||
void Cache(void);
|
||||
int GetWidth(void) { return attribs->Width(); };
|
||||
void Close(void);
|
||||
void Clear(void);
|
||||
void Hide(void);
|
||||
void Show(void);
|
||||
void Render(void);
|
||||
bool Execute(void);
|
||||
void SetTransparency(int transparency, bool absolute = false);
|
||||
cRect CoveringArea(void);
|
||||
//Scrollable
|
||||
bool Scrolling(void);
|
||||
int ScrollWidth(void);
|
||||
int ScrollHeight(void);
|
||||
int ScrollDelay(void);
|
||||
eScrollMode ScrollMode(void);
|
||||
eScrollSpeed ScrollSpeed(void);
|
||||
eOrientation ScrollOrientation(void);
|
||||
cArea *ScrollingArea(void) { return this; };
|
||||
void StartScrolling(void);
|
||||
void StopScrolling(void);
|
||||
cRect ViewPort(void);
|
||||
void SetDrawPort(cPoint &point);
|
||||
void SetViewPort(cRect &vp);
|
||||
void SetPosition(cPoint &pos, cPoint &ref);
|
||||
cRect DrawPort(void);
|
||||
int ScrollStep(void) { return attribs->ScrollStep(); };
|
||||
//Blinkable
|
||||
int BlinkFreq(int func);
|
||||
void DoBlink(int func, bool on);
|
||||
//Common
|
||||
const char *Name(void) { return attribs->Name(); };
|
||||
bool BackgroundArea(void) { return attribs->BackgroundArea(); };
|
||||
void Flush(void);
|
||||
void Debug(bool full = false);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cAreaContainer
|
||||
******************************************************************/
|
||||
class cAreaContainer : public cAreaNode {
|
||||
private:
|
||||
cAreaContainerAttribs *attribs;
|
||||
cList<cArea> areas;
|
||||
public:
|
||||
cAreaContainer(void);
|
||||
cAreaContainer(const cAreaContainer &other);
|
||||
virtual ~cAreaContainer(void);
|
||||
void SetGlobals(cGlobals *globals);
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void SetAttributes(vector<stringpair> &attributes);
|
||||
void AddArea(cArea *area);
|
||||
cFunction *GetFunction(const char *name);
|
||||
void SetX(int x);
|
||||
void SetY(int y);
|
||||
void SetWidth(int width);
|
||||
void SetHeight(int height);
|
||||
void Cache(void);
|
||||
void Close(void);
|
||||
void Clear(void);
|
||||
void Hide(void);
|
||||
void Show(void);
|
||||
void Render(void);
|
||||
bool Execute(void);
|
||||
void SetTransparency(int transparency, bool absolute = false);
|
||||
void SetViewPort(cRect &vp);
|
||||
void SetPosition(cPoint &pos, cPoint &ref);
|
||||
cRect CoveringArea(void);
|
||||
bool Scrolling(void);
|
||||
cArea *ScrollingArea(void);
|
||||
void Debug(bool full = false);
|
||||
};
|
||||
|
||||
#endif //__TEMPLATEAREA_H
|
||||
@@ -1,478 +1,478 @@
|
||||
#include "attribute.h"
|
||||
#include "../config.h"
|
||||
|
||||
/***************************************************************************
|
||||
* cAttributes
|
||||
***************************************************************************/
|
||||
cAttributes::cAttributes(int numAttributes) {
|
||||
globals = NULL;
|
||||
tokenContainer = NULL;
|
||||
numAttribs = (int)eCommonAttribs::count + numAttributes;
|
||||
attribs = new int[numAttribs];
|
||||
for (int i=0; i < numAttribs; i++)
|
||||
attribs[i] = ATTR_UNKNOWN;
|
||||
attribCtors = new cNumericExpr*[numAttribs];
|
||||
for (int i=0; i < numAttribs; i++)
|
||||
attribCtors[i] = NULL;
|
||||
cond = NULL;
|
||||
SetCommonAttributesDefs();
|
||||
}
|
||||
|
||||
cAttributes::cAttributes(const cAttributes &other) : cAttributes(other.numAttribs - (int)eCommonAttribs::count){
|
||||
globals = other.globals;
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
attribs[i] = other.attribs[i];
|
||||
if (other.attribCtors[i]) {
|
||||
attribCtors[i] = new cNumericExpr(*other.attribCtors[i]);
|
||||
attribCtors[i]->SetContainer(&container);
|
||||
}
|
||||
}
|
||||
cond = NULL;
|
||||
if (other.cond) {
|
||||
cond = new cCondition(*other.cond);
|
||||
}
|
||||
attribIDs = other.attribIDs;
|
||||
attribNames = other.attribNames;
|
||||
}
|
||||
|
||||
cAttributes::~cAttributes(void) {
|
||||
delete[] attribs;
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
delete attribCtors[i];
|
||||
}
|
||||
delete[] attribCtors;
|
||||
delete cond;
|
||||
}
|
||||
|
||||
void cAttributes::SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {
|
||||
this->tokenContainer = tokenContainer;
|
||||
}
|
||||
|
||||
void cAttributes::SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer) {
|
||||
this->tokenContainer = tokenContainer;
|
||||
if (cond) {
|
||||
cond->SetTokenContainer(tokenContainer);
|
||||
}
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (!attribCtors[i])
|
||||
continue;
|
||||
attribCtors[i]->SetTokenContainer(tokenContainer);
|
||||
}
|
||||
}
|
||||
|
||||
void cAttributes::SetContainer(int x, int y, int width, int height) {
|
||||
container.SetX(x);
|
||||
container.SetY(y);
|
||||
container.SetWidth(width);
|
||||
container.SetHeight(height);
|
||||
}
|
||||
|
||||
void cAttributes::SetX(int x) {
|
||||
attribs[(int)eCommonAttribs::x] = x;
|
||||
}
|
||||
|
||||
void cAttributes::SetY(int y) {
|
||||
attribs[(int)eCommonAttribs::y] = y;
|
||||
}
|
||||
|
||||
void cAttributes::SetWidth(int width) {
|
||||
attribs[(int)eCommonAttribs::width] = width;
|
||||
}
|
||||
|
||||
void cAttributes::SetHeight(int height) {
|
||||
attribs[(int)eCommonAttribs::height] = height;
|
||||
}
|
||||
|
||||
void cAttributes::Cache(void) {
|
||||
if (cond) {
|
||||
cond->SetGlobals(globals);
|
||||
cond->SetTokenContainer(tokenContainer);
|
||||
cond->Prepare();
|
||||
}
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (!attribCtors[i])
|
||||
continue;
|
||||
attribCtors[i]->SetContainer(&container);
|
||||
attribCtors[i]->SetGlobals(globals);
|
||||
attribCtors[i]->SetTokenContainer(tokenContainer);
|
||||
if (attribCtors[i]->CacheStatic()) {
|
||||
int val = attribCtors[i]->GetValue();
|
||||
attribs[i] = val;
|
||||
delete attribCtors[i];
|
||||
attribCtors[i] = NULL;
|
||||
} else {
|
||||
attribCtors[i]->PrepareTokens();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cAttributes::GetValue(int id) {
|
||||
if (!attribCtors[id + (int)eCommonAttribs::count])
|
||||
return attribs[(int)id + (int)eCommonAttribs::count];
|
||||
return attribCtors[id + (int)eCommonAttribs::count]->Calculate();
|
||||
}
|
||||
|
||||
|
||||
int cAttributes::X(void) {
|
||||
int x = 0;
|
||||
if (!attribCtors[(int)eCommonAttribs::x])
|
||||
x = attribs[(int)eCommonAttribs::x];
|
||||
else
|
||||
x = attribCtors[(int)eCommonAttribs::x]->Calculate();
|
||||
x += container.X();
|
||||
return x;
|
||||
}
|
||||
|
||||
int cAttributes::Y(void) {
|
||||
int y = 0;
|
||||
if (!attribCtors[(int)eCommonAttribs::y])
|
||||
y = attribs[(int)eCommonAttribs::y];
|
||||
else
|
||||
y = attribCtors[(int)eCommonAttribs::y]->Calculate();
|
||||
y += container.Y();
|
||||
return y;
|
||||
}
|
||||
|
||||
int cAttributes::Width(void) {
|
||||
if (!attribCtors[(int)eCommonAttribs::width])
|
||||
return attribs[(int)eCommonAttribs::width];
|
||||
return attribCtors[(int)eCommonAttribs::width]->Calculate();
|
||||
}
|
||||
|
||||
int cAttributes::Height(void) {
|
||||
if (!attribCtors[(int)eCommonAttribs::height])
|
||||
return attribs[(int)eCommonAttribs::height];
|
||||
return attribCtors[(int)eCommonAttribs::height]->Calculate();
|
||||
}
|
||||
|
||||
bool cAttributes::DoExecute(void) {
|
||||
if (!cond)
|
||||
return true;
|
||||
return cond->True();
|
||||
}
|
||||
|
||||
|
||||
void cAttributes::Debug(void) {
|
||||
esyslog("skindesigner: container %d %d %dx%d", container.X(), container.Y(), container.Width(), container.Height());
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (attribs[i] != ATTR_UNKNOWN) {
|
||||
if (i == (int)eCommonAttribs::debug)
|
||||
continue;
|
||||
const char *attName = "attribute";
|
||||
if (i < (int)eCommonAttribs::count)
|
||||
attName = CommonAttributeName(i);
|
||||
else
|
||||
attName = AttributeName(i - (int)eCommonAttribs::count);
|
||||
dsyslog("skindesigner: fixed Value %s = %d", attName, attribs[i]);
|
||||
}
|
||||
if (attribCtors[i]) {
|
||||
const char *attName = "attribute";
|
||||
if (i < (int)eCommonAttribs::count)
|
||||
attName = CommonAttributeName(i);
|
||||
else
|
||||
attName = AttributeName(i - (int)eCommonAttribs::count);
|
||||
dsyslog("skindesigner: %s constructor:", attName);
|
||||
attribCtors[i]->Debug();
|
||||
}
|
||||
}
|
||||
if (cond) {
|
||||
cond->Debug();
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Protected Functions
|
||||
***************************************************************************/
|
||||
int cAttributes::CommonAttributeId(const char *att) {
|
||||
if (!strcmp(att, "condition"))
|
||||
return ATTR_COND;
|
||||
map<string, int>::iterator hit = commonAttribIDs.find(att);
|
||||
if (hit != commonAttribIDs.end())
|
||||
return hit->second;
|
||||
return ATTR_UNKNOWN;
|
||||
}
|
||||
|
||||
const char *cAttributes::CommonAttributeName(int id) {
|
||||
if (id < 0 || id >= (int)eCommonAttribs::count)
|
||||
return "";
|
||||
map<int, string>::iterator hit = commonAttribNames.find(id);
|
||||
if (hit != commonAttribNames.end())
|
||||
return hit->second.c_str();
|
||||
return "";
|
||||
}
|
||||
|
||||
int cAttributes::AttributeId(const char *att) {
|
||||
int id = CommonAttributeId(att);
|
||||
if (id != ATTR_UNKNOWN)
|
||||
return id;
|
||||
map<string, int>::iterator hit = attribIDs.find(att);
|
||||
if (hit != attribIDs.end())
|
||||
id = (int)hit->second + (int)eCommonAttribs::count;
|
||||
return id;
|
||||
}
|
||||
|
||||
const char *cAttributes::AttributeName(int id) {
|
||||
map<int, string>::iterator hit = attribNames.find(id);
|
||||
if (hit != attribNames.end())
|
||||
return hit->second.c_str();
|
||||
return "";
|
||||
}
|
||||
|
||||
bool cAttributes::SetCommon(int id, const char *val) {
|
||||
if (id == ATTR_COND) {
|
||||
cond = new cCondition(val);
|
||||
return true;
|
||||
}
|
||||
if (id == (int)eCommonAttribs::debug) {
|
||||
SetBool(id, val);
|
||||
return true;
|
||||
} else if (id == (int)eCommonAttribs::x || id == (int)eCommonAttribs::width) {
|
||||
attribCtors[id] = new cNumericExpr(val);
|
||||
return true;
|
||||
} else if (id == (int)eCommonAttribs::y || id == (int)eCommonAttribs::height) {
|
||||
attribCtors[id] = new cNumericExpr(val);
|
||||
attribCtors[id]->SetVertical();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cAttributes::IdEqual(int id, int compId) {
|
||||
if (compId + (int)eCommonAttribs::count == id)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void cAttributes::SetBool(int id, const char *val) {
|
||||
if (!strcmp(val, "true")) {
|
||||
attribs[id] = 1;
|
||||
} else {
|
||||
attribs[id] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void cAttributes::SetViewElementMode(int id, const char *val) {
|
||||
eViewElementMode mode = eViewElementMode::regular;
|
||||
if (!strcmp(val, "light"))
|
||||
mode = eViewElementMode::light;
|
||||
attribs[id] = (int)mode;
|
||||
}
|
||||
|
||||
void cAttributes::SetShiftType(int id, const char *val) {
|
||||
eShiftType shiftType = eShiftType::none;
|
||||
if (!strcmp(val, "left"))
|
||||
shiftType = eShiftType::left;
|
||||
else if (!strcmp(val, "right"))
|
||||
shiftType = eShiftType::right;
|
||||
else if (!strcmp(val, "top"))
|
||||
shiftType = eShiftType::top;
|
||||
else if (!strcmp(val, "bottom"))
|
||||
shiftType = eShiftType::bottom;
|
||||
else {
|
||||
esyslog("skindesigner: unknown shift type \"%s\"", val);
|
||||
return;
|
||||
}
|
||||
attribs[id] = (int)shiftType;
|
||||
}
|
||||
|
||||
void cAttributes::SetShiftMode(int id, const char *val) {
|
||||
eShiftMode shiftMode = eShiftMode::linear;
|
||||
if (!strcmp(val, "slowed"))
|
||||
shiftMode = eShiftMode::slowedDown;
|
||||
attribs[id] = (int)shiftMode;
|
||||
}
|
||||
|
||||
void cAttributes::SetScrollMode(int id, const char *val) {
|
||||
eScrollMode mode = eScrollMode::none;
|
||||
if (!strcmp(val, "forthandback"))
|
||||
mode = eScrollMode::forthandback;
|
||||
else if (!strcmp(val, "carriagereturn"))
|
||||
mode = eScrollMode::carriagereturn;
|
||||
attribs[id] = (int)mode;
|
||||
}
|
||||
|
||||
void cAttributes::SetScrollSpeed(int id, const char *val) {
|
||||
eScrollSpeed speed = eScrollSpeed::medium;
|
||||
if (!strcmp(val, "slow"))
|
||||
speed = eScrollSpeed::slow;
|
||||
else if (!strcmp(val, "fast"))
|
||||
speed = eScrollSpeed::fast;
|
||||
else if (!strcmp(val, "medium"))
|
||||
speed = eScrollSpeed::medium;
|
||||
attribs[id] = (int)speed;
|
||||
}
|
||||
|
||||
void cAttributes::SetOrientation(int id, const char *val) {
|
||||
eOrientation orientation = eOrientation::none;
|
||||
if (!strcmp(val, "horizontal"))
|
||||
orientation = eOrientation::horizontal;
|
||||
else if (!strcmp(val, "vertical"))
|
||||
orientation = eOrientation::vertical;
|
||||
else if (!strcmp(val, "absolute"))
|
||||
orientation = eOrientation::absolute;
|
||||
attribs[id] = (int)orientation;
|
||||
}
|
||||
|
||||
void cAttributes::SetAlign(int id, const char *val) {
|
||||
eAlign align = eAlign::left;
|
||||
if (!strcmp(val, "center")) {
|
||||
align = eAlign::center;
|
||||
} else if (!strcmp(val, "right")) {
|
||||
align = eAlign::right;
|
||||
} else if (!strcmp(val, "top")) {
|
||||
align = eAlign::top;
|
||||
} else if (!strcmp(val, "bottom")) {
|
||||
align = eAlign::bottom;
|
||||
} else if (!strcmp(val, "left")) {
|
||||
align = eAlign::left;
|
||||
}
|
||||
attribs[id] = (int)align;
|
||||
}
|
||||
|
||||
void cAttributes::SetDirection(int id, const char *val) {
|
||||
eDirection direction = eDirection::none;
|
||||
if (!strcmp(val, "bottomup"))
|
||||
direction = eDirection::bottomup;
|
||||
else if (!strcmp(val, "topdown"))
|
||||
direction = eDirection::topdown;
|
||||
attribs[id] = (int)direction;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Private Functions
|
||||
***************************************************************************/
|
||||
void cAttributes::SetCommonAttributesDefs(void) {
|
||||
commonAttribIDs.insert(pair<string, int>("x", (int)eCommonAttribs::x));
|
||||
commonAttribIDs.insert(pair<string, int>("y", (int)eCommonAttribs::y));
|
||||
commonAttribIDs.insert(pair<string, int>("width", (int)eCommonAttribs::width));
|
||||
commonAttribIDs.insert(pair<string, int>("height", (int)eCommonAttribs::height));
|
||||
commonAttribIDs.insert(pair<string, int>("debug", (int)eCommonAttribs::debug));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::x, "x"));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::y, "y"));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::width, "width"));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::height, "height"));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::debug, "debug"));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cFunction
|
||||
***************************************************************************/
|
||||
cFunction::cFunction(cArea *owner, int numAttributes) : cAttributes(numAttributes) {
|
||||
funcType = "Unknown";
|
||||
owningArea = owner;
|
||||
color = NULL;
|
||||
name = NULL;
|
||||
scrolling = false;
|
||||
}
|
||||
|
||||
cFunction::cFunction(const cFunction &other) : cAttributes(other) {
|
||||
funcType = other.funcType;
|
||||
owningArea = NULL;
|
||||
color = NULL;
|
||||
if (other.color)
|
||||
color = new cColor(*other.color);
|
||||
name = NULL;
|
||||
if (other.name)
|
||||
name = strdup(other.name);
|
||||
scrolling = other.scrolling;
|
||||
}
|
||||
|
||||
cFunction::~cFunction(void) {
|
||||
delete color;
|
||||
free(name);
|
||||
}
|
||||
|
||||
void cFunction::SetLoopInfo(cLoopInfo *loopInfo) {
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (!attribCtors[i])
|
||||
continue;
|
||||
attribCtors[i]->SetLoopInfo(loopInfo);
|
||||
}
|
||||
if (cond)
|
||||
cond->SetLoopInfo(loopInfo);
|
||||
}
|
||||
|
||||
void cFunction::Cache(void) {
|
||||
if (color) {
|
||||
color->SetGlobals(globals);
|
||||
color->Cache();
|
||||
}
|
||||
cAttributes::Cache();
|
||||
}
|
||||
|
||||
void cFunction::CacheFuncReferences(void) {
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (!attribCtors[i])
|
||||
continue;
|
||||
vector<cFactor*> refFactors = attribCtors[i]->GetRefFactors();
|
||||
for (vector<cFactor*>::iterator it = refFactors.begin(); it != refFactors.end(); it++) {
|
||||
cFactor *f = *it;
|
||||
if (!f->funcRefName)
|
||||
continue;
|
||||
cFunction *fRef = owningArea->GetFunction(f->funcRefName);
|
||||
if (fRef) {
|
||||
f->funcRef = fRef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cFunction::GetX(eAlign align, int x0, int colWidth) {
|
||||
int containerWidth = colWidth > 0 ? colWidth : container.Width();
|
||||
int x = x0 + X();
|
||||
if (align == eAlign::right) {
|
||||
x = x0 + containerWidth - FuncWidth();
|
||||
} else if (align == eAlign::center) {
|
||||
x = x0 + (containerWidth - FuncWidth()) / 2;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int cFunction::GetY(eAlign valign, int y0, int rowHeight) {
|
||||
int containerHeight = rowHeight > 0 ? rowHeight : container.Height();
|
||||
int y = y0 + Y();
|
||||
if (valign == eAlign::bottom) {
|
||||
y = y0 + containerHeight - FuncHeight();
|
||||
} else if (valign == eAlign::center) {
|
||||
y = y0 + (containerHeight - FuncHeight()) / 2;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
void cFunction::Debug(void) {
|
||||
esyslog("skindesigner: ---> Function %s", funcType);
|
||||
cAttributes::Debug();
|
||||
if (name) {
|
||||
esyslog("skindesigner: name %s", name);
|
||||
}
|
||||
if (color) {
|
||||
color->Debug();
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Protected Functions
|
||||
***************************************************************************/
|
||||
|
||||
void cFunction::SetColor(const char *val) {
|
||||
color = new cColor(val);
|
||||
}
|
||||
|
||||
void cFunction::SetAnimType(int id, const char *val) {
|
||||
eAnimType animType = eAnimType::none;
|
||||
if (!strcmp(val, "blink"))
|
||||
animType = eAnimType::blink;
|
||||
else if (!strcmp(val, "animated"))
|
||||
animType = eAnimType::animated;
|
||||
attribs[id] = (int)animType;
|
||||
}
|
||||
|
||||
void cFunction::SetOverflow(int id, const char *val) {
|
||||
eOverflowType overflowType = eOverflowType::none;
|
||||
if (!strcmp(val, "linewrap"))
|
||||
overflowType = eOverflowType::wrap;
|
||||
else if (!strcmp(val, "cut"))
|
||||
overflowType = eOverflowType::cut;
|
||||
attribs[id] = (int)overflowType;
|
||||
}
|
||||
#include "attribute.h"
|
||||
#include "../config.h"
|
||||
|
||||
/***************************************************************************
|
||||
* cAttributes
|
||||
***************************************************************************/
|
||||
cAttributes::cAttributes(int numAttributes) {
|
||||
globals = NULL;
|
||||
tokenContainer = NULL;
|
||||
numAttribs = (int)eCommonAttribs::count + numAttributes;
|
||||
attribs = new int[numAttribs];
|
||||
for (int i=0; i < numAttribs; i++)
|
||||
attribs[i] = ATTR_UNKNOWN;
|
||||
attribCtors = new cNumericExpr*[numAttribs];
|
||||
for (int i=0; i < numAttribs; i++)
|
||||
attribCtors[i] = NULL;
|
||||
cond = NULL;
|
||||
SetCommonAttributesDefs();
|
||||
}
|
||||
|
||||
cAttributes::cAttributes(const cAttributes &other) : cAttributes(other.numAttribs - (int)eCommonAttribs::count){
|
||||
globals = other.globals;
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
attribs[i] = other.attribs[i];
|
||||
if (other.attribCtors[i]) {
|
||||
attribCtors[i] = new cNumericExpr(*other.attribCtors[i]);
|
||||
attribCtors[i]->SetContainer(&container);
|
||||
}
|
||||
}
|
||||
cond = NULL;
|
||||
if (other.cond) {
|
||||
cond = new cCondition(*other.cond);
|
||||
}
|
||||
attribIDs = other.attribIDs;
|
||||
attribNames = other.attribNames;
|
||||
}
|
||||
|
||||
cAttributes::~cAttributes(void) {
|
||||
delete[] attribs;
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
delete attribCtors[i];
|
||||
}
|
||||
delete[] attribCtors;
|
||||
delete cond;
|
||||
}
|
||||
|
||||
void cAttributes::SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {
|
||||
this->tokenContainer = tokenContainer;
|
||||
}
|
||||
|
||||
void cAttributes::SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer) {
|
||||
this->tokenContainer = tokenContainer;
|
||||
if (cond) {
|
||||
cond->SetTokenContainer(tokenContainer);
|
||||
}
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (!attribCtors[i])
|
||||
continue;
|
||||
attribCtors[i]->SetTokenContainer(tokenContainer);
|
||||
}
|
||||
}
|
||||
|
||||
void cAttributes::SetContainer(int x, int y, int width, int height) {
|
||||
container.SetX(x);
|
||||
container.SetY(y);
|
||||
container.SetWidth(width);
|
||||
container.SetHeight(height);
|
||||
}
|
||||
|
||||
void cAttributes::SetX(int x) {
|
||||
attribs[(int)eCommonAttribs::x] = x;
|
||||
}
|
||||
|
||||
void cAttributes::SetY(int y) {
|
||||
attribs[(int)eCommonAttribs::y] = y;
|
||||
}
|
||||
|
||||
void cAttributes::SetWidth(int width) {
|
||||
attribs[(int)eCommonAttribs::width] = width;
|
||||
}
|
||||
|
||||
void cAttributes::SetHeight(int height) {
|
||||
attribs[(int)eCommonAttribs::height] = height;
|
||||
}
|
||||
|
||||
void cAttributes::Cache(void) {
|
||||
if (cond) {
|
||||
cond->SetGlobals(globals);
|
||||
cond->SetTokenContainer(tokenContainer);
|
||||
cond->Prepare();
|
||||
}
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (!attribCtors[i])
|
||||
continue;
|
||||
attribCtors[i]->SetContainer(&container);
|
||||
attribCtors[i]->SetGlobals(globals);
|
||||
attribCtors[i]->SetTokenContainer(tokenContainer);
|
||||
if (attribCtors[i]->CacheStatic()) {
|
||||
int val = attribCtors[i]->GetValue();
|
||||
attribs[i] = val;
|
||||
delete attribCtors[i];
|
||||
attribCtors[i] = NULL;
|
||||
} else {
|
||||
attribCtors[i]->PrepareTokens();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cAttributes::GetValue(int id) {
|
||||
if (!attribCtors[id + (int)eCommonAttribs::count])
|
||||
return attribs[(int)id + (int)eCommonAttribs::count];
|
||||
return attribCtors[id + (int)eCommonAttribs::count]->Calculate();
|
||||
}
|
||||
|
||||
|
||||
int cAttributes::X(void) {
|
||||
int x = 0;
|
||||
if (!attribCtors[(int)eCommonAttribs::x])
|
||||
x = attribs[(int)eCommonAttribs::x];
|
||||
else
|
||||
x = attribCtors[(int)eCommonAttribs::x]->Calculate();
|
||||
x += container.X();
|
||||
return x;
|
||||
}
|
||||
|
||||
int cAttributes::Y(void) {
|
||||
int y = 0;
|
||||
if (!attribCtors[(int)eCommonAttribs::y])
|
||||
y = attribs[(int)eCommonAttribs::y];
|
||||
else
|
||||
y = attribCtors[(int)eCommonAttribs::y]->Calculate();
|
||||
y += container.Y();
|
||||
return y;
|
||||
}
|
||||
|
||||
int cAttributes::Width(void) {
|
||||
if (!attribCtors[(int)eCommonAttribs::width])
|
||||
return attribs[(int)eCommonAttribs::width];
|
||||
return attribCtors[(int)eCommonAttribs::width]->Calculate();
|
||||
}
|
||||
|
||||
int cAttributes::Height(void) {
|
||||
if (!attribCtors[(int)eCommonAttribs::height])
|
||||
return attribs[(int)eCommonAttribs::height];
|
||||
return attribCtors[(int)eCommonAttribs::height]->Calculate();
|
||||
}
|
||||
|
||||
bool cAttributes::DoExecute(void) {
|
||||
if (!cond)
|
||||
return true;
|
||||
return cond->True();
|
||||
}
|
||||
|
||||
|
||||
void cAttributes::Debug(void) {
|
||||
esyslog("skindesigner: container %d %d %dx%d", container.X(), container.Y(), container.Width(), container.Height());
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (attribs[i] != ATTR_UNKNOWN) {
|
||||
if (i == (int)eCommonAttribs::debug)
|
||||
continue;
|
||||
const char *attName = "attribute";
|
||||
if (i < (int)eCommonAttribs::count)
|
||||
attName = CommonAttributeName(i);
|
||||
else
|
||||
attName = AttributeName(i - (int)eCommonAttribs::count);
|
||||
dsyslog("skindesigner: fixed Value %s = %d", attName, attribs[i]);
|
||||
}
|
||||
if (attribCtors[i]) {
|
||||
const char *attName = "attribute";
|
||||
if (i < (int)eCommonAttribs::count)
|
||||
attName = CommonAttributeName(i);
|
||||
else
|
||||
attName = AttributeName(i - (int)eCommonAttribs::count);
|
||||
dsyslog("skindesigner: %s constructor:", attName);
|
||||
attribCtors[i]->Debug();
|
||||
}
|
||||
}
|
||||
if (cond) {
|
||||
cond->Debug();
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Protected Functions
|
||||
***************************************************************************/
|
||||
int cAttributes::CommonAttributeId(const char *att) {
|
||||
if (!strcmp(att, "condition"))
|
||||
return ATTR_COND;
|
||||
map<string, int>::iterator hit = commonAttribIDs.find(att);
|
||||
if (hit != commonAttribIDs.end())
|
||||
return hit->second;
|
||||
return ATTR_UNKNOWN;
|
||||
}
|
||||
|
||||
const char *cAttributes::CommonAttributeName(int id) {
|
||||
if (id < 0 || id >= (int)eCommonAttribs::count)
|
||||
return "";
|
||||
map<int, string>::iterator hit = commonAttribNames.find(id);
|
||||
if (hit != commonAttribNames.end())
|
||||
return hit->second.c_str();
|
||||
return "";
|
||||
}
|
||||
|
||||
int cAttributes::AttributeId(const char *att) {
|
||||
int id = CommonAttributeId(att);
|
||||
if (id != ATTR_UNKNOWN)
|
||||
return id;
|
||||
map<string, int>::iterator hit = attribIDs.find(att);
|
||||
if (hit != attribIDs.end())
|
||||
id = (int)hit->second + (int)eCommonAttribs::count;
|
||||
return id;
|
||||
}
|
||||
|
||||
const char *cAttributes::AttributeName(int id) {
|
||||
map<int, string>::iterator hit = attribNames.find(id);
|
||||
if (hit != attribNames.end())
|
||||
return hit->second.c_str();
|
||||
return "";
|
||||
}
|
||||
|
||||
bool cAttributes::SetCommon(int id, const char *val) {
|
||||
if (id == ATTR_COND) {
|
||||
cond = new cCondition(val);
|
||||
return true;
|
||||
}
|
||||
if (id == (int)eCommonAttribs::debug) {
|
||||
SetBool(id, val);
|
||||
return true;
|
||||
} else if (id == (int)eCommonAttribs::x || id == (int)eCommonAttribs::width) {
|
||||
attribCtors[id] = new cNumericExpr(val);
|
||||
return true;
|
||||
} else if (id == (int)eCommonAttribs::y || id == (int)eCommonAttribs::height) {
|
||||
attribCtors[id] = new cNumericExpr(val);
|
||||
attribCtors[id]->SetVertical();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cAttributes::IdEqual(int id, int compId) {
|
||||
if (compId + (int)eCommonAttribs::count == id)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void cAttributes::SetBool(int id, const char *val) {
|
||||
if (!strcmp(val, "true")) {
|
||||
attribs[id] = 1;
|
||||
} else {
|
||||
attribs[id] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void cAttributes::SetViewElementMode(int id, const char *val) {
|
||||
eViewElementMode mode = eViewElementMode::regular;
|
||||
if (!strcmp(val, "light"))
|
||||
mode = eViewElementMode::light;
|
||||
attribs[id] = (int)mode;
|
||||
}
|
||||
|
||||
void cAttributes::SetShiftType(int id, const char *val) {
|
||||
eShiftType shiftType = eShiftType::none;
|
||||
if (!strcmp(val, "left"))
|
||||
shiftType = eShiftType::left;
|
||||
else if (!strcmp(val, "right"))
|
||||
shiftType = eShiftType::right;
|
||||
else if (!strcmp(val, "top"))
|
||||
shiftType = eShiftType::top;
|
||||
else if (!strcmp(val, "bottom"))
|
||||
shiftType = eShiftType::bottom;
|
||||
else {
|
||||
esyslog("skindesigner: unknown shift type \"%s\"", val);
|
||||
return;
|
||||
}
|
||||
attribs[id] = (int)shiftType;
|
||||
}
|
||||
|
||||
void cAttributes::SetShiftMode(int id, const char *val) {
|
||||
eShiftMode shiftMode = eShiftMode::linear;
|
||||
if (!strcmp(val, "slowed"))
|
||||
shiftMode = eShiftMode::slowedDown;
|
||||
attribs[id] = (int)shiftMode;
|
||||
}
|
||||
|
||||
void cAttributes::SetScrollMode(int id, const char *val) {
|
||||
eScrollMode mode = eScrollMode::none;
|
||||
if (!strcmp(val, "forthandback"))
|
||||
mode = eScrollMode::forthandback;
|
||||
else if (!strcmp(val, "carriagereturn"))
|
||||
mode = eScrollMode::carriagereturn;
|
||||
attribs[id] = (int)mode;
|
||||
}
|
||||
|
||||
void cAttributes::SetScrollSpeed(int id, const char *val) {
|
||||
eScrollSpeed speed = eScrollSpeed::medium;
|
||||
if (!strcmp(val, "slow"))
|
||||
speed = eScrollSpeed::slow;
|
||||
else if (!strcmp(val, "fast"))
|
||||
speed = eScrollSpeed::fast;
|
||||
else if (!strcmp(val, "medium"))
|
||||
speed = eScrollSpeed::medium;
|
||||
attribs[id] = (int)speed;
|
||||
}
|
||||
|
||||
void cAttributes::SetOrientation(int id, const char *val) {
|
||||
eOrientation orientation = eOrientation::none;
|
||||
if (!strcmp(val, "horizontal"))
|
||||
orientation = eOrientation::horizontal;
|
||||
else if (!strcmp(val, "vertical"))
|
||||
orientation = eOrientation::vertical;
|
||||
else if (!strcmp(val, "absolute"))
|
||||
orientation = eOrientation::absolute;
|
||||
attribs[id] = (int)orientation;
|
||||
}
|
||||
|
||||
void cAttributes::SetAlign(int id, const char *val) {
|
||||
eAlign align = eAlign::left;
|
||||
if (!strcmp(val, "center")) {
|
||||
align = eAlign::center;
|
||||
} else if (!strcmp(val, "right")) {
|
||||
align = eAlign::right;
|
||||
} else if (!strcmp(val, "top")) {
|
||||
align = eAlign::top;
|
||||
} else if (!strcmp(val, "bottom")) {
|
||||
align = eAlign::bottom;
|
||||
} else if (!strcmp(val, "left")) {
|
||||
align = eAlign::left;
|
||||
}
|
||||
attribs[id] = (int)align;
|
||||
}
|
||||
|
||||
void cAttributes::SetDirection(int id, const char *val) {
|
||||
eDirection direction = eDirection::none;
|
||||
if (!strcmp(val, "bottomup"))
|
||||
direction = eDirection::bottomup;
|
||||
else if (!strcmp(val, "topdown"))
|
||||
direction = eDirection::topdown;
|
||||
attribs[id] = (int)direction;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Private Functions
|
||||
***************************************************************************/
|
||||
void cAttributes::SetCommonAttributesDefs(void) {
|
||||
commonAttribIDs.insert(pair<string, int>("x", (int)eCommonAttribs::x));
|
||||
commonAttribIDs.insert(pair<string, int>("y", (int)eCommonAttribs::y));
|
||||
commonAttribIDs.insert(pair<string, int>("width", (int)eCommonAttribs::width));
|
||||
commonAttribIDs.insert(pair<string, int>("height", (int)eCommonAttribs::height));
|
||||
commonAttribIDs.insert(pair<string, int>("debug", (int)eCommonAttribs::debug));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::x, "x"));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::y, "y"));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::width, "width"));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::height, "height"));
|
||||
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::debug, "debug"));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cFunction
|
||||
***************************************************************************/
|
||||
cFunction::cFunction(cArea *owner, int numAttributes) : cAttributes(numAttributes) {
|
||||
funcType = "Unknown";
|
||||
owningArea = owner;
|
||||
color = NULL;
|
||||
name = NULL;
|
||||
scrolling = false;
|
||||
}
|
||||
|
||||
cFunction::cFunction(const cFunction &other) : cAttributes(other) {
|
||||
funcType = other.funcType;
|
||||
owningArea = NULL;
|
||||
color = NULL;
|
||||
if (other.color)
|
||||
color = new cColor(*other.color);
|
||||
name = NULL;
|
||||
if (other.name)
|
||||
name = strdup(other.name);
|
||||
scrolling = other.scrolling;
|
||||
}
|
||||
|
||||
cFunction::~cFunction(void) {
|
||||
delete color;
|
||||
free(name);
|
||||
}
|
||||
|
||||
void cFunction::SetLoopInfo(cLoopInfo *loopInfo) {
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (!attribCtors[i])
|
||||
continue;
|
||||
attribCtors[i]->SetLoopInfo(loopInfo);
|
||||
}
|
||||
if (cond)
|
||||
cond->SetLoopInfo(loopInfo);
|
||||
}
|
||||
|
||||
void cFunction::Cache(void) {
|
||||
if (color) {
|
||||
color->SetGlobals(globals);
|
||||
color->Cache();
|
||||
}
|
||||
cAttributes::Cache();
|
||||
}
|
||||
|
||||
void cFunction::CacheFuncReferences(void) {
|
||||
for (int i=0; i < numAttribs; i++) {
|
||||
if (!attribCtors[i])
|
||||
continue;
|
||||
vector<cFactor*> refFactors = attribCtors[i]->GetRefFactors();
|
||||
for (vector<cFactor*>::iterator it = refFactors.begin(); it != refFactors.end(); it++) {
|
||||
cFactor *f = *it;
|
||||
if (!f->funcRefName)
|
||||
continue;
|
||||
cFunction *fRef = owningArea->GetFunction(f->funcRefName);
|
||||
if (fRef) {
|
||||
f->funcRef = fRef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cFunction::GetX(eAlign align, int x0, int colWidth) {
|
||||
int containerWidth = colWidth > 0 ? colWidth : container.Width();
|
||||
int x = x0 + X();
|
||||
if (align == eAlign::right) {
|
||||
x = x0 + containerWidth - FuncWidth();
|
||||
} else if (align == eAlign::center) {
|
||||
x = x0 + (containerWidth - FuncWidth()) / 2;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int cFunction::GetY(eAlign valign, int y0, int rowHeight) {
|
||||
int containerHeight = rowHeight > 0 ? rowHeight : container.Height();
|
||||
int y = y0 + Y();
|
||||
if (valign == eAlign::bottom) {
|
||||
y = y0 + containerHeight - FuncHeight();
|
||||
} else if (valign == eAlign::center) {
|
||||
y = y0 + (containerHeight - FuncHeight()) / 2;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
void cFunction::Debug(void) {
|
||||
esyslog("skindesigner: ---> Function %s", funcType);
|
||||
cAttributes::Debug();
|
||||
if (name) {
|
||||
esyslog("skindesigner: name %s", name);
|
||||
}
|
||||
if (color) {
|
||||
color->Debug();
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Protected Functions
|
||||
***************************************************************************/
|
||||
|
||||
void cFunction::SetColor(const char *val) {
|
||||
color = new cColor(val);
|
||||
}
|
||||
|
||||
void cFunction::SetAnimType(int id, const char *val) {
|
||||
eAnimType animType = eAnimType::none;
|
||||
if (!strcmp(val, "blink"))
|
||||
animType = eAnimType::blink;
|
||||
else if (!strcmp(val, "animated"))
|
||||
animType = eAnimType::animated;
|
||||
attribs[id] = (int)animType;
|
||||
}
|
||||
|
||||
void cFunction::SetOverflow(int id, const char *val) {
|
||||
eOverflowType overflowType = eOverflowType::none;
|
||||
if (!strcmp(val, "linewrap"))
|
||||
overflowType = eOverflowType::wrap;
|
||||
else if (!strcmp(val, "cut"))
|
||||
overflowType = eOverflowType::cut;
|
||||
attribs[id] = (int)overflowType;
|
||||
}
|
||||
|
||||
@@ -1,126 +1,126 @@
|
||||
#ifndef __ATTRIBUTE_H
|
||||
#define __ATTRIBUTE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <vdr/skins.h>
|
||||
#include "globals.h"
|
||||
#include "../libskindesignerapi/tokencontainer.h"
|
||||
#include "definitions.h"
|
||||
#include "complextypes.h"
|
||||
|
||||
class cArea;
|
||||
/******************************************************************
|
||||
* cAttributes
|
||||
******************************************************************/
|
||||
class cAttributes {
|
||||
private:
|
||||
map<string, int> commonAttribIDs;
|
||||
map<int, string> commonAttribNames;
|
||||
void SetCommonAttributesDefs(void);
|
||||
protected:
|
||||
cGlobals *globals;
|
||||
skindesignerapi::cTokenContainer *tokenContainer;
|
||||
cRect container;
|
||||
int numAttribs;
|
||||
int *attribs;
|
||||
cNumericExpr **attribCtors;
|
||||
cCondition *cond;
|
||||
map<string, int> attribIDs;
|
||||
map<int, string> attribNames;
|
||||
int CommonAttributeId(const char *att);
|
||||
const char *CommonAttributeName(int id);
|
||||
int AttributeId(const char *att);
|
||||
const char *AttributeName(int id);
|
||||
bool SetCommon(int id, const char *val);
|
||||
virtual bool IdEqual(int id, int compId);
|
||||
void SetBool(int id, const char *val);
|
||||
void SetViewElementMode(int id, const char *val);
|
||||
void SetShiftType(int id, const char *val);
|
||||
void SetShiftMode(int id, const char *val);
|
||||
void SetScrollMode(int id, const char *val);
|
||||
void SetScrollSpeed(int id, const char *val);
|
||||
void SetOrientation(int id, const char *val);
|
||||
void SetDirection(int id, const char *val);
|
||||
void SetAlign(int id, const char *val);
|
||||
public:
|
||||
cAttributes(int numAttributes);
|
||||
cAttributes(const cAttributes &other);
|
||||
virtual ~cAttributes(void);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
virtual void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
virtual void SetContainer(int x, int y, int width, int height);
|
||||
virtual void Set(vector<stringpair> &attributes) {};
|
||||
void SetX(int width);
|
||||
void SetY(int height);
|
||||
void SetWidth(int width);
|
||||
void SetHeight(int height);
|
||||
virtual void Cache(void);
|
||||
int GetValue(int id);
|
||||
int X(void);
|
||||
int Y(void);
|
||||
int Width(void);
|
||||
int Height(void);
|
||||
int DoDebug(void) { return attribs[(int)eCommonAttribs::debug] == 1 ? true : false; };
|
||||
bool DoExecute(void);
|
||||
virtual void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cLoopInfo
|
||||
******************************************************************/
|
||||
class cLoopInfo {
|
||||
public:
|
||||
int colWidth;
|
||||
int rowHeight;
|
||||
int index;
|
||||
int row;
|
||||
cLoopInfo(void) {
|
||||
colWidth = 0;
|
||||
rowHeight = 0;
|
||||
index = 0;
|
||||
row = 0;
|
||||
};
|
||||
};
|
||||
/******************************************************************
|
||||
* cFunction
|
||||
******************************************************************/
|
||||
class cFunction : public cAttributes, public cListObject {
|
||||
private:
|
||||
cArea *owningArea;
|
||||
protected:
|
||||
const char *funcType;
|
||||
cColor *color;
|
||||
char *name;
|
||||
bool scrolling;
|
||||
void SetColor(const char *val);
|
||||
void SetAnimType(int id, const char *val);
|
||||
void SetOverflow(int id, const char *val);
|
||||
public:
|
||||
cFunction(cArea *owner, int numAttributes);
|
||||
cFunction(const cFunction &other);
|
||||
virtual ~cFunction(void);
|
||||
virtual void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetOwner(cArea *owner) { owningArea = owner; };
|
||||
const char *Name(void) { return name; };
|
||||
virtual void Cache(void);
|
||||
void CacheFuncReferences(void);
|
||||
void Scrolling(bool scrolling) { this->scrolling = scrolling; };
|
||||
virtual void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0) {};
|
||||
virtual int FuncX(void) { return X(); };
|
||||
virtual int FuncY(void) { return Y(); };
|
||||
virtual int FuncWidth(void) { return Width(); };
|
||||
virtual int FuncHeight(void) { return Height(); };
|
||||
virtual int Align(void) { return (int)eAlign::left; };
|
||||
virtual int Valign(void) { return (int)eAlign::top; };
|
||||
int GetX(eAlign align, int x0, int colWidth);
|
||||
int GetY(eAlign valign, int y0, int rowHeight);
|
||||
virtual bool Blinking(void) { return false; };
|
||||
virtual int BlinkFreq(void) { return -1; };
|
||||
virtual void Debug(void);
|
||||
};
|
||||
|
||||
#ifndef __ATTRIBUTE_H
|
||||
#define __ATTRIBUTE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <vdr/skins.h>
|
||||
#include "globals.h"
|
||||
#include "../libskindesignerapi/tokencontainer.h"
|
||||
#include "definitions.h"
|
||||
#include "complextypes.h"
|
||||
|
||||
class cArea;
|
||||
/******************************************************************
|
||||
* cAttributes
|
||||
******************************************************************/
|
||||
class cAttributes {
|
||||
private:
|
||||
map<string, int> commonAttribIDs;
|
||||
map<int, string> commonAttribNames;
|
||||
void SetCommonAttributesDefs(void);
|
||||
protected:
|
||||
cGlobals *globals;
|
||||
skindesignerapi::cTokenContainer *tokenContainer;
|
||||
cRect container;
|
||||
int numAttribs;
|
||||
int *attribs;
|
||||
cNumericExpr **attribCtors;
|
||||
cCondition *cond;
|
||||
map<string, int> attribIDs;
|
||||
map<int, string> attribNames;
|
||||
int CommonAttributeId(const char *att);
|
||||
const char *CommonAttributeName(int id);
|
||||
int AttributeId(const char *att);
|
||||
const char *AttributeName(int id);
|
||||
bool SetCommon(int id, const char *val);
|
||||
virtual bool IdEqual(int id, int compId);
|
||||
void SetBool(int id, const char *val);
|
||||
void SetViewElementMode(int id, const char *val);
|
||||
void SetShiftType(int id, const char *val);
|
||||
void SetShiftMode(int id, const char *val);
|
||||
void SetScrollMode(int id, const char *val);
|
||||
void SetScrollSpeed(int id, const char *val);
|
||||
void SetOrientation(int id, const char *val);
|
||||
void SetDirection(int id, const char *val);
|
||||
void SetAlign(int id, const char *val);
|
||||
public:
|
||||
cAttributes(int numAttributes);
|
||||
cAttributes(const cAttributes &other);
|
||||
virtual ~cAttributes(void);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
virtual void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
virtual void SetContainer(int x, int y, int width, int height);
|
||||
virtual void Set(vector<stringpair> &attributes) {};
|
||||
void SetX(int width);
|
||||
void SetY(int height);
|
||||
void SetWidth(int width);
|
||||
void SetHeight(int height);
|
||||
virtual void Cache(void);
|
||||
int GetValue(int id);
|
||||
int X(void);
|
||||
int Y(void);
|
||||
int Width(void);
|
||||
int Height(void);
|
||||
int DoDebug(void) { return attribs[(int)eCommonAttribs::debug] == 1 ? true : false; };
|
||||
bool DoExecute(void);
|
||||
virtual void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cLoopInfo
|
||||
******************************************************************/
|
||||
class cLoopInfo {
|
||||
public:
|
||||
int colWidth;
|
||||
int rowHeight;
|
||||
int index;
|
||||
int row;
|
||||
cLoopInfo(void) {
|
||||
colWidth = 0;
|
||||
rowHeight = 0;
|
||||
index = 0;
|
||||
row = 0;
|
||||
};
|
||||
};
|
||||
/******************************************************************
|
||||
* cFunction
|
||||
******************************************************************/
|
||||
class cFunction : public cAttributes, public cListObject {
|
||||
private:
|
||||
cArea *owningArea;
|
||||
protected:
|
||||
const char *funcType;
|
||||
cColor *color;
|
||||
char *name;
|
||||
bool scrolling;
|
||||
void SetColor(const char *val);
|
||||
void SetAnimType(int id, const char *val);
|
||||
void SetOverflow(int id, const char *val);
|
||||
public:
|
||||
cFunction(cArea *owner, int numAttributes);
|
||||
cFunction(const cFunction &other);
|
||||
virtual ~cFunction(void);
|
||||
virtual void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetOwner(cArea *owner) { owningArea = owner; };
|
||||
const char *Name(void) { return name; };
|
||||
virtual void Cache(void);
|
||||
void CacheFuncReferences(void);
|
||||
void Scrolling(bool scrolling) { this->scrolling = scrolling; };
|
||||
virtual void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0) {};
|
||||
virtual int FuncX(void) { return X(); };
|
||||
virtual int FuncY(void) { return Y(); };
|
||||
virtual int FuncWidth(void) { return Width(); };
|
||||
virtual int FuncHeight(void) { return Height(); };
|
||||
virtual int Align(void) { return (int)eAlign::left; };
|
||||
virtual int Valign(void) { return (int)eAlign::top; };
|
||||
int GetX(eAlign align, int x0, int colWidth);
|
||||
int GetY(eAlign valign, int y0, int rowHeight);
|
||||
virtual bool Blinking(void) { return false; };
|
||||
virtual int BlinkFreq(void) { return -1; };
|
||||
virtual void Debug(void);
|
||||
};
|
||||
|
||||
#endif //__ATTRIBUTE_H
|
||||
@@ -1,447 +1,447 @@
|
||||
#include "attributes.h"
|
||||
#include "../config.h"
|
||||
|
||||
/***************************************************************************
|
||||
* cViewAttribs
|
||||
***************************************************************************/
|
||||
cViewAttribs::cViewAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
orientation = NULL;
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cViewAttribs::~cViewAttribs(void) {
|
||||
delete orientation;
|
||||
}
|
||||
|
||||
void cViewAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown view attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
if (IdEqual(id, (int)eViewAttribs::shifttype)) {
|
||||
SetShiftType(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewAttribs::shiftmode)) {
|
||||
SetShiftMode(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewAttribs::orientation)) {
|
||||
SetOrientationDynamic(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewAttribs::hideroot)) {
|
||||
SetBool(id, attVal);
|
||||
} else {
|
||||
attribCtors[id] = new cNumericExpr(attVal);
|
||||
if ( (id == (int)eViewAttribs::starty + (int)eCommonAttribs::count) ||
|
||||
(id == (int)eViewAttribs::scaletvy + (int)eCommonAttribs::count) ||
|
||||
(id == (int)eViewAttribs::scaletvheight + (int)eCommonAttribs::count) ) {
|
||||
attribCtors[id]->SetVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cViewAttribs::SetAttributesDefs(void) {
|
||||
attribIDs.insert(pair<string, int>("fadetime", (int)eViewAttribs::fadetime));
|
||||
attribIDs.insert(pair<string, int>("shifttime", (int)eViewAttribs::shifttime));
|
||||
attribIDs.insert(pair<string, int>("shifttype", (int)eViewAttribs::shifttype));
|
||||
attribIDs.insert(pair<string, int>("shiftmode", (int)eViewAttribs::shiftmode));
|
||||
attribIDs.insert(pair<string, int>("startx", (int)eViewAttribs::startx));
|
||||
attribIDs.insert(pair<string, int>("starty", (int)eViewAttribs::starty));
|
||||
attribIDs.insert(pair<string, int>("scaletvx", (int)eViewAttribs::scaletvx));
|
||||
attribIDs.insert(pair<string, int>("scaletvy", (int)eViewAttribs::scaletvy));
|
||||
attribIDs.insert(pair<string, int>("scaletvwidth", (int)eViewAttribs::scaletvwidth));
|
||||
attribIDs.insert(pair<string, int>("scaletvheight", (int)eViewAttribs::scaletvheight));
|
||||
attribIDs.insert(pair<string, int>("orientation", (int)eViewAttribs::orientation));
|
||||
attribIDs.insert(pair<string, int>("debuggrid", (int)eViewAttribs::debuggrid));
|
||||
attribIDs.insert(pair<string, int>("hideroot", (int)eViewAttribs::hideroot));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::fadetime, "fadetime"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::shifttime, "shifttime"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::shifttype, "shifttype"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::shiftmode, "shiftmode"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::startx, "startx"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::starty, "starty"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvx, "scaletvx"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvy, "scaletvy"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvwidth, "scaletvwidth"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvheight, "scaletvheight"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::orientation, "orientation"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::debuggrid, "debuggrid"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::hideroot, "hideroot"));
|
||||
}
|
||||
|
||||
void cViewAttribs::Cache(void) {
|
||||
tokenContainer = new skindesignerapi::cTokenContainer();
|
||||
cAttributes::Cache();
|
||||
if (orientation) {
|
||||
orientation->SetGlobals(globals);
|
||||
orientation->SetTokenContainer(tokenContainer);
|
||||
orientation->Cache();
|
||||
char *res = orientation->DeterminateText();
|
||||
if (res) {
|
||||
SetOrientation((int)eViewAttribs::orientation + (int)eCommonAttribs::count, res);
|
||||
}
|
||||
free(res);
|
||||
}
|
||||
}
|
||||
|
||||
void cViewAttribs::Debug(void) {
|
||||
esyslog("skindesigner: --> View Attribs");
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
eOrientation cViewAttribs::Orientation(void) {
|
||||
int orientation = GetValue((int)eViewAttribs::orientation);
|
||||
if (orientation == -1)
|
||||
return eOrientation::vertical;
|
||||
if (orientation == (int)eOrientation::none)
|
||||
return eOrientation::vertical;
|
||||
return (eOrientation)orientation;
|
||||
}
|
||||
|
||||
cRect cViewAttribs::TvFrame(void) {
|
||||
int frameX = GetValue((int)eViewAttribs::scaletvx);
|
||||
int frameY = GetValue((int)eViewAttribs::scaletvy);
|
||||
int frameWidth = GetValue((int)eViewAttribs::scaletvwidth);
|
||||
int frameHeight = GetValue((int)eViewAttribs::scaletvheight);
|
||||
if (frameX < 0 || frameY < 0 || frameWidth <= 0 || frameHeight <= 0)
|
||||
return cRect::Null;
|
||||
frameX += cOsd::OsdLeft();
|
||||
frameY += cOsd::OsdTop();
|
||||
return cRect(frameX, frameY, frameWidth, frameHeight);
|
||||
}
|
||||
|
||||
void cViewAttribs::SetOrientationDynamic(int id, const char *val) {
|
||||
if (strchr(val, '{') && strchr(val, '}')) {
|
||||
orientation = new cTextExpr(val);
|
||||
} else {
|
||||
SetOrientation(id, val);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cViewElementAttribs
|
||||
***************************************************************************/
|
||||
cViewElementAttribs::cViewElementAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
name = NULL;
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cViewElementAttribs::cViewElementAttribs(const cViewElementAttribs &other) : cAttributes(other) {
|
||||
name = NULL;
|
||||
}
|
||||
|
||||
cViewElementAttribs::~cViewElementAttribs(void) {
|
||||
free(name);
|
||||
}
|
||||
|
||||
void cViewElementAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown view element attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
if (IdEqual(id, (int)eViewElementAttribs::mode)) {
|
||||
SetViewElementMode(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewElementAttribs::shifttype)) {
|
||||
SetShiftType(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewElementAttribs::shiftmode)) {
|
||||
SetShiftMode(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewElementAttribs::orientation)) {
|
||||
SetOrientation(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewElementAttribs::name)) {
|
||||
name = strdup(attVal);
|
||||
} else {
|
||||
attribCtors[id] = new cNumericExpr(attVal);
|
||||
if (id == (int)eViewElementAttribs::starty + (int)eCommonAttribs::count) {
|
||||
attribCtors[id]->SetVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cViewElementAttribs::SetAttributesDefs(void) {
|
||||
attribIDs.insert(pair<string, int>("delay", (int)eViewElementAttribs::delay));
|
||||
attribIDs.insert(pair<string, int>("fadetime", (int)eViewElementAttribs::fadetime));
|
||||
attribIDs.insert(pair<string, int>("shifttime", (int)eViewElementAttribs::shifttime));
|
||||
attribIDs.insert(pair<string, int>("shifttype", (int)eViewElementAttribs::shifttype));
|
||||
attribIDs.insert(pair<string, int>("shiftmode", (int)eViewElementAttribs::shiftmode));
|
||||
attribIDs.insert(pair<string, int>("startx", (int)eViewElementAttribs::startx));
|
||||
attribIDs.insert(pair<string, int>("starty", (int)eViewElementAttribs::starty));
|
||||
attribIDs.insert(pair<string, int>("orientation", (int)eViewElementAttribs::orientation));
|
||||
attribIDs.insert(pair<string, int>("mode", (int)eViewElementAttribs::mode));
|
||||
attribIDs.insert(pair<string, int>("name", (int)eViewElementAttribs::name));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::delay, "delay"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::fadetime, "fadetime"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::shifttime, "shifttime"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::shifttype, "shifttype"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::shiftmode, "shiftmode"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::startx, "startx"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::starty, "starty"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::orientation, "orientation"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::mode, "mode"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::name, "name"));
|
||||
}
|
||||
|
||||
eOrientation cViewElementAttribs::Orientation(void) {
|
||||
int orientation = GetValue((int)eViewElementAttribs::orientation);
|
||||
if (orientation == -1)
|
||||
return eOrientation::vertical;
|
||||
if (orientation == (int)eOrientation::none)
|
||||
return eOrientation::vertical;
|
||||
return (eOrientation)orientation;
|
||||
}
|
||||
|
||||
void cViewElementAttribs::Debug(void) {
|
||||
esyslog("skindesigner: ---> View Element Attribs");
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cViewListAttribs
|
||||
***************************************************************************/
|
||||
cViewListAttribs::cViewListAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
determinateFont = NULL;
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cViewListAttribs::~cViewListAttribs(void) {
|
||||
free(determinateFont);
|
||||
}
|
||||
|
||||
void cViewListAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown view list attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
if (IdEqual(id, (int)eViewListAttribs::align)) {
|
||||
SetAlign(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewListAttribs::determinatefont)) {
|
||||
determinateFont = strdup(attVal);
|
||||
} else if (IdEqual(id, (int)eViewListAttribs::orientation)) {
|
||||
SetOrientation(id, attVal);
|
||||
} else {
|
||||
attribCtors[id] = new cNumericExpr(attVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cViewListAttribs::NumListElements(void) {
|
||||
return GetValue((int)eViewListAttribs::numlistelements);
|
||||
}
|
||||
|
||||
int cViewListAttribs::MenuItemWidth(void) {
|
||||
return GetValue((int)eViewListAttribs::menuitemwidth);
|
||||
}
|
||||
|
||||
const char *cViewListAttribs::DeterminateFont(void) {
|
||||
return determinateFont;
|
||||
}
|
||||
|
||||
eAlign cViewListAttribs::Align(void) {
|
||||
int align = GetValue((int)eViewListAttribs::align);
|
||||
if (align < 0)
|
||||
return eAlign::top;
|
||||
return (eAlign)align;
|
||||
}
|
||||
|
||||
eOrientation cViewListAttribs::Orientation(void) {
|
||||
int orientation = GetValue((int)eViewListAttribs::orientation);
|
||||
if (orientation < 0)
|
||||
return eOrientation::vertical;
|
||||
return (eOrientation)orientation;
|
||||
}
|
||||
|
||||
void cViewListAttribs::SetAttributesDefs(void) {
|
||||
attribIDs.insert(pair<string, int>("align", (int)eViewListAttribs::align));
|
||||
attribIDs.insert(pair<string, int>("menuitemwidth", (int)eViewListAttribs::menuitemwidth));
|
||||
attribIDs.insert(pair<string, int>("determinatefont", (int)eViewListAttribs::determinatefont));
|
||||
attribIDs.insert(pair<string, int>("numlistelements", (int)eViewListAttribs::numlistelements));
|
||||
attribIDs.insert(pair<string, int>("orientation", (int)eViewListAttribs::orientation));
|
||||
attribIDs.insert(pair<string, int>("condition", (int)eViewListAttribs::condition));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::align, "align"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::menuitemwidth, "menuitemwidth"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::determinatefont, "determinatefont"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::numlistelements, "numlistelements"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::orientation, "orientation"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::condition, "condition"));
|
||||
}
|
||||
|
||||
void cViewListAttribs::Debug(void) {
|
||||
esyslog("skindesigner: ---> View List Attribs");
|
||||
esyslog("skindesigner: DeterminateFont %s", determinateFont);
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cAreaAttribs
|
||||
***************************************************************************/
|
||||
cAreaAttribs::cAreaAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
name = NULL;
|
||||
scrollElement = NULL;
|
||||
dynamic = false;
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cAreaAttribs::cAreaAttribs(const cAreaAttribs &other) : cAttributes(other) {
|
||||
name = NULL;
|
||||
if (other.name)
|
||||
name = new cTextExpr(*other.name);
|
||||
scrollElement = NULL;
|
||||
if (other.scrollElement)
|
||||
scrollElement = strdup(other.scrollElement);
|
||||
dynamic = false;
|
||||
}
|
||||
|
||||
cAreaAttribs::~cAreaAttribs(void) {
|
||||
delete name;
|
||||
free(scrollElement);
|
||||
}
|
||||
|
||||
void cAreaAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown area attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
if (IdEqual(id, (int)eAreaAttribs::scrollelement)) {
|
||||
scrollElement = strdup(attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::mode)) {
|
||||
SetScrollMode(id, attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::orientation)) {
|
||||
SetOrientation(id, attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::scrollspeed)) {
|
||||
SetScrollSpeed(id, attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::background)) {
|
||||
SetBool(id, attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::name)) {
|
||||
name = new cTextExpr(attVal);
|
||||
} else {
|
||||
attribCtors[id] = new cNumericExpr(attVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cAreaAttribs::Layer(void) {
|
||||
if (GetValue((int)eAreaAttribs::layer) > 0) {
|
||||
return GetValue((int)eAreaAttribs::layer);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool cAreaAttribs::BackgroundArea(void) {
|
||||
int isBackground = GetValue((int)eAreaAttribs::background);
|
||||
if (isBackground == 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void cAreaAttribs::CheckDynamic(void) {
|
||||
for (int i = (int)eCommonAttribs::x; i <= (int)eCommonAttribs::height; ++i ) {
|
||||
if (attribCtors[i] && attribCtors[i]->Dynamic()) {
|
||||
dynamic = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *cAreaAttribs::Name(void) {
|
||||
if (name)
|
||||
return name->DeterminateText();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void cAreaAttribs::SetAttributesDefs(void) {
|
||||
attribIDs.insert(pair<string, int>("layer", (int)eAreaAttribs::layer));
|
||||
attribIDs.insert(pair<string, int>("transparency", (int)eAreaAttribs::transparency));
|
||||
attribIDs.insert(pair<string, int>("mode", (int)eAreaAttribs::mode));
|
||||
attribIDs.insert(pair<string, int>("orientation", (int)eAreaAttribs::orientation));
|
||||
attribIDs.insert(pair<string, int>("scrollelement", (int)eAreaAttribs::scrollelement));
|
||||
attribIDs.insert(pair<string, int>("scrollspeed", (int)eAreaAttribs::scrollspeed));
|
||||
attribIDs.insert(pair<string, int>("delay", (int)eAreaAttribs::delay));
|
||||
attribIDs.insert(pair<string, int>("background", (int)eAreaAttribs::background));
|
||||
attribIDs.insert(pair<string, int>("name", (int)eAreaAttribs::name));
|
||||
attribIDs.insert(pair<string, int>("scrollheight", (int)eAreaAttribs::scrollheight));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::layer, "layer"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::transparency, "transparency"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::mode, "mode"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::orientation, "orientation"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::scrollelement, "scrollelement"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::scrollspeed, "scrollspeed"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::delay, "delay"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::background, "background"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::name, "name"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::scrollheight, "scrollheight"));
|
||||
}
|
||||
|
||||
void cAreaAttribs::Cache(void) {
|
||||
cAttributes::Cache();
|
||||
if (name) {
|
||||
name->SetGlobals(globals);
|
||||
name->SetTokenContainer(tokenContainer);
|
||||
name->Cache();
|
||||
}
|
||||
}
|
||||
|
||||
void cAreaAttribs::Debug(void) {
|
||||
if (!name) {
|
||||
esyslog("skindesigner: ---> Area Attribs");
|
||||
} else {
|
||||
esyslog("skindesigner: ---> Tab %s Attribs", name->DeterminateText());
|
||||
}
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cAreaContainerAttribs
|
||||
***************************************************************************/
|
||||
cAreaContainerAttribs::cAreaContainerAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cAreaContainerAttribs::cAreaContainerAttribs(const cAreaContainerAttribs &other) : cAttributes(other) {
|
||||
}
|
||||
|
||||
cAreaContainerAttribs::~cAreaContainerAttribs(void) {
|
||||
}
|
||||
|
||||
void cAreaContainerAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown area container attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
void cAreaContainerAttribs::SetAttributesDefs(void) {
|
||||
}
|
||||
|
||||
void cAreaContainerAttribs::Debug(void) {
|
||||
esyslog("skindesigner: ---> Area Container Attribs");
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
#include "attributes.h"
|
||||
#include "../config.h"
|
||||
|
||||
/***************************************************************************
|
||||
* cViewAttribs
|
||||
***************************************************************************/
|
||||
cViewAttribs::cViewAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
orientation = NULL;
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cViewAttribs::~cViewAttribs(void) {
|
||||
delete orientation;
|
||||
}
|
||||
|
||||
void cViewAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown view attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
if (IdEqual(id, (int)eViewAttribs::shifttype)) {
|
||||
SetShiftType(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewAttribs::shiftmode)) {
|
||||
SetShiftMode(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewAttribs::orientation)) {
|
||||
SetOrientationDynamic(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewAttribs::hideroot)) {
|
||||
SetBool(id, attVal);
|
||||
} else {
|
||||
attribCtors[id] = new cNumericExpr(attVal);
|
||||
if ( (id == (int)eViewAttribs::starty + (int)eCommonAttribs::count) ||
|
||||
(id == (int)eViewAttribs::scaletvy + (int)eCommonAttribs::count) ||
|
||||
(id == (int)eViewAttribs::scaletvheight + (int)eCommonAttribs::count) ) {
|
||||
attribCtors[id]->SetVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cViewAttribs::SetAttributesDefs(void) {
|
||||
attribIDs.insert(pair<string, int>("fadetime", (int)eViewAttribs::fadetime));
|
||||
attribIDs.insert(pair<string, int>("shifttime", (int)eViewAttribs::shifttime));
|
||||
attribIDs.insert(pair<string, int>("shifttype", (int)eViewAttribs::shifttype));
|
||||
attribIDs.insert(pair<string, int>("shiftmode", (int)eViewAttribs::shiftmode));
|
||||
attribIDs.insert(pair<string, int>("startx", (int)eViewAttribs::startx));
|
||||
attribIDs.insert(pair<string, int>("starty", (int)eViewAttribs::starty));
|
||||
attribIDs.insert(pair<string, int>("scaletvx", (int)eViewAttribs::scaletvx));
|
||||
attribIDs.insert(pair<string, int>("scaletvy", (int)eViewAttribs::scaletvy));
|
||||
attribIDs.insert(pair<string, int>("scaletvwidth", (int)eViewAttribs::scaletvwidth));
|
||||
attribIDs.insert(pair<string, int>("scaletvheight", (int)eViewAttribs::scaletvheight));
|
||||
attribIDs.insert(pair<string, int>("orientation", (int)eViewAttribs::orientation));
|
||||
attribIDs.insert(pair<string, int>("debuggrid", (int)eViewAttribs::debuggrid));
|
||||
attribIDs.insert(pair<string, int>("hideroot", (int)eViewAttribs::hideroot));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::fadetime, "fadetime"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::shifttime, "shifttime"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::shifttype, "shifttype"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::shiftmode, "shiftmode"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::startx, "startx"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::starty, "starty"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvx, "scaletvx"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvy, "scaletvy"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvwidth, "scaletvwidth"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvheight, "scaletvheight"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::orientation, "orientation"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::debuggrid, "debuggrid"));
|
||||
attribNames.insert(pair<int, string>((int)eViewAttribs::hideroot, "hideroot"));
|
||||
}
|
||||
|
||||
void cViewAttribs::Cache(void) {
|
||||
tokenContainer = new skindesignerapi::cTokenContainer();
|
||||
cAttributes::Cache();
|
||||
if (orientation) {
|
||||
orientation->SetGlobals(globals);
|
||||
orientation->SetTokenContainer(tokenContainer);
|
||||
orientation->Cache();
|
||||
char *res = orientation->DeterminateText();
|
||||
if (res) {
|
||||
SetOrientation((int)eViewAttribs::orientation + (int)eCommonAttribs::count, res);
|
||||
}
|
||||
free(res);
|
||||
}
|
||||
}
|
||||
|
||||
void cViewAttribs::Debug(void) {
|
||||
esyslog("skindesigner: --> View Attribs");
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
eOrientation cViewAttribs::Orientation(void) {
|
||||
int orientation = GetValue((int)eViewAttribs::orientation);
|
||||
if (orientation == -1)
|
||||
return eOrientation::vertical;
|
||||
if (orientation == (int)eOrientation::none)
|
||||
return eOrientation::vertical;
|
||||
return (eOrientation)orientation;
|
||||
}
|
||||
|
||||
cRect cViewAttribs::TvFrame(void) {
|
||||
int frameX = GetValue((int)eViewAttribs::scaletvx);
|
||||
int frameY = GetValue((int)eViewAttribs::scaletvy);
|
||||
int frameWidth = GetValue((int)eViewAttribs::scaletvwidth);
|
||||
int frameHeight = GetValue((int)eViewAttribs::scaletvheight);
|
||||
if (frameX < 0 || frameY < 0 || frameWidth <= 0 || frameHeight <= 0)
|
||||
return cRect::Null;
|
||||
frameX += cOsd::OsdLeft();
|
||||
frameY += cOsd::OsdTop();
|
||||
return cRect(frameX, frameY, frameWidth, frameHeight);
|
||||
}
|
||||
|
||||
void cViewAttribs::SetOrientationDynamic(int id, const char *val) {
|
||||
if (strchr(val, '{') && strchr(val, '}')) {
|
||||
orientation = new cTextExpr(val);
|
||||
} else {
|
||||
SetOrientation(id, val);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cViewElementAttribs
|
||||
***************************************************************************/
|
||||
cViewElementAttribs::cViewElementAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
name = NULL;
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cViewElementAttribs::cViewElementAttribs(const cViewElementAttribs &other) : cAttributes(other) {
|
||||
name = NULL;
|
||||
}
|
||||
|
||||
cViewElementAttribs::~cViewElementAttribs(void) {
|
||||
free(name);
|
||||
}
|
||||
|
||||
void cViewElementAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown view element attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
if (IdEqual(id, (int)eViewElementAttribs::mode)) {
|
||||
SetViewElementMode(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewElementAttribs::shifttype)) {
|
||||
SetShiftType(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewElementAttribs::shiftmode)) {
|
||||
SetShiftMode(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewElementAttribs::orientation)) {
|
||||
SetOrientation(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewElementAttribs::name)) {
|
||||
name = strdup(attVal);
|
||||
} else {
|
||||
attribCtors[id] = new cNumericExpr(attVal);
|
||||
if (id == (int)eViewElementAttribs::starty + (int)eCommonAttribs::count) {
|
||||
attribCtors[id]->SetVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cViewElementAttribs::SetAttributesDefs(void) {
|
||||
attribIDs.insert(pair<string, int>("delay", (int)eViewElementAttribs::delay));
|
||||
attribIDs.insert(pair<string, int>("fadetime", (int)eViewElementAttribs::fadetime));
|
||||
attribIDs.insert(pair<string, int>("shifttime", (int)eViewElementAttribs::shifttime));
|
||||
attribIDs.insert(pair<string, int>("shifttype", (int)eViewElementAttribs::shifttype));
|
||||
attribIDs.insert(pair<string, int>("shiftmode", (int)eViewElementAttribs::shiftmode));
|
||||
attribIDs.insert(pair<string, int>("startx", (int)eViewElementAttribs::startx));
|
||||
attribIDs.insert(pair<string, int>("starty", (int)eViewElementAttribs::starty));
|
||||
attribIDs.insert(pair<string, int>("orientation", (int)eViewElementAttribs::orientation));
|
||||
attribIDs.insert(pair<string, int>("mode", (int)eViewElementAttribs::mode));
|
||||
attribIDs.insert(pair<string, int>("name", (int)eViewElementAttribs::name));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::delay, "delay"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::fadetime, "fadetime"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::shifttime, "shifttime"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::shifttype, "shifttype"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::shiftmode, "shiftmode"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::startx, "startx"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::starty, "starty"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::orientation, "orientation"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::mode, "mode"));
|
||||
attribNames.insert(pair<int, string>((int)eViewElementAttribs::name, "name"));
|
||||
}
|
||||
|
||||
eOrientation cViewElementAttribs::Orientation(void) {
|
||||
int orientation = GetValue((int)eViewElementAttribs::orientation);
|
||||
if (orientation == -1)
|
||||
return eOrientation::vertical;
|
||||
if (orientation == (int)eOrientation::none)
|
||||
return eOrientation::vertical;
|
||||
return (eOrientation)orientation;
|
||||
}
|
||||
|
||||
void cViewElementAttribs::Debug(void) {
|
||||
esyslog("skindesigner: ---> View Element Attribs");
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cViewListAttribs
|
||||
***************************************************************************/
|
||||
cViewListAttribs::cViewListAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
determinateFont = NULL;
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cViewListAttribs::~cViewListAttribs(void) {
|
||||
free(determinateFont);
|
||||
}
|
||||
|
||||
void cViewListAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown view list attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
if (IdEqual(id, (int)eViewListAttribs::align)) {
|
||||
SetAlign(id, attVal);
|
||||
} else if (IdEqual(id, (int)eViewListAttribs::determinatefont)) {
|
||||
determinateFont = strdup(attVal);
|
||||
} else if (IdEqual(id, (int)eViewListAttribs::orientation)) {
|
||||
SetOrientation(id, attVal);
|
||||
} else {
|
||||
attribCtors[id] = new cNumericExpr(attVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cViewListAttribs::NumListElements(void) {
|
||||
return GetValue((int)eViewListAttribs::numlistelements);
|
||||
}
|
||||
|
||||
int cViewListAttribs::MenuItemWidth(void) {
|
||||
return GetValue((int)eViewListAttribs::menuitemwidth);
|
||||
}
|
||||
|
||||
const char *cViewListAttribs::DeterminateFont(void) {
|
||||
return determinateFont;
|
||||
}
|
||||
|
||||
eAlign cViewListAttribs::Align(void) {
|
||||
int align = GetValue((int)eViewListAttribs::align);
|
||||
if (align < 0)
|
||||
return eAlign::top;
|
||||
return (eAlign)align;
|
||||
}
|
||||
|
||||
eOrientation cViewListAttribs::Orientation(void) {
|
||||
int orientation = GetValue((int)eViewListAttribs::orientation);
|
||||
if (orientation < 0)
|
||||
return eOrientation::vertical;
|
||||
return (eOrientation)orientation;
|
||||
}
|
||||
|
||||
void cViewListAttribs::SetAttributesDefs(void) {
|
||||
attribIDs.insert(pair<string, int>("align", (int)eViewListAttribs::align));
|
||||
attribIDs.insert(pair<string, int>("menuitemwidth", (int)eViewListAttribs::menuitemwidth));
|
||||
attribIDs.insert(pair<string, int>("determinatefont", (int)eViewListAttribs::determinatefont));
|
||||
attribIDs.insert(pair<string, int>("numlistelements", (int)eViewListAttribs::numlistelements));
|
||||
attribIDs.insert(pair<string, int>("orientation", (int)eViewListAttribs::orientation));
|
||||
attribIDs.insert(pair<string, int>("condition", (int)eViewListAttribs::condition));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::align, "align"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::menuitemwidth, "menuitemwidth"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::determinatefont, "determinatefont"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::numlistelements, "numlistelements"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::orientation, "orientation"));
|
||||
attribNames.insert(pair<int, string>((int)eViewListAttribs::condition, "condition"));
|
||||
}
|
||||
|
||||
void cViewListAttribs::Debug(void) {
|
||||
esyslog("skindesigner: ---> View List Attribs");
|
||||
esyslog("skindesigner: DeterminateFont %s", determinateFont);
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cAreaAttribs
|
||||
***************************************************************************/
|
||||
cAreaAttribs::cAreaAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
name = NULL;
|
||||
scrollElement = NULL;
|
||||
dynamic = false;
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cAreaAttribs::cAreaAttribs(const cAreaAttribs &other) : cAttributes(other) {
|
||||
name = NULL;
|
||||
if (other.name)
|
||||
name = new cTextExpr(*other.name);
|
||||
scrollElement = NULL;
|
||||
if (other.scrollElement)
|
||||
scrollElement = strdup(other.scrollElement);
|
||||
dynamic = false;
|
||||
}
|
||||
|
||||
cAreaAttribs::~cAreaAttribs(void) {
|
||||
delete name;
|
||||
free(scrollElement);
|
||||
}
|
||||
|
||||
void cAreaAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown area attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
if (IdEqual(id, (int)eAreaAttribs::scrollelement)) {
|
||||
scrollElement = strdup(attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::mode)) {
|
||||
SetScrollMode(id, attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::orientation)) {
|
||||
SetOrientation(id, attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::scrollspeed)) {
|
||||
SetScrollSpeed(id, attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::background)) {
|
||||
SetBool(id, attVal);
|
||||
} else if (IdEqual(id, (int)eAreaAttribs::name)) {
|
||||
name = new cTextExpr(attVal);
|
||||
} else {
|
||||
attribCtors[id] = new cNumericExpr(attVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cAreaAttribs::Layer(void) {
|
||||
if (GetValue((int)eAreaAttribs::layer) > 0) {
|
||||
return GetValue((int)eAreaAttribs::layer);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool cAreaAttribs::BackgroundArea(void) {
|
||||
int isBackground = GetValue((int)eAreaAttribs::background);
|
||||
if (isBackground == 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void cAreaAttribs::CheckDynamic(void) {
|
||||
for (int i = (int)eCommonAttribs::x; i <= (int)eCommonAttribs::height; ++i ) {
|
||||
if (attribCtors[i] && attribCtors[i]->Dynamic()) {
|
||||
dynamic = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *cAreaAttribs::Name(void) {
|
||||
if (name)
|
||||
return name->DeterminateText();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void cAreaAttribs::SetAttributesDefs(void) {
|
||||
attribIDs.insert(pair<string, int>("layer", (int)eAreaAttribs::layer));
|
||||
attribIDs.insert(pair<string, int>("transparency", (int)eAreaAttribs::transparency));
|
||||
attribIDs.insert(pair<string, int>("mode", (int)eAreaAttribs::mode));
|
||||
attribIDs.insert(pair<string, int>("orientation", (int)eAreaAttribs::orientation));
|
||||
attribIDs.insert(pair<string, int>("scrollelement", (int)eAreaAttribs::scrollelement));
|
||||
attribIDs.insert(pair<string, int>("scrollspeed", (int)eAreaAttribs::scrollspeed));
|
||||
attribIDs.insert(pair<string, int>("delay", (int)eAreaAttribs::delay));
|
||||
attribIDs.insert(pair<string, int>("background", (int)eAreaAttribs::background));
|
||||
attribIDs.insert(pair<string, int>("name", (int)eAreaAttribs::name));
|
||||
attribIDs.insert(pair<string, int>("scrollheight", (int)eAreaAttribs::scrollheight));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::layer, "layer"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::transparency, "transparency"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::mode, "mode"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::orientation, "orientation"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::scrollelement, "scrollelement"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::scrollspeed, "scrollspeed"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::delay, "delay"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::background, "background"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::name, "name"));
|
||||
attribNames.insert(pair<int, string>((int)eAreaAttribs::scrollheight, "scrollheight"));
|
||||
}
|
||||
|
||||
void cAreaAttribs::Cache(void) {
|
||||
cAttributes::Cache();
|
||||
if (name) {
|
||||
name->SetGlobals(globals);
|
||||
name->SetTokenContainer(tokenContainer);
|
||||
name->Cache();
|
||||
}
|
||||
}
|
||||
|
||||
void cAreaAttribs::Debug(void) {
|
||||
if (!name) {
|
||||
esyslog("skindesigner: ---> Area Attribs");
|
||||
} else {
|
||||
esyslog("skindesigner: ---> Tab %s Attribs", name->DeterminateText());
|
||||
}
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* cAreaContainerAttribs
|
||||
***************************************************************************/
|
||||
cAreaContainerAttribs::cAreaContainerAttribs(int numAttributes) : cAttributes(numAttributes) {
|
||||
SetAttributesDefs();
|
||||
}
|
||||
|
||||
cAreaContainerAttribs::cAreaContainerAttribs(const cAreaContainerAttribs &other) : cAttributes(other) {
|
||||
}
|
||||
|
||||
cAreaContainerAttribs::~cAreaContainerAttribs(void) {
|
||||
}
|
||||
|
||||
void cAreaContainerAttribs::Set(vector<stringpair> &attributes) {
|
||||
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
|
||||
const char *attName = (*att).first.c_str();
|
||||
const char *attVal = (*att).second.c_str();
|
||||
int id = AttributeId(attName);
|
||||
if (id == ATTR_UNKNOWN) {
|
||||
esyslog("skindesigner: unknown area container attribute \"%s\" = \"%s\"", attName, attVal);
|
||||
continue;
|
||||
}
|
||||
if (SetCommon(id, attVal))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
void cAreaContainerAttribs::SetAttributesDefs(void) {
|
||||
}
|
||||
|
||||
void cAreaContainerAttribs::Debug(void) {
|
||||
esyslog("skindesigner: ---> Area Container Attribs");
|
||||
cAttributes::Debug();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,111 +1,111 @@
|
||||
#ifndef __ATTRIBUTES_H
|
||||
#define __ATTRIBUTES_H
|
||||
|
||||
#include "attribute.h"
|
||||
/******************************************************************
|
||||
* cViewAttribs
|
||||
******************************************************************/
|
||||
class cViewAttribs : public cAttributes {
|
||||
private:
|
||||
cTextExpr *orientation;
|
||||
void SetAttributesDefs(void);
|
||||
void SetOrientationDynamic(int id, const char *val);
|
||||
public:
|
||||
cViewAttribs(int numAttributes);
|
||||
virtual ~cViewAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
eOrientation Orientation(void);
|
||||
int FadeTime(void) { return GetValue((int)eViewAttribs::fadetime); };
|
||||
int ShiftTime(void) { return GetValue((int)eViewAttribs::shifttime); };
|
||||
cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewAttribs::startx), GetValue((int)eViewAttribs::starty)); };
|
||||
int ShiftType(void) { return GetValue((int)eViewAttribs::shifttype); };
|
||||
int ShiftMode(void) { return GetValue((int)eViewAttribs::shiftmode); };
|
||||
cRect TvFrame(void);
|
||||
void Cache(void);
|
||||
void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewElementAttribs
|
||||
******************************************************************/
|
||||
class cViewElementAttribs : public cAttributes {
|
||||
private:
|
||||
char *name;
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cViewElementAttribs(int numAttributes);
|
||||
cViewElementAttribs(const cViewElementAttribs &other);
|
||||
virtual ~cViewElementAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
int Mode(void) { return GetValue((int)eViewElementAttribs::mode); };
|
||||
int Delay(void) { return GetValue((int)eViewElementAttribs::delay); };
|
||||
eOrientation Orientation(void);
|
||||
int FadeTime(void) { return GetValue((int)eViewElementAttribs::fadetime); };
|
||||
int ShiftTime(void) { return GetValue((int)eViewElementAttribs::shifttime); };
|
||||
cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewElementAttribs::startx), GetValue((int)eViewElementAttribs::starty)); };
|
||||
int ShiftType(void) { return GetValue((int)eViewElementAttribs::shifttype); };
|
||||
int ShiftMode(void) { return GetValue((int)eViewElementAttribs::shiftmode); };
|
||||
const char *Name(void) { return name; };
|
||||
void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewListAttribs
|
||||
******************************************************************/
|
||||
class cViewListAttribs : public cAttributes {
|
||||
private:
|
||||
char *determinateFont;
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cViewListAttribs(int numAttributes);
|
||||
virtual ~cViewListAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
int NumListElements(void);
|
||||
int MenuItemWidth(void);
|
||||
const char *DeterminateFont(void);
|
||||
eAlign Align(void);
|
||||
eOrientation Orientation(void);
|
||||
void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cAreaAttribs
|
||||
******************************************************************/
|
||||
class cAreaAttribs : public cAttributes {
|
||||
private:
|
||||
cTextExpr *name;
|
||||
char *scrollElement;
|
||||
void SetAttributesDefs(void);
|
||||
bool dynamic;
|
||||
public:
|
||||
cAreaAttribs(int numAttributes);
|
||||
cAreaAttribs(const cAreaAttribs &other);
|
||||
virtual ~cAreaAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
const char *GetScrollElement(void) { return scrollElement; };
|
||||
int Orientation(void) { return GetValue((int)eAreaAttribs::orientation); };
|
||||
int Delay(void) { return GetValue((int)eAreaAttribs::delay); };
|
||||
int Mode(void) { return GetValue((int)eAreaAttribs::mode); };
|
||||
int ScrollSpeed(void) { return GetValue((int)eAreaAttribs::scrollspeed); };
|
||||
int Transparency(void) { return GetValue((int)eAreaAttribs::transparency); };
|
||||
int Layer(void);
|
||||
int ScrollStep(void) { return GetValue((int)eAreaAttribs::scrollheight); };
|
||||
bool BackgroundArea(void);
|
||||
const char *Name(void);
|
||||
void CheckDynamic(void);
|
||||
bool Dynamic(void) {return dynamic; };
|
||||
void Cache(void);
|
||||
void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cAreaContainerAttribs
|
||||
******************************************************************/
|
||||
class cAreaContainerAttribs : public cAttributes {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cAreaContainerAttribs(int numAttributes);
|
||||
cAreaContainerAttribs(const cAreaContainerAttribs &other);
|
||||
virtual ~cAreaContainerAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
#ifndef __ATTRIBUTES_H
|
||||
#define __ATTRIBUTES_H
|
||||
|
||||
#include "attribute.h"
|
||||
/******************************************************************
|
||||
* cViewAttribs
|
||||
******************************************************************/
|
||||
class cViewAttribs : public cAttributes {
|
||||
private:
|
||||
cTextExpr *orientation;
|
||||
void SetAttributesDefs(void);
|
||||
void SetOrientationDynamic(int id, const char *val);
|
||||
public:
|
||||
cViewAttribs(int numAttributes);
|
||||
virtual ~cViewAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
eOrientation Orientation(void);
|
||||
int FadeTime(void) { return GetValue((int)eViewAttribs::fadetime); };
|
||||
int ShiftTime(void) { return GetValue((int)eViewAttribs::shifttime); };
|
||||
cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewAttribs::startx), GetValue((int)eViewAttribs::starty)); };
|
||||
int ShiftType(void) { return GetValue((int)eViewAttribs::shifttype); };
|
||||
int ShiftMode(void) { return GetValue((int)eViewAttribs::shiftmode); };
|
||||
cRect TvFrame(void);
|
||||
void Cache(void);
|
||||
void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewElementAttribs
|
||||
******************************************************************/
|
||||
class cViewElementAttribs : public cAttributes {
|
||||
private:
|
||||
char *name;
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cViewElementAttribs(int numAttributes);
|
||||
cViewElementAttribs(const cViewElementAttribs &other);
|
||||
virtual ~cViewElementAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
int Mode(void) { return GetValue((int)eViewElementAttribs::mode); };
|
||||
int Delay(void) { return GetValue((int)eViewElementAttribs::delay); };
|
||||
eOrientation Orientation(void);
|
||||
int FadeTime(void) { return GetValue((int)eViewElementAttribs::fadetime); };
|
||||
int ShiftTime(void) { return GetValue((int)eViewElementAttribs::shifttime); };
|
||||
cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewElementAttribs::startx), GetValue((int)eViewElementAttribs::starty)); };
|
||||
int ShiftType(void) { return GetValue((int)eViewElementAttribs::shifttype); };
|
||||
int ShiftMode(void) { return GetValue((int)eViewElementAttribs::shiftmode); };
|
||||
const char *Name(void) { return name; };
|
||||
void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewListAttribs
|
||||
******************************************************************/
|
||||
class cViewListAttribs : public cAttributes {
|
||||
private:
|
||||
char *determinateFont;
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cViewListAttribs(int numAttributes);
|
||||
virtual ~cViewListAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
int NumListElements(void);
|
||||
int MenuItemWidth(void);
|
||||
const char *DeterminateFont(void);
|
||||
eAlign Align(void);
|
||||
eOrientation Orientation(void);
|
||||
void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cAreaAttribs
|
||||
******************************************************************/
|
||||
class cAreaAttribs : public cAttributes {
|
||||
private:
|
||||
cTextExpr *name;
|
||||
char *scrollElement;
|
||||
void SetAttributesDefs(void);
|
||||
bool dynamic;
|
||||
public:
|
||||
cAreaAttribs(int numAttributes);
|
||||
cAreaAttribs(const cAreaAttribs &other);
|
||||
virtual ~cAreaAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
const char *GetScrollElement(void) { return scrollElement; };
|
||||
int Orientation(void) { return GetValue((int)eAreaAttribs::orientation); };
|
||||
int Delay(void) { return GetValue((int)eAreaAttribs::delay); };
|
||||
int Mode(void) { return GetValue((int)eAreaAttribs::mode); };
|
||||
int ScrollSpeed(void) { return GetValue((int)eAreaAttribs::scrollspeed); };
|
||||
int Transparency(void) { return GetValue((int)eAreaAttribs::transparency); };
|
||||
int Layer(void);
|
||||
int ScrollStep(void) { return GetValue((int)eAreaAttribs::scrollheight); };
|
||||
bool BackgroundArea(void);
|
||||
const char *Name(void);
|
||||
void CheckDynamic(void);
|
||||
bool Dynamic(void) {return dynamic; };
|
||||
void Cache(void);
|
||||
void Debug(void);
|
||||
};
|
||||
/******************************************************************
|
||||
* cAreaContainerAttribs
|
||||
******************************************************************/
|
||||
class cAreaContainerAttribs : public cAttributes {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cAreaContainerAttribs(int numAttributes);
|
||||
cAreaContainerAttribs(const cAreaContainerAttribs &other);
|
||||
virtual ~cAreaContainerAttribs(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
#endif //__ATTRIBUTES_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,318 +1,318 @@
|
||||
#ifndef __COMPLEXTYPES_H
|
||||
#define __COMPLEXTYPES_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vdr/skins.h>
|
||||
#include "globals.h"
|
||||
#include "../libskindesignerapi/tokencontainer.h"
|
||||
|
||||
class cLoopInfo;
|
||||
class cFunction;
|
||||
/******************************************************************
|
||||
* helpers
|
||||
******************************************************************/
|
||||
char *RemoveSpace(char *e);
|
||||
void ReplaceDecimalpoint(char *e);
|
||||
void ReplaceStart(char *e, int num);
|
||||
void ReplaceEnd(char *e, int num);
|
||||
|
||||
/******************************************************************
|
||||
* cCondition
|
||||
******************************************************************/
|
||||
enum class eCondOp {
|
||||
tAnd,
|
||||
tOr
|
||||
};
|
||||
|
||||
enum class eCondType {
|
||||
token,
|
||||
negtoken,
|
||||
lowerInt,
|
||||
equalInt,
|
||||
greaterInt,
|
||||
isset,
|
||||
empty,
|
||||
equalString,
|
||||
notEqualString,
|
||||
contains,
|
||||
notContains
|
||||
};
|
||||
|
||||
enum class eCondTokenType {
|
||||
inttoken,
|
||||
stringtoken,
|
||||
looptoken
|
||||
};
|
||||
|
||||
class cCond : public cListObject {
|
||||
public:
|
||||
cCond(const char *expression);
|
||||
cCond(const cCond &other);
|
||||
virtual ~cCond(void);
|
||||
void Debug(void);
|
||||
char *expr;
|
||||
eCondOp operation;
|
||||
eCondType type;
|
||||
eCondTokenType tokenType;
|
||||
bool constant;
|
||||
bool isTrue;
|
||||
int tokenIndex;
|
||||
int compareValue;
|
||||
char *compareStrValue;
|
||||
};
|
||||
|
||||
class cCondition {
|
||||
private:
|
||||
char *expr;
|
||||
cGlobals *globals;
|
||||
skindesignerapi::cTokenContainer *tokenContainer;
|
||||
cLoopInfo *loopInfo;
|
||||
cList<cCond> conds;
|
||||
void Tokenize(void);
|
||||
void PrepareTokens(void);
|
||||
void SetTokenCond(cCond *c);
|
||||
void SetIntegerCond(cCond *c);
|
||||
void SetStringCond(cCond *c);
|
||||
void SetStringCompareCond(cCond *c);
|
||||
void SetTokenIndex(cCond *c, const char *token);
|
||||
public:
|
||||
cCondition(const char *expression);
|
||||
cCondition(const cCondition &other);
|
||||
virtual ~cCondition(void);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {this->tokenContainer = tokenContainer; };
|
||||
void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; };
|
||||
void Prepare(void);
|
||||
bool True(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cNumericExpr
|
||||
******************************************************************/
|
||||
enum class eFactorType {
|
||||
constant = 0,
|
||||
stringtoken,
|
||||
inttoken,
|
||||
looptoken,
|
||||
xref,
|
||||
yref,
|
||||
widthref,
|
||||
heightref,
|
||||
areawidth,
|
||||
areaheight,
|
||||
columnwidth,
|
||||
rowheight
|
||||
};
|
||||
|
||||
class cFactor: public cListObject {
|
||||
public:
|
||||
cFactor(void) {
|
||||
multiplication = true;
|
||||
type = eFactorType::constant;
|
||||
constValue = 1.0f;
|
||||
tokenIndex = -1;
|
||||
funcRefName = NULL;
|
||||
funcRef = NULL;
|
||||
};
|
||||
cFactor(const cFactor &other) {
|
||||
multiplication = other.multiplication;
|
||||
type = other.type;
|
||||
constValue = other.constValue;
|
||||
tokenIndex = other.tokenIndex;
|
||||
funcRefName = NULL;
|
||||
if (other.funcRefName)
|
||||
funcRefName = strdup(other.funcRefName);
|
||||
funcRef = other.funcRef;
|
||||
}
|
||||
~cFactor(void) {
|
||||
free(funcRefName);
|
||||
};
|
||||
bool multiplication;
|
||||
eFactorType type;
|
||||
double constValue;
|
||||
int tokenIndex;
|
||||
char *funcRefName;
|
||||
cFunction *funcRef;
|
||||
};
|
||||
|
||||
class cSummand : public cListObject {
|
||||
public:
|
||||
cSummand(const char *summand);
|
||||
cSummand(const cSummand &other);
|
||||
~cSummand(void);
|
||||
void Debug(void);
|
||||
char *summand;
|
||||
bool positive;
|
||||
cList<cFactor> factors;
|
||||
};
|
||||
|
||||
class cNumericExpr {
|
||||
private:
|
||||
cGlobals *globals;
|
||||
cRect *container;
|
||||
skindesignerapi::cTokenContainer *tokenContainer;
|
||||
cLoopInfo *loopInfo;
|
||||
char *expr;
|
||||
cList<cSummand> summands;
|
||||
bool horizontal;
|
||||
int value;
|
||||
bool dynamic;
|
||||
//common string functions
|
||||
bool IsNumeric(const char *e);
|
||||
bool IsNumericExpression(const char *e);
|
||||
bool PercentValue(const char *e);
|
||||
char *ReplacePercentValue(char *e);
|
||||
char *ReplaceToken(char *e, const char* token, int value);
|
||||
char *ReplaceTokens(char *e, const char* token, int value);
|
||||
//calculate numeric expressions
|
||||
int EvaluateExpression(char *e);
|
||||
double EvaluateExpressionDouble(char *e);
|
||||
double ParseAtom(char*& e);
|
||||
double ParseFactors(char*& e);
|
||||
double ParseSummands(char*& e);
|
||||
//prepare expressions with tokens
|
||||
void CreateSummands(void);
|
||||
void CreateFactors(void);
|
||||
bool SetTokenFactor(cFactor *f, char *tokenName);
|
||||
bool SetReferenceFactor(cFactor *f, char *tokenName);
|
||||
bool SetGeometryFactor(cFactor *f, char *tokenName);
|
||||
void ConsolidateSummand(void);
|
||||
void ConsolidateFactors(void);
|
||||
public:
|
||||
cNumericExpr(const char *expression);
|
||||
cNumericExpr(const cNumericExpr &other);
|
||||
virtual ~cNumericExpr(void);
|
||||
void SetContainer(cRect *container) { this->container = container; };
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) { this->tokenContainer = tokenContainer; };
|
||||
void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; };
|
||||
void SetVertical(void) { horizontal = false; };
|
||||
bool CacheStatic(void);
|
||||
void PrepareTokens(void);
|
||||
vector<cFactor*> GetRefFactors(void);
|
||||
int GetValue(void) { return value; };
|
||||
bool Dynamic(void) { return dynamic; };
|
||||
int Calculate(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cColor
|
||||
******************************************************************/
|
||||
class cColor {
|
||||
private:
|
||||
cGlobals *globals;
|
||||
char *expr;
|
||||
tColor value;
|
||||
public:
|
||||
cColor(const char *expression);
|
||||
cColor(const cColor &other);
|
||||
virtual ~cColor(void);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void Cache(void);
|
||||
tColor Color(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cTextExpr
|
||||
******************************************************************/
|
||||
enum class eTexttokenType {
|
||||
constant = 0,
|
||||
stringtoken,
|
||||
inttoken,
|
||||
looptoken,
|
||||
printftoken,
|
||||
condstringtoken,
|
||||
condinttoken,
|
||||
};
|
||||
|
||||
enum class ePrintfVarType {
|
||||
stringtoken,
|
||||
inttoken,
|
||||
looptoken
|
||||
};
|
||||
|
||||
struct sPrintfInfo {
|
||||
ePrintfVarType type;
|
||||
int index;
|
||||
};
|
||||
|
||||
class cTextToken: public cListObject {
|
||||
public:
|
||||
cTextToken(void) {
|
||||
type = eTexttokenType::constant;
|
||||
constValue = NULL;
|
||||
printfExpr = NULL;
|
||||
printfResult = NULL;
|
||||
tokenIndex = -1;
|
||||
condStart = NULL;
|
||||
condEnd = NULL;
|
||||
};
|
||||
cTextToken(const cTextToken &other) {
|
||||
type = other.type;
|
||||
constValue = NULL;
|
||||
if (other.constValue)
|
||||
constValue = strdup(other.constValue);
|
||||
printfExpr = NULL;
|
||||
if (other.printfExpr)
|
||||
printfExpr = strdup(other.printfExpr);
|
||||
printfVarIndices = other.printfVarIndices;
|
||||
printfResult = NULL;
|
||||
if (other.printfResult)
|
||||
printfResult = strdup(other.printfResult);
|
||||
tokenIndex = other.tokenIndex;
|
||||
condStart = NULL;
|
||||
if (other.condStart)
|
||||
condStart = strdup(other.condStart);
|
||||
condEnd = NULL;
|
||||
if (other.condEnd)
|
||||
condEnd = strdup(other.condEnd);
|
||||
};
|
||||
~cTextToken(void) {
|
||||
free(constValue);
|
||||
free(printfExpr);
|
||||
};
|
||||
eTexttokenType type;
|
||||
char *constValue;
|
||||
int tokenIndex;
|
||||
char *printfExpr;
|
||||
vector<sPrintfInfo> printfVarIndices;
|
||||
char *printfResult;
|
||||
char *condStart;
|
||||
char *condEnd;
|
||||
};
|
||||
|
||||
class cTextExpr {
|
||||
private:
|
||||
cGlobals *globals;
|
||||
skindesignerapi::cTokenContainer *tokenContainer;
|
||||
cLoopInfo *loopInfo;
|
||||
char *expr;
|
||||
cList<cTextToken> textTokens;
|
||||
void Translate(void);
|
||||
void Tokenize(void);
|
||||
void PrepareTokens(void);
|
||||
bool CheckGlobals(cTextToken *t);
|
||||
bool ParsePrintfToken(cTextToken *t);
|
||||
void DeterminatePrintfToken(cTextToken *t);
|
||||
void ParseCondToken(cTextToken *t);
|
||||
char *CopyTextPart(char *start, char *stop, bool incLastChar= true);
|
||||
public:
|
||||
cTextExpr(const char *expression);
|
||||
cTextExpr(const cTextExpr &other);
|
||||
virtual ~cTextExpr(void);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) { this->tokenContainer = tokenContainer; };
|
||||
void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; };
|
||||
void CorrectImagePath(void);
|
||||
void Cache(void);
|
||||
char *DeterminateText(void);
|
||||
void Debug(const char *exprName);
|
||||
};
|
||||
|
||||
#ifndef __COMPLEXTYPES_H
|
||||
#define __COMPLEXTYPES_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vdr/skins.h>
|
||||
#include "globals.h"
|
||||
#include "../libskindesignerapi/tokencontainer.h"
|
||||
|
||||
class cLoopInfo;
|
||||
class cFunction;
|
||||
/******************************************************************
|
||||
* helpers
|
||||
******************************************************************/
|
||||
char *RemoveSpace(char *e);
|
||||
void ReplaceDecimalpoint(char *e);
|
||||
void ReplaceStart(char *e, int num);
|
||||
void ReplaceEnd(char *e, int num);
|
||||
|
||||
/******************************************************************
|
||||
* cCondition
|
||||
******************************************************************/
|
||||
enum class eCondOp {
|
||||
tAnd,
|
||||
tOr
|
||||
};
|
||||
|
||||
enum class eCondType {
|
||||
token,
|
||||
negtoken,
|
||||
lowerInt,
|
||||
equalInt,
|
||||
greaterInt,
|
||||
isset,
|
||||
empty,
|
||||
equalString,
|
||||
notEqualString,
|
||||
contains,
|
||||
notContains
|
||||
};
|
||||
|
||||
enum class eCondTokenType {
|
||||
inttoken,
|
||||
stringtoken,
|
||||
looptoken
|
||||
};
|
||||
|
||||
class cCond : public cListObject {
|
||||
public:
|
||||
cCond(const char *expression);
|
||||
cCond(const cCond &other);
|
||||
virtual ~cCond(void);
|
||||
void Debug(void);
|
||||
char *expr;
|
||||
eCondOp operation;
|
||||
eCondType type;
|
||||
eCondTokenType tokenType;
|
||||
bool constant;
|
||||
bool isTrue;
|
||||
int tokenIndex;
|
||||
int compareValue;
|
||||
char *compareStrValue;
|
||||
};
|
||||
|
||||
class cCondition {
|
||||
private:
|
||||
char *expr;
|
||||
cGlobals *globals;
|
||||
skindesignerapi::cTokenContainer *tokenContainer;
|
||||
cLoopInfo *loopInfo;
|
||||
cList<cCond> conds;
|
||||
void Tokenize(void);
|
||||
void PrepareTokens(void);
|
||||
void SetTokenCond(cCond *c);
|
||||
void SetIntegerCond(cCond *c);
|
||||
void SetStringCond(cCond *c);
|
||||
void SetStringCompareCond(cCond *c);
|
||||
void SetTokenIndex(cCond *c, const char *token);
|
||||
public:
|
||||
cCondition(const char *expression);
|
||||
cCondition(const cCondition &other);
|
||||
virtual ~cCondition(void);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {this->tokenContainer = tokenContainer; };
|
||||
void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; };
|
||||
void Prepare(void);
|
||||
bool True(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cNumericExpr
|
||||
******************************************************************/
|
||||
enum class eFactorType {
|
||||
constant = 0,
|
||||
stringtoken,
|
||||
inttoken,
|
||||
looptoken,
|
||||
xref,
|
||||
yref,
|
||||
widthref,
|
||||
heightref,
|
||||
areawidth,
|
||||
areaheight,
|
||||
columnwidth,
|
||||
rowheight
|
||||
};
|
||||
|
||||
class cFactor: public cListObject {
|
||||
public:
|
||||
cFactor(void) {
|
||||
multiplication = true;
|
||||
type = eFactorType::constant;
|
||||
constValue = 1.0f;
|
||||
tokenIndex = -1;
|
||||
funcRefName = NULL;
|
||||
funcRef = NULL;
|
||||
};
|
||||
cFactor(const cFactor &other) {
|
||||
multiplication = other.multiplication;
|
||||
type = other.type;
|
||||
constValue = other.constValue;
|
||||
tokenIndex = other.tokenIndex;
|
||||
funcRefName = NULL;
|
||||
if (other.funcRefName)
|
||||
funcRefName = strdup(other.funcRefName);
|
||||
funcRef = other.funcRef;
|
||||
}
|
||||
~cFactor(void) {
|
||||
free(funcRefName);
|
||||
};
|
||||
bool multiplication;
|
||||
eFactorType type;
|
||||
double constValue;
|
||||
int tokenIndex;
|
||||
char *funcRefName;
|
||||
cFunction *funcRef;
|
||||
};
|
||||
|
||||
class cSummand : public cListObject {
|
||||
public:
|
||||
cSummand(const char *summand);
|
||||
cSummand(const cSummand &other);
|
||||
~cSummand(void);
|
||||
void Debug(void);
|
||||
char *summand;
|
||||
bool positive;
|
||||
cList<cFactor> factors;
|
||||
};
|
||||
|
||||
class cNumericExpr {
|
||||
private:
|
||||
cGlobals *globals;
|
||||
cRect *container;
|
||||
skindesignerapi::cTokenContainer *tokenContainer;
|
||||
cLoopInfo *loopInfo;
|
||||
char *expr;
|
||||
cList<cSummand> summands;
|
||||
bool horizontal;
|
||||
int value;
|
||||
bool dynamic;
|
||||
//common string functions
|
||||
bool IsNumeric(const char *e);
|
||||
bool IsNumericExpression(const char *e);
|
||||
bool PercentValue(const char *e);
|
||||
char *ReplacePercentValue(char *e);
|
||||
char *ReplaceToken(char *e, const char* token, int value);
|
||||
char *ReplaceTokens(char *e, const char* token, int value);
|
||||
//calculate numeric expressions
|
||||
int EvaluateExpression(char *e);
|
||||
double EvaluateExpressionDouble(char *e);
|
||||
double ParseAtom(char*& e);
|
||||
double ParseFactors(char*& e);
|
||||
double ParseSummands(char*& e);
|
||||
//prepare expressions with tokens
|
||||
void CreateSummands(void);
|
||||
void CreateFactors(void);
|
||||
bool SetTokenFactor(cFactor *f, char *tokenName);
|
||||
bool SetReferenceFactor(cFactor *f, char *tokenName);
|
||||
bool SetGeometryFactor(cFactor *f, char *tokenName);
|
||||
void ConsolidateSummand(void);
|
||||
void ConsolidateFactors(void);
|
||||
public:
|
||||
cNumericExpr(const char *expression);
|
||||
cNumericExpr(const cNumericExpr &other);
|
||||
virtual ~cNumericExpr(void);
|
||||
void SetContainer(cRect *container) { this->container = container; };
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) { this->tokenContainer = tokenContainer; };
|
||||
void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; };
|
||||
void SetVertical(void) { horizontal = false; };
|
||||
bool CacheStatic(void);
|
||||
void PrepareTokens(void);
|
||||
vector<cFactor*> GetRefFactors(void);
|
||||
int GetValue(void) { return value; };
|
||||
bool Dynamic(void) { return dynamic; };
|
||||
int Calculate(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cColor
|
||||
******************************************************************/
|
||||
class cColor {
|
||||
private:
|
||||
cGlobals *globals;
|
||||
char *expr;
|
||||
tColor value;
|
||||
public:
|
||||
cColor(const char *expression);
|
||||
cColor(const cColor &other);
|
||||
virtual ~cColor(void);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void Cache(void);
|
||||
tColor Color(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cTextExpr
|
||||
******************************************************************/
|
||||
enum class eTexttokenType {
|
||||
constant = 0,
|
||||
stringtoken,
|
||||
inttoken,
|
||||
looptoken,
|
||||
printftoken,
|
||||
condstringtoken,
|
||||
condinttoken,
|
||||
};
|
||||
|
||||
enum class ePrintfVarType {
|
||||
stringtoken,
|
||||
inttoken,
|
||||
looptoken
|
||||
};
|
||||
|
||||
struct sPrintfInfo {
|
||||
ePrintfVarType type;
|
||||
int index;
|
||||
};
|
||||
|
||||
class cTextToken: public cListObject {
|
||||
public:
|
||||
cTextToken(void) {
|
||||
type = eTexttokenType::constant;
|
||||
constValue = NULL;
|
||||
printfExpr = NULL;
|
||||
printfResult = NULL;
|
||||
tokenIndex = -1;
|
||||
condStart = NULL;
|
||||
condEnd = NULL;
|
||||
};
|
||||
cTextToken(const cTextToken &other) {
|
||||
type = other.type;
|
||||
constValue = NULL;
|
||||
if (other.constValue)
|
||||
constValue = strdup(other.constValue);
|
||||
printfExpr = NULL;
|
||||
if (other.printfExpr)
|
||||
printfExpr = strdup(other.printfExpr);
|
||||
printfVarIndices = other.printfVarIndices;
|
||||
printfResult = NULL;
|
||||
if (other.printfResult)
|
||||
printfResult = strdup(other.printfResult);
|
||||
tokenIndex = other.tokenIndex;
|
||||
condStart = NULL;
|
||||
if (other.condStart)
|
||||
condStart = strdup(other.condStart);
|
||||
condEnd = NULL;
|
||||
if (other.condEnd)
|
||||
condEnd = strdup(other.condEnd);
|
||||
};
|
||||
~cTextToken(void) {
|
||||
free(constValue);
|
||||
free(printfExpr);
|
||||
};
|
||||
eTexttokenType type;
|
||||
char *constValue;
|
||||
int tokenIndex;
|
||||
char *printfExpr;
|
||||
vector<sPrintfInfo> printfVarIndices;
|
||||
char *printfResult;
|
||||
char *condStart;
|
||||
char *condEnd;
|
||||
};
|
||||
|
||||
class cTextExpr {
|
||||
private:
|
||||
cGlobals *globals;
|
||||
skindesignerapi::cTokenContainer *tokenContainer;
|
||||
cLoopInfo *loopInfo;
|
||||
char *expr;
|
||||
cList<cTextToken> textTokens;
|
||||
void Translate(void);
|
||||
void Tokenize(void);
|
||||
void PrepareTokens(void);
|
||||
bool CheckGlobals(cTextToken *t);
|
||||
bool ParsePrintfToken(cTextToken *t);
|
||||
void DeterminatePrintfToken(cTextToken *t);
|
||||
void ParseCondToken(cTextToken *t);
|
||||
char *CopyTextPart(char *start, char *stop, bool incLastChar= true);
|
||||
public:
|
||||
cTextExpr(const char *expression);
|
||||
cTextExpr(const cTextExpr &other);
|
||||
virtual ~cTextExpr(void);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) { this->tokenContainer = tokenContainer; };
|
||||
void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; };
|
||||
void CorrectImagePath(void);
|
||||
void Cache(void);
|
||||
char *DeterminateText(void);
|
||||
void Debug(const char *exprName);
|
||||
};
|
||||
|
||||
#endif //__COMPLEXTYPES_H
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,220 +1,220 @@
|
||||
#ifndef __FUNCTIONS_H
|
||||
#define __FUNCTIONS_H
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
class cFuncFill : public cFunction {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncFill(cArea *owner, int numAttributes);
|
||||
cFuncFill(const cFuncFill &other);
|
||||
virtual ~cFuncFill(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
};
|
||||
|
||||
class cFuncDrawRectangle : public cFunction {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncDrawRectangle(cArea *owner, int numAttributes);
|
||||
cFuncDrawRectangle(const cFuncDrawRectangle &other);
|
||||
virtual ~cFuncDrawRectangle(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
bool Blinking(void) { return GetValue((int)eDrawRectangleAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawRectangleAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawRectangleAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawRectangleAttribs::valign); };
|
||||
};
|
||||
|
||||
class cFuncDrawEllipse : public cFunction {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncDrawEllipse(cArea *owner, int numAttributes);
|
||||
cFuncDrawEllipse(const cFuncDrawEllipse &other);
|
||||
virtual ~cFuncDrawEllipse(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
bool Blinking(void) { return GetValue((int)eDrawEllipseAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawEllipseAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawEllipseAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawEllipseAttribs::valign); };
|
||||
};
|
||||
|
||||
class cFuncDrawSlope : public cFunction {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncDrawSlope(cArea *owner, int numAttributes);
|
||||
cFuncDrawSlope(const cFuncDrawSlope &other);
|
||||
virtual ~cFuncDrawSlope(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
bool Blinking(void) { return GetValue((int)eDrawSlopeAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawSlopeAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawSlopeAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawSlopeAttribs::valign); };
|
||||
};
|
||||
|
||||
class cTextDrawer {
|
||||
private:
|
||||
static cMutex fontLock;
|
||||
protected:
|
||||
const cFont *font;
|
||||
char *fontName;
|
||||
int fontSize;
|
||||
void CacheFont(cGlobals *globals, int size);
|
||||
void LoadFont(int size);
|
||||
int TextWidth(const char *text);
|
||||
int FontHeight(void);
|
||||
public:
|
||||
cTextDrawer(void);
|
||||
virtual ~cTextDrawer(void);
|
||||
};
|
||||
|
||||
class cFuncDrawText : public cFunction, public cTextDrawer {
|
||||
private:
|
||||
cTextExpr *text;
|
||||
void SetAttributesDefs(void);
|
||||
char *Cut(char *expr, int width);
|
||||
public:
|
||||
cFuncDrawText(cArea *owner, int numAttributes);
|
||||
cFuncDrawText(const cFuncDrawText &other);
|
||||
virtual ~cFuncDrawText(void);
|
||||
void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Cache(void);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
int FuncX(void);
|
||||
int FuncY(void);
|
||||
int FuncWidth(void);
|
||||
int FuncHeight(void);
|
||||
int AvrgFontWidth(void);
|
||||
const cFont *GetFont(void);
|
||||
bool Blinking(void) { return GetValue((int)eDrawTextAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawTextAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawTextAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawTextAttribs::valign); };
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cFuncDrawTextVertical : public cFunction, public cTextDrawer {
|
||||
private:
|
||||
cTextExpr *text;
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncDrawTextVertical(cArea *owner, int numAttributes);
|
||||
cFuncDrawTextVertical(const cFuncDrawTextVertical &other);
|
||||
virtual ~cFuncDrawTextVertical(void);
|
||||
void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Cache(void);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
int FuncWidth(void);
|
||||
int FuncHeight(void);
|
||||
bool Blinking(void) { return GetValue((int)eDrawTextAttribsVertical::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawTextAttribsVertical::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawTextAttribsVertical::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawTextAttribsVertical::valign); };
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cTextFloater;
|
||||
|
||||
class cFuncDrawTextBox : public cFunction, public cTextDrawer {
|
||||
private:
|
||||
cTextExpr *text;
|
||||
cTextFloater *floater;
|
||||
void SetFloater(void);
|
||||
void SetAttributesDefs(void);
|
||||
void SetFloatMode(int id, const char *val);
|
||||
public:
|
||||
cFuncDrawTextBox(cArea *owner, int numAttributes);
|
||||
cFuncDrawTextBox(const cFuncDrawTextBox &other);
|
||||
virtual ~cFuncDrawTextBox(void);
|
||||
void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Cache(void);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
int FuncWidth(void);
|
||||
int FuncHeight(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cFuncDrawImage : public cFunction {
|
||||
private:
|
||||
cTextExpr *path;
|
||||
void SetAttributesDefs(void);
|
||||
void SetImageType(int id, const char *val);
|
||||
void PreCacheImage(void);
|
||||
public:
|
||||
cFuncDrawImage(cArea *owner, int numAttributes);
|
||||
cFuncDrawImage(const cFuncDrawImage &other);
|
||||
virtual ~cFuncDrawImage(void);
|
||||
void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Cache(void);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
bool Blinking(void) { return GetValue((int)eDrawImageAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawImageAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawImageAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawImageAttribs::valign); };
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cFuncLoop : public cFunction {
|
||||
private:
|
||||
cLoopInfo loopInfo;
|
||||
cList<cFunction> functions;
|
||||
void SetAttributesDefs(void);
|
||||
int ColumnWidth(void);
|
||||
int RowHeight(void);
|
||||
public:
|
||||
cFuncLoop(cArea *owner, int numAttributes);
|
||||
virtual ~cFuncLoop(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void SetContainer(int x, int y, int width, int height);
|
||||
void Cache(void);
|
||||
void AddFunction(cFunction *f);
|
||||
cFunction *GetFunction(const char *name);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
int FuncWidth(void);
|
||||
int FuncHeight(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cTextFloater {
|
||||
private:
|
||||
char *text;
|
||||
char *eol;
|
||||
int lines;
|
||||
int lastLine;
|
||||
public:
|
||||
cTextFloater(void);
|
||||
cTextFloater(const char *text, const cFont *font, int width, int height = 0, int floatWidth = 0, int floatHeight = 0, int maxLines = 0);
|
||||
~cTextFloater();
|
||||
void Set(const char *Text, const cFont *font, int width, int height = 0, int floatWidth = 0, int floatHeight = 0, int maxLines = 0);
|
||||
///< Wraps the Text to make it fit into the area defined by the given Width
|
||||
///< when displayed with the given Font.
|
||||
///< Wrapping is done by inserting the necessary number of newline
|
||||
///< characters into the string.
|
||||
///< if height is set, new lines are only set till height is reached
|
||||
///< if floatwidth and floatheight are set, the first lines (depending on
|
||||
///< size of floatheight) are set to floatwidth
|
||||
const char *Text(void);
|
||||
///< Returns the full wrapped text.
|
||||
int Lines(void) { return lines; }
|
||||
///< Returns the actual number of lines needed to display the full wrapped text.
|
||||
const char *GetLine(int line);
|
||||
///< Returns the given Line. The first line is numbered 0.
|
||||
};
|
||||
|
||||
|
||||
#ifndef __FUNCTIONS_H
|
||||
#define __FUNCTIONS_H
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
class cFuncFill : public cFunction {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncFill(cArea *owner, int numAttributes);
|
||||
cFuncFill(const cFuncFill &other);
|
||||
virtual ~cFuncFill(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
};
|
||||
|
||||
class cFuncDrawRectangle : public cFunction {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncDrawRectangle(cArea *owner, int numAttributes);
|
||||
cFuncDrawRectangle(const cFuncDrawRectangle &other);
|
||||
virtual ~cFuncDrawRectangle(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
bool Blinking(void) { return GetValue((int)eDrawRectangleAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawRectangleAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawRectangleAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawRectangleAttribs::valign); };
|
||||
};
|
||||
|
||||
class cFuncDrawEllipse : public cFunction {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncDrawEllipse(cArea *owner, int numAttributes);
|
||||
cFuncDrawEllipse(const cFuncDrawEllipse &other);
|
||||
virtual ~cFuncDrawEllipse(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
bool Blinking(void) { return GetValue((int)eDrawEllipseAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawEllipseAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawEllipseAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawEllipseAttribs::valign); };
|
||||
};
|
||||
|
||||
class cFuncDrawSlope : public cFunction {
|
||||
private:
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncDrawSlope(cArea *owner, int numAttributes);
|
||||
cFuncDrawSlope(const cFuncDrawSlope &other);
|
||||
virtual ~cFuncDrawSlope(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
bool Blinking(void) { return GetValue((int)eDrawSlopeAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawSlopeAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawSlopeAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawSlopeAttribs::valign); };
|
||||
};
|
||||
|
||||
class cTextDrawer {
|
||||
private:
|
||||
static cMutex fontLock;
|
||||
protected:
|
||||
const cFont *font;
|
||||
char *fontName;
|
||||
int fontSize;
|
||||
void CacheFont(cGlobals *globals, int size);
|
||||
void LoadFont(int size);
|
||||
int TextWidth(const char *text);
|
||||
int FontHeight(void);
|
||||
public:
|
||||
cTextDrawer(void);
|
||||
virtual ~cTextDrawer(void);
|
||||
};
|
||||
|
||||
class cFuncDrawText : public cFunction, public cTextDrawer {
|
||||
private:
|
||||
cTextExpr *text;
|
||||
void SetAttributesDefs(void);
|
||||
char *Cut(char *expr, int width);
|
||||
public:
|
||||
cFuncDrawText(cArea *owner, int numAttributes);
|
||||
cFuncDrawText(const cFuncDrawText &other);
|
||||
virtual ~cFuncDrawText(void);
|
||||
void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Cache(void);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
int FuncX(void);
|
||||
int FuncY(void);
|
||||
int FuncWidth(void);
|
||||
int FuncHeight(void);
|
||||
int AvrgFontWidth(void);
|
||||
const cFont *GetFont(void);
|
||||
bool Blinking(void) { return GetValue((int)eDrawTextAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawTextAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawTextAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawTextAttribs::valign); };
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cFuncDrawTextVertical : public cFunction, public cTextDrawer {
|
||||
private:
|
||||
cTextExpr *text;
|
||||
void SetAttributesDefs(void);
|
||||
public:
|
||||
cFuncDrawTextVertical(cArea *owner, int numAttributes);
|
||||
cFuncDrawTextVertical(const cFuncDrawTextVertical &other);
|
||||
virtual ~cFuncDrawTextVertical(void);
|
||||
void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Cache(void);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
int FuncWidth(void);
|
||||
int FuncHeight(void);
|
||||
bool Blinking(void) { return GetValue((int)eDrawTextAttribsVertical::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawTextAttribsVertical::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawTextAttribsVertical::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawTextAttribsVertical::valign); };
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cTextFloater;
|
||||
|
||||
class cFuncDrawTextBox : public cFunction, public cTextDrawer {
|
||||
private:
|
||||
cTextExpr *text;
|
||||
cTextFloater *floater;
|
||||
void SetFloater(void);
|
||||
void SetAttributesDefs(void);
|
||||
void SetFloatMode(int id, const char *val);
|
||||
public:
|
||||
cFuncDrawTextBox(cArea *owner, int numAttributes);
|
||||
cFuncDrawTextBox(const cFuncDrawTextBox &other);
|
||||
virtual ~cFuncDrawTextBox(void);
|
||||
void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Cache(void);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
int FuncWidth(void);
|
||||
int FuncHeight(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cFuncDrawImage : public cFunction {
|
||||
private:
|
||||
cTextExpr *path;
|
||||
void SetAttributesDefs(void);
|
||||
void SetImageType(int id, const char *val);
|
||||
void PreCacheImage(void);
|
||||
public:
|
||||
cFuncDrawImage(cArea *owner, int numAttributes);
|
||||
cFuncDrawImage(const cFuncDrawImage &other);
|
||||
virtual ~cFuncDrawImage(void);
|
||||
void SetLoopInfo(cLoopInfo *loopInfo);
|
||||
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void Cache(void);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
bool Blinking(void) { return GetValue((int)eDrawImageAttribs::animtype) == (int)eAnimType::blink; };
|
||||
int BlinkFreq(void) { return GetValue((int)eDrawImageAttribs::animfreq); };
|
||||
int Align(void) { return GetValue((int)eDrawImageAttribs::align); };
|
||||
int Valign(void) { return GetValue((int)eDrawImageAttribs::valign); };
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cFuncLoop : public cFunction {
|
||||
private:
|
||||
cLoopInfo loopInfo;
|
||||
cList<cFunction> functions;
|
||||
void SetAttributesDefs(void);
|
||||
int ColumnWidth(void);
|
||||
int RowHeight(void);
|
||||
public:
|
||||
cFuncLoop(cArea *owner, int numAttributes);
|
||||
virtual ~cFuncLoop(void);
|
||||
void Set(vector<stringpair> &attributes);
|
||||
void SetContainer(int x, int y, int width, int height);
|
||||
void Cache(void);
|
||||
void AddFunction(cFunction *f);
|
||||
cFunction *GetFunction(const char *name);
|
||||
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
|
||||
int FuncWidth(void);
|
||||
int FuncHeight(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cTextFloater {
|
||||
private:
|
||||
char *text;
|
||||
char *eol;
|
||||
int lines;
|
||||
int lastLine;
|
||||
public:
|
||||
cTextFloater(void);
|
||||
cTextFloater(const char *text, const cFont *font, int width, int height = 0, int floatWidth = 0, int floatHeight = 0, int maxLines = 0);
|
||||
~cTextFloater();
|
||||
void Set(const char *Text, const cFont *font, int width, int height = 0, int floatWidth = 0, int floatHeight = 0, int maxLines = 0);
|
||||
///< Wraps the Text to make it fit into the area defined by the given Width
|
||||
///< when displayed with the given Font.
|
||||
///< Wrapping is done by inserting the necessary number of newline
|
||||
///< characters into the string.
|
||||
///< if height is set, new lines are only set till height is reached
|
||||
///< if floatwidth and floatheight are set, the first lines (depending on
|
||||
///< size of floatheight) are set to floatwidth
|
||||
const char *Text(void);
|
||||
///< Returns the full wrapped text.
|
||||
int Lines(void) { return lines; }
|
||||
///< Returns the actual number of lines needed to display the full wrapped text.
|
||||
const char *GetLine(int line);
|
||||
///< Returns the given Line. The first line is numbered 0.
|
||||
};
|
||||
|
||||
|
||||
#endif //__FUNCTIONS_H
|
||||
@@ -1,57 +1,57 @@
|
||||
#include "gridelement.h"
|
||||
#include "../config.h"
|
||||
|
||||
cGridElement::cGridElement(void) {
|
||||
current = false;
|
||||
indexCurrent = -1;
|
||||
viewId = -1;
|
||||
plugId = -1;
|
||||
}
|
||||
|
||||
cGridElement::cGridElement(const cGridElement &other) : cViewElement(other) {
|
||||
current = false;
|
||||
viewId = other.viewId;
|
||||
plugId = other.plugId;
|
||||
tokenContainer = new skindesignerapi::cTokenContainer(*other.tokenContainer);
|
||||
indexCurrent = other.indexCurrent;
|
||||
InheritTokenContainerDeep();
|
||||
}
|
||||
|
||||
cGridElement::~cGridElement(void) {
|
||||
}
|
||||
|
||||
void cGridElement::SetTokenContainer(void) {
|
||||
skindesignerapi::cTokenContainer *tkGe = plgManager->GetTokenContainerGE(plugId, viewId, id);
|
||||
if (!tkGe)
|
||||
return;
|
||||
tokenContainer = new skindesignerapi::cTokenContainer(*tkGe);
|
||||
indexCurrent = tokenContainer->GetNumDefinedIntTokens();
|
||||
tokenContainer->DefineIntToken("{current}", indexCurrent);
|
||||
InheritTokenContainer();
|
||||
}
|
||||
|
||||
void cGridElement::Set(skindesignerapi::cTokenContainer *tk) {
|
||||
tokenContainer->Clear();
|
||||
tokenContainer->SetTokens(tk);
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
void cGridElement::SetCurrent(bool current) {
|
||||
this->current = current;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
bool cGridElement::Parse(bool forced) {
|
||||
if (!dirty)
|
||||
return false;
|
||||
tokenContainer->AddIntToken(indexCurrent, current);
|
||||
return true;
|
||||
}
|
||||
|
||||
int cGridElement::Width(void) {
|
||||
return container.Width();
|
||||
}
|
||||
|
||||
int cGridElement::Height(void) {
|
||||
return container.Height();
|
||||
#include "gridelement.h"
|
||||
#include "../config.h"
|
||||
|
||||
cGridElement::cGridElement(void) {
|
||||
current = false;
|
||||
indexCurrent = -1;
|
||||
viewId = -1;
|
||||
plugId = -1;
|
||||
}
|
||||
|
||||
cGridElement::cGridElement(const cGridElement &other) : cViewElement(other) {
|
||||
current = false;
|
||||
viewId = other.viewId;
|
||||
plugId = other.plugId;
|
||||
tokenContainer = new skindesignerapi::cTokenContainer(*other.tokenContainer);
|
||||
indexCurrent = other.indexCurrent;
|
||||
InheritTokenContainerDeep();
|
||||
}
|
||||
|
||||
cGridElement::~cGridElement(void) {
|
||||
}
|
||||
|
||||
void cGridElement::SetTokenContainer(void) {
|
||||
skindesignerapi::cTokenContainer *tkGe = plgManager->GetTokenContainerGE(plugId, viewId, id);
|
||||
if (!tkGe)
|
||||
return;
|
||||
tokenContainer = new skindesignerapi::cTokenContainer(*tkGe);
|
||||
indexCurrent = tokenContainer->GetNumDefinedIntTokens();
|
||||
tokenContainer->DefineIntToken("{current}", indexCurrent);
|
||||
InheritTokenContainer();
|
||||
}
|
||||
|
||||
void cGridElement::Set(skindesignerapi::cTokenContainer *tk) {
|
||||
tokenContainer->Clear();
|
||||
tokenContainer->SetTokens(tk);
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
void cGridElement::SetCurrent(bool current) {
|
||||
this->current = current;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
bool cGridElement::Parse(bool forced) {
|
||||
if (!dirty)
|
||||
return false;
|
||||
tokenContainer->AddIntToken(indexCurrent, current);
|
||||
return true;
|
||||
}
|
||||
|
||||
int cGridElement::Width(void) {
|
||||
return container.Width();
|
||||
}
|
||||
|
||||
int cGridElement::Height(void) {
|
||||
return container.Height();
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
#ifndef __GRIDELEMENT_H
|
||||
#define __GRIDELEMENT_H
|
||||
|
||||
#include "viewelement.h"
|
||||
|
||||
class cGridElement : public cViewElement {
|
||||
private:
|
||||
int viewId;
|
||||
int plugId;
|
||||
bool current;
|
||||
int indexCurrent;
|
||||
public:
|
||||
cGridElement(void);
|
||||
cGridElement(const cGridElement &other);
|
||||
virtual ~cGridElement(void);
|
||||
void SetPluginId(int plugId) { this->plugId = plugId; };
|
||||
void SetViewId(int viewId) { this->viewId = viewId; };
|
||||
void SetTokenContainer(void);
|
||||
skindesignerapi::cTokenContainer *GetTokenContainer(void) { return tokenContainer; };
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
void SetCurrent(bool current);
|
||||
bool Parse(bool forced = true);
|
||||
int Width(void);
|
||||
int Height(void);
|
||||
};
|
||||
|
||||
#ifndef __GRIDELEMENT_H
|
||||
#define __GRIDELEMENT_H
|
||||
|
||||
#include "viewelement.h"
|
||||
|
||||
class cGridElement : public cViewElement {
|
||||
private:
|
||||
int viewId;
|
||||
int plugId;
|
||||
bool current;
|
||||
int indexCurrent;
|
||||
public:
|
||||
cGridElement(void);
|
||||
cGridElement(const cGridElement &other);
|
||||
virtual ~cGridElement(void);
|
||||
void SetPluginId(int plugId) { this->plugId = plugId; };
|
||||
void SetViewId(int viewId) { this->viewId = viewId; };
|
||||
void SetTokenContainer(void);
|
||||
skindesignerapi::cTokenContainer *GetTokenContainer(void) { return tokenContainer; };
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
void SetCurrent(bool current);
|
||||
bool Parse(bool forced = true);
|
||||
int Width(void);
|
||||
int Height(void);
|
||||
};
|
||||
|
||||
#endif //__GRIDELEMENT_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,340 +1,340 @@
|
||||
#ifndef __LISTELEMENTS_H
|
||||
#define __LISTELEMENTS_H
|
||||
|
||||
#include "viewelement.h"
|
||||
#include "../extensions/scrapmanager.h"
|
||||
|
||||
#define MAX_TABS 6
|
||||
/******************************************************************
|
||||
* cListElement
|
||||
******************************************************************/
|
||||
class cListElement : public cViewElement {
|
||||
protected:
|
||||
eMenuCategory menuCat;
|
||||
int num;
|
||||
bool current;
|
||||
bool wasCurrent;
|
||||
bool selectable;
|
||||
cViewElement *currentElement;
|
||||
char *ParseSeparator(const char *text);
|
||||
public:
|
||||
cListElement(void);
|
||||
cListElement(const cListElement &other);
|
||||
virtual ~cListElement(void) {};
|
||||
void SetMenuCategory(eMenuCategory menuCat) { this->menuCat = menuCat; };
|
||||
void SetNumber(int number) { num = number; };
|
||||
void SetCurrent(bool cur);
|
||||
bool Current(void) { return current; };
|
||||
void WakeCurrent(void);
|
||||
void SetSelectable(bool sel) { selectable = sel; };
|
||||
bool DoScroll(void) { return current; };
|
||||
virtual void RenderCurrent(void) { };
|
||||
void Close(void);
|
||||
void Clear(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCurrentElement
|
||||
******************************************************************/
|
||||
class cCurrentElement : public cViewElement {
|
||||
protected:
|
||||
int listX;
|
||||
int listY;
|
||||
int listWidth;
|
||||
int listHeight;
|
||||
public:
|
||||
cCurrentElement(void);
|
||||
virtual ~cCurrentElement(void) {};
|
||||
void SetListPosition(int x, int y, int width, int height);
|
||||
void SetListTokens(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuDefault
|
||||
******************************************************************/
|
||||
class cLeMenuDefault : public cListElement {
|
||||
private:
|
||||
char *text;
|
||||
int *colX;
|
||||
int *colWidths;
|
||||
const char *plugName;
|
||||
const char *GetTabbedText(const char *s, int tab);
|
||||
void SetMenuCategory(void);
|
||||
void CheckProgressBar(const char *text, int tab);
|
||||
public:
|
||||
cLeMenuDefault(void);
|
||||
cLeMenuDefault(const cLeMenuDefault &other);
|
||||
virtual ~cLeMenuDefault(void);
|
||||
void SetListInfo(int *colX, int *colWidths);
|
||||
void SetText(const char *text);
|
||||
void SetPlugin(const char *plugName) { this->plugName = plugName; };
|
||||
void SetTokenContainer(void);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cVeMenuMain
|
||||
******************************************************************/
|
||||
class cVeMenuMain {
|
||||
protected:
|
||||
char *text;
|
||||
char *number;
|
||||
char *label;
|
||||
void SplitText(void);
|
||||
public:
|
||||
cVeMenuMain(void);
|
||||
virtual ~cVeMenuMain(void);
|
||||
void SetText(const char *text);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuMain
|
||||
******************************************************************/
|
||||
class cCeMenuMain;
|
||||
class cLeMenuMain : public cListElement, public cVeMenuMain {
|
||||
private:
|
||||
cCeMenuMain *currentMain;
|
||||
public:
|
||||
cLeMenuMain(void);
|
||||
cLeMenuMain(const cLeMenuMain &other);
|
||||
virtual ~cLeMenuMain(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuMain *cur) { currentMain = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void SetText(const char *text);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
const char *PluginName(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuMain
|
||||
******************************************************************/
|
||||
class cCeMenuMain : public cCurrentElement, public cVeMenuMain {
|
||||
private:
|
||||
public:
|
||||
cCeMenuMain(void);
|
||||
virtual ~cCeMenuMain(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetText(const char *text);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cVeMenuSchedules
|
||||
******************************************************************/
|
||||
class cVeMenuSchedules {
|
||||
protected:
|
||||
const cEvent *event;
|
||||
const cChannel *channel;
|
||||
bool withDate;
|
||||
eTimerMatch timerMatch;
|
||||
bool epgSearchFav;
|
||||
public:
|
||||
cVeMenuSchedules(void);
|
||||
virtual ~cVeMenuSchedules(void){};
|
||||
void SetEpgSearchFav(bool isFav) { epgSearchFav = isFav; };
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuSchedules
|
||||
******************************************************************/
|
||||
class cCeMenuSchedules;
|
||||
class cLeMenuSchedules : public cListElement, public cVeMenuSchedules {
|
||||
private:
|
||||
cCeMenuSchedules *currentSchedules;
|
||||
public:
|
||||
cLeMenuSchedules(void);
|
||||
cLeMenuSchedules(const cLeMenuSchedules &other);
|
||||
virtual ~cLeMenuSchedules(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuSchedules *cur) { currentSchedules = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(const cEvent *event, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuSchedules
|
||||
******************************************************************/
|
||||
class cCeMenuSchedules : public cCurrentElement, public cVeMenuSchedules, public cScrapManager {
|
||||
private:
|
||||
eMenuCategory menuCat;
|
||||
int schedulesIndex;
|
||||
public:
|
||||
cCeMenuSchedules(void);
|
||||
virtual ~cCeMenuSchedules(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const cEvent *event, const cChannel *channel, bool withDate, eTimerMatch timerMatch, eMenuCategory menuCat);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuChannels
|
||||
******************************************************************/
|
||||
class cCeMenuChannels;
|
||||
class cLeMenuChannels : public cListElement {
|
||||
private:
|
||||
cCeMenuChannels *currentChannel;
|
||||
const cChannel *channel;
|
||||
bool withProvider;
|
||||
public:
|
||||
cLeMenuChannels(void);
|
||||
cLeMenuChannels(const cLeMenuChannels &other);
|
||||
virtual ~cLeMenuChannels(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuChannels *cur) { currentChannel = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(const cChannel *channel, bool withProvider);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuChannels
|
||||
******************************************************************/
|
||||
class cCeMenuChannels : public cCurrentElement {
|
||||
private:
|
||||
const cChannel *channel;
|
||||
bool withProvider;
|
||||
int schedulesIndex;
|
||||
public:
|
||||
cCeMenuChannels(void);
|
||||
virtual ~cCeMenuChannels(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const cChannel *channel, bool withProvider);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuTimers
|
||||
******************************************************************/
|
||||
class cCeMenuTimers;
|
||||
class cLeMenuTimers : public cListElement {
|
||||
private:
|
||||
cCeMenuTimers *currentTimer;
|
||||
const cTimer *timer;
|
||||
public:
|
||||
cLeMenuTimers(void);
|
||||
cLeMenuTimers(const cLeMenuTimers &other);
|
||||
virtual ~cLeMenuTimers(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuTimers *cur) { currentTimer = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(const cTimer *timer);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuTimers
|
||||
******************************************************************/
|
||||
class cCeMenuTimers : public cCurrentElement {
|
||||
private:
|
||||
const cTimer *timer;
|
||||
public:
|
||||
cCeMenuTimers(void);
|
||||
virtual ~cCeMenuTimers(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const cTimer *timer);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuRecordings
|
||||
******************************************************************/
|
||||
class cCeMenuRecordings;
|
||||
class cLeMenuRecordings : public cListElement, public cScrapManager {
|
||||
private:
|
||||
cCeMenuRecordings *currentRecording;
|
||||
const cRecording *recording;
|
||||
int level;
|
||||
int total;
|
||||
int New;
|
||||
char *RecName(const char *path, int level);
|
||||
char *FolderName(const char *path, int level);
|
||||
public:
|
||||
cLeMenuRecordings(void);
|
||||
cLeMenuRecordings(const cLeMenuRecordings &other);
|
||||
virtual ~cLeMenuRecordings(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuRecordings *cur) { currentRecording = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(const cRecording *recording, int level, int total, int New);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuRecordings
|
||||
******************************************************************/
|
||||
class cCeMenuRecordings : public cCurrentElement, public cScrapManager {
|
||||
private:
|
||||
const cRecording *recording;
|
||||
int level;
|
||||
int total;
|
||||
int New;
|
||||
public:
|
||||
cCeMenuRecordings(void);
|
||||
virtual ~cCeMenuRecordings(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const cRecording *recording, int level, int total, int New);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuPlugin
|
||||
******************************************************************/
|
||||
class cCeMenuPlugin;
|
||||
class cLeMenuPlugin : public cListElement {
|
||||
private:
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
cCeMenuPlugin *currentPlugin;
|
||||
public:
|
||||
cLeMenuPlugin(void);
|
||||
cLeMenuPlugin(const cLeMenuPlugin &other);
|
||||
virtual ~cLeMenuPlugin(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetPlugId(int id) { plugId = id; };
|
||||
void SetPlugMenuId(int id) { plugMenuId = id; };
|
||||
void SetCurrentElement(cCeMenuPlugin *cur) { currentPlugin = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuPlugin
|
||||
******************************************************************/
|
||||
class cCeMenuPlugin : public cCurrentElement {
|
||||
private:
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
public:
|
||||
cCeMenuPlugin(void);
|
||||
virtual ~cCeMenuPlugin(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetPlugId(int id) { plugId = id; };
|
||||
void SetPlugMenuId(int id) { plugMenuId = id; };
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeAudioTracks
|
||||
******************************************************************/
|
||||
class cLeAudioTracks : public cListElement {
|
||||
private:
|
||||
char *text;
|
||||
public:
|
||||
cLeAudioTracks(void);
|
||||
virtual ~cLeAudioTracks(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const char *text);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
#ifndef __LISTELEMENTS_H
|
||||
#define __LISTELEMENTS_H
|
||||
|
||||
#include "viewelement.h"
|
||||
#include "../extensions/scrapmanager.h"
|
||||
|
||||
#define MAX_TABS 6
|
||||
/******************************************************************
|
||||
* cListElement
|
||||
******************************************************************/
|
||||
class cListElement : public cViewElement {
|
||||
protected:
|
||||
eMenuCategory menuCat;
|
||||
int num;
|
||||
bool current;
|
||||
bool wasCurrent;
|
||||
bool selectable;
|
||||
cViewElement *currentElement;
|
||||
char *ParseSeparator(const char *text);
|
||||
public:
|
||||
cListElement(void);
|
||||
cListElement(const cListElement &other);
|
||||
virtual ~cListElement(void) {};
|
||||
void SetMenuCategory(eMenuCategory menuCat) { this->menuCat = menuCat; };
|
||||
void SetNumber(int number) { num = number; };
|
||||
void SetCurrent(bool cur);
|
||||
bool Current(void) { return current; };
|
||||
void WakeCurrent(void);
|
||||
void SetSelectable(bool sel) { selectable = sel; };
|
||||
bool DoScroll(void) { return current; };
|
||||
virtual void RenderCurrent(void) { };
|
||||
void Close(void);
|
||||
void Clear(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCurrentElement
|
||||
******************************************************************/
|
||||
class cCurrentElement : public cViewElement {
|
||||
protected:
|
||||
int listX;
|
||||
int listY;
|
||||
int listWidth;
|
||||
int listHeight;
|
||||
public:
|
||||
cCurrentElement(void);
|
||||
virtual ~cCurrentElement(void) {};
|
||||
void SetListPosition(int x, int y, int width, int height);
|
||||
void SetListTokens(skindesignerapi::cTokenContainer *tokenContainer);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuDefault
|
||||
******************************************************************/
|
||||
class cLeMenuDefault : public cListElement {
|
||||
private:
|
||||
char *text;
|
||||
int *colX;
|
||||
int *colWidths;
|
||||
const char *plugName;
|
||||
const char *GetTabbedText(const char *s, int tab);
|
||||
void SetMenuCategory(void);
|
||||
void CheckProgressBar(const char *text, int tab);
|
||||
public:
|
||||
cLeMenuDefault(void);
|
||||
cLeMenuDefault(const cLeMenuDefault &other);
|
||||
virtual ~cLeMenuDefault(void);
|
||||
void SetListInfo(int *colX, int *colWidths);
|
||||
void SetText(const char *text);
|
||||
void SetPlugin(const char *plugName) { this->plugName = plugName; };
|
||||
void SetTokenContainer(void);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cVeMenuMain
|
||||
******************************************************************/
|
||||
class cVeMenuMain {
|
||||
protected:
|
||||
char *text;
|
||||
char *number;
|
||||
char *label;
|
||||
void SplitText(void);
|
||||
public:
|
||||
cVeMenuMain(void);
|
||||
virtual ~cVeMenuMain(void);
|
||||
void SetText(const char *text);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuMain
|
||||
******************************************************************/
|
||||
class cCeMenuMain;
|
||||
class cLeMenuMain : public cListElement, public cVeMenuMain {
|
||||
private:
|
||||
cCeMenuMain *currentMain;
|
||||
public:
|
||||
cLeMenuMain(void);
|
||||
cLeMenuMain(const cLeMenuMain &other);
|
||||
virtual ~cLeMenuMain(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuMain *cur) { currentMain = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void SetText(const char *text);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
const char *PluginName(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuMain
|
||||
******************************************************************/
|
||||
class cCeMenuMain : public cCurrentElement, public cVeMenuMain {
|
||||
private:
|
||||
public:
|
||||
cCeMenuMain(void);
|
||||
virtual ~cCeMenuMain(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetText(const char *text);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cVeMenuSchedules
|
||||
******************************************************************/
|
||||
class cVeMenuSchedules {
|
||||
protected:
|
||||
const cEvent *event;
|
||||
const cChannel *channel;
|
||||
bool withDate;
|
||||
eTimerMatch timerMatch;
|
||||
bool epgSearchFav;
|
||||
public:
|
||||
cVeMenuSchedules(void);
|
||||
virtual ~cVeMenuSchedules(void){};
|
||||
void SetEpgSearchFav(bool isFav) { epgSearchFav = isFav; };
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuSchedules
|
||||
******************************************************************/
|
||||
class cCeMenuSchedules;
|
||||
class cLeMenuSchedules : public cListElement, public cVeMenuSchedules {
|
||||
private:
|
||||
cCeMenuSchedules *currentSchedules;
|
||||
public:
|
||||
cLeMenuSchedules(void);
|
||||
cLeMenuSchedules(const cLeMenuSchedules &other);
|
||||
virtual ~cLeMenuSchedules(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuSchedules *cur) { currentSchedules = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(const cEvent *event, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuSchedules
|
||||
******************************************************************/
|
||||
class cCeMenuSchedules : public cCurrentElement, public cVeMenuSchedules, public cScrapManager {
|
||||
private:
|
||||
eMenuCategory menuCat;
|
||||
int schedulesIndex;
|
||||
public:
|
||||
cCeMenuSchedules(void);
|
||||
virtual ~cCeMenuSchedules(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const cEvent *event, const cChannel *channel, bool withDate, eTimerMatch timerMatch, eMenuCategory menuCat);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuChannels
|
||||
******************************************************************/
|
||||
class cCeMenuChannels;
|
||||
class cLeMenuChannels : public cListElement {
|
||||
private:
|
||||
cCeMenuChannels *currentChannel;
|
||||
const cChannel *channel;
|
||||
bool withProvider;
|
||||
public:
|
||||
cLeMenuChannels(void);
|
||||
cLeMenuChannels(const cLeMenuChannels &other);
|
||||
virtual ~cLeMenuChannels(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuChannels *cur) { currentChannel = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(const cChannel *channel, bool withProvider);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuChannels
|
||||
******************************************************************/
|
||||
class cCeMenuChannels : public cCurrentElement {
|
||||
private:
|
||||
const cChannel *channel;
|
||||
bool withProvider;
|
||||
int schedulesIndex;
|
||||
public:
|
||||
cCeMenuChannels(void);
|
||||
virtual ~cCeMenuChannels(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const cChannel *channel, bool withProvider);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuTimers
|
||||
******************************************************************/
|
||||
class cCeMenuTimers;
|
||||
class cLeMenuTimers : public cListElement {
|
||||
private:
|
||||
cCeMenuTimers *currentTimer;
|
||||
const cTimer *timer;
|
||||
public:
|
||||
cLeMenuTimers(void);
|
||||
cLeMenuTimers(const cLeMenuTimers &other);
|
||||
virtual ~cLeMenuTimers(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuTimers *cur) { currentTimer = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(const cTimer *timer);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuTimers
|
||||
******************************************************************/
|
||||
class cCeMenuTimers : public cCurrentElement {
|
||||
private:
|
||||
const cTimer *timer;
|
||||
public:
|
||||
cCeMenuTimers(void);
|
||||
virtual ~cCeMenuTimers(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const cTimer *timer);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuRecordings
|
||||
******************************************************************/
|
||||
class cCeMenuRecordings;
|
||||
class cLeMenuRecordings : public cListElement, public cScrapManager {
|
||||
private:
|
||||
cCeMenuRecordings *currentRecording;
|
||||
const cRecording *recording;
|
||||
int level;
|
||||
int total;
|
||||
int New;
|
||||
char *RecName(const char *path, int level);
|
||||
char *FolderName(const char *path, int level);
|
||||
public:
|
||||
cLeMenuRecordings(void);
|
||||
cLeMenuRecordings(const cLeMenuRecordings &other);
|
||||
virtual ~cLeMenuRecordings(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetCurrentElement(cCeMenuRecordings *cur) { currentRecording = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(const cRecording *recording, int level, int total, int New);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuRecordings
|
||||
******************************************************************/
|
||||
class cCeMenuRecordings : public cCurrentElement, public cScrapManager {
|
||||
private:
|
||||
const cRecording *recording;
|
||||
int level;
|
||||
int total;
|
||||
int New;
|
||||
public:
|
||||
cCeMenuRecordings(void);
|
||||
virtual ~cCeMenuRecordings(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const cRecording *recording, int level, int total, int New);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeMenuPlugin
|
||||
******************************************************************/
|
||||
class cCeMenuPlugin;
|
||||
class cLeMenuPlugin : public cListElement {
|
||||
private:
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
cCeMenuPlugin *currentPlugin;
|
||||
public:
|
||||
cLeMenuPlugin(void);
|
||||
cLeMenuPlugin(const cLeMenuPlugin &other);
|
||||
virtual ~cLeMenuPlugin(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetPlugId(int id) { plugId = id; };
|
||||
void SetPlugMenuId(int id) { plugMenuId = id; };
|
||||
void SetCurrentElement(cCeMenuPlugin *cur) { currentPlugin = cur; currentElement = (cViewElement*)cur; };
|
||||
void ClearCurrentElement(void);
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
bool Parse(bool forced = true);
|
||||
void RenderCurrent(void);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cCeMenuPlugin
|
||||
******************************************************************/
|
||||
class cCeMenuPlugin : public cCurrentElement {
|
||||
private:
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
public:
|
||||
cCeMenuPlugin(void);
|
||||
virtual ~cCeMenuPlugin(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetPlugId(int id) { plugId = id; };
|
||||
void SetPlugMenuId(int id) { plugMenuId = id; };
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cLeAudioTracks
|
||||
******************************************************************/
|
||||
class cLeAudioTracks : public cListElement {
|
||||
private:
|
||||
char *text;
|
||||
public:
|
||||
cLeAudioTracks(void);
|
||||
virtual ~cLeAudioTracks(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(const char *text);
|
||||
bool Parse(bool forced = true);
|
||||
};
|
||||
|
||||
#endif //__LISTELEMENTS_H
|
||||
@@ -1,71 +1,71 @@
|
||||
#include "osdwrapper.h"
|
||||
|
||||
cSdOsd::cSdOsd(void) {
|
||||
osd = NULL;
|
||||
flushLocked = false;
|
||||
}
|
||||
|
||||
cSdOsd::~cSdOsd(void) {
|
||||
DeleteOsd();
|
||||
}
|
||||
|
||||
void cSdOsd::Lock(void) {
|
||||
mutex.Lock();
|
||||
}
|
||||
|
||||
void cSdOsd::Unlock(void) {
|
||||
mutex.Unlock();
|
||||
}
|
||||
|
||||
void cSdOsd::LockFlush(void) {
|
||||
Lock();
|
||||
flushLocked = true;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
void cSdOsd::UnlockFlush(void) {
|
||||
Lock();
|
||||
flushLocked = false;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
bool cSdOsd::CreateOsd(int x, int y, int width, int height) {
|
||||
cOsd *newOsd = cOsdProvider::NewOsd(cOsd::OsdLeft() + x, cOsd::OsdTop() + y);
|
||||
if (newOsd) {
|
||||
tArea Area = { 0, 0, width - 1, height - 1, 32 };
|
||||
if (newOsd->SetAreas(&Area, 1) == oeOk) {
|
||||
Lock();
|
||||
osd = newOsd;
|
||||
Unlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void cSdOsd::DeleteOsd(void) {
|
||||
Lock();
|
||||
delete osd;
|
||||
osd = NULL;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
cPixmap *cSdOsd::CreatePixmap(int layer, cRect &viewPort, cRect &drawPort) {
|
||||
if (osd) {
|
||||
return osd->CreatePixmap(layer, viewPort, drawPort);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void cSdOsd::DestroyPixmap(cPixmap *pix) {
|
||||
if (osd) {
|
||||
osd->DestroyPixmap(pix);
|
||||
}
|
||||
}
|
||||
|
||||
void cSdOsd::Flush(void) {
|
||||
Lock();
|
||||
if (osd && !flushLocked)
|
||||
osd->Flush();
|
||||
Unlock();
|
||||
}
|
||||
#include "osdwrapper.h"
|
||||
|
||||
cSdOsd::cSdOsd(void) {
|
||||
osd = NULL;
|
||||
flushLocked = false;
|
||||
}
|
||||
|
||||
cSdOsd::~cSdOsd(void) {
|
||||
DeleteOsd();
|
||||
}
|
||||
|
||||
void cSdOsd::Lock(void) {
|
||||
mutex.Lock();
|
||||
}
|
||||
|
||||
void cSdOsd::Unlock(void) {
|
||||
mutex.Unlock();
|
||||
}
|
||||
|
||||
void cSdOsd::LockFlush(void) {
|
||||
Lock();
|
||||
flushLocked = true;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
void cSdOsd::UnlockFlush(void) {
|
||||
Lock();
|
||||
flushLocked = false;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
bool cSdOsd::CreateOsd(int x, int y, int width, int height) {
|
||||
cOsd *newOsd = cOsdProvider::NewOsd(cOsd::OsdLeft() + x, cOsd::OsdTop() + y);
|
||||
if (newOsd) {
|
||||
tArea Area = { 0, 0, width - 1, height - 1, 32 };
|
||||
if (newOsd->SetAreas(&Area, 1) == oeOk) {
|
||||
Lock();
|
||||
osd = newOsd;
|
||||
Unlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void cSdOsd::DeleteOsd(void) {
|
||||
Lock();
|
||||
delete osd;
|
||||
osd = NULL;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
cPixmap *cSdOsd::CreatePixmap(int layer, cRect &viewPort, cRect &drawPort) {
|
||||
if (osd) {
|
||||
return osd->CreatePixmap(layer, viewPort, drawPort);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void cSdOsd::DestroyPixmap(cPixmap *pix) {
|
||||
if (osd) {
|
||||
osd->DestroyPixmap(pix);
|
||||
}
|
||||
}
|
||||
|
||||
void cSdOsd::Flush(void) {
|
||||
Lock();
|
||||
if (osd && !flushLocked)
|
||||
osd->Flush();
|
||||
Unlock();
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
#ifndef __OSDWRAPPER_H
|
||||
#define __OSDWRAPPER_H
|
||||
|
||||
#include <vdr/osd.h>
|
||||
#include <vdr/thread.h>
|
||||
|
||||
class cSdOsd {
|
||||
private:
|
||||
cOsd *osd;
|
||||
cMutex mutex;
|
||||
bool flushLocked;
|
||||
public:
|
||||
cSdOsd(void);
|
||||
virtual ~cSdOsd(void);
|
||||
void Lock(void);
|
||||
void Unlock(void);
|
||||
void LockFlush(void);
|
||||
void UnlockFlush(void);
|
||||
bool CreateOsd(int x, int y, int width, int height);
|
||||
void DeleteOsd(void);
|
||||
cPixmap *CreatePixmap(int layer, cRect &viewPort, cRect &drawPort);
|
||||
void DestroyPixmap(cPixmap *pix);
|
||||
void Flush(void);
|
||||
};
|
||||
|
||||
#ifndef __OSDWRAPPER_H
|
||||
#define __OSDWRAPPER_H
|
||||
|
||||
#include <vdr/osd.h>
|
||||
#include <vdr/thread.h>
|
||||
|
||||
class cSdOsd {
|
||||
private:
|
||||
cOsd *osd;
|
||||
cMutex mutex;
|
||||
bool flushLocked;
|
||||
public:
|
||||
cSdOsd(void);
|
||||
virtual ~cSdOsd(void);
|
||||
void Lock(void);
|
||||
void Unlock(void);
|
||||
void LockFlush(void);
|
||||
void UnlockFlush(void);
|
||||
bool CreateOsd(int x, int y, int width, int height);
|
||||
void DeleteOsd(void);
|
||||
cPixmap *CreatePixmap(int layer, cRect &viewPort, cRect &drawPort);
|
||||
void DestroyPixmap(cPixmap *pix);
|
||||
void Flush(void);
|
||||
};
|
||||
|
||||
#endif //__OSDWRAPPER_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,114 +1,114 @@
|
||||
#ifndef __VIEWDETAIL_H
|
||||
#define __VIEWDETAIL_H
|
||||
|
||||
#include "../services/epgsearch.h"
|
||||
#include "../extensions/scrapmanager.h"
|
||||
#include "viewelement.h"
|
||||
/******************************************************************
|
||||
* cViewDetail
|
||||
******************************************************************/
|
||||
class cViewDetail : public cViewElement, public cScrapManager {
|
||||
protected:
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
cArea *activeTab;
|
||||
int activeTabIndex;
|
||||
int numTabs;
|
||||
void SetActiveTab(void);
|
||||
public:
|
||||
cViewDetail(void);
|
||||
virtual ~cViewDetail(void);
|
||||
void SetPlugId(int id) { plugId = id; };
|
||||
void SetPlugMenuId(int id) { plugMenuId = id; };
|
||||
int GetWidth(void);
|
||||
void ResetTabs(void);
|
||||
void Clear(void);
|
||||
void Close(void);
|
||||
void Render(void);
|
||||
void Scrollbar(int &barheight, int &offset, bool &end);
|
||||
bool ScrollUp(bool page = false);
|
||||
bool ScrollDown(bool page = false);
|
||||
int GetTabs(vector<const char*> &tabs);
|
||||
int NumTabs(void) { return numTabs; };
|
||||
int ActiveTab(void) { return activeTabIndex; };
|
||||
void NextTab(void);
|
||||
void PrevTab(void);
|
||||
void SetTransparency(int transparency, bool forceDetached = false);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewDetailEpg
|
||||
******************************************************************/
|
||||
class cViewDetailEpg : public cViewDetail {
|
||||
protected:
|
||||
const cEvent *event;
|
||||
int rerunsIndex;
|
||||
int actorsIndex;
|
||||
cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *LoadReruns(void);
|
||||
int NumReruns(cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *reruns);
|
||||
void SetReruns(cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *reruns);
|
||||
public:
|
||||
cViewDetailEpg(void);
|
||||
virtual ~cViewDetailEpg(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetEvent(const cEvent *event) { this->event = event; };
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewDetailRec
|
||||
******************************************************************/
|
||||
class cViewDetailRec : public cViewDetail {
|
||||
protected:
|
||||
const cRecording *recording;
|
||||
int actorsIndex;
|
||||
void SetRecInfos(void);
|
||||
int ReadSizeVdr(const char *strPath);
|
||||
string StripXmlTag(string &Line, const char *Tag);
|
||||
void SetRecordingImages(const char *recPath);
|
||||
public:
|
||||
cViewDetailRec(void);
|
||||
virtual ~cViewDetailRec(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetRecording(const cRecording *recording) { this->recording = recording; };
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewDetailText
|
||||
******************************************************************/
|
||||
class cViewDetailText : public cViewDetail {
|
||||
protected:
|
||||
const char *text;
|
||||
public:
|
||||
cViewDetailText(void);
|
||||
virtual ~cViewDetailText(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetText(const char *text) { this->text = text; };
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cViewDetailPlugin
|
||||
******************************************************************/
|
||||
class cViewDetailPlugin : public cViewDetail {
|
||||
protected:
|
||||
public:
|
||||
cViewDetailPlugin(void);
|
||||
virtual ~cViewDetailPlugin(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cViewDetailAdvancedPlugin
|
||||
******************************************************************/
|
||||
class cViewDetailAdvancedPlugin : public cViewDetail {
|
||||
protected:
|
||||
int plugViewId;
|
||||
public:
|
||||
cViewDetailAdvancedPlugin(int viewId, int plugId);
|
||||
virtual ~cViewDetailAdvancedPlugin(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
#ifndef __VIEWDETAIL_H
|
||||
#define __VIEWDETAIL_H
|
||||
|
||||
#include "../services/epgsearch.h"
|
||||
#include "../extensions/scrapmanager.h"
|
||||
#include "viewelement.h"
|
||||
/******************************************************************
|
||||
* cViewDetail
|
||||
******************************************************************/
|
||||
class cViewDetail : public cViewElement, public cScrapManager {
|
||||
protected:
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
cArea *activeTab;
|
||||
int activeTabIndex;
|
||||
int numTabs;
|
||||
void SetActiveTab(void);
|
||||
public:
|
||||
cViewDetail(void);
|
||||
virtual ~cViewDetail(void);
|
||||
void SetPlugId(int id) { plugId = id; };
|
||||
void SetPlugMenuId(int id) { plugMenuId = id; };
|
||||
int GetWidth(void);
|
||||
void ResetTabs(void);
|
||||
void Clear(void);
|
||||
void Close(void);
|
||||
void Render(void);
|
||||
void Scrollbar(int &barheight, int &offset, bool &end);
|
||||
bool ScrollUp(bool page = false);
|
||||
bool ScrollDown(bool page = false);
|
||||
int GetTabs(vector<const char*> &tabs);
|
||||
int NumTabs(void) { return numTabs; };
|
||||
int ActiveTab(void) { return activeTabIndex; };
|
||||
void NextTab(void);
|
||||
void PrevTab(void);
|
||||
void SetTransparency(int transparency, bool forceDetached = false);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewDetailEpg
|
||||
******************************************************************/
|
||||
class cViewDetailEpg : public cViewDetail {
|
||||
protected:
|
||||
const cEvent *event;
|
||||
int rerunsIndex;
|
||||
int actorsIndex;
|
||||
cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *LoadReruns(void);
|
||||
int NumReruns(cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *reruns);
|
||||
void SetReruns(cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *reruns);
|
||||
public:
|
||||
cViewDetailEpg(void);
|
||||
virtual ~cViewDetailEpg(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetEvent(const cEvent *event) { this->event = event; };
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewDetailRec
|
||||
******************************************************************/
|
||||
class cViewDetailRec : public cViewDetail {
|
||||
protected:
|
||||
const cRecording *recording;
|
||||
int actorsIndex;
|
||||
void SetRecInfos(void);
|
||||
int ReadSizeVdr(const char *strPath);
|
||||
string StripXmlTag(string &Line, const char *Tag);
|
||||
void SetRecordingImages(const char *recPath);
|
||||
public:
|
||||
cViewDetailRec(void);
|
||||
virtual ~cViewDetailRec(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetRecording(const cRecording *recording) { this->recording = recording; };
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
/******************************************************************
|
||||
* cViewDetailText
|
||||
******************************************************************/
|
||||
class cViewDetailText : public cViewDetail {
|
||||
protected:
|
||||
const char *text;
|
||||
public:
|
||||
cViewDetailText(void);
|
||||
virtual ~cViewDetailText(void);
|
||||
void SetTokenContainer(void);
|
||||
void SetText(const char *text) { this->text = text; };
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cViewDetailPlugin
|
||||
******************************************************************/
|
||||
class cViewDetailPlugin : public cViewDetail {
|
||||
protected:
|
||||
public:
|
||||
cViewDetailPlugin(void);
|
||||
virtual ~cViewDetailPlugin(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* cViewDetailAdvancedPlugin
|
||||
******************************************************************/
|
||||
class cViewDetailAdvancedPlugin : public cViewDetail {
|
||||
protected:
|
||||
int plugViewId;
|
||||
public:
|
||||
cViewDetailAdvancedPlugin(int viewId, int plugId);
|
||||
virtual ~cViewDetailAdvancedPlugin(void);
|
||||
void SetTokenContainer(void);
|
||||
void Set(skindesignerapi::cTokenContainer *tk);
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
#endif //__VIEWDETAIL_H
|
||||
@@ -1,199 +1,199 @@
|
||||
#include "viewdisplaychannel.h"
|
||||
#include "../config.h"
|
||||
|
||||
/************************************************************************************
|
||||
* cViewChannel
|
||||
************************************************************************************/
|
||||
|
||||
cViewChannel::cViewChannel(void) {
|
||||
veCustomTokens = NULL;
|
||||
ClearVariables();
|
||||
viewId = eViewType::DisplayChannel;
|
||||
viewName = strdup("displaychannel");
|
||||
numViewElements = (int)eVeDisplayChannel::count;
|
||||
viewElements = new cViewElement*[numViewElements];
|
||||
for (int i=0; i < numViewElements; i++) {
|
||||
viewElements[i] = NULL;
|
||||
}
|
||||
SetViewElements();
|
||||
veMessage = NULL;
|
||||
veChannelInfo = NULL;
|
||||
veChannelGroup = NULL;
|
||||
veEpgInfo = NULL;
|
||||
veProgressBar = NULL;
|
||||
veStatusInfo = NULL;
|
||||
veScraperContent = NULL;
|
||||
veEcmInfo = NULL;
|
||||
}
|
||||
|
||||
cViewChannel::~cViewChannel() {
|
||||
}
|
||||
|
||||
void cViewChannel::SetViewElements(void) {
|
||||
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayChannel::background));
|
||||
viewElementNames.insert(pair<string, int>("channelgroup", (int)eVeDisplayChannel::channelgroup));
|
||||
viewElementNames.insert(pair<string, int>("channelinfo", (int)eVeDisplayChannel::channelinfo));
|
||||
viewElementNames.insert(pair<string, int>("epginfo", (int)eVeDisplayChannel::epginfo));
|
||||
viewElementNames.insert(pair<string, int>("progressbar", (int)eVeDisplayChannel::progressbar));
|
||||
viewElementNames.insert(pair<string, int>("statusinfo", (int)eVeDisplayChannel::statusinfo));
|
||||
viewElementNames.insert(pair<string, int>("audioinfo", (int)eVeDisplayChannel::audioinfo));
|
||||
viewElementNames.insert(pair<string, int>("ecminfo", (int)eVeDisplayChannel::ecminfo));
|
||||
viewElementNames.insert(pair<string, int>("screenresolution", (int)eVeDisplayChannel::screenresolution));
|
||||
viewElementNames.insert(pair<string, int>("signalquality", (int)eVeDisplayChannel::signalquality));
|
||||
viewElementNames.insert(pair<string, int>("devices", (int)eVeDisplayChannel::devices));
|
||||
viewElementNames.insert(pair<string, int>("currentweather", (int)eVeDisplayChannel::currentweather));
|
||||
viewElementNames.insert(pair<string, int>("scrapercontent", (int)eVeDisplayChannel::scrapercontent));
|
||||
viewElementNames.insert(pair<string, int>("datetime", (int)eVeDisplayChannel::datetime));
|
||||
viewElementNames.insert(pair<string, int>("time", (int)eVeDisplayChannel::time));
|
||||
viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayChannel::message));
|
||||
viewElementNames.insert(pair<string, int>("customtokens", (int)eVeDisplayChannel::customtokens));
|
||||
}
|
||||
|
||||
void cViewChannel::SetViewElementObjects(void) {
|
||||
for (int i = 0; i < numViewElements; i++) {
|
||||
if (!viewElements[i])
|
||||
continue;
|
||||
if (dynamic_cast<cVeMessage*>(viewElements[i]))
|
||||
{
|
||||
veMessage = dynamic_cast<cVeMessage*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcChannelInfo*>(viewElements[i])) {
|
||||
|
||||
veChannelInfo = dynamic_cast<cVeDcChannelInfo*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcChannelGroup*>(viewElements[i]))
|
||||
{
|
||||
veChannelGroup = dynamic_cast<cVeDcChannelGroup*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcEpgInfo*>(viewElements[i]))
|
||||
{
|
||||
veEpgInfo = dynamic_cast<cVeDcEpgInfo*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcProgressBar*>(viewElements[i]))
|
||||
{
|
||||
veProgressBar = dynamic_cast<cVeDcProgressBar*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcStatusInfo*>(viewElements[i]))
|
||||
{
|
||||
veStatusInfo = dynamic_cast<cVeDcStatusInfo*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcScraperContent*>(viewElements[i]))
|
||||
{
|
||||
veScraperContent = dynamic_cast<cVeDcScraperContent*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcEcmInfo*>(viewElements[i]))
|
||||
{
|
||||
veEcmInfo = dynamic_cast<cVeDcEcmInfo*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeCustomTokens*>(viewElements[i]))
|
||||
{
|
||||
veCustomTokens = dynamic_cast<cVeCustomTokens*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDevices*>(viewElements[i]))
|
||||
{
|
||||
viewElements[i]->SetDetached();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cViewChannel::ClearVariables(void) {
|
||||
cView::ClearVariables();
|
||||
channelChange = false;
|
||||
displayChannelGroups = false;
|
||||
if (veCustomTokens)
|
||||
veCustomTokens->Reset();
|
||||
}
|
||||
|
||||
void cViewChannel::SetChannel(const cChannel *channel, int number) {
|
||||
channelChange = true;
|
||||
bool wasChannelGroups = displayChannelGroups;
|
||||
displayChannelGroups = false;
|
||||
|
||||
if (veChannelInfo) {
|
||||
veChannelInfo->Set(channel, number);
|
||||
}
|
||||
|
||||
if (channel) {
|
||||
if (!channel->GroupSep()) {
|
||||
if (wasChannelGroups)
|
||||
Clear((int)eVeDisplayChannel::channelgroup);
|
||||
if (veStatusInfo)
|
||||
veStatusInfo->Set(channel);
|
||||
if (veEcmInfo)
|
||||
veEcmInfo->Set(channel);
|
||||
} else {
|
||||
displayChannelGroups = true;
|
||||
Clear((int)eVeDisplayChannel::channelinfo);
|
||||
Clear((int)eVeDisplayChannel::epginfo);
|
||||
Clear((int)eVeDisplayChannel::statusinfo);
|
||||
Clear((int)eVeDisplayChannel::progressbar);
|
||||
Clear((int)eVeDisplayChannel::screenresolution);
|
||||
Clear((int)eVeDisplayChannel::signalquality);
|
||||
Clear((int)eVeDisplayChannel::audioinfo);
|
||||
Clear((int)eVeDisplayChannel::ecminfo);
|
||||
Clear((int)eVeDisplayChannel::devices);
|
||||
Clear((int)eVeDisplayChannel::customtokens);
|
||||
if (veChannelGroup)
|
||||
veChannelGroup->Set(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cViewChannel::SetEvents(const cEvent *present, const cEvent *following) {
|
||||
Clear((int)eVeDisplayChannel::epginfo);
|
||||
Clear((int)eVeDisplayChannel::progressbar);
|
||||
Clear((int)eVeDisplayChannel::scrapercontent);
|
||||
if (veProgressBar)
|
||||
veProgressBar->Set(present);
|
||||
|
||||
if (!present && !following)
|
||||
return;
|
||||
|
||||
if (veEpgInfo)
|
||||
veEpgInfo->Set(present, following);
|
||||
|
||||
if (veScraperContent)
|
||||
veScraperContent->Set(present);
|
||||
}
|
||||
|
||||
void cViewChannel::SetMessage(eMessageType type, const char *text) {
|
||||
if (veMessage) {
|
||||
if (text)
|
||||
veMessage->Set(type, text);
|
||||
else
|
||||
veMessage->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
void cViewChannel::Flush(void) {
|
||||
if (init) {
|
||||
sdOsd.LockFlush();
|
||||
Render((int)eVeDisplayChannel::background);
|
||||
Render((int)eVeDisplayChannel::progressbar);
|
||||
Render((int)eVeDisplayChannel::currentweather);
|
||||
}
|
||||
|
||||
if (!displayChannelGroups) {
|
||||
//normal display
|
||||
Render((int)eVeDisplayChannel::channelinfo);
|
||||
Render((int)eVeDisplayChannel::epginfo);
|
||||
Render((int)eVeDisplayChannel::statusinfo);
|
||||
Render((int)eVeDisplayChannel::scrapercontent);
|
||||
Render((int)eVeDisplayChannel::progressbar, channelChange);
|
||||
Render((int)eVeDisplayChannel::screenresolution);
|
||||
Render((int)eVeDisplayChannel::signalquality);
|
||||
Render((int)eVeDisplayChannel::audioinfo);
|
||||
Render((int)eVeDisplayChannel::ecminfo);
|
||||
Render((int)eVeDisplayChannel::devices);
|
||||
Render((int)eVeDisplayChannel::customtokens);
|
||||
Render((int)eVeDisplayChannel::message);
|
||||
} else {
|
||||
//channelgroup display
|
||||
Render((int)eVeDisplayChannel::channelgroup);
|
||||
}
|
||||
Render((int)eVeDisplayChannel::datetime);
|
||||
Render((int)eVeDisplayChannel::time);
|
||||
channelChange = false;
|
||||
cView::Flush();
|
||||
}
|
||||
|
||||
#include "viewdisplaychannel.h"
|
||||
#include "../config.h"
|
||||
|
||||
/************************************************************************************
|
||||
* cViewChannel
|
||||
************************************************************************************/
|
||||
|
||||
cViewChannel::cViewChannel(void) {
|
||||
veCustomTokens = NULL;
|
||||
ClearVariables();
|
||||
viewId = eViewType::DisplayChannel;
|
||||
viewName = strdup("displaychannel");
|
||||
numViewElements = (int)eVeDisplayChannel::count;
|
||||
viewElements = new cViewElement*[numViewElements];
|
||||
for (int i=0; i < numViewElements; i++) {
|
||||
viewElements[i] = NULL;
|
||||
}
|
||||
SetViewElements();
|
||||
veMessage = NULL;
|
||||
veChannelInfo = NULL;
|
||||
veChannelGroup = NULL;
|
||||
veEpgInfo = NULL;
|
||||
veProgressBar = NULL;
|
||||
veStatusInfo = NULL;
|
||||
veScraperContent = NULL;
|
||||
veEcmInfo = NULL;
|
||||
}
|
||||
|
||||
cViewChannel::~cViewChannel() {
|
||||
}
|
||||
|
||||
void cViewChannel::SetViewElements(void) {
|
||||
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayChannel::background));
|
||||
viewElementNames.insert(pair<string, int>("channelgroup", (int)eVeDisplayChannel::channelgroup));
|
||||
viewElementNames.insert(pair<string, int>("channelinfo", (int)eVeDisplayChannel::channelinfo));
|
||||
viewElementNames.insert(pair<string, int>("epginfo", (int)eVeDisplayChannel::epginfo));
|
||||
viewElementNames.insert(pair<string, int>("progressbar", (int)eVeDisplayChannel::progressbar));
|
||||
viewElementNames.insert(pair<string, int>("statusinfo", (int)eVeDisplayChannel::statusinfo));
|
||||
viewElementNames.insert(pair<string, int>("audioinfo", (int)eVeDisplayChannel::audioinfo));
|
||||
viewElementNames.insert(pair<string, int>("ecminfo", (int)eVeDisplayChannel::ecminfo));
|
||||
viewElementNames.insert(pair<string, int>("screenresolution", (int)eVeDisplayChannel::screenresolution));
|
||||
viewElementNames.insert(pair<string, int>("signalquality", (int)eVeDisplayChannel::signalquality));
|
||||
viewElementNames.insert(pair<string, int>("devices", (int)eVeDisplayChannel::devices));
|
||||
viewElementNames.insert(pair<string, int>("currentweather", (int)eVeDisplayChannel::currentweather));
|
||||
viewElementNames.insert(pair<string, int>("scrapercontent", (int)eVeDisplayChannel::scrapercontent));
|
||||
viewElementNames.insert(pair<string, int>("datetime", (int)eVeDisplayChannel::datetime));
|
||||
viewElementNames.insert(pair<string, int>("time", (int)eVeDisplayChannel::time));
|
||||
viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayChannel::message));
|
||||
viewElementNames.insert(pair<string, int>("customtokens", (int)eVeDisplayChannel::customtokens));
|
||||
}
|
||||
|
||||
void cViewChannel::SetViewElementObjects(void) {
|
||||
for (int i = 0; i < numViewElements; i++) {
|
||||
if (!viewElements[i])
|
||||
continue;
|
||||
if (dynamic_cast<cVeMessage*>(viewElements[i]))
|
||||
{
|
||||
veMessage = dynamic_cast<cVeMessage*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcChannelInfo*>(viewElements[i])) {
|
||||
|
||||
veChannelInfo = dynamic_cast<cVeDcChannelInfo*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcChannelGroup*>(viewElements[i]))
|
||||
{
|
||||
veChannelGroup = dynamic_cast<cVeDcChannelGroup*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcEpgInfo*>(viewElements[i]))
|
||||
{
|
||||
veEpgInfo = dynamic_cast<cVeDcEpgInfo*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcProgressBar*>(viewElements[i]))
|
||||
{
|
||||
veProgressBar = dynamic_cast<cVeDcProgressBar*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcStatusInfo*>(viewElements[i]))
|
||||
{
|
||||
veStatusInfo = dynamic_cast<cVeDcStatusInfo*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcScraperContent*>(viewElements[i]))
|
||||
{
|
||||
veScraperContent = dynamic_cast<cVeDcScraperContent*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDcEcmInfo*>(viewElements[i]))
|
||||
{
|
||||
veEcmInfo = dynamic_cast<cVeDcEcmInfo*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeCustomTokens*>(viewElements[i]))
|
||||
{
|
||||
veCustomTokens = dynamic_cast<cVeCustomTokens*>(viewElements[i]);
|
||||
}
|
||||
else if (dynamic_cast<cVeDevices*>(viewElements[i]))
|
||||
{
|
||||
viewElements[i]->SetDetached();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cViewChannel::ClearVariables(void) {
|
||||
cView::ClearVariables();
|
||||
channelChange = false;
|
||||
displayChannelGroups = false;
|
||||
if (veCustomTokens)
|
||||
veCustomTokens->Reset();
|
||||
}
|
||||
|
||||
void cViewChannel::SetChannel(const cChannel *channel, int number) {
|
||||
channelChange = true;
|
||||
bool wasChannelGroups = displayChannelGroups;
|
||||
displayChannelGroups = false;
|
||||
|
||||
if (veChannelInfo) {
|
||||
veChannelInfo->Set(channel, number);
|
||||
}
|
||||
|
||||
if (channel) {
|
||||
if (!channel->GroupSep()) {
|
||||
if (wasChannelGroups)
|
||||
Clear((int)eVeDisplayChannel::channelgroup);
|
||||
if (veStatusInfo)
|
||||
veStatusInfo->Set(channel);
|
||||
if (veEcmInfo)
|
||||
veEcmInfo->Set(channel);
|
||||
} else {
|
||||
displayChannelGroups = true;
|
||||
Clear((int)eVeDisplayChannel::channelinfo);
|
||||
Clear((int)eVeDisplayChannel::epginfo);
|
||||
Clear((int)eVeDisplayChannel::statusinfo);
|
||||
Clear((int)eVeDisplayChannel::progressbar);
|
||||
Clear((int)eVeDisplayChannel::screenresolution);
|
||||
Clear((int)eVeDisplayChannel::signalquality);
|
||||
Clear((int)eVeDisplayChannel::audioinfo);
|
||||
Clear((int)eVeDisplayChannel::ecminfo);
|
||||
Clear((int)eVeDisplayChannel::devices);
|
||||
Clear((int)eVeDisplayChannel::customtokens);
|
||||
if (veChannelGroup)
|
||||
veChannelGroup->Set(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cViewChannel::SetEvents(const cEvent *present, const cEvent *following) {
|
||||
Clear((int)eVeDisplayChannel::epginfo);
|
||||
Clear((int)eVeDisplayChannel::progressbar);
|
||||
Clear((int)eVeDisplayChannel::scrapercontent);
|
||||
if (veProgressBar)
|
||||
veProgressBar->Set(present);
|
||||
|
||||
if (!present && !following)
|
||||
return;
|
||||
|
||||
if (veEpgInfo)
|
||||
veEpgInfo->Set(present, following);
|
||||
|
||||
if (veScraperContent)
|
||||
veScraperContent->Set(present);
|
||||
}
|
||||
|
||||
void cViewChannel::SetMessage(eMessageType type, const char *text) {
|
||||
if (veMessage) {
|
||||
if (text)
|
||||
veMessage->Set(type, text);
|
||||
else
|
||||
veMessage->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
void cViewChannel::Flush(void) {
|
||||
if (init) {
|
||||
sdOsd.LockFlush();
|
||||
Render((int)eVeDisplayChannel::background);
|
||||
Render((int)eVeDisplayChannel::progressbar);
|
||||
Render((int)eVeDisplayChannel::currentweather);
|
||||
}
|
||||
|
||||
if (!displayChannelGroups) {
|
||||
//normal display
|
||||
Render((int)eVeDisplayChannel::channelinfo);
|
||||
Render((int)eVeDisplayChannel::epginfo);
|
||||
Render((int)eVeDisplayChannel::statusinfo);
|
||||
Render((int)eVeDisplayChannel::scrapercontent);
|
||||
Render((int)eVeDisplayChannel::progressbar, channelChange);
|
||||
Render((int)eVeDisplayChannel::screenresolution);
|
||||
Render((int)eVeDisplayChannel::signalquality);
|
||||
Render((int)eVeDisplayChannel::audioinfo);
|
||||
Render((int)eVeDisplayChannel::ecminfo);
|
||||
Render((int)eVeDisplayChannel::devices);
|
||||
Render((int)eVeDisplayChannel::customtokens);
|
||||
Render((int)eVeDisplayChannel::message);
|
||||
} else {
|
||||
//channelgroup display
|
||||
Render((int)eVeDisplayChannel::channelgroup);
|
||||
}
|
||||
Render((int)eVeDisplayChannel::datetime);
|
||||
Render((int)eVeDisplayChannel::time);
|
||||
channelChange = false;
|
||||
cView::Flush();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
#ifndef __VIEWDISPLAYCHANNEL_H
|
||||
#define __VIEWDISPLAYCHANNEL_H
|
||||
|
||||
#include "view.h"
|
||||
|
||||
class cViewChannel : public cView {
|
||||
private:
|
||||
cVeMessage *veMessage;
|
||||
cVeCustomTokens *veCustomTokens;
|
||||
cVeDcChannelInfo *veChannelInfo;
|
||||
cVeDcChannelGroup *veChannelGroup;
|
||||
cVeDcEpgInfo *veEpgInfo;
|
||||
cVeDcProgressBar *veProgressBar;
|
||||
cVeDcStatusInfo *veStatusInfo;
|
||||
cVeDcScraperContent *veScraperContent;
|
||||
cVeDcEcmInfo *veEcmInfo;
|
||||
bool channelChange;
|
||||
bool displayChannelGroups;
|
||||
void SetViewElements(void);
|
||||
void ClearVariables(void);
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewChannel(void);
|
||||
virtual ~cViewChannel(void);
|
||||
void SetChannel(const cChannel *channel, int number);
|
||||
void SetEvents(const cEvent *present, const cEvent *following);
|
||||
void SetMessage(eMessageType type, const char *text);
|
||||
void Flush(void);
|
||||
};
|
||||
|
||||
#ifndef __VIEWDISPLAYCHANNEL_H
|
||||
#define __VIEWDISPLAYCHANNEL_H
|
||||
|
||||
#include "view.h"
|
||||
|
||||
class cViewChannel : public cView {
|
||||
private:
|
||||
cVeMessage *veMessage;
|
||||
cVeCustomTokens *veCustomTokens;
|
||||
cVeDcChannelInfo *veChannelInfo;
|
||||
cVeDcChannelGroup *veChannelGroup;
|
||||
cVeDcEpgInfo *veEpgInfo;
|
||||
cVeDcProgressBar *veProgressBar;
|
||||
cVeDcStatusInfo *veStatusInfo;
|
||||
cVeDcScraperContent *veScraperContent;
|
||||
cVeDcEcmInfo *veEcmInfo;
|
||||
bool channelChange;
|
||||
bool displayChannelGroups;
|
||||
void SetViewElements(void);
|
||||
void ClearVariables(void);
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewChannel(void);
|
||||
virtual ~cViewChannel(void);
|
||||
void SetChannel(const cChannel *channel, int number);
|
||||
void SetEvents(const cEvent *present, const cEvent *following);
|
||||
void SetMessage(eMessageType type, const char *text);
|
||||
void Flush(void);
|
||||
};
|
||||
|
||||
#endif //__VIEWDISPLAYCHANNEL_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,325 +1,325 @@
|
||||
#ifndef __VIEWDISPLAYMENU_H
|
||||
#define __VIEWDISPLAYMENU_H
|
||||
|
||||
#include "view.h"
|
||||
#include "viewdetail.h"
|
||||
|
||||
#if defined(APIVERSNUM) && APIVERSNUM < 20301
|
||||
#ifndef MENU_ORIENTATION_DEFINED
|
||||
enum eMenuOrientation {
|
||||
moVertical = 0,
|
||||
moHorizontal
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/***********************************************************
|
||||
* cViewMenu
|
||||
***********************************************************/
|
||||
class cSubView;
|
||||
class cViewMenuDefault;
|
||||
class cViewMenuMain;
|
||||
class cViewMenuSetup;
|
||||
class cViewMenuSchedules;
|
||||
class cViewMenuChannels;
|
||||
class cViewMenuTimers;
|
||||
class cViewMenuRecordings;
|
||||
class cViewMenuDetail;
|
||||
|
||||
class cViewMenu : public cView {
|
||||
protected:
|
||||
map<string,int> subviewNames;
|
||||
cSubView **subViews;
|
||||
int numSubviews;
|
||||
cSubView *activeSubview;
|
||||
cSubView *activeSubviewLast;
|
||||
cViewMenuDefault *menuDefault;
|
||||
cViewMenuMain *menuMain;
|
||||
cViewMenuSetup *menuSetup;
|
||||
cViewMenuSchedules *menuSchedules;
|
||||
cViewMenuChannels *menuChannels;
|
||||
cViewMenuTimers *menuTimers;
|
||||
cViewMenuRecordings *menuRecordings;
|
||||
cViewMenuDetail *menuDetailedEpg;
|
||||
cViewMenuDetail *menuDetailedRec;
|
||||
cViewMenuDetail *menuDetailedText;
|
||||
eMenuCategory menuCat;
|
||||
//name of current plugin for menu icon
|
||||
const char *plugName;
|
||||
//external plugin menus
|
||||
bool pluginIdSet;
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
//status variables
|
||||
bool menuChange;
|
||||
bool listChange;
|
||||
bool detailViewInit;
|
||||
void SetViewElements(void);
|
||||
void SetViewElementObjects(void);
|
||||
void SetSubViews(void);
|
||||
void ClearVariables(void);
|
||||
int SubviewId(const char *name);
|
||||
bool SetPluginSubView(eMenuCategory menuCat);
|
||||
void WakeViewElements(void);
|
||||
public:
|
||||
cViewMenu(void);
|
||||
virtual ~cViewMenu(void);
|
||||
void SetGlobals(cGlobals *globals);
|
||||
void PreCache(void);
|
||||
bool ValidSubView(const char *subView);
|
||||
static cSubView *CreateSubview(const char *name);
|
||||
static cSubView *CreatePluginview(const char *plugname, int plugId, int menuNumber, int menuType);
|
||||
void AddSubview(const char *sSubView, cSubView *subView);
|
||||
void AddPluginview(cSubView *plugView);
|
||||
void SetSubView(eMenuCategory MenuCat);
|
||||
void SetSortMode(eMenuSortMode sortMode);
|
||||
void SetPluginMenu(int plugId, int plugMenuId);
|
||||
int NumListItems(void);
|
||||
eMenuOrientation MenuOrientation(void);
|
||||
const cFont *GetTextAreaFont(void);
|
||||
int GetTextAreaWidth(void);
|
||||
int GetListWidth(void);
|
||||
void SetTitleHeader(const char *title);
|
||||
void SetChannelHeader(const cEvent *event);
|
||||
void SetMessage(eMessageType type, const char *text);
|
||||
void SetMenuButtons(const char *red, const char *green, const char *yellow, const char *blue);
|
||||
void SetScrollbar(int total, int offset);
|
||||
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
|
||||
void SetItem(const char *text, int index, bool current, bool selectable);
|
||||
bool SetItemEvent(const cEvent *event, int index, bool current, bool selectable, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
|
||||
bool SetItemTimer(const cTimer *timer, int index, bool current, bool selectable);
|
||||
bool SetItemChannel(const cChannel *channel, int index, bool current, bool selectable, bool withProvider);
|
||||
bool SetItemRecording(const cRecording *recording, int index, bool current, bool selectable, int level, int total, int New);
|
||||
bool SetItemPlugin(skindesignerapi::cTokenContainer *tk, int index, bool current, bool selectable);
|
||||
void SetEvent(const cEvent *event);
|
||||
void SetRecording(const cRecording *recording);
|
||||
void SetText(const char *text);
|
||||
bool SetPluginText(skindesignerapi::cTokenContainer *tk);
|
||||
void SetCurrentRecording(const char *currentRec);
|
||||
void KeyDetailView(bool up, bool page);
|
||||
bool Init(void);
|
||||
void Close(void);
|
||||
void Clear(void);
|
||||
void Flush(void);
|
||||
void SetTransparency(int transparency, bool forceDetached = false);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
/***********************************************************
|
||||
* cSubView
|
||||
***********************************************************/
|
||||
class cSubView : public cView {
|
||||
protected:
|
||||
eMenuCategory menuCat;
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
cViewList *viewList;
|
||||
cViewList *viewListVertical;
|
||||
cViewList *viewListHorizontal;
|
||||
cViewElement *background;
|
||||
cVeDmHeader *header;
|
||||
cVeDateTime *datetime;
|
||||
cVeTime *time;
|
||||
cVeMessage *message;
|
||||
cVeDmSortmode *sortmode;
|
||||
cVeDmColorbuttons *colorbuttons;
|
||||
cVeDmScrollbar *scrollbar;
|
||||
virtual void SetViewElementObjects(void);
|
||||
virtual void SetViewElements(void);
|
||||
public:
|
||||
cSubView(const char *name);
|
||||
virtual ~cSubView(void);
|
||||
virtual void SetGlobals(cGlobals *globals);
|
||||
virtual void PreCache(void);
|
||||
bool ViewElementSet(int ve);
|
||||
bool ViewElementHorizontalSet(int ve);
|
||||
void SetViewElement(eVeDisplayMenu ve, cViewElement *viewElement);
|
||||
void SetViewElementHorizontal(eVeDisplayMenu ve, cViewElement *viewElement);
|
||||
void AddViewList(cViewList *viewList);
|
||||
virtual void AddTab(cArea *tab) {};
|
||||
int NumListItems(void);
|
||||
eMenuOrientation MenuOrientation(void);
|
||||
void SetMenuCategory(eMenuCategory menuCat) { this->menuCat = menuCat; };
|
||||
void SetPlugId(int id) { plugId = id; };
|
||||
void SetPlugMenuId(int id) { plugMenuId = id; };
|
||||
void SetTitle(const char *title);
|
||||
void SetMessage(eMessageType type, const char *text);
|
||||
void SetChannel(const cChannel *channel);
|
||||
void SetMenuButtons(const char *red, const char *green, const char *yellow, const char *blue);
|
||||
void SetScrollbar(int total, int offset);
|
||||
void SetSortMode(eMenuSortMode sortMode);
|
||||
virtual void Close(void);
|
||||
virtual void Clear(void);
|
||||
void ClearViewList(void);
|
||||
void WakeViewElements(void);
|
||||
virtual void DrawStaticVEs(void);
|
||||
virtual void DrawDynamicVEs(void);
|
||||
void DrawList(void);
|
||||
virtual void DrawDetailedView(void) {};
|
||||
virtual void UpdateDetailedView(void) {};
|
||||
void SetTransparency(int transparency, bool forceDetached = false);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuDefault
|
||||
***********************************************************/
|
||||
class cViewMenuDefault : public cSubView {
|
||||
private:
|
||||
cViewListDefault *listDefault;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuDefault(const char *name);
|
||||
virtual ~cViewMenuDefault(void);
|
||||
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
|
||||
void SetPlugin(const char *plugName);
|
||||
void SetItem(const char *text, int index, bool current, bool selectable);
|
||||
const cFont *GetTextAreaFont(void);
|
||||
int GetListWidth(void);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuMain
|
||||
***********************************************************/
|
||||
class cViewMenuMain : public cSubView {
|
||||
private:
|
||||
cViewListMain *listMain;
|
||||
cVeDmTimers *timers;
|
||||
cVeDevices *devices;
|
||||
cVeCurrentWeather *weather;
|
||||
cVeDmDiscusage *discusage;
|
||||
cVeDmSystemload *load;
|
||||
cVeDmSystemmemory *memory;
|
||||
cVeDmVdrstatistics *vdrstats;
|
||||
cVeDmTemperatures *temperatures;
|
||||
cVeDmCurrentschedule *currentSchedule;
|
||||
cVeDmLastrecordings *lastRecordings;
|
||||
cVeCustomTokens *customTokens;
|
||||
uint64_t lastDrawDynamic;
|
||||
void ClearVariables(void);
|
||||
void SetViewElements(void);
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuMain(const char *name);
|
||||
virtual ~cViewMenuMain(void);
|
||||
void Clear(void);
|
||||
void SetItem(const char *text, int index, bool current, bool selectable);
|
||||
void SetCurrentRecording(const char *currentRec);
|
||||
void DrawStaticVEs(void);
|
||||
void DrawDynamicVEs(void);
|
||||
const char *GetPlugin(void);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuSetup
|
||||
***********************************************************/
|
||||
class cViewMenuSetup : public cSubView {
|
||||
private:
|
||||
cViewListMain *listSetup;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuSetup(const char *name);
|
||||
virtual ~cViewMenuSetup(void);
|
||||
void SetItem(const char *text, int index, bool current, bool selectable);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuSchedules
|
||||
***********************************************************/
|
||||
class cViewMenuSchedules : public cSubView {
|
||||
private:
|
||||
cViewListSchedules *listSchedules;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuSchedules(const char *name);
|
||||
virtual ~cViewMenuSchedules(void);
|
||||
void SetItem(const cEvent *event, int index, bool current, bool selectable, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuChannels
|
||||
***********************************************************/
|
||||
class cViewMenuChannels : public cSubView {
|
||||
private:
|
||||
cViewListChannels *listChannels;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuChannels(const char *name);
|
||||
virtual ~cViewMenuChannels(void);
|
||||
void SetItem(const cChannel *channel, int index, bool current, bool selectable, bool withProvider);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuTimers
|
||||
***********************************************************/
|
||||
class cViewMenuTimers : public cSubView {
|
||||
private:
|
||||
cViewListTimers *listTimers;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuTimers(const char *name);
|
||||
virtual ~cViewMenuTimers(void);
|
||||
void SetItem(const cTimer *timer, int index, bool current, bool selectable);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuRecordings
|
||||
***********************************************************/
|
||||
class cViewMenuRecordings : public cSubView {
|
||||
private:
|
||||
cViewListRecordings *listRecordings;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuRecordings(const char *name);
|
||||
virtual ~cViewMenuRecordings(void);
|
||||
void SetItem(const cRecording *recording, int index, bool current, bool selectable, int level, int total, int New);
|
||||
};
|
||||
|
||||
/***********************************************************
|
||||
* cViewMenuPlugins
|
||||
***********************************************************/
|
||||
class cViewMenuPlugin : public cSubView {
|
||||
private:
|
||||
cViewListPlugin *listPlugin;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuPlugin(const char *name);
|
||||
virtual ~cViewMenuPlugin(void);
|
||||
void SetItem(skindesignerapi::cTokenContainer *tk, int index, bool current, bool selectable);
|
||||
};
|
||||
|
||||
/***********************************************************
|
||||
* cViewMenuDetail
|
||||
***********************************************************/
|
||||
class cViewMenuDetail : public cSubView {
|
||||
private:
|
||||
bool firstTab;
|
||||
cVeDmDetailheaderEpg *detailedheaderEpg;
|
||||
cVeDmDetailheaderRec *detailedheaderRec;
|
||||
cVeDmDetailheaderPlugin *detailedheaderPlug;
|
||||
cVeDmTablabels *tablabels;
|
||||
cViewDetail *detailView;
|
||||
cViewDetailEpg *detailViewEpg;
|
||||
cViewDetailRec *detailViewRec;
|
||||
cViewDetailText *detailViewText;
|
||||
cViewDetailPlugin *detailViewPlugin;
|
||||
void SetDetailedView(void);
|
||||
void SetViewElements(void);
|
||||
void SetViewElementObjects(void);
|
||||
void DrawScrollbar(void);
|
||||
public:
|
||||
cViewMenuDetail(const char *name);
|
||||
virtual ~cViewMenuDetail(void);
|
||||
void SetGlobals(cGlobals *globals);
|
||||
void AddTab(cArea *tab);
|
||||
void PreCache(void);
|
||||
int GetWidth(void);
|
||||
void SetEvent(const cEvent *event);
|
||||
void SetRecording(const cRecording *recording);
|
||||
void SetText(const char *text);
|
||||
void SetPluginText(skindesignerapi::cTokenContainer *tk);
|
||||
void Clear(void);
|
||||
void Close(void);
|
||||
void DrawStaticVEs(void);
|
||||
void DrawDynamicVEs(void);
|
||||
void DrawDetailedView(void);
|
||||
void KeyLeft(void);
|
||||
void KeyRight(void);
|
||||
void KeyUp(void);
|
||||
void KeyDown(void);
|
||||
void SetTransparency(int transparency, bool forceDetached = false);
|
||||
};
|
||||
|
||||
#ifndef __VIEWDISPLAYMENU_H
|
||||
#define __VIEWDISPLAYMENU_H
|
||||
|
||||
#include "view.h"
|
||||
#include "viewdetail.h"
|
||||
|
||||
#if defined(APIVERSNUM) && APIVERSNUM < 20301
|
||||
#ifndef MENU_ORIENTATION_DEFINED
|
||||
enum eMenuOrientation {
|
||||
moVertical = 0,
|
||||
moHorizontal
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/***********************************************************
|
||||
* cViewMenu
|
||||
***********************************************************/
|
||||
class cSubView;
|
||||
class cViewMenuDefault;
|
||||
class cViewMenuMain;
|
||||
class cViewMenuSetup;
|
||||
class cViewMenuSchedules;
|
||||
class cViewMenuChannels;
|
||||
class cViewMenuTimers;
|
||||
class cViewMenuRecordings;
|
||||
class cViewMenuDetail;
|
||||
|
||||
class cViewMenu : public cView {
|
||||
protected:
|
||||
map<string,int> subviewNames;
|
||||
cSubView **subViews;
|
||||
int numSubviews;
|
||||
cSubView *activeSubview;
|
||||
cSubView *activeSubviewLast;
|
||||
cViewMenuDefault *menuDefault;
|
||||
cViewMenuMain *menuMain;
|
||||
cViewMenuSetup *menuSetup;
|
||||
cViewMenuSchedules *menuSchedules;
|
||||
cViewMenuChannels *menuChannels;
|
||||
cViewMenuTimers *menuTimers;
|
||||
cViewMenuRecordings *menuRecordings;
|
||||
cViewMenuDetail *menuDetailedEpg;
|
||||
cViewMenuDetail *menuDetailedRec;
|
||||
cViewMenuDetail *menuDetailedText;
|
||||
eMenuCategory menuCat;
|
||||
//name of current plugin for menu icon
|
||||
const char *plugName;
|
||||
//external plugin menus
|
||||
bool pluginIdSet;
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
//status variables
|
||||
bool menuChange;
|
||||
bool listChange;
|
||||
bool detailViewInit;
|
||||
void SetViewElements(void);
|
||||
void SetViewElementObjects(void);
|
||||
void SetSubViews(void);
|
||||
void ClearVariables(void);
|
||||
int SubviewId(const char *name);
|
||||
bool SetPluginSubView(eMenuCategory menuCat);
|
||||
void WakeViewElements(void);
|
||||
public:
|
||||
cViewMenu(void);
|
||||
virtual ~cViewMenu(void);
|
||||
void SetGlobals(cGlobals *globals);
|
||||
void PreCache(void);
|
||||
bool ValidSubView(const char *subView);
|
||||
static cSubView *CreateSubview(const char *name);
|
||||
static cSubView *CreatePluginview(const char *plugname, int plugId, int menuNumber, int menuType);
|
||||
void AddSubview(const char *sSubView, cSubView *subView);
|
||||
void AddPluginview(cSubView *plugView);
|
||||
void SetSubView(eMenuCategory MenuCat);
|
||||
void SetSortMode(eMenuSortMode sortMode);
|
||||
void SetPluginMenu(int plugId, int plugMenuId);
|
||||
int NumListItems(void);
|
||||
eMenuOrientation MenuOrientation(void);
|
||||
const cFont *GetTextAreaFont(void);
|
||||
int GetTextAreaWidth(void);
|
||||
int GetListWidth(void);
|
||||
void SetTitleHeader(const char *title);
|
||||
void SetChannelHeader(const cEvent *event);
|
||||
void SetMessage(eMessageType type, const char *text);
|
||||
void SetMenuButtons(const char *red, const char *green, const char *yellow, const char *blue);
|
||||
void SetScrollbar(int total, int offset);
|
||||
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
|
||||
void SetItem(const char *text, int index, bool current, bool selectable);
|
||||
bool SetItemEvent(const cEvent *event, int index, bool current, bool selectable, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
|
||||
bool SetItemTimer(const cTimer *timer, int index, bool current, bool selectable);
|
||||
bool SetItemChannel(const cChannel *channel, int index, bool current, bool selectable, bool withProvider);
|
||||
bool SetItemRecording(const cRecording *recording, int index, bool current, bool selectable, int level, int total, int New);
|
||||
bool SetItemPlugin(skindesignerapi::cTokenContainer *tk, int index, bool current, bool selectable);
|
||||
void SetEvent(const cEvent *event);
|
||||
void SetRecording(const cRecording *recording);
|
||||
void SetText(const char *text);
|
||||
bool SetPluginText(skindesignerapi::cTokenContainer *tk);
|
||||
void SetCurrentRecording(const char *currentRec);
|
||||
void KeyDetailView(bool up, bool page);
|
||||
bool Init(void);
|
||||
void Close(void);
|
||||
void Clear(void);
|
||||
void Flush(void);
|
||||
void SetTransparency(int transparency, bool forceDetached = false);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
/***********************************************************
|
||||
* cSubView
|
||||
***********************************************************/
|
||||
class cSubView : public cView {
|
||||
protected:
|
||||
eMenuCategory menuCat;
|
||||
int plugId;
|
||||
int plugMenuId;
|
||||
cViewList *viewList;
|
||||
cViewList *viewListVertical;
|
||||
cViewList *viewListHorizontal;
|
||||
cViewElement *background;
|
||||
cVeDmHeader *header;
|
||||
cVeDateTime *datetime;
|
||||
cVeTime *time;
|
||||
cVeMessage *message;
|
||||
cVeDmSortmode *sortmode;
|
||||
cVeDmColorbuttons *colorbuttons;
|
||||
cVeDmScrollbar *scrollbar;
|
||||
virtual void SetViewElementObjects(void);
|
||||
virtual void SetViewElements(void);
|
||||
public:
|
||||
cSubView(const char *name);
|
||||
virtual ~cSubView(void);
|
||||
virtual void SetGlobals(cGlobals *globals);
|
||||
virtual void PreCache(void);
|
||||
bool ViewElementSet(int ve);
|
||||
bool ViewElementHorizontalSet(int ve);
|
||||
void SetViewElement(eVeDisplayMenu ve, cViewElement *viewElement);
|
||||
void SetViewElementHorizontal(eVeDisplayMenu ve, cViewElement *viewElement);
|
||||
void AddViewList(cViewList *viewList);
|
||||
virtual void AddTab(cArea *tab) {};
|
||||
int NumListItems(void);
|
||||
eMenuOrientation MenuOrientation(void);
|
||||
void SetMenuCategory(eMenuCategory menuCat) { this->menuCat = menuCat; };
|
||||
void SetPlugId(int id) { plugId = id; };
|
||||
void SetPlugMenuId(int id) { plugMenuId = id; };
|
||||
void SetTitle(const char *title);
|
||||
void SetMessage(eMessageType type, const char *text);
|
||||
void SetChannel(const cChannel *channel);
|
||||
void SetMenuButtons(const char *red, const char *green, const char *yellow, const char *blue);
|
||||
void SetScrollbar(int total, int offset);
|
||||
void SetSortMode(eMenuSortMode sortMode);
|
||||
virtual void Close(void);
|
||||
virtual void Clear(void);
|
||||
void ClearViewList(void);
|
||||
void WakeViewElements(void);
|
||||
virtual void DrawStaticVEs(void);
|
||||
virtual void DrawDynamicVEs(void);
|
||||
void DrawList(void);
|
||||
virtual void DrawDetailedView(void) {};
|
||||
virtual void UpdateDetailedView(void) {};
|
||||
void SetTransparency(int transparency, bool forceDetached = false);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuDefault
|
||||
***********************************************************/
|
||||
class cViewMenuDefault : public cSubView {
|
||||
private:
|
||||
cViewListDefault *listDefault;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuDefault(const char *name);
|
||||
virtual ~cViewMenuDefault(void);
|
||||
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
|
||||
void SetPlugin(const char *plugName);
|
||||
void SetItem(const char *text, int index, bool current, bool selectable);
|
||||
const cFont *GetTextAreaFont(void);
|
||||
int GetListWidth(void);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuMain
|
||||
***********************************************************/
|
||||
class cViewMenuMain : public cSubView {
|
||||
private:
|
||||
cViewListMain *listMain;
|
||||
cVeDmTimers *timers;
|
||||
cVeDevices *devices;
|
||||
cVeCurrentWeather *weather;
|
||||
cVeDmDiscusage *discusage;
|
||||
cVeDmSystemload *load;
|
||||
cVeDmSystemmemory *memory;
|
||||
cVeDmVdrstatistics *vdrstats;
|
||||
cVeDmTemperatures *temperatures;
|
||||
cVeDmCurrentschedule *currentSchedule;
|
||||
cVeDmLastrecordings *lastRecordings;
|
||||
cVeCustomTokens *customTokens;
|
||||
uint64_t lastDrawDynamic;
|
||||
void ClearVariables(void);
|
||||
void SetViewElements(void);
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuMain(const char *name);
|
||||
virtual ~cViewMenuMain(void);
|
||||
void Clear(void);
|
||||
void SetItem(const char *text, int index, bool current, bool selectable);
|
||||
void SetCurrentRecording(const char *currentRec);
|
||||
void DrawStaticVEs(void);
|
||||
void DrawDynamicVEs(void);
|
||||
const char *GetPlugin(void);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuSetup
|
||||
***********************************************************/
|
||||
class cViewMenuSetup : public cSubView {
|
||||
private:
|
||||
cViewListMain *listSetup;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuSetup(const char *name);
|
||||
virtual ~cViewMenuSetup(void);
|
||||
void SetItem(const char *text, int index, bool current, bool selectable);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuSchedules
|
||||
***********************************************************/
|
||||
class cViewMenuSchedules : public cSubView {
|
||||
private:
|
||||
cViewListSchedules *listSchedules;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuSchedules(const char *name);
|
||||
virtual ~cViewMenuSchedules(void);
|
||||
void SetItem(const cEvent *event, int index, bool current, bool selectable, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuChannels
|
||||
***********************************************************/
|
||||
class cViewMenuChannels : public cSubView {
|
||||
private:
|
||||
cViewListChannels *listChannels;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuChannels(const char *name);
|
||||
virtual ~cViewMenuChannels(void);
|
||||
void SetItem(const cChannel *channel, int index, bool current, bool selectable, bool withProvider);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuTimers
|
||||
***********************************************************/
|
||||
class cViewMenuTimers : public cSubView {
|
||||
private:
|
||||
cViewListTimers *listTimers;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuTimers(const char *name);
|
||||
virtual ~cViewMenuTimers(void);
|
||||
void SetItem(const cTimer *timer, int index, bool current, bool selectable);
|
||||
};
|
||||
/***********************************************************
|
||||
* cViewMenuRecordings
|
||||
***********************************************************/
|
||||
class cViewMenuRecordings : public cSubView {
|
||||
private:
|
||||
cViewListRecordings *listRecordings;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuRecordings(const char *name);
|
||||
virtual ~cViewMenuRecordings(void);
|
||||
void SetItem(const cRecording *recording, int index, bool current, bool selectable, int level, int total, int New);
|
||||
};
|
||||
|
||||
/***********************************************************
|
||||
* cViewMenuPlugins
|
||||
***********************************************************/
|
||||
class cViewMenuPlugin : public cSubView {
|
||||
private:
|
||||
cViewListPlugin *listPlugin;
|
||||
void SetViewElementObjects(void);
|
||||
public:
|
||||
cViewMenuPlugin(const char *name);
|
||||
virtual ~cViewMenuPlugin(void);
|
||||
void SetItem(skindesignerapi::cTokenContainer *tk, int index, bool current, bool selectable);
|
||||
};
|
||||
|
||||
/***********************************************************
|
||||
* cViewMenuDetail
|
||||
***********************************************************/
|
||||
class cViewMenuDetail : public cSubView {
|
||||
private:
|
||||
bool firstTab;
|
||||
cVeDmDetailheaderEpg *detailedheaderEpg;
|
||||
cVeDmDetailheaderRec *detailedheaderRec;
|
||||
cVeDmDetailheaderPlugin *detailedheaderPlug;
|
||||
cVeDmTablabels *tablabels;
|
||||
cViewDetail *detailView;
|
||||
cViewDetailEpg *detailViewEpg;
|
||||
cViewDetailRec *detailViewRec;
|
||||
cViewDetailText *detailViewText;
|
||||
cViewDetailPlugin *detailViewPlugin;
|
||||
void SetDetailedView(void);
|
||||
void SetViewElements(void);
|
||||
void SetViewElementObjects(void);
|
||||
void DrawScrollbar(void);
|
||||
public:
|
||||
cViewMenuDetail(const char *name);
|
||||
virtual ~cViewMenuDetail(void);
|
||||
void SetGlobals(cGlobals *globals);
|
||||
void AddTab(cArea *tab);
|
||||
void PreCache(void);
|
||||
int GetWidth(void);
|
||||
void SetEvent(const cEvent *event);
|
||||
void SetRecording(const cRecording *recording);
|
||||
void SetText(const char *text);
|
||||
void SetPluginText(skindesignerapi::cTokenContainer *tk);
|
||||
void Clear(void);
|
||||
void Close(void);
|
||||
void DrawStaticVEs(void);
|
||||
void DrawDynamicVEs(void);
|
||||
void DrawDetailedView(void);
|
||||
void KeyLeft(void);
|
||||
void KeyRight(void);
|
||||
void KeyUp(void);
|
||||
void KeyDown(void);
|
||||
void SetTransparency(int transparency, bool forceDetached = false);
|
||||
};
|
||||
|
||||
#endif //__VIEWDISPLAYMENU_H
|
||||
@@ -1,54 +1,54 @@
|
||||
#include "viewdisplaymessage.h"
|
||||
#include "../config.h"
|
||||
|
||||
/************************************************************************************
|
||||
* cViewMessage
|
||||
************************************************************************************/
|
||||
|
||||
cViewMessage::cViewMessage(void) {
|
||||
ClearVariables();
|
||||
viewId = eViewType::DisplayMessage;
|
||||
viewName = strdup("displaymessage");
|
||||
numViewElements = (int)eVeDisplayMessage::count;
|
||||
viewElements = new cViewElement*[numViewElements];
|
||||
for (int i=0; i < numViewElements; i++) {
|
||||
viewElements[i] = NULL;
|
||||
}
|
||||
SetViewElements();
|
||||
veMessage = NULL;
|
||||
}
|
||||
|
||||
cViewMessage::~cViewMessage() {
|
||||
}
|
||||
|
||||
void cViewMessage::SetViewElements(void) {
|
||||
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayMessage::background));
|
||||
viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayMessage::message));
|
||||
}
|
||||
|
||||
void cViewMessage::SetViewElementObjects(void) {
|
||||
if (!viewElements[(int)eVeDisplayMessage::message])
|
||||
return;
|
||||
veMessage = dynamic_cast<cVeMessage*>(viewElements[(int)eVeDisplayMessage::message]);
|
||||
}
|
||||
|
||||
void cViewMessage::ClearVariables(void) {
|
||||
init = true;
|
||||
}
|
||||
|
||||
void cViewMessage::SetMessage(eMessageType type, const char *text) {
|
||||
if (!text)
|
||||
veMessage->Clear();
|
||||
else
|
||||
veMessage->Set(type, text);
|
||||
}
|
||||
|
||||
void cViewMessage::Flush(void) {
|
||||
if (init) {
|
||||
sdOsd.LockFlush();
|
||||
Render((int)eVeDisplayMessage::background);
|
||||
}
|
||||
Render((int)eVeDisplayMessage::message);
|
||||
cView::Flush();
|
||||
}
|
||||
|
||||
#include "viewdisplaymessage.h"
|
||||
#include "../config.h"
|
||||
|
||||
/************************************************************************************
|
||||
* cViewMessage
|
||||
************************************************************************************/
|
||||
|
||||
cViewMessage::cViewMessage(void) {
|
||||
ClearVariables();
|
||||
viewId = eViewType::DisplayMessage;
|
||||
viewName = strdup("displaymessage");
|
||||
numViewElements = (int)eVeDisplayMessage::count;
|
||||
viewElements = new cViewElement*[numViewElements];
|
||||
for (int i=0; i < numViewElements; i++) {
|
||||
viewElements[i] = NULL;
|
||||
}
|
||||
SetViewElements();
|
||||
veMessage = NULL;
|
||||
}
|
||||
|
||||
cViewMessage::~cViewMessage() {
|
||||
}
|
||||
|
||||
void cViewMessage::SetViewElements(void) {
|
||||
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayMessage::background));
|
||||
viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayMessage::message));
|
||||
}
|
||||
|
||||
void cViewMessage::SetViewElementObjects(void) {
|
||||
if (!viewElements[(int)eVeDisplayMessage::message])
|
||||
return;
|
||||
veMessage = dynamic_cast<cVeMessage*>(viewElements[(int)eVeDisplayMessage::message]);
|
||||
}
|
||||
|
||||
void cViewMessage::ClearVariables(void) {
|
||||
init = true;
|
||||
}
|
||||
|
||||
void cViewMessage::SetMessage(eMessageType type, const char *text) {
|
||||
if (!text)
|
||||
veMessage->Clear();
|
||||
else
|
||||
veMessage->Set(type, text);
|
||||
}
|
||||
|
||||
void cViewMessage::Flush(void) {
|
||||
if (init) {
|
||||
sdOsd.LockFlush();
|
||||
Render((int)eVeDisplayMessage::background);
|
||||
}
|
||||
Render((int)eVeDisplayMessage::message);
|
||||
cView::Flush();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
#ifndef __VIEWDISPLAYMESSAGE_H
|
||||
#define __VIEWDISPLAYMESSAGE_H
|
||||
|
||||
#include "view.h"
|
||||