From ef1e221154d63b6c50f71b341de26d3c28c969c0 Mon Sep 17 00:00:00 2001 From: ggslyman Date: Fri, 21 Mar 2014 15:46:26 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=93=E3=83=A5=E3=83=BC=E3=82=A2=E3=81=AE?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=82=92=E9=96=89=E3=81=98=E3=81=A6=E3=82=82?= =?UTF-8?q?=E3=83=A1=E3=83=A2=E3=83=AA=E3=81=8C=E8=A7=A3=E6=94=BE=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=AA=E3=81=84=E4=B8=8D=E5=85=B7=E5=90=88=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit youtubeもビューアで開くように修正 --- README.md | 4 ++++ SpeechCast/FormMain.cs | 25 ++++++++++++++++++++----- SpeechCast/FormViewResource.cs | 20 ++++++++++++++++++-- SpeechCast/Properties/AssemblyInfo.cs | 4 ++-- 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ab0bbc4..d23d677 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,10 @@ ##更新履歴 +* 14/03/10 2.0.1 Rev.7 + - ビューアのタブを閉じてもメモリが解放されない不具合を修正 + - youtubeもビューアで開く様に変更 + * 14/03/10 2.0.1 Rev.6 - https、ttpsでもリンクをはる様に修正 - イメージビューアを仮実装 diff --git a/SpeechCast/FormMain.cs b/SpeechCast/FormMain.cs index d90985b..f81db3c 100644 --- a/SpeechCast/FormMain.cs +++ b/SpeechCast/FormMain.cs @@ -71,7 +71,6 @@ public FormMain() void webBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string url = e.Url.AbsoluteUri; - if (url.StartsWith(Response.AnchorUrl)) { e.Cancel = true; @@ -86,7 +85,13 @@ void webBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) else if (url.EndsWith("jpg") || url.EndsWith("png") || url.EndsWith("gif")) { e.Cancel = true; - oepnFormViewNewtab(url); + oepnFormViewNewtabImg(url); + } + else if (url.IndexOf("youtube.com/watch?v=")>0) + { + e.Cancel = true; + var id = url.Split('='); + oepnFormViewNewtabYoutube(id[1]); } else if (url.StartsWith("http:")) { @@ -2100,19 +2105,29 @@ private static string MatchKanaEvaluator(System.Text.RegularExpressions.Match m) private void toolStripButton19_Click(object sender, EventArgs e) { - oepnFormViewNewtab("http://peercasket.s3.amazonaws.com/2014s/title/d348fc17-c842-412f-bfe4-37af265905cd"); + oepnFormViewNewtabImg("http://peercasket.s3.amazonaws.com/2014s/title/d348fc17-c842-412f-bfe4-37af265905cd"); } // イメージビューア起動 public FormViewResource formViewResource = null; - private void oepnFormViewNewtab(string url) + private void oepnFormViewNewtabImg(string url) + { + if ((formViewResource == null) || formViewResource.IsDisposed) + { + formViewResource = new FormViewResource(UserConfig.FormViewToRect); + formViewResource.Show(); + } + formViewResource.addTabImg(url); + formViewResource.Activate(); + } + private void oepnFormViewNewtabYoutube(string id) { if ((formViewResource == null) || formViewResource.IsDisposed) { formViewResource = new FormViewResource(UserConfig.FormViewToRect); formViewResource.Show(); } - formViewResource.addTab(url); + formViewResource.addTabYoutube(id); formViewResource.Activate(); } // ビューア位置の保存 diff --git a/SpeechCast/FormViewResource.cs b/SpeechCast/FormViewResource.cs index 0606b6f..76514c4 100644 --- a/SpeechCast/FormViewResource.cs +++ b/SpeechCast/FormViewResource.cs @@ -17,7 +17,7 @@ public partial class FormViewResource : Form static public FormViewResource Instance; private ImageList imgList = new ImageList(); public Rectangle rect; - public FormViewResource(Rectangle loadRect) + public FormViewResource(Rectangle loadRect) { rect = loadRect; InitializeComponent(); @@ -35,7 +35,20 @@ private void FormViewResouce_Load(object sender, EventArgs e) this.Height = rect.Height; } - public void addTab(string url) + public void addTabYoutube(string id) + { + string widgetCode = ""; + // コンテンツ格納用のWebブラウザを作成 + WebBrowser wb = new WebBrowser(); + wb.Dock = DockStyle.Fill; + wb.DocumentText = "" + widgetCode + ""; + + // タブを追加 + TabPage tp = new TabPage(); + tp.Controls.Add(wb); + this.tabControlContainer.TabPages.Add(tp); + } + public void addTabImg(string url) { // コンテンツ格納用のWebブラウザを作成 WebBrowser wb = new WebBrowser(); @@ -65,7 +78,10 @@ private void tabControlContainer_MouseDown(object sender, MouseEventArgs e) //タブとマウス位置を比較し、クリックしたタブを選択 if (this.tabControlContainer.GetTabRect(i).Contains(e.X, e.Y)) { + TabPage rmPage = this.tabControlContainer.TabPages[i]; this.tabControlContainer.TabPages.Remove(this.tabControlContainer.TabPages[i]); + // タブを消しただけだとページがメモリ上に残るのでdisposeする + rmPage.Dispose(); // タブが無くなったらフォーム自体を閉じる if (this.tabControlContainer.TabCount == 0)this.Close(); break; diff --git a/SpeechCast/Properties/AssemblyInfo.cs b/SpeechCast/Properties/AssemblyInfo.cs index 409e708..51f9d80 100644 --- a/SpeechCast/Properties/AssemblyInfo.cs +++ b/SpeechCast/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.1.6")] -[assembly: AssemblyFileVersion("2.0.1.6")] +[assembly: AssemblyVersion("2.0.1.7")] +[assembly: AssemblyFileVersion("2.0.1.7")]