private void hotkeyTextBox_KeyDown(object sender, KeyEventArgs e) { Key key = e.Key; if (key == Key.System) { key = e.SystemKey; } if (HotkeyUtils.IllegalHotkeys.Contains(key)) { return; } HotkeyType hotkeyType = (HotkeyType)Convert.ToInt32(((ButtonTextBox)e.Source).Tag); if (key == Key.Escape) { ClearHotkey(hotkeyType); } else { FillHotkeyField(hotkeyType, key, Keyboard.Modifiers); Config.GlobalHotkeys[hotkeyType] = new Tuple <Key, ModifierKeys>(key, Keyboard.Modifiers); } }
public Hotkey(ModifierKeys modifier, Keys key, HotkeyType hotkeyType) { Modifier = modifier; Key = key; HotkeyType = hotkeyType; hook.KeyPressed += Hook_KeyPressed; }
private void H_Pressed(object sender, EventArgs e) { HotkeyType type = (sender as Hotkey).HotkeyType; switch (type) { case HotkeyType.SaveBuffer: _ = startup.SaveBuffer(); break; case HotkeyType.StartBuffer: startup.SetBuffering(true, true); break; case HotkeyType.StopBuffer: startup.SetBuffering(false, true); break; case HotkeyType.ToggleBuffer: startup.SetBuffering(!startup.Buffering, true); break; case HotkeyType.StartRecording: startup.SetRecording(true, true); break; case HotkeyType.StopRecording: startup.SetRecording(false, true); break; case HotkeyType.ToggleRecording: startup.SetRecording(!startup.Recording, true); break; } }
public XMLHotkeyFile(string filePath) { FilePath = filePath; // Ignores comments and reads file XmlReaderSettings readerSettings = new XmlReaderSettings { IgnoreComments = true }; XmlReader reader = XmlReader.Create(filePath, readerSettings); Load(reader); // Finds HotkeyType by parsing file name HotkeyType = System.IO.Path.GetFileNameWithoutExtension(filePath); if (HotkeyType.Contains("_")) { // Finds index of first "_" character int index = HotkeyType.IndexOf("_"); // Substring(4, index - 4) returns string after CIV5 and excluding text after "_"; ex. CIV5Builds_Inherited_Expansion2 returns Builds HotkeyType = HotkeyType.Substring(4, index - 4); } else { // Substring(4) returns string after CIV5; ex. CIV5Builds returns Builds HotkeyType = HotkeyType.Substring(4); } }
public HotkeySettings(HotkeyType job, Keys hotkey = Keys.None) : this() { TaskSettings = TaskSettings.GetDefaultTaskSettings(); TaskSettings.Job = job; HotkeyInfo = new HotkeyInfo(hotkey); }
public bool IsAlreadyInUseBy(ModifierKeys modifiers, HotkeyType type, object activator) { return(this.Hotkey.Modifiers == modifiers && this.Type == type && (this.Type == HotkeyType.Keyboard && this.keyboardHotkey.Key == (activator as Key?) || this.Type == HotkeyType.MouseHook && this.mouseHookHotkey.MouseButton == (activator as MouseAction?))); }
public HotkeySettings(HotkeyType job, Keys hotkey = Keys.None) : this() { TaskSettings = TaskSettings.GetDefaultTaskSettings(); TaskSettings.Job = job; TaskSettings.Description = job.GetDescription(); HotkeyInfo = new HotkeyInfo { Hotkey = hotkey }; }
private void ClearHotkey(HotkeyType hotkeyType) { FillHotkeyField(hotkeyType, Key.None, ModifierKeys.None); if (Config.GlobalHotkeys.ContainsKey(hotkeyType)) { Config.GlobalHotkeys.Remove(hotkeyType); } }
private void AddActionToList(HotkeyType hotkeyType) { ListViewItem lvi = new ListViewItem() { Text = hotkeyType.GetLocalizedDescription(), ImageKey = hotkeyType.ToString() }; lvActions.Items.Add(lvi); }
public void RemoveHotkey(HotkeyType type) { Hotkey previous = hotkeys.Where(h => h.HotkeyType == type).SingleOrDefault(); if (!(previous is null)) { previous.Dispose(); hotkeys.Remove(previous); } ConfigHandler.Config.Hotkeys.RemoveAll(c => c.Type != type); ConfigHandler.Save(); }
private void AddEnumItemsContextMenu(Action <HotkeyType> selectedEnum, params ToolStripDropDown[] parents) { EnumInfo[] enums = Helpers.GetEnums <HotkeyType>().OfType <Enum>().Select(x => new EnumInfo(x)).ToArray(); foreach (ToolStripDropDown parent in parents) { foreach (EnumInfo enumInfo in enums) { HotkeyType hotkeyType = (HotkeyType)Enum.ToObject(typeof(HotkeyType), enumInfo.Value); string text; Image img; if (hotkeyType == HotkeyType.None) { text = Resources.ActionsToolbarEditForm_Separator; img = Resources.ui_splitter; } else { text = enumInfo.Description.Replace("&", "&&"); img = TaskHelpers.GetHotkeyTypeIcon(hotkeyType); } ToolStripMenuItem tsmi = new ToolStripMenuItem(text); tsmi.Image = img; tsmi.Tag = enumInfo; tsmi.Click += (sender, e) => { selectedEnum(hotkeyType); }; if (!string.IsNullOrEmpty(enumInfo.Category)) { ToolStripMenuItem tsmiParent = parent.Items.OfType <ToolStripMenuItem>().FirstOrDefault(x => x.Text == enumInfo.Category); if (tsmiParent == null) { tsmiParent = new ToolStripMenuItem(enumInfo.Category); parent.Items.Add(tsmiParent); } tsmiParent.DropDownItems.Add(tsmi); } else { parent.Items.Add(tsmi); } } } }
public Hotkey(HotkeyType type, Control owner, Keys keyCode, bool shift, bool control, bool alt, bool windows) { this.enabled = true; this.type = type; this.keyCode = keyCode; this.shift = shift; this.control = control; this.alt = alt; this.windows = windows; this.WindowControl = owner; Application.AddMessageFilter(this); }
public override void UseHotkey(HotkeyType type, string relateId, Vector3?aimPosition) { ClearQueueUsingSkill(); switch (type) { case HotkeyType.Skill: UseSkill(relateId, aimPosition); break; case HotkeyType.Item: UseItem(relateId, aimPosition); break; } }
private void FillHotkeyField(HotkeyType hotkeyType, Key hotkey, ModifierKeys modifiers) { if (hotkey == Key.None || HotkeyUtils.IllegalHotkeys.Contains(hotkey)) { GetHotkeyTextBox(hotkeyType).Text = string.Empty; } else if (modifiers == ModifierKeys.None) { GetHotkeyTextBox(hotkeyType).Text = hotkey.ToString(); } else { GetHotkeyTextBox(hotkeyType).Text = string.Format("{0} + {1}", modifiers, hotkey); } }
public static void Register(HotkeyType type, Control control, KeyMod mod, Keys key, HandledEventHandler handler) { Hotkey hk = new Hotkey(); hk.WindowControl = control; hk.type = type; hk.keyCode = key; hk.alt = mod.HasFlag(KeyMod.Alt); hk.shift = mod.HasFlag(KeyMod.Shift); hk.control = mod.HasFlag(KeyMod.Control); hk.windows = mod.HasFlag(KeyMod.Windows); hk.Pressed += handler; if (type == HotkeyType.System && !hk.Register()) { throw new Exception("Ошибочка вышла - не удалось зарегестрировать клавишу"); } }
private TextBox GetHotkeyTextBox(HotkeyType hotkeyType) { switch (hotkeyType) { case HotkeyType.StartRecording: return(hotkeyRecordTextBox); case HotkeyType.PauseRecording: return(hotkeyPauseTextBox); case HotkeyType.StopRecording: return(hotkeyStopTextBox); case HotkeyType.MuteUnmute: return(hotkeyMuteUnmuteTextBox); default: return(null); } }
private void UpdateHotkeyActivator(GenericHotkeyProxy hotkeyProxy, HotkeyType newHotkeyType, object newActivator, string text) { this.TxtSingleKey.Text = text; // This should be called before changing the hotkey type; otherwise, it will return the Key/MouseAction // used by the previous *keyboard/mouse hotkey* instead of the activator used by the previous *generic hotkey*. // This doesn't make any difference if we are not changing hotkey type. object previousActivator = hotkeyProxy.GetActivator(); HotkeyType previousType = hotkeyProxy.Type; hotkeyProxy.Type = newHotkeyType; hotkeyProxy.SetActivator(newActivator); if (!previousActivator.Equals(hotkeyProxy.GetActivator())) { // Check every hotkey's validity again in case one of them has been set to use // the same activator this hotkey was previously using. this.VerifyHotkeysValidityAgainst(hotkeyProxy, null, previousType, previousActivator); } }
private void HotkeyUtils_GlobalHoykeyPressed(HotkeyType hotkey) { switch (hotkey) { case HotkeyType.StartRecording: StartRecording(); break; case HotkeyType.PauseRecording: PauseRecording(); break; case HotkeyType.StopRecording: StopRecording(); break; case HotkeyType.MuteUnmute: muteToggleButton.IsChecked = !muteToggleButton.IsChecked; break; } }
private void AddActionToList(HotkeyType hotkeyType) { string text; if (hotkeyType == HotkeyType.None) { text = Resources.ActionsToolbarEditForm_Separator; } else { text = hotkeyType.GetLocalizedDescription(); } ListViewItem lvi = new ListViewItem() { Text = text, ImageKey = hotkeyType.ToString() }; lvActions.Items.Add(lvi); }
private void MakeCache() { if (type == HotkeyType.None) { cacheSkill = null; cacheItem = null; return; } if (dirtyDataId != dataId || type != dirtyType) { dirtyDataId = dataId; dirtyType = type; cacheSkill = null; cacheItem = null; if (type == HotkeyType.Skill) { GameInstance.Skills.TryGetValue(dataId, out cacheSkill); } if (type == HotkeyType.Item) { GameInstance.Items.TryGetValue(dataId, out cacheItem); } } }
private void startPreparingGroupsHotkeys(HotkeyType type, SQLiteDataObject oData, ref int id) { try { //delete possible duplicates first var sqlQuery = "SELECT MAX(GROUP_ID) FROM GROUPS"; var obj = oData.GetScalar(sqlQuery); if (obj == null || PNData.IsDBNull(obj)) return; var maxId = Convert.ToInt32(obj); var deleteList = new List<string>(); sqlQuery = "SELECT MENU_NAME, ID FROM HOT_KEYS WHERE HK_TYPE = 3"; using (var t = oData.FillDataTable(sqlQuery)) { foreach (DataRow r in t.Rows) { var arr = Convert.ToString(r["MENU_NAME"]).Split('_'); if (Convert.ToInt32(arr[0]) <= maxId) continue; var sb = new StringBuilder("DELETE FROM HOT_KEYS WHERE MENU_NAME = '"); sb.Append(r["MENU_NAME"]); sb.Append("' AND ID = "); sb.Append(r["ID"]); deleteList.Add(sb.ToString()); } } if (deleteList.Count > 0) { PNData.ExecuteTransactionForList(deleteList, oData.ConnectionString); } sqlQuery = "SELECT MENU_NAME FROM HOT_KEYS WHERE HK_TYPE = " + ((int)type).ToString(CultureInfo.InvariantCulture); using (var t = oData.FillDataTable(sqlQuery)) { var names = (from DataRow r in t.Rows select (string)r[0]).ToList(); var group = PNStatic.Groups.GetGroupByID((int)SpecialGroups.AllGroups); if (group != null) { foreach (var g in group.Subgroups) { prepareSingleGroupHotKey(g, oData, names, HotkeyType.Group, ref id); } } } loadSpecificHotKeys(type, oData); } catch (Exception ex) { PNStatic.LogException(ex); } }
public virtual void RequestAssignHotkey(string hotkeyId, HotkeyType type, int dataId) { CallNetFunction(NetFuncAssignHotkey, FunctionReceivers.Server, hotkeyId, (byte)type, dataId); }
private void AddAction(HotkeyType hotkeyType) { Actions.Add(hotkeyType); AddActionToList(hotkeyType); }
public HotkeyPair(HotkeyType type = HotkeyType.ExpandDown, Hotkey hotkey = null) { Type = type; Hotkey = hotkey; }
private void prepareSingleMenuHotKey(MenuItem mi, SQLiteDataObject oData, List<string> names, HotkeyType type, ref int id) { try { foreach (var ti in mi.Items.OfType<MenuItem>()) { prepareSingleMenuHotKey(ti, oData, names, type, ref id); } if (names.All(s => s != mi.Name)) { string sqlQuery = "INSERT INTO HOT_KEYS (HK_TYPE, MENU_NAME, ID, SHORTCUT) VALUES(" + ((int)type).ToString(CultureInfo.InvariantCulture) + ",'" + mi.Name + "'," + id.ToString(CultureInfo.InvariantCulture) + ",'" + mi.InputGestureText + "')"; oData.Execute(sqlQuery); id++; } } catch (Exception ex) { PNStatic.LogException(ex); } }
public static Image GetHotkeyTypeIcon(HotkeyType hotkeyType) { switch (hotkeyType) { default: throw new Exception("Icon missing for hotkey type."); case HotkeyType.None: return(null); // Upload case HotkeyType.FileUpload: return(Resources.folder_open_document); case HotkeyType.FolderUpload: return(Resources.folder); case HotkeyType.ClipboardUpload: return(Resources.clipboard); case HotkeyType.ClipboardUploadWithContentViewer: return(Resources.clipboard_task); case HotkeyType.UploadURL: return(Resources.drive); case HotkeyType.DragDropUpload: return(Resources.inbox); case HotkeyType.StopUploads: return(Resources.cross_button); // Screen capture case HotkeyType.PrintScreen: return(Resources.layer_fullscreen); case HotkeyType.ActiveWindow: return(Resources.application_blue); case HotkeyType.ActiveMonitor: return(Resources.monitor); case HotkeyType.RectangleRegion: return(Resources.layer_shape); case HotkeyType.RectangleLight: return(Resources.Rectangle); case HotkeyType.RectangleTransparent: return(Resources.layer_transparent); case HotkeyType.CustomRegion: return(Resources.layer__arrow); case HotkeyType.LastRegion: return(Resources.layers); case HotkeyType.ScrollingCapture: return(Resources.ui_scroll_pane_image); case HotkeyType.CaptureWebpage: return(Resources.document_globe); case HotkeyType.TextCapture: return(Resources.edit_drop_cap); case HotkeyType.AutoCapture: return(Resources.clock); case HotkeyType.StartAutoCapture: return(Resources.clock__arrow); // Screen record case HotkeyType.ScreenRecorder: return(Resources.camcorder_image); case HotkeyType.ScreenRecorderActiveWindow: return(Resources.camcorder__arrow); case HotkeyType.ScreenRecorderCustomRegion: return(Resources.camcorder__arrow); case HotkeyType.StartScreenRecorder: return(Resources.camcorder__arrow); case HotkeyType.ScreenRecorderGIF: return(Resources.film); case HotkeyType.ScreenRecorderGIFActiveWindow: return(Resources.film__arrow); case HotkeyType.ScreenRecorderGIFCustomRegion: return(Resources.film__arrow); case HotkeyType.StartScreenRecorderGIF: return(Resources.film__arrow); case HotkeyType.AbortScreenRecording: return(Resources.camcorder__exclamation); // Tools case HotkeyType.ColorPicker: return(Resources.color); case HotkeyType.ScreenColorPicker: return(Resources.pipette); case HotkeyType.ImageEditor: return(Resources.image_pencil); case HotkeyType.ImageEffects: return(Resources.image_saturation); case HotkeyType.HashCheck: return(Resources.application_task); case HotkeyType.DNSChanger: return(Resources.network_ip); case HotkeyType.QRCode: return(Resources.barcode_2d); case HotkeyType.Ruler: return(Resources.ruler_triangle); case HotkeyType.IndexFolder: return(Resources.folder_tree); case HotkeyType.ImageCombiner: return(Resources.document_break); case HotkeyType.VideoThumbnailer: return(Resources.images_stack); case HotkeyType.FTPClient: return(Resources.application_network); case HotkeyType.TweetMessage: return(Resources.Twitter); case HotkeyType.MonitorTest: return(Resources.monitor); // Other case HotkeyType.DisableHotkeys: return(Resources.keyboard__minus); case HotkeyType.OpenMainWindow: return(Resources.application_home); case HotkeyType.OpenScreenshotsFolder: return(Resources.folder_open_image); case HotkeyType.OpenHistory: return(Resources.application_blog); case HotkeyType.OpenImageHistory: return(Resources.application_icon_large); case HotkeyType.ToggleActionsToolbar: return(Resources.ui_toolbar__arrow); case HotkeyType.ExitShareX: return(Resources.cross); } }
public HotkeyConfig(ModifierKeys modifierKeys, Keys key, HotkeyType type) { ModifierKeys = modifierKeys; Key = key; Type = type; }
public static void ExecuteJob(HotkeyType job, CLICommand command = null) { ExecuteJob(TaskSettings.GetDefaultTaskSettings(), job, command); }
public static void ExecuteJob(TaskSettings taskSettings, HotkeyType job, CLICommand command = null) { if (job == HotkeyType.None) { return; } DebugHelper.WriteLine("Executing: " + job.GetLocalizedDescription()); TaskSettings safeTaskSettings = TaskSettings.GetSafeTaskSettings(taskSettings); switch (job) { // Screen capture case HotkeyType.PrintScreen: CaptureTaskHelpers.CaptureScreenshot(CaptureType.Fullscreen, safeTaskSettings, false); break; case HotkeyType.ActiveWindow: CaptureTaskHelpers.CaptureScreenshot(CaptureType.ActiveWindow, safeTaskSettings, false); break; case HotkeyType.ActiveMonitor: CaptureTaskHelpers.CaptureScreenshot(CaptureType.ActiveMonitor, safeTaskSettings, false); break; case HotkeyType.RectangleRegion: CaptureTaskHelpers.CaptureScreenshot(CaptureType.Region, safeTaskSettings, false); break; case HotkeyType.RectangleLight: CaptureTaskHelpers.CaptureRectangleLight(safeTaskSettings, false); break; case HotkeyType.RectangleTransparent: CaptureTaskHelpers.CaptureRectangleTransparent(safeTaskSettings, false); break; case HotkeyType.CustomRegion: CaptureTaskHelpers.CaptureScreenshot(CaptureType.CustomRegion, safeTaskSettings, false); break; case HotkeyType.LastRegion: CaptureTaskHelpers.CaptureScreenshot(CaptureType.LastRegion, safeTaskSettings, false); break; case HotkeyType.ScrollingCapture: OpenScrollingCapture(safeTaskSettings, true); break; case HotkeyType.CaptureWebpage: OpenWebpageCapture(safeTaskSettings); break; case HotkeyType.AutoCapture: OpenAutoCapture(); break; case HotkeyType.StartAutoCapture: StartAutoCapture(); break; // Screen record case HotkeyType.ScreenRecorder: StartScreenRecording(ScreenRecordOutput.FFmpeg, ScreenRecordStartMethod.Region, safeTaskSettings); break; case HotkeyType.ScreenRecorderActiveWindow: StartScreenRecording(ScreenRecordOutput.FFmpeg, ScreenRecordStartMethod.ActiveWindow, safeTaskSettings); break; case HotkeyType.ScreenRecorderCustomRegion: StartScreenRecording(ScreenRecordOutput.FFmpeg, ScreenRecordStartMethod.CustomRegion, safeTaskSettings); break; case HotkeyType.StartScreenRecorder: StartScreenRecording(ScreenRecordOutput.FFmpeg, ScreenRecordStartMethod.LastRegion, safeTaskSettings); break; case HotkeyType.ScreenRecorderGIF: StartScreenRecording(ScreenRecordOutput.GIF, ScreenRecordStartMethod.Region, safeTaskSettings); break; case HotkeyType.ScreenRecorderGIFActiveWindow: StartScreenRecording(ScreenRecordOutput.GIF, ScreenRecordStartMethod.ActiveWindow, safeTaskSettings); break; case HotkeyType.ScreenRecorderGIFCustomRegion: StartScreenRecording(ScreenRecordOutput.GIF, ScreenRecordStartMethod.CustomRegion, safeTaskSettings); break; case HotkeyType.StartScreenRecorderGIF: StartScreenRecording(ScreenRecordOutput.GIF, ScreenRecordStartMethod.LastRegion, safeTaskSettings); break; case HotkeyType.AbortScreenRecording: AbortScreenRecording(); break; // Tools case HotkeyType.ColorPicker: OpenColorPicker(); break; case HotkeyType.ScreenColorPicker: OpenScreenColorPicker(safeTaskSettings); break; case HotkeyType.ImageEditor: if (command != null && !string.IsNullOrEmpty(command.Parameter) && File.Exists(command.Parameter)) { AnnotateImage(command.Parameter, safeTaskSettings); } else { AnnotateImage(safeTaskSettings); } break; break; case HotkeyType.HashCheck: OpenHashCheck(); break; case HotkeyType.DNSChanger: OpenDNSChanger(); break; case HotkeyType.IndexFolder: break; case HotkeyType.ImageCombiner: OpenImageCombiner(safeTaskSettings); break; case HotkeyType.VideoThumbnailer: OpenVideoThumbnailer(safeTaskSettings); break; // Other case HotkeyType.DisableHotkeys: ToggleHotkeys(); break; case HotkeyType.ToggleActionsToolbar: ToggleActionsToolbar(); break; } }
private void startPreparingMenuHotkeys(HotkeyType type, SQLiteDataObject oData, ContextMenu ctm, ref int id) { try { var sqlQuery = "SELECT MENU_NAME FROM HOT_KEYS WHERE HK_TYPE = " + ((int)type).ToString(CultureInfo.InvariantCulture); using (var t = oData.FillDataTable(sqlQuery)) { var names = (from DataRow r in t.Rows select (string)r[0]).ToList(); foreach (var ti in ctm.Items.OfType<MenuItem>()) { prepareSingleMenuHotKey(ti, oData, names, type, ref id); } } loadSpecificHotKeys(type, oData); } catch (Exception ex) { PNStatic.LogException(ex); } }
public int id = -1; //The id of the item or skill in the hotkey //Updates the information of the hotkey so we can use it elsewhere public void UpdateHotkey(int keyID, HotkeyType type) { hotkeyType = type; id = keyID; }
private void loadSpecificHotKeys(HotkeyType type, SQLiteDataObject oData) { try { var sqlQuery = "SELECT MENU_NAME, ID, MODIFIERS, VK, SHORTCUT FROM HOT_KEYS WHERE HK_TYPE = " + ((int)type).ToString(CultureInfo.InvariantCulture); using (var t = oData.FillDataTable(sqlQuery)) { foreach (DataRow r in t.Rows) { switch (type) { case HotkeyType.Main: PNStatic.HotKeysMain.Add(new PNHotKey { MenuName = (string)r["MENU_NAME"], ID = (int)r["ID"], Modifiers = (HotkeyModifiers)(int)r["MODIFIERS"], VK = (uint)(int)r["VK"], Shortcut = (string)r["SHORTCUT"], Type = type }); break; case HotkeyType.Note: PNStatic.HotKeysNote.Add(new PNHotKey { MenuName = (string)r["MENU_NAME"], ID = (int)r["ID"], Modifiers = (HotkeyModifiers)(int)r["MODIFIERS"], VK = (uint)(int)r["VK"], Shortcut = (string)r["SHORTCUT"], Type = type }); break; case HotkeyType.Edit: PNStatic.HotKeysEdit.Add(new PNHotKey { MenuName = (string)r["MENU_NAME"], ID = (int)r["ID"], Modifiers = (HotkeyModifiers)(int)r["MODIFIERS"], VK = (uint)(int)r["VK"], Shortcut = (string)r["SHORTCUT"], Type = type }); break; case HotkeyType.Group: PNStatic.HotKeysGroups.Add(new PNHotKey { MenuName = (string)r["MENU_NAME"], ID = (int)r["ID"], Modifiers = (HotkeyModifiers)(int)r["MODIFIERS"], VK = (uint)(int)r["VK"], Shortcut = (string)r["SHORTCUT"], Type = type }); break; } } } } catch (Exception ex) { PNStatic.LogException(ex); } }
public void Deserialize(NetDataReader reader) { hotkeyId = reader.GetString(); type = (HotkeyType)reader.GetByte(); dataId = reader.GetInt(); }
internal void setHotkey(HotkeyType type, KeyCode code) { hotkeys[(int)type] = code; }
private void loadMenus(PNMenu mnu, PNTreeItem item, HotkeyType type) { try { if (mnu.Text == PNStrings.MENU_SEPARATOR_STRING) return; switch (mnu.Name) { case "": case "mnuSave": case "mnuPrint": case "mnuGroups": case "mnuRemoveFromFavorites": case "mnuRemovePassword": case "mnuUnpin": case "mnuUndo": case "mnuRedo": case "mnuCut": case "mnuCopy": case "mnuPaste": case "mnuFind": case "mnuFindNext": case "mnuReplace": case "mnuSearchWeb": case "mnuSelectAll": case "mnuShowByTag": case "mnuHideByTag": case "mnuFont": case "mnuFontSize": case "mnuFontColor": case "mnuBold": case "mnuItalic": case "mnuUnderline": case "mnuStrikethrough": case "mnuHighlight": case "mnuAlignLeft": case "mnuAlignCenter": case "mnuAlignRight": case "mnuPostOn": case "mnuPostNote": case "mnuReplacePost": case "mnuInsertPost": case "mnuRun": return; } var ti = new PNTreeItem(mnu.Items.Any() ? "submnu" : "mnu", mnu.Text, mnu.Name) { IsExpanded = true }; foreach (var sg in mnu.Items) { loadMenus(sg, ti, type); } if (item == null) { switch (type) { case HotkeyType.Main: _ItemsMain.Add(ti); break; case HotkeyType.Note: _ItemsNote.Add(ti); break; case HotkeyType.Edit: _ItemsEdit.Add(ti); break; case HotkeyType.Group: _ItemsGroup.Add(ti); break; } } else item.Items.Add(ti); } catch (Exception ex) { PNStatic.LogException(ex); } }
internal KeyCode getHotkey(HotkeyType type) { return(hotkeys[(int)type]); }
private void prepareSingleGroupHotKey(PNGroup group, SQLiteDataObject oData, List<string> names, HotkeyType type, ref int id) { try { foreach (var g in group.Subgroups) { prepareSingleGroupHotKey(g, oData, names, HotkeyType.Group, ref id); } var prefix = group.ID + "_show"; if (names.All(n => n != prefix)) { var sqlQuery = "INSERT INTO HOT_KEYS (HK_TYPE, MENU_NAME, ID, SHORTCUT) VALUES(" + ((int)type).ToString(CultureInfo.InvariantCulture) + ",'" + prefix + "'," + id.ToString(CultureInfo.InvariantCulture) + ",'')"; oData.Execute(sqlQuery); id++; } prefix = group.ID + "_hide"; if (names.All(n => n != prefix)) { string sqlQuery = "INSERT INTO HOT_KEYS (HK_TYPE, MENU_NAME, ID, SHORTCUT) VALUES(" + ((int)type).ToString(CultureInfo.InvariantCulture) + ",'" + prefix + "'," + id.ToString(CultureInfo.InvariantCulture) + ",'')"; oData.Execute(sqlQuery); id++; } } catch (Exception ex) { PNStatic.LogException(ex); } }
internal DefKey(int id, HotkeyType menuType, string menuName) { Id = id; MenuType = menuType; MenuName = menuName; }