mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-15 11:59:20 +02:00
Turbopower_ipro: Move specialized HTML node classes to new separate unit IpHtmlNodes.
This commit is contained in:
parent
e8afecf3c7
commit
92ed8ecb60
@ -52,7 +52,7 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<CursorPos X="68" Y="26"/>
|
||||
<CursorPos X="61" Y="19"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ interface
|
||||
|
||||
uses
|
||||
types, Classes, SysUtils, LCLPRoc, LCLIntf, Graphics,
|
||||
IpUtils, IpHtmlTypes, IpHtmlProp, IpHtmlUtils, IpHtml;
|
||||
IpUtils, IpHtmlTypes, IpHtmlProp, IpHtmlUtils, IpHtml, IpHtmlNodes;
|
||||
|
||||
type
|
||||
|
||||
|
@ -5,7 +5,7 @@ unit IpHtmlClasses;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Types,
|
||||
Classes, SysUtils, Types, Graphics, Forms,
|
||||
IpHtmlTypes;
|
||||
|
||||
type
|
||||
@ -135,6 +135,56 @@ type
|
||||
procedure Delete(Index: Integer);
|
||||
end;
|
||||
|
||||
TIpHtmlPreviewSettings = class(TPersistent)
|
||||
private
|
||||
FAntiAliasingMode: TAntiAliasingMode;
|
||||
FPosition: TPosition;
|
||||
FMaximized: Boolean;
|
||||
FLeft: Integer;
|
||||
FTop: Integer;
|
||||
FWidth: Integer;
|
||||
FHeight: Integer;
|
||||
FZoom: Integer;
|
||||
public
|
||||
constructor Create;
|
||||
published
|
||||
property AntiAliasingMode: TAntiAliasingMode
|
||||
read FAntiAliasingMode write FAntiAliasingMode default amDontCare;
|
||||
property Position: TPosition
|
||||
read FPosition write FPosition default poScreenCenter;
|
||||
property Maximized: Boolean
|
||||
read FMaximized write FMaximized default false;
|
||||
property Left: Integer
|
||||
read FLeft write FLeft;
|
||||
property Top: Integer
|
||||
read FTop write FTop;
|
||||
property Width: Integer
|
||||
read FWidth write FWidth;
|
||||
property Height: Integer
|
||||
read FHeight write FHeight;
|
||||
property Zoom: integer
|
||||
read FZoom write FZoom default 100;
|
||||
end;
|
||||
|
||||
TIpHtmlPrintSettings = class(TPersistent)
|
||||
private
|
||||
FPreview: TIpHtmlPreviewSettings;
|
||||
FMarginTop: Double;
|
||||
FMarginLeft: Double;
|
||||
FMarginBottom: Double;
|
||||
FMarginRight: Double;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
property MarginLeft: Double read FMarginLeft write FMarginLeft;
|
||||
property MarginTop: Double read FMarginTop write FMarginTop;
|
||||
property MarginRight: Double read FMarginRight write FMarginRight;
|
||||
property MarginBottom: Double read FMarginBottom write FMarginBottom;
|
||||
property Preview: TIpHtmlPreviewSettings read FPreview write FPreview;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{ TIpHtmlInteger }
|
||||
@ -442,5 +492,38 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
|
||||
{ TIpHtmlPreviewSettings }
|
||||
|
||||
constructor TIpHtmlPreviewSettings.Create;
|
||||
begin
|
||||
inherited;
|
||||
FPosition := poScreenCenter;
|
||||
FZoom := 100;
|
||||
FWidth := Screen.Width * 3 div 4;
|
||||
FHeight := Screen.Height * 3 div 4;
|
||||
FLeft := Screen.Width div 4;
|
||||
FTop := Screen.Height div 4;
|
||||
end;
|
||||
|
||||
|
||||
{ TIpHtmlPrintSettings }
|
||||
|
||||
constructor TIpHtmlPrintSettings.Create;
|
||||
begin
|
||||
inherited;
|
||||
FPreview := TIpHtmlPreviewSettings.Create;
|
||||
FMarginLeft := DEFAULT_PRINTMARGIN;
|
||||
FMarginTop := DEFAULT_PRINTMARGIN;
|
||||
FMarginRight := DEFAULT_PRINTMARGIN;
|
||||
FMarginBottom := DEFAULT_PRINTMARGIN;
|
||||
end;
|
||||
|
||||
destructor TIpHtmlPrintSettings.Destroy;
|
||||
begin
|
||||
FPreview.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
4705
components/turbopower_ipro/iphtmlnodes.pas
Normal file
4705
components/turbopower_ipro/iphtmlnodes.pas
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Graphics,
|
||||
ipConst, ipUtils, ipHtmlTypes, ipHtmlUtils, ipHtmlProp, ipCSS, ipHtmlClasses,
|
||||
ipHtml;
|
||||
ipConst, ipUtils, ipHtmlTypes, ipHtmlUtils, ipCSS, ipHtmlClasses, ipHtml;
|
||||
|
||||
type
|
||||
TIpHtmlParser = class(TIpHtmlBasicParser)
|
||||
@ -180,7 +179,8 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
LConvEncoding, LazUTF8, LazStringUtils, Translations;
|
||||
LConvEncoding, LazUTF8, LazStringUtils, Translations,
|
||||
IpHtmlNodes;
|
||||
|
||||
{ TIpHtmlParser }
|
||||
|
||||
|
@ -7,7 +7,7 @@ interface
|
||||
|
||||
uses
|
||||
types, Classes, LCLType, LCLIntf,
|
||||
IpHtmlTypes, IpHtmlProp, IpHtml, IpHtmlClasses;
|
||||
IpHtmlTypes, IpHtmlProp, IpHtmlUtils, IpHtmlClasses, IpHtml, IpHtmlNodes;
|
||||
|
||||
type
|
||||
|
||||
|
@ -5,8 +5,8 @@ unit IpHtmlUtils;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Graphics,
|
||||
IpHtmlTypes, IpHtmlProp;
|
||||
Classes, SysUtils, Graphics, Forms,
|
||||
IpHtmlTypes;
|
||||
|
||||
function ColorFromString(S: String): TColor;
|
||||
function TryColorFromString(S: String; out AColor: TColor; out AErrMsg: String): Boolean;
|
||||
@ -17,6 +17,12 @@ function AnsiToEscape(const S: string): string;
|
||||
function EscapeToAnsi(const S: string): string;
|
||||
function NoBreakToSpace(const S: string): string;
|
||||
|
||||
function FindFontName(const AFontList: string): string;
|
||||
|
||||
function MaxI2(const I1, I2: Integer) : Integer;
|
||||
function MinI2(const I1, I2: Integer) : Integer;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -587,5 +593,70 @@ begin
|
||||
SetLength(Result, n);
|
||||
end;
|
||||
|
||||
function FindFontName(const AFontList: string): string;
|
||||
|
||||
function CheckFonts(ATestFontList: array of String): String;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to High(ATestFontList) do begin
|
||||
Result := ATestFontList[i];
|
||||
if Screen.Fonts.IndexOf(Result) > -1 then
|
||||
exit;
|
||||
end;
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
var
|
||||
L: TStringList;
|
||||
i: Integer;
|
||||
begin
|
||||
L := TStringList.Create;
|
||||
try
|
||||
L.CommaText := AFontList;
|
||||
for i:=0 to L.Count-1 do begin
|
||||
Result := L[i];
|
||||
if Screen.Fonts.IndexOf(Result) > -1 then
|
||||
exit;
|
||||
if SameText(Result, 'sans-serif') then begin
|
||||
Result := Checkfonts(['Arial', 'Helvetica', 'Liberation Sans']);
|
||||
if Result = '' then
|
||||
Result := Screen.MenuFont.Name;
|
||||
exit;
|
||||
end else
|
||||
if SameText(Result, 'serif') then begin
|
||||
Result := CheckFonts(['Times', 'Times New Roman', 'Liberation Serif']);
|
||||
if Result = '' then
|
||||
Result := Screen.MenuFont.Name;
|
||||
exit;
|
||||
end else
|
||||
if SameText(Result, 'monospace') then begin
|
||||
Result := CheckFonts(['Courier New', 'Courier', 'Liberation Mono']);
|
||||
if Result = '' then
|
||||
Result := Screen.MenuFont.Name;
|
||||
exit;
|
||||
end else
|
||||
Result := Screen.MenuFont.Name;
|
||||
end;
|
||||
finally
|
||||
L.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function MaxI2(const I1, I2: Integer) : Integer;
|
||||
begin
|
||||
Result := I1;
|
||||
if I2 > I1 then
|
||||
Result := I2;
|
||||
end;
|
||||
|
||||
function MinI2(const I1, I2: Integer) : Integer;
|
||||
begin
|
||||
Result := I1;
|
||||
if I2 < I1 then
|
||||
Result := I2;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
@ -37,7 +37,7 @@ interface
|
||||
uses
|
||||
SysUtils, Classes, Registry,
|
||||
LCLType, LCLIntf, LMessages, Controls, ComCtrls,
|
||||
GraphType, LazFileUtils, LazStringUtils;
|
||||
LazFileUtils, LazStringUtils;
|
||||
|
||||
const
|
||||
InternetProfessionalVersion = 1.15;
|
||||
|
@ -119,6 +119,29 @@ const
|
||||
'There should be an empty line between the two lines.';
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <PRE>
|
||||
//------------------------------------------------------------------------------
|
||||
const
|
||||
PRE_title =
|
||||
'Formatting with <PRE> tag';
|
||||
PRE_descr =
|
||||
'All lines should have normal spacing.';
|
||||
PRE_html =
|
||||
'<html>' + LE +
|
||||
'<body>' + LE +
|
||||
'<p>Normal text before.</p>' + LE +
|
||||
'<pre>' + LE +
|
||||
'program Test;' + LE +
|
||||
'begin' + LE +
|
||||
' Run;' + LE +
|
||||
'end.' + LE +
|
||||
'</pre>' + LE +
|
||||
'<p>Normal text after.</p>' + LE +
|
||||
'</body>' + LE +
|
||||
'</html>';
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Background color
|
||||
//------------------------------------------------------------------------------
|
||||
@ -730,7 +753,7 @@ const
|
||||
Arab_title =
|
||||
'Arabian text';
|
||||
Arab_descr =
|
||||
'...';
|
||||
'Text should begin at right. The left-most character should be the period (.).';
|
||||
Arab_html =
|
||||
'<html lang="ar" dir="rtl">' + LE +
|
||||
'<head>' + LE +
|
||||
|
@ -144,18 +144,7 @@ begin
|
||||
TreeView1.Items.BeginUpdate;
|
||||
try
|
||||
TreeView1.Items.Clear;
|
||||
|
||||
node := TreeView1.Items.AddChild(nil, '<BR>');
|
||||
AddTest(node, BRinBODY_title, BRinBODY_descr, BRinBODY_html);
|
||||
AddTest(node, TwoBRinBODY_title, TwoBRinBODY_descr, TwoBRinBODY_html);
|
||||
AddTest(node, BRinP_title, BRinP_descr, BRinP_html);
|
||||
AddTest(node, TwoBRinP_title, TwoBRinP_descr, TwoBRinP_html);
|
||||
AddTest(node, BRinTableCell_title, BRinTableCell_descr, BRinTableCell_html);
|
||||
AddTest(node, TwoBRinTableCell_title, TwoBRinTableCell_descr, TwoBRinTableCell_html);
|
||||
AddTest(node, BRbetweenTwoP_title, BRbetweenTwoP_descr, BRbetweenTwoP_html);
|
||||
AddTest(node, BRbetweenTwoTables_title, BRbetweenTwoTables_descr, BRbetweenTwoTables_html);
|
||||
node.Expanded := true;
|
||||
|
||||
|
||||
node := TreeView1.Items.AddChild(nil, 'Text background');
|
||||
AddTest(node, TextWithBackgroundInBODY_title, TextWithBackgroundInBODY_descr, TextWithBackgroundInBODY_html);
|
||||
AddTest(node, TextWithBackgroundInBODY_CSS_title, TextWithBackgroundInBODY_CSS_descr, TextWithBackgroundInBODY_CSS_html);
|
||||
@ -202,6 +191,22 @@ begin
|
||||
AddTest(node, HTMLCommentInCSS_title, HTMLCommentInCSS_descr, HTMLCommentInCSS_html);
|
||||
node.Expanded := true;
|
||||
|
||||
node := TreeView1.Items.AddChild(nil, 'Special tags');
|
||||
node1 := TreeView1.Items.AddChild(node, '<BR>');
|
||||
AddTest(node1, BRinBODY_title, BRinBODY_descr, BRinBODY_html);
|
||||
AddTest(node1, TwoBRinBODY_title, TwoBRinBODY_descr, TwoBRinBODY_html);
|
||||
AddTest(node1, BRinP_title, BRinP_descr, BRinP_html);
|
||||
AddTest(node1, TwoBRinP_title, TwoBRinP_descr, TwoBRinP_html);
|
||||
AddTest(node1, BRinTableCell_title, BRinTableCell_descr, BRinTableCell_html);
|
||||
AddTest(node1, TwoBRinTableCell_title, TwoBRinTableCell_descr, TwoBRinTableCell_html);
|
||||
AddTest(node1, BRbetweenTwoP_title, BRbetweenTwoP_descr, BRbetweenTwoP_html);
|
||||
AddTest(node1, BRbetweenTwoTables_title, BRbetweenTwoTables_descr, BRbetweenTwoTables_html);
|
||||
node1.Expanded := true;
|
||||
node1 := TreeView1.Items.AddChild(node, '<PRE>');
|
||||
AddTest(node1, PRE_title, PRE_descr, PRE_html);
|
||||
node1.Expanded := true;
|
||||
node.Expanded := true;
|
||||
|
||||
node := TreeView1.Items.AddChild(nil, 'Special cases in file structure');
|
||||
AddTest(node, NoHtmlTag_title, NoHtmlTag_descr, NoHtmlTag_html);
|
||||
AddTest(node, NoBodyTag_title, NoBodyTag_descr, NoBodyTag_html);
|
||||
|
@ -25,7 +25,7 @@
|
||||
<License Value="MPL - Mozilla public license
|
||||
"/>
|
||||
<Version Major="1"/>
|
||||
<Files Count="22">
|
||||
<Files Count="23">
|
||||
<Item1>
|
||||
<Filename Value="ipanim.pas"/>
|
||||
<UnitName Value="IpAnim"/>
|
||||
@ -116,8 +116,12 @@
|
||||
</Item21>
|
||||
<Item22>
|
||||
<Filename Value="iphtmltypes.pas"/>
|
||||
<UnitName Value="iphtmltypes"/>
|
||||
<UnitName Value="IpHtmlTypes"/>
|
||||
</Item22>
|
||||
<Item23>
|
||||
<Filename Value="iphtmlnodes.pas"/>
|
||||
<UnitName Value="IpHtmlNodes"/>
|
||||
</Item23>
|
||||
</Files>
|
||||
<CompatibilityMode Value="True"/>
|
||||
<i18n>
|
||||
|
@ -10,7 +10,7 @@ interface
|
||||
uses
|
||||
IpAnim, IpConst, Ipfilebroker, Iphttpbroker, IpHtml, IpMsg, IpStrms,
|
||||
IpUtils, IpHtmlTabList, IpHtmlProp, ipHtmlBlockLayout, ipHtmlTableLayout,
|
||||
IpHtmlParser, IpHtmlUtils, IpCSS, IpHtmlClasses, IpHtmlTypes,
|
||||
IpHtmlParser, IpHtmlUtils, IpCSS, IpHtmlClasses, IpHtmlTypes, IpHtmlNodes,
|
||||
LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
Loading…
Reference in New Issue
Block a user