Example #1
0
        void HandleButtonPressEvent(Point coords, uint time, ButtonType type, ButtonModifier modifier, ButtonRepetition repetition)
        {
            if (IgnoreClicks)
            {
                return;
            }

            coords = ToUserCoords(coords);
            if (repetition == ButtonRepetition.Single)
            {
                if (type == ButtonType.Left)
                {
                    /* For OS X CTRL+Left emulating right click */
                    if (modifier == ButtonModifier.Meta)
                    {
                        HandleRightButton(coords, modifier);
                    }
                    HandleLeftButton(coords, modifier);
                }
                else if (type == ButtonType.Right)
                {
                    HandleRightButton(coords, modifier);
                }
            }
            else
            {
                HandleDoubleClick(coords, modifier);
            }
        }
Example #2
0
        public override void ClickPressed(Point p, ButtonModifier modif, Selection selection)
        {
            if (ButtonVM.Mode == DashboardMode.Edit || Button.ShowSettingIcon)
            {
                editClicked = CheckRect(p, editRect, editbutton);
                if (editClicked || ButtonVM.Mode == DashboardMode.Edit)
                {
                    return;
                }
            }

            foreach (Rectangle rect in buttonsRects.Keys)
            {
                if (CheckRect(p, rect, buttonsRects [rect]))
                {
                    return;
                }
            }
            foreach (Rectangle rect in rects.Keys)
            {
                if (CheckRect(p, rect, rects [rect]))
                {
                    return;
                }
            }
        }
Example #3
0
        protected virtual void HandleLeftButton(Point coords, ButtonModifier modif)
        {
            Selection sel;

            sel = GetSelection(coords);

            clickedSel = sel;
            if (sel != null)
            {
                (sel.Drawable as ICanvasObject).ClickPressed(coords, modif);
            }

            if ((SelectionMode == MultiSelectionMode.Multiple) ||
                (SelectionMode == MultiSelectionMode.MultipleWithModifier &&
                 (modif == ButtonModifier.Control ||
                  modif == ButtonModifier.Shift)))
            {
                if (sel != null)
                {
                    sel.Position = SelectionPosition.All;
                    UpdateSelection(sel);
                }
            }
            else
            {
                ClearSelection();
                MoveStart = coords;
                UpdateSelection(sel);
                StartMove(sel);
                Moving = Selections.Count > 0 && ObjectsCanMove;
            }
        }
        bool ButtonClickPressed(Point point, ButtonModifier modif, params ButtonObject [] buttons)
        {
            Selection sel;

            if (!ViewModel.ShowSubstitutionButtons && !ViewModel.ShowTeamsButtons)
            {
                return(false);
            }

            foreach (ButtonObject button in buttons)
            {
                if (!button.Visible)
                {
                    continue;
                }
                sel = button.GetSelection(point, 0);
                if (sel != null)
                {
                    clickedButton = sel.Drawable as ButtonObject;
                    (sel.Drawable as ICanvasObject).ClickPressed(point, modif);
                    return(true);
                }
            }
            return(false);
        }
Example #5
0
 public override void ClickPressed(Point p, ButtonModifier modif, Selection selection)
 {
     base.ClickPressed(p, modif, selection);
     Position = p;
     moving   = true;
     modified = true;
 }
Example #6
0
 public override void ClickPressed(Point p, ButtonModifier modif, Selection selection)
 {
     if (!insensitive)
     {
         base.ClickPressed(p, modif, selection);
         ReDraw();
     }
 }
Example #7
0
 protected void PCardAction(ButtonModifier modifier, PlayerVM player)
 {
     HandleClickedPCardEvent(new ClickedPCardEvent {
         ClickedPlayer = player,
         Modifier      = modifier,
         Sender        = player
     });
 }
Example #8
0
 public override void ClickPressed(Point p, ButtonModifier modif, Selection selection)
 {
     if (IsClickInsideButton(p))
     {
         Active  = !Active;
         clicked = true;
     }
 }
