Skip to content

Commit

Permalink
レス表示領域の表示倍率を指定+保存できるように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
ggslyman committed Apr 20, 2014
1 parent 0435149 commit 8f97b75
Show file tree
Hide file tree
Showing 8 changed files with 302 additions and 169 deletions.
264 changes: 163 additions & 101 deletions SpeechCast/FormMain.Designer.cs

Large diffs are not rendered by default.

42 changes: 28 additions & 14 deletions SpeechCast/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ private bool CheckBaseURL()
#if DEBUG
string debugDatFileName = null;
#endif
// 元ソースより非同期に変更
private int oldResCount = 0;
private string oldUrl = "";
// 元ソースより非同期に変更
private async Task<bool> GetFromURL(bool next)
{

Expand Down Expand Up @@ -722,6 +722,8 @@ await Task.Run(() =>
Object[] objArray = new Object[1];
objArray[0] = responses[idx].Html;
webBrowser.Document.InvokeScript("addRes", objArray);
objArray[0] = UserConfig.magnification;
webBrowser.Document.InvokeScript("setZoom", objArray);
}
}
}
Expand Down Expand Up @@ -1887,33 +1889,29 @@ private void toolStripButtonPlaySoundNewResponse_Click(object sender, EventArgs

private void toolStripStatusLabelCommunication_Click(object sender, EventArgs e)
{
if (this.splitContainerResCaption.Panel2.Height > 0)
{
this.splitContainerResCaption.SplitterDistance = 2000;
this.splitContainerResCaption.IsSplitterFixed = true;
this.webBrowser.Focus();
}
else
{
this.splitContainerResCaption.SplitterDistance = this.splitContainerResCaption.Height - 130;
this.splitContainerResCaption.IsSplitterFixed = false;
}
this.openResCaptionForm();
}
private void toolStripStatusLabelDefaultCaptionButton_Click(object sender, EventArgs e)
{
this.openResCaptionForm();
}

private void openResCaptionForm()
{
if (this.splitContainerResCaption.Panel2.Height > 0)
{
this.splitContainerResCaption.SplitterDistance = 2000;
int resCaptionFormHeight = this.splitContainerResCaption.SplitterDistance;
this.splitContainerResCaption.SplitterDistance = 4000;
this.splitContainerResCaption.IsSplitterFixed = true;
this.webBrowser.Focus();
}
else
{
this.splitContainerResCaption.SplitterDistance = this.splitContainerResCaption.Height - 130;
this.splitContainerResCaption.IsSplitterFixed = false;
webBrowser.Document.Window.ScrollTo(0, (webBrowser.Document.Body.ScrollTop + this.splitContainerResCaption.Panel2.Height));
}
}

private void toolStripButtonCaptionAutoSmall_Click(object sender, EventArgs e)
{
UserConfig.CaptionAutoSmall = this.toolStripButtonCaptionAutoSmall.Checked;
Expand Down Expand Up @@ -2250,5 +2248,21 @@ private void viewResList(bool visibleFlag)
}

}

private void toolStripButtonZoomOutnResView_Click(object sender, EventArgs e)
{
Object[] objArray = new Object[1];
UserConfig.magnification = UserConfig.magnification - 0.1;
objArray[0] = UserConfig.magnification;
webBrowser.Document.InvokeScript("setZoom", objArray);
}

private void toolStripButtonZoomInnResView_Click(object sender, EventArgs e)
{
Object[] objArray = new Object[1];
UserConfig.magnification = UserConfig.magnification + 0.1;
objArray[0] = UserConfig.magnification;
webBrowser.Document.InvokeScript("setZoom", objArray);
}
}
}
123 changes: 83 additions & 40 deletions SpeechCast/FormMain.resx

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions SpeechCast/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.1.17")]
[assembly: AssemblyFileVersion("2.0.1.17")]
[assembly: AssemblyVersion("2.0.1.18")]
[assembly: AssemblyFileVersion("2.0.1.18")]
33 changes: 21 additions & 12 deletions SpeechCast/Resources/resView.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
<html>
<body>
<script type="text/javascript">
function addRes(res) {
var element = document.createElement('div');
element.innerHTML = res;
var objResArea = document.getElementById("resArea");;
objResArea.appendChild(element);
}
function clearRes() {
var objResArea = document.getElementById("resArea");
objResArea.innerHTML = "";
}
</script>
<div id="resArea">
function addRes(res) {
var element = document.createElement('div');
element.innerHTML = res;
var objResArea = document.getElementById("resArea");;
objResArea.appendChild(element);
}
function clearRes() {
var objResArea = document.getElementById("resArea");
objResArea.innerHTML = "";
}
function setZoom(magnification){
var objResArea = document.getElementById("resArea");

if ('zoom' in objResArea.style) {
objResArea.style.zoom = magnification;
} else {
alert ("Your browser doesn't support this example!");
}
}
</script>
<div id="resArea" style="zoom:100%">
</div>
</body>
</html>
Binary file added SpeechCast/Resources/zoom-in.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SpeechCast/Resources/zoom-out.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions SpeechCast/UseConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ public void SupplementSettings()
/// </summary>
public bool AutoOpenNextThread = false;

/// <summary>
/// レス表示領域の表示倍率
/// </summary>
public double magnification = 1.0;

/// <summary>
/// 文字数制限
/// </summary>
Expand Down

0 comments on commit 8f97b75

Please sign in to comment.