diff --git a/OpenTween/OpenTween.csproj b/OpenTween/OpenTween.csproj
index b0ec82a31..11053730d 100644
--- a/OpenTween/OpenTween.csproj
+++ b/OpenTween/OpenTween.csproj
@@ -198,6 +198,12 @@
TweetDetailsView.cs
+
+ Form
+
+
+ TweetThumbnailWindow.cs
+
Form
diff --git a/OpenTween/Setting/Panel/PreviewPanel.Designer.cs b/OpenTween/Setting/Panel/PreviewPanel.Designer.cs
index ca6e9f858..f3929a31e 100644
--- a/OpenTween/Setting/Panel/PreviewPanel.Designer.cs
+++ b/OpenTween/Setting/Panel/PreviewPanel.Designer.cs
@@ -33,6 +33,7 @@ private void InitializeComponent()
this.Label72 = new System.Windows.Forms.Label();
this.chkTabIconDisp = new System.Windows.Forms.CheckBox();
this.CheckPreviewEnable = new System.Windows.Forms.CheckBox();
+ this.CheckPreviewWindowEnable = new System.Windows.Forms.CheckBox();
this.Label81 = new System.Windows.Forms.Label();
this.LanguageCombo = new System.Windows.Forms.ComboBox();
this.Label13 = new System.Windows.Forms.Label();
@@ -72,6 +73,13 @@ private void InitializeComponent()
resources.ApplyResources(this.CheckPreviewEnable, "CheckPreviewEnable");
this.CheckPreviewEnable.Name = "CheckPreviewEnable";
this.CheckPreviewEnable.UseVisualStyleBackColor = true;
+ this.CheckPreviewEnable.CheckedChanged += new System.EventHandler(this.CheckPreviewEnable_CheckedChanged);
+ //
+ // CheckPreviewWindowEnable
+ //
+ resources.ApplyResources(this.CheckPreviewWindowEnable, "CheckPreviewWindowEnable");
+ this.CheckPreviewWindowEnable.Name = "CheckPreviewWindowEnable";
+ this.CheckPreviewWindowEnable.UseVisualStyleBackColor = true;
//
// Label81
//
@@ -155,6 +163,7 @@ private void InitializeComponent()
this.Controls.Add(this.Label72);
this.Controls.Add(this.chkTabIconDisp);
this.Controls.Add(this.CheckPreviewEnable);
+ this.Controls.Add(this.CheckPreviewWindowEnable);
this.Controls.Add(this.Label81);
this.Controls.Add(this.LanguageCombo);
this.Controls.Add(this.Label13);
@@ -176,6 +185,7 @@ private void InitializeComponent()
internal System.Windows.Forms.Label Label72;
internal System.Windows.Forms.CheckBox chkTabIconDisp;
internal System.Windows.Forms.CheckBox CheckPreviewEnable;
+ internal System.Windows.Forms.CheckBox CheckPreviewWindowEnable;
internal System.Windows.Forms.Label Label81;
internal System.Windows.Forms.ComboBox LanguageCombo;
internal System.Windows.Forms.Label Label13;
diff --git a/OpenTween/Setting/Panel/PreviewPanel.cs b/OpenTween/Setting/Panel/PreviewPanel.cs
index 416ed97ef..6e5b52f0c 100644
--- a/OpenTween/Setting/Panel/PreviewPanel.cs
+++ b/OpenTween/Setting/Panel/PreviewPanel.cs
@@ -62,6 +62,8 @@ public void LoadConfig(SettingCommon settingCommon)
this.chkTabIconDisp.Checked = settingCommon.TabIconDisp;
this.CheckMonospace.Checked = settingCommon.IsMonospace;
this.CheckPreviewEnable.Checked = settingCommon.PreviewEnable;
+ this.CheckPreviewWindowEnable.Enabled = this.CheckPreviewEnable.Checked;
+ this.CheckPreviewWindowEnable.Checked = settingCommon.PreviewWindowEnable;
this.CheckStatusAreaAtBottom.Checked = settingCommon.StatusAreaAtBottom;
this.ReplyIconStateCombo.SelectedIndex = settingCommon.ReplyIconState switch
{
@@ -99,6 +101,7 @@ public void SaveConfig(SettingCommon settingCommon)
settingCommon.TabIconDisp = this.chkTabIconDisp.Checked;
settingCommon.IsMonospace = this.CheckMonospace.Checked;
settingCommon.PreviewEnable = this.CheckPreviewEnable.Checked;
+ settingCommon.PreviewWindowEnable = this.CheckPreviewWindowEnable.Checked;
settingCommon.StatusAreaAtBottom = this.CheckStatusAreaAtBottom.Checked;
settingCommon.ReplyIconState = this.ReplyIconStateCombo.SelectedIndex switch
{
@@ -115,5 +118,10 @@ public void SaveConfig(SettingCommon settingCommon)
_ => "en",
};
}
+
+ private void CheckPreviewEnable_CheckedChanged(object sender, EventArgs e)
+ {
+ this.CheckPreviewWindowEnable.Enabled = this.CheckPreviewEnable.Checked;
+ }
}
}
diff --git a/OpenTween/Setting/Panel/PreviewPanel.en.resx b/OpenTween/Setting/Panel/PreviewPanel.en.resx
index a8233b161..cec919d6f 100644
--- a/OpenTween/Setting/Panel/PreviewPanel.en.resx
+++ b/OpenTween/Setting/Panel/PreviewPanel.en.resx
@@ -21,6 +21,9 @@
138, 16
Show image thumbnail
+ 138, 16
+ Open image thumbnail window on click
+
278, 16
Locate tweet detail and input area at the bottom
diff --git a/OpenTween/Setting/Panel/PreviewPanel.resx b/OpenTween/Setting/Panel/PreviewPanel.resx
index 024ba9f54..2623051eb 100644
--- a/OpenTween/Setting/Panel/PreviewPanel.resx
+++ b/OpenTween/Setting/Panel/PreviewPanel.resx
@@ -32,6 +32,10 @@
$this
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
3
+ CheckPreviewEnable
+ $this
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ 3
CheckStatusAreaAtBottom
$this
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
@@ -70,7 +74,7 @@
0
True
NoControl
- 23, 227
+ 23, 252
133, 16
32
常に最前面に表示する
@@ -88,7 +92,7 @@
タイトルバーとツールチップにユーザー名を表示
True
NoControl
- 23, 202
+ 23, 227
343, 16
31
発言詳細を等幅フォントで表示(AA対応、フォント適用不具合あり)
@@ -98,9 +102,15 @@
243, 16
29
画像リンクがあった場合にサムネイルを表示する
+ True
+ NoControl
+ 50, 180
+ 243, 16
+ 29
+ サムネイルクリック時に画像プレビューウインドウを表示する
True
NoControl
- 23, 177
+ 23, 202
257, 16
30
発言詳細部・入力欄を発言一覧の下に配置する
@@ -123,7 +133,7 @@
24
True
NoControl
- 23, 255
+ 23, 280
53, 12
33
Language
@@ -141,14 +151,14 @@
未読Mentions通知アイコン
True
NoControl
- 92, 255
+ 92, 280
115, 12
34
Apply after restarting
OS Default
Japanese
English
- 276, 252
+ 276, 277
136, 20
35
通知なし
diff --git a/OpenTween/Setting/SettingCommon.cs b/OpenTween/Setting/SettingCommon.cs
index 18114b648..b25dda56e 100644
--- a/OpenTween/Setting/SettingCommon.cs
+++ b/OpenTween/Setting/SettingCommon.cs
@@ -169,6 +169,7 @@ private string Decrypt(string password)
public bool HashIsHead = false;
public bool HashIsNotAddToAtReply = true;
public bool PreviewEnable = true;
+ public bool PreviewWindowEnable = true;
public bool StatusAreaAtBottom = true;
public MyCommon.UrlConverter AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;
diff --git a/OpenTween/TweetThumbnail.cs b/OpenTween/TweetThumbnail.cs
index 0a255367f..ba3772658 100644
--- a/OpenTween/TweetThumbnail.cs
+++ b/OpenTween/TweetThumbnail.cs
@@ -21,23 +21,19 @@
#nullable enable
+using OpenTween.Models;
+using OpenTween.Setting;
+using OpenTween.Thumbnail;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
-using System.Data;
using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Text;
-using System.Windows.Forms;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using OpenTween.Thumbnail;
-using System.Threading;
-using OpenTween.Models;
using System.Runtime.InteropServices;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
namespace OpenTween
{
@@ -50,6 +46,11 @@ public partial class TweetThumbnail : UserControl
public event EventHandler? ThumbnailDoubleClick;
public event EventHandler? ThumbnailImageSearchClick;
+ private TweetThumbnailWindow? _thumbWindow;
+ private TweetThumbnailWindow ThumbnailWindow
+ => _thumbWindow ??= CreateTweetThumbnailWindow();
+
+
public ThumbnailInfo Thumbnail
=> (ThumbnailInfo)this.pictureBox[this.scrollBar.Value].Tag;
@@ -142,6 +143,7 @@ protected void SetThumbnailCount(int count)
picbox.MouseWheel -= this.pictureBox_MouseWheel;
picbox.DoubleClick -= this.pictureBox_DoubleClick;
+ picbox.MouseClick -= this.pictureBox_MouseClick;
picbox.Dispose();
memoryImage?.Dispose();
@@ -160,6 +162,7 @@ protected void SetThumbnailCount(int count)
picbox.Visible = (i == 0);
picbox.MouseWheel += this.pictureBox_MouseWheel;
picbox.DoubleClick += this.pictureBox_DoubleClick;
+ picbox.MouseClick += this.pictureBox_MouseClick;
filter.Register(picbox);
@@ -231,6 +234,36 @@ private void pictureBox_MouseWheel(object sender, MouseEventArgs e)
this.ScrollDown();
}
+ private void pictureBox_MouseClick(object sender, MouseEventArgs e)
+ {
+ if (SettingManager.Common.PreviewWindowEnable
+ && sender is PictureBox picBox
+ && picBox.Tag is ThumbnailInfo thumb
+ && !thumb.IsPlayable)
+ {
+ this.ShowThubWindow(picBox.Image);
+ }
+ }
+
+ private void ShowThubWindow(Image image)
+ {
+ var thumbWindow = this.ThumbnailWindow;
+ if (thumbWindow.Image == image)
+ {
+ ThumbnailWindow.HideAndClear();
+ return;
+ }
+
+ thumbWindow.Image = image;
+ thumbWindow.Show();
+ }
+ private TweetThumbnailWindow CreateTweetThumbnailWindow()
+ {
+ var window = new TweetThumbnailWindow(this.ParentForm);
+ this.components.Add(window);
+ return window;
+ }
+
private void pictureBox_DoubleClick(object sender, EventArgs e)
{
if (((PictureBox)sender).Tag is ThumbnailInfo thumb)
diff --git a/OpenTween/TweetThumbnailWindow.Designer.cs b/OpenTween/TweetThumbnailWindow.Designer.cs
new file mode 100644
index 000000000..a4ee713a1
--- /dev/null
+++ b/OpenTween/TweetThumbnailWindow.Designer.cs
@@ -0,0 +1,73 @@
+namespace OpenTween
+{
+ partial class TweetThumbnailWindow
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBox1.Location = new System.Drawing.Point(0, 0);
+ this.pictureBox1.Margin = new System.Windows.Forms.Padding(0);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(284, 261);
+ this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
+ this.pictureBox1.TabIndex = 0;
+ this.pictureBox1.TabStop = false;
+ this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
+ this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
+ this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
+ //
+ // TweetThumbnailWindow
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSize = true;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.ClientSize = new System.Drawing.Size(284, 261);
+ this.Controls.Add(this.pictureBox1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+ this.Name = "TweetThumbnailWindow";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "TweetThumbnailWindow";
+ this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TweetThumbnailWindow_KeyPress);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PictureBox pictureBox1;
+ }
+}
\ No newline at end of file
diff --git a/OpenTween/TweetThumbnailWindow.cs b/OpenTween/TweetThumbnailWindow.cs
new file mode 100644
index 000000000..cdb088aef
--- /dev/null
+++ b/OpenTween/TweetThumbnailWindow.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+#nullable enable
+namespace OpenTween
+{
+ public partial class TweetThumbnailWindow : Form
+ {
+ private Point mouseDownPoint;
+ private bool _moved;
+
+ public Image? Image
+ {
+ set => pictureBox1.Image = value;
+ get => pictureBox1.Image;
+ }
+
+ public TweetThumbnailWindow(Form tweenMain)
+ {
+ InitializeComponent();
+ tweenMain.Activated += TweenMain_Activated;
+ }
+
+ public void HideAndClear()
+ {
+ this.Hide();
+ Image = null;
+ }
+
+ private void TweetThumbnailWindow_KeyPress(object sender, KeyPressEventArgs e)
+ {
+ this.HideAndClear();
+ }
+
+ private void TweenMain_Activated(object sender, EventArgs e)
+ {
+ /// で確認できるように Image を残しておく
+ this.Hide();
+ }
+
+ private void pictureBox1_Click(object sender, EventArgs e)
+ {
+ if (!_moved) this.HideAndClear();
+ }
+
+ private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
+ {
+ if (e.Button.HasFlag(MouseButtons.Left))
+ {
+ _moved = false;
+ mouseDownPoint = e.Location;
+ }
+ }
+
+ private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (e.Button.HasFlag(MouseButtons.Left))
+ {
+ _moved = true;
+ this.Location = new Point(this.Location.X + e.X - mouseDownPoint.X, this.Location.Y + e.Y - mouseDownPoint.Y);
+ }
+ }
+ }
+}