From 16a1b63ca879d24701a33393e789a86fff0ed76e Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 7 May 2020 16:13:21 +0100 Subject: [PATCH] WOptionBox CWFs --- woptionbox.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/woptionbox.cc b/woptionbox.cc index 9d1316f..bf3fb73 100644 --- a/woptionbox.cc +++ b/woptionbox.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2020 Chris Tallon This file is part of VOMP. @@ -14,18 +14,17 @@ 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 "woptionbox.h" - #include "colour.h" #include "log.h" #ifndef WIN32 #include "unistd.h" #endif +#include "woptionbox.h" + WOptionBox::WOptionBox() { numOptions = 0; @@ -97,7 +96,7 @@ void WOptionBox::addOption(const char* takeText) int length = strlen(takeText); char* newOption = new char[length + 1]; strcpy(newOption, takeText); - options = (char**)realloc(options, (numOptions+1) * sizeof(char*)); + options = static_cast(realloc(options, (numOptions+1) * sizeof(char*))); options[numOptions] = newOption; numOptions++; setData(); @@ -188,9 +187,12 @@ void WOptionBox::setSelected(int toSelect) bool WOptionBox::mouseMove(int x, int y) { - - if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0 - && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && !active) + if ( (x - getRootBoxOffsetX()) >= 0 + && (y - getRootBoxOffsetY()) >= 0 + && (x - getRootBoxOffsetX()) <= static_cast(area.w) + && (y - getRootBoxOffsetY()) <= static_cast(area.h) + && !active + ) { setActive(1); return true; @@ -201,9 +203,11 @@ bool WOptionBox::mouseMove(int x, int y) bool WOptionBox::mouseLBDOWN(int x, int y) { - - if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0 - && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && active) + if ( (x - getRootBoxOffsetX()) >= 0 + && (y - getRootBoxOffsetY()) >= 0 + && (x - getRootBoxOffsetX()) <= static_cast(area.w) + && (y - getRootBoxOffsetY()) <= static_cast(area.h) + && active) { return true; } -- 2.39.2