You've already forked lazarus-ccr
fpbrowser: Re-enables THTMLPort support, fixes identing and starts implementing back, forward and adds image support for ipro (although not working yet)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1928 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -91,7 +91,7 @@
|
||||
<CompilerOptions>
|
||||
<Version Value="10"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="../../Wcomponents/thtmlport/package"/>
|
||||
<OtherUnitFiles Value="../../components/thtmlport/package"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
|
@ -64,17 +64,16 @@ object formBrowser: TformBrowser
|
||||
TabStop = False
|
||||
TabOrder = 3
|
||||
end
|
||||
object ReloadButton: TButton
|
||||
object buttonReload: TButton
|
||||
Left = 10
|
||||
Height = 24
|
||||
Top = 4
|
||||
Width = 59
|
||||
Caption = '&Reload'
|
||||
Enabled = False
|
||||
OnClick = ReloadButtonClick
|
||||
OnClick = buttonReloadClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object BackButton: TButton
|
||||
object buttonBack: TButton
|
||||
Left = 69
|
||||
Height = 24
|
||||
Top = 4
|
||||
@ -84,7 +83,7 @@ object formBrowser: TformBrowser
|
||||
OnClick = FwdBackClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object FwdButton: TButton
|
||||
object buttonForward: TButton
|
||||
Left = 128
|
||||
Height = 24
|
||||
Top = 4
|
||||
|
@ -18,65 +18,65 @@ LazarusResources.Add('TformBrowser','FORMDATA',[
|
||||
+'bvNone'#12'ClientHeight'#2'!'#11'ClientWidth'#3'm'#2#8'TabOrder'#2#1#0#5'TE'
|
||||
+'dit'#7'editURL'#4'Left'#3#190#0#6'Height'#2#24#3'Top'#2#4#5'Width'#3'Q'#1#8
|
||||
+'AutoSize'#8#9'OnKeyDown'#7#14'editURLKeyDown'#7'TabStop'#8#8'TabOrder'#2#3#0
|
||||
+#0#7'TButton'#12'ReloadButton'#4'Left'#2#10#6'Height'#2#24#3'Top'#2#4#5'Widt'
|
||||
+'h'#2';'#7'Caption'#6#7'&Reload'#7'Enabled'#8#7'OnClick'#7#17'ReloadButtonCl'
|
||||
+'ick'#8'TabOrder'#2#0#0#0#7'TButton'#10'BackButton'#4'Left'#2'E'#6'Height'#2
|
||||
+#24#3'Top'#2#4#5'Width'#2';'#7'Caption'#6#5'&Back'#7'Enabled'#8#7'OnClick'#7
|
||||
+#12'FwdBackClick'#8'TabOrder'#2#1#0#0#7'TButton'#9'FwdButton'#4'Left'#3#128#0
|
||||
+#6'Height'#2#24#3'Top'#2#4#5'Width'#2';'#7'Caption'#6#8'&Forward'#7'Enabled'
|
||||
+#8#7'OnClick'#7#12'FwdBackClick'#8'TabOrder'#2#2#0#0#0#12'TPageControl'#11'p'
|
||||
+'ageBrowser'#4'Left'#2#0#6'Height'#3'i'#1#3'Top'#2'!'#5'Width'#3'm'#2#10'Act'
|
||||
+'ivePage'#7#10'tabBrowser'#5'Align'#7#8'alClient'#8'ShowTabs'#8#8'TabIndex'#2
|
||||
+#0#8'TabOrder'#2#2#0#9'TTabSheet'#10'tabBrowser'#7'Caption'#6#7'Browser'#12
|
||||
+'ClientHeight'#3'g'#1#11'ClientWidth'#3'k'#2#0#6'TPanel'#12'panelBrowser'#4
|
||||
+'Left'#2#0#6'Height'#3'g'#1#3'Top'#2#0#5'Width'#3'k'#2#5'Align'#7#8'alClient'
|
||||
+#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7#6'bvNone'#7'Caption'#6#12'pa'
|
||||
+'nelBrowser'#8'TabOrder'#2#0#0#0#0#9'TTabSheet'#8'tabDebug'#7'Caption'#6#5'D'
|
||||
+'ebug'#12'ClientHeight'#3'g'#1#11'ClientWidth'#3'k'#2#0#5'TMemo'#9'memoDebug'
|
||||
+#4'Left'#2#0#6'Height'#3'g'#1#3'Top'#2#0#5'Width'#3'k'#2#5'Align'#7#8'alClie'
|
||||
+'nt'#13'Lines.Strings'#1#6#9'memoDebug'#0#8'TabOrder'#2#0#0#0#0#9'TTabSheet'
|
||||
+#9'tabSource'#7'Caption'#6#6'Source'#12'ClientHeight'#3'g'#1#11'ClientWidth'
|
||||
+#3'k'#2#0#5'TMemo'#10'memoSource'#4'Left'#2#0#6'Height'#3'g'#1#3'Top'#2#0#5
|
||||
+'Width'#3'k'#2#5'Align'#7#8'alClient'#13'Lines.Strings'#1#6#10'memoSource'#0
|
||||
+#8'TabOrder'#2#0#0#0#0#0#11'TOpenDialog'#10'OpenDialog'#10'DefaultExt'#6#4'.'
|
||||
+'htm'#6'Filter'#6'%html files|*.htm;*.html|all files|*.*'#7'Options'#11#14'o'
|
||||
+'fHideReadOnly'#15'ofPathMustExist'#15'ofFileMustExist'#0#4'left'#3'I'#1#3't'
|
||||
+'op'#2#2#0#0#9'TMainMenu'#8'MainMenu'#4'left'#3'#'#1#3'top'#2#4#0#9'TMenuIte'
|
||||
+'m'#5'File1'#7'Caption'#6#5'&File'#0#9'TMenuItem'#4'Open'#7'Caption'#6#5'&Op'
|
||||
+'en'#8'ShortCut'#2'r'#7'OnClick'#7#13'OpenFileClick'#0#0#9'TMenuItem'#12'Ope'
|
||||
+'nTextFile'#7'Caption'#6#15'Open &Text File'#7'OnClick'#7#17'OpenTextFileCli'
|
||||
+'ck'#0#0#9'TMenuItem'#13'OpenImageFile'#7'Caption'#6#16'Open &Image File'#7
|
||||
+'OnClick'#7#18'OpenImageFileClick'#0#0#9'TMenuItem'#13'PrinterSetup1'#7'Capt'
|
||||
+'ion'#6#16'Printer Setup...'#7'OnClick'#7#18'PrinterSetup1Click'#0#0#9'TMenu'
|
||||
+'Item'#12'Printpreview'#7'Caption'#6#14'Print pre&view'#7'Enabled'#8#7'OnCli'
|
||||
+'ck'#7#17'PrintpreviewClick'#0#0#9'TMenuItem'#6'Print1'#7'Caption'#6#9'&Prin'
|
||||
+'t...'#7'Enabled'#8#7'OnClick'#7#11'Print1Click'#0#0#9'TMenuItem'#2'N1'#7'Ca'
|
||||
+'ption'#6#1'-'#0#0#9'TMenuItem'#5'Exit1'#7'Caption'#6#5'E&xit'#7'OnClick'#7
|
||||
+#10'Exit1Click'#0#0#0#9'TMenuItem'#5'Edit2'#7'Caption'#6#5'&Edit'#7'OnClick'
|
||||
+#7#10'Edit2Click'#0#9'TMenuItem'#5'Find1'#7'Caption'#6#5'&Find'#7'Enabled'#8
|
||||
+#7'OnClick'#7#10'Find1Click'#0#0#9'TMenuItem'#8'CopyItem'#7'Caption'#6#5'&Co'
|
||||
+'py'#8'ShortCut'#3'C@'#7'OnClick'#7#13'CopyItemClick'#0#0#9'TMenuItem'#2'N2'
|
||||
+#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'SelectAllItem'#7'Caption'#6#11'Select'
|
||||
+' &All'#7'Enabled'#8#7'OnClick'#7#18'SelectAllItemClick'#0#0#0#9'TMenuItem'#8
|
||||
+'options1'#7'Caption'#6#6'&Tools'#0#9'TMenuItem'#10'ShowImages'#7'Caption'#6
|
||||
+#12'&Show images'#7'OnClick'#7#15'ShowImagesClick'#0#0#9'TMenuItem'#5'Fonts'
|
||||
+#7'Caption'#6#23'Default &Font/Colors...'#7'OnClick'#7#15'FontColorsClick'#0
|
||||
+#0#9'TMenuItem'#13'menuViewDebug'#7'Caption'#6#26'View Source and Debug info'
|
||||
+#7'OnClick'#7#18'menuViewDebugClick'#0#0#0#9'TMenuItem'#15'HistoryMenuItem'#7
|
||||
+'Caption'#6#8'&History'#7'Visible'#8#0#0#9'TMenuItem'#6'About1'#7'Caption'#6
|
||||
+#6'&About'#7'OnClick'#7#11'About1Click'#0#0#0#12'TPrintDialog'#11'PrintDialo'
|
||||
,'g'#8'FromPage'#2#1#7'MinPage'#2#1#7'MaxPage'#3#15''''#7'Options'#11#10'poPa'
|
||||
+'geNums'#0#6'ToPage'#2#1#4'left'#3'j'#1#3'top'#2#1#0#0#11'TFindDialog'#10'Fi'
|
||||
+'ndDialog'#7'Options'#11#6'frDown'#15'frHideWholeWord'#18'frDisableWholeWord'
|
||||
+#0#6'OnFind'#7#14'FindDialogFind'#4'left'#3#248#0#3'top'#2#4#0#0#10'TPopupMe'
|
||||
+'nu'#9'PopupMenu'#4'left'#3#144#1#3'top'#2#1#0#9'TMenuItem'#9'Viewimage'#7'C'
|
||||
+'aption'#6#11'&View image'#7'OnClick'#7#14'ViewimageClick'#0#0#9'TMenuItem'
|
||||
+#20'CopyImageToClipboard'#7'Caption'#6#24'&Copy image to clipboard'#7'OnClic'
|
||||
+'k'#7#25'CopyImageToClipboardClick'#0#0#9'TMenuItem'#2'N3'#7'Caption'#6#1'-'
|
||||
+#0#0#9'TMenuItem'#15'OpenInNewWindow'#7'Caption'#6#19'&Open in new window'#7
|
||||
+'OnClick'#7#20'OpenInNewWindowClick'#0#0#0#6'TTimer'#9'MetaTimer'#7'Enabled'
|
||||
+#8#7'OnTimer'#7#14'MetaTimerTimer'#4'left'#3#242#0#3'top'#2'K'#0#0#6'TTimer'
|
||||
+#6'Timer1'#8'Interval'#3#200#0#7'OnTimer'#7#11'Timer1Timer'#4'left'#3'0'#1#3
|
||||
+'top'#2'G'#0#0#19'TPrinterSetupDialog'#18'PrinterSetupDialog'#4'left'#3#192#1
|
||||
+#0#0#0
|
||||
+#0#7'TButton'#12'buttonReload'#4'Left'#2#10#6'Height'#2#24#3'Top'#2#4#5'Widt'
|
||||
+'h'#2';'#7'Caption'#6#7'&Reload'#7'OnClick'#7#17'buttonReloadClick'#8'TabOrd'
|
||||
+'er'#2#0#0#0#7'TButton'#10'buttonBack'#4'Left'#2'E'#6'Height'#2#24#3'Top'#2#4
|
||||
+#5'Width'#2';'#7'Caption'#6#5'&Back'#7'Enabled'#8#7'OnClick'#7#12'FwdBackCli'
|
||||
+'ck'#8'TabOrder'#2#1#0#0#7'TButton'#13'buttonForward'#4'Left'#3#128#0#6'Heig'
|
||||
+'ht'#2#24#3'Top'#2#4#5'Width'#2';'#7'Caption'#6#8'&Forward'#7'Enabled'#8#7'O'
|
||||
+'nClick'#7#12'FwdBackClick'#8'TabOrder'#2#2#0#0#0#12'TPageControl'#11'pageBr'
|
||||
+'owser'#4'Left'#2#0#6'Height'#3'i'#1#3'Top'#2'!'#5'Width'#3'm'#2#10'ActivePa'
|
||||
+'ge'#7#10'tabBrowser'#5'Align'#7#8'alClient'#8'ShowTabs'#8#8'TabIndex'#2#0#8
|
||||
+'TabOrder'#2#2#0#9'TTabSheet'#10'tabBrowser'#7'Caption'#6#7'Browser'#12'Clie'
|
||||
+'ntHeight'#3'g'#1#11'ClientWidth'#3'k'#2#0#6'TPanel'#12'panelBrowser'#4'Left'
|
||||
+#2#0#6'Height'#3'g'#1#3'Top'#2#0#5'Width'#3'k'#2#5'Align'#7#8'alClient'#10'B'
|
||||
+'evelInner'#7#9'bvLowered'#10'BevelOuter'#7#6'bvNone'#7'Caption'#6#12'panelB'
|
||||
+'rowser'#8'TabOrder'#2#0#0#0#0#9'TTabSheet'#8'tabDebug'#7'Caption'#6#5'Debug'
|
||||
+#12'ClientHeight'#3'g'#1#11'ClientWidth'#3'k'#2#0#5'TMemo'#9'memoDebug'#4'Le'
|
||||
+'ft'#2#0#6'Height'#3'g'#1#3'Top'#2#0#5'Width'#3'k'#2#5'Align'#7#8'alClient'
|
||||
+#13'Lines.Strings'#1#6#9'memoDebug'#0#8'TabOrder'#2#0#0#0#0#9'TTabSheet'#9't'
|
||||
+'abSource'#7'Caption'#6#6'Source'#12'ClientHeight'#3'g'#1#11'ClientWidth'#3
|
||||
+'k'#2#0#5'TMemo'#10'memoSource'#4'Left'#2#0#6'Height'#3'g'#1#3'Top'#2#0#5'Wi'
|
||||
+'dth'#3'k'#2#5'Align'#7#8'alClient'#13'Lines.Strings'#1#6#10'memoSource'#0#8
|
||||
+'TabOrder'#2#0#0#0#0#0#11'TOpenDialog'#10'OpenDialog'#10'DefaultExt'#6#4'.ht'
|
||||
+'m'#6'Filter'#6'%html files|*.htm;*.html|all files|*.*'#7'Options'#11#14'ofH'
|
||||
+'ideReadOnly'#15'ofPathMustExist'#15'ofFileMustExist'#0#4'left'#3'I'#1#3'top'
|
||||
+#2#2#0#0#9'TMainMenu'#8'MainMenu'#4'left'#3'#'#1#3'top'#2#4#0#9'TMenuItem'#5
|
||||
+'File1'#7'Caption'#6#5'&File'#0#9'TMenuItem'#4'Open'#7'Caption'#6#5'&Open'#8
|
||||
+'ShortCut'#2'r'#7'OnClick'#7#13'OpenFileClick'#0#0#9'TMenuItem'#12'OpenTextF'
|
||||
+'ile'#7'Caption'#6#15'Open &Text File'#7'OnClick'#7#17'OpenTextFileClick'#0#0
|
||||
+#9'TMenuItem'#13'OpenImageFile'#7'Caption'#6#16'Open &Image File'#7'OnClick'
|
||||
+#7#18'OpenImageFileClick'#0#0#9'TMenuItem'#13'PrinterSetup1'#7'Caption'#6#16
|
||||
+'Printer Setup...'#7'OnClick'#7#18'PrinterSetup1Click'#0#0#9'TMenuItem'#12'P'
|
||||
+'rintpreview'#7'Caption'#6#14'Print pre&view'#7'Enabled'#8#7'OnClick'#7#17'P'
|
||||
+'rintpreviewClick'#0#0#9'TMenuItem'#6'Print1'#7'Caption'#6#9'&Print...'#7'En'
|
||||
+'abled'#8#7'OnClick'#7#11'Print1Click'#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1
|
||||
+'-'#0#0#9'TMenuItem'#5'Exit1'#7'Caption'#6#5'E&xit'#7'OnClick'#7#10'Exit1Cli'
|
||||
+'ck'#0#0#0#9'TMenuItem'#5'Edit2'#7'Caption'#6#5'&Edit'#7'OnClick'#7#10'Edit2'
|
||||
+'Click'#0#9'TMenuItem'#5'Find1'#7'Caption'#6#5'&Find'#7'Enabled'#8#7'OnClick'
|
||||
+#7#10'Find1Click'#0#0#9'TMenuItem'#8'CopyItem'#7'Caption'#6#5'&Copy'#8'Short'
|
||||
+'Cut'#3'C@'#7'OnClick'#7#13'CopyItemClick'#0#0#9'TMenuItem'#2'N2'#7'Caption'
|
||||
+#6#1'-'#0#0#9'TMenuItem'#13'SelectAllItem'#7'Caption'#6#11'Select &All'#7'En'
|
||||
+'abled'#8#7'OnClick'#7#18'SelectAllItemClick'#0#0#0#9'TMenuItem'#8'options1'
|
||||
+#7'Caption'#6#6'&Tools'#0#9'TMenuItem'#10'ShowImages'#7'Caption'#6#12'&Show '
|
||||
+'images'#7'OnClick'#7#15'ShowImagesClick'#0#0#9'TMenuItem'#5'Fonts'#7'Captio'
|
||||
+'n'#6#23'Default &Font/Colors...'#7'OnClick'#7#15'FontColorsClick'#0#0#9'TMe'
|
||||
+'nuItem'#13'menuViewDebug'#7'Caption'#6#26'View Source and Debug info'#7'OnC'
|
||||
+'lick'#7#18'menuViewDebugClick'#0#0#0#9'TMenuItem'#15'HistoryMenuItem'#7'Cap'
|
||||
+'tion'#6#8'&History'#7'Visible'#8#0#0#9'TMenuItem'#6'About1'#7'Caption'#6#6
|
||||
+'&About'#7'OnClick'#7#11'About1Click'#0#0#0#12'TPrintDialog'#11'PrintDialog'
|
||||
,#8'FromPage'#2#1#7'MinPage'#2#1#7'MaxPage'#3#15''''#7'Options'#11#10'poPageN'
|
||||
+'ums'#0#6'ToPage'#2#1#4'left'#3'j'#1#3'top'#2#1#0#0#11'TFindDialog'#10'FindD'
|
||||
+'ialog'#7'Options'#11#6'frDown'#15'frHideWholeWord'#18'frDisableWholeWord'#0
|
||||
+#6'OnFind'#7#14'FindDialogFind'#4'left'#3#248#0#3'top'#2#4#0#0#10'TPopupMenu'
|
||||
+#9'PopupMenu'#4'left'#3#144#1#3'top'#2#1#0#9'TMenuItem'#9'Viewimage'#7'Capti'
|
||||
+'on'#6#11'&View image'#7'OnClick'#7#14'ViewimageClick'#0#0#9'TMenuItem'#20'C'
|
||||
+'opyImageToClipboard'#7'Caption'#6#24'&Copy image to clipboard'#7'OnClick'#7
|
||||
+#25'CopyImageToClipboardClick'#0#0#9'TMenuItem'#2'N3'#7'Caption'#6#1'-'#0#0#9
|
||||
+'TMenuItem'#15'OpenInNewWindow'#7'Caption'#6#19'&Open in new window'#7'OnCli'
|
||||
+'ck'#7#20'OpenInNewWindowClick'#0#0#0#6'TTimer'#9'MetaTimer'#7'Enabled'#8#7
|
||||
+'OnTimer'#7#14'MetaTimerTimer'#4'left'#3#242#0#3'top'#2'K'#0#0#6'TTimer'#6'T'
|
||||
+'imer1'#8'Interval'#3#200#0#7'OnTimer'#7#11'Timer1Timer'#4'left'#3'0'#1#3'to'
|
||||
+'p'#2'G'#0#0#19'TPrinterSetupDialog'#18'PrinterSetupDialog'#4'left'#3#192#1#0
|
||||
+#0#0
|
||||
]);
|
||||
|
@ -21,8 +21,6 @@ uses
|
||||
HTMLabt,
|
||||
pageloader;
|
||||
|
||||
const
|
||||
MaxHistories = 6; {size of History list}
|
||||
type
|
||||
|
||||
{$ifdef FPBROWSER_TURBOPOWERIPRO}
|
||||
@ -54,9 +52,9 @@ type
|
||||
ShowImages: TMenuItem;
|
||||
Fonts: TMenuItem;
|
||||
editURL: TEdit;
|
||||
ReloadButton: TButton;
|
||||
BackButton: TButton;
|
||||
FwdButton: TButton;
|
||||
buttonReload: TButton;
|
||||
buttonBack: TButton;
|
||||
buttonForward: TButton;
|
||||
HistoryMenuItem: TMenuItem;
|
||||
Exit1: TMenuItem;
|
||||
PrintDialog: TPrintDialog;
|
||||
@ -88,7 +86,7 @@ type
|
||||
procedure menuViewDebugClick(Sender: TObject);
|
||||
procedure OpenFileClick(Sender: TObject);
|
||||
procedure ShowImagesClick(Sender: TObject);
|
||||
procedure ReloadButtonClick(Sender: TObject);
|
||||
procedure buttonReloadClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FwdBackClick(Sender: TObject);
|
||||
procedure HistoryClick(Sender: TObject);
|
||||
@ -128,7 +126,8 @@ type
|
||||
{$IFDEF LCLCarbon}
|
||||
AppMenu : TMenuItem;
|
||||
{$ENDIF}
|
||||
Histories: array[0..MaxHistories-1] of TMenuItem;
|
||||
History: TStringList;
|
||||
HistoryIndex: Integer;
|
||||
MediaCount: integer;
|
||||
NewWindowFile: string;
|
||||
NextFile, PresentFile: string;
|
||||
@ -181,6 +180,7 @@ type
|
||||
MyPageLoaderThread: TPageLoaderThread;
|
||||
MyPageLoader: TPageLoader;
|
||||
procedure LoadURL(AURL: string);
|
||||
procedure AddURLToHistory(AURL: string);
|
||||
procedure HandlePageLoaderProgress(APercent: Integer);
|
||||
procedure HandlePageLoaderTerminated(Sender: TObject);
|
||||
end;
|
||||
@ -217,14 +217,14 @@ end;
|
||||
function TformBrowser.DataProvider1CanHandle(Sender: TObject; const URL: string
|
||||
): Boolean;
|
||||
begin
|
||||
WriteLn('TForm1.DataProvider1CanHandle ',URL);
|
||||
WriteLn('TformBrowser.DataProvider1CanHandle ',URL);
|
||||
Result:=True;
|
||||
end;
|
||||
|
||||
procedure TformBrowser.DataProvider1CheckURL(Sender: TObject; const URL: string;
|
||||
var Available: Boolean; var ContentType: string);
|
||||
begin
|
||||
WriteLn('TForm1.DataProvider1CheckURL ',URL);
|
||||
WriteLn('TformBrowser.DataProvider1CheckURL ',URL);
|
||||
Available:=True;
|
||||
ContentType:='text/html';
|
||||
end;
|
||||
@ -234,17 +234,39 @@ procedure TformBrowser.DataProvider1GetHtml(Sender: TObject; const URL: string;
|
||||
var
|
||||
lStream: TMemoryStream;
|
||||
begin
|
||||
WriteLn('TForm1.DataProvider1GetHtml ',URL);
|
||||
MyPageLoader.LoadBinaryResource(URL, lStream);
|
||||
WriteLn('TformBrowser.DataProvider1GetHtml ',URL);
|
||||
{ MyPageLoader.LoadBinaryResource(URL, lStream);
|
||||
Stream := lStream;
|
||||
lStream.Position := 0;
|
||||
lStream.Position := 0;}
|
||||
Stream := nil;
|
||||
LoadURL(URL);
|
||||
end;
|
||||
|
||||
procedure TformBrowser.DataProvider1GetImage(Sender: TIpHtmlNode; const URL: string;
|
||||
var Picture: TPicture);
|
||||
var
|
||||
lStream: TMemoryStream = nil;
|
||||
lStr: String;
|
||||
begin
|
||||
//debugln(['TForm1.DataProvider1GetImage ',URL]);
|
||||
Picture:=nil;
|
||||
WriteLn('TformBrowser.DataProvider1GetImage ',URL);
|
||||
lStr := ExtractFileExt(URL);
|
||||
if (lStr = '.jpeg') or (lStr = '.jpg') then
|
||||
begin
|
||||
try
|
||||
MyPageLoader.LoadBinaryResource(URL, lStream);
|
||||
Picture := TPicture.Create;
|
||||
Picture.Jpeg.LoadFromStream(lStream);
|
||||
finally
|
||||
lStream.Free
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
WriteLn('TformBrowser.DataProvider1GetImage Unsupported format: ', lStr);
|
||||
Picture := nil;
|
||||
Exit;
|
||||
end;
|
||||
// and (lStr <> '.bmp') and (lStr <> '.png')
|
||||
end;
|
||||
|
||||
procedure TformBrowser.DataProvider1Leave(Sender: TIpHtml);
|
||||
@ -282,6 +304,7 @@ var
|
||||
I: integer;
|
||||
begin
|
||||
MyPageLoader := TPageLoader.Create;
|
||||
History := TStringList.Create;
|
||||
|
||||
{$ifdef FPBROWSER_TURBOPOWERIPRO}
|
||||
DataProvider1:=TMyIpHtmlDataProvider.Create(Self);
|
||||
@ -336,7 +359,7 @@ begin
|
||||
Viewer.OnPrintHTMLHeader := ViewerPrintHTMLHeader;
|
||||
Viewer.OnPrintHTMLFooter := ViewerPrintHTMLFooter;
|
||||
Viewer.OnInclude := ViewerInclude;
|
||||
Viewer.OnSoundRequest := SoundRequest;
|
||||
//Viewer.OnSoundRequest := SoundRequest;
|
||||
Viewer.OnMetaRefresh := MetaRefreshEvent;
|
||||
Viewer.OnObjectClick := ObjectClick;
|
||||
Viewer.OnRightClick := RightClick;
|
||||
@ -356,7 +379,7 @@ begin
|
||||
|
||||
Caption := 'HTML Demo, Version '+HTMLAbt.Version;
|
||||
|
||||
for I := 0 to MaxHistories-1 do
|
||||
(*for I := 0 to MaxHistories-1 do
|
||||
begin {create the MenuItems for the history list}
|
||||
Histories[I] := TMenuItem.Create(HistoryMenuItem);
|
||||
HistoryMenuItem.Insert(I, Histories[I]);
|
||||
@ -366,7 +389,7 @@ begin
|
||||
OnClick := HistoryClick;
|
||||
Tag := I;
|
||||
end;
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{$IFDEF LCLCarbon}
|
||||
AppMenu := TMenuItem.Create(Self); //Application menu
|
||||
@ -582,13 +605,13 @@ begin
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TformBrowser.ReloadButtonClick(Sender: TObject);
|
||||
procedure TformBrowser.buttonReloadClick(Sender: TObject);
|
||||
{the Reload button was clicked}
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
Viewer.ReLoadButton.Enabled := False;
|
||||
buttonReload.Enabled := False;
|
||||
Viewer.ReLoad;
|
||||
Viewer.ReLoadButton.Enabled := CurrentFile <> '';
|
||||
buttonReload.Enabled := Viewer.CurrentFile <> '';
|
||||
Viewer.SetFocus;
|
||||
{$endif}
|
||||
end;
|
||||
@ -597,15 +620,24 @@ procedure TformBrowser.FwdBackClick(Sender: TObject);
|
||||
{Either the Forward or Back button was clicked}
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
with Viewer do
|
||||
begin
|
||||
if Sender = BackButton then
|
||||
HistoryIndex := HistoryIndex +1
|
||||
{ if Sender = buttonBack then
|
||||
Viewer.HistoryIndex := Viewer.HistoryIndex +1
|
||||
else
|
||||
HistoryIndex := HistoryIndex -1;
|
||||
Self.Caption := DocumentTitle;
|
||||
end;
|
||||
Viewer.HistoryIndex := Viewer.HistoryIndex -1;
|
||||
Self.Caption := Viewer.DocumentTitle;}
|
||||
{$endif}
|
||||
LoadURL(History.Strings[HistoryIndex]);
|
||||
if Sender = buttonBack then
|
||||
begin
|
||||
HistoryIndex := HistoryIndex-1;
|
||||
if HistoryIndex < 0 then buttonBack.Enabled := False;
|
||||
buttonForward.Enabled := True;
|
||||
end
|
||||
else
|
||||
begin
|
||||
HistoryIndex := HistoryIndex+1;
|
||||
if HistoryIndex >= History.Count then buttonForward.Enabled := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TformBrowser.HistoryChange(Sender: TObject);
|
||||
@ -614,12 +646,12 @@ var
|
||||
I: integer;
|
||||
Cap: string[80];
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
with Sender as ThtmlViewer do
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
with Sender as ThtmlViewer do
|
||||
begin
|
||||
{check to see which buttons are to be enabled}
|
||||
FwdButton.Enabled := HistoryIndex > 0;
|
||||
BackButton.Enabled := HistoryIndex < History.Count-1;
|
||||
buttonForward.Enabled := HistoryIndex > 0;
|
||||
buttonBack.Enabled := HistoryIndex < History.Count-1;
|
||||
|
||||
{Enable and caption the appropriate history menuitems}
|
||||
HistoryMenuItem.Visible := History.Count > 0;
|
||||
@ -638,21 +670,21 @@ with Sender as ThtmlViewer do
|
||||
Caption := DocumentTitle; {keep the caption updated}
|
||||
Viewer.SetFocus;
|
||||
end;
|
||||
{$endif}
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
{A history list menuitem got clicked on}
|
||||
procedure TformBrowser.HistoryClick(Sender: TObject);
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
{Changing the HistoryIndex loads and positions the appropriate document}
|
||||
Viewer.HistoryIndex := (Sender as TMenuItem).Tag;
|
||||
{$endif}
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TformBrowser.Exit1Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TformBrowser.FontColorsClick(Sender: TObject);
|
||||
@ -685,14 +717,14 @@ end;
|
||||
|
||||
procedure TformBrowser.Print1Click(Sender: TObject);
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
with PrintDialog do
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
with PrintDialog do
|
||||
if Execute then
|
||||
if PrintRange = prAllPages then
|
||||
viewer.Print(1, 9999)
|
||||
else
|
||||
Viewer.Print(FromPage, ToPage);
|
||||
{$endif}
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TformBrowser.PrinterSetup1Click(Sender: TObject);
|
||||
@ -707,52 +739,49 @@ end;
|
||||
|
||||
procedure TformBrowser.About1Click(Sender: TObject);
|
||||
begin
|
||||
AboutBox := TAboutBox.CreateIt(Self, 'HTMLDemo', 'ThtmlViewer');
|
||||
try
|
||||
AboutBox.ShowModal;
|
||||
finally
|
||||
AboutBox.Free;
|
||||
AboutBox := TAboutBox.CreateIt(Self, 'HTMLDemo', 'ThtmlViewer');
|
||||
try
|
||||
AboutBox.ShowModal;
|
||||
finally
|
||||
AboutBox.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TformBrowser.SubmitEvent(Sender: TObject; const AnAction, Target, EncType, Method: String;
|
||||
Results: TStringList);
|
||||
procedure TformBrowser.SubmitEvent(Sender: TObject; const AnAction, Target,
|
||||
EncType, Method: String; Results: TStringList);
|
||||
begin
|
||||
with SubmitForm do
|
||||
begin
|
||||
ActionText.Text := AnAction;
|
||||
MethodText.Text := Method;
|
||||
ResultBox.Items := Results;
|
||||
SubmitForm.ActionText.Text := AnAction;
|
||||
SubmitForm.MethodText.Text := Method;
|
||||
SubmitForm.ResultBox.Items := Results;
|
||||
Results.Free;
|
||||
Show;
|
||||
end;
|
||||
SubmitForm.Show;
|
||||
end;
|
||||
|
||||
procedure TformBrowser.Find1Click(Sender: TObject);
|
||||
begin
|
||||
FindDialog.Execute;
|
||||
FindDialog.Execute;
|
||||
end;
|
||||
|
||||
procedure TformBrowser.FindDialogFind(Sender: TObject);
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
with FindDialog do
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
with FindDialog do
|
||||
begin
|
||||
if not Viewer.FindEx(FindText, frMatchCase in Options, not (frDown in Options)) then
|
||||
MessageDlg('No further occurances of "'+FindText+'"', mtInformation, [mbOK], 0);
|
||||
end;
|
||||
{$endif}
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TformBrowser.ProcessingHandler(Sender: TObject; ProcessingOn: Boolean);
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
if ProcessingOn then
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
if ProcessingOn then
|
||||
begin {disable various buttons and menuitems during processing}
|
||||
FwdButton.Enabled := False;
|
||||
BackButton.Enabled := False;
|
||||
ReLoadButton.Enabled := False;
|
||||
buttonForward.Enabled := False;
|
||||
buttonBack.Enabled := False;
|
||||
buttonReload.Enabled := False;
|
||||
Print1.Enabled := False;
|
||||
PrintPreview.Enabled := False;
|
||||
Find1.Enabled := False;
|
||||
@ -760,11 +789,11 @@ if ProcessingOn then
|
||||
Open.Enabled := False;
|
||||
CloseAll; {in case hint window is open}
|
||||
end
|
||||
else
|
||||
else
|
||||
begin
|
||||
FwdButton.Enabled := Viewer.HistoryIndex > 0;
|
||||
BackButton.Enabled := Viewer.HistoryIndex < Viewer.History.Count-1;
|
||||
ReLoadButton.Enabled := Viewer.CurrentFile <> '';
|
||||
buttonForward.Enabled := Viewer.HistoryIndex > 0;
|
||||
buttonBack.Enabled := Viewer.HistoryIndex < Viewer.History.Count-1;
|
||||
buttonReload.Enabled := Viewer.CurrentFile <> '';
|
||||
Print1.Enabled := Viewer.CurrentFile <> '';
|
||||
PrintPreview.Enabled := Viewer.CurrentFile <> '';
|
||||
Find1.Enabled := Viewer.CurrentFile <> '';
|
||||
@ -798,20 +827,20 @@ end;
|
||||
procedure TformBrowser.OpenTextFileClick(Sender: TObject);
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
if Viewer.CurrentFile <> '' then
|
||||
OpenDialog.InitialDir := ExtractFilePath(Viewer.CurrentFile);
|
||||
OpenDialog.Filter := 'HTML Files (*.htm,*.html)|*.htm;*.html'+
|
||||
if Viewer.CurrentFile <> '' then
|
||||
OpenDialog.InitialDir := ExtractFilePath(Viewer.CurrentFile);
|
||||
OpenDialog.Filter := 'HTML Files (*.htm,*.html)|*.htm;*.html'+
|
||||
'|Text Files (*.txt)|*.txt'+
|
||||
'|All Files (*.*)|*.*';
|
||||
if OpenDialog.Execute then
|
||||
if OpenDialog.Execute then
|
||||
begin
|
||||
ReloadButton.Enabled := False;
|
||||
Update;
|
||||
Viewer.LoadTextFile(OpenDialog.Filename);
|
||||
if Viewer.CurrentFile <> '' then
|
||||
buttonReload.Enabled := False;
|
||||
Update;
|
||||
Viewer.LoadTextFile(OpenDialog.Filename);
|
||||
if Viewer.CurrentFile <> '' then
|
||||
begin
|
||||
Caption := Viewer.DocumentTitle;
|
||||
ReLoadButton.Enabled := True;
|
||||
Caption := Viewer.DocumentTitle;
|
||||
buttonReload.Enabled := True;
|
||||
end;
|
||||
end;
|
||||
{$endif}
|
||||
@ -819,23 +848,23 @@ end;
|
||||
|
||||
procedure TformBrowser.OpenImageFileClick(Sender: TObject);
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
if Viewer.CurrentFile <> '' then
|
||||
OpenDialog.InitialDir := ExtractFilePath(Viewer.CurrentFile);
|
||||
OpenDialog.Filter := 'Graphics Files (*.bmp,*.gif,*.jpg,*.jpeg,*.png)|'+
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
if Viewer.CurrentFile <> '' then
|
||||
OpenDialog.InitialDir := ExtractFilePath(Viewer.CurrentFile);
|
||||
OpenDialog.Filter := 'Graphics Files (*.bmp,*.gif,*.jpg,*.jpeg,*.png)|'+
|
||||
'*.bmp;*.jpg;*.jpeg;*.gif;*.png|'+
|
||||
'All Files (*.*)|*.*';
|
||||
if OpenDialog.Execute then
|
||||
if OpenDialog.Execute then
|
||||
begin
|
||||
ReloadButton.Enabled := False;
|
||||
Viewer.LoadImageFile(OpenDialog.Filename);
|
||||
if Viewer.CurrentFile <> '' then
|
||||
buttonReload.Enabled := False;
|
||||
Viewer.LoadImageFile(OpenDialog.Filename);
|
||||
if Viewer.CurrentFile <> '' then
|
||||
begin
|
||||
Caption := Viewer.DocumentTitle;
|
||||
ReLoadButton.Enabled := True;
|
||||
Caption := Viewer.DocumentTitle;
|
||||
buttonReload.Enabled := True;
|
||||
end;
|
||||
end;
|
||||
{$endif}
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TformBrowser.DropFiles( Sender : TObject;
|
||||
@ -844,7 +873,7 @@ var
|
||||
S : string;
|
||||
Ext: string;
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
S := FileNames[0];
|
||||
Ext := LowerCase(ExtractFileExt(S));
|
||||
if (Ext = '.htm') or (Ext = '.html') then
|
||||
@ -881,7 +910,7 @@ var
|
||||
S: string;
|
||||
begin
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
if OnClick = 'display' then
|
||||
if OnClick = 'display' then
|
||||
begin
|
||||
if Obj is TFormControlObj then
|
||||
with TFormControlObj(Obj) do
|
||||
@ -902,7 +931,7 @@ if OnClick = 'display' then
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else if OnClick <> '' then
|
||||
else if OnClick <> '' then
|
||||
MessageDlg(OnClick, mtCustom, [mbOK], 0);
|
||||
{$endif}
|
||||
end;
|
||||
@ -933,13 +962,13 @@ var
|
||||
I: integer;
|
||||
MS: TMemoryStream;
|
||||
begin
|
||||
if CompareText(Command, 'Date') = 0 then
|
||||
S := DateToStr(Date) { <!--#date --> }
|
||||
else if CompareText(Command, 'Time') = 0 then
|
||||
S := TimeToStr(Time) { <!--#time --> }
|
||||
else if CompareText(Command, 'Include') = 0 then
|
||||
if CompareText(Command, 'Date') = 0 then
|
||||
S := DateToStr(Date) { <!--#date --> }
|
||||
else if CompareText(Command, 'Time') = 0 then
|
||||
S := TimeToStr(Time) { <!--#time --> }
|
||||
else if CompareText(Command, 'Include') = 0 then
|
||||
begin {an include file <!--#include FILE="filename" --> }
|
||||
if (Params.count >= 1) then
|
||||
if (Params.count >= 1) then
|
||||
begin
|
||||
I := Pos('file=', Lowercase(Params[0]));
|
||||
if I > 0 then
|
||||
@ -958,13 +987,14 @@ else if CompareText(Command, 'Include') = 0 then
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Params.Free;
|
||||
Params.Free;
|
||||
end;
|
||||
|
||||
procedure TformBrowser.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
HintWindow.Free;
|
||||
MyPageLoader.Free;
|
||||
History.Free;
|
||||
end;
|
||||
|
||||
{$ifdef FPBROWSER_THTMLCOMP}
|
||||
@ -1127,6 +1157,13 @@ begin
|
||||
MyPageLoaderThread.Resume;
|
||||
end;
|
||||
|
||||
procedure TformBrowser.AddURLToHistory(AURL: string);
|
||||
begin
|
||||
History.Add(AURL);
|
||||
HistoryIndex := History.Count-1;
|
||||
buttonBack.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TformBrowser.HandlePageLoaderProgress(APercent: Integer);
|
||||
begin
|
||||
labelProgress.Caption := 'Loading a Page';
|
||||
@ -1151,6 +1188,7 @@ begin
|
||||
memoSource.Lines.AddStrings(MyPageLoader.ContentsList);
|
||||
memoDebug.Lines.Clear();
|
||||
memoDebug.Lines.AddStrings(MyPageLoader.DebugInfo);
|
||||
AddURLToHistory(MyPageLoader.LastPageURL);
|
||||
end;
|
||||
|
||||
procedure TformBrowser.Timer1Timer(Sender: TObject);
|
||||
@ -1199,15 +1237,15 @@ end;
|
||||
procedure TformBrowser.ViewerProgress(Sender: TObject; Stage: TProgressStage;
|
||||
PercentDone: Integer);
|
||||
begin
|
||||
ProgressBar.Position := PercentDone;
|
||||
case Stage of
|
||||
ProgressBar.Position := PercentDone;
|
||||
case Stage of
|
||||
psStarting:
|
||||
ProgressBar.Visible := True;
|
||||
psRunning:;
|
||||
psEnding:
|
||||
ProgressBar.Visible := False;
|
||||
end;
|
||||
ProgressBar.Update;
|
||||
ProgressBar.Update;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
@ -1229,12 +1267,12 @@ function ReplaceStr(Const S, FromStr, ToStr: string): string;
|
||||
var
|
||||
I: integer;
|
||||
begin
|
||||
I := Pos(FromStr, S);
|
||||
if I > 0 then
|
||||
I := Pos(FromStr, S);
|
||||
if I > 0 then
|
||||
begin
|
||||
Result := S;
|
||||
Delete(Result, I, Length(FromStr));
|
||||
Insert(ToStr, Result, I);
|
||||
Result := S;
|
||||
Delete(Result, I, Length(FromStr));
|
||||
Insert(ToStr, Result, I);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1244,9 +1282,9 @@ procedure TformBrowser.ViewerPrintHTMLHeader(Sender: TObject;
|
||||
var
|
||||
S: string;
|
||||
begin
|
||||
S := ReplaceStr(HFText, '#left', Viewer.DocumentTitle);
|
||||
S := ReplaceStr(S, '#right', Viewer.CurrentFile);
|
||||
HFViewer.LoadFromString(S);
|
||||
S := ReplaceStr(HFText, '#left', Viewer.DocumentTitle);
|
||||
S := ReplaceStr(S, '#right', Viewer.CurrentFile);
|
||||
HFViewer.LoadFromString(S);
|
||||
end;
|
||||
|
||||
procedure TformBrowser.ViewerPrintHTMLFooter(Sender: TObject;
|
||||
@ -1254,9 +1292,9 @@ procedure TformBrowser.ViewerPrintHTMLFooter(Sender: TObject;
|
||||
var
|
||||
S: string;
|
||||
begin
|
||||
S := ReplaceStr(HFText, '#left', DateToStr(Date));
|
||||
S := ReplaceStr(S, '#right', 'Page '+IntToStr(NumPage));
|
||||
HFViewer.LoadFromString(S);
|
||||
S := ReplaceStr(HFText, '#left', DateToStr(Date));
|
||||
S := ReplaceStr(S, '#right', 'Page '+IntToStr(NumPage));
|
||||
HFViewer.LoadFromString(S);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
@ -82,7 +82,7 @@ constructor TPageLoader.Create;
|
||||
begin
|
||||
ContentsList := TStringList.Create;
|
||||
DebugInfo := TStringList.Create;
|
||||
UserAgent := 'FPBrowser/1.0 (X11; Linux i686; Mobile; U; en-GB)';
|
||||
UserAgent := 'FPBrowser/1.0 (Mobile; U; en-GB)';
|
||||
end;
|
||||
|
||||
destructor TPageLoader.Destroy;
|
||||
|
Reference in New Issue
Block a user