リビジョン | cc060214b95bd3b48489b260159f3a846fe80502 (tree) |
---|---|
日時 | 2011-01-18 21:13:35 |
作者 | azyobuzin <azyobuzin@user...> |
コミッター | azyobuzin |
StatusesListViewに移行
TODO:オーナードローなど
@@ -20,7 +20,7 @@ namespace Azyobuzi.Twirunrun | ||
20 | 20 | e.ItemHeight = |
21 | 21 | Math.Max( |
22 | 22 | Settings.Instance.IconSize, |
23 | - (int)Settings.Instance.MainFont.ConvertToFont().GetHeight() | |
23 | + (int)Settings.Instance.MainFont.GetHeight() | |
24 | 24 | ) + 1; |
25 | 25 | this.DrawItem += this_DrawItem; |
26 | 26 | } |
@@ -69,18 +69,18 @@ namespace Azyobuzi.Twirunrun | ||
69 | 69 | |
70 | 70 | var post = Statuses[e.Index]; |
71 | 71 | |
72 | - var font = Settings.Instance.MainFont.ConvertToFont(); | |
72 | + var font = Settings.Instance.MainFont; | |
73 | 73 | var color = (e.State & DrawItemState.Selected) == DrawItemState.Selected ? |
74 | - SystemColors.HighlightText : Settings.Instance.MainFontColor.ConvertToColor(); | |
74 | + SystemColors.HighlightText : Settings.Instance.MainFontColor; | |
75 | 75 | |
76 | 76 | e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; |
77 | 77 | |
78 | 78 | //背景色描画 |
79 | 79 | Brush bgBrush; |
80 | 80 | if (post.Type == StatusTypes.Retweet) |
81 | - bgBrush = new SolidBrush(Settings.Instance.RetweetedBgColor.ConvertToColor()); | |
81 | + bgBrush = new SolidBrush(Settings.Instance.RetweetedBgColor); | |
82 | 82 | else |
83 | - bgBrush = new SolidBrush(Settings.Instance.MainBgColor.ConvertToColor()); | |
83 | + bgBrush = new SolidBrush(Settings.Instance.MainBgColor); | |
84 | 84 | |
85 | 85 | e.Graphics.FillRectangle(bgBrush, e.Bounds); |
86 | 86 |
@@ -12,9 +12,16 @@ namespace Azyobuzi.Twirunrun | ||
12 | 12 | { |
13 | 13 | this.View = View.Details; |
14 | 14 | this.VirtualMode = true; |
15 | + this.HeaderStyle = ColumnHeaderStyle.None; | |
16 | + this.FullRowSelect = true; | |
15 | 17 | this.RetrieveVirtualItem += this_RetrieveVirtualItem; |
18 | + this.Columns.Add("名前", Settings.Instance.NameWidth); | |
19 | + this.Columns.Add("投稿"); | |
20 | + this.SizeChanged += (sender, e) => this.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.ColumnContent); | |
16 | 21 | } |
17 | 22 | |
23 | + public const string NAME_SUBITEM = "NameSubItem";//SubItem識別用 | |
24 | + | |
18 | 25 | private IList<StatusInfo> statuses; |
19 | 26 | public IList<StatusInfo> Statuses |
20 | 27 | { |
@@ -31,7 +38,7 @@ namespace Azyobuzi.Twirunrun | ||
31 | 38 | |
32 | 39 | public void SetItemsCount(int count) |
33 | 40 | { |
34 | - VirtualListSize = count; | |
41 | + this.Invoke((MethodInvoker)(() => VirtualListSize = count)); | |
35 | 42 | } |
36 | 43 | |
37 | 44 | public void SetItemsCount() |
@@ -42,9 +49,19 @@ namespace Azyobuzi.Twirunrun | ||
42 | 49 | private void this_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) |
43 | 50 | { |
44 | 51 | var item = Statuses[e.ItemIndex]; |
52 | + var s = Settings.Instance; | |
45 | 53 | |
46 | 54 | var lvi = new ListViewItem(); |
55 | + lvi.BackColor = item.Type == StatusTypes.Retweet ? s.RetweetedBgColor : s.MainBgColor; | |
56 | + lvi.Font = s.MainFont; | |
57 | + lvi.ForeColor = item.Type == StatusTypes.Retweet ? s.RetweetedFontColor : s.MainFontColor; | |
58 | + lvi.Text = s.NameType == NameTypes.Name ? item.User.Name : item.User.ScreenName; | |
59 | + | |
60 | + lvi.SubItems.Add(item.Text.Replace('\n', ' ')); | |
61 | + | |
62 | + lvi.SubItems[0].Tag = NAME_SUBITEM; | |
47 | 63 | |
64 | + e.Item = lvi; | |
48 | 65 | } |
49 | 66 | } |
50 | 67 | } |
@@ -14,7 +14,7 @@ namespace Azyobuzi.Twirunrun | ||
14 | 14 | RecentStatusesCollection.Instance.AsParallel() |
15 | 15 | .Where(tweet => tweet.Type == StatusTypes.DirectMessage) |
16 | 16 | .OrderBy(Settings.Instance.OrderType) |
17 | - .ToList().AsReadOnly(); | |
17 | + .ToList(); | |
18 | 18 | if (e.NewItems.Count != 0) |
19 | 19 | { |
20 | 20 | var newTweets = e.NewItems.OfType<StatusInfo>().Where(tweet => tweet.Type == StatusTypes.DirectMessage); |
@@ -14,7 +14,7 @@ namespace Azyobuzi.Twirunrun | ||
14 | 14 | RecentStatusesCollection.Instance.AsParallel() |
15 | 15 | .Where(tweet => tweet.Type != StatusTypes.DirectMessage) |
16 | 16 | .OrderBy(Settings.Instance.OrderType) |
17 | - .ToList().AsReadOnly(); | |
17 | + .ToList(); | |
18 | 18 | //新着通知 |
19 | 19 | if (e.NewItems.Count != 0) |
20 | 20 | { |
@@ -22,7 +22,7 @@ namespace Azyobuzi.Twirunrun | ||
22 | 22 | tweet.Type != StatusTypes.DirectMessage && |
23 | 23 | mentionCheckRegex.IsMatch(tweet.Text)) |
24 | 24 | .OrderBy(Settings.Instance.OrderType) |
25 | - .ToList().AsReadOnly(); | |
25 | + .ToList(); | |
26 | 26 | //新着通知 |
27 | 27 | if (e.NewItems.Count != 0) |
28 | 28 | { |
@@ -15,12 +15,14 @@ namespace Azyobuzi.Twirunrun | ||
15 | 15 | Timeline.Dock = DockStyle.Fill; |
16 | 16 | this.Controls.Add(Timeline); |
17 | 17 | TabSettings.PropertyChanged += TabSettings_PropertyChanged; |
18 | - Timeline.SelectedIndexChanged += (sender, e) => | |
19 | - this.GetMainForm().ShowDetailStatus(Timeline.Statuses[Timeline.SelectedIndex]); | |
18 | + Timeline.SelectedIndexChanged += (sender, e) =>{ | |
19 | + if (Timeline.SelectedIndices.Count != 0) | |
20 | + this.GetMainForm().ShowDetailStatus(Timeline.Statuses[Timeline.SelectedIndices[0]]); | |
21 | + }; | |
20 | 22 | Timeline.DoubleClick += (sender, e) => |
21 | 23 | { |
22 | - if (Timeline.SelectedIndex == -1) return; | |
23 | - var selecting = Timeline.Statuses[Timeline.SelectedIndex]; | |
24 | + if (Timeline.SelectedIndices.Count == 0) return; | |
25 | + var selecting = Timeline.Statuses[Timeline.SelectedIndices[0]]; | |
24 | 26 | this.GetMainForm().UpdateStatusPanel.SetReplyTo( |
25 | 27 | selecting.Type == StatusTypes.Retweet ? |
26 | 28 | selecting.Tweet.Retweet.ID : selecting.Id, |
@@ -32,7 +34,7 @@ namespace Azyobuzi.Twirunrun | ||
32 | 34 | |
33 | 35 | //public TwirunrunTabControl Owner { private set; get; } |
34 | 36 | |
35 | - public StatusesListBox Timeline = new StatusesListBox(); | |
37 | + public StatusesListView Timeline = new StatusesListView(); | |
36 | 38 | |
37 | 39 | public TabInfo TabSettings { private set; get; } |
38 | 40 |
@@ -3,6 +3,7 @@ using System.Collections.Generic; | ||
3 | 3 | using System.Drawing; |
4 | 4 | using System.Windows.Forms; |
5 | 5 | using System.Linq; |
6 | +using System.Xml.Serialization; | |
6 | 7 | |
7 | 8 | namespace Azyobuzi.Twirunrun |
8 | 9 | { |
@@ -199,14 +200,36 @@ namespace Azyobuzi.Twirunrun | ||
199 | 200 | } |
200 | 201 | } |
201 | 202 | |
202 | - private string mainFont = new Font("MS UI Gothic", 9f).ConvertToString(); | |
203 | - public string MainFont | |
203 | + private string mainFontString = new Font("MS UI Gothic", 9f).ConvertToString(); | |
204 | + public string MainFontString | |
204 | 205 | { |
205 | 206 | set |
206 | 207 | { |
207 | - if (mainFont != value) | |
208 | + if (mainFontString != value) | |
209 | + { | |
210 | + mainFontString = value; | |
211 | + mainFont = value.ConvertToFont(); | |
212 | + OnPropertyChanged("MainFontString"); | |
213 | + OnPropertyChanged("MainFont"); | |
214 | + } | |
215 | + } | |
216 | + get | |
217 | + { | |
218 | + return mainFontString; | |
219 | + } | |
220 | + } | |
221 | + | |
222 | + private Font mainFont = new Font("MS UI Gothic", 9f); | |
223 | + [XmlIgnore] | |
224 | + public Font MainFont | |
225 | + { | |
226 | + set | |
227 | + { | |
228 | + if (!mainFont.Equals(value)) | |
208 | 229 | { |
209 | 230 | mainFont = value; |
231 | + mainFontString = value.ConvertToString(); | |
232 | + OnPropertyChanged("MainFontString"); | |
210 | 233 | OnPropertyChanged("MainFont"); |
211 | 234 | } |
212 | 235 | } |
@@ -216,14 +239,36 @@ namespace Azyobuzi.Twirunrun | ||
216 | 239 | } |
217 | 240 | } |
218 | 241 | |
219 | - private string mainFontColor = SystemColors.ControlText.ConvertToString(); | |
220 | - public string MainFontColor | |
242 | + private string mainFontColorString = SystemColors.ControlText.ConvertToString(); | |
243 | + public string MainFontColorString | |
244 | + { | |
245 | + set | |
246 | + { | |
247 | + if (mainFontColorString != value) | |
248 | + { | |
249 | + mainFontColorString = value; | |
250 | + mainFontColor = value.ConvertToColor(); | |
251 | + OnPropertyChanged("MainFontColorString"); | |
252 | + OnPropertyChanged("MainFontColor"); | |
253 | + } | |
254 | + } | |
255 | + get | |
256 | + { | |
257 | + return mainFontColorString; | |
258 | + } | |
259 | + } | |
260 | + | |
261 | + private Color mainFontColor = SystemColors.ControlText; | |
262 | + [XmlIgnore] | |
263 | + public Color MainFontColor | |
221 | 264 | { |
222 | 265 | set |
223 | 266 | { |
224 | 267 | if (mainFontColor != value) |
225 | 268 | { |
226 | 269 | mainFontColor = value; |
270 | + mainFontColorString = value.ConvertToString(); | |
271 | + OnPropertyChanged("MainFontColorString"); | |
227 | 272 | OnPropertyChanged("MainFontColor"); |
228 | 273 | } |
229 | 274 | } |
@@ -233,14 +278,36 @@ namespace Azyobuzi.Twirunrun | ||
233 | 278 | } |
234 | 279 | } |
235 | 280 | |
236 | - private string mainBgColor = Color.White.ConvertToString(); | |
237 | - public string MainBgColor | |
281 | + private string mainBgColorString = SystemColors.Window.ConvertToString(); | |
282 | + public string MainBgColorString | |
283 | + { | |
284 | + set | |
285 | + { | |
286 | + if (mainBgColorString != value) | |
287 | + { | |
288 | + mainBgColorString = value; | |
289 | + mainBgColor = value.ConvertToColor(); | |
290 | + OnPropertyChanged("MainBgColorString"); | |
291 | + OnPropertyChanged("MainBgColor"); | |
292 | + } | |
293 | + } | |
294 | + get | |
295 | + { | |
296 | + return mainBgColorString; | |
297 | + } | |
298 | + } | |
299 | + | |
300 | + private Color mainBgColor = SystemColors.Window; | |
301 | + [XmlIgnore] | |
302 | + public Color MainBgColor | |
238 | 303 | { |
239 | 304 | set |
240 | 305 | { |
241 | 306 | if (mainBgColor != value) |
242 | 307 | { |
243 | 308 | mainBgColor = value; |
309 | + mainBgColorString = value.ConvertToString(); | |
310 | + OnPropertyChanged("MainBgColorString"); | |
244 | 311 | OnPropertyChanged("MainBgColor"); |
245 | 312 | } |
246 | 313 | } |
@@ -250,14 +317,36 @@ namespace Azyobuzi.Twirunrun | ||
250 | 317 | } |
251 | 318 | } |
252 | 319 | |
253 | - private string retweetedBgColor = Color.Green.ConvertToString(); | |
254 | - public string RetweetedBgColor | |
320 | + private string retweetedBgColorString = SystemColors.Window.ConvertToString(); | |
321 | + public string RetweetedBgColorString | |
322 | + { | |
323 | + set | |
324 | + { | |
325 | + if (retweetedBgColorString != value) | |
326 | + { | |
327 | + retweetedBgColorString = value; | |
328 | + retweetedBgColor = value.ConvertToColor(); | |
329 | + OnPropertyChanged("RetweetedBgColorString"); | |
330 | + OnPropertyChanged("RetweetedBgColor"); | |
331 | + } | |
332 | + } | |
333 | + get | |
334 | + { | |
335 | + return retweetedBgColorString; | |
336 | + } | |
337 | + } | |
338 | + | |
339 | + private Color retweetedBgColor = SystemColors.Window; | |
340 | + [XmlIgnore] | |
341 | + public Color RetweetedBgColor | |
255 | 342 | { |
256 | 343 | set |
257 | 344 | { |
258 | 345 | if (retweetedBgColor != value) |
259 | 346 | { |
260 | 347 | retweetedBgColor = value; |
348 | + retweetedBgColorString = value.ConvertToString(); | |
349 | + OnPropertyChanged("RetweetedBgColorString"); | |
261 | 350 | OnPropertyChanged("RetweetedBgColor"); |
262 | 351 | } |
263 | 352 | } |
@@ -267,14 +356,75 @@ namespace Azyobuzi.Twirunrun | ||
267 | 356 | } |
268 | 357 | } |
269 | 358 | |
270 | - private string postPanelFont = new Font("MS UI Gothic", 9f).ConvertToString(); | |
271 | - public string PostPanelFont | |
359 | + private string retweetedFontColorString = Color.Green.ConvertToString(); | |
360 | + public string RetweetedFontColorString | |
361 | + { | |
362 | + set | |
363 | + { | |
364 | + if (retweetedFontColorString != value) | |
365 | + { | |
366 | + retweetedFontColorString = value; | |
367 | + retweetedFontColor = value.ConvertToColor(); | |
368 | + OnPropertyChanged("RetweetedFontColorString"); | |
369 | + OnPropertyChanged("RetweetedFontColor"); | |
370 | + } | |
371 | + } | |
372 | + get | |
373 | + { | |
374 | + return retweetedFontColorString; | |
375 | + } | |
376 | + } | |
377 | + | |
378 | + private Color retweetedFontColor = Color.Green; | |
379 | + [XmlIgnore] | |
380 | + public Color RetweetedFontColor | |
381 | + { | |
382 | + set | |
383 | + { | |
384 | + if (retweetedFontColor != value) | |
385 | + { | |
386 | + retweetedFontColor = value; | |
387 | + retweetedFontColorString = value.ConvertToString(); | |
388 | + OnPropertyChanged("RetweetedFontColorString"); | |
389 | + OnPropertyChanged("RetweetedFontColor"); | |
390 | + } | |
391 | + } | |
392 | + get | |
393 | + { | |
394 | + return retweetedFontColor; | |
395 | + } | |
396 | + } | |
397 | + | |
398 | + private string postPanelFontString = new Font("MS UI Gothic", 9f).ConvertToString(); | |
399 | + public string PostPanelFontString | |
400 | + { | |
401 | + set | |
402 | + { | |
403 | + if (postPanelFontString != value) | |
404 | + { | |
405 | + postPanelFontString = value; | |
406 | + postPanelFont = value.ConvertToFont(); | |
407 | + OnPropertyChanged("PostPanelFontString"); | |
408 | + OnPropertyChanged("PostPanelFont"); | |
409 | + } | |
410 | + } | |
411 | + get | |
412 | + { | |
413 | + return postPanelFontString; | |
414 | + } | |
415 | + } | |
416 | + | |
417 | + private Font postPanelFont = new Font("MS UI Gothic", 9f); | |
418 | + [XmlIgnore] | |
419 | + public Font PostPanelFont | |
272 | 420 | { |
273 | 421 | set |
274 | 422 | { |
275 | - if (postPanelFont != value) | |
423 | + if (!postPanelFont.Equals(value)) | |
276 | 424 | { |
277 | 425 | postPanelFont = value; |
426 | + postPanelFontString = value.ConvertToString(); | |
427 | + OnPropertyChanged("PostPanelFontString"); | |
278 | 428 | OnPropertyChanged("PostPanelFont"); |
279 | 429 | } |
280 | 430 | } |
@@ -27,7 +27,6 @@ namespace Azyobuzi.Twirunrun | ||
27 | 27 | ReplyToStatusId = Tweet.InReplyToStatusID; |
28 | 28 | Favorited = Tweet.Favorited; |
29 | 29 | Source = new SourceClient(Tweet.Source); |
30 | - IsProtected = Tweet.User.Protected; | |
31 | 30 | ProfileImageUri = Tweet.User.ProfileImageUrl; |
32 | 31 | } |
33 | 32 | else |
@@ -74,7 +73,6 @@ namespace Azyobuzi.Twirunrun | ||
74 | 73 | Text = DirectMessage.SenderScreenName.Equals(Settings.Instance.MyScreenName, StringComparison.InvariantCultureIgnoreCase) ? |
75 | 74 | string.Format("@{0} {1}", DirectMessage.RecipientScreenName, DirectMessage.Text) : DirectMessage.Text; |
76 | 75 | CreatedAt = DirectMessage.CreatedAt.ToLocalTime(); |
77 | - IsProtected = DirectMessage.Sender.Protected; | |
78 | 76 | ProfileImageUri = DirectMessage.Sender.ProfileImageUrl; |
79 | 77 | } |
80 | 78 | else |
@@ -100,9 +98,6 @@ namespace Azyobuzi.Twirunrun | ||
100 | 98 | public bool Favorited { get; set; } |
101 | 99 | [XmlIgnore] |
102 | 100 | public SourceClient Source { set; get; } |
103 | - //public Retweet Retweet { set; get; } | |
104 | - [XmlIgnore] | |
105 | - public bool IsProtected { set; get; } | |
106 | 101 | [XmlIgnore] |
107 | 102 | public string ProfileImageUri { set; get; } |
108 | 103 |