svnno****@sourc*****
svnno****@sourc*****
2010年 12月 28日 (火) 09:47:39 JST
Revision: 1269 http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1269 Author: anis774 Date: 2010-12-28 09:47:38 +0900 (Tue, 28 Dec 2010) Log Message: ----------- ]でそのポストに対するリプライを選択する機能を実装。 Shift + ] で同じポストへのリプライに移動 Modified Paths: -------------- trunk/Tween/Tween.vb -------------- next part -------------- Modified: trunk/Tween/Tween.vb =================================================================== --- trunk/Tween/Tween.vb 2010-12-27 20:22:27 UTC (rev 1268) +++ trunk/Tween/Tween.vb 2010-12-28 00:47:38 UTC (rev 1269) @@ -1604,7 +1604,7 @@ 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 @@ 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 @@ 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