fixed line breaks

This commit is contained in:
louis 2016-02-06 09:55:15 +01:00
parent 8ef68f8ab8
commit ac0e6dbc8d
62 changed files with 21702 additions and 21702 deletions

View File

@ -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;
}
}

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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

View File

@ -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();
}

View File

@ -1,19 +1,19 @@
#ifndef __VIEWDISPLAYMESSAGE_H
#define __VIEWDISPLAYMESSAGE_H
#include "view.h"
class cViewMessage : public cView {
private:
cVeMessage *veMessage;
void SetViewElements(void);
void SetViewElementObjects(void);
void ClearVariables(void);
public:
cViewMessage(void);
virtual ~cViewMessage(void);
void SetMessage(eMessageType type, const char *text);
void Flush(void);
};
#ifndef __VIEWDISPLAYMESSAGE_H
#define __VIEWDISPLAYMESSAGE_H
#include "view.h"
class cViewMessage : public cView {
private:
cVeMessage *veMessage;
void SetViewElements(void);
void SetViewElementObjects(void);
void ClearVariables(void);
public:
cViewMessage(void);
virtual ~cViewMessage(void);
void SetMessage(eMessageType type, const char *text);
void Flush(void);
};
#endif //__VIEWDISPLAYMESSAGE_H

File diff suppressed because it is too large Load Diff

View File

@ -1,101 +1,101 @@
#ifndef __VIEWDISPLAYPLUGIN_H
#define __VIEWDISPLAYPLUGIN_H
#include "view.h"
#include "viewdetail.h"
#include "viewelementsdisplaymenu.h"
#include "viewgrid.h"
#include "../libskindesignerapi/skindesignerapi.h"
class cPluginTabView;
/***********************************************************
* cViewPlugin
***********************************************************/
class cViewPlugin : public cView, public skindesignerapi::ISkinDisplayPlugin {
private:
int id;
int plugId;
int numViews;
cViewPlugin **views;
int numViewGrids;
cViewGrid **viewGrids;
map<string,int> gridNames;
cPluginTabView *tabView;
bool viewChanged;
int newViewId;
void SetViewElements(void);
void SetViewGrids(void);
int GridId(const char *name);
public:
cViewPlugin(int id, int plugId);
~cViewPlugin(void);
//Internal Interface
bool ReadFromXML(const char *plugName, const char *tplName, cSdOsd *osd = NULL);
bool ReadSubViews(const char *plugName);
void AddViewElement(cVePlugin *viewElement);
void AddViewGrid(cViewGrid *viewGrid);
void AddTab(cArea *tab);
void AddScrollbar(cVeDmScrollbar *scrollbar);
void AddTablabels(cVeDmTablabels *tablabels);
void SetGlobals(cGlobals *globals);
void PreCache(void);
cVePlugin *GetViewElement(int veId);
cViewGrid *GetViewGrid(int gId);
cPluginTabView *GetViewTab(void);
void Hide(void);
void Show(void);
//libskindesigner api interface
bool InitOsd(void);
void CloseOsd(void);
void Deactivate(int viewId, bool hide);
void Activate(int viewId);
void SetViewElementTokens(int veId, int viewId, skindesignerapi::cTokenContainer *tk);
void ClearViewElement(int veId, int viewId);
void DisplayViewElement(int veId, int viewId);
void SetGrid(long gId, int viewId, int viewGridId, double x, double y, double width, double height, skindesignerapi::cTokenContainer *tk);
void SetGridCurrent(long gId, int viewId, int viewGridId, bool current);
void DeleteGrid(long gId, int viewId, int viewGridId);
void DisplayGrids(int viewId, int viewGridId);
void ClearGrids(int viewId, int viewGridId);
void SetTabTokens(int viewId, skindesignerapi::cTokenContainer *tk);
void TabLeft(int viewId);
void TabRight(int viewId);
void TabUp(int viewId);
void TabDown(int viewId);
void DisplayTabs(int viewId);
void ClearTab(int viewId);
void Flush(void);
bool ChannelLogoExists(string channelId);
string GetEpgImagePath(void);
};
/***********************************************************
* cPluginTabView
***********************************************************/
class cPluginTabView {
private:
cSdOsd *sdOsd;
bool init;
bool drawScrollbar;
bool firstTab;
cVeDmScrollbar *scrollbar;
cVeDmTablabels *tablabels;
cViewDetailAdvancedPlugin *detailView;
void DrawScrollbar(void);
public:
cPluginTabView(int viewId, int plugId);
~cPluginTabView(void);
void SetGlobals(cGlobals *globals);
void SetOsd(cSdOsd *osd) { sdOsd = osd; };
void AddTab(cArea *tab);
void AddScrollbar(cVeDmScrollbar *scrollbar);
void AddTablabels(cVeDmTablabels *tablabels);
void PreCache(int containerX, int containerY, int containerWidth, int containerHeight);
void Set(skindesignerapi::cTokenContainer *tk);
void Render(void);
void Clear(void);
void KeyLeft(void);
void KeyRight(void);
void KeyUp(void);
void KeyDown(void);
};
#ifndef __VIEWDISPLAYPLUGIN_H
#define __VIEWDISPLAYPLUGIN_H
#include "view.h"
#include "viewdetail.h"
#include "viewelementsdisplaymenu.h"
#include "viewgrid.h"
#include "../libskindesignerapi/skindesignerapi.h"
class cPluginTabView;
/***********************************************************
* cViewPlugin
***********************************************************/
class cViewPlugin : public cView, public skindesignerapi::ISkinDisplayPlugin {
private:
int id;
int plugId;
int numViews;
cViewPlugin **views;
int numViewGrids;
cViewGrid **viewGrids;
map<string,int> gridNames;
cPluginTabView *tabView;
bool viewChanged;
int newViewId;
void SetViewElements(void);
void SetViewGrids(void);
int GridId(const char *name);
public:
cViewPlugin(int id, int plugId);
~cViewPlugin(void);
//Internal Interface
bool ReadFromXML(const char *plugName, const char *tplName, cSdOsd *osd = NULL);
bool ReadSubViews(const char *plugName);
void AddViewElement(cVePlugin *viewElement);
void AddViewGrid(cViewGrid *viewGrid);
void AddTab(cArea *tab);
void AddScrollbar(cVeDmScrollbar *scrollbar);
void AddTablabels(cVeDmTablabels *tablabels);
void SetGlobals(cGlobals *globals);
void PreCache(void);
cVePlugin *GetViewElement(int veId);
cViewGrid *GetViewGrid(int gId);
cPluginTabView *GetViewTab(void);
void Hide(void);
void Show(void);
//libskindesigner api interface
bool InitOsd(void);
void CloseOsd(void);
void Deactivate(int viewId, bool hide);
void Activate(int viewId);
void SetViewElementTokens(int veId, int viewId, skindesignerapi::cTokenContainer *tk);
void ClearViewElement(int veId, int viewId);
void DisplayViewElement(int veId, int viewId);
void SetGrid(long gId, int viewId, int viewGridId, double x, double y, double width, double height, skindesignerapi::cTokenContainer *tk);
void SetGridCurrent(long gId, int viewId, int viewGridId, bool current);
void DeleteGrid(long gId, int viewId, int viewGridId);
void DisplayGrids(int viewId, int viewGridId);
void ClearGrids(int viewId, int viewGridId);
void SetTabTokens(int viewId, skindesignerapi::cTokenContainer *tk);
void TabLeft(int viewId);
void TabRight(int viewId);
void TabUp(int viewId);
void TabDown(int viewId);
void DisplayTabs(int viewId);
void ClearTab(int viewId);
void Flush(void);
bool ChannelLogoExists(string channelId);
string GetEpgImagePath(void);
};
/***********************************************************
* cPluginTabView
***********************************************************/
class cPluginTabView {
private:
cSdOsd *sdOsd;
bool init;
bool drawScrollbar;
bool firstTab;
cVeDmScrollbar *scrollbar;
cVeDmTablabels *tablabels;
cViewDetailAdvancedPlugin *detailView;
void DrawScrollbar(void);
public:
cPluginTabView(int viewId, int plugId);
~cPluginTabView(void);
void SetGlobals(cGlobals *globals);
void SetOsd(cSdOsd *osd) { sdOsd = osd; };
void AddTab(cArea *tab);
void AddScrollbar(cVeDmScrollbar *scrollbar);
void AddTablabels(cVeDmTablabels *tablabels);
void PreCache(int containerX, int containerY, int containerWidth, int containerHeight);
void Set(skindesignerapi::cTokenContainer *tk);
void Render(void);
void Clear(void);
void KeyLeft(void);
void KeyRight(void);
void KeyUp(void);
void KeyDown(void);
};
#endif //__VIEWDISPLAYPLUGIN_H

View File

@ -1,314 +1,314 @@
#include "viewdisplayreplay.h"
/************************************************************************************
* cViewReplay
************************************************************************************/
cViewReplay::cViewReplay(void) {
veCustomTokens = NULL;
veEndTime = NULL;
veMessage = NULL;
veScraperContent = NULL;
veRecTitle = NULL;
veRecInfo = NULL;
veCurrentTime = NULL;
veTotalTime = NULL;
veProgressbar = NULL;
veCutMarks = NULL;
veProgressModeOnly = NULL;
veControlIcons = NULL;
veControlIconsModeOnly = NULL;
veJump = NULL;
veOnPause = NULL;
veOnPauseModeOnly = NULL;
ClearVariables();
viewId = eViewType::DisplayReplay;
viewName = strdup("displayreplay");
numViewElements = (int)eVeDisplayReplay::count;
viewElements = new cViewElement*[numViewElements];
for (int i=0; i < numViewElements; i++) {
viewElements[i] = NULL;
}
SetViewElements();
}
cViewReplay::~cViewReplay() {
}
void cViewReplay::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayReplay::background));
viewElementNames.insert(pair<string, int>("backgroundmodeonly", (int)eVeDisplayReplay::backgroundmodeonly));
viewElementNames.insert(pair<string, int>("datetime", (int)eVeDisplayReplay::datetime));
viewElementNames.insert(pair<string, int>("time", (int)eVeDisplayReplay::time));
viewElementNames.insert(pair<string, int>("scrapercontent", (int)eVeDisplayReplay::scrapercontent));
viewElementNames.insert(pair<string, int>("rectitle", (int)eVeDisplayReplay::rectitle));
viewElementNames.insert(pair<string, int>("recinfo", (int)eVeDisplayReplay::recinfo));
viewElementNames.insert(pair<string, int>("currenttime", (int)eVeDisplayReplay::currenttime));
viewElementNames.insert(pair<string, int>("endtime", (int)eVeDisplayReplay::endtime));
viewElementNames.insert(pair<string, int>("totaltime", (int)eVeDisplayReplay::totaltime));
viewElementNames.insert(pair<string, int>("progressbar", (int)eVeDisplayReplay::progressbar));
viewElementNames.insert(pair<string, int>("cutmarks", (int)eVeDisplayReplay::cutmarks));
viewElementNames.insert(pair<string, int>("cutmarks", (int)eVeDisplayReplay::cutmarks));
viewElementNames.insert(pair<string, int>("controlicons", (int)eVeDisplayReplay::controlicons));
viewElementNames.insert(pair<string, int>("controliconsmodeonly", (int)eVeDisplayReplay::controliconsmodeonly));
viewElementNames.insert(pair<string, int>("progressmodeonly", (int)eVeDisplayReplay::progressmodeonly));
viewElementNames.insert(pair<string, int>("jump", (int)eVeDisplayReplay::jump));
viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayReplay::message));
viewElementNames.insert(pair<string, int>("onpause", (int)eVeDisplayReplay::onpause));
viewElementNames.insert(pair<string, int>("onpausemodeonly", (int)eVeDisplayReplay::onpausemodeonly));
viewElementNames.insert(pair<string, int>("customtokens", (int)eVeDisplayReplay::customtokens));
}
void cViewReplay::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<cVeDrScraperContent*>(viewElements[i]))
{
veScraperContent = dynamic_cast<cVeDrScraperContent*>(viewElements[i]);
}
else if (dynamic_cast<cVeCustomTokens*>(viewElements[i]))
{
veCustomTokens = dynamic_cast<cVeCustomTokens*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrRecTitle*>(viewElements[i]))
{
veRecTitle = dynamic_cast<cVeDrRecTitle*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrRecInfo*>(viewElements[i]))
{
veRecInfo = dynamic_cast<cVeDrRecInfo*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrCurrentTime*>(viewElements[i]))
{
veCurrentTime = dynamic_cast<cVeDrCurrentTime*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrTotalTime*>(viewElements[i]))
{
veTotalTime = dynamic_cast<cVeDrTotalTime*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrEndTime*>(viewElements[i]))
{
veEndTime = dynamic_cast<cVeDrEndTime*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrProgressBar*>(viewElements[i]))
{
veProgressbar = dynamic_cast<cVeDrProgressBar*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrCutMarks*>(viewElements[i]))
{
veCutMarks = dynamic_cast<cVeDrCutMarks*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrProgressModeonly*>(viewElements[i]))
{
veProgressModeOnly = dynamic_cast<cVeDrProgressModeonly*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrControlIcons*>(viewElements[i]) && (i == (int)eVeDisplayReplay::controlicons))
{
veControlIcons = dynamic_cast<cVeDrControlIcons*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrControlIcons*>(viewElements[i]) && i == (int)eVeDisplayReplay::controliconsmodeonly)
{
veControlIconsModeOnly = dynamic_cast<cVeDrControlIcons*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrJump*>(viewElements[i]))
{
veJump = dynamic_cast<cVeDrJump*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrOnPause*>(viewElements[i]) && i == (int)eVeDisplayReplay::onpause)
{
veOnPause = dynamic_cast<cVeDrOnPause*>(viewElements[i]);
veOnPause->SetDetached();
veOnPause->UnsetWaitOnWakeup();
}
else if (dynamic_cast<cVeDrOnPause*>(viewElements[i]) && i == (int)eVeDisplayReplay::onpausemodeonly)
{
veOnPauseModeOnly = dynamic_cast<cVeDrOnPause*>(viewElements[i]);
veOnPauseModeOnly->SetDetached();
veOnPauseModeOnly->UnsetWaitOnWakeup();
}
}
}
void cViewReplay::ClearVariables(void) {
cView::ClearVariables();
modeOnly = false;
lastFlush = 0;
message = false;
reclength = -1;
timeShiftActive = false;
timeShiftFramesTotal = -1;
timeShiftLength = -1;
timeShiftDuration = "";
if (veCustomTokens)
veCustomTokens->Reset();
if (veEndTime)
veEndTime->Set(cString(""));
if (veCutMarks)
veCutMarks->Reset();
}
void cViewReplay::SetTimeShift(int framesTotal, int timeShiftLength) {
timeShiftActive = true;
timeShiftFramesTotal = framesTotal;
this->timeShiftLength = timeShiftLength;
int mins = (timeShiftLength / 60) % 60;
int hours = (timeShiftLength / 3600) % 24;
timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
}
void cViewReplay::SetRecording(const cRecording *recording) {
if (veRecTitle) {
veRecTitle->Set(recording);
}
if (veRecInfo) {
veRecInfo->Set(recording);
}
if (veScraperContent) {
veScraperContent->Set(recording);
}
}
void cViewReplay::SetTitle(const char *title) {
if (veRecTitle) {
veRecTitle->Set(title);
}
}
void cViewReplay::SetCurrent(const char *current) {
if (veCurrentTime)
veCurrentTime->Set(current);
Render((int)eVeDisplayReplay::currenttime);
//good place to refresh these viewelements
//since SetCurrent is called every second
Render((int)eVeDisplayReplay::datetime);
Render((int)eVeDisplayReplay::time);
Render((int)eVeDisplayChannel::customtokens);
}
void cViewReplay::SetTotal(const char *total) {
if (veTotalTime)
veTotalTime->Set(total, timeShiftActive, *timeShiftDuration);
Render((int)eVeDisplayReplay::totaltime);
}
void cViewReplay::SetEndTime(int current, int total) {
if (!veEndTime)
return;
int totalLength = total;
int recordingLength = reclength;
if (timeShiftActive && timeShiftFramesTotal > 0) {
totalLength = timeShiftFramesTotal;
recordingLength = timeShiftLength;
}
double rest = (double)(totalLength - current) / (double)totalLength;
time_t end = time(0) + rest*recordingLength;
veEndTime->Set(TimeString(end));
Render((int)eVeDisplayReplay::endtime);
}
void cViewReplay::SetProgressbar(int current, int total) {
if (veProgressbar)
veProgressbar->Set(current, total, timeShiftActive, timeShiftFramesTotal);
Render((int)eVeDisplayReplay::progressbar);
}
void cViewReplay::SetMarks(const cMarks *marks, int current, int total) {
if (veCutMarks)
veCutMarks->Set(marks, current, total, timeShiftActive, timeShiftFramesTotal);
Render((int)eVeDisplayReplay::cutmarks);
}
void cViewReplay::SetControlIcons(bool play, bool forward, int speed) {
if (!modeOnly) {
if (veControlIcons)
veControlIcons->Set(play, forward, speed);
Render((int)eVeDisplayReplay::controlicons);
} else {
if (veControlIconsModeOnly)
veControlIconsModeOnly->Set(play, forward, speed);
Render((int)eVeDisplayReplay::controliconsmodeonly);
}
}
void cViewReplay::SetJump(const char *jump) {
if (veJump) {
if (!jump)
veJump->Clear();
else
veJump->Set(jump);
}
Render((int)eVeDisplayReplay::jump);
}
void cViewReplay::SetMessage(eMessageType type, const char *text) {
if (veMessage) {
if (text)
veMessage->Set(type, text);
else
veMessage->Clear();
}
Render((int)eVeDisplayReplay::message);
}
void cViewReplay::StartOnPause(const char *recfilename) {
cVeDrOnPause *onPause = (!modeOnly) ? veOnPause : veOnPauseModeOnly;
if (!onPause)
return;
onPause->Set(recfilename);
onPause->Parse(true);
}
void cViewReplay::ClearOnPause(void) {
cVeDrOnPause *onPause = (!modeOnly) ? veOnPause : veOnPauseModeOnly;
if (!onPause)
return;
onPause->Close();
}
void cViewReplay::Flush(void) {
if (init) {
sdOsd.LockFlush();
if (!modeOnly) {
Render((int)eVeDisplayReplay::background);
Render((int)eVeDisplayReplay::rectitle);
Render((int)eVeDisplayReplay::recinfo);
Render((int)eVeDisplayReplay::scrapercontent);
} else {
Render((int)eVeDisplayReplay::backgroundmodeonly);
}
}
if (modeOnly) {
SetProgressModeOnly();
}
cView::Flush();
}
void cViewReplay::SetProgressModeOnly(void) {
if (!veProgressModeOnly)
return;
time_t now = time(0);
if (now == lastFlush) {
return;
}
lastFlush = now;
cControl *control = cControl::Control();
if (!control)
return;
double fps = control->FramesPerSecond();
int current = 0;
int total = 0;
if (!control->GetIndex(current, total))
return;
veProgressModeOnly->Set(fps, current, total);
if (veProgressModeOnly->Parse())
veProgressModeOnly->Render();
#include "viewdisplayreplay.h"
/************************************************************************************
* cViewReplay
************************************************************************************/
cViewReplay::cViewReplay(void) {
veCustomTokens = NULL;
veEndTime = NULL;
veMessage = NULL;
veScraperContent = NULL;
veRecTitle = NULL;
veRecInfo = NULL;
veCurrentTime = NULL;
veTotalTime = NULL;
veProgressbar = NULL;
veCutMarks = NULL;
veProgressModeOnly = NULL;
veControlIcons = NULL;
veControlIconsModeOnly = NULL;
veJump = NULL;
veOnPause = NULL;
veOnPauseModeOnly = NULL;
ClearVariables();
viewId = eViewType::DisplayReplay;
viewName = strdup("displayreplay");
numViewElements = (int)eVeDisplayReplay::count;
viewElements = new cViewElement*[numViewElements];
for (int i=0; i < numViewElements; i++) {
viewElements[i] = NULL;
}
SetViewElements();
}
cViewReplay::~cViewReplay() {
}
void cViewReplay::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayReplay::background));
viewElementNames.insert(pair<string, int>("backgroundmodeonly", (int)eVeDisplayReplay::backgroundmodeonly));
viewElementNames.insert(pair<string, int>("datetime", (int)eVeDisplayReplay::datetime));
viewElementNames.insert(pair<string, int>("time", (int)eVeDisplayReplay::time));
viewElementNames.insert(pair<string, int>("scrapercontent", (int)eVeDisplayReplay::scrapercontent));
viewElementNames.insert(pair<string, int>("rectitle", (int)eVeDisplayReplay::rectitle));
viewElementNames.insert(pair<string, int>("recinfo", (int)eVeDisplayReplay::recinfo));
viewElementNames.insert(pair<string, int>("currenttime", (int)eVeDisplayReplay::currenttime));
viewElementNames.insert(pair<string, int>("endtime", (int)eVeDisplayReplay::endtime));
viewElementNames.insert(pair<string, int>("totaltime", (int)eVeDisplayReplay::totaltime));
viewElementNames.insert(pair<string, int>("progressbar", (int)eVeDisplayReplay::progressbar));
viewElementNames.insert(pair<string, int>("cutmarks", (int)eVeDisplayReplay::cutmarks));
viewElementNames.insert(pair<string, int>("cutmarks", (int)eVeDisplayReplay::cutmarks));
viewElementNames.insert(pair<string, int>("controlicons", (int)eVeDisplayReplay::controlicons));
viewElementNames.insert(pair<string, int>("controliconsmodeonly", (int)eVeDisplayReplay::controliconsmodeonly));
viewElementNames.insert(pair<string, int>("progressmodeonly", (int)eVeDisplayReplay::progressmodeonly));
viewElementNames.insert(pair<string, int>("jump", (int)eVeDisplayReplay::jump));
viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayReplay::message));
viewElementNames.insert(pair<string, int>("onpause", (int)eVeDisplayReplay::onpause));
viewElementNames.insert(pair<string, int>("onpausemodeonly", (int)eVeDisplayReplay::onpausemodeonly));
viewElementNames.insert(pair<string, int>("customtokens", (int)eVeDisplayReplay::customtokens));
}
void cViewReplay::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<cVeDrScraperContent*>(viewElements[i]))
{
veScraperContent = dynamic_cast<cVeDrScraperContent*>(viewElements[i]);
}
else if (dynamic_cast<cVeCustomTokens*>(viewElements[i]))
{
veCustomTokens = dynamic_cast<cVeCustomTokens*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrRecTitle*>(viewElements[i]))
{
veRecTitle = dynamic_cast<cVeDrRecTitle*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrRecInfo*>(viewElements[i]))
{
veRecInfo = dynamic_cast<cVeDrRecInfo*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrCurrentTime*>(viewElements[i]))
{
veCurrentTime = dynamic_cast<cVeDrCurrentTime*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrTotalTime*>(viewElements[i]))
{
veTotalTime = dynamic_cast<cVeDrTotalTime*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrEndTime*>(viewElements[i]))
{
veEndTime = dynamic_cast<cVeDrEndTime*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrProgressBar*>(viewElements[i]))
{
veProgressbar = dynamic_cast<cVeDrProgressBar*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrCutMarks*>(viewElements[i]))
{
veCutMarks = dynamic_cast<cVeDrCutMarks*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrProgressModeonly*>(viewElements[i]))
{
veProgressModeOnly = dynamic_cast<cVeDrProgressModeonly*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrControlIcons*>(viewElements[i]) && (i == (int)eVeDisplayReplay::controlicons))
{
veControlIcons = dynamic_cast<cVeDrControlIcons*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrControlIcons*>(viewElements[i]) && i == (int)eVeDisplayReplay::controliconsmodeonly)
{
veControlIconsModeOnly = dynamic_cast<cVeDrControlIcons*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrJump*>(viewElements[i]))
{
veJump = dynamic_cast<cVeDrJump*>(viewElements[i]);
}
else if (dynamic_cast<cVeDrOnPause*>(viewElements[i]) && i == (int)eVeDisplayReplay::onpause)
{
veOnPause = dynamic_cast<cVeDrOnPause*>(viewElements[i]);
veOnPause->SetDetached();
veOnPause->UnsetWaitOnWakeup();
}
else if (dynamic_cast<cVeDrOnPause*>(viewElements[i]) && i == (int)eVeDisplayReplay::onpausemodeonly)
{
veOnPauseModeOnly = dynamic_cast<cVeDrOnPause*>(viewElements[i]);
veOnPauseModeOnly->SetDetached();
veOnPauseModeOnly->UnsetWaitOnWakeup();
}
}
}
void cViewReplay::ClearVariables(void) {
cView::ClearVariables();
modeOnly = false;
lastFlush = 0;
message = false;
reclength = -1;
timeShiftActive = false;
timeShiftFramesTotal = -1;
timeShiftLength = -1;
timeShiftDuration = "";
if (veCustomTokens)
veCustomTokens->Reset();
if (veEndTime)
veEndTime->Set(cString(""));
if (veCutMarks)
veCutMarks->Reset();
}
void cViewReplay::SetTimeShift(int framesTotal, int timeShiftLength) {
timeShiftActive = true;
timeShiftFramesTotal = framesTotal;
this->timeShiftLength = timeShiftLength;
int mins = (timeShiftLength / 60) % 60;
int hours = (timeShiftLength / 3600) % 24;
timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
}
void cViewReplay::SetRecording(const cRecording *recording) {
if (veRecTitle) {
veRecTitle->Set(recording);
}
if (veRecInfo) {
veRecInfo->Set(recording);
}
if (veScraperContent) {
veScraperContent->Set(recording);
}
}
void cViewReplay::SetTitle(const char *title) {
if (veRecTitle) {
veRecTitle->Set(title);
}
}
void cViewReplay::SetCurrent(const char *current) {
if (veCurrentTime)
veCurrentTime->Set(current);
Render((int)eVeDisplayReplay::currenttime);
//good place to refresh these viewelements
//since SetCurrent is called every second
Render((int)eVeDisplayReplay::datetime);
Render((int)eVeDisplayReplay::time);
Render((int)eVeDisplayChannel::customtokens);
}
void cViewReplay::SetTotal(const char *total) {
if (veTotalTime)
veTotalTime->Set(total, timeShiftActive, *timeShiftDuration);
Render((int)eVeDisplayReplay::totaltime);
}
void cViewReplay::SetEndTime(int current, int total) {
if (!veEndTime)
return;
int totalLength = total;
int recordingLength = reclength;
if (timeShiftActive && timeShiftFramesTotal > 0) {
totalLength = timeShiftFramesTotal;
recordingLength = timeShiftLength;
}
double rest = (double)(totalLength - current) / (double)totalLength;
time_t end = time(0) + rest*recordingLength;
veEndTime->Set(TimeString(end));
Render((int)eVeDisplayReplay::endtime);
}
void cViewReplay::SetProgressbar(int current, int total) {
if (veProgressbar)
veProgressbar->Set(current, total, timeShiftActive, timeShiftFramesTotal);
Render((int)eVeDisplayReplay::progressbar);
}
void cViewReplay::SetMarks(const cMarks *marks, int current, int total) {
if (veCutMarks)
veCutMarks->Set(marks, current, total, timeShiftActive, timeShiftFramesTotal);
Render((int)eVeDisplayReplay::cutmarks);
}
void cViewReplay::SetControlIcons(bool play, bool forward, int speed) {
if (!modeOnly) {
if (veControlIcons)
veControlIcons->Set(play, forward, speed);
Render((int)eVeDisplayReplay::controlicons);
} else {
if (veControlIconsModeOnly)
veControlIconsModeOnly->Set(play, forward, speed);
Render((int)eVeDisplayReplay::controliconsmodeonly);
}
}
void cViewReplay::SetJump(const char *jump) {
if (veJump) {
if (!jump)
veJump->Clear();
else
veJump->Set(jump);
}
Render((int)eVeDisplayReplay::jump);
}
void cViewReplay::SetMessage(eMessageType type, const char *text) {
if (veMessage) {
if (text)
veMessage->Set(type, text);
else
veMessage->Clear();
}
Render((int)eVeDisplayReplay::message);
}
void cViewReplay::StartOnPause(const char *recfilename) {
cVeDrOnPause *onPause = (!modeOnly) ? veOnPause : veOnPauseModeOnly;
if (!onPause)
return;
onPause->Set(recfilename);
onPause->Parse(true);
}
void cViewReplay::ClearOnPause(void) {
cVeDrOnPause *onPause = (!modeOnly) ? veOnPause : veOnPauseModeOnly;
if (!onPause)
return;
onPause->Close();
}
void cViewReplay::Flush(void) {
if (init) {
sdOsd.LockFlush();
if (!modeOnly) {
Render((int)eVeDisplayReplay::background);
Render((int)eVeDisplayReplay::rectitle);
Render((int)eVeDisplayReplay::recinfo);
Render((int)eVeDisplayReplay::scrapercontent);
} else {
Render((int)eVeDisplayReplay::backgroundmodeonly);
}
}
if (modeOnly) {
SetProgressModeOnly();
}
cView::Flush();
}
void cViewReplay::SetProgressModeOnly(void) {
if (!veProgressModeOnly)
return;
time_t now = time(0);
if (now == lastFlush) {
return;
}
lastFlush = now;
cControl *control = cControl::Control();
if (!control)
return;
double fps = control->FramesPerSecond();
int current = 0;
int total = 0;
if (!control->GetIndex(current, total))
return;
veProgressModeOnly->Set(fps, current, total);
if (veProgressModeOnly->Parse())
veProgressModeOnly->Render();
}

