From f2222ba1bff959a57c518ea7a4be9d80db568a56 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 20 Apr 2008 16:21:04 +0000 Subject: [PATCH] Mouse code for windows --- vaudioselector.cc | 10 ++++++++++ vvideolivetv.cc | 25 ++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/vaudioselector.cc b/vaudioselector.cc index 2d89a34..a12397b 100644 --- a/vaudioselector.cc +++ b/vaudioselector.cc @@ -314,10 +314,19 @@ void VAudioSelector::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { + UINT lastsel=sl.getCurrentOption(); if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { sl.draw(); BoxStack::getInstance()->update(this); + if ((int)lastsel!=sl.getCurrentOption()) { + Message* m2 = new Message(); + m2->from = this; + m2->to = parent; + m2->message = Message::AUDIO_CHANGE_CHANNEL; + m2->parameter = (((AudioChannel*)sl.getCurrentOptionData())->pestype&0xFF)|(((AudioChannel*)sl.getCurrentOptionData())->type &0xFF)<<8 ; + Command::getInstance()->postMessageNoLock(m2); + } } } else if (m->message == Message::MOUSE_LBDOWN) @@ -337,3 +346,4 @@ void VAudioSelector::processMessage(Message* m) } } } + diff --git a/vvideolivetv.cc b/vvideolivetv.cc index 0fbd44b..f1bbcbf 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -785,7 +785,30 @@ void VVideoLiveTV::processMessage(Message* m) { if (m->message == Message::MOUSE_LBDOWN) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press + //check if press is outside this view! then simulate cancel + int x=(m->parameter>>16)-osd.getScreenX(); + int y=(m->parameter&0xFFFF)-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(Remote::RED); + } else if ((boxGreen.getX()<=x) && (boxGreen.getX()+(int)boxGreen.getWidth()>=x ) && + (boxGreen.getY()<=y) && (boxGreen.getY()+(int)boxGreen.getHeight()>=y)){ + BoxStack::getInstance()->handleCommand(Remote::GREEN); + } else if ((boxYellow.getX()<=x) && (boxYellow.getX()+(int)boxYellow.getWidth()>=x ) && + (boxYellow.getY()<=y) && (boxYellow.getY()+(int)boxYellow.getHeight()>=y )){ + BoxStack::getInstance()->handleCommand(Remote::YELLOW); + } else if ((boxBlue.getX()<=x) && (boxBlue.getX()+(int)boxBlue.getWidth()>=x ) && + (boxBlue.getY()<=y) && (boxBlue.getY()+(int)boxBlue.getHeight()>=y )){ + BoxStack::getInstance()->handleCommand(Remote::BLUE); + } else { + BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press + } + + } else { + BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press + } } else if (m->message == Message::CHANNEL_CHANGE) { -- 2.39.5