From 292ea96dd59f8adfe2679ffe50b34dae8c5e6761 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Fri, 22 May 2020 17:36:31 +0100 Subject: [PATCH] VVideoLiveTV CWFs --- vvideolivetv.cc | 67 +++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/vvideolivetv.cc b/vvideolivetv.cc index dcaaa04..27c7290 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -504,7 +504,7 @@ void VVideoLiveTV::doOK() if (keying) { UINT newChannel = 0; - for(int i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * (ULONG)pow(10., i); + for(int i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * static_cast(pow(10.f, i)); channelChange(NUMBER, newChannel); osdChannelIndex = currentChannelIndex; @@ -567,12 +567,12 @@ void VVideoLiveTV::doKey(int command) for (i = 0; i < numberWidth; i++) keyingString[i] = '_'; keyingString[numberWidth] = '\0'; - for (i = 0; i < keying; i++) keyingString[i] = keyingInput[keying - 1 - i] + 48; + for (i = 0; i < keying; i++) keyingString[i] = static_cast(keyingInput[keying - 1 - i] + 48); if (keying == numberWidth) { UINT newChannel = 0; - for(i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * (ULONG)pow(10., i); + for(i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * static_cast(pow(10.f, i)); channelChange(NUMBER, newChannel); osdChannelIndex = currentChannelIndex; @@ -852,7 +852,7 @@ void VVideoLiveTV::timercall(int ref) { Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 key start."); UINT newChannel = 0; - for(int i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * (ULONG)pow(10., i); + for(int i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * static_cast(pow(10.f, i)); Message* m = new Message(); m->message = Message::CHANNEL_CHANGE; @@ -1014,29 +1014,30 @@ void VVideoLiveTV::processMessage(Message* m) int y = m->tag - osd.getScreenY(); if (osd.getVisible()) { - if ((boxRed.getX()<=x) && (boxRed.getX()+(int)boxRed.getWidth()>=x ) && - (boxRed.getY()<=y) && (boxRed.getY()+(int)boxRed.getHeight()>=y )) - { - BoxStack::getInstance()->handleCommand(Input::RED); - } - else if ((boxGreen.getX()<=x) && (boxGreen.getX()+(int)boxGreen.getWidth()>=x ) && - (boxGreen.getY()<=y) && (boxGreen.getY()+(int)boxGreen.getHeight()>=y)) - { - BoxStack::getInstance()->handleCommand(Input::GREEN); - } - else if ((boxYellow.getX()<=x) && (boxYellow.getX()+(int)boxYellow.getWidth()>=x ) && - (boxYellow.getY()<=y) && (boxYellow.getY()+(int)boxYellow.getHeight()>=y )){ - BoxStack::getInstance()->handleCommand(Input::YELLOW); - } - else if ((boxBlue.getX()<=x) && (boxBlue.getX()+(int)boxBlue.getWidth()>=x ) && - (boxBlue.getY()<=y) && (boxBlue.getY()+(int)boxBlue.getHeight()>=y )) - { - BoxStack::getInstance()->handleCommand(Input::BLUE); - } - else - { - BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press - } + if ((boxRed.getX() <= x) && (boxRed.getX() + static_cast(boxRed.getWidth()) >= x) && + (boxRed.getY() <= y) && (boxRed.getY() + static_cast(boxRed.getHeight()) >= y)) + { + BoxStack::getInstance()->handleCommand(Input::RED); + } + else if ((boxGreen.getX() <= x) && (boxGreen.getX() + static_cast(boxGreen.getWidth()) >= x) && + (boxGreen.getY() <= y) && (boxGreen.getY() + static_cast(boxGreen.getHeight()) >= y)) + { + BoxStack::getInstance()->handleCommand(Input::GREEN); + } + else if ((boxYellow.getX() <= x) && (boxYellow.getX() + static_cast(boxYellow.getWidth()) >= x) && + (boxYellow.getY() <= y) && (boxYellow.getY() + static_cast(boxYellow.getHeight()) >= y)) + { + BoxStack::getInstance()->handleCommand(Input::YELLOW); + } + else if ((boxBlue.getX() <= x) && (boxBlue.getX() + static_cast(boxBlue.getWidth()) >= x) && + (boxBlue.getY() <= y) && (boxBlue.getY() + static_cast(boxBlue.getHeight()) >= y)) + { + BoxStack::getInstance()->handleCommand(Input::BLUE); + } + else + { + BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press + } } else { @@ -1360,12 +1361,12 @@ void VVideoLiveTV::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, c Region r; r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height; //now convert to our display - float scalex=720.f/((float) (region.framewidth+1)); - float scaley=576.f/((float) (region.frameheight+1)); - r.x = (UINT)floor(scalex*((float)r.x)); - r.y = (UINT)floor(scaley*((float)r.y)); - r.w = (UINT)(ceil(scalex*((float)r.w))+1.f); - r.h = (UINT)(ceil(scaley*((float)r.h))+1.f); + float scalex = 720.f / static_cast(region.framewidth + 1); + float scaley = 576.f / static_cast(region.frameheight + 1); + r.x = static_cast(floor(scalex * static_cast(r.x))); + r.y = static_cast(floor(scaley * static_cast(r.y))); + r.w = static_cast(ceil(scalex * static_cast(r.w)) + 1.f); + r.h = static_cast(ceil(scaley * static_cast(r.h)) + 1.f); rectangle(r, DrawStyle(0,0,0,0)); boxstack->update(this, &r); } -- 2.39.2