]> git.vomp.tv Git - vompclient.git/commitdiff
VRadioRec CWFs
authorChris Tallon <chris@vomp.tv>
Sat, 25 Apr 2020 13:05:27 +0000 (14:05 +0100)
committerChris Tallon <chris@vomp.tv>
Sat, 25 Apr 2020 13:05:27 +0000 (14:05 +0100)
vradiorec.cc

index 673ea77bfd414913f5e749c18ed88538d9e14022..df787f4c040cfdee192d02d82e83e6e87e3ac2b9 100644 (file)
@@ -274,24 +274,26 @@ void VRadioRec::processMessage(Message* m)
 {
   if (m->message == Message::MOUSE_LBDOWN)
   {
-    int x = m->parameter - getScreenX();
-    int y = m->tag - getScreenY();
+    UINT x = m->parameter - getScreenX();
+    UINT y = m->tag - getScreenY();
     if (!barShowing)
     {
       boxstack->handleCommand(Input::OK); //simulate rok press
     }
-    else if ((int)barRegion.x<=x && (int)barRegion.y<=y && ((int)barRegion.x+(int)barRegion.w)>=x
-             &&  ((int)barRegion.y+(int)barRegion.h)>=y)
+    else if (    (barRegion.x <= x)                  // If the click happened within the bar region...
+              && (barRegion.y <= y)
+              && ((barRegion.x + barRegion.w) >= x)
+              && ((barRegion.y + barRegion.h) >= y))
     {
-      int progBarXbase = barRegion.x + 300;
-      if (x>=(int)barRegion.x + progBarXbase + 24
-        && x<=(int)barRegion.x + progBarXbase + 4 + 302
-        && y>=(int)barRegion.y + 12 - 2
-        && y<=(int)barRegion.y + 12 - 2+28)
+      UINT progBarXbase = barRegion.x + 300;
+      if ( x >= barRegion.x + progBarXbase + 24
+        && x <= barRegion.x + progBarXbase + 4 + 302
+        && y >= barRegion.y + 12 - 2
+        && y <= barRegion.y + 12 - 2+28)
       {
-        int cx=x-(barRegion.x + progBarXbase + 4);
-        double percent=((double)cx)/302.*100.;
-        player->jumpToPercent(percent);
+        int cx = x - (barRegion.x + progBarXbase + 4);
+        double percent = 100 * cx / 302.;
+        player->jumpToPercent(percent); // FIXME check this still works
         doBar(3);
         return;
         //  int progressWidth = 302 * currentFrameNum / lengthFrames;