You've already forked lina-components
mirror of
https://bitbucket.org/Dennis07/lina-components.git
synced 2025-08-24 21:49:04 +02:00
Version 1.0 DEV 1.16
Signed-off-by: Dennis07 <den.goehlert@t-online.de>
This commit is contained in:
15
Example/THtmlDocument/pExample.dpr
Normal file
15
Example/THtmlDocument/pExample.dpr
Normal file
@@ -0,0 +1,15 @@
|
||||
program pExample;
|
||||
|
||||
uses
|
||||
Vcl.Forms,
|
||||
uMain in 'uMain.pas' {fmMain};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.MainFormOnTaskbar := True;
|
||||
Application.Title := 'Example';
|
||||
Application.CreateForm(TfmMain, fmMain);
|
||||
Application.Run;
|
||||
end.
|
176
Example/THtmlDocument/pExample.dproj
Normal file
176
Example/THtmlDocument/pExample.dproj
Normal file
@@ -0,0 +1,176 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{D28E4737-637C-4A11-9D4B-624FB1C78C89}</ProjectGuid>
|
||||
<ProjectVersion>15.3</ProjectVersion>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<MainSource>pExample.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>1</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||
<Base_Win32>true</Base_Win32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
|
||||
<Base_Win64>true</Base_Win64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
|
||||
<Cfg_1_Win32>true</Cfg_1_Win32>
|
||||
<CfgParent>Cfg_1</CfgParent>
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
|
||||
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
|
||||
<DCC_E>false</DCC_E>
|
||||
<DCC_N>false</DCC_N>
|
||||
<DCC_S>false</DCC_S>
|
||||
<DCC_F>false</DCC_F>
|
||||
<DCC_K>false</DCC_K>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<DCC_UsePackage>frxDB19;FireDACASADriver;FireDACSqliteDriver;bindcompfmx;DBXSqliteDriver;AbbreviaVCL;vcldbx;FireDACPgDriver;FireDACODBCDriver;VampyreImagingPackage.D2009;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;FireDACCommon;bindcomp;frx19;TeeDB;vclib;inetdbbde;DBXInterBaseDriver;GR32_DSGN_RSXE5;DataSnapCommon;MiscrosoftScriptControls;pkCindyDERDXE5;Tee;vclFireDAC;xmlrtl;svnui;ibxpress;DbxCommonDriver;SVATimer_DXE5;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;PieLib;FireDACCommonDriver;MetropolisUILiveTile;djsonrt;bindengine;vclactnband;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;pkCindyPackDXE5;TeeUI;FMXTee;vclie;pkCindyIEDXE5;vclshlctrls;fmxFireDAC;FireDACADSDriver;vcltouch;pkCindyDBCtrlsPackDXE5;pkCindyDBXDXE5;LINA_D_XE5;CustomIPTransport;SynEdit_RXE5;vclribbon;VclSmp;FireDAC;dsnap;IndyIPServer;Intraweb;fmxase;vcl;IndyCore;VCLRESTComponents;GR32_RSXE5;IndyIPCommon;CloudService;CodeSiteExpressPkg;dsnapcon;FireDACIBDriver;DebenuPDFLibraryLite;inet;FmxTeeUI;fmxobj;DCEF_XE5;FireDACMySQLDriver;vclx;inetdbxpress;webdsnap;svn;fmxdae;frxe19;RESTComponents;bdertl;FireDACMSAccDriver;adortl;dbexpress;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||
<DCC_UsePackage>FireDACASADriver;FireDACSqliteDriver;bindcompfmx;DBXSqliteDriver;AbbreviaVCL;FireDACPgDriver;FireDACODBCDriver;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;FireDACCommon;bindcomp;vclib;DBXInterBaseDriver;DataSnapCommon;vclFireDAC;xmlrtl;ibxpress;DbxCommonDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;FireDACCommonDriver;MetropolisUILiveTile;bindengine;vclactnband;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;vclie;vclshlctrls;fmxFireDAC;FireDACADSDriver;vcltouch;LINA_D_XE5;CustomIPTransport;SynEdit_RXE5;vclribbon;VclSmp;FireDAC;dsnap;IndyIPServer;Intraweb;fmxase;vcl;IndyCore;VCLRESTComponents;IndyIPCommon;CloudService;dsnapcon;FireDACIBDriver;inet;fmxobj;FireDACMySQLDriver;vclx;inetdbxpress;webdsnap;fmxdae;RESTComponents;FireDACMSAccDriver;adortl;dbexpress;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||
<DCC_DebugDCUs>true</DCC_DebugDCUs>
|
||||
<DCC_Optimize>false</DCC_Optimize>
|
||||
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
<DCC_DebugInformation>0</DCC_DebugInformation>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<DelphiCompile Include="$(MainSource)">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="uMain.pas">
|
||||
<Form>fmMain</Form>
|
||||
<FormType>dfm</FormType>
|
||||
</DCCReference>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType/>
|
||||
<BorlandProject>
|
||||
<Delphi.Personality>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">1031</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"/>
|
||||
<VersionInfoKeys Name="FileDescription"/>
|
||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"/>
|
||||
<VersionInfoKeys Name="LegalCopyright"/>
|
||||
<VersionInfoKeys Name="LegalTrademarks"/>
|
||||
<VersionInfoKeys Name="OriginalFilename"/>
|
||||
<VersionInfoKeys Name="ProductName"/>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"/>
|
||||
<VersionInfoKeys Name="CFBundleName"/>
|
||||
<VersionInfoKeys Name="CFBundleDisplayName"/>
|
||||
<VersionInfoKeys Name="UIDeviceFamily"/>
|
||||
<VersionInfoKeys Name="CFBundleIdentifier"/>
|
||||
<VersionInfoKeys Name="CFBundleVersion"/>
|
||||
<VersionInfoKeys Name="CFBundlePackageType"/>
|
||||
<VersionInfoKeys Name="CFBundleSignature"/>
|
||||
<VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
|
||||
<VersionInfoKeys Name="UISupportedInterfaceOrientations"/>
|
||||
<VersionInfoKeys Name="CFBundleExecutable"/>
|
||||
<VersionInfoKeys Name="CFBundleResourceSpecification"/>
|
||||
<VersionInfoKeys Name="LSRequiresIPhoneOS"/>
|
||||
<VersionInfoKeys Name="CFBundleInfoDictionaryVersion"/>
|
||||
<VersionInfoKeys Name="CFBundleDevelopmentRegion"/>
|
||||
<VersionInfoKeys Name="package"/>
|
||||
<VersionInfoKeys Name="label"/>
|
||||
<VersionInfoKeys Name="versionCode"/>
|
||||
<VersionInfoKeys Name="versionName"/>
|
||||
<VersionInfoKeys Name="persistent"/>
|
||||
<VersionInfoKeys Name="restoreAnyVersion"/>
|
||||
<VersionInfoKeys Name="installLocation"/>
|
||||
<VersionInfoKeys Name="largeHeap"/>
|
||||
<VersionInfoKeys Name="theme"/>
|
||||
</VersionInfoKeys>
|
||||
<Source>
|
||||
<Source Name="MainSource">pExample.dpr</Source>
|
||||
</Source>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k190.bpl">Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp190.bpl">Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
</Delphi.Personality>
|
||||
<Deployment/>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
<Platform value="Win64">False</Platform>
|
||||
</Platforms>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
|
||||
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
|
||||
</Project>
|
14
Example/THtmlDocument/pExample.dproj.local
Normal file
14
Example/THtmlDocument/pExample.dproj.local
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<BorlandProject>
|
||||
<Transactions>
|
||||
<Transaction>1899.12.30 00:00:00.000.028,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas</Transaction>
|
||||
<Transaction>1899.12.30 00:00:00.000.957,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas</Transaction>
|
||||
<Transaction>1899.12.30 00:00:00.000.824,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas</Transaction>
|
||||
<Transaction>1899.12.30 00:00:00.000.554,C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Example\TWinFile\uMain.pas</Transaction>
|
||||
<Transaction>1899.12.30 00:00:00.000.832,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas</Transaction>
|
||||
<Transaction>1899.12.30 00:00:00.000.554,C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.dfm=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Example\TWinFile\uMain.dfm</Transaction>
|
||||
<Transaction>1899.12.30 00:00:00.000.484,C:\Users\Dennis G\Documents\RAD Studio\Projekte\Project1.dproj=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Example\TWinFile\pExample.dproj</Transaction>
|
||||
<Transaction>1899.12.30 00:00:00.000.333,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas</Transaction>
|
||||
<Transaction>1899.12.30 00:00:00.000.634,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas</Transaction>
|
||||
</Transactions>
|
||||
</BorlandProject>
|
BIN
Example/THtmlDocument/pExample.exe
Normal file
BIN
Example/THtmlDocument/pExample.exe
Normal file
Binary file not shown.
BIN
Example/THtmlDocument/pExample.identcache
Normal file
BIN
Example/THtmlDocument/pExample.identcache
Normal file
Binary file not shown.
BIN
Example/THtmlDocument/pExample.res
Normal file
BIN
Example/THtmlDocument/pExample.res
Normal file
Binary file not shown.
156
Example/THtmlDocument/uMain.dfm
Normal file
156
Example/THtmlDocument/uMain.dfm
Normal file
@@ -0,0 +1,156 @@
|
||||
object fmMain: TfmMain
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'LinaComponents "THtmlDocument" Example'
|
||||
ClientHeight = 417
|
||||
ClientWidth = 657
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Menu = MainMenu
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object tvStructure: TTreeView
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 169
|
||||
Height = 417
|
||||
Align = alLeft
|
||||
Indent = 19
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
OnClick = tvStructureClick
|
||||
end
|
||||
object pnProperties: TPanel
|
||||
Left = 169
|
||||
Top = 0
|
||||
Width = 488
|
||||
Height = 417
|
||||
Align = alClient
|
||||
TabOrder = 1
|
||||
object lvParams: TListView
|
||||
Left = 1
|
||||
Top = 1
|
||||
Width = 486
|
||||
Height = 150
|
||||
Align = alTop
|
||||
Columns = <
|
||||
item
|
||||
Caption = 'Name'
|
||||
Width = 200
|
||||
end
|
||||
item
|
||||
Caption = 'Value'
|
||||
Width = 200
|
||||
end>
|
||||
ReadOnly = True
|
||||
RowSelect = True
|
||||
TabOrder = 0
|
||||
ViewStyle = vsReport
|
||||
end
|
||||
object mmLines: TSynMemo
|
||||
Left = 1
|
||||
Top = 151
|
||||
Width = 486
|
||||
Height = 265
|
||||
Align = alClient
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -13
|
||||
Font.Name = 'Courier New'
|
||||
Font.Style = []
|
||||
PopupMenu = pmLines
|
||||
TabOrder = 1
|
||||
Gutter.Font.Charset = DEFAULT_CHARSET
|
||||
Gutter.Font.Color = clWindowText
|
||||
Gutter.Font.Height = -11
|
||||
Gutter.Font.Name = 'Courier New'
|
||||
Gutter.Font.Style = []
|
||||
Highlighter = SynHTMLSyn
|
||||
ReadOnly = True
|
||||
FontSmoothing = fsmNone
|
||||
end
|
||||
end
|
||||
object OpenDialog: TOpenDialog
|
||||
Filter =
|
||||
'Hypertext markup files (*.html)|*.html|Extended markup files (*.' +
|
||||
'xml)|*.xml'
|
||||
Title = 'Select an HTML/XML file anywhere on your system'
|
||||
Left = 608
|
||||
Top = 8
|
||||
end
|
||||
object MainMenu: TMainMenu
|
||||
Left = 552
|
||||
Top = 8
|
||||
object miFile: TMenuItem
|
||||
Caption = 'File'
|
||||
OnClick = miFileClick
|
||||
object miOpen: TMenuItem
|
||||
Caption = 'Open...'
|
||||
ShortCut = 16463
|
||||
OnClick = miOpenClick
|
||||
end
|
||||
object miClose: TMenuItem
|
||||
Caption = 'Close'
|
||||
OnClick = miCloseClick
|
||||
end
|
||||
end
|
||||
object miEdit: TMenuItem
|
||||
Caption = 'Edit'
|
||||
OnClick = miEditClick
|
||||
object miSelectAll: TMenuItem
|
||||
Caption = 'Select all'
|
||||
ShortCut = 16449
|
||||
OnClick = miSelectAllClick
|
||||
end
|
||||
object miSelectNone: TMenuItem
|
||||
Caption = 'Select none'
|
||||
OnClick = miSelectNoneClick
|
||||
end
|
||||
object miSepEdit: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object miCopy: TMenuItem
|
||||
Caption = 'Copy'
|
||||
ShortCut = 16451
|
||||
OnClick = miCopyClick
|
||||
end
|
||||
end
|
||||
end
|
||||
object SynHTMLSyn: TSynHTMLSyn
|
||||
Options.AutoDetectEnabled = False
|
||||
Options.AutoDetectLineLimit = 0
|
||||
Options.Visible = False
|
||||
Left = 489
|
||||
Top = 8
|
||||
end
|
||||
object pmLines: TPopupMenu
|
||||
OnPopup = pmLinesPopup
|
||||
Left = 432
|
||||
Top = 8
|
||||
object miLinesSelectAll: TMenuItem
|
||||
Caption = 'Select all'
|
||||
OnClick = miLinesSelectAllClick
|
||||
end
|
||||
object miLinesSelectNone: TMenuItem
|
||||
Caption = 'Select none'
|
||||
OnClick = miLinesSelectNoneClick
|
||||
end
|
||||
object miLinesSep: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object miLinesCopy: TMenuItem
|
||||
Caption = 'Copy'
|
||||
OnClick = miLinesCopyClick
|
||||
end
|
||||
end
|
||||
end
|
244
Example/THtmlDocument/uMain.pas
Normal file
244
Example/THtmlDocument/uMain.pas
Normal file
@@ -0,0 +1,244 @@
|
||||
unit uMain;
|
||||
|
||||
//////////////////////////////////////
|
||||
/// Lina Web Document Example ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IF CompilerVersion <> 26.0}
|
||||
{$MESSAGE ERROR 'This example was written to compile under Delphi XE5'}
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
{ Dies ist ein Beispielprojekt, um den Umgang und die m�gliche Verwendeng der
|
||||
THtmlDocument-Klasse und einiger uWebCtrls-Methoden von LinaComponents zu
|
||||
veranschaulichen.
|
||||
Es darf als Grundlage f�r eingene Projekte ohne vorherige Einwilligung
|
||||
verwendet werden, solange mindestens eine LinaComponents-Unit im Projekt
|
||||
verarbeitet wird.
|
||||
|
||||
WICHTIG: Im Gegensatz zur Entwicklung der LinaComponents selbst wurde bei
|
||||
diesem Beispielprojekt keinerlei R�cksicht auf Abw�rtskompatibilit�t
|
||||
genommen. Dieses Beispielprogramm wurde in Embarcadero Delphi XE5
|
||||
erstellt, entwickelt und kompiliert und k�nnte bei �lteren Delphi-
|
||||
Versionen zu Kompilierungsfehlern f�hren. }
|
||||
|
||||
uses
|
||||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
|
||||
System.Generics.Collections, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
|
||||
Vcl.ExtCtrls, Vcl.ComCtrls, SynEditHighlighter, SynHighlighterHtml, SynEdit, Vcl.Menus,
|
||||
uWebCtrls, SynMemo;
|
||||
|
||||
type
|
||||
TfmMain = class(TForm)
|
||||
OpenDialog: TOpenDialog;
|
||||
tvStructure: TTreeView;
|
||||
MainMenu: TMainMenu;
|
||||
miFile: TMenuItem;
|
||||
miOpen: TMenuItem;
|
||||
miClose: TMenuItem;
|
||||
miEdit: TMenuItem;
|
||||
miSelectAll: TMenuItem;
|
||||
miSelectNone: TMenuItem;
|
||||
miSepEdit: TMenuItem;
|
||||
miCopy: TMenuItem;
|
||||
pnProperties: TPanel;
|
||||
lvParams: TListView;
|
||||
SynHTMLSyn: TSynHTMLSyn;
|
||||
mmLines: TSynMemo;
|
||||
pmLines: TPopupMenu;
|
||||
miLinesSelectAll: TMenuItem;
|
||||
miLinesSelectNone: TMenuItem;
|
||||
miLinesSep: TMenuItem;
|
||||
miLinesCopy: TMenuItem;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure miOpenClick(Sender: TObject);
|
||||
procedure tvStructureClick(Sender: TObject);
|
||||
procedure miCloseClick(Sender: TObject);
|
||||
procedure miFileClick(Sender: TObject);
|
||||
procedure miEditClick(Sender: TObject);
|
||||
procedure pmLinesPopup(Sender: TObject);
|
||||
procedure miLinesSelectAllClick(Sender: TObject);
|
||||
procedure miLinesSelectNoneClick(Sender: TObject);
|
||||
procedure miLinesCopyClick(Sender: TObject);
|
||||
procedure miSelectAllClick(Sender: TObject);
|
||||
procedure miSelectNoneClick(Sender: TObject);
|
||||
procedure miCopyClick(Sender: TObject);
|
||||
procedure miCutClick(Sender: TObject);
|
||||
procedure miPasteClick(Sender: TObject);
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
Opened: Boolean;
|
||||
Nodes: TObjectDictionary<THtmlDocumentTag,TTreeNode>;
|
||||
Tags: TObjectDictionary<TTreeNode,THtmlDocumentTag>;
|
||||
HtmlDocument: THtmlDocument;
|
||||
procedure HtmlDocumentParseSuccess(Sender: TObject);
|
||||
procedure AddTagNode(Tag: THtmlDocumentTag);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
end;
|
||||
|
||||
var
|
||||
fmMain: TfmMain;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfmMain.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Nodes := TObjectDictionary<THtmlDocumentTag,TTreeNode>.Create([]);
|
||||
Tags := TObjectDictionary<TTreeNode,THtmlDocumentTag>.Create([]);
|
||||
HtmlDocument := THtmlDocument.Create;
|
||||
HtmlDocument.OnParseSuccess := HtmlDocumentParseSuccess;
|
||||
miClose.Click;
|
||||
end;
|
||||
|
||||
procedure TfmMain.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
Nodes.Free;
|
||||
Tags.Free;
|
||||
HtmlDocument.Free;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miCloseClick(Sender: TObject);
|
||||
begin
|
||||
Opened := False;
|
||||
Nodes.Clear;
|
||||
Tags.Clear;
|
||||
tvStructure.Items.Clear;
|
||||
tvStructure.Enabled := False;
|
||||
lvParams.Items.Clear;
|
||||
lvParams.Enabled := False;
|
||||
mmLines.Lines.Clear;
|
||||
mmLines.Enabled := False;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miCopyClick(Sender: TObject);
|
||||
begin
|
||||
mmLines.CopyToClipboard;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miCutClick(Sender: TObject);
|
||||
begin
|
||||
mmLines.CutToClipboard;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miEditClick(Sender: TObject);
|
||||
begin
|
||||
miSelectAll.Enabled := Opened and (ActiveControl = mmLines) and (mmLines.SelLength <> Length(mmLines.Lines.Text));
|
||||
miSelectNone.Enabled := Opened and (ActiveControl = mmLines) and (mmLines.SelLength <> 0);
|
||||
miCopy.Enabled := Opened and (ActiveControl = mmLines) and (mmLines.SelLength <> 0);
|
||||
end;
|
||||
|
||||
procedure TfmMain.miFileClick(Sender: TObject);
|
||||
begin
|
||||
miClose.Enabled := Opened;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miLinesCopyClick(Sender: TObject);
|
||||
begin
|
||||
miCopy.Click;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miLinesSelectAllClick(Sender: TObject);
|
||||
begin
|
||||
miSelectAll.Click;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miLinesSelectNoneClick(Sender: TObject);
|
||||
begin
|
||||
miSelectNone.Click;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miOpenClick(Sender: TObject);
|
||||
begin
|
||||
if OpenDialog.Execute then
|
||||
begin
|
||||
miClose.Click;
|
||||
Opened := True;
|
||||
tvStructure.Enabled := True;
|
||||
tvStructure.Items.Add(nil,'(root)');
|
||||
lvParams.Enabled := True;
|
||||
mmLines.Enabled := True;
|
||||
Nodes.Add(nil,tvStructure.Items.Item[0]);
|
||||
Tags.Add(tvStructure.Items.Item[0],nil);
|
||||
HtmlDocument.Lines.LoadFromFile(OpenDialog.FileName);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miPasteClick(Sender: TObject);
|
||||
begin
|
||||
mmLines.PasteFromClipboard;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miSelectAllClick(Sender: TObject);
|
||||
begin
|
||||
mmLines.SelectAll;
|
||||
end;
|
||||
|
||||
procedure TfmMain.miSelectNoneClick(Sender: TObject);
|
||||
begin
|
||||
mmLines.SelLength := 0;
|
||||
end;
|
||||
|
||||
procedure TfmMain.pmLinesPopup(Sender: TObject);
|
||||
begin
|
||||
miEdit.Click;
|
||||
miLinesSelectAll.Enabled := miSelectAll.Enabled;
|
||||
miLinesSelectNone.Enabled := miSelectNone.Enabled;
|
||||
miLinesCopy.Enabled := miCopy.Enabled;
|
||||
end;
|
||||
|
||||
procedure TfmMain.tvStructureClick(Sender: TObject);
|
||||
var
|
||||
Index: Integer;
|
||||
Param: TListItem;
|
||||
begin
|
||||
if tvStructure.SelectionCount <> 0 then
|
||||
begin
|
||||
lvParams.Items.Clear;
|
||||
if Tags.Items[tvStructure.Selected] = nil then
|
||||
begin
|
||||
mmLines.Lines.Assign(HtmlDocument.Lines);
|
||||
end else
|
||||
begin
|
||||
mmLines.Lines.Assign(Tags.Items[tvStructure.Selected].Lines);
|
||||
for Index := 0 to Tags.Items[tvStructure.Selected].ParamCount - 1 do
|
||||
begin
|
||||
Param := lvParams.Items.Add;
|
||||
Param.Caption := Tags.Items[tvStructure.Selected].Params[Index].Name;
|
||||
Param.SubItems.Add(Tags.Items[tvStructure.Selected].Params[Index].Name);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfmMain.HtmlDocumentParseSuccess(Sender: TObject);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
for Index := 0 to HtmlDocument.TagCount - 1 do
|
||||
begin
|
||||
AddTagNode(HtmlDocument.Tags[Index]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfmMain.AddTagNode(Tag: THtmlDocumentTag);
|
||||
var
|
||||
Index: Integer;
|
||||
Node: TTreeNode;
|
||||
begin
|
||||
Node := tvStructure.Items.AddChild(Nodes.Items[Tag.Parent],Tag.Name);
|
||||
Nodes.Add(Tag,Node);
|
||||
Tags.Add(Node,Tag);
|
||||
for Index := 0 to Tag.TagCount - 1 do
|
||||
begin
|
||||
AddTagNode(Tag.Tags[Index]);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
unit uMain;
|
||||
|
||||
//////////////////////////////////////
|
||||
/// Lina File Tools Example ///
|
||||
/// Lina Win File Example ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -26,13 +26,11 @@ type
|
||||
TPathEditPaths = set of (pepURL_History,pepURL_Recent,pepFS_Dirs,pepFS_Shell);
|
||||
TValueEditAllow = set of (veaNumbers,veaLetters,veaSpaces,veaSeparators,veaOperators,veaOther);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TPaintMemoPaintEvent = procedure(Sender: TObject) of object;
|
||||
TShortcutLabelOpenTargetEvent = procedure(Sender: TObject) of object;
|
||||
TShortcutLabelOpenTargetQueryEvent = procedure(Sender: TObject; var CanOpen: Boolean) of object;
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
@@ -313,6 +311,8 @@ type
|
||||
{$ENDIF}
|
||||
|
||||
function BmpToIco(Bitmap: TBitmap): TIcon;
|
||||
function BmpToMask(Bitmap: TBitmap; BkColor: TColor = clNone): TBitmap;
|
||||
procedure BmpResize(var Bitmap: TBitmap; NewWidth, NewHeight: Integer);
|
||||
function TargetVisited(Target: String): Boolean;
|
||||
|
||||
const
|
||||
@@ -350,6 +350,29 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function BmpToMask(Bitmap: TBitmap; BkColor: TColor = clNone): TBitmap;
|
||||
begin
|
||||
Result := TBitmap.Create;
|
||||
Result.Assign(Bitmap);
|
||||
Result.Canvas.Brush.Color := BkColor;
|
||||
Result.Monochrome := True;
|
||||
end;
|
||||
|
||||
procedure BmpResize(var Bitmap: TBitmap; NewWidth, NewHeight: Integer);
|
||||
var
|
||||
ResizedBitmap: TBitmap;
|
||||
begin
|
||||
if (Bitmap.Width <> NewWidth) and (Bitmap.Height <> NewHeight) then
|
||||
begin
|
||||
ResizedBitmap := TBitmap.Create;
|
||||
ResizedBitmap.Assign(Bitmap);
|
||||
ResizedBitmap.SetSize(NewWidth,NewHeight);
|
||||
SetStretchBltMode(Bitmap.Canvas.Handle,HALFTONE);
|
||||
StretchBlt(ResizedBitmap.Canvas.Handle,0,0,ResizedBitmap.Width,ResizedBitmap.Height,Bitmap.Canvas.Handle,0,0,Bitmap.Width,Bitmap.Height,SRCCOPY);
|
||||
Bitmap.Assign(ResizedBitmap);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TargetVisited(Target: String): Boolean;
|
||||
begin
|
||||
if VisitedTargets = nil then
|
||||
|
@@ -21,20 +21,17 @@ type
|
||||
ECalculate = class(Exception);
|
||||
EIdentifierExists = class(Exception);
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
TCalcOperation = (coAdd,coSub,coMul,coDiv,coMod,coExp);
|
||||
TCalcOperations = set of TCalcOperation;
|
||||
TDecimalSeparators = set of (dsPoint,dsComma);
|
||||
TCalculatorOptions = set of (coBrackets,coOperatorsOrder);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TCalculatorCalculateEvent = procedure(Sender: TObject) of object;
|
||||
TCalculatorConstantEvent = procedure(Sender: TObject; const Name: String) of object;
|
||||
TCalculatorFunctionEvent = procedure(Sender: TObject; const Name: String; var Value: Extended) of object;
|
||||
|
||||
type
|
||||
TCalculatorTerm = record
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
|
@@ -22,12 +22,10 @@ type
|
||||
EInvalidExt = class(Exception);
|
||||
EInvalidAlias = class(Exception);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TContextMenuCreateItemEvent = procedure(Sender: TObject) of object;
|
||||
TContextMenuCreateEntryEvent = procedure(Sender: TObject) of object;
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
TContextMenuItem = class(TCollectionItem)
|
||||
private
|
||||
@@ -64,13 +62,16 @@ type
|
||||
FExt: ShortString;
|
||||
FAutoLoad: Boolean;
|
||||
FAlias: ShortString;
|
||||
FAliasRedirect: Boolean;
|
||||
{ Ereignisse }
|
||||
FCreateItemEvent: TContextMenuCreateItemEvent;
|
||||
FCreateEntryEvent: TContextMenuCreateEntryEvent;
|
||||
{ Methoden }
|
||||
function GetRegKey: String;
|
||||
procedure SetExt(Value: ShortString);
|
||||
procedure SetAutoLoad(Value: Boolean);
|
||||
procedure SetAlias(Value: ShortString);
|
||||
procedure SetAliasRedirect(Value: Boolean);
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
procedure CreateMenuItem(const AName: TComponentName;
|
||||
@@ -85,6 +86,7 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure LoadFromRegistry;
|
||||
procedure SaveToRegistry;
|
||||
property RegKey: String read GetRegKey;
|
||||
published
|
||||
{ Published-Deklarationen }
|
||||
property About: TComponentAbout read FAbout;
|
||||
@@ -92,6 +94,7 @@ type
|
||||
property Ext: ShortString read FExt write SetExt;
|
||||
property AutoLoad: Boolean read FAutoLoad write SetAutoLoad default False;
|
||||
property Alias: ShortString read FAlias write SetAlias;
|
||||
property AliasRedirect: Boolean read FAliasRedirect write SetAliasRedirect default True;
|
||||
{ Ereignisse }
|
||||
property OnCreateItem: TContextMenuCreateItemEvent read FCreateItemEvent write FCreateItemEvent;
|
||||
property OnCreateEntry: TContextMenuCreateEntryEvent read FCreateEntryEvent write FCreateEntryEvent;
|
||||
@@ -101,8 +104,6 @@ type
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
function ExtStrToRegKey(ExtStr: String): String;
|
||||
|
||||
const
|
||||
{ Sonstige }
|
||||
ContextRegPathShell = '\shell';
|
||||
@@ -117,17 +118,6 @@ implementation
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function ExtStrToRegKey(ExtStr: String): String;
|
||||
begin
|
||||
if ExtStr = '*' then
|
||||
begin
|
||||
Result := ExtStr;
|
||||
end else
|
||||
begin
|
||||
Result := '.' + ExtStr;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TContextMenuItem
|
||||
---------------------------------------------------------------------------- }
|
||||
@@ -184,6 +174,7 @@ begin
|
||||
FItems := TContextMenuItems.Create(TContextMenuItem);
|
||||
FExt := '*';
|
||||
FAutoLoad := False;
|
||||
FAliasRedirect := True;
|
||||
end;
|
||||
|
||||
destructor TContextMenu.Destroy;
|
||||
@@ -193,6 +184,23 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TContextMenu.GetRegKey: String;
|
||||
begin
|
||||
if (Length(Alias) = 0) or (not AliasRedirect) then
|
||||
begin
|
||||
if Ext = '*' then
|
||||
begin
|
||||
Result := Ext;
|
||||
end else
|
||||
begin
|
||||
Result := '.' + Ext;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
Result := Alias;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TContextMenu.SetExt(Value: ShortString);
|
||||
var
|
||||
Index: Integer;
|
||||
@@ -237,7 +245,7 @@ procedure TContextMenu.SetAlias(Value: ShortString);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if Value = FExt then
|
||||
if Value = FAlias then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
@@ -252,6 +260,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
FAlias := Value;
|
||||
if FAutoLoad = True then
|
||||
begin
|
||||
LoadFromRegistry;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TContextMenu.SetAliasRedirect(Value: Boolean);
|
||||
begin
|
||||
FAliasRedirect := Value;
|
||||
if FAutoLoad = True then
|
||||
begin
|
||||
LoadFromRegistry;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TContextMenu.CreateMenuItem(const AName: TComponentName;
|
||||
@@ -277,7 +298,7 @@ procedure TContextMenu.CreateRegistryEntry(var ARegistry: TRegistry;
|
||||
var
|
||||
Key: String;
|
||||
begin
|
||||
Key := ExtStrToRegKey(Ext) + ContextRegPathShell;
|
||||
Key := RegKey + ContextRegPathShell;
|
||||
with ARegistry do
|
||||
begin
|
||||
OpenKey(Key + PathDelim + AName,True);
|
||||
@@ -310,16 +331,16 @@ begin
|
||||
try
|
||||
Reg.RootKey := HKEY_CLASSES_ROOT;
|
||||
Reg.Access := KEY_READ;
|
||||
if Reg.KeyExists(ExtStrToRegKey(Ext)) = True then
|
||||
if Reg.KeyExists(RegKey) = True then
|
||||
begin
|
||||
Reg.OpenKeyReadOnly(ExtStrToRegKey(Ext));
|
||||
Reg.OpenKeyReadOnly(RegKey);
|
||||
if Reg.ValueExists('') = True then
|
||||
begin
|
||||
FAlias := Reg.ReadString('');
|
||||
end;
|
||||
Reg.CloseKey;
|
||||
end;
|
||||
Key := ExtStrToRegKey(Ext) + ContextRegPathShell;
|
||||
Key := RegKey + ContextRegPathShell;
|
||||
if Reg.KeyExists(Key) = True then
|
||||
begin
|
||||
Reg.OpenKeyReadOnly(Key);
|
||||
@@ -376,7 +397,7 @@ begin
|
||||
try
|
||||
Reg.RootKey := HKEY_CLASSES_ROOT;
|
||||
Reg.Access := KEY_WRITE;
|
||||
Reg.OpenKey(ExtStrToRegKey(Ext),True);
|
||||
Reg.OpenKey(RegKey,True);
|
||||
Reg.WriteString('',FAlias);
|
||||
Reg.CloseKey;
|
||||
for Index := 0 to Items.Count - 1 do
|
||||
|
@@ -30,7 +30,6 @@ type
|
||||
EDllFileNoExist = class(Exception);
|
||||
EDllMethodNoExist = class(Exception);
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
TFileExecuteMode = (feOpen,feEdit,feExplore,feFind,fePrint,feProperties,feRunAs,feRunAsUser);
|
||||
TFileNameStyles = set of (fnDirectory,fnExtension);
|
||||
@@ -38,7 +37,6 @@ type
|
||||
TInvalidFileName = String[4];
|
||||
TInvalidFileNames = array[1..22] of TInvalidFileName;
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
TDllFile = record
|
||||
FileName: String;
|
||||
@@ -163,6 +161,7 @@ type
|
||||
function GetFileCreated(FileName: String): TDateTime;
|
||||
function GetFileAccessed(FileName: String): TDateTime;
|
||||
function GetFileAttributes(FileName: String): TFileAttributes;
|
||||
function GetFileOwner(FileName: String): String;
|
||||
|
||||
const
|
||||
PathDelims = [PathDelim,'/'];
|
||||
@@ -685,6 +684,48 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetFileOwner(FileName: String): String;
|
||||
var
|
||||
SecDescr: PSecurityDescriptor;
|
||||
SizeNeeded, SizeNeeded2: DWORD;
|
||||
OwnerSID: PSID;
|
||||
OwnerDefault: BOOL;
|
||||
OwnerName, DomainName: PChar;
|
||||
OwnerType: SID_NAME_USE;
|
||||
begin
|
||||
GetMem(SecDescr,1024);
|
||||
GetMem(OwnerSID,SizeOf(PSID));
|
||||
GetMem(OwnerName,1024);
|
||||
GetMem(DomainName,1024);
|
||||
try
|
||||
if GetFileSecurity(PChar(FileName),OWNER_SECURITY_INFORMATION,SecDescr,1024,SizeNeeded) = True then
|
||||
begin
|
||||
if GetSecurityDescriptorOwner(SecDescr,OwnerSID,OwnerDefault) = True then
|
||||
begin
|
||||
SizeNeeded := 1024;
|
||||
SizeNeeded2 := 1024;
|
||||
if LookupAccountSID(nil,OwnerSID,OwnerName,SizeNeeded,DomainName,SizeNeeded2,OwnerType) = True then
|
||||
begin
|
||||
Result := OwnerName + '@' + DomainName;
|
||||
end else
|
||||
begin
|
||||
raise ENoGetFileOwner.Create('Could not determine the file owner');
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
raise ENoGetFileOwner.Create('Could not determine the file owner');
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
raise ENoGetFileOwner.Create('Could not determine the file owner');
|
||||
end;
|
||||
finally
|
||||
FreeMem(SecDescr);
|
||||
FreeMem(OwnerName);
|
||||
FreeMem(DomainName);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TDllManager
|
||||
---------------------------------------------------------------------------- }
|
||||
@@ -1009,45 +1050,8 @@ begin
|
||||
end;
|
||||
|
||||
function TWinFile.GetOwner: String;
|
||||
var
|
||||
SecDescr: PSecurityDescriptor;
|
||||
SizeNeeded, SizeNeeded2: DWORD;
|
||||
OwnerSID: PSID;
|
||||
OwnerDefault: BOOL;
|
||||
OwnerName, DomainName: PChar;
|
||||
OwnerType: SID_NAME_USE;
|
||||
begin
|
||||
GetMem(SecDescr,1024);
|
||||
GetMem(OwnerSID,SizeOf(PSID));
|
||||
GetMem(OwnerName,1024);
|
||||
GetMem(DomainName,1024);
|
||||
try
|
||||
if GetFileSecurity(PChar(FFileName),OWNER_SECURITY_INFORMATION,SecDescr,1024,SizeNeeded) = True then
|
||||
begin
|
||||
if GetSecurityDescriptorOwner(SecDescr,OwnerSID,OwnerDefault) = True then
|
||||
begin
|
||||
SizeNeeded := 1024;
|
||||
SizeNeeded2 := 1024;
|
||||
if LookupAccountSID(nil,OwnerSID,OwnerName,SizeNeeded,DomainName,SizeNeeded2,OwnerType) = True then
|
||||
begin
|
||||
Result := OwnerName + '@' + DomainName;
|
||||
end else
|
||||
begin
|
||||
raise ENoGetFileOwner.Create('Could not determine the file owner');
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
raise ENoGetFileOwner.Create('Could not determine the file owner');
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
raise ENoGetFileOwner.Create('Could not determine the file owner');
|
||||
end;
|
||||
finally
|
||||
FreeMem(SecDescr);
|
||||
FreeMem(OwnerName);
|
||||
FreeMem(DomainName);
|
||||
end;
|
||||
Result := GetFileOwner(FFileName);
|
||||
end;
|
||||
|
||||
function TWinFile.Execute: Boolean;
|
||||
|
@@ -24,7 +24,6 @@ type
|
||||
EInvalidParamFormat = class(Exception);
|
||||
EInvalidDiagramGap = class(Exception);
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
TSplashScreenMode = (ssmDefault,ssmModal);
|
||||
TSplashScreenAnimation = (ssaNone,ssaShallow);
|
||||
@@ -33,7 +32,6 @@ type
|
||||
TDiagramLayout = (dloColumns,dloPoints,dloLines,dloCustom);
|
||||
TDiagramGridLines = (dglHorizontal,dglVertical,dglBoth);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TSplashScreenCreateEvent = procedure(Sender: TObject) of object;
|
||||
TSplashScreenDestroyEvent = procedure(Sender: TObject) of object;
|
||||
@@ -46,7 +44,6 @@ type
|
||||
TDiagramDrawValueEvent = procedure(Sender: TObject; Index: Integer) of object;
|
||||
TDiagramCustomDrawValueEvent = procedure(Sender: TObject; Index: Integer) of object;
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
|
||||
{ TSplash... }
|
||||
|
@@ -22,21 +22,17 @@ type
|
||||
ELanguageTagExists = class(Exception);
|
||||
ELocalizationParse = class(Exception);
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
TLanguageTag = String[3];
|
||||
TCommentAllow = type TLinePosition;
|
||||
TLocalizationApplyMode = (laCustom,laAll,laMainForm,laNone);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TLocalizationManagerChangeQueryEvent = procedure(Sender: TObject; OldIndex, NewIndex: Integer; var CanChange: Boolean) of object;
|
||||
TLocalizationManagerChangeEvent = procedure(Sender: TObject; OldIndex, NewIndex: Integer) of object;
|
||||
TLocalizationManagerChangeSuccessEvent = procedure(Sender: TObject; OldIndex, NewIndex: Integer) of object;
|
||||
TLocalizationManagerChangeFailEvent = procedure(Sender: TObject; OldIndex, NewIndex: Integer) of object;
|
||||
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
TLocalizationFormat = class(TPersistent)
|
||||
private
|
||||
|
@@ -33,13 +33,11 @@ type
|
||||
EMissingComponentName = class(Exception);
|
||||
EInvalidCodeLine = class(Exception);
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
TScriptReturnMode = (srNone,srAll,srErrors);
|
||||
TScriptReturnStyle = (srSimple,srTime,srDateTime,srName);
|
||||
TScriptLibraries = set of (slClasses,slControls,slStdCtrls,slForms,slDateUtils,slComObj,slDB,slCustom);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TScriptManagerCreateEvent = procedure(Sender: TObject) of object;
|
||||
TScriptManagerDestroyEvent = procedure(Sender: TObject) of object;
|
||||
@@ -49,7 +47,6 @@ type
|
||||
TScriptManagerExecuteEvent = procedure(Sender: TObject) of object;
|
||||
TScriptManagerAfterExecuteEvent = procedure(Sender: TObject) of object;
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
TScriptManager = class;
|
||||
|
||||
|
@@ -22,7 +22,6 @@ type
|
||||
EDelphiVersion = class(Exception);
|
||||
EInvalidKey = class(Exception);
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
TBatteryFlag = (bfHealthy,bfLow,bfCritical,bfCharge,bfHealthyAccu,bfNone,bfUnknown);
|
||||
TBatteryStatus = (bsInternal,bsExternal);
|
||||
@@ -36,7 +35,6 @@ type
|
||||
TDelphiEdition = (dePersonal,deProfessional,deEnterprise,deUltimate,deArchitect);
|
||||
TCryptMode = (cmCustom,cmXor,cmCaesar,cmVigenere);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TProcessManagerUpdateEvent = procedure(Sender: TObject; const Modified: Boolean) of object;
|
||||
TStringContainerChangeEvent = procedure(Sender: TObject) of object;
|
||||
@@ -45,7 +43,6 @@ type
|
||||
TCryptKeyChangeEvent = procedure(Sender: TObject) of object;
|
||||
TCryptKeyChangeQueryEvent = procedure(Sender: TObject; const NewKey: String; var CanChange: Boolean) of object;
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
PTOKEN_USER = ^TOKEN_USER;
|
||||
_TOKEN_USER = record
|
||||
@@ -660,15 +657,15 @@ var
|
||||
Snapshot: THandle;
|
||||
ProcEntry: TProcessEntry32;
|
||||
begin
|
||||
OldNames := Names.Text;
|
||||
Names.Clear;
|
||||
OldNames := FNames.Text;
|
||||
FNames.Clear;
|
||||
Snapshot := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS,0);
|
||||
try
|
||||
ProcEntry.dwSize := SizeOf(ProcEntry);
|
||||
if Process32First(Snapshot,ProcEntry) = True then
|
||||
begin
|
||||
repeat
|
||||
Names.Add(ProcEntry.szExeFile);
|
||||
FNames.Add(ProcEntry.szExeFile);
|
||||
until (Process32Next(Snapshot,ProcEntry) = False)
|
||||
end else
|
||||
begin
|
||||
@@ -679,7 +676,7 @@ begin
|
||||
end;
|
||||
if Assigned(OnUpdate) then
|
||||
begin
|
||||
OnUpdate(Self,OldNames = Names.Text);
|
||||
OnUpdate(Self,OldNames = FNames.Text);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@@ -13,7 +13,7 @@ interface
|
||||
|
||||
uses
|
||||
{ Standard-Units }
|
||||
SysUtils, Classes, Math, Windows, Graphics, Printers, TypInfo
|
||||
SysUtils, Classes, Math, Windows, Graphics, Printers, TypInfo, Controls
|
||||
{$IFNDEF NO_GENERIC}
|
||||
,Generics.Collections
|
||||
{$ENDIF}
|
||||
@@ -25,7 +25,6 @@ type
|
||||
EStringCharAccess = class(Exception);
|
||||
EInvalidBFCommand = class(Exception);
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
TLinePosition = (lpAnyPosition,lpBeginning); //Mutter-Hilfsklasse f�r s�mtliche Enums
|
||||
TStringFilterMode = type TLinePosition;
|
||||
@@ -35,7 +34,6 @@ type
|
||||
TVerticalAlignment = (taAlignTop, taAlignBottom, taVerticalCenter);
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
{$IFNDEF NO_GENERIC}
|
||||
TVariantList = TList<Variant>;
|
||||
TIntegerList = TList<Integer>;
|
||||
@@ -167,6 +165,21 @@ type
|
||||
TVector = TFloatArray;
|
||||
TMatrix = array of TVector;
|
||||
|
||||
TRGBTripleArray = array [Word] of TRGBTriple;
|
||||
PRGBTripleArray = ^TRGBTripleArray;
|
||||
|
||||
TLonelyByte = array [0..0] of Byte;
|
||||
TLonelyWord = array [0..0] of Word;
|
||||
TLonelyCardinal = array [0..0] of Cardinal;
|
||||
TLonelyUInt64 = array [0..0] of UInt64;
|
||||
TLonelyShortInt = array [0..0] of ShortInt;
|
||||
TLonelySmallInt = array [0..0] of SmallInt;
|
||||
TLonelyInteger = array [0..0] of Integer;
|
||||
TLonelyInt64 = array [0..0] of Int64;
|
||||
TLonelySingle = array [0..0] of Extended;
|
||||
TLonelyDouble = array [0..0] of Double;
|
||||
TLonelyExtended = array [0..0] of Extended;
|
||||
|
||||
TCycle = class
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -210,6 +223,48 @@ type
|
||||
property Step: Integer read FStep write FStep default 1;
|
||||
end;
|
||||
|
||||
TField = class
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FPoints: array of TPoint;
|
||||
FHighest: Integer;
|
||||
FLowest: Integer;
|
||||
FLeftest: Integer;
|
||||
FRightest: Integer;
|
||||
function GetPoints(Index: Integer): TPoint;
|
||||
procedure SetPoints(Index: Integer; Value: TPoint);
|
||||
function GetPointCount: Integer;
|
||||
function GetRect: TRect;
|
||||
function GetHighest: TPoint;
|
||||
function GetLowest: TPoint;
|
||||
function GetLeftest: TPoint;
|
||||
function GetRightest: TPoint;
|
||||
function GetMinDistance: TPoint;
|
||||
function GetMaxDistance: TPoint;
|
||||
function GetAverage: TPoint;
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create; overload;
|
||||
constructor Create(APoints: array of TPoint); overload;
|
||||
destructor Destroy; override;
|
||||
function Add(Point: TPoint): Integer;
|
||||
function AddPoints(APoints: array of TPoint): Integer;
|
||||
procedure Delete(Index: Integer);
|
||||
procedure Remove(Point: TPoint);
|
||||
function IndexOf(Point: TPoint): Integer;
|
||||
function Contains(Point: TPoint): Boolean;
|
||||
property Points[Index: Integer]: TPoint read GetPoints write SetPoints;
|
||||
property PointCount: Integer read GetPointCount;
|
||||
property Rect: TRect read GetRect;
|
||||
property Highest: TPoint read GetHighest;
|
||||
property Lowest: TPoint read GetLowest;
|
||||
property Leftest: TPoint read GetLeftest;
|
||||
property Rightest: TPoint read GetRightest;
|
||||
property Average: TPoint read GetAverage;
|
||||
property MinDistance: TPoint read GetMinDistance;
|
||||
property MaxDistance: TPoint read GetMaxDistance;
|
||||
end;
|
||||
|
||||
TFilteredStringList = class(TStringList)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -407,7 +462,7 @@ type
|
||||
function StringToRange(const S: String; var Range: TRange): Boolean;
|
||||
function ExprInStr(const S: String; Position: Integer): String;
|
||||
function Factional(X: Byte): Cardinal;
|
||||
function ExtractClassName(FullClassName: String; CaseSensitive: Boolean = True): String;
|
||||
function ExtractClassName(FullClassName: String; CaseSensitive: Boolean = False): String;
|
||||
function CountLines(S: String): Integer;
|
||||
function CountLine(S: String; Line: Integer): Integer;
|
||||
function Wrappable(S: String; Canvas: TCanvas; MaxWidth: Integer): Boolean;
|
||||
@@ -423,6 +478,7 @@ type
|
||||
function FontSizeToHeight(Size: Integer; PpI: Integer): Integer;
|
||||
function FontHeightToSize(Height: Integer; PpI: Integer): Integer;
|
||||
function ComponentByTag(Owner: TComponent; const Tag: Integer): TComponent;
|
||||
function ControlIndex(Control: TControl): Integer;
|
||||
function IntToStrMinLength(Value: Integer; MinLength: SmallInt): String;
|
||||
function MultiPos(const SubStr, Str: ShortString; Offset: Integer = 1): TIntegerArray; overload;
|
||||
function MultiPos(const SubStr, Str: String; Offset: Integer = 1): TIntegerArray; overload;
|
||||
@@ -434,6 +490,7 @@ type
|
||||
{$ENDIF}
|
||||
function ConsistsOf(const S: String; Chars: array of Char): Boolean; overload;
|
||||
function ConsistsOf(const S: String; Chars: TCharSet): Boolean; overload;
|
||||
procedure IndentBlock(var S: String; Indents: Byte; const Indent: Char = ' ');
|
||||
procedure Exchange(var X,Y); inline;
|
||||
procedure PrintText(Strings: TStrings; Font: TFont);
|
||||
procedure BFInterpret(const S: String; var P: Pointer); overload;
|
||||
@@ -1924,7 +1981,7 @@ asm
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function ExtractClassName(FullClassName: String; CaseSensitive: Boolean = True): String;
|
||||
function ExtractClassName(FullClassName: String; CaseSensitive: Boolean = False): String;
|
||||
begin
|
||||
if (Length(FullClassName) <> 0) and ((FullClassName[1] = 'T') or ((CaseSensitive = False) and (FullClassName[1] = 't'))) and ((FullClassName[2] in UppercaseLetters) or (CaseSensitive = False)) then
|
||||
begin
|
||||
@@ -2848,6 +2905,21 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function ControlIndex(Control: TControl): Integer;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
for Index := 0 to Control.Parent.ControlCount - 1 do
|
||||
begin
|
||||
if Control.Parent.Controls[Index] = Control then
|
||||
begin
|
||||
Result := Index;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function IntToStrMinLength(Value: Integer; MinLength: SmallInt): String;
|
||||
begin
|
||||
Result := IntToStr(Value);
|
||||
@@ -3096,6 +3168,20 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure IndentBlock(var S: String; Indents: Byte; const Indent: Char = ' ');
|
||||
var
|
||||
Index: Integer;
|
||||
Sequence: String;
|
||||
begin
|
||||
Sequence := StringOfChar(Indent, Indents);
|
||||
Index := 1;
|
||||
repeat
|
||||
Insert(Sequence, S, Index);
|
||||
Inc(Index, Indents);
|
||||
Index := Pos(sLineBreak, S, Index);
|
||||
until Index = 0;
|
||||
end;
|
||||
|
||||
procedure Exchange(var X,Y); inline;
|
||||
var
|
||||
Buffer: Pointer;
|
||||
@@ -3456,6 +3542,281 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TField
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TField.Create;
|
||||
begin
|
||||
Inherited;
|
||||
FHighest := -1;
|
||||
FLowest := -1;
|
||||
FLeftest := -1;
|
||||
FRightest := -1;
|
||||
end;
|
||||
|
||||
constructor TField.Create(APoints: array of TPoint);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
Create;
|
||||
AddPoints(APoints);
|
||||
end;
|
||||
|
||||
destructor TField.Destroy;
|
||||
begin
|
||||
//...
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TField.Add(Point: TPoint): Integer;
|
||||
begin
|
||||
Result := PointCount;
|
||||
SetLength(FPoints,Succ(Result));
|
||||
Points[Result] := Point;
|
||||
end;
|
||||
|
||||
function TField.AddPoints(APoints: array of TPoint): Integer;
|
||||
var
|
||||
Current: TPoint;
|
||||
begin
|
||||
for Current in APoints do
|
||||
begin
|
||||
Add(Current);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TField.Delete(Index: Integer);
|
||||
var
|
||||
CurrentIndex: Integer;
|
||||
begin
|
||||
Move(FPoints[Succ(Index)],FPoints[Index],SizeOf(TPoint) * (Length(FPoints) - Succ(Index)));
|
||||
SetLength(FPoints,Pred(Length(FPoints)));
|
||||
if Index = FHighest then
|
||||
begin
|
||||
if PointCount = 0 then
|
||||
begin
|
||||
FHighest := -1;
|
||||
end else
|
||||
begin
|
||||
FHighest := 0;
|
||||
for CurrentIndex := 1 to PointCount - 1 do
|
||||
begin
|
||||
if Points[CurrentIndex].Y > Highest.Y then
|
||||
begin
|
||||
FHighest := CurrentIndex;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if Index < FHighest then
|
||||
begin
|
||||
Dec(FHighest);
|
||||
end;
|
||||
end;
|
||||
if Index = FLowest then
|
||||
begin
|
||||
if PointCount = 0 then
|
||||
begin
|
||||
FLowest := -1;
|
||||
end else
|
||||
begin
|
||||
FLowest := 0;
|
||||
for CurrentIndex := 1 to PointCount - 1 do
|
||||
begin
|
||||
if Points[CurrentIndex].Y < Lowest.Y then
|
||||
begin
|
||||
FLowest := CurrentIndex;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if Index < FLowest then
|
||||
begin
|
||||
Dec(FLowest);
|
||||
end;
|
||||
end;
|
||||
if Index = FLeftest then
|
||||
begin
|
||||
if PointCount = 0 then
|
||||
begin
|
||||
FLeftest := -1;
|
||||
end else
|
||||
begin
|
||||
FLeftest := 0;
|
||||
for CurrentIndex := 1 to PointCount - 1 do
|
||||
begin
|
||||
if Points[CurrentIndex].X < Leftest.X then
|
||||
begin
|
||||
FLeftest := CurrentIndex;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if Index < FLeftest then
|
||||
begin
|
||||
Dec(FLeftest);
|
||||
end;
|
||||
end;
|
||||
if Index = FRightest then
|
||||
begin
|
||||
if PointCount = 0 then
|
||||
begin
|
||||
FRightest := -1;
|
||||
end else
|
||||
begin
|
||||
FRightest := 0;
|
||||
for CurrentIndex := 1 to PointCount - 1 do
|
||||
begin
|
||||
if Points[CurrentIndex].X > Rightest.X then
|
||||
begin
|
||||
FRightest := CurrentIndex;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if Index < FRightest then
|
||||
begin
|
||||
Dec(FRightest);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TField.Remove(Point: TPoint);
|
||||
begin
|
||||
Delete(IndexOf(Point));
|
||||
end;
|
||||
|
||||
function TField.IndexOf(Point: TPoint): Integer;
|
||||
begin
|
||||
for Result := 0 to PointCount - 1 do
|
||||
begin
|
||||
if Points[Result] = Point then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function TField.Contains(Point: TPoint): Boolean;
|
||||
begin
|
||||
Result := IndexOf(Point) <> -1;
|
||||
end;
|
||||
|
||||
function TField.GetPoints(Index: Integer): TPoint;
|
||||
begin
|
||||
Result := FPoints[Index];
|
||||
end;
|
||||
|
||||
procedure TField.SetPoints(Index: Integer; Value: TPoint);
|
||||
begin
|
||||
FPoints[Index] := Value;
|
||||
if (Value.X < Leftest.X) or (FLeftest = -1) then
|
||||
begin
|
||||
FLeftest := Index;
|
||||
end;
|
||||
if (Value.X > Rightest.X) or (FRightest = -1) then
|
||||
begin
|
||||
FRightest := Index;
|
||||
end;
|
||||
if (Value.Y < Lowest.Y) or (FLowest = -1) then
|
||||
begin
|
||||
FLowest := Index;
|
||||
end;
|
||||
if (Value.Y > Highest.Y) or (FHighest = -1) then
|
||||
begin
|
||||
FHighest := Index;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TField.GetPointCount: Integer;
|
||||
begin
|
||||
Result := Length(FPoints);
|
||||
end;
|
||||
|
||||
function TField.GetRect: TRect;
|
||||
begin
|
||||
Result := Classes.Rect(Leftest.X,Highest.Y,Rightest.X,Lowest.Y);
|
||||
end;
|
||||
|
||||
function TField.GetHighest: TPoint;
|
||||
begin
|
||||
if FHighest = -1 then
|
||||
begin
|
||||
Result := Point(0,0);
|
||||
end else
|
||||
begin
|
||||
Result := Points[FHighest];
|
||||
end;
|
||||
end;
|
||||
|
||||
function TField.GetLowest: TPoint;
|
||||
begin
|
||||
if FLowest = -1 then
|
||||
begin
|
||||
Result := Point(0,0);
|
||||
end else
|
||||
begin
|
||||
Result := Points[FLowest];
|
||||
end;
|
||||
end;
|
||||
|
||||
function TField.GetLeftest: TPoint;
|
||||
begin
|
||||
if FLeftest = -1 then
|
||||
begin
|
||||
Result := Point(0,0);
|
||||
end else
|
||||
begin
|
||||
Result := Points[FLeftest];
|
||||
end;
|
||||
end;
|
||||
|
||||
function TField.GetRightest: TPoint;
|
||||
begin
|
||||
if FRightest = -1 then
|
||||
begin
|
||||
Result := Point(0,0);
|
||||
end else
|
||||
begin
|
||||
Result := Points[FRightest];
|
||||
end;
|
||||
end;
|
||||
|
||||
function TField.GetMinDistance: TPoint;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TField.GetMaxDistance: TPoint;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TField.GetAverage: TPoint;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if PointCount = 0 then
|
||||
begin
|
||||
for Index := 0 to PointCount - 1 do
|
||||
begin
|
||||
Inc(Result.X,Points[Index].X);
|
||||
Inc(Result.Y,Points[Index].Y);
|
||||
end;
|
||||
Result.X := Result.X div PointCount;
|
||||
Result.Y := Result.Y div PointCount;
|
||||
end else
|
||||
begin
|
||||
Result := Point(0,0);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TFilteredStringList
|
||||
---------------------------------------------------------------------------- }
|
||||
|
@@ -22,14 +22,18 @@ type
|
||||
{ Fehlermeldungen }
|
||||
EInvalidWebAddress = class(Exception);
|
||||
EInvalidTagChar = class(Exception);
|
||||
EHtmlParse = class(Exception);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TDownloadWorkEvent = procedure(Sender: TObject; AWorkMode: TWorkMode) of object;
|
||||
TDownloadWorkBeginEvent = procedure(Sender: TObject; AWorkMode: TWorkMode) of object;
|
||||
TDownloadWorkEndEvent = procedure(Sender: TObject; AWorkMode: TWorkMode) of object;
|
||||
THtmlDocumentTag = class;
|
||||
THtmlDocumentTagAddEvent = procedure(Sender: TObject; Tag: THtmlDocumentTag) of object;
|
||||
THtmlDocumentParseEvent = procedure(Sender: TObject) of object;
|
||||
THtmlDocumentParseSuccessEvent = procedure(Sender: TObject) of object;
|
||||
THtmlDocumentParseFailEvent = procedure(Sender: TObject) of object;
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
@@ -80,6 +84,92 @@ type
|
||||
property SSL: Boolean read FSSL write FSSL default False;
|
||||
end;
|
||||
|
||||
THtmlDocumentTagParam = record
|
||||
Name: String;
|
||||
Value: String;
|
||||
end;
|
||||
|
||||
THtmlDocument = class;
|
||||
|
||||
THtmlDocumentTag = class
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FName: String;
|
||||
FIndex: Integer;
|
||||
FId: Integer;
|
||||
FDocument: THtmlDocument;
|
||||
FParent: THtmlDocumentTag;
|
||||
FLines: TStrings;
|
||||
FParams: array of THtmlDocumentTagParam;
|
||||
FTags: array of THtmlDocumentTag;
|
||||
FText: String;
|
||||
{ Methoden }
|
||||
function GetParams(Index: Integer): THtmlDocumentTagParam;
|
||||
function GetParamCount: Integer;
|
||||
function GetTags(Index: Integer): THtmlDocumentTag;
|
||||
function GetTagCount: Integer;
|
||||
procedure LinesChange(Sender: TObject);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(const AName: String; ADocument: THtmlDocument; AParent: THtmlDocumentTag); overload;
|
||||
constructor Create(const AName: String; ADocument: THtmlDocument; AParent: THtmlDocumentTag; ALines: TStrings); overload;
|
||||
destructor Destroy; override;
|
||||
function FindTag(const Id: Integer): THtmlDocumentTag;
|
||||
function IsParent(Tag: THtmlDocumentTag): Boolean;
|
||||
function GetPath(const Separator: Char = '.'): String;
|
||||
{ Eigenschaften }
|
||||
property Name: String read FName;
|
||||
property Index: Integer read FIndex;
|
||||
property Id: Integer read FId;
|
||||
property Document: THtmlDocument read FDocument;
|
||||
property Parent: THtmlDocumentTag read FParent;
|
||||
property Lines: TStrings read FLines;
|
||||
property Params[Index: Integer]: THtmlDocumentTagParam read GetParams;
|
||||
property ParamCount: Integer read GetParamCount;
|
||||
property Tags[Index: Integer]: THtmlDocumentTag read GetTags;
|
||||
property TagCount: Integer read GetTagCount;
|
||||
property Text: String read FText;
|
||||
end;
|
||||
|
||||
THtmlDocument = class(TPersistent)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FLines: TStrings;
|
||||
FTags: array of THtmlDocumentTag;
|
||||
FText: String;
|
||||
FNextId: Integer;
|
||||
{ Ereignisse }
|
||||
FTagAddEvent: THtmlDocumentTagAddEvent;
|
||||
FParseEvent: THtmlDocumentParseEvent;
|
||||
FParseSuccessEvent: THtmlDocumentParseSuccessEvent;
|
||||
FParseFailEvent: THtmlDocumentParseFailEvent;
|
||||
{ Methoden }
|
||||
procedure SetLines(Value: TStrings);
|
||||
function GetTags(Index: Integer): THtmlDocumentTag;
|
||||
function GetTagCount: Integer;
|
||||
function GetNextId: Integer;
|
||||
procedure LinesChange(Sender: TObject);
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
property NextId: Integer read GetNextId;
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create; overload;
|
||||
constructor Create(ALines: TStrings); overload;
|
||||
destructor Destroy; override;
|
||||
function FindTag(const Id: Integer): THtmlDocumentTag;
|
||||
{ Ereignisse }
|
||||
property OnTagAdd: THtmlDocumentTagAddEvent read FTagAddEvent write FTagAddEvent;
|
||||
property OnParse: THtmlDocumentParseEvent read FParseEvent write FParseEvent;
|
||||
property OnParseSuccess: THtmlDocumentParseSuccessEvent read FParseSuccessEvent write FParseSuccessEvent;
|
||||
property OnParseFail: THtmlDocumentParseFailEvent read FParseFailEvent write FParseFailEvent;
|
||||
{ Eigenschaften }
|
||||
property Lines: TStrings read FLines write SetLines;
|
||||
property Tags[Index: Integer]: THtmlDocumentTag read GetTags;
|
||||
property TagCount: Integer read GetTagCount;
|
||||
property Text: String read FText;
|
||||
end;
|
||||
|
||||
function ValidProtocol(const Protocol: String; const Protocols: array of String): Boolean;
|
||||
function StrIsURL(const S: String): Boolean;
|
||||
function GetTagParamValue(const S,Tag,Param: String): String;
|
||||
@@ -442,4 +532,599 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
THtmlDocumentTag
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor THtmlDocumentTag.Create(const AName: String; ADocument: THtmlDocument; AParent: THtmlDocumentTag);
|
||||
begin
|
||||
inherited Create;
|
||||
FName := AName;
|
||||
if AParent = nil then
|
||||
begin
|
||||
FIndex := ADocument.TagCount - 1;
|
||||
end else
|
||||
begin
|
||||
FIndex := AParent.TagCount - 1;
|
||||
end;
|
||||
FId := ADocument.NextId;
|
||||
FDocument := ADocument;
|
||||
FParent := AParent;
|
||||
FLines := TStringList.Create;
|
||||
(FLines as TStringList).OnChange := LinesChange;
|
||||
end;
|
||||
|
||||
constructor THtmlDocumentTag.Create(const AName: String; ADocument: THtmlDocument; AParent: THtmlDocumentTag; ALines: TStrings);
|
||||
begin
|
||||
Create(AName,ADocument,AParent);
|
||||
FLines.Assign(ALines);
|
||||
end;
|
||||
|
||||
destructor THtmlDocumentTag.Destroy;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
for Index := 0 to TagCount - 1 do
|
||||
begin
|
||||
Tags[Index].Free;
|
||||
end;
|
||||
FLines.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function THtmlDocumentTag.FindTag(const Id: Integer): THtmlDocumentTag;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
for Index := 0 to TagCount - 1 do
|
||||
begin
|
||||
if Tags[Index].Id = Id then
|
||||
begin
|
||||
Result := Tags[Index];
|
||||
Exit;
|
||||
end else
|
||||
begin
|
||||
Result := Tags[Index].FindTag(Id);
|
||||
if Result <> nil then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function THtmlDocumentTag.IsParent(Tag: THtmlDocumentTag): Boolean;
|
||||
var
|
||||
Current: THtmlDocumentTag;
|
||||
begin
|
||||
Current := Parent;
|
||||
while Current <> nil do
|
||||
begin
|
||||
if Current = Tag then
|
||||
begin
|
||||
Result := True;
|
||||
Exit;
|
||||
end;
|
||||
Current := Current.Parent;
|
||||
end;
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function THtmlDocumentTag.GetPath(const Separator: Char = '.'): String;
|
||||
var
|
||||
Current: THtmlDocumentTag;
|
||||
begin
|
||||
Result := Name;
|
||||
Current := Parent;
|
||||
while Current <> nil do
|
||||
begin
|
||||
Result := Current.Name + Separator + Result;
|
||||
Current := Current.Parent;
|
||||
end;
|
||||
end;
|
||||
|
||||
function THtmlDocumentTag.GetParams(Index: Integer): THtmlDocumentTagParam;
|
||||
begin
|
||||
Result := FParams[Index];
|
||||
end;
|
||||
|
||||
function THtmlDocumentTag.GetParamCount: Integer;
|
||||
begin
|
||||
Result := Length(FParams);
|
||||
end;
|
||||
|
||||
function THtmlDocumentTag.GetTags(Index: Integer): THtmlDocumentTag;
|
||||
begin
|
||||
Result := FTags[Index];
|
||||
end;
|
||||
|
||||
function THtmlDocumentTag.GetTagCount: Integer;
|
||||
begin
|
||||
Result := Length(FTags);
|
||||
end;
|
||||
|
||||
procedure THtmlDocumentTag.LinesChange(Sender: TObject);
|
||||
var
|
||||
Index: Integer;
|
||||
Current: PChar;
|
||||
CurrentTag: String;
|
||||
TagName: String;
|
||||
TagText: String;
|
||||
TagLines: TStrings;
|
||||
InTag, InTagArea: Boolean;
|
||||
TagKind: (tagOpen,tagClose,tagSingle,tagComment);
|
||||
begin
|
||||
for Index := 0 to TagCount - 1 do
|
||||
begin
|
||||
Tags[Index].Free;
|
||||
end;
|
||||
SetLength(FTags,0);
|
||||
FText := '';
|
||||
TagName := '';
|
||||
TagText := '';
|
||||
TagLines := TStringList.Create;
|
||||
InTag := False;
|
||||
InTagArea := False;
|
||||
Current := PChar(Lines.Text);
|
||||
try
|
||||
try
|
||||
while Current^ <> #0 do
|
||||
begin
|
||||
if (Current^ = '<') and ((Current + 1)^ in Letters + ['!','/']) then
|
||||
begin
|
||||
InTag := True;
|
||||
InTagArea := True;
|
||||
if (Current + 1)^ in Letters then
|
||||
begin
|
||||
TagKind := tagOpen;
|
||||
if Length(TagName) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
end;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
if ((Current + 1)^ = '!') and ((Current + 2)^ = '-') and ((Current + 3)^ = '-') then
|
||||
begin
|
||||
TagKind := tagComment;
|
||||
if Length(TagName) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^ + (Current + 1)^ + (Current + 2)^ + (Current + 3)^;
|
||||
end;
|
||||
//-->
|
||||
Inc(Current,4);
|
||||
Continue;
|
||||
end;
|
||||
if ((Current + 1)^ = '/') and ((Current + 2)^ in Letters) then
|
||||
begin
|
||||
TagKind := tagClose;
|
||||
//-->
|
||||
Inc(Current,2);
|
||||
Continue;
|
||||
end;
|
||||
end;
|
||||
if InTagArea then
|
||||
begin
|
||||
if InTag then
|
||||
begin
|
||||
case TagKind of
|
||||
tagSingle,
|
||||
tagOpen: if (Current^ = '>') or ((Current^ = '/') and (Length(Trim(CurrentTag)) <> 0)) then
|
||||
begin
|
||||
if Length(CurrentTag) <> 0 then
|
||||
begin
|
||||
InTag := False;
|
||||
if Length(TagName) = 0 then
|
||||
begin
|
||||
TagName := CurrentTag;
|
||||
end else
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
end;
|
||||
CurrentTag := '';
|
||||
//Parse spaces and parameters .... (to be added)
|
||||
if Current^ = '/' then
|
||||
begin
|
||||
TagKind := tagSingle;
|
||||
if Length(TagText) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
end;
|
||||
end;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
CurrentTag := CurrentTag + Current^;
|
||||
if Length(TagName) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
end;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
tagClose: if Current^ = '>' then
|
||||
begin
|
||||
if (Length(CurrentTag) <> 0) and (Length(TagName) <> 0) then
|
||||
begin
|
||||
InTag := False;
|
||||
if TrimRight(CurrentTag) = TagName then
|
||||
begin
|
||||
InTagArea := False;
|
||||
SetLength(FTags,Length(FTags) + 1);
|
||||
TagLines.Text := TagText;
|
||||
FTags[TagCount - 1] := THtmlDocumentTag.Create(TagName,Document,Self,TagLines);
|
||||
if Assigned(Document.OnTagAdd) then
|
||||
begin
|
||||
Document.OnTagAdd(Self,FTags[TagCount - 1]);
|
||||
end;
|
||||
TagLines.Clear;
|
||||
TagName := '';
|
||||
TagText := '';
|
||||
end else
|
||||
begin
|
||||
TagText := TagText + '</' + CurrentTag + '>';
|
||||
end;
|
||||
CurrentTag := '';
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
CurrentTag := CurrentTag + Current^;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
tagComment: if (Current^ = '-') and ((Current + 1)^ = '-') and ((Current + 2)^ = '>') then
|
||||
begin
|
||||
InTag := False;
|
||||
TagText := TagText + Current^ + (Current + 1)^ + (Current + 2)^;
|
||||
//-->
|
||||
Inc(Current,3);
|
||||
Continue;
|
||||
end else
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
FText := FText + Current^;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
raise EHtmlParse.Create('HTML parse error on line ' + IntToStr(CharLine(Current,Lines.Text)) + ' at position ' + IntToStr(CharPosition(Current,Lines.Text)));
|
||||
end;
|
||||
if InTagArea then
|
||||
begin
|
||||
SetLength(FTags,Length(FTags) + 1);
|
||||
TagLines.Text := TagText;
|
||||
FTags[TagCount - 1] := THtmlDocumentTag.Create(TagName,Document,Self,TagLines);
|
||||
if Assigned(Document.OnTagAdd) then
|
||||
begin
|
||||
Document.OnTagAdd(Self,FTags[TagCount - 1]);
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
TagLines.Free;
|
||||
end;
|
||||
except
|
||||
raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
THtmlDocument
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor THtmlDocument.Create;
|
||||
begin
|
||||
inherited;
|
||||
FNextId := 0;
|
||||
FLines := TStringList.Create;
|
||||
(FLines as TStringList).OnChange := LinesChange;
|
||||
end;
|
||||
|
||||
constructor THtmlDocument.Create(ALines: TStrings);
|
||||
begin
|
||||
Create;
|
||||
Lines := ALines;
|
||||
end;
|
||||
|
||||
destructor THtmlDocument.Destroy;
|
||||
begin
|
||||
FLines.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function THtmlDocument.FindTag(const Id: Integer): THtmlDocumentTag;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
for Index := 0 to TagCount - 1 do
|
||||
begin
|
||||
if Tags[Index].Id = Id then
|
||||
begin
|
||||
Result := Tags[Index];
|
||||
Exit;
|
||||
end else
|
||||
begin
|
||||
Result := Tags[Index].FindTag(Id);
|
||||
if Result <> nil then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
procedure THtmlDocument.SetLines(Value: TStrings);
|
||||
begin
|
||||
FLines.Assign(Value);
|
||||
end;
|
||||
|
||||
function THtmlDocument.GetTags(Index: Integer): THtmlDocumentTag;
|
||||
begin
|
||||
Result := FTags[Index];
|
||||
end;
|
||||
|
||||
function THtmlDocument.GetTagCount: Integer;
|
||||
begin
|
||||
Result := Length(FTags);
|
||||
end;
|
||||
|
||||
function THtmlDocument.GetNextId: Integer;
|
||||
begin
|
||||
Result := FNextId;
|
||||
Inc(FNextId);
|
||||
end;
|
||||
|
||||
procedure THtmlDocument.LinesChange(Sender: TObject);
|
||||
var
|
||||
Index: Integer;
|
||||
Current: PChar;
|
||||
CurrentTag: String;
|
||||
TagName: String;
|
||||
TagText: String;
|
||||
TagLines: TStrings;
|
||||
InTag, InTagArea: Boolean;
|
||||
TagKind: (tagOpen,tagClose,tagSingle,tagComment,tagSpecial);
|
||||
begin
|
||||
if Assigned(OnParse) then
|
||||
begin
|
||||
OnParse(Self);
|
||||
end;
|
||||
for Index := 0 to TagCount - 1 do
|
||||
begin
|
||||
Tags[Index].Free;
|
||||
end;
|
||||
SetLength(FTags,0);
|
||||
FText := '';
|
||||
TagName := '';
|
||||
TagText := '';
|
||||
TagLines := TStringList.Create;
|
||||
InTag := False;
|
||||
InTagArea := False;
|
||||
Current := PChar(Lines.Text);
|
||||
try
|
||||
try
|
||||
while Current^ <> #0 do
|
||||
begin
|
||||
if (Current^ = '<') and ((Current + 1)^ in Letters + ['!','/']) then
|
||||
begin
|
||||
InTag := True;
|
||||
InTagArea := True;
|
||||
if (Current + 1)^ in Letters then
|
||||
begin
|
||||
TagKind := tagOpen;
|
||||
if Length(TagName) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
end;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
if ((Current + 1)^ = '!') and ((Current + 2)^ in Letters + ['-']) then
|
||||
begin
|
||||
if ((Current + 2)^ = '-') and ((Current + 3)^ = '-') then
|
||||
begin
|
||||
TagKind := tagComment;
|
||||
if Length(TagName) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^ + (Current + 1)^;
|
||||
end;
|
||||
Inc(Current,2);
|
||||
end else
|
||||
begin
|
||||
TagKind := tagSpecial;
|
||||
end;
|
||||
if Length(TagName) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^ + (Current + 1)^;
|
||||
end;
|
||||
//-->
|
||||
Inc(Current,2);
|
||||
Continue;
|
||||
end;
|
||||
if ((Current + 1)^ = '/') and ((Current + 2)^ in Letters) then
|
||||
begin
|
||||
TagKind := tagClose;
|
||||
//-->
|
||||
Inc(Current,2);
|
||||
Continue;
|
||||
end;
|
||||
end;
|
||||
if InTagArea then
|
||||
begin
|
||||
if InTag then
|
||||
begin
|
||||
case TagKind of
|
||||
tagSingle,
|
||||
tagOpen: if (Current^ = '>') or ((Current^ = '/') and (Length(Trim(CurrentTag)) <> 0)) then
|
||||
begin
|
||||
if Length(CurrentTag) <> 0 then
|
||||
begin
|
||||
InTag := False;
|
||||
if Length(TagName) = 0 then
|
||||
begin
|
||||
TagName := CurrentTag;
|
||||
end else
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
end;
|
||||
CurrentTag := '';
|
||||
//Parse spaces and parameters .... (to be added)
|
||||
if Current^ = '/' then
|
||||
begin
|
||||
TagKind := tagSingle;
|
||||
if Length(TagText) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
end;
|
||||
end;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
CurrentTag := CurrentTag + Current^;
|
||||
if Length(TagName) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
end;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
tagClose: if Current^ = '>' then
|
||||
begin
|
||||
if (Length(CurrentTag) <> 0) and (Length(TagName) <> 0) then
|
||||
begin
|
||||
InTag := False;
|
||||
if TrimRight(CurrentTag) = TagName then
|
||||
begin
|
||||
InTagArea := False;
|
||||
SetLength(FTags,Length(FTags) + 1);
|
||||
TagLines.Text := TagText;
|
||||
FTags[TagCount - 1] := THtmlDocumentTag.Create(TagName,Self,nil,TagLines);
|
||||
if Assigned(OnTagAdd) then
|
||||
begin
|
||||
OnTagAdd(Self,FTags[TagCount - 1]);
|
||||
end;
|
||||
TagLines.Clear;
|
||||
TagName := '';
|
||||
TagText := '';
|
||||
end else
|
||||
begin
|
||||
TagText := TagText + '</' + CurrentTag + '>';
|
||||
end;
|
||||
CurrentTag := '';
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
CurrentTag := CurrentTag + Current^;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
tagComment: if (Current^ = '-') and ((Current + 1)^ = '-') and ((Current + 2)^ = '>') then
|
||||
begin
|
||||
InTag := False;
|
||||
TagText := TagText + Current^ + (Current + 1)^ + (Current + 2)^;
|
||||
//-->
|
||||
Inc(Current,3);
|
||||
Continue;
|
||||
end else
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
tagSpecial: if (Length(Text) = 0) and (TagCount = 0) then
|
||||
begin
|
||||
if Current^ = '>' then
|
||||
begin
|
||||
if Length(CurrentTag) <> 0 then
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
CurrentTag := CurrentTag + Current^;
|
||||
TagText := TagText + Current^;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
TagText := TagText + Current^;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
FText := FText + Current^;
|
||||
//-->
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
raise EHtmlParse.Create('HTML parse error on line ' + IntToStr(CharLine(Current,Lines.Text) + 1) + ' at position ' + IntToStr(CharPosition(Current,Lines.Text) + 1));
|
||||
end;
|
||||
if InTagArea then
|
||||
begin
|
||||
SetLength(FTags,Length(FTags) + 1);
|
||||
TagLines.Text := TagText;
|
||||
FTags[TagCount - 1] := THtmlDocumentTag.Create(TagName,Self,nil,TagLines);
|
||||
if Assigned(OnTagAdd) then
|
||||
begin
|
||||
OnTagAdd(Self,FTags[TagCount - 1]);
|
||||
end;
|
||||
end;
|
||||
if Assigned(OnParseSuccess) then
|
||||
begin
|
||||
OnParseSuccess(Self);
|
||||
end;
|
||||
finally
|
||||
TagLines.Free;
|
||||
end;
|
||||
except
|
||||
if Assigned(OnParseFail) then
|
||||
begin
|
||||
OnParseFail(Self);
|
||||
end else
|
||||
begin
|
||||
raise;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user