From b399d56f435f60feae6c285613bba9d9b0cf710f Mon Sep 17 00:00:00 2001 From: ggslyman Date: Fri, 21 Mar 2014 14:01:06 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A4=E3=83=A1=E3=83=BC=E3=82=B8=E3=83=93?= =?UTF-8?q?=E3=83=A5=E3=83=BC=E3=82=A2=E4=BB=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 + SpeechCast/Controls/TabPageImg.Designer.cs | 52 ----------- SpeechCast/Controls/TabPageImg.cs | 25 ------ SpeechCast/FormCaption.cs | 8 +- SpeechCast/FormMain.Designer.cs | 15 +++- SpeechCast/FormMain.cs | 36 +++++++- SpeechCast/FormMain.resx | 15 ++++ SpeechCast/FormViewResource.Designer.cs | 63 +++++++++++++ SpeechCast/FormViewResource.cs | 88 +++++++++++++++++++ .../TabPageImg.resx => FormViewResource.resx} | 6 -- SpeechCast/Properties/AssemblyInfo.cs | 4 +- SpeechCast/Response.cs | 2 +- SpeechCast/SpeechCast.csproj | 14 +-- SpeechCast/UseConfig.cs | 5 ++ 14 files changed, 237 insertions(+), 100 deletions(-) delete mode 100644 SpeechCast/Controls/TabPageImg.Designer.cs delete mode 100644 SpeechCast/Controls/TabPageImg.cs create mode 100644 SpeechCast/FormViewResource.Designer.cs create mode 100644 SpeechCast/FormViewResource.cs rename SpeechCast/{Controls/TabPageImg.resx => FormViewResource.resx} (93%) diff --git a/README.md b/README.md index f596c52..ab0bbc4 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,10 @@ ##更新履歴 +* 14/03/10 2.0.1 Rev.6 + - https、ttpsでもリンクをはる様に修正 + - イメージビューアを仮実装 + * 14/03/10 2.0.1 Rev.5 - レス新着音の鳴るタイミングが新規レス取得時になっていたのをレス読み上げ前に修正 diff --git a/SpeechCast/Controls/TabPageImg.Designer.cs b/SpeechCast/Controls/TabPageImg.Designer.cs deleted file mode 100644 index e1b43b7..0000000 --- a/SpeechCast/Controls/TabPageImg.Designer.cs +++ /dev/null @@ -1,52 +0,0 @@ -namespace SpeechCast.Controls -{ - partial class TabPageImg - { - /// - /// 必要なデザイナー変数です。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 使用中のリソースをすべてクリーンアップします。 - /// - /// マネージ リソースが破棄される場合 true、破棄されない場合は false です。 - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region コンポーネント デザイナーで生成されたコード - - /// - /// デザイナー サポートに必要なメソッドです。このメソッドの内容を - /// コード エディターで変更しないでください。 - /// - private void InitializeComponent() - { - this.pictureBoxImg = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxImg)).BeginInit(); - this.SuspendLayout(); - // - // pictureBoxImg - // - this.pictureBoxImg.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBoxImg.Location = new System.Drawing.Point(0, 0); - this.pictureBoxImg.Name = "pictureBoxImg"; - this.pictureBoxImg.Size = new System.Drawing.Size(100, 50); - this.pictureBoxImg.TabIndex = 0; - this.pictureBoxImg.TabStop = false; - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxImg)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBoxImg; - } -} diff --git a/SpeechCast/Controls/TabPageImg.cs b/SpeechCast/Controls/TabPageImg.cs deleted file mode 100644 index cd1a5a1..0000000 --- a/SpeechCast/Controls/TabPageImg.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace SpeechCast.Controls -{ - public partial class TabPageImg : TabPage - { - public TabPageImg() - { - InitializeComponent(); - } - - protected override void OnPaint(PaintEventArgs pe) - { - base.OnPaint(pe); - } - } -} diff --git a/SpeechCast/FormCaption.cs b/SpeechCast/FormCaption.cs index a968a2d..d915ada 100644 --- a/SpeechCast/FormCaption.cs +++ b/SpeechCast/FormCaption.cs @@ -203,12 +203,12 @@ public static void DrawCaption(Graphics g, Rectangle captionRect, string caption System.Drawing.Font font = captionFont.CreateFont(); StringFormat stringFormat = new StringFormat(); - + //TextFormatFlags txtFormatFlags = new TextFormatFlags(); + //txtFormatFlags = TextFormatFlags.Top | TextFormatFlags.Left; if (captionFont.IsDirectionVertical) { stringFormat.FormatFlags = StringFormatFlags.DirectionVertical | StringFormatFlags.DirectionRightToLeft; } - List offsets = new List(); for (int i = 0; i < captionFont.BorderSize; i++) @@ -229,20 +229,24 @@ public static void DrawCaption(Graphics g, Rectangle captionRect, string caption if (isAAMode) { + //TextRenderer.DrawText(g, captionText, font, borderRect, FormMain.UserConfig.AACaptionFont.Colors.BorderColor, txtFormatFlags); g.DrawString(captionText, font, captionFont.BorderBrush, borderRect.X, borderRect.Y); } else { + //TextRenderer.DrawText(g, captionText, font, borderRect, FormMain.UserConfig.CaptionFont.Colors.BorderColor, txtFormatFlags); g.DrawString(captionText, font, captionFont.BorderBrush, borderRect, stringFormat); } } if (isAAMode) { + //TextRenderer.DrawText(g, captionText, font, captionRect, FormMain.UserConfig.AACaptionFont.Colors.HighForeColor, txtFormatFlags); g.DrawString(captionText, font, captionFont.GetForeBrush(captionRect), captionRect.X, captionRect.Y); } else { + //TextRenderer.DrawText(g, captionText, font, captionRect, FormMain.UserConfig.CaptionFont.Colors.HighForeColor, txtFormatFlags); g.DrawString(captionText, font, captionFont.GetForeBrush(captionRect), captionRect, stringFormat); } } diff --git a/SpeechCast/FormMain.Designer.cs b/SpeechCast/FormMain.Designer.cs index e39c7a1..a688818 100644 --- a/SpeechCast/FormMain.Designer.cs +++ b/SpeechCast/FormMain.Designer.cs @@ -136,6 +136,7 @@ private void InitializeComponent() this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripButton17 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton18 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton19 = new System.Windows.Forms.ToolStripButton(); this.statusStrip1.SuspendLayout(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -497,7 +498,8 @@ private void InitializeComponent() this.toolStripButtonBorder, this.toolStripButtonSettings, this.toolStripButtonCaptionAutoSmall, - this.toolStripSeparator4}); + this.toolStripSeparator4, + this.toolStripButton19}); this.myToolStripVoice.Location = new System.Drawing.Point(0, 26); this.myToolStripVoice.Name = "myToolStripVoice"; this.myToolStripVoice.Size = new System.Drawing.Size(949, 26); @@ -1191,6 +1193,16 @@ private void InitializeComponent() this.toolStripButton18.Size = new System.Drawing.Size(23, 23); this.toolStripButton18.Text = "toolStripButtonAutoNextThread"; // + // toolStripButton19 + // + this.toolStripButton19.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton19.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton19.Image"))); + this.toolStripButton19.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton19.Name = "toolStripButton19"; + this.toolStripButton19.Size = new System.Drawing.Size(23, 23); + this.toolStripButton19.Text = "toolStripButton19"; + this.toolStripButton19.Click += new System.EventHandler(this.toolStripButton19_Click); + // // FormMain // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -1351,6 +1363,7 @@ private void InitializeComponent() private System.Windows.Forms.TextBox textBoxDefaultCaption; public System.Windows.Forms.ToolStripButton toolStripButtonShowCaptionImmediately; public System.Windows.Forms.ToolStripButton toolStripButtonPlaySoundNewResponse; + private System.Windows.Forms.ToolStripButton toolStripButton19; } } diff --git a/SpeechCast/FormMain.cs b/SpeechCast/FormMain.cs index 0563ea5..d90985b 100644 --- a/SpeechCast/FormMain.cs +++ b/SpeechCast/FormMain.cs @@ -83,6 +83,11 @@ void webBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) webBrowser.Document.Window.ScrollTo(0, GetResponsesScrollY(resNo)); } } + else if (url.EndsWith("jpg") || url.EndsWith("png") || url.EndsWith("gif")) + { + e.Cancel = true; + oepnFormViewNewtab(url); + } else if (url.StartsWith("http:")) { System.Diagnostics.Process.Start(url); @@ -912,8 +917,6 @@ private void StartSpeaking(int resNumber) private void StartSpeaking() { speakClipboard = false; - isSpeaking = true; - if (CurrentResNumber <= 0) { @@ -937,6 +940,7 @@ private void StartSpeaking() } isSpeakingWarningMessage = false; + isSpeaking = true; StartSpeaking(text); listViewResponses.Items[CurrentResNumber - 1].Selected = true; webBrowser.Document.Window.ScrollTo(0, GetResponsesScrollY(CurrentResNumber)); @@ -950,6 +954,7 @@ private void StartSpeaking() isSpeakingWarningMessage = true; FormCaption.Instance.IsAAMode = false; synthesizer.Rate = UserConfig.SpeakingRate; + isSpeaking = true; synthesizer.SpeakAsync(speakingText); } else if (CurrentResNumber > Response.MaxResponseCount && openNextThread == ReadThread) @@ -960,11 +965,12 @@ private void StartSpeaking() isSpeakingWarningMessage = true; FormCaption.Instance.IsAAMode = false; synthesizer.Rate = UserConfig.SpeakingRate; + isSpeaking = true; synthesizer.SpeakAsync(speakingText); } else { - speakingCompletedTime = System.DateTime.Now; + if(isSpeaking)speakingCompletedTime = System.DateTime.Now; isSpeaking = false; } } @@ -2091,6 +2097,28 @@ private static string MatchKanaEvaluator(System.Text.RegularExpressions.Match m) { return Microsoft.VisualBasic.Strings.StrConv(m.Value, Microsoft.VisualBasic.VbStrConv.Wide, 0); } - } + private void toolStripButton19_Click(object sender, EventArgs e) + { + oepnFormViewNewtab("http://peercasket.s3.amazonaws.com/2014s/title/d348fc17-c842-412f-bfe4-37af265905cd"); + } + + // イメージビューア起動 + public FormViewResource formViewResource = null; + private void oepnFormViewNewtab(string url) + { + if ((formViewResource == null) || formViewResource.IsDisposed) + { + formViewResource = new FormViewResource(UserConfig.FormViewToRect); + formViewResource.Show(); + } + formViewResource.addTab(url); + formViewResource.Activate(); + } + // ビューア位置の保存 + public void saveViewerPos(FormViewResource frm) + { + UserConfig.SetFormToRect(ref UserConfig.FormViewToRect, frm); + } + } } diff --git a/SpeechCast/FormMain.resx b/SpeechCast/FormMain.resx index 2011c7a..a3f8574 100644 --- a/SpeechCast/FormMain.resx +++ b/SpeechCast/FormMain.resx @@ -410,6 +410,21 @@ jMTxYRvTjOk+2jqSAKiHQ1yAIOEQBwBVNEg4xAH4db3zEncKgkFIFmEQCAkArA7hAqCKcq53ahA2gNlq 3DumCoQBcPc5B6Lve3z9BIC7Q+YJAo8hPIqOtp+apnk8ZK4g1MIhlPJ381Y2hGq4RIDAM/AcHkUvkW8v aUqIfs4AAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== diff --git a/SpeechCast/FormViewResource.Designer.cs b/SpeechCast/FormViewResource.Designer.cs new file mode 100644 index 0000000..6a304cf --- /dev/null +++ b/SpeechCast/FormViewResource.Designer.cs @@ -0,0 +1,63 @@ +namespace SpeechCast +{ + partial class FormViewResource + { + /// + /// 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.tabControlContainer = new System.Windows.Forms.TabControl(); + this.SuspendLayout(); + // + // tabControlContainer + // + this.tabControlContainer.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControlContainer.Location = new System.Drawing.Point(0, 0); + this.tabControlContainer.Name = "tabControlContainer"; + this.tabControlContainer.SelectedIndex = 0; + this.tabControlContainer.Size = new System.Drawing.Size(284, 262); + this.tabControlContainer.TabIndex = 0; + this.tabControlContainer.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControlContainer_MouseDown); + // + // FormViewResource + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 262); + this.Controls.Add(this.tabControlContainer); + this.Name = "FormViewResource"; + this.Text = "ビューア"; + this.Load += new System.EventHandler(this.FormViewResouce_Load); + this.Move += new System.EventHandler(this.FormViewResource_Move); + this.Resize += new System.EventHandler(this.FormViewResource_Resize); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControlContainer; + } +} \ No newline at end of file diff --git a/SpeechCast/FormViewResource.cs b/SpeechCast/FormViewResource.cs new file mode 100644 index 0000000..0606b6f --- /dev/null +++ b/SpeechCast/FormViewResource.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Net; +using System.IO; + +namespace SpeechCast +{ + public partial class FormViewResource : Form + { + static public FormViewResource Instance; + private ImageList imgList = new ImageList(); + public Rectangle rect; + public FormViewResource(Rectangle loadRect) + { + rect = loadRect; + InitializeComponent(); + Instance = this; + this.tabControlContainer.ImageList = imgList; + Size thumbSize = new Size(32, 32); + this.tabControlContainer.ImageList.ImageSize = thumbSize; + } + + private void FormViewResouce_Load(object sender, EventArgs e) + { + this.Top = rect.Top; + this.Left = rect.Left; + this.Width = rect.Width; + this.Height = rect.Height; + } + + public void addTab(string url) + { + // コンテンツ格納用のWebブラウザを作成 + WebBrowser wb = new WebBrowser(); + wb.Url = new Uri(url); + wb.Dock = DockStyle.Fill; + // タブに表示するアイコン用画像ストリーム取得 + WebClient wc = new WebClient(); + Stream stream = wc.OpenRead(url); + Bitmap bmp = new Bitmap(stream); + imgList.Images.Add(url,bmp); + + // タブを追加 + TabPage tp = new TabPage(); + tp.Controls.Add(wb); + tp.ImageIndex = imgList.Images.IndexOfKey(url); + this.tabControlContainer.TabPages.Add(tp); + } + + // タブクリック処理 + private void tabControlContainer_MouseDown(object sender, MouseEventArgs e) + { +// if (e.Button == MouseButtons.Right || e.Button == MouseButtons.Middle) + if (e.Button == MouseButtons.Middle) + { + for (int i = 0; i < this.tabControlContainer.TabCount; i++) + { + //タブとマウス位置を比較し、クリックしたタブを選択 + if (this.tabControlContainer.GetTabRect(i).Contains(e.X, e.Y)) + { + this.tabControlContainer.TabPages.Remove(this.tabControlContainer.TabPages[i]); + // タブが無くなったらフォーム自体を閉じる + if (this.tabControlContainer.TabCount == 0)this.Close(); + break; + } + } + } + } + + // ウィンドウ位置の保存 + private void FormViewResource_Move(object sender, EventArgs e) + { + FormMain.Instance.saveViewerPos(this); + } + private void FormViewResource_Resize(object sender, EventArgs e) + { + FormMain.Instance.saveViewerPos(this); + } + + } +} diff --git a/SpeechCast/Controls/TabPageImg.resx b/SpeechCast/FormViewResource.resx similarity index 93% rename from SpeechCast/Controls/TabPageImg.resx rename to SpeechCast/FormViewResource.resx index dcea23d..1af7de1 100644 --- a/SpeechCast/Controls/TabPageImg.resx +++ b/SpeechCast/FormViewResource.resx @@ -117,10 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - - - False - \ No newline at end of file diff --git a/SpeechCast/Properties/AssemblyInfo.cs b/SpeechCast/Properties/AssemblyInfo.cs index 77a0d8e..409e708 100644 --- a/SpeechCast/Properties/AssemblyInfo.cs +++ b/SpeechCast/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.1.5")] -[assembly: AssemblyFileVersion("2.0.1.5")] +[assembly: AssemblyVersion("2.0.1.6")] +[assembly: AssemblyFileVersion("2.0.1.6")] diff --git a/SpeechCast/Response.cs b/SpeechCast/Response.cs index 5041678..8041e76 100644 --- a/SpeechCast/Response.cs +++ b/SpeechCast/Response.cs @@ -276,7 +276,7 @@ private static string ReplaceGroupAddLink(Match m) StringBuilder sb = new StringBuilder(); sb.Append(""); //sb.Append("\" target=\"_blank\">"); sb.Append(m.Groups[0].Value); diff --git a/SpeechCast/SpeechCast.csproj b/SpeechCast/SpeechCast.csproj index 7d26ea4..48e8fe7 100644 --- a/SpeechCast/SpeechCast.csproj +++ b/SpeechCast/SpeechCast.csproj @@ -148,14 +148,14 @@ Component - + Component - - TabPageImg.cs + + Form - - Component + + FormViewResource.cs Form @@ -228,8 +228,8 @@ FormWaitForEdit.cs Designer - - TabPageImg.cs + + FormViewResource.cs FormAbout.cs diff --git a/SpeechCast/UseConfig.cs b/SpeechCast/UseConfig.cs index 939196a..0c07633 100644 --- a/SpeechCast/UseConfig.cs +++ b/SpeechCast/UseConfig.cs @@ -118,6 +118,11 @@ public void SupplementSettings() /// public Rectangle FormCaptionRect; + /// + /// イメージビューアのウィンドウ位置 + /// + public Rectangle FormViewToRect; + /// /// 読み上げONOFF ///