View File

@ -1,57 +1,57 @@
#ifndef __VIEWDISPLAYREPLAY_H
#define __VIEWDISPLAYREPLAY_H
#include "view.h"
class cViewReplay : public cView {
private:
cVeMessage *veMessage;
cVeCustomTokens *veCustomTokens;
cVeDrRecTitle *veRecTitle;
cVeDrRecInfo *veRecInfo;
cVeDrScraperContent *veScraperContent;
cVeDrCurrentTime *veCurrentTime;
cVeDrTotalTime *veTotalTime;
cVeDrEndTime *veEndTime;
cVeDrProgressBar *veProgressbar;
cVeDrCutMarks *veCutMarks;
cVeDrProgressModeonly *veProgressModeOnly;
cVeDrControlIcons *veControlIcons;
cVeDrControlIcons *veControlIconsModeOnly;
cVeDrJump *veJump;
cVeDrOnPause *veOnPause;
cVeDrOnPause *veOnPauseModeOnly;
bool modeOnly;
time_t lastFlush;
bool message;
int reclength;
bool timeShiftActive;
int timeShiftFramesTotal;
int timeShiftLength;
cString timeShiftDuration;
void SetViewElements(void);
void ClearVariables(void);
void SetViewElementObjects(void);
void SetProgressModeOnly(void);
public:
cViewReplay(void);
virtual ~cViewReplay(void);
void SetModeOnly(bool modeOnly) { this->modeOnly = modeOnly; };
void SetRecordingLength(int length) { reclength = length; };
void SetTimeShift(int framesTotal, int timeShiftLength);
void SetRecording(const cRecording *recording);
void SetTitle(const char *title);
void SetCurrent(const char *current);
void SetTotal(const char *total);
void SetEndTime(int current, int total);
void SetProgressbar(int current, int total);
void SetMarks(const cMarks *marks, int current, int total);
void SetControlIcons(bool play, bool forward, int speed);
void SetJump(const char *jump);
void SetMessage(eMessageType type, const char *text);
void StartOnPause(const char *recfilename);
void ClearOnPause(void);
void Flush(void);
};
#ifndef __VIEWDISPLAYREPLAY_H
#define __VIEWDISPLAYREPLAY_H
#include "view.h"
class cViewReplay : public cView {
private:
cVeMessage *veMessage;
cVeCustomTokens *veCustomTokens;
cVeDrRecTitle *veRecTitle;
cVeDrRecInfo *veRecInfo;
cVeDrScraperContent *veScraperContent;
cVeDrCurrentTime *veCurrentTime;
cVeDrTotalTime *veTotalTime;
cVeDrEndTime *veEndTime;
cVeDrProgressBar *veProgressbar;
cVeDrCutMarks *veCutMarks;
cVeDrProgressModeonly *veProgressModeOnly;
cVeDrControlIcons *veControlIcons;
cVeDrControlIcons *veControlIconsModeOnly;
cVeDrJump *veJump;
cVeDrOnPause *veOnPause;
cVeDrOnPause *veOnPauseModeOnly;
bool modeOnly;
time_t lastFlush;
bool message;
int reclength;
bool timeShiftActive;
int timeShiftFramesTotal;
int timeShiftLength;
cString timeShiftDuration;
void SetViewElements(void);
void ClearVariables(void);
void SetViewElementObjects(void);
void SetProgressModeOnly(void);
public:
cViewReplay(void);
virtual ~cViewReplay(void);
void SetModeOnly(bool modeOnly) { this->modeOnly = modeOnly; };
void SetRecordingLength(int length) { reclength = length; };
void SetTimeShift(int framesTotal, int timeShiftLength);
void SetRecording(const cRecording *recording);
void SetTitle(const char *title);
void SetCurrent(const char *current);
void SetTotal(const char *total);
void SetEndTime(int current, int total);
void SetProgressbar(int current, int total);
void SetMarks(const cMarks *marks, int current, int total);
void SetControlIcons(bool play, bool forward, int speed);
void SetJump(const char *jump);
void SetMessage(eMessageType type, const char *text);
void StartOnPause(const char *recfilename);
void ClearOnPause(void);
void Flush(void);
};
#endif //__VIEWDISPLAYREPLAY_H1

View File

@ -1,122 +1,122 @@
#include "viewdisplaytracks.h"
#include "../config.h"
/************************************************************************************
* cViewTracks
************************************************************************************/
cViewTracks::cViewTracks(void) {
ClearVariables();
viewId = eViewType::DisplayTracks;
viewName = strdup("displayaudiotracks");
numViewElements = (int)eVeDisplayTracks::count;
viewElements = new cViewElement*[numViewElements];
for (int i=0; i < numViewElements; i++) {
viewElements[i] = NULL;
}
viewList = NULL;
veBackground = NULL;
veHeader = NULL;
SetViewElements();
}
cViewTracks::~cViewTracks() {
}
void cViewTracks::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayTracks::background));
viewElementNames.insert(pair<string, int>("header", (int)eVeDisplayTracks::header));
}
void cViewTracks::SetViewElementObjects(void) {
if (viewElements[(int)eVeDisplayTracks::background])
veBackground = dynamic_cast<cVeDtBackground*>(viewElements[(int)eVeDisplayTracks::background]);
if (viewElements[(int)eVeDisplayTracks::header])
veHeader = dynamic_cast<cVeDtHeader*>(viewElements[(int)eVeDisplayTracks::header]);
}
void cViewTracks::ClearVariables(void) {
init = true;
change = true;
}
void cViewTracks::Close(void) {
delete fader;
fader = NULL;
if (FadeTime() > 0) {
fader = new cAnimation((cFadable*)this, false);
fader->Fade();
delete fader;
fader = NULL;
}
for (int i=0; i < numViewElements; i++) {
if (viewElements[i]) {
viewElements[i]->Close();
}
}
if (viewList) {
viewList->Close();
}
ClearVariables();
sdOsd.DeleteOsd();
}
void cViewTracks::AddViewList(cViewList *viewList) {
this->viewList = dynamic_cast<cViewListAudioTracks*>(viewList);
}
void cViewTracks::PreCache(void) {
cView::PreCache();
if (viewList) {
viewList->SetContainer(0, 0, attribs->Width(), attribs->Height());
viewList->SetGlobals(globals);
viewList->PreCache();
}
}
void cViewTracks::SetTitle(const char *title) {
if (veHeader)
veHeader->SetTitle(title);
change = true;
}
void cViewTracks::SetNumtracks(int numTracks) {
if (veBackground)
veBackground->Set(numTracks);
if (veHeader)
veHeader->SetNumtracks(numTracks);
if (viewList)
viewList->SetNumtracks(numTracks);
}
void cViewTracks::SetAudiochannel(int audioChannel) {
if (veHeader)
veHeader->SetAudiochannel(audioChannel);
change = true;
}
void cViewTracks::SetTracks(const char * const *tracks) {
if (viewList)
viewList->SetTracks(tracks);
change = true;
}
void cViewTracks::SetCurrentTrack(int index) {
if (viewList)
viewList->SetCurrentTrack(index);
change = true;
}
void cViewTracks::Flush(void) {
if (init) {
sdOsd.LockFlush();
Render((int)eVeDisplayTracks::background);
}
if (change) {
Render((int)eVeDisplayTracks::header);
if (viewList)
viewList->Draw();
change = false;
}
cView::Flush();
}
#include "viewdisplaytracks.h"
#include "../config.h"
/************************************************************************************
* cViewTracks
************************************************************************************/
cViewTracks::cViewTracks(void) {
ClearVariables();
viewId = eViewType::DisplayTracks;
viewName = strdup("displayaudiotracks");
numViewElements = (int)eVeDisplayTracks::count;
viewElements = new cViewElement*[numViewElements];
for (int i=0; i < numViewElements; i++) {
viewElements[i] = NULL;
}
viewList = NULL;
veBackground = NULL;
veHeader = NULL;
SetViewElements();
}
cViewTracks::~cViewTracks() {
}
void cViewTracks::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayTracks::background));
viewElementNames.insert(pair<string, int>("header", (int)eVeDisplayTracks::header));
}
void cViewTracks::SetViewElementObjects(void) {
if (viewElements[(int)eVeDisplayTracks::background])
veBackground = dynamic_cast<cVeDtBackground*>(viewElements[(int)eVeDisplayTracks::background]);
if (viewElements[(int)eVeDisplayTracks::header])
veHeader = dynamic_cast<cVeDtHeader*>(viewElements[(int)eVeDisplayTracks::header]);
}
void cViewTracks::ClearVariables(void) {
init = true;
change = true;
}
void cViewTracks::Close(void) {
delete fader;
fader = NULL;
if (FadeTime() > 0) {
fader = new cAnimation((cFadable*)this, false);
fader->Fade();
delete fader;
fader = NULL;
}
for (int i=0; i < numViewElements; i++) {
if (viewElements[i]) {
viewElements[i]->Close();
}
}
if (viewList) {
viewList->Close();
}
ClearVariables();
sdOsd.DeleteOsd();
}
void cViewTracks::AddViewList(cViewList *viewList) {
this->viewList = dynamic_cast<cViewListAudioTracks*>(viewList);
}
void cViewTracks::PreCache(void) {
cView::PreCache();
if (viewList) {
viewList->SetContainer(0, 0, attribs->Width(), attribs->Height());
viewList->SetGlobals(globals);
viewList->PreCache();
}
}
void cViewTracks::SetTitle(const char *title) {
if (veHeader)
veHeader->SetTitle(title);
change = true;
}
void cViewTracks::SetNumtracks(int numTracks) {
if (veBackground)
veBackground->Set(numTracks);
if (veHeader)
veHeader->SetNumtracks(numTracks);
if (viewList)
viewList->SetNumtracks(numTracks);
}
void cViewTracks::SetAudiochannel(int audioChannel) {
if (veHeader)
veHeader->SetAudiochannel(audioChannel);
change = true;
}
void cViewTracks::SetTracks(const char * const *tracks) {
if (viewList)
viewList->SetTracks(tracks);
change = true;
}
void cViewTracks::SetCurrentTrack(int index) {
if (viewList)
viewList->SetCurrentTrack(index);
change = true;
}
void cViewTracks::Flush(void) {
if (init) {
sdOsd.LockFlush();
Render((int)eVeDisplayTracks::background);
}
if (change) {
Render((int)eVeDisplayTracks::header);
if (viewList)
viewList->Draw();
change = false;
}
cView::Flush();
}

View File

@ -1,29 +1,29 @@
#ifndef __VIEWDISPLAYTRACKS_H
#define __VIEWDISPLAYTRACKS_H
#include "view.h"
class cViewTracks : public cView {
private:
cViewListAudioTracks *viewList;
cVeDtBackground *veBackground;
cVeDtHeader *veHeader;
bool change;
void SetViewElements(void);
void SetViewElementObjects(void);
void ClearVariables(void);
public:
cViewTracks(void);
virtual ~cViewTracks(void);
void Close(void);
void AddViewList(cViewList *viewList);
void PreCache(void);
void SetTitle(const char *title);
void SetNumtracks(int numTracks);
void SetTracks(const char * const *tracks);
void SetAudiochannel(int audioChannel);
void SetCurrentTrack(int index);
void Flush(void);
};
#ifndef __VIEWDISPLAYTRACKS_H
#define __VIEWDISPLAYTRACKS_H
#include "view.h"
class cViewTracks : public cView {
private:
cViewListAudioTracks *viewList;
cVeDtBackground *veBackground;
cVeDtHeader *veHeader;
bool change;
void SetViewElements(void);
void SetViewElementObjects(void);
void ClearVariables(void);
public:
cViewTracks(void);
virtual ~cViewTracks(void);
void Close(void);
void AddViewList(cViewList *viewList);
void PreCache(void);
void SetTitle(const char *title);
void SetNumtracks(int numTracks);
void SetTracks(const char * const *tracks);
void SetAudiochannel(int audioChannel);
void SetCurrentTrack(int index);
void Flush(void);
};
#endif //__VIEWDISPLAYTRACKS_H

View File

@ -1,52 +1,52 @@
#include "viewdisplayvolume.h"
/************************************************************************************
* cViewVolume
************************************************************************************/
cViewVolume::cViewVolume(void) {
viewId = eViewType::DisplayVolume;
viewName = strdup("displayvolume");
numViewElements = (int)eVeDisplayVolume::count;
viewElements = new cViewElement*[numViewElements];
for (int i=0; i < numViewElements; i++) {
viewElements[i] = NULL;
}
SetViewElements();
ClearVariables();
veVolume = NULL;
}
cViewVolume::~cViewVolume() {
}
void cViewVolume::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayVolume::background));
viewElementNames.insert(pair<string, int>("volume", (int)eVeDisplayVolume::volume));
}
void cViewVolume::SetViewElementObjects(void) {
if (!viewElements[(int)eVeDisplayVolume::volume])
return;
veVolume = dynamic_cast<cVeVolume*>(viewElements[(int)eVeDisplayVolume::volume]);
}
void cViewVolume::ClearVariables(void) {
init = true;
}
void cViewVolume::SetVolume(int current, int total, bool mute) {
if (veVolume)
veVolume->Set(current, total, mute);
}
void cViewVolume::Flush(void) {
if (init) {
sdOsd.LockFlush();
Render((int)eVeDisplayVolume::background);
}
Render((int)eVeDisplayVolume::volume);
cView::Flush();
}
#include "viewdisplayvolume.h"
/************************************************************************************
* cViewVolume
************************************************************************************/
cViewVolume::cViewVolume(void) {
viewId = eViewType::DisplayVolume;
viewName = strdup("displayvolume");
numViewElements = (int)eVeDisplayVolume::count;
viewElements = new cViewElement*[numViewElements];
for (int i=0; i < numViewElements; i++) {
viewElements[i] = NULL;
}
SetViewElements();
ClearVariables();
veVolume = NULL;
}
cViewVolume::~cViewVolume() {
}
void cViewVolume::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayVolume::background));
viewElementNames.insert(pair<string, int>("volume", (int)eVeDisplayVolume::volume));
}
void cViewVolume::SetViewElementObjects(void) {
if (!viewElements[(int)eVeDisplayVolume::volume])
return;
veVolume = dynamic_cast<cVeVolume*>(viewElements[(int)eVeDisplayVolume::volume]);
}
void cViewVolume::ClearVariables(void) {
init = true;
}
void cViewVolume::SetVolume(int current, int total, bool mute) {
if (veVolume)
veVolume->Set(current, total, mute);
}
void cViewVolume::Flush(void) {
if (init) {
sdOsd.LockFlush();
Render((int)eVeDisplayVolume::background);
}
Render((int)eVeDisplayVolume::volume);
cView::Flush();
}

View File

@ -1,19 +1,19 @@
#ifndef __VIEWDISPLAYVOLUME_H
#define __VIEWDISPLAYVOLUME_H
#include "view.h"
class cViewVolume : public cView {
private:
cVeVolume *veVolume;
void SetViewElements(void);
void SetViewElementObjects(void);
void ClearVariables(void);
public:
cViewVolume(void);
virtual ~cViewVolume(void);
void SetVolume(int current, int total, bool mute);
void Flush(void);
};
#ifndef __VIEWDISPLAYVOLUME_H
#define __VIEWDISPLAYVOLUME_H
#include "view.h"
class cViewVolume : public cView {
private:
cVeVolume *veVolume;
void SetViewElements(void);
void SetViewElementObjects(void);
void ClearVariables(void);
public:
cViewVolume(void);
virtual ~cViewVolume(void);
void SetVolume(int current, int total, bool mute);
void Flush(void);
};
#endif //__VIEWDISPLAYVOLUME_H

File diff suppressed because it is too large Load Diff

View File

@ -1,93 +1,93 @@
#ifndef __VIEWELEMENT_H
#define __VIEWELEMENT_H
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <vdr/tools.h>
#include "osdwrapper.h"
#include "globals.h"
#include "../libskindesignerapi/tokencontainer.h"
#include "area.h"
#include "animation.h"
/******************************************************************
* cViewElement
******************************************************************/
class cViewElement : public cDetachable, public cFadable, public cShiftable {
protected:
cSdOsd *sdOsd;
int id;
bool init;
bool drawn;
bool dirty;
bool blocked;
bool detached;
bool waitOnWakeup;
bool scrollingStarted;
bool startAnimation;
cGlobals *globals;
cRect container;
cViewElementAttribs *attribs;
cList<cAreaNode> areaNodes;
skindesignerapi::cTokenContainer *tokenContainer;
cList<cAnimation> scrollers;
cAnimation *detacher;
cAnimation *fader;
cAnimation *shifter;
void InheritTokenContainer(void);
void InheritTokenContainerDeep(void);
virtual bool DoScroll(void) { return true; };
cPoint ShiftStart(cRect &shiftbox);
public:
cViewElement(void);
cViewElement(const cViewElement &other);
virtual ~cViewElement(void);
void SetOsd(cSdOsd *osd) { sdOsd = osd; };
static cViewElement *CreateViewElement(const char *name, const char *viewname);
void SetId(int id) { this->id = id; };
void SetGlobals(cGlobals *globals);
virtual void SetTokenContainer(void);
void SetDetached(void) { detached = true; };
void UnsetWaitOnWakeup(void) { waitOnWakeup = false; };
bool Detached(void);
void SetContainer(int x, int y, int width, int height);
void SetAttributes(vector<stringpair> &attributes);
void AddArea(cAreaNode *area);
void SetAreaX(int x);
void SetAreaY(int y);
void SetAreaWidth(int width);
void SetAreaHeight(int height);
void Cache(void);
virtual void Close(void);
virtual void Clear(void);
void Hide(void);
void Show(void);
void WakeUp(void);
bool Execute(void);
void SetDirty(void) { dirty = true; };
bool Dirty(void) { return dirty; };
void SetPosition(int newX, int newY, int newWidth, int newHeight);
virtual void Render(void);
void StopScrolling(bool deletePixmaps = true);
eOrientation Orientation(void) { return attribs->Orientation(); };
virtual int Delay(void) { return attribs->Delay(); };
void ParseDetached(void);
void RenderDetached(void);
bool Shifting(void);
bool Fading(void);
int FadeTime(void);
int ShiftTime(void);
int ShiftMode(void);
void StartAnimation(void);
virtual void SetTransparency(int transparency, bool force = false);
virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false);
cRect CoveredArea(void);
void Flush(void);
virtual bool Parse(bool forced = false);
cFunction *GetFunction(const char *name);
virtual void Debug(bool full = false);
};
#ifndef __VIEWELEMENT_H
#define __VIEWELEMENT_H
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <vdr/tools.h>
#include "osdwrapper.h"
#include "globals.h"
#include "../libskindesignerapi/tokencontainer.h"
#include "area.h"
#include "animation.h"
/******************************************************************
* cViewElement
******************************************************************/
class cViewElement : public cDetachable, public cFadable, public cShiftable {
protected:
cSdOsd *sdOsd;
int id;
bool init;
bool drawn;
bool dirty;
bool blocked;
bool detached;
bool waitOnWakeup;
bool scrollingStarted;
bool startAnimation;
cGlobals *globals;
cRect container;
cViewElementAttribs *attribs;
cList<cAreaNode> areaNodes;
skindesignerapi::cTokenContainer *tokenContainer;
cList<cAnimation> scrollers;
cAnimation *detacher;
cAnimation *fader;
cAnimation *shifter;
void InheritTokenContainer(void);
void InheritTokenContainerDeep(void);
virtual bool DoScroll(void) { return true; };
cPoint ShiftStart(cRect &shiftbox);
public:
cViewElement(void);
cViewElement(const cViewElement &other);
virtual ~cViewElement(void);
void SetOsd(cSdOsd *osd) { sdOsd = osd; };
static cViewElement *CreateViewElement(const char *name, const char *viewname);
void SetId(int id) { this->id = id; };
void SetGlobals(cGlobals *globals);
virtual void SetTokenContainer(void);
void SetDetached(void) { detached = true; };
void UnsetWaitOnWakeup(void) { waitOnWakeup = false; };
bool Detached(void);
void SetContainer(int x, int y, int width, int height);
void SetAttributes(vector<stringpair> &attributes);
void AddArea(cAreaNode *area);
void SetAreaX(int x);
void SetAreaY(int y);
void SetAreaWidth(int width);
void SetAreaHeight(int height);
void Cache(void);
virtual void Close(void);
virtual void Clear(void);
void Hide(void);
void Show(void);
void WakeUp(void);
bool Execute(void);
void SetDirty(void) { dirty = true; };
bool Dirty(void) { return dirty; };
void SetPosition(int newX, int newY, int newWidth, int newHeight);
virtual void Render(void);
void StopScrolling(bool deletePixmaps = true);
eOrientation Orientation(void) { return attribs->Orientation(); };
virtual int Delay(void) { return attribs->Delay(); };
void ParseDetached(void);
void RenderDetached(void);
bool Shifting(void);
bool Fading(void);
int FadeTime(void);
int ShiftTime(void);
int ShiftMode(void);
void StartAnimation(void);
virtual void SetTransparency(int transparency, bool force = false);
virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false);
cRect CoveredArea(void);
void Flush(void);
virtual bool Parse(bool forced = false);
cFunction *GetFunction(const char *name);
virtual void Debug(bool full = false);
};
#endif //__VIEWELEMENT_H

View File

@ -1,36 +1,36 @@
#include "viewelementplugin.h"
#include "../config.h"
cVePlugin::cVePlugin(void) {
plugId = -1;
viewId = -1;
}
cVePlugin::~cVePlugin(void) {
}
void cVePlugin::Close(void) {
cViewElement::Close();
}
void cVePlugin::SetTokenContainer(void) {
skindesignerapi::cTokenContainer *tkVe = plgManager->GetTokenContainerVE(plugId, viewId, id);
if (!tkVe)
return;
tokenContainer = new skindesignerapi::cTokenContainer(*tkVe);
InheritTokenContainer();
}
void cVePlugin::Set(skindesignerapi::cTokenContainer *tk) {
tokenContainer->Clear();
tokenContainer->SetTokens(tk);
SetDirty();
}
bool cVePlugin::Parse(bool forced) {
if (!cViewElement::Parse(forced))
return false;
if (!dirty)
return false;
return true;
}
#include "viewelementplugin.h"
#include "../config.h"
cVePlugin::cVePlugin(void) {
plugId = -1;
viewId = -1;
}
cVePlugin::~cVePlugin(void) {
}
void cVePlugin::Close(void) {
cViewElement::Close();
}
void cVePlugin::SetTokenContainer(void) {
skindesignerapi::cTokenContainer *tkVe = plgManager->GetTokenContainerVE(plugId, viewId, id);
if (!tkVe)
return;
tokenContainer = new skindesignerapi::cTokenContainer(*tkVe);
InheritTokenContainer();
}
void cVePlugin::Set(skindesignerapi::cTokenContainer *tk) {
tokenContainer->Clear();
tokenContainer->SetTokens(tk);
SetDirty();
}
bool cVePlugin::Parse(bool forced) {
if (!cViewElement::Parse(forced))
return false;
if (!dirty)
return false;
return true;
}

View File

@ -1,22 +1,22 @@
#ifndef __VIEWELEMENTPLUGIN_H
#define __VIEWELEMENTPLUGIN_H
#include "viewelement.h"
class cVePlugin : public cViewElement {
private:
int plugId;
int viewId;
public:
cVePlugin(void);
virtual ~cVePlugin(void);
void SetPluginId(int plugId) { this->plugId = plugId; };
void SetViewId(int viewId) { this->viewId = viewId; };
void Close(void);
void SetTokenContainer(void);
void Set(skindesignerapi::cTokenContainer *tk);
bool Parse(bool forced = false);
const char *Name(void) { return attribs->Name(); };
};
#endif //__VIEWELEMENTPLUGIN_H
#ifndef __VIEWELEMENTPLUGIN_H
#define __VIEWELEMENTPLUGIN_H
#include "viewelement.h"
class cVePlugin : public cViewElement {
private:
int plugId;
int viewId;
public:
cVePlugin(void);
virtual ~cVePlugin(void);
void SetPluginId(int plugId) { this->plugId = plugId; };
void SetViewId(int viewId) { this->viewId = viewId; };
void Close(void);
void SetTokenContainer(void);
void Set(skindesignerapi::cTokenContainer *tk);
bool Parse(bool forced = false);
const char *Name(void) { return attribs->Name(); };
};
#endif //__VIEWELEMENTPLUGIN_H

File diff suppressed because it is too large Load Diff

View File

