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 "animation.h"
#include <math.h> #include <math.h>
/****************************************************************** /******************************************************************
* cAnimation * cAnimation
******************************************************************/ ******************************************************************/
cAnimation::cAnimation(cScrollable *scrollable) : cThread("scroller") { cAnimation::cAnimation(cScrollable *scrollable) : cThread("scroller") {
this->scrollable = scrollable; this->scrollable = scrollable;
this->detachable = NULL; this->detachable = NULL;
this->fadable = NULL; this->fadable = NULL;
this->shiftable = NULL; this->shiftable = NULL;
this->blinkable = NULL; this->blinkable = NULL;
waitOnWakeup = false; waitOnWakeup = false;
doAnimation = true; doAnimation = true;
modeIn = false; modeIn = false;
blinkFunc = -1; blinkFunc = -1;
} }
cAnimation::cAnimation(cDetachable *detachable, bool wait, bool animation) : cThread("detached") { cAnimation::cAnimation(cDetachable *detachable, bool wait, bool animation) : cThread("detached") {
this->scrollable = NULL; this->scrollable = NULL;
this->detachable = detachable; this->detachable = detachable;
this->fadable = NULL; this->fadable = NULL;
this->shiftable = NULL; this->shiftable = NULL;
this->blinkable = NULL; this->blinkable = NULL;
waitOnWakeup = wait; waitOnWakeup = wait;
doAnimation = animation; doAnimation = animation;
modeIn = false; modeIn = false;
blinkFunc = -1; blinkFunc = -1;
} }
cAnimation::cAnimation(cFadable *fadable, bool fadein) : cThread("fadable") { cAnimation::cAnimation(cFadable *fadable, bool fadein) : cThread("fadable") {
this->scrollable = NULL; this->scrollable = NULL;
this->detachable = NULL; this->detachable = NULL;
this->fadable = fadable; this->fadable = fadable;
this->shiftable = NULL; this->shiftable = NULL;
this->blinkable = NULL; this->blinkable = NULL;
waitOnWakeup = false; waitOnWakeup = false;
doAnimation = true; doAnimation = true;
modeIn = fadein; modeIn = fadein;
blinkFunc = -1; blinkFunc = -1;
} }
cAnimation::cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin) : cThread("shiftable") { cAnimation::cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin) : cThread("shiftable") {
this->scrollable = NULL; this->scrollable = NULL;
this->detachable = NULL; this->detachable = NULL;
this->fadable = NULL; this->fadable = NULL;
this->shiftable = shiftable; this->shiftable = shiftable;
this->blinkable = NULL; this->blinkable = NULL;
waitOnWakeup = false; waitOnWakeup = false;
doAnimation = true; doAnimation = true;
modeIn = shiftin; modeIn = shiftin;
shiftstart = start; shiftstart = start;
shiftend = end; shiftend = end;
blinkFunc = -1; blinkFunc = -1;
} }
cAnimation::cAnimation(cBlinkable *blinkable, int func) : cThread("blinking") { cAnimation::cAnimation(cBlinkable *blinkable, int func) : cThread("blinking") {
this->scrollable = NULL; this->scrollable = NULL;
this->detachable = NULL; this->detachable = NULL;
this->fadable = NULL; this->fadable = NULL;
this->shiftable = NULL; this->shiftable = NULL;
this->blinkable = blinkable; this->blinkable = blinkable;
waitOnWakeup = false; waitOnWakeup = false;
doAnimation = true; doAnimation = true;
modeIn = false; modeIn = false;
blinkFunc = func; blinkFunc = func;
} }
cAnimation::~cAnimation(void) { cAnimation::~cAnimation(void) {
sleepWait.Signal(); sleepWait.Signal();
Cancel(2); Cancel(2);
} }
void cAnimation::WakeUp(void) { void cAnimation::WakeUp(void) {
sleepWait.Signal(); sleepWait.Signal();
} }
void cAnimation::Stop(bool deletePixmaps) { void cAnimation::Stop(bool deletePixmaps) {
sleepWait.Signal(); sleepWait.Signal();
Cancel(2); Cancel(2);
if (scrollable && deletePixmaps) if (scrollable && deletePixmaps)
scrollable->StopScrolling(); scrollable->StopScrolling();
} }
void cAnimation::Action(void) { void cAnimation::Action(void) {
if (scrollable) { if (scrollable) {
Scroll(); Scroll();
} else if (detachable) { } else if (detachable) {
Detach(); Detach();
} else if (fadable) { } else if (fadable) {
Fade(); Fade();
} else if (shiftable) { } else if (shiftable) {
Shift(); Shift();
} else if (blinkable) { } else if (blinkable) {
Blink(); Blink();
} }
} }
void cAnimation::Sleep(int duration) { void cAnimation::Sleep(int duration) {
//sleep should wake up itself, so no infinit wait allowed //sleep should wake up itself, so no infinit wait allowed
if (duration <= 0) if (duration <= 0)
return; return;
sleepWait.Wait(duration); sleepWait.Wait(duration);
} }
void cAnimation::Wait(void) { void cAnimation::Wait(void) {
//wait has to be waked up from outside //wait has to be waked up from outside
sleepWait.Wait(0); sleepWait.Wait(0);
} }
void cAnimation::Scroll(void) { void cAnimation::Scroll(void) {
int delay = scrollable->ScrollDelay(); int delay = scrollable->ScrollDelay();
Sleep(delay); Sleep(delay);
if (!Running()) return; if (!Running()) return;
eOrientation orientation = scrollable->ScrollOrientation(); eOrientation orientation = scrollable->ScrollOrientation();
int scrollTotal = 0; int scrollTotal = 0;
if (orientation == eOrientation::horizontal) { if (orientation == eOrientation::horizontal) {
scrollTotal = scrollable->ScrollWidth(); scrollTotal = scrollable->ScrollWidth();
} else if (orientation == eOrientation::vertical) { } else if (orientation == eOrientation::vertical) {
scrollTotal = scrollable->ScrollHeight(); scrollTotal = scrollable->ScrollHeight();
} }
eScrollMode mode = scrollable->ScrollMode(); eScrollMode mode = scrollable->ScrollMode();
bool carriageReturn = (mode == eScrollMode::carriagereturn) ? true : false; bool carriageReturn = (mode == eScrollMode::carriagereturn) ? true : false;
eScrollSpeed speed = scrollable->ScrollSpeed(); eScrollSpeed speed = scrollable->ScrollSpeed();
int frameTime = 30; int frameTime = 30;
if (speed == eScrollSpeed::slow) if (speed == eScrollSpeed::slow)
frameTime = 50; frameTime = 50;
else if (speed == eScrollSpeed::medium) else if (speed == eScrollSpeed::medium)
frameTime = 30; frameTime = 30;
else if (speed == eScrollSpeed::fast) else if (speed == eScrollSpeed::fast)
frameTime = 15; frameTime = 15;
if (!Running()) return; if (!Running()) return;
scrollable->StartScrolling(); scrollable->StartScrolling();
int drawPortX = 0; int drawPortX = 0;
int drawPortY = 0; int drawPortY = 0;
int scrollDelta = 1; int scrollDelta = 1;
bool doSleep = false; bool doSleep = false;
while (Running()) { while (Running()) {
if (doSleep) { if (doSleep) {
Sleep(delay); Sleep(delay);
doSleep = false; doSleep = false;
} }
if (!Running()) return; if (!Running()) return;
uint64_t now = cTimeMs::Now(); uint64_t now = cTimeMs::Now();
cPoint drawPortPoint(0,0); cPoint drawPortPoint(0,0);
if (orientation == eOrientation::horizontal) { if (orientation == eOrientation::horizontal) {
drawPortX -= scrollDelta; drawPortX -= scrollDelta;
if (abs(drawPortX) > scrollTotal) { if (abs(drawPortX) > scrollTotal) {
Sleep(delay); Sleep(delay);
if (carriageReturn) { if (carriageReturn) {
drawPortX = 0; drawPortX = 0;
doSleep = true; doSleep = true;
} else { } else {
scrollDelta *= -1; scrollDelta *= -1;
drawPortX -= scrollDelta; drawPortX -= scrollDelta;
} }
} }
drawPortPoint.SetX(drawPortX); drawPortPoint.SetX(drawPortX);
} else if (orientation == eOrientation::vertical) { } else if (orientation == eOrientation::vertical) {
drawPortY -= scrollDelta; drawPortY -= scrollDelta;
if (abs(drawPortY) > scrollTotal) { if (abs(drawPortY) > scrollTotal) {
Sleep(delay); Sleep(delay);
drawPortY = 0; drawPortY = 0;
doSleep = true; doSleep = true;
} }
drawPortPoint.SetY(drawPortY); drawPortPoint.SetY(drawPortY);
} }
if (!Running()) return; if (!Running()) return;
scrollable->SetDrawPort(drawPortPoint); scrollable->SetDrawPort(drawPortPoint);
if (!Running()) return; if (!Running()) return;
scrollable->Flush(); scrollable->Flush();
if (orientation == eOrientation::horizontal && !carriageReturn && (drawPortX == 0)) { if (orientation == eOrientation::horizontal && !carriageReturn && (drawPortX == 0)) {
scrollDelta *= -1; scrollDelta *= -1;
doSleep = true; doSleep = true;
} }
int delta = cTimeMs::Now() - now; int delta = cTimeMs::Now() - now;
if (delta < frameTime) if (delta < frameTime)
Sleep(frameTime - delta); Sleep(frameTime - delta);
} }
} }
void cAnimation::Detach(void) { void cAnimation::Detach(void) {
if (waitOnWakeup) { if (waitOnWakeup) {
Wait(); Wait();
int delay = 100 + detachable->Delay(); int delay = 100 + detachable->Delay();
Sleep(delay); Sleep(delay);
} else { } else {
int delay = detachable->Delay(); int delay = detachable->Delay();
Sleep(delay); Sleep(delay);
} }
if (!Running()) return; if (!Running()) return;
detachable->ParseDetached(); detachable->ParseDetached();
if (!Running()) return; if (!Running()) return;
detachable->RenderDetached(); detachable->RenderDetached();
if (!Running()) return; if (!Running()) return;
detachable->Flush(); detachable->Flush();
if (!Running()) return; if (!Running()) return;
if (doAnimation) { if (doAnimation) {
detachable->StartAnimation(); detachable->StartAnimation();
} }
} }
void cAnimation::Fade(void) { void cAnimation::Fade(void) {
int fadetime = fadable->FadeTime(); int fadetime = fadable->FadeTime();
int frametime = 1000 / FPS; int frametime = 1000 / FPS;
int step = 100.0f / ((double)fadetime / (double)frametime); int step = 100.0f / ((double)fadetime / (double)frametime);
uint64_t start = cTimeMs::Now(); uint64_t start = cTimeMs::Now();
int transparency = 0; int transparency = 0;
if (modeIn) { if (modeIn) {
transparency = 100 - step; transparency = 100 - step;
} else { } else {
transparency = step; transparency = step;
} }
//wait configured delay if not already done by detacher //wait configured delay if not already done by detacher
if (!fadable->Detached()) { if (!fadable->Detached()) {
int delay = fadable->Delay(); int delay = fadable->Delay();
if (delay > 0) if (delay > 0)
Sleep(delay); Sleep(delay);
} }
while (Running() || !modeIn) { while (Running() || !modeIn) {
uint64_t now = cTimeMs::Now(); uint64_t now = cTimeMs::Now();
if (Running() || !modeIn) if (Running() || !modeIn)
fadable->SetTransparency(transparency, !modeIn); fadable->SetTransparency(transparency, !modeIn);
if (Running() || !modeIn) if (Running() || !modeIn)
fadable->Flush(); fadable->Flush();
int delta = cTimeMs::Now() - now; int delta = cTimeMs::Now() - now;
if ((Running() || !modeIn) && (delta < frametime)) { if ((Running() || !modeIn) && (delta < frametime)) {
Sleep(frametime - delta); Sleep(frametime - delta);
} }
if ((int)(now - start) > fadetime) { if ((int)(now - start) > fadetime) {
if ((Running() && modeIn) && transparency > 0) { if ((Running() && modeIn) && transparency > 0) {
fadable->SetTransparency(0); fadable->SetTransparency(0);
fadable->Flush(); fadable->Flush();
} else if (!modeIn && transparency < 100) { } else if (!modeIn && transparency < 100) {
fadable->SetTransparency(100, true); fadable->SetTransparency(100, true);
fadable->Flush(); fadable->Flush();
} }
break; break;
} }
if (modeIn) { if (modeIn) {
transparency -= step; transparency -= step;
if (transparency < 0) if (transparency < 0)
transparency = 0; transparency = 0;
} else { } else {
transparency += step; transparency += step;
if (transparency > 100) if (transparency > 100)
transparency = 100; transparency = 100;
} }
} }
} }
void cAnimation::Shift(void) { void cAnimation::Shift(void) {
int shifttime = shiftable->ShiftTime(); int shifttime = shiftable->ShiftTime();
eShiftMode mode = (eShiftMode)shiftable->ShiftMode(); eShiftMode mode = (eShiftMode)shiftable->ShiftMode();
//in shiftmode slowedDown shifting is done starting with slowratio % faster //in shiftmode slowedDown shifting is done starting with slowratio % faster
//at start. Then speed reduces linear to (100 - slowratio)% at end //at start. Then speed reduces linear to (100 - slowratio)% at end
//for me 60 is a nice value :-) //for me 60 is a nice value :-)
int slowRatio = 60; int slowRatio = 60;
int frametime = 1000 / FPS; int frametime = 1000 / FPS;
int steps = (double)shifttime / (double)frametime; int steps = (double)shifttime / (double)frametime;
int stepXLinear = 0; int stepXLinear = 0;
int stepYLinear = 0; int stepYLinear = 0;
if (shiftstart.X() == shiftend.X()) { if (shiftstart.X() == shiftend.X()) {
stepYLinear = (shiftend.Y() - shiftstart.Y()) / steps; stepYLinear = (shiftend.Y() - shiftstart.Y()) / steps;
} else if (shiftstart.Y() == shiftend.Y()) { } else if (shiftstart.Y() == shiftend.Y()) {
stepXLinear = (shiftend.X() - shiftstart.X()) / steps; stepXLinear = (shiftend.X() - shiftstart.X()) / steps;
} else { } else {
stepXLinear = (shiftend.X() - shiftstart.X()) / steps; stepXLinear = (shiftend.X() - shiftstart.X()) / steps;
stepYLinear = (shiftend.Y() - shiftstart.Y()) / steps; stepYLinear = (shiftend.Y() - shiftstart.Y()) / steps;
} }
int stepX = stepXLinear; int stepX = stepXLinear;
int stepY = stepYLinear; int stepY = stepYLinear;
cPoint pos; cPoint pos;
if (modeIn) if (modeIn)
pos = shiftstart; pos = shiftstart;
else else
pos = shiftend; pos = shiftend;
//wait configured delay if not already done by detacher //wait configured delay if not already done by detacher
if (!shiftable->Detached()) { if (!shiftable->Detached()) {
int delay = shiftable->Delay(); int delay = shiftable->Delay();
if (delay > 0) if (delay > 0)
Sleep(delay); Sleep(delay);
} }
uint64_t start = cTimeMs::Now(); uint64_t start = cTimeMs::Now();
while (Running() || !modeIn) { while (Running() || !modeIn) {
uint64_t now = cTimeMs::Now(); uint64_t now = cTimeMs::Now();
if (Running() || !modeIn) if (Running() || !modeIn)
shiftable->SetPosition(pos, shiftend); shiftable->SetPosition(pos, shiftend);
if (Running() || !modeIn) if (Running() || !modeIn)
shiftable->Flush(); shiftable->Flush();
int delta = cTimeMs::Now() - now; int delta = cTimeMs::Now() - now;
if ((Running() || !modeIn) && (delta < frametime)) { if ((Running() || !modeIn) && (delta < frametime)) {
cCondWait::SleepMs(frametime - delta); cCondWait::SleepMs(frametime - delta);
} }
if ((int)(now - start) > shifttime) { if ((int)(now - start) > shifttime) {
if ((Running() && modeIn) && pos != shiftend) { if ((Running() && modeIn) && pos != shiftend) {
shiftable->SetPosition(shiftend, shiftend); shiftable->SetPosition(shiftend, shiftend);
shiftable->Flush(); shiftable->Flush();
} }
break; break;
} }
if (mode == eShiftMode::slowedDown) { if (mode == eShiftMode::slowedDown) {
double t = (double)(now - start) / (double)shifttime; double t = (double)(now - start) / (double)shifttime;
double factor = 1.0f + (double)slowRatio / 100.0f - 2.0f * ((double)slowRatio / 100.0f) * t; double factor = 1.0f + (double)slowRatio / 100.0f - 2.0f * ((double)slowRatio / 100.0f) * t;
stepX = stepXLinear * factor; stepX = stepXLinear * factor;
stepY = stepYLinear * factor; stepY = stepYLinear * factor;
} }
if (modeIn) { if (modeIn) {
pos.Set(pos.X() + stepX, pos.Y() + stepY); pos.Set(pos.X() + stepX, pos.Y() + stepY);
} else { } else {
pos.Set(pos.X() - stepX, pos.Y() - stepY); pos.Set(pos.X() - stepX, pos.Y() - stepY);
} }
} }
} }
void cAnimation::Blink(void) { void cAnimation::Blink(void) {
int freq = blinkable->BlinkFreq(blinkFunc); int freq = blinkable->BlinkFreq(blinkFunc);
bool blinkOn = false; bool blinkOn = false;
while (Running()) { while (Running()) {
Sleep(freq); Sleep(freq);
if (Running()) { if (Running()) {
blinkable->DoBlink(blinkFunc, blinkOn); blinkable->DoBlink(blinkFunc, blinkOn);
blinkable->Flush(); blinkable->Flush();
} }
blinkOn = !blinkOn; blinkOn = !blinkOn;
} }
} }

View File

@ -1,126 +1,126 @@
#ifndef __ANIMATION_H #ifndef __ANIMATION_H
#define __ANIMATION_H #define __ANIMATION_H
#include <vdr/skins.h> #include <vdr/skins.h>
#include <vdr/thread.h> #include <vdr/thread.h>
#include "definitions.h" #include "definitions.h"
#define FPS 50 #define FPS 50
/****************************************************************** /******************************************************************
* cScrollable * cScrollable
******************************************************************/ ******************************************************************/
class cScrollable { class cScrollable {
protected: protected:
cScrollable(void) {}; cScrollable(void) {};
~cScrollable(void) {}; ~cScrollable(void) {};
public: public:
virtual int ScrollDelay(void) = 0; virtual int ScrollDelay(void) = 0;
virtual int ScrollWidth(void) = 0; virtual int ScrollWidth(void) = 0;
virtual int ScrollHeight(void) = 0; virtual int ScrollHeight(void) = 0;
virtual eScrollMode ScrollMode(void) = 0; virtual eScrollMode ScrollMode(void) = 0;
virtual eScrollSpeed ScrollSpeed(void) = 0; virtual eScrollSpeed ScrollSpeed(void) = 0;
virtual eOrientation ScrollOrientation(void) = 0; virtual eOrientation ScrollOrientation(void) = 0;
virtual void StartScrolling(void) = 0; virtual void StartScrolling(void) = 0;
virtual void StopScrolling(void) = 0; virtual void StopScrolling(void) = 0;
virtual void SetDrawPort(cPoint &point) = 0; virtual void SetDrawPort(cPoint &point) = 0;
virtual void Flush(void) = 0; virtual void Flush(void) = 0;
}; };
/****************************************************************** /******************************************************************
* cDetachable * cDetachable
******************************************************************/ ******************************************************************/
class cDetachable { class cDetachable {
protected: protected:
cDetachable(void) {}; cDetachable(void) {};
~cDetachable(void) {}; ~cDetachable(void) {};
public: public:
virtual int Delay(void) = 0; virtual int Delay(void) = 0;
virtual void ParseDetached(void) = 0; virtual void ParseDetached(void) = 0;
virtual void RenderDetached(void) = 0; virtual void RenderDetached(void) = 0;
virtual void StartAnimation(void) = 0; virtual void StartAnimation(void) = 0;
virtual void Flush(void) = 0; virtual void Flush(void) = 0;
}; };
/****************************************************************** /******************************************************************
* cFadable * cFadable
******************************************************************/ ******************************************************************/
class cFadable { class cFadable {
protected: protected:
cFadable(void) {}; cFadable(void) {};
~cFadable(void) {}; ~cFadable(void) {};
public: public:
virtual bool Detached(void) = 0; virtual bool Detached(void) = 0;
virtual int Delay(void) = 0; virtual int Delay(void) = 0;
virtual int FadeTime(void) = 0; virtual int FadeTime(void) = 0;
virtual void SetTransparency(int transparency, bool force = false) = 0; virtual void SetTransparency(int transparency, bool force = false) = 0;
virtual void Flush(void) = 0; virtual void Flush(void) = 0;
}; };
/****************************************************************** /******************************************************************
* cShiftable * cShiftable
******************************************************************/ ******************************************************************/
class cShiftable { class cShiftable {
protected: protected:
cShiftable(void) {}; cShiftable(void) {};
~cShiftable(void) {}; ~cShiftable(void) {};
public: public:
virtual bool Detached(void) = 0; virtual bool Detached(void) = 0;
virtual int Delay(void) = 0; virtual int Delay(void) = 0;
virtual int ShiftTime(void) = 0; virtual int ShiftTime(void) = 0;
virtual int ShiftMode(void) = 0; virtual int ShiftMode(void) = 0;
virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false) = 0; virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false) = 0;
virtual void Flush(void) = 0; virtual void Flush(void) = 0;
}; };
/****************************************************************** /******************************************************************
* cBlinkable * cBlinkable
******************************************************************/ ******************************************************************/
class cBlinkable { class cBlinkable {
protected: protected:
cBlinkable(void) {}; cBlinkable(void) {};
~cBlinkable(void) {}; ~cBlinkable(void) {};
public: public:
virtual int BlinkFreq(int func) = 0; virtual int BlinkFreq(int func) = 0;
virtual void DoBlink(int func, bool on) = 0; virtual void DoBlink(int func, bool on) = 0;
virtual void Flush(void) = 0; virtual void Flush(void) = 0;
}; };
/****************************************************************** /******************************************************************
* cAnimation * cAnimation
******************************************************************/ ******************************************************************/
class cAnimation : public cThread, public cListObject { class cAnimation : public cThread, public cListObject {
private: private:
cCondWait sleepWait; cCondWait sleepWait;
cScrollable *scrollable; cScrollable *scrollable;
cDetachable *detachable; cDetachable *detachable;
cFadable *fadable; cFadable *fadable;
cShiftable *shiftable; cShiftable *shiftable;
cBlinkable *blinkable; cBlinkable *blinkable;
bool waitOnWakeup; bool waitOnWakeup;
bool doAnimation; bool doAnimation;
bool modeIn; bool modeIn;
int blinkFunc; int blinkFunc;
cPoint shiftstart; cPoint shiftstart;
cPoint shiftend; cPoint shiftend;
void Sleep(int duration); void Sleep(int duration);
void Wait(void); void Wait(void);
void Scroll(void); void Scroll(void);
void Detach(void); void Detach(void);
void Blink(void); void Blink(void);
protected: protected:
virtual void Action(void); virtual void Action(void);
public: public:
cAnimation(cScrollable *scrollable); cAnimation(cScrollable *scrollable);
cAnimation(cDetachable *detachable, bool wait, bool animation); cAnimation(cDetachable *detachable, bool wait, bool animation);
cAnimation(cFadable *fadable, bool fadein); cAnimation(cFadable *fadable, bool fadein);
cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin); cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin);
cAnimation(cBlinkable *blinkable, int func); cAnimation(cBlinkable *blinkable, int func);
~cAnimation(void); ~cAnimation(void);
void WakeUp(void); void WakeUp(void);
void Fade(void); void Fade(void);
void Shift(void); void Shift(void);
void Stop(bool deletePixmaps); void Stop(bool deletePixmaps);
}; };
#endif //__ANIMATION_H #endif //__ANIMATION_H

File diff suppressed because it is too large Load Diff

View File

