void HandleSearchEntryKeyPressed(object sender, KeyPressEventArgs e) { if (SearchEntryKeyPressed != null) { // TODO: Refactor this in Xwt as an extension method. var k = (Xwt.Key)e.Event.KeyValue; var m = Xwt.ModifierKeys.None; if ((e.Event.State & Gdk.ModifierType.ShiftMask) != 0) { m |= Xwt.ModifierKeys.Shift; } if ((e.Event.State & Gdk.ModifierType.ControlMask) != 0) { m |= Xwt.ModifierKeys.Control; } if ((e.Event.State & Gdk.ModifierType.Mod1Mask) != 0) { m |= Xwt.ModifierKeys.Alt; } // TODO: Backport this one. if ((e.Event.State & Gdk.ModifierType.Mod2Mask) != 0) { m |= Xwt.ModifierKeys.Command; } var kargs = new Xwt.KeyEventArgs(k, m, false, (long)e.Event.Time); SearchEntryKeyPressed(sender, kargs); e.RetVal = kargs.Handled; } }
bool SendKeyPressed(Xwt.KeyEventArgs kargs) { if (KeyPressed != null) { KeyPressed(this, kargs); } return(kargs.Handled); }
bool SendKeyPressed(Xwt.KeyEventArgs kargs) { if (KeyPressed != null) { KeyPressed(this, kargs); } LogMessage($"KeyPressed with Handled {kargs.Handled}"); return(kargs.Handled); }
bool SendKeyPressed(Xwt.Key key, Xwt.ModifierKeys mask) { var kargs = new Xwt.KeyEventArgs(key, mask, false, 0); if (KeyPressed != null) { KeyPressed(this, kargs); } return(kargs.Handled); }
void HandleSearchEntryKeyPressed(object sender, Xwt.KeyEventArgs e) { if (e.Key == Xwt.Key.Escape) { DestroyPopup(); var doc = IdeApp.Workbench.ActiveDocument; if (doc != null) doc.Select (); return; } if (popup != null) e.Handled = popup.ProcessKey (e.Key, e.Modifiers); }
void CommandBox_KeyReleased(object sender, Xwt.KeyEventArgs e) { if (e.Key == Xwt.Key.Return) { if (CommandBox.Text == "q") { this.Close(); return; } if (CommandBox.Text == "q!") { Plugin.SaveFile(); this.Close(); return; } SendCommand(CommandBox.Text); } }
protected bool IsInputKey(Xwt.KeyEventArgs keyData) { if (keyData.Key == Xwt.Key.Left || keyData.Key == Xwt.Key.Right || keyData.Key == Xwt.Key.Up || keyData.Key == Xwt.Key.Down || keyData.Key == Xwt.Key.Home || keyData.Key == Xwt.Key.End || keyData.Key == Xwt.Key.PageDown || keyData.Key == Xwt.Key.PageUp) { return(true); } return(false); }
void HandleSearchEntryKeyPressed (object sender, KeyPressEventArgs e) { if (SearchEntryKeyPressed != null) { // TODO: Refactor this in Xwt as an extension method. var k = (Xwt.Key)e.Event.KeyValue; var m = Xwt.ModifierKeys.None; if ((e.Event.State & Gdk.ModifierType.ShiftMask) != 0) m |= Xwt.ModifierKeys.Shift; if ((e.Event.State & Gdk.ModifierType.ControlMask) != 0) m |= Xwt.ModifierKeys.Control; if ((e.Event.State & Gdk.ModifierType.Mod1Mask) != 0) m |= Xwt.ModifierKeys.Alt; // TODO: Backport this one. if ((e.Event.State & Gdk.ModifierType.Mod2Mask) != 0) m |= Xwt.ModifierKeys.Command; var kargs = new Xwt.KeyEventArgs (k, m, false, (long)e.Event.Time); SearchEntryKeyPressed (sender, kargs); e.RetVal = kargs.Handled; } }
/// <summary>The entry form's keyboard keypress handler (except commandbar keypresses)</summary> void PanelLayout_KeyReleased(object sender, Xwt.KeyEventArgs e) { #if DEBUG pluginner.FileListPanel p1 = (PanelLayout.Panel1.Content as pluginner.FileListPanel); pluginner.FileListPanel p2 = (PanelLayout.Panel2.Content as pluginner.FileListPanel); Console.WriteLine("KEYBOARD DEBUG: " + e.Modifiers.ToString() + "+" + e.Key.ToString() + " was pressed. Panels focuses: " + (ActivePanel == p1) + " | " + (ActivePanel == p2)); #endif if (e.Key == Xwt.Key.Return) { return; //ENTER presses are handled by other event } string URL1; if (ActivePanel.ListingView.SelectedRow > -1) { URL1 = ActivePanel.GetValue(ActivePanel.dfURL); } else { URL1 = null; } pluginner.IFSPlugin FS1 = ActivePanel.FS; string URL2; if (PassivePanel.ListingView.SelectedRow > -1) { URL2 = PassivePanel.GetValue(PassivePanel.dfURL); } else { URL2 = null; } pluginner.IFSPlugin FS2 = PassivePanel.FS; switch (e.Key) { case Xwt.Key.NumPadAdd: //[+] gray - add selection string Filter = @"*.*"; InputBox ibx_qs = new InputBox(Locale.GetString("QuickSelect"), Filter); Xwt.CheckBox chkRegExp = new Xwt.CheckBox(Locale.GetString("NameFilterUseRegExp")); ibx_qs.OtherWidgets.Add(chkRegExp, 0, 0); if (!ibx_qs.ShowDialog()) { return; } Filter = ibx_qs.Result; if (chkRegExp.State == Xwt.CheckBoxState.Off) { Filter = Filter.Replace(".", @"\."); Filter = Filter.Replace("*", ".*"); Filter = Filter.Replace("?", "."); } try { System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex(Filter); int Count = 0; foreach (pluginner.ListView2Item lvi in ActivePanel.ListingView.Items) { if (re.IsMatch(lvi.Data[1].ToString())) { ActivePanel.ListingView.Select(lvi); Count++; } } ActivePanel.StatusBar.Text = string.Format(Locale.GetString("NameFilterFound"), Filter, Count); } catch (Exception ex) { Xwt.MessageDialog.ShowError(Locale.GetString("NameFilterError"), ex.Message); } return; case Xwt.Key.NumPadSubtract: //[-] gray - add selection string Filter_qus = @"*.*"; InputBox ibx_qus = new InputBox(Locale.GetString("QuickUnselect"), Filter_qus); Xwt.CheckBox chkRegExp_qus = new Xwt.CheckBox(Locale.GetString("NameFilterUseRegExp")); ibx_qus.OtherWidgets.Add(chkRegExp_qus, 0, 0); if (!ibx_qus.ShowDialog()) { return; } Filter_qus = ibx_qus.Result; if (chkRegExp_qus.State == Xwt.CheckBoxState.Off) { Filter_qus = Filter_qus.Replace(".", @"\."); Filter_qus = Filter_qus.Replace("*", ".*"); Filter_qus = Filter_qus.Replace("?", "."); } try { System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex(Filter_qus); int Count_qus = 0; foreach (pluginner.ListView2Item lvi in ActivePanel.ListingView.Items) { if (re.IsMatch(lvi.Data[1].ToString())) { ActivePanel.ListingView.Unselect(lvi); Count_qus++; } } } catch (Exception ex) { Xwt.MessageDialog.ShowError(Locale.GetString("NameFilterError"), ex.Message); } return; //F KEYS case Xwt.Key.F3: //F3: View. Shift+F3: View as text. if (URL1 == null) { return; } if (!FS1.FileExists(URL1)) { Xwt.MessageDialog.ShowWarning(string.Format(Locale.GetString("FileNotFound"), ActivePanel.GetValue(ActivePanel.dfDisplayName))); return; } VEd V = new VEd(); if (e.Modifiers == Xwt.ModifierKeys.None) { V.LoadFile(URL1, FS1, false); V.Show(); } else if (e.Modifiers == Xwt.ModifierKeys.Shift) { V.LoadFile(URL1, FS1, new base_plugins.ve.PlainText(), false); V.Show(); } //todo: handle Ctrl+F3 (Sort by name). return; case Xwt.Key.F4: //F4: Edit. Shift+F4: Edit as txt. if (URL1 == null) { return; } if (!FS1.FileExists(URL1)) { Xwt.MessageDialog.ShowWarning(string.Format(Locale.GetString("FileNotFound"), ActivePanel.GetValue(ActivePanel.dfDisplayName))); return; } VEd E = new VEd(); if (e.Modifiers == Xwt.ModifierKeys.None) { E.LoadFile(URL1, FS1, true); E.Show(); } else if (e.Modifiers == Xwt.ModifierKeys.Shift) { E.LoadFile(URL1, FS1, new base_plugins.ve.PlainText(), true); E.Show(); } //todo: handle Ctrl+F4 (Sort by extension). return; case Xwt.Key.F5: //F5: Copy. if (URL1 == null) { return; } Cp(); //todo: handle Ctrl+F5 (Sort by timestamp). return; case Xwt.Key.F6: //F6: Move/Rename. if (URL1 == null) { return; } Mv(); //todo: handle Ctrl+F6 (Sort by size). return; case Xwt.Key.F7: //F7: New directory. InputBox ibx = new InputBox(Locale.GetString("NewDirURL"), ActivePanel.FS.CurrentDirectory + Locale.GetString("NewDirTemplate")); if (ibx.ShowDialog()) { MkDir(ibx.Result); } return; case Xwt.Key.F8: //F8: delete if (URL1 == null) { return; } Rm(); //todo: move to trash can/recycle bin & handle Shit+F8 (remove completely) return; case Xwt.Key.F10: //F10: Exit //todo: ask user, are it really want to close FC? Xwt.Application.Exit(); //todo: handle Alt+F10 (directory tree) return; } #if DEBUG Console.WriteLine("KEYBOARD DEBUG: the key isn't handled"); #endif }