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

View File

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