TurboPower_iPro: Remove Delphi specific defines and comments. Issue #37990, patch from Zaher Dirkey.

git-svn-id: trunk@64099 -
This commit is contained in:
juha 2020-11-02 10:04:43 +00:00
parent b5c82b66cd
commit 8fe85cc110
7 changed files with 249 additions and 550 deletions

View File

@ -29,7 +29,7 @@ type
TIpDefContentInfo = record
Typ : string; { content type, e.g. 'application' }
Sub : string; { content subtype, e.g. 'octet-stream' }
Enc : TIpMimeEncodingMethod; { encoding method, e.g. 'base64' } {!!.02}
Enc : TIpMimeEncodingMethod; { encoding method, e.g. 'base64' }
end;
const

View File

@ -33,181 +33,27 @@
so options specified here could be overridden by hardcoded
options in the unit source file.}
{$IFDEF LCL}
{$DEFINE IP_LAZARUS}
{$ENDIF}
{$MODE DELPHI}{$H+}
{$IFDEF IP_LAZARUS}
{$MODE DELPHI}{$H+}
{$DEFINE VERSION7} { Delphi 7.0 or higher }
{$DEFINE VERSION4}
{$DEFINE VERSION5}
{$DEFINE Version6OrHigher}
{$DEFINE Version7OrHigher}
// Activate several features of the package by enabling the following DEFINEs.
// Best flexibility is achieved by doing this in the "Additions and Overrides"
// of the Project options.
// Uncomment if you want to enable printing functionality
// (requires extra build/runtime dependencies for Linux like cairo,etc)
//{$DEFINE Html_print}
// Uncomment if you want to disable RTTI access to properties of the HTML nodes
//{$DEFINE Html_RTTI}
{$ELSE}
{====Compiler options that can be changed====}
{$A+ Force alignment on word/dword boundaries}
{$S- No stack checking}
{====Global fixed compiler options (do NOT change)====}
{$B- Incomplete boolean evaluation}
{$H+ Long string support}
{$J+ Writeable typed constants}
{$P- No open string parameters}
{$Q- No arithmetic overflow checking}
{$R- No range checking}
{$T- No type-checked pointers}
{$V- No var string checking}
{$X+ Extended syntax}
{$Z1 Enumerations are byte sized}
{====General defines=================================================}
{.$DEFINE UseGifImageUnit}
{$IFDEF VER110}
{.$DEFINE UseJPegUnit} {BCB3 does not include the JPeg unit by default}
{$ELSE}
{$DEFINE UseJPegUnit}
{$ENDIF}
// Define the following symbol to use the TIpAnimatedGIFImage class. To use
// this class, you must have Ander's TGIFImage.
{.$DEFINE AndersGIFImage }
// Define the following symbol to use the TIpAnimatedImageLibImage. To use
// this class, you must have the ImageLib ILWebImage component.
{.$DEFINE ImageLibGIFImage }
// Define this symbol to use the TIpPNGImage class. TIpPNGImage requires the
// ZLib library.
{$DEFINE UsePNGGraphic }
// !!.12 Define this symbol to exclude all support for HTTP and sockets in
// an application using the HTML panels, e.g. for HTML based wizards
{.$DEFINE HtmlWithoutHttp}
// Activate several features of the package by enabling the following DEFINEs.
// Best flexibility is achieved by doing this in the "Additions and Overrides"
// of the Project options.
// Uncomment if you want to enable printing functionality
//{$DEFINECSS_CASESENSITIVE_CLASSID}
//{$DEFINE IP_LAZARUS_DBG}
// (requires extra build/runtime dependencies for Linux like cairo,etc)
{$DEFINE Html_print}
//{$DEFINE Html_print}
// we do not want to include PNG support when building the design-time package
// (that would cause problems if another package also included ZLib). We also
// do not want to include units that aren't ours, so we'll undefine the other
// graphics stuff too. When rebuilding the design-time package, the
// 'BuildingDesignTime' define must be defined
{$IFDEF BuildingDesignTime}
{$UNDEF UseGifImageUnit}
{$UNDEF AndersGIFImage}
{$UNDEF ImageLibGIFImage}
{$UNDEF UsePNGGraphic}
{$DEFINE HtmlWithoutHttp}
{$ENDIF}
// Uncomment if you want to disable RTTI access to properties of the HTML nodes
//{$DEFINE Html_RTTI}
{-------- !! DO NOT CHANGE DEFINES BELOW THIS LINE !! --------}
{ Compiler stoppers for unsupported compilers }
{$IFDEF VER80}
!!! Internet Professional does not support Delphi 1
{$ENDIF}
{$IFDEF VER90}
!!! Internet Professional does not support Delphi 2
{$ENDIF}
{$IFDEF VER93}
!!! Internet Professional does not support C++Builder 1
{$ENDIF}
{$DEFINE VERSION3} { Delphi 3.0 or BCB 3.0 or higher }
{ General define indicating use under C++ Builder }
{$IFDEF VER110} { C++ Builder 3 }
{$DEFINE CBuilder}
{$ObjExportAll On}
{$ENDIF}
{$IFDEF VER125} { C++ Builder 4 }
{$DEFINE CBuilder}
{$ObjExportAll On}
{$ENDIF}
{$IFDEF VER130} { Delphi 5 & C++ Builder 5 }
{$IFDEF BCB} { C++ Builder 5 }
{$DEFINE CBuilder}
{$ObjExportAll On}
{$ENDIF}
{$ENDIF}
{$IFDEF VER140} { Delphi 6 & C++Builder 6 }
{$IFDEF BCB} { C++ Builder 6}
{$DEFINE CBuilder}
{$ObjExportAll On}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION3}
{$IFNDEF VER100} { Delphi 3 }
{$IFNDEF VER110} { BCB 3 }
{$DEFINE VERSION4} { Delphi 4.0 or higher }
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION4}
{$IFNDEF VER120} { Delphi 4 }
{$IFNDEF VER125} { BCB 4 }
{$DEFINE VERSION5} { Delphi 5.0 or higher }
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION3}
{$IFNDEF VERSION4}
{$DEFINE VERSION3ONLY}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION3}
{$IFDEF VER140}
{$DEFINE VERSION6} { Delphi 6.0 or higher }
{$DEFINE Version6OrHigher}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION3}
{$IFDEF VER150}
{$DEFINE VERSION7} { Delphi 7.0 or higher }
{$DEFINE Version6OrHigher}
{$DEFINE Version7OrHigher}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION7}
{$WARN UNIT_PLATFORM OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CAST OFF}
{$WARN UNIT_DEPRECATED OFF}
{$ENDIF}
{$ENDIF}
// TODO removing it from source code or enable it
//{$UNDEF UseGifImageUnit}
//{$UNDEF AndersGIFImage}
//{$UNDEF ImageLibGIFImage}
//{$UNDEF UsePNGGraphic}
//{$DEFINE HtmlWithoutHttp}

