Skip to content

Commit

Permalink
・各オーバーレイの HTML 内で onOverlayDataUpdate イベントを発行することにより、イベントドリブンな動作を可能にした
Browse files Browse the repository at this point in the history
・ログビューを ListView に切り替え、警告やエラーは色付きで表示するようにした
・ログビューのコンテキストメニューに「すべてのログをコピー」「常に最新のログを追跡」「ログをクリア」を追加した
・CEF から出力されるコンソールメッセージをログに表示するようにした
・ミニパースオーバーレイ用 HTML のデフォルトファイル名を default.html から miniparse.html に変更した
・miniparse.html において、イベントドリブンな動作を行うように変更した
・miniparse.html において、各項目に HTML を指定できるように改良した
・miniparse.html において、データ定義の text、html プロパティに関数を指定できるように改良した
・miniparse.html において、データ定義のプロパティに effect を追加した
・配布バイナリについて、-update のほうに resources フォルダを毎回含めるようにした
  • Loading branch information
RainbowMage committed Dec 5, 2014
1 parent 9f7c2d6 commit 4c2cc3a
Show file tree
Hide file tree
Showing 17 changed files with 552 additions and 188 deletions.
7 changes: 7 additions & 0 deletions HtmlRenderer/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ class Client : CefClient
private readonly RenderHandler renderHandler;
private readonly LifeSpanHandler lifeSpanHandler;
private readonly LoadHandler loadHandler;
private readonly DisplayHandler displayHandler;

public Client(Renderer renderer, int windowWidth, int windowHeight)
{
this.renderer = renderer;
this.renderHandler = new RenderHandler(renderer, windowWidth, windowHeight);
this.lifeSpanHandler = new LifeSpanHandler(renderer);
this.loadHandler = new LoadHandler(renderer);
this.displayHandler = new DisplayHandler(renderer);
}

protected override CefRenderHandler GetRenderHandler()
Expand All @@ -37,6 +39,11 @@ protected override CefLoadHandler GetLoadHandler()
return loadHandler;
}

protected override CefDisplayHandler GetDisplayHandler()
{
return displayHandler;
}

public void ResizeView(int width, int height)
{
renderHandler.Width = width;
Expand Down
26 changes: 26 additions & 0 deletions HtmlRenderer/DisplayHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xilium.CefGlue;

namespace RainbowMage.HtmlRenderer
{
class DisplayHandler : CefDisplayHandler
{
private Renderer renderer;

public DisplayHandler(Renderer renderer)
{
this.renderer = renderer;
}

protected override bool OnConsoleMessage(CefBrowser browser, string message, string source, int line)
{
this.renderer.OnConsoleLog(browser, message, source, line);

return base.OnConsoleMessage(browser, message, source, line);
}
}
}
1 change: 1 addition & 0 deletions HtmlRenderer/HtmlRenderer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<ItemGroup>
<Compile Include="App.cs" />
<Compile Include="Client.cs" />
<Compile Include="DisplayHandler.cs" />
<Compile Include="LifeSpanHandler.cs" />
<Compile Include="LoadHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
7 changes: 3 additions & 4 deletions HtmlRenderer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("HtmlRenderer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("HTML based offscreen rendering library for the OverlayPlugin.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HtmlRenderer")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyCopyright("Copyright © RainbowMage 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,4 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.1")]
25 changes: 24 additions & 1 deletion HtmlRenderer/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Renderer : IDisposable
public event EventHandler<RenderEventArgs> Render;
public event EventHandler<BrowserErrorEventArgs> BrowserError;
public event EventHandler<BrowserLoadEventArgs> BrowserLoad;
public event EventHandler<BrowserConsoleLogEventArgs> BrowserConsoleLog;

public CefBrowser Browser { get; private set; }
private Client Client { get; set; }
Expand Down Expand Up @@ -101,6 +102,14 @@ internal void OnLoad(CefBrowser browser, CefFrame frame, int httpStatusCode)
}
}

internal void OnConsoleLog(CefBrowser browser, string message, string source, int line)
{
if (BrowserConsoleLog != null)
{
BrowserConsoleLog(this, new BrowserConsoleLogEventArgs(message, source, line));
}
}

public void Dispose()
{
var host = Browser.GetHost();
Expand Down Expand Up @@ -129,7 +138,8 @@ public static void Initialize()
var cefSettings = new CefSettings
{
SingleProcess = true,
MultiThreadedMessageLoop = true
MultiThreadedMessageLoop = true,
LogSeverity = CefLogSeverity.Disable
};

CefRuntime.Initialize(cefMainArgs, cefSettings, cefApp, IntPtr.Zero);
Expand Down Expand Up @@ -170,4 +180,17 @@ public BrowserLoadEventArgs(int httpStatusCode, string url)
this.Url = url;
}
}

public class BrowserConsoleLogEventArgs : EventArgs
{
public string Message { get; private set; }
public string Source { get; private set; }
public int Line { get; private set; }
public BrowserConsoleLogEventArgs(string message, string source, int line)
{
this.Message = message;
this.Source = source;
this.Line = line;
}
}
}
112 changes: 92 additions & 20 deletions OverlayPlugin/ControlPanel.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4c2cc3a

Please sign in to comment.