public void EventKey(KeyEvent k) { if (k.Value == _setting.FowardShortCut) { ShowNextClipBoardRing(); } else if (k.Value == _setting.PreviousShortCut) { ShowPrevClipBoardRing(); } else if (k.Value == _setting.ShowClipBoardRingShortCut) { List<PluginCore.ICompletionListItem> lcomp = new List<PluginCore.ICompletionListItem>(); List<string> lsClip = clipRing.getClipBoardRing(); if (lsClip.Count > 0) { int maxLenght = 30; StringBuilder sb = new StringBuilder(" ", maxLenght+3); int totalChar = 0; int count = lsClip.Count; for (int i = count-1; i >-1; i--) { if (lsClip[i].Length > maxLenght) totalChar = maxLenght; else totalChar = lsClip[i].Length; sb.Append(lsClip[i], 0, totalChar); totalChar += 3; sb.Append("..."); QuickGenerator.UI.ClipBoardItem comp = new QuickGenerator.UI.ClipBoardItem(sb.ToString(), lsClip[i], lsClip[i], ManagerResources.ClipBoardImage); // for test ///QuickGenerator.UI.CompletionListItem comp = new QuickGenerator.UI.CompletionListItem(sb.ToString(), lsClip[i], lsClip[i], ManagerResources.ClipBoardImage); sb.Remove(1, totalChar); lcomp.Add(comp); } PluginCore.Controls.CompletionList.Show(lcomp, false); } } }
/** * Handles the application shortcuts */ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { /** * Notify plugins. Don't notify ControlKey or ShiftKey as it polls a lot */ KeyEvent ke = new KeyEvent(EventType.Shortcut, keyData); Keys keyCode = keyData & Keys.KeyCode; if ((keyCode != Keys.ControlKey) && (keyCode != Keys.ShiftKey)) { Global.Plugins.NotifyPlugins(this, ke); } if (!ke.Handled) { ScintillaControl sci = CurSciControl; if ((sci != null) && (sci.IgnoreAllKeys || !sci.IsActive)) return base.ProcessCmdKey(ref msg, keyData); else { bool handled = this.commandBarManager.PreProcessMessage(ref msg); if (!handled) { // Process special key combinations if ((keyData & Keys.Control) != 0) { // Allow "chaining" of Ctrl-Tab commands if you keep holding control down this.tabTimer.Enabled = true; if ((keyData == (Keys.Control | Keys.Next)) || (keyData == (Keys.Control | Keys.Tab))) { if (keyData == (Keys.Control | Keys.Next) || this.settings.GetBool("FlashDevelop.SequentialTabbing")) this.NextDocument(null, null); else this.NavigateTabHistory(1); } if ((keyData == (Keys.Control | Keys.Prior)) || (keyData == (Keys.Control | Keys.Shift | Keys.Tab))) { if (keyData == (Keys.Control | Keys.Prior) || this.settings.GetBool("FlashDevelop.SequentialTabbing")) { this.PreviousDocument(null, null); } else this.NavigateTabHistory(-1); } handled = true; } } return handled; } } return true; }
/// <summary> /// Handles the application shortcuts /// </summary> protected override Boolean ProcessCmdKey(ref Message msg, Keys keyData) { /** * Notify plugins. Don't notify ControlKey or ShiftKey as it polls a lot */ KeyEvent ke = new KeyEvent(EventType.Keys, keyData); Keys keyCode = keyData & Keys.KeyCode; if ((keyCode != Keys.ControlKey) && (keyCode != Keys.ShiftKey)) { EventManager.DispatchEvent(this, ke); } if (!ke.Handled) { /** * Process special key combinations and allow "chaining" of * Ctrl-Tab commands if you keep holding control down. */ if ((keyData & Keys.Control) != 0) { Boolean sequentialTabbing = this.appSettings.SequentialTabbing; if ((keyData == (Keys.Control | Keys.Next)) || (keyData == (Keys.Control | Keys.Tab))) { TabbingManager.TabTimer.Enabled = true; if (keyData == (Keys.Control | Keys.Next) || sequentialTabbing) { TabbingManager.NavigateTabsSequentially(1); } else TabbingManager.NavigateTabHistory(1); return true; } if ((keyData == (Keys.Control | Keys.Prior)) || (keyData == (Keys.Control | Keys.Shift | Keys.Tab))) { TabbingManager.TabTimer.Enabled = true; if (keyData == (Keys.Control | Keys.Prior) || sequentialTabbing) { TabbingManager.NavigateTabsSequentially(-1); } else TabbingManager.NavigateTabHistory(-1); return true; } } return base.ProcessCmdKey(ref msg, keyData); } return true; }
private bool HandleKeyEvent(KeyEvent ke) { if (activeProject == null) return false; // Handle tree-level simple shortcuts like copy/paste/del else if (Tree.Focused && !pluginUI.IsEditingLabel && ke != null) { if (ke.Value == (Keys.Control | Keys.C) && pluginUI.Menu.Contains(pluginUI.Menu.Copy)) TreeCopyItems(); else if (ke.Value == (Keys.Control | Keys.X) && pluginUI.Menu.Contains(pluginUI.Menu.Cut)) TreeCutItems(); else if (ke.Value == (Keys.Control | Keys.V) && pluginUI.Menu.Contains(pluginUI.Menu.Paste)) TreePasteItems(); else if (ke.Value == Keys.Delete && pluginUI.Menu.Contains(pluginUI.Menu.Delete)) TreeDeleteItems(); else if (ke.Value == Keys.Enter && pluginUI.Menu.Contains(pluginUI.Menu.Open)) TreeOpenItems(); else if (ke.Value == Keys.Enter && pluginUI.Menu.Contains(pluginUI.Menu.Insert)) TreeInsertItem(); else return false; } else return false; return true; }
private bool HandleKeys(Keys key) { // UITools is currently broadcasting a shortcut, ignore! if (ignoreKeys || DisableEvents) return false; // list/tip shortcut dispatching if ((key == (Keys.Control | Keys.Space)) || (key == (Keys.Shift | Keys.Control | Keys.Space))) { /*if (CompletionList.Active || callTip.CallTipActive) { UnlockControl(); CompletionList.Hide(); callTip.Hide(); }*/ // offer to handle the shortcut ignoreKeys = true; KeyEvent ke = new KeyEvent(EventType.Keys, key); EventManager.DispatchEvent(this, ke); ignoreKeys = false; // if not handled - show snippets if (!ke.Handled) { PluginBase.MainForm.CallCommand("InsertSnippet", "null"); } return true; } // are we currently displaying something? if (!CompletionList.Active && !callTip.CallTipActive) return false; // hide if pressing Esc or Ctrl+Key combination if (lockedSciControl == null || !lockedSciControl.IsAlive || key == Keys.Escape || ((Control.ModifierKeys & Keys.Control) != 0 && Control.ModifierKeys != (Keys.Control|Keys.Alt)) ) { if (key == (Keys.Control | Keys.C) || key == (Keys.Control | Keys.A)) return false; // let text copy in tip UnlockControl(); CompletionList.Hide((char)27); callTip.Hide(); return false; } ScintillaControl sci = (ScintillaControl)lockedSciControl.Target; // chars string ks = key.ToString(); if (ks.Length == 1 || (ks.EndsWith(", Shift") && ks.IndexOf(',') == 1) || ks.StartsWith("NumPad")) { return false; } // toggle "long-description" if (key == Keys.F1) { showDetails = !showDetails; if (callTip.CallTipActive) callTip.UpdateTip(sci); else CompletionList.UpdateTip(null, null); return true; } // switches else if ((key & Keys.ShiftKey) == Keys.ShiftKey || (key & Keys.ControlKey) == Keys.ControlKey || (key & Keys.Menu) == Keys.Menu) { return false; } // handle special keys bool handled = false; if (callTip.CallTipActive) handled |= callTip.HandleKeys(sci, key); if (CompletionList.Active) handled |= CompletionList.HandleKeys(sci, key); return handled; }
private bool HandleKeyEvent(KeyEvent ke) { if (ke.Value == settingObj.AlwaysCompileKey) alwaysCompile(null, null); else if (ke.Value == settingObj.NextWordKey) nextWord(null, null); else if (ke.Value == settingObj.PrevWordKey) prevWord(null, null); else if (ke.Value == settingObj.NextLineKey) nextLine(null, null); else if (ke.Value == settingObj.PrevLineKey) prevLine(null, null); else if (ke.Value == settingObj.FoldAllCommentsKey) foldAllComments(null, null); else if (ke.Value == settingObj.ExpandAllCommentsKey) expandAllComments(null, null); else if (ke.Value == settingObj.AlignAssignmentsKey) alignAssignment(null, null); else if (ke.Value == settingObj.SearchNextKey) searchNext(null, null); else if (ke.Value == settingObj.SearchPrevKey) searchPrev(null, null); else if (ke.Value == settingObj.CalcSelectionKey) calcSelection(null, null); else return false; return true; }
private bool HandleKeyEvent(KeyEvent ke) { if (activeProject == null) return false; string shortcutId = PluginBase.MainForm.GetShortcutItemId(ke.Value); if (shortcutId == "ProjectMenu.ConfigurationSelector") { pluginUI.menus.ConfigurationSelector.Focus(); } else if (shortcutId == "ProjectMenu.ConfigurationSelectorToggle") { pluginUI.menus.ToggleDebugRelease(); } else if (shortcutId == "ProjectMenu.TargetBuildSelector") { pluginUI.menus.TargetBuildSelector.Focus(); } else if (shortcutId == "ProjectTree.LocateActiveFile") { TreeSyncToCurrentFile(); } // Handle tree-level simple shortcuts like copy/paste/del else if (Tree.Focused && !pluginUI.IsEditingLabel && ke != null) { if (ke.Value == (Keys.Control | Keys.C) && pluginUI.Menu.Contains(pluginUI.Menu.Copy)) TreeCopyItems(); else if (ke.Value == (Keys.Control | Keys.X) && pluginUI.Menu.Contains(pluginUI.Menu.Cut)) TreeCutItems(); else if (ke.Value == (Keys.Control | Keys.V) && pluginUI.Menu.Contains(pluginUI.Menu.Paste)) TreePasteItems(); else if (ke.Value == Keys.Delete && pluginUI.Menu.Contains(pluginUI.Menu.Delete)) TreeDeleteItems(); else if (ke.Value == Keys.Enter && pluginUI.Menu.Contains(pluginUI.Menu.Open)) TreeOpenItems(); else if (ke.Value == Keys.Enter && pluginUI.Menu.Contains(pluginUI.Menu.Insert)) TreeInsertItem(); else return false; } else return false; return true; }