[longomatch/newui: 6/50] Configure wait times for moves and clicks



commit d4af59c34da4021a34ee545d614010447ddf9fab
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Aug 13 11:23:22 2014 +0200

    Configure wait times for moves and clicks

 LongoMatch.Drawing.Cairo/WidgetWrapper.cs |    8 +++++++-
 LongoMatch.Drawing/Canvas.cs              |    8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Drawing.Cairo/WidgetWrapper.cs b/LongoMatch.Drawing.Cairo/WidgetWrapper.cs
index 313e924..9fbb5ed 100644
--- a/LongoMatch.Drawing.Cairo/WidgetWrapper.cs
+++ b/LongoMatch.Drawing.Cairo/WidgetWrapper.cs
@@ -45,6 +45,7 @@ namespace LongoMatch.Drawing.Cairo
                public WidgetWrapper (DrawingArea widget)
                {
                        this.widget = widget;
+                       MoveWaitMS = 200;
                        widget.AddEvents ((int)EventMask.PointerMotionMask);
                        widget.AddEvents ((int)EventMask.ButtonPressMask);
                        widget.AddEvents ((int)EventMask.ButtonReleaseMask);
@@ -55,6 +56,11 @@ namespace LongoMatch.Drawing.Cairo
                        widget.MotionNotifyEvent += HandleMotionNotifyEvent;
                }
 
+               public uint MoveWaitMS {
+                       get;
+                       set;
+               }
+               
                public double Width {
                        get {
                                return currentWidth;
@@ -280,7 +286,7 @@ namespace LongoMatch.Drawing.Cairo
                         * should be ignored. Start moving only when the button has been
                         * pressed for more than 200ms */
                        canMove = false;
-                       moveTimerID = GLib.Timeout.Add (200, ReadyToMove);
+                       moveTimerID = GLib.Timeout.Add (MoveWaitMS, ReadyToMove);
                        if (ButtonPressEvent != null) {
                                ButtonType bt;
                                ButtonModifier bm;
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index 3407cd3..33a2d17 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -93,6 +93,7 @@ namespace LongoMatch.Drawing
                        Selections = new List<Selection> ();
                        SelectionMode = MultiSelectionMode.Single;
                        Accuracy = 1;
+                       ClickRepeatMS = 100;
                        MoveWithoutSelection = false;
                        ObjectsCanMove = true;
                        
@@ -102,6 +103,11 @@ namespace LongoMatch.Drawing
                        widget.ShowTooltipEvent += HandleShowTooltipEvent;
                }
 
+               public int ClickRepeatMS {
+                       get;
+                       set;
+               }
+               
                public double Accuracy {
                        get;
                        set;
@@ -293,7 +299,7 @@ namespace LongoMatch.Drawing
 
                void HandleButtonPressEvent (Point coords, uint time, ButtonType type, ButtonModifier 
modifier)
                {
-                       if (time - lastTime < 500) {
+                       if (time - lastTime < ClickRepeatMS) {
                                return;
                        }
                        coords = ToUserCoords (coords); 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]