@ -1,178 +1,178 @@
#ifndef __TEMPLATEAREA_H #ifndef __TEMPLATEAREA_H
#define __TEMPLATEAREA_H #define __TEMPLATEAREA_H
#include <iostream> #include <iostream>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include "osdwrapper.h" #include "osdwrapper.h"
#include "definitions.h" #include "definitions.h"
#include "globals.h" #include "globals.h"
#include "../libskindesignerapi/tokencontainer.h" #include "../libskindesignerapi/tokencontainer.h"
#include "attributes.h" #include "attributes.h"
#include "functions.h" #include "functions.h"
#include "animation.h" #include "animation.h"
class cArea; class cArea;
/****************************************************************** /******************************************************************
* cAreaNode * cAreaNode
******************************************************************/ ******************************************************************/
class cAreaNode : public cListObject { class cAreaNode : public cListObject {
protected: protected:
cGlobals *globals; cGlobals *globals;
cRect container; cRect container;
bool isTab; bool isTab;
bool activeTab; bool activeTab;
public: public:
cAreaNode(void); cAreaNode(void);
virtual ~cAreaNode(void); virtual ~cAreaNode(void);
virtual void SetGlobals(cGlobals *globals) {}; virtual void SetGlobals(cGlobals *globals) {};
virtual void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {}; virtual void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {};
virtual void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer) {}; virtual void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer) {};
void SetContainer(int x, int y, int width, int height); void SetContainer(int x, int y, int width, int height);
virtual void SetAttributes(vector<stringpair> &attributes) {}; virtual void SetAttributes(vector<stringpair> &attributes) {};
virtual void SetX(int x) {}; virtual void SetX(int x) {};
virtual void SetY(int y) {}; virtual void SetY(int y) {};
virtual void SetWidth(int width) {}; virtual void SetWidth(int width) {};
virtual void SetHeight(int height) {}; virtual void SetHeight(int height) {};
void SetTab(void) { isTab = true; }; void SetTab(void) { isTab = true; };
bool IsTab(void) { return isTab; }; bool IsTab(void) { return isTab; };
void SetActiveTab(bool active) { activeTab = active; }; void SetActiveTab(bool active) { activeTab = active; };
bool ActiveTab(void) { return activeTab; }; bool ActiveTab(void) { return activeTab; };
virtual int GetWidth(void) { return 0; }; virtual int GetWidth(void) { return 0; };
virtual void Cache(void) {}; virtual void Cache(void) {};
virtual void Close(void) {}; virtual void Close(void) {};
virtual void Clear(void) {}; virtual void Clear(void) {};
virtual void Hide(void) {}; virtual void Hide(void) {};
virtual void Show(void) {}; virtual void Show(void) {};
virtual void Render(void) {}; virtual void Render(void) {};
virtual bool Execute(void) { return true; }; virtual bool Execute(void) { return true; };
virtual void SetTransparency(int transparency, bool absolute = false) {}; virtual void SetTransparency(int transparency, bool absolute = false) {};
virtual void SetViewPort(cRect &vp) {}; virtual void SetViewPort(cRect &vp) {};
virtual void SetPosition(cPoint &pos, cPoint &ref) {}; virtual void SetPosition(cPoint &pos, cPoint &ref) {};
virtual cRect CoveringArea(void) { return cRect::Null; }; virtual cRect CoveringArea(void) { return cRect::Null; };
virtual bool Scrolling(void) { return false; }; virtual bool Scrolling(void) { return false; };
virtual cArea *ScrollingArea(void) { return NULL; }; virtual cArea *ScrollingArea(void) { return NULL; };
virtual cFunction *GetFunction(const char *name) { return NULL; }; virtual cFunction *GetFunction(const char *name) { return NULL; };
virtual const char *Name(void) { return NULL; }; virtual const char *Name(void) { return NULL; };
virtual bool BackgroundArea(void) { return false; }; virtual bool BackgroundArea(void) { return false; };
virtual void Debug(bool full = false) {}; virtual void Debug(bool full = false) {};
}; };
class cAreaContainer; class cAreaContainer;
/****************************************************************** /******************************************************************
* cArea * cArea
******************************************************************/ ******************************************************************/
class cArea : public cAreaNode, public cScrollable, public cBlinkable { class cArea : public cAreaNode, public cScrollable, public cBlinkable {
private: private:
cSdOsd *sdOsd; cSdOsd *sdOsd;
bool init; bool init;
bool isBackgroundArea; bool isBackgroundArea;
cPixmap *pix; cPixmap *pix;
cAreaAttribs *attribs; cAreaAttribs *attribs;
cAreaContainer *areaContainer; cAreaContainer *areaContainer;
cList<cFunction> functions; cList<cFunction> functions;
bool scrolling; bool scrolling;
bool isScrolling; bool isScrolling;
cFunction *scrollFunc; cFunction *scrollFunc;
cList<cAnimation> blinkers; cList<cAnimation> blinkers;
bool blinking; bool blinking;
void InitFunctions(void); void InitFunctions(void);
void CreatePixmap(cRect drawPort = cRect::Null); void CreatePixmap(cRect drawPort = cRect::Null);
void SetScrollFunc(void); void SetScrollFunc(void);
void StartBlinkers(void); void StartBlinkers(void);
void StopBlinkers(void); void StopBlinkers(void);
public: public:
cArea(void); cArea(void);
cArea(const cArea &other); cArea(const cArea &other);
virtual ~cArea(void); virtual ~cArea(void);
void SetOsd(cSdOsd *osd) { sdOsd = osd; }; void SetOsd(cSdOsd *osd) { sdOsd = osd; };
void SetGlobals(cGlobals *globals); void SetGlobals(cGlobals *globals);
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer); void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer); void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void SetAttributes(vector<stringpair> &attributes); void SetAttributes(vector<stringpair> &attributes);
void SetScrolling(void) { scrolling = true; }; void SetScrolling(void) { scrolling = true; };
void SetAreaContainer(cAreaContainer *ac) { areaContainer = ac; }; void SetAreaContainer(cAreaContainer *ac) { areaContainer = ac; };
bool ValidFunction(const char *func); bool ValidFunction(const char *func);
cFunction *AddFunction(const char *name, vector<stringpair> attribs, cFuncLoop *loopFunc = NULL); cFunction *AddFunction(const char *name, vector<stringpair> attribs, cFuncLoop *loopFunc = NULL);
cFunction *GetFunction(const char *name); cFunction *GetFunction(const char *name);
void SetX(int x); void SetX(int x);
void SetY(int y); void SetY(int y);
void SetWidth(int width); void SetWidth(int width);
void SetHeight(int height); void SetHeight(int height);
void Cache(void); void Cache(void);
int GetWidth(void) { return attribs->Width(); }; int GetWidth(void) { return attribs->Width(); };
void Close(void); void Close(void);
void Clear(void); void Clear(void);
void Hide(void); void Hide(void);
void Show(void); void Show(void);
void Render(void); void Render(void);
bool Execute(void); bool Execute(void);
void SetTransparency(int transparency, bool absolute = false); void SetTransparency(int transparency, bool absolute = false);
cRect CoveringArea(void); cRect CoveringArea(void);
//Scrollable //Scrollable
bool Scrolling(void); bool Scrolling(void);
int ScrollWidth(void); int ScrollWidth(void);
int ScrollHeight(void); int ScrollHeight(void);
int ScrollDelay(void); int ScrollDelay(void);
eScrollMode ScrollMode(void); eScrollMode ScrollMode(void);
eScrollSpeed ScrollSpeed(void); eScrollSpeed ScrollSpeed(void);
eOrientation ScrollOrientation(void); eOrientation ScrollOrientation(void);
cArea *ScrollingArea(void) { return this; }; cArea *ScrollingArea(void) { return this; };
void StartScrolling(void); void StartScrolling(void);
void StopScrolling(void); void StopScrolling(void);
cRect ViewPort(void); cRect ViewPort(void);
void SetDrawPort(cPoint &point); void SetDrawPort(cPoint &point);
void SetViewPort(cRect &vp); void SetViewPort(cRect &vp);
void SetPosition(cPoint &pos, cPoint &ref); void SetPosition(cPoint &pos, cPoint &ref);
cRect DrawPort(void); cRect DrawPort(void);
int ScrollStep(void) { return attribs->ScrollStep(); }; int ScrollStep(void) { return attribs->ScrollStep(); };
//Blinkable //Blinkable
int BlinkFreq(int func); int BlinkFreq(int func);
void DoBlink(int func, bool on); void DoBlink(int func, bool on);
//Common //Common
const char *Name(void) { return attribs->Name(); }; const char *Name(void) { return attribs->Name(); };
bool BackgroundArea(void) { return attribs->BackgroundArea(); }; bool BackgroundArea(void) { return attribs->BackgroundArea(); };
void Flush(void); void Flush(void);
void Debug(bool full = false); void Debug(bool full = false);
}; };
/****************************************************************** /******************************************************************
* cAreaContainer * cAreaContainer
******************************************************************/ ******************************************************************/
class cAreaContainer : public cAreaNode { class cAreaContainer : public cAreaNode {
private: private:
cAreaContainerAttribs *attribs; cAreaContainerAttribs *attribs;
cList<cArea> areas; cList<cArea> areas;
public: public:
cAreaContainer(void); cAreaContainer(void);
cAreaContainer(const cAreaContainer &other); cAreaContainer(const cAreaContainer &other);
virtual ~cAreaContainer(void); virtual ~cAreaContainer(void);
void SetGlobals(cGlobals *globals); void SetGlobals(cGlobals *globals);
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer); void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer); void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void SetAttributes(vector<stringpair> &attributes); void SetAttributes(vector<stringpair> &attributes);
void AddArea(cArea *area); void AddArea(cArea *area);
cFunction *GetFunction(const char *name); cFunction *GetFunction(const char *name);
void SetX(int x); void SetX(int x);
void SetY(int y); void SetY(int y);
void SetWidth(int width); void SetWidth(int width);
void SetHeight(int height); void SetHeight(int height);
void Cache(void); void Cache(void);
void Close(void); void Close(void);
void Clear(void); void Clear(void);
void Hide(void); void Hide(void);
void Show(void); void Show(void);
void Render(void); void Render(void);
bool Execute(void); bool Execute(void);
void SetTransparency(int transparency, bool absolute = false); void SetTransparency(int transparency, bool absolute = false);
void SetViewPort(cRect &vp); void SetViewPort(cRect &vp);
void SetPosition(cPoint &pos, cPoint &ref); void SetPosition(cPoint &pos, cPoint &ref);
cRect CoveringArea(void); cRect CoveringArea(void);
bool Scrolling(void); bool Scrolling(void);
cArea *ScrollingArea(void); cArea *ScrollingArea(void);
void Debug(bool full = false); void Debug(bool full = false);
}; };
#endif //__TEMPLATEAREA_H #endif //__TEMPLATEAREA_H

View File

@ -1,478 +1,478 @@
#include "attribute.h" #include "attribute.h"
#include "../config.h" #include "../config.h"
/*************************************************************************** /***************************************************************************
* cAttributes * cAttributes
***************************************************************************/ ***************************************************************************/
cAttributes::cAttributes(int numAttributes) { cAttributes::cAttributes(int numAttributes) {
globals = NULL; globals = NULL;
tokenContainer = NULL; tokenContainer = NULL;
numAttribs = (int)eCommonAttribs::count + numAttributes; numAttribs = (int)eCommonAttribs::count + numAttributes;
attribs = new int[numAttribs]; attribs = new int[numAttribs];
for (int i=0; i < numAttribs; i++) for (int i=0; i < numAttribs; i++)
attribs[i] = ATTR_UNKNOWN; attribs[i] = ATTR_UNKNOWN;
attribCtors = new cNumericExpr*[numAttribs]; attribCtors = new cNumericExpr*[numAttribs];
for (int i=0; i < numAttribs; i++) for (int i=0; i < numAttribs; i++)
attribCtors[i] = NULL; attribCtors[i] = NULL;
cond = NULL; cond = NULL;
SetCommonAttributesDefs(); SetCommonAttributesDefs();
} }
cAttributes::cAttributes(const cAttributes &other) : cAttributes(other.numAttribs - (int)eCommonAttribs::count){ cAttributes::cAttributes(const cAttributes &other) : cAttributes(other.numAttribs - (int)eCommonAttribs::count){
globals = other.globals; globals = other.globals;
for (int i=0; i < numAttribs; i++) { for (int i=0; i < numAttribs; i++) {
attribs[i] = other.attribs[i]; attribs[i] = other.attribs[i];
if (other.attribCtors[i]) { if (other.attribCtors[i]) {
attribCtors[i] = new cNumericExpr(*other.attribCtors[i]); attribCtors[i] = new cNumericExpr(*other.attribCtors[i]);
attribCtors[i]->SetContainer(&container); attribCtors[i]->SetContainer(&container);
} }
} }
cond = NULL; cond = NULL;
if (other.cond) { if (other.cond) {
cond = new cCondition(*other.cond); cond = new cCondition(*other.cond);
} }
attribIDs = other.attribIDs; attribIDs = other.attribIDs;
attribNames = other.attribNames; attribNames = other.attribNames;
} }
cAttributes::~cAttributes(void) { cAttributes::~cAttributes(void) {
delete[] attribs; delete[] attribs;
for (int i=0; i < numAttribs; i++) { for (int i=0; i < numAttribs; i++) {
delete attribCtors[i]; delete attribCtors[i];
} }
delete[] attribCtors; delete[] attribCtors;
delete cond; delete cond;
} }
void cAttributes::SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) { void cAttributes::SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {
this->tokenContainer = tokenContainer; this->tokenContainer = tokenContainer;
} }
void cAttributes::SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer) { void cAttributes::SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer) {
this->tokenContainer = tokenContainer; this->tokenContainer = tokenContainer;
if (cond) { if (cond) {
cond->SetTokenContainer(tokenContainer); cond->SetTokenContainer(tokenContainer);
} }
for (int i=0; i < numAttribs; i++) { for (int i=0; i < numAttribs; i++) {
if (!attribCtors[i]) if (!attribCtors[i])
continue; continue;
attribCtors[i]->SetTokenContainer(tokenContainer); attribCtors[i]->SetTokenContainer(tokenContainer);
} }
} }
void cAttributes::SetContainer(int x, int y, int width, int height) { void cAttributes::SetContainer(int x, int y, int width, int height) {
container.SetX(x); container.SetX(x);
container.SetY(y); container.SetY(y);
container.SetWidth(width); container.SetWidth(width);
container.SetHeight(height); container.SetHeight(height);
} }
void cAttributes::SetX(int x) { void cAttributes::SetX(int x) {
attribs[(int)eCommonAttribs::x] = x; attribs[(int)eCommonAttribs::x] = x;
} }
void cAttributes::SetY(int y) { void cAttributes::SetY(int y) {
attribs[(int)eCommonAttribs::y] = y; attribs[(int)eCommonAttribs::y] = y;
} }
void cAttributes::SetWidth(int width) { void cAttributes::SetWidth(int width) {
attribs[(int)eCommonAttribs::width] = width; attribs[(int)eCommonAttribs::width] = width;
} }
void cAttributes::SetHeight(int height) { void cAttributes::SetHeight(int height) {
attribs[(int)eCommonAttribs::height] = height; attribs[(int)eCommonAttribs::height] = height;
} }
void cAttributes::Cache(void) { void cAttributes::Cache(void) {
if (cond) { if (cond) {
cond->SetGlobals(globals); cond->SetGlobals(globals);
cond->SetTokenContainer(tokenContainer); cond->SetTokenContainer(tokenContainer);
cond->Prepare(); cond->Prepare();
} }
for (int i=0; i < numAttribs; i++) { for (int i=0; i < numAttribs; i++) {
if (!attribCtors[i]) if (!attribCtors[i])
continue; continue;
attribCtors[i]->SetContainer(&container); attribCtors[i]->SetContainer(&container);
attribCtors[i]->SetGlobals(globals); attribCtors[i]->SetGlobals(globals);
attribCtors[i]->SetTokenContainer(tokenContainer); attribCtors[i]->SetTokenContainer(tokenContainer);
if (attribCtors[i]->CacheStatic()) { if (attribCtors[i]->CacheStatic()) {
int val = attribCtors[i]->GetValue(); int val = attribCtors[i]->GetValue();
attribs[i] = val; attribs[i] = val;
delete attribCtors[i]; delete attribCtors[i];
attribCtors[i] = NULL; attribCtors[i] = NULL;
} else { } else {
attribCtors[i]->PrepareTokens(); attribCtors[i]->PrepareTokens();
} }
} }
} }
int cAttributes::GetValue(int id) { int cAttributes::GetValue(int id) {
if (!attribCtors[id + (int)eCommonAttribs::count]) if (!attribCtors[id + (int)eCommonAttribs::count])
return attribs[(int)id + (int)eCommonAttribs::count]; return attribs[(int)id + (int)eCommonAttribs::count];
return attribCtors[id + (int)eCommonAttribs::count]->Calculate(); return attribCtors[id + (int)eCommonAttribs::count]->Calculate();
} }
int cAttributes::X(void) { int cAttributes::X(void) {
int x = 0; int x = 0;
if (!attribCtors[(int)eCommonAttribs::x]) if (!attribCtors[(int)eCommonAttribs::x])
x = attribs[(int)eCommonAttribs::x]; x = attribs[(int)eCommonAttribs::x];
else else
x = attribCtors[(int)eCommonAttribs::x]->Calculate(); x = attribCtors[(int)eCommonAttribs::x]->Calculate();
x += container.X(); x += container.X();
return x; return x;
} }
int cAttributes::Y(void) { int cAttributes::Y(void) {
int y = 0; int y = 0;
if (!attribCtors[(int)eCommonAttribs::y]) if (!attribCtors[(int)eCommonAttribs::y])
y = attribs[(int)eCommonAttribs::y]; y = attribs[(int)eCommonAttribs::y];
else else
y = attribCtors[(int)eCommonAttribs::y]->Calculate(); y = attribCtors[(int)eCommonAttribs::y]->Calculate();
y += container.Y(); y += container.Y();
return y; return y;
} }
int cAttributes::Width(void) { int cAttributes::Width(void) {
if (!attribCtors[(int)eCommonAttribs::width]) if (!attribCtors[(int)eCommonAttribs::width])
return attribs[(int)eCommonAttribs::width]; return attribs[(int)eCommonAttribs::width];
return attribCtors[(int)eCommonAttribs::width]->Calculate(); return attribCtors[(int)eCommonAttribs::width]->Calculate();
} }
int cAttributes::Height(void) { int cAttributes::Height(void) {
if (!attribCtors[(int)eCommonAttribs::height]) if (!attribCtors[(int)eCommonAttribs::height])
return attribs[(int)eCommonAttribs::height]; return attribs[(int)eCommonAttribs::height];
return attribCtors[(int)eCommonAttribs::height]->Calculate(); return attribCtors[(int)eCommonAttribs::height]->Calculate();
} }
bool cAttributes::DoExecute(void) { bool cAttributes::DoExecute(void) {
if (!cond) if (!cond)
return true; return true;
return cond->True(); return cond->True();
} }
void cAttributes::Debug(void) { void cAttributes::Debug(void) {
esyslog("skindesigner: container %d %d %dx%d", container.X(), container.Y(), container.Width(), container.Height()); esyslog("skindesigner: container %d %d %dx%d", container.X(), container.Y(), container.Width(), container.Height());
for (int i=0; i < numAttribs; i++) { for (int i=0; i < numAttribs; i++) {
if (attribs[i] != ATTR_UNKNOWN) { if (attribs[i] != ATTR_UNKNOWN) {
if (i == (int)eCommonAttribs::debug) if (i == (int)eCommonAttribs::debug)
continue; continue;
const char *attName = "attribute"; const char *attName = "attribute";
if (i < (int)eCommonAttribs::count) if (i < (int)eCommonAttribs::count)
attName = CommonAttributeName(i); attName = CommonAttributeName(i);
else else
attName = AttributeName(i - (int)eCommonAttribs::count); attName = AttributeName(i - (int)eCommonAttribs::count);
dsyslog("skindesigner: fixed Value %s = %d", attName, attribs[i]); dsyslog("skindesigner: fixed Value %s = %d", attName, attribs[i]);
} }
if (attribCtors[i]) { if (attribCtors[i]) {
const char *attName = "attribute"; const char *attName = "attribute";
if (i < (int)eCommonAttribs::count) if (i < (int)eCommonAttribs::count)
attName = CommonAttributeName(i); attName = CommonAttributeName(i);
else else
attName = AttributeName(i - (int)eCommonAttribs::count); attName = AttributeName(i - (int)eCommonAttribs::count);
dsyslog("skindesigner: %s constructor:", attName); dsyslog("skindesigner: %s constructor:", attName);
attribCtors[i]->Debug(); attribCtors[i]->Debug();
} }
} }
if (cond) { if (cond) {
cond->Debug(); cond->Debug();
} }
} }
/*************************************************************************** /***************************************************************************
* Protected Functions * Protected Functions
***************************************************************************/ ***************************************************************************/
int cAttributes::CommonAttributeId(const char *att) { int cAttributes::CommonAttributeId(const char *att) {
if (!strcmp(att, "condition")) if (!strcmp(att, "condition"))
return ATTR_COND; return ATTR_COND;
map<string, int>::iterator hit = commonAttribIDs.find(att); map<string, int>::iterator hit = commonAttribIDs.find(att);
if (hit != commonAttribIDs.end()) if (hit != commonAttribIDs.end())
return hit->second; return hit->second;
return ATTR_UNKNOWN; return ATTR_UNKNOWN;
} }
const char *cAttributes::CommonAttributeName(int id) { const char *cAttributes::CommonAttributeName(int id) {
if (id < 0 || id >= (int)eCommonAttribs::count) if (id < 0 || id >= (int)eCommonAttribs::count)
return ""; return "";
map<int, string>::iterator hit = commonAttribNames.find(id); map<int, string>::iterator hit = commonAttribNames.find(id);
if (hit != commonAttribNames.end()) if (hit != commonAttribNames.end())
return hit->second.c_str(); return hit->second.c_str();
return ""; return "";
} }
int cAttributes::AttributeId(const char *att) { int cAttributes::AttributeId(const char *att) {
int id = CommonAttributeId(att); int id = CommonAttributeId(att);
if (id != ATTR_UNKNOWN) if (id != ATTR_UNKNOWN)
return id; return id;
map<string, int>::iterator hit = attribIDs.find(att); map<string, int>::iterator hit = attribIDs.find(att);
if (hit != attribIDs.end()) if (hit != attribIDs.end())
id = (int)hit->second + (int)eCommonAttribs::count; id = (int)hit->second + (int)eCommonAttribs::count;
return id; return id;
} }
const char *cAttributes::AttributeName(int id) { const char *cAttributes::AttributeName(int id) {
map<int, string>::iterator hit = attribNames.find(id); map<int, string>::iterator hit = attribNames.find(id);
if (hit != attribNames.end()) if (hit != attribNames.end())
return hit->second.c_str(); return hit->second.c_str();
return ""; return "";
} }
bool cAttributes::SetCommon(int id, const char *val) { bool cAttributes::SetCommon(int id, const char *val) {
if (id == ATTR_COND) { if (id == ATTR_COND) {
cond = new cCondition(val); cond = new cCondition(val);
return true; return true;
} }
if (id == (int)eCommonAttribs::debug) { if (id == (int)eCommonAttribs::debug) {
SetBool(id, val); SetBool(id, val);
return true; return true;
} else if (id == (int)eCommonAttribs::x || id == (int)eCommonAttribs::width) { } else if (id == (int)eCommonAttribs::x || id == (int)eCommonAttribs::width) {
attribCtors[id] = new cNumericExpr(val); attribCtors[id] = new cNumericExpr(val);
return true; return true;
} else if (id == (int)eCommonAttribs::y || id == (int)eCommonAttribs::height) { } else if (id == (int)eCommonAttribs::y || id == (int)eCommonAttribs::height) {
attribCtors[id] = new cNumericExpr(val); attribCtors[id] = new cNumericExpr(val);
attribCtors[id]->SetVertical(); attribCtors[id]->SetVertical();
return true; return true;
} }
return false; return false;
} }
bool cAttributes::IdEqual(int id, int compId) { bool cAttributes::IdEqual(int id, int compId) {
if (compId + (int)eCommonAttribs::count == id) if (compId + (int)eCommonAttribs::count == id)
return true; return true;
return false; return false;
} }
void cAttributes::SetBool(int id, const char *val) { void cAttributes::SetBool(int id, const char *val) {
if (!strcmp(val, "true")) { if (!strcmp(val, "true")) {
attribs[id] = 1; attribs[id] = 1;
} else { } else {
attribs[id] = 0; attribs[id] = 0;
} }
} }
void cAttributes::SetViewElementMode(int id, const char *val) { void cAttributes::SetViewElementMode(int id, const char *val) {
eViewElementMode mode = eViewElementMode::regular; eViewElementMode mode = eViewElementMode::regular;
if (!strcmp(val, "light")) if (!strcmp(val, "light"))
mode = eViewElementMode::light; mode = eViewElementMode::light;
attribs[id] = (int)mode; attribs[id] = (int)mode;
} }
void cAttributes::SetShiftType(int id, const char *val) { void cAttributes::SetShiftType(int id, const char *val) {
eShiftType shiftType = eShiftType::none; eShiftType shiftType = eShiftType::none;
if (!strcmp(val, "left")) if (!strcmp(val, "left"))
shiftType = eShiftType::left; shiftType = eShiftType::left;
else if (!strcmp(val, "right")) else if (!strcmp(val, "right"))
shiftType = eShiftType::right; shiftType = eShiftType::right;
else if (!strcmp(val, "top")) else if (!strcmp(val, "top"))
shiftType = eShiftType::top; shiftType = eShiftType::top;
else if (!strcmp(val, "bottom")) else if (!strcmp(val, "bottom"))
shiftType = eShiftType::bottom; shiftType = eShiftType::bottom;
else { else {
esyslog("skindesigner: unknown shift type \"%s\"", val); esyslog("skindesigner: unknown shift type \"%s\"", val);
return; return;
} }
attribs[id] = (int)shiftType; attribs[id] = (int)shiftType;
} }
void cAttributes::SetShiftMode(int id, const char *val) { void cAttributes::SetShiftMode(int id, const char *val) {
eShiftMode shiftMode = eShiftMode::linear; eShiftMode shiftMode = eShiftMode::linear;
if (!strcmp(val, "slowed")) if (!strcmp(val, "slowed"))
shiftMode = eShiftMode::slowedDown; shiftMode = eShiftMode::slowedDown;
attribs[id] = (int)shiftMode; attribs[id] = (int)shiftMode;
} }
void cAttributes::SetScrollMode(int id, const char *val) { void cAttributes::SetScrollMode(int id, const char *val) {
eScrollMode mode = eScrollMode::none; eScrollMode mode = eScrollMode::none;
if (!strcmp(val, "forthandback")) if (!strcmp(val, "forthandback"))
mode = eScrollMode::forthandback; mode = eScrollMode::forthandback;
else if (!strcmp(val, "carriagereturn")) else if (!strcmp(val, "carriagereturn"))
mode = eScrollMode::carriagereturn; mode = eScrollMode::carriagereturn;
attribs[id] = (int)mode; attribs[id] = (int)mode;
} }
void cAttributes::SetScrollSpeed(int id, const char *val) { void cAttributes::SetScrollSpeed(int id, const char *val) {
eScrollSpeed speed = eScrollSpeed::medium; eScrollSpeed speed = eScrollSpeed::medium;
if (!strcmp(val, "slow")) if (!strcmp(val, "slow"))
speed = eScrollSpeed::slow; speed = eScrollSpeed::slow;
else if (!strcmp(val, "fast")) else if (!strcmp(val, "fast"))
speed = eScrollSpeed::fast; speed = eScrollSpeed::fast;
else if (!strcmp(val, "medium")) else if (!strcmp(val, "medium"))
speed = eScrollSpeed::medium; speed = eScrollSpeed::medium;
attribs[id] = (int)speed; attribs[id] = (int)speed;
} }
void cAttributes::SetOrientation(int id, const char *val) { void cAttributes::SetOrientation(int id, const char *val) {
eOrientation orientation = eOrientation::none; eOrientation orientation = eOrientation::none;
if (!strcmp(val, "horizontal")) if (!strcmp(val, "horizontal"))
orientation = eOrientation::horizontal; orientation = eOrientation::horizontal;
else if (!strcmp(val, "vertical")) else if (!strcmp(val, "vertical"))
orientation = eOrientation::vertical; orientation = eOrientation::vertical;
else if (!strcmp(val, "absolute")) else if (!strcmp(val, "absolute"))
orientation = eOrientation::absolute; orientation = eOrientation::absolute;
attribs[id] = (int)orientation; attribs[id] = (int)orientation;
} }
void cAttributes::SetAlign(int id, const char *val) { void cAttributes::SetAlign(int id, const char *val) {
eAlign align = eAlign::left; eAlign align = eAlign::left;
if (!strcmp(val, "center")) { if (!strcmp(val, "center")) {
align = eAlign::center; align = eAlign::center;
} else if (!strcmp(val, "right")) { } else if (!strcmp(val, "right")) {
align = eAlign::right; align = eAlign::right;
} else if (!strcmp(val, "top")) { } else if (!strcmp(val, "top")) {
align = eAlign::top; align = eAlign::top;
} else if (!strcmp(val, "bottom")) { } else if (!strcmp(val, "bottom")) {
align = eAlign::bottom; align = eAlign::bottom;
} else if (!strcmp(val, "left")) { } else if (!strcmp(val, "left")) {
align = eAlign::left; align = eAlign::left;
} }
attribs[id] = (int)align; attribs[id] = (int)align;
} }
void cAttributes::SetDirection(int id, const char *val) { void cAttributes::SetDirection(int id, const char *val) {
eDirection direction = eDirection::none; eDirection direction = eDirection::none;
if (!strcmp(val, "bottomup")) if (!strcmp(val, "bottomup"))
direction = eDirection::bottomup; direction = eDirection::bottomup;
else if (!strcmp(val, "topdown")) else if (!strcmp(val, "topdown"))
direction = eDirection::topdown; direction = eDirection::topdown;
attribs[id] = (int)direction; attribs[id] = (int)direction;
} }
/*************************************************************************** /***************************************************************************
* Private Functions * Private Functions
***************************************************************************/ ***************************************************************************/
void cAttributes::SetCommonAttributesDefs(void) { void cAttributes::SetCommonAttributesDefs(void) {
commonAttribIDs.insert(pair<string, int>("x", (int)eCommonAttribs::x)); commonAttribIDs.insert(pair<string, int>("x", (int)eCommonAttribs::x));
commonAttribIDs.insert(pair<string, int>("y", (int)eCommonAttribs::y)); commonAttribIDs.insert(pair<string, int>("y", (int)eCommonAttribs::y));
commonAttribIDs.insert(pair<string, int>("width", (int)eCommonAttribs::width)); commonAttribIDs.insert(pair<string, int>("width", (int)eCommonAttribs::width));
commonAttribIDs.insert(pair<string, int>("height", (int)eCommonAttribs::height)); commonAttribIDs.insert(pair<string, int>("height", (int)eCommonAttribs::height));
commonAttribIDs.insert(pair<string, int>("debug", (int)eCommonAttribs::debug)); 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::x, "x"));
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::y, "y")); 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::width, "width"));
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::height, "height")); commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::height, "height"));
commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::debug, "debug")); commonAttribNames.insert(pair<int, string>((int)eCommonAttribs::debug, "debug"));
} }
/*************************************************************************** /***************************************************************************
* cFunction * cFunction
***************************************************************************/ ***************************************************************************/
cFunction::cFunction(cArea *owner, int numAttributes) : cAttributes(numAttributes) { cFunction::cFunction(cArea *owner, int numAttributes) : cAttributes(numAttributes) {
funcType = "Unknown"; funcType = "Unknown";
owningArea = owner; owningArea = owner;
color = NULL; color = NULL;
name = NULL; name = NULL;
scrolling = false; scrolling = false;
} }
cFunction::cFunction(const cFunction &other) : cAttributes(other) { cFunction::cFunction(const cFunction &other) : cAttributes(other) {
funcType = other.funcType; funcType = other.funcType;
owningArea = NULL; owningArea = NULL;
color = NULL; color = NULL;
if (other.color) if (other.color)
color = new cColor(*other.color); color = new cColor(*other.color);
name = NULL; name = NULL;
if (other.name) if (other.name)
name = strdup(other.name); name = strdup(other.name);
scrolling = other.scrolling; scrolling = other.scrolling;
} }
cFunction::~cFunction(void) { cFunction::~cFunction(void) {
delete color; delete color;
free(name); free(name);
} }
void cFunction::SetLoopInfo(cLoopInfo *loopInfo) { void cFunction::SetLoopInfo(cLoopInfo *loopInfo) {
for (int i=0; i < numAttribs; i++) { for (int i=0; i < numAttribs; i++) {
if (!attribCtors[i]) if (!attribCtors[i])
continue; continue;
attribCtors[i]->SetLoopInfo(loopInfo); attribCtors[i]->SetLoopInfo(loopInfo);
} }
if (cond) if (cond)
cond->SetLoopInfo(loopInfo); cond->SetLoopInfo(loopInfo);
} }
void cFunction::Cache(void) { void cFunction::Cache(void) {
if (color) { if (color) {
color->SetGlobals(globals); color->SetGlobals(globals);
color->Cache(); color->Cache();
} }
cAttributes::Cache(); cAttributes::Cache();
} }
void cFunction::CacheFuncReferences(void) { void cFunction::CacheFuncReferences(void) {
for (int i=0; i < numAttribs; i++) { for (int i=0; i < numAttribs; i++) {
if (!attribCtors[i]) if (!attribCtors[i])
continue; continue;
vector<cFactor*> refFactors = attribCtors[i]->GetRefFactors(); vector<cFactor*> refFactors = attribCtors[i]->GetRefFactors();
for (vector<cFactor*>::iterator it = refFactors.begin(); it != refFactors.end(); it++) { for (vector<cFactor*>::iterator it = refFactors.begin(); it != refFactors.end(); it++) {
cFactor *f = *it; cFactor *f = *it;
if (!f->funcRefName) if (!f->funcRefName)
continue; continue;
cFunction *fRef = owningArea->GetFunction(f->funcRefName); cFunction *fRef = owningArea->GetFunction(f->funcRefName);
if (fRef) { if (fRef) {
f->funcRef = fRef; f->funcRef = fRef;
} }
} }
} }
} }
int cFunction::GetX(eAlign align, int x0, int colWidth) { int cFunction::GetX(eAlign align, int x0, int colWidth) {
int containerWidth = colWidth > 0 ? colWidth : container.Width(); int containerWidth = colWidth > 0 ? colWidth : container.Width();
int x = x0 + X(); int x = x0 + X();
if (align == eAlign::right) { if (align == eAlign::right) {
x = x0 + containerWidth - FuncWidth(); x = x0 + containerWidth - FuncWidth();
} else if (align == eAlign::center) { } else if (align == eAlign::center) {
x = x0 + (containerWidth - FuncWidth()) / 2; x = x0 + (containerWidth - FuncWidth()) / 2;
} }
return x; return x;
} }
int cFunction::GetY(eAlign valign, int y0, int rowHeight) { int cFunction::GetY(eAlign valign, int y0, int rowHeight) {
int containerHeight = rowHeight > 0 ? rowHeight : container.Height(); int containerHeight = rowHeight > 0 ? rowHeight : container.Height();
int y = y0 + Y(); int y = y0 + Y();
if (valign == eAlign::bottom) { if (valign == eAlign::bottom) {
y = y0 + containerHeight - FuncHeight(); y = y0 + containerHeight - FuncHeight();
} else if (valign == eAlign::center) { } else if (valign == eAlign::center) {
y = y0 + (containerHeight - FuncHeight()) / 2; y = y0 + (containerHeight - FuncHeight()) / 2;
} }
return y; return y;
} }
void cFunction::Debug(void) { void cFunction::Debug(void) {
esyslog("skindesigner: ---> Function %s", funcType); esyslog("skindesigner: ---> Function %s", funcType);
cAttributes::Debug(); cAttributes::Debug();
if (name) { if (name) {
esyslog("skindesigner: name %s", name); esyslog("skindesigner: name %s", name);
} }
if (color) { if (color) {
color->Debug(); color->Debug();
} }
} }
/*************************************************************************** /***************************************************************************
* Protected Functions * Protected Functions
***************************************************************************/ ***************************************************************************/
void cFunction::SetColor(const char *val) { void cFunction::SetColor(const char *val) {
color = new cColor(val); color = new cColor(val);
} }
void cFunction::SetAnimType(int id, const char *val) { void cFunction::SetAnimType(int id, const char *val) {
eAnimType animType = eAnimType::none; eAnimType animType = eAnimType::none;
if (!strcmp(val, "blink")) if (!strcmp(val, "blink"))
animType = eAnimType::blink; animType = eAnimType::blink;
else if (!strcmp(val, "animated")) else if (!strcmp(val, "animated"))
animType = eAnimType::animated; animType = eAnimType::animated;
attribs[id] = (int)animType; attribs[id] = (int)animType;
} }
void cFunction::SetOverflow(int id, const char *val) { void cFunction::SetOverflow(int id, const char *val) {
eOverflowType overflowType = eOverflowType::none; eOverflowType overflowType = eOverflowType::none;
if (!strcmp(val, "linewrap")) if (!strcmp(val, "linewrap"))
overflowType = eOverflowType::wrap; overflowType = eOverflowType::wrap;
else if (!strcmp(val, "cut")) else if (!strcmp(val, "cut"))
overflowType = eOverflowType::cut; overflowType = eOverflowType::cut;
attribs[id] = (int)overflowType; attribs[id] = (int)overflowType;
} }

