Add speed slider, new HeronLX with deltaMs as double
[SugarCubes.git] / _UIFramework.pde
index 7ed25850346f1a9ce7b67c33e8b9eec17cb5c194..3ca493b1658d365258104bc62381f826a35d8042 100644 (file)
@@ -602,11 +602,28 @@ public class UIParameterSlider extends UIParameterControl {
   }
   
   private boolean editing = false;
+  private long lastClick = 0;
+  private float doubleClickMode = 0;
+  private float doubleClickX = 0;
   protected void onMousePressed(float mx, float my) {
+    long now = millis();
     float handleLeft = 4 + parameter.getValuef() * (w-8-handleWidth);
     if (mx >= handleLeft && mx < handleLeft + handleWidth) {
       editing = true;
+    } else {
+      if ((now - lastClick) < 300 && abs(mx - doubleClickX) < 3) {
+        parameter.setValue(doubleClickMode);  
+      }
+      doubleClickX = mx;
+      if (mx < w*.25) {
+        doubleClickMode = 0;
+      } else if (mx > w*.75) {
+        doubleClickMode = 1;
+      } else {
+        doubleClickMode = 0.5;
+      }
     }
+    lastClick = now;
   }
   
   protected void onMouseReleased(float mx, float my) {
@@ -655,8 +672,11 @@ public class UIScrollList extends UIObject {
         itemColor = pendingColor;
       } else {
         labelColor = #000000;
-        itemColor = even ? #666666 : #777777;
+        itemColor = #707070;
       }
+      float factor = even ? .92 : 1.08;
+      itemColor = color(hue(itemColor), saturation(itemColor), min(100, factor*brightness(itemColor)));
+      
       pg.noStroke();
       pg.fill(itemColor);
       pg.rect(0, yp, w, itemHeight);
@@ -693,7 +713,6 @@ public class UIScrollList extends UIObject {
       if (scrollOffset + index < items.size()) {
         pressedItem = items.get(scrollOffset + index);
         pressedItem.onMousePressed();
-        pressedItem.select();
         redraw();
       }
     }
@@ -751,7 +770,6 @@ public interface ScrollItem {
   public boolean isSelected();
   public boolean isPending();
   public String getLabel();
-  public void select();
   public void onMousePressed();
   public void onMouseReleased();  
 }