mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-04-17 06:57:13 +02:00
Fixed context menu position in FMX demos using OSR mode in high DPI screens
Fixed a build issue in the SubProcess demo.
This commit is contained in:
parent
7f3e3415ef
commit
676162a41b
@ -588,10 +588,11 @@ procedure TFMXExternalPumpBrowserFrm.chrmosrGetScreenPoint( Sender : TObje
|
|||||||
out Result : Boolean);
|
out Result : Boolean);
|
||||||
var
|
var
|
||||||
TempScreenPt, TempViewPt : TPoint;
|
TempScreenPt, TempViewPt : TPoint;
|
||||||
|
TempScale : single;
|
||||||
begin
|
begin
|
||||||
// TFMXBufferPanel.ClientToScreen applies the scale factor. No need to call LogicalToDevice to set TempViewPt.
|
TempScale := Panel1.ScreenScale;
|
||||||
TempViewPt.x := viewX;
|
TempViewPt.x := LogicalToDevice(viewX, TempScale);
|
||||||
TempViewPt.y := viewY;
|
TempViewPt.y := LogicalToDevice(viewY, TempScale);
|
||||||
TempScreenPt := Panel1.ClientToScreen(TempViewPt);
|
TempScreenPt := Panel1.ClientToScreen(TempViewPt);
|
||||||
screenX := TempScreenPt.x;
|
screenX := TempScreenPt.x;
|
||||||
screenY := TempScreenPt.y;
|
screenY := TempScreenPt.y;
|
||||||
|
@ -578,8 +578,8 @@ procedure TMainForm.chrmosrGetScreenPoint( Sender : TObject;
|
|||||||
var
|
var
|
||||||
TempPoint : TPointF;
|
TempPoint : TPointF;
|
||||||
begin
|
begin
|
||||||
TempPoint.x := viewX;
|
TempPoint.x := LogicalToDevice(viewX, GlobalCEFApp.DeviceScaleFactor);
|
||||||
TempPoint.y := viewY;
|
TempPoint.y := LogicalToDevice(viewY, GlobalCEFApp.DeviceScaleFactor);
|
||||||
// LocalToScreen applies the scale factor. No need to call LogicalToDevice to set TempViewPt.
|
// LocalToScreen applies the scale factor. No need to call LogicalToDevice to set TempViewPt.
|
||||||
TempPoint := Panel1.LocalToScreen(TempPoint);
|
TempPoint := Panel1.LocalToScreen(TempPoint);
|
||||||
screenX := round(TempPoint.x);
|
screenX := round(TempPoint.x);
|
||||||
|
@ -213,6 +213,7 @@ begin
|
|||||||
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
|
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBrowserFrame.ReloadBtnClick(Sender: TObject);
|
procedure TBrowserFrame.ReloadBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FMXChromium1.Reload;
|
FMXChromium1.Reload;
|
||||||
@ -222,6 +223,7 @@ procedure TBrowserFrame.FocusBrowser;
|
|||||||
begin
|
begin
|
||||||
FMXBufferPanel1.SetFocus;
|
FMXBufferPanel1.SetFocus;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBrowserFrame.ResizeBrowser;
|
procedure TBrowserFrame.ResizeBrowser;
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
@ -244,6 +246,7 @@ begin
|
|||||||
if (FResizeCS <> nil) then FResizeCS.Release;
|
if (FResizeCS <> nil) then FResizeCS.Release;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBrowserFrame.NotifyMoveOrResizeStarted;
|
procedure TBrowserFrame.NotifyMoveOrResizeStarted;
|
||||||
begin
|
begin
|
||||||
FMXChromium1.NotifyMoveOrResizeStarted;
|
FMXChromium1.NotifyMoveOrResizeStarted;
|
||||||
@ -490,10 +493,11 @@ procedure TBrowserFrame.FMXChromium1GetScreenPoint(Sender: TObject;
|
|||||||
screenY: Integer; out Result: Boolean);
|
screenY: Integer; out Result: Boolean);
|
||||||
var
|
var
|
||||||
TempScreenPt, TempViewPt : TPoint;
|
TempScreenPt, TempViewPt : TPoint;
|
||||||
|
TempScale : single;
|
||||||
begin
|
begin
|
||||||
// TFMXBufferPanel.ClientToScreen applies the scale factor. No need to call LogicalToDevice to set TempViewPt.
|
TempScale := FMXBufferPanel1.ScreenScale;
|
||||||
TempViewPt.x := viewX;
|
TempViewPt.x := LogicalToDevice(viewX, TempScale);
|
||||||
TempViewPt.y := viewY;
|
TempViewPt.y := LogicalToDevice(viewY, TempScale);
|
||||||
TempScreenPt := FMXBufferPanel1.ClientToScreen(TempViewPt);
|
TempScreenPt := FMXBufferPanel1.ClientToScreen(TempViewPt);
|
||||||
screenX := TempScreenPt.x;
|
screenX := TempScreenPt.x;
|
||||||
screenY := TempScreenPt.y;
|
screenY := TempScreenPt.y;
|
||||||
|
@ -40,21 +40,17 @@ program SimpleBrowser;
|
|||||||
{$I cef.inc}
|
{$I cef.inc}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
WinApi.Windows,
|
|
||||||
{$ELSE}
|
|
||||||
Forms,
|
|
||||||
Windows,
|
|
||||||
{$ENDIF}
|
|
||||||
uCEFLoader in 'uCEFLoader.pas',
|
uCEFLoader in 'uCEFLoader.pas',
|
||||||
uSimpleBrowser in 'uSimpleBrowser.pas' {Form1};
|
uSimpleBrowser in 'uSimpleBrowser.pas' {Form1};
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
{$IFDEF WIN32}
|
||||||
// If you don't add this flag the rederer process will crash when you try to load large images.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
// If you don't add this flag the rederer process will crash when you try to load large images.
|
||||||
|
{$SetPEFlags $20}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// This demo has the GlobalCEFApp creation, initialization and destruction in uCEFLoader.pas
|
// This demo has the GlobalCEFApp creation, initialization and destruction in uCEFLoader.pas
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectGuid>{55E00327-9D98-4DA3-A4E1-844942A01C6B}</ProjectGuid>
|
<ProjectGuid>{55E00327-9D98-4DA3-A4E1-844942A01C6B}</ProjectGuid>
|
||||||
<ProjectVersion>19.3</ProjectVersion>
|
<ProjectVersion>19.4</ProjectVersion>
|
||||||
<FrameworkType>VCL</FrameworkType>
|
<FrameworkType>VCL</FrameworkType>
|
||||||
<MainSource>SimpleBrowser.dpr</MainSource>
|
<MainSource>SimpleBrowser.dpr</MainSource>
|
||||||
<Base>True</Base>
|
<Base>True</Base>
|
||||||
@ -162,13 +162,13 @@
|
|||||||
</Excluded_Packages>
|
</Excluded_Packages>
|
||||||
</Delphi.Personality>
|
</Delphi.Personality>
|
||||||
<Deployment Version="3">
|
<Deployment Version="3">
|
||||||
<DeployFile LocalName="Win32\Debug\SimpleBrowser.exe" Configuration="Debug" Class="ProjectOutput"/>
|
|
||||||
<DeployFile LocalName="..\..\bin\SimpleBrowser.exe" Configuration="Debug" Class="ProjectOutput">
|
<DeployFile LocalName="..\..\bin\SimpleBrowser.exe" Configuration="Debug" Class="ProjectOutput">
|
||||||
<Platform Name="Win32">
|
<Platform Name="Win32">
|
||||||
<RemoteName>SimpleBrowser.exe</RemoteName>
|
<RemoteName>SimpleBrowser.exe</RemoteName>
|
||||||
<Overwrite>true</Overwrite>
|
<Overwrite>true</Overwrite>
|
||||||
</Platform>
|
</Platform>
|
||||||
</DeployFile>
|
</DeployFile>
|
||||||
|
<DeployFile LocalName="Win32\Debug\SimpleBrowser.exe" Configuration="Debug" Class="ProjectOutput"/>
|
||||||
<DeployClass Name="AdditionalDebugSymbols">
|
<DeployClass Name="AdditionalDebugSymbols">
|
||||||
<Platform Name="iOSSimulator">
|
<Platform Name="iOSSimulator">
|
||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
@ -1294,17 +1294,17 @@
|
|||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
</Platform>
|
</Platform>
|
||||||
</DeployClass>
|
</DeployClass>
|
||||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
|
|
||||||
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
|
|
||||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
|
||||||
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
|
|
||||||
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
||||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
|
||||||
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
|
||||||
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
||||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||||
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
|
||||||
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
||||||
|
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
||||||
|
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
|
||||||
|
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
|
||||||
|
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
||||||
|
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||||
|
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||||
</Deployment>
|
</Deployment>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform value="Win32">True</Platform>
|
<Platform value="Win32">True</Platform>
|
||||||
|
@ -35,26 +35,18 @@
|
|||||||
*
|
*
|
||||||
*)
|
*)
|
||||||
program SimpleBrowser_sp;
|
program SimpleBrowser_sp;
|
||||||
{$I cef.inc}
|
|
||||||
uses
|
|
||||||
{$IFDEF DELPHI16_UP}
|
|
||||||
WinApi.Windows,
|
|
||||||
{$ELSE}
|
|
||||||
Windows,
|
|
||||||
{$ENDIF}
|
|
||||||
uCEFLoader in 'uCEFLoader.pas';
|
|
||||||
|
|
||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes
|
{$I cef.inc}
|
||||||
// to use up to 3GB of RAM.
|
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
uses
|
||||||
|
uCEFLoader_sp in 'uCEFLoader_sp.pas';
|
||||||
|
|
||||||
|
{$IFDEF WIN32}
|
||||||
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
|
// If you don't add this flag the rederer process will crash when you try to load large images.
|
||||||
|
{$SetPEFlags $20}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// This SubProcess project is only used for the CEF subprocesses and it needs
|
// This SubProcess project is only used for the CEF subprocesses.
|
||||||
// to declare "CEFSUBPROCESS" conditional define. Follow these steps to add it:
|
|
||||||
// 1. Open the project options in the Project->Options menu option and select
|
|
||||||
// "Building->Delphi Compiler" on the left.
|
|
||||||
// 2. Select "All configurations - All platforms" option as the "Target" on
|
|
||||||
// the right section of that window.
|
|
||||||
// 3. Add "CEFSUBPROCESS" (without quotes) in the "Conditional defines" box.
|
|
||||||
// uCEFLoader will call CreateGlobalCEFApp and DestroyGlobalCEFApp in the
|
|
||||||
// initialization and finalization sections of that unit.
|
|
||||||
end.
|
end.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectGuid>{6ABCF641-08D0-4F35-9D13-2FBD18E5152A}</ProjectGuid>
|
<ProjectGuid>{6ABCF641-08D0-4F35-9D13-2FBD18E5152A}</ProjectGuid>
|
||||||
<ProjectVersion>19.3</ProjectVersion>
|
<ProjectVersion>19.4</ProjectVersion>
|
||||||
<FrameworkType>VCL</FrameworkType>
|
<FrameworkType>VCL</FrameworkType>
|
||||||
<MainSource>SimpleBrowser_sp.dpr</MainSource>
|
<MainSource>SimpleBrowser_sp.dpr</MainSource>
|
||||||
<Base>True</Base>
|
<Base>True</Base>
|
||||||
@ -58,7 +58,6 @@
|
|||||||
<DCC_F>false</DCC_F>
|
<DCC_F>false</DCC_F>
|
||||||
<DCC_K>false</DCC_K>
|
<DCC_K>false</DCC_K>
|
||||||
<DCC_ExeOutput>..\..\..\bin</DCC_ExeOutput>
|
<DCC_ExeOutput>..\..\..\bin</DCC_ExeOutput>
|
||||||
<DCC_Define>CEFSUBPROCESS;$(DCC_Define)</DCC_Define>
|
|
||||||
<DCC_UnitSearchPath>..\..\..\source;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
<DCC_UnitSearchPath>..\..\..\source;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||||
@ -115,7 +114,7 @@
|
|||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
<MainSource>MainSource</MainSource>
|
<MainSource>MainSource</MainSource>
|
||||||
</DelphiCompile>
|
</DelphiCompile>
|
||||||
<DCCReference Include="uCEFLoader.pas"/>
|
<DCCReference Include="uCEFLoader_sp.pas"/>
|
||||||
<BuildConfiguration Include="Base">
|
<BuildConfiguration Include="Base">
|
||||||
<Key>Base</Key>
|
<Key>Base</Key>
|
||||||
</BuildConfiguration>
|
</BuildConfiguration>
|
||||||
@ -137,11 +136,18 @@
|
|||||||
<Source Name="MainSource">SimpleBrowser_sp.dpr</Source>
|
<Source Name="MainSource">SimpleBrowser_sp.dpr</Source>
|
||||||
</Source>
|
</Source>
|
||||||
<Excluded_Packages>
|
<Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl280.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
</Excluded_Packages>
|
</Excluded_Packages>
|
||||||
</Delphi.Personality>
|
</Delphi.Personality>
|
||||||
<Deployment Version="3">
|
<Deployment Version="3">
|
||||||
|
<DeployFile LocalName="..\..\..\bin\SimpleBrowser_sp.exe" Configuration="Debug" Class="ProjectOutput">
|
||||||
|
<Platform Name="Win32">
|
||||||
|
<RemoteName>SimpleBrowser_sp.exe</RemoteName>
|
||||||
|
<Overwrite>true</Overwrite>
|
||||||
|
</Platform>
|
||||||
|
</DeployFile>
|
||||||
<DeployFile LocalName="..\..\..\bin\SimpleBrowser_sp.exe" Configuration="Release" Class="ProjectOutput">
|
<DeployFile LocalName="..\..\..\bin\SimpleBrowser_sp.exe" Configuration="Release" Class="ProjectOutput">
|
||||||
<Platform Name="Win32">
|
<Platform Name="Win32">
|
||||||
<RemoteName>SimpleBrowser_sp.exe</RemoteName>
|
<RemoteName>SimpleBrowser_sp.exe</RemoteName>
|
||||||
@ -1274,17 +1280,17 @@
|
|||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
</Platform>
|
</Platform>
|
||||||
</DeployClass>
|
</DeployClass>
|
||||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
|
|
||||||
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
|
|
||||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
|
||||||
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
|
|
||||||
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
||||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
|
||||||
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
|
||||||
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
||||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||||
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
|
||||||
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
||||||
|
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
||||||
|
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
|
||||||
|
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
|
||||||
|
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
||||||
|
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||||
|
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||||
</Deployment>
|
</Deployment>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform value="Win32">True</Platform>
|
<Platform value="Win32">True</Platform>
|
||||||
|
@ -42,11 +42,7 @@ interface
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF CEFSUBPROCESS}
|
|
||||||
uCEFApplicationCore;
|
|
||||||
{$ELSE}
|
|
||||||
uCEFApplication;
|
uCEFApplication;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
procedure CreateGlobalCEFApp;
|
procedure CreateGlobalCEFApp;
|
||||||
begin
|
begin
|
||||||
@ -56,12 +52,8 @@ begin
|
|||||||
if (GlobalCEFApp <> nil) then
|
if (GlobalCEFApp <> nil) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
{$IFDEF CEFSUBPROCESS}
|
|
||||||
GlobalCEFApp := TCefApplicationCore.Create;
|
|
||||||
{$ELSE}
|
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.BrowserSubprocessPath := 'SimpleBrowser_sp.exe';
|
GlobalCEFApp.BrowserSubprocessPath := 'SimpleBrowser_sp.exe';
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
// In case you want to use custom directories for the CEF binaries, cache and user data.
|
// In case you want to use custom directories for the CEF binaries, cache and user data.
|
||||||
// If you don't set a cache directory the browser will use in-memory cache.
|
// If you don't set a cache directory the browser will use in-memory cache.
|
||||||
|
80
demos/Delphi_VCL/SubProcess/uCEFLoader_sp.pas
Normal file
80
demos/Delphi_VCL/SubProcess/uCEFLoader_sp.pas
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFLoader_sp;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFApplicationCore;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
begin
|
||||||
|
// In case you prefer to call CreateGlobalCEFApp and DestroyGlobalCEFApp manually
|
||||||
|
// you have to remember that GlobalCEFApp can only be initialized *ONCE* per process.
|
||||||
|
// This is a CEF requirement and there's no workaround.
|
||||||
|
if (GlobalCEFApp <> nil) then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
GlobalCEFApp := TCefApplicationCore.Create;
|
||||||
|
|
||||||
|
// In case you want to use custom directories for the CEF binaries, cache and user data.
|
||||||
|
// If you don't set a cache directory the browser will use in-memory cache.
|
||||||
|
// The cache and user data directories must be writable.
|
||||||
|
{
|
||||||
|
GlobalCEFApp.FrameworkDirPath := 'cef';
|
||||||
|
GlobalCEFApp.ResourcesDirPath := 'cef';
|
||||||
|
GlobalCEFApp.LocalesDirPath := 'cef\locales';
|
||||||
|
GlobalCEFApp.cache := 'cef\cache';
|
||||||
|
GlobalCEFApp.UserDataPath := 'cef\User Data';
|
||||||
|
}
|
||||||
|
|
||||||
|
// This demo uses a different EXE for the subprocesses.
|
||||||
|
// With this configuration it's not necessary to have the
|
||||||
|
// GlobalCEFApp.StartMainProcess call in a if..then clause.
|
||||||
|
GlobalCEFApp.StartSubProcess;
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
finalization
|
||||||
|
DestroyGlobalCEFApp;
|
||||||
|
|
||||||
|
end.
|
Loading…
x
Reference in New Issue
Block a user