View File

@ -1,126 +1,126 @@
#ifndef __ATTRIBUTE_H #ifndef __ATTRIBUTE_H
#define __ATTRIBUTE_H #define __ATTRIBUTE_H
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
#include <vdr/skins.h> #include <vdr/skins.h>
#include "globals.h" #include "globals.h"
#include "../libskindesignerapi/tokencontainer.h" #include "../libskindesignerapi/tokencontainer.h"
#include "definitions.h" #include "definitions.h"
#include "complextypes.h" #include "complextypes.h"
class cArea; class cArea;
/****************************************************************** /******************************************************************
* cAttributes * cAttributes
******************************************************************/ ******************************************************************/
class cAttributes { class cAttributes {
private: private:
map<string, int> commonAttribIDs; map<string, int> commonAttribIDs;
map<int, string> commonAttribNames; map<int, string> commonAttribNames;
void SetCommonAttributesDefs(void); void SetCommonAttributesDefs(void);
protected: protected:
cGlobals *globals; cGlobals *globals;
skindesignerapi::cTokenContainer *tokenContainer; skindesignerapi::cTokenContainer *tokenContainer;
cRect container; cRect container;
int numAttribs; int numAttribs;
int *attribs; int *attribs;
cNumericExpr **attribCtors; cNumericExpr **attribCtors;
cCondition *cond; cCondition *cond;
map<string, int> attribIDs; map<string, int> attribIDs;
map<int, string> attribNames; map<int, string> attribNames;
int CommonAttributeId(const char *att); int CommonAttributeId(const char *att);
const char *CommonAttributeName(int id); const char *CommonAttributeName(int id);
int AttributeId(const char *att); int AttributeId(const char *att);
const char *AttributeName(int id); const char *AttributeName(int id);
bool SetCommon(int id, const char *val); bool SetCommon(int id, const char *val);
virtual bool IdEqual(int id, int compId); virtual bool IdEqual(int id, int compId);
void SetBool(int id, const char *val); void SetBool(int id, const char *val);
void SetViewElementMode(int id, const char *val); void SetViewElementMode(int id, const char *val);
void SetShiftType(int id, const char *val); void SetShiftType(int id, const char *val);
void SetShiftMode(int id, const char *val); void SetShiftMode(int id, const char *val);
void SetScrollMode(int id, const char *val); void SetScrollMode(int id, const char *val);
void SetScrollSpeed(int id, const char *val); void SetScrollSpeed(int id, const char *val);
void SetOrientation(int id, const char *val); void SetOrientation(int id, const char *val);
void SetDirection(int id, const char *val); void SetDirection(int id, const char *val);
void SetAlign(int id, const char *val); void SetAlign(int id, const char *val);
public: public:
cAttributes(int numAttributes); cAttributes(int numAttributes);
cAttributes(const cAttributes &other); cAttributes(const cAttributes &other);
virtual ~cAttributes(void); virtual ~cAttributes(void);
void SetGlobals(cGlobals *globals) { this->globals = globals; }; void SetGlobals(cGlobals *globals) { this->globals = globals; };
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer); void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer);
virtual void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer); virtual void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
virtual void SetContainer(int x, int y, int width, int height); virtual void SetContainer(int x, int y, int width, int height);
virtual void Set(vector<stringpair> &attributes) {}; virtual void Set(vector<stringpair> &attributes) {};
void SetX(int width); void SetX(int width);
void SetY(int height); void SetY(int height);
void SetWidth(int width); void SetWidth(int width);
void SetHeight(int height); void SetHeight(int height);
virtual void Cache(void); virtual void Cache(void);
int GetValue(int id); int GetValue(int id);
int X(void); int X(void);
int Y(void); int Y(void);
int Width(void); int Width(void);
int Height(void); int Height(void);
int DoDebug(void) { return attribs[(int)eCommonAttribs::debug] == 1 ? true : false; }; int DoDebug(void) { return attribs[(int)eCommonAttribs::debug] == 1 ? true : false; };
bool DoExecute(void); bool DoExecute(void);
virtual void Debug(void); virtual void Debug(void);
}; };
/****************************************************************** /******************************************************************
* cLoopInfo * cLoopInfo
******************************************************************/ ******************************************************************/
class cLoopInfo { class cLoopInfo {
public: public:
int colWidth; int colWidth;
int rowHeight; int rowHeight;
int index; int index;
int row; int row;
cLoopInfo(void) { cLoopInfo(void) {
colWidth = 0; colWidth = 0;
rowHeight = 0; rowHeight = 0;
index = 0; index = 0;
row = 0; row = 0;
}; };
}; };
/****************************************************************** /******************************************************************
* cFunction * cFunction
******************************************************************/ ******************************************************************/
class cFunction : public cAttributes, public cListObject { class cFunction : public cAttributes, public cListObject {
private: private:
cArea *owningArea; cArea *owningArea;
protected: protected:
const char *funcType; const char *funcType;
cColor *color; cColor *color;
char *name; char *name;
bool scrolling; bool scrolling;
void SetColor(const char *val); void SetColor(const char *val);
void SetAnimType(int id, const char *val); void SetAnimType(int id, const char *val);
void SetOverflow(int id, const char *val); void SetOverflow(int id, const char *val);
public: public:
cFunction(cArea *owner, int numAttributes); cFunction(cArea *owner, int numAttributes);
cFunction(const cFunction &other); cFunction(const cFunction &other);
virtual ~cFunction(void); virtual ~cFunction(void);
virtual void SetLoopInfo(cLoopInfo *loopInfo); virtual void SetLoopInfo(cLoopInfo *loopInfo);
void SetOwner(cArea *owner) { owningArea = owner; }; void SetOwner(cArea *owner) { owningArea = owner; };
const char *Name(void) { return name; }; const char *Name(void) { return name; };
virtual void Cache(void); virtual void Cache(void);
void CacheFuncReferences(void); void CacheFuncReferences(void);
void Scrolling(bool scrolling) { this->scrolling = scrolling; }; 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 void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0) {};
virtual int FuncX(void) { return X(); }; virtual int FuncX(void) { return X(); };
virtual int FuncY(void) { return Y(); }; virtual int FuncY(void) { return Y(); };
virtual int FuncWidth(void) { return Width(); }; virtual int FuncWidth(void) { return Width(); };
virtual int FuncHeight(void) { return Height(); }; virtual int FuncHeight(void) { return Height(); };
virtual int Align(void) { return (int)eAlign::left; }; virtual int Align(void) { return (int)eAlign::left; };
virtual int Valign(void) { return (int)eAlign::top; }; virtual int Valign(void) { return (int)eAlign::top; };
int GetX(eAlign align, int x0, int colWidth); int GetX(eAlign align, int x0, int colWidth);
int GetY(eAlign valign, int y0, int rowHeight); int GetY(eAlign valign, int y0, int rowHeight);
virtual bool Blinking(void) { return false; }; virtual bool Blinking(void) { return false; };
virtual int BlinkFreq(void) { return -1; }; virtual int BlinkFreq(void) { return -1; };
virtual void Debug(void); virtual void Debug(void);
}; };
#endif //__ATTRIBUTE_H #endif //__ATTRIBUTE_H

View File