Example #9
0
 /// <summary>
 /// Forces a Click at a concrete Point position
 /// </summary>
 /// <param name="p">Position</param>
 /// <param name="modif">Button Modifier</param>
 public void Click(Point p, ButtonModifier modif)
 {
     if (IsClickInsideButton(p))
     {
         ClickPressed(p, ButtonModifier.None, null);
         ClickReleased();
     }
 }
Example #10
0
 public override void ClickPressed(Point p, ButtonModifier modif, Selection selection)
 {
     base.ClickPressed(p, modif, selection);
     if (selection.Position == SelectionPosition.Left || selection.Position == SelectionPosition.Right)
     {
         ViewModel.SelectedGrabber = selection.Position;
     }
 }
Example #11
0
 /// <summary>
 /// Creates a new menu item attribute with a shortcut. Pressing the shortcut key or selecting the item in the menu
 /// will trigger the menu item callback.
 /// </summary>
 /// <param name="path">Path that determines where in the menu to add the element. All path elements must be
 ///                    separated by /, e.g. "View/Toolbars/Find"</param>
 /// <param name="shortcutModifier">Optional shortcut modifier that needs to be pressed along with the shortcut
 ///                                button in order to trigger the shortcut.</param>
 /// <param name="shortcutKey">Shortcut key that will trigger the shortcut.</param>
 /// <param name="priority">Priority determines the position of the menu item relative to its siblings.
 ///                        Higher priority means it will be placed earlier in the menu.</param>
 /// <param name="separator">Determines should a separator be inserted just before this element.</param>
 /// <param name="contextCallback">Name of a method that returns a boolean determining whether the menu item callback
 ///                               is allowed to trigger. This is useful if menu items are only valid in specific
 ///                               situations (e.g. a scene object must be selected). The method must be static,
 ///                               return a boolean value, accept no parameters and be in the same class as
 ///                               the method this attribute is attached to.</param>
 public MenuItem(string path, ButtonModifier shortcutModifier, ButtonCode shortcutKey, int priority = 0,
                 bool separator = false, string contextCallback = null)
 {
     this.path            = path;
     this.shortcut        = new ShortcutKey(shortcutModifier, shortcutKey);
     this.priority        = priority;
     this.separator       = separator;
     this.contextCallback = contextCallback;
 }
Example #12
0
 /// <summary>
 /// Method to click a LMPlayerVM
 /// </summary>
 /// <param name="player">Player.</param>
 /// <param name="modifier">Modifier.</param>
 public void PlayerClick(LMPlayerVM player, ButtonModifier modifier)
 {
     App.Current.EventsBroker.Publish(new TagPlayerEvent {
         Player   = player,
         Team     = GetTeam(player),
         Modifier = modifier,
         Sender   = player
     });
 }
Example #13
0
 protected virtual void HandleRightButton(Point coords, ButtonModifier modif)
 {
     if (Selections.Count <= 1)
     {
         ClearSelection();
         UpdateSelection(GetSelection(coords));
     }
     ShowMenu(coords);
 }
Example #14
0
 void HandleButtonReleasedEvent(Point coords, ButtonType type, ButtonModifier modifier)
 {
     Moving = false;
     if (clickedSel != null)
     {
         (clickedSel.Drawable as ICanvasSelectableObject).ClickReleased();
         clickedSel = null;
     }
     StopMove(Moved);
     Moved = false;
 }
Example #15
0
        protected override void HandleDoubleClick(Point coords, ButtonModifier modif)
        {
            base.HandleDoubleClick(coords, modif);

            if (Selections.Any())
            {
                if (CenterPlayheadClicked != null)
                {
                    CenterPlayheadClicked(this, new EventArgs());
                }
            }
        }
 public override void ClickReleased()
 {
     if (clickedButton != null)
     {
         clickedButton.ClickReleased();
         clickedButton = null;
     }
     else if (clickedPlayer != null)
     {
         clickedPlayer.ClickReleased();
         modifier = ButtonModifier.None;
     }
 }
Example #17
0
        protected override void HandleLeftButton(Point coords, ButtonModifier modif)
        {
            base.HandleLeftButton(coords, modif);
            Time clickTime = Utils.PosToTime(new Point(coords.X + Scroll, 0), SecondsPerPixel);

            if (clickTime >= Duration)
            {
                return;
            }
            needle.X = coords.X;
            viewModel.SeekCommand.Execute(new VideoPlayerSeekOptions(clickTime, true));
            needle.ReDraw();
        }
Example #18
0
        public override void ClickPressed(Point point, ButtonModifier modif)
        {
            Selection selection = null;

            if (ButtonClickPressed(point, modif, subPlayers, subInjury,
                                   homeButton, awayButton))
            {
                return;
            }

            if (!SubstitutionMode && SelectionMode != MultiSelectionMode.Multiple)
            {
                if (SelectionMode == MultiSelectionMode.Single || modif == ButtonModifier.None)
                {
                    ResetSelection();
                }
            }

            point     = Utils.ToUserCoords(point, offset, scaleX, scaleY);
            selection = homeBench.GetSelection(point, 0, false);
            if (selection == null)
            {
                selection = awayBench.GetSelection(point, 0, false);
                if (selection == null)
                {
                    selection = field.GetSelection(point, 0, false);
                }
            }
            if (selection != null)
            {
                clickedPlayer = selection.Drawable as PlayerObject;
                if (SubstitutionMode && substitutionPlayer != null &&
                    clickedPlayer.Team != substitutionPlayer.Team)
                {
                    clickedPlayer = null;
                }
                else
                {
                    (selection.Drawable as ICanvasObject).ClickPressed(point, modif);
                }
            }
            else
            {
                clickedPlayer = null;
            }
        }
        public override void ClickPressed(Point point, ButtonModifier modif)
        {
            Selection selection = null;

            modifier = ButtonModifier.None;
            if (ButtonClickPressed(point, modif, subPlayers, subInjury,
                                   homeButton, awayButton))
            {
                return;
            }

            // FIXME: this is very awkward, click events should be forwarded to the child views
            point     = VASDrawing.Utils.ToUserCoords(point, offset, scaleX, scaleY);
            selection = homeBench.GetSelection(point, 0, false);
            if (selection == null)
            {
                selection = awayBench.GetSelection(point, 0, false);
                if (selection == null)
                {
                    selection = field.GetSelection(point, 0, false);
                    if (selection != null)
                    {
                        point = VASDrawing.Utils.ToUserCoords(point, field.Position, 1, 1);
                    }
                }
                else
                {
                    point = VASDrawing.Utils.ToUserCoords(point, awayBench.Position, 1, 1);
                }
            }
            else
            {
                point = VASDrawing.Utils.ToUserCoords(point, homeBench.Position, 1, 1);
            }
            if (selection != null)
            {
                clickedPlayer = selection.Drawable as LMPlayerView;
                modifier      = modif;
                (selection.Drawable as ICanvasObject).ClickPressed(point, modif);
            }
            else
            {
                clickedPlayer = null;
            }
        }
Example #20
0
 public override void ClickPressed(Point p, ButtonModifier modif)
 {
     if (Mode == DashboardMode.Edit)
     {
         editClicked = CheckRect(p, editRect, editbutton);
         return;
     }
     foreach (Rectangle rect in buttonsRects.Keys)
     {
         if (CheckRect(p, rect, buttonsRects [rect]))
         {
             return;
         }
     }
     foreach (Rectangle rect in rects.Keys)
     {
         if (CheckRect(p, rect, rects [rect]))
         {
             return;
         }
     }
 }
Example #21
0
 void HandleButtonPressEvent(Point coords, uint time, ButtonType type, ButtonModifier modifier)
 {
     if (time - lastTime < ClickRepeatMS)
     {
         return;
     }
     coords = ToUserCoords(coords);
     if (type == ButtonType.Left)
     {
         /* For OS X CTRL+Left emulating right click */
         if (modifier == ButtonModifier.Meta)
         {
             HandleRightButton(coords, modifier);
         }
         HandleLeftButton(coords, modifier);
     }
     else if (type == ButtonType.Right)
     {
         HandleRightButton(coords, modifier);
     }
     lastTime = time;
 }
Example #22
0
 protected override void HandleLeftButton(Point coords, ButtonModifier modif)
 {
     modifier = modif;
     base.HandleLeftButton (coords, modif);
 }
Example #23
0
 /// <summary>
 /// Registers a new virtual button.
 /// </summary>
 /// <param name="name">Unique name used to access the virtual button.</param>
 /// <param name="buttonCode">Physical button the virtual button is triggered by.</param>
 /// <param name="modifiers">Modifiers required to be pressed with the physical button to trigger the virtual button.
 ///                         </param>
 /// <param name="repeatable">If true, the virtual button events will be sent continually while the physical button 
 ///                          is being held.</param>
 public void RegisterButton(String name, ButtonCode buttonCode, 
     ButtonModifier modifiers = ButtonModifier.None, bool repeatable = false)
 {
     Internal_RegisterButton(mCachedPtr, name, buttonCode, modifiers, repeatable);
 }
 private static extern void Internal_RegisterButton(IntPtr thisPtr, String name, ButtonCode buttonCode,
                                                    ButtonModifier modifiers, bool repeatable);
Example #25
0
 private static extern void Internal_RegisterButton(IntPtr thisPtr, String name, ButtonCode buttonCode,
     ButtonModifier modifiers, bool repeatable);
Example #26
0
 protected virtual void HandleRightButton(Point coords, ButtonModifier modif)
 {
     if (Selections.Count <= 1) {
         ClearSelection ();
         UpdateSelection (GetSelection (coords));
     }
     ShowMenu (coords);
 }
Example #27
0
 public new void HandleLeftButton(Point coords, ButtonModifier modif)
 {
     base.HandleLeftButton(coords, modif);
 }
Example #28
0
 public virtual void ClickPressed(Point p, ButtonModifier modif, Selection selection)
 {
 }
        public override void ClickPressed(Point point, ButtonModifier modif)
        {
            Selection selection = null;

            if (ButtonClickPressed (point, modif, subPlayers, subInjury,
                    homeButton, awayButton)) {
                return;
            }

            if (!SubstitutionMode && SelectionMode != MultiSelectionMode.Multiple) {
                if (SelectionMode == MultiSelectionMode.Single || modif == ButtonModifier.None) {
                    ResetSelection ();
                }
            }

            point = VASDrawing.Utils.ToUserCoords (point, offset, scaleX, scaleY);
            selection = homeBench.GetSelection (point, 0, false);
            if (selection == null) {
                selection = awayBench.GetSelection (point, 0, false);
                if (selection == null) {
                    selection = field.GetSelection (point, 0, false);
                }
            }
            if (selection != null) {
                clickedPlayer = selection.Drawable as SportsPlayerObject;
                if (SubstitutionMode && substitutionPlayer != null &&
                    clickedPlayer.Team != substitutionPlayer.Team) {
                    clickedPlayer = null;
                } else {
                    (selection.Drawable as ICanvasObject).ClickPressed (point, modif);
                }
            } else {
                clickedPlayer = null;
            }
        }
Example #30
0
 public override void ClickPressed(Point p, ButtonModifier modif)
 {
     cancelPressed = cancelRect.GetSelection (p) != null;
 }
Example #31
0
 protected virtual void HandleDoubleClick(Point coords, ButtonModifier modif)
 {
 }
Example #32
0
        protected virtual void HandleLeftButton(Point coords, ButtonModifier modif)
        {
            Selection sel;

            sel = GetSelection (coords);

            clickedSel = sel;
            if (sel != null) {
                (sel.Drawable as ICanvasObject).ClickPressed (coords, modif);
            }

            if ((SelectionMode == MultiSelectionMode.Multiple) ||
                (SelectionMode == MultiSelectionMode.MultipleWithModifier &&
                (modif == ButtonModifier.Control ||
                modif == ButtonModifier.Shift))) {
                if (sel != null) {
                    sel.Position = SelectionPosition.All;
                    UpdateSelection (sel);
                }
            } else {
                ClearSelection ();
                MoveStart = coords;
                UpdateSelection (sel);
                StartMove (sel);
                Moving = Selections.Count > 0 && ObjectsCanMove;
            }
        }
