public virtual void OnKeyPressed(KeyActionEventArgs e) { KeyEditBehaviour(e); if (e.Handled) { return; } focusAfterEdit = false; hoverAfteredit = false; bool insert = false; if (e.Key == Key.Return && e.Modifiers == ModifierKeys.Control) { insert = true; } if (e.Key == Key.Insert) { insert = true; focusAfterEdit = true; } if (insert) { Insert(CursorPosition()); e.Handled = true; } }
public virtual void OnKeyReleased(KeyActionEventArgs e) { if (Resolved) { Resolved = false; } }
public override void OnKeyPressed(KeyActionEventArgs e) { base.OnKeyPressed(e); if (e.Key == Key.Delete && (e.Modifiers == ModifierKeys.Control)) { Delete(); } }
protected override Rectangle ProcessKey(KeyActionEventArgs e) { var result = base.ProcessKey(e); if (KeyProcessed != null) { KeyProcessed(result); } return(result); }
public void OnKeyReleased(KeyActionEventArgs e) { Resolved = false; foreach (IKeyAction keyAction in KeyActions) { if (keyAction.Enabled) { Resolved = keyAction.Resolved || Resolved; bool exclusive = keyAction.Exclusive; keyAction.OnKeyReleased(e); if (exclusive || e.Handled) { break; } } } Perform(); }
public override void OnKeyPressed(KeyActionEventArgs e) { Trace.WriteLine(string.Format("folding key {0} {1}", e.Key, e.Modifiers)); base.OnKeyPressed(e); var folder = Folding.Folder; Action <Action> fold = a => Folding.Fold(a); if (e.Key == Key.Delete && e.Modifiers == ModifierKeys.None) { Folding.Hide(); } else if (e.Key == Key.Delete && (e.Modifiers == ModifierKeys.Control)) { Folding.Delete(); } else if ((e.Key == Key.NumPadAdd || e.Key == Key.Plus) && e.Modifiers == ModifierKeys.None) { fold(() => folder.Expand(false)); } else if ((e.Key == Key.NumPadSubtract || e.Key == Key.Minus) && e.Modifiers == ModifierKeys.None) { fold(() => folder.Collapse()); } else if ((e.Key == Key.NumPadDivide || e.Key == Key.Slash)) { fold(() => folder.CollapseToFocused()); } else if ((e.Key == Key.NumPadMultiply || e.Key == Key.Asterisk) && e.Modifiers == ModifierKeys.Control) { fold(() => folder.ShowAllData()); } else if (((e.Key == Key.NumPadMultiply || e.Key == Key.Asterisk) && e.Modifiers == ModifierKeys.None) || (e.Key == Key.Plus && e.Modifiers == ModifierKeys.Shift)) { fold(() => folder.Expand(true)); } else if ((e.Key == Key.Space && e.Modifiers == ModifierKeys.None)) { fold(() => folder.Toggle()); } }
public void OnKeyPressed(KeyActionEventArgs e) { if (UserEventsDisabled) { return; } Resolved = false; foreach (IKeyAction keyAction in KeyActions) { if (keyAction.Enabled) { keyAction.OnKeyPressed(e); Resolved = keyAction.Resolved || Resolved; if (keyAction.Exclusive) { break; } } } Perform(); }
void IKeyAction.OnKeyPressed(KeyActionEventArgs e) { var key = e.Key.ToUpper(); if (key == Key.C && e.Modifiers == ModifierKeys.Control) { if (Scene.Focused != null) { this.Copy(); e.Handled = true; } } if (key == Key.V && e.Modifiers == ModifierKeys.Control) { this.Paste(); e.Handled = true; } }
private async void ScreenMasterConsole_KeyAction(object sender, KeyActionEventArgs e) { //Look up button reference var mapping = buttonMap.GetConfigForButton(e.KeyIndex); if (mapping != null) { if (mapping.CustomKey != null) { if (e.IsPressed) { //Light pressed button screenMasterConsole.SetLamps(true, e.KeyIndex); //Clear light on other buttons in same group var keyConfig = buttonMap.GetConfigForButton(e.KeyIndex); if (keyConfig != null && !string.IsNullOrEmpty(keyConfig.CustomGroup)) { var otherGroupKeys = buttonMap.GetKeysInGroup(keyConfig.CustomGroup) .Except(new int[] { e.KeyIndex }) .ToArray(); if (otherGroupKeys.Length > 0) { screenMasterConsole.SetLamps(false, otherGroupKeys); } } //Process segment changes based on selection await SetSpyderConsoleSegments(buttonMap.GetSegmentConfigsForCustomKey(keyConfig.CustomKey)).ConfigureAwait(false); } } else { //Send direct key action to Spyder spyderConsole.ButtonAction(mapping.SegmentID, mapping.SpyderButtonIndex, e.IsPressed); } } }
public void OnKeyReleased(KeyActionEventArgs e) { }
public virtual void OnKeyPressed(KeyActionEventArgs e) { Resolved = false; }
void IKeyAction.OnKeyReleased(KeyActionEventArgs e) { }
void IKeyAction.OnKeyPressed(KeyActionEventArgs e) { if (!(e.Modifiers.HasFlag(ModifierKeys.Control) || e.Modifiers.HasFlag(ModifierKeys.Alt))) { return; } var key = e.Key.ToUpper(); if (key == Key.A) { Select(Scene, Scene.Elements, e.Modifiers); e.Handled = true; } if (key == Key.F) { if (Scene.Focused != null) { Select(Scene, Scene.Graph.Foliage(Scene.Graph.Fork(Scene.Focused)), e.Modifiers); } e.Handled = true; } if (key == Key.T) { if (Scene.Focused != null) { Select(Scene, Scene.Graph.Foliage(Scene.Graph.Twig(Scene.Focused)), e.Modifiers); } e.Handled = true; } if (key == Key.D) { if (Scene.Focused != null) { Select(Scene, Scene.Graph.Foliage(Scene.Graph.Walk().DeepWalk(Scene.Focused, 0).Edges <TItem, TEdge> ()), e.Modifiers); } e.Handled = true; } if (key == Key.E) { if (Scene.Focused != null) { Select(Scene, Scene.Graph.Foliage(Scene.Graph.Walk().ExpandWalk(Scene.Focused, 0).Edges <TItem, TEdge>()), e.Modifiers); } e.Handled = true; } if (key == Key.W) { if (Scene.Focused != null) { Select(Scene, Scene.Graph.Foliage(Scene.Graph.Walk().Walk(Scene.Focused, 0).Edges <TItem, TEdge>()), e.Modifiers); } e.Handled = true; } if (key == Key.K) { if (Scene.Focused != null) { Select(Scene, Scene.Graph.Foliage(Scene.Graph.Walk().CollapseWalk(Scene.Focused, 0).Edges <TItem, TEdge>()), e.Modifiers); } e.Handled = true; } }
protected virtual Rectangle ProcessKey(KeyActionEventArgs e) { base.OnKeyPressed(e); var viewport = Viewport(); var x = 0d; var y = 0d; if (e.Key == Key.Down && e.Modifiers == ModifierKeys.None) { y = 1; } if (e.Key == Key.Up && e.Modifiers == ModifierKeys.None) { y = -1; } if (e.Key == Key.Left && e.Modifiers == ModifierKeys.None) { x = -1; } if (e.Key == Key.Right && e.Modifiers == ModifierKeys.None) { x = 1; } if (x != 0d || y != 0d) { var pos = viewport.ClipOrigin; var size = viewport.ClipSize; var bounds = new Rectangle(viewport.DataOrigin, new Size((int)viewport.DataSize.Width, (int)viewport.DataSize.Height)); var result = Rectangle.FromLTRB( x == -1 && pos.X == bounds.X ? -1 : 0, y == -1 && pos.Y == bounds.Y ? -1 : 0, x == 1 && pos.X + size.Width >= bounds.Width ? 1 : 0, y == 1 && pos.Y + size.Height >= bounds.Height ? 1 : 0 ); x = pos.X + x * (size.Width / 10); y = pos.Y + y * (size.Height / 10); if (x < bounds.Left) { x = bounds.Left; } if (x > bounds.Right) { x = bounds.Right - size.Width; } if (y < bounds.Top) { y = bounds.Top; } if (y > bounds.Bottom) { y = bounds.Bottom - size.Height; } pos = new Point(x, y); viewport.ClipOrigin = pos; viewport.Update(); return(result); } else { return(new Rectangle()); } }
public override void OnKeyPressed(KeyActionEventArgs e) { ProcessKey(e); }
public static KeyEventArgs Convert(KeyActionEventArgs e) { return(new KeyEventArgs(Convert(e.Key, e.Modifiers))); }