@ -1,447 +1,447 @@
#include "attributes.h" #include "attributes.h"
#include "../config.h" #include "../config.h"
/*************************************************************************** /***************************************************************************
* cViewAttribs * cViewAttribs
***************************************************************************/ ***************************************************************************/
cViewAttribs::cViewAttribs(int numAttributes) : cAttributes(numAttributes) { cViewAttribs::cViewAttribs(int numAttributes) : cAttributes(numAttributes) {
orientation = NULL; orientation = NULL;
SetAttributesDefs(); SetAttributesDefs();
} }
cViewAttribs::~cViewAttribs(void) { cViewAttribs::~cViewAttribs(void) {
delete orientation; delete orientation;
} }
void cViewAttribs::Set(vector<stringpair> &attributes) { void cViewAttribs::Set(vector<stringpair> &attributes) {
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) { for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
const char *attName = (*att).first.c_str(); const char *attName = (*att).first.c_str();
const char *attVal = (*att).second.c_str(); const char *attVal = (*att).second.c_str();
int id = AttributeId(attName); int id = AttributeId(attName);
if (id == ATTR_UNKNOWN) { if (id == ATTR_UNKNOWN) {
esyslog("skindesigner: unknown view attribute \"%s\" = \"%s\"", attName, attVal); esyslog("skindesigner: unknown view attribute \"%s\" = \"%s\"", attName, attVal);
continue; continue;
} }
if (SetCommon(id, attVal)) if (SetCommon(id, attVal))
continue; continue;
if (IdEqual(id, (int)eViewAttribs::shifttype)) { if (IdEqual(id, (int)eViewAttribs::shifttype)) {
SetShiftType(id, attVal); SetShiftType(id, attVal);
} else if (IdEqual(id, (int)eViewAttribs::shiftmode)) { } else if (IdEqual(id, (int)eViewAttribs::shiftmode)) {
SetShiftMode(id, attVal); SetShiftMode(id, attVal);
} else if (IdEqual(id, (int)eViewAttribs::orientation)) { } else if (IdEqual(id, (int)eViewAttribs::orientation)) {
SetOrientationDynamic(id, attVal); SetOrientationDynamic(id, attVal);
} else if (IdEqual(id, (int)eViewAttribs::hideroot)) { } else if (IdEqual(id, (int)eViewAttribs::hideroot)) {
SetBool(id, attVal); SetBool(id, attVal);
} else { } else {
attribCtors[id] = new cNumericExpr(attVal); attribCtors[id] = new cNumericExpr(attVal);
if ( (id == (int)eViewAttribs::starty + (int)eCommonAttribs::count) || if ( (id == (int)eViewAttribs::starty + (int)eCommonAttribs::count) ||
(id == (int)eViewAttribs::scaletvy + (int)eCommonAttribs::count) || (id == (int)eViewAttribs::scaletvy + (int)eCommonAttribs::count) ||
(id == (int)eViewAttribs::scaletvheight + (int)eCommonAttribs::count) ) { (id == (int)eViewAttribs::scaletvheight + (int)eCommonAttribs::count) ) {
attribCtors[id]->SetVertical(); attribCtors[id]->SetVertical();
} }
} }
} }
} }
void cViewAttribs::SetAttributesDefs(void) { void cViewAttribs::SetAttributesDefs(void) {
attribIDs.insert(pair<string, int>("fadetime", (int)eViewAttribs::fadetime)); attribIDs.insert(pair<string, int>("fadetime", (int)eViewAttribs::fadetime));
attribIDs.insert(pair<string, int>("shifttime", (int)eViewAttribs::shifttime)); attribIDs.insert(pair<string, int>("shifttime", (int)eViewAttribs::shifttime));
attribIDs.insert(pair<string, int>("shifttype", (int)eViewAttribs::shifttype)); attribIDs.insert(pair<string, int>("shifttype", (int)eViewAttribs::shifttype));
attribIDs.insert(pair<string, int>("shiftmode", (int)eViewAttribs::shiftmode)); attribIDs.insert(pair<string, int>("shiftmode", (int)eViewAttribs::shiftmode));
attribIDs.insert(pair<string, int>("startx", (int)eViewAttribs::startx)); attribIDs.insert(pair<string, int>("startx", (int)eViewAttribs::startx));
attribIDs.insert(pair<string, int>("starty", (int)eViewAttribs::starty)); attribIDs.insert(pair<string, int>("starty", (int)eViewAttribs::starty));
attribIDs.insert(pair<string, int>("scaletvx", (int)eViewAttribs::scaletvx)); attribIDs.insert(pair<string, int>("scaletvx", (int)eViewAttribs::scaletvx));
attribIDs.insert(pair<string, int>("scaletvy", (int)eViewAttribs::scaletvy)); attribIDs.insert(pair<string, int>("scaletvy", (int)eViewAttribs::scaletvy));
attribIDs.insert(pair<string, int>("scaletvwidth", (int)eViewAttribs::scaletvwidth)); attribIDs.insert(pair<string, int>("scaletvwidth", (int)eViewAttribs::scaletvwidth));
attribIDs.insert(pair<string, int>("scaletvheight", (int)eViewAttribs::scaletvheight)); attribIDs.insert(pair<string, int>("scaletvheight", (int)eViewAttribs::scaletvheight));
attribIDs.insert(pair<string, int>("orientation", (int)eViewAttribs::orientation)); attribIDs.insert(pair<string, int>("orientation", (int)eViewAttribs::orientation));
attribIDs.insert(pair<string, int>("debuggrid", (int)eViewAttribs::debuggrid)); attribIDs.insert(pair<string, int>("debuggrid", (int)eViewAttribs::debuggrid));
attribIDs.insert(pair<string, int>("hideroot", (int)eViewAttribs::hideroot)); 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::fadetime, "fadetime"));
attribNames.insert(pair<int, string>((int)eViewAttribs::shifttime, "shifttime")); 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::shifttype, "shifttype"));
attribNames.insert(pair<int, string>((int)eViewAttribs::shiftmode, "shiftmode")); 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::startx, "startx"));
attribNames.insert(pair<int, string>((int)eViewAttribs::starty, "starty")); 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::scaletvx, "scaletvx"));
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvy, "scaletvy")); 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::scaletvwidth, "scaletvwidth"));
attribNames.insert(pair<int, string>((int)eViewAttribs::scaletvheight, "scaletvheight")); 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::orientation, "orientation"));
attribNames.insert(pair<int, string>((int)eViewAttribs::debuggrid, "debuggrid")); attribNames.insert(pair<int, string>((int)eViewAttribs::debuggrid, "debuggrid"));
attribNames.insert(pair<int, string>((int)eViewAttribs::hideroot, "hideroot")); attribNames.insert(pair<int, string>((int)eViewAttribs::hideroot, "hideroot"));
} }
void cViewAttribs::Cache(void) { void cViewAttribs::Cache(void) {
tokenContainer = new skindesignerapi::cTokenContainer(); tokenContainer = new skindesignerapi::cTokenContainer();
cAttributes::Cache(); cAttributes::Cache();
if (orientation) { if (orientation) {
orientation->SetGlobals(globals); orientation->SetGlobals(globals);
orientation->SetTokenContainer(tokenContainer); orientation->SetTokenContainer(tokenContainer);
orientation->Cache(); orientation->Cache();
char *res = orientation->DeterminateText(); char *res = orientation->DeterminateText();
if (res) { if (res) {
SetOrientation((int)eViewAttribs::orientation + (int)eCommonAttribs::count, res); SetOrientation((int)eViewAttribs::orientation + (int)eCommonAttribs::count, res);
} }
free(res); free(res);
} }
} }
void cViewAttribs::Debug(void) { void cViewAttribs::Debug(void) {
esyslog("skindesigner: --> View Attribs"); esyslog("skindesigner: --> View Attribs");
cAttributes::Debug(); cAttributes::Debug();
} }
eOrientation cViewAttribs::Orientation(void) { eOrientation cViewAttribs::Orientation(void) {
int orientation = GetValue((int)eViewAttribs::orientation); int orientation = GetValue((int)eViewAttribs::orientation);
if (orientation == -1) if (orientation == -1)
return eOrientation::vertical; return eOrientation::vertical;
if (orientation == (int)eOrientation::none) if (orientation == (int)eOrientation::none)
return eOrientation::vertical; return eOrientation::vertical;
return (eOrientation)orientation; return (eOrientation)orientation;
} }
cRect cViewAttribs::TvFrame(void) { cRect cViewAttribs::TvFrame(void) {
int frameX = GetValue((int)eViewAttribs::scaletvx); int frameX = GetValue((int)eViewAttribs::scaletvx);
int frameY = GetValue((int)eViewAttribs::scaletvy); int frameY = GetValue((int)eViewAttribs::scaletvy);
int frameWidth = GetValue((int)eViewAttribs::scaletvwidth); int frameWidth = GetValue((int)eViewAttribs::scaletvwidth);
int frameHeight = GetValue((int)eViewAttribs::scaletvheight); int frameHeight = GetValue((int)eViewAttribs::scaletvheight);
if (frameX < 0 || frameY < 0 || frameWidth <= 0 || frameHeight <= 0) if (frameX < 0 || frameY < 0 || frameWidth <= 0 || frameHeight <= 0)
return cRect::Null; return cRect::Null;
frameX += cOsd::OsdLeft(); frameX += cOsd::OsdLeft();
frameY += cOsd::OsdTop(); frameY += cOsd::OsdTop();
return cRect(frameX, frameY, frameWidth, frameHeight); return cRect(frameX, frameY, frameWidth, frameHeight);
} }
void cViewAttribs::SetOrientationDynamic(int id, const char *val) { void cViewAttribs::SetOrientationDynamic(int id, const char *val) {
if (strchr(val, '{') && strchr(val, '}')) { if (strchr(val, '{') && strchr(val, '}')) {
orientation = new cTextExpr(val); orientation = new cTextExpr(val);
} else { } else {
SetOrientation(id, val); SetOrientation(id, val);
} }
} }
/*************************************************************************** /***************************************************************************
* cViewElementAttribs * cViewElementAttribs
***************************************************************************/ ***************************************************************************/
cViewElementAttribs::cViewElementAttribs(int numAttributes) : cAttributes(numAttributes) { cViewElementAttribs::cViewElementAttribs(int numAttributes) : cAttributes(numAttributes) {
name = NULL; name = NULL;
SetAttributesDefs(); SetAttributesDefs();
} }
cViewElementAttribs::cViewElementAttribs(const cViewElementAttribs &other) : cAttributes(other) { cViewElementAttribs::cViewElementAttribs(const cViewElementAttribs &other) : cAttributes(other) {
name = NULL; name = NULL;
} }
cViewElementAttribs::~cViewElementAttribs(void) { cViewElementAttribs::~cViewElementAttribs(void) {
free(name); free(name);
} }
void cViewElementAttribs::Set(vector<stringpair> &attributes) { void cViewElementAttribs::Set(vector<stringpair> &attributes) {
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) { for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
const char *attName = (*att).first.c_str(); const char *attName = (*att).first.c_str();
const char *attVal = (*att).second.c_str(); const char *attVal = (*att).second.c_str();
int id = AttributeId(attName); int id = AttributeId(attName);
if (id == ATTR_UNKNOWN) { if (id == ATTR_UNKNOWN) {
esyslog("skindesigner: unknown view element attribute \"%s\" = \"%s\"", attName, attVal); esyslog("skindesigner: unknown view element attribute \"%s\" = \"%s\"", attName, attVal);
continue; continue;
} }
if (SetCommon(id, attVal)) if (SetCommon(id, attVal))
continue; continue;
if (IdEqual(id, (int)eViewElementAttribs::mode)) { if (IdEqual(id, (int)eViewElementAttribs::mode)) {
SetViewElementMode(id, attVal); SetViewElementMode(id, attVal);
} else if (IdEqual(id, (int)eViewElementAttribs::shifttype)) { } else if (IdEqual(id, (int)eViewElementAttribs::shifttype)) {
SetShiftType(id, attVal); SetShiftType(id, attVal);
} else if (IdEqual(id, (int)eViewElementAttribs::shiftmode)) { } else if (IdEqual(id, (int)eViewElementAttribs::shiftmode)) {
SetShiftMode(id, attVal); SetShiftMode(id, attVal);
} else if (IdEqual(id, (int)eViewElementAttribs::orientation)) { } else if (IdEqual(id, (int)eViewElementAttribs::orientation)) {
SetOrientation(id, attVal); SetOrientation(id, attVal);
} else if (IdEqual(id, (int)eViewElementAttribs::name)) { } else if (IdEqual(id, (int)eViewElementAttribs::name)) {
name = strdup(attVal); name = strdup(attVal);
} else { } else {
attribCtors[id] = new cNumericExpr(attVal); attribCtors[id] = new cNumericExpr(attVal);
if (id == (int)eViewElementAttribs::starty + (int)eCommonAttribs::count) { if (id == (int)eViewElementAttribs::starty + (int)eCommonAttribs::count) {
attribCtors[id]->SetVertical(); attribCtors[id]->SetVertical();
} }
} }
} }
} }
void cViewElementAttribs::SetAttributesDefs(void) { void cViewElementAttribs::SetAttributesDefs(void) {
attribIDs.insert(pair<string, int>("delay", (int)eViewElementAttribs::delay)); attribIDs.insert(pair<string, int>("delay", (int)eViewElementAttribs::delay));
attribIDs.insert(pair<string, int>("fadetime", (int)eViewElementAttribs::fadetime)); attribIDs.insert(pair<string, int>("fadetime", (int)eViewElementAttribs::fadetime));
attribIDs.insert(pair<string, int>("shifttime", (int)eViewElementAttribs::shifttime)); attribIDs.insert(pair<string, int>("shifttime", (int)eViewElementAttribs::shifttime));
attribIDs.insert(pair<string, int>("shifttype", (int)eViewElementAttribs::shifttype)); attribIDs.insert(pair<string, int>("shifttype", (int)eViewElementAttribs::shifttype));
attribIDs.insert(pair<string, int>("shiftmode", (int)eViewElementAttribs::shiftmode)); attribIDs.insert(pair<string, int>("shiftmode", (int)eViewElementAttribs::shiftmode));
attribIDs.insert(pair<string, int>("startx", (int)eViewElementAttribs::startx)); attribIDs.insert(pair<string, int>("startx", (int)eViewElementAttribs::startx));
attribIDs.insert(pair<string, int>("starty", (int)eViewElementAttribs::starty)); attribIDs.insert(pair<string, int>("starty", (int)eViewElementAttribs::starty));
attribIDs.insert(pair<string, int>("orientation", (int)eViewElementAttribs::orientation)); attribIDs.insert(pair<string, int>("orientation", (int)eViewElementAttribs::orientation));
attribIDs.insert(pair<string, int>("mode", (int)eViewElementAttribs::mode)); attribIDs.insert(pair<string, int>("mode", (int)eViewElementAttribs::mode));
attribIDs.insert(pair<string, int>("name", (int)eViewElementAttribs::name)); 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::delay, "delay"));
attribNames.insert(pair<int, string>((int)eViewElementAttribs::fadetime, "fadetime")); 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::shifttime, "shifttime"));
attribNames.insert(pair<int, string>((int)eViewElementAttribs::shifttype, "shifttype")); 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::shiftmode, "shiftmode"));
attribNames.insert(pair<int, string>((int)eViewElementAttribs::startx, "startx")); 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::starty, "starty"));
attribNames.insert(pair<int, string>((int)eViewElementAttribs::orientation, "orientation")); 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::mode, "mode"));
attribNames.insert(pair<int, string>((int)eViewElementAttribs::name, "name")); attribNames.insert(pair<int, string>((int)eViewElementAttribs::name, "name"));
} }
eOrientation cViewElementAttribs::Orientation(void) { eOrientation cViewElementAttribs::Orientation(void) {
int orientation = GetValue((int)eViewElementAttribs::orientation); int orientation = GetValue((int)eViewElementAttribs::orientation);
if (orientation == -1) if (orientation == -1)
return eOrientation::vertical; return eOrientation::vertical;
if (orientation == (int)eOrientation::none) if (orientation == (int)eOrientation::none)
return eOrientation::vertical; return eOrientation::vertical;
return (eOrientation)orientation; return (eOrientation)orientation;
} }
void cViewElementAttribs::Debug(void) { void cViewElementAttribs::Debug(void) {
esyslog("skindesigner: ---> View Element Attribs"); esyslog("skindesigner: ---> View Element Attribs");
cAttributes::Debug(); cAttributes::Debug();
} }
/*************************************************************************** /***************************************************************************
* cViewListAttribs * cViewListAttribs
***************************************************************************/ ***************************************************************************/
cViewListAttribs::cViewListAttribs(int numAttributes) : cAttributes(numAttributes) { cViewListAttribs::cViewListAttribs(int numAttributes) : cAttributes(numAttributes) {
determinateFont = NULL; determinateFont = NULL;
SetAttributesDefs(); SetAttributesDefs();
} }
cViewListAttribs::~cViewListAttribs(void) { cViewListAttribs::~cViewListAttribs(void) {
free(determinateFont); free(determinateFont);
} }
void cViewListAttribs::Set(vector<stringpair> &attributes) { void cViewListAttribs::Set(vector<stringpair> &attributes) {
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) { for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
const char *attName = (*att).first.c_str(); const char *attName = (*att).first.c_str();
const char *attVal = (*att).second.c_str(); const char *attVal = (*att).second.c_str();
int id = AttributeId(attName); int id = AttributeId(attName);
if (id == ATTR_UNKNOWN) { if (id == ATTR_UNKNOWN) {
esyslog("skindesigner: unknown view list attribute \"%s\" = \"%s\"", attName, attVal); esyslog("skindesigner: unknown view list attribute \"%s\" = \"%s\"", attName, attVal);
continue; continue;
} }
if (SetCommon(id, attVal)) if (SetCommon(id, attVal))
continue; continue;
if (IdEqual(id, (int)eViewListAttribs::align)) { if (IdEqual(id, (int)eViewListAttribs::align)) {
SetAlign(id, attVal); SetAlign(id, attVal);
} else if (IdEqual(id, (int)eViewListAttribs::determinatefont)) { } else if (IdEqual(id, (int)eViewListAttribs::determinatefont)) {
determinateFont = strdup(attVal); determinateFont = strdup(attVal);
} else if (IdEqual(id, (int)eViewListAttribs::orientation)) { } else if (IdEqual(id, (int)eViewListAttribs::orientation)) {
SetOrientation(id, attVal); SetOrientation(id, attVal);
} else { } else {
attribCtors[id] = new cNumericExpr(attVal); attribCtors[id] = new cNumericExpr(attVal);
} }
} }
} }
int cViewListAttribs::NumListElements(void) { int cViewListAttribs::NumListElements(void) {
return GetValue((int)eViewListAttribs::numlistelements); return GetValue((int)eViewListAttribs::numlistelements);
} }
int cViewListAttribs::MenuItemWidth(void) { int cViewListAttribs::MenuItemWidth(void) {
return GetValue((int)eViewListAttribs::menuitemwidth); return GetValue((int)eViewListAttribs::menuitemwidth);
} }
const char *cViewListAttribs::DeterminateFont(void) { const char *cViewListAttribs::DeterminateFont(void) {
return determinateFont; return determinateFont;
} }
eAlign cViewListAttribs::Align(void) { eAlign cViewListAttribs::Align(void) {
int align = GetValue((int)eViewListAttribs::align); int align = GetValue((int)eViewListAttribs::align);
if (align < 0) if (align < 0)
return eAlign::top; return eAlign::top;
return (eAlign)align; return (eAlign)align;
} }
eOrientation cViewListAttribs::Orientation(void) { eOrientation cViewListAttribs::Orientation(void) {
int orientation = GetValue((int)eViewListAttribs::orientation); int orientation = GetValue((int)eViewListAttribs::orientation);
if (orientation < 0) if (orientation < 0)
return eOrientation::vertical; return eOrientation::vertical;
return (eOrientation)orientation; return (eOrientation)orientation;
} }
void cViewListAttribs::SetAttributesDefs(void) { void cViewListAttribs::SetAttributesDefs(void) {
attribIDs.insert(pair<string, int>("align", (int)eViewListAttribs::align)); attribIDs.insert(pair<string, int>("align", (int)eViewListAttribs::align));
attribIDs.insert(pair<string, int>("menuitemwidth", (int)eViewListAttribs::menuitemwidth)); attribIDs.insert(pair<string, int>("menuitemwidth", (int)eViewListAttribs::menuitemwidth));
attribIDs.insert(pair<string, int>("determinatefont", (int)eViewListAttribs::determinatefont)); attribIDs.insert(pair<string, int>("determinatefont", (int)eViewListAttribs::determinatefont));
attribIDs.insert(pair<string, int>("numlistelements", (int)eViewListAttribs::numlistelements)); attribIDs.insert(pair<string, int>("numlistelements", (int)eViewListAttribs::numlistelements));
attribIDs.insert(pair<string, int>("orientation", (int)eViewListAttribs::orientation)); attribIDs.insert(pair<string, int>("orientation", (int)eViewListAttribs::orientation));
attribIDs.insert(pair<string, int>("condition", (int)eViewListAttribs::condition)); 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::align, "align"));
attribNames.insert(pair<int, string>((int)eViewListAttribs::menuitemwidth, "menuitemwidth")); 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::determinatefont, "determinatefont"));
attribNames.insert(pair<int, string>((int)eViewListAttribs::numlistelements, "numlistelements")); 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::orientation, "orientation"));
attribNames.insert(pair<int, string>((int)eViewListAttribs::condition, "condition")); attribNames.insert(pair<int, string>((int)eViewListAttribs::condition, "condition"));
} }
void cViewListAttribs::Debug(void) { void cViewListAttribs::Debug(void) {
esyslog("skindesigner: ---> View List Attribs"); esyslog("skindesigner: ---> View List Attribs");
esyslog("skindesigner: DeterminateFont %s", determinateFont); esyslog("skindesigner: DeterminateFont %s", determinateFont);
cAttributes::Debug(); cAttributes::Debug();
} }
/*************************************************************************** /***************************************************************************
* cAreaAttribs * cAreaAttribs
***************************************************************************/ ***************************************************************************/
cAreaAttribs::cAreaAttribs(int numAttributes) : cAttributes(numAttributes) { cAreaAttribs::cAreaAttribs(int numAttributes) : cAttributes(numAttributes) {
name = NULL; name = NULL;
scrollElement = NULL; scrollElement = NULL;
dynamic = false; dynamic = false;
SetAttributesDefs(); SetAttributesDefs();
} }
cAreaAttribs::cAreaAttribs(const cAreaAttribs &other) : cAttributes(other) { cAreaAttribs::cAreaAttribs(const cAreaAttribs &other) : cAttributes(other) {
name = NULL; name = NULL;
if (other.name) if (other.name)
name = new cTextExpr(*other.name); name = new cTextExpr(*other.name);
scrollElement = NULL; scrollElement = NULL;
if (other.scrollElement) if (other.scrollElement)
scrollElement = strdup(other.scrollElement); scrollElement = strdup(other.scrollElement);
dynamic = false; dynamic = false;
} }
cAreaAttribs::~cAreaAttribs(void) { cAreaAttribs::~cAreaAttribs(void) {
delete name; delete name;
free(scrollElement); free(scrollElement);
} }
void cAreaAttribs::Set(vector<stringpair> &attributes) { void cAreaAttribs::Set(vector<stringpair> &attributes) {
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) { for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
const char *attName = (*att).first.c_str(); const char *attName = (*att).first.c_str();
const char *attVal = (*att).second.c_str(); const char *attVal = (*att).second.c_str();
int id = AttributeId(attName); int id = AttributeId(attName);
if (id == ATTR_UNKNOWN) { if (id == ATTR_UNKNOWN) {
esyslog("skindesigner: unknown area attribute \"%s\" = \"%s\"", attName, attVal); esyslog("skindesigner: unknown area attribute \"%s\" = \"%s\"", attName, attVal);
continue; continue;
} }
if (SetCommon(id, attVal)) if (SetCommon(id, attVal))
continue; continue;
if (IdEqual(id, (int)eAreaAttribs::scrollelement)) { if (IdEqual(id, (int)eAreaAttribs::scrollelement)) {
scrollElement = strdup(attVal); scrollElement = strdup(attVal);
} else if (IdEqual(id, (int)eAreaAttribs::mode)) { } else if (IdEqual(id, (int)eAreaAttribs::mode)) {
SetScrollMode(id, attVal); SetScrollMode(id, attVal);
} else if (IdEqual(id, (int)eAreaAttribs::orientation)) { } else if (IdEqual(id, (int)eAreaAttribs::orientation)) {
SetOrientation(id, attVal); SetOrientation(id, attVal);
} else if (IdEqual(id, (int)eAreaAttribs::scrollspeed)) { } else if (IdEqual(id, (int)eAreaAttribs::scrollspeed)) {
SetScrollSpeed(id, attVal); SetScrollSpeed(id, attVal);
} else if (IdEqual(id, (int)eAreaAttribs::background)) { } else if (IdEqual(id, (int)eAreaAttribs::background)) {
SetBool(id, attVal); SetBool(id, attVal);
} else if (IdEqual(id, (int)eAreaAttribs::name)) { } else if (IdEqual(id, (int)eAreaAttribs::name)) {
name = new cTextExpr(attVal); name = new cTextExpr(attVal);
} else { } else {
attribCtors[id] = new cNumericExpr(attVal); attribCtors[id] = new cNumericExpr(attVal);
} }
} }
} }
int cAreaAttribs::Layer(void) { int cAreaAttribs::Layer(void) {
if (GetValue((int)eAreaAttribs::layer) > 0) { if (GetValue((int)eAreaAttribs::layer) > 0) {
return GetValue((int)eAreaAttribs::layer); return GetValue((int)eAreaAttribs::layer);
} }
return 1; return 1;
} }
bool cAreaAttribs::BackgroundArea(void) { bool cAreaAttribs::BackgroundArea(void) {
int isBackground = GetValue((int)eAreaAttribs::background); int isBackground = GetValue((int)eAreaAttribs::background);
if (isBackground == 1) if (isBackground == 1)
return true; return true;
return false; return false;
} }
void cAreaAttribs::CheckDynamic(void) { void cAreaAttribs::CheckDynamic(void) {
for (int i = (int)eCommonAttribs::x; i <= (int)eCommonAttribs::height; ++i ) { for (int i = (int)eCommonAttribs::x; i <= (int)eCommonAttribs::height; ++i ) {
if (attribCtors[i] && attribCtors[i]->Dynamic()) { if (attribCtors[i] && attribCtors[i]->Dynamic()) {
dynamic = true; dynamic = true;
return; return;
} }
} }
} }
const char *cAreaAttribs::Name(void) { const char *cAreaAttribs::Name(void) {
if (name) if (name)
return name->DeterminateText(); return name->DeterminateText();
return NULL; return NULL;
} }
void cAreaAttribs::SetAttributesDefs(void) { void cAreaAttribs::SetAttributesDefs(void) {
attribIDs.insert(pair<string, int>("layer", (int)eAreaAttribs::layer)); attribIDs.insert(pair<string, int>("layer", (int)eAreaAttribs::layer));
attribIDs.insert(pair<string, int>("transparency", (int)eAreaAttribs::transparency)); attribIDs.insert(pair<string, int>("transparency", (int)eAreaAttribs::transparency));
attribIDs.insert(pair<string, int>("mode", (int)eAreaAttribs::mode)); attribIDs.insert(pair<string, int>("mode", (int)eAreaAttribs::mode));
attribIDs.insert(pair<string, int>("orientation", (int)eAreaAttribs::orientation)); attribIDs.insert(pair<string, int>("orientation", (int)eAreaAttribs::orientation));
attribIDs.insert(pair<string, int>("scrollelement", (int)eAreaAttribs::scrollelement)); attribIDs.insert(pair<string, int>("scrollelement", (int)eAreaAttribs::scrollelement));
attribIDs.insert(pair<string, int>("scrollspeed", (int)eAreaAttribs::scrollspeed)); attribIDs.insert(pair<string, int>("scrollspeed", (int)eAreaAttribs::scrollspeed));
attribIDs.insert(pair<string, int>("delay", (int)eAreaAttribs::delay)); attribIDs.insert(pair<string, int>("delay", (int)eAreaAttribs::delay));
attribIDs.insert(pair<string, int>("background", (int)eAreaAttribs::background)); attribIDs.insert(pair<string, int>("background", (int)eAreaAttribs::background));
attribIDs.insert(pair<string, int>("name", (int)eAreaAttribs::name)); attribIDs.insert(pair<string, int>("name", (int)eAreaAttribs::name));
attribIDs.insert(pair<string, int>("scrollheight", (int)eAreaAttribs::scrollheight)); 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::layer, "layer"));
attribNames.insert(pair<int, string>((int)eAreaAttribs::transparency, "transparency")); 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::mode, "mode"));
attribNames.insert(pair<int, string>((int)eAreaAttribs::orientation, "orientation")); 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::scrollelement, "scrollelement"));
attribNames.insert(pair<int, string>((int)eAreaAttribs::scrollspeed, "scrollspeed")); 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::delay, "delay"));
attribNames.insert(pair<int, string>((int)eAreaAttribs::background, "background")); 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::name, "name"));
attribNames.insert(pair<int, string>((int)eAreaAttribs::scrollheight, "scrollheight")); attribNames.insert(pair<int, string>((int)eAreaAttribs::scrollheight, "scrollheight"));
} }
void cAreaAttribs::Cache(void) { void cAreaAttribs::Cache(void) {
cAttributes::Cache(); cAttributes::Cache();
if (name) { if (name) {
name->SetGlobals(globals); name->SetGlobals(globals);
name->SetTokenContainer(tokenContainer); name->SetTokenContainer(tokenContainer);
name->Cache(); name->Cache();
} }
} }
void cAreaAttribs::Debug(void) { void cAreaAttribs::Debug(void) {
if (!name) { if (!name) {
esyslog("skindesigner: ---> Area Attribs"); esyslog("skindesigner: ---> Area Attribs");
} else { } else {
esyslog("skindesigner: ---> Tab %s Attribs", name->DeterminateText()); esyslog("skindesigner: ---> Tab %s Attribs", name->DeterminateText());
} }
cAttributes::Debug(); cAttributes::Debug();
} }
/*************************************************************************** /***************************************************************************
* cAreaContainerAttribs * cAreaContainerAttribs
***************************************************************************/ ***************************************************************************/
cAreaContainerAttribs::cAreaContainerAttribs(int numAttributes) : cAttributes(numAttributes) { cAreaContainerAttribs::cAreaContainerAttribs(int numAttributes) : cAttributes(numAttributes) {
SetAttributesDefs(); SetAttributesDefs();
} }
cAreaContainerAttribs::cAreaContainerAttribs(const cAreaContainerAttribs &other) : cAttributes(other) { cAreaContainerAttribs::cAreaContainerAttribs(const cAreaContainerAttribs &other) : cAttributes(other) {
} }
cAreaContainerAttribs::~cAreaContainerAttribs(void) { cAreaContainerAttribs::~cAreaContainerAttribs(void) {
} }
void cAreaContainerAttribs::Set(vector<stringpair> &attributes) { void cAreaContainerAttribs::Set(vector<stringpair> &attributes) {
for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) { for (vector<stringpair>::iterator att = attributes.begin(); att != attributes.end(); att++) {
const char *attName = (*att).first.c_str(); const char *attName = (*att).first.c_str();
const char *attVal = (*att).second.c_str(); const char *attVal = (*att).second.c_str();
int id = AttributeId(attName); int id = AttributeId(attName);
if (id == ATTR_UNKNOWN) { if (id == ATTR_UNKNOWN) {
esyslog("skindesigner: unknown area container attribute \"%s\" = \"%s\"", attName, attVal); esyslog("skindesigner: unknown area container attribute \"%s\" = \"%s\"", attName, attVal);
continue; continue;
} }
if (SetCommon(id, attVal)) if (SetCommon(id, attVal))
continue; continue;
} }
} }
void cAreaContainerAttribs::SetAttributesDefs(void) { void cAreaContainerAttribs::SetAttributesDefs(void) {
} }
void cAreaContainerAttribs::Debug(void) { void cAreaContainerAttribs::Debug(void) {
esyslog("skindesigner: ---> Area Container Attribs"); esyslog("skindesigner: ---> Area Container Attribs");
cAttributes::Debug(); cAttributes::Debug();
} }

View File