@ -1,110 +1,110 @@
#ifndef __VIEWELEMENTSCOMMON_H
#define __VIEWELEMENTSCOMMON_H
#include <vdr/menu.h>
#include "viewelement.h"
/******************************************************************
* cVeDateTime
******************************************************************/
class cVeDateTime : public cViewElement {
private:
int lastMinute;
public:
cVeDateTime(void);
virtual ~cVeDateTime(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeTime
******************************************************************/
class cVeTime : public cViewElement {
private:
int lastSecond;
public:
cVeTime(void);
virtual ~cVeTime(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeMessage
******************************************************************/
class cVeMessage : public cViewElement {
private:
bool changed;
eMessageType type;
char *text;
public:
cVeMessage(void);
virtual ~cVeMessage(void);
void SetTokenContainer(void);
void Set(eMessageType type, const char *text);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDevices
******************************************************************/
class cVeDevices : public cViewElement {
private:
bool light;
time_t lastRefresh;
vector<int> devices;
bool initial;
int devicesIndex;
cMutex mutexDevices;
int numDevices;
int* lastSignalStrength;
int* lastSignalQuality;
bool* recDevices;
void Init(void);
public:
cVeDevices(void);
virtual ~cVeDevices(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeCurrentWeather
******************************************************************/
class cVeCurrentWeather : public cViewElement {
private:
public:
cVeCurrentWeather(void);
virtual ~cVeCurrentWeather(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeCustomTokens
******************************************************************/
class cVeCustomTokens : public cViewElement {
private:
public:
cVeCustomTokens(void);
virtual ~cVeCustomTokens(void);
void Reset(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeVolume
******************************************************************/
class cVeVolume : public cViewElement {
private:
int current;
int total;
bool mute;
bool changed;
public:
cVeVolume(void);
virtual ~cVeVolume(void);
void SetTokenContainer(void);
void Set(int current, int total, bool mute);
bool Parse(bool forced = false);
};
#ifndef __VIEWELEMENTSCOMMON_H
#define __VIEWELEMENTSCOMMON_H
#include <vdr/menu.h>
#include "viewelement.h"
/******************************************************************
* cVeDateTime
******************************************************************/
class cVeDateTime : public cViewElement {
private:
int lastMinute;
public:
cVeDateTime(void);
virtual ~cVeDateTime(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeTime
******************************************************************/
class cVeTime : public cViewElement {
private:
int lastSecond;
public:
cVeTime(void);
virtual ~cVeTime(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeMessage
******************************************************************/
class cVeMessage : public cViewElement {
private:
bool changed;
eMessageType type;
char *text;
public:
cVeMessage(void);
virtual ~cVeMessage(void);
void SetTokenContainer(void);
void Set(eMessageType type, const char *text);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDevices
******************************************************************/
class cVeDevices : public cViewElement {
private:
bool light;
time_t lastRefresh;
vector<int> devices;
bool initial;
int devicesIndex;
cMutex mutexDevices;
int numDevices;
int* lastSignalStrength;
int* lastSignalQuality;
bool* recDevices;
void Init(void);
public:
cVeDevices(void);
virtual ~cVeDevices(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeCurrentWeather
******************************************************************/
class cVeCurrentWeather : public cViewElement {
private:
public:
cVeCurrentWeather(void);
virtual ~cVeCurrentWeather(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeCustomTokens
******************************************************************/
class cVeCustomTokens : public cViewElement {
private:
public:
cVeCustomTokens(void);
virtual ~cVeCustomTokens(void);
void Reset(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeVolume
******************************************************************/
class cVeVolume : public cViewElement {
private:
int current;
int total;
bool mute;
bool changed;
public:
cVeVolume(void);
virtual ~cVeVolume(void);
void SetTokenContainer(void);
void Set(int current, int total, bool mute);
bool Parse(bool forced = false);
};
#endif //__VIEWELEMENTSCOMMON_H

File diff suppressed because it is too large Load Diff

View File

@ -1,145 +1,145 @@
#ifndef __VIEWELEMENTSDC_H
#define __VIEWELEMENTSDC_H
#include "viewelement.h"
#include "../extensions/scrapmanager.h"
#include "../services/dvbapi.h"
/******************************************************************
* cVeDcChannelInfo
******************************************************************/
class cVeDcChannelInfo : public cViewElement {
private:
public:
cVeDcChannelInfo(void);
virtual ~cVeDcChannelInfo(void);
void SetTokenContainer(void);
void Set(const cChannel *c, int number);
};
/******************************************************************
* cVeDcChannelGroup
******************************************************************/
class cVeDcChannelGroup : public cViewElement {
private:
const char *GetChannelSep(const cChannel *c, bool prev);
public:
cVeDcChannelGroup(void);
virtual ~cVeDcChannelGroup(void);
void SetTokenContainer(void);
void Set(const cChannel *c);
};
/******************************************************************
* cVeDcEpgInfo
******************************************************************/
class cVeDcEpgInfo : public cViewElement {
private:
bool EventHasTimer(const cEvent *e);
public:
cVeDcEpgInfo(void);
virtual ~cVeDcEpgInfo(void);
void SetTokenContainer(void);
void Set(const cEvent *p, const cEvent *f);
};
/******************************************************************
* cVeDcProgressBar
******************************************************************/
class cVeDcProgressBar : public cViewElement {
private:
int currentLast;
int startTime;
int duration;
int GetLiveBuffer(void);
public:
cVeDcProgressBar(void);
virtual ~cVeDcProgressBar(void);
void Close(void);
void SetTokenContainer(void);
void Set(const cEvent *p);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDcStatusInfo
******************************************************************/
class cVeDcStatusInfo : public cViewElement {
private:
bool CheckMails(void);
public:
cVeDcStatusInfo(void);
virtual ~cVeDcStatusInfo(void);
void SetTokenContainer(void);
void Set(const cChannel *c);
};
/******************************************************************
* cVeDcAudioInfo
******************************************************************/
class cVeDcAudioInfo : public cViewElement {
private:
int lastNumAudioTracks;
int lastAudioChannel;
char *lastTracDesc;
char *lastTrackLang;
public:
cVeDcAudioInfo(void);
virtual ~cVeDcAudioInfo(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDcScreenResolution
******************************************************************/
class cVeDcScreenResolution : public cViewElement {
private:
int lastScreenWidth;
int lastScreenHeight;
public:
cVeDcScreenResolution(void);
virtual ~cVeDcScreenResolution(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDcSignalQuality
******************************************************************/
class cVeDcSignalQuality : public cViewElement {
private:
int lastSignalDisplay;
int lastSignalStrength;
int lastSignalQuality;
public:
cVeDcSignalQuality(void);
virtual ~cVeDcSignalQuality(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDcScraperContent
******************************************************************/
class cVeDcScraperContent : public cViewElement, public cScrapManager {
private:
public:
cVeDcScraperContent(void);
virtual ~cVeDcScraperContent(void);
void SetTokenContainer(void);
void Set(const cEvent *e);
};
/******************************************************************
* cVeDcEcmInfo
******************************************************************/
class cVeDcEcmInfo : public cViewElement {
private:
int channelSid;
sDVBAPIEcmInfo lastEcmInfo;
bool CompareECMInfos(sDVBAPIEcmInfo *ecmInfo);
public:
cVeDcEcmInfo(void);
virtual ~cVeDcEcmInfo(void);
void Close(void);
void SetTokenContainer(void);
void Set(const cChannel *c);
bool Parse(bool forced = false);
};
#ifndef __VIEWELEMENTSDC_H
#define __VIEWELEMENTSDC_H
#include "viewelement.h"
#include "../extensions/scrapmanager.h"
#include "../services/dvbapi.h"
/******************************************************************
* cVeDcChannelInfo
******************************************************************/
class cVeDcChannelInfo : public cViewElement {
private:
public:
cVeDcChannelInfo(void);
virtual ~cVeDcChannelInfo(void);
void SetTokenContainer(void);
void Set(const cChannel *c, int number);
};
/******************************************************************
* cVeDcChannelGroup
******************************************************************/
class cVeDcChannelGroup : public cViewElement {
private:
const char *GetChannelSep(const cChannel *c, bool prev);
public:
cVeDcChannelGroup(void);
virtual ~cVeDcChannelGroup(void);
void SetTokenContainer(void);
void Set(const cChannel *c);
};
/******************************************************************
* cVeDcEpgInfo
******************************************************************/
class cVeDcEpgInfo : public cViewElement {
private:
bool EventHasTimer(const cEvent *e);
public:
cVeDcEpgInfo(void);
virtual ~cVeDcEpgInfo(void);
void SetTokenContainer(void);
void Set(const cEvent *p, const cEvent *f);
};
/******************************************************************
* cVeDcProgressBar
******************************************************************/
class cVeDcProgressBar : public cViewElement {
private:
int currentLast;
int startTime;
int duration;
int GetLiveBuffer(void);
public:
cVeDcProgressBar(void);
virtual ~cVeDcProgressBar(void);
void Close(void);
void SetTokenContainer(void);
void Set(const cEvent *p);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDcStatusInfo
******************************************************************/
class cVeDcStatusInfo : public cViewElement {
private:
bool CheckMails(void);
public:
cVeDcStatusInfo(void);
virtual ~cVeDcStatusInfo(void);
void SetTokenContainer(void);
void Set(const cChannel *c);
};
/******************************************************************
* cVeDcAudioInfo
******************************************************************/
class cVeDcAudioInfo : public cViewElement {
private:
int lastNumAudioTracks;
int lastAudioChannel;
char *lastTracDesc;
char *lastTrackLang;
public:
cVeDcAudioInfo(void);
virtual ~cVeDcAudioInfo(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDcScreenResolution
******************************************************************/
class cVeDcScreenResolution : public cViewElement {
private:
int lastScreenWidth;
int lastScreenHeight;
public:
cVeDcScreenResolution(void);
virtual ~cVeDcScreenResolution(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDcSignalQuality
******************************************************************/
class cVeDcSignalQuality : public cViewElement {
private:
int lastSignalDisplay;
int lastSignalStrength;
int lastSignalQuality;
public:
cVeDcSignalQuality(void);
virtual ~cVeDcSignalQuality(void);
void Close(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDcScraperContent
******************************************************************/
class cVeDcScraperContent : public cViewElement, public cScrapManager {
private:
public:
cVeDcScraperContent(void);
virtual ~cVeDcScraperContent(void);
void SetTokenContainer(void);
void Set(const cEvent *e);
};
/******************************************************************
* cVeDcEcmInfo
******************************************************************/
class cVeDcEcmInfo : public cViewElement {
private:
int channelSid;
sDVBAPIEcmInfo lastEcmInfo;
bool CompareECMInfos(sDVBAPIEcmInfo *ecmInfo);
public:
cVeDcEcmInfo(void);
virtual ~cVeDcEcmInfo(void);
void Close(void);
void SetTokenContainer(void);
void Set(const cChannel *c);
bool Parse(bool forced = false);
};
#endif //__VIEWELEMENTSDC_H

File diff suppressed because it is too large Load Diff

View File

@ -1,250 +1,250 @@
#ifndef __VIEWELEMENTSDM_H
#define __VIEWELEMENTSDM_H
#include "viewelement.h"
#include "../extensions/scrapmanager.h"
/******************************************************************
* cVeDmHeader
******************************************************************/
class cVeDmHeader : public cViewElement {
private:
char *title;
char *channelName;
int channelNumber;
char *channelId;
bool epgSearchFav;
public:
cVeDmHeader(void);
virtual ~cVeDmHeader(void);
void SetTokenContainer(void);
void SetTitle(const char *title);
void SetChannel(const cChannel *channel);
void Set(eMenuCategory menuCat);
void IsEpgSearchFav(bool isFav) { epgSearchFav = isFav;} ;
};
/******************************************************************
* cVeDmSortmode
******************************************************************/
class cVeDmSortmode : public cViewElement {
private:
eMenuSortMode sortMode;
eMenuSortMode lastSortMode;
public:
cVeDmSortmode(void);
virtual ~cVeDmSortmode(void);
void Reset(void) { lastSortMode = msmUnknown; }
void SetTokenContainer(void);
void Set(eMenuSortMode sortMode);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmColorbuttons
******************************************************************/
class cVeDmColorbuttons : public cViewElement {
private:
bool changed;
char *red;
char *green;
char *yellow;
char *blue;
public:
cVeDmColorbuttons(void);
virtual ~cVeDmColorbuttons(void);
void SetTokenContainer(void);
void SetButtons(const char *red, const char *green, const char *yellow, const char *blue);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmScrollbar
******************************************************************/
class cVeDmScrollbar : public cViewElement {
private:
public:
cVeDmScrollbar(void);
virtual ~cVeDmScrollbar(void);
void SetTokenContainer(void);
void SetList(int numDisplayed, int offset, int numMax);
void SetDetail(int height, int offset, bool end);
};
/******************************************************************
* cVeDmTimers
******************************************************************/
class cVeDmTimers : public cViewElement {
private:
int timerIndex;
public:
cVeDmTimers(void);
virtual ~cVeDmTimers(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmCurrentschedule
******************************************************************/
class cVeDmCurrentschedule : public cViewElement, public cScrapManager {
private:
const char *rec;
void ParseFromChannel(const cChannel *channel);
void ParseFromRecording(const cRecording *recording);
void RecName(string &path, string &name, string &folder);
public:
cVeDmCurrentschedule(void);
virtual ~cVeDmCurrentschedule(void);
void SetTokenContainer(void);
void SetRecording(const char *currentRec);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmDiscusage
******************************************************************/
class cVeDmDiscusage : public cViewElement {
private:
public:
cVeDmDiscusage(void);
virtual ~cVeDmDiscusage(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmSystemload
******************************************************************/
class cVeDmSystemload : public cViewElement {
private:
double lastSystemLoad;
public:
cVeDmSystemload(void);
virtual ~cVeDmSystemload(void);
void Reset(void) { lastSystemLoad = -1.0f; }
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmSystemmemory
******************************************************************/
class cVeDmSystemmemory : public cViewElement {
private:
int lastMemUsage;
public:
cVeDmSystemmemory(void);
virtual ~cVeDmSystemmemory(void);
void Reset(void) { lastMemUsage = -1; }
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmTemperatures
******************************************************************/
class cVeDmTemperatures : public cViewElement {
private:
int lastCpuTemp;
int lastGpuTemp;
public:
cVeDmTemperatures(void);
virtual ~cVeDmTemperatures(void);
void Reset(void) { lastCpuTemp = -1; lastGpuTemp = -1; }
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmVdrstatistics
******************************************************************/
class cVeDmVdrstatistics : public cViewElement {
private:
string lastVdrCPU;
string lastVdrMEM;
public:
cVeDmVdrstatistics(void);
virtual ~cVeDmVdrstatistics(void);
void Reset(void) { lastVdrCPU = "undefined"; lastVdrMEM = "undefined"; }
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmLastrecordings
******************************************************************/
class cVeDmLastrecordings : public cViewElement, public cScrapManager {
private:
int recIndex;
void RecName(string &path, string &name, string &folder);
public:
cVeDmLastrecordings(void);
virtual ~cVeDmLastrecordings(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmDetailheaderEpg
******************************************************************/
class cVeDmDetailheaderEpg : public cViewElement, public cScrapManager {
private:
const cEvent *event;
public:
cVeDmDetailheaderEpg(void);
virtual ~cVeDmDetailheaderEpg(void);
void SetTokenContainer(void);
void SetEvent(const cEvent *event);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmDetailheaderRec
******************************************************************/
class cVeDmDetailheaderRec : public cViewElement, public cScrapManager {
private:
const cRecording *recording;
public:
cVeDmDetailheaderRec(void);
virtual ~cVeDmDetailheaderRec(void);
void SetTokenContainer(void);
void SetRecording(const cRecording *rec);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmDetailheaderPlugin
******************************************************************/
class cVeDmDetailheaderPlugin : public cViewElement {
private:
int plugId;
int plugMenuId;
public:
cVeDmDetailheaderPlugin(void);
virtual ~cVeDmDetailheaderPlugin(void);
void SetPlugId(int id) { plugId = id; };
void SetPlugMenuId(int id) { plugMenuId = id; };
void SetTokenContainer(void);
void Set(skindesignerapi::cTokenContainer *tk);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmTablabels
******************************************************************/
class cVeDmTablabels : public cViewElement {
private:
int tabIndex;
int activeTab;
vector<const char*> tabs;
public:
cVeDmTablabels(void);
virtual ~cVeDmTablabels(void);
void SetTokenContainer(void);
void SetTabs(vector<const char*> &newTabs);
void SetActiveTab(int activeTab) { SetDirty(); this->activeTab = activeTab; };
bool Parse(bool forced = false);
};
#ifndef __VIEWELEMENTSDM_H
#define __VIEWELEMENTSDM_H
#include "viewelement.h"
#include "../extensions/scrapmanager.h"
/******************************************************************
* cVeDmHeader
******************************************************************/
class cVeDmHeader : public cViewElement {
private:
char *title;
char *channelName;
int channelNumber;
char *channelId;
bool epgSearchFav;
public:
cVeDmHeader(void);
virtual ~cVeDmHeader(void);
void SetTokenContainer(void);
void SetTitle(const char *title);
void SetChannel(const cChannel *channel);
void Set(eMenuCategory menuCat);
void IsEpgSearchFav(bool isFav) { epgSearchFav = isFav;} ;
};
/******************************************************************
* cVeDmSortmode
******************************************************************/
class cVeDmSortmode : public cViewElement {
private:
eMenuSortMode sortMode;
eMenuSortMode lastSortMode;
public:
cVeDmSortmode(void);
virtual ~cVeDmSortmode(void);
void Reset(void) { lastSortMode = msmUnknown; }
void SetTokenContainer(void);
void Set(eMenuSortMode sortMode);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmColorbuttons
******************************************************************/
class cVeDmColorbuttons : public cViewElement {
private:
bool changed;
char *red;
char *green;
char *yellow;
char *blue;
public:
cVeDmColorbuttons(void);
virtual ~cVeDmColorbuttons(void);
void SetTokenContainer(void);
void SetButtons(const char *red, const char *green, const char *yellow, const char *blue);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmScrollbar
******************************************************************/
class cVeDmScrollbar : public cViewElement {
private:
public:
cVeDmScrollbar(void);
virtual ~cVeDmScrollbar(void);
void SetTokenContainer(void);
void SetList(int numDisplayed, int offset, int numMax);
void SetDetail(int height, int offset, bool end);
};
/******************************************************************
* cVeDmTimers
******************************************************************/
class cVeDmTimers : public cViewElement {
private:
int timerIndex;
public:
cVeDmTimers(void);
virtual ~cVeDmTimers(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmCurrentschedule
******************************************************************/
class cVeDmCurrentschedule : public cViewElement, public cScrapManager {
private:
const char *rec;
void ParseFromChannel(const cChannel *channel);
void ParseFromRecording(const cRecording *recording);
void RecName(string &path, string &name, string &folder);
public:
cVeDmCurrentschedule(void);
virtual ~cVeDmCurrentschedule(void);
void SetTokenContainer(void);
void SetRecording(const char *currentRec);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmDiscusage
******************************************************************/
class cVeDmDiscusage : public cViewElement {
private:
public:
cVeDmDiscusage(void);
virtual ~cVeDmDiscusage(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmSystemload
******************************************************************/
class cVeDmSystemload : public cViewElement {
private:
double lastSystemLoad;
public:
cVeDmSystemload(void);
virtual ~cVeDmSystemload(void);
void Reset(void) { lastSystemLoad = -1.0f; }
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmSystemmemory
******************************************************************/
class cVeDmSystemmemory : public cViewElement {
private:
int lastMemUsage;
public:
cVeDmSystemmemory(void);
virtual ~cVeDmSystemmemory(void);
void Reset(void) { lastMemUsage = -1; }
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmTemperatures
******************************************************************/
class cVeDmTemperatures : public cViewElement {
private:
int lastCpuTemp;
int lastGpuTemp;
public:
cVeDmTemperatures(void);
virtual ~cVeDmTemperatures(void);
void Reset(void) { lastCpuTemp = -1; lastGpuTemp = -1; }
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmVdrstatistics
******************************************************************/
class cVeDmVdrstatistics : public cViewElement {
private:
string lastVdrCPU;
string lastVdrMEM;
public:
cVeDmVdrstatistics(void);
virtual ~cVeDmVdrstatistics(void);
void Reset(void) { lastVdrCPU = "undefined"; lastVdrMEM = "undefined"; }
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmLastrecordings
******************************************************************/
class cVeDmLastrecordings : public cViewElement, public cScrapManager {
private:
int recIndex;
void RecName(string &path, string &name, string &folder);
public:
cVeDmLastrecordings(void);
virtual ~cVeDmLastrecordings(void);
void SetTokenContainer(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmDetailheaderEpg
******************************************************************/
class cVeDmDetailheaderEpg : public cViewElement, public cScrapManager {
private:
const cEvent *event;
public:
cVeDmDetailheaderEpg(void);
virtual ~cVeDmDetailheaderEpg(void);
void SetTokenContainer(void);
void SetEvent(const cEvent *event);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmDetailheaderRec
******************************************************************/
class cVeDmDetailheaderRec : public cViewElement, public cScrapManager {
private:
const cRecording *recording;
public:
cVeDmDetailheaderRec(void);
virtual ~cVeDmDetailheaderRec(void);
void SetTokenContainer(void);
void SetRecording(const cRecording *rec);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmDetailheaderPlugin
******************************************************************/
class cVeDmDetailheaderPlugin : public cViewElement {
private:
int plugId;
int plugMenuId;
public:
cVeDmDetailheaderPlugin(void);
virtual ~cVeDmDetailheaderPlugin(void);
void SetPlugId(int id) { plugId = id; };
void SetPlugMenuId(int id) { plugMenuId = id; };
void SetTokenContainer(void);
void Set(skindesignerapi::cTokenContainer *tk);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDmTablabels
******************************************************************/
class cVeDmTablabels : public cViewElement {
private:
int tabIndex;
int activeTab;
vector<const char*> tabs;
public:
cVeDmTablabels(void);
virtual ~cVeDmTablabels(void);
void SetTokenContainer(void);
void SetTabs(vector<const char*> &newTabs);
void SetActiveTab(int activeTab) { SetDirty(); this->activeTab = activeTab; };
bool Parse(bool forced = false);
};
#endif //__VIEWELEMENTSDM_H

File diff suppressed because it is too large Load Diff

View File

@ -1,206 +1,206 @@
#ifndef __VIEWELEMENTSDR_H
#define __VIEWELEMENTSDR_H
#include "viewelement.h"
#include "../extensions/scrapmanager.h"
/******************************************************************
* cVeDrRecTitle
******************************************************************/
class cVeDrRecTitle : public cViewElement {
private:
const cRecording *recording;
char *title;
public:
cVeDrRecTitle(void);
virtual ~cVeDrRecTitle(void);
void SetTokenContainer(void);
void Set(const cRecording *recording);
void Set(const char *title);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrRecInfo
******************************************************************/
class cVeDrRecInfo : public cViewElement {
private:
const cRecording *recording;
public:
cVeDrRecInfo(void);
virtual ~cVeDrRecInfo(void);
void SetTokenContainer(void);
void Set(const cRecording *recording);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrCurrentTime
******************************************************************/
class cVeDrCurrentTime : public cViewElement {
private:
bool changed;
char *current;
public:
cVeDrCurrentTime(void);
virtual ~cVeDrCurrentTime(void);
void SetTokenContainer(void);
void Set(const char *current);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrTotalTime
******************************************************************/
class cVeDrTotalTime : public cViewElement {
private:
bool changed;
char *total;
bool timeshiftActive;
char *timeshiftDuration;
public:
cVeDrTotalTime(void);
virtual ~cVeDrTotalTime(void);
void SetTokenContainer(void);
void Set(const char *total, bool timeshiftActive, const char *timeshiftDuration);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrEndTime
******************************************************************/
class cVeDrEndTime : public cViewElement {
private:
cString end;
bool changed;
public:
cVeDrEndTime(void);
virtual ~cVeDrEndTime(void);
void SetTokenContainer(void);
void Set(cString end);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrProgressBar
******************************************************************/
class cVeDrProgressBar : public cViewElement {
private:
int current;
int total;
bool timeshiftActive;
int timeshiftTotal;
bool changed;
public:
cVeDrProgressBar(void);
virtual ~cVeDrProgressBar(void);
void SetTokenContainer(void);
void Set(int current, int total, bool timeshiftActive, int timeshiftTotal);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrCutMarks
******************************************************************/
class cVeDrCutMarks : public cViewElement {
private:
int cutmarksIndex;
const cMarks *marks;
int current;
int total;
bool timeshiftActive;
int timeshiftTotal;
int numMarksLast;
int *lastMarks;
int markActive;
bool MarksChanged(void);
void RememberMarks(void);
public:
cVeDrCutMarks(void);
virtual ~cVeDrCutMarks(void);
void SetTokenContainer(void);
void Set(const cMarks *marks, int current, int total, bool timeshiftActive, int timeshiftTotal);
void Reset(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrControlIcons
******************************************************************/
class cVeDrControlIcons : public cViewElement {
private:
bool play;
bool forward;
int speed;
bool changed;
public:
cVeDrControlIcons(void);
virtual ~cVeDrControlIcons(void);
void SetTokenContainer(void);
void Set(bool play, bool forward, int speed);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrProgressModeonly
******************************************************************/
class cVeDrProgressModeonly : public cViewElement {
private:
double fps;
int current;
int total;
bool changed;
public:
cVeDrProgressModeonly(void);
virtual ~cVeDrProgressModeonly(void);
void SetTokenContainer(void);
void Set(double fps, int current, int total);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrJump
******************************************************************/
class cVeDrJump : public cViewElement {
private:
char *jump;
bool changed;
public:
cVeDrJump(void);
virtual ~cVeDrJump(void);
void SetTokenContainer(void);
void Set(const char *jump);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrOnPause
******************************************************************/
class cVeDrOnPause : public cViewElement, public cScrapManager {
private:
int actorsIndex;
char *recfilename;
public:
cVeDrOnPause(void);
virtual ~cVeDrOnPause(void);
int Delay(void) { return attribs->Delay() * 1000; };
void SetTokenContainer(void);
void Set(const char *recfilename);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrScraperContent
******************************************************************/
class cVeDrScraperContent : public cViewElement, public cScrapManager {
private:
const cRecording *recording;
public:
cVeDrScraperContent(void);
virtual ~cVeDrScraperContent(void);
void SetTokenContainer(void);
void Set(const cRecording *recording);
bool Parse(bool forced = false);
};
#ifndef __VIEWELEMENTSDR_H
#define __VIEWELEMENTSDR_H
#include "viewelement.h"
#include "../extensions/scrapmanager.h"
/******************************************************************
* cVeDrRecTitle
******************************************************************/
class cVeDrRecTitle : public cViewElement {
private:
const cRecording *recording;
char *title;
public:
cVeDrRecTitle(void);
virtual ~cVeDrRecTitle(void);
void SetTokenContainer(void);
void Set(const cRecording *recording);
void Set(const char *title);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrRecInfo
******************************************************************/
class cVeDrRecInfo : public cViewElement {
private:
const cRecording *recording;
public:
cVeDrRecInfo(void);
virtual ~cVeDrRecInfo(void);
void SetTokenContainer(void);
void Set(const cRecording *recording);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrCurrentTime
******************************************************************/
class cVeDrCurrentTime : public cViewElement {
private:
bool changed;
char *current;
public:
cVeDrCurrentTime(void);
virtual ~cVeDrCurrentTime(void);
void SetTokenContainer(void);
void Set(const char *current);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrTotalTime
******************************************************************/
class cVeDrTotalTime : public cViewElement {
private:
bool changed;
char *total;
bool timeshiftActive;
char *timeshiftDuration;
public:
cVeDrTotalTime(void);
virtual ~cVeDrTotalTime(void);
void SetTokenContainer(void);
void Set(const char *total, bool timeshiftActive, const char *timeshiftDuration);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrEndTime
******************************************************************/
class cVeDrEndTime : public cViewElement {
private:
cString end;
bool changed;
public:
cVeDrEndTime(void);
virtual ~cVeDrEndTime(void);
void SetTokenContainer(void);
void Set(cString end);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrProgressBar
******************************************************************/
class cVeDrProgressBar : public cViewElement {
private:
int current;
int total;
bool timeshiftActive;
int timeshiftTotal;
bool changed;
public:
cVeDrProgressBar(void);
virtual ~cVeDrProgressBar(void);
void SetTokenContainer(void);
void Set(int current, int total, bool timeshiftActive, int timeshiftTotal);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrCutMarks
******************************************************************/
class cVeDrCutMarks : public cViewElement {
private:
int cutmarksIndex;
const cMarks *marks;
int current;
int total;
bool timeshiftActive;
int timeshiftTotal;
int numMarksLast;
int *lastMarks;
int markActive;
bool MarksChanged(void);
void RememberMarks(void);
public:
cVeDrCutMarks(void);
virtual ~cVeDrCutMarks(void);
void SetTokenContainer(void);
void Set(const cMarks *marks, int current, int total, bool timeshiftActive, int timeshiftTotal);
void Reset(void);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrControlIcons
******************************************************************/
class cVeDrControlIcons : public cViewElement {
private:
bool play;
bool forward;
int speed;
bool changed;
public:
cVeDrControlIcons(void);
virtual ~cVeDrControlIcons(void);
void SetTokenContainer(void);
void Set(bool play, bool forward, int speed);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrProgressModeonly
******************************************************************/
class cVeDrProgressModeonly : public cViewElement {
private:
double fps;
int current;
int total;
bool changed;
public:
cVeDrProgressModeonly(void);
virtual ~cVeDrProgressModeonly(void);
void SetTokenContainer(void);
void Set(double fps, int current, int total);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrJump
******************************************************************/
class cVeDrJump : public cViewElement {
private:
char *jump;
bool changed;
public:
cVeDrJump(void);
virtual ~cVeDrJump(void);
void SetTokenContainer(void);
void Set(const char *jump);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrOnPause
******************************************************************/
class cVeDrOnPause : public cViewElement, public cScrapManager {
private:
int actorsIndex;
char *recfilename;
public:
cVeDrOnPause(void);
virtual ~cVeDrOnPause(void);
int Delay(void) { return attribs->Delay() * 1000; };
void SetTokenContainer(void);
void Set(const char *recfilename);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDrScraperContent
******************************************************************/
class cVeDrScraperContent : public cViewElement, public cScrapManager {
private:
const cRecording *recording;
public:
cVeDrScraperContent(void);
virtual ~cVeDrScraperContent(void);
void SetTokenContainer(void);
void Set(const cRecording *recording);
bool Parse(bool forced = false);
};
#endif //__VIEWELEMENTSDR_H

View File

@ -1,84 +1,84 @@
#include "viewelementsdisplaytracks.h"
/******************************************************************
* cVeDtBackground
******************************************************************/
cVeDtBackground::cVeDtBackground(void) {
numTracks = 0;
}
cVeDtBackground::~cVeDtBackground(void) {
}
void cVeDtBackground::SetTokenContainer(void) {
tokenContainer = new skindesignerapi::cTokenContainer();
tokenContainer->DefineIntToken("{numtracks}", (int)eDTBackgroundIT::numtracks);
InheritTokenContainer();
}
void cVeDtBackground::Set(int numTracks) {
this->numTracks = numTracks;
}
bool cVeDtBackground::Parse(bool forced) {
if (!cViewElement::Parse(forced))
return false;
tokenContainer->Clear();
tokenContainer->AddIntToken((int)eDTBackgroundIT::numtracks, numTracks);
SetDirty();
return true;
}
/******************************************************************
* cVeDtHeader
******************************************************************/
cVeDtHeader::cVeDtHeader(void) {
title = NULL;
audioChannel = 0;
numTracks = 0;
changed = true;
}
cVeDtHeader::~cVeDtHeader(void) {
free(title);
}
void cVeDtHeader::SetTokenContainer(void) {
tokenContainer = new skindesignerapi::cTokenContainer();
tokenContainer->DefineIntToken("{numtracks}", (int)eDTHeaderIT::numtracks);
tokenContainer->DefineIntToken("{isstereo}", (int)eDTHeaderIT::isstereo);
tokenContainer->DefineIntToken("{isac3}", (int)eDTHeaderIT::isac3);
tokenContainer->DefineStringToken("{title}", (int)eDTHeaderST::title);
InheritTokenContainer();
}
void cVeDtHeader::SetTitle(const char *title) {
if (!title)
return;
free(this->title);
this->title = strdup(title);
changed = true;
}
void cVeDtHeader::SetNumtracks(int numTracks) {
this->numTracks = numTracks;
changed = true;
}
void cVeDtHeader::SetAudiochannel(int audioChannel) {
this->audioChannel = audioChannel;
changed = true;
}
bool cVeDtHeader::Parse(bool forced) {
if (!cViewElement::Parse(forced) || !changed)
return false;
tokenContainer->Clear();
tokenContainer->AddIntToken((int)eDTHeaderIT::numtracks, numTracks);
tokenContainer->AddIntToken((int)eDTHeaderIT::isstereo, (audioChannel < 0) ? false : true);
tokenContainer->AddIntToken((int)eDTHeaderIT::isac3, (audioChannel < 0) ? true : false);
tokenContainer->AddStringToken((int)eDTHeaderST::title, title);
SetDirty();
return true;
#include "viewelementsdisplaytracks.h"
/******************************************************************
* cVeDtBackground
******************************************************************/
cVeDtBackground::cVeDtBackground(void) {
numTracks = 0;
}
cVeDtBackground::~cVeDtBackground(void) {
}
void cVeDtBackground::SetTokenContainer(void) {
tokenContainer = new skindesignerapi::cTokenContainer();
tokenContainer->DefineIntToken("{numtracks}", (int)eDTBackgroundIT::numtracks);
InheritTokenContainer();
}
void cVeDtBackground::Set(int numTracks) {
this->numTracks = numTracks;
}
bool cVeDtBackground::Parse(bool forced) {
if (!cViewElement::Parse(forced))
return false;
tokenContainer->Clear();
tokenContainer->AddIntToken((int)eDTBackgroundIT::numtracks, numTracks);
SetDirty();
return true;
}
/******************************************************************
* cVeDtHeader
******************************************************************/
cVeDtHeader::cVeDtHeader(void) {
title = NULL;
audioChannel = 0;
numTracks = 0;
changed = true;
}
cVeDtHeader::~cVeDtHeader(void) {
free(title);
}
void cVeDtHeader::SetTokenContainer(void) {
tokenContainer = new skindesignerapi::cTokenContainer();
tokenContainer->DefineIntToken("{numtracks}", (int)eDTHeaderIT::numtracks);
tokenContainer->DefineIntToken("{isstereo}", (int)eDTHeaderIT::isstereo);
tokenContainer->DefineIntToken("{isac3}", (int)eDTHeaderIT::isac3);
tokenContainer->DefineStringToken("{title}", (int)eDTHeaderST::title);
InheritTokenContainer();
}
void cVeDtHeader::SetTitle(const char *title) {
if (!title)
return;
free(this->title);
this->title = strdup(title);
changed = true;
}
void cVeDtHeader::SetNumtracks(int numTracks) {
this->numTracks = numTracks;
changed = true;
}
void cVeDtHeader::SetAudiochannel(int audioChannel) {
this->audioChannel = audioChannel;
changed = true;
}
bool cVeDtHeader::Parse(bool forced) {
if (!cViewElement::Parse(forced) || !changed)
return false;
tokenContainer->Clear();
tokenContainer->AddIntToken((int)eDTHeaderIT::numtracks, numTracks);
tokenContainer->AddIntToken((int)eDTHeaderIT::isstereo, (audioChannel < 0) ? false : true);
tokenContainer->AddIntToken((int)eDTHeaderIT::isac3, (audioChannel < 0) ? true : false);
tokenContainer->AddStringToken((int)eDTHeaderST::title, title);
SetDirty();
return true;
}

View File

@ -1,40 +1,40 @@
#ifndef __VIEWELEMENTSDT_H
#define __VIEWELEMENTSDT_H
#include <vdr/menu.h>
#include "viewelement.h"
/******************************************************************
* cVeDtBackground
******************************************************************/
class cVeDtBackground : public cViewElement {
private:
int numTracks;
public:
cVeDtBackground(void);
virtual ~cVeDtBackground(void);
void SetTokenContainer(void);
void Set(int numTracks);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDtHeader
******************************************************************/
class cVeDtHeader : public cViewElement {
private:
char *title;
int audioChannel;
int numTracks;
bool changed;
public:
cVeDtHeader(void);
virtual ~cVeDtHeader(void);
void SetTokenContainer(void);
void SetTitle(const char *title);
void SetNumtracks(int numTracks);
void SetAudiochannel(int audioChannel);
bool Parse(bool forced = false);
};
#ifndef __VIEWELEMENTSDT_H
#define __VIEWELEMENTSDT_H
#include <vdr/menu.h>
#include "viewelement.h"
/******************************************************************
* cVeDtBackground
******************************************************************/
class cVeDtBackground : public cViewElement {
private:
int numTracks;
public:
cVeDtBackground(void);
virtual ~cVeDtBackground(void);
void SetTokenContainer(void);
void Set(int numTracks);
bool Parse(bool forced = false);
};
/******************************************************************
* cVeDtHeader
******************************************************************/
class cVeDtHeader : public cViewElement {
private:
char *title;
int audioChannel;
int numTracks;
bool changed;
public:
cVeDtHeader(void);
virtual ~cVeDtHeader(void);
void SetTokenContainer(void);
void SetTitle(const char *title);
void SetNumtracks(int numTracks);
void SetAudiochannel(int audioChannel);
bool Parse(bool forced = false);
};
#endif //__VIEWELEMENTSDT_H

View File

@ -1,188 +1,188 @@
#include "viewgrid.h"
#include "../extensions/helpers.h"
cViewGrid::cViewGrid(void) {
id = -1;
plugId = -1;
viewId = -1;
globals = NULL;
attribs = new cViewElementAttribs((int)eViewElementAttribs::count);
gridTpl = NULL;
gridsize = GRIDSIZE;
grid = new cGridElement*[gridsize];
for (int i=0; i < gridsize; i++) {
grid[i] = NULL;
}
gridMin = 0;
gridMax = -1;
}
cViewGrid::~cViewGrid(void) {
delete attribs;
delete gridTpl;
}
void cViewGrid::SetGlobals(cGlobals *globals) {
this->globals = globals;
}
void cViewGrid::SetContainer(int x, int y, int width, int height) {
container.SetX(x);
container.SetY(y);
container.SetWidth(width);
container.SetHeight(height);
}
void cViewGrid::SetAttributes(vector<stringpair> &attributes) {
attribs->Set(attributes);
}
void cViewGrid::AddGridElement(cGridElement *gridElement) {
gridTpl = gridElement;
}
const char *cViewGrid::Name(void) {
return attribs->Name();
}
void cViewGrid::SetTokenContainer(void) {
if (!gridTpl)
return;
gridTpl->SetId(id);
gridTpl->SetPluginId(plugId);
gridTpl->SetViewId(viewId);
gridTpl->SetTokenContainer();
}
void cViewGrid::PreCache(void) {
attribs->SetContainer(container.X(), container.Y(), container.Width(), container.Height());
attribs->SetGlobals(globals);
attribs->Cache();
gridTpl->SetGlobals(globals);
gridTpl->SetContainer(attribs->X(), attribs->Y(), attribs->Width(), attribs->Height());
gridTpl->Cache();
}
void cViewGrid::CheckSize(int id) {
if (id < gridsize)
return;
int newgridsize = gridsize + GRIDSIZE;
while (newgridsize < id)
newgridsize += gridsize;
cGridElement **gridNew = new cGridElement*[newgridsize];
int i=0;
bool foundFirst = false;
for (; i < gridsize; i++) {
if (!foundFirst && grid[i]) {
foundFirst = true;
gridMin = i;
}
gridNew[i] = grid[i];
}
gridsize = newgridsize;
for (; i < gridsize; i++) {
gridNew[i] = NULL;
}
delete[] grid;
grid = gridNew;
}
void cViewGrid::SetTokens(int gId, skindesignerapi::cTokenContainer *tk) {
if (!grid[gId]) {
return;
}
grid[gId]->Set(tk);
}
void cViewGrid::PositionGrid(int gId, double x, double y, double width, double height) {
int gridX = attribs->X() + x * attribs->Width();
int gridY = attribs->Y() + y * attribs->Height();
int gridWidth = width * attribs->Width();
int gridHeight = height * attribs->Height();
if (!grid[gId]) {
if (gId >= gridMax)
gridMax = gId+1;
grid[gId] = CreateGrid(gridX, gridY, gridWidth, gridHeight);
} else {
if (grid[gId]->Width() == gridWidth && grid[gId]->Height() == gridHeight) {
grid[gId]->SetPosition(gridX, gridY, gridWidth, gridHeight);
} else {
cGridElement *ge = CreateGrid(gridX, gridY, gridWidth, gridHeight);
ge->Set(grid[gId]->GetTokenContainer());
grid[gId]->Close();
delete grid[gId];
grid[gId] = ge;
}
grid[gId]->SetDirty();
}
}
void cViewGrid::SetCurrentGrid(int gId, bool current) {
if (gId >= 0 && grid[gId]) {
grid[gId]->SetCurrent(current);
}
}
void cViewGrid::DeleteGrid(int gId) {
if (!grid[gId])
return;
grid[gId]->Close();
delete grid[gId];
grid[gId] = NULL;
}
void cViewGrid::ClearGrids(void) {
for (int i = 0; i < gridsize; i++) {
if (!grid[i])
continue;
grid[i]->Close();
delete grid[i];
grid[i] = NULL;
}
}
void cViewGrid::Render(void) {
for (int i = gridMin; i < gridMax; i++) {
if (grid[i] && grid[i]->Parse()) {
grid[i]->Render();
}
}
}
cGridElement *cViewGrid::CreateGrid(int x, int y, int width, int height) {
cGridElement *ge = new cGridElement(*gridTpl);
ge->SetAreaX(x);
ge->SetAreaY(y);
ge->SetAreaWidth(width);
ge->SetAreaHeight(height);
return ge;
}
void cViewGrid::Close(void) {
ClearGrids();
gridsize = GRIDSIZE;
delete[] grid;
grid = new cGridElement*[gridsize];
for (int i=0; i < gridsize; i++) {
grid[i] = NULL;
}
gridMin = 0;
gridMax = -1;
}
void cViewGrid::Hide(void) {
for (int i = 0; i < gridsize; i++) {
if (grid[i]) {
grid[i]->Hide();
}
}
}
void cViewGrid::Show(void) {
for (int i = 0; i < gridsize; i++) {
if (grid[i]) {
grid[i]->Show();
}
}
}
#include "viewgrid.h"
#include "../extensions/helpers.h"
cViewGrid::cViewGrid(void) {
id = -1;
plugId = -1;
viewId = -1;
globals = NULL;
attribs = new cViewElementAttribs((int)eViewElementAttribs::count);
gridTpl = NULL;
gridsize = GRIDSIZE;
grid = new cGridElement*[gridsize];
for (int i=0; i < gridsize; i++) {
grid[i] = NULL;
}
gridMin = 0;
gridMax = -1;
}
cViewGrid::~cViewGrid(void) {
delete attribs;
delete gridTpl;
}
void cViewGrid::SetGlobals(cGlobals *globals) {
this->globals = globals;
}
void cViewGrid::SetContainer(int x, int y, int width, int height) {
container.SetX(x);
container.SetY(y);
container.SetWidth(width);
container.SetHeight(height);
}
void cViewGrid::SetAttributes(vector<stringpair> &attributes) {
attribs->Set(attributes);
}
void cViewGrid::AddGridElement(cGridElement *gridElement) {
gridTpl = gridElement;
}
const char *cViewGrid::Name(void) {
return attribs->Name();
}
void cViewGrid::SetTokenContainer(void) {
if (!gridTpl)
return;
gridTpl->SetId(id);
gridTpl->SetPluginId(plugId);
gridTpl->SetViewId(viewId);
gridTpl->SetTokenContainer();
}
void cViewGrid::PreCache(void) {
attribs->SetContainer(container.X(), container.Y(), container.Width(), container.Height());
attribs->SetGlobals(globals);
attribs->Cache();
gridTpl->SetGlobals(globals);
gridTpl->SetContainer(attribs->X(), attribs->Y(), attribs->Width(), attribs->Height());
gridTpl->Cache();
}
void cViewGrid::CheckSize(int id) {
if (id < gridsize)
return;
int newgridsize = gridsize + GRIDSIZE;
while (newgridsize < id)
newgridsize += gridsize;
cGridElement **gridNew = new cGridElement*[newgridsize];
int i=0;
bool foundFirst = false;
for (; i < gridsize; i++) {
if (!foundFirst && grid[i]) {
foundFirst = true;
gridMin = i;
}
gridNew[i] = grid[i];
}
gridsize = newgridsize;
for (; i < gridsize; i++) {
gridNew[i] = NULL;
}
delete[] grid;
grid = gridNew;
}
void cViewGrid::SetTokens(int gId, skindesignerapi::cTokenContainer *tk) {
if (!grid[gId]) {
return;
}
grid[gId]->Set(tk);
}
void cViewGrid::PositionGrid(int gId, double x, double y, double width, double height) {
int gridX = attribs->X() + x * attribs->Width();
int gridY = attribs->Y() + y * attribs->Height();
int gridWidth = width * attribs->Width();
int gridHeight = height * attribs->Height();
if (!grid[gId]) {
if (gId >= gridMax)
gridMax = gId+1;
grid[gId] = CreateGrid(gridX, gridY, gridWidth, gridHeight);
} else {
if (grid[gId]->Width() == gridWidth && grid[gId]->Height() == gridHeight) {
grid[gId]->SetPosition(gridX, gridY, gridWidth, gridHeight);
} else {
cGridElement *ge = CreateGrid(gridX, gridY, gridWidth, gridHeight);
ge->Set(grid[gId]->GetTokenContainer());
grid[gId]->Close();
delete grid[gId];
grid[gId] = ge;
}
grid[gId]->SetDirty();
}
}
void cViewGrid::SetCurrentGrid(int gId, bool current) {
if (gId >= 0 && grid[gId]) {
grid[gId]->SetCurrent(current);
}
}
void cViewGrid::DeleteGrid(int gId) {
if (!grid[gId])
return;
grid[gId]->Close();
delete grid[gId];
grid[gId] = NULL;
}
void cViewGrid::ClearGrids(void) {
for (int i = 0; i < gridsize; i++) {
if (!grid[i])
continue;
grid[i]->Close();
delete grid[i];
grid[i] = NULL;
}
}
void cViewGrid::Render(void) {
for (int i = gridMin; i < gridMax; i++) {
if (grid[i] && grid[i]->Parse()) {
grid[i]->Render();
}
}
}
cGridElement *cViewGrid::CreateGrid(int x, int y, int width, int height) {
cGridElement *ge = new cGridElement(*gridTpl);
ge->SetAreaX(x);
ge->SetAreaY(y);
ge->SetAreaWidth(width);
ge->SetAreaHeight(height);
return ge;
}
void cViewGrid::Close(void) {
ClearGrids();
gridsize = GRIDSIZE;
delete[] grid;
grid = new cGridElement*[gridsize];
for (int i=0; i < gridsize; i++) {
grid[i] = NULL;
}
gridMin = 0;
gridMax = -1;
}
void cViewGrid::Hide(void) {
for (int i = 0; i < gridsize; i++) {
if (grid[i]) {
grid[i]->Hide();
}
}
}
void cViewGrid::Show(void) {
for (int i = 0; i < gridsize; i++) {
if (grid[i]) {
grid[i]->Show();
}
}
}

View File

@ -1,47 +1,47 @@
#ifndef __VIEWGRID_H
#define __VIEWGRID_H
#define GRIDSIZE 500
#include "gridelement.h"
class cViewGrid {
protected:
cRect container;
cGlobals *globals;
cViewElementAttribs *attribs;
cGridElement *gridTpl;
int gridsize;
cGridElement **grid;
int gridMin;
int gridMax;
int id;
int viewId;
int plugId;
cGridElement *CreateGrid(int x, int y, int width, int height);
public:
cViewGrid(void);
virtual ~cViewGrid(void);
void SetGlobals(cGlobals *globals);
void SetContainer(int x, int y, int width, int height);
void SetAttributes(vector<stringpair> &attributes);
void SetId(int id) { this->id = id; };
void SetPluginId(int plugId) { this->plugId = plugId; };
void SetViewId(int viewId) { this->viewId = viewId; };
void AddGridElement(cGridElement *gridElement);
const char *Name(void);
void SetTokenContainer(void);
void PreCache(void);
void CheckSize(int id);
void SetTokens(int gId, skindesignerapi::cTokenContainer *tk);
void PositionGrid(int gId, double x, double y, double width, double height);
void SetCurrentGrid(int gId, bool current);
void DeleteGrid(int gId);
void ClearGrids(void);
void Render(void);
void Close(void);
void Hide(void);
void Show(void);
};
#ifndef __VIEWGRID_H
#define __VIEWGRID_H
#define GRIDSIZE 500
#include "gridelement.h"
class cViewGrid {
protected:
cRect container;
cGlobals *globals;
cViewElementAttribs *attribs;
cGridElement *gridTpl;
int gridsize;
cGridElement **grid;
int gridMin;
int gridMax;
int id;
int viewId;
int plugId;
cGridElement *CreateGrid(int x, int y, int width, int height);
public:
cViewGrid(void);
virtual ~cViewGrid(void);
void SetGlobals(cGlobals *globals);
void SetContainer(int x, int y, int width, int height);
void SetAttributes(vector<stringpair> &attributes);
void SetId(int id) { this->id = id; };
void SetPluginId(int plugId) { this->plugId = plugId; };
void SetViewId(int viewId) { this->viewId = viewId; };
void AddGridElement(cGridElement *gridElement);
const char *Name(void);
void SetTokenContainer(void);
void PreCache(void);
void CheckSize(int id);
void SetTokens(int gId, skindesignerapi::cTokenContainer *tk);
void PositionGrid(int gId, double x, double y, double width, double height);
void SetCurrentGrid(int gId, bool current);
void DeleteGrid(int gId);
void ClearGrids(void);
void Render(void);
void Close(void);
void Hide(void);
void Show(void);
};
#endif //__VIEWGRID_H

View File

@ -1,155 +1,155 @@
#ifndef __VIEWLIST_H
#define __VIEWLIST_H
#include "globals.h"
#include "../libskindesignerapi/tokencontainer.h"
#include "listelements.h"
#include "area.h"
class cViewList {
protected:
int plugId;
int plugMenuId;
cViewListAttribs *attribs;
cRect container;
cGlobals *globals;
int numElements;
eOrientation orientation;
cViewElement *listElement;
cViewElement *currentElement;
cListElement **listElements;
virtual void Prepare(int start, int step) {};
public:
cViewList(void);
virtual ~cViewList(void);
void SetGlobals(cGlobals *globals);
void SetContainer(int x, int y, int width, int height);
void SetAttributes(vector<stringpair> &attributes);
void SetPlugId(int id) { plugId = id; };
void SetPlugMenuId(int id) { plugMenuId = id; };
static cViewList *CreateViewList(const char *name);
static cViewElement *CreateListElement(const char *name);
static cViewElement *CreateCurrentElement(const char *name);
void AddListElement(cViewElement *listElement);
void AddCurrentElement(cViewElement *currentElement);
virtual void PreCache(void);
int NumItems(void);
eOrientation Orientation(void);
void Draw(eMenuCategory menuCat);
void Clear(void);
virtual void Close(void);
void SetTransparency(int transparency);
void Debug(void);
};
class cViewListDefault : public cViewList {
private:
cLeMenuDefault **listDefault;
int avrgFontWidth;
const cFont *listFont;
int *colX;
int *colWidths;
const char *plugName;
protected:
void Prepare(int start, int step);
public:
cViewListDefault(void);
virtual ~cViewListDefault(void);
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
void SetPlugin(const char *plugName) { this->plugName = plugName; };
void Set(const char *text, int index, bool current, bool selectable);
const cFont *GetListFont(void);
int GetListWidth(void);
};
class cViewListMain : public cViewList {
private:
cLeMenuMain **listMain;
cCeMenuMain *currentMain;
protected:
void Prepare(int start, int step);
public:
cViewListMain(void);
virtual ~cViewListMain(void);
void Set(const char *text, int index, bool current, bool selectable);
const char *GetPlugin(void);
};
class cViewListSchedules : public cViewList {
private:
cLeMenuSchedules **listSchedules;
cCeMenuSchedules *currentSchedules;
bool epgSearchFav;
protected:
void Prepare(int start, int step);
public:
cViewListSchedules(void);
virtual ~cViewListSchedules(void);
void IsEpgSearchFav(bool isFav) { epgSearchFav = isFav; };
void Set(const cEvent *event, int index, bool current, bool selectable, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
};
class cViewListTimers : public cViewList {
private:
cLeMenuTimers **listTimers;
cCeMenuTimers *currentTimer;
protected:
void Prepare(int start, int step);
public:
cViewListTimers(void);
virtual ~cViewListTimers(void);
void Set(const cTimer *timer, int index, bool current, bool selectable);
};
class cViewListChannels : public cViewList {
private:
cLeMenuChannels **listChannels;
cCeMenuChannels *currentChannel;
protected:
void Prepare(int start, int step);
public:
cViewListChannels(void);
virtual ~cViewListChannels(void);
void Set(const cChannel *channel, int index, bool current, bool selectable, bool withProvider);
};
class cViewListRecordings : public cViewList {
private:
cLeMenuRecordings **listRecordings;
cCeMenuRecordings *currentRecording;
protected:
void Prepare(int start, int step);
public:
cViewListRecordings(void);
virtual ~cViewListRecordings(void);
void Set(const cRecording *recording, int index, bool current, bool selectable, int level, int total, int New);
};
class cViewListPlugin : public cViewList {
private:
cLeMenuPlugin **listPlugin;
cCeMenuPlugin *currentPlugin;
protected:
void Prepare(int start, int step);
public:
cViewListPlugin(void);
virtual ~cViewListPlugin(void);
void Set(skindesignerapi::cTokenContainer *tk, int index, bool current, bool selectable);
};
class cViewListAudioTracks : public cViewList {
private:
skindesignerapi::cTokenContainer *tokenContainer;
int numTracks;
cLeAudioTracks **listAudioTracks;
public:
cViewListAudioTracks(void);
virtual ~cViewListAudioTracks(void);
void Close(void);
void PreCache(void);
void SetNumtracks(int numTracks);
void SetTracks(const char * const *tracks);
void SetCurrentTrack(int index);
void Draw(void);
};
#ifndef __VIEWLIST_H
#define __VIEWLIST_H
#include "globals.h"
#include "../libskindesignerapi/tokencontainer.h"
#include "listelements.h"
#include "area.h"
class cViewList {
protected:
int plugId;
int plugMenuId;
cViewListAttribs *attribs;
cRect container;
cGlobals *globals;
int numElements;
eOrientation orientation;
cViewElement *listElement;
cViewElement *currentElement;
cListElement **listElements;
virtual void Prepare(int start, int step) {};
public:
cViewList(void);
virtual ~cViewList(void);
void SetGlobals(cGlobals *globals);
void SetContainer(int x, int y, int width, int height);
void SetAttributes(vector<stringpair> &attributes);
void SetPlugId(int id) { plugId = id; };
void SetPlugMenuId(int id) { plugMenuId = id; };
static cViewList *CreateViewList(const char *name);
static cViewElement *CreateListElement(const char *name);
static cViewElement *CreateCurrentElement(const char *name);
void AddListElement(cViewElement *listElement);
void AddCurrentElement(cViewElement *currentElement);
virtual void PreCache(void);
int NumItems(void);
eOrientation Orientation(void);
void Draw(eMenuCategory menuCat);
void Clear(void);
virtual void Close(void);
void SetTransparency(int transparency);
void Debug(void);
};
class cViewListDefault : public cViewList {
private:
cLeMenuDefault **listDefault;
int avrgFontWidth;
const cFont *listFont;
int *colX;
int *colWidths;
const char *plugName;
protected:
void Prepare(int start, int step);
public:
cViewListDefault(void);
virtual ~cViewListDefault(void);
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
void SetPlugin(const char *plugName) { this->plugName = plugName; };
void Set(const char *text, int index, bool current, bool selectable);
const cFont *GetListFont(void);
int GetListWidth(void);
};
class cViewListMain : public cViewList {
private:
cLeMenuMain **listMain;
cCeMenuMain *currentMain;
protected:
void Prepare(int start, int step);
public:
cViewListMain(void);
virtual ~cViewListMain(void);
void Set(const char *text, int index, bool current, bool selectable);
const char *GetPlugin(void);
};
class cViewListSchedules : public cViewList {
private:
cLeMenuSchedules **listSchedules;
cCeMenuSchedules *currentSchedules;
bool epgSearchFav;
protected:
void Prepare(int start, int step);
public:
cViewListSchedules(void);
virtual ~cViewListSchedules(void);
void IsEpgSearchFav(bool isFav) { epgSearchFav = isFav; };
void Set(const cEvent *event, int index, bool current, bool selectable, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
};
class cViewListTimers : public cViewList {
private:
cLeMenuTimers **listTimers;
cCeMenuTimers *currentTimer;
protected:
void Prepare(int start, int step);
public:
cViewListTimers(void);
virtual ~cViewListTimers(void);
void Set(const cTimer *timer, int index, bool current, bool selectable);
};
class cViewListChannels : public cViewList {
private:
cLeMenuChannels **listChannels;
cCeMenuChannels *currentChannel;
protected:
void Prepare(int start, int step);
public:
cViewListChannels(void);
virtual ~cViewListChannels(void);
void Set(const cChannel *channel, int index, bool current, bool selectable, bool withProvider);
};
class cViewListRecordings : public cViewList {
private:
cLeMenuRecordings **listRecordings;
cCeMenuRecordings *currentRecording;
protected:
void Prepare(int start, int step);
public:
cViewListRecordings(void);
virtual ~cViewListRecordings(void);
void Set(const cRecording *recording, int index, bool current, bool selectable, int level, int total, int New);
};
class cViewListPlugin : public cViewList {
private:
cLeMenuPlugin **listPlugin;
cCeMenuPlugin *currentPlugin;
protected:
void Prepare(int start, int step);
public:
cViewListPlugin(void);
virtual ~cViewListPlugin(void);
void Set(skindesignerapi::cTokenContainer *tk, int index, bool current, bool selectable);
};
class cViewListAudioTracks : public cViewList {
private:
skindesignerapi::cTokenContainer *tokenContainer;
int numTracks;
cLeAudioTracks **listAudioTracks;
public:
cViewListAudioTracks(void);
virtual ~cViewListAudioTracks(void);
void Close(void);
void PreCache(void);
void SetNumtracks(int numTracks);
void SetTracks(const char * const *tracks);
void SetCurrentTrack(int index);
void Draw(void);
};
#endif //__VIEWLIST_H

View File

@ -1,189 +1,189 @@
#include "helpers.h"
#include "libxmlwrapper.h"
void SkinDesignerXMLErrorHandler (void * userData, xmlErrorPtr error) {
esyslog("skindesigner: Error in XML: %s", error->message);
}
cLibXMLWrapper::cLibXMLWrapper(void) {
ctxt = NULL;
doc = NULL;
root = NULL;
initGenericErrorDefaultFunc(NULL);
xmlSetStructuredErrorFunc(NULL, SkinDesignerXMLErrorHandler);
ctxt = xmlNewParserCtxt();
}
cLibXMLWrapper::~cLibXMLWrapper() {
DeleteDocument();
xmlFreeParserCtxt(ctxt);
}
void cLibXMLWrapper::InitLibXML() {
xmlInitParser();
}
void cLibXMLWrapper::CleanupLibXML() {
xmlCleanupParser();
}
void cLibXMLWrapper::DeleteDocument(void) {
if (doc) {
xmlFreeDoc(doc);
doc = NULL;
}
while (!nodeStack.empty())
nodeStack.pop();
}
bool cLibXMLWrapper::ReadXMLFile(const char *path, bool validate) {
if (!ctxt) {
esyslog("skindesigner: Failed to allocate parser context");
return false;
}
if (!FileExists(path)) {
dsyslog("skindesigner: reading XML Template %s failed", path);
return false;
}
if (validate)
doc = xmlCtxtReadFile(ctxt, path, NULL, XML_PARSE_NOENT | XML_PARSE_DTDVALID);
else
doc = xmlCtxtReadFile(ctxt, path, NULL, XML_PARSE_NOENT);
if (!doc) {
dsyslog("skindesigner: reading XML Template %s failed", path);
return false;
}
return true;
}
bool cLibXMLWrapper::SetDocument(void) {
if (!doc)
return false;
root = xmlDocGetRootElement(doc);
nodeStack.push(root);
if (root == NULL) {
esyslog("skindesigner: ERROR: XML File is empty");
return false;
}
return true;
}
bool cLibXMLWrapper::Validate(void) {
if (!ctxt)
return false;
if (ctxt->valid == 0) {
esyslog("skindesigner: Failed to validate XML File");
return false;
}
return true;
}
bool cLibXMLWrapper::CheckNodeName(const char *name) {
if (nodeStack.empty())
return false;
xmlNodePtr current = nodeStack.top();
if (xmlStrcmp(current->name, (const xmlChar *) name)) {
return false;
}
return true;
}
const char *cLibXMLWrapper::NodeName(void) {
xmlNodePtr current = nodeStack.top();
return (const char*)current->name;
}
vector<stringpair> cLibXMLWrapper::ParseAttributes(void) {
vector<stringpair> attributes;
if (nodeStack.empty())
return attributes;
xmlNodePtr current = nodeStack.top();
xmlAttrPtr attrPtr = current->properties;
if (attrPtr == NULL) {
return attributes;
}
while (NULL != attrPtr) {
string name = (const char*)attrPtr->name;
xmlChar *value = NULL;
value = xmlGetProp(current, attrPtr->name);
if (value)
attributes.push_back(stringpair((const char*)attrPtr->name, (const char*)value));
attrPtr = attrPtr->next;
if (value)
xmlFree(value);
}
return attributes;
}
bool cLibXMLWrapper::LevelDown(void) {
if (nodeStack.empty())
return false;
xmlNodePtr current = nodeStack.top();
xmlNodePtr child = current->xmlChildrenNode;
while (child && child->type != XML_ELEMENT_NODE) {
child = child->next;
}
if (!child)
return false;
nodeStack.push(child);
return true;
}
bool cLibXMLWrapper::LevelUp(void) {
if (nodeStack.size() == 1)
return false;
nodeStack.pop();
return true;
}
bool cLibXMLWrapper::NextNode(void) {
xmlNodePtr current = nodeStack.top();
current = current->next;
while (current && current->type != XML_ELEMENT_NODE) {
current = current->next;
}
if (!current)
return false;
nodeStack.pop();
nodeStack.push(current);
return true;
}
bool cLibXMLWrapper::GetAttribute(string &name, string &value) {
bool ok = false;
xmlNodePtr current = nodeStack.top();
xmlAttrPtr attr = current->properties;
if (attr == NULL) {
return ok;
}
xmlChar *xmlValue = NULL;
while (NULL != attr) {
if (xmlStrcmp(attr->name, (const xmlChar *) name.c_str())) {
attr = attr->next;
continue;
}
ok = true;
xmlValue = xmlGetProp(current, attr->name);
if (xmlValue) {
value = (const char*)xmlValue;
xmlFree(xmlValue);
}
break;
}
return ok;
}
bool cLibXMLWrapper::GetNodeValue(string &value) {
xmlChar *val = NULL;
xmlNodePtr current = nodeStack.top();
val = xmlNodeListGetString(doc, current->xmlChildrenNode, 1);
if (val) {
value = (const char*)val;
xmlFree(val);
return true;
}
value = "";
return false;
}
#include "helpers.h"
#include "libxmlwrapper.h"
void SkinDesignerXMLErrorHandler (void * userData, xmlErrorPtr error) {
esyslog("skindesigner: Error in XML: %s", error->message);
}
cLibXMLWrapper::cLibXMLWrapper(void) {
ctxt = NULL;
doc = NULL;
root = NULL;
initGenericErrorDefaultFunc(NULL);
xmlSetStructuredErrorFunc(NULL, SkinDesignerXMLErrorHandler);
ctxt = xmlNewParserCtxt();
}
cLibXMLWrapper::~cLibXMLWrapper() {
DeleteDocument();
xmlFreeParserCtxt(ctxt);
}
void cLibXMLWrapper::InitLibXML() {
xmlInitParser();
}
void cLibXMLWrapper::CleanupLibXML() {
xmlCleanupParser();
}
void cLibXMLWrapper::DeleteDocument(void) {
if (doc) {
xmlFreeDoc(doc);
doc = NULL;
}
while (!nodeStack.empty())
nodeStack.pop();
}
bool cLibXMLWrapper::ReadXMLFile(const char *path, bool validate) {
if (!ctxt) {
esyslog("skindesigner: Failed to allocate parser context");
return false;
}
if (!FileExists(path)) {
dsyslog("skindesigner: reading XML Template %s failed", path);
return false;
}
if (validate)
doc = xmlCtxtReadFile(ctxt, path, NULL, XML_PARSE_NOENT | XML_PARSE_DTDVALID);
else
doc = xmlCtxtReadFile(ctxt, path, NULL, XML_PARSE_NOENT);
if (!doc) {
dsyslog("skindesigner: reading XML Template %s failed", path);
return false;
}
return true;
}
bool cLibXMLWrapper::SetDocument(void) {
if (!doc)
return false;
root = xmlDocGetRootElement(doc);
nodeStack.push(root);
if (root == NULL) {
esyslog("skindesigner: ERROR: XML File is empty");
return false;
}
return true;
}
bool cLibXMLWrapper::Validate(void) {
if (!ctxt)
return false;
if (ctxt->valid == 0) {
esyslog("skindesigner: Failed to validate XML File");
return false;
}
return true;
}
bool cLibXMLWrapper::CheckNodeName(const char *name) {
if (nodeStack.empty())
return false;
xmlNodePtr current = nodeStack.top();
if (xmlStrcmp(current->name, (const xmlChar *) name)) {
return false;
}
return true;
}
const char *cLibXMLWrapper::NodeName(void) {
xmlNodePtr current = nodeStack.top();
return (const char*)current->name;
}
vector<stringpair> cLibXMLWrapper::ParseAttributes(void) {
vector<stringpair> attributes;
if (nodeStack.empty())
return attributes;
xmlNodePtr current = nodeStack.top();
xmlAttrPtr attrPtr = current->properties;
if (attrPtr == NULL) {
return attributes;
}
while (NULL != attrPtr) {
string name = (const char*)attrPtr->name;
xmlChar *value = NULL;
value = xmlGetProp(current, attrPtr->name);
if (value)
attributes.push_back(stringpair((const char*)attrPtr->name, (const char*)value));
attrPtr = attrPtr->next;
if (value)
xmlFree(value);
}
return attributes;
}
bool cLibXMLWrapper::LevelDown(void) {
if (nodeStack.empty())
return false;
xmlNodePtr current = nodeStack.top();
xmlNodePtr child = current->xmlChildrenNode;
while (child && child->type != XML_ELEMENT_NODE) {
child = child->next;
}
if (!child)
return false;
nodeStack.push(child);
return true;
}
bool cLibXMLWrapper::LevelUp(void) {
if (nodeStack.size() == 1)
return false;
nodeStack.pop();
return true;
}
bool cLibXMLWrapper::NextNode(void) {
xmlNodePtr current = nodeStack.top();
current = current->next;
while (current && current->type != XML_ELEMENT_NODE) {
current = current->next;
}
if (!current)
return false;
nodeStack.pop();
nodeStack.push(current);
return true;
}
bool cLibXMLWrapper::GetAttribute(string &name, string &value) {
bool ok = false;
xmlNodePtr current = nodeStack.top();
xmlAttrPtr attr = current->properties;
if (attr == NULL) {
return ok;
}
xmlChar *xmlValue = NULL;
while (NULL != attr) {
if (xmlStrcmp(attr->name, (const xmlChar *) name.c_str())) {
attr = attr->next;
continue;
}
ok = true;
xmlValue = xmlGetProp(current, attr->name);
if (xmlValue) {
value = (const char*)xmlValue;
xmlFree(xmlValue);
}
break;
}
return ok;
}
bool cLibXMLWrapper::GetNodeValue(string &value) {
xmlChar *val = NULL;
xmlNodePtr current = nodeStack.top();
val = xmlNodeListGetString(doc, current->xmlChildrenNode, 1);
if (val) {
value = (const char*)val;
xmlFree(val);
return true;
}
value = "";
return false;
}

View File

@ -1,46 +1,46 @@
#ifndef __LIBXMLWRAPPER_H
#define __LIBXMLWRAPPER_H
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <stack>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#include <vdr/plugin.h>
using namespace std;
typedef pair<string,string> stringpair;
typedef map<string,string> stringmap;
class cLibXMLWrapper {
private:
xmlParserCtxtPtr ctxt;
xmlDocPtr doc;
xmlNodePtr root;
xmlNodePtr current;
stack<xmlNodePtr> nodeStack;
protected:
void DeleteDocument(void);
bool ReadXMLFile(const char *path, bool validate = true);
bool SetDocument(void);
bool Validate(void);
bool CheckNodeName(const char *name);
const char *NodeName(void);
vector<stringpair> ParseAttributes(void);
bool LevelDown(void);
bool LevelUp(void);
bool NextNode(void);
bool GetAttribute(string &name, string &value);
bool GetNodeValue(string &value);
public:
cLibXMLWrapper(void);
virtual ~cLibXMLWrapper(void);
static void InitLibXML();
static void CleanupLibXML();
};
#ifndef __LIBXMLWRAPPER_H
#define __LIBXMLWRAPPER_H
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <stack>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#include <vdr/plugin.h>
using namespace std;
typedef pair<string,string> stringpair;
typedef map<string,string> stringmap;
class cLibXMLWrapper {
private:
xmlParserCtxtPtr ctxt;
xmlDocPtr doc;
xmlNodePtr root;
xmlNodePtr current;
stack<xmlNodePtr> nodeStack;
protected:
void DeleteDocument(void);
bool ReadXMLFile(const char *path, bool validate = true);
bool SetDocument(void);
bool Validate(void);
bool CheckNodeName(const char *name);
const char *NodeName(void);
vector<stringpair> ParseAttributes(void);
bool LevelDown(void);
bool LevelUp(void);
bool NextNode(void);
bool GetAttribute(string &name, string &value);
bool GetNodeValue(string &value);
public:
cLibXMLWrapper(void);
virtual ~cLibXMLWrapper(void);
static void InitLibXML();
static void CleanupLibXML();
};
#endif //__LIBXMLWRAPPER_H

View File

@ -1,301 +1,301 @@
#include "pluginmanager.h"
cSDPluginManager::cSDPluginManager(void) {
lastId = 0;
subviewsfound = false;
}
cSDPluginManager::~cSDPluginManager(void) {
}
void cSDPluginManager::Reset(void) {
subViewMapping.clear();
}
void cSDPluginManager::RegisterBasicPlugin(skindesignerapi::cPluginStructure *plugStructure) {
dsyslog("skindesigner: plugin %s uses libskindesigner API Version %s",
plugStructure->name.c_str(),
plugStructure->libskindesignerAPIVersion.c_str());
plugStructure->id = lastId;
registeredPlugins.insert(pair<int,string>(lastId, plugStructure->name));
lastId++;
map< int, skindesignerapi::sPlugMenu > menusNew;
for (map< int, skindesignerapi::sPlugMenu >::iterator it = plugStructure->menus.begin(); it != plugStructure->menus.end(); it++) {
int key = it->first;
skindesignerapi::sPlugMenu menu = it->second;
skindesignerapi::sPlugMenu menuNew;
menuNew.type = menu.type;
menuNew.tplname = menu.tplname;
menuNew.tokenContainer = new skindesignerapi::cTokenContainer(*menu.tokenContainer);
menusNew.insert(pair<int, skindesignerapi::sPlugMenu>(key, menuNew));
}
pluginMenus.insert(pair< int, map < int, skindesignerapi::sPlugMenu > >(plugStructure->id, menusNew));
if (plugStructure->menus.size() > 0)
dsyslog("skindesigner: plugin %s has registered %ld menus", plugStructure->name.c_str(), plugStructure->menus.size());
}
int cSDPluginManager::GetNumPluginMenus(void) {
int numMenusTotal = 0;
for (map < int, map < int, skindesignerapi::sPlugMenu > >::iterator it = pluginMenus.begin(); it != pluginMenus.end(); it++) {
numMenusTotal += (it->second).size();
}
return numMenusTotal;
}
void cSDPluginManager::InitPluginMenuIterator(void) {
plugMenuIt = pluginMenus.begin();
}
map <int,skindesignerapi::sPlugMenu> *cSDPluginManager::GetPluginMenus(string &name, int &id) {
if (plugMenuIt == pluginMenus.end())
return NULL;
id = plugMenuIt->first;
map<int,string>::iterator hit = registeredPlugins.find(id);
if (hit != registeredPlugins.end())
name = hit->second;
map <int,skindesignerapi::sPlugMenu> *templates = &plugMenuIt->second;
plugMenuIt++;
return templates;
}
skindesignerapi::cTokenContainer *cSDPluginManager::GetTokenContainer(int plugId, int plugMenuId) {
map <int, map<int, skindesignerapi::sPlugMenu> >::iterator hit = pluginMenus.find(plugId);
if (hit == pluginMenus.end())
return NULL;
map<int, skindesignerapi::sPlugMenu>::iterator hit2 = (hit->second).find(plugMenuId);
if (hit2 == (hit->second).end())
return NULL;
skindesignerapi::cTokenContainer *tk = hit2->second.tokenContainer;
return tk;
}
void cSDPluginManager::AddSubviewMapping(int plugId, int plugMenuId, int subViewId) {
map <int, map<int,int> >::iterator hit = subViewMapping.find(plugId);
if (hit == subViewMapping.end()) {
map<int,int> menus;
menus.insert(pair<int,int>(plugMenuId, subViewId));
subViewMapping.insert(pair<int, map<int,int> >(plugId, menus));
} else {
(hit->second).insert(pair<int,int>(plugMenuId, subViewId));
}
}
int cSDPluginManager::GetSubviewId(int plugId, int plugMenuId) {
map <int, map<int,int> >::iterator hit = subViewMapping.find(plugId);
if (hit == subViewMapping.end())
return -1;
map<int,int>::iterator hit2 = (hit->second).find(plugMenuId);
if (hit2 == (hit->second).end())
return -1;
return hit2->second;
}
void cSDPluginManager::RegisterAdvancedPlugin(skindesignerapi::cPluginStructure *plugStructure) {
dsyslog("skindesigner: plugin %s uses libskindesigner API Version %s",
plugStructure->name.c_str(),
plugStructure->libskindesignerAPIVersion.c_str());
plugStructure->id = lastId;
registeredPlugins.insert(pair<int,string>(lastId, plugStructure->name));
lastId++;
rootviews.insert(pair<int,string>(plugStructure->id, plugStructure->rootview));
subviews.insert(pair<int,map<int,string> >(plugStructure->id, plugStructure->subviews));
multimap< int, skindesignerapi::sPlugViewElement > viewelementsNew;
for (map< int, skindesignerapi::sPlugViewElement >::iterator it = plugStructure->viewelements.begin(); it != plugStructure->viewelements.end(); it++) {
int key = it->first;
skindesignerapi::sPlugViewElement ve = it->second;
skindesignerapi::sPlugViewElement veNew;
veNew.id = ve.id;
veNew.viewId = ve.viewId;
veNew.name = ve.name;
veNew.tokenContainer = new skindesignerapi::cTokenContainer(*ve.tokenContainer);
viewelementsNew.insert(pair<int, skindesignerapi::sPlugViewElement>(key, veNew));
}
viewelements.insert(pair< int, multimap < int, skindesignerapi::sPlugViewElement > >(plugStructure->id, viewelementsNew));
multimap< int, skindesignerapi::sPlugViewGrid > viewgridsNew;
for (map< int, skindesignerapi::sPlugViewGrid >::iterator it = plugStructure->viewgrids.begin(); it != plugStructure->viewgrids.end(); it++) {
int key = it->first;
skindesignerapi::sPlugViewGrid vg = it->second;
skindesignerapi::sPlugViewGrid vgNew;
vgNew.id = vg.id;
vgNew.viewId = vg.viewId;
vgNew.name = vg.name;
vgNew.tokenContainer = new skindesignerapi::cTokenContainer(*vg.tokenContainer);
viewgridsNew.insert(pair<int, skindesignerapi::sPlugViewGrid>(key, vgNew));
}
viewgrids.insert(pair< int, multimap < int, skindesignerapi::sPlugViewGrid > >(plugStructure->id, viewgridsNew));
map< int, skindesignerapi::cTokenContainer* > viewtabsNew;
for (map<int,skindesignerapi::cTokenContainer*>::iterator it = plugStructure->viewtabs.begin(); it != plugStructure->viewtabs.end(); it++) {
int id = it->first;
skindesignerapi::cTokenContainer *tk = it->second;
viewtabsNew.insert(pair<int,skindesignerapi::cTokenContainer*>(id, new skindesignerapi::cTokenContainer(*tk)));
}
viewtabs.insert(pair< int, map<int,skindesignerapi::cTokenContainer*> >(plugStructure->id, viewtabsNew));
if (plugStructure->rootview.size() > 0)
dsyslog("skindesigner: plugin %s has registered %ld views with %ld viewelements and %ld viewgrids",
plugStructure->name.c_str(),
1 + plugStructure->subviews.size(),
plugStructure->viewelements.size(),
plugStructure->viewgrids.size());
}
void cSDPluginManager::InitPluginViewIterator(void) {
rootViewsIt = rootviews.begin();
}
bool cSDPluginManager::GetNextPluginView(string &plugName, int &plugId, string &tplName) {
if (rootViewsIt == rootviews.end())
return false;
plugId = rootViewsIt->first;
tplName = rootViewsIt->second;
map<int,string>::iterator hit = registeredPlugins.find(plugId);
if (hit != registeredPlugins.end())
plugName = hit->second;
rootViewsIt++;
return true;
}
int cSDPluginManager::GetNumSubviews(int plugId) {
map< int, map< int, string > >::iterator hit = subviews.find(plugId);
if (hit == subviews.end())
return 0;
return (hit->second).size();
}
void cSDPluginManager::InitPluginSubviewIterator(int plugId) {
map< int, map< int, string > >::iterator hit = subviews.find(plugId);
if (hit == subviews.end()) {
subviewsfound = false;
return;
}
subviewsCurrent = hit->second;
subviewsfound = true;
svIt = subviewsCurrent.begin();
}
bool cSDPluginManager::GetNextSubView(int &id, string &tplname) {
if (!subviewsfound)
return false;
if( svIt == subviewsCurrent.end() ) {
return false;
}
id = svIt->first;
tplname = svIt->second;
svIt++;
return true;
}
int cSDPluginManager::GetNumViewElements(int plugId, int viewId) {
map< int, multimap< int, skindesignerapi::sPlugViewElement > >::iterator hit = viewelements.find(plugId);
if (hit == viewelements.end())
return 0;
multimap<int, skindesignerapi::sPlugViewElement> *plugVEs = &hit->second;
pair<multimap<int, skindesignerapi::sPlugViewElement>::iterator, multimap<int, skindesignerapi::sPlugViewElement>::iterator> range;
range = plugVEs->equal_range(viewId);
int numVEs = 0;
for (multimap<int, skindesignerapi::sPlugViewElement>::iterator it=range.first; it!=range.second; ++it) {
numVEs++;
}
return numVEs;
}
void cSDPluginManager::InitViewElementIterator(int plugId, int viewId) {
map< int, multimap< int, skindesignerapi::sPlugViewElement > >::iterator hit = viewelements.find(plugId);
if (hit == viewelements.end())
return;
multimap<int, skindesignerapi::sPlugViewElement> *plugVEs = &hit->second;
veRange = plugVEs->equal_range(viewId);
veIt = veRange.first;
}
bool cSDPluginManager::GetNextViewElement(int &veId, string &veName) {
if (veIt == veRange.second)
return false;
skindesignerapi::sPlugViewElement *ve = &veIt->second;
veId = ve->id;
veName = ve->name;
veIt++;
return true;
}
skindesignerapi::cTokenContainer *cSDPluginManager::GetTokenContainerVE(int plugId, int viewId, int veId) {
map< int, multimap< int, skindesignerapi::sPlugViewElement > >::iterator hit = viewelements.find(plugId);
if (hit == viewelements.end())
return NULL;
multimap<int, skindesignerapi::sPlugViewElement> *plugVEs = &hit->second;
for (multimap<int, skindesignerapi::sPlugViewElement>::iterator it = plugVEs->begin(); it != plugVEs->end(); it++) {
int view = it->first;
if (view != viewId)
continue;
skindesignerapi::sPlugViewElement *ve = &it->second;
if (ve->id == veId)
return ve->tokenContainer;
}
return NULL;
}
int cSDPluginManager::GetNumViewGrids(int plugId, int viewId) {
map< int, multimap< int, skindesignerapi::sPlugViewGrid > >::iterator hit = viewgrids.find(plugId);
if (hit == viewgrids.end())
return 0;
multimap<int, skindesignerapi::sPlugViewGrid> *plugVGs = &hit->second;
pair<multimap<int, skindesignerapi::sPlugViewGrid>::iterator, multimap<int, skindesignerapi::sPlugViewGrid>::iterator> range;
range = plugVGs->equal_range(viewId);
int numVGs = 0;
for (multimap<int, skindesignerapi::sPlugViewGrid>::iterator it=range.first; it!=range.second; ++it) {
numVGs++;
}
return numVGs;
}
void cSDPluginManager::InitViewGridIterator(int plugId, int viewId) {
map< int, multimap< int, skindesignerapi::sPlugViewGrid > >::iterator hit = viewgrids.find(plugId);
if (hit == viewgrids.end())
return;
multimap<int, skindesignerapi::sPlugViewGrid> *plugGEs = &hit->second;
gRange = plugGEs->equal_range(viewId);
gIt = gRange.first;
}
bool cSDPluginManager::GetNextViewGrid(int &gId, string &gName) {
if (gIt == gRange.second)
return false;
skindesignerapi::sPlugViewGrid *ge = &gIt->second;
gId = ge->id;
gName = ge->name;
gIt++;
return true;
}
skindesignerapi::cTokenContainer *cSDPluginManager::GetTokenContainerGE(int plugId, int viewId, int gId) {
map< int, multimap< int, skindesignerapi::sPlugViewGrid > >::iterator hit = viewgrids.find(plugId);
if (hit == viewgrids.end())
return NULL;
multimap<int, skindesignerapi::sPlugViewGrid> *plugGEs = &hit->second;
for (multimap<int, skindesignerapi::sPlugViewGrid>::iterator it = plugGEs->begin(); it != plugGEs->end(); it++) {
int view = it->first;
if (view != viewId)
continue;
skindesignerapi::sPlugViewGrid *g = &it->second;
if (g->id == gId)
return g->tokenContainer;
}
return NULL;
}
skindesignerapi::cTokenContainer *cSDPluginManager::GetTokenContainerTab(int plugId, int viewId) {
map< int, map< int, skindesignerapi::cTokenContainer* > >::iterator hit = viewtabs.find(plugId);
if (hit == viewtabs.end())
return NULL;
map< int, skindesignerapi::cTokenContainer* > *tabs = &hit->second;
map< int, skindesignerapi::cTokenContainer* >::iterator hit2 = tabs->find(viewId);
if (hit2 == tabs->end())
return NULL;
return (hit2->second);
}
#include "pluginmanager.h"
cSDPluginManager::cSDPluginManager(void) {
lastId = 0;
subviewsfound = false;
}
cSDPluginManager::~cSDPluginManager(void) {
}
void cSDPluginManager::Reset(void) {
subViewMapping.clear();
}
void cSDPluginManager::RegisterBasicPlugin(skindesignerapi::cPluginStructure *plugStructure) {
dsyslog("skindesigner: plugin %s uses libskindesigner API Version %s",
plugStructure->name.c_str(),
plugStructure->libskindesignerAPIVersion.c_str());
plugStructure->id = lastId;
registeredPlugins.insert(pair<int,string>(lastId, plugStructure->name));
lastId++;
map< int, skindesignerapi::sPlugMenu > menusNew;
for (map< int, skindesignerapi::sPlugMenu >::iterator it = plugStructure->menus.begin(); it != plugStructure->menus.end(); it++) {
int key = it->first;
skindesignerapi::sPlugMenu menu = it->second;
skindesignerapi::sPlugMenu menuNew;
menuNew.type = menu.type;
menuNew.tplname = menu.tplname;
menuNew.tokenContainer = new skindesignerapi::cTokenContainer(*menu.tokenContainer);
menusNew.insert(pair<int, skindesignerapi::sPlugMenu>(key, menuNew));
}
pluginMenus.insert(pair< int, map < int, skindesignerapi::sPlugMenu > >(plugStructure->id, menusNew));
if (plugStructure->menus.size() > 0)
dsyslog("skindesigner: plugin %s has registered %ld menus", plugStructure->name.c_str(), plugStructure->menus.size());
}
int cSDPluginManager::GetNumPluginMenus(void) {
int numMenusTotal = 0;
for (map < int, map < int, skindesignerapi::sPlugMenu > >::iterator it = pluginMenus.begin(); it != pluginMenus.end(); it++) {
numMenusTotal += (it->second).size();
}
return numMenusTotal;
}
void cSDPluginManager::InitPluginMenuIterator(void) {
plugMenuIt = pluginMenus.begin();
}
map <int,skindesignerapi::sPlugMenu> *cSDPluginManager::GetPluginMenus(string &name, int &id) {
if (plugMenuIt == pluginMenus.end())
return NULL;
id = plugMenuIt->first;
map<int,string>::iterator hit = registeredPlugins.find(id);
if (hit != registeredPlugins.end())
name = hit->second;
map <int,skindesignerapi::sPlugMenu> *templates = &plugMenuIt->second;
plugMenuIt++;
return templates;
}
skindesignerapi::cTokenContainer *cSDPluginManager::GetTokenContainer(int plugId, int plugMenuId) {
map <int, map<int, skindesignerapi::sPlugMenu> >::iterator hit = pluginMenus.find(plugId);
if (hit == pluginMenus.end())
return NULL;
map<int, skindesignerapi::sPlugMenu>::iterator hit2 = (hit->second).find(plugMenuId);
if (hit2 == (hit->second).end())
return NULL;
skindesignerapi::cTokenContainer *tk = hit2->second.tokenContainer;
return tk;
}
void cSDPluginManager::AddSubviewMapping(int plugId, int plugMenuId, int subViewId) {
map <int, map<int,int> >::iterator hit = subViewMapping.find(plugId);
if (hit == subViewMapping.end()) {
map<int,int> menus;
menus.insert(pair<int,int>(plugMenuId, subViewId));
subViewMapping.insert(pair<int, map<int,int> >(plugId, menus));
} else {
(hit->second).insert(pair<int,int>(plugMenuId, subViewId));
}
}
int cSDPluginManager::GetSubviewId(int plugId, int plugMenuId) {
map <int, map<int,int> >::iterator hit = subViewMapping.find(plugId);
if (hit == subViewMapping.end())
return -1;
map<int,int>::iterator hit2 = (hit->second).find(plugMenuId);
if (hit2 == (hit->second).end())
return -1;
return hit2->second;
}
void cSDPluginManager::RegisterAdvancedPlugin(skindesignerapi::cPluginStructure *plugStructure) {
dsyslog("skindesigner: plugin %s uses libskindesigner API Version %s",
plugStructure->name.c_str(),
plugStructure->libskindesignerAPIVersion.c_str());
plugStructure->id = lastId;
registeredPlugins.insert(pair<int,string>(lastId, plugStructure->name));
lastId++;
rootviews.insert(pair<int,string>(plugStructure->id, plugStructure->rootview));
subviews.insert(pair<int,map<int,string> >(plugStructure->id, plugStructure->subviews));
multimap< int, skindesignerapi::sPlugViewElement > viewelementsNew;
for (map< int, skindesignerapi::sPlugViewElement >::iterator it = plugStructure->viewelements.begin(); it != plugStructure->viewelements.end(); it++) {
int key = it->first;
skindesignerapi::sPlugViewElement ve = it->second;
skindesignerapi::sPlugViewElement veNew;
veNew.id = ve.id;
veNew.viewId = ve.viewId;
veNew.name = ve.name;
veNew.tokenContainer = new skindesignerapi::cTokenContainer(*ve.tokenContainer);
viewelementsNew.insert(pair<int, skindesignerapi::sPlugViewElement>(key, veNew));
}
viewelements.insert(pair< int, multimap < int, skindesignerapi::sPlugViewElement > >(plugStructure->id, viewelementsNew));
multimap< int, skindesignerapi::sPlugViewGrid > viewgridsNew;
for (map< int, skindesignerapi::sPlugViewGrid >::iterator it = plugStructure->viewgrids.begin(); it != plugStructure->viewgrids.end(); it++) {
int key = it->first;
skindesignerapi::sPlugViewGrid vg = it->second;
skindesignerapi::sPlugViewGrid vgNew;
vgNew.id = vg.id;
vgNew.viewId = vg.viewId;
vgNew.name = vg.name;
vgNew.tokenContainer = new skindesignerapi::cTokenContainer(*vg.tokenContainer);
viewgridsNew.insert(pair<int, skindesignerapi::sPlugViewGrid>(key, vgNew));
}
viewgrids.insert(pair< int, multimap < int, skindesignerapi::sPlugViewGrid > >(plugStructure->id, viewgridsNew));
map< int, skindesignerapi::cTokenContainer* > viewtabsNew;
for (map<int,skindesignerapi::cTokenContainer*>::iterator it = plugStructure->viewtabs.begin(); it != plugStructure->viewtabs.end(); it++) {
int id = it->first;
skindesignerapi::cTokenContainer *tk = it->second;
viewtabsNew.insert(pair<int,skindesignerapi::cTokenContainer*>(id, new skindesignerapi::cTokenContainer(*tk)));
}
viewtabs.insert(pair< int, map<int,skindesignerapi::cTokenContainer*> >(plugStructure->id, viewtabsNew));
if (plugStructure->rootview.size() > 0)
dsyslog("skindesigner: plugin %s has registered %ld views with %ld viewelements and %ld viewgrids",
plugStructure->name.c_str(),
1 + plugStructure->subviews.size(),
plugStructure->viewelements.size(),
plugStructure->viewgrids.size());
}
void cSDPluginManager::InitPluginViewIterator(void) {
rootViewsIt = rootviews.begin();
}
bool cSDPluginManager::GetNextPluginView(string &plugName, int &plugId, string &tplName) {
if (rootViewsIt == rootviews.end())
return false;
plugId = rootViewsIt->first;
tplName = rootViewsIt->second;
map<int,string>::iterator hit = registeredPlugins.find(plugId);
if (hit != registeredPlugins.end())
plugName = hit->second;
rootViewsIt++;
return true;
}
int cSDPluginManager::GetNumSubviews(int plugId) {
map< int, map< int, string > >::iterator hit = subviews.find(plugId);
if (hit == subviews.end())
return 0;
return (hit->second).size();
}
void cSDPluginManager::InitPluginSubviewIterator(int plugId) {
map< int, map< int, string > >::iterator hit = subviews.find(plugId);
if (hit == subviews.end()) {
subviewsfound = false;
return;
}
subviewsCurrent = hit->second;
subviewsfound = true;
svIt = subviewsCurrent.begin();
}
bool cSDPluginManager::GetNextSubView(int &id, string &tplname) {
if (!subviewsfound)
return false;
if( svIt == subviewsCurrent.end() ) {
return false;
}
id = svIt->first;
tplname = svIt->second;
svIt++;
return true;
}
int cSDPluginManager::GetNumViewElements(int plugId, int viewId) {
map< int, multimap< int, skindesignerapi::sPlugViewElement > >::iterator hit = viewelements.find(plugId);
if (hit == viewelements.end())
return 0;
multimap<int, skindesignerapi::sPlugViewElement> *plugVEs = &hit->second;
pair<multimap<int, skindesignerapi::sPlugViewElement>::iterator, multimap<int, skindesignerapi::sPlugViewElement>::iterator> range;
range = plugVEs->equal_range(viewId);
int numVEs = 0;
for (multimap<int, skindesignerapi::sPlugViewElement>::iterator it=range.first; it!=range.second; ++it) {
numVEs++;
}
return numVEs;
}
void cSDPluginManager::InitViewElementIterator(int plugId, int viewId) {
map< int, multimap< int, skindesignerapi::sPlugViewElement > >::iterator hit = viewelements.find(plugId);
if (hit == viewelements.end())
return;
multimap<int, skindesignerapi::sPlugViewElement> *plugVEs = &hit->second;
veRange = plugVEs->equal_range(viewId);
veIt = veRange.first;
}
bool cSDPluginManager::GetNextViewElement(int &veId, string &veName) {
if (veIt == veRange.second)
return false;
skindesignerapi::sPlugViewElement *ve = &veIt->second;
veId = ve->id;
veName = ve->name;
veIt++;
return true;
}
skindesignerapi::cTokenContainer *cSDPluginManager::GetTokenContainerVE(int plugId, int viewId, int veId) {
map< int, multimap< int, skindesignerapi::sPlugViewElement > >::iterator hit = viewelements.find(plugId);
if (hit == viewelements.end())
return NULL;
multimap<int, skindesignerapi::sPlugViewElement> *plugVEs = &hit->second;
for (multimap<int, skindesignerapi::sPlugViewElement>::iterator it = plugVEs->begin(); it != plugVEs->end(); it++) {
int view = it->first;
if (view != viewId)
continue;
skindesignerapi::sPlugViewElement *ve = &it->second;
if (ve->id == veId)
return ve->tokenContainer;
}
return NULL;
}
int cSDPluginManager::GetNumViewGrids(int plugId, int viewId) {
map< int, multimap< int, skindesignerapi::sPlugViewGrid > >::iterator hit = viewgrids.find(plugId);
if (hit == viewgrids.end())
return 0;
multimap<int, skindesignerapi::sPlugViewGrid> *plugVGs = &hit->second;
pair<multimap<int, skindesignerapi::sPlugViewGrid>::iterator, multimap<int, skindesignerapi::sPlugViewGrid>::iterator> range;
range = plugVGs->equal_range(viewId);
int numVGs = 0;
for (multimap<int, skindesignerapi::sPlugViewGrid>::iterator it=range.first; it!=range.second; ++it) {
numVGs++;
}
return numVGs;
}
void cSDPluginManager::InitViewGridIterator(int plugId, int viewId) {
map< int, multimap< int, skindesignerapi::sPlugViewGrid > >::iterator hit = viewgrids.find(plugId);
if (hit == viewgrids.end())
return;
multimap<int, skindesignerapi::sPlugViewGrid> *plugGEs = &hit->second;
gRange = plugGEs->equal_range(viewId);
gIt = gRange.first;
}
bool cSDPluginManager::GetNextViewGrid(int &gId, string &gName) {
if (gIt == gRange.second)
return false;
skindesignerapi::sPlugViewGrid *ge = &gIt->second;
gId = ge->id;
gName = ge->name;
gIt++;
return true;
}
skindesignerapi::cTokenContainer *cSDPluginManager::GetTokenContainerGE(int plugId, int viewId, int gId) {
map< int, multimap< int, skindesignerapi::sPlugViewGrid > >::iterator hit = viewgrids.find(plugId);
if (hit == viewgrids.end())
return NULL;
multimap<int, skindesignerapi::sPlugViewGrid> *plugGEs = &hit->second;
for (multimap<int, skindesignerapi::sPlugViewGrid>::iterator it = plugGEs->begin(); it != plugGEs->end(); it++) {
int view = it->first;
if (view != viewId)
continue;
skindesignerapi::sPlugViewGrid *g = &it->second;
if (g->id == gId)
return g->tokenContainer;
}
return NULL;
}
skindesignerapi::cTokenContainer *cSDPluginManager::GetTokenContainerTab(int plugId, int viewId) {
map< int, map< int, skindesignerapi::cTokenContainer* > >::iterator hit = viewtabs.find(plugId);
if (hit == viewtabs.end())
return NULL;
map< int, skindesignerapi::cTokenContainer* > *tabs = &hit->second;
map< int, skindesignerapi::cTokenContainer* >::iterator hit2 = tabs->find(viewId);
if (hit2 == tabs->end())
return NULL;
return (hit2->second);
}

View File

@ -1,71 +1,71 @@
#ifndef __PLUGINMANAGER_H
#define __PLUGINMANAGER_H
#include <string>
#include <map>
#include "../libskindesignerapi/skindesignerapi.h"
using namespace std;
class cSDPluginManager {
private:
int lastId;
//plugin id --> plugin name
map < int, string > registeredPlugins;
//Basic Plugin Interface
//plugin id --> plugin definition
map < int, map < int, skindesignerapi::sPlugMenu > > pluginMenus;
map < int, map < int, skindesignerapi::sPlugMenu > >::iterator plugMenuIt;
//plugin id - menuId --> subviewid
map < int, map<int, int> > subViewMapping;
//Advanced Plugin Interface
//plugin id --> rootview templatename definition
map< int, string > rootviews;
map< int, string >::iterator rootViewsIt;
//plugin id --> subviewid /templatename definition
map< int, map< int, string > > subviews;
map< int, string> subviewsCurrent;
map< int, string>::iterator svIt;
bool subviewsfound;
//plugin id --> view id --> viewelement definition
map< int, multimap< int, skindesignerapi::sPlugViewElement > > viewelements;
pair<multimap<int, skindesignerapi::sPlugViewElement>::iterator, multimap<int, skindesignerapi::sPlugViewElement>::iterator> veRange;
multimap<int, skindesignerapi::sPlugViewElement>::iterator veIt;
//plugin id --> view id --> viewgrid definition
map< int, multimap< int, skindesignerapi::sPlugViewGrid > > viewgrids;
pair<multimap<int, skindesignerapi::sPlugViewGrid>::iterator, multimap<int, skindesignerapi::sPlugViewGrid>::iterator> gRange;
multimap<int, skindesignerapi::sPlugViewGrid>::iterator gIt;
//plugin id --> view id --> tokencontainer of detailedview definition
map< int, map< int, skindesignerapi::cTokenContainer* > > viewtabs;
public:
cSDPluginManager(void);
~cSDPluginManager(void);
void Reset(void);
//Basic Plugin Interface
void RegisterBasicPlugin(skindesignerapi::cPluginStructure *plugStructure);
int GetNumPluginMenus(void);
void InitPluginMenuIterator(void);
map <int,skindesignerapi::sPlugMenu> *GetPluginMenus(string &name, int &id);
skindesignerapi::cTokenContainer *GetTokenContainer(int plugId, int plugMenuId);
void AddSubviewMapping(int plugId, int plugMenuId, int subViewId);
int GetSubviewId(int plugId, int plugMenuId);
//Advanced Plugin Interface
void RegisterAdvancedPlugin(skindesignerapi::cPluginStructure *plugStructure);
void InitPluginViewIterator(void);
bool GetNextPluginView(string &plugName, int &plugId, string &tplName);
int GetNumSubviews(int plugId);
void InitPluginSubviewIterator(int plugId);
bool GetNextSubView(int &id, string &tplname);
int GetNumViewElements(int plugId, int viewId);
void InitViewElementIterator(int plugId, int viewId);
bool GetNextViewElement(int &veId, string &veName);
skindesignerapi::cTokenContainer *GetTokenContainerVE(int plugId, int viewId, int veId);
int GetNumViewGrids(int plugId, int viewId);
void InitViewGridIterator(int plugId, int viewId);
bool GetNextViewGrid(int &gId, string &gName);
skindesignerapi::cTokenContainer *GetTokenContainerGE(int plugId, int viewId, int gId);
skindesignerapi::cTokenContainer *GetTokenContainerTab(int plugId, int viewId);
};
#endif //__PLUGINMANAGER_H
#ifndef __PLUGINMANAGER_H
#define __PLUGINMANAGER_H
#include <string>
#include <map>
#include "../libskindesignerapi/skindesignerapi.h"
using namespace std;
class cSDPluginManager {
private:
int lastId;
//plugin id --> plugin name
map < int, string > registeredPlugins;
//Basic Plugin Interface
//plugin id --> plugin definition
map < int, map < int, skindesignerapi::sPlugMenu > > pluginMenus;
map < int, map < int, skindesignerapi::sPlugMenu > >::iterator plugMenuIt;
//plugin id - menuId --> subviewid
map < int, map<int, int> > subViewMapping;
//Advanced Plugin Interface
//plugin id --> rootview templatename definition
map< int, string > rootviews;
map< int, string >::iterator rootViewsIt;
//plugin id --> subviewid /templatename definition
map< int, map< int, string > > subviews;
map< int, string> subviewsCurrent;
map< int, string>::iterator svIt;
bool subviewsfound;
//plugin id --> view id --> viewelement definition
map< int, multimap< int, skindesignerapi::sPlugViewElement > > viewelements;
pair<multimap<int, skindesignerapi::sPlugViewElement>::iterator, multimap<int, skindesignerapi::sPlugViewElement>::iterator> veRange;
multimap<int, skindesignerapi::sPlugViewElement>::iterator veIt;
//plugin id --> view id --> viewgrid definition
map< int, multimap< int, skindesignerapi::sPlugViewGrid > > viewgrids;
pair<multimap<int, skindesignerapi::sPlugViewGrid>::iterator, multimap<int, skindesignerapi::sPlugViewGrid>::iterator> gRange;
multimap<int, skindesignerapi::sPlugViewGrid>::iterator gIt;
//plugin id --> view id --> tokencontainer of detailedview definition
map< int, map< int, skindesignerapi::cTokenContainer* > > viewtabs;
public:
cSDPluginManager(void);
~cSDPluginManager(void);
void Reset(void);
//Basic Plugin Interface
void RegisterBasicPlugin(skindesignerapi::cPluginStructure *plugStructure);
int GetNumPluginMenus(void);
void InitPluginMenuIterator(void);
map <int,skindesignerapi::sPlugMenu> *GetPluginMenus(string &name, int &id);
skindesignerapi::cTokenContainer *GetTokenContainer(int plugId, int plugMenuId);
void AddSubviewMapping(int plugId, int plugMenuId, int subViewId);
int GetSubviewId(int plugId, int plugMenuId);
//Advanced Plugin Interface
void RegisterAdvancedPlugin(skindesignerapi::cPluginStructure *plugStructure);
void InitPluginViewIterator(void);
bool GetNextPluginView(string &plugName, int &plugId, string &tplName);
int GetNumSubviews(int plugId);
void InitPluginSubviewIterator(int plugId);
bool GetNextSubView(int &id, string &tplname);
int GetNumViewElements(int plugId, int viewId);
void InitViewElementIterator(int plugId, int viewId);
bool GetNextViewElement(int &veId, string &veName);
skindesignerapi::cTokenContainer *GetTokenContainerVE(int plugId, int viewId, int veId);
int GetNumViewGrids(int plugId, int viewId);
void InitViewGridIterator(int plugId, int viewId);
bool GetNextViewGrid(int &gId, string &gName);
skindesignerapi::cTokenContainer *GetTokenContainerGE(int plugId, int viewId, int gId);
skindesignerapi::cTokenContainer *GetTokenContainerTab(int plugId, int viewId);
};
#endif //__PLUGINMANAGER_H

View File

@ -1,359 +1,359 @@
#include "scrapmanager.h"
#include "../coreengine/definitions.h"
#include "helpers.h"
cPlugin *cScrapManager::pScraper = NULL;
cScrapManager::cScrapManager(void) {
if (!pScraper) {
pScraper = GetScraperPlugin();
}
movie = NULL;
series = NULL;
}
cScrapManager::~cScrapManager(void) {
delete movie;
delete series;
}
bool cScrapManager::LoadFullScrapInfo(const cEvent *event, const cRecording *recording) {
if (!pScraper) {
return false;
}
delete movie;
movie = NULL;
delete series;
series = NULL;
ScraperGetEventType getType;
getType.event = event;
getType.recording = recording;
if (!pScraper->Service("GetEventType", &getType)) {
return false;
}
if (getType.type == tMovie) {
movie = new cMovie();
movie->movieId = getType.movieId;
pScraper->Service("GetMovie", movie);
return true;
} else if (getType.type == tSeries) {
series = new cSeries();
series->seriesId = getType.seriesId;
series->episodeId = getType.episodeId;
pScraper->Service("GetSeries", series);
return true;
}
return false;
}
void cScrapManager::SetFullScrapInfo(skindesignerapi::cTokenContainer *tk, int actorsIndex) {
if (series) {
tk->AddIntToken((int)eScraperIT::ismovie, 0);
tk->AddIntToken((int)eScraperIT::isseries, 1);
SetSeries(tk, actorsIndex);
} else if (movie) {
tk->AddIntToken((int)eScraperIT::ismovie, 1);
tk->AddIntToken((int)eScraperIT::isseries, 0);
SetMovie(tk, actorsIndex);
} else {
tk->AddIntToken((int)eScraperIT::ismovie, 0);
tk->AddIntToken((int)eScraperIT::isseries, 0);
}
}
int cScrapManager::NumActors(void) {
if (series) {
return series->actors.size();
} else if (movie) {
return movie->actors.size();
}
return 0;
}
void cScrapManager::SetHeaderScrapInfo(skindesignerapi::cTokenContainer *tk) {
if (series) {
tk->AddIntToken((int)eScraperHeaderIT::ismovie, 0);
tk->AddIntToken((int)eScraperHeaderIT::isseries, 1);
vector<cTvMedia>::iterator poster = series->posters.begin();
if (poster != series->posters.end()) {
tk->AddIntToken((int)eScraperHeaderIT::posteravailable, true);
tk->AddIntToken((int)eScraperHeaderIT::posterwidth, (*poster).width);
tk->AddIntToken((int)eScraperHeaderIT::posterheight, (*poster).height);
tk->AddStringToken((int)eScraperHeaderST::posterpath, (*poster).path.c_str());
}
vector<cTvMedia>::iterator banner = series->banners.begin();
if (banner != series->banners.end()) {
tk->AddIntToken((int)eScraperHeaderIT::banneravailable, true);
tk->AddIntToken((int)eScraperHeaderIT::bannerwidth, (*banner).width);
tk->AddIntToken((int)eScraperHeaderIT::bannerheight, (*banner).height);
tk->AddStringToken((int)eScraperHeaderST::bannerpath, (*banner).path.c_str());
}
} else if (movie) {
tk->AddIntToken((int)eScraperHeaderIT::ismovie, 1);
tk->AddIntToken((int)eScraperHeaderIT::isseries, 0);
tk->AddIntToken((int)eScraperHeaderIT::posteravailable, true);
tk->AddIntToken((int)eScraperHeaderIT::banneravailable, false);
tk->AddIntToken((int)eScraperHeaderIT::posterwidth, movie->poster.width);
tk->AddIntToken((int)eScraperHeaderIT::posterheight, movie->poster.height);
tk->AddStringToken((int)eScraperHeaderST::posterpath, movie->poster.path.c_str());
} else {
tk->AddIntToken((int)eScraperHeaderIT::ismovie, 0);
tk->AddIntToken((int)eScraperHeaderIT::isseries, 0);
}
}
void cScrapManager::SetScraperPosterBanner(skindesignerapi::cTokenContainer *tk) {
if (movie) {
tk->AddIntToken((int)eCeMenuSchedulesIT::hasposter, 1);
tk->AddStringToken((int)eCeMenuSchedulesST::posterpath, movie->poster.path.c_str());
tk->AddIntToken((int)eCeMenuSchedulesIT::posterwidth, movie->poster.width);
tk->AddIntToken((int)eCeMenuSchedulesIT::posterheight, movie->poster.height);
} else if (series) {
vector<cTvMedia>::iterator poster = series->posters.begin();
if (poster != series->posters.end()) {
tk->AddIntToken((int)eCeMenuSchedulesIT::hasposter, 1);
tk->AddIntToken((int)eCeMenuSchedulesIT::posterwidth, (*poster).width);
tk->AddIntToken((int)eCeMenuSchedulesIT::posterheight, (*poster).height);
tk->AddStringToken((int)eCeMenuSchedulesST::posterpath, (*poster).path.c_str());
}
vector<cTvMedia>::iterator banner = series->banners.begin();
if (banner != series->banners.end()) {
tk->AddIntToken((int)eCeMenuSchedulesIT::hasbanner, 1);
tk->AddIntToken((int)eCeMenuSchedulesIT::bannerwidth, (*banner).width);
tk->AddIntToken((int)eCeMenuSchedulesIT::bannerheight, (*banner).height);
tk->AddStringToken((int)eCeMenuSchedulesST::bannerpath, (*banner).path.c_str());
}
}
}
void cScrapManager::SetScraperRecordingPoster(skindesignerapi::cTokenContainer *tk, const cRecording *recording, bool isListElement) {
if (!pScraper) {
return;
}
ScraperGetPosterThumb call;
call.event = NULL;
call.recording = recording;
if (pScraper->Service("GetPosterThumb", &call)) {
if (isListElement) {
tk->AddIntToken((int)eLeMenuRecordingsIT::hasposterthumbnail, FileExists(call.poster.path));
tk->AddIntToken((int)eLeMenuRecordingsIT::thumbnailwidth, call.poster.width);
tk->AddIntToken((int)eLeMenuRecordingsIT::thumbnailheight, call.poster.height);
tk->AddStringToken((int)eLeMenuRecordingsST::thumbnailpath, call.poster.path.c_str());
} else {
tk->AddIntToken((int)eCeMenuRecordingsIT::hasposterthumbnail, FileExists(call.poster.path));
tk->AddIntToken((int)eCeMenuRecordingsIT::thumbnailwidth, call.poster.width);
tk->AddIntToken((int)eCeMenuRecordingsIT::thumbnailheight, call.poster.height);
tk->AddStringToken((int)eCeMenuRecordingsST::thumbnailpath, call.poster.path.c_str());
}
}
ScraperGetPoster call2;
call2.event = NULL;
call2.recording = recording;
if (pScraper->Service("GetPoster", &call2)) {
if (isListElement) {
tk->AddIntToken((int)eLeMenuRecordingsIT::hasposter, FileExists(call2.poster.path));
tk->AddIntToken((int)eLeMenuRecordingsIT::posterwidth, call2.poster.width);
tk->AddIntToken((int)eLeMenuRecordingsIT::posterheight, call2.poster.height);
tk->AddStringToken((int)eLeMenuRecordingsST::posterpath, call2.poster.path.c_str());
} else {
tk->AddIntToken((int)eCeMenuRecordingsIT::hasposter, FileExists(call2.poster.path));
tk->AddIntToken((int)eCeMenuRecordingsIT::posterwidth, call2.poster.width);
tk->AddIntToken((int)eCeMenuRecordingsIT::posterheight, call2.poster.height);
tk->AddStringToken((int)eCeMenuRecordingsST::posterpath, call2.poster.path.c_str());
}
}
}
cPlugin *cScrapManager::GetScraperPlugin(void) {
static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr");
if( !pScraper ) // if it doesn't exit, try tvscraper
pScraper = cPluginManager::GetPlugin("tvscraper");
return pScraper;
}
void cScrapManager::SetMovie(skindesignerapi::cTokenContainer *tk, int actorsIndex) {
tk->AddStringToken((int)eScraperST::movietitle, movie->title.c_str());
tk->AddStringToken((int)eScraperST::movieoriginalTitle, movie->originalTitle.c_str());
tk->AddStringToken((int)eScraperST::movietagline, movie->tagline.c_str());
tk->AddStringToken((int)eScraperST::movieoverview, movie->overview.c_str());
tk->AddStringToken((int)eScraperST::moviegenres, movie->genres.c_str());
tk->AddStringToken((int)eScraperST::moviehomepage, movie->homepage.c_str());
tk->AddStringToken((int)eScraperST::moviereleasedate, movie->releaseDate.c_str());
tk->AddStringToken((int)eScraperST::moviepopularity, *cString::sprintf("%f", movie->popularity));
tk->AddStringToken((int)eScraperST::movievoteaverage, *cString::sprintf("%f", movie->voteAverage));
tk->AddStringToken((int)eScraperST::posterpath, movie->poster.path.c_str());
tk->AddStringToken((int)eScraperST::fanartpath, movie->fanart.path.c_str());
tk->AddStringToken((int)eScraperST::collectionposterpath, movie->collectionPoster.path.c_str());
tk->AddStringToken((int)eScraperST::collectionfanartpath, movie->collectionFanart.path.c_str());
tk->AddIntToken((int)eScraperIT::movieadult, movie->adult);
tk->AddIntToken((int)eScraperIT::moviebudget, movie->budget);
tk->AddIntToken((int)eScraperIT::movierevenue, movie->revenue);
tk->AddIntToken((int)eScraperIT::movieruntime, movie->runtime);
tk->AddIntToken((int)eScraperIT::posterwidth, movie->poster.width);
tk->AddIntToken((int)eScraperIT::posterheight, movie->poster.height);
tk->AddIntToken((int)eScraperIT::fanartwidth, movie->fanart.width);
tk->AddIntToken((int)eScraperIT::fanartheight, movie->fanart.height);
tk->AddIntToken((int)eScraperIT::collectionposterwidth, movie->collectionPoster.width);
tk->AddIntToken((int)eScraperIT::collectionposterheight, movie->collectionPoster.height);
tk->AddIntToken((int)eScraperIT::collectionfanartwidth, movie->collectionFanart.width);
tk->AddIntToken((int)eScraperIT::collectionfanartheight, movie->collectionFanart.height);
if (movie->collectionPoster.path.size() > 0)
tk->AddIntToken((int)eScraperIT::movieiscollection, 1);
int i=0;
for (vector<cActor>::iterator act = movie->actors.begin(); act != movie->actors.end(); act++) {
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::name, (*act).name.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::role, (*act).role.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumb, (*act).actorThumb.path.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumbwidth, *cString::sprintf("%d", (*act).actorThumb.width));
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumbheight, *cString::sprintf("%d", (*act).actorThumb.height));
i++;
}
}
void cScrapManager::SetSeries(skindesignerapi::cTokenContainer *tk, int actorsIndex) {
//Series Basics
tk->AddStringToken((int)eScraperST::seriesname, series->name.c_str());
tk->AddStringToken((int)eScraperST::seriesoverview, series->overview.c_str());
tk->AddStringToken((int)eScraperST::seriesfirstaired, series->firstAired.c_str());
tk->AddStringToken((int)eScraperST::seriesnetwork, series->network.c_str());
tk->AddStringToken((int)eScraperST::seriesgenre, series->genre.c_str());
tk->AddStringToken((int)eScraperST::seriesrating, *cString::sprintf("%f", series->rating));
tk->AddStringToken((int)eScraperST::seriesstatus, series->status.c_str());
//Episode Information
tk->AddIntToken((int)eScraperIT::episodenumber, series->episode.number);
tk->AddIntToken((int)eScraperIT::episodeseason, series->episode.season);
tk->AddStringToken((int)eScraperST::episodetitle, series->episode.name.c_str());
tk->AddStringToken((int)eScraperST::episodefirstaired, series->episode.firstAired.c_str());
tk->AddStringToken((int)eScraperST::episodegueststars, series->episode.guestStars.c_str());
tk->AddStringToken((int)eScraperST::episodeoverview, series->episode.overview.c_str());
tk->AddStringToken((int)eScraperST::episoderating, *cString::sprintf("%f", series->episode.rating));
tk->AddIntToken((int)eScraperIT::episodeimagewidth, series->episode.episodeImage.width);
tk->AddIntToken((int)eScraperIT::episodeimageheight, series->episode.episodeImage.height);
tk->AddStringToken((int)eScraperST::episodeimagepath, series->episode.episodeImage.path.c_str());
//Seasonposter
tk->AddIntToken((int)eScraperIT::seasonposterwidth, series->seasonPoster.width);
tk->AddIntToken((int)eScraperIT::seasonposterheight, series->seasonPoster.height);
tk->AddStringToken((int)eScraperST::seasonposterpath, series->seasonPoster.path.c_str());
//Posters
int indexInt = (int)eScraperIT::seriesposter1width;
int indexStr = (int)eScraperST::seriesposter1path;
for(vector<cTvMedia>::iterator poster = series->posters.begin(); poster != series->posters.end(); poster++) {
tk->AddIntToken(indexInt, (*poster).width);
tk->AddIntToken(indexInt+1, (*poster).height);
tk->AddStringToken(indexStr, (*poster).path.c_str());
indexInt += 2;
indexStr++;
}
//Banners
indexInt = (int)eScraperIT::seriesbanner1width;
indexStr = (int)eScraperST::seriesbanner1path;
for(vector<cTvMedia>::iterator banner = series->banners.begin(); banner != series->banners.end(); banner++) {
tk->AddIntToken(indexInt, (*banner).width);
tk->AddIntToken(indexInt+1, (*banner).height);
tk->AddStringToken(indexStr, (*banner).path.c_str());
indexInt += 2;
indexStr++;
}
//Fanarts
indexInt = (int)eScraperIT::seriesfanart1width;
indexStr = (int)eScraperST::seriesfanart1path;
for(vector<cTvMedia>::iterator fanart = series->fanarts.begin(); fanart != series->fanarts.end(); fanart++) {
tk->AddIntToken(indexInt, (*fanart).width);
tk->AddIntToken(indexInt+1, (*fanart).height);
tk->AddStringToken(indexStr, (*fanart).path.c_str());
indexInt += 2;
indexStr++;
}
//Actors
int i=0;
for (vector<cActor>::iterator act = series->actors.begin(); act != series->actors.end(); act++) {
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::name, (*act).name.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::role, (*act).role.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumb, (*act).actorThumb.path.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumbwidth, *cString::sprintf("%d", (*act).actorThumb.width));
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumbheight, *cString::sprintf("%d", (*act).actorThumb.height));
i++;
}
}
void cScrapManager::RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster) {
if (!pScraper) {
return;
}
ScraperGetPoster callPoster;
callPoster.event = NULL;
callPoster.recording = rec;
if (pScraper->Service("GetPoster", &callPoster)) {
posterWidth = callPoster.poster.width;
posterHeight = callPoster.poster.height;
path = callPoster.poster.path;
if (path.size() > 0)
hasPoster = true;
}
}
void cScrapManager::SetPosterBanner(skindesignerapi::cTokenContainer *tk, const cEvent *event, const cRecording *recording) {
if (!pScraper) {
return;
}
int mediaWidth = 0;
int mediaHeight = 0;
string mediaPath = "";
bool isBanner = false;
int posterWidth = 0;
int posterHeight = 0;
string posterPath = "";
bool hasPoster = false;
int bannerWidth = 0;
int bannerHeight = 0;
string bannerPath = "";
bool hasBanner = false;
ScraperGetPosterBannerV2 call;
call.event = event;
call.recording = recording;
if (pScraper->Service("GetPosterBannerV2", &call)) {
if ((call.type == tSeries) && call.banner.path.size() > 0) {
mediaWidth = call.banner.width;
mediaHeight = call.banner.height;
mediaPath = call.banner.path;
isBanner = true;
bannerWidth = mediaWidth;
bannerHeight = mediaHeight;
bannerPath = mediaPath;
hasBanner = true;
ScraperGetPoster callPoster;
callPoster.event = event;
callPoster.recording = recording;
if (pScraper->Service("GetPoster", &callPoster)) {
posterWidth = callPoster.poster.width;
posterHeight = callPoster.poster.height;
posterPath = callPoster.poster.path;
hasPoster = true;
}
} else if (call.type == tMovie && call.poster.path.size() > 0 && call.poster.height > 0) {
mediaWidth = call.poster.width;
mediaHeight = call.poster.height;
mediaPath = call.poster.path;
posterWidth = call.poster.width;
posterHeight = call.poster.height;
posterPath = call.poster.path;
hasPoster = true;
}
}
tk->AddIntToken((int)eScraperPosterBannerIT::mediawidth, mediaWidth);
tk->AddIntToken((int)eScraperPosterBannerIT::mediaheight, mediaHeight);
tk->AddIntToken((int)eScraperPosterBannerIT::isbanner, isBanner);
tk->AddStringToken((int)eScraperPosterBannerST::mediapath, mediaPath.c_str());
tk->AddIntToken((int)eScraperPosterBannerIT::posterwidth, posterWidth);
tk->AddIntToken((int)eScraperPosterBannerIT::posterheight, posterHeight);
tk->AddStringToken((int)eScraperPosterBannerST::posterpath, posterPath.c_str());
tk->AddIntToken((int)eScraperPosterBannerIT::hasposter, hasPoster);
tk->AddIntToken((int)eScraperPosterBannerIT::bannerwidth, bannerWidth);
tk->AddIntToken((int)eScraperPosterBannerIT::bannerheight, bannerHeight);
tk->AddStringToken((int)eScraperPosterBannerST::bannerpath, bannerPath.c_str());
tk->AddIntToken((int)eScraperPosterBannerIT::hasbanner, hasBanner);
#include "scrapmanager.h"
#include "../coreengine/definitions.h"
#include "helpers.h"
cPlugin *cScrapManager::pScraper = NULL;
cScrapManager::cScrapManager(void) {
if (!pScraper) {
pScraper = GetScraperPlugin();
}
movie = NULL;
series = NULL;
}
cScrapManager::~cScrapManager(void) {
delete movie;
delete series;
}
bool cScrapManager::LoadFullScrapInfo(const cEvent *event, const cRecording *recording) {
if (!pScraper) {
return false;
}
delete movie;
movie = NULL;
delete series;
series = NULL;
ScraperGetEventType getType;
getType.event = event;
getType.recording = recording;
if (!pScraper->Service("GetEventType", &getType)) {
return false;
}
if (getType.type == tMovie) {
movie = new cMovie();
movie->movieId = getType.movieId;
pScraper->Service("GetMovie", movie);
return true;
} else if (getType.type == tSeries) {
series = new cSeries();
series->seriesId = getType.seriesId;
series->episodeId = getType.episodeId;
pScraper->Service("GetSeries", series);
return true;
}
return false;
}
void cScrapManager::SetFullScrapInfo(skindesignerapi::cTokenContainer *tk, int actorsIndex) {
if (series) {
tk->AddIntToken((int)eScraperIT::ismovie, 0);
tk->AddIntToken((int)eScraperIT::isseries, 1);
SetSeries(tk, actorsIndex);
} else if (movie) {
tk->AddIntToken((int)eScraperIT::ismovie, 1);
tk->AddIntToken((int)eScraperIT::isseries, 0);
SetMovie(tk, actorsIndex);
} else {
tk->AddIntToken((int)eScraperIT::ismovie, 0);
tk->AddIntToken((int)eScraperIT::isseries, 0);
}
}
int cScrapManager::NumActors(void) {
if (series) {
return series->actors.size();
} else if (movie) {
return movie->actors.size();
}
return 0;
}
void cScrapManager::SetHeaderScrapInfo(skindesignerapi::cTokenContainer *tk) {
if (series) {
tk->AddIntToken((int)eScraperHeaderIT::ismovie, 0);
tk->AddIntToken((int)eScraperHeaderIT::isseries, 1);
vector<cTvMedia>::iterator poster = series->posters.begin();
if (poster != series->posters.end()) {
tk->AddIntToken((int)eScraperHeaderIT::posteravailable, true);
tk->AddIntToken((int)eScraperHeaderIT::posterwidth, (*poster).width);
tk->AddIntToken((int)eScraperHeaderIT::posterheight, (*poster).height);
tk->AddStringToken((int)eScraperHeaderST::posterpath, (*poster).path.c_str());
}
vector<cTvMedia>::iterator banner = series->banners.begin();
if (banner != series->banners.end()) {
tk->AddIntToken((int)eScraperHeaderIT::banneravailable, true);
tk->AddIntToken((int)eScraperHeaderIT::bannerwidth, (*banner).width);
tk->AddIntToken((int)eScraperHeaderIT::bannerheight, (*banner).height);
tk->AddStringToken((int)eScraperHeaderST::bannerpath, (*banner).path.c_str());
}
} else if (movie) {
tk->AddIntToken((int)eScraperHeaderIT::ismovie, 1);
tk->AddIntToken((int)eScraperHeaderIT::isseries, 0);
tk->AddIntToken((int)eScraperHeaderIT::posteravailable, true);
tk->AddIntToken((int)eScraperHeaderIT::banneravailable, false);
tk->AddIntToken((int)eScraperHeaderIT::posterwidth, movie->poster.width);
tk->AddIntToken((int)eScraperHeaderIT::posterheight, movie->poster.height);
tk->AddStringToken((int)eScraperHeaderST::posterpath, movie->poster.path.c_str());
} else {
tk->AddIntToken((int)eScraperHeaderIT::ismovie, 0);
tk->AddIntToken((int)eScraperHeaderIT::isseries, 0);
}
}
void cScrapManager::SetScraperPosterBanner(skindesignerapi::cTokenContainer *tk) {
if (movie) {
tk->AddIntToken((int)eCeMenuSchedulesIT::hasposter, 1);
tk->AddStringToken((int)eCeMenuSchedulesST::posterpath, movie->poster.path.c_str());
tk->AddIntToken((int)eCeMenuSchedulesIT::posterwidth, movie->poster.width);
tk->AddIntToken((int)eCeMenuSchedulesIT::posterheight, movie->poster.height);
} else if (series) {
vector<cTvMedia>::iterator poster = series->posters.begin();
if (poster != series->posters.end()) {
tk->AddIntToken((int)eCeMenuSchedulesIT::hasposter, 1);
tk->AddIntToken((int)eCeMenuSchedulesIT::posterwidth, (*poster).width);
tk->AddIntToken((int)eCeMenuSchedulesIT::posterheight, (*poster).height);
tk->AddStringToken((int)eCeMenuSchedulesST::posterpath, (*poster).path.c_str());
}
vector<cTvMedia>::iterator banner = series->banners.begin();
if (banner != series->banners.end()) {
tk->AddIntToken((int)eCeMenuSchedulesIT::hasbanner, 1);
tk->AddIntToken((int)eCeMenuSchedulesIT::bannerwidth, (*banner).width);
tk->AddIntToken((int)eCeMenuSchedulesIT::bannerheight, (*banner).height);
tk->AddStringToken((int)eCeMenuSchedulesST::bannerpath, (*banner).path.c_str());
}
}
}
void cScrapManager::SetScraperRecordingPoster(skindesignerapi::cTokenContainer *tk, const cRecording *recording, bool isListElement) {
if (!pScraper) {
return;
}
ScraperGetPosterThumb call;
call.event = NULL;
call.recording = recording;
if (pScraper->Service("GetPosterThumb", &call)) {
if (isListElement) {
tk->AddIntToken((int)eLeMenuRecordingsIT::hasposterthumbnail, FileExists(call.poster.path));
tk->AddIntToken((int)eLeMenuRecordingsIT::thumbnailwidth, call.poster.width);
tk->AddIntToken((int)eLeMenuRecordingsIT::thumbnailheight, call.poster.height);
tk->AddStringToken((int)eLeMenuRecordingsST::thumbnailpath, call.poster.path.c_str());
} else {
tk->AddIntToken((int)eCeMenuRecordingsIT::hasposterthumbnail, FileExists(call.poster.path));
tk->AddIntToken((int)eCeMenuRecordingsIT::thumbnailwidth, call.poster.width);
tk->AddIntToken((int)eCeMenuRecordingsIT::thumbnailheight, call.poster.height);
tk->AddStringToken((int)eCeMenuRecordingsST::thumbnailpath, call.poster.path.c_str());
}
}
ScraperGetPoster call2;
call2.event = NULL;
call2.recording = recording;
if (pScraper->Service("GetPoster", &call2)) {
if (isListElement) {
tk->AddIntToken((int)eLeMenuRecordingsIT::hasposter, FileExists(call2.poster.path));
tk->AddIntToken((int)eLeMenuRecordingsIT::posterwidth, call2.poster.width);
tk->AddIntToken((int)eLeMenuRecordingsIT::posterheight, call2.poster.height);
tk->AddStringToken((int)eLeMenuRecordingsST::posterpath, call2.poster.path.c_str());
} else {
tk->AddIntToken((int)eCeMenuRecordingsIT::hasposter, FileExists(call2.poster.path));
tk->AddIntToken((int)eCeMenuRecordingsIT::posterwidth, call2.poster.width);
tk->AddIntToken((int)eCeMenuRecordingsIT::posterheight, call2.poster.height);
tk->AddStringToken((int)eCeMenuRecordingsST::posterpath, call2.poster.path.c_str());
}
}
}
cPlugin *cScrapManager::GetScraperPlugin(void) {
static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr");
if( !pScraper ) // if it doesn't exit, try tvscraper
pScraper = cPluginManager::GetPlugin("tvscraper");
return pScraper;
}
void cScrapManager::SetMovie(skindesignerapi::cTokenContainer *tk, int actorsIndex) {
tk->AddStringToken((int)eScraperST::movietitle, movie->title.c_str());
tk->AddStringToken((int)eScraperST::movieoriginalTitle, movie->originalTitle.c_str());
tk->AddStringToken((int)eScraperST::movietagline, movie->tagline.c_str());
tk->AddStringToken((int)eScraperST::movieoverview, movie->overview.c_str());
tk->AddStringToken((int)eScraperST::moviegenres, movie->genres.c_str());
tk->AddStringToken((int)eScraperST::moviehomepage, movie->homepage.c_str());
tk->AddStringToken((int)eScraperST::moviereleasedate, movie->releaseDate.c_str());
tk->AddStringToken((int)eScraperST::moviepopularity, *cString::sprintf("%f", movie->popularity));
tk->AddStringToken((int)eScraperST::movievoteaverage, *cString::sprintf("%f", movie->voteAverage));
tk->AddStringToken((int)eScraperST::posterpath, movie->poster.path.c_str());
tk->AddStringToken((int)eScraperST::fanartpath, movie->fanart.path.c_str());
tk->AddStringToken((int)eScraperST::collectionposterpath, movie->collectionPoster.path.c_str());
tk->AddStringToken((int)eScraperST::collectionfanartpath, movie->collectionFanart.path.c_str());
tk->AddIntToken((int)eScraperIT::movieadult, movie->adult);
tk->AddIntToken((int)eScraperIT::moviebudget, movie->budget);
tk->AddIntToken((int)eScraperIT::movierevenue, movie->revenue);
tk->AddIntToken((int)eScraperIT::movieruntime, movie->runtime);
tk->AddIntToken((int)eScraperIT::posterwidth, movie->poster.width);
tk->AddIntToken((int)eScraperIT::posterheight, movie->poster.height);
tk->AddIntToken((int)eScraperIT::fanartwidth, movie->fanart.width);
tk->AddIntToken((int)eScraperIT::fanartheight, movie->fanart.height);
tk->AddIntToken((int)eScraperIT::collectionposterwidth, movie->collectionPoster.width);
tk->AddIntToken((int)eScraperIT::collectionposterheight, movie->collectionPoster.height);
tk->AddIntToken((int)eScraperIT::collectionfanartwidth, movie->collectionFanart.width);
tk->AddIntToken((int)eScraperIT::collectionfanartheight, movie->collectionFanart.height);
if (movie->collectionPoster.path.size() > 0)
tk->AddIntToken((int)eScraperIT::movieiscollection, 1);
int i=0;
for (vector<cActor>::iterator act = movie->actors.begin(); act != movie->actors.end(); act++) {
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::name, (*act).name.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::role, (*act).role.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumb, (*act).actorThumb.path.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumbwidth, *cString::sprintf("%d", (*act).actorThumb.width));
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumbheight, *cString::sprintf("%d", (*act).actorThumb.height));
i++;
}
}
void cScrapManager::SetSeries(skindesignerapi::cTokenContainer *tk, int actorsIndex) {
//Series Basics
tk->AddStringToken((int)eScraperST::seriesname, series->name.c_str());
tk->AddStringToken((int)eScraperST::seriesoverview, series->overview.c_str());
tk->AddStringToken((int)eScraperST::seriesfirstaired, series->firstAired.c_str());
tk->AddStringToken((int)eScraperST::seriesnetwork, series->network.c_str());
tk->AddStringToken((int)eScraperST::seriesgenre, series->genre.c_str());
tk->AddStringToken((int)eScraperST::seriesrating, *cString::sprintf("%f", series->rating));
tk->AddStringToken((int)eScraperST::seriesstatus, series->status.c_str());
//Episode Information
tk->AddIntToken((int)eScraperIT::episodenumber, series->episode.number);
tk->AddIntToken((int)eScraperIT::episodeseason, series->episode.season);
tk->AddStringToken((int)eScraperST::episodetitle, series->episode.name.c_str());
tk->AddStringToken((int)eScraperST::episodefirstaired, series->episode.firstAired.c_str());
tk->AddStringToken((int)eScraperST::episodegueststars, series->episode.guestStars.c_str());
tk->AddStringToken((int)eScraperST::episodeoverview, series->episode.overview.c_str());
tk->AddStringToken((int)eScraperST::episoderating, *cString::sprintf("%f", series->episode.rating));
tk->AddIntToken((int)eScraperIT::episodeimagewidth, series->episode.episodeImage.width);
tk->AddIntToken((int)eScraperIT::episodeimageheight, series->episode.episodeImage.height);
tk->AddStringToken((int)eScraperST::episodeimagepath, series->episode.episodeImage.path.c_str());
//Seasonposter
tk->AddIntToken((int)eScraperIT::seasonposterwidth, series->seasonPoster.width);
tk->AddIntToken((int)eScraperIT::seasonposterheight, series->seasonPoster.height);
tk->AddStringToken((int)eScraperST::seasonposterpath, series->seasonPoster.path.c_str());
//Posters
int indexInt = (int)eScraperIT::seriesposter1width;
int indexStr = (int)eScraperST::seriesposter1path;
for(vector<cTvMedia>::iterator poster = series->posters.begin(); poster != series->posters.end(); poster++) {
tk->AddIntToken(indexInt, (*poster).width);
tk->AddIntToken(indexInt+1, (*poster).height);
tk->AddStringToken(indexStr, (*poster).path.c_str());
indexInt += 2;
indexStr++;
}
//Banners
indexInt = (int)eScraperIT::seriesbanner1width;
indexStr = (int)eScraperST::seriesbanner1path;
for(vector<cTvMedia>::iterator banner = series->banners.begin(); banner != series->banners.end(); banner++) {
tk->AddIntToken(indexInt, (*banner).width);
tk->AddIntToken(indexInt+1, (*banner).height);
tk->AddStringToken(indexStr, (*banner).path.c_str());
indexInt += 2;
indexStr++;
}
//Fanarts
indexInt = (int)eScraperIT::seriesfanart1width;
indexStr = (int)eScraperST::seriesfanart1path;
for(vector<cTvMedia>::iterator fanart = series->fanarts.begin(); fanart != series->fanarts.end(); fanart++) {
tk->AddIntToken(indexInt, (*fanart).width);
tk->AddIntToken(indexInt+1, (*fanart).height);
tk->AddStringToken(indexStr, (*fanart).path.c_str());
indexInt += 2;
indexStr++;
}
//Actors
int i=0;
for (vector<cActor>::iterator act = series->actors.begin(); act != series->actors.end(); act++) {
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::name, (*act).name.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::role, (*act).role.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumb, (*act).actorThumb.path.c_str());
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumbwidth, *cString::sprintf("%d", (*act).actorThumb.width));
tk->AddLoopToken(actorsIndex, i, (int)eScraperLT::thumbheight, *cString::sprintf("%d", (*act).actorThumb.height));
i++;
}
}
void cScrapManager::RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster) {
if (!pScraper) {
return;
}
ScraperGetPoster callPoster;
callPoster.event = NULL;
callPoster.recording = rec;
if (pScraper->Service("GetPoster", &callPoster)) {
posterWidth = callPoster.poster.width;
posterHeight = callPoster.poster.height;
path = callPoster.poster.path;
if (path.size() > 0)
hasPoster = true;
}
}
void cScrapManager::SetPosterBanner(skindesignerapi::cTokenContainer *tk, const cEvent *event, const cRecording *recording) {
if (!pScraper) {
return;
}
int mediaWidth = 0;
int mediaHeight = 0;
string mediaPath = "";
bool isBanner = false;
int posterWidth = 0;
int posterHeight = 0;
string posterPath = "";
bool hasPoster = false;
int bannerWidth = 0;
int bannerHeight = 0;
string bannerPath = "";
bool hasBanner = false;
ScraperGetPosterBannerV2 call;
call.event = event;
call.recording = recording;
if (pScraper->Service("GetPosterBannerV2", &call)) {
if ((call.type == tSeries) && call.banner.path.size() > 0) {
mediaWidth = call.banner.width;
mediaHeight = call.banner.height;
mediaPath = call.banner.path;
isBanner = true;
bannerWidth = mediaWidth;
bannerHeight = mediaHeight;
bannerPath = mediaPath;
hasBanner = true;
ScraperGetPoster callPoster;
callPoster.event = event;
callPoster.recording = recording;
if (pScraper->Service("GetPoster", &callPoster)) {
posterWidth = callPoster.poster.width;
posterHeight = callPoster.poster.height;
posterPath = callPoster.poster.path;
hasPoster = true;
}
} else if (call.type == tMovie && call.poster.path.size() > 0 && call.poster.height > 0) {
mediaWidth = call.poster.width;
mediaHeight = call.poster.height;
mediaPath = call.poster.path;
posterWidth = call.poster.width;
posterHeight = call.poster.height;
posterPath = call.poster.path;
hasPoster = true;
}
}
tk->AddIntToken((int)eScraperPosterBannerIT::mediawidth, mediaWidth);
tk->AddIntToken((int)eScraperPosterBannerIT::mediaheight, mediaHeight);
tk->AddIntToken((int)eScraperPosterBannerIT::isbanner, isBanner);
tk->AddStringToken((int)eScraperPosterBannerST::mediapath, mediaPath.c_str());
tk->AddIntToken((int)eScraperPosterBannerIT::posterwidth, posterWidth);
tk->AddIntToken((int)eScraperPosterBannerIT::posterheight, posterHeight);
tk->AddStringToken((int)eScraperPosterBannerST::posterpath, posterPath.c_str());
tk->AddIntToken((int)eScraperPosterBannerIT::hasposter, hasPoster);
tk->AddIntToken((int)eScraperPosterBannerIT::bannerwidth, bannerWidth);
tk->AddIntToken((int)eScraperPosterBannerIT::bannerheight, bannerHeight);
tk->AddStringToken((int)eScraperPosterBannerST::bannerpath, bannerPath.c_str());
tk->AddIntToken((int)eScraperPosterBannerIT::hasbanner, hasBanner);
}

View File

@ -1,28 +1,28 @@
#ifndef __SCRAPMANAGER_H
#define __SCRAPMANAGER_H
#include "../services/scraper2vdr.h"
#include "../libskindesignerapi/tokencontainer.h"
class cScrapManager {
private:
static cPlugin *pScraper;
cMovie *movie;
cSeries *series;
cPlugin *GetScraperPlugin(void);
void SetMovie(skindesignerapi::cTokenContainer *tk, int actorsIndex);
void SetSeries(skindesignerapi::cTokenContainer *tk, int actorsIndex);
protected:
bool LoadFullScrapInfo(const cEvent *event, const cRecording *recording);
void SetFullScrapInfo(skindesignerapi::cTokenContainer *tk, int actorsIndex);
int NumActors(void);
void SetHeaderScrapInfo(skindesignerapi::cTokenContainer *tk);
void SetScraperPosterBanner(skindesignerapi::cTokenContainer *tk);
void SetScraperRecordingPoster(skindesignerapi::cTokenContainer *tk, const cRecording *recording, bool isListElement);
void RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster);
void SetPosterBanner(skindesignerapi::cTokenContainer *tk, const cEvent *event, const cRecording *recording);
public:
cScrapManager(void);
virtual ~cScrapManager(void);
};
#ifndef __SCRAPMANAGER_H
#define __SCRAPMANAGER_H
#include "../services/scraper2vdr.h"
#include "../libskindesignerapi/tokencontainer.h"
class cScrapManager {
private:
static cPlugin *pScraper;
cMovie *movie;
cSeries *series;
cPlugin *GetScraperPlugin(void);
void SetMovie(skindesignerapi::cTokenContainer *tk, int actorsIndex);
void SetSeries(skindesignerapi::cTokenContainer *tk, int actorsIndex);
protected:
bool LoadFullScrapInfo(const cEvent *event, const cRecording *recording);
void SetFullScrapInfo(skindesignerapi::cTokenContainer *tk, int actorsIndex);
int NumActors(void);
void SetHeaderScrapInfo(skindesignerapi::cTokenContainer *tk);
void SetScraperPosterBanner(skindesignerapi::cTokenContainer *tk);
void SetScraperRecordingPoster(skindesignerapi::cTokenContainer *tk, const cRecording *recording, bool isListElement);
void RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster);
void SetPosterBanner(skindesignerapi::cTokenContainer *tk, const cEvent *event, const cRecording *recording);
public:
cScrapManager(void);
virtual ~cScrapManager(void);
};
#endif //__SCRAPMANAGER_H

View File

@ -1,92 +1,92 @@
#include "pluginstructure.h"
skindesignerapi::cPluginStructure::cPluginStructure(void) {
name = "";
libskindesignerAPIVersion = "undefined";
id = -1;
rootview = "";
};
skindesignerapi::cPluginStructure::~cPluginStructure(void) {
for (map<int,sPlugMenu>::iterator it = menus.begin(); it != menus.end(); it++) {
delete (it->second).tokenContainer;
}
};
void skindesignerapi::cPluginStructure::RegisterMenu(int key, int type, string tpl, skindesignerapi::cTokenContainer *tk) {
tk->CreateContainers();
sPlugMenu s;
s.type = type;
s.tplname = tpl;
s.tokenContainer = tk;
menus.insert(pair<int, sPlugMenu>(key, s));
}
skindesignerapi::cTokenContainer *skindesignerapi::cPluginStructure::GetMenuTokenContainer(int key) {
map<int, sPlugMenu>::iterator hit = menus.find(key);
if (hit == menus.end())
return NULL;
return hit->second.tokenContainer;
}
void skindesignerapi::cPluginStructure::RegisterRootView(string templateName) {
rootview = templateName;
}
void skindesignerapi::cPluginStructure::RegisterSubView(int subView, string templateName) {
subviews.insert(pair<int, string>(subView, templateName));
}
void skindesignerapi::cPluginStructure::RegisterViewElement(int view, int viewElement, string name, skindesignerapi::cTokenContainer *tk) {
tk->CreateContainers();
sPlugViewElement ve;
ve.id = viewElement;
ve.viewId = view;
ve.name = name;
ve.tokenContainer = tk;
viewelements.insert(pair<int, sPlugViewElement>(view, ve));
}
void skindesignerapi::cPluginStructure::RegisterViewGrid(int view, int viewGrid, string name, skindesignerapi::cTokenContainer *tk) {
tk->CreateContainers();
sPlugViewGrid vg;
vg.id = viewGrid;
vg.viewId = view;
vg.name = name;
vg.tokenContainer = tk;
viewgrids.insert(pair<int, sPlugViewGrid>(view, vg));
}
void skindesignerapi::cPluginStructure::RegisterViewTab(int view, skindesignerapi::cTokenContainer *tk) {
tk->CreateContainers();
viewtabs.insert(pair<int, skindesignerapi::cTokenContainer*>(view, tk));
}
skindesignerapi::cTokenContainer *skindesignerapi::cPluginStructure::GetTokenContainerVE(int viewId, int veId) {
pair<multimap<int, sPlugViewElement>::iterator, multimap<int, sPlugViewElement>::iterator> range;
range = viewelements.equal_range(viewId);
for (multimap<int, sPlugViewElement>::iterator it=range.first; it!=range.second; ++it) {
sPlugViewElement *ve = &it->second;
if (ve->id == veId)
return ve->tokenContainer;
}
return NULL;
}
skindesignerapi::cTokenContainer *skindesignerapi::cPluginStructure::GetTokenContainerGE(int viewId, int geId) {
pair<multimap<int, sPlugViewGrid>::iterator, multimap<int, sPlugViewGrid>::iterator> range;
range = viewgrids.equal_range(viewId);
for (multimap<int, sPlugViewGrid>::iterator it=range.first; it!=range.second; ++it) {
sPlugViewGrid *ge = &it->second;
if (ge->id == geId)
return ge->tokenContainer;
}
return NULL;
}
skindesignerapi::cTokenContainer *skindesignerapi::cPluginStructure::GetTokenContainerTab(int viewId) {
map<int,skindesignerapi::cTokenContainer*>::iterator hit = viewtabs.find(viewId);
if (hit == viewtabs.end())
return NULL;
return hit->second;
}
#include "pluginstructure.h"
skindesignerapi::cPluginStructure::cPluginStructure(void) {
name = "";
libskindesignerAPIVersion = "undefined";
id = -1;
rootview = "";
};
skindesignerapi::cPluginStructure::~cPluginStructure(void) {
for (map<int,sPlugMenu>::iterator it = menus.begin(); it != menus.end(); it++) {
delete (it->second).tokenContainer;
}
};
void skindesignerapi::cPluginStructure::RegisterMenu(int key, int type, string tpl, skindesignerapi::cTokenContainer *tk) {
tk->CreateContainers();
sPlugMenu s;
s.type = type;
s.tplname = tpl;
s.tokenContainer = tk;
menus.insert(pair<int, sPlugMenu>(key, s));
}
skindesignerapi::cTokenContainer *skindesignerapi::cPluginStructure::GetMenuTokenContainer(int key) {
map<int, sPlugMenu>::iterator hit = menus.find(key);
if (hit == menus.end())
return NULL;
return hit->second.tokenContainer;
}
void skindesignerapi::cPluginStructure::RegisterRootView(string templateName) {
rootview = templateName;
}
void skindesignerapi::cPluginStructure::RegisterSubView(int subView, string templateName) {
subviews.insert(pair<int, string>(subView, templateName));
}
void skindesignerapi::cPluginStructure::RegisterViewElement(int view, int viewElement, string name, skindesignerapi::cTokenContainer *tk) {
tk->CreateContainers();
sPlugViewElement ve;
ve.id = viewElement;
ve.viewId = view;
ve.name = name;
ve.tokenContainer = tk;
viewelements.insert(pair<int, sPlugViewElement>(view, ve));
}
void skindesignerapi::cPluginStructure::RegisterViewGrid(int view, int viewGrid, string name, skindesignerapi::cTokenContainer *tk) {
tk->CreateContainers();
sPlugViewGrid vg;
vg.id = viewGrid;
vg.viewId = view;
vg.name = name;
vg.tokenContainer = tk;
viewgrids.insert(pair<int, sPlugViewGrid>(view, vg));
}
void skindesignerapi::cPluginStructure::RegisterViewTab(int view, skindesignerapi::cTokenContainer *tk) {
tk->CreateContainers();
viewtabs.insert(pair<int, skindesignerapi::cTokenContainer*>(view, tk));
}
skindesignerapi::cTokenContainer *skindesignerapi::cPluginStructure::GetTokenContainerVE(int viewId, int veId) {
pair<multimap<int, sPlugViewElement>::iterator, multimap<int, sPlugViewElement>::iterator> range;
range = viewelements.equal_range(viewId);
for (multimap<int, sPlugViewElement>::iterator it=range.first; it!=range.second; ++it) {
sPlugViewElement *ve = &it->second;
if (ve->id == veId)
return ve->tokenContainer;
}
return NULL;
}
skindesignerapi::cTokenContainer *skindesignerapi::cPluginStructure::GetTokenContainerGE(int viewId, int geId) {
pair<multimap<int, sPlugViewGrid>::iterator, multimap<int, sPlugViewGrid>::iterator> range;
range = viewgrids.equal_range(viewId);
for (multimap<int, sPlugViewGrid>::iterator it=range.first; it!=range.second; ++it) {
sPlugViewGrid *ge = &it->second;
if (ge->id == geId)
return ge->tokenContainer;
}
return NULL;
}
skindesignerapi::cTokenContainer *skindesignerapi::cPluginStructure::GetTokenContainerTab(int viewId) {
map<int,skindesignerapi::cTokenContainer*>::iterator hit = viewtabs.find(viewId);
if (hit == viewtabs.end())
return NULL;
return hit->second;
}

View File

@ -1,57 +1,57 @@
#ifndef __PLUGINSTRUCTURE_H
#define __PLUGINSTRUCTURE_H
#include "tokencontainer.h"
namespace skindesignerapi {
struct sPlugMenu {
int type;
string tplname;
cTokenContainer *tokenContainer;
};
struct sPlugViewElement {
int id;
int viewId;
string name;
cTokenContainer *tokenContainer;
};
struct sPlugViewGrid {
int id;
int viewId;
string name;
cTokenContainer *tokenContainer;
};
class cPluginStructure {
public:
cPluginStructure(void);
~cPluginStructure(void);
void RegisterMenu(int key, int type, string tpl, cTokenContainer *tk);
cTokenContainer *GetMenuTokenContainer(int key);
void RegisterRootView(string templateName);
void RegisterSubView(int subView, string templateName);
void RegisterViewElement(int view, int viewElement, string name, cTokenContainer *tk);
void RegisterViewGrid(int view, int viewGrid, string name, cTokenContainer *tk);
void RegisterViewTab(int view, cTokenContainer *tk);
cTokenContainer *GetTokenContainerVE(int viewId, int veId);
cTokenContainer *GetTokenContainerGE(int viewId, int geId);
cTokenContainer *GetTokenContainerTab(int viewId);
string name; //name of plugin
string libskindesignerAPIVersion; //skindesigner API Version plugin is using
int id; //id of plugin in skindesigner
//basic plugin interface
map< int, sPlugMenu > menus; //menus as key -> sPlugMenu struct hashmap
//advanced plugin interface
string rootview; //template name of root view
map< int, string > subviews; //subviews as subviewid -> template name map
multimap< int, sPlugViewElement > viewelements; //viewelements as viewid -> sPlugViewElement struct multimap
multimap< int, sPlugViewGrid > viewgrids; //viewgrids as viewid -> sPlugViewGrid struct hashmap
map< int, cTokenContainer* > viewtabs; //viewtabs as viewid -> tokencontainer hashmap
};
}
#ifndef __PLUGINSTRUCTURE_H
#define __PLUGINSTRUCTURE_H
#include "tokencontainer.h"
namespace skindesignerapi {
struct sPlugMenu {
int type;
string tplname;
cTokenContainer *tokenContainer;
};
struct sPlugViewElement {
int id;
int viewId;
string name;
cTokenContainer *tokenContainer;
};
struct sPlugViewGrid {
int id;
int viewId;
string name;
cTokenContainer *tokenContainer;
};
class cPluginStructure {
public:
cPluginStructure(void);
~cPluginStructure(void);
void RegisterMenu(int key, int type, string tpl, cTokenContainer *tk);
cTokenContainer *GetMenuTokenContainer(int key);
void RegisterRootView(string templateName);
void RegisterSubView(int subView, string templateName);
void RegisterViewElement(int view, int viewElement, string name, cTokenContainer *tk);
void RegisterViewGrid(int view, int viewGrid, string name, cTokenContainer *tk);
void RegisterViewTab(int view, cTokenContainer *tk);
cTokenContainer *GetTokenContainerVE(int viewId, int veId);
cTokenContainer *GetTokenContainerGE(int viewId, int geId);
cTokenContainer *GetTokenContainerTab(int viewId);
string name; //name of plugin
string libskindesignerAPIVersion; //skindesigner API Version plugin is using
int id; //id of plugin in skindesigner
//basic plugin interface
map< int, sPlugMenu > menus; //menus as key -> sPlugMenu struct hashmap
//advanced plugin interface
string rootview; //template name of root view
map< int, string > subviews; //subviews as subviewid -> template name map
multimap< int, sPlugViewElement > viewelements; //viewelements as viewid -> sPlugViewElement struct multimap
multimap< int, sPlugViewGrid > viewgrids; //viewgrids as viewid -> sPlugViewGrid struct hashmap
map< int, cTokenContainer* > viewtabs; //viewtabs as viewid -> tokencontainer hashmap
};
}
#endif //__PLUGINSTRUCTURE_H

View File

@ -1,305 +1,305 @@
#include "tokencontainer.h"
skindesignerapi::cTokenContainer::cTokenContainer(void) {
numIntTokens = 0;
numStringTokens = 0;
stringTokens = NULL;
intTokens = NULL;
stNames = NULL;
itNames = NULL;
}
skindesignerapi::cTokenContainer::cTokenContainer(const cTokenContainer &other) {
numIntTokens = 0;
numStringTokens = 0;
stringTokens = NULL;
intTokens = NULL;
stNames = NULL;
itNames = NULL;
stringTokenNames = other.stringTokenNames;
intTokenNames = other.intTokenNames;
loopTokenNames = other.loopTokenNames;
loopNameMapping = other.loopNameMapping;
}
skindesignerapi::cTokenContainer::~cTokenContainer(void) {
Clear();
delete[] intTokens;
delete[] stringTokens;
delete[] stNames;
delete[] itNames;
}
void skindesignerapi::cTokenContainer::CreateContainers(void) {
numIntTokens = intTokenNames.size();
if (numIntTokens) {
intTokens = new int[numIntTokens];
itNames = new string[numIntTokens];
for (int i=0; i < numIntTokens; i++) {
intTokens[i] = -1;
itNames[i] = GetIntTokenName(i);
}
}
numStringTokens = stringTokenNames.size();
if (numStringTokens) {
stringTokens = new char*[numStringTokens];
stNames = new string[numStringTokens];
for (int i=0; i < numStringTokens; i++) {
stringTokens[i] = NULL;
stNames[i] = GetStringTokenName(i);
}
}
int numLoops = loopTokenNames.size();
for (int i = 0; i < numLoops; ++i) {
vector<string> loopToken;
int numLoopTokens = loopTokenNames[i].size();
for (int j = 0; j < numLoopTokens; ++j) {
string tokenName = GetLoopTokenName(i, j);
loopToken.push_back(tokenName);
}
ltNames.push_back(loopToken);
}
}
void skindesignerapi::cTokenContainer::CreateLoopTokenContainer(vector<int> *loopInfo) {
int numLoops = loopInfo->size();
for (int i = 0; i < numLoops; ++i) {
numLoopTokens.push_back(loopInfo->at(i));
int rows = loopInfo->at(i);
char*** loopToks = new char**[rows];
for (int j = 0; j < rows ; ++j) {
int numLoopTokens = loopTokenNames[i].size();
loopToks[j] = new char*[numLoopTokens];
for (int k = 0; k < numLoopTokens; ++k) {
loopToks[j][k] = NULL;
}
}
loopTokens.push_back(loopToks);
}
}
void skindesignerapi::cTokenContainer::DeleteLoopTokenContainer(void) {
int i = 0;
for (vector<char***>::iterator it = loopTokens.begin(); it != loopTokens.end(); it++) {
char*** loopToks = *it;
for (int j = 0; j < numLoopTokens[i] ; j++) {
int numToks = loopTokenNames[i].size();
for (int k = 0; k < numToks; ++k) {
free(loopToks[j][k]);
}
delete[] loopToks[j];
}
delete[] loopToks;
++i;
}
loopTokens.clear();
numLoopTokens.clear();
}
void skindesignerapi::cTokenContainer::DefineStringToken(string name, int index) {
stringTokenNames.insert(pair<string, int>(name, index));
}
void skindesignerapi::cTokenContainer::DefineIntToken(string name, int index) {
intTokenNames.insert(pair<string, int>(name, index));
}
void skindesignerapi::cTokenContainer::DefineLoopToken(string name, int index) {
string loopName = LoopName(name);
int loopIndex = LoopIndex(loopName, true);
if ((int)loopTokenNames.size() < loopIndex+1) {
map<string, int> newloop;
newloop.insert(pair<string, int>(name, index));
loopTokenNames.push_back(newloop);
return;
}
loopTokenNames[loopIndex].insert(pair<string, int>(name, index));
}
int skindesignerapi::cTokenContainer::GetNumDefinedIntTokens(void) {
return intTokenNames.size();
}
int skindesignerapi::cTokenContainer::LoopIndex(string name, bool createNew) {
map<string, int>::iterator hit = loopNameMapping.find(name);
if (hit != loopNameMapping.end())
return hit->second;
if (!createNew)
return -1;
int index = loopNameMapping.size();
loopNameMapping.insert(pair<string, int>(name, index));
return index;
}
int skindesignerapi::cTokenContainer::StringTokenIndex(string name) {
map<string, int>::iterator hit = stringTokenNames.find(name);
if (hit == stringTokenNames.end())
return -1;
return hit->second;
}
int skindesignerapi::cTokenContainer::IntTokenIndex(string name) {
map<string, int>::iterator hit = intTokenNames.find(name);
if (hit == intTokenNames.end())
return -1;
return hit->second;
}
int skindesignerapi::cTokenContainer::LoopTokenIndex(string name) {
string loopName = LoopName(name);
int loopIndex = LoopIndex(loopName);
if (loopIndex > -1 && loopIndex < (int)loopTokenNames.size()) {
map<string, int>::iterator hit = loopTokenNames[loopIndex].find(name);
if (hit == loopTokenNames[loopIndex].end())
return -1;
return hit->second;
}
return -1;
}
void skindesignerapi::cTokenContainer::AddIntToken(int index, int value) {
intTokens[index] = value;
}
void skindesignerapi::cTokenContainer::AddStringToken(int index, const char *value) {
if (value)
stringTokens[index] = strdup(value);
}
void skindesignerapi::cTokenContainer::AddLoopToken(int loopIndex, int row, int index, const char *value) {
if (value) {
loopTokens[loopIndex][row][index] = strdup(value);
}
}
int skindesignerapi::cTokenContainer::NumLoops(int loopIndex) {
int numLT = numLoopTokens.size();
if (loopIndex >= 0 && loopIndex < numLT)
return numLoopTokens[loopIndex];
return 0;
}
void skindesignerapi::cTokenContainer::SetTokens(cTokenContainer *other) {
//Set Int and String Tokens
if (numIntTokens) {
for (int i=0; i < numIntTokens; i++) {
AddIntToken(i, other->IntToken(i));
}
}
if (numStringTokens) {
for (int i=0; i < numStringTokens; i++) {
AddStringToken(i, other->StringToken(i));
}
}
//Set Looptoken Container
set<int> loopIndices;
for (map<string, int>::iterator it = loopNameMapping.begin(); it != loopNameMapping.end(); it++) {
loopIndices.insert(it->second);
}
vector<int> loopInfo;
for (set<int>::iterator it = loopIndices.begin(); it != loopIndices.end(); it++) {
loopInfo.push_back(other->NumLoops(*it));
}
CreateLoopTokenContainer(&loopInfo);
//Set Loop Tokens
int i = 0;
for (vector<int>::iterator it = loopInfo.begin(); it != loopInfo.end(); it++) {
int numRows = *it;
int numCols = loopTokenNames[i].size();
for (int j = 0; j < numRows; j++) {
for (int k = 0; k < numCols; k++) {
AddLoopToken(i, j, k, other->LoopToken(i, j, k));
}
}
i++;
}
}
void skindesignerapi::cTokenContainer::Clear(void) {
if (numIntTokens) {
for (int i=0; i < numIntTokens; i++) {
intTokens[i] = -1;
}
}
if (numStringTokens) {
for (int i=0; i < numStringTokens; i++) {
free(stringTokens[i]);
stringTokens[i] = NULL;
}
}
DeleteLoopTokenContainer();
}
void skindesignerapi::cTokenContainer::Debug(void) {
/*
esyslog("skindesigner: TokenContainer defined string tokens");
for (map<string, int>::iterator it = stringTokenNames.begin(); it != stringTokenNames.end(); it++) {
esyslog("skindesigner: name %s id %d", (it->first).c_str(), it->second);
}
esyslog("skindesigner: TokenContainer defined int tokens");
for (map<string, int>::iterator it = intTokenNames.begin(); it != intTokenNames.end(); it++) {
esyslog("skindesigner: name %s id %d", (it->first).c_str(), it->second);
}
*/
esyslog("skindesigner: TokenContainer content");
for (int i=0; i < numStringTokens; i++) {
if (stringTokens[i])
esyslog("skindesigner: stringtoken %d. %s: \"%s\"", i, stNames[i].c_str(), stringTokens[i]);
else
esyslog("skindesigner: stringtoken %d. %s: empty", i, stNames[i].c_str());
}
for (int i=0; i < numIntTokens; i++) {
if (intTokens[i] >= 0)
esyslog("skindesigner: inttoken %d. %s: %d", i, itNames[i].c_str(), intTokens[i]);
else
esyslog("skindesigner: inttoken %d. %s: empty", i, itNames[i].c_str());
}
for (size_t i=0; i < loopTokens.size(); i++) {
for (int j = 0; j < numLoopTokens[i]; j++) {
esyslog("skindesigner: row %d", j);
for (size_t k = 0; k < loopTokenNames[i].size(); k++) {
if (loopTokens[i][j][k])
esyslog("skindesigner: looptoken %d. %s: \"%s\"", (int)k, ltNames[i][k].c_str(), loopTokens[i][j][k]);
else
esyslog("skindesigner: looptoken %d. %s: empty", (int)k, ltNames[i][k].c_str());
}
}
}
}
string skindesignerapi::cTokenContainer::GetStringTokenName(int id) {
for (map<string, int>::iterator it = stringTokenNames.begin(); it != stringTokenNames.end(); it++) {
if (it->second == id)
return it->first;
}
return "";
}
string skindesignerapi::cTokenContainer::GetIntTokenName(int id) {
for (map<string, int>::iterator it = intTokenNames.begin(); it != intTokenNames.end(); it++) {
if (it->second == id)
return it->first;
}
return "";
}
string skindesignerapi::cTokenContainer::GetLoopTokenName(int loop, int id) {
for (map<string, int>::iterator it = loopTokenNames[loop].begin(); it != loopTokenNames[loop].end(); it++) {
if (it->second == id)
return it->first;
}
return "";
}
//Get name of loop from a loop token name
string skindesignerapi::cTokenContainer::LoopName(string &loopToken) {
size_t hit = loopToken.find('{');
if (hit != 0)
return "";
hit = loopToken.find('[');
if (hit == string::npos)
return "";
return loopToken.substr(1, hit-1);
}
#include "tokencontainer.h"
skindesignerapi::cTokenContainer::cTokenContainer(void) {
numIntTokens = 0;
numStringTokens = 0;
stringTokens = NULL;
intTokens = NULL;
stNames = NULL;
itNames = NULL;
}
skindesignerapi::cTokenContainer::cTokenContainer(const cTokenContainer &other) {
numIntTokens = 0;
numStringTokens = 0;
stringTokens = NULL;
intTokens = NULL;
stNames = NULL;
itNames = NULL;
stringTokenNames = other.stringTokenNames;
intTokenNames = other.intTokenNames;
loopTokenNames = other.loopTokenNames;
loopNameMapping = other.loopNameMapping;
}
skindesignerapi::cTokenContainer::~cTokenContainer(void) {
Clear();
delete[] intTokens;
delete[] stringTokens;
delete[] stNames;
delete[] itNames;
}
void skindesignerapi::cTokenContainer::CreateContainers(void) {
numIntTokens = intTokenNames.size();
if (numIntTokens) {
intTokens = new int[numIntTokens];
itNames = new string[numIntTokens];
for (int i=0; i < numIntTokens; i++) {
intTokens[i] = -1;
itNames[i] = GetIntTokenName(i);
}
}
numStringTokens = stringTokenNames.size();
if (numStringTokens) {
stringTokens = new char*[numStringTokens];
stNames = new string[numStringTokens];
for (int i=0; i < numStringTokens; i++) {
stringTokens[i] = NULL;
stNames[i] = GetStringTokenName(i);
}
}
int numLoops = loopTokenNames.size();
for (int i = 0; i < numLoops; ++i) {
vector<string> loopToken;
int numLoopTokens = loopTokenNames[i].size();
for (int j = 0; j < numLoopTokens; ++j) {
string tokenName = GetLoopTokenName(i, j);
loopToken.push_back(tokenName);
}
ltNames.push_back(loopToken);
}
}
void skindesignerapi::cTokenContainer::CreateLoopTokenContainer(vector<int> *loopInfo) {
int numLoops = loopInfo->size();
for (int i = 0; i < numLoops; ++i) {
numLoopTokens.push_back(loopInfo->at(i));
int rows = loopInfo->at(i);
char*** loopToks = new char**[rows];
for (int j = 0; j < rows ; ++j) {
int numLoopTokens = loopTokenNames[i].size();
loopToks[j] = new char*[numLoopTokens];
for (int k = 0; k < numLoopTokens; ++k) {
loopToks[j][k] = NULL;
}
}
loopTokens.push_back(loopToks);
}
}
void skindesignerapi::cTokenContainer::DeleteLoopTokenContainer(void) {
int i = 0;
for (vector<char***>::iterator it = loopTokens.begin(); it != loopTokens.end(); it++) {
char*** loopToks = *it;
for (int j = 0; j < numLoopTokens[i] ; j++) {
int numToks = loopTokenNames[i].size();
for (int k = 0; k < numToks; ++k) {
free(loopToks[j][k]);
}
delete[] loopToks[j];
}
delete[] loopToks;
++i;
}
loopTokens.clear();
numLoopTokens.clear();
}
void skindesignerapi::cTokenContainer::DefineStringToken(string name, int index) {
stringTokenNames.insert(pair<string, int>(name, index));
}
void skindesignerapi::cTokenContainer::DefineIntToken(string name, int index) {
intTokenNames.insert(pair<string, int>(name, index));
}
void skindesignerapi::cTokenContainer::DefineLoopToken(string name, int index) {
string loopName = LoopName(name);
int loopIndex = LoopIndex(loopName, true);
if ((int)loopTokenNames.size() < loopIndex+1) {
map<string, int> newloop;
newloop.insert(pair<string, int>(name, index));
loopTokenNames.push_back(newloop);
return;
}
loopTokenNames[loopIndex].insert(pair<string, int>(name, index));
}
int skindesignerapi::cTokenContainer::GetNumDefinedIntTokens(void) {
return intTokenNames.size();
}
int skindesignerapi::cTokenContainer::LoopIndex(string name, bool createNew) {
map<string, int>::iterator hit = loopNameMapping.find(name);
if (hit != loopNameMapping.end())
return hit->second;
if (!createNew)
return -1;
int index = loopNameMapping.size();
loopNameMapping.insert(pair<string, int>(name, index));
return index;
}
int skindesignerapi::cTokenContainer::StringTokenIndex(string name) {
map<string, int>::iterator hit = stringTokenNames.find(name);
if (hit == stringTokenNames.end())
return -1;
return hit->second;
}
int skindesignerapi::cTokenContainer::IntTokenIndex(string name) {
map<string, int>::iterator hit = intTokenNames.find(name);
if (hit == intTokenNames.end())
return -1;
return hit->second;
}
int skindesignerapi::cTokenContainer::LoopTokenIndex(string name) {
string loopName = LoopName(name);
int loopIndex = LoopIndex(loopName);
if (loopIndex > -1 && loopIndex < (int)loopTokenNames.size()) {
map<string, int>::iterator hit = loopTokenNames[loopIndex].find(name);
if (hit == loopTokenNames[loopIndex].end())
return -1;
return hit->second;
}
return -1;
}
void skindesignerapi::cTokenContainer::AddIntToken(int index, int value) {
intTokens[index] = value;
}
void skindesignerapi::cTokenContainer::AddStringToken(int index, const char *value) {
if (value)
stringTokens[index] = strdup(value);
}
void skindesignerapi::cTokenContainer::AddLoopToken(int loopIndex, int row, int index, const char *value) {
if (value) {
loopTokens[loopIndex][row][index] = strdup(value);
}
}
int skindesignerapi::cTokenContainer::NumLoops(int loopIndex) {
int numLT = numLoopTokens.size();
if (loopIndex >= 0 && loopIndex < numLT)
return numLoopTokens[loopIndex];
return 0;
}
void skindesignerapi::cTokenContainer::SetTokens(cTokenContainer *other) {
//Set Int and String Tokens
if (numIntTokens) {
for (int i=0; i < numIntTokens; i++) {
AddIntToken(i, other->IntToken(i));
}
}
if (numStringTokens) {
for (int i=0; i < numStringTokens; i++) {
AddStringToken(i, other->StringToken(i));
}
}
//Set Looptoken Container
set<int> loopIndices;
for (map<string, int>::iterator it = loopNameMapping.begin(); it != loopNameMapping.end(); it++) {
loopIndices.insert(it->second);
}
vector<int> loopInfo;
for (set<int>::iterator it = loopIndices.begin(); it != loopIndices.end(); it++) {
loopInfo.push_back(other->NumLoops(*it));
}
CreateLoopTokenContainer(&loopInfo);
//Set Loop Tokens
int i = 0;
for (vector<int>::iterator it = loopInfo.begin(); it != loopInfo.end(); it++) {
int numRows = *it;
int numCols = loopTokenNames[i].size();
for (int j = 0; j < numRows; j++) {
for (int k = 0; k < numCols; k++) {
AddLoopToken(i, j, k, other->LoopToken(i, j, k));
}
}
i++;
}
}
void skindesignerapi::cTokenContainer::Clear(void) {
if (numIntTokens) {
for (int i=0; i < numIntTokens; i++) {
intTokens[i] = -1;
}
}
if (numStringTokens) {
for (int i=0; i < numStringTokens; i++) {
free(stringTokens[i]);
stringTokens[i] = NULL;
}
}
DeleteLoopTokenContainer();
}
void skindesignerapi::cTokenContainer::Debug(void) {
/*
esyslog("skindesigner: TokenContainer defined string tokens");
for (map<string, int>::iterator it = stringTokenNames.begin(); it != stringTokenNames.end(); it++) {
esyslog("skindesigner: name %s id %d", (it->first).c_str(), it->second);
}
esyslog("skindesigner: TokenContainer defined int tokens");
for (map<string, int>::iterator it = intTokenNames.begin(); it != intTokenNames.end(); it++) {
esyslog("skindesigner: name %s id %d", (it->first).c_str(), it->second);
}
*/
esyslog("skindesigner: TokenContainer content");
for (int i=0; i < numStringTokens; i++) {
if (stringTokens[i])
esyslog("skindesigner: stringtoken %d. %s: \"%s\"", i, stNames[i].c_str(), stringTokens[i]);
else
esyslog("skindesigner: stringtoken %d. %s: empty", i, stNames[i].c_str());
}
for (int i=0; i < numIntTokens; i++) {
if (intTokens[i] >= 0)
esyslog("skindesigner: inttoken %d. %s: %d", i, itNames[i].c_str(), intTokens[i]);
else
esyslog("skindesigner: inttoken %d. %s: empty", i, itNames[i].c_str());
}
for (size_t i=0; i < loopTokens.size(); i++) {
for (int j = 0; j < numLoopTokens[i]; j++) {
esyslog("skindesigner: row %d", j);
for (size_t k = 0; k < loopTokenNames[i].size(); k++) {
if (loopTokens[i][j][k])
esyslog("skindesigner: looptoken %d. %s: \"%s\"", (int)k, ltNames[i][k].c_str(), loopTokens[i][j][k]);
else
esyslog("skindesigner: looptoken %d. %s: empty", (int)k, ltNames[i][k].c_str());
}
}
}
}
string skindesignerapi::cTokenContainer::GetStringTokenName(int id) {
for (map<string, int>::iterator it = stringTokenNames.begin(); it != stringTokenNames.end(); it++) {
if (it->second == id)
return it->first;
}
return "";
}
string skindesignerapi::cTokenContainer::GetIntTokenName(int id) {
for (map<string, int>::iterator it = intTokenNames.begin(); it != intTokenNames.end(); it++) {
if (it->second == id)
return it->first;
}
return "";
}
string skindesignerapi::cTokenContainer::GetLoopTokenName(int loop, int id) {
for (map<string, int>::iterator it = loopTokenNames[loop].begin(); it != loopTokenNames[loop].end(); it++) {
if (it->second == id)
return it->first;
}
return "";
}
//Get name of loop from a loop token name
string skindesignerapi::cTokenContainer::LoopName(string &loopToken) {
size_t hit = loopToken.find('{');
if (hit != 0)
return "";
hit = loopToken.find('[');
if (hit == string::npos)
return "";
return loopToken.substr(1, hit-1);
}

View File

@ -1,69 +1,69 @@
#ifndef __TOKENCONTAINER_H
#define __TOKENCONTAINER_H
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <vdr/plugin.h>
using namespace std;
namespace skindesignerapi {
class cTokenContainer {
private:
int numIntTokens;
int numStringTokens;
vector<int> numLoopTokens;
//token containers
char **stringTokens;
int *intTokens;
vector<char***>loopTokens;
//mapping id --> name
string *stNames;
string *itNames;
vector< vector<string> > ltNames;
//mapping name --> id
map<string, int> stringTokenNames;
map<string, int> intTokenNames;
vector< map<string, int> > loopTokenNames;
//get token name from id
string GetStringTokenName(int id);
string GetIntTokenName(int id);
string GetLoopTokenName(int loop, int id);
//looptoken management
string LoopName(string &loopToken);
map<string, int> loopNameMapping;
void DeleteLoopTokenContainer(void);
public:
cTokenContainer(void);
cTokenContainer(const cTokenContainer &other);
~cTokenContainer(void);
void CreateContainers(void);
void CreateLoopTokenContainer(vector<int> *loopInfo);
void DefineStringToken (string name, int index);
void DefineIntToken (string name, int index);
void DefineLoopToken (string name, int index);
int GetNumDefinedIntTokens(void);
int LoopIndex (string name, bool createNew = false);
int StringTokenIndex (string name);
int IntTokenIndex (string name);
int LoopTokenIndex (string name);
void AddIntToken (int index, int value);
void AddStringToken (int index, const char *value);
void AddLoopToken (int loopIndex, int row, int index, const char *value);
char *StringToken (int index) { return stringTokens[index]; };
int IntToken (int index) { return intTokens[index]; };
char *LoopToken (int i, int j, int k) { return loopTokens[i][j][k]; };
int NumLoops (int loopIndex);
void SetTokens (cTokenContainer *other);
void Clear(void);
void Debug(void);
};
}
#ifndef __TOKENCONTAINER_H
#define __TOKENCONTAINER_H
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <vdr/plugin.h>
using namespace std;
namespace skindesignerapi {
class cTokenContainer {
private:
int numIntTokens;
int numStringTokens;
vector<int> numLoopTokens;
//token containers
char **stringTokens;
int *intTokens;
vector<char***>loopTokens;
//mapping id --> name
string *stNames;
string *itNames;
vector< vector<string> > ltNames;
//mapping name --> id
map<string, int> stringTokenNames;
map<string, int> intTokenNames;
vector< map<string, int> > loopTokenNames;
//get token name from id
string GetStringTokenName(int id);
string GetIntTokenName(int id);
string GetLoopTokenName(int loop, int id);
//looptoken management
string LoopName(string &loopToken);
map<string, int> loopNameMapping;
void DeleteLoopTokenContainer(void);
public:
cTokenContainer(void);
cTokenContainer(const cTokenContainer &other);
~cTokenContainer(void);
void CreateContainers(void);
void CreateLoopTokenContainer(vector<int> *loopInfo);
void DefineStringToken (string name, int index);
void DefineIntToken (string name, int index);
void DefineLoopToken (string name, int index);
int GetNumDefinedIntTokens(void);
int LoopIndex (string name, bool createNew = false);
int StringTokenIndex (string name);
int IntTokenIndex (string name);
int LoopTokenIndex (string name);
void AddIntToken (int index, int value);
void AddStringToken (int index, const char *value);
void AddLoopToken (int loopIndex, int row, int index, const char *value);
char *StringToken (int index) { return stringTokens[index]; };
int IntToken (int index) { return intTokens[index]; };
char *LoopToken (int i, int j, int k) { return loopTokens[i][j][k]; };
int NumLoops (int loopIndex);
void SetTokens (cTokenContainer *other);
void Clear(void);
void Debug(void);
};
}
#endif //__TOKENCONTAINER_H