TurboPower_ipro: Remove access classes for protected members. Make stuff public when needed.

This commit is contained in:
Juha 2024-02-12 09:26:27 +02:00
parent dab39f77d5
commit 76da2aad75
2 changed files with 238 additions and 271 deletions

View File

@ -148,6 +148,13 @@ type
var Min, Max: Integer); virtual; abstract;
procedure CalcSize(ParentWidth: Integer; RenderProps: TIpHtmlProps); virtual; abstract;
function GetColCount: Integer; virtual; abstract;
public
property Min: Integer read FMin;
property Max: Integer read FMax;
property TableWidth: Integer read FTableWidth;
property CellSpacing: Integer read FCellSpacing write FCellSpacing;
property CellPadding: Integer read FCellPadding write FCellPadding;
property RowSp: TIntArr read FRowSp;
end;
TIpHtmlBaseTableLayouterClass = class of TIpHtmlBaseTableLayouter;
@ -180,12 +187,6 @@ type
procedure ScreenFrame(R : TRect; Raised: boolean);
procedure ScreenPolygon(Points : array of TPoint; const Color : TColor);
function PagePtToScreen(const Pt: TPoint): TPoint;
procedure Enqueue; virtual;
procedure EnqueueElement(const Entry: PIpHtmlElement); virtual;
function ElementQueueIsEmpty: Boolean; virtual;
procedure ReportDrawRects(M : TRectMethod); virtual;
procedure ReportCurDrawRects(Owner: TIpHtmlNode; M : TRectMethod); virtual;
procedure ReportMapRects(M : TRectMethod); virtual;
procedure Invalidate; virtual;
procedure InvalidateSize; virtual;
procedure SubmitRequest; virtual;
@ -201,9 +202,15 @@ type
public
constructor Create(ParentNode : TIpHtmlNode);
destructor Destroy; override;
procedure Enqueue; virtual;
procedure EnqueueElement(const Entry: PIpHtmlElement); virtual;
function ElementQueueIsEmpty: Boolean; virtual;
function ExpParentWidth: Integer; virtual;
procedure ImageChange(NewPicture : TPicture); virtual;
function PageRectToScreen(const Rect : TRect; var ScreenRect: TRect): Boolean;
procedure ReportDrawRects(M : TRectMethod); virtual;
procedure ReportCurDrawRects(Owner: TIpHtmlNode; M : TRectMethod); virtual;
procedure ReportMapRects(M : TRectMethod); virtual;
procedure GetAttributes(Target: TStrings; IncludeValues, IncludeBlanks: Boolean);
procedure SetAttributeValue(const AttrName, NewValue: string);
procedure SetProps(const RenderProps: TIpHtmlProps); virtual;
@ -214,13 +221,13 @@ type
TIpHtmlNodeNv = class(TIpHtmlNode)
protected
procedure Invalidate; override;
procedure InvalidateSize; override;
public
procedure Enqueue; override;
procedure EnqueueElement(const Entry: PIpHtmlElement); override;
function ElementQueueIsEmpty: Boolean; override;
procedure ReportDrawRects(M : TRectMethod); override;
procedure Invalidate; override;
procedure InvalidateSize; override;
procedure Enqueue; override;
public
procedure SetProps(const RenderProps: TIpHtmlProps); override;
end;
@ -231,8 +238,6 @@ type
function GetChildNode(Index: Integer): TIpHtmlNode;
function GetChildCount: Integer;
protected
procedure ReportDrawRects(M : TRectMethod); override;
procedure ReportMapRects(M : TRectMethod); override;
procedure AppendSelection(var S : string; var Completed: Boolean); override;
procedure EnumChildren(EnumProc: TIpHtmlNodeEnumProc; UserData: Pointer); override;
function GetMargin(AMargin: TIpHtmlElemMargin; ADefault: Integer): Integer; override;
@ -240,6 +245,8 @@ type
constructor Create(ParentNode : TIpHtmlNode);
destructor Destroy; override;
procedure Enqueue; override;
procedure ReportDrawRects(M : TRectMethod); override;
procedure ReportMapRects(M : TRectMethod); override;
procedure SetProps(const RenderProps: TIpHtmlProps); override;
public
property ChildCount : Integer read GetChildCount;
@ -290,9 +297,10 @@ type
TIpHtmlNodeInline = class(TIpHtmlNodeCore)
protected
procedure Invalidate; override;
public
procedure EnqueueElement(const Entry: PIpHtmlElement); override;
function ElementQueueIsEmpty: Boolean; override;
procedure Invalidate; override;
end;
TIpHtmlNodeAlignInline = class(TIpHtmlNodeInline)
@ -367,13 +375,9 @@ type
FBackground : string;
FBgColor : TColor;
FTextColor : TColor;
procedure EnqueueElement(const Entry: PIpHtmlElement); override;
function ElementQueueIsEmpty: Boolean; override;
procedure CalcMinMaxPropWidth(RenderProps: TIpHtmlProps; var aMin, aMax: Integer); virtual;
procedure Invalidate; override;
function GetHeight(const RenderProps: TIpHtmlProps; const Width: Integer): Integer;
procedure InvalidateSize; override;
procedure ReportCurDrawRects(aOwner: TIpHtmlNode; M : TRectMethod); override;
procedure AppendSelection(var S : string; var Completed: Boolean); override;
procedure SetBackground(const AValue: string);
procedure SetBgColor(const AValue: TColor);
@ -382,10 +386,14 @@ type
constructor Create(ParentNode : TIpHtmlNode; LayouterClass: TIpHtmlBaseLayouterClass); overload;
constructor Create(ParentNode : TIpHtmlNode); overload;
destructor Destroy; override;
procedure EnqueueElement(const Entry: PIpHtmlElement); override;
function ElementQueueIsEmpty: Boolean; override;
procedure InvalidateSize; override;
procedure Layout(RenderProps: TIpHtmlProps; const TargetRect : TRect); virtual;
procedure Render(RenderProps: TIpHtmlProps); virtual;
function Level0: Boolean;
procedure LoadAndApplyCSSProps; override;
procedure ReportCurDrawRects(aOwner: TIpHtmlNode; M : TRectMethod); override;
public
property Layouter : TIpHtmlBaseLayouter read FLayouter;
property PageRect : TRect read GetPageRect;
@ -411,10 +419,9 @@ type
FMedia: string;
FTitle: string;
FType: string;
protected
public
procedure EnqueueElement(const Entry: PIpHtmlElement); override;
function ElementQueueIsEmpty: Boolean; override;
public
{$IFDEF HTML_RTTI}
published
{$ENDIF}
@ -685,22 +692,8 @@ type
FBody : TIpHtmlNodeBODY;
FTitleNode : TIpHtmlNodeTITLE;
FDataProvider: TIpAbstractHtmlDataProvider;
{$IFDEF UseGifImageUnit}
GifImages : TFPList;
{$ELSE}
AnimationFrames : TFPList;
{$ENDIF}
FLIndent, FLOutdent : PIpHtmlElement;
SoftLF,
HardLF, HardLFClearLeft, SoftHyphen,
HardLFClearRight, HardLFClearBoth : PIpHtmlElement;
NameList : TStringList;
IdList: TStringList;
GifQueue : TFPList;
MapList : TFPList;
AreaList : TFPList;
DefaultImage : TPicture;
MapImgList : TFPList;
PaintBufferBitmap : TBitmap;
PaintBuffer : TCanvas;
Destroying : Boolean;
@ -708,18 +701,12 @@ type
RectList : TFPList;
FStartSel, FEndSel : TPoint;
ElementPool : TIpHtmlPoolManager;
AnchorList : TFPList;
FControlList : TFPList;
FCurURL : string;
DoneLoading : Boolean;
PropACache : TIpHtmlPropsAList;
PropBCache : TIpHtmlPropsBList;
RenderCanvas : TCanvas;
FPageHeight : Integer;
FFixedTypeface: string;
FDefaultTypeFace: string;
FDefaultFontSize: integer;
FControlParent: TWinControl;
procedure ResetCanvasData;
procedure ResetWordLists;
procedure ResetBlocks(Node: TIpHtmlNode);
@ -728,29 +715,18 @@ type
function CheckKnownURL(URL: string): boolean;
procedure ReportReference(URL: string);
procedure PaintSelection;
function NewElement(EType : TElementType; Own: TIpHtmlNode) : PIpHtmlElement;
function BuildStandardEntry(EType: TElementType): PIpHtmlElement;
function BuildLinefeedEntry(EType: TElementType; AHeight: Integer): PIpHtmlElement;
function FindAttribute(const AttrNameSet: TIpHtmlAttributesSet): string;
procedure Parse;
procedure InvalidateRect(R : TRect);
procedure SetDefaultProps;
function BuildPath(const Ext: string): string;
procedure MakeVisible(const R: TRect; ShowAtTop: Boolean = True);
procedure InvalidateSize;
procedure AddGifQueue(Graphic: TGraphic; const R: TRect);
procedure ClearGifQueue;
procedure StartGifPaint(Target: TCanvas);
procedure ClearAreaLists;
procedure BuildAreaList;
procedure ClearAreaList;
procedure Get(const URL: string);
procedure Post(const URL: string; FormData: TIpFormDataEntity);
procedure ClearRectList;
procedure CreateIFrame(Parent: TWinControl; Frame: TIpHtmlNodeIFRAME; var Control: TWinControl);
procedure FinalizeRecs(P: Pointer);
function LinkVisited(const URL: string): Boolean;
procedure AddWord(Value: string; Props: TIpHtmlProps; Owner: TIpHtmlNode);
procedure AddWordEntry(const Value: string; Props: TIpHtmlProps; Owner: TIpHtmlNode);
function FindElement(const Name: string): TIpHtmlNode;
function FindElementId(const Id: String): TIpHtmlNode;
@ -766,11 +742,6 @@ type
procedure RequestImageNodes(Node: TIpHtmlNode);
procedure SelectAll;
procedure DeselectAll;
procedure ControlClick(Sender: TIpHtmlNodeControl);
procedure ControlClick2(Sender: TIpHtmlNodeControl; var cancel: boolean);
procedure ControlOnEditingDone(Sender: TIpHtmlNodeControl);
procedure ControlOnChange(Sender: TIpHtmlNodeControl);
procedure ControlCreate(Sender: TIpHtmlNodeControl);
property HotNode: TIpHtmlNode read FHotNode;
property CurElement: PIpHtmlElement read FCurElement write FCurElement;
property HotPoint: TPoint read FHotPoint;
@ -780,7 +751,6 @@ type
property VLinkColor: TColor read FVLinkColor write FVLinkColor;
property ALinkColor: TColor read FALinkColor write FALinkColor;
property BgColor: TColor read FBgColor write FBgColor;
property LinksUnderlined: Boolean read FLinksUnderlined write FLinksUnderlined;
property HasFrames: Boolean read FHasFrames;
property OnGetImageX: TIpHtmlDataGetImageEvent read FOnGetImageX write FOnGetImageX;
property OnScroll: TIpHtmlScrollEvent read FOnScroll write FOnScroll;
@ -798,18 +768,55 @@ type
property CanPaint: Boolean read FCanPaint;
property MarginWidth: Integer read FMarginWidth write FMarginWidth default 20;
property MarginHeight: Integer read FMarginHeight write FMarginHeight default 20;
procedure DoGetImage(Sender: TIpHtmlNode; const URL: string; var Picture: TPicture);
function GetSelectionBlocks(out StartSelIndex,EndSelIndex: Integer): boolean;
function getControlCount:integer;
function getControl(i:integer):TIpHtmlNode;
public
ControlParent: TWinControl;
DoneLoading : Boolean;
SoftLF, HardLF, SoftHyphen,
HardLFClearLeft, HardLFClearRight, HardLFClearBoth : PIpHtmlElement;
LIndent, LOutdent : PIpHtmlElement;
AnchorList : TFPList;
AreaList : TFPList;
ControlList : TFPList;
MapList : TFPList;
NameList : TStringList;
PropACache : TIpHtmlPropsAList;
PropBCache : TIpHtmlPropsBList;
MapImgList : TFPList;
DefaultImage : TPicture;
{$IFDEF UseGifImageUnit}
GifImages : TFPList;
{$ELSE}
AnimationFrames : TFPList;
{$ENDIF}
public
constructor Create;
destructor Destroy; override;
procedure AddGifQueue(Graphic: TGraphic; const R: TRect);
procedure AddRect(const R: TRect; AElement: PIpHtmlElement; ABlock: TIpHtmlNodeBlock);
procedure AddWord(Value: string; Props: TIpHtmlProps; Owner: TIpHtmlNode);
function BuildStandardEntry(EType: TElementType): PIpHtmlElement;
function BuildLinefeedEntry(EType: TElementType; AHeight: Integer): PIpHtmlElement;
function BuildPath(const Ext: string): string;
procedure ClearAreaList;
procedure ControlCreate(Sender: TIpHtmlNodeControl);
procedure ControlClick(Sender: TIpHtmlNodeControl);
procedure ControlClick2(Sender: TIpHtmlNodeControl; var cancel: boolean);
procedure ControlOnChange(Sender: TIpHtmlNodeControl);
procedure ControlOnEditingDone(Sender: TIpHtmlNodeControl);
procedure DoGetImage(Sender: TIpHtmlNode; const URL: string; var Picture: TPicture);
procedure FixMissingBodyTag;
procedure Get(const URL: string);
procedure InvalidateRect(R : TRect);
function LinkVisited(const URL: string): Boolean;
property LinksUnderlined: Boolean read FLinksUnderlined write FLinksUnderlined;
procedure LoadFromStream(S : TStream);
function NewElement(EType : TElementType; Own: TIpHtmlNode) : PIpHtmlElement;
function PagePtToScreen(const Pt: TPoint): TPoint;
function PageRectToScreen(const Rect: TRect; var ScreenRect: TRect): Boolean;
procedure AddRect(const R: TRect; AElement: PIpHtmlElement; ABlock: TIpHtmlNodeBlock);
procedure FixMissingBodyTag;
procedure LoadFromStream(S : TStream);
procedure Post(const URL: string; FormData: TIpFormDataEntity);
procedure Render(TargetCanvas: TCanvas; TargetPageRect : TRect;
UsePaintBuffer: Boolean; const TopLeft: TPoint); overload;
procedure Render(TargetCanvas: TCanvas; TargetPageRect: TRect;
@ -2926,8 +2933,8 @@ begin
HardLFClearLeft := BuildStandardEntry(etClearLeft);
HardLFClearRight := BuildStandardEntry(etClearRight);
HardLFClearBoth := BuildStandardEntry(etClearBoth);
FLIndent := BuildStandardEntry(etIndent);
FLOutdent := BuildStandardEntry(etOutdent);
LIndent := BuildStandardEntry(etIndent);
LOutdent := BuildStandardEntry(etOutdent);
SoftHyphen := BuildStandardEntry(etSoftHyphen);
DefaultProps := TIpHtmlProps.Create(PropACache, PropBCache);
FHtml := TIpHtmlNodeHtml.Create(nil);
@ -2937,7 +2944,7 @@ begin
AreaList := TFPList.Create;
MapImgList := TFPList.Create;
RectList := TFPList.Create;
FControlList := TFPList.Create;
ControlList := TFPList.Create;
LinkColor := clBlue;
VLinkColor := clPurple;
ALinkColor := clRed;
@ -3048,7 +3055,7 @@ begin
ClearRectList;
RectList.Free;
MapImgList.Free;
FControlList.Free;
ControlList.Free;
DefaultProps.Free;
FTabList.Free;
{$IFDEF UseGifImageUnit}
@ -3215,12 +3222,12 @@ end;
function TIpHtml.getControlCount:integer;
begin
result := FControlList.Count;
result := ControlList.Count;
end;
function TIpHtml.getControl(i:integer):TIpHtmlNode;
begin
result := FControlList[i];
result := ControlList[i];
end;
procedure TIpHtml.PaintSelection;
@ -3397,8 +3404,8 @@ begin
AggressiveDrawing := False;
{$ENDIF}
for i := 0 to Pred(FControlList.Count) do
TIpHtmlNode(FControlList[i]).UnmarkControl;
for i := 0 to Pred(ControlList.Count) do
TIpHtmlNode(ControlList[i]).UnmarkControl;
if NeedResize then
SetDefaultProps;
FPageViewRect := TargetPageRect;
@ -3427,8 +3434,8 @@ begin
if FHtml <> nil then
FHtml.Render(DefaultProps);
for i := 0 to Pred(FControlList.Count) do
TIpHtmlNode(FControlList[i]).HideUnmarkedControl;
for i := 0 to Pred(ControlList.Count) do
TIpHtmlNode(ControlList[i]).HideUnmarkedControl;
if UsePaintBuffer then
TargetCanvas.CopyRect(FClientRect, PaintBuffer, FClientRect)
else
@ -5077,13 +5084,13 @@ end;
constructor TIpHtmlNodeControl.Create(ParentNode: TIpHtmlNode);
begin
inherited Create(ParentNode);
Owner.FControlList.Add(Self);
Owner.ControlList.Add(Self);
Align := hiaBottom;
end;
destructor TIpHtmlNodeControl.Destroy;
begin
Owner.FControlList.Remove(Self);
Owner.ControlList.Remove(Self);
inherited;
end;
@ -6459,15 +6466,15 @@ begin
HyperPanel.OnHotClick := FViewer.HotClick;
HyperPanel.OnClick := FViewer.ClientClick;
HyperPanel.TabStop := FViewer.WantTabs;
FHtml.FControlParent := HyperPanel;
FHtml.ControlParent := HyperPanel;
FHtml.OnScroll := HyperPanel.ScrollRequest;
FHtml.OnControlClick := ControlClick;
FHtml.OnControlClick2 := ControlClick2;
FHtml.OnControlChange := ControlOnChange;
FHtml.OnControlEditingdone := ControlOnEditingDone;
FHtml.OnControlCreate := ControlCreate;
for i := 0 to Pred(FHtml.FControlList.Count) do
TIpHtmlNode(FHtml.FControlList[i]).CreateControl(HyperPanel);
for i := 0 to Pred(FHtml.ControlList.Count) do
TIpHtmlNode(FHtml.ControlList[i]).CreateControl(HyperPanel);
HyperPanel.Hyper := FHtml;
end;
end;

View File

@ -34,13 +34,13 @@ type
procedure BuildWordList;
protected
PropsR : TIpHtmlProps; {reference}
public
constructor Create(ParentNode : TIpHtmlNode);
destructor Destroy; override;
procedure ReportDrawRects(M : TRectMethod); override;
procedure Enqueue; override;
procedure EnqueueElement(const Entry: PIpHtmlElement); override;
function ElementQueueIsEmpty: Boolean; override;
public
constructor Create(ParentNode : TIpHtmlNode);
destructor Destroy; override;
procedure SetProps(const RenderProps: TIpHtmlProps); override;
{$IFDEF HTML_RTTI}
published
@ -737,8 +737,6 @@ type
FSize: TSize;
NetDrawRect: TRect;
SizeWidth: TIpHtmlPixels;
procedure ReportDrawRects(M : TRectMethod); override;
procedure ReportMapRects(M : TRectMethod); override;
function GetHint: string; override;
procedure InvalidateSize; override;
public
@ -755,6 +753,8 @@ type
function GrossDrawRect: TRect;
procedure LoadImage;
procedure UnloadImage;
procedure ReportDrawRects(M : TRectMethod); override;
procedure ReportMapRects(M : TRectMethod); override;
{$IFDEF HTML_RTTI}
published
{$ENDIF}
@ -848,7 +848,7 @@ type
function GetColCount: Integer;
public
FCaption: TIpHtmlNodeCAPTION;
FLayouter : TIpHtmlBaseTableLayouter;
FLayouter: TIpHtmlBaseTableLayouter;
BorderRect: TRect;
BorderRect2: TRect; {includes caption if any}
constructor Create(ParentNode : TIpHtmlNode);
@ -1167,15 +1167,6 @@ uses
{$ENDIF}
StrUtils, LazStringUtils;
type
// Helper classes to access protected class members
TIpHtmlOpener = class(TIpHtml);
TIpHtmlNodeOpener = class(TIpHtmlNode);
TIpHtmlNodeBlockOpener = class(TIpHtmlNodeBlock);
TIpHtmlBaseTableLayouterOpener = class(TIpHtmlBaseTableLayouter);
TFriendPanel = class(TCustomPanel);
type
THtmlRadioButton = class(TRadioButton)
protected
@ -1229,12 +1220,9 @@ end;
{ TIpHtmlNodeText }
constructor TIpHtmlNodeText.Create(ParentNode : TIpHtmlNode);
var
lOwner: TIpHtmlOpener;
begin
inherited Create(ParentNode);
lOwner := TIpHtmlOpener(FOwner);
PropsR := TIpHtmlProps.Create(lOwner.PropACache, lOwner.PropBCache);
PropsR := TIpHtmlProps.Create(FOwner.PropACache, FOwner.PropBCache);
end;
destructor TIpHtmlNodeText.Destroy;
@ -1261,9 +1249,9 @@ end;
procedure TIpHtmlNodeText.AddAWord(StartP: PAnsiChar);
begin
if FFirstW then
TIpHtmlOpener(Owner).AddWord(StartP, PropsR, Self)
Owner.AddWord(StartP, PropsR, Self)
else
TIpHtmlOpener(Owner).AddWord(StartP, nil, Self);
Owner.AddWord(StartP, nil, Self);
FFirstW := False;
end;
@ -1290,14 +1278,14 @@ begin
ImplicitLF := True;
LF :
begin
EnqueueElement(TIpHtmlOpener(Owner).HardLF);
EnqueueElement(Owner.HardLF);
Inc(N);
ImplicitLF := False;
end;
else
begin
if ImplicitLF then begin
EnqueueElement(TIpHtmlOpener(Owner).HardLF);
EnqueueElement(Owner.HardLF);
Inc(N);
ImplicitLF := False;
end;
@ -1327,13 +1315,13 @@ begin
case N^ of
LF :
begin
EnqueueElement(TIpHtmlOpener(Owner).HardLF);
EnqueueElement(Owner.HardLF);
Inc(N);
end;
' ' :
begin
if not ElementQueueIsEmpty then begin
NewEntry := TIpHtmlOpener(Owner).NewElement(etWord, Self);
NewEntry := Owner.NewElement(etWord, Self);
NewEntry.AnsiWord := ' ';
NewEntry.IsBlank := 1;
if FFirstW then
@ -1389,13 +1377,13 @@ end;
procedure TIpHtmlNodeText.EnqueueElement(const Entry: PIpHtmlElement);
begin
TIpHtmlNodeOpener(FParentNode).EnqueueElement(Entry);
FParentNode.EnqueueElement(Entry);
end;
function FindInnerBlock(Node : TIpHTMLNode): TIpHtmlNodeBlock;
begin
while (Node <> nil) and not (Node is TIpHtmlNodeBlock) do
Node := TIpHtmlNodeOpener(Node).FParentNode;
Node := Node.ParentNode;
Result := TIpHtmlNodeBlock(Node);
end;
@ -1414,11 +1402,11 @@ begin
exit;
{we need to clear the queue so that it will be built again}
TIpHtmlNodeBlockOpener(Block).FLayouter.ClearWordList;
Block.Layouter.ClearWordList;
{then, we need to Invalidate the block so that
the rendering logic recalculates everything}
TIpHtmlNodeBlockOpener(Block).InvalidateSize;
Block.InvalidateSize;
end;
procedure TIpHtmlNodeText.ReportDrawRects(M: TRectMethod);
@ -1428,7 +1416,7 @@ end;
function TIpHtmlNodeText.ElementQueueIsEmpty: Boolean;
begin
Result := TIpHtmlNodeOpener(FParentNode).ElementQueueIsEmpty;
Result := FParentNode.ElementQueueIsEmpty;
end;
@ -1442,9 +1430,9 @@ destructor TIpHtmlNodeAREA.Destroy;
var
I: Integer;
begin
I := TIpHtmlOpener(Owner).AreaList.IndexOf(Self);
I := Owner.AreaList.IndexOf(Self);
if I <> -1 then
TIpHtmlOpener(Owner).AreaList.Delete(I);
Owner.AreaList.Delete(I);
inherited;
end;
@ -1569,12 +1557,12 @@ end;
constructor TIpHtmlNodeMAP.Create(ParentNode: TIpHtmlNode);
begin
inherited;
TIpHtmlOpener(Owner).MapList.Add(Self);
Owner.MapList.Add(Self);
end;
destructor TIpHtmlNodeMAP.Destroy;
begin
TIpHtmlOpener(Owner).MapList.Remove(Self);
Owner.MapList.Remove(Self);
inherited;
end;
@ -1825,7 +1813,7 @@ end;
destructor TIpHtmlNodeA.Destroy;
begin
if HasRef then
TIpHtmlOpener(Owner).AnchorList.Remove(Self);
Owner.AnchorList.Remove(Self);
inherited;
MapAreaList.Free;
end;
@ -1868,7 +1856,7 @@ var
begin
inherited;
for i := 0 to Pred(ChildCount) do
TIpHtmlNodeOpener(ChildNode[i]).ReportMapRects(AddMapArea);
ChildNode[i].ReportMapRects(AddMapArea);
end;
function TIpHtmlNodeA.PtInRects(const P: TPoint): Boolean;
@ -1917,7 +1905,7 @@ begin
SetProps(Props);
for i := 0 to Pred(FAreaList.Count) do
if PageRectToScreen(PRect(FAreaList[i])^, R) then
TIpHtmlOpener(Owner).InvalidateRect(R);
Owner.InvalidateRect(R);
end;
procedure TIpHtmlNodeA.SetHRef(const Value: string);
@ -1928,9 +1916,9 @@ begin
NewHasRef := Value <> '';
if NewHasRef <> HasRef then begin
if HasRef then
TIpHtmlOpener(Owner).AnchorList.Remove(Self)
Owner.AnchorList.Remove(Self)
else
TIpHtmlOpener(Owner).AnchorList.Add(Self);
Owner.AnchorList.Add(Self);
FHasRef := NewHasRef;
end;
end;
@ -1951,11 +1939,11 @@ end;
procedure TIpHtmlNodeA.SetName(const Value: string);
begin
if FName <> '' then
with TIpHtmlOpener(Owner).NameList do
with Owner.NameList do
Delete(IndexOf(FName));
FName := Value;
if FName <> '' then
TIpHtmlOpener(Owner).NameList.AddObject(FName, Self);
Owner.NameList.AddObject(FName, Self);
end;
(*
procedure TIpHtmlNodeA.MakeVisible;
@ -1982,11 +1970,11 @@ begin
Props.FontStyle := Props.FontStyle + [fsUnderline];
end else
if HasRef then begin
if TIpHtmlOpener(Owner).LinksUnderlined then
if Owner.LinksUnderlined then
Props.FontStyle := Props.FontStyle + [fsUnderline]
else
Props.FontStyle := Props.FontStyle - [fsUnderline];
if TIpHtmlOpener(Owner).LinkVisited(HRef) then
if Owner.LinkVisited(HRef) then
Props.FontColor := Props.VLinkColor
else
Props.FontColor := Props.LinkColor;
@ -2032,15 +2020,15 @@ var
begin
// display: block;
hf := Props.FontSize;
elem := TIpHtmlOpener(Owner).BuildLinefeedEntry(etHardLF, hf);
elem := Owner.BuildLinefeedEntry(etHardLF, hf);
EnqueueElement(elem);
EnqueueElement(TIpHtmlOpener(Owner).FLIndent);
EnqueueElement(Owner.LIndent);
inherited;
EnqueueElement(TIpHtmlOpener(Owner).FLOutdent);
EnqueueElement(Owner.LOutdent);
// close the block
elem := TIpHtmlOpener(Owner).BuildLinefeedEntry(etHardLF, hf);
elem := Owner.BuildLinefeedEntry(etHardLF, hf);
EnqueueElement(elem);
end;
@ -2075,15 +2063,15 @@ begin
case Clear of
hbcNone :
begin
elem := TIpHtmlOpener(Owner).BuildLinefeedEntry(etHardLF, h);
elem := Owner.BuildLinefeedEntry(etHardLF, h);
EnqueueElement(elem);
end;
hbcLeft :
EnqueueElement(TIpHtmlOpener(Owner).HardLFClearLeft);
EnqueueElement(Owner.HardLFClearLeft);
hbcRight :
EnqueueElement(TIpHtmlOpener(Owner).HardLFClearRight);
EnqueueElement(Owner.HardLFClearRight);
hbcAll :
EnqueueElement(TIpHtmlOpener(Owner).HardLFClearBoth);
EnqueueElement(Owner.HardLFClearBoth);
end;
end;
@ -2119,16 +2107,16 @@ var
begin
// avoid top and bottom margins... they're always inherited from DL
if ChildCount > 0 then begin
elem := TIpHtmlOpener(Owner).BuildLineFeedEntry(etSoftLF, 0);
elem := Owner.BuildLineFeedEntry(etSoftLF, 0);
EnqueueElement(elem);
end;
EnqueueElement(TIpHtmlOpener(Owner).FLIndent);
EnqueueElement(Owner.LIndent);
inherited;
EnqueueElement(TIpHtmlOpener(Owner).FLOutdent);
EnqueueElement(Owner.LOutdent);
if ChildCount > 0 then begin
elem := TIpHtmlOpener(Owner).BuildLineFeedEntry(etSoftLF, 0);
elem := Owner.BuildLineFeedEntry(etSoftLF, 0);
EnqueueElement(elem);
end;
end;
@ -2185,13 +2173,13 @@ begin
//hf := Props.FontSize;
if ChildCount > 0 then begin
h := GetMargin(Props.ElemMarginTop, 0); //hf div 4);
elem := TIpHtmlOpener(Owner).BuildLinefeedEntry(etSoftLF, h);
elem := Owner.BuildLinefeedEntry(etSoftLF, h);
EnqueueElement(elem);
end;
inherited Enqueue;
if ChildCount > 0 then begin
h := GetMargin(Props.ElemMarginBottom, 0); //hf div 4);
elem := TIpHtmlOpener(Owner).BuildLinefeedEntry(etSoftLF, h);
elem := Owner.BuildLinefeedEntry(etSoftLF, h);
EnqueueElement(elem);
end;
end;
@ -2234,18 +2222,18 @@ begin
// display block
hf := Props.FontSize;
h := GetMargin(Props.ElemMarginTop, hf);
elem := TIpHtmlOpener(Owner).BuildLinefeedEntry(etHardLF, h);
elem := Owner.BuildLinefeedEntry(etHardLF, h);
EnqueueElement(elem);
// indent not needed here
// EnqueueElement(TIpHtmlOpener(Owner).FLIndent);
// EnqueueElement(Owner.LIndent);
inherited;
// outdent not needed here
// EnqueueElement(TIpHtmlOpener(Owner).FLOutdent);
// EnqueueElement(Owner.LOutdent);
// close the block
h := GetMargin(Props.ElemMarginBottom, hf);
elem := TIpHtmlOpener(Owner).BuildLinefeedEntry(etHardLF, h);
elem := Owner.BuildLinefeedEntry(etHardLF, h);
EnqueueElement(elem);
end;
@ -2270,7 +2258,7 @@ begin
begin
hf := Props.FontSize;
h := 3 * (hf div 8);
elem := TIPHtmlOpener(Owner).BuildLinefeedEntry(etSoftLF, h);
elem := Owner.BuildLinefeedEntry(etSoftLF, h);
EnqueueElement(elem);
end;
@ -2282,7 +2270,7 @@ begin
begin
hf := Props.FontSize;
h := hf div 8;
elem := TIPHtmlOpener(Owner).BuildLinefeedEntry(etSoftLF, h);
elem := Owner.BuildLinefeedEntry(etSoftLF, h);
EnqueueElement(elem);
end;
end;
@ -2380,10 +2368,10 @@ var
begin
case Method of
hfmGet :
TIpHtmlOpener(Owner).Get(Action + '?' + URLData);
Owner.Get(Action + '?' + URLData);
hfmPost :
begin
TIpHtmlOpener(Owner).Post(Action, FormData);
Owner.Post(Action, FormData);
{The Formdata object will be freed by the post logic,
which is called asynchroneously via PostMessage.
Clear the pointer to prevent our finalization
@ -2447,7 +2435,7 @@ end;
constructor TIpHtmlNodeGenInline.Create(ParentNode: TIpHtmlNode);
begin
inherited Create(ParentNode);
Props := TIpHtmlProps.Create(TIpHtmlOpener(Owner).PropACache, TIpHtmlOpener(Owner).PropBCache);
Props := TIpHtmlProps.Create(Owner.PropACache, Owner.PropBCache);
end;
destructor TIpHtmlNodeGenInline.Destroy;
@ -2468,12 +2456,12 @@ end;
constructor TIpHtmlNodeLABEL.Create(ParentNode: TIpHtmlNode);
begin
inherited Create(ParentNode);
TIpHtmlOpener(Owner).FControlList.Add(Self);
Owner.ControlList.Add(Self);
end;
destructor TIpHtmlNodeLABEL.Destroy;
begin
TIpHtmlOpener(Owner).FControlList.Remove(Self);
Owner.ControlList.Remove(Self);
inherited;
end;
@ -2483,12 +2471,8 @@ end;
procedure TIpHtmlNodeList.Enqueue;
var
i, hf: Integer;
lOwner: TIpHtmlOpener;
lParentNode: TIpHtmlNodeOpener;
elem: PIpHtmlElement;
begin
lOwner := TIpHtmlOpener(Owner);
lParentNode := TIpHtmlNodeOpener(FParentNode);
hf := Props.FontSize;
if ChildCount > 0 then begin
@ -2497,20 +2481,20 @@ begin
(FParentNode is TIpHtmlNodeList) or
(FParentNode is TIpHtmlNodeLI) then
begin
elem := lOwner.BuildLineFeedEntry(etHardLF, 0);
lParentNode.EnqueueElement(elem);
elem := lOwner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
lParentNode.EnqueueElement(elem);
lParentNode.EnqueueElement(lOwner.FLIndent);
elem := Owner.BuildLineFeedEntry(etHardLF, 0);
ParentNode.EnqueueElement(elem);
elem := Owner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
ParentNode.EnqueueElement(elem);
ParentNode.EnqueueElement(Owner.LIndent);
end
// start block container and inline block for list items
else
begin
elem := lOwner.BuildLineFeedEntry(etHardLF, hf);
elem := Owner.BuildLineFeedEntry(etHardLF, hf);
EnqueueElement(elem);
elem := lOwner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
elem := Owner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
EnqueueElement(elem);
EnqueueElement(lOwner.FLIndent);
EnqueueElement(Owner.LIndent);
end;
end;
@ -2521,28 +2505,28 @@ begin
if (ChildNode[i] is TIpHtmlNodeLI) then
begin
TIpHtmlNodeLI(ChildNode[i]).Enqueue;
elem := lOwner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
elem := Owner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
EnqueueElement(elem);
end
// handle a nested list
else
TIpHtmlNodeOpener(ChildNode[i]).Enqueue;
ChildNode[i].Enqueue;
end;
if ChildCount > 0 then begin
// close inline block
lParentNode.EnqueueElement(lOwner.FLOutdent);
elem := lOwner.BuildLineFeedEntry(etSoftLF, 0);
ParentNode.EnqueueElement(Owner.LOutdent);
elem := Owner.BuildLineFeedEntry(etSoftLF, 0);
EnqueueElement(elem);
// nested list has different bottom margin
if (FParentNode is TIpHtmlNodeOL) or
(FParentNode is TIpHtmlNodeList) or
(FParentNode is TIpHtmlNodeLI) then
elem := lOwner.BuildLineFeedEntry(etSoftLF, hf div 8)
elem := Owner.BuildLineFeedEntry(etSoftLF, hf div 8)
// close the block
else
elem := lOwner.BuildLineFeedEntry(etHardLF, 3 * (hf div 8));
elem := Owner.BuildLineFeedEntry(etHardLF, 3 * (hf div 8));
EnqueueElement(elem);
end;
@ -2622,7 +2606,7 @@ begin
// start block with top margin
if (ChildCount > 0) then begin
h := GetMargin(Props.ElemMarginTop, hf);
elem := TIpHtmlOpener(Owner).BuildLineFeedEntry(etHardLF, h);
elem := Owner.BuildLineFeedEntry(etHardLF, h);
EnqueueElement(elem);
end;
@ -2631,7 +2615,7 @@ begin
// close block with optional bottom margin
if (ChildCount > 0) then begin
h := GetMargin(Props.ElemMarginBottom, 0);
elem := TIpHtmlOpener(Owner).BuildLineFeedEntry(etHardLF, h);
elem := Owner.BuildLineFeedEntry(etHardLF, h);
EnqueueElement(elem);
end;
end;
@ -2722,9 +2706,9 @@ end;
procedure TIpHtmlNodeHR.Enqueue;
begin
EnqueueElement(TIpHtmlOpener(Owner).SoftLF);
EnqueueElement(Owner.SoftLF);
inherited;
EnqueueElement(TIpHtmlOpener(Owner).SoftLF);
EnqueueElement(Owner.SoftLF);
end;
function TIpHtmlNodeHR.GetDim(ParentWidth: Integer): TSize;
@ -2777,44 +2761,36 @@ begin
end;
procedure TIpHtmlNodeIMG.LoadImage;
var
lOwner: TIpHtmlOpener;
begin
lOwner := TIpHtmlOpener(Owner);
if Src <> '' then begin
if FPicture <> lOwner.DefaultImage then begin
if FPicture <> Owner.DefaultImage then begin
FPicture.Free;
FPicture := nil;
end;
lOwner.DoGetImage(Self, lOwner.BuildPath(Src), FPicture);
Owner.DoGetImage(Self, Owner.BuildPath(Src), FPicture);
if FPicture = nil then
FPicture := lOwner.DefaultImage;
FPicture := Owner.DefaultImage;
{$IFDEF UseGifImageUnit}
if (FPicture <> nil) and (FPicture.Graphic <> nil) and (FPicture.Graphic is TGifImage) then
lOwner.GifImages.Add(Self);
Owner.GifImages.Add(Self);
{$ELSE}
if (FPicture <> nil) and (FPicture.Graphic <> nil) and (FPicture.Graphic is TIpAnimatedGraphic) then
lOwner.AnimationFrames.Add(Self);
Owner.AnimationFrames.Add(Self);
{$ENDIF}
end;
end;
procedure TIpHtmlNodeIMG.UnloadImage;
var
lOwner: TIpHtmlOpener;
begin
lOwner := TIpHtmlOpener(Owner);
{$IFDEF UseGifImageUnit}
if (FPicture <> nil) and (FPicture.Graphic <> nil) and (FPicture.Graphic is TGifImage) then
Owner.GifImages.Remove(Self);
{$ELSE}
if (FPicture <> nil) and (FPicture.Graphic <> nil) and (FPicture.Graphic is TIpAnimatedGraphic) then
lOwner.AnimationFrames.Remove(Self);
Owner.AnimationFrames.Remove(Self);
{$ENDIF}
if FPicture <> lOwner.DefaultImage then begin
if FPicture <> Owner.DefaultImage then begin
FPicture.Free;
FPicture := nil;
end;
@ -2915,17 +2891,17 @@ begin
begin
with TGifImage(FPicture.Graphic) do
DrawOptions := DrawOptions + [goDirectDraw];
TIpHtmlOpener(Owner).AddGifQueue(FPicture.Graphic, R);
Owner.AddGifQueue(FPicture.Graphic, R);
end else
{$ELSE}
if (FPicture.Graphic is TIpAnimatedGraphic) and (TIpAnimatedGraphic(FPicture.Graphic).Images.Count > 1) then
begin
TIpAnimatedGraphic(FPicture.Graphic).AggressiveDrawing := True;
TIpHtmlOpener(Owner).AddGifQueue(FPicture.Graphic, R);
Owner.AddGifQueue(FPicture.Graphic, R);
end else
begin
{$ENDIF}
if FPicture = TIpHtmlOpener(Owner).DefaultImage then begin
if FPicture = Owner.DefaultImage then begin
if (NetDrawRect.Right - NetDrawRect.Left > FPicture.Graphic.Width) and
(NetDrawRect.Bottom - NetDrawRect.Top > FPicture.Graphic.Height) then
begin
@ -2960,10 +2936,7 @@ end;
procedure TIpHtmlNodeIMG.ImageChange(NewPicture: TPicture);
var
OldDim, Dim: TSize;
lOwner: TIpHtmlOpener;
begin
lOwner := TIpHtmlOpener(Owner);
{$IFOPT C+}
Owner.CheckImage(NewPicture);
{$ENDIF}
@ -2971,22 +2944,22 @@ begin
{$IFDEF UseGifImageUnit}
if (FPicture <> nil) and (FPicture.Graphic <> nil) and (FPicture.Graphic is TGifImage) then
lOwner.GifImages.Remove(Self);
Owner.GifImages.Remove(Self);
{$ELSE}
if (FPicture <> nil) and (FPicture.Graphic <> nil) and (FPicture.Graphic is TIpAnimatedGraphic) then
lOwner.AnimationFrames.Remove(Self);
Owner.AnimationFrames.Remove(Self);
{$ENDIF}
if FPicture <> lOwner.DefaultImage then
if FPicture <> Owner.DefaultImage then
FPicture.Free;
FPicture := NewPicture;
{$IFDEF UseGifImageUnit}
if (FPicture <> nil) and (FPicture.Graphic <> nil) and (FPicture.Graphic is TGifImage) then
lOwner.GifImages.Add(Self);
Owner.GifImages.Add(Self);
{$ELSE}
if (FPicture <> nil) and (FPicture.Graphic <> nil) and (FPicture.Graphic is TIpAnimatedGraphic) then
lOwner.AnimationFrames.Add(Self);
Owner.AnimationFrames.Add(Self);
{$ENDIF}
SizeWidth.PixelsType := hpUndefined;
@ -3095,19 +3068,15 @@ begin
end;
procedure TIpHtmlNodeIMG.SetUseMap(const Value: string);
var
lOwner: TIpHtmlOpener;
begin
lOwner := TIpHtmlOpener(Owner);
if FUseMap <> '' then begin
lOwner.MapImgList.Remove(Self);
lOwner.ClearAreaList;
Owner.MapImgList.Remove(Self);
Owner.ClearAreaList;
end;
FUseMap := Value;
if FUseMap <> '' then begin
lOwner.MapImgList.Add(Self);
lOwner.ClearAreaList;
Owner.MapImgList.Add(Self);
Owner.ClearAreaList;
end;
end;
@ -3153,7 +3122,7 @@ begin
inherited;
ElementName := 'li';
Align := hiaBottom;
WordEntry := TIpHtmlOpener(Owner).NewElement(etWord, Self);
WordEntry := Owner.NewElement(etWord, Self);
WordEntry.Props := Props;
end;
@ -3233,10 +3202,10 @@ begin
EnqueueElement(WordEntry);
end else
EnqueueElement(Element);
EnqueueElement(TIpHtmlOpener(Owner).FLIndent);
EnqueueElement(Owner.LIndent);
for i := 0 to Pred(ChildCount) do
TIpHtmlNodeOpener(ChildNode[i]).Enqueue;
EnqueueElement(TIpHtmlOpener(Owner).FLOutdent);
ChildNode[i].Enqueue;
EnqueueElement(Owner.LOutdent);
end;
function TIpHtmlNodeLI.GetDim(ParentWidth: Integer): TSize;
@ -3287,14 +3256,10 @@ procedure TIpHtmlNodeOL.Enqueue;
var
i: Integer;
iVal: Integer;
lParentNode: TIpHtmlNodeOpener;
lOwner: TIpHtmlOpener;
elem: PIpHtmlElement;
hf: Integer;
begin
// display block
lOwner := TIpHtmlOpener(Owner);
lParentNode := TIpHtmlNodeOpener(FParentNode);
hf := Props.FontSize;
if ChildCount > 0 then begin
@ -3303,20 +3268,20 @@ begin
(FParentNode is TIpHtmlNodeList) or
(FParentNode is TIpHtmlNodeLI) then
begin
elem := lOwner.BuildLineFeedEntry(etHardLF, 0);
lParentNode.EnqueueElement(elem);
elem := lOwner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
lParentNode.EnqueueElement(elem);
lParentNode.EnqueueElement(lOwner.FLIndent);
elem := Owner.BuildLineFeedEntry(etHardLF, 0);
ParentNode.EnqueueElement(elem);
elem := Owner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
ParentNode.EnqueueElement(elem);
ParentNode.EnqueueElement(Owner.LIndent);
end
// start block container and inline block for list items
else
begin
elem := lOwner.BuildLineFeedEntry(etHardLF, hf);
elem := Owner.BuildLineFeedEntry(etHardLF, hf);
EnqueueElement(elem);
elem := lOwner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
elem := Owner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
EnqueueElement(elem);
EnqueueElement(lOwner.FLIndent);
EnqueueElement(Owner.LIndent);
end;
end;
@ -3330,28 +3295,28 @@ begin
Inc(iVal);
Counter := Start + iVal;
TIpHtmlNodeLI(ChildNode[i]).Enqueue;
elem := lOwner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
elem := Owner.BuildLineFeedEntry(etSoftLF, 3 * (hf div 16));
EnqueueElement(elem);
end
// handle a nested list
else
TIpHtmlNodeOpener(ChildNode[i]).Enqueue;
ChildNode[i].Enqueue;
end;
if ChildCount > 0 then begin
// close inline block
lParentNode.EnqueueElement(lOwner.FLOutdent);
elem := lOwner.BuildLineFeedEntry(etSoftLF, 0);
ParentNode.EnqueueElement(Owner.LOutdent);
elem := Owner.BuildLineFeedEntry(etSoftLF, 0);
EnqueueElement(elem);
// nested list has different bottom margin
if (FParentNode is TIpHtmlNodeOL) or
(FParentNode is TIpHtmlNodeList) or
(FParentNode is TIpHtmlNodeLI) then
elem := lOwner.BuildLineFeedEntry(etSoftLF, hf div 8)
elem := Owner.BuildLineFeedEntry(etSoftLF, hf div 8)
// close the block
else
elem := lOwner.BuildLineFeedEntry(etHardLF, 3 * (hf div 8));
elem := Owner.BuildLineFeedEntry(etHardLF, 3 * (hf div 8));
EnqueueElement(elem);
end;
end;
@ -3483,10 +3448,8 @@ var
Al : TIpHtmlVAlign3;
TRBgColor, TrTextColor: TColor;
aCanvas : TCanvas;
lLayouter: TIpHtmlBaseTableLayouterOpener;
begin
aCanvas := Owner.Target;
lLayouter := TIpHtmlBaseTableLayouterOpener(FLayouter);
if (FOwner.Body.BgPicture <> nil) or (Props.BGColor = 1) then
aCanvas.Brush.Style := bsClear
@ -3500,7 +3463,7 @@ begin
Al := Props.VAlignment;
for z := 0 to Pred(ColCount) do
lLayouter.FRowSp[z] := 0;
FLayouter.RowSp[z] := 0;
for z := 0 to Pred(ChildCount) do
if (TIpHtmlNode(ChildNode[z]) is TIpHtmlNodeTHeadFootBody) then
@ -3669,13 +3632,11 @@ end;
procedure TIpHtmlNodeTABLE.Enqueue;
var
//lOwner: TIpHtmlOpener;
h: Integer;
elem: PIpHtmlElement;
begin
// display block
//lOwner := TIpHtmlOpener(Owner);
//The commented code below prevents a blank line before the table
{
case Align of
@ -3689,7 +3650,7 @@ begin
// vertical margin: specified in CSS or none
h := GetMargin(Props.ElemMarginTop, 0);
elem := TIpHtmlOpener(Owner).BuildLinefeedEntry(etSoftLF, h);
elem := Owner.BuildLinefeedEntry(etSoftLF, h);
EnqueueElement(elem);
// insert element content
@ -3698,7 +3659,7 @@ begin
// close block
// vertical margin: specified in CSS or none
h := GetMargin(Props.ElemMarginBottom, 0);
elem := TIpHtmlOpener(Owner).BuildLinefeedEntry(etHardLF, h);
elem := Owner.BuildLinefeedEntry(etHardLF, h);
EnqueueElement(elem);
{
@ -3727,38 +3688,40 @@ end;
function TIpHtmlNodeTABLE.GetMaxWidth: Integer;
begin
Result := TIpHtmlBaseTableLayouterOpener(FLayouter).FMax;
Result := FLayouter.Max;
end;
function TIpHtmlNodeTABLE.GetMinWidth: Integer;
begin
Result := TIpHtmlBaseTableLayouterOpener(FLayouter).FMin;
Result := FLayouter.Min;
end;
function TIpHtmlNodeTABLE.GetTableWidth: Integer;
begin
Result := TIpHtmlBaseTableLayouterOpener(FLayouter).FTableWidth;
Result := FLayouter.TableWidth;
end;
function TIpHtmlNodeTABLE.GetCellPadding: Integer;
begin
Result := TIpHtmlBaseTableLayouterOpener(FLayouter).FCellPadding;
Result := FLayouter.CellPadding;
end;
function TIpHtmlNodeTABLE.GetCellSpacing: Integer;
begin
Result := TIpHtmlBaseTableLayouterOpener(FLayouter).FCellSpacing;
Result := FLayouter.CellSpacing;
end;
procedure TIpHtmlNodeTABLE.SetCellPadding(const Value: Integer);
begin
TIpHtmlBaseTableLayouterOpener(FLayouter).FCellPadding := Value;
FLayouter.CellPadding := Value;
InvalidateSize;
end;
procedure TIpHtmlNodeTABLE.SetCellSpacing(const Value: Integer);
begin
TIpHtmlBaseTableLayouterOpener(FLayouter).FCellSpacing := Value;
if not (FLayouter is TIpHtmlBaseTableLayouter) then
raise Exception.Create('TIpHtmlNodeTABLE.FLayouter has wrong type: ' + FLayouter.ClassName);
FLayouter.CellSpacing := Value;
InvalidateSize;
end;
@ -4074,24 +4037,21 @@ constructor TIpHtmlNodeBUTTON.Create(ParentNode: TIpHtmlNode);
begin
inherited Create(ParentNode);
ElementName := 'button';
with TIpHtmlOpener(Owner) do
begin
FControlList.Add(Self);
if DoneLoading then
Self.CreateControl(FControlParent);
end;
Owner.ControlList.Add(Self);
if Owner.DoneLoading then
CreateControl(Owner.ControlParent);
end;
destructor TIpHtmlNodeBUTTON.Destroy;
begin
TIpHtmlOpener(Owner).FControlList.Remove(Self);
Owner.ControlList.Remove(Self);
inherited;
end;
procedure TIpHtmlNodeBUTTON.CreateControl(Parent: TWinControl);
begin
inherited;
TIpHtmlOpener(Owner).ControlCreate(Self);
Owner.ControlCreate(Self);
FControl := TButton.Create(Parent);
FControl.Visible := False;
@ -4145,7 +4105,7 @@ begin
end;
hbtButton :
begin
TIpHtmlOpener(Owner).ControlClick(Self);
Owner.ControlClick(Self);
end;
end;
end;
@ -4162,10 +4122,10 @@ var
begin
with Control as TButton do
begin
lCanvas := TFriendPanel(Parent).Canvas;
lCanvas := TCustomPanel(Parent).Canvas;
oldFontSize := lCanvas.Font.Size;
Width := TFriendPanel(Parent).Canvas.TextWidth(Caption) + 40;
Height := TFriendPanel(Parent).Canvas.TextHeight('Tg') + 10;
Width := lCanvas.TextWidth(Caption) + 40;
Height := lCanvas.TextHeight('Tg') + 10;
lCanvas.Font.Size := oldFontSize;
end;
end;
@ -4174,7 +4134,7 @@ procedure TIpHtmlNodeBUTTON.SetInputType(const AValue: TIpHtmlButtonType);
begin
if FInputType = AValue then exit;
FInputType := AValue;
if TIpHtmlOpener(Owner).DoneLoading and (FControl <> nil) and (Self.Value = '') then
if Owner.DoneLoading and (FControl <> nil) and (Self.Value = '') then
SetValue(GetButtonCaption);
end;
@ -4182,7 +4142,7 @@ procedure TIpHtmlNodeBUTTON.SetValue(const AValue: String);
begin
if FValue = AValue then Exit;
FValue := AValue;
if TIpHtmlOpener(Owner).DoneLoading and (FControl <> nil) then
if Owner.DoneLoading and (FControl <> nil) then
begin
(FControl as TButton).Caption := GetButtonCaption;
CalcSize;
@ -4284,9 +4244,9 @@ var
begin
inherited;
TIpHtmlOpener(Owner).ControlCreate(Self);
Owner.ControlCreate(Self);
aCanvas := TFriendPanel(Parent).Canvas;
aCanvas := TCustomPanel(Parent).Canvas;
iCurFontSize := aCanvas.Font.Size;
case InputType of
hitText :
@ -4418,10 +4378,9 @@ begin
begin
FControl := TBitbtn.Create(Parent);
setCommonProperties;
with TIpHtmlOpener(Owner) do
DoGetImage(Self, BuildPath(Src), FPicture);
Owner.DoGetImage(Self, Owner.BuildPath(Src), FPicture);
if FPicture = nil
then FPicture := TIpHtmlOpener(Owner).DefaultImage;
then FPicture := Owner.DefaultImage;
with TBitbtn(FControl) do begin
Caption := Self.Value;
Enabled := not Self.Disabled and not Self.Readonly;
@ -4473,7 +4432,7 @@ begin
{$IFOPT C+}
Owner.CheckImage(NewPicture);
{$ENDIF}
if FPicture <> TIpHtmlOpener(Owner).DefaultImage then
if FPicture <> Owner.DefaultImage then
FPicture.Free;
FPicture := NewPicture;
SetImageGlyph(FPicture);
@ -4535,8 +4494,9 @@ var
vCancel: boolean;
begin
vCancel := False;
TIpHtmlOpener(Owner).ControlClick2(Self, vCancel);
if not vCancel then SubmitRequest;
Owner.ControlClick2(Self, vCancel);
if not vCancel then
SubmitRequest;
end;
procedure TIpHtmlNodeINPUT.ResetClick(Sender: TObject);
@ -4560,19 +4520,19 @@ end;
procedure TIpHtmlNodeINPUT.ButtonClick(Sender: TObject);
begin
getControlValue;
TIpHtmlOpener(Owner).ControlClick(Self);
Owner.ControlClick(Self);
end;
procedure TIpHtmlNodeINPUT.ControlOnEditingDone(Sender: TObject);
begin
getControlValue;
TIpHtmlOpener(Owner).ControlOnEditingDone(Self);
Owner.ControlOnEditingDone(Self);
end;
procedure TIpHtmlNodeINPUT.ControlOnChange(Sender: TObject);
begin
getControlValue;
TIpHtmlOpener(Owner).ControlOnChange(Self);
Owner.ControlOnChange(Self);
end;
function TIpHtmlNodeINPUT.GetHint: string;
@ -4678,9 +4638,9 @@ var
OptGroup: TIpHtmlNodeOPTGROUP;
begin
inherited;
TIpHtmlOpener(Owner).ControlCreate(Self);
Owner.ControlCreate(Self);
aCanvas := TFriendPanel(Parent).Canvas;
aCanvas := TCustomPanel(Parent).Canvas;
iCurFontSize := aCanvas.Font.Size;
if Multiple then begin
FControl := TListBox.Create(Parent);
@ -4788,17 +4748,17 @@ end;
procedure TIpHtmlNodeSELECT.ButtonClick(Sender: TObject);
begin
TIpHtmlOpener(Owner).ControlClick(Self);
Owner.ControlClick(Self);
end;
procedure TIpHtmlNodeSELECT.ControlOnEditingDone(Sender: TObject);
begin
TIpHtmlOpener(Owner).ControlOnEditingDone(Self);
Owner.ControlOnEditingDone(Self);
end;
procedure TIpHtmlNodeSELECT.ListBoxSelectionChange(Sender: TObject; User: boolean);
begin
TIpHtmlOpener(Owner).ControlOnEditingDone(Self);
Owner.ControlOnEditingDone(Self);
end;
procedure TIpHtmlNodeSELECT.SetText(aText: string);
@ -4845,9 +4805,9 @@ var
aCanvas : TCanvas;
begin
inherited;
TIpHtmlOpener(Owner).ControlCreate(Self);
Owner.ControlCreate(Self);
aCanvas := TFriendPanel(Parent).Canvas;
aCanvas := TCustomPanel(Parent).Canvas;
iCurFontSize := aCanvas.Font.Size;
FControl := TMemo.Create(Parent);
FControl.Visible := False;
@ -4856,8 +4816,8 @@ begin
adjustFromCss;
with TMemo(FControl) do begin
Width := Cols * TFriendPanel(Parent).Canvas.TextWidth('0');
Height := Rows * TFriendPanel(Parent).Canvas.TextHeight('Wy');
Width := Cols * TCustomPanel(Parent).Canvas.TextWidth('0');
Height := Rows * TCustomPanel(Parent).Canvas.TextHeight('Wy');
Enabled := not Self.Disabled;
end;
@ -4902,7 +4862,7 @@ end;
procedure TIpHtmlNodeTEXTAREA.ControlOnEditingDone(Sender: TObject);
begin
TIpHtmlOpener(Owner).ControlOnEditingDone(Self);
Owner.ControlOnEditingDone(Self);
end;