PageRenderTime 64ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 2ms

/OpenTween/Tween.cs

https://bitbucket.org/opentween/opentween
C# | 11593 lines | 9372 code | 1607 blank | 614 comment | 1889 complexity | 0454e54525a76c9903a6fc35f6efe3e2 MD5 | raw file
Possible License(s): LGPL-3.0, BSD-3-Clause, Apache-2.0, GPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. // OpenTween - Client of Twitter
  2. // Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
  3. // (c) 2008-2011 Moz (@syo68k)
  4. // (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
  5. // (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
  6. // (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
  7. // (c) 2011 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
  8. // All rights reserved.
  9. //
  10. // This file is part of OpenTween.
  11. //
  12. // This program is free software; you can redistribute it and/or modify it
  13. // under the terms of the GNU General public License as published by the Free
  14. // Software Foundation; either version 3 of the License, or (at your option)
  15. // any later version.
  16. //
  17. // This program is distributed in the hope that it will be useful, but
  18. // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  19. // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General public License
  20. // for more details.
  21. //
  22. // You should have received a copy of the GNU General public License along
  23. // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
  24. // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
  25. // Boston, MA 02110-1301, USA.
  26. #nullable enable
  27. //コンパイル後コマンド
  28. //"c:\Program Files\Microsoft.NET\SDK\v2.0\Bin\sgen.exe" /f /a:"$(TargetPath)"
  29. //"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sgen.exe" /f /a:"$(TargetPath)"
  30. using System;
  31. using System.Collections.Concurrent;
  32. using System.Collections.Generic;
  33. using System.ComponentModel;
  34. using System.Diagnostics;
  35. using System.Diagnostics.CodeAnalysis;
  36. using System.Drawing;
  37. using System.Globalization;
  38. using System.IO;
  39. using System.Linq;
  40. using System.Media;
  41. using System.Net;
  42. using System.Net.Http;
  43. using System.Reflection;
  44. using System.Runtime.InteropServices;
  45. using System.Text;
  46. using System.Text.RegularExpressions;
  47. using System.Threading;
  48. using System.Threading.Tasks;
  49. using System.Windows.Forms;
  50. using OpenTween.Api;
  51. using OpenTween.Api.DataModel;
  52. using OpenTween.Connection;
  53. using OpenTween.Models;
  54. using OpenTween.OpenTweenCustomControl;
  55. using OpenTween.Setting;
  56. using OpenTween.Thumbnail;
  57. namespace OpenTween
  58. {
  59. public partial class TweenMain : OTBaseForm
  60. {
  61. //各種設定
  62. /// <summary>画面サイズ</summary>
  63. private Size _mySize;
  64. /// <summary>画面位置</summary>
  65. private Point _myLoc;
  66. /// <summary>区切り位置</summary>
  67. private int _mySpDis;
  68. /// <summary>発言欄区切り位置</summary>
  69. private int _mySpDis2;
  70. /// <summary>プレビュー区切り位置</summary>
  71. private int _mySpDis3;
  72. /// <summary>アイコンサイズ</summary>
  73. /// <remarks>
  74. /// 現在は16、24、48の3種類。将来直接数字指定可能とする
  75. /// 注:24x24の場合に26と指定しているのはMSゴシック系フォントのための仕様
  76. /// </remarks>
  77. private int _iconSz;
  78. private bool _iconCol; // 1列表示の時true(48サイズのとき)
  79. //雑多なフラグ類
  80. private bool _initial; // true:起動時処理中
  81. private bool _initialLayout = true;
  82. private bool _ignoreConfigSave; // true:起動時処理中
  83. /// <summary>タブドラッグ中フラグ(DoDragDropを実行するかの判定用)</summary>
  84. private bool _tabDrag;
  85. private TabPage? _beforeSelectedTab; // タブが削除されたときに前回選択されていたときのタブを選択する為に保持
  86. private Point _tabMouseDownPoint;
  87. /// <summary>右クリックしたタブの名前(Tabコントロール機能不足対応)</summary>
  88. private string? _rclickTabName;
  89. private readonly object _syncObject = new object(); // ロック用
  90. private const string detailHtmlFormatHeaderMono =
  91. "<html><head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\">"
  92. + "<style type=\"text/css\"><!-- "
  93. + "body, p, pre {margin: 0;} "
  94. + "pre {font-family: \"%FONT_FAMILY%\", sans-serif; font-size: %FONT_SIZE%pt; background-color:rgb(%BG_COLOR%); word-wrap: break-word; color:rgb(%FONT_COLOR%);} "
  95. + "a:link, a:visited, a:active, a:hover {color:rgb(%LINK_COLOR%); } "
  96. + "img.emoji {width: 1em; height: 1em; margin: 0 .05em 0 .1em; vertical-align: -0.1em; border: none;} "
  97. + ".quote-tweet {border: 1px solid #ccc; margin: 1em; padding: 0.5em;} "
  98. + ".quote-tweet.reply {border-color: #f33;} "
  99. + ".quote-tweet-link {color: inherit !important; text-decoration: none;}"
  100. + "--></style>"
  101. + "</head><body><pre>";
  102. private const string detailHtmlFormatFooterMono = "</pre></body></html>";
  103. private const string detailHtmlFormatHeaderColor =
  104. "<html><head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\">"
  105. + "<style type=\"text/css\"><!-- "
  106. + "body, p, pre {margin: 0;} "
  107. + "body {font-family: \"%FONT_FAMILY%\", sans-serif; font-size: %FONT_SIZE%pt; background-color:rgb(%BG_COLOR%); margin: 0; word-wrap: break-word; color:rgb(%FONT_COLOR%);} "
  108. + "a:link, a:visited, a:active, a:hover {color:rgb(%LINK_COLOR%); } "
  109. + "img.emoji {width: 1em; height: 1em; margin: 0 .05em 0 .1em; vertical-align: -0.1em; border: none;} "
  110. + ".quote-tweet {border: 1px solid #ccc; margin: 1em; padding: 0.5em;} "
  111. + ".quote-tweet.reply {border-color: rgb(%BG_REPLY_COLOR%);} "
  112. + ".quote-tweet-link {color: inherit !important; text-decoration: none;}"
  113. + "--></style>"
  114. + "</head><body><p>";
  115. private const string detailHtmlFormatFooterColor = "</p></body></html>";
  116. private string detailHtmlFormatHeader = null!;
  117. private string detailHtmlFormatFooter = null!;
  118. private bool _myStatusError = false;
  119. private bool _myStatusOnline = false;
  120. private bool soundfileListup = false;
  121. private FormWindowState _formWindowState = FormWindowState.Normal; // フォームの状態保存用 通知領域からアイコンをクリックして復帰した際に使用する
  122. //twitter解析部
  123. private readonly TwitterApi twitterApi = new TwitterApi();
  124. private Twitter tw = null!;
  125. //Growl呼び出し部
  126. private readonly GrowlHelper gh = new GrowlHelper(ApplicationSettings.ApplicationName);
  127. //サブ画面インスタンス
  128. /// <summary>検索画面インスタンス</summary>
  129. internal SearchWordDialog SearchDialog = new SearchWordDialog();
  130. private readonly OpenURL UrlDialog = new OpenURL();
  131. /// <summary>@id補助</summary>
  132. public AtIdSupplement AtIdSupl = null!;
  133. /// <summary>Hashtag補助</summary>
  134. public AtIdSupplement HashSupl = null!;
  135. public HashtagManage HashMgr = null!;
  136. private EventViewerDialog evtDialog = null!;
  137. //表示フォント、色、アイコン
  138. /// <summary>未読用フォント</summary>
  139. private Font _fntUnread = null!;
  140. /// <summary>未読用文字色</summary>
  141. private Color _clUnread;
  142. /// <summary>既読用フォント</summary>
  143. private Font _fntReaded = null!;
  144. /// <summary>既読用文字色</summary>
  145. private Color _clReaded;
  146. /// <summary>Fav用文字色</summary>
  147. private Color _clFav;
  148. /// <summary>片思い用文字色</summary>
  149. private Color _clOWL;
  150. /// <summary>Retweet用文字色</summary>
  151. private Color _clRetweet;
  152. /// <summary>選択中の行用文字色</summary>
  153. private readonly Color _clHighLight = Color.FromKnownColor(KnownColor.HighlightText);
  154. /// <summary>発言詳細部用フォント</summary>
  155. private Font _fntDetail = null!;
  156. /// <summary>発言詳細部用色</summary>
  157. private Color _clDetail;
  158. /// <summary>発言詳細部用リンク文字色</summary>
  159. private Color _clDetailLink;
  160. /// <summary>発言詳細部用背景色</summary>
  161. private Color _clDetailBackcolor;
  162. /// <summary>自分の発言用背景色</summary>
  163. private Color _clSelf;
  164. /// <summary>自分宛返信用背景色</summary>
  165. private Color _clAtSelf;
  166. /// <summary>選択発言者の他の発言用背景色</summary>
  167. private Color _clTarget;
  168. /// <summary>選択発言中の返信先用背景色</summary>
  169. private Color _clAtTarget;
  170. /// <summary>選択発言者への返信発言用背景色</summary>
  171. private Color _clAtFromTarget;
  172. /// <summary>選択発言の唯一@先</summary>
  173. private Color _clAtTo;
  174. /// <summary>リスト部通常発言背景色</summary>
  175. private Color _clListBackcolor;
  176. /// <summary>入力欄背景色</summary>
  177. private Color _clInputBackcolor;
  178. /// <summary>入力欄文字色</summary>
  179. private Color _clInputFont;
  180. /// <summary>入力欄フォント</summary>
  181. private Font _fntInputFont = null!;
  182. /// <summary>アイコン画像リスト</summary>
  183. private ImageCache IconCache = null!;
  184. /// <summary>タスクトレイアイコン:通常時 (At.ico)</summary>
  185. private Icon NIconAt = null!;
  186. /// <summary>タスクトレイアイコン:通信エラー時 (AtRed.ico)</summary>
  187. private Icon NIconAtRed = null!;
  188. /// <summary>タスクトレイアイコン:オフライン時 (AtSmoke.ico)</summary>
  189. private Icon NIconAtSmoke = null!;
  190. /// <summary>タスクトレイアイコン:更新中 (Refresh.ico)</summary>
  191. private Icon[] NIconRefresh = new Icon[4];
  192. /// <summary>未読のあるタブ用アイコン (Tab.ico)</summary>
  193. private Icon TabIcon = null!;
  194. /// <summary>画面左上のアイコン (Main.ico)</summary>
  195. private Icon MainIcon = null!;
  196. private Icon ReplyIcon = null!;
  197. private Icon ReplyIconBlink = null!;
  198. private readonly ImageList _listViewImageList = new ImageList(); //ListViewItemの高さ変更用
  199. private PostClass? _anchorPost;
  200. private bool _anchorFlag; //true:関連発言移動中(関連移動以外のオペレーションをするとfalseへ。trueだとリスト背景色をアンカー発言選択中として描画)
  201. /// <summary>発言履歴</summary>
  202. private readonly List<StatusTextHistory> _history = new List<StatusTextHistory>();
  203. /// <summary>発言履歴カレントインデックス</summary>
  204. private int _hisIdx;
  205. //発言投稿時のAPI引数(発言編集時に設定。手書きreplyでは設定されない)
  206. /// <summary>リプライ先のステータスID・スクリーン名</summary>
  207. private (long StatusId, string ScreenName)? inReplyTo = null;
  208. //時速表示用
  209. private readonly List<DateTimeUtc> _postTimestamps = new List<DateTimeUtc>();
  210. private readonly List<DateTimeUtc> _favTimestamps = new List<DateTimeUtc>();
  211. // 以下DrawItem関連
  212. private readonly SolidBrush _brsHighLight = new SolidBrush(Color.FromKnownColor(KnownColor.Highlight));
  213. private SolidBrush _brsBackColorMine = null!;
  214. private SolidBrush _brsBackColorAt = null!;
  215. private SolidBrush _brsBackColorYou = null!;
  216. private SolidBrush _brsBackColorAtYou = null!;
  217. private SolidBrush _brsBackColorAtFromTarget = null!;
  218. private SolidBrush _brsBackColorAtTo = null!;
  219. private SolidBrush _brsBackColorNone = null!;
  220. /// <summary>Listにフォーカスないときの選択行の背景色</summary>
  221. private readonly SolidBrush _brsDeactiveSelection = new SolidBrush(Color.FromKnownColor(KnownColor.ButtonFace));
  222. private readonly StringFormat sfTab = new StringFormat();
  223. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  224. private TabInformations _statuses = null!;
  225. /// <summary>
  226. /// 現在表示している発言一覧の <see cref="ListView"/> に対するキャッシュ
  227. /// </summary>
  228. /// <remarks>
  229. /// キャッシュクリアのために null が代入されることがあるため、
  230. /// 使用する場合には <see cref="_listItemCache"/> に対して直接メソッド等を呼び出さずに
  231. /// 一旦ローカル変数に代入してから参照すること。
  232. /// </remarks>
  233. private ListViewItemCache? _listItemCache = null;
  234. internal class ListViewItemCache
  235. {
  236. /// <summary>アイテムをキャッシュする対象の <see cref="ListView"/></summary>
  237. public ListView TargetList { get; set; } = null!;
  238. /// <summary>キャッシュする範囲の開始インデックス</summary>
  239. public int StartIndex { get; set; }
  240. /// <summary>キャッシュする範囲の終了インデックス</summary>
  241. public int EndIndex { get; set; }
  242. /// <summary>キャッシュされた範囲に対応する <see cref="ListViewItem"/> と <see cref="PostClass"/> の組</summary>
  243. public (ListViewItem, PostClass)[] Cache { get; set; } = null!;
  244. /// <summary>キャッシュされたアイテムの件数</summary>
  245. public int Count
  246. => this.EndIndex - this.StartIndex + 1;
  247. /// <summary>指定されたインデックスがキャッシュの範囲内であるか判定します</summary>
  248. /// <returns><paramref name="index"/> がキャッシュの範囲内であれば true、それ以外は false</returns>
  249. public bool Contains(int index)
  250. => index >= this.StartIndex && index <= this.EndIndex;
  251. /// <summary>指定されたインデックスの範囲が全てキャッシュの範囲内であるか判定します</summary>
  252. /// <returns><paramref name="rangeStart"/> から <paramref name="rangeEnd"/> の範囲が全てキャッシュの範囲内であれば true、それ以外は false</returns>
  253. public bool IsSupersetOf(int rangeStart, int rangeEnd)
  254. => rangeStart >= this.StartIndex && rangeEnd <= this.EndIndex;
  255. /// <summary>指定されたインデックスの <see cref="ListViewItem"/> と <see cref="PostClass"/> をキャッシュから取得することを試みます</summary>
  256. /// <returns>取得に成功すれば true、それ以外は false</returns>
  257. public bool TryGetValue(int index, [NotNullWhen(true)] out ListViewItem? item, [NotNullWhen(true)] out PostClass? post)
  258. {
  259. if (this.Contains(index))
  260. {
  261. (item, post) = this.Cache[index - this.StartIndex];
  262. return true;
  263. }
  264. else
  265. {
  266. item = null;
  267. post = null;
  268. return false;
  269. }
  270. }
  271. }
  272. private bool _isColumnChanged = false;
  273. private const int MAX_WORKER_THREADS = 20;
  274. private readonly SemaphoreSlim workerSemaphore = new SemaphoreSlim(MAX_WORKER_THREADS);
  275. private readonly CancellationTokenSource workerCts = new CancellationTokenSource();
  276. private readonly IProgress<string> workerProgress = null!;
  277. private int UnreadCounter = -1;
  278. private int UnreadAtCounter = -1;
  279. private readonly string[] ColumnOrgText = new string[9];
  280. private readonly string[] ColumnText = new string[9];
  281. private bool _DoFavRetweetFlags = false;
  282. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  283. private readonly TimelineScheduler timelineScheduler = new TimelineScheduler();
  284. private ThrottlingTimer RefreshThrottlingTimer = null!;
  285. private ThrottlingTimer selectionDebouncer = null!;
  286. private ThrottlingTimer saveConfigDebouncer = null!;
  287. private string recommendedStatusFooter = null!;
  288. private bool urlMultibyteSplit = false;
  289. private bool preventSmsCommand = true;
  290. // URL短縮のUndo用
  291. private struct urlUndo
  292. {
  293. public string Before;
  294. public string After;
  295. }
  296. private List<urlUndo>? urlUndoBuffer = null;
  297. private readonly struct ReplyChain
  298. {
  299. public readonly long OriginalId;
  300. public readonly long InReplyToId;
  301. public readonly TabModel OriginalTab;
  302. public ReplyChain(long originalId, long inReplyToId, TabModel originalTab)
  303. {
  304. this.OriginalId = originalId;
  305. this.InReplyToId = inReplyToId;
  306. this.OriginalTab = originalTab;
  307. }
  308. }
  309. /// <summary>[, ]でのリプライ移動の履歴</summary>
  310. private Stack<ReplyChain>? replyChains;
  311. /// <summary>ポスト選択履歴</summary>
  312. private readonly Stack<(TabModel, PostClass?)> selectPostChains = new Stack<(TabModel, PostClass?)>();
  313. public TabModel CurrentTab
  314. => this._statuses.SelectedTab;
  315. public string CurrentTabName
  316. => this._statuses.SelectedTabName;
  317. public TabPage CurrentTabPage
  318. => this.ListTab.TabPages[this._statuses.Tabs.IndexOf(this.CurrentTabName)];
  319. public DetailsListView CurrentListView
  320. => (DetailsListView)this.CurrentTabPage.Tag;
  321. public PostClass? CurrentPost
  322. => this.CurrentTab.SelectedPost;
  323. /// <summary>検索処理タイプ</summary>
  324. internal enum SEARCHTYPE
  325. {
  326. DialogSearch,
  327. NextSearch,
  328. PrevSearch,
  329. }
  330. private class StatusTextHistory
  331. {
  332. public string status = "";
  333. public (long StatusId, string ScreenName)? inReplyTo = null;
  334. /// <summary>画像投稿サービス名</summary>
  335. public string imageService = "";
  336. public IMediaItem[]? mediaItems = null;
  337. public StatusTextHistory()
  338. {
  339. }
  340. public StatusTextHistory(string status, (long StatusId, string ScreenName)? inReplyTo)
  341. {
  342. this.status = status;
  343. this.inReplyTo = inReplyTo;
  344. }
  345. }
  346. private void TweenMain_Activated(object sender, EventArgs e)
  347. {
  348. //画面がアクティブになったら、発言欄の背景色戻す
  349. if (StatusText.Focused)
  350. {
  351. this.StatusText_Enter(this.StatusText, System.EventArgs.Empty);
  352. }
  353. }
  354. private bool disposed = false;
  355. /// <summary>
  356. /// 使用中のリソースをすべてクリーンアップします。
  357. /// </summary>
  358. /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
  359. protected override void Dispose(bool disposing)
  360. {
  361. base.Dispose(disposing);
  362. if (this.disposed)
  363. return;
  364. if (disposing)
  365. {
  366. this.components?.Dispose();
  367. //後始末
  368. SearchDialog.Dispose();
  369. UrlDialog.Dispose();
  370. NIconAt?.Dispose();
  371. NIconAtRed?.Dispose();
  372. NIconAtSmoke?.Dispose();
  373. foreach (var iconRefresh in this.NIconRefresh)
  374. {
  375. iconRefresh?.Dispose();
  376. }
  377. TabIcon?.Dispose();
  378. MainIcon?.Dispose();
  379. ReplyIcon?.Dispose();
  380. ReplyIconBlink?.Dispose();
  381. _listViewImageList.Dispose();
  382. _brsHighLight.Dispose();
  383. _brsBackColorMine?.Dispose();
  384. _brsBackColorAt?.Dispose();
  385. _brsBackColorYou?.Dispose();
  386. _brsBackColorAtYou?.Dispose();
  387. _brsBackColorAtFromTarget?.Dispose();
  388. _brsBackColorAtTo?.Dispose();
  389. _brsBackColorNone?.Dispose();
  390. _brsDeactiveSelection?.Dispose();
  391. //sf.Dispose();
  392. sfTab.Dispose();
  393. this.workerCts.Cancel();
  394. if (IconCache != null)
  395. {
  396. this.IconCache.CancelAsync();
  397. this.IconCache.Dispose();
  398. }
  399. this.thumbnailTokenSource?.Dispose();
  400. this.tw.Dispose();
  401. this.twitterApi.Dispose();
  402. this._hookGlobalHotkey.Dispose();
  403. }
  404. // 終了時にRemoveHandlerしておかないとメモリリークする
  405. // http://msdn.microsoft.com/ja-jp/library/microsoft.win32.systemevents.powermodechanged.aspx
  406. Microsoft.Win32.SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged;
  407. Microsoft.Win32.SystemEvents.TimeChanged -= SystemEvents_TimeChanged;
  408. this.disposed = true;
  409. }
  410. private void LoadIcons()
  411. {
  412. // Icons フォルダ以下のアイコンを読み込み(着せ替えアイコン対応)
  413. var iconsDir = Path.Combine(Application.StartupPath, "Icons");
  414. // ウィンドウ左上のアイコン
  415. var iconMain = this.LoadIcon(Path.Combine(iconsDir, "MIcon.ico"));
  416. // タブ見出し未読表示アイコン
  417. var iconTab = this.LoadIcon(Path.Combine(iconsDir, "Tab.ico"));
  418. // タスクトレイ: 通常時アイコン
  419. var iconAt = this.LoadIcon(Path.Combine(iconsDir, "At.ico"));
  420. // タスクトレイ: エラー時アイコン
  421. var iconAtRed = this.LoadIcon(Path.Combine(iconsDir, "AtRed.ico"));
  422. // タスクトレイ: オフライン時アイコン
  423. var iconAtSmoke = this.LoadIcon(Path.Combine(iconsDir, "AtSmoke.ico"));
  424. // タスクトレイ: Reply通知アイコン (最大2枚でアニメーション可能)
  425. var iconReply = this.LoadIcon(Path.Combine(iconsDir, "Reply.ico"));
  426. var iconReplyBlink = this.LoadIcon(Path.Combine(iconsDir, "ReplyBlink.ico"));
  427. // タスクトレイ: 更新中アイコン (最大4枚でアニメーション可能)
  428. var iconRefresh1 = this.LoadIcon(Path.Combine(iconsDir, "Refresh.ico"));
  429. var iconRefresh2 = this.LoadIcon(Path.Combine(iconsDir, "Refresh2.ico"));
  430. var iconRefresh3 = this.LoadIcon(Path.Combine(iconsDir, "Refresh3.ico"));
  431. var iconRefresh4 = this.LoadIcon(Path.Combine(iconsDir, "Refresh4.ico"));
  432. // 読み込んだアイコンを設定 (不足するアイコンはデフォルトのものを設定)
  433. this.MainIcon = iconMain ?? Properties.Resources.MIcon;
  434. this.TabIcon = iconTab ?? Properties.Resources.TabIcon;
  435. this.NIconAt = iconAt ?? iconMain ?? Properties.Resources.At;
  436. this.NIconAtRed = iconAtRed ?? Properties.Resources.AtRed;
  437. this.NIconAtSmoke = iconAtSmoke ?? Properties.Resources.AtSmoke;
  438. if (iconReply != null && iconReplyBlink != null)
  439. {
  440. this.ReplyIcon = iconReply;
  441. this.ReplyIconBlink = iconReplyBlink;
  442. }
  443. else
  444. {
  445. this.ReplyIcon = iconReply ?? iconReplyBlink ?? Properties.Resources.Reply;
  446. this.ReplyIconBlink = this.NIconAt;
  447. }
  448. if (iconRefresh1 == null)
  449. {
  450. this.NIconRefresh = new[] {
  451. Properties.Resources.Refresh, Properties.Resources.Refresh2,
  452. Properties.Resources.Refresh3, Properties.Resources.Refresh4,
  453. };
  454. }
  455. else if (iconRefresh2 == null)
  456. {
  457. this.NIconRefresh = new[] { iconRefresh1 };
  458. }
  459. else if (iconRefresh3 == null)
  460. {
  461. this.NIconRefresh = new[] { iconRefresh1, iconRefresh2 };
  462. }
  463. else if (iconRefresh4 == null)
  464. {
  465. this.NIconRefresh = new[] { iconRefresh1, iconRefresh2, iconRefresh3 };
  466. }
  467. else // iconRefresh1 から iconRefresh4 まで全て揃っている
  468. {
  469. this.NIconRefresh = new[] { iconRefresh1, iconRefresh2, iconRefresh3, iconRefresh4 };
  470. }
  471. }
  472. private Icon? LoadIcon(string filePath)
  473. {
  474. if (!File.Exists(filePath))
  475. return null;
  476. try
  477. {
  478. return new Icon(filePath);
  479. }
  480. catch (Exception)
  481. {
  482. return null;
  483. }
  484. }
  485. private void InitColumns(ListView list, bool startup)
  486. {
  487. this.InitColumnText();
  488. ColumnHeader[]? columns = null;
  489. try
  490. {
  491. if (this._iconCol)
  492. {
  493. columns = new[]
  494. {
  495. new ColumnHeader(), // アイコン
  496. new ColumnHeader(), // 本文
  497. };
  498. columns[0].Text = this.ColumnText[0];
  499. columns[1].Text = this.ColumnText[2];
  500. if (startup)
  501. {
  502. var widthScaleFactor = this.CurrentAutoScaleDimensions.Width / SettingManager.Local.ScaleDimension.Width;
  503. columns[0].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width1);
  504. columns[1].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width3);
  505. columns[0].DisplayIndex = 0;
  506. columns[1].DisplayIndex = 1;
  507. }
  508. else
  509. {
  510. var idx = 0;
  511. foreach (var curListColumn in this.CurrentListView.Columns.Cast<ColumnHeader>())
  512. {
  513. columns[idx].Width = curListColumn.Width;
  514. columns[idx].DisplayIndex = curListColumn.DisplayIndex;
  515. idx++;
  516. }
  517. }
  518. }
  519. else
  520. {
  521. columns = new[]
  522. {
  523. new ColumnHeader(), // アイコン
  524. new ColumnHeader(), // ニックネーム
  525. new ColumnHeader(), // 本文
  526. new ColumnHeader(), // 日付
  527. new ColumnHeader(), // ユーザID
  528. new ColumnHeader(), // 未読
  529. new ColumnHeader(), // マーク&プロテクト
  530. new ColumnHeader(), // ソース
  531. };
  532. foreach (var i in Enumerable.Range(0, columns.Length))
  533. columns[i].Text = this.ColumnText[i];
  534. if (startup)
  535. {
  536. var widthScaleFactor = this.CurrentAutoScaleDimensions.Width / SettingManager.Local.ScaleDimension.Width;
  537. columns[0].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width1);
  538. columns[1].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width2);
  539. columns[2].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width3);
  540. columns[3].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width4);
  541. columns[4].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width5);
  542. columns[5].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width6);
  543. columns[6].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width7);
  544. columns[7].Width = ScaleBy(widthScaleFactor, SettingManager.Local.Width8);
  545. var displayIndex = new[] {
  546. SettingManager.Local.DisplayIndex1, SettingManager.Local.DisplayIndex2,
  547. SettingManager.Local.DisplayIndex3, SettingManager.Local.DisplayIndex4,
  548. SettingManager.Local.DisplayIndex5, SettingManager.Local.DisplayIndex6,
  549. SettingManager.Local.DisplayIndex7, SettingManager.Local.DisplayIndex8
  550. };
  551. foreach (var i in Enumerable.Range(0, displayIndex.Length))
  552. {
  553. columns[i].DisplayIndex = displayIndex[i];
  554. }
  555. }
  556. else
  557. {
  558. var idx = 0;
  559. foreach (var curListColumn in this.CurrentListView.Columns.Cast<ColumnHeader>())
  560. {
  561. columns[idx].Width = curListColumn.Width;
  562. columns[idx].DisplayIndex = curListColumn.DisplayIndex;
  563. idx++;
  564. }
  565. }
  566. }
  567. list.Columns.AddRange(columns);
  568. columns = null;
  569. }
  570. finally
  571. {
  572. if (columns != null)
  573. {
  574. foreach (var column in columns)
  575. column?.Dispose();
  576. }
  577. }
  578. }
  579. private void InitColumnText()
  580. {
  581. ColumnText[0] = "";
  582. ColumnText[1] = Properties.Resources.AddNewTabText2;
  583. ColumnText[2] = Properties.Resources.AddNewTabText3;
  584. ColumnText[3] = Properties.Resources.AddNewTabText4_2;
  585. ColumnText[4] = Properties.Resources.AddNewTabText5;
  586. ColumnText[5] = "";
  587. ColumnText[6] = "";
  588. ColumnText[7] = "Source";
  589. ColumnOrgText[0] = "";
  590. ColumnOrgText[1] = Properties.Resources.AddNewTabText2;
  591. ColumnOrgText[2] = Properties.Resources.AddNewTabText3;
  592. ColumnOrgText[3] = Properties.Resources.AddNewTabText4_2;
  593. ColumnOrgText[4] = Properties.Resources.AddNewTabText5;
  594. ColumnOrgText[5] = "";
  595. ColumnOrgText[6] = "";
  596. ColumnOrgText[7] = "Source";
  597. var c = this._statuses.SortMode switch
  598. {
  599. ComparerMode.Nickname => 1, // ニックネーム
  600. ComparerMode.Data => 2, // 本文
  601. ComparerMode.Id => 3, // 時刻=発言Id
  602. ComparerMode.Name => 4, // 名前
  603. ComparerMode.Source => 7, // Source
  604. _ => 0,
  605. };
  606. if (_iconCol)
  607. {
  608. if (_statuses.SortOrder == SortOrder.Descending)
  609. {
  610. // U+25BE BLACK DOWN-POINTING SMALL TRIANGLE
  611. ColumnText[2] = ColumnOrgText[2] + "▾";
  612. }
  613. else
  614. {
  615. // U+25B4 BLACK UP-POINTING SMALL TRIANGLE
  616. ColumnText[2] = ColumnOrgText[2] + "▴";
  617. }
  618. }
  619. else
  620. {
  621. if (_statuses.SortOrder == SortOrder.Descending)
  622. {
  623. // U+25BE BLACK DOWN-POINTING SMALL TRIANGLE
  624. ColumnText[c] = ColumnOrgText[c] + "▾";
  625. }
  626. else
  627. {
  628. // U+25B4 BLACK UP-POINTING SMALL TRIANGLE
  629. ColumnText[c] = ColumnOrgText[c] + "▴";
  630. }
  631. }
  632. }
  633. private void InitializeTraceFrag()
  634. {
  635. #if DEBUG
  636. TraceOutToolStripMenuItem.Checked = true;
  637. MyCommon.TraceFlag = true;
  638. #endif
  639. if (!MyCommon.FileVersion.EndsWith("0", StringComparison.Ordinal))
  640. {
  641. TraceOutToolStripMenuItem.Checked = true;
  642. MyCommon.TraceFlag = true;
  643. }
  644. }
  645. private void TweenMain_Load(object sender, EventArgs e)
  646. {
  647. _ignoreConfigSave = true;
  648. this.Visible = false;
  649. if (MyApplication.StartupOptions.ContainsKey("d"))
  650. MyCommon.TraceFlag = true;
  651. InitializeTraceFrag();
  652. Microsoft.Win32.SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
  653. Regex.CacheSize = 100;
  654. //発言保持クラス
  655. _statuses = TabInformations.GetInstance();
  656. //アイコン設定
  657. LoadIcons();
  658. this.Icon = MainIcon; //メインフォーム(TweenMain)
  659. NotifyIcon1.Icon = NIconAt; //タスクトレイ
  660. TabImage.Images.Add(TabIcon); //タブ見出し
  661. //<<<<<<<<<設定関連>>>>>>>>>
  662. ////設定読み出し
  663. LoadConfig();
  664. // 現在の DPI と設定保存時の DPI との比を取得する
  665. var configScaleFactor = SettingManager.Local.GetConfigScaleFactor(this.CurrentAutoScaleDimensions);
  666. // UIフォント設定
  667. var fontUIGlobal = SettingManager.Local.FontUIGlobal;
  668. if (fontUIGlobal != null)
  669. {
  670. OTBaseForm.GlobalFont = fontUIGlobal;
  671. this.Font = fontUIGlobal;
  672. }
  673. //不正値チェック
  674. if (!MyApplication.StartupOptions.ContainsKey("nolimit"))
  675. {
  676. if (SettingManager.Common.TimelinePeriod < 15 && SettingManager.Common.TimelinePeriod > 0)
  677. SettingManager.Common.TimelinePeriod = 15;
  678. if (SettingManager.Common.ReplyPeriod < 15 && SettingManager.Common.ReplyPeriod > 0)
  679. SettingManager.Common.ReplyPeriod = 15;
  680. if (SettingManager.Common.DMPeriod < 15 && SettingManager.Common.DMPeriod > 0)
  681. SettingManager.Common.DMPeriod = 15;
  682. if (SettingManager.Common.PubSearchPeriod < 30 && SettingManager.Common.PubSearchPeriod > 0)
  683. SettingManager.Common.PubSearchPeriod = 30;
  684. if (SettingManager.Common.UserTimelinePeriod < 15 && SettingManager.Common.UserTimelinePeriod > 0)
  685. SettingManager.Common.UserTimelinePeriod = 15;
  686. if (SettingManager.Common.ListsPeriod < 15 && SettingManager.Common.ListsPeriod > 0)
  687. SettingManager.Common.ListsPeriod = 15;
  688. }
  689. if (!Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.Timeline, SettingManager.Common.CountApi))
  690. SettingManager.Common.CountApi = 60;
  691. if (!Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.Reply, SettingManager.Common.CountApiReply))
  692. SettingManager.Common.CountApiReply = 40;
  693. if (SettingManager.Common.MoreCountApi != 0 && !Twitter.VerifyMoreApiResultCount(SettingManager.Common.MoreCountApi))
  694. SettingManager.Common.MoreCountApi = 200;
  695. if (SettingManager.Common.FirstCountApi != 0 && !Twitter.VerifyFirstApiResultCount(SettingManager.Common.FirstCountApi))
  696. SettingManager.Common.FirstCountApi = 100;
  697. if (SettingManager.Common.FavoritesCountApi != 0 && !Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.Favorites, SettingManager.Common.FavoritesCountApi))
  698. SettingManager.Common.FavoritesCountApi = 40;
  699. if (SettingManager.Common.ListCountApi != 0 && !Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.List, SettingManager.Common.ListCountApi))
  700. SettingManager.Common.ListCountApi = 100;
  701. if (SettingManager.Common.SearchCountApi != 0 && !Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.PublicSearch, SettingManager.Common.SearchCountApi))
  702. SettingManager.Common.SearchCountApi = 100;
  703. if (SettingManager.Common.UserTimelineCountApi != 0 && !Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.UserTimeline, SettingManager.Common.UserTimelineCountApi))
  704. SettingManager.Common.UserTimelineCountApi = 20;
  705. //廃止サービスが選択されていた場合ux.nuへ読み替え
  706. if (SettingManager.Common.AutoShortUrlFirst < 0)
  707. SettingManager.Common.AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;
  708. TwitterApiConnection.RestApiHost = SettingManager.Common.TwitterApiHost;
  709. this.tw = new Twitter(this.twitterApi);
  710. //認証関連
  711. if (MyCommon.IsNullOrEmpty(SettingManager.Common.Token)) SettingManager.Common.UserName = "";
  712. tw.Initialize(SettingManager.Common.Token, SettingManager.Common.TokenSecret, SettingManager.Common.UserName, SettingManager.Common.UserId);
  713. _initial = true;
  714. Networking.Initialize();
  715. var saveRequired = false;
  716. var firstRun = false;
  717. //ユーザー名、パスワードが未設定なら設定画面を表示(初回起動時など)
  718. if (MyCommon.IsNullOrEmpty(tw.Username))
  719. {
  720. saveRequired = true;
  721. firstRun = true;
  722. //設定せずにキャンセルされたか、設定されたが依然ユーザー名が未設定ならプログラム終了
  723. if (ShowSettingDialog(showTaskbarIcon: true) != DialogResult.OK ||
  724. MyCommon.IsNullOrEmpty(tw.Username))
  725. {
  726. Application.Exit(); //強制終了
  727. return;
  728. }
  729. }
  730. //Twitter用通信クラス初期化
  731. Networking.DefaultTimeout = TimeSpan.FromSeconds(SettingManager.Common.DefaultTimeOut);
  732. Networking.UploadImageTimeout = TimeSpan.FromSeconds(SettingManager.Common.UploadImageTimeout);
  733. Networking.SetWebProxy(SettingManager.Local.ProxyType,
  734. SettingManager.Local.ProxyAddress, SettingManager.Local.ProxyPort,
  735. SettingManager.Local.ProxyUser, SettingManager.Local.ProxyPassword);
  736. Networking.ForceIPv4 = SettingManager.Common.ForceIPv4;
  737. TwitterApiConnection.RestApiHost = SettingManager.Common.TwitterApiHost;
  738. tw.RestrictFavCheck = SettingManager.Common.RestrictFavCheck;
  739. tw.ReadOwnPost = SettingManager.Common.ReadOwnPost;
  740. tw.TrackWord = SettingManager.Common.TrackWord;
  741. TrackToolStripMenuItem.Checked = !MyCommon.IsNullOrEmpty(tw.TrackWord);
  742. tw.AllAtReply = SettingManager.Common.AllAtReply;
  743. AllrepliesToolStripMenuItem.Checked = tw.AllAtReply;
  744. ShortUrl.Instance.DisableExpanding = !SettingManager.Common.TinyUrlResolve;
  745. ShortUrl.Instance.BitlyAccessToken = SettingManager.Common.BitlyAccessToken;
  746. ShortUrl.Instance.BitlyId = SettingManager.Common.BilyUser;
  747. ShortUrl.Instance.BitlyKey = SettingManager.Common.BitlyPwd;
  748. // アクセストークンが有効であるか確認する
  749. // ここが Twitter API への最初のアクセスになるようにすること
  750. try
  751. {
  752. this.tw.VerifyCredentials();
  753. }
  754. catch (WebApiException ex)
  755. {
  756. MessageBox.Show(this, string.Format(Properties.Resources.StartupAuthError_Text, ex.Message),
  757. ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  758. }
  759. //サムネイル関連の初期化
  760. //プロキシ設定等の通信まわりの初期化が済んでから処理する
  761. ThumbnailGenerator.InitializeGenerator();
  762. var imgazyobizinet = ThumbnailGenerator.ImgAzyobuziNetInstance;
  763. imgazyobizinet.Enabled = SettingManager.Common.EnableImgAzyobuziNet;
  764. imgazyobizinet.DisabledInDM = SettingManager.Common.ImgAzyobuziNetDisabledInDM;
  765. Thumbnail.Services.TonTwitterCom.GetApiConnection = () => this.twitterApi.Connection;
  766. //画像投稿サービス
  767. ImageSelector.Initialize(tw, this.tw.Configuration, SettingManager.Common.UseImageServiceName, SettingManager.Common.UseImageService);
  768. //ハッシュタグ/@id関連
  769. AtIdSupl = new AtIdSupplement(SettingManager.AtIdList.AtIdList, "@");
  770. HashSupl = new AtIdSupplement(SettingManager.Common.HashTags, "#");
  771. HashMgr = new HashtagManage(HashSupl,
  772. SettingManager.Common.HashTags.ToArray(),
  773. SettingManager.Common.HashSelected,
  774. SettingManager.Common.HashIsPermanent,
  775. SettingManager.Common.HashIsHead,
  776. SettingManager.Common.HashIsNotAddToAtReply);
  777. if (!MyCommon.IsNullOrEmpty(HashMgr.UseHash) && HashMgr.IsPermanent) HashStripSplitButton.Text = HashMgr.UseHash;
  778. //アイコンリスト作成
  779. this.IconCache = new ImageCache();
  780. this.tweetDetailsView.IconCache = this.IconCache;
  781. //フォント&文字色&背景色保持
  782. _fntUnread = SettingManager.Local.FontUnread;
  783. _clUnread = SettingManager.Local.ColorUnread;
  784. _fntReaded = SettingManager.Local.FontRead;
  785. _clReaded = SettingManager.Local.ColorRead;
  786. _clFav = SettingManager.Local.ColorFav;
  787. _clOWL = SettingManager.Local.ColorOWL;
  788. _clRetweet = SettingManager.Local.ColorRetweet;
  789. _fntDetail = SettingManager.Local.FontDetail;
  790. _clDetail = SettingManager.Local.ColorDetail;
  791. _clDetailLink = SettingManager.Local.ColorDetailLink;
  792. _clDetailBackcolor = SettingManager.Local.ColorDetailBackcolor;
  793. _clSelf = SettingManager.Local.ColorSelf;
  794. _clAtSelf = SettingManager.Local.ColorAtSelf;
  795. _clTarget = SettingManager.Local.ColorTarget;
  796. _clAtTarget = SettingManager.Local.ColorAtTarget;
  797. _clAtFromTarget = SettingManager.Local.ColorAtFromTarget;
  798. _clAtTo = SettingManager.Local.ColorAtTo;
  799. _clListBackcolor = SettingManager.Local.ColorListBackcolor;
  800. _clInputBackcolor = SettingManager.Local.ColorInputBackcolor;
  801. _clInputFont = SettingManager.Local.ColorInputFont;
  802. _fntInputFont = SettingManager.Local.FontInputFont;
  803. _brsBackColorMine = new SolidBrush(_clSelf);
  804. _brsBackColorAt = new SolidBrush(_clAtSelf);
  805. _brsBackColorYou = new SolidBrush(_clTarget);
  806. _brsBackColorAtYou = new SolidBrush(_clAtTarget);
  807. _brsBackColorAtFromTarget = new SolidBrush(_clAtFromTarget);
  808. _brsBackColorAtTo = new SolidBrush(_clAtTo);
  809. _brsBackColorNone = new SolidBrush(_clListBackcolor);
  810. // StringFormatオブジェクトへの事前設定
  811. sfTab.Alignment = StringAlignment.Center;
  812. sfTab.LineAlignment = StringAlignment.Center;
  813. InitDetailHtmlFormat();
  814. this.recommendedStatusFooter = " [TWNv" + Regex.Replace(MyCommon.FileVersion.Replace(".", ""), "^0*", "") + "]";
  815. _history.Add(new StatusTextHistory());
  816. _hisIdx = 0;
  817. this.inReplyTo = null;
  818. //各種ダイアログ設定
  819. SearchDialog.Owner = this;
  820. UrlDialog.Owner = this;
  821. //新着バルーン通知のチェック状態設定
  822. NewPostPopMenuItem.Checked = SettingManager.Common.NewAllPop;
  823. this.NotifyFileMenuItem.Checked = NewPostPopMenuItem.Checked;
  824. //新着取得時のリストスクロールをするか。trueならスクロールしない
  825. ListLockMenuItem.Checked = SettingManager.Common.ListLock;
  826. this.LockListFileMenuItem.Checked = SettingManager.Common.ListLock;
  827. //サウンド再生(タブ別設定より優先)
  828. this.PlaySoundMenuItem.Checked = SettingManager.Common.PlaySound;
  829. this.PlaySoundFileMenuItem.Checked = SettingManager.Common.PlaySound;
  830. //ウィンドウ設定
  831. this.ClientSize = ScaleBy(configScaleFactor, SettingManager.Local.FormSize);
  832. _mySize = this.ClientSize; // サイズ保持(最小化・最大化されたまま終了した場合の対応用)
  833. _myLoc = SettingManager.Local.FormLocation;
  834. //タイトルバー領域
  835. if (this.WindowState != FormWindowState.Minimized)
  836. {
  837. var tbarRect = new Rectangle(this._myLoc, new Size(_mySize.Width, SystemInformation.CaptionHeight));
  838. var outOfScreen = true;
  839. if (Screen.AllScreens.Length == 1) //ハングするとの報告
  840. {
  841. foreach (var scr in Screen.AllScreens)
  842. {
  843. if (!Rectangle.Intersect(tbarRect, scr.Bounds).IsEmpty)
  844. {
  845. outOfScreen = false;
  846. break;
  847. }
  848. }
  849. if (outOfScreen)
  850. this._myLoc = new Point(0, 0);
  851. }
  852. this.DesktopLocation = this._myLoc;
  853. }
  854. this.TopMost = SettingManager.Common.AlwaysTop;
  855. _mySpDis = ScaleBy(configScaleFactor.Height, SettingManager.Local.SplitterDistance);
  856. _mySpDis2 = ScaleBy(configScaleFactor.Height, SettingManager.Local.StatusTextHeight);
  857. if (SettingManager.Local.PreviewDistance == -1)
  858. {
  859. _mySpDis3 = _mySize.Width - ScaleBy(this.CurrentScaleFactor.Width, 150);
  860. if (_mySpDis3 < 1) _mySpDis3 = ScaleBy(this.CurrentScaleFactor.Width, 50);
  861. SettingManager.Local.PreviewDistance = _mySpDis3;
  862. }
  863. else
  864. {
  865. _mySpDis3 = ScaleBy(configScaleFactor.Width, SettingManager.Local.PreviewDistance);
  866. }
  867. this.PlaySoundMenuItem.Checked = SettingManager.Common.PlaySound;
  868. this.PlaySoundFileMenuItem.Checked = SettingManager.Common.PlaySound;
  869. //入力欄
  870. StatusText.Font = _fntInputFont;
  871. StatusText.ForeColor = _clInputFont;
  872. // SplitContainer2.Panel2MinSize を一行表示の入力欄の高さに合わせる (MS UI Gothic 12pt (96dpi) の場合は 19px)
  873. this.StatusText.Multiline = false; // SettingManager.Local.StatusMultiline の設定は後で反映される
  874. this.SplitContainer2.Panel2MinSize = this.StatusText.Height;
  875. // 必要であれば、発言一覧と発言詳細部・入力欄の上下を入れ替える
  876. SplitContainer1.IsPanelInverted = !SettingManager.Common.StatusAreaAtBottom;
  877. //全新着通知のチェック状態により、Reply&DMの新着通知有効無効切り替え(タブ別設定にするため削除予定)
  878. if (SettingManager.Common.UnreadManage == false)
  879. {
  880. ReadedStripMenuItem.Enabled = false;
  881. UnreadStripMenuItem.Enabled = false;
  882. }
  883. //リンク先URL表示部の初期化(画面左下)
  884. StatusLabelUrl.Text = "";
  885. //状態表示部の初期化(画面右下)
  886. StatusLabel.Text = "";
  887. StatusLabel.AutoToolTip = false;
  888. StatusLabel.ToolTipText = "";
  889. //文字カウンタ初期化
  890. lblLen.Text = this.GetRestStatusCount(this.FormatStatusTextExtended("")).ToString();
  891. this.JumpReadOpMenuItem.ShortcutKeyDisplayString = "Space";
  892. CopySTOTMenuItem.ShortcutKeyDisplayString = "Ctrl+C";
  893. CopyURLMenuItem.ShortcutKeyDisplayString = "Ctrl+Shift+C";
  894. CopyUserIdStripMenuItem.ShortcutKeyDisplayString = "Shift+Alt+C";
  895. // SourceLinkLabel のテキストが SplitContainer2.Panel2.AccessibleName にセットされるのを防ぐ
  896. // (タブオーダー順で SourceLinkLabel の次にある PostBrowser が TabStop = false となっているため、
  897. // さらに次のコントロールである SplitContainer2.Panel2 の AccessibleName がデフォルトで SourceLinkLabel のテキストになってしまう)
  898. this.SplitContainer2.Panel2.AccessibleName = "";
  899. ////////////////////////////////////////////////////////////////////////////////
  900. var sortOrder = (SortOrder)SettingManager.Common.SortOrder;
  901. var mode = ComparerMode.Id;
  902. switch (SettingManager.Common.SortColumn)
  903. {
  904. case 0: //0:アイコン,5:未読マーク,6:プロテクト・フィルターマーク
  905. case 5:
  906. case 6:
  907. //ソートしない
  908. mode = ComparerMode.Id; //Idソートに読み替え
  909. break;
  910. case 1: //ニックネーム
  911. mode = ComparerMode.Nickname;
  912. break;
  913. case 2: //本文
  914. mode = ComparerMode.Data;
  915. break;
  916. case 3: //時刻=発言Id
  917. mode = ComparerMode.Id;
  918. break;

Large files files are truncated, but you can click here to view the full file