View File

@ -105,7 +105,6 @@ type
TIpAbstractHtmlDataProvider = class;
{.$DEFINE CSS_CASESENSITIVE_CLASSID}
{$DEFINE CSS_INTERFACE}
{$I ipcss.inc}
{$UNDEF CSS_INTERFACE}
@ -2740,16 +2739,12 @@ type
property Align;
property ALinkColor;
property AllowTextSelect;
{$IFDEF VERSION4}
property Anchors;
{$ENDIF}
property BgColor;
property BorderSpacing;
property BorderWidth;
property BorderStyle;
{$IFDEF VERSION4}
property Constraints;
{$ENDIF}
property DataProvider;
property Enabled;
property FixedTypeface;
@ -2773,12 +2768,8 @@ type
property VLinkColor;
property WantTabs;
property OnClick;
{$IFDEF VERSION4}
property OnConstrainedResize;
{$ENDIF}
{$IFDEF VERSION5}
property OnContextPopup;
{$ENDIF}
property OnControlClick;
property OnControlClick2;
property OnControlChange;
@ -3110,7 +3101,6 @@ begin
RegisterComponents('IPro', [TIpHtmlPanel]);
end;
{$IFNDEF VERSION3ONLY}
type
THtmlRadioButton = class(TRadioButton)
protected
@ -3169,8 +3159,6 @@ begin
end;
*)
{$ENDIF}
function GetAlignmentForStr(str: string;
pDefault: TIpHtmlAlign = haDefault) : TIpHtmlAlign;
var
@ -3938,7 +3926,6 @@ begin
FMax := -1;
end;
{ TIpHtmlNode }
function TIpHtmlNode.GetHint: string;
@ -4186,7 +4173,7 @@ function GetPropertyValue(PI: PPropInfo; const AObject: TObject): string;
function GetPropType : PTypeInfo;
begin
Result := PI.PropType{$IFDEF VERSION3}^{$ENDIF};
Result := PI.PropType;
end;
function GetIntegerProperty : string;
@ -4224,11 +4211,7 @@ function GetPropertyValue(PI: PPropInfo; const AObject: TObject): string;
function GetVariantProperty : string;
begin
{$IFDEF FPC}
Result := AnsiString(GetVariantProp(AObject, PI));
{$ELSE}
Result := GetVariantProp(AObject, PI);
{$ENDIF}
end;
function GetStringProperty : string;
@ -4281,7 +4264,7 @@ procedure SetPropertyValueLow(PI: PPropInfo;
function GetPropType : PTypeInfo;
begin
Result := PI.PropType{$IFDEF VERSION3}^{$ENDIF};
Result := PI.PropType;
end;
procedure SetIntegerProperty;
@ -4296,9 +4279,7 @@ procedure SetPropertyValueLow(PI: PPropInfo;
procedure SetEnumProperty;
begin
{$IFDEF VERSION5}
SetEnumProp(AObject, PI, NewValue);
{$ENDIF}
end;
procedure SetFloatProperty;
@ -4316,9 +4297,7 @@ procedure SetPropertyValueLow(PI: PPropInfo;
procedure SetSetProperty;
begin
{$IFDEF VERSION5}
SetSetProp(AObject, PI, NewValue);
{$ENDIF}
end;
begin
@ -11616,11 +11595,7 @@ begin
end;
hitRadio :
begin
{$IFDEF VERSION3ONLY}
with FControl do
{$ELSE}
with THtmlRadioButton(FControl) do
{$ENDIF}
Checked := Self.Checked;
end;
end;
@ -11708,18 +11683,10 @@ begin
end;
hitRadio :
begin
{$IFDEF VERSION3ONLY}
FControl := TRadioButton.Create(Parent);
{$ELSE}
FControl := THtmlRadioButton.Create(Parent);
{$ENDIF}
FControl.Tag := PtrInt(OwnerForm);
setCommonProperties;
{$IFDEF VERSION3ONLY}
with TRadioButton(FControl) do begin
{$ELSE}
with THtmlRadioButton(FControl) do begin
{$ENDIF}
Color := Brush.Color;
SetWidthHeight(1, 8, 0);
Checked := Self.Checked;
@ -11841,7 +11808,7 @@ begin
}
inherited;
if (Props.BgColor <> clNone) and (
(FControl is {$IFDEF VERSION3ONLY}TRadioButton{$ELSE}THtmlRadioButton{$ENDIF}) or
(FControl is THtmlRadioButton) or
(FControl is TCustomEdit)) then
FControl.Color := Props.BgColor;
end;
@ -11899,11 +11866,7 @@ begin
hitCheckbox :
Result := TCheckBox(FControl).Checked;
hitRadio :
{$IFDEF VERSION3ONLY}
Result := TRadioButton(FControl).Checked;
{$ELSE}
Result := THtmlRadioButton(FControl).Checked;
{$ENDIF}
hitFile :
Result := FFileEdit.Text <> '';
hitHidden :
@ -11935,11 +11898,7 @@ begin
hitCheckbox :
Checked := TCheckBox(FControl).Checked;
hitRadio :
{$IFDEF VERSION3ONLY}
Checked := TRadioButton(FControl).Checked;
{$ELSE}
Checked := THtmlRadioButton(FControl).Checked;
{$ENDIF}
end;
end;

View File

@ -114,18 +114,14 @@ function TIpHttpDataProvider.CheckURL(const AUrl: string;
var
VAddrRec: TIpAddrRec;
begin
{$IFDEF VER2_6}
FillChar(VAddrRec, SizeOf(TIpAddrRec), 0);
{$ELSE}
VAddrRec := Default(TIpAddrRec);
{$ENDIF}
Initialize(VAddrRec);
try
IpParseURL(AUrl, VAddrRec);
FDocumment.Clear;
FClient.Get(AUrl, FDocumment);
Result := (FClient.ResponseStatusCode = 200)
{$IF FPC_FULLVERSION > 30000}or FClient.IsRedirect(FClient.ResponseStatusCode){$ENDIF};
or FClient.IsRedirect(FClient.ResponseStatusCode);
if Result then
begin
FContentType := AllTrimSpaces(FClient.ResponseHeaders.Values['Content-Type']);

File diff suppressed because it is too large Load Diff

View File

@ -157,7 +157,7 @@ type
constructor CreateEmpty;
destructor Destroy; override;
procedure Flush; {!!.12}
procedure Flush;
{ Flush any unwritten changes to the stream. }
procedure FreeStream;
function ReadChar(var aCh : AnsiChar) : Boolean;
@ -211,7 +211,7 @@ type
destructor Destroy; override;
function AtEndOfStream : Boolean;
procedure bsInitForNewStream; override; {!!.01}
procedure bsInitForNewStream; override;
function ReadLine : string;
function ReadLineArray(aCharArray : PAnsiChar; aLen : Longint) : Longint;
function ReadLineZ(aSt : PAnsiChar; aMaxLen : Longint) : PAnsiChar;
@ -725,7 +725,6 @@ begin
raise EIpBaseException.Create(SCannotWriteToStream);
FDirty := false;
end;
{Begin !!.12}
{-----------------------------------------------------------------------------}
@ -734,7 +733,6 @@ begin
if FDirty then
bsWriteToStream;
end;
{End !!.12}
{-----------------------------------------------------------------------------}
@ -1482,7 +1480,6 @@ end;
{-----------------------------------------------------------------------------}
procedure TIpAnsiTextStream.WriteLine(const aSt : string);
{Rewritten !!.15}
begin
if Length(aSt) > 0 then
WriteLineArray(@aSt[1], length(aSt))
@ -1555,11 +1552,7 @@ begin
FHandle := THandle(FileOpen(FFileName, fmShareDenyNone + fmOpenReadWrite));
if (Handle = IpFileOpenFailed) then
{$IFDEF Version6OrHigher}
RaiseLastOSError;
{$ELSE}
RaiseLastWin32Error;
{$ENDIF}
RaiseLastOSError;
end;
destructor TIpDownloadFileStream.Destroy;
@ -1585,7 +1578,7 @@ begin
raise EIpBaseException.Create(SBadPath);
{ Create a new uniquely named file in that folder. }
FFileName := GetTemporaryFile(FPath); {!!.12}
FFileName := GetTemporaryFile(FPath);
end;
function TIpDownloadFileStream.Read(var Buffer; Count : Longint) : Longint;
@ -1618,14 +1611,8 @@ begin
{calculate the full new name}
NewFullName := FPath + '\' + aNewName;
{rename the file}
{$IFDEF Version6OrHigher}
{$IFNDEF IP_LAZARUS} //TODO need review
if not MoveFile(PAnsiChar(FFileName), PAnsiChar(NewFullName)) then
if not RenameFile(FFileName, NewFullName) then
RaiseLastOSError;
{$ENDIF}
{$ELSE}
Win32Check(MoveFile(PAnsiChar(FFileName), PAnsiChar(NewFullName)));
{$ENDIF}
{open up the same file, but with its new name}
FFileName := NewFullName;
try
@ -1635,11 +1622,7 @@ begin
end;
if (Handle = IpFileOpenFailed) then
{$IFDEF Version6OrHigher}
RaiseLastOSError;
{$ELSE}
RaiseLastWin32Error;
{$ENDIF}
FRenamed := true;
end;
@ -1650,16 +1633,9 @@ begin
{close the current handle}
//CloseHandle(Handle);
FHandle := IpFileOpenFailed;
{copy the file} {!!.01}
{$IFDEF Version6OrHigher}
{$IFNDEF IP_LAZARUS} //TODO Need review
if not CopyFile(PAnsiChar(FFileName), PAnsiChar(aNewName), False) then
{copy the file}
if not RenameFile(FFileName, aNewName) then
RaiseLastOSError;
{$ENDIF}
{$ELSE}
Win32Check(CopyFile(PAnsiChar(FFileName), {!!.01}
PAnsiChar(aNewName), False)); {!!.01}
{$ENDIF}
{open up the same file, but with its new name}
FFileName := aNewName;
@ -1670,11 +1646,7 @@ begin
end;
if (Handle = IpFileOpenFailed) then
{$IFDEF Version6OrHigher}
RaiseLastOSError;
{$ELSE}
RaiseLastWin32Error;
{$ENDIF}
FRenamed := true;
end;

View File

@ -1156,7 +1156,7 @@ end;
function IpParseURL(const URL : string; var Rslt : TIpAddrRec) : Boolean;
{ Splits URL into components }
{!!.03 -- rewritten
{ -- rewritten
- Parsing UserName and Password fields out of Mailto: urls of the form:
mailto:user:pass@myserver.net
- Username and Password fields added to TIpAddrRec in support of
@ -2020,7 +2020,7 @@ Canonical Internet header date strings are in one of three standard formats:
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
}
{!!.03 -- rewritten to handle common variants such as the Day or Month name
{-- rewritten to handle common variants such as the Day or Month name
to be fully spelled out where they are not in the canonical form, or to have
a 4 digit year in the RFC 850 style
}
@ -2668,13 +2668,11 @@ begin
Result:=DirPathExists(Dir);
end;
{Begin !!.12}
{ Get temporary filename as string }
function GetTemporaryFile(const Path : string) : string;
begin
Result:=GetTempFileNameUTF8(Path,'IP_');
end;
{End !!.12}
{ Get Windows system TEMP path in a string }
function GetTemporaryPath: string;