Example #33
0
 public override void ClickPressed(Point p, ButtonModifier modif)
 {
     Active = !Active;
 }
Example #34
0
 public virtual void ClickPressed(Point p, ButtonModifier modif)
 {
 }
Example #35
0
 /// <summary>
 /// Creates a new shortcut key.
 /// </summary>
 /// <param name="modifier">Optional modifier that is required to be pressed along with the shortcut button.</param>
 /// <param name="key">Shortcut button that triggers the shortcut.</param>
 public ShortcutKey(ButtonModifier modifier, ButtonCode key)
 {
     this.modifier = modifier;
     this.key      = key;
 }
Example #36
0
 void HandleButtonReleasedEvent(Point coords, ButtonType type, ButtonModifier modifier)
 {
     Moving = false;
     if (clickedSel != null) {
         (clickedSel.Drawable as ICanvasSelectableObject).ClickReleased ();
         clickedSel = null;
     }
     StopMove (Moved);
     Moved = false;
 }
Example #37
0
 /// <summary>
 /// Creates a new shortcut key.
 /// </summary>
 /// <param name="modifier">Optional modifier that is required to be pressed along with the shortcut button.</param>
 /// <param name="key">Shortcut button that triggers the shortcut.</param>
 public ShortcutKey(ButtonModifier modifier, ButtonCode key)
 {
     this.modifier = modifier;
     this.key = key;
 }
        bool ButtonClickPressed(Point point, ButtonModifier modif, params ButtonObject[] buttons)
        {
            Selection sel;

            if (!ShowSubsitutionButtons && !ShowTeamsButtons) {
                return false;
            }

            foreach (ButtonObject button in buttons) {
                if (!button.Visible)
                    continue;
                sel = button.GetSelection (point, 0);
                if (sel != null) {
                    clickedButton = sel.Drawable as ButtonObject;
                    (sel.Drawable as ICanvasObject).ClickPressed (point, modif);
                    return true;
                }
            }
            return false;
        }
Example #39
0
 public override void ClickPressed(Point p, ButtonModifier modif)
 {
     if (Mode == DashboardMode.Edit) {
         editClicked = CheckRect (p, editRect, editbutton);
         return;
     }
     foreach (Rectangle rect in buttonsRects.Keys) {
         if (CheckRect (p, rect, buttonsRects [rect])) {
             return;
         }
     }
     foreach (Rectangle rect in rects.Keys) {
         if (CheckRect (p, rect, rects [rect])) {
             return;
         }
     }
 }
Example #40
0
 public override void ClickPressed(Point p, ButtonModifier modif, Selection selection)
 {
     cancelPressed = cancelRect.GetSelection(p) != null;
     base.ClickPressed(p, modif, selection);
 }
Example #41
0
 /// <summary>
 /// Returns the event that exists for a mouse button and a modifier
 /// </summary>
 /// <param name="button">Button.</param>
 /// <param name="modifier">Modifier.</param>
 public Event OnMouse(MouseButton button, ButtonModifier modifier)
 {
     return(_mouseEvents [button] [modifier]);
 }
Example #42
0
 void HandleButtonPressEvent(Point coords, uint time, ButtonType type, ButtonModifier modifier)
 {
     if (time - lastTime < ClickRepeatMS) {
         return;
     }
     coords = ToUserCoords (coords);
     if (type == ButtonType.Left) {
         /* For OS X CTRL+Left emulating right click */
         if (modifier == ButtonModifier.Meta) {
             HandleRightButton (coords, modifier);
         }
         HandleLeftButton (coords, modifier);
     } else if (type == ButtonType.Right) {
         HandleRightButton (coords, modifier);
     }
     lastTime = time;
 }