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")]