Project

General

Profile

Support #1566 ยป enigma-SetPositioner.diff

dimeptr, 10/23/2013 10:33 PM

View differences:

enigma.c
#endif
cTimeMs UpdateSignalTimer;
#endif //DISABLE_SIGNALINFO
int xStartPosition;
void DrawAreas(void);
void DrawGroupInfo(const cChannel *Channel, int Number);
......
cSkinEnigmaDisplayChannel(bool WithInfo);
virtual ~ cSkinEnigmaDisplayChannel();
virtual void SetChannel(const cChannel *Channel, int Number);
virtual void SetPositioner(const cPositioner *Positioner);
virtual void SetEvents(const cEvent *Present, const cEvent *Following);
virtual void SetMessage(eMessageType Type, const char *Text);
virtual void Flush(void);
......
#ifndef DISABLE_SIGNALINFO
xSignalBarLeft = EnigmaConfig.showSignalInfo ? (xBottomRight - xIndent - EnigmaConfig.signalInfoWidth) : -1;
#endif
xStartPosition = -1;
// create osd
osd = cOsdProvider::NewOsd(OsdSize.x, OsdSize.y + (Setup.ChannelInfoPos ? 0 : (OsdSize.h - yBottomBottom)) );
......
TE_UNLOCK;
}
void cSkinEnigmaDisplayChannel::SetPositioner(const cPositioner* Positioner)
{
int xPosAreaLeft = xBottomLeft + xIndent + EnigmaConfig.progressBarWidth + 2*Gap;
int xPosAreaRight = xFirstSymbol - Gap - 1;
int yPosAreaTop = yBottomTop + Gap;
int yPosAreaBottom = yBottomBottom - Gap - 1;
if (Positioner) {
//debug("cSkinEnigmaDisplayChannel: xMessageLeft:%d xMessageRight:%d yMessageTop:%d yMessageBottom:%d", xMessageLeft,xMessageRight,yMessageTop,yMessageBottom);
//debug("cSkinEnigmaDisplayChannel: xPosAreaLeft:%d xPosAreaRight:%d yPosAreaTop:%d yPosAreaBottom:%d", xPosAreaLeft,xPosAreaRight,yPosAreaTop,yPosAreaBottom);
//error("cSkinEnigmaDisplayChannel: osd->IsOpen():%d", osd->IsOpen());
osd->DrawRectangle(xPosAreaLeft, yPosAreaTop, xPosAreaRight,
yPosAreaBottom, Theme.Color(clrBackground));
int HorizonLeft = Positioner->HorizonLongitude(cPositioner::pdLeft);
int HorizonRight = Positioner->HorizonLongitude(cPositioner::pdRight);
int HardLimitLeft = cPositioner::NormalizeAngle(HorizonLeft - Positioner->HardLimitLongitude(cPositioner::pdLeft));
int HardLimitRight = cPositioner::NormalizeAngle(Positioner->HardLimitLongitude(cPositioner::pdRight) - HorizonRight);
int HorizonDelta = cPositioner::NormalizeAngle(HorizonLeft - HorizonRight);
int Current = cPositioner::NormalizeAngle(HorizonLeft - Positioner->CurrentLongitude());
int Target = cPositioner::NormalizeAngle(HorizonLeft - Positioner->TargetLongitude());
int d = (yPosAreaTop - yPosAreaBottom - 1) / 2;
int w = xPosAreaRight - xPosAreaLeft - 2 * d;
int l = max(xPosAreaLeft + d, xPosAreaLeft + d + w * HardLimitLeft / HorizonDelta);
int r = min(xPosAreaRight - d, xPosAreaRight - d - w * HardLimitRight / HorizonDelta) - 1;
int c = constrain(xPosAreaLeft + d + w * Current / HorizonDelta, l, r);
int t = constrain(xPosAreaLeft + d + w * Target / HorizonDelta, l, r);
osd->DrawRectangle(l, yPosAreaTop, r, yPosAreaBottom, Theme.Color(clrBotProgBarBg));
yPosAreaTop += SmallGap;
yPosAreaBottom -= SmallGap;
int cr = (yPosAreaBottom - yPosAreaTop) /2;
if (xStartPosition == -1)
xStartPosition = c;
osd->DrawEllipse(xStartPosition - cr, yPosAreaTop, xStartPosition + cr,
yPosAreaBottom, Theme.Color(clrSignalHighFg));
osd->DrawRectangle(c > xStartPosition ? xStartPosition : c, yPosAreaTop,
c < xStartPosition ? xStartPosition : c, yPosAreaBottom, Theme.Color(clrSignalHighFg));
osd->DrawEllipse(t - cr, yPosAreaTop, t + cr, yPosAreaBottom, Theme.Color(clrSignalHighFg));
osd->DrawEllipse(t - cr + Gap, yPosAreaTop + Gap,
t + cr - Gap, yPosAreaBottom - Gap, Theme.Color(clrBotProgBarBg));
osd->DrawEllipse(c - cr, yPosAreaTop, c + cr, yPosAreaBottom, Theme.Color(clrSignalHighFg));
} else {
xStartPosition = -1;
osd->DrawRectangle(xPosAreaLeft, yPosAreaTop, xPosAreaRight,
yPosAreaBottom, Theme.Color(clrBottomBg));
}
}
void cSkinEnigmaDisplayChannel::Flush(void)
{
// debug("cSkinEnigmaDisplayChannel::Flush()");
    (1-1/1)