From: Kimura Youichi Date: Fri, 13 Oct 2017 21:50:01 +0000 (+0900) Subject: TweetThumbnailのコンテキストメニューに「開く」「URLをコピー」を追加 X-Git-Tag: OpenTween_v1.4.0~8 X-Git-Url: http://git.osdn.net/view?p=opentween%2Fopen-tween.git;a=commitdiff_plain;h=226b7e8ed733c5ec5be9d088aaa4ddf2cbf20b05 TweetThumbnailのコンテキストメニューに「開く」「URLをコピー」を追加 --- diff --git a/OpenTween/Resources/ChangeLog.txt b/OpenTween/Resources/ChangeLog.txt index 09fd60bf..3b4b46c9 100644 --- a/OpenTween/Resources/ChangeLog.txt +++ b/OpenTween/Resources/ChangeLog.txt @@ -1,6 +1,7 @@ 更新履歴 ==== Ver 1.4.0-dev(2017/xx/xx) + * NEW: サムネイル画像のコンテキストメニューに「開く」「URLをコピー」を追加 * CHG: 自分宛のメンションを含むツイートがRTされた場合に、リプライとして扱わずReplyタブにも表示しないように変更 (thx @7mencho!) * FIX: 起動時に復元したウィンドウ位置が画面領域外であった場合に、強制的にウィンドウを移動する動作が機能しない不具合を修正 * FIX: TweetDeckから投稿されたツイートをFav追加・削除した場合にエラーが発生する問題を回避 (thx @Lolitapple!) diff --git a/OpenTween/TweetThumbnail.Designer.cs b/OpenTween/TweetThumbnail.Designer.cs index 2cb47cda..6e49c47c 100644 --- a/OpenTween/TweetThumbnail.Designer.cs +++ b/OpenTween/TweetThumbnail.Designer.cs @@ -34,6 +34,9 @@ this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.panelPictureBox = new System.Windows.Forms.Panel(); this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.openMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.copyUrlMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.searchImageGoogleMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.searchImageSauceNaoMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip.SuspendLayout(); @@ -58,12 +61,32 @@ // resources.ApplyResources(this.contextMenuStrip, "contextMenuStrip"); this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openMenuItem, + this.copyUrlMenuItem, + this.toolStripSeparator1, this.searchImageGoogleMenuItem, this.searchImageSauceNaoMenuItem}); this.contextMenuStrip.Name = "contextMenuStrip"; this.toolTip.SetToolTip(this.contextMenuStrip, resources.GetString("contextMenuStrip.ToolTip")); this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Opening); // + // openMenuItem + // + resources.ApplyResources(this.openMenuItem, "openMenuItem"); + this.openMenuItem.Name = "openMenuItem"; + this.openMenuItem.Click += new System.EventHandler(this.openMenuItem_Click); + // + // copyUrlMenuItem + // + resources.ApplyResources(this.copyUrlMenuItem, "copyUrlMenuItem"); + this.copyUrlMenuItem.Name = "copyUrlMenuItem"; + this.copyUrlMenuItem.Click += new System.EventHandler(this.copyUrlMenuItem_Click); + // + // toolStripSeparator1 + // + resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1"); + this.toolStripSeparator1.Name = "toolStripSeparator1"; + // // searchImageGoogleMenuItem // resources.ApplyResources(this.searchImageGoogleMenuItem, "searchImageGoogleMenuItem"); @@ -97,5 +120,8 @@ private System.Windows.Forms.ContextMenuStrip contextMenuStrip; private System.Windows.Forms.ToolStripMenuItem searchImageGoogleMenuItem; private System.Windows.Forms.ToolStripMenuItem searchImageSauceNaoMenuItem; + private System.Windows.Forms.ToolStripMenuItem openMenuItem; + private System.Windows.Forms.ToolStripMenuItem copyUrlMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; } } diff --git a/OpenTween/TweetThumbnail.cs b/OpenTween/TweetThumbnail.cs index 3c62a8ef..86494db0 100644 --- a/OpenTween/TweetThumbnail.cs +++ b/OpenTween/TweetThumbnail.cs @@ -35,6 +35,7 @@ using System.Threading.Tasks; using OpenTween.Thumbnail; using System.Threading; using OpenTween.Models; +using System.Runtime.InteropServices; namespace OpenTween { @@ -191,6 +192,9 @@ namespace OpenTween }; } + public void OpenImage(ThumbnailInfo thumb) + => this.ThumbnailDoubleClick?.Invoke(this, new ThumbnailDoubleClickEventArgs(thumb)); + public void ScrollUp() { var newval = this.scrollBar.Value - this.scrollBar.SmallChange; @@ -243,7 +247,7 @@ namespace OpenTween if (thumb == null) return; - this.ThumbnailDoubleClick?.Invoke(this, new ThumbnailDoubleClickEventArgs(thumb)); + this.OpenImage(thumb); } private void contextMenuStrip_Opening(object sender, CancelEventArgs e) @@ -281,6 +285,21 @@ namespace OpenTween this.ThumbnailImageSearchClick?.Invoke(this, new ThumbnailImageSearchEventArgs(searchUri)); } + + private void openMenuItem_Click(object sender, EventArgs e) + => this.OpenImage(this.Thumbnail); + + private void copyUrlMenuItem_Click(object sender, EventArgs e) + { + try + { + Clipboard.SetText(this.Thumbnail.FullSizeImageUrl); + } + catch (ExternalException ex) + { + MessageBox.Show(ex.Message); + } + } } public class ThumbnailDoubleClickEventArgs : EventArgs diff --git a/OpenTween/TweetThumbnail.en.resx b/OpenTween/TweetThumbnail.en.resx index ee9003da..fb5c2f2b 100644 --- a/OpenTween/TweetThumbnail.en.resx +++ b/OpenTween/TweetThumbnail.en.resx @@ -124,6 +124,21 @@ + + 254, 22 + + + &Open + + + 254, 22 + + + &Copy URL + + + 251, 6 + 254, 22 @@ -137,7 +152,7 @@ Search similar images (SauceNAO) - 255, 48 + 255, 98 diff --git a/OpenTween/TweetThumbnail.resx b/OpenTween/TweetThumbnail.resx index 81fd0401..de80de33 100644 --- a/OpenTween/TweetThumbnail.resx +++ b/OpenTween/TweetThumbnail.resx @@ -130,21 +130,26 @@ panelPictureBox + + searchImageGoogleMenuItem + $this + + 223, 22 + + + 220, 6 + 類似画像を検索 (SauceNAO) - - 類似画像を検索 (Google) + + toolStripSeparator1 - - System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - 0 + + 223, 22 TweetThumbnail @@ -155,6 +160,9 @@ System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 類似画像を検索 (Google) + @@ -164,12 +172,19 @@ contextMenuStrip + + + 0 + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 143, 150 + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + searchImageSauceNaoMenuItem @@ -180,6 +195,9 @@ Fill + + openMenuItem + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -192,6 +210,9 @@ $this + + System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + @@ -204,20 +225,32 @@ 0, 0 + + 開く(&O) + + + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + copyUrlMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + URLをコピー(&C) + - 224, 48 + 224, 98 143, 0 - - 223, 22 - Right - - searchImageGoogleMenuItem + + 223, 22 System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089