]> git.vomp.tv Git - vompclient.git/commitdiff
WOptionPane CWFs
authorChris Tallon <chris@vomp.tv>
Thu, 7 May 2020 15:00:13 +0000 (16:00 +0100)
committerChris Tallon <chris@vomp.tv>
Thu, 7 May 2020 15:00:13 +0000 (16:00 +0100)
woptionpane.cc

index 59b05b6b3691483c1d2126394f97ba23309357ca..1dcdcfe01503cc2cb3cdbf18fc162b4fe0b178e0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright 2007 Chris Tallon
+    Copyright 2007-2020 Chris Tallon
 
     This file is part of VOMP.
 
     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 <https://www.gnu.org/licenses/>.
 */
 
-#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;i<optionBoxes.size();i++) {
-        if (optionBoxes[i]->mouseMove(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<int>(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;i<optionBoxes.size();i++) {
-        if (optionBoxes[i]->mouseLBDOWN(x,y)) {
-            if ( selectedOption==(int)i) {
-                optionBoxes[selectedOption]->cycle();
-                return true;
-            } else {
-                return false;
-            }
-        }
+  for (int i = 0; i < static_cast<int>(optionBoxes.size()); i++)
+  {
+    if (optionBoxes[i]->mouseLBDOWN(x, y))
+    {
+      if (selectedOption == i)
+      {
+        optionBoxes[selectedOption]->cycle();
+        return true;
+      }
+      else
+      {
+        return false;
+      }
     }
-    return false;
+  }
+  return false;
 }
-
-
-
-