@ -1,111 +1,111 @@
#ifndef __ATTRIBUTES_H #ifndef __ATTRIBUTES_H
#define __ATTRIBUTES_H #define __ATTRIBUTES_H
#include "attribute.h" #include "attribute.h"
/****************************************************************** /******************************************************************
* cViewAttribs * cViewAttribs
******************************************************************/ ******************************************************************/
class cViewAttribs : public cAttributes { class cViewAttribs : public cAttributes {
private: private:
cTextExpr *orientation; cTextExpr *orientation;
void SetAttributesDefs(void); void SetAttributesDefs(void);
void SetOrientationDynamic(int id, const char *val); void SetOrientationDynamic(int id, const char *val);
public: public:
cViewAttribs(int numAttributes); cViewAttribs(int numAttributes);
virtual ~cViewAttribs(void); virtual ~cViewAttribs(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
eOrientation Orientation(void); eOrientation Orientation(void);
int FadeTime(void) { return GetValue((int)eViewAttribs::fadetime); }; int FadeTime(void) { return GetValue((int)eViewAttribs::fadetime); };
int ShiftTime(void) { return GetValue((int)eViewAttribs::shifttime); }; int ShiftTime(void) { return GetValue((int)eViewAttribs::shifttime); };
cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewAttribs::startx), GetValue((int)eViewAttribs::starty)); }; cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewAttribs::startx), GetValue((int)eViewAttribs::starty)); };
int ShiftType(void) { return GetValue((int)eViewAttribs::shifttype); }; int ShiftType(void) { return GetValue((int)eViewAttribs::shifttype); };
int ShiftMode(void) { return GetValue((int)eViewAttribs::shiftmode); }; int ShiftMode(void) { return GetValue((int)eViewAttribs::shiftmode); };
cRect TvFrame(void); cRect TvFrame(void);
void Cache(void); void Cache(void);
void Debug(void); void Debug(void);
}; };
/****************************************************************** /******************************************************************
* cViewElementAttribs * cViewElementAttribs
******************************************************************/ ******************************************************************/
class cViewElementAttribs : public cAttributes { class cViewElementAttribs : public cAttributes {
private: private:
char *name; char *name;
void SetAttributesDefs(void); void SetAttributesDefs(void);
public: public:
cViewElementAttribs(int numAttributes); cViewElementAttribs(int numAttributes);
cViewElementAttribs(const cViewElementAttribs &other); cViewElementAttribs(const cViewElementAttribs &other);
virtual ~cViewElementAttribs(void); virtual ~cViewElementAttribs(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
int Mode(void) { return GetValue((int)eViewElementAttribs::mode); }; int Mode(void) { return GetValue((int)eViewElementAttribs::mode); };
int Delay(void) { return GetValue((int)eViewElementAttribs::delay); }; int Delay(void) { return GetValue((int)eViewElementAttribs::delay); };
eOrientation Orientation(void); eOrientation Orientation(void);
int FadeTime(void) { return GetValue((int)eViewElementAttribs::fadetime); }; int FadeTime(void) { return GetValue((int)eViewElementAttribs::fadetime); };
int ShiftTime(void) { return GetValue((int)eViewElementAttribs::shifttime); }; int ShiftTime(void) { return GetValue((int)eViewElementAttribs::shifttime); };
cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewElementAttribs::startx), GetValue((int)eViewElementAttribs::starty)); }; cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewElementAttribs::startx), GetValue((int)eViewElementAttribs::starty)); };
int ShiftType(void) { return GetValue((int)eViewElementAttribs::shifttype); }; int ShiftType(void) { return GetValue((int)eViewElementAttribs::shifttype); };
int ShiftMode(void) { return GetValue((int)eViewElementAttribs::shiftmode); }; int ShiftMode(void) { return GetValue((int)eViewElementAttribs::shiftmode); };
const char *Name(void) { return name; }; const char *Name(void) { return name; };
void Debug(void); void Debug(void);
}; };
/****************************************************************** /******************************************************************
* cViewListAttribs * cViewListAttribs
******************************************************************/ ******************************************************************/
class cViewListAttribs : public cAttributes { class cViewListAttribs : public cAttributes {
private: private:
char *determinateFont; char *determinateFont;
void SetAttributesDefs(void); void SetAttributesDefs(void);
public: public:
cViewListAttribs(int numAttributes); cViewListAttribs(int numAttributes);
virtual ~cViewListAttribs(void); virtual ~cViewListAttribs(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
int NumListElements(void); int NumListElements(void);
int MenuItemWidth(void); int MenuItemWidth(void);
const char *DeterminateFont(void); const char *DeterminateFont(void);
eAlign Align(void); eAlign Align(void);
eOrientation Orientation(void); eOrientation Orientation(void);
void Debug(void); void Debug(void);
}; };
/****************************************************************** /******************************************************************
* cAreaAttribs * cAreaAttribs
******************************************************************/ ******************************************************************/
class cAreaAttribs : public cAttributes { class cAreaAttribs : public cAttributes {
private: private:
cTextExpr *name; cTextExpr *name;
char *scrollElement; char *scrollElement;
void SetAttributesDefs(void); void SetAttributesDefs(void);
bool dynamic; bool dynamic;
public: public:
cAreaAttribs(int numAttributes); cAreaAttribs(int numAttributes);
cAreaAttribs(const cAreaAttribs &other); cAreaAttribs(const cAreaAttribs &other);
virtual ~cAreaAttribs(void); virtual ~cAreaAttribs(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
const char *GetScrollElement(void) { return scrollElement; }; const char *GetScrollElement(void) { return scrollElement; };
int Orientation(void) { return GetValue((int)eAreaAttribs::orientation); }; int Orientation(void) { return GetValue((int)eAreaAttribs::orientation); };
int Delay(void) { return GetValue((int)eAreaAttribs::delay); }; int Delay(void) { return GetValue((int)eAreaAttribs::delay); };
int Mode(void) { return GetValue((int)eAreaAttribs::mode); }; int Mode(void) { return GetValue((int)eAreaAttribs::mode); };
int ScrollSpeed(void) { return GetValue((int)eAreaAttribs::scrollspeed); }; int ScrollSpeed(void) { return GetValue((int)eAreaAttribs::scrollspeed); };
int Transparency(void) { return GetValue((int)eAreaAttribs::transparency); }; int Transparency(void) { return GetValue((int)eAreaAttribs::transparency); };
int Layer(void); int Layer(void);
int ScrollStep(void) { return GetValue((int)eAreaAttribs::scrollheight); }; int ScrollStep(void) { return GetValue((int)eAreaAttribs::scrollheight); };
bool BackgroundArea(void); bool BackgroundArea(void);
const char *Name(void); const char *Name(void);
void CheckDynamic(void); void CheckDynamic(void);
bool Dynamic(void) {return dynamic; }; bool Dynamic(void) {return dynamic; };
void Cache(void); void Cache(void);
void Debug(void); void Debug(void);
}; };
/****************************************************************** /******************************************************************
* cAreaContainerAttribs * cAreaContainerAttribs
******************************************************************/ ******************************************************************/
class cAreaContainerAttribs : public cAttributes { class cAreaContainerAttribs : public cAttributes {
private: private:
void SetAttributesDefs(void); void SetAttributesDefs(void);
public: public:
cAreaContainerAttribs(int numAttributes); cAreaContainerAttribs(int numAttributes);
cAreaContainerAttribs(const cAreaContainerAttribs &other); cAreaContainerAttribs(const cAreaContainerAttribs &other);
virtual ~cAreaContainerAttribs(void); virtual ~cAreaContainerAttribs(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void Debug(void); void Debug(void);
}; };
#endif //__ATTRIBUTES_H #endif //__ATTRIBUTES_H

File diff suppressed because it is too large Load Diff

View File

@ -1,318 +1,318 @@
#ifndef __COMPLEXTYPES_H #ifndef __COMPLEXTYPES_H
#define __COMPLEXTYPES_H #define __COMPLEXTYPES_H
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <vdr/skins.h> #include <vdr/skins.h>
#include "globals.h" #include "globals.h"
#include "../libskindesignerapi/tokencontainer.h" #include "../libskindesignerapi/tokencontainer.h"
class cLoopInfo; class cLoopInfo;
class cFunction; class cFunction;
/****************************************************************** /******************************************************************
* helpers * helpers
******************************************************************/ ******************************************************************/
char *RemoveSpace(char *e); char *RemoveSpace(char *e);
void ReplaceDecimalpoint(char *e); void ReplaceDecimalpoint(char *e);
void ReplaceStart(char *e, int num); void ReplaceStart(char *e, int num);
void ReplaceEnd(char *e, int num); void ReplaceEnd(char *e, int num);
/****************************************************************** /******************************************************************
* cCondition * cCondition
******************************************************************/ ******************************************************************/
enum class eCondOp { enum class eCondOp {
tAnd, tAnd,
tOr tOr
}; };
enum class eCondType { enum class eCondType {
token, token,
negtoken, negtoken,
lowerInt, lowerInt,
equalInt, equalInt,
greaterInt, greaterInt,
isset, isset,
empty, empty,
equalString, equalString,
notEqualString, notEqualString,
contains, contains,
notContains notContains
}; };
enum class eCondTokenType { enum class eCondTokenType {
inttoken, inttoken,
stringtoken, stringtoken,
looptoken looptoken
}; };
class cCond : public cListObject { class cCond : public cListObject {
public: public:
cCond(const char *expression); cCond(const char *expression);
cCond(const cCond &other); cCond(const cCond &other);
virtual ~cCond(void); virtual ~cCond(void);
void Debug(void); void Debug(void);
char *expr; char *expr;
eCondOp operation; eCondOp operation;
eCondType type; eCondType type;
eCondTokenType tokenType; eCondTokenType tokenType;
bool constant; bool constant;
bool isTrue; bool isTrue;
int tokenIndex; int tokenIndex;
int compareValue; int compareValue;
char *compareStrValue; char *compareStrValue;
}; };
class cCondition { class cCondition {
private: private:
char *expr; char *expr;
cGlobals *globals; cGlobals *globals;
skindesignerapi::cTokenContainer *tokenContainer; skindesignerapi::cTokenContainer *tokenContainer;
cLoopInfo *loopInfo; cLoopInfo *loopInfo;
cList<cCond> conds; cList<cCond> conds;
void Tokenize(void); void Tokenize(void);
void PrepareTokens(void); void PrepareTokens(void);
void SetTokenCond(cCond *c); void SetTokenCond(cCond *c);
void SetIntegerCond(cCond *c); void SetIntegerCond(cCond *c);
void SetStringCond(cCond *c); void SetStringCond(cCond *c);
void SetStringCompareCond(cCond *c); void SetStringCompareCond(cCond *c);
void SetTokenIndex(cCond *c, const char *token); void SetTokenIndex(cCond *c, const char *token);
public: public:
cCondition(const char *expression); cCondition(const char *expression);
cCondition(const cCondition &other); cCondition(const cCondition &other);
virtual ~cCondition(void); virtual ~cCondition(void);
void SetGlobals(cGlobals *globals) { this->globals = globals; }; void SetGlobals(cGlobals *globals) { this->globals = globals; };
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {this->tokenContainer = tokenContainer; }; void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) {this->tokenContainer = tokenContainer; };
void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; }; void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; };
void Prepare(void); void Prepare(void);
bool True(void); bool True(void);
void Debug(void); void Debug(void);
}; };
/****************************************************************** /******************************************************************
* cNumericExpr * cNumericExpr
******************************************************************/ ******************************************************************/
enum class eFactorType { enum class eFactorType {
constant = 0, constant = 0,
stringtoken, stringtoken,
inttoken, inttoken,
looptoken, looptoken,
xref, xref,
yref, yref,
widthref, widthref,
heightref, heightref,
areawidth, areawidth,
areaheight, areaheight,
columnwidth, columnwidth,
rowheight rowheight
}; };
class cFactor: public cListObject { class cFactor: public cListObject {
public: public:
cFactor(void) { cFactor(void) {
multiplication = true; multiplication = true;
type = eFactorType::constant; type = eFactorType::constant;
constValue = 1.0f; constValue = 1.0f;
tokenIndex = -1; tokenIndex = -1;
funcRefName = NULL; funcRefName = NULL;
funcRef = NULL; funcRef = NULL;
}; };
cFactor(const cFactor &other) { cFactor(const cFactor &other) {
multiplication = other.multiplication; multiplication = other.multiplication;
type = other.type; type = other.type;
constValue = other.constValue; constValue = other.constValue;
tokenIndex = other.tokenIndex; tokenIndex = other.tokenIndex;
funcRefName = NULL; funcRefName = NULL;
if (other.funcRefName) if (other.funcRefName)
funcRefName = strdup(other.funcRefName); funcRefName = strdup(other.funcRefName);
funcRef = other.funcRef; funcRef = other.funcRef;
} }
~cFactor(void) { ~cFactor(void) {
free(funcRefName); free(funcRefName);
}; };
bool multiplication; bool multiplication;
eFactorType type; eFactorType type;
double constValue; double constValue;
int tokenIndex; int tokenIndex;
char *funcRefName; char *funcRefName;
cFunction *funcRef; cFunction *funcRef;
}; };
class cSummand : public cListObject { class cSummand : public cListObject {
public: public:
cSummand(const char *summand); cSummand(const char *summand);
cSummand(const cSummand &other); cSummand(const cSummand &other);
~cSummand(void); ~cSummand(void);
void Debug(void); void Debug(void);
char *summand; char *summand;
bool positive; bool positive;
cList<cFactor> factors; cList<cFactor> factors;
}; };
class cNumericExpr { class cNumericExpr {
private: private:
cGlobals *globals; cGlobals *globals;
cRect *container; cRect *container;
skindesignerapi::cTokenContainer *tokenContainer; skindesignerapi::cTokenContainer *tokenContainer;
cLoopInfo *loopInfo; cLoopInfo *loopInfo;
char *expr; char *expr;
cList<cSummand> summands; cList<cSummand> summands;
bool horizontal; bool horizontal;
int value; int value;
bool dynamic; bool dynamic;
//common string functions //common string functions
bool IsNumeric(const char *e); bool IsNumeric(const char *e);
bool IsNumericExpression(const char *e); bool IsNumericExpression(const char *e);
bool PercentValue(const char *e); bool PercentValue(const char *e);
char *ReplacePercentValue(char *e); char *ReplacePercentValue(char *e);
char *ReplaceToken(char *e, const char* token, int value); char *ReplaceToken(char *e, const char* token, int value);
char *ReplaceTokens(char *e, const char* token, int value); char *ReplaceTokens(char *e, const char* token, int value);
//calculate numeric expressions //calculate numeric expressions
int EvaluateExpression(char *e); int EvaluateExpression(char *e);
double EvaluateExpressionDouble(char *e); double EvaluateExpressionDouble(char *e);
double ParseAtom(char*& e); double ParseAtom(char*& e);
double ParseFactors(char*& e); double ParseFactors(char*& e);
double ParseSummands(char*& e); double ParseSummands(char*& e);
//prepare expressions with tokens //prepare expressions with tokens
void CreateSummands(void); void CreateSummands(void);
void CreateFactors(void); void CreateFactors(void);
bool SetTokenFactor(cFactor *f, char *tokenName); bool SetTokenFactor(cFactor *f, char *tokenName);
bool SetReferenceFactor(cFactor *f, char *tokenName); bool SetReferenceFactor(cFactor *f, char *tokenName);
bool SetGeometryFactor(cFactor *f, char *tokenName); bool SetGeometryFactor(cFactor *f, char *tokenName);
void ConsolidateSummand(void); void ConsolidateSummand(void);
void ConsolidateFactors(void); void ConsolidateFactors(void);
public: public:
cNumericExpr(const char *expression); cNumericExpr(const char *expression);
cNumericExpr(const cNumericExpr &other); cNumericExpr(const cNumericExpr &other);
virtual ~cNumericExpr(void); virtual ~cNumericExpr(void);
void SetContainer(cRect *container) { this->container = container; }; void SetContainer(cRect *container) { this->container = container; };
void SetGlobals(cGlobals *globals) { this->globals = globals; }; void SetGlobals(cGlobals *globals) { this->globals = globals; };
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) { this->tokenContainer = tokenContainer; }; void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) { this->tokenContainer = tokenContainer; };
void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; }; void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; };
void SetVertical(void) { horizontal = false; }; void SetVertical(void) { horizontal = false; };
bool CacheStatic(void); bool CacheStatic(void);
void PrepareTokens(void); void PrepareTokens(void);
vector<cFactor*> GetRefFactors(void); vector<cFactor*> GetRefFactors(void);
int GetValue(void) { return value; }; int GetValue(void) { return value; };
bool Dynamic(void) { return dynamic; }; bool Dynamic(void) { return dynamic; };
int Calculate(void); int Calculate(void);
void Debug(void); void Debug(void);
}; };
/****************************************************************** /******************************************************************
* cColor * cColor
******************************************************************/ ******************************************************************/
class cColor { class cColor {
private: private:
cGlobals *globals; cGlobals *globals;
char *expr; char *expr;
tColor value; tColor value;
public: public:
cColor(const char *expression); cColor(const char *expression);
cColor(const cColor &other); cColor(const cColor &other);
virtual ~cColor(void); virtual ~cColor(void);
void SetGlobals(cGlobals *globals) { this->globals = globals; }; void SetGlobals(cGlobals *globals) { this->globals = globals; };
void Cache(void); void Cache(void);
tColor Color(void); tColor Color(void);
void Debug(void); void Debug(void);
}; };
/****************************************************************** /******************************************************************
* cTextExpr * cTextExpr
******************************************************************/ ******************************************************************/
enum class eTexttokenType { enum class eTexttokenType {
constant = 0, constant = 0,
stringtoken, stringtoken,
inttoken, inttoken,
looptoken, looptoken,
printftoken, printftoken,
condstringtoken, condstringtoken,
condinttoken, condinttoken,
}; };
enum class ePrintfVarType { enum class ePrintfVarType {
stringtoken, stringtoken,
inttoken, inttoken,
looptoken looptoken
}; };
struct sPrintfInfo { struct sPrintfInfo {
ePrintfVarType type; ePrintfVarType type;
int index; int index;
}; };
class cTextToken: public cListObject { class cTextToken: public cListObject {
public: public:
cTextToken(void) { cTextToken(void) {
type = eTexttokenType::constant; type = eTexttokenType::constant;
constValue = NULL; constValue = NULL;
printfExpr = NULL; printfExpr = NULL;
printfResult = NULL; printfResult = NULL;
tokenIndex = -1; tokenIndex = -1;
condStart = NULL; condStart = NULL;
condEnd = NULL; condEnd = NULL;
}; };
cTextToken(const cTextToken &other) { cTextToken(const cTextToken &other) {
type = other.type; type = other.type;
constValue = NULL; constValue = NULL;
if (other.constValue) if (other.constValue)
constValue = strdup(other.constValue); constValue = strdup(other.constValue);
printfExpr = NULL; printfExpr = NULL;
if (other.printfExpr) if (other.printfExpr)
printfExpr = strdup(other.printfExpr); printfExpr = strdup(other.printfExpr);
printfVarIndices = other.printfVarIndices; printfVarIndices = other.printfVarIndices;
printfResult = NULL; printfResult = NULL;
if (other.printfResult) if (other.printfResult)
printfResult = strdup(other.printfResult); printfResult = strdup(other.printfResult);
tokenIndex = other.tokenIndex; tokenIndex = other.tokenIndex;
condStart = NULL; condStart = NULL;
if (other.condStart) if (other.condStart)
condStart = strdup(other.condStart); condStart = strdup(other.condStart);
condEnd = NULL; condEnd = NULL;
if (other.condEnd) if (other.condEnd)
condEnd = strdup(other.condEnd); condEnd = strdup(other.condEnd);
}; };
~cTextToken(void) { ~cTextToken(void) {
free(constValue); free(constValue);
free(printfExpr); free(printfExpr);
}; };
eTexttokenType type; eTexttokenType type;
char *constValue; char *constValue;
int tokenIndex; int tokenIndex;
char *printfExpr; char *printfExpr;
vector<sPrintfInfo> printfVarIndices; vector<sPrintfInfo> printfVarIndices;
char *printfResult; char *printfResult;
char *condStart; char *condStart;
char *condEnd; char *condEnd;
}; };
class cTextExpr { class cTextExpr {
private: private:
cGlobals *globals; cGlobals *globals;
skindesignerapi::cTokenContainer *tokenContainer; skindesignerapi::cTokenContainer *tokenContainer;
cLoopInfo *loopInfo; cLoopInfo *loopInfo;
char *expr; char *expr;
cList<cTextToken> textTokens; cList<cTextToken> textTokens;
void Translate(void); void Translate(void);
void Tokenize(void); void Tokenize(void);
void PrepareTokens(void); void PrepareTokens(void);
bool CheckGlobals(cTextToken *t); bool CheckGlobals(cTextToken *t);
bool ParsePrintfToken(cTextToken *t); bool ParsePrintfToken(cTextToken *t);
void DeterminatePrintfToken(cTextToken *t); void DeterminatePrintfToken(cTextToken *t);
void ParseCondToken(cTextToken *t); void ParseCondToken(cTextToken *t);
char *CopyTextPart(char *start, char *stop, bool incLastChar= true); char *CopyTextPart(char *start, char *stop, bool incLastChar= true);
public: public:
cTextExpr(const char *expression); cTextExpr(const char *expression);
cTextExpr(const cTextExpr &other); cTextExpr(const cTextExpr &other);
virtual ~cTextExpr(void); virtual ~cTextExpr(void);
void SetGlobals(cGlobals *globals) { this->globals = globals; }; void SetGlobals(cGlobals *globals) { this->globals = globals; };
void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) { this->tokenContainer = tokenContainer; }; void SetTokenContainer(skindesignerapi::cTokenContainer *tokenContainer) { this->tokenContainer = tokenContainer; };
void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; }; void SetLoopInfo(cLoopInfo *loopInfo) { this->loopInfo = loopInfo; };
void CorrectImagePath(void); void CorrectImagePath(void);
void Cache(void); void Cache(void);
char *DeterminateText(void); char *DeterminateText(void);
void Debug(const char *exprName); void Debug(const char *exprName);
}; };
#endif //__COMPLEXTYPES_H #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 #ifndef __FUNCTIONS_H
#define __FUNCTIONS_H #define __FUNCTIONS_H
#include "functions.h" #include "functions.h"
class cFuncFill : public cFunction { class cFuncFill : public cFunction {
private: private:
void SetAttributesDefs(void); void SetAttributesDefs(void);
public: public:
cFuncFill(cArea *owner, int numAttributes); cFuncFill(cArea *owner, int numAttributes);
cFuncFill(const cFuncFill &other); cFuncFill(const cFuncFill &other);
virtual ~cFuncFill(void); virtual ~cFuncFill(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
}; };
class cFuncDrawRectangle : public cFunction { class cFuncDrawRectangle : public cFunction {
private: private:
void SetAttributesDefs(void); void SetAttributesDefs(void);
public: public:
cFuncDrawRectangle(cArea *owner, int numAttributes); cFuncDrawRectangle(cArea *owner, int numAttributes);
cFuncDrawRectangle(const cFuncDrawRectangle &other); cFuncDrawRectangle(const cFuncDrawRectangle &other);
virtual ~cFuncDrawRectangle(void); virtual ~cFuncDrawRectangle(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); 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; }; bool Blinking(void) { return GetValue((int)eDrawRectangleAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawRectangleAttribs::animfreq); }; int BlinkFreq(void) { return GetValue((int)eDrawRectangleAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawRectangleAttribs::align); }; int Align(void) { return GetValue((int)eDrawRectangleAttribs::align); };
int Valign(void) { return GetValue((int)eDrawRectangleAttribs::valign); }; int Valign(void) { return GetValue((int)eDrawRectangleAttribs::valign); };
}; };
class cFuncDrawEllipse : public cFunction { class cFuncDrawEllipse : public cFunction {
private: private:
void SetAttributesDefs(void); void SetAttributesDefs(void);
public: public:
cFuncDrawEllipse(cArea *owner, int numAttributes); cFuncDrawEllipse(cArea *owner, int numAttributes);
cFuncDrawEllipse(const cFuncDrawEllipse &other); cFuncDrawEllipse(const cFuncDrawEllipse &other);
virtual ~cFuncDrawEllipse(void); virtual ~cFuncDrawEllipse(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); 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; }; bool Blinking(void) { return GetValue((int)eDrawEllipseAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawEllipseAttribs::animfreq); }; int BlinkFreq(void) { return GetValue((int)eDrawEllipseAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawEllipseAttribs::align); }; int Align(void) { return GetValue((int)eDrawEllipseAttribs::align); };
int Valign(void) { return GetValue((int)eDrawEllipseAttribs::valign); }; int Valign(void) { return GetValue((int)eDrawEllipseAttribs::valign); };
}; };
class cFuncDrawSlope : public cFunction { class cFuncDrawSlope : public cFunction {
private: private:
void SetAttributesDefs(void); void SetAttributesDefs(void);
public: public:
cFuncDrawSlope(cArea *owner, int numAttributes); cFuncDrawSlope(cArea *owner, int numAttributes);
cFuncDrawSlope(const cFuncDrawSlope &other); cFuncDrawSlope(const cFuncDrawSlope &other);
virtual ~cFuncDrawSlope(void); virtual ~cFuncDrawSlope(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); 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; }; bool Blinking(void) { return GetValue((int)eDrawSlopeAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawSlopeAttribs::animfreq); }; int BlinkFreq(void) { return GetValue((int)eDrawSlopeAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawSlopeAttribs::align); }; int Align(void) { return GetValue((int)eDrawSlopeAttribs::align); };
int Valign(void) { return GetValue((int)eDrawSlopeAttribs::valign); }; int Valign(void) { return GetValue((int)eDrawSlopeAttribs::valign); };
}; };
class cTextDrawer { class cTextDrawer {
private: private:
static cMutex fontLock; static cMutex fontLock;
protected: protected:
const cFont *font; const cFont *font;
char *fontName; char *fontName;
int fontSize; int fontSize;
void CacheFont(cGlobals *globals, int size); void CacheFont(cGlobals *globals, int size);
void LoadFont(int size); void LoadFont(int size);
int TextWidth(const char *text); int TextWidth(const char *text);
int FontHeight(void); int FontHeight(void);
public: public:
cTextDrawer(void); cTextDrawer(void);
virtual ~cTextDrawer(void); virtual ~cTextDrawer(void);
}; };
class cFuncDrawText : public cFunction, public cTextDrawer { class cFuncDrawText : public cFunction, public cTextDrawer {
private: private:
cTextExpr *text; cTextExpr *text;
void SetAttributesDefs(void); void SetAttributesDefs(void);
char *Cut(char *expr, int width); char *Cut(char *expr, int width);
public: public:
cFuncDrawText(cArea *owner, int numAttributes); cFuncDrawText(cArea *owner, int numAttributes);
cFuncDrawText(const cFuncDrawText &other); cFuncDrawText(const cFuncDrawText &other);
virtual ~cFuncDrawText(void); virtual ~cFuncDrawText(void);
void SetLoopInfo(cLoopInfo *loopInfo); void SetLoopInfo(cLoopInfo *loopInfo);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer); void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void Cache(void); void Cache(void);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
int FuncX(void); int FuncX(void);
int FuncY(void); int FuncY(void);
int FuncWidth(void); int FuncWidth(void);
int FuncHeight(void); int FuncHeight(void);
int AvrgFontWidth(void); int AvrgFontWidth(void);
const cFont *GetFont(void); const cFont *GetFont(void);
bool Blinking(void) { return GetValue((int)eDrawTextAttribs::animtype) == (int)eAnimType::blink; }; bool Blinking(void) { return GetValue((int)eDrawTextAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawTextAttribs::animfreq); }; int BlinkFreq(void) { return GetValue((int)eDrawTextAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawTextAttribs::align); }; int Align(void) { return GetValue((int)eDrawTextAttribs::align); };
int Valign(void) { return GetValue((int)eDrawTextAttribs::valign); }; int Valign(void) { return GetValue((int)eDrawTextAttribs::valign); };
void Debug(void); void Debug(void);
}; };
class cFuncDrawTextVertical : public cFunction, public cTextDrawer { class cFuncDrawTextVertical : public cFunction, public cTextDrawer {
private: private:
cTextExpr *text; cTextExpr *text;
void SetAttributesDefs(void); void SetAttributesDefs(void);
public: public:
cFuncDrawTextVertical(cArea *owner, int numAttributes); cFuncDrawTextVertical(cArea *owner, int numAttributes);
cFuncDrawTextVertical(const cFuncDrawTextVertical &other); cFuncDrawTextVertical(const cFuncDrawTextVertical &other);
virtual ~cFuncDrawTextVertical(void); virtual ~cFuncDrawTextVertical(void);
void SetLoopInfo(cLoopInfo *loopInfo); void SetLoopInfo(cLoopInfo *loopInfo);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer); void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void Cache(void); void Cache(void);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
int FuncWidth(void); int FuncWidth(void);
int FuncHeight(void); int FuncHeight(void);
bool Blinking(void) { return GetValue((int)eDrawTextAttribsVertical::animtype) == (int)eAnimType::blink; }; bool Blinking(void) { return GetValue((int)eDrawTextAttribsVertical::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawTextAttribsVertical::animfreq); }; int BlinkFreq(void) { return GetValue((int)eDrawTextAttribsVertical::animfreq); };
int Align(void) { return GetValue((int)eDrawTextAttribsVertical::align); }; int Align(void) { return GetValue((int)eDrawTextAttribsVertical::align); };
int Valign(void) { return GetValue((int)eDrawTextAttribsVertical::valign); }; int Valign(void) { return GetValue((int)eDrawTextAttribsVertical::valign); };
void Debug(void); void Debug(void);
}; };
class cTextFloater; class cTextFloater;
class cFuncDrawTextBox : public cFunction, public cTextDrawer { class cFuncDrawTextBox : public cFunction, public cTextDrawer {
private: private:
cTextExpr *text; cTextExpr *text;
cTextFloater *floater; cTextFloater *floater;
void SetFloater(void); void SetFloater(void);
void SetAttributesDefs(void); void SetAttributesDefs(void);
void SetFloatMode(int id, const char *val); void SetFloatMode(int id, const char *val);
public: public:
cFuncDrawTextBox(cArea *owner, int numAttributes); cFuncDrawTextBox(cArea *owner, int numAttributes);
cFuncDrawTextBox(const cFuncDrawTextBox &other); cFuncDrawTextBox(const cFuncDrawTextBox &other);
virtual ~cFuncDrawTextBox(void); virtual ~cFuncDrawTextBox(void);
void SetLoopInfo(cLoopInfo *loopInfo); void SetLoopInfo(cLoopInfo *loopInfo);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer); void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void Cache(void); void Cache(void);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
int FuncWidth(void); int FuncWidth(void);
int FuncHeight(void); int FuncHeight(void);
void Debug(void); void Debug(void);
}; };
class cFuncDrawImage : public cFunction { class cFuncDrawImage : public cFunction {
private: private:
cTextExpr *path; cTextExpr *path;
void SetAttributesDefs(void); void SetAttributesDefs(void);
void SetImageType(int id, const char *val); void SetImageType(int id, const char *val);
void PreCacheImage(void); void PreCacheImage(void);
public: public:
cFuncDrawImage(cArea *owner, int numAttributes); cFuncDrawImage(cArea *owner, int numAttributes);
cFuncDrawImage(const cFuncDrawImage &other); cFuncDrawImage(const cFuncDrawImage &other);
virtual ~cFuncDrawImage(void); virtual ~cFuncDrawImage(void);
void SetLoopInfo(cLoopInfo *loopInfo); void SetLoopInfo(cLoopInfo *loopInfo);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer); void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void Cache(void); void Cache(void);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); 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; }; bool Blinking(void) { return GetValue((int)eDrawImageAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawImageAttribs::animfreq); }; int BlinkFreq(void) { return GetValue((int)eDrawImageAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawImageAttribs::align); }; int Align(void) { return GetValue((int)eDrawImageAttribs::align); };
int Valign(void) { return GetValue((int)eDrawImageAttribs::valign); }; int Valign(void) { return GetValue((int)eDrawImageAttribs::valign); };
void Debug(void); void Debug(void);
}; };
class cFuncLoop : public cFunction { class cFuncLoop : public cFunction {
private: private:
cLoopInfo loopInfo; cLoopInfo loopInfo;
cList<cFunction> functions; cList<cFunction> functions;
void SetAttributesDefs(void); void SetAttributesDefs(void);
int ColumnWidth(void); int ColumnWidth(void);
int RowHeight(void); int RowHeight(void);
public: public:
cFuncLoop(cArea *owner, int numAttributes); cFuncLoop(cArea *owner, int numAttributes);
virtual ~cFuncLoop(void); virtual ~cFuncLoop(void);
void Set(vector<stringpair> &attributes); void Set(vector<stringpair> &attributes);
void SetContainer(int x, int y, int width, int height); void SetContainer(int x, int y, int width, int height);
void Cache(void); void Cache(void);
void AddFunction(cFunction *f); void AddFunction(cFunction *f);
cFunction *GetFunction(const char *name); cFunction *GetFunction(const char *name);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
int FuncWidth(void); int FuncWidth(void);
int FuncHeight(void); int FuncHeight(void);
void Debug(void); void Debug(void);
}; };
class cTextFloater { class cTextFloater {
private: private:
char *text; char *text;
char *eol; char *eol;
int lines; int lines;
int lastLine; int lastLine;
public: public:
cTextFloater(void); cTextFloater(void);
cTextFloater(const char *text, const cFont *font, int width, int height = 0, int floatWidth = 0, int floatHeight = 0, int maxLines = 0); cTextFloater(const char *text, const cFont *font, int width, int height = 0, int floatWidth = 0, int floatHeight = 0, int maxLines = 0);
~cTextFloater(); ~cTextFloater();
void Set(const char *Text, const cFont *font, int width, int height = 0, int floatWidth = 0, int floatHeight = 0, int maxLines = 0); 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 ///< Wraps the Text to make it fit into the area defined by the given Width
///< when displayed with the given Font. ///< when displayed with the given Font.
///< Wrapping is done by inserting the necessary number of newline ///< Wrapping is done by inserting the necessary number of newline
///< characters into the string. ///< characters into the string.
///< if height is set, new lines are only set till height is reached ///< if height is set, new lines are only set till height is reached
///< if floatwidth and floatheight are set, the first lines (depending on ///< if floatwidth and floatheight are set, the first lines (depending on
///< size of floatheight) are set to floatwidth ///< size of floatheight) are set to floatwidth
const char *Text(void); const char *Text(void);
///< Returns the full wrapped text. ///< Returns the full wrapped text.
int Lines(void) { return lines; } int Lines(void) { return lines; }
///< Returns the actual number of lines needed to display the full wrapped text. ///< Returns the actual number of lines needed to display the full wrapped text.
const char *GetLine(int line); const char *GetLine(int line);
///< Returns the given Line. The first line is numbered 0. ///< Returns the given Line. The first line is numbered 0.
}; };
#endif //__FUNCTIONS_H #endif //__FUNCTIONS_H

View File

@ -1,57 +1,57 @@
#include "gridelement.h" #include "gridelement.h"
#include "../config.h" #include "../config.h"
cGridElement::cGridElement(void) { cGridElement::cGridElement(void) {
current = false; current = false;
indexCurrent = -1; indexCurrent = -1;
viewId = -1; viewId = -1;
plugId = -1; plugId = -1;
} }
cGridElement::cGridElement(const cGridElement &other) : cViewElement(other) { cGridElement::cGridElement(const cGridElement &other) : cViewElement(other) {
current = false; current = false;
viewId = other.viewId; viewId = other.viewId;
plugId = other.plugId; plugId = other.plugId;
tokenContainer = new skindesignerapi::cTokenContainer(*other.tokenContainer); tokenContainer = new skindesignerapi::cTokenContainer(*other.tokenContainer);
indexCurrent = other.indexCurrent; indexCurrent = other.indexCurrent;
InheritTokenContainerDeep(); InheritTokenContainerDeep();
} }
cGridElement::~cGridElement(void) { cGridElement::~cGridElement(void) {
} }
void cGridElement::SetTokenContainer(void) { void cGridElement::SetTokenContainer(void) {
skindesignerapi::cTokenContainer *tkGe = plgManager->GetTokenContainerGE(plugId, viewId, id); skindesignerapi::cTokenContainer *tkGe = plgManager->GetTokenContainerGE(plugId, viewId, id);
if (!tkGe) if (!tkGe)
return; return;
tokenContainer = new skindesignerapi::cTokenContainer(*tkGe); tokenContainer = new skindesignerapi::cTokenContainer(*tkGe);
indexCurrent = tokenContainer->GetNumDefinedIntTokens(); indexCurrent = tokenContainer->GetNumDefinedIntTokens();
tokenContainer->DefineIntToken("{current}", indexCurrent); tokenContainer->DefineIntToken("{current}", indexCurrent);
InheritTokenContainer(); InheritTokenContainer();
} }
void cGridElement::Set(skindesignerapi::cTokenContainer *tk) { void cGridElement::Set(skindesignerapi::cTokenContainer *tk) {
tokenContainer->Clear(); tokenContainer->Clear();
tokenContainer->SetTokens(tk); tokenContainer->SetTokens(tk);
SetDirty(); SetDirty();
} }
void cGridElement::SetCurrent(bool current) { void cGridElement::SetCurrent(bool current) {
this->current = current; this->current = current;
SetDirty(); SetDirty();
} }
bool cGridElement::Parse(bool forced) { bool cGridElement::Parse(bool forced) {
if (!dirty) if (!dirty)
return false; return false;
tokenContainer->AddIntToken(indexCurrent, current); tokenContainer->AddIntToken(indexCurrent, current);
return true; return true;
} }
int cGridElement::Width(void) { int cGridElement::Width(void) {
return container.Width(); return container.Width();
} }
int cGridElement::Height(void) { int cGridElement::Height(void) {
return container.Height(); return container.Height();
} }

View File

@ -1,27 +1,27 @@
#ifndef __GRIDELEMENT_H #ifndef __GRIDELEMENT_H
#define __GRIDELEMENT_H #define __GRIDELEMENT_H
#include "viewelement.h" #include "viewelement.h"
class cGridElement : public cViewElement { class cGridElement : public cViewElement {
private: private:
int viewId; int viewId;
int plugId; int plugId;
bool current; bool current;
int indexCurrent; int indexCurrent;
public: public:
cGridElement(void); cGridElement(void);
cGridElement(const cGridElement &other); cGridElement(const cGridElement &other);
virtual ~cGridElement(void); virtual ~cGridElement(void);
void SetPluginId(int plugId) { this->plugId = plugId; }; void SetPluginId(int plugId) { this->plugId = plugId; };
void SetViewId(int viewId) { this->viewId = viewId; }; void SetViewId(int viewId) { this->viewId = viewId; };
void SetTokenContainer(void); void SetTokenContainer(void);
skindesignerapi::cTokenContainer *GetTokenContainer(void) { return tokenContainer; }; skindesignerapi::cTokenContainer *GetTokenContainer(void) { return tokenContainer; };
void Set(skindesignerapi::cTokenContainer *tk); void Set(skindesignerapi::cTokenContainer *tk);
void SetCurrent(bool current); void SetCurrent(bool current);
bool Parse(bool forced = true); bool Parse(bool forced = true);
int Width(void); int Width(void);
int Height(void); int Height(void);
}; };
#endif //__GRIDELEMENT_H #endif //__GRIDELEMENT_H

File diff suppressed because it is too large Load Diff

View File

@ -1,340 +1,340 @@
#ifndef __LISTELEMENTS_H #ifndef __LISTELEMENTS_H
#define __LISTELEMENTS_H #define __LISTELEMENTS_H
#include "viewelement.h" #include "viewelement.h"
#include "../extensions/scrapmanager.h" #include "../extensions/scrapmanager.h"
#define MAX_TABS 6 #define MAX_TABS 6
/****************************************************************** /******************************************************************
* cListElement * cListElement
******************************************************************/ ******************************************************************/
class cListElement : public cViewElement { class cListElement : public cViewElement {
protected: protected:
eMenuCategory menuCat; eMenuCategory menuCat;
int num; int num;
bool current; bool current;
bool wasCurrent; bool wasCurrent;
bool selectable; bool selectable;
cViewElement *currentElement; cViewElement *currentElement;
char *ParseSeparator(const char *text); char *ParseSeparator(const char *text);
public: public:
cListElement(void); cListElement(void);
cListElement(const cListElement &other); cListElement(const cListElement &other);
virtual ~cListElement(void) {}; virtual ~cListElement(void) {};
void SetMenuCategory(eMenuCategory menuCat) { this->menuCat = menuCat; }; void SetMenuCategory(eMenuCategory menuCat) { this->menuCat = menuCat; };
void SetNumber(int number) { num = number; }; void SetNumber(int number) { num = number; };
void SetCurrent(bool cur); void SetCurrent(bool cur);
bool Current(void) { return current; }; bool Current(void) { return current; };
void WakeCurrent(void); void WakeCurrent(void);
void SetSelectable(bool sel) { selectable = sel; }; void SetSelectable(bool sel) { selectable = sel; };
bool DoScroll(void) { return current; }; bool DoScroll(void) { return current; };
virtual void RenderCurrent(void) { }; virtual void RenderCurrent(void) { };
void Close(void); void Close(void);
void Clear(void); void Clear(void);
}; };
/****************************************************************** /******************************************************************
* cCurrentElement * cCurrentElement
******************************************************************/ ******************************************************************/
class cCurrentElement : public cViewElement { class cCurrentElement : public cViewElement {
protected: protected:
int listX; int listX;
int listY; int listY;
int listWidth; int listWidth;
int listHeight; int listHeight;
public: public:
cCurrentElement(void); cCurrentElement(void);
virtual ~cCurrentElement(void) {}; virtual ~cCurrentElement(void) {};
void SetListPosition(int x, int y, int width, int height); void SetListPosition(int x, int y, int width, int height);
void SetListTokens(skindesignerapi::cTokenContainer *tokenContainer); void SetListTokens(skindesignerapi::cTokenContainer *tokenContainer);
}; };
/****************************************************************** /******************************************************************
* cLeMenuDefault * cLeMenuDefault
******************************************************************/ ******************************************************************/
class cLeMenuDefault : public cListElement { class cLeMenuDefault : public cListElement {
private: private:
char *text; char *text;
int *colX; int *colX;
int *colWidths; int *colWidths;
const char *plugName; const char *plugName;
const char *GetTabbedText(const char *s, int tab); const char *GetTabbedText(const char *s, int tab);
void SetMenuCategory(void); void SetMenuCategory(void);
void CheckProgressBar(const char *text, int tab); void CheckProgressBar(const char *text, int tab);
public: public:
cLeMenuDefault(void); cLeMenuDefault(void);
cLeMenuDefault(const cLeMenuDefault &other); cLeMenuDefault(const cLeMenuDefault &other);
virtual ~cLeMenuDefault(void); virtual ~cLeMenuDefault(void);
void SetListInfo(int *colX, int *colWidths); void SetListInfo(int *colX, int *colWidths);
void SetText(const char *text); void SetText(const char *text);
void SetPlugin(const char *plugName) { this->plugName = plugName; }; void SetPlugin(const char *plugName) { this->plugName = plugName; };
void SetTokenContainer(void); void SetTokenContainer(void);
bool Parse(bool forced = true); bool Parse(bool forced = true);
}; };
/****************************************************************** /******************************************************************
* cVeMenuMain * cVeMenuMain
******************************************************************/ ******************************************************************/
class cVeMenuMain { class cVeMenuMain {
protected: protected:
char *text; char *text;
char *number; char *number;
char *label; char *label;
void SplitText(void); void SplitText(void);
public: public:
cVeMenuMain(void); cVeMenuMain(void);
virtual ~cVeMenuMain(void); virtual ~cVeMenuMain(void);
void SetText(const char *text); void SetText(const char *text);
}; };
/****************************************************************** /******************************************************************
* cLeMenuMain * cLeMenuMain
******************************************************************/ ******************************************************************/
class cCeMenuMain; class cCeMenuMain;
class cLeMenuMain : public cListElement, public cVeMenuMain { class cLeMenuMain : public cListElement, public cVeMenuMain {
private: private:
cCeMenuMain *currentMain; cCeMenuMain *currentMain;
public: public:
cLeMenuMain(void); cLeMenuMain(void);
cLeMenuMain(const cLeMenuMain &other); cLeMenuMain(const cLeMenuMain &other);
virtual ~cLeMenuMain(void); virtual ~cLeMenuMain(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetCurrentElement(cCeMenuMain *cur) { currentMain = cur; currentElement = (cViewElement*)cur; }; void SetCurrentElement(cCeMenuMain *cur) { currentMain = cur; currentElement = (cViewElement*)cur; };
void ClearCurrentElement(void); void ClearCurrentElement(void);
void SetText(const char *text); void SetText(const char *text);
bool Parse(bool forced = true); bool Parse(bool forced = true);
void RenderCurrent(void); void RenderCurrent(void);
const char *PluginName(void); const char *PluginName(void);
}; };
/****************************************************************** /******************************************************************
* cCeMenuMain * cCeMenuMain
******************************************************************/ ******************************************************************/
class cCeMenuMain : public cCurrentElement, public cVeMenuMain { class cCeMenuMain : public cCurrentElement, public cVeMenuMain {
private: private:
public: public:
cCeMenuMain(void); cCeMenuMain(void);
virtual ~cCeMenuMain(void); virtual ~cCeMenuMain(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetText(const char *text); void SetText(const char *text);
bool Parse(bool forced = true); bool Parse(bool forced = true);
}; };
/****************************************************************** /******************************************************************
* cVeMenuSchedules * cVeMenuSchedules
******************************************************************/ ******************************************************************/
class cVeMenuSchedules { class cVeMenuSchedules {
protected: protected:
const cEvent *event; const cEvent *event;
const cChannel *channel; const cChannel *channel;
bool withDate; bool withDate;
eTimerMatch timerMatch; eTimerMatch timerMatch;
bool epgSearchFav; bool epgSearchFav;
public: public:
cVeMenuSchedules(void); cVeMenuSchedules(void);
virtual ~cVeMenuSchedules(void){}; virtual ~cVeMenuSchedules(void){};
void SetEpgSearchFav(bool isFav) { epgSearchFav = isFav; }; void SetEpgSearchFav(bool isFav) { epgSearchFav = isFav; };
}; };
/****************************************************************** /******************************************************************
* cLeMenuSchedules * cLeMenuSchedules
******************************************************************/ ******************************************************************/
class cCeMenuSchedules; class cCeMenuSchedules;
class cLeMenuSchedules : public cListElement, public cVeMenuSchedules { class cLeMenuSchedules : public cListElement, public cVeMenuSchedules {
private: private:
cCeMenuSchedules *currentSchedules; cCeMenuSchedules *currentSchedules;
public: public:
cLeMenuSchedules(void); cLeMenuSchedules(void);
cLeMenuSchedules(const cLeMenuSchedules &other); cLeMenuSchedules(const cLeMenuSchedules &other);
virtual ~cLeMenuSchedules(void); virtual ~cLeMenuSchedules(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetCurrentElement(cCeMenuSchedules *cur) { currentSchedules = cur; currentElement = (cViewElement*)cur; }; void SetCurrentElement(cCeMenuSchedules *cur) { currentSchedules = cur; currentElement = (cViewElement*)cur; };
void ClearCurrentElement(void); void ClearCurrentElement(void);
void Set(const cEvent *event, const cChannel *channel, bool withDate, eTimerMatch timerMatch); void Set(const cEvent *event, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
bool Parse(bool forced = true); bool Parse(bool forced = true);
void RenderCurrent(void); void RenderCurrent(void);
}; };
/****************************************************************** /******************************************************************
* cCeMenuSchedules * cCeMenuSchedules
******************************************************************/ ******************************************************************/
class cCeMenuSchedules : public cCurrentElement, public cVeMenuSchedules, public cScrapManager { class cCeMenuSchedules : public cCurrentElement, public cVeMenuSchedules, public cScrapManager {
private: private:
eMenuCategory menuCat; eMenuCategory menuCat;
int schedulesIndex; int schedulesIndex;
public: public:
cCeMenuSchedules(void); cCeMenuSchedules(void);
virtual ~cCeMenuSchedules(void); virtual ~cCeMenuSchedules(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void Set(const cEvent *event, const cChannel *channel, bool withDate, eTimerMatch timerMatch, eMenuCategory menuCat); void Set(const cEvent *event, const cChannel *channel, bool withDate, eTimerMatch timerMatch, eMenuCategory menuCat);
bool Parse(bool forced = true); bool Parse(bool forced = true);
}; };
/****************************************************************** /******************************************************************
* cLeMenuChannels * cLeMenuChannels
******************************************************************/ ******************************************************************/
class cCeMenuChannels; class cCeMenuChannels;
class cLeMenuChannels : public cListElement { class cLeMenuChannels : public cListElement {
private: private:
cCeMenuChannels *currentChannel; cCeMenuChannels *currentChannel;
const cChannel *channel; const cChannel *channel;
bool withProvider; bool withProvider;
public: public:
cLeMenuChannels(void); cLeMenuChannels(void);
cLeMenuChannels(const cLeMenuChannels &other); cLeMenuChannels(const cLeMenuChannels &other);
virtual ~cLeMenuChannels(void); virtual ~cLeMenuChannels(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetCurrentElement(cCeMenuChannels *cur) { currentChannel = cur; currentElement = (cViewElement*)cur; }; void SetCurrentElement(cCeMenuChannels *cur) { currentChannel = cur; currentElement = (cViewElement*)cur; };
void ClearCurrentElement(void); void ClearCurrentElement(void);
void Set(const cChannel *channel, bool withProvider); void Set(const cChannel *channel, bool withProvider);
bool Parse(bool forced = true); bool Parse(bool forced = true);
void RenderCurrent(void); void RenderCurrent(void);
}; };
/****************************************************************** /******************************************************************
* cCeMenuChannels * cCeMenuChannels
******************************************************************/ ******************************************************************/
class cCeMenuChannels : public cCurrentElement { class cCeMenuChannels : public cCurrentElement {
private: private:
const cChannel *channel; const cChannel *channel;
bool withProvider; bool withProvider;
int schedulesIndex; int schedulesIndex;
public: public:
cCeMenuChannels(void); cCeMenuChannels(void);
virtual ~cCeMenuChannels(void); virtual ~cCeMenuChannels(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void Set(const cChannel *channel, bool withProvider); void Set(const cChannel *channel, bool withProvider);
bool Parse(bool forced = true); bool Parse(bool forced = true);
}; };
/****************************************************************** /******************************************************************
* cLeMenuTimers * cLeMenuTimers
******************************************************************/ ******************************************************************/
class cCeMenuTimers; class cCeMenuTimers;
class cLeMenuTimers : public cListElement { class cLeMenuTimers : public cListElement {
private: private:
cCeMenuTimers *currentTimer; cCeMenuTimers *currentTimer;
const cTimer *timer; const cTimer *timer;
public: public:
cLeMenuTimers(void); cLeMenuTimers(void);
cLeMenuTimers(const cLeMenuTimers &other); cLeMenuTimers(const cLeMenuTimers &other);
virtual ~cLeMenuTimers(void); virtual ~cLeMenuTimers(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetCurrentElement(cCeMenuTimers *cur) { currentTimer = cur; currentElement = (cViewElement*)cur; }; void SetCurrentElement(cCeMenuTimers *cur) { currentTimer = cur; currentElement = (cViewElement*)cur; };
void ClearCurrentElement(void); void ClearCurrentElement(void);
void Set(const cTimer *timer); void Set(const cTimer *timer);
bool Parse(bool forced = true); bool Parse(bool forced = true);
void RenderCurrent(void); void RenderCurrent(void);
}; };
/****************************************************************** /******************************************************************
* cCeMenuTimers * cCeMenuTimers
******************************************************************/ ******************************************************************/
class cCeMenuTimers : public cCurrentElement { class cCeMenuTimers : public cCurrentElement {
private: private:
const cTimer *timer; const cTimer *timer;
public: public:
cCeMenuTimers(void); cCeMenuTimers(void);
virtual ~cCeMenuTimers(void); virtual ~cCeMenuTimers(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void Set(const cTimer *timer); void Set(const cTimer *timer);
bool Parse(bool forced = true); bool Parse(bool forced = true);
}; };
/****************************************************************** /******************************************************************
* cLeMenuRecordings * cLeMenuRecordings
******************************************************************/ ******************************************************************/
class cCeMenuRecordings; class cCeMenuRecordings;
class cLeMenuRecordings : public cListElement, public cScrapManager { class cLeMenuRecordings : public cListElement, public cScrapManager {
private: private:
cCeMenuRecordings *currentRecording; cCeMenuRecordings *currentRecording;
const cRecording *recording; const cRecording *recording;
int level; int level;
int total; int total;
int New; int New;
char *RecName(const char *path, int level); char *RecName(const char *path, int level);
char *FolderName(const char *path, int level); char *FolderName(const char *path, int level);
public: public:
cLeMenuRecordings(void); cLeMenuRecordings(void);
cLeMenuRecordings(const cLeMenuRecordings &other); cLeMenuRecordings(const cLeMenuRecordings &other);
virtual ~cLeMenuRecordings(void); virtual ~cLeMenuRecordings(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetCurrentElement(cCeMenuRecordings *cur) { currentRecording = cur; currentElement = (cViewElement*)cur; }; void SetCurrentElement(cCeMenuRecordings *cur) { currentRecording = cur; currentElement = (cViewElement*)cur; };
void ClearCurrentElement(void); void ClearCurrentElement(void);
void Set(const cRecording *recording, int level, int total, int New); void Set(const cRecording *recording, int level, int total, int New);
bool Parse(bool forced = true); bool Parse(bool forced = true);
void RenderCurrent(void); void RenderCurrent(void);
}; };
/****************************************************************** /******************************************************************
* cCeMenuRecordings * cCeMenuRecordings
******************************************************************/ ******************************************************************/
class cCeMenuRecordings : public cCurrentElement, public cScrapManager { class cCeMenuRecordings : public cCurrentElement, public cScrapManager {
private: private:
const cRecording *recording; const cRecording *recording;
int level; int level;
int total; int total;
int New; int New;
public: public:
cCeMenuRecordings(void); cCeMenuRecordings(void);
virtual ~cCeMenuRecordings(void); virtual ~cCeMenuRecordings(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void Set(const cRecording *recording, int level, int total, int New); void Set(const cRecording *recording, int level, int total, int New);
bool Parse(bool forced = true); bool Parse(bool forced = true);
}; };
/****************************************************************** /******************************************************************
* cLeMenuPlugin * cLeMenuPlugin
******************************************************************/ ******************************************************************/
class cCeMenuPlugin; class cCeMenuPlugin;
class cLeMenuPlugin : public cListElement { class cLeMenuPlugin : public cListElement {
private: private:
int plugId; int plugId;
int plugMenuId; int plugMenuId;
cCeMenuPlugin *currentPlugin; cCeMenuPlugin *currentPlugin;
public: public:
cLeMenuPlugin(void); cLeMenuPlugin(void);
cLeMenuPlugin(const cLeMenuPlugin &other); cLeMenuPlugin(const cLeMenuPlugin &other);
virtual ~cLeMenuPlugin(void); virtual ~cLeMenuPlugin(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetPlugId(int id) { plugId = id; }; void SetPlugId(int id) { plugId = id; };
void SetPlugMenuId(int id) { plugMenuId = id; }; void SetPlugMenuId(int id) { plugMenuId = id; };
void SetCurrentElement(cCeMenuPlugin *cur) { currentPlugin = cur; currentElement = (cViewElement*)cur; }; void SetCurrentElement(cCeMenuPlugin *cur) { currentPlugin = cur; currentElement = (cViewElement*)cur; };
void ClearCurrentElement(void); void ClearCurrentElement(void);
void Set(skindesignerapi::cTokenContainer *tk); void Set(skindesignerapi::cTokenContainer *tk);
bool Parse(bool forced = true); bool Parse(bool forced = true);
void RenderCurrent(void); void RenderCurrent(void);
}; };
/****************************************************************** /******************************************************************
* cCeMenuPlugin * cCeMenuPlugin
******************************************************************/ ******************************************************************/
class cCeMenuPlugin : public cCurrentElement { class cCeMenuPlugin : public cCurrentElement {
private: private:
int plugId; int plugId;
int plugMenuId; int plugMenuId;
public: public:
cCeMenuPlugin(void); cCeMenuPlugin(void);
virtual ~cCeMenuPlugin(void); virtual ~cCeMenuPlugin(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetPlugId(int id) { plugId = id; }; void SetPlugId(int id) { plugId = id; };
void SetPlugMenuId(int id) { plugMenuId = id; }; void SetPlugMenuId(int id) { plugMenuId = id; };
void Set(skindesignerapi::cTokenContainer *tk); void Set(skindesignerapi::cTokenContainer *tk);
bool Parse(bool forced = true); bool Parse(bool forced = true);
}; };
/****************************************************************** /******************************************************************
* cLeAudioTracks * cLeAudioTracks
******************************************************************/ ******************************************************************/
class cLeAudioTracks : public cListElement { class cLeAudioTracks : public cListElement {
private: private:
char *text; char *text;
public: public:
cLeAudioTracks(void); cLeAudioTracks(void);
virtual ~cLeAudioTracks(void); virtual ~cLeAudioTracks(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void Set(const char *text); void Set(const char *text);
bool Parse(bool forced = true); bool Parse(bool forced = true);
}; };
#endif //__LISTELEMENTS_H #endif //__LISTELEMENTS_H

View File

@ -1,71 +1,71 @@
#include "osdwrapper.h" #include "osdwrapper.h"
cSdOsd::cSdOsd(void) { cSdOsd::cSdOsd(void) {
osd = NULL; osd = NULL;
flushLocked = false; flushLocked = false;
} }
cSdOsd::~cSdOsd(void) { cSdOsd::~cSdOsd(void) {
DeleteOsd(); DeleteOsd();
} }
void cSdOsd::Lock(void) { void cSdOsd::Lock(void) {
mutex.Lock(); mutex.Lock();
} }
void cSdOsd::Unlock(void) { void cSdOsd::Unlock(void) {
mutex.Unlock(); mutex.Unlock();
} }
void cSdOsd::LockFlush(void) { void cSdOsd::LockFlush(void) {
Lock(); Lock();
flushLocked = true; flushLocked = true;
Unlock(); Unlock();
} }
void cSdOsd::UnlockFlush(void) { void cSdOsd::UnlockFlush(void) {
Lock(); Lock();
flushLocked = false; flushLocked = false;
Unlock(); Unlock();
} }
bool cSdOsd::CreateOsd(int x, int y, int width, int height) { bool cSdOsd::CreateOsd(int x, int y, int width, int height) {
cOsd *newOsd = cOsdProvider::NewOsd(cOsd::OsdLeft() + x, cOsd::OsdTop() + y); cOsd *newOsd = cOsdProvider::NewOsd(cOsd::OsdLeft() + x, cOsd::OsdTop() + y);
if (newOsd) { if (newOsd) {
tArea Area = { 0, 0, width - 1, height - 1, 32 }; tArea Area = { 0, 0, width - 1, height - 1, 32 };
if (newOsd->SetAreas(&Area, 1) == oeOk) { if (newOsd->SetAreas(&Area, 1) == oeOk) {
Lock(); Lock();
osd = newOsd; osd = newOsd;
Unlock(); Unlock();
return true; return true;
} }
} }
return false; return false;
} }
void cSdOsd::DeleteOsd(void) { void cSdOsd::DeleteOsd(void) {
Lock(); Lock();
delete osd; delete osd;
osd = NULL; osd = NULL;
Unlock(); Unlock();
} }
cPixmap *cSdOsd::CreatePixmap(int layer, cRect &viewPort, cRect &drawPort) { cPixmap *cSdOsd::CreatePixmap(int layer, cRect &viewPort, cRect &drawPort) {
if (osd) { if (osd) {
return osd->CreatePixmap(layer, viewPort, drawPort); return osd->CreatePixmap(layer, viewPort, drawPort);
} }
return NULL; return NULL;
} }
void cSdOsd::DestroyPixmap(cPixmap *pix) { void cSdOsd::DestroyPixmap(cPixmap *pix) {
if (osd) { if (osd) {
osd->DestroyPixmap(pix); osd->DestroyPixmap(pix);
} }
} }
void cSdOsd::Flush(void) { void cSdOsd::Flush(void) {
Lock(); Lock();
if (osd && !flushLocked) if (osd && !flushLocked)
osd->Flush(); osd->Flush();
Unlock(); Unlock();
} }

View File

@ -1,26 +1,26 @@
#ifndef __OSDWRAPPER_H #ifndef __OSDWRAPPER_H
#define __OSDWRAPPER_H #define __OSDWRAPPER_H
#include <vdr/osd.h> #include <vdr/osd.h>
#include <vdr/thread.h> #include <vdr/thread.h>
class cSdOsd { class cSdOsd {
private: private:
cOsd *osd; cOsd *osd;
cMutex mutex; cMutex mutex;
bool flushLocked; bool flushLocked;
public: public:
cSdOsd(void); cSdOsd(void);
virtual ~cSdOsd(void); virtual ~cSdOsd(void);
void Lock(void); void Lock(void);
void Unlock(void); void Unlock(void);
void LockFlush(void); void LockFlush(void);
void UnlockFlush(void); void UnlockFlush(void);
bool CreateOsd(int x, int y, int width, int height); bool CreateOsd(int x, int y, int width, int height);
void DeleteOsd(void); void DeleteOsd(void);
cPixmap *CreatePixmap(int layer, cRect &viewPort, cRect &drawPort); cPixmap *CreatePixmap(int layer, cRect &viewPort, cRect &drawPort);
void DestroyPixmap(cPixmap *pix); void DestroyPixmap(cPixmap *pix);
void Flush(void); void Flush(void);
}; };
#endif //__OSDWRAPPER_H #endif //__OSDWRAPPER_H

File diff suppressed because it is too large Load Diff

View File

@ -1,114 +1,114 @@
#ifndef __VIEWDETAIL_H #ifndef __VIEWDETAIL_H
#define __VIEWDETAIL_H #define __VIEWDETAIL_H
#include "../services/epgsearch.h" #include "../services/epgsearch.h"
#include "../extensions/scrapmanager.h" #include "../extensions/scrapmanager.h"
#include "viewelement.h" #include "viewelement.h"
/****************************************************************** /******************************************************************
* cViewDetail * cViewDetail
******************************************************************/ ******************************************************************/
class cViewDetail : public cViewElement, public cScrapManager { class cViewDetail : public cViewElement, public cScrapManager {
protected: protected:
int plugId; int plugId;
int plugMenuId; int plugMenuId;
cArea *activeTab; cArea *activeTab;
int activeTabIndex; int activeTabIndex;
int numTabs; int numTabs;
void SetActiveTab(void); void SetActiveTab(void);
public: public:
cViewDetail(void); cViewDetail(void);
virtual ~cViewDetail(void); virtual ~cViewDetail(void);
void SetPlugId(int id) { plugId = id; }; void SetPlugId(int id) { plugId = id; };
void SetPlugMenuId(int id) { plugMenuId = id; }; void SetPlugMenuId(int id) { plugMenuId = id; };
int GetWidth(void); int GetWidth(void);
void ResetTabs(void); void ResetTabs(void);
void Clear(void); void Clear(void);
void Close(void); void Close(void);
void Render(void); void Render(void);
void Scrollbar(int &barheight, int &offset, bool &end); void Scrollbar(int &barheight, int &offset, bool &end);
bool ScrollUp(bool page = false); bool ScrollUp(bool page = false);
bool ScrollDown(bool page = false); bool ScrollDown(bool page = false);
int GetTabs(vector<const char*> &tabs); int GetTabs(vector<const char*> &tabs);
int NumTabs(void) { return numTabs; }; int NumTabs(void) { return numTabs; };
int ActiveTab(void) { return activeTabIndex; }; int ActiveTab(void) { return activeTabIndex; };
void NextTab(void); void NextTab(void);
void PrevTab(void); void PrevTab(void);
void SetTransparency(int transparency, bool forceDetached = false); void SetTransparency(int transparency, bool forceDetached = false);
}; };
/****************************************************************** /******************************************************************
* cViewDetailEpg * cViewDetailEpg
******************************************************************/ ******************************************************************/
class cViewDetailEpg : public cViewDetail { class cViewDetailEpg : public cViewDetail {
protected: protected:
const cEvent *event; const cEvent *event;
int rerunsIndex; int rerunsIndex;
int actorsIndex; int actorsIndex;
cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *LoadReruns(void); cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *LoadReruns(void);
int NumReruns(cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *reruns); int NumReruns(cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *reruns);
void SetReruns(cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *reruns); void SetReruns(cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *reruns);
public: public:
cViewDetailEpg(void); cViewDetailEpg(void);
virtual ~cViewDetailEpg(void); virtual ~cViewDetailEpg(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetEvent(const cEvent *event) { this->event = event; }; void SetEvent(const cEvent *event) { this->event = event; };
bool Parse(bool forced = false); bool Parse(bool forced = false);
}; };
/****************************************************************** /******************************************************************
* cViewDetailRec * cViewDetailRec
******************************************************************/ ******************************************************************/
class cViewDetailRec : public cViewDetail { class cViewDetailRec : public cViewDetail {
protected: protected:
const cRecording *recording; const cRecording *recording;
int actorsIndex; int actorsIndex;
void SetRecInfos(void); void SetRecInfos(void);
int ReadSizeVdr(const char *strPath); int ReadSizeVdr(const char *strPath);
string StripXmlTag(string &Line, const char *Tag); string StripXmlTag(string &Line, const char *Tag);
void SetRecordingImages(const char *recPath); void SetRecordingImages(const char *recPath);
public: public:
cViewDetailRec(void); cViewDetailRec(void);
virtual ~cViewDetailRec(void); virtual ~cViewDetailRec(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetRecording(const cRecording *recording) { this->recording = recording; }; void SetRecording(const cRecording *recording) { this->recording = recording; };
bool Parse(bool forced = false); bool Parse(bool forced = false);
}; };
/****************************************************************** /******************************************************************
* cViewDetailText * cViewDetailText
******************************************************************/ ******************************************************************/
class cViewDetailText : public cViewDetail { class cViewDetailText : public cViewDetail {
protected: protected:
const char *text; const char *text;
public: public:
cViewDetailText(void); cViewDetailText(void);
virtual ~cViewDetailText(void); virtual ~cViewDetailText(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void SetText(const char *text) { this->text = text; }; void SetText(const char *text) { this->text = text; };
bool Parse(bool forced = false); bool Parse(bool forced = false);
}; };
/****************************************************************** /******************************************************************
* cViewDetailPlugin * cViewDetailPlugin
******************************************************************/ ******************************************************************/
class cViewDetailPlugin : public cViewDetail { class cViewDetailPlugin : public cViewDetail {
protected: protected:
public: public:
cViewDetailPlugin(void); cViewDetailPlugin(void);
virtual ~cViewDetailPlugin(void); virtual ~cViewDetailPlugin(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void Set(skindesignerapi::cTokenContainer *tk); void Set(skindesignerapi::cTokenContainer *tk);
bool Parse(bool forced = false); bool Parse(bool forced = false);
}; };
/****************************************************************** /******************************************************************
* cViewDetailAdvancedPlugin * cViewDetailAdvancedPlugin
******************************************************************/ ******************************************************************/
class cViewDetailAdvancedPlugin : public cViewDetail { class cViewDetailAdvancedPlugin : public cViewDetail {
protected: protected:
int plugViewId; int plugViewId;
public: public:
cViewDetailAdvancedPlugin(int viewId, int plugId); cViewDetailAdvancedPlugin(int viewId, int plugId);
virtual ~cViewDetailAdvancedPlugin(void); virtual ~cViewDetailAdvancedPlugin(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void Set(skindesignerapi::cTokenContainer *tk); void Set(skindesignerapi::cTokenContainer *tk);
bool Parse(bool forced = false); bool Parse(bool forced = false);
}; };
#endif //__VIEWDETAIL_H #endif //__VIEWDETAIL_H

View File

@ -1,199 +1,199 @@
#include "viewdisplaychannel.h" #include "viewdisplaychannel.h"
#include "../config.h" #include "../config.h"
/************************************************************************************ /************************************************************************************
* cViewChannel * cViewChannel
************************************************************************************/ ************************************************************************************/
cViewChannel::cViewChannel(void) { cViewChannel::cViewChannel(void) {
veCustomTokens = NULL; veCustomTokens = NULL;
ClearVariables(); ClearVariables();
viewId = eViewType::DisplayChannel; viewId = eViewType::DisplayChannel;
viewName = strdup("displaychannel"); viewName = strdup("displaychannel");
numViewElements = (int)eVeDisplayChannel::count; numViewElements = (int)eVeDisplayChannel::count;
viewElements = new cViewElement*[numViewElements]; viewElements = new cViewElement*[numViewElements];
for (int i=0; i < numViewElements; i++) { for (int i=0; i < numViewElements; i++) {
viewElements[i] = NULL; viewElements[i] = NULL;
} }
SetViewElements(); SetViewElements();
veMessage = NULL; veMessage = NULL;
veChannelInfo = NULL; veChannelInfo = NULL;
veChannelGroup = NULL; veChannelGroup = NULL;
veEpgInfo = NULL; veEpgInfo = NULL;
veProgressBar = NULL; veProgressBar = NULL;
veStatusInfo = NULL; veStatusInfo = NULL;
veScraperContent = NULL; veScraperContent = NULL;
veEcmInfo = NULL; veEcmInfo = NULL;
} }
cViewChannel::~cViewChannel() { cViewChannel::~cViewChannel() {
} }
void cViewChannel::SetViewElements(void) { void cViewChannel::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayChannel::background)); viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayChannel::background));
viewElementNames.insert(pair<string, int>("channelgroup", (int)eVeDisplayChannel::channelgroup)); viewElementNames.insert(pair<string, int>("channelgroup", (int)eVeDisplayChannel::channelgroup));
viewElementNames.insert(pair<string, int>("channelinfo", (int)eVeDisplayChannel::channelinfo)); viewElementNames.insert(pair<string, int>("channelinfo", (int)eVeDisplayChannel::channelinfo));
viewElementNames.insert(pair<string, int>("epginfo", (int)eVeDisplayChannel::epginfo)); viewElementNames.insert(pair<string, int>("epginfo", (int)eVeDisplayChannel::epginfo));
viewElementNames.insert(pair<string, int>("progressbar", (int)eVeDisplayChannel::progressbar)); viewElementNames.insert(pair<string, int>("progressbar", (int)eVeDisplayChannel::progressbar));
viewElementNames.insert(pair<string, int>("statusinfo", (int)eVeDisplayChannel::statusinfo)); viewElementNames.insert(pair<string, int>("statusinfo", (int)eVeDisplayChannel::statusinfo));
viewElementNames.insert(pair<string, int>("audioinfo", (int)eVeDisplayChannel::audioinfo)); viewElementNames.insert(pair<string, int>("audioinfo", (int)eVeDisplayChannel::audioinfo));
viewElementNames.insert(pair<string, int>("ecminfo", (int)eVeDisplayChannel::ecminfo)); viewElementNames.insert(pair<string, int>("ecminfo", (int)eVeDisplayChannel::ecminfo));
viewElementNames.insert(pair<string, int>("screenresolution", (int)eVeDisplayChannel::screenresolution)); viewElementNames.insert(pair<string, int>("screenresolution", (int)eVeDisplayChannel::screenresolution));
viewElementNames.insert(pair<string, int>("signalquality", (int)eVeDisplayChannel::signalquality)); viewElementNames.insert(pair<string, int>("signalquality", (int)eVeDisplayChannel::signalquality));
viewElementNames.insert(pair<string, int>("devices", (int)eVeDisplayChannel::devices)); viewElementNames.insert(pair<string, int>("devices", (int)eVeDisplayChannel::devices));
viewElementNames.insert(pair<string, int>("currentweather", (int)eVeDisplayChannel::currentweather)); viewElementNames.insert(pair<string, int>("currentweather", (int)eVeDisplayChannel::currentweather));
viewElementNames.insert(pair<string, int>("scrapercontent", (int)eVeDisplayChannel::scrapercontent)); viewElementNames.insert(pair<string, int>("scrapercontent", (int)eVeDisplayChannel::scrapercontent));
viewElementNames.insert(pair<string, int>("datetime", (int)eVeDisplayChannel::datetime)); viewElementNames.insert(pair<string, int>("datetime", (int)eVeDisplayChannel::datetime));
viewElementNames.insert(pair<string, int>("time", (int)eVeDisplayChannel::time)); viewElementNames.insert(pair<string, int>("time", (int)eVeDisplayChannel::time));
viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayChannel::message)); viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayChannel::message));
viewElementNames.insert(pair<string, int>("customtokens", (int)eVeDisplayChannel::customtokens)); viewElementNames.insert(pair<string, int>("customtokens", (int)eVeDisplayChannel::customtokens));
} }
void cViewChannel::SetViewElementObjects(void) { void cViewChannel::SetViewElementObjects(void) {
for (int i = 0; i < numViewElements; i++) { for (int i = 0; i < numViewElements; i++) {
if (!viewElements[i]) if (!viewElements[i])
continue; continue;
if (dynamic_cast<cVeMessage*>(viewElements[i])) if (dynamic_cast<cVeMessage*>(viewElements[i]))
{ {
veMessage = dynamic_cast<cVeMessage*>(viewElements[i]); veMessage = dynamic_cast<cVeMessage*>(viewElements[i]);
} }
else if (dynamic_cast<cVeDcChannelInfo*>(viewElements[i])) { else if (dynamic_cast<cVeDcChannelInfo*>(viewElements[i])) {
veChannelInfo = dynamic_cast<cVeDcChannelInfo*>(viewElements[i]); veChannelInfo = dynamic_cast<cVeDcChannelInfo*>(viewElements[i]);
} }
else if (dynamic_cast<cVeDcChannelGroup*>(viewElements[i])) else if (dynamic_cast<cVeDcChannelGroup*>(viewElements[i]))
{ {
veChannelGroup = dynamic_cast<cVeDcChannelGroup*>(viewElements[i]); veChannelGroup = dynamic_cast<cVeDcChannelGroup*>(viewElements[i]);
} }
else if (dynamic_cast<cVeDcEpgInfo*>(viewElements[i])) else if (dynamic_cast<cVeDcEpgInfo*>(viewElements[i]))
{ {
veEpgInfo = dynamic_cast<cVeDcEpgInfo*>(viewElements[i]); veEpgInfo = dynamic_cast<cVeDcEpgInfo*>(viewElements[i]);
} }
else if (dynamic_cast<cVeDcProgressBar*>(viewElements[i])) else if (dynamic_cast<cVeDcProgressBar*>(viewElements[i]))
{ {
veProgressBar = dynamic_cast<cVeDcProgressBar*>(viewElements[i]); veProgressBar = dynamic_cast<cVeDcProgressBar*>(viewElements[i]);
} }
else if (dynamic_cast<cVeDcStatusInfo*>(viewElements[i])) else if (dynamic_cast<cVeDcStatusInfo*>(viewElements[i]))
{ {
veStatusInfo = dynamic_cast<cVeDcStatusInfo*>(viewElements[i]); veStatusInfo = dynamic_cast<cVeDcStatusInfo*>(viewElements[i]);
} }
else if (dynamic_cast<cVeDcScraperContent*>(viewElements[i])) else if (dynamic_cast<cVeDcScraperContent*>(viewElements[i]))
{ {
veScraperContent = dynamic_cast<cVeDcScraperContent*>(viewElements[i]); veScraperContent = dynamic_cast<cVeDcScraperContent*>(viewElements[i]);
} }
else if (dynamic_cast<cVeDcEcmInfo*>(viewElements[i])) else if (dynamic_cast<cVeDcEcmInfo*>(viewElements[i]))
{ {
veEcmInfo = dynamic_cast<cVeDcEcmInfo*>(viewElements[i]); veEcmInfo = dynamic_cast<cVeDcEcmInfo*>(viewElements[i]);
} }
else if (dynamic_cast<cVeCustomTokens*>(viewElements[i])) else if (dynamic_cast<cVeCustomTokens*>(viewElements[i]))
{ {
veCustomTokens = dynamic_cast<cVeCustomTokens*>(viewElements[i]); veCustomTokens = dynamic_cast<cVeCustomTokens*>(viewElements[i]);
} }
else if (dynamic_cast<cVeDevices*>(viewElements[i])) else if (dynamic_cast<cVeDevices*>(viewElements[i]))
{ {
viewElements[i]->SetDetached(); viewElements[i]->SetDetached();
} }
} }
} }
void cViewChannel::ClearVariables(void) { void cViewChannel::ClearVariables(void) {
cView::ClearVariables(); cView::ClearVariables();
channelChange = false; channelChange = false;
displayChannelGroups = false; displayChannelGroups = false;
if (veCustomTokens) if (veCustomTokens)
veCustomTokens->Reset(); veCustomTokens->Reset();
} }
void cViewChannel::SetChannel(const cChannel *channel, int number) { void cViewChannel::SetChannel(const cChannel *channel, int number) {
channelChange = true; channelChange = true;
bool wasChannelGroups = displayChannelGroups; bool wasChannelGroups = displayChannelGroups;
displayChannelGroups = false; displayChannelGroups = false;
if (veChannelInfo) { if (veChannelInfo) {
veChannelInfo->Set(channel, number); veChannelInfo->Set(channel, number);
} }
if (channel) { if (channel) {
if (!channel->GroupSep()) { if (!channel->GroupSep()) {
if (wasChannelGroups) if (wasChannelGroups)
Clear((int)eVeDisplayChannel::channelgroup); Clear((int)eVeDisplayChannel::channelgroup);
if (veStatusInfo) if (veStatusInfo)
veStatusInfo->Set(channel); veStatusInfo->Set(channel);
if (veEcmInfo) if (veEcmInfo)
veEcmInfo->Set(channel); veEcmInfo->Set(channel);
} else { } else {
displayChannelGroups = true; displayChannelGroups = true;
Clear((int)eVeDisplayChannel::channelinfo); Clear((int)eVeDisplayChannel::channelinfo);
Clear((int)eVeDisplayChannel::epginfo); Clear((int)eVeDisplayChannel::epginfo);
Clear((int)eVeDisplayChannel::statusinfo); Clear((int)eVeDisplayChannel::statusinfo);
Clear((int)eVeDisplayChannel::progressbar); Clear((int)eVeDisplayChannel::progressbar);
Clear((int)eVeDisplayChannel::screenresolution); Clear((int)eVeDisplayChannel::screenresolution);
Clear((int)eVeDisplayChannel::signalquality); Clear((int)eVeDisplayChannel::signalquality);
Clear((int)eVeDisplayChannel::audioinfo); Clear((int)eVeDisplayChannel::audioinfo);
Clear((int)eVeDisplayChannel::ecminfo); Clear((int)eVeDisplayChannel::ecminfo);
Clear((int)eVeDisplayChannel::devices); Clear((int)eVeDisplayChannel::devices);
Clear((int)eVeDisplayChannel::customtokens); Clear((int)eVeDisplayChannel::customtokens);
if (veChannelGroup) if (veChannelGroup)
veChannelGroup->Set(channel); veChannelGroup->Set(channel);
} }
} }
} }
void cViewChannel::SetEvents(const cEvent *present, const cEvent *following) { void cViewChannel::SetEvents(const cEvent *present, const cEvent *following) {
Clear((int)eVeDisplayChannel::epginfo); Clear((int)eVeDisplayChannel::epginfo);
Clear((int)eVeDisplayChannel::progressbar); Clear((int)eVeDisplayChannel::progressbar);
Clear((int)eVeDisplayChannel::scrapercontent); Clear((int)eVeDisplayChannel::scrapercontent);
if (veProgressBar) if (veProgressBar)
veProgressBar->Set(present); veProgressBar->Set(present);
if (!present && !following) if (!present && !following)
return; return;
if (veEpgInfo) if (veEpgInfo)
veEpgInfo->Set(present, following); veEpgInfo->Set(present, following);
if (veScraperContent) if (veScraperContent)
veScraperContent->Set(present); veScraperContent->Set(present);
} }
void cViewChannel::SetMessage(eMessageType type, const char *text) { void cViewChannel::SetMessage(eMessageType type, const char *text) {
if (veMessage) { if (veMessage) {
if (text) if (text)
veMessage->Set(type, text); veMessage->Set(type, text);
else else
veMessage->Clear(); veMessage->Clear();
} }
} }
void cViewChannel::Flush(void) { void cViewChannel::Flush(void) {
if (init) { if (init) {
sdOsd.LockFlush(); sdOsd.LockFlush();
Render((int)eVeDisplayChannel::background); Render((int)eVeDisplayChannel::background);
Render((int)eVeDisplayChannel::progressbar); Render((int)eVeDisplayChannel::progressbar);
Render((int)eVeDisplayChannel::currentweather); Render((int)eVeDisplayChannel::currentweather);
} }
if (!displayChannelGroups) { if (!displayChannelGroups) {
//normal display //normal display
Render((int)eVeDisplayChannel::channelinfo); Render((int)eVeDisplayChannel::channelinfo);
Render((int)eVeDisplayChannel::epginfo); Render((int)eVeDisplayChannel::epginfo);
Render((int)eVeDisplayChannel::statusinfo); Render((int)eVeDisplayChannel::statusinfo);
Render((int)eVeDisplayChannel::scrapercontent); Render((int)eVeDisplayChannel::scrapercontent);
Render((int)eVeDisplayChannel::progressbar, channelChange); Render((int)eVeDisplayChannel::progressbar, channelChange);
Render((int)eVeDisplayChannel::screenresolution); Render((int)eVeDisplayChannel::screenresolution);
Render((int)eVeDisplayChannel::signalquality); Render((int)eVeDisplayChannel::signalquality);
Render((int)eVeDisplayChannel::audioinfo); Render((int)eVeDisplayChannel::audioinfo);
Render((int)eVeDisplayChannel::ecminfo); Render((int)eVeDisplayChannel::ecminfo);
Render((int)eVeDisplayChannel::devices); Render((int)eVeDisplayChannel::devices);
Render((int)eVeDisplayChannel::customtokens); Render((int)eVeDisplayChannel::customtokens);
Render((int)eVeDisplayChannel::message); Render((int)eVeDisplayChannel::message);
} else { } else {
//channelgroup display //channelgroup display
Render((int)eVeDisplayChannel::channelgroup); Render((int)eVeDisplayChannel::channelgroup);
} }
Render((int)eVeDisplayChannel::datetime); Render((int)eVeDisplayChannel::datetime);
Render((int)eVeDisplayChannel::time); Render((int)eVeDisplayChannel::time);
channelChange = false; channelChange = false;
cView::Flush(); cView::Flush();
} }

View File

@ -1,31 +1,31 @@
#ifndef __VIEWDISPLAYCHANNEL_H #ifndef __VIEWDISPLAYCHANNEL_H
#define __VIEWDISPLAYCHANNEL_H #define __VIEWDISPLAYCHANNEL_H
#include "view.h" #include "view.h"
class cViewChannel : public cView { class cViewChannel : public cView {
private: private:
cVeMessage *veMessage; cVeMessage *veMessage;
cVeCustomTokens *veCustomTokens; cVeCustomTokens *veCustomTokens;
cVeDcChannelInfo *veChannelInfo; cVeDcChannelInfo *veChannelInfo;
cVeDcChannelGroup *veChannelGroup; cVeDcChannelGroup *veChannelGroup;
cVeDcEpgInfo *veEpgInfo; cVeDcEpgInfo *veEpgInfo;
cVeDcProgressBar *veProgressBar; cVeDcProgressBar *veProgressBar;
cVeDcStatusInfo *veStatusInfo; cVeDcStatusInfo *veStatusInfo;
cVeDcScraperContent *veScraperContent; cVeDcScraperContent *veScraperContent;
cVeDcEcmInfo *veEcmInfo; cVeDcEcmInfo *veEcmInfo;
bool channelChange; bool channelChange;
bool displayChannelGroups; bool displayChannelGroups;
void SetViewElements(void); void SetViewElements(void);
void ClearVariables(void); void ClearVariables(void);
void SetViewElementObjects(void); void SetViewElementObjects(void);
public: public:
cViewChannel(void); cViewChannel(void);
virtual ~cViewChannel(void); virtual ~cViewChannel(void);
void SetChannel(const cChannel *channel, int number); void SetChannel(const cChannel *channel, int number);
void SetEvents(const cEvent *present, const cEvent *following); void SetEvents(const cEvent *present, const cEvent *following);
void SetMessage(eMessageType type, const char *text); void SetMessage(eMessageType type, const char *text);
void Flush(void); void Flush(void);
}; };
#endif //__VIEWDISPLAYCHANNEL_H #endif //__VIEWDISPLAYCHANNEL_H

File diff suppressed because it is too large Load Diff

View File

@ -1,325 +1,325 @@
#ifndef __VIEWDISPLAYMENU_H #ifndef __VIEWDISPLAYMENU_H
#define __VIEWDISPLAYMENU_H #define __VIEWDISPLAYMENU_H
#include "view.h" #include "view.h"
#include "viewdetail.h" #include "viewdetail.h"
#if defined(APIVERSNUM) && APIVERSNUM < 20301 #if defined(APIVERSNUM) && APIVERSNUM < 20301
#ifndef MENU_ORIENTATION_DEFINED #ifndef MENU_ORIENTATION_DEFINED
enum eMenuOrientation { enum eMenuOrientation {
moVertical = 0, moVertical = 0,
moHorizontal moHorizontal
}; };
#endif #endif
#endif #endif
/*********************************************************** /***********************************************************
* cViewMenu * cViewMenu
***********************************************************/ ***********************************************************/
class cSubView; class cSubView;
class cViewMenuDefault; class cViewMenuDefault;
class cViewMenuMain; class cViewMenuMain;
class cViewMenuSetup; class cViewMenuSetup;
class cViewMenuSchedules; class cViewMenuSchedules;
class cViewMenuChannels; class cViewMenuChannels;
class cViewMenuTimers; class cViewMenuTimers;
class cViewMenuRecordings; class cViewMenuRecordings;
class cViewMenuDetail; class cViewMenuDetail;
class cViewMenu : public cView { class cViewMenu : public cView {
protected: protected:
map<string,int> subviewNames; map<string,int> subviewNames;
cSubView **subViews; cSubView **subViews;
int numSubviews; int numSubviews;
cSubView *activeSubview; cSubView *activeSubview;
cSubView *activeSubviewLast; cSubView *activeSubviewLast;
cViewMenuDefault *menuDefault; cViewMenuDefault *menuDefault;
cViewMenuMain *menuMain; cViewMenuMain *menuMain;
cViewMenuSetup *menuSetup; cViewMenuSetup *menuSetup;
cViewMenuSchedules *menuSchedules; cViewMenuSchedules *menuSchedules;
cViewMenuChannels *menuChannels; cViewMenuChannels *menuChannels;
cViewMenuTimers *menuTimers; cViewMenuTimers *menuTimers;
cViewMenuRecordings *menuRecordings; cViewMenuRecordings *menuRecordings;
cViewMenuDetail *menuDetailedEpg; cViewMenuDetail *menuDetailedEpg;
cViewMenuDetail *menuDetailedRec; cViewMenuDetail *menuDetailedRec;
cViewMenuDetail *menuDetailedText; cViewMenuDetail *menuDetailedText;
eMenuCategory menuCat; eMenuCategory menuCat;
//name of current plugin for menu icon //name of current plugin for menu icon
const char *plugName; const char *plugName;
//external plugin menus //external plugin menus
bool pluginIdSet; bool pluginIdSet;
int plugId; int plugId;
int plugMenuId; int plugMenuId;
//status variables //status variables
bool menuChange; bool menuChange;
bool listChange; bool listChange;
bool detailViewInit; bool detailViewInit;
void SetViewElements(void); void SetViewElements(void);
void SetViewElementObjects(void); void SetViewElementObjects(void);
void SetSubViews(void); void SetSubViews(void);
void ClearVariables(void); void ClearVariables(void);
int SubviewId(const char *name); int SubviewId(const char *name);
bool SetPluginSubView(eMenuCategory menuCat); bool SetPluginSubView(eMenuCategory menuCat);
void WakeViewElements(void); void WakeViewElements(void);
public: public:
cViewMenu(void); cViewMenu(void);
virtual ~cViewMenu(void); virtual ~cViewMenu(void);
void SetGlobals(cGlobals *globals); void SetGlobals(cGlobals *globals);
void PreCache(void); void PreCache(void);
bool ValidSubView(const char *subView); bool ValidSubView(const char *subView);
static cSubView *CreateSubview(const char *name); static cSubView *CreateSubview(const char *name);
static cSubView *CreatePluginview(const char *plugname, int plugId, int menuNumber, int menuType); static cSubView *CreatePluginview(const char *plugname, int plugId, int menuNumber, int menuType);
void AddSubview(const char *sSubView, cSubView *subView); void AddSubview(const char *sSubView, cSubView *subView);
void AddPluginview(cSubView *plugView); void AddPluginview(cSubView *plugView);
void SetSubView(eMenuCategory MenuCat); void SetSubView(eMenuCategory MenuCat);
void SetSortMode(eMenuSortMode sortMode); void SetSortMode(eMenuSortMode sortMode);
void SetPluginMenu(int plugId, int plugMenuId); void SetPluginMenu(int plugId, int plugMenuId);
int NumListItems(void); int NumListItems(void);
eMenuOrientation MenuOrientation(void); eMenuOrientation MenuOrientation(void);
const cFont *GetTextAreaFont(void); const cFont *GetTextAreaFont(void);
int GetTextAreaWidth(void); int GetTextAreaWidth(void);
int GetListWidth(void); int GetListWidth(void);
void SetTitleHeader(const char *title); void SetTitleHeader(const char *title);
void SetChannelHeader(const cEvent *event); void SetChannelHeader(const cEvent *event);
void SetMessage(eMessageType type, const char *text); void SetMessage(eMessageType type, const char *text);
void SetMenuButtons(const char *red, const char *green, const char *yellow, const char *blue); void SetMenuButtons(const char *red, const char *green, const char *yellow, const char *blue);
void SetScrollbar(int total, int offset); void SetScrollbar(int total, int offset);
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5); void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
void SetItem(const char *text, int index, bool current, bool selectable); 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 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 SetItemTimer(const cTimer *timer, int index, bool current, bool selectable);
bool SetItemChannel(const cChannel *channel, int index, bool current, bool selectable, bool withProvider); 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 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); bool SetItemPlugin(skindesignerapi::cTokenContainer *tk, int index, bool current, bool selectable);
void SetEvent(const cEvent *event); void SetEvent(const cEvent *event);
void SetRecording(const cRecording *recording); void SetRecording(const cRecording *recording);
void SetText(const char *text); void SetText(const char *text);
bool SetPluginText(skindesignerapi::cTokenContainer *tk); bool SetPluginText(skindesignerapi::cTokenContainer *tk);
void SetCurrentRecording(const char *currentRec); void SetCurrentRecording(const char *currentRec);
void KeyDetailView(bool up, bool page); void KeyDetailView(bool up, bool page);
bool Init(void); bool Init(void);
void Close(void); void Close(void);
void Clear(void); void Clear(void);
void Flush(void); void Flush(void);
void SetTransparency(int transparency, bool forceDetached = false); void SetTransparency(int transparency, bool forceDetached = false);
void Debug(void); void Debug(void);
}; };
/*********************************************************** /***********************************************************
* cSubView * cSubView
***********************************************************/ ***********************************************************/
class cSubView : public cView { class cSubView : public cView {
protected: protected:
eMenuCategory menuCat; eMenuCategory menuCat;
int plugId; int plugId;
int plugMenuId; int plugMenuId;
cViewList *viewList; cViewList *viewList;
cViewList *viewListVertical; cViewList *viewListVertical;
cViewList *viewListHorizontal; cViewList *viewListHorizontal;
cViewElement *background; cViewElement *background;
cVeDmHeader *header; cVeDmHeader *header;
cVeDateTime *datetime; cVeDateTime *datetime;
cVeTime *time; cVeTime *time;
cVeMessage *message; cVeMessage *message;
cVeDmSortmode *sortmode; cVeDmSortmode *sortmode;
cVeDmColorbuttons *colorbuttons; cVeDmColorbuttons *colorbuttons;
cVeDmScrollbar *scrollbar; cVeDmScrollbar *scrollbar;
virtual void SetViewElementObjects(void); virtual void SetViewElementObjects(void);
virtual void SetViewElements(void); virtual void SetViewElements(void);
public: public:
cSubView(const char *name); cSubView(const char *name);
virtual ~cSubView(void); virtual ~cSubView(void);
virtual void SetGlobals(cGlobals *globals); virtual void SetGlobals(cGlobals *globals);
virtual void PreCache(void); virtual void PreCache(void);
bool ViewElementSet(int ve); bool ViewElementSet(int ve);
bool ViewElementHorizontalSet(int ve); bool ViewElementHorizontalSet(int ve);
void SetViewElement(eVeDisplayMenu ve, cViewElement *viewElement); void SetViewElement(eVeDisplayMenu ve, cViewElement *viewElement);
void SetViewElementHorizontal(eVeDisplayMenu ve, cViewElement *viewElement); void SetViewElementHorizontal(eVeDisplayMenu ve, cViewElement *viewElement);
void AddViewList(cViewList *viewList); void AddViewList(cViewList *viewList);
virtual void AddTab(cArea *tab) {}; virtual void AddTab(cArea *tab) {};
int NumListItems(void); int NumListItems(void);
eMenuOrientation MenuOrientation(void); eMenuOrientation MenuOrientation(void);
void SetMenuCategory(eMenuCategory menuCat) { this->menuCat = menuCat; }; void SetMenuCategory(eMenuCategory menuCat) { this->menuCat = menuCat; };
void SetPlugId(int id) { plugId = id; }; void SetPlugId(int id) { plugId = id; };
void SetPlugMenuId(int id) { plugMenuId = id; }; void SetPlugMenuId(int id) { plugMenuId = id; };
void SetTitle(const char *title); void SetTitle(const char *title);
void SetMessage(eMessageType type, const char *text); void SetMessage(eMessageType type, const char *text);
void SetChannel(const cChannel *channel); void SetChannel(const cChannel *channel);
void SetMenuButtons(const char *red, const char *green, const char *yellow, const char *blue); void SetMenuButtons(const char *red, const char *green, const char *yellow, const char *blue);
void SetScrollbar(int total, int offset); void SetScrollbar(int total, int offset);
void SetSortMode(eMenuSortMode sortMode); void SetSortMode(eMenuSortMode sortMode);
virtual void Close(void); virtual void Close(void);
virtual void Clear(void); virtual void Clear(void);
void ClearViewList(void); void ClearViewList(void);
void WakeViewElements(void); void WakeViewElements(void);
virtual void DrawStaticVEs(void); virtual void DrawStaticVEs(void);
virtual void DrawDynamicVEs(void); virtual void DrawDynamicVEs(void);
void DrawList(void); void DrawList(void);
virtual void DrawDetailedView(void) {}; virtual void DrawDetailedView(void) {};
virtual void UpdateDetailedView(void) {}; virtual void UpdateDetailedView(void) {};
void SetTransparency(int transparency, bool forceDetached = false); void SetTransparency(int transparency, bool forceDetached = false);
}; };
/*********************************************************** /***********************************************************
* cViewMenuDefault * cViewMenuDefault
***********************************************************/ ***********************************************************/
class cViewMenuDefault : public cSubView { class cViewMenuDefault : public cSubView {
private: private:
cViewListDefault *listDefault; cViewListDefault *listDefault;
void SetViewElementObjects(void); void SetViewElementObjects(void);
public: public:
cViewMenuDefault(const char *name); cViewMenuDefault(const char *name);
virtual ~cViewMenuDefault(void); virtual ~cViewMenuDefault(void);
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5); void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
void SetPlugin(const char *plugName); void SetPlugin(const char *plugName);
void SetItem(const char *text, int index, bool current, bool selectable); void SetItem(const char *text, int index, bool current, bool selectable);
const cFont *GetTextAreaFont(void); const cFont *GetTextAreaFont(void);
int GetListWidth(void); int GetListWidth(void);
}; };
/*********************************************************** /***********************************************************
* cViewMenuMain * cViewMenuMain
***********************************************************/ ***********************************************************/
class cViewMenuMain : public cSubView { class cViewMenuMain : public cSubView {
private: private:
cViewListMain *listMain; cViewListMain *listMain;
cVeDmTimers *timers; cVeDmTimers *timers;
cVeDevices *devices; cVeDevices *devices;
cVeCurrentWeather *weather; cVeCurrentWeather *weather;
cVeDmDiscusage *discusage; cVeDmDiscusage *discusage;
cVeDmSystemload *load; cVeDmSystemload *load;
cVeDmSystemmemory *memory; cVeDmSystemmemory *memory;
cVeDmVdrstatistics *vdrstats; cVeDmVdrstatistics *vdrstats;
cVeDmTemperatures *temperatures; cVeDmTemperatures *temperatures;
cVeDmCurrentschedule *currentSchedule; cVeDmCurrentschedule *currentSchedule;
cVeDmLastrecordings *lastRecordings; cVeDmLastrecordings *lastRecordings;
cVeCustomTokens *customTokens; cVeCustomTokens *customTokens;
uint64_t lastDrawDynamic; uint64_t lastDrawDynamic;
void ClearVariables(void); void ClearVariables(void);
void SetViewElements(void); void SetViewElements(void);
void SetViewElementObjects(void); void SetViewElementObjects(void);
public: public:
cViewMenuMain(const char *name); cViewMenuMain(const char *name);
virtual ~cViewMenuMain(void); virtual ~cViewMenuMain(void);
void Clear(void); void Clear(void);
void SetItem(const char *text, int index, bool current, bool selectable); void SetItem(const char *text, int index, bool current, bool selectable);
void SetCurrentRecording(const char *currentRec); void SetCurrentRecording(const char *currentRec);
void DrawStaticVEs(void); void DrawStaticVEs(void);
void DrawDynamicVEs(void); void DrawDynamicVEs(void);
const char *GetPlugin(void); const char *GetPlugin(void);
}; };
/*********************************************************** /***********************************************************
* cViewMenuSetup * cViewMenuSetup
***********************************************************/ ***********************************************************/
class cViewMenuSetup : public cSubView { class cViewMenuSetup : public cSubView {
private: private:
cViewListMain *listSetup; cViewListMain *listSetup;
void SetViewElementObjects(void); void SetViewElementObjects(void);
public: public:
cViewMenuSetup(const char *name); cViewMenuSetup(const char *name);
virtual ~cViewMenuSetup(void); virtual ~cViewMenuSetup(void);
void SetItem(const char *text, int index, bool current, bool selectable); void SetItem(const char *text, int index, bool current, bool selectable);
}; };
/*********************************************************** /***********************************************************
* cViewMenuSchedules * cViewMenuSchedules
***********************************************************/ ***********************************************************/
class cViewMenuSchedules : public cSubView { class cViewMenuSchedules : public cSubView {
private: private:
cViewListSchedules *listSchedules; cViewListSchedules *listSchedules;
void SetViewElementObjects(void); void SetViewElementObjects(void);
public: public:
cViewMenuSchedules(const char *name); cViewMenuSchedules(const char *name);
virtual ~cViewMenuSchedules(void); virtual ~cViewMenuSchedules(void);
void SetItem(const cEvent *event, int index, bool current, bool selectable, const cChannel *channel, bool withDate, eTimerMatch timerMatch); void SetItem(const cEvent *event, int index, bool current, bool selectable, const cChannel *channel, bool withDate, eTimerMatch timerMatch);
}; };
/*********************************************************** /***********************************************************
* cViewMenuChannels * cViewMenuChannels
***********************************************************/ ***********************************************************/
class cViewMenuChannels : public cSubView { class cViewMenuChannels : public cSubView {
private: private:
cViewListChannels *listChannels; cViewListChannels *listChannels;
void SetViewElementObjects(void); void SetViewElementObjects(void);
public: public:
cViewMenuChannels(const char *name); cViewMenuChannels(const char *name);
virtual ~cViewMenuChannels(void); virtual ~cViewMenuChannels(void);
void SetItem(const cChannel *channel, int index, bool current, bool selectable, bool withProvider); void SetItem(const cChannel *channel, int index, bool current, bool selectable, bool withProvider);
}; };
/*********************************************************** /***********************************************************
* cViewMenuTimers * cViewMenuTimers
***********************************************************/ ***********************************************************/
class cViewMenuTimers : public cSubView { class cViewMenuTimers : public cSubView {
private: private:
cViewListTimers *listTimers; cViewListTimers *listTimers;
void SetViewElementObjects(void); void SetViewElementObjects(void);
public: public:
cViewMenuTimers(const char *name); cViewMenuTimers(const char *name);
virtual ~cViewMenuTimers(void); virtual ~cViewMenuTimers(void);
void SetItem(const cTimer *timer, int index, bool current, bool selectable); void SetItem(const cTimer *timer, int index, bool current, bool selectable);
}; };
/*********************************************************** /***********************************************************
* cViewMenuRecordings * cViewMenuRecordings
***********************************************************/ ***********************************************************/
class cViewMenuRecordings : public cSubView { class cViewMenuRecordings : public cSubView {
private: private:
cViewListRecordings *listRecordings; cViewListRecordings *listRecordings;
void SetViewElementObjects(void); void SetViewElementObjects(void);
public: public:
cViewMenuRecordings(const char *name); cViewMenuRecordings(const char *name);
virtual ~cViewMenuRecordings(void); virtual ~cViewMenuRecordings(void);
void SetItem(const cRecording *recording, int index, bool current, bool selectable, int level, int total, int New); void SetItem(const cRecording *recording, int index, bool current, bool selectable, int level, int total, int New);
}; };
/*********************************************************** /***********************************************************
* cViewMenuPlugins * cViewMenuPlugins
***********************************************************/ ***********************************************************/
class cViewMenuPlugin : public cSubView { class cViewMenuPlugin : public cSubView {
private: private:
cViewListPlugin *listPlugin; cViewListPlugin *listPlugin;
void SetViewElementObjects(void); void SetViewElementObjects(void);
public: public:
cViewMenuPlugin(const char *name); cViewMenuPlugin(const char *name);
virtual ~cViewMenuPlugin(void); virtual ~cViewMenuPlugin(void);
void SetItem(skindesignerapi::cTokenContainer *tk, int index, bool current, bool selectable); void SetItem(skindesignerapi::cTokenContainer *tk, int index, bool current, bool selectable);
}; };
/*********************************************************** /***********************************************************
* cViewMenuDetail * cViewMenuDetail
***********************************************************/ ***********************************************************/
class cViewMenuDetail : public cSubView { class cViewMenuDetail : public cSubView {
private: private:
bool firstTab; bool firstTab;
cVeDmDetailheaderEpg *detailedheaderEpg; cVeDmDetailheaderEpg *detailedheaderEpg;
cVeDmDetailheaderRec *detailedheaderRec; cVeDmDetailheaderRec *detailedheaderRec;
cVeDmDetailheaderPlugin *detailedheaderPlug; cVeDmDetailheaderPlugin *detailedheaderPlug;
cVeDmTablabels *tablabels; cVeDmTablabels *tablabels;
cViewDetail *detailView; cViewDetail *detailView;
cViewDetailEpg *detailViewEpg; cViewDetailEpg *detailViewEpg;
cViewDetailRec *detailViewRec; cViewDetailRec *detailViewRec;
cViewDetailText *detailViewText; cViewDetailText *detailViewText;
cViewDetailPlugin *detailViewPlugin; cViewDetailPlugin *detailViewPlugin;
void SetDetailedView(void); void SetDetailedView(void);
void SetViewElements(void); void SetViewElements(void);
void SetViewElementObjects(void); void SetViewElementObjects(void);
void DrawScrollbar(void); void DrawScrollbar(void);
public: public:
cViewMenuDetail(const char *name); cViewMenuDetail(const char *name);
virtual ~cViewMenuDetail(void); virtual ~cViewMenuDetail(void);
void SetGlobals(cGlobals *globals); void SetGlobals(cGlobals *globals);
void AddTab(cArea *tab); void AddTab(cArea *tab);
void PreCache(void); void PreCache(void);
int GetWidth(void); int GetWidth(void);
void SetEvent(const cEvent *event); void SetEvent(const cEvent *event);
void SetRecording(const cRecording *recording); void SetRecording(const cRecording *recording);
void SetText(const char *text); void SetText(const char *text);
void SetPluginText(skindesignerapi::cTokenContainer *tk); void SetPluginText(skindesignerapi::cTokenContainer *tk);
void Clear(void); void Clear(void);
void Close(void); void Close(void);
void DrawStaticVEs(void); void DrawStaticVEs(void);
void DrawDynamicVEs(void); void DrawDynamicVEs(void);
void DrawDetailedView(void); void DrawDetailedView(void);
void KeyLeft(void); void KeyLeft(void);
void KeyRight(void); void KeyRight(void);
void KeyUp(void); void KeyUp(void);
void KeyDown(void); void KeyDown(void);
void SetTransparency(int transparency, bool forceDetached = false); void SetTransparency(int transparency, bool forceDetached = false);
}; };
#endif //__VIEWDISPLAYMENU_H #endif //__VIEWDISPLAYMENU_H

View File

@ -1,54 +1,54 @@
#include "viewdisplaymessage.h" #include "viewdisplaymessage.h"
#include "../config.h" #include "../config.h"
/************************************************************************************ /************************************************************************************
* cViewMessage * cViewMessage
************************************************************************************/ ************************************************************************************/
cViewMessage::cViewMessage(void) { cViewMessage::cViewMessage(void) {
ClearVariables(); ClearVariables();
viewId = eViewType::DisplayMessage; viewId = eViewType::DisplayMessage;
viewName = strdup("displaymessage"); viewName = strdup("displaymessage");
numViewElements = (int)eVeDisplayMessage::count; numViewElements = (int)eVeDisplayMessage::count;
viewElements = new cViewElement*[numViewElements]; viewElements = new cViewElement*[numViewElements];
for (int i=0; i < numViewElements; i++) { for (int i=0; i < numViewElements; i++) {
viewElements[i] = NULL; viewElements[i] = NULL;
} }
SetViewElements(); SetViewElements();
veMessage = NULL; veMessage = NULL;
} }
cViewMessage::~cViewMessage() { cViewMessage::~cViewMessage() {
} }
void cViewMessage::SetViewElements(void) { void cViewMessage::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayMessage::background)); viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayMessage::background));
viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayMessage::message)); viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayMessage::message));
} }
void cViewMessage::SetViewElementObjects(void) { void cViewMessage::SetViewElementObjects(void) {
if (!viewElements[(int)eVeDisplayMessage::message]) if (!viewElements[(int)eVeDisplayMessage::message])
return; return;
veMessage = dynamic_cast<cVeMessage*>(viewElements[(int)eVeDisplayMessage::message]); veMessage = dynamic_cast<cVeMessage*>(viewElements[(int)eVeDisplayMessage::message]);
} }
void cViewMessage::ClearVariables(void) { void cViewMessage::ClearVariables(void) {
init = true; init = true;
} }
void cViewMessage::SetMessage(eMessageType type, const char *text) { void cViewMessage::SetMessage(eMessageType type, const char *text) {
if (!text) if (!text)
veMessage->Clear(); veMessage->Clear();
else else
veMessage->Set(type, text); veMessage->Set(type, text);
} }
void cViewMessage::Flush(void) { void cViewMessage::Flush(void) {
if (init) { if (init) {
sdOsd.LockFlush(); sdOsd.LockFlush();
Render((int)eVeDisplayMessage::background); Render((int)eVeDisplayMessage::background);
} }
Render((int)eVeDisplayMessage::message); Render((int)eVeDisplayMessage::message);
cView::Flush(); cView::Flush();
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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