fpbrowser: Starts the code to load images

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1726 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-07-01 07:04:46 +00:00
parent 67e9c9c02c
commit ead2a75db2
6 changed files with 255 additions and 182 deletions

View File

@ -19,7 +19,7 @@ uses
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TformBrowser, formBrowser);
Application.CreateForm(TSubmitForm, SubmitForm);
Application.Run;
end.

View File

@ -51,7 +51,7 @@
<Unit1>
<Filename Value="mainform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ComponentName Value="formBrowser"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="mainform"/>
@ -120,13 +120,16 @@
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="2">
<Exceptions Count="3">
<Item1>
<Name Value="ECodetoolError"/>
</Item1>
<Item2>
<Name Value="EFOpenError"/>
</Item2>
<Item3>
<Name Value="EConvertError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -1,9 +1,9 @@
object Form1: TForm1
object formBrowser: TformBrowser
Left = 372
Height = 439
Top = 267
Width = 621
ClientHeight = 412
ClientHeight = 439
ClientWidth = 621
Color = clBtnFace
Font.Color = clWindowText
@ -17,7 +17,7 @@ object Form1: TForm1
object Panel1: TPanel
Left = 0
Height = 18
Top = 394
Top = 421
Width = 621
Align = alBottom
Alignment = taLeftJustify
@ -48,7 +48,7 @@ object Form1: TForm1
TabOrder = 1
object editURL: TEdit
Left = 190
Height = 23
Height = 22
Top = 4
Width = 337
OnKeyDown = editURLKeyDown
@ -88,23 +88,24 @@ object Form1: TForm1
end
object Panel3: TPanel
Left = 0
Height = 361
Height = 388
Top = 33
Width = 621
Align = alClient
BevelInner = bvLowered
BevelOuter = bvNone
Caption = 'Panel3'
ClientHeight = 361
ClientHeight = 388
ClientWidth = 621
TabOrder = 2
object Viewer: THTMLViewer
Left = 1
Height = 359
Height = 386
Top = 1
Width = 619
OnHotSpotCovered = HotSpotChange
OnHotSpotClick = HotSpotClick
OnImageRequest = ViewerImageRequest
OnFormSubmit = SubmitEvent
OnHistoryChange = HistoryChange
OnProgress = ViewerProgress

View File

@ -1,84 +1,84 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3't'#1#6'Height'#3#183#1#3'Top'#3#11#1#5'Wi'
+'dth'#3'm'#2#12'ClientHeight'#3#156#1#11'ClientWidth'#3'm'#2#5'Color'#7#9'cl'
+'BtnFace'#10'Font.Color'#7#12'clWindowText'#11'Font.Height'#2#243#9'Font.Nam'
+'e'#6#5'Arial'#4'Menu'#7#8'MainMenu'#8'OnCreate'#7#10'FormCreate'#9'OnDestro'
+'y'#7#11'FormDestroy'#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#6'0.9.31'#0#6
+'TPanel'#6'Panel1'#4'Left'#2#0#6'Height'#2#18#3'Top'#3#138#1#5'Width'#3'm'#2
+#5'Align'#7#8'alBottom'#9'Alignment'#7#13'taLeftJustify'#10'BevelInner'#7#9
+'bvLowered'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2#18#11'ClientWidth'
+#3'm'#2#8'TabOrder'#2#0#0#12'TProgressBar'#11'ProgressBar'#4'Left'#3#214#1#6
+'Height'#2#16#3'Top'#2#1#5'Width'#3#150#0#5'Align'#7#7'alRight'#8'TabOrder'#2
+#0#7'Visible'#8#0#0#0#6'TPanel'#6'Panel2'#4'Left'#2#0#6'Height'#2'!'#3'Top'#2
+#0#5'Width'#3'm'#2#5'Align'#7#5'alTop'#10'BevelOuter'#7#6'bvNone'#12'ClientH'
+'eight'#2'!'#11'ClientWidth'#3'm'#2#8'TabOrder'#2#1#0#5'TEdit'#7'editURL'#4
+'Left'#3#190#0#6'Height'#2#23#3'Top'#2#4#5'Width'#3'Q'#1#9'OnKeyDown'#7#14'e'
+'ditURLKeyDown'#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'Width'#2';'#7'Caption'#6#7'&Reload'
+#7'Enabled'#8#7'OnClick'#7#17'ReloadButtonClick'#8'TabOrder'#2#0#0#0#7'TButt'
+'on'#10'BackButton'#4'Left'#2'E'#6'Height'#2#24#3'Top'#2#4#5'Width'#2';'#7'C'
+'aption'#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'W'
+'idth'#2';'#7'Caption'#6#8'&Forward'#7'Enabled'#8#7'OnClick'#7#12'FwdBackCli'
+'ck'#8'TabOrder'#2#2#0#0#0#6'TPanel'#6'Panel3'#4'Left'#2#0#6'Height'#3'i'#1#3
+'Top'#2'!'#5'Width'#3'm'#2#5'Align'#7#8'alClient'#10'BevelInner'#7#9'bvLower'
+'ed'#10'BevelOuter'#7#6'bvNone'#7'Caption'#6#6'Panel3'#12'ClientHeight'#3'i'
+#1#11'ClientWidth'#3'm'#2#8'TabOrder'#2#2#0#11'THTMLViewer'#6'Viewer'#4'Left'
+#2#1#6'Height'#3'g'#1#3'Top'#2#1#5'Width'#3'k'#2#16'OnHotSpotCovered'#7#13'H'
+'otSpotChange'#14'OnHotSpotClick'#7#12'HotSpotClick'#12'OnFormSubmit'#7#11'S'
+'ubmitEvent'#15'OnHistoryChange'#7#13'HistoryChange'#10'OnProgress'#7#14'Vie'
+'werProgress'#7'TabStop'#9#8'TabOrder'#2#0#5'Align'#7#8'alClient'#13'DefBack'
+'ground'#7#8'clWindow'#11'BorderStyle'#7#9'htFocused'#15'HistoryMaxCount'#2#6
+#11'DefFontName'#6#15'Times New Roman'#14'DefPreFontName'#6#11'Courier New'
+#12'DefFontColor'#7#12'clWindowText'#16'DefOverLinkColor'#7#9'clFuchsia'#15
+'ImageCacheCount'#2#6#8'NoSelect'#8#7'CharSet'#7#15'DEFAULT_CHARSET'#15'Prin'
+'tMarginLeft'#5#0#0#0#0#0#0#0#128#0'@'#16'PrintMarginRight'#5#0#0#0#0#0#0#0
+#128#0'@'#14'PrintMarginTop'#5#0#0#0#0#0#0#0#128#0'@'#17'PrintMarginBottom'#5
+#0#0#0#0#0#0#0#128#0'@'#10'PrintScale'#5#0#0#0#0#0#0#0#128#255'?'#11'OnMouse'
+'Move'#7#15'ViewerMouseMove'#12'OnProcessing'#7#17'ProcessingHandler'#17'OnP'
+'rintHTMLHeader'#7#21'ViewerPrintHTMLHeader'#17'OnPrintHTMLFooter'#7#21'View'
+'erPrintHTMLFooter'#9'OnInclude'#7#13'ViewerInclude'#14'OnSoundRequest'#7#12
+'SoundRequest'#13'OnMetaRefresh'#7#16'MetaRefreshEvent'#13'OnObjectClick'#7
+#11'ObjectClick'#12'OnRightClick'#7#10'RightClick'#0#0#0#11'TOpenDialog'#10
+'OpenDialog'#10'DefaultExt'#6#4'.htm'#6'Filter'#6'%html files|*.htm;*.html|a'
+'ll files|*.*'#7'Options'#11#14'ofHideReadOnly'#15'ofPathMustExist'#15'ofFil'
+'eMustExist'#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'TMenuIt'
+'em'#4'Open'#7'Caption'#6#5'&Open'#8'ShortCut'#2'r'#7'OnClick'#7#13'OpenFile'
+'Click'#0#0#9'TMenuItem'#12'OpenTextFile'#7'Caption'#6#15'Open &Text File'#7
+'OnClick'#7#17'OpenTextFileClick'#0#0#9'TMenuItem'#13'OpenImageFile'#7'Capti'
+'on'#6#16'Open &Image File'#7'OnClick'#7#18'OpenImageFileClick'#0#0#9'TMenuI'
+'tem'#13'PrinterSetup1'#7'Caption'#6#16'Printer Setup...'#7'OnClick'#7#18'Pr'
+'interSetup1Click'#0#0#9'TMenuItem'#12'Printpreview'#7'Caption'#6#14'Print p'
+'re&view'#7'Enabled'#8#7'OnClick'#7#17'PrintpreviewClick'#0#0#9'TMenuItem'#6
+'Print1'#7'Caption'#6#9'&Print...'#7'Enabled'#8#7'OnClick'#7#11'Print1Click'
+#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#5'Exit1'#7'Captio'
+'n'#6#5'E&xit'#7'OnClick'#7#10'Exit1Click'#0#0#0#9'TMenuItem'#5'Edit2'#7'Cap'
+'tion'#6#5'&Edit'#7'OnClick'#7#10'Edit2Click'#0#9'TMenuItem'#5'Find1'#7'Capt'
+'ion'#6#5'&Find'#7'Enabled'#8#7'OnClick'#7#10'Find1Click'#0#0#9'TMenuItem'#8
+'CopyItem'#7'Caption'#6#5'&Copy'#8'ShortCut'#3'C@'#7'OnClick'#7#13'CopyItemC'
+'lick'#0#0#9'TMenuItem'#2'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'SelectAl'
+'lItem'#7'Caption'#6#11'Select &All'#7'Enabled'#8#7'OnClick'#7#18'SelectAllI'
+'temClick'#0#0#0#9'TMenuItem'#8'options1'#7'Caption'#6#8'&Options'#0#9'TMenu'
+'Item'#10'ShowImages'#7'Caption'#6#12'&Show images'#7'OnClick'#7#15'ShowImag'
+'esClick'#0#0#9'TMenuItem'#5'Fonts'#7'Caption'#6#23'Default &Font/Colors...'
+#7'OnClick'#7#15'FontColorsClick'#0#0#0#9'TMenuItem'#15'HistoryMenuItem'#7'C'
,'aption'#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#249#0#3'top'#4#255#255#0#0#0#0#10
+'TPopupMenu'#9'PopupMenu'#4'left'#3#144#1#3'top'#2#1#0#9'TMenuItem'#9'Viewim'
+'age'#7'Caption'#6#11'&View image'#7'OnClick'#7#14'ViewimageClick'#0#0#9'TMe'
+'nuItem'#20'CopyImageToClipboard'#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 wind'
+'ow'#7'OnClick'#7#20'OpenInNewWindowClick'#0#0#0#6'TTimer'#9'MetaTimer'#7'En'
+'abled'#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
+'#'#1#3'top'#2'G'#0#0#19'TPrinterSetupDialog'#18'PrinterSetupDialog'#4'left'
+#3#192#1#0#0#0
LazarusResources.Add('TformBrowser','FORMDATA',[
'TPF0'#12'TformBrowser'#11'formBrowser'#4'Left'#3't'#1#6'Height'#3#183#1#3'To'
+'p'#3#11#1#5'Width'#3'm'#2#12'ClientHeight'#3#183#1#11'ClientWidth'#3'm'#2#5
+'Color'#7#9'clBtnFace'#10'Font.Color'#7#12'clWindowText'#11'Font.Height'#2
+#243#9'Font.Name'#6#5'Arial'#4'Menu'#7#8'MainMenu'#8'OnCreate'#7#10'FormCrea'
+'te'#9'OnDestroy'#7#11'FormDestroy'#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6
+#6'0.9.31'#0#6'TPanel'#6'Panel1'#4'Left'#2#0#6'Height'#2#18#3'Top'#3#165#1#5
+'Width'#3'm'#2#5'Align'#7#8'alBottom'#9'Alignment'#7#13'taLeftJustify'#10'Be'
+'velInner'#7#9'bvLowered'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2#18#11
+'ClientWidth'#3'm'#2#8'TabOrder'#2#0#0#12'TProgressBar'#11'ProgressBar'#4'Le'
+'ft'#3#214#1#6'Height'#2#16#3'Top'#2#1#5'Width'#3#150#0#5'Align'#7#7'alRight'
+#8'TabOrder'#2#0#7'Visible'#8#0#0#0#6'TPanel'#6'Panel2'#4'Left'#2#0#6'Height'
+#2'!'#3'Top'#2#0#5'Width'#3'm'#2#5'Align'#7#5'alTop'#10'BevelOuter'#7#6'bvNo'
+'ne'#12'ClientHeight'#2'!'#11'ClientWidth'#3'm'#2#8'TabOrder'#2#1#0#5'TEdit'
+#7'editURL'#4'Left'#3#190#0#6'Height'#2#22#3'Top'#2#4#5'Width'#3'Q'#1#9'OnKe'
+'yDown'#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'Width'#2';'#7'Captio'
+'n'#6#7'&Reload'#7'Enabled'#8#7'OnClick'#7#17'ReloadButtonClick'#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#6'TPanel'#6'Panel3'#4'Left'#2#0#6'Heigh'
+'t'#3#132#1#3'Top'#2'!'#5'Width'#3'm'#2#5'Align'#7#8'alClient'#10'BevelInner'
+#7#9'bvLowered'#10'BevelOuter'#7#6'bvNone'#7'Caption'#6#6'Panel3'#12'ClientH'
+'eight'#3#132#1#11'ClientWidth'#3'm'#2#8'TabOrder'#2#2#0#11'THTMLViewer'#6'V'
+'iewer'#4'Left'#2#1#6'Height'#3#130#1#3'Top'#2#1#5'Width'#3'k'#2#16'OnHotSpo'
+'tCovered'#7#13'HotSpotChange'#14'OnHotSpotClick'#7#12'HotSpotClick'#14'OnIm'
+'ageRequest'#7#18'ViewerImageRequest'#12'OnFormSubmit'#7#11'SubmitEvent'#15
+'OnHistoryChange'#7#13'HistoryChange'#10'OnProgress'#7#14'ViewerProgress'#7
+'TabStop'#9#8'TabOrder'#2#0#5'Align'#7#8'alClient'#13'DefBackground'#7#8'clW'
+'indow'#11'BorderStyle'#7#9'htFocused'#15'HistoryMaxCount'#2#6#11'DefFontNam'
+'e'#6#15'Times New Roman'#14'DefPreFontName'#6#11'Courier New'#12'DefFontCol'
+'or'#7#12'clWindowText'#16'DefOverLinkColor'#7#9'clFuchsia'#15'ImageCacheCou'
+'nt'#2#6#8'NoSelect'#8#7'CharSet'#7#15'DEFAULT_CHARSET'#15'PrintMarginLeft'#5
+#0#0#0#0#0#0#0#128#0'@'#16'PrintMarginRight'#5#0#0#0#0#0#0#0#128#0'@'#14'Pri'
+'ntMarginTop'#5#0#0#0#0#0#0#0#128#0'@'#17'PrintMarginBottom'#5#0#0#0#0#0#0#0
+#128#0'@'#10'PrintScale'#5#0#0#0#0#0#0#0#128#255'?'#11'OnMouseMove'#7#15'Vie'
+'werMouseMove'#12'OnProcessing'#7#17'ProcessingHandler'#17'OnPrintHTMLHeader'
+#7#21'ViewerPrintHTMLHeader'#17'OnPrintHTMLFooter'#7#21'ViewerPrintHTMLFoote'
+'r'#9'OnInclude'#7#13'ViewerInclude'#14'OnSoundRequest'#7#12'SoundRequest'#13
+'OnMetaRefresh'#7#16'MetaRefreshEvent'#13'OnObjectClick'#7#11'ObjectClick'#12
+'OnRightClick'#7#10'RightClick'#0#0#0#11'TOpenDialog'#10'OpenDialog'#10'Defa'
+'ultExt'#6#4'.htm'#6'Filter'#6'%html files|*.htm;*.html|all files|*.*'#7'Opt'
+'ions'#11#14'ofHideReadOnly'#15'ofPathMustExist'#15'ofFileMustExist'#0#4'lef'
+'t'#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'Capt'
+'ion'#6#5'&Open'#8'ShortCut'#2'r'#7'OnClick'#7#13'OpenFileClick'#0#0#9'TMenu'
+'Item'#12'OpenTextFile'#7'Caption'#6#15'Open &Text File'#7'OnClick'#7#17'Ope'
+'nTextFileClick'#0#0#9'TMenuItem'#13'OpenImageFile'#7'Caption'#6#16'Open &Im'
+'age File'#7'OnClick'#7#18'OpenImageFileClick'#0#0#9'TMenuItem'#13'PrinterSe'
+'tup1'#7'Caption'#6#16'Printer Setup...'#7'OnClick'#7#18'PrinterSetup1Click'
+#0#0#9'TMenuItem'#12'Printpreview'#7'Caption'#6#14'Print pre&view'#7'Enabled'
+#8#7'OnClick'#7#17'PrintpreviewClick'#0#0#9'TMenuItem'#6'Print1'#7'Caption'#6
+#9'&Print...'#7'Enabled'#8#7'OnClick'#7#11'Print1Click'#0#0#9'TMenuItem'#2'N'
+'1'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#5'Exit1'#7'Caption'#6#5'E&xit'#7'OnCl'
+'ick'#7#10'Exit1Click'#0#0#0#9'TMenuItem'#5'Edit2'#7'Caption'#6#5'&Edit'#7'O'
+'nClick'#7#10'Edit2Click'#0#9'TMenuItem'#5'Find1'#7'Caption'#6#5'&Find'#7'En'
+'abled'#8#7'OnClick'#7#10'Find1Click'#0#0#9'TMenuItem'#8'CopyItem'#7'Caption'
+#6#5'&Copy'#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'TMenu'
+'Item'#8'options1'#7'Caption'#6#8'&Options'#0#9'TMenuItem'#10'ShowImages'#7
+'Caption'#6#12'&Show images'#7'OnClick'#7#15'ShowImagesClick'#0#0#9'TMenuIte'
+'m'#5'Fonts'#7'Caption'#6#23'Default &Font/Colors...'#7'OnClick'#7#15'FontCo'
,'lorsClick'#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'PrintDialog'#8'FromPage'#2#1#7'MinPa'
+'ge'#2#1#7'MaxPage'#3#15''''#7'Options'#11#10'poPageNums'#0#6'ToPage'#2#1#4
+'left'#3'j'#1#3'top'#2#1#0#0#11'TFindDialog'#10'FindDialog'#7'Options'#11#6
+'frDown'#15'frHideWholeWord'#18'frDisableWholeWord'#0#6'OnFind'#7#14'FindDia'
+'logFind'#4'left'#3#249#0#3'top'#4#255#255#0#0#0#0#10'TPopupMenu'#9'PopupMen'
+'u'#4'left'#3#144#1#3'top'#2#1#0#9'TMenuItem'#9'Viewimage'#7'Caption'#6#11'&'
+'View image'#7'OnClick'#7#14'ViewimageClick'#0#0#9'TMenuItem'#20'CopyImageTo'
+'Clipboard'#7'Caption'#6#24'&Copy image to clipboard'#7'OnClick'#7#25'CopyIm'
+'ageToClipboardClick'#0#0#9'TMenuItem'#2'N3'#7'Caption'#6#1'-'#0#0#9'TMenuIt'
+'em'#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'In'
+'terval'#3#200#0#7'OnTimer'#7#11'Timer1Timer'#4'left'#3'#'#1#3'top'#2'G'#0#0
+#19'TPrinterSetupDialog'#18'PrinterSetupDialog'#4'left'#3#192#1#0#0#0
]);

View File

@ -29,9 +29,9 @@ const
MaxHistories = 6; {size of History list}
type
{ TForm1 }
{ TformBrowser }
TForm1 = class(TForm)
TformBrowser = class(TForm)
OpenDialog: TOpenDialog;
MainMenu: TMainMenu;
Panel1: TPanel;
@ -105,6 +105,8 @@ type
Loop: Integer; Terminate: Boolean);
procedure CopyImageToClipboardClick(Sender: TObject);
procedure ObjectClick(Sender, Obj: TObject; const OnClick: String);
procedure ViewerImageRequest(Sender: TObject; const SRC: string;
var Stream: TMemoryStream);
procedure ViewimageClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ViewerInclude(Sender: TObject; const Command: String;
@ -152,10 +154,11 @@ type
procedure CloseAll;
public
{ Public declarations }
procedure LoadURL(AURL: string);
end;
var
Form1: TForm1;
formBrowser: TformBrowser;
implementation
@ -166,7 +169,7 @@ uses
{$R *.DFM}
{$ENDIF}
procedure TForm1.FormCreate(Sender: TObject);
procedure TformBrowser.FormCreate(Sender: TObject);
var
I: integer;
begin
@ -225,13 +228,13 @@ HintWindow := THintWindow.Create(Self);
HintWindow.Color := $C0FFFF;
end;
procedure TForm1.FormShow(Sender: TObject);
procedure TformBrowser.FormShow(Sender: TObject);
var
S: string;
I: integer;
begin
// With OS X app, ParamStr not meaningful unless launched with --args switch.
if (ParamCount >= 1) {$IFDEF DARWIN} and (Copy(ParamStr(1), 1, 4) <> '-psn') {$ENDIF} then
// With OS X app, ParamStr not meaningful unless launched with --args switch.
if (ParamCount >= 1) {$IFDEF DARWIN} and (Copy(ParamStr(1), 1, 4) <> '-psn') {$ENDIF} then
begin {Parameter is file to load}
{$IFNDEF LCL}
S := CmdLine;
@ -252,7 +255,7 @@ if (ParamCount >= 1) {$IFDEF DARWIN} and (Copy(ParamStr(1), 1, 4) <> '-psn') {$E
end;
end;
procedure TForm1.OpenFileClick(Sender: TObject);
procedure TformBrowser.OpenFileClick(Sender: TObject);
begin
if Viewer.CurrentFile <> '' then
OpenDialog.InitialDir := ExtractFilePath(Viewer.CurrentFile);
@ -265,37 +268,35 @@ begin
end;
end;
procedure TForm1.editURLKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure TformBrowser.editURLKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then
begin
MyPageLoader.LoadFromURL(editURL.Text);
Viewer.LoadFromString(MyPageLoader.Contents);
Caption := Viewer.DocumentTitle;
LoadURL(editURL.Text);
end;
end;
procedure TForm1.HotSpotChange(Sender: TObject; const URL: string);
procedure TformBrowser.HotSpotChange(Sender: TObject; const URL: string);
{mouse moved over or away from a hot spot. Change the status line}
var
Caption: string;
begin
Caption := '';
if URL <> '' then
Caption := Caption+'URL: '+URL+' ';
if Viewer.TitleAttr <> '' then
Caption := Caption+'Title: '+Viewer.TitleAttr;
Panel1.Caption := Caption;
Caption := '';
if URL <> '' then
Caption := Caption+'URL: '+URL+' ';
if Viewer.TitleAttr <> '' then
Caption := Caption+'Title: '+Viewer.TitleAttr;
Panel1.Caption := Caption;
end;
procedure TForm1.HotSpotClick(Sender: TObject; const URL: string;
var Handled: boolean);
{This routine handles what happens when a hot spot is clicked. The assumption
is made that DOS filenames are being used. .EXE, .WAV, .MID, and .AVI files are
handled here, but other file types could be easily added.
If the URL is handled here, set Handled to True. If not handled here, set it
to False and ThtmlViewer will handle it.}
procedure TformBrowser.HotSpotClick(Sender: TObject; const URL: string;
var Handled: boolean);
const
snd_Async = $0001; { play asynchronously }
var
@ -307,23 +308,30 @@ var
Ext: string[5];
ID: string;
I, J, K: integer;
begin
Handled := False;
Handled := False;
{The following looks for a link of the form, "IDExpand_XXX". This is interpreted
as meaning a block with an ID="XXXPlus" or ID="XXXMinus" attribute should
have its Display property toggled.
}
I := Pos('IDEXPAND_', Uppercase(URL));
if I=1 then
{The following looks for a link of the form, "IDExpand_XXX". This is interpreted
as meaning a block with an ID="XXXPlus" or ID="XXXMinus" attribute should
have its Display property toggled.
}
I := Pos('IDEXPAND_', Uppercase(URL));
if I=1 then
begin
ID := Copy(URL, 10, Length(URL)-9);
Viewer.IDDisplay[ID+'Plus'] := not Viewer.IDDisplay[ID+'Plus'];
Viewer.IDDisplay[ID+'Minus'] := not Viewer.IDDisplay[ID+'Minus'];
Viewer.Reformat;
Handled := True;
Exit;
ID := Copy(URL, 10, Length(URL)-9);
Viewer.IDDisplay[ID+'Plus'] := not Viewer.IDDisplay[ID+'Plus'];
Viewer.IDDisplay[ID+'Minus'] := not Viewer.IDDisplay[ID+'Minus'];
Viewer.Reformat;
Handled := True;
Exit;
end;
J := Pos('HTTP:', UpperCase(URL));
if (J > 0) then
begin
LoadURL(URL);
Handled := True;
Exit;
end;
I := Pos(':', URL);
@ -384,9 +392,8 @@ if (I <= 2) or (J > 0) then
Exit;
end;
I := Pos('MAILTO:', UpperCase(URL));
J := Pos('HTTP:', UpperCase(URL));
if (I > 0) or (J > 0) then
I := Pos('MAILTO:', UpperCase(URL));
if (I > 0) then
begin
{$IFDEF MSWINDOWS}
ShellExecute(0, nil, pchar(URL), nil, nil, SW_SHOWNORMAL);
@ -401,20 +408,17 @@ if (I > 0) or (J > 0) then
Exit;
end;
editURL.Text := URL; {other protocall}
editURL.Text := URL; {other protocall}
end;
procedure TForm1.ShowImagesClick(Sender: TObject);
{The Show Images menu item was clicked}
procedure TformBrowser.ShowImagesClick(Sender: TObject);
begin
With Viewer do
begin
ViewImages := not ViewImages;
(Sender as TMenuItem).Checked := ViewImages;
end;
Viewer.ViewImages := not Viewer.ViewImages;
(Sender as TMenuItem).Checked := Viewer.ViewImages;
end;
procedure TForm1.ReloadButtonClick(Sender: TObject);
procedure TformBrowser.ReloadButtonClick(Sender: TObject);
{the Reload button was clicked}
begin
with Viewer do
@ -426,7 +430,7 @@ with Viewer do
end;
end;
procedure TForm1.FwdBackClick(Sender: TObject);
procedure TformBrowser.FwdBackClick(Sender: TObject);
{Either the Forward or Back button was clicked}
begin
with Viewer do
@ -439,7 +443,7 @@ with Viewer do
end;
end;
procedure TForm1.HistoryChange(Sender: TObject);
procedure TformBrowser.HistoryChange(Sender: TObject);
{This event occurs when something changes history list}
var
I: integer;
@ -470,19 +474,19 @@ with Sender as ThtmlViewer do
end;
end;
procedure TForm1.HistoryClick(Sender: TObject);
procedure TformBrowser.HistoryClick(Sender: TObject);
{A history list menuitem got clicked on}
begin
{Changing the HistoryIndex loads and positions the appropriate document}
Viewer.HistoryIndex := (Sender as TMenuItem).Tag;
end;
procedure TForm1.Exit1Click(Sender: TObject);
procedure TformBrowser.Exit1Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.FontColorsClick(Sender: TObject);
procedure TformBrowser.FontColorsClick(Sender: TObject);
var
FontForm: TFontForm;
begin
@ -510,7 +514,7 @@ finally
end;
end;
procedure TForm1.Print1Click(Sender: TObject);
procedure TformBrowser.Print1Click(Sender: TObject);
begin
with PrintDialog do
if Execute then
@ -520,7 +524,7 @@ with PrintDialog do
Viewer.Print(FromPage, ToPage);
end;
procedure TForm1.PrinterSetup1Click(Sender: TObject);
procedure TformBrowser.PrinterSetup1Click(Sender: TObject);
begin
{$IFNDEF LCLCarbon}
PrinterSetupDialog.Execute;
@ -530,7 +534,7 @@ PrinterSetupDialog.Execute;
{$ENDIF}
end;
procedure TForm1.About1Click(Sender: TObject);
procedure TformBrowser.About1Click(Sender: TObject);
begin
AboutBox := TAboutBox.CreateIt(Self, 'HTMLDemo', 'ThtmlViewer');
try
@ -541,7 +545,7 @@ finally
end;
procedure TForm1.SubmitEvent(Sender: TObject; const AnAction, Target, EncType, Method: String;
procedure TformBrowser.SubmitEvent(Sender: TObject; const AnAction, Target, EncType, Method: String;
Results: TStringList);
begin
with SubmitForm do
@ -554,12 +558,12 @@ with SubmitForm do
end;
end;
procedure TForm1.Find1Click(Sender: TObject);
procedure TformBrowser.Find1Click(Sender: TObject);
begin
FindDialog.Execute;
end;
procedure TForm1.FindDialogFind(Sender: TObject);
procedure TformBrowser.FindDialogFind(Sender: TObject);
begin
with FindDialog do
begin
@ -568,7 +572,7 @@ with FindDialog do
end;
end;
procedure TForm1.ProcessingHandler(Sender: TObject; ProcessingOn: Boolean);
procedure TformBrowser.ProcessingHandler(Sender: TObject; ProcessingOn: Boolean);
begin
if ProcessingOn then
begin {disable various buttons and menuitems during processing}
@ -595,22 +599,22 @@ else
end;
end;
procedure TForm1.CopyItemClick(Sender: TObject);
procedure TformBrowser.CopyItemClick(Sender: TObject);
begin
Viewer.CopyToClipboard;
end;
procedure TForm1.Edit2Click(Sender: TObject);
procedure TformBrowser.Edit2Click(Sender: TObject);
begin
CopyItem.Enabled := Viewer.SelLength <> 0;
end;
procedure TForm1.SelectAllItemClick(Sender: TObject);
procedure TformBrowser.SelectAllItemClick(Sender: TObject);
begin
Viewer.SelectAll;
end;
procedure TForm1.OpenTextFileClick(Sender: TObject);
procedure TformBrowser.OpenTextFileClick(Sender: TObject);
begin
if Viewer.CurrentFile <> '' then
OpenDialog.InitialDir := ExtractFilePath(Viewer.CurrentFile);
@ -630,7 +634,7 @@ if OpenDialog.Execute then
end;
end;
procedure TForm1.OpenImageFileClick(Sender: TObject);
procedure TformBrowser.OpenImageFileClick(Sender: TObject);
begin
if Viewer.CurrentFile <> '' then
OpenDialog.InitialDir := ExtractFilePath(Viewer.CurrentFile);
@ -650,7 +654,7 @@ if OpenDialog.Execute then
end;
{$IFNDEF LCL}
procedure TForm1.wmDropFiles(var Message: TMessage);
procedure TformBrowser.wmDropFiles(var Message: TMessage);
var
S: string[200];
Ext: string;
@ -662,7 +666,7 @@ DragFinish(Message.WParam);
if Count >0 then
begin
{$ELSE}
procedure TForm1.DropFiles( Sender : TObject;
procedure TformBrowser.DropFiles( Sender : TObject;
const FileNames : array of string);
var
S : string;
@ -684,7 +688,7 @@ Message.Result := 0;
{$ENDIF}
end;
procedure TForm1.MediaPlayerNotify(Sender: TObject);
procedure TformBrowser.MediaPlayerNotify(Sender: TObject);
begin
{$IFNDEF LCL}
try
@ -704,7 +708,7 @@ except
{$ENDIF}
end;
procedure TForm1.SoundRequest(Sender: TObject; const SRC: String;
procedure TformBrowser.SoundRequest(Sender: TObject; const SRC: String;
Loop: Integer; Terminate: Boolean);
begin
{$IFNDEF LCL}
@ -726,7 +730,7 @@ except
{$ENDIF}
end;
procedure TForm1.ViewimageClick(Sender: TObject);
procedure TformBrowser.ViewimageClick(Sender: TObject);
var
AForm: TImageForm;
begin
@ -739,12 +743,12 @@ with AForm do
end;
end;
procedure TForm1.CopyImageToClipboardClick(Sender: TObject);
procedure TformBrowser.CopyImageToClipboardClick(Sender: TObject);
begin
Clipboard.Assign(FoundObject.Bitmap);
end;
procedure TForm1.ObjectClick(Sender, Obj: TObject; const OnClick: String);
procedure TformBrowser.ObjectClick(Sender, Obj: TObject; const OnClick: String);
var
S: string;
begin
@ -773,8 +777,32 @@ else if OnClick <> '' then
MessageDlg(OnClick, mtCustom, [mbOK], 0);
end;
{ In this event we should provide images for the html component }
procedure TformBrowser.ViewerImageRequest(Sender: TObject; const SRC: string;
var Stream: TMemoryStream);
var
J: Integer;
URL: string;
begin
// Add the base URL if the URL is relative
J := Pos(':', UpperCase(SRC));
if J = 0 then
begin
URL := MyPageLoader.LastPageURL + Copy(SRC, 2, Length(SRC)-1)
end
else URL := SRC;
procedure TForm1.ViewerInclude(Sender: TObject; const Command: String;
J := Pos('HTTP:', UpperCase(URL));
if (J > 0) then
begin
MyPageLoader.LoadBinaryResource(URL, Stream);
Exit;
end;
end;
procedure TformBrowser.ViewerInclude(Sender: TObject; const Command: String;
Params: TStrings; var S: string);
{OnInclude handler}
var
@ -810,12 +838,12 @@ else if CompareText(Command, 'Include') = 0 then
Params.Free;
end;
procedure TForm1.FormDestroy(Sender: TObject);
procedure TformBrowser.FormDestroy(Sender: TObject);
begin
HintWindow.Free;
end;
procedure TForm1.RightClick(Sender: TObject; Parameters: TRightClickParameters);
procedure TformBrowser.RightClick(Sender: TObject; Parameters: TRightClickParameters);
var
Pt: TPoint;
S, Dest: string;
@ -864,7 +892,7 @@ with Parameters do
end;
end;
procedure TForm1.OpenInNewWindowClick(Sender: TObject);
procedure TformBrowser.OpenInNewWindowClick(Sender: TObject);
var
PC: array[0..255] of char;
{$IFDEF LCL}
@ -889,7 +917,7 @@ begin
{$ENDIF}
end;
procedure TForm1.MetaTimerTimer(Sender: TObject);
procedure TformBrowser.MetaTimerTimer(Sender: TObject);
begin
MetaTimer.Enabled := False;
if Viewer.CurrentFile = PresentFile then {don't load if current file has changed}
@ -899,7 +927,7 @@ if Viewer.CurrentFile = PresentFile then {don't load if current file has change
end;
end;
procedure TForm1.MetaRefreshEvent(Sender: TObject; Delay: Integer;
procedure TformBrowser.MetaRefreshEvent(Sender: TObject; Delay: Integer;
const URL: String);
begin
NextFile := Viewer.HTMLExpandFilename(URL);
@ -911,7 +939,7 @@ if FileExists(NextFile) then
end;
end;
procedure TForm1.PrintpreviewClick(Sender: TObject);
procedure TformBrowser.PrintpreviewClick(Sender: TObject);
{$IFNDEF LCL}
var
pf: TPreviewForm;
@ -931,7 +959,7 @@ begin
{$ENDIF}
end;
procedure TForm1.ViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure TformBrowser.ViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
TitleStr: string;
begin
@ -949,14 +977,21 @@ if not Timer1.Enabled and Assigned(ActiveControl) and ActiveControl.Focused then
end;
end;
procedure TForm1.CloseAll;
procedure TformBrowser.CloseAll;
begin
Timer1.Enabled := False;
HintWindow.ReleaseHandle;
HintVisible := False;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
procedure TformBrowser.LoadURL(AURL: string);
begin
MyPageLoader.LoadFromURL(AURL);
Viewer.LoadFromString(MyPageLoader.Contents);
Caption := Viewer.DocumentTitle;
end;
procedure TformBrowser.Timer1Timer(Sender: TObject);
const
StartCount = 2; {timer counts before hint window opens}
EndCount = 20; {after this many timer counts, hint window closes}
@ -1001,7 +1036,7 @@ else if (TimerCount >= StartCount) and not HintVisible then
end;
end;
procedure TForm1.ViewerProgress(Sender: TObject; Stage: TProgressStage;
procedure TformBrowser.ViewerProgress(Sender: TObject; Stage: TProgressStage;
PercentDone: Integer);
begin
ProgressBar.Position := PercentDone;
@ -1042,7 +1077,7 @@ if I > 0 then
end;
end;
procedure TForm1.ViewerPrintHTMLHeader(Sender: TObject;
procedure TformBrowser.ViewerPrintHTMLHeader(Sender: TObject;
HFViewer: THTMLViewer; NumPage: Integer; LastPage: boolean; var XL, XR: integer; var StopPrinting: Boolean);
var
S: string;
@ -1052,7 +1087,7 @@ S := ReplaceStr(S, '#right', Viewer.CurrentFile);
HFViewer.LoadFromString(S);
end;
procedure TForm1.ViewerPrintHTMLFooter(Sender: TObject;
procedure TformBrowser.ViewerPrintHTMLFooter(Sender: TObject;
HFViewer: THTMLViewer; NumPage: Integer; LastPage: boolean; var XL, XR: integer; var StopPrinting: Boolean);
var
S: string;

View File

@ -14,9 +14,11 @@ type
TPageLoader = class
public
Contents: string;
LastPageURL: string;
ContentsList: TStringList;
constructor Create;
procedure LoadFromURL(AURL: string);
procedure LoadBinaryResource(AURL: string; ADest: TStream);
end;
var
@ -37,25 +39,57 @@ procedure TPageLoader.LoadFromURL(AURL: string);
var
Client: THttpSend;
begin
Client := THttpSend.Create;
LastPageURL := AURL;
Client := THttpSend.Create;
try
// if checkGZip.Checked then
begin
// begin
Client.Headers.Add('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');
Client.Headers.Add('Accept-Language: en-gb,en;q=0.5');
// Client.Headers.Add('Accept-Encoding: gzip,deflate');
Client.Headers.Add('Accept-Charset: utf-8;q=0.7,*;q=0.7'); // ISO-8859-1,
end;
// end;
// Client.UserAgent := AUserAgent;
Client.HttpMethod('GET', AURL);
Client.Document.Position := 0;
Client.HttpMethod('GET', AURL);
Client.Document.Position := 0;
ContentsList.LoadFromStream(Client.Document);
ContentsList.LoadFromStream(Client.Document);
Contents := ContentsList.Text;
Contents := ContentsList.Text;
finally
Client.Free;
end;
end;
Client.Free;
procedure TPageLoader.LoadBinaryResource(AURL: string; ADest: TStream);
var
Client: THttpSend;
i: Integer;
begin
Client := THttpSend.Create;
try
Client.Headers.Add('Accept: image/png, image/jpeg, image/gif');
Client.Headers.Add('Accept-Language: en-gb,en;q=0.5');
// Client.Headers.Add('Accept-Encoding: gzip,deflate');
Client.Headers.Add('Accept-Charset: utf-8;q=0.7,*;q=0.7'); // ISO-8859-1,
// Client.UserAgent := AUserAgent;
Client.HttpMethod('GET', AURL);
Client.Document.Position := 0;
// ADest.CopyFrom(Client.Document, Client.Document.Size);
{ ContentsList.LoadFromStream(Client.Document);
for i := 0 to ContentsList.Count-1 do
WriteLn(ContentsList.Strings[i]);
Contents := ContentsList.Text;}
finally
Client.Free;
end;
end;
initialization