From ef0bff2374a383aedce1f07db643f7ce4ca5b053 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 7 Feb 2009 15:22:18 +0000 Subject: [PATCH] VRecording buttons fixed, mouse support fixed, wbutton text now centred --- vrecording.cc | 76 +++++++++++++++++++++++++++++++++++++++++++-------- wbutton.cc | 6 ++-- 2 files changed, 67 insertions(+), 15 deletions(-) diff --git a/vrecording.cc b/vrecording.cc index 516e0d9..d3b48f3 100644 --- a/vrecording.cc +++ b/vrecording.cc @@ -74,15 +74,22 @@ VRecording::VRecording(RecMan* trecman, Recording* trec) add(&summary); - buttonPlay.setPosition(70, area.h - 40); - buttonResume.setPosition(180, area.h - 40); + buttonPlay.setPosition(10, area.h - 40); + buttonResume.setPosition(150, area.h - 40); buttonMove.setPosition(290, area.h - 40); - buttonDelete.setPosition(400, area.h - 40); + buttonDelete.setPosition(430, area.h - 40); - buttonRegion.x = 70; + int sfh = Surface::getFontHeight(); + + buttonPlay.setSize(130, sfh); + buttonResume.setSize(130, sfh); + buttonMove.setSize(130, sfh); + buttonDelete.setSize(130, sfh); + + buttonRegion.x = 10; buttonRegion.y = area.h - 40; - buttonRegion.w = 460; - buttonRegion.h = Surface::getFontHeight(); + buttonRegion.w = 550; + buttonRegion.h = sfh; buttonPlay.setText(tr("Play")); buttonResume.setText(tr("Resume")); @@ -271,18 +278,64 @@ void VRecording::doLeft() void VRecording::processMessage(Message* m) { -/* if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) + if (buttonPlay.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - sl.draw(); + buttonPlay.setActive(1); + buttonResume.setActive(0); + buttonMove.setActive(0); + buttonDelete.setActive(0); + selected=1; + draw(); + BoxStack::getInstance()->update(this); + } + else if (buttonResume.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) + { + buttonPlay.setActive(0); + buttonResume.setActive(1); + buttonMove.setActive(0); + buttonDelete.setActive(0); + selected=2; + draw(); + BoxStack::getInstance()->update(this); + } + else if (buttonMove.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) + { + buttonPlay.setActive(0); + buttonResume.setActive(0); + buttonMove.setActive(1); + buttonDelete.setActive(0); + selected=3; + draw(); + BoxStack::getInstance()->update(this); + } + else if (buttonDelete.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) + { + buttonPlay.setActive(0); + buttonResume.setActive(0); + buttonMove.setActive(0); + buttonDelete.setActive(1); + selected=4; + draw(); BoxStack::getInstance()->update(this); } } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) + if (buttonPlay.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) + { + BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + } + else if (buttonResume.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) + { + BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + } + else if (buttonMove.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) + { + BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + } + else if (buttonDelete.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press } @@ -297,8 +350,7 @@ void VRecording::processMessage(Message* m) } } } - */ - if (m->message == Message::QUESTION_YES) + else if (m->message == Message::QUESTION_YES) { if (selected == 4) { diff --git a/wbutton.cc b/wbutton.cc index c0392e3..7340cf1 100644 --- a/wbutton.cc +++ b/wbutton.cc @@ -63,17 +63,17 @@ void WButton::draw() if (dimmed) { fillColour(Colour::BLACK); - drawText(mytext, 0, 0, Colour::SELECTHIGHLIGHT); + drawTextCentre(mytext, area.w / 2, 0, Colour::SELECTHIGHLIGHT); } else if (active) { fillColour(Colour::SELECTHIGHLIGHT); - drawText(mytext, 0, 0, Colour::DARKTEXT); + drawTextCentre(mytext, area.w / 2, 0, Colour::DARKTEXT); } else { fillColour(Colour::BUTTONBACKGROUND); - drawText(mytext, 0, 0, Colour::LIGHTTEXT); + drawTextCentre(mytext, area.w / 2, 0, Colour::LIGHTTEXT); } } -- 2.39.5