mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-22 07:37:40 +00:00
[Windows] More chromium integration; tsysinfo
This commit is contained in:
parent
f4793297b6
commit
46049802aa
8 changed files with 44 additions and 86 deletions
Binary file not shown.
|
|
@ -46,14 +46,9 @@ type
|
|||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure cmdPrintClick(Sender: TObject);
|
||||
procedure webNewWindow3(ASender: TObject; var ppDisp: IDispatch;
|
||||
var Cancel: WordBool; dwFlags: Cardinal; const bstrUrlContext,
|
||||
bstrUrl: WideString);
|
||||
procedure cmdBackClick(Sender: TObject);
|
||||
procedure cmdForwardClick(Sender: TObject);
|
||||
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure webKeyDown(Sender: TObject; var Key: Word; ScanCode: Word;
|
||||
Shift: TShiftState);
|
||||
procedure ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);
|
||||
private
|
||||
cef: TframeCEFHost;
|
||||
|
|
@ -99,21 +94,21 @@ begin
|
|||
cmdBack.Enabled := Enable;
|
||||
end;}
|
||||
|
||||
procedure TfrmHTML.webKeyDown(Sender: TObject; var Key: Word; ScanCode: Word;
|
||||
{procedure TfrmHTML.webKeyDown(Sender: TObject; var Key: Word; ScanCode: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
inherited;
|
||||
if Key = VK_ESCAPE then
|
||||
Close;
|
||||
end;
|
||||
end;}
|
||||
|
||||
procedure TfrmHTML.webNewWindow3(ASender: TObject; var ppDisp: IDispatch;
|
||||
{procedure TfrmHTML.webNewWindow3(ASender: TObject; var ppDisp: IDispatch;
|
||||
var Cancel: WordBool; dwFlags: Cardinal; const bstrUrlContext,
|
||||
bstrUrl: WideString);
|
||||
begin
|
||||
Cancel := True;
|
||||
TUtilExecute.URL(bstrUrl); // I3349
|
||||
end;
|
||||
end;}
|
||||
|
||||
procedure TfrmHTML.SetText(const Value: string);
|
||||
var
|
||||
|
|
@ -177,6 +172,7 @@ begin
|
|||
cef.Parent := Self;
|
||||
cef.Visible := True;
|
||||
cef.ShouldOpenRemoteUrlsInBrowser := True;
|
||||
|
||||
// cef.OnBeforeBrowse := cefBeforeBrowse;
|
||||
// cef.OnBeforeBrowseSync := cefBeforeBrowseSync;
|
||||
// cef.OnLoadEnd := cefLoadEnd;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(*
|
||||
(* r
|
||||
Name: UfrmTextEditor
|
||||
Copyright: Copyright (C) SIL International.
|
||||
Documentation:
|
||||
|
|
@ -138,18 +138,12 @@ type
|
|||
procedure editorKeymanSelectLang(Sender: TObject);
|
||||
procedure editorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
|
||||
procedure webBeforeNavigate2(ASender: TObject;
|
||||
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
|
||||
Headers: OleVariant; var Cancel: WordBool);
|
||||
procedure ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);
|
||||
procedure Help2Click(Sender: TObject);
|
||||
procedure webNewWindow3(ASender: TObject; var ppDisp: IDispatch;
|
||||
var Cancel: WordBool; dwFlags: Cardinal; const bstrUrlContext,
|
||||
bstrUrl: WideString);
|
||||
procedure mnuViewFontHelperClick(Sender: TObject);
|
||||
procedure editorKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
private
|
||||
webFonts: TframeCEFHost;
|
||||
cefFonts: TframeCEFHost;
|
||||
wm_keyman_control, wm_keyman_refresh: UINT;
|
||||
FUpdating: Boolean;
|
||||
FCheckFontsThread: TCheckFontsThread;
|
||||
|
|
@ -160,7 +154,6 @@ type
|
|||
|
||||
procedure CMFontChange(var Message: TMessage); message CM_FONTCHANGE;
|
||||
procedure WMUserFormShown(var Message: TMessage); message WM_USER_FormShown;
|
||||
procedure WMUserFireCommand(var Message: TMessage); message WM_USER_FireCommand;
|
||||
procedure WMUserCheckFonts(var Message: TMessage); message WM_USER_CheckFonts;
|
||||
procedure PostKeymanControlMessage(msg, wParam: UINT; lParam: Cardinal);
|
||||
{function SendKeymanControlMessage(msg, wParam: UINT;
|
||||
|
|
@ -183,6 +176,8 @@ type
|
|||
procedure FireCommand(const command: WideString; params: TStringList);
|
||||
procedure ResetAutoKeyboard;
|
||||
procedure StartCheckFontsThread;
|
||||
procedure cefCommand(Sender: TObject; const command: string;
|
||||
params: TStringList);
|
||||
protected
|
||||
class function ShouldRegisterWindow: Boolean; override; // I2720
|
||||
public
|
||||
|
|
@ -264,7 +259,11 @@ begin
|
|||
StartCheckFontsThread;
|
||||
HideFontsBox;
|
||||
|
||||
{$MESSAGE HINT 'TODO: Support font box'}
|
||||
cefFonts := TframeCEFHost.Create(Self);
|
||||
cefFonts.Parent := Self;
|
||||
cefFonts.Visible := True;
|
||||
cefFonts.ShouldOpenRemoteUrlsInBrowser := True;
|
||||
cefFonts.OnCommand := cefCommand;
|
||||
|
||||
FormCreate_Editor;
|
||||
end;
|
||||
|
|
@ -464,18 +463,6 @@ begin
|
|||
CheckKeyboardFonts(True);
|
||||
end;
|
||||
|
||||
procedure TfrmTextEditor.WMUserFireCommand(var Message: TMessage);
|
||||
var
|
||||
command: WideString;
|
||||
params: TStringList;
|
||||
begin
|
||||
params := TStringList(Message.LParam);
|
||||
command := params[0];
|
||||
params.Delete(0);
|
||||
FireCommand(command, params);
|
||||
params.Free;
|
||||
end;
|
||||
|
||||
procedure TfrmTextEditor.WMUserFormShown(var Message: TMessage);
|
||||
begin
|
||||
CheckKeyboardFonts(False);
|
||||
|
|
@ -590,7 +577,7 @@ begin
|
|||
if (lang = nil) or (lang.KeymanKeyboardLanguage = nil) then
|
||||
begin
|
||||
FreeAndNil(FFontWebFileName); // I4181
|
||||
FFontWebFileName := LoadWebBox(webFonts, 'welcome_fonts', '<not_keyman />'); // I4181
|
||||
FFontWebFileName := LoadWebBox(cefFonts, 'welcome_fonts', '<not_keyman />'); // I4181
|
||||
//HideFontsBox;
|
||||
Exit;
|
||||
end;
|
||||
|
|
@ -601,7 +588,7 @@ begin
|
|||
if not Assigned(FKeyboard) then
|
||||
begin
|
||||
FreeAndNil(FFontWebFileName); // I4181
|
||||
FFontWebFileName := LoadWebBox(webFonts, 'welcome_fonts', ''); // I1534 - show hint for non-Unicode keyboards // I4181
|
||||
FFontWebFileName := LoadWebBox(cefFonts, 'welcome_fonts', ''); // I1534 - show hint for non-Unicode keyboards // I4181
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
|
@ -624,7 +611,7 @@ begin
|
|||
FFontsData := FFontsData + '</Fonts>';
|
||||
|
||||
FreeAndNil(FFontWebFileName); // I4181
|
||||
FFontWebFileName := LoadWebBox(webFonts, 'welcome_fonts', FFontsData); // I4181
|
||||
FFontWebFileName := LoadWebBox(cefFonts, 'welcome_fonts', FFontsData); // I4181
|
||||
|
||||
if (FKeyboard.Fonts.Count > 0) and FSetFont then
|
||||
CurrText.Name := FKeyboard.Fonts[0].FontName;
|
||||
|
|
@ -795,36 +782,9 @@ begin
|
|||
StatusBar.Panels[0].Text := Format(sColRowInfo, [CharPos.Y, CharPos.X]);
|
||||
end;
|
||||
|
||||
procedure TfrmTextEditor.webBeforeNavigate2(ASender: TObject;
|
||||
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
|
||||
Headers: OleVariant; var Cancel: WordBool);
|
||||
var
|
||||
params: TStringList;
|
||||
procedure TfrmTextEditor.cefCommand(Sender: TObject; const command: string; params: TStringList);
|
||||
begin
|
||||
if GetParamsFromURL(URL, params) then
|
||||
begin
|
||||
PostMessage(Handle, WM_USER_FireCommand, 0, Integer(params));
|
||||
Cancel := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$MESSAGE HINT 'TODO: Handle new window event from font frame'}
|
||||
procedure TfrmTextEditor.webNewWindow3(ASender: TObject;
|
||||
var ppDisp: IDispatch; var Cancel: WordBool; dwFlags: Cardinal;
|
||||
const bstrUrlContext, bstrUrl: WideString);
|
||||
var
|
||||
params: TStringList;
|
||||
begin
|
||||
if GetParamsFromURL(bstrUrl, params) then
|
||||
begin
|
||||
PostMessage(Handle, WM_USER_FireCommand, 0, Integer(params));
|
||||
Cancel := True;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Cancel := True;
|
||||
(ASender as TframeCEFHost).Navigate(bstrUrl);
|
||||
end;
|
||||
FireCommand(command, params);
|
||||
end;
|
||||
|
||||
procedure TfrmTextEditor.FormShow_Editor;
|
||||
|
|
@ -868,7 +828,7 @@ var
|
|||
begin
|
||||
if command = 'selectfont' then
|
||||
begin
|
||||
webFonts.SetFocus;
|
||||
cefFonts.SetFocus;
|
||||
if editor.CanFocus then // I1641
|
||||
editor.SetFocus;
|
||||
CurrText.Name := params.Values['font'];
|
||||
|
|
|
|||
|
|
@ -442,8 +442,8 @@ begin
|
|||
begin
|
||||
si := FSIList[i];
|
||||
web := TframeCEFHost.Create(si.Parent);
|
||||
// web.Parent := si.Parent as TWinControl;
|
||||
(si.Parent as TWinControl).InsertControl(web);
|
||||
web.Parent := si.Parent as TWinControl;
|
||||
//(si.Parent as TWinControl).InsertControl(web);
|
||||
(si.Parent as TTabSheet).Caption := si.Caption;
|
||||
(si.Parent as TTabSheet).TabVisible := True;
|
||||
web.Align := alClient;
|
||||
|
|
|
|||
|
|
@ -63,8 +63,20 @@ uses
|
|||
{$R version.res}
|
||||
|
||||
begin
|
||||
Application.Title := 'Keyman Desktop System Information';
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TfrmDiagnostics, frmDiagnostics);
|
||||
Application.Run;
|
||||
FInitializeCEF := TCEFManager.Create(SFolderKeymanEngine);
|
||||
try
|
||||
try
|
||||
if FInitializeCEF.Start then
|
||||
begin
|
||||
Application.Title := 'Keyman Desktop System Information';
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TfrmDiagnostics, frmDiagnostics);
|
||||
Application.Run;
|
||||
end;
|
||||
finally
|
||||
frmDiagnostics.Free;
|
||||
end;
|
||||
finally
|
||||
FInitializeCEF.Free;
|
||||
end;
|
||||
end.
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||
<Icon_MainIcon>tsysinfo_Icon1.ico</Icon_MainIcon>
|
||||
<Debugger_RunParams>-c c:\temp\exception-10472-2017-03-20-19-47-10.log</Debugger_RunParams>
|
||||
<VerInfo_Keys>CompanyName=;FileVersion=5.0.0.26;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<BT_BuildType>Debug</BT_BuildType>
|
||||
|
|
@ -170,7 +169,6 @@
|
|||
<DCCReference Include="..\..\global\delphi\general\DebugPaths.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\general\GetOsVersion.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\general\GlobalProxySettings.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\tlb\MSHTML_TLB.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\general\ErrLogPath.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\general\klog.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\general\utildir.pas"/>
|
||||
|
|
@ -197,7 +195,6 @@
|
|||
<DCCReference Include="..\..\global\delphi\winapi\keyman_msctf.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\general\Glossary.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\general\TempFileManager.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\vcl\SHDocVw.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\cust\StockFileNames.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\general\kmxfileconsts.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\chromium\Keyman.System.CEFManager.pas"/>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ Keyman Desktop from TEmbeddedWB to TCEF4Delphi. It may not be up to date.
|
|||
|
||||
cef / cefwp:
|
||||
UframeCEFHost (TframeCEFHost)
|
||||
{Kmshell, Developer, Keyman, Tsysinfo}
|
||||
|
||||
Kmshell
|
||||
UfrmHTML ()
|
||||
|
|
@ -70,7 +71,7 @@ Developer
|
|||
Keyman
|
||||
UfrmOSKFontHelper
|
||||
UfrmOSKKeyboardUsage
|
||||
UfrmVisualKeyboard [WebHintManager]
|
||||
UfrmVisualKeyboard [*WebHintManager from global]
|
||||
UfrmWebContainer [*from global]
|
||||
UfrmHelp
|
||||
UfrmHint [*from global]
|
||||
|
|
@ -80,5 +81,8 @@ Tsysinfo
|
|||
|
||||
Global
|
||||
WebBrowserManager [*]
|
||||
{Keyman}
|
||||
UfrmWebContainer [*]
|
||||
{Keyman, KMShell}
|
||||
{Keyman, KMShell}
|
||||
UfrmHint [*]
|
||||
{Keyman, KMShell}
|
||||
|
|
|
|||
|
|
@ -134,20 +134,9 @@ begin
|
|||
end;
|
||||
|
||||
procedure TWebBrowserManager.SafeWndProc(var Message: TMessage);
|
||||
var
|
||||
command: WideString;
|
||||
params: TStringList;
|
||||
begin
|
||||
with Message do
|
||||
case Msg of
|
||||
WM_USER_FireCommand:
|
||||
begin
|
||||
params := TStringList(Message.LParam);
|
||||
command := params[0];
|
||||
params.Delete(0);
|
||||
FireCommand(command, params);
|
||||
params.Free;
|
||||
end;
|
||||
WM_USER_ContentRender:
|
||||
Content_Render;
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue