From c3d0027fb448af4b32eab957cfb71d353ce608c9 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Mon, 17 Feb 2020 19:43:22 +0000 Subject: [PATCH] Change WSelectList option data to void*. About 65 CWFs --- boxx.cc | 20 ++++++++++++++++++++ boxx.h | 2 ++ imageomx.cc | 30 +++++++++++++++--------------- vaudioselector.cc | 12 ++++++------ vchannellist.cc | 15 +++++---------- vchannelselect.cc | 2 +- vcolourtuner.cc | 5 +---- vepglistadvanced.cc | 37 ++++++++++++++++++++----------------- vepgsettimer.cc | 10 ++-------- vepgsummary.cc | 11 ++++------- vmedialist.cc | 11 +++-------- vmediaview.cc | 6 +----- vpicturebanner.cc | 8 ++++---- vquestion.cc | 10 ++-------- vrecmove.cc | 16 +++++----------- vrecording.cc | 5 +---- vrecordinglist.cc | 10 ++-------- vrecordingmenu.cc | 33 ++++++++++++++------------------- vtimerlist.cc | 14 ++++---------- vwelcome.cc | 18 +++++++++--------- wremoteconfig.cc | 4 ++-- wselectlist.cc | 4 ++-- wselectlist.h | 6 +++--- wwinaudiofilter.cc | 2 +- wwinvideofilter.cc | 2 +- 25 files changed, 130 insertions(+), 163 deletions(-) diff --git a/boxx.cc b/boxx.cc index 08e56d8..071ba98 100644 --- a/boxx.cc +++ b/boxx.cc @@ -595,3 +595,23 @@ bool Boxx::mouseLBDOWN(int x, int y) return false; } } + +bool Boxx::coordsOutsideBox(Message* m) +{ + /* Helper function to look at parameter in m, decode the x and y coords + * and see if the point is outside this Boxx's area + */ + + int x = (m->parameter >> 16) - getScreenX(); + int y = (m->parameter & 0xFFFF) - getScreenY(); + + if ( (x < 0) + || (y < 0) + || (x > static_cast(area.w)) + || (y > static_cast(area.h)) + ) + return true; + + return false; +} + diff --git a/boxx.h b/boxx.h index 3c88049..e027da7 100644 --- a/boxx.h +++ b/boxx.h @@ -91,6 +91,8 @@ class Boxx bool getVideoDisplay(VideoDisplay &vd); + bool coordsOutsideBox(Message*); + // Drawing functions level 1 void fillColour(const DrawStyle & colour); int drawPara(const char* text, int x, int y, const DrawStyle& colour, unsigned int skiplines=0); diff --git a/imageomx.cc b/imageomx.cc index 7e791bf..9348901 100644 --- a/imageomx.cc +++ b/imageomx.cc @@ -63,10 +63,10 @@ void ImageOMX::shutdown() -OMX_ERRORTYPE ImageOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp,OMX_IN OMX_PTR appdata,OMX_IN OMX_BUFFERHEADERTYPE* buffer){ +OMX_ERRORTYPE ImageOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE /*hcomp*/,OMX_IN OMX_PTR /*appdata*/,OMX_IN OMX_BUFFERHEADERTYPE* buffer){ //Log::getInstance()->log("Image", Log::NOTICE, "EmptyBufferDone"); - ImageOMX *image=(ImageOMX *)buffer->pAppPrivate; + ImageOMX* image = static_cast(buffer->pAppPrivate); image->ReturnEmptyOMXBuffer(buffer); return OMX_ErrorNone; @@ -83,23 +83,25 @@ void ImageOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer){ input_bufs_omx_free.push_back(buffer); //Log::getInstance()->log("Image", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size()); input_bufs_omx_mutex.Unlock(); - VideoOMX *video=(VideoOMX*)Video::getInstance(); + VideoOMX* video = static_cast(Video::getInstance()); + video->signalOmx(); } - OMX_ERRORTYPE ImageOMX::FillBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp, OMX_IN OMX_PTR appdata,OMX_IN OMX_BUFFERHEADERTYPE* buffer) { +OMX_ERRORTYPE ImageOMX::FillBufferDone_OMX(OMX_IN OMX_HANDLETYPE /*hcomp*/, OMX_IN OMX_PTR /*appdata*/,OMX_IN OMX_BUFFERHEADERTYPE* buffer) { Log::getInstance()->log("ImageOmx", Log::NOTICE, "FillBufferDone"); - ImageOMX *image=(ImageOMX *)buffer->pAppPrivate; + ImageOMX* image = static_cast(buffer->pAppPrivate); image->ReturnFillOMXBuffer(buffer); return OMX_ErrorNone; } - void ImageOMX::ReturnFillOMXBuffer(OMX_BUFFERHEADERTYPE* buffer){ +void ImageOMX::ReturnFillOMXBuffer(OMX_BUFFERHEADERTYPE* /*buffer*/) + { //input_bufs_omx_mutex.Lock(); omx_egl_filled = true; //output_bufs_omx_full.push_back(buffer); //input_bufs_omx_mutex.Unlock(); - VideoOMX *video=(VideoOMX*)Video::getInstance(); + VideoOMX* video = static_cast(Video::getInstance()); video->signalOmx(); } @@ -131,7 +133,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) //Log::getInstance()->log("Image", Log::NOTICE, "Allocate Codecs OMX"); //Clock, move later to Image - VideoOMX *video=(VideoOMX*)Video::getInstance(); + VideoOMX* video = static_cast(Video::getInstance()); OMX_PORT_PARAM_TYPE p_param; memset(&p_param,0,sizeof(p_param)); @@ -265,7 +267,7 @@ unsigned char* ImageOMX::decodePicture(LoadIndex index, unsigned char * buffer, if (curformat == Unsupported) return buffer; // Jpeg magic numbers // Log::getInstance()->log("Image", Log::DEBUG, // "decodePicture 2"); - VideoOMX *video=(VideoOMX*)Video::getInstance(); + VideoOMX* video = static_cast(Video::getInstance()); if (!pictcreat) return NULL; @@ -291,7 +293,7 @@ unsigned char* ImageOMX::decodePicture(LoadIndex index, unsigned char * buffer, } -bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, EGLPictureCreator* pictcreat, VideoOMX *video) +bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, unsigned int length, EGLPictureCreator* pictcreat, VideoOMX *video) { static OMX_CALLBACKTYPE callbacks= {&VideoOMX::EventHandler_OMX,&EmptyBufferDone_OMX,&FillBufferDone_OMX}; @@ -646,15 +648,13 @@ bool ImageOMX::getDecodedPicture(struct OsdVector::PictureInfo& pict_inf) return true; } -void ImageOMX::freeReference(void * ref) +void ImageOMX::freeReference(void* /* ref */) { - } - int ImageOMX::PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsigned int length) //needs to be called with locvke omx clock mutex { - VideoOMX *video=(VideoOMX*)Video::getInstance(); + VideoOMX* video = static_cast(Video::getInstance()); OMX_ERRORTYPE error; OMX_PARAM_PORTDEFINITIONTYPE port_def_type; memset(&port_def_type,0,sizeof(port_def_type)); @@ -769,7 +769,7 @@ int ImageOMX::DeAllocateCodecsOMX() { OMX_ERRORTYPE error; omx_running=false; - VideoOMX *video=(VideoOMX*)Video::getInstance(); + VideoOMX* video = static_cast(Video::getInstance()); // Log::getInstance()->log("Image", Log::DEBUG, "enter deallocatecodecsomx"); diff --git a/vaudioselector.cc b/vaudioselector.cc index eb815a0..c4f9196 100644 --- a/vaudioselector.cc +++ b/vaudioselector.cc @@ -236,7 +236,7 @@ VAudioSelector::VAudioSelector(void* tparent, bool* availableMpegAudioChannels, if (ac->name) { - asl.addOption(ac->name, (ULONG)ac, (ac->pestype == currentAudioChannel)); + asl.addOption(ac->name, ac, (ac->pestype == currentAudioChannel)); } else { @@ -252,7 +252,7 @@ VAudioSelector::VAudioSelector(void* tparent, bool* availableMpegAudioChannels, { SNPRINTF(tempString, 299, "unknown"); } - asl.addOption(tempString, (ULONG)ac, (ac->pestype == currentAudioChannel)); + asl.addOption(tempString, ac, (ac->pestype == currentAudioChannel)); } } } @@ -273,7 +273,7 @@ VAudioSelector::VAudioSelector(void* tparent, bool* availableMpegAudioChannels, if (sc->name) { - ssl.addOption(sc->name, (ULONG)sc, selected); + ssl.addOption(sc->name, sc, selected); } else { @@ -285,7 +285,7 @@ VAudioSelector::VAudioSelector(void* tparent, bool* availableMpegAudioChannels, { SNPRINTF(tempString, 299, "unknown"); } - ssl.addOption(tempString, (ULONG)sc, selected); + ssl.addOption(tempString, sc, selected); } } } @@ -389,7 +389,7 @@ VAudioSelector::VAudioSelector(void* tparent, Channel* channel, int currentAudio for(int j = 0; j < audioChannelListSize; j++) { AudioSubtitleChannel* ac = acl[j]; - asl.addOption(ac->name, (ULONG)ac, (ac->pestype == currentAudioChannel)); + asl.addOption(ac->name, ac, (ac->pestype == currentAudioChannel)); } } else @@ -405,7 +405,7 @@ VAudioSelector::VAudioSelector(void* tparent, Channel* channel, int currentAudio AudioSubtitleChannel* sc = scl[j]; bool selected=false; if ((sc->type==currentSubtitletype) && (sc->pestype == currentSubtitleChannel)) selected=true; - ssl.addOption(sc->name, (ULONG)sc, selected); + ssl.addOption(sc->name, sc, selected); } } diff --git a/vchannellist.cc b/vchannellist.cc index 04767b3..7c33c16 100644 --- a/vchannellist.cc +++ b/vchannellist.cc @@ -113,7 +113,7 @@ void VChannelList::setList(ChannelList* tlist) if (type == VDR::VIDEO) info->setStaticFallback(sa_tv); else info->setStaticFallback(sa_radio); } - chan->index = sl.addOption(str, (ULONG)chan, first, info); + chan->index = sl.addOption(str, chan, first, info); first = 0; } } @@ -240,7 +240,7 @@ int VChannelList::handleCommand(int command) case Input::PLAY: { Channel* chan = NULL; - if (chanList) chan = (Channel*)sl.getCurrentOptionData(); + if (chanList) chan = reinterpret_cast(sl.getCurrentOptionData()); if (chan == NULL) return 2; VVideoLiveTV* v = new VVideoLiveTV(chanList, chan->number, this); @@ -282,14 +282,9 @@ void VChannelList::processMessage(Message* m) { boxstack->handleCommand(Input::OK); //simulate OK press } - else - { //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) - { - boxstack->handleCommand(Input::BACK); //simulate cancel press - } + else if (coordsOutsideBox(m)) + { + boxstack->handleCommand(Input::BACK); //simulate cancel press } } else if (m->message == Message::CHANNEL_CHANGE) diff --git a/vchannelselect.cc b/vchannelselect.cc index f41b311..bc6c492 100644 --- a/vchannelselect.cc +++ b/vchannelselect.cc @@ -52,7 +52,7 @@ VChannelSelect::~VChannelSelect() Timers::getInstance()->cancelTimer(this, 1); } -void VChannelSelect::timercall(int clientReference) +void VChannelSelect::timercall(int /*clientReference*/) { Log::getInstance()->log("VChannelSelect", Log::DEBUG, "Timer call"); if (ignoreTimer) return; diff --git a/vcolourtuner.cc b/vcolourtuner.cc index b20a008..b1fc472 100644 --- a/vcolourtuner.cc +++ b/vcolourtuner.cc @@ -226,10 +226,7 @@ void VColourTuner::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) + if (coordsOutsideBox(m)) { BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } diff --git a/vepglistadvanced.cc b/vepglistadvanced.cc index 12a1951..cf0c574 100644 --- a/vepglistadvanced.cc +++ b/vepglistadvanced.cc @@ -207,8 +207,9 @@ void VEpgListAdvanced::doBlue() void VEpgListAdvanced::doNext() { Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doNext"); + ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); if (mode!=OneChannel) { - Channel * chan=(*chanList)[ sl.getCurrentOptionData()]; + Channel * chan=(*chanList)[slCurrentOption]; channelNumber = chan->number; } mode=Next; @@ -223,8 +224,9 @@ void VEpgListAdvanced::doNext() void VEpgListAdvanced::doNow() { Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doNow"); + ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); if (mode!=OneChannel) { - Channel * chan=(*chanList)[ sl.getCurrentOptionData()]; + Channel * chan=(*chanList)[slCurrentOption]; channelNumber = chan->number; } mode=Now; @@ -241,8 +243,8 @@ void VEpgListAdvanced::doProgramm() { Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doProgram"); mode=OneChannel; - - Channel * chan=(*chanList)[ sl.getCurrentOptionData()]; + ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); + Channel * chan=(*chanList)[slCurrentOption]; channelNumber = chan->number; updateEpgDataChannel(); setButtonText(); @@ -260,7 +262,8 @@ void VEpgListAdvanced::doSwitch() if (videolive) { if (mode!=OneChannel) { - Channel * chan=(*chanList)[ sl.getCurrentOptionData()]; + ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); + Channel * chan=(*chanList)[slCurrentOption]; channelNumber = chan->number; } Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doSwitch %d", channelNumber); @@ -309,7 +312,8 @@ void VEpgListAdvanced::doGrid() { if (mode!=OneChannel) { - Channel * chan=(*chanList)[ sl.getCurrentOptionData()]; + ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); + Channel * chan=(*chanList)[slCurrentOption]; channelNumber = chan->number; } UINT listIndex; @@ -483,7 +487,7 @@ void VEpgListAdvanced::drawDataChannel(bool doIndexPop) TVMediaInfo *info= new TVMediaInfo(); info->setPosterThumb(channelNumber, currentEvent->id); info->setStaticFallback(sa_defposter); - currentEvent->index = sl.addOption(tempC, currentEvent->id, first, info); + currentEvent->index = sl.addOption(tempC, reinterpret_cast(currentEvent->id), first, info); first = 0; } } @@ -558,7 +562,7 @@ void VEpgListAdvanced::drawDataNowNext(bool next, bool doIndexPop) } info->setChannelLogo((*chanList)[listIndex]->number); info->setStaticFallback(sa_tv); - int index =sl.addOption(tempC, listIndex, first, info); + int index = sl.addOption(tempC, reinterpret_cast(listIndex), first, info); if (currentEvent) currentEvent->index = index; first = 0; } @@ -652,6 +656,8 @@ Event* VEpgListAdvanced::getCurrentOptionEvent(int& channel) Event* currentEvent = NULL; EventList::iterator j; EventList* eventList = NULL; + ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); + switch (mode) { case OneChannel: { @@ -661,14 +667,14 @@ Event* VEpgListAdvanced::getCurrentOptionEvent(int& channel) for (j = eventList->begin(); j != eventList->end(); j++) { currentEvent = *j; - if (currentEvent->index == sl.getCurrentOption()) return currentEvent; + if (currentEvent->index == slCurrentOption) return currentEvent; } } break; case Next: { - eventList = eventLista[sl.getCurrentOptionData()]; - channel = (*chanList)[sl.getCurrentOptionData()]->number; + eventList = eventLista[slCurrentOption]; + channel = (*chanList)[slCurrentOption]->number; if (eventList && eventList->size()>1) { @@ -679,8 +685,8 @@ Event* VEpgListAdvanced::getCurrentOptionEvent(int& channel) } } break; case Now: { - eventList = eventLista[sl.getCurrentOptionData()]; - channel = (*chanList)[sl.getCurrentOptionData()]->number; + eventList = eventLista[slCurrentOption]; + channel = (*chanList)[slCurrentOption]->number; if (eventList && eventList->size()>0) { j = eventList->begin(); @@ -895,10 +901,7 @@ void VEpgListAdvanced::processMessage(Message* m) } else { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) + if (coordsOutsideBox(m)) { boxstack->handleCommand(Input::BACK); //simulate cancel press } diff --git a/vepgsettimer.cc b/vepgsettimer.cc index f23e748..b6f71a3 100644 --- a/vepgsettimer.cc +++ b/vepgsettimer.cc @@ -310,15 +310,9 @@ void VEpgSetTimer::processMessage(Message* m) { boxstack->handleCommand(Input::OK); //simulate OK press } - else + else if (coordsOutsideBox(m)) { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) - { - boxstack->handleCommand(Input::BACK); //simulate cancel press - } + boxstack->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vepgsummary.cc b/vepgsummary.cc index 6b99822..7fb795a 100644 --- a/vepgsummary.cc +++ b/vepgsummary.cc @@ -232,13 +232,10 @@ void VEpgSummary::processMessage(Message* m) } if (cancel) { - //check if press is outside this view! then simulate cancel - int checkX=(m->parameter>>16)-getScreenX(); - int checkY=(m->parameter&0xFFFF)-getScreenY(); - if (checkX<0 || checkY <0 || checkX>(int)getWidth() || checkY>(int)getHeight()) - { - BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press - } + if (coordsOutsideBox(m)) + { + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press + } } } else if (m->message == Message::MOUSE_SCROLL) { diff --git a/vmedialist.cc b/vmedialist.cc index 532ae8b..ef22b7b 100644 --- a/vmedialist.cc +++ b/vmedialist.cc @@ -1079,14 +1079,9 @@ void VMediaList::processMessage(Message* m) updateSelection(); boxstack->handleCommand(Input::OK); //simulate OK press } - else - { //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) - { - boxstack->handleCommand(Input::BACK); //simulate cancel press - } + else if (coordsOutsideBox(m)) + { + boxstack->handleCommand(Input::BACK); //simulate cancel press } } else if (m->message == Message::PLAYER_EVENT) { diff --git a/vmediaview.cc b/vmediaview.cc index e66b072..403c68d 100644 --- a/vmediaview.cc +++ b/vmediaview.cc @@ -703,11 +703,7 @@ void VMediaView::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) + if (coordsOutsideBox(m)) { BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } diff --git a/vpicturebanner.cc b/vpicturebanner.cc index 8976198..76491a1 100644 --- a/vpicturebanner.cc +++ b/vpicturebanner.cc @@ -104,10 +104,10 @@ void VPictureBanner::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) + int x = (m->parameter >> 16) - getScreenX(); + int y = (m->parameter & 0xFFFF) - getScreenY(); + + if (coordsOutsideBox(m)) { BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } diff --git a/vquestion.cc b/vquestion.cc index 96c73c2..c0d0b87 100644 --- a/vquestion.cc +++ b/vquestion.cc @@ -149,15 +149,9 @@ void VQuestion::processMessage(Message* m) { BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } - else + else if (coordsOutsideBox(m)) { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) - { - BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press - } + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vrecmove.cc b/vrecmove.cc index 188f2e8..425abdb 100644 --- a/vrecmove.cc +++ b/vrecmove.cc @@ -59,7 +59,7 @@ VRecMove::VRecMove(RecMan* trecman) add(&sl); Directory* dir = recman->getRootDir(); - sl.addOption("/", (ULONG)dir, 1); + sl.addOption("/", dir, 1); addDirs(dir, ""); } @@ -80,7 +80,7 @@ void VRecMove::addDirs(Directory* dir,const char* prefix) currentDir = *i; char* title = new char[strlen(prefix) + strlen(currentDir->name) + 2]; // one for the null, one for '/' sprintf(title, "%s%s", prefix, currentDir->name); - sl.addOption(title, (ULONG)currentDir, 0); + sl.addOption(title, currentDir, 0); strcat(title, "/"); addDirs(*i, title); @@ -128,7 +128,7 @@ int VRecMove::handleCommand(int command) Message* m = new Message(); m->message = Message::MOVE_RECORDING; m->to = parent; - m->parameter = sl.getCurrentOptionData(); + m->parameter = reinterpret_cast(sl.getCurrentOptionData()); // FIXME move to m->data MessageQueue::getInstance()->postMessage(m); return 4; @@ -158,15 +158,9 @@ void VRecMove::processMessage(Message* m) { BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } - else + else if (coordsOutsideBox(m)) { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) - { - BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press - } + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vrecording.cc b/vrecording.cc index 1032941..6e4eae5 100644 --- a/vrecording.cc +++ b/vrecording.cc @@ -424,10 +424,7 @@ void VRecording::processMessage(Message* m) } if (cancel) { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) + if (coordsOutsideBox(m)) { BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } diff --git a/vrecordinglist.cc b/vrecordinglist.cc index 6653dbf..64641b9 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -68,15 +68,9 @@ void VRecordingList::processMessage(Message* m) { boxstack->handleCommand(Input::OK); //simulate OK press } - else + else if (coordsOutsideBox(m)) { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) - { - boxstack->handleCommand(Input::BACK); //simulate cancel press - } + boxstack->handleCommand(Input::BACK); //simulate cancel press } } else if (m->message == Message::DELETE_SELECTED_RECORDING) diff --git a/vrecordingmenu.cc b/vrecordingmenu.cc index 67dbcf5..81cc05c 100644 --- a/vrecordingmenu.cc +++ b/vrecordingmenu.cc @@ -58,11 +58,11 @@ VRecordingMenu::VRecordingMenu(RecMan* trecman) sl.setPosition(10, 30 + 5); sl.setSize(area.w - 20, area.h - 30 - 15); - sl.addOption(tr("Play"), 1, 1); - sl.addOption(tr("Resume"), 2, 0); - sl.addOption(tr("Summary"), 3, 0); - sl.addOption(tr("Move"), 4, 0); - sl.addOption(tr("Delete"), 5, 0); + sl.addOption(tr("Play"), reinterpret_cast(1), 1); + sl.addOption(tr("Resume"), reinterpret_cast(2), 0); + sl.addOption(tr("Summary"), reinterpret_cast(3), 0); + sl.addOption(tr("Move"), reinterpret_cast(4), 0); + sl.addOption(tr("Delete"), reinterpret_cast(5), 0); add(&sl); } @@ -100,7 +100,8 @@ int VRecordingMenu::handleCommand(int command) } case Input::OK: { - if (sl.getCurrentOptionData() == 1) + ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); + if (slCurrentOption == 1) { Message* m = new Message(); // Must be done after this view deleted m->from = this; @@ -110,7 +111,7 @@ int VRecordingMenu::handleCommand(int command) return 4; } - if (sl.getCurrentOptionData() == 2) + if (slCurrentOption == 2) { Message* m = new Message(); // Must be done after this view deleted m->from = this; @@ -120,7 +121,7 @@ int VRecordingMenu::handleCommand(int command) return 4; } - if (sl.getCurrentOptionData() == 3) + if (slCurrentOption == 3) { rec->loadRecInfo(); @@ -145,7 +146,7 @@ int VRecordingMenu::handleCommand(int command) return 2; } - if (sl.getCurrentOptionData() == 4) + if (slCurrentOption == 4) { VRecMove* vrm = new VRecMove(recman); vrm->setParent(this); @@ -155,7 +156,7 @@ int VRecordingMenu::handleCommand(int command) return 2; } - if (sl.getCurrentOptionData() == 5) + if (slCurrentOption == 5) { VQuestion* v = new VQuestion(this); v->setSize(260, 180); @@ -208,20 +209,14 @@ void VRecordingMenu::processMessage(Message* m) { BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } - else + else if (coordsOutsideBox(m)) { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) - { - BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press - } + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } else if (m->message == Message::QUESTION_YES) { - if (sl.getCurrentOptionData() == 5) + if (reinterpret_cast(sl.getCurrentOptionData()) == 5) { Message* m2 = new Message(); // Delete self m2->from = this; diff --git a/vtimerlist.cc b/vtimerlist.cc index b81807b..b8eb713 100644 --- a/vtimerlist.cc +++ b/vtimerlist.cc @@ -154,7 +154,7 @@ bool VTimerList::load() LOCALTIME_R((time_t*)&rectime, &btime); strftime(strA, 299, "%d/%m %H:%M ", &btime); SNPRINTF(strB, 299, "%s\t%s", strA, recTimer->getName()); - sl.addOption(strB, (ULONG)recTimer, first); + sl.addOption(strB, recTimer, first); first = 0; } @@ -246,7 +246,7 @@ void VTimerList::drawIndicators() } } -void VTimerList::timercall(int clientReference) +void VTimerList::timercall(int /* clientReference */) { flipflop = !flipflop; #ifndef GRADIENT_DRAWING @@ -332,15 +332,9 @@ void VTimerList::processMessage(Message* m) { BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } - else + else if (coordsOutsideBox(m)) { - //check if press is outside this view! then simulate cancel - int x=(m->parameter>>16)-getScreenX(); - int y=(m->parameter&0xFFFF)-getScreenY(); - if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) - { - BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press - } + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } else if (m->message == Message::DELETE_SELECTED_TIMER) diff --git a/vwelcome.cc b/vwelcome.cc index 094e9d9..bb8b070 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -103,33 +103,33 @@ VWelcome::VWelcome() TVMediaInfo *info= new TVMediaInfo(); info->setStaticArtwork(sa_tv); - sl.addOption(tr("1. Live TV"), 1, 1,info); + sl.addOption(tr("1. Live TV"), reinterpret_cast(1), 1, info); info= new TVMediaInfo(); info->setStaticArtwork(sa_radio); - sl.addOption(tr("2. Radio"), 2, 0,info); + sl.addOption(tr("2. Radio"), reinterpret_cast(2), 0, info); info= new TVMediaInfo(); info->setStaticArtwork(sa_recordings); - sl.addOption(tr("3. Recordings"), 3, 0,info); + sl.addOption(tr("3. Recordings"), reinterpret_cast(3), 0, info); info= new TVMediaInfo(); info->setStaticArtwork(sa_timers); - sl.addOption(tr("4. Timers"), 4, 0,info); + sl.addOption(tr("4. Timers"), reinterpret_cast(4), 0, info); #ifdef VOMP_PLATTFORM_MVP - sl.addOption(tr("5. MediaPlayer"), 5, 0); + sl.addOption(tr("5. MediaPlayer"), reinterpret_cast(5), 0); #endif info= new TVMediaInfo(); info->setStaticArtwork(sa_properties); - sl.addOption(tr("6. Options"), 6, 0,info); + sl.addOption(tr("6. Options"), reinterpret_cast(6), 0,info); info= new TVMediaInfo(); info->setStaticArtwork(sa_restart); #ifndef VOMP_HAS_EXIT - sl.addOption(tr("7. Reboot"), 7, 0,info); + sl.addOption(tr("7. Reboot"), reinterpret_cast(7), 0,info); #else - sl.addOption(tr("7. Exit"), 7, 0,info); + sl.addOption(tr("7. Exit"), reinterpret_cast(7), 0,info); #endif @@ -240,7 +240,7 @@ int VWelcome::handleCommand(int command) } case Input::OK: { - ULONG option = sl.getCurrentOptionData(); + ULONG option = reinterpret_cast(sl.getCurrentOptionData()); if (option == 1) { doChannelsList(); diff --git a/wremoteconfig.cc b/wremoteconfig.cc index 3aeef85..96942df 100644 --- a/wremoteconfig.cc +++ b/wremoteconfig.cc @@ -76,7 +76,7 @@ void WRemoteConfig::initSelectList(bool startup) line += inputMan->getHardCodedHardwareKeyNamesForVompKey(static_cast(i)); line += " \t"; // FIXME extra spaces for braindead strtok. Ditch strtok. line += inputMan->getAllHardwareKeyNamesAssignedToVompKey(static_cast(i)); - sl.addOption(line.c_str(), i, 0); + sl.addOption(line.c_str(), reinterpret_cast(i), 0); } } @@ -230,7 +230,7 @@ int WRemoteConfig::handleCommand(int command) case Input::OK: { learnmode = true; - InputMan::getInstance()->EnterLearningMode(sl.getCurrentOptionData()); + InputMan::getInstance()->EnterLearningMode(reinterpret_cast(sl.getCurrentOptionData())); return 1; } case Input::BACK: diff --git a/wselectlist.cc b/wselectlist.cc index d6e50fa..e11dad2 100644 --- a/wselectlist.cc +++ b/wselectlist.cc @@ -83,7 +83,7 @@ void WSelectList::hintSetTop(int idx) topOption = idx; } -int WSelectList::addOption(const char* text, ULONG data, int selected, TVMediaInfo * pict) +int WSelectList::addOption(const char* text, void* data, int selected, TVMediaInfo * pict) { int thisNewOption = options.size(); @@ -271,7 +271,7 @@ int WSelectList::getCurrentOption() return selectedOption; } -ULONG WSelectList::getCurrentOptionData() +void* WSelectList::getCurrentOptionData() { if (!options.size()) return 0; return options[selectedOption].data; diff --git a/wselectlist.h b/wselectlist.h index 24b301c..07db58e 100644 --- a/wselectlist.h +++ b/wselectlist.h @@ -32,7 +32,7 @@ typedef struct { char* text; - ULONG data; + void* data; TVMediaInfo *pict; } wsloption; @@ -48,7 +48,7 @@ class WSelectList : public Boxx void setNoLoop(); void setShowSelOption(bool set) { showseloption = set; }; void setDarkSelOption(bool set) { darkseloption = set; }; - int addOption(const char* text, ULONG data, int selected, TVMediaInfo * pict=NULL); + int addOption(const char* text, void* data, int selected, TVMediaInfo * pict=NULL); void draw(); void setBackgroundColour(const DrawStyle& colour); void setLinesPerOption(float lines) {linesPerOption=lines;}; @@ -63,7 +63,7 @@ class WSelectList : public Boxx int getBottomOption(); // actually returns bottom + 1 i.e. the one just past display ?! int getNumOptionsDisplayable(); int getCurrentOption(); - ULONG getCurrentOptionData(); + void* getCurrentOptionData(); void hintSetCurrent(int index); void hintSetTop(int index); diff --git a/wwinaudiofilter.cc b/wwinaudiofilter.cc index 98f40f0..de04858 100644 --- a/wwinaudiofilter.cc +++ b/wwinaudiofilter.cc @@ -59,7 +59,7 @@ void WWinAudioFilter::initSelectList(bool startup) { char * desc=new char [strlen(name)+1]; strcpy(desc,name); - sl.addOption(desc,i,0); + sl.addOption(desc, reinterpret_cast(i), 0); } } diff --git a/wwinvideofilter.cc b/wwinvideofilter.cc index 67db7dc..93306c6 100644 --- a/wwinvideofilter.cc +++ b/wwinvideofilter.cc @@ -59,7 +59,7 @@ void WWinVideoFilter::initSelectList(bool startup) { char * desc=new char [strlen(name)+1]; strcpy(desc,name); - sl.addOption(desc,i,0); + sl.addOption(desc, reinterpret_cast(i), 0); } } -- 2.39.5