Added Delphi 6 support thanks to andreluisfc

This commit is contained in:
Salvador Díaz Fau 2024-03-23 18:21:32 +01:00
parent 76d3880633
commit 16639d5ea5
10 changed files with 58 additions and 10 deletions

View File

@ -13,7 +13,7 @@ The CEF binaries used by CEF4Delphi are available for download at Spotify :
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_122.1.13%2Bgde5b724%2Bchromium-122.0.6261.130_linuxarm64.tar.bz2) * [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_122.1.13%2Bgde5b724%2Bchromium-122.0.6261.130_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_122.1.13%2Bgde5b724%2Bchromium-122.0.6261.130_macosx64.tar.bz2) * [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_122.1.13%2Bgde5b724%2Bchromium-122.0.6261.130_macosx64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 12.0 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 11 and Lazarus 3.2/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. CEF4Delphi was developed and tested on Delphi 12.0 and it has been tested in Delphi 6, Delphi XE, Delphi 10, Delphi 11 and Lazarus 3.2/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
CEF4Delphi demos have been tested in Windows 10, Windows 11, Linux Mint 21.3 and Raspberry Pi OS. CEF4Delphi demos have been tested in Windows 10, Windows 11, Linux Mint 21.3 and Raspberry Pi OS.

View File

@ -451,7 +451,8 @@
{$DEFINE DELPHI25_UP} {$DEFINE DELPHI25_UP}
{$DEFINE DELPHI26_UP} {$DEFINE DELPHI26_UP}
{$DEFINE DELPHI27_UP} {$DEFINE DELPHI27_UP}
{$DEFINE DELPHI28_UP} {$DEFINE DELPHI28_UP}
{$DEFINE DELPHI29_UP}
{$ENDIF} {$ENDIF}
{$ENDIF} {$ENDIF}

View File

@ -3154,7 +3154,11 @@ end;
procedure TCefApplicationCore.AddCustomCommandLineSwitches(var aKeys, aValues : TStringList); procedure TCefApplicationCore.AddCustomCommandLineSwitches(var aKeys, aValues : TStringList);
var var
i : integer; i : integer;
{$IFDEF VER140}
TempDecimalSeparator : char; // Only for Delphi 6
{$ELSE}
TempFormatSettings : TFormatSettings; TempFormatSettings : TFormatSettings;
{$ENDIF}
begin begin
if FEnableMediaStream then if FEnableMediaStream then
ReplaceSwitch(aKeys, aValues, '--enable-media-stream'); ReplaceSwitch(aKeys, aValues, '--enable-media-stream');
@ -3298,15 +3302,23 @@ begin
begin begin
{$IFDEF FPC} {$IFDEF FPC}
TempFormatSettings.DecimalSeparator := '.'; TempFormatSettings.DecimalSeparator := '.';
ReplaceSwitch(aKeys, aValues, '--force-device-scale-factor', FloatToStr(FForcedDeviceScaleFactor, TempFormatSettings));
{$ELSE} {$ELSE}
{$IFDEF DELPHI24_UP} {$IFDEF DELPHI7_UP}
TempFormatSettings := TFormatSettings.Create('en-US'); {$IFDEF DELPHI24_UP}
TempFormatSettings := TFormatSettings.Create('en-US');
{$ELSE}
GetLocaleFormatSettings(GetThreadLocale, TempFormatSettings);
TempFormatSettings.DecimalSeparator := '.';
{$ENDIF}
ReplaceSwitch(aKeys, aValues, '--force-device-scale-factor', FloatToStr(FForcedDeviceScaleFactor, TempFormatSettings));
{$ELSE} {$ELSE}
GetLocaleFormatSettings(GetThreadLocale, TempFormatSettings); TempDecimalSeparator := DecimalSeparator;
TempFormatSettings.DecimalSeparator := '.'; DecimalSeparator := '.';
ReplaceSwitch(aKeys, aValues, '--force-device-scale-factor', FloatToStr(FForcedDeviceScaleFactor));
DecimalSeparator := TempDecimalSeparator;
{$ENDIF} {$ENDIF}
{$ENDIF} {$ENDIF}
ReplaceSwitch(aKeys, aValues, '--force-device-scale-factor', FloatToStr(FForcedDeviceScaleFactor, TempFormatSettings));
end; end;
if FDisableZygote then if FDisableZygote then

View File

@ -353,7 +353,9 @@ type
property BevelKind; property BevelKind;
property Ctl3D; property Ctl3D;
property Locked; property Locked;
{$IFDEF DELPHI7_UP}
property ParentBackground; property ParentBackground;
{$ENDIF}
property ParentCtl3D; property ParentCtl3D;
property OnCanResize; property OnCanResize;
{$ENDIF} {$ENDIF}

View File

@ -154,7 +154,11 @@ begin
TempValue := TempStrMap.Value[i]; TempValue := TempStrMap.Value[i];
if (length(TempKey) > 0) and (length(TempValue) > 0) then if (length(TempKey) > 0) and (length(TempValue) > 0) then
{$IFDEF VER140}
switches.Add(TempKey + '=' + TempValue) // Only for Delphi 6
{$ELSE}
switches.Add(TempKey + switches.NameValueSeparator + TempValue) switches.Add(TempKey + switches.NameValueSeparator + TempValue)
{$ENDIF}
else else
if (length(TempKey) > 0) then if (length(TempKey) > 0) then
switches.Add(TempKey) switches.Add(TempKey)

View File

@ -106,7 +106,11 @@ begin
TempValue := TempStrMap.Value[i]; TempValue := TempStrMap.Value[i];
if (length(TempKey) > 0) and (length(TempValue) > 0) then if (length(TempKey) > 0) and (length(TempValue) > 0) then
{$IFDEF VER140}
attrList.Add(TempKey + '=' + TempValue) // Only for Delphi 6
{$ELSE}
attrList.Add(TempKey + attrList.NameValueSeparator + TempValue) attrList.Add(TempKey + attrList.NameValueSeparator + TempValue)
{$ENDIF}
else else
if (length(TempKey) > 0) then if (length(TempKey) > 0) then
attrList.Add(TempKey) attrList.Add(TempKey)

View File

@ -817,6 +817,10 @@ function GetCommandLineSwitchValue(const aKey : string; var aValue : ustring) :
/// </summary> /// </summary>
function IsCEFSubprocess : boolean; function IsCEFSubprocess : boolean;
{$IFNDEF FPC}{$IFNDEF DELPHI7_UP}
function PosEx(const SubStr, S: string; Offset: Cardinal = 1): Integer;
{$ENDIF}{$ENDIF}
implementation implementation
uses uses
@ -3443,4 +3447,20 @@ begin
Result := GetCommandLineSwitchValue('type', TempValue) and (length(TempValue) > 0); Result := GetCommandLineSwitchValue('type', TempValue) and (length(TempValue) > 0);
end; end;
{$IFNDEF FPC}{$IFNDEF DELPHI7_UP}
function PosEx(const SubStr, S: string; Offset: Cardinal = 1): Integer;
var
TempString : string;
begin
if Offset <= 1 then
Result := Pos(SubStr, S)
else
begin
TempString := copy(S, Offset, length(S));
Result := Pos(SubStr, TempString);
if (Result > 0) then inc(Result, Offset - 1);
end;
end;
{$ENDIF}{$ENDIF}
end. end.

View File

@ -15,10 +15,11 @@ interface
uses uses
{$IFDEF DELPHI16_UP} {$IFDEF DELPHI16_UP}
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.ShlObj, WinApi.ActiveX,{$ENDIF} System.Classes, System.Math; {$IFDEF MSWINDOWS}WinApi.Windows, WinApi.ShlObj, WinApi.ActiveX,{$ENDIF} System.Classes, System.Math,
{$ELSE} {$ELSE}
{$IFDEF MSWINDOWS}Windows, ShlObj, ActiveX,{$ENDIF} Classes, Math; {$IFDEF MSWINDOWS}Windows, ShlObj, ActiveX,{$ENDIF} Classes, Math,
{$ENDIF} {$ENDIF}
uCEFTypes;
const const
CUSTOM_ARRAY_LENGTH = 25; CUSTOM_ARRAY_LENGTH = 25;

View File

@ -733,6 +733,10 @@ type
/// </summary> /// </summary>
ustring = type WideString; ustring = type WideString;
rbstring = type AnsiString; rbstring = type AnsiString;
{$IFNDEF DELPHI7_UP}
uint64 = type int64;
PPAnsiChar = array of PChar;
{$ENDIF}
{$ELSE} {$ELSE}
/// <summary> /// <summary>
/// String type used by CEF. ustring was created to use the same type in Delphi and Lazarus. /// String type used by CEF. ustring was created to use the same type in Delphi and Lazarus.

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 575, "InternalVersion" : 576,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "122.1.13" "Version" : "122.1.13"
} }