From f6cd9d48ceefb572495196903575004fa5fc37b1 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 7 May 2020 16:00:13 +0100 Subject: [PATCH] WOptionPane CWFs --- woptionpane.cc | 86 ++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/woptionpane.cc b/woptionpane.cc index 59b05b6..1dcdcfe 100644 --- a/woptionpane.cc +++ b/woptionpane.cc @@ -1,5 +1,5 @@ /* - Copyright 2007 Chris Tallon + Copyright 2007-2020 Chris Tallon This file is part of VOMP. @@ -14,11 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ -#include "woptionpane.h" #include "wtextbox.h" #include "i18n.h" #include "woptionbox.h" @@ -26,6 +24,7 @@ #include "vdr.h" #include "input.h" #include "option.h" +#include "woptionpane.h" WOptionPane::WOptionPane() { @@ -62,8 +61,7 @@ void WOptionPane::addOptionLine(Option* option) { int fontHeight = getFontHeight(); - - options.resize(numOptions+1); + options.resize(numOptions + 1); options[numOptions] = option; WTextbox* tb = new WTextbox(); @@ -73,7 +71,7 @@ void WOptionPane::addOptionLine(Option* option) tb->setTextPos(0, 0); add(tb); - textBoxes.resize(numOptions+1); + textBoxes.resize(numOptions + 1); textBoxes[numOptions] = tb; WOptionBox* ob = new WOptionBox(); @@ -81,7 +79,7 @@ void WOptionPane::addOptionLine(Option* option) ob->setSize(190, fontHeight); add(ob); - optionBoxes.resize(numOptions+1); + optionBoxes.resize(numOptions + 1); optionBoxes[numOptions] = ob; if (option->optionType == Option::TYPE_TEXT || @@ -104,18 +102,17 @@ void WOptionPane::addOptionLine(Option* option) } numOptions++; - } void WOptionPane::deactivateAllControls() { - if (selectedOption >= 0) { - optionBoxes[selectedOption]->setActive(0); - selectedOption = -1; - } + if (selectedOption >= 0) + { + optionBoxes[selectedOption]->setActive(0); + selectedOption = -1; + } } - int WOptionPane::handleCommand(int command) { switch(command) @@ -140,6 +137,7 @@ int WOptionPane::handleCommand(int command) optionBoxes[selectedOption]->setActive(1); return 1; } + FALLTHROUGH // it doesn't really } case Input::DOWN: { @@ -156,6 +154,7 @@ int WOptionPane::handleCommand(int command) selectedOption = -1; return 4; // Signal return control to parent } + FALLTHROUGH // it doesn't really } case Input::LEFT: { @@ -179,38 +178,41 @@ int WOptionPane::handleCommand(int command) bool WOptionPane::mouseMove(int x, int y) { - UINT i; - for (i=0;imouseMove(x,y)) { - if ( selectedOption!=(int)i) { - if (selectedOption != -1 ) optionBoxes[selectedOption]->setActive(0); - selectedOption=i; - return true; - } else { - return false; - } - } + for (int i = 0; i < static_cast(optionBoxes.size()); i++) + { + if (optionBoxes[i]->mouseMove(x, y)) + { + if (selectedOption != i) + { + if (selectedOption != -1) optionBoxes[selectedOption]->setActive(0); + selectedOption = i; + return true; + } + else + { + return false; + } } - - return false; + } + return false; } bool WOptionPane::mouseLBDOWN(int x, int y) { - UINT i; - for (i=0;imouseLBDOWN(x,y)) { - if ( selectedOption==(int)i) { - optionBoxes[selectedOption]->cycle(); - return true; - } else { - return false; - } - } + for (int i = 0; i < static_cast(optionBoxes.size()); i++) + { + if (optionBoxes[i]->mouseLBDOWN(x, y)) + { + if (selectedOption == i) + { + optionBoxes[selectedOption]->cycle(); + return true; + } + else + { + return false; + } } - return false; + } + return false; } - - - - -- 2.39.2