/// <summary> /// コマンドを実行する条件を満たしているか判定します /// </summary> public bool IsMatch(Keys pressedKey, FocusedControl focusedOn) { if (!this.Shortcuts.Contains(pressedKey)) return false; if (this.FocusedOn != FocusedControl.None && this.FocusedOn != focusedOn) return false; if (this.NotFocusedOn != FocusedControl.None && this.NotFocusedOn == focusedOn) return false; if (!this.onlyWhen()) return false; return true; }
private bool CommonKeyDown(Keys KeyCode, FocusedControl Focused, ModifierState Modifier) { //リストのカーソル移動関係(上下キー、PageUp/Downに該当) if (Focused == FocusedControl.ListTab) { if (Modifier == (ModifierState.Ctrl | ModifierState.Shift) || Modifier == ModifierState.Ctrl || Modifier == ModifierState.None || Modifier == ModifierState.Shift) { if (KeyCode == Keys.J) { SendKeys.Send("{DOWN}"); return true; } else if (KeyCode == Keys.K) { SendKeys.Send("{UP}"); return true; } } if (Modifier == ModifierState.Shift || Modifier == ModifierState.None) { if (KeyCode == Keys.F) { SendKeys.Send("{PGDN}"); return true; } else if (KeyCode == Keys.B) { SendKeys.Send("{PGUP}"); return true; } } } //修飾キーなし switch (Modifier) { case ModifierState.None: //フォーカス関係なし switch (KeyCode) { case Keys.F1: OpenApplicationWebsite(); return true; case Keys.F3: MenuItemSearchNext_Click(null, null); return true; case Keys.F5: DoRefresh(); return true; case Keys.F6: GetTimeline(MyCommon.WORKERTYPE.Reply, 1, 0, ""); return true; case Keys.F7: GetTimeline(MyCommon.WORKERTYPE.DirectMessegeRcv, 1, 0, ""); return true; } if (Focused != FocusedControl.StatusText) { //フォーカスStatusText以外 switch (KeyCode) { case Keys.Space: case Keys.ProcessKey: if (Focused == FocusedControl.ListTab) _anchorFlag = false; JumpUnreadMenuItem_Click(null, null); return true; case Keys.G: if (Focused == FocusedControl.ListTab) _anchorFlag = false; ShowRelatedStatusesMenuItem_Click(null, null); return true; } } if (Focused == FocusedControl.ListTab) { //フォーカスList switch (KeyCode) { case Keys.N: case Keys.Right: GoRelPost(true); return true; case Keys.P: case Keys.Left: GoRelPost(false); return true; case Keys.OemPeriod: GoAnchor(); return true; case Keys.I: if (this.StatusText.Enabled) this.StatusText.Focus(); return true; case Keys.Enter: MakeReplyOrDirectStatus(); return true; case Keys.R: DoRefresh(); return true; } //以下、アンカー初期化 _anchorFlag = false; switch (KeyCode) { case Keys.L: GoPost(true); return true; case Keys.H: GoPost(false); return true; case Keys.Z: case Keys.Oemcomma: MoveTop(); return true; case Keys.S: GoNextTab(true); return true; case Keys.A: GoNextTab(false); return true; case Keys.Oem4: // ] in_reply_to参照元へ戻る GoInReplyToPostTree(); return true; case Keys.Oem6: // [ in_reply_toへジャンプ GoBackInReplyToPostTree(); return true; case Keys.Escape: if (ListTab.SelectedTab != null) { MyCommon.TabUsageType tabtype = _statuses.Tabs[ListTab.SelectedTab.Text].TabType; if (tabtype == MyCommon.TabUsageType.Related || tabtype == MyCommon.TabUsageType.UserTimeline || tabtype == MyCommon.TabUsageType.PublicSearch) { TabPage relTp = ListTab.SelectedTab; RemoveSpecifiedTab(relTp.Text, false); SaveConfigsTabs(); return true; } } break; } } break; case ModifierState.Ctrl: //フォーカス関係なし switch (KeyCode) { case Keys.R: MakeReplyOrDirectStatus(false, true); return true; case Keys.D: doStatusDelete(); return true; case Keys.M: MakeReplyOrDirectStatus(false, false); return true; case Keys.S: FavoriteChange(true); return true; case Keys.I: doRepliedStatusOpen(); return true; case Keys.Q: doQuote(); return true; case Keys.B: ReadedStripMenuItem_Click(null, null); return true; case Keys.T: HashManageMenuItem_Click(null, null); return true; case Keys.L: UrlConvertAutoToolStripMenuItem_Click(null, null); return true; case Keys.Y: if (Focused != FocusedControl.PostBrowser) { MultiLineMenuItem_Click(null, null); return true; } break; case Keys.F: MenuItemSubSearch_Click(null, null); return true; case Keys.U: ShowUserTimeline(); return true; case Keys.H: // Webページを開く動作 if (_curList.SelectedIndices.Count > 0) OpenUriAsync("http://twitter.com/" + GetCurTabPost(_curList.SelectedIndices[0]).ScreenName); else if (_curList.SelectedIndices.Count == 0) OpenUriAsync("http://twitter.com/"); return true; case Keys.G: // Webページを開く動作 if (_curList.SelectedIndices.Count > 0) OpenUriAsync("http://twitter.com/" + GetCurTabPost(_curList.SelectedIndices[0]).ScreenName + "/favorites"); return true; case Keys.O: // Webページを開く動作 StatusOpenMenuItem_Click(null, null); return true; case Keys.E: // Webページを開く動作 OpenURLMenuItem_Click(null, null); return true; } //フォーカスList if (Focused == FocusedControl.ListTab) { switch (KeyCode) { case Keys.Home: case Keys.End: _colorize = true; return false; //スルーする case Keys.N: GoNextTab(true); return true; case Keys.P: GoNextTab(false); return true; case Keys.C: CopyStot(); return true; case Keys.D1: case Keys.D2: case Keys.D3: case Keys.D4: case Keys.D5: case Keys.D6: case Keys.D7: case Keys.D8: // タブダイレクト選択(Ctrl+1~8,Ctrl+9) int tabNo = KeyCode - Keys.D1; if (ListTab.TabPages.Count < tabNo) return false; ListTab.SelectedIndex = tabNo; ListTabSelect(ListTab.TabPages[tabNo]); return true; case Keys.D9: ListTab.SelectedIndex = ListTab.TabPages.Count - 1; ListTabSelect(ListTab.TabPages[ListTab.TabPages.Count - 1]); return true; } } else if (Focused == FocusedControl.StatusText) { //フォーカスStatusText switch (KeyCode) { case Keys.A: StatusText.SelectAll(); return true; case Keys.Up: case Keys.Down: if (!string.IsNullOrWhiteSpace(StatusText.Text)) { _history[_hisIdx] = new PostingStatus(StatusText.Text, _reply_to_id, _reply_to_name); } if (KeyCode == Keys.Up) { _hisIdx -= 1; if (_hisIdx < 0) _hisIdx = 0; } else { _hisIdx += 1; if (_hisIdx > _history.Count - 1) _hisIdx = _history.Count - 1; } StatusText.Text = _history[_hisIdx].status; _reply_to_id = _history[_hisIdx].inReplyToId; _reply_to_name = _history[_hisIdx].inReplyToName; StatusText.SelectionStart = StatusText.Text.Length; return true; case Keys.PageUp: case Keys.P: if (ListTab.SelectedIndex == 0) { ListTab.SelectedIndex = ListTab.TabCount - 1; } else { ListTab.SelectedIndex -= 1; } StatusText.Focus(); return true; case Keys.PageDown: case Keys.N: if (ListTab.SelectedIndex == ListTab.TabCount - 1) { ListTab.SelectedIndex = 0; } else { ListTab.SelectedIndex += 1; } StatusText.Focus(); return true; } } else { //フォーカスPostBrowserもしくは関係なし switch (KeyCode) { case Keys.A: PostBrowser.Document.ExecCommand("SelectAll", false, null); return true; case Keys.C: case Keys.Insert: string _selText = WebBrowser_GetSelectionText(ref PostBrowser); if (!string.IsNullOrEmpty(_selText)) { try { Clipboard.SetDataObject(_selText, false, 5, 100); } catch (Exception ex) { MessageBox.Show(ex.Message); } } return true; case Keys.Y: MultiLineMenuItem.Checked = !MultiLineMenuItem.Checked; MultiLineMenuItem_Click(null, null); return true; } } break; case ModifierState.Shift: //フォーカス関係なし switch (KeyCode) { case Keys.F3: MenuItemSearchPrev_Click(null, null); return true; case Keys.F5: DoRefreshMore(); return true; case Keys.F6: GetTimeline(MyCommon.WORKERTYPE.Reply, -1, 0, ""); return true; case Keys.F7: GetTimeline(MyCommon.WORKERTYPE.DirectMessegeRcv, -1, 0, ""); return true; } //フォーカスStatusText以外 if (Focused != FocusedControl.StatusText) { if (KeyCode == Keys.R) { DoRefreshMore(); return true; } } //フォーカスリスト if (Focused == FocusedControl.ListTab) { switch (KeyCode) { case Keys.H: GoTopEnd(true); return true; case Keys.L: GoTopEnd(false); return true; case Keys.M: GoMiddle(); return true; case Keys.G: GoLast(); return true; case Keys.Z: MoveMiddle(); return true; case Keys.Oem4: GoBackInReplyToPostTree(true, false); return true; case Keys.Oem6: GoBackInReplyToPostTree(true, true); return true; case Keys.N: case Keys.Right: // お気に入り前後ジャンプ(SHIFT+N←/P→) GoFav(true); return true; case Keys.P: case Keys.Left: // お気に入り前後ジャンプ(SHIFT+N←/P→) GoFav(false); return true; case Keys.Space: this.GoBackSelectPostChain(); return true; } } break; case ModifierState.Alt: switch (KeyCode) { case Keys.R: doReTweetOfficial(true); return true; case Keys.P: if (_curPost != null) { doShowUserStatus(_curPost.ScreenName, false); return true; } break; case Keys.Up: ScrollDownPostBrowser(false); return true; case Keys.Down: ScrollDownPostBrowser(true); return true; case Keys.PageUp: PageDownPostBrowser(false); return true; case Keys.PageDown: PageDownPostBrowser(true); return true; } if (Focused == FocusedControl.ListTab) { // 別タブの同じ書き込みへ(ALT+←/→) if (KeyCode == Keys.Right) { GoSamePostToAnotherTab(false); return true; } else if (KeyCode == Keys.Left) { GoSamePostToAnotherTab(true); return true; } } break; case ModifierState.Ctrl | ModifierState.Shift: switch (KeyCode) { case Keys.R: MakeReplyOrDirectStatus(false, true, true); return true; case Keys.C: CopyIdUri(); return true; case Keys.F: if (ListTab.SelectedTab != null) { if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.PublicSearch) { ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focus(); return true; } } break; case Keys.S: FavoriteChange(false); return true; case Keys.B: UnreadStripMenuItem_Click(null, null); return true; case Keys.T: HashToggleMenuItem_Click(null, null); return true; case Keys.P: ImageSelectMenuItem_Click(null, null); return true; case Keys.H: doMoveToRTHome(); return true; case Keys.O: FavorareMenuItem_Click(null, null); return true; } if (Focused == FocusedControl.StatusText) { int idx = 0; switch (KeyCode) { case Keys.Up: if (_curList != null && _curList.Items.Count != 0 && _curList.SelectedIndices.Count > 0 && _curList.SelectedIndices[0] > 0) { idx = _curList.SelectedIndices[0] - 1; SelectListItem(_curList, idx); _curList.EnsureVisible(idx); return true; } break; case Keys.Down: if (_curList != null && _curList.Items.Count != 0 && _curList.SelectedIndices.Count > 0 && _curList.SelectedIndices[0] < _curList.Items.Count - 1) { idx = _curList.SelectedIndices[0] + 1; SelectListItem(_curList, idx); _curList.EnsureVisible(idx); return true; } break; case Keys.Space: if (StatusText.SelectionStart > 0) { int endidx = StatusText.SelectionStart - 1; string startstr = ""; bool pressed = false; for (int i = StatusText.SelectionStart - 1; i >= 0; i--) { char c = StatusText.Text[i]; if (Char.IsLetterOrDigit(c) || c == '_') { continue; } if (c == '@') { pressed = true; startstr = StatusText.Text.Substring(i + 1, endidx - i); int cnt = AtIdSupl.ItemCount; ShowSuplDialog(StatusText, AtIdSupl, startstr.Length + 1, startstr); if (AtIdSupl.ItemCount != cnt) _modifySettingAtId = true; } else if (c == '#') { pressed = true; startstr = StatusText.Text.Substring(i + 1, endidx - i); ShowSuplDialog(StatusText, HashSupl, startstr.Length + 1, startstr); } else { break; } } return pressed; } break; } } else if (Focused == FocusedControl.ListTab) { DetailsListView lst = (DetailsListView)ListTab.SelectedTab.Tag; ColumnHeader col; switch (KeyCode) { case Keys.D1: case Keys.D2: case Keys.D3: case Keys.D4: case Keys.D5: case Keys.D6: case Keys.D7: case Keys.D8: // ソートダイレクト選択(Ctrl+Shift+1~8,Ctrl+Shift+9) int colNo = KeyCode - Keys.D1; if (lst.Columns.Count < colNo) return false; col = lst.Columns.Cast<ColumnHeader>().Where((x) => { return x.DisplayIndex == colNo; }).FirstOrDefault(); if (col == null) return false; MyList_ColumnClick(lst, new ColumnClickEventArgs(col.Index)); return true; case Keys.D9: col = lst.Columns.Cast<ColumnHeader>().OrderByDescending((x) => { return x.DisplayIndex; }).First(); MyList_ColumnClick(lst, new ColumnClickEventArgs(col.Index)); return true; } } break; case ModifierState.Ctrl | ModifierState.Alt: if (KeyCode == Keys.S) { FavoritesRetweetOriginal(); return true; } else if (KeyCode == Keys.R) { FavoritesRetweetUnofficial(); return true; } else if (KeyCode == Keys.H) { OpenUserAppointUrl(); return true; } break; case ModifierState.Alt | ModifierState.Shift: if (Focused == FocusedControl.PostBrowser) { if (KeyCode == Keys.R) doReTweetUnofficial(); else if (KeyCode == Keys.C) CopyUserId(); return true; } switch (KeyCode) { case Keys.T: if (!this.ExistCurrentPost) return false; doTranslation(_curPost.TextFromApi); return true; case Keys.R: doReTweetUnofficial(); return true; case Keys.C: CopyUserId(); return true; case Keys.Up: Thumbnail.ScrollThumbnail(false); return true; case Keys.Down: Thumbnail.ScrollThumbnail(true); return true; } if (Focused == FocusedControl.ListTab && KeyCode == Keys.Enter) { if (!this.SplitContainer3.Panel2Collapsed) { Thumbnail.OpenPicture(); } return true; } break; } return false; }
private ShortcutCommand() { this.shortcuts = new Keys[0]; this.command = () => Task.FromResult(0); this.onlyWhen = () => true; this.focusedOn = FocusedControl.None; this.notFocusedOn = FocusedControl.None; this.preventDefault = true; }
/// <summary> /// 指定されたコントロールにフォーカスが当たっている時はショートカットを有効にしません /// </summary> public Builder NotFocusedOn(FocusedControl notFocusedOn) { this.instance.notFocusedOn = notFocusedOn; return this; }
/// <summary> /// 指定されたコントロールにフォーカスが当たっている時のみショートカットを有効にします /// </summary> public Builder FocusedOn(FocusedControl focusedOn) { this.instance.focusedOn = focusedOn; return this; }
internal bool CommonKeyDown(Keys keyData, FocusedControl focusedOn, out Task asyncTask) { // Task を返す非同期処理があれば asyncTask に代入する asyncTask = null; // ShortcutCommand に対応しているコマンドはここで処理される foreach (var command in this.shortcutCommands) { if (command.IsMatch(keyData, focusedOn)) { asyncTask = command.RunCommand(); return command.PreventDefault; } } return false; }
private bool CommonKeyDown(Keys keyCode, FocusedControl focusedControl, ModifierState modifierState) { if (focusedControl == FocusedControl.ListTab) { // リストのカーソル移動関係(上下キー、PageUp/Downに該当) if (modifierState == (ModifierState.Ctrl | ModifierState.Shift) || modifierState == ModifierState.Ctrl || modifierState == ModifierState.None || modifierState == ModifierState.Shift) { switch (keyCode) { case Keys.J: SendKeys.Send("{DOWN}"); return true; case Keys.K: SendKeys.Send("{UP}"); return true; } } if (modifierState == ModifierState.Shift || modifierState == ModifierState.None) { switch (keyCode) { case Keys.F: SendKeys.Send("{PGDN}"); return true; case Keys.B: SendKeys.Send("{PGUP}"); return true; } } } switch (modifierState) { // 修飾キーなし case ModifierState.None: // フォーカス関係なし switch (keyCode) { case Keys.F1: OpenUriAsync(ApplicationHelpWebPageUrl); return true; case Keys.F3: TrySearchWordInTabToBottom(); return true; case Keys.F5: RefreshTab(); return true; case Keys.F6: GetTimeline(WorkerType.Reply); return true; case Keys.F7: GetTimeline(WorkerType.DirectMessegeRcv); return true; } if (focusedControl != FocusedControl.StatusText) { // フォーカスStatusText以外 switch (keyCode) { case Keys.Space: case Keys.ProcessKey: if (focusedControl == FocusedControl.ListTab) { _anchorFlag = false; } TrySearchAndFocusUnreadTweet(); return true; case Keys.G: if (focusedControl == FocusedControl.ListTab) { _anchorFlag = false; } AddRelatedStatusesTab(); return true; } } if (focusedControl == FocusedControl.ListTab) { // フォーカスList switch (keyCode) { case Keys.N: case Keys.Right: GoRelPost(true); return true; case Keys.P: case Keys.Left: GoRelPost(false); return true; case Keys.OemPeriod: GoAnchor(); return true; case Keys.I: if (StatusText.Enabled) { StatusText.Focus(); } return true; case Keys.Enter: // case Keys.Return: MakeReplyOrDirectStatus(); return true; case Keys.R: RefreshTab(); return true; } // 以下、アンカー初期化 _anchorFlag = false; switch (keyCode) { case Keys.L: GoSameUsersPost(true); return true; case Keys.H: GoSameUsersPost(false); return true; case Keys.Z: case Keys.Oemcomma: MoveTop(); return true; case Keys.S: GoNextTab(true); return true; case Keys.A: GoNextTab(false); return true; case Keys.Oem4: // ] in_reply_to参照元へ戻る GoInReplyToPostTree(); return true; case Keys.Oem6: // [ in_reply_toへジャンプ GoBackInReplyToPostTree(); return true; case Keys.Escape: if (ListTab.SelectedTab != null) { TabUsageType tabtype = _statuses.Tabs[ListTab.SelectedTab.Text].TabType; if (tabtype == TabUsageType.Related || tabtype == TabUsageType.UserTimeline || tabtype == TabUsageType.PublicSearch) { TabPage relTp = ListTab.SelectedTab; RemoveSpecifiedTab(relTp.Text, false); SaveConfigsTabs(); return true; } } break; } } break; case ModifierState.Ctrl: // フォーカス関係なし switch (keyCode) { case Keys.R: MakeReplyOrDirectStatus(false); return true; case Keys.D: DeleteSelected(); return true; case Keys.M: MakeReplyOrDirectStatus(false, false); return true; case Keys.S: ChangeSelectedFavStatus(true); return true; case Keys.I: OpenRepliedStatus(); return true; case Keys.Q: DoQuote(); return true; case Keys.B: ChangeSelectedTweetReadStateToRead(); return true; case Keys.T: ShowHashManageBox(); return true; case Keys.L: ConvertUrlByAutoSelectedService(); return true; case Keys.Y: if (focusedControl != FocusedControl.PostBrowser) { ChangeStatusTextMultilineState(MultiLineMenuItem.Checked); return true; } break; case Keys.F: TrySearchWordInTab(); return true; case Keys.U: ShowUserTimeline(); return true; case Keys.H: // Webページを開く動作 TryOpenCurListSelectedUserHome(); return true; case Keys.G: // Webページを開く動作 TryOpenCurListSelectedUserFavorites(); return true; case Keys.O: // Webページを開く動作 TryOpenSelectedTweetWebPage(); return true; case Keys.E: // Webページを開く動作 TryOpenUrlInCurrentTweet(); return true; } // フォーカスList if (focusedControl == FocusedControl.ListTab) { switch (keyCode) { case Keys.Home: case Keys.End: _colorize = true; // スルーする return false; case Keys.N: GoNextTab(true); return true; case Keys.P: GoNextTab(false); return true; case Keys.C: CopyStot(); return true; case Keys.D1: case Keys.D2: case Keys.D3: case Keys.D4: case Keys.D5: case Keys.D6: case Keys.D7: case Keys.D8: // タブダイレクト選択(Ctrl+1~8,Ctrl+9) int tabNo = keyCode - Keys.D1; if (ListTab.TabPages.Count < tabNo) { return false; } ListTabSelect(tabNo); return true; case Keys.D9: ListTabSelect(ListTab.TabPages.Count - 1); return true; } } else if (focusedControl == FocusedControl.StatusText) { // フォーカスStatusText switch (keyCode) { case Keys.A: StatusText.SelectAll(); return true; case Keys.Up: case Keys.Down: if (!string.IsNullOrEmpty(StatusText.Text.Trim())) { _postHistory[_postHistoryIndex] = new PostingStatus(StatusText.Text, _replyToId, _replyToName); } if (keyCode == Keys.Up) { _postHistoryIndex -= 1; if (_postHistoryIndex < 0) { _postHistoryIndex = 0; } } else { _postHistoryIndex += 1; if (_postHistoryIndex > _postHistory.Count - 1) { _postHistoryIndex = _postHistory.Count - 1; } } StatusText.Text = _postHistory[_postHistoryIndex].Status; _replyToId = _postHistory[_postHistoryIndex].InReplyToId; _replyToName = _postHistory[_postHistoryIndex].InReplyToName; StatusText.SelectionStart = StatusText.Text.Length; return true; case Keys.PageUp: case Keys.P: if (ListTab.SelectedIndex == 0) { ListTab.SelectedIndex = ListTab.TabCount - 1; } else { ListTab.SelectedIndex -= 1; } StatusText.Focus(); return true; case Keys.PageDown: case Keys.N: if (ListTab.SelectedIndex == ListTab.TabCount - 1) { ListTab.SelectedIndex = 0; } else { ListTab.SelectedIndex += 1; } StatusText.Focus(); return true; } } else { // フォーカスPostBrowserもしくは関係なし switch (keyCode) { case Keys.A: PostBrowser.Document.ExecCommand("SelectAll", false, null); return true; case Keys.C: case Keys.Insert: string selText = WebBrowser_GetSelectionText(PostBrowser); if (!string.IsNullOrEmpty(selText)) { CopyToClipboard(selText); } return true; case Keys.Y: MultiLineMenuItem.Checked = !MultiLineMenuItem.Checked; ChangeStatusTextMultilineState(MultiLineMenuItem.Checked); return true; } } break; case ModifierState.Shift: // フォーカス関係なし switch (keyCode) { case Keys.F3: TrySearchWordInTabToTop(); return true; case Keys.F5: RefreshTab(true); return true; case Keys.F6: GetTimeline(WorkerType.Reply, -1); return true; case Keys.F7: GetTimeline(WorkerType.DirectMessegeRcv); return true; } // フォーカスStatusText以外 if (focusedControl != FocusedControl.StatusText) { if (keyCode == Keys.R) { RefreshTab(true); return true; } } // フォーカスリスト if (focusedControl == FocusedControl.ListTab) { switch (keyCode) { case Keys.H: GoTopEnd(true); return true; case Keys.L: GoTopEnd(false); return true; case Keys.M: GoMiddle(); return true; case Keys.G: GoLast(); return true; case Keys.Z: MoveMiddle(); return true; case Keys.Oem4: GoBackInReplyToPostTree(true, false); return true; case Keys.Oem6: GoBackInReplyToPostTree(true); return true; case Keys.N: case Keys.Right: // お気に入り前後ジャンプ(SHIFT+N←/P→) GoFav(true); return true; case Keys.P: case Keys.Left: // お気に入り前後ジャンプ(SHIFT+N←/P→) GoFav(false); return true; case Keys.Space: GoBackSelectPostChain(); return true; } } break; case ModifierState.Alt: switch (keyCode) { case Keys.R: DoReTweetOfficial(true); return true; case Keys.P: if (_curPost != null) { ShowUserStatus(_curPost.ScreenName, false); return true; } break; case Keys.Up: ScrollDownPostBrowser(false); return true; case Keys.Down: ScrollDownPostBrowser(true); return true; case Keys.PageUp: PageDownPostBrowser(false); return true; case Keys.PageDown: PageDownPostBrowser(true); return true; } if (focusedControl == FocusedControl.ListTab) { // 別タブの同じ書き込みへ(ALT+←/→) if (keyCode == Keys.Right) { GoSamePostToAnotherTab(false); return true; } if (keyCode == Keys.Left) { GoSamePostToAnotherTab(true); return true; } } break; case ModifierState.Ctrl | ModifierState.Shift: switch (keyCode) { case Keys.R: MakeReplyOrDirectStatus(false, true, true); return true; case Keys.C: CopyIdUri(); return true; case Keys.F: if (ListTab.SelectedTab != null) { if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == TabUsageType.PublicSearch) { ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focus(); return true; } } break; case Keys.S: ChangeSelectedFavStatus(false); return true; case Keys.B: ChangeSelectedTweetReadSateToUnread(); return true; case Keys.T: ChangeUseHashTagSetting(); return true; case Keys.P: ToggleImageSelectorView(); return true; case Keys.H: TryOpenSelectedRtUserHome(); return true; case Keys.O: OpenFavorarePageOfSelectedTweetUser(); return true; } if (focusedControl == FocusedControl.StatusText) { switch (keyCode) { case Keys.Up: { if (_curList != null && _curList.Items.Count != 0 && _curList.SelectedIndices.Count > 0 && _curList.SelectedIndices[0] > 0) { int idx = _curList.SelectedIndices[0] - 1; SelectListItem(_curList, idx); _curList.EnsureVisible(idx); return true; } } break; case Keys.Down: { if (_curList != null && _curList.Items.Count != 0 && _curList.SelectedIndices.Count > 0 && _curList.SelectedIndices[0] < _curList.Items.Count - 1) { int idx = _curList.SelectedIndices[0] + 1; SelectListItem(_curList, idx); _curList.EnsureVisible(idx); return true; } } break; case Keys.Space: if (StatusText.SelectionStart > 0) { int endidx = StatusText.SelectionStart - 1; bool pressed = false; for (int i = StatusText.SelectionStart - 1; i >= 0; i--) { char c = StatusText.Text[i]; if (char.IsLetterOrDigit(c) || c == '_') { continue; } string startstr; if (c == '@') { pressed = true; startstr = StatusText.Text.Substring(i + 1, endidx - i); int cnt = AtIdSupl.ItemCount; ShowSuplDialog(StatusText, AtIdSupl, startstr.Length + 1, startstr); if (AtIdSupl.ItemCount != cnt) { _modifySettingAtId = true; } } else if (c == '#') { pressed = true; startstr = StatusText.Text.Substring(i + 1, endidx - i); ShowSuplDialog(StatusText, HashSupl, startstr.Length + 1, startstr); } else { break; } } return pressed; } break; } } else if (focusedControl == FocusedControl.ListTab) { switch (keyCode) { case Keys.D1: case Keys.D2: case Keys.D3: case Keys.D4: case Keys.D5: case Keys.D6: case Keys.D7: case Keys.D8: { // ソートダイレクト選択(Ctrl+Shift+1~8,Ctrl+Shift+9) int colNo = keyCode - Keys.D1; var lst = (DetailsListView)ListTab.SelectedTab.Tag; if (lst.Columns.Count < colNo) { return false; } var col = lst.Columns.Cast<ColumnHeader>().FirstOrDefault(x => x.DisplayIndex == colNo); if (col == null) { return false; } MyList_ColumnClick(lst, new ColumnClickEventArgs(col.Index)); return true; } case Keys.D9: { var lst = (DetailsListView)ListTab.SelectedTab.Tag; var col = lst.Columns.Cast<ColumnHeader>().OrderByDescending(x => x.DisplayIndex).First(); MyList_ColumnClick(lst, new ColumnClickEventArgs(col.Index)); return true; } } } break; case ModifierState.Ctrl | ModifierState.Alt: switch (keyCode) { case Keys.S: FavoritesRetweetOriginal(); return true; case Keys.R: FavoritesRetweetUnofficial(); return true; case Keys.H: OpenUserAppointUrl(); return true; } break; case ModifierState.Alt | ModifierState.Shift: if (focusedControl == FocusedControl.PostBrowser) { if (keyCode == Keys.R) { DoReTweetUnofficial(); } else if (keyCode == Keys.C) { CopyUserId(); } return true; } switch (keyCode) { case Keys.T: if (!ExistCurrentPost) { return false; } DoTranslation(_curPost.TextFromApi); return true; case Keys.R: DoReTweetUnofficial(); return true; case Keys.C: CopyUserId(); return true; case Keys.Up: _thumbnail.ScrollThumbnail(false); return true; case Keys.Down: _thumbnail.ScrollThumbnail(true); return true; } if (focusedControl == FocusedControl.ListTab && keyCode == Keys.Enter) { if (!SplitContainer3.Panel2Collapsed) { _thumbnail.OpenPicture(); } return true; } break; } return false; }