From dedec76a675a1847c4e0c93720b0522f552a9e73 Mon Sep 17 00:00:00 2001 From: anis774 Date: Tue, 28 Dec 2010 00:47:38 +0000 Subject: [PATCH] =?utf8?q?]=E3=81=A7=E3=81=9D=E3=81=AE=E3=83=9D=E3=82=B9?= =?utf8?q?=E3=83=88=E3=81=AB=E5=AF=BE=E3=81=99=E3=82=8B=E3=83=AA=E3=83=97?= =?utf8?q?=E3=83=A9=E3=82=A4=E3=82=92=E9=81=B8=E6=8A=9E=E3=81=99=E3=82=8B?= =?utf8?q?=E6=A9=9F=E8=83=BD=E3=82=92=E5=AE=9F=E8=A3=85=E3=80=82=20Shift?= =?utf8?q?=20+=20]=20=E3=81=A7=E5=90=8C=E3=81=98=E3=83=9D=E3=82=B9?= =?utf8?q?=E3=83=88=E3=81=B8=E3=81=AE=E3=83=AA=E3=83=97=E3=83=A9=E3=82=A4?= =?utf8?q?=E3=81=AB=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@1269 e39ad16e-3079-482e-bb30-4b4d378143b6 --- Tween/Tween.vb | 107 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 92 insertions(+), 15 deletions(-) diff --git a/Tween/Tween.vb b/Tween/Tween.vb index 45a6aa56..eed44829 100644 --- a/Tween/Tween.vb +++ b/Tween/Tween.vb @@ -1604,7 +1604,7 @@ Public Class TweenMain Private Function JudgeColor(ByVal BasePost As PostClass, ByVal TargetPost As PostClass) As Color Dim cl As Color - If TargetPost.Id = BasePost.InReplyToId Then + If TargetPost.Id = BasePost.InReplyToId OrElse BasePost.Id = TargetPost.InReplyToId Then '@先 cl = _clAtTo ElseIf TargetPost.IsMe Then @@ -5011,6 +5011,10 @@ RETRY: e.Handled = True e.SuppressKeyPress = True SendKeys.Send("{UP}") + ElseIf e.KeyCode = Keys.Oem6 AndAlso Not e.Alt Then + e.Handled = True + e.SuppressKeyPress = True + GoBackInReplyToPost(True) End If ' お気に入り前後ジャンプ(SHIFT+N←/P→) @@ -5556,27 +5560,100 @@ RETRY: listView.EnsureVisible(inReplyToIndex) End Sub - Private Sub GoBackInReplyToPost() + Private Sub GoBackInReplyToPost(Optional ByVal isShiftKeyPress As Boolean = False) If replyChains Is Nothing OrElse replyChains.Count < 1 Then - Exit Sub - End If + If _curPost Is Nothing Then Return - Dim chainHead As ReplyChain = replyChains.Pop() - If chainHead.InReplyToId = _curPost.Id Then - Dim idx As Integer = _statuses.Tabs(chainHead.OriginalTab.Text).IndexOf(chainHead.OriginalId) - If idx = -1 Then - replyChains = Nothing + Dim curTabClass As TabClass = _statuses.Tabs(_curTab.Text) + Dim curTabPosts As Dictionary(Of Long, PostClass) = DirectCast(IIf(curTabClass.IsInnerStorageTabType, curTabClass.Posts, _statuses.Posts), Dictionary(Of Long, PostClass)) + + If isShiftKeyPress Then + Dim posts = From p In curTabPosts + Where p.Value.Id <> _curPost.Id AndAlso p.Value.InReplyToId = _curPost.InReplyToId + Let indexOf = curTabClass.IndexOf(p.Value.Id) + Where indexOf > -1 + Order By indexOf + Select New With {.Post = p.Value, .Index = indexOf} + + Try + Dim postList = posts.ToList() + Dim post = postList.FirstOrDefault(Function(p) + Return p.Index > curTabClass.IndexOf(_curPost.Id) + End Function) + If post Is Nothing Then + post = postList.First() + End If + SelectListItem(_curList, post.Index) + _curList.EnsureVisible(post.Index) + Catch ex As InvalidOperationException + Dim posts2 = From t In _statuses.Tabs + Where t.Value IsNot curTabClass + From p In DirectCast(IIf(t.Value.IsInnerStorageTabType, t.Value.Posts, _statuses.Posts), Dictionary(Of Long, PostClass)) + Where p.Value.Id <> _curPost.Id AndAlso p.Value.InReplyToId = _curPost.InReplyToId + Let indexOf = t.Value.IndexOf(p.Value.Id) + Where indexOf > -1 + Order By indexOf + Select New With {.Tab = t.Value, .Post = p.Value, .Index = indexOf} + Try + Dim post = posts2.First() + Me.ListTab.SelectTab(Me.ListTab.TabPages.Cast(Of TabPage).First(Function(tp) tp.Text = post.Tab.TabName)) + Dim listView = DirectCast(Me.ListTab.SelectedTab.Tag, DetailsListView) + SelectListItem(listView, post.Index) + listView.EnsureVisible(post.Index) + Catch ex2 As InvalidOperationException + Exit Sub + End Try + End Try Else + Dim posts = From p In curTabPosts + Where p.Value.InReplyToId = _curPost.Id + Let indexOf = curTabClass.IndexOf(p.Value.Id) + Where indexOf > -1 + Order By indexOf + Select New With {.Post = p.Value, .Index = indexOf} Try - ListTab.SelectTab(chainHead.OriginalTab) - Catch ex As Exception - replyChains = Nothing + Dim post = posts.First() + SelectListItem(_curList, post.Index) + _curList.EnsureVisible(post.Index) + Catch ex As InvalidOperationException + Dim posts2 = From t In _statuses.Tabs + Where t.Value IsNot curTabClass + From p In DirectCast(IIf(t.Value.IsInnerStorageTabType, t.Value.Posts, _statuses.Posts), Dictionary(Of Long, PostClass)) + Where p.Value.InReplyToId = _curPost.Id + Let indexOf = t.Value.IndexOf(p.Value.Id) + Where indexOf > -1 + Order By indexOf + Select New With {.Tab = t.Value, .Post = p.Value, .Index = indexOf} + Try + Dim post = posts2.First() + Me.ListTab.SelectTab(Me.ListTab.TabPages.Cast(Of TabPage).First(Function(tp) tp.Text = post.Tab.TabName)) + Dim listView = DirectCast(Me.ListTab.SelectedTab.Tag, DetailsListView) + SelectListItem(listView, post.Index) + listView.EnsureVisible(post.Index) + Catch ex2 As InvalidOperationException + Exit Sub + End Try End Try - SelectListItem(_curList, idx) - _curList.EnsureVisible(idx) End If Else - replyChains = Nothing + Dim chainHead As ReplyChain = replyChains.Pop() + If chainHead.InReplyToId = _curPost.Id Then + Dim idx As Integer = _statuses.Tabs(chainHead.OriginalTab.Text).IndexOf(chainHead.OriginalId) + If idx = -1 Then + replyChains = Nothing + Else + Try + ListTab.SelectTab(chainHead.OriginalTab) + Catch ex As Exception + replyChains = Nothing + End Try + SelectListItem(_curList, idx) + _curList.EnsureVisible(idx) + End If + Else + replyChains = Nothing + Me.GoBackInReplyToPost(isShiftKeyPress) + End If End If End Sub -- 2.11.0