fpbrowser: Adds relative url clicking and debug and source viewing

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1734 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-07-04 13:07:40 +00:00
parent 63c77c7417
commit 57541c8e74
4 changed files with 305 additions and 196 deletions

View File

@ -88,56 +88,104 @@ object formBrowser: TformBrowser
TabOrder = 2
end
end
object Panel3: TPanel
object pageBrowser: TPageControl
Left = 0
Height = 368
Top = 33
Width = 621
ActivePage = tabBrowser
Align = alClient
BevelInner = bvLowered
BevelOuter = bvNone
Caption = 'Panel3'
ClientHeight = 368
ClientWidth = 621
ShowTabs = False
TabIndex = 0
TabOrder = 2
object Viewer: THTMLViewer
Left = 1
Height = 366
Top = 1
Width = 619
OnHotSpotCovered = HotSpotChange
OnHotSpotClick = HotSpotClick
OnImageRequest = ViewerImageRequest
OnFormSubmit = SubmitEvent
OnHistoryChange = HistoryChange
OnProgress = ViewerProgress
TabStop = True
TabOrder = 0
Align = alClient
DefBackground = clWindow
BorderStyle = htFocused
HistoryMaxCount = 6
DefFontName = 'Times New Roman'
DefPreFontName = 'Courier New'
DefFontColor = clWindowText
DefOverLinkColor = clFuchsia
ImageCacheCount = 6
NoSelect = False
CharSet = DEFAULT_CHARSET
PrintMarginLeft = 2
PrintMarginRight = 2
PrintMarginTop = 2
PrintMarginBottom = 2
PrintScale = 1
OnMouseMove = ViewerMouseMove
OnProcessing = ProcessingHandler
OnPrintHTMLHeader = ViewerPrintHTMLHeader
OnPrintHTMLFooter = ViewerPrintHTMLFooter
OnInclude = ViewerInclude
OnSoundRequest = SoundRequest
OnMetaRefresh = MetaRefreshEvent
OnObjectClick = ObjectClick
OnRightClick = RightClick
object tabBrowser: TTabSheet
Caption = 'Browser'
ClientHeight = 360
ClientWidth = 613
object Panel3: TPanel
Left = 0
Height = 360
Top = 0
Width = 613
Align = alClient
BevelInner = bvLowered
BevelOuter = bvNone
Caption = 'Panel3'
ClientHeight = 360
ClientWidth = 613
TabOrder = 0
object Viewer: THTMLViewer
Left = 1
Height = 358
Top = 1
Width = 611
OnHotSpotCovered = HotSpotChange
OnHotSpotClick = HotSpotClick
OnImageRequest = ViewerImageRequest
OnFormSubmit = SubmitEvent
OnHistoryChange = HistoryChange
OnProgress = ViewerProgress
TabStop = True
TabOrder = 0
Align = alClient
DefBackground = clWindow
BorderStyle = htFocused
HistoryMaxCount = 6
DefFontName = 'Times New Roman'
DefPreFontName = 'Courier New'
DefFontColor = clWindowText
DefOverLinkColor = clFuchsia
ImageCacheCount = 6
NoSelect = False
CharSet = DEFAULT_CHARSET
PrintMarginLeft = 2
PrintMarginRight = 2
PrintMarginTop = 2
PrintMarginBottom = 2
PrintScale = 1
OnMouseMove = ViewerMouseMove
OnProcessing = ProcessingHandler
OnPrintHTMLHeader = ViewerPrintHTMLHeader
OnPrintHTMLFooter = ViewerPrintHTMLFooter
OnInclude = ViewerInclude
OnSoundRequest = SoundRequest
OnMetaRefresh = MetaRefreshEvent
OnObjectClick = ObjectClick
OnRightClick = RightClick
end
end
end
object tabDebug: TTabSheet
Caption = 'Debug'
ClientHeight = 360
ClientWidth = 613
object memoDebug: TMemo
Left = 0
Height = 360
Top = 0
Width = 613
Align = alClient
Lines.Strings = (
'memoDebug'
)
TabOrder = 0
end
end
object tabSource: TTabSheet
Caption = 'tabSource'
ClientHeight = 360
ClientWidth = 613
object memoSource: TMemo
Left = 0
Height = 360
Top = 0
Width = 613
Align = alClient
Lines.Strings = (
'memoSource'
)
TabOrder = 0
end
end
end
object OpenDialog: TOpenDialog
@ -210,7 +258,7 @@ object formBrowser: TformBrowser
end
end
object options1: TMenuItem
Caption = '&Options'
Caption = '&Tools'
object ShowImages: TMenuItem
Caption = '&Show images'
OnClick = ShowImagesClick
@ -219,6 +267,10 @@ object formBrowser: TformBrowser
Caption = 'Default &Font/Colors...'
OnClick = FontColorsClick
end
object menuViewDebug: TMenuItem
Caption = 'View Source and Debug info'
OnClick = menuViewDebugClick
end
end
object HistoryMenuItem: TMenuItem
Caption = '&History'
@ -241,8 +293,8 @@ object formBrowser: TformBrowser
object FindDialog: TFindDialog
Options = [frDown, frHideWholeWord, frDisableWholeWord]
OnFind = FindDialogFind
left = 249
top = 65535
left = 248
top = 4
end
object PopupMenu: TPopupMenu
left = 400

View File

@ -23,63 +23,75 @@ LazarusResources.Add('TformBrowser','FORMDATA',[
+'Back'#7'Enabled'#8#7'OnClick'#7#12'FwdBackClick'#8'TabOrder'#2#1#0#0#7'TBut'
+'ton'#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'TabOrde'
+'r'#2#2#0#0#0#6'TPanel'#6'Panel3'#4'Left'#2#0#6'Height'#3'p'#1#3'Top'#2'!'#5
+'Width'#3'm'#2#5'Align'#7#8'alClient'#10'BevelInner'#7#9'bvLowered'#10'Bevel'
+'Outer'#7#6'bvNone'#7'Caption'#6#6'Panel3'#12'ClientHeight'#3'p'#1#11'Client'
+'Width'#3'm'#2#8'TabOrder'#2#2#0#11'THTMLViewer'#6'Viewer'#4'Left'#2#1#6'Hei'
+'ght'#3'n'#1#3'Top'#2#1#5'Width'#3'k'#2#16'OnHotSpotCovered'#7#13'HotSpotCha'
+'nge'#14'OnHotSpotClick'#7#12'HotSpotClick'#14'OnImageRequest'#7#18'ViewerIm'
+'ageRequest'#12'OnFormSubmit'#7#11'SubmitEvent'#15'OnHistoryChange'#7#13'His'
+'toryChange'#10'OnProgress'#7#14'ViewerProgress'#7'TabStop'#9#8'TabOrder'#2#0
+#5'Align'#7#8'alClient'#13'DefBackground'#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'De'
+'fOverLinkColor'#7#9'clFuchsia'#15'ImageCacheCount'#2#6#8'NoSelect'#8#7'Char'
+'Set'#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'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'OnMouseMove'#7#15'ViewerMouseMove'#12'OnProcessin'
+'g'#7#17'ProcessingHandler'#17'OnPrintHTMLHeader'#7#21'ViewerPrintHTMLHeader'
+#17'OnPrintHTMLFooter'#7#21'ViewerPrintHTMLFooter'#9'OnInclude'#7#13'ViewerI'
+'nclude'#14'OnSoundRequest'#7#12'SoundRequest'#13'OnMetaRefresh'#7#16'MetaRe'
+'freshEvent'#13'OnObjectClick'#7#11'ObjectClick'#12'OnRightClick'#7#10'Right'
+'Click'#0#0#0#11'TOpenDialog'#10'OpenDialog'#10'DefaultExt'#6#4'.htm'#6'Filt'
+'er'#6'%html files|*.htm;*.html|all files|*.*'#7'Options'#11#14'ofHideReadOn'
+'ly'#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'OpenTextFile'#7'Cap'
+'tion'#6#15'Open &Text File'#7'OnClick'#7#17'OpenTextFileClick'#0#0#9'TMenuI'
+'tem'#13'OpenImageFile'#7'Caption'#6#16'Open &Image File'#7'OnClick'#7#18'Op'
+'enImageFileClick'#0#0#9'TMenuItem'#13'PrinterSetup1'#7'Caption'#6#16'Printe'
+'r Setup...'#7'OnClick'#7#18'PrinterSetup1Click'#0#0#9'TMenuItem'#12'Printpr'
+'eview'#7'Caption'#6#14'Print pre&view'#7'Enabled'#8#7'OnClick'#7#17'Printpr'
+'eviewClick'#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'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'Fi'
+'nd1Click'#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'TMenuItem'#8'options1'#7'Captio'
+'n'#6#8'&Options'#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#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'TPrint'
+'Dialog'#11'PrintDialog'#8'FromPage'#2#1#7'MinPage'#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'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'Viewimage'#7'Caption'#6#11'&View image'#7'OnClick'#7#14'Viewim'
+'ageClick'#0#0#9'TMenuItem'#20'CopyImageToClipboard'#7'Caption'#6#24'&Copy i'
+'mage to clipboard'#7'OnClick'#7#25'CopyImageToClipboardClick'#0#0#9'TMenuIt'
+'em'#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'TTi'
+'mer'#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'T'
+'imer1Timer'#4'left'#3'#'#1#3'top'#2'G'#0#0#19'TPrinterSetupDialog'#18'Print'
+'erSetupDialog'#4'left'#3#192#1#0#0#0
+'r'#2#2#0#0#0#12'TPageControl'#11'pageBrowser'#4'Left'#2#0#6'Height'#3'p'#1#3
+'Top'#2'!'#5'Width'#3'm'#2#10'ActivePage'#7#10'tabBrowser'#5'Align'#7#8'alCl'
+'ient'#8'ShowTabs'#8#8'TabIndex'#2#0#8'TabOrder'#2#2#0#9'TTabSheet'#10'tabBr'
+'owser'#7'Caption'#6#7'Browser'#12'ClientHeight'#3'h'#1#11'ClientWidth'#3'e'
+#2#0#6'TPanel'#6'Panel3'#4'Left'#2#0#6'Height'#3'h'#1#3'Top'#2#0#5'Width'#3
+'e'#2#5'Align'#7#8'alClient'#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7#6
+'bvNone'#7'Caption'#6#6'Panel3'#12'ClientHeight'#3'h'#1#11'ClientWidth'#3'e'
+#2#8'TabOrder'#2#0#0#11'THTMLViewer'#6'Viewer'#4'Left'#2#1#6'Height'#3'f'#1#3
+'Top'#2#1#5'Width'#3'c'#2#16'OnHotSpotCovered'#7#13'HotSpotChange'#14'OnHotS'
+'potClick'#7#12'HotSpotClick'#14'OnImageRequest'#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'clWindow'#11'BorderStyle'#7#9'htFocused'#15
+'HistoryMaxCount'#2#6#11'DefFontName'#6#15'Times New Roman'#14'DefPreFontNam'
+'e'#6#11'Courier New'#12'DefFontColor'#7#12'clWindowText'#16'DefOverLinkColo'
+'r'#7#9'clFuchsia'#15'ImageCacheCount'#2#6#8'NoSelect'#8#7'CharSet'#7#15'DEF'
+'AULT_CHARSET'#15'PrintMarginLeft'#5#0#0#0#0#0#0#0#128#0'@'#16'PrintMarginRi'
+'ght'#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'OnMouseMove'#7#15'ViewerMouseMove'#12'OnProcessing'#7#17'Proc'
+'essingHandler'#17'OnPrintHTMLHeader'#7#21'ViewerPrintHTMLHeader'#17'OnPrint'
+'HTMLFooter'#7#21'ViewerPrintHTMLFooter'#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
+#0#9'TTabSheet'#8'tabDebug'#7'Caption'#6#5'Debug'#12'ClientHeight'#3'h'#1#11
+'ClientWidth'#3'e'#2#0#5'TMemo'#9'memoDebug'#4'Left'#2#0#6'Height'#3'h'#1#3
+'Top'#2#0#5'Width'#3'e'#2#5'Align'#7#8'alClient'#13'Lines.Strings'#1#6#9'mem'
+'oDebug'#0#8'TabOrder'#2#0#0#0#0#9'TTabSheet'#9'tabSource'#7'Caption'#6#9'ta'
+'bSource'#12'ClientHeight'#3'h'#1#11'ClientWidth'#3'e'#2#0#5'TMemo'#10'memoS'
+'ource'#4'Left'#2#0#6'Height'#3'h'#1#3'Top'#2#0#5'Width'#3'e'#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 file'
+'s|*.htm;*.html|all files|*.*'#7'Options'#11#14'ofHideReadOnly'#15'ofPathMus'
+'tExist'#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'OnCl'
+'ick'#7#13'OpenFileClick'#0#0#9'TMenuItem'#12'OpenTextFile'#7'Caption'#6#15
+'Open &Text File'#7'OnClick'#7#17'OpenTextFileClick'#0#0#9'TMenuItem'#13'Ope'
+'nImageFile'#7'Caption'#6#16'Open &Image File'#7'OnClick'#7#18'OpenImageFile'
+'Click'#0#0#9'TMenuItem'#13'PrinterSetup1'#7'Caption'#6#16'Printer Setup...'
+#7'OnClick'#7#18'PrinterSetup1Click'#0#0#9'TMenuItem'#12'Printpreview'#7'Cap'
+'tion'#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'N1'#7'Caption'#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'&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'TMenuItem'#8'options1'#7'Caption'#6#6'&Tools'#0
+#9'TMenuItem'#10'ShowImages'#7'Caption'#6#12'&Show images'#7'OnClick'#7#15'S'
+'howImagesClick'#0#0#9'TMenuItem'#5'Fonts'#7'Caption'#6#23'Default &Font/Col'
+'ors...'#7'OnClick'#7#15'FontColorsClick'#0#0#9'TMenuItem'#13'menuViewDebug'
+#7'Caption'#6#26'View Source and Debug info'#7'OnClick'#7#18'menuViewDebugCl'
+'ick'#0#0#0#9'TMenuItem'#15'HistoryMenuItem'#7'Caption'#6#8'&History'#7'Visi'
+'ble'#8#0#0#9'TMenuItem'#6'About1'#7'Caption'#6#6'&About'#7'OnClick'#7#11'Ab'
+'out1Click'#0#0#0#12'TPrintDialog'#11'PrintDialog'#8'FromPage'#2#1#7'MinPage'
+#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'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'Caption'#6#11'&View image'#7'OnClick'
+#7#14'ViewimageClick'#0#0#9'TMenuItem'#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 window'#7'OnClick'#7#20'OpenInNewWindowClick'#0#0
+#0#6'TTimer'#9'MetaTimer'#7'Enabled'#8#7'OnTimer'#7#14'MetaTimerTimer'#4'lef'
+'t'#3#242#0#3'top'#2'K'#0#0#6'TTimer'#6'Timer1'#8'Interval'#3#200#0#7'OnTime'
+'r'#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

@ -32,14 +32,19 @@ type
{ TformBrowser }
TformBrowser = class(TForm)
memoSource: TMemo;
memoDebug: TMemo;
menuViewDebug: TMenuItem;
N1: TMenuItem;
OpenDialog: TOpenDialog;
MainMenu: TMainMenu;
pageBrowser: TPageControl;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel2: TPanel;
File1: TMenuItem;
Open: TMenuItem;
options1: TMenuItem;
Panel3: TPanel;
ShowImages: TMenuItem;
Fonts: TMenuItem;
editURL: TEdit;
@ -53,7 +58,6 @@ type
Edit2: TMenuItem;
Find1: TMenuItem;
FindDialog: TFindDialog;
Viewer: THTMLViewer;
CopyItem: TMenuItem;
N2: TMenuItem;
SelectAllItem: TMenuItem;
@ -64,6 +68,10 @@ type
{$ENDIF}
PopupMenu: TPopupMenu;
CopyImageToClipboard: TMenuItem;
tabBrowser: TTabSheet;
tabDebug: TTabSheet;
tabSource: TTabSheet;
Viewer: THTMLViewer;
Viewimage: TMenuItem;
N3: TMenuItem;
OpenInNewWindow: TMenuItem;
@ -75,6 +83,7 @@ type
PrinterSetupDialog: TPrinterSetupDialog;
PrinterSetup1: TMenuItem;
procedure editURLKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure menuViewDebugClick(Sender: TObject);
procedure OpenFileClick(Sender: TObject);
procedure HotSpotChange(Sender: TObject; const URL: string);
procedure HotSpotClick(Sender: TObject; const URL: string;
@ -276,6 +285,12 @@ begin
end;
end;
procedure TformBrowser.menuViewDebugClick(Sender: TObject);
begin
pageBrowser.ShowTabs := True;
pageBrowser.ActivePageIndex := 2;
end;
procedure TformBrowser.HotSpotChange(Sender: TObject; const URL: string);
{mouse moved over or away from a hot spot. Change the status line}
var
@ -307,6 +322,7 @@ var
S, Params: string[255];
Ext: string[5];
ID: string;
AbsURL: string;
I, J, K: integer;
begin
Handled := False;
@ -326,86 +342,87 @@ begin
Exit;
end;
J := Pos('HTTP:', UpperCase(URL));
AbsURL := MyPageLoader.URLToAbsoluteURL(URL);
J := Pos('HTTP:', UpperCase(AbsURL));
if (J > 0) then
begin
LoadURL(URL);
LoadURL(AbsURL);
Handled := True;
Exit;
end;
I := Pos(':', URL);
J := Pos('FILE:', UpperCase(URL));
if (I <= 2) or (J > 0) then
I := Pos(':', URL);
J := Pos('FILE:', UpperCase(URL));
if (I <= 2) or (J > 0) then
begin {apparently the URL is a filename}
S := URL;
K := Pos(' ', S); {look for parameters}
if K = 0 then K := Pos('?', S); {could be '?x,y' , etc}
if K > 0 then
S := URL;
K := Pos(' ', S); {look for parameters}
if K = 0 then K := Pos('?', S); {could be '?x,y' , etc}
if K > 0 then
begin
Params := Copy(S, K+1, 255); {save any parameters}
S[0] := chr(K-1); {truncate S}
Params := Copy(S, K+1, 255); {save any parameters}
S[0] := chr(K-1); {truncate S}
end
else Params := '';
S := Viewer.HTMLExpandFileName(S);
Ext := Uppercase(ExtractFileExt(S));
if Ext = '.WAV' then
else Params := '';
S := Viewer.HTMLExpandFileName(S);
Ext := Uppercase(ExtractFileExt(S));
if Ext = '.WAV' then
begin
Handled := True;
Handled := True;
{$IFNDEF LCL}
sndPlaySound(StrPCopy(PC, S), snd_ASync);
sndPlaySound(StrPCopy(PC, S), snd_ASync);
{$ENDIF}
end
else if Ext = '.EXE' then
else if Ext = '.EXE' then
begin
Handled := True;
Handled := True;
{$IFNDEF LCL}
WinExec(StrPCopy(PC, S+' '+Params), sw_Show);
WinExec(StrPCopy(PC, S+' '+Params), sw_Show);
{$ELSE}
{$IFDEF MSWINDOWS}
ShellExecute(Handle, nil, StrPCopy(PC, S), StrPCopy(PC2, Params),
ShellExecute(Handle, nil, StrPCopy(PC, S), StrPCopy(PC2, Params),
nil, SW_SHOWNORMAL);
{$ELSE} //Not sure if this makes any sense since executable won't have .exe.
{$IFDEF DARWIN}
Shell('open -n "' + S + '" --args "' + Params + '"');
Shell('open -n "' + S + '" --args "' + Params + '"');
{$ELSE}
Shell('"' + S + '" "' + Params + '"');
Shell('"' + S + '" "' + Params + '"');
{$ENDIF}
{$ENDIF}
{$ENDIF}
end
else if (Ext = '.MID') or (Ext = '.AVI') then
else if (Ext = '.MID') or (Ext = '.AVI') then
begin
Handled := True;
Handled := True;
{$IFNDEF LCL}
WinExec(StrPCopy(PC, 'MPlayer.exe /play /close '+S), sw_Show);
WinExec(StrPCopy(PC, 'MPlayer.exe /play /close '+S), sw_Show);
{$ELSE}
{$IFDEF MSWINDOWS}
ShellExecute(Handle, nil, 'MPlayer.exe', '/play /close',
ShellExecute(Handle, nil, 'MPlayer.exe', '/play /close',
nil, SW_SHOWNORMAL);
{$ELSE} //No equivalent to MPlayer?
{$ENDIF}
{$ENDIF}
end;
{else ignore other extensions}
editURL.Text := URL;
Exit;
editURL.Text := URL;
Exit;
end;
I := Pos('MAILTO:', UpperCase(URL));
if (I > 0) then
begin
{$IFDEF MSWINDOWS}
ShellExecute(0, nil, pchar(URL), nil, nil, SW_SHOWNORMAL);
ShellExecute(0, nil, pchar(URL), nil, nil, SW_SHOWNORMAL);
{$ELSE}
{$IFDEF DARWIN}
Shell('open "' + URL + '"');
Shell('open "' + URL + '"');
{$ELSE}
Shell('"' + URL + '"'); //use LCL's OpenURL?
Shell('"' + URL + '"'); //use LCL's OpenURL?
{$ENDIF}
{$ENDIF}
Handled := True;
Exit;
Handled := True;
Exit;
end;
editURL.Text := URL; {other protocall}
@ -734,18 +751,15 @@ procedure TformBrowser.ViewimageClick(Sender: TObject);
var
AForm: TImageForm;
begin
AForm := TImageForm.Create(Self);
with AForm do
begin
ImageFormBitmap := FoundObject.Bitmap;
Caption := '';
Show;
end;
AForm := TImageForm.Create(Self);
AForm.ImageFormBitmap := FoundObject.Bitmap;
AForm.Caption := '';
AForm.Show;
end;
procedure TformBrowser.CopyImageToClipboardClick(Sender: TObject);
begin
Clipboard.Assign(FoundObject.Bitmap);
Clipboard.Assign(FoundObject.Bitmap);
end;
procedure TformBrowser.ObjectClick(Sender, Obj: TObject; const OnClick: String);
@ -784,18 +798,7 @@ var
J: Integer;
URL: string;
begin
// Add the base URL if the URL is relative
J := Pos(':', UpperCase(SRC));
if J = 0 then
begin
if (Length(MyPageLoader.LastPageURL) > 0) and
(MyPageLoader.LastPageURL[Length(MyPageLoader.LastPageURL)] = '/') then
URL := MyPageLoader.LastPageURL + Copy(SRC, 2, Length(SRC)-1)
else
URL := MyPageLoader.LastPageURL + SRC;
end
else
URL := SRC;
URL := MyPageLoader.URLToAbsoluteURL(SRC);
J := Pos('http:', LowerCase(URL));
if (J > 0) then
@ -844,7 +847,7 @@ end;
procedure TformBrowser.FormDestroy(Sender: TObject);
begin
HintWindow.Free;
HintWindow.Free;
end;
procedure TformBrowser.RightClick(Sender: TObject; Parameters: TRightClickParameters);
@ -855,7 +858,7 @@ var
HintWindow: THintWindow;
ARect: TRect;
begin
with Parameters do
with Parameters do
begin
FoundObject := Image;
ViewImage.Enabled := (FoundObject <> Nil) and (FoundObject.Bitmap <> Nil);
@ -923,23 +926,23 @@ end;
procedure TformBrowser.MetaTimerTimer(Sender: TObject);
begin
MetaTimer.Enabled := False;
if Viewer.CurrentFile = PresentFile then {don't load if current file has changed}
MetaTimer.Enabled := False;
if Viewer.CurrentFile = PresentFile then {don't load if current file has changed}
begin
Viewer.LoadFromFile(NextFile);
Caption := Viewer.DocumentTitle;
Viewer.LoadFromFile(NextFile);
Caption := Viewer.DocumentTitle;
end;
end;
procedure TformBrowser.MetaRefreshEvent(Sender: TObject; Delay: Integer;
const URL: String);
begin
NextFile := Viewer.HTMLExpandFilename(URL);
if FileExists(NextFile) then
NextFile := Viewer.HTMLExpandFilename(URL);
if FileExists(NextFile) then
begin
PresentFile := Viewer.CurrentFile;
MetaTimer.Interval := Delay*1000;
MetaTimer.Enabled := True;
PresentFile := Viewer.CurrentFile;
MetaTimer.Interval := Delay*1000;
MetaTimer.Enabled := True;
end;
end;
@ -949,12 +952,12 @@ var
pf: TPreviewForm;
Abort: boolean;
begin
pf := TPreviewForm.CreateIt(Self, Viewer, Abort);
try
if not Abort then
pf.ShowModal;
finally
pf.Free;
pf := TPreviewForm.CreateIt(Self, Viewer, Abort);
try
if not Abort then
pf.ShowModal;
finally
pf.Free;
end;
{$ELSE}
begin
@ -967,25 +970,25 @@ procedure TformBrowser.ViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y
var
TitleStr: string;
begin
if not Timer1.Enabled and Assigned(ActiveControl) and ActiveControl.Focused then {9.25}
if not Timer1.Enabled and Assigned(ActiveControl) and ActiveControl.Focused then {9.25}
begin
TitleStr := Viewer.TitleAttr;
if TitleStr = '' then
OldTitle := ''
else if TitleStr <> OldTitle then
TitleStr := Viewer.TitleAttr;
if TitleStr = '' then
OldTitle := ''
else if TitleStr <> OldTitle then
begin
TimerCount := 0;
Timer1.Enabled := True;
OldTitle := TitleStr;
TimerCount := 0;
Timer1.Enabled := True;
OldTitle := TitleStr;
end;
end;
end;
procedure TformBrowser.CloseAll;
begin
Timer1.Enabled := False;
HintWindow.ReleaseHandle;
HintVisible := False;
Timer1.Enabled := False;
HintWindow.ReleaseHandle;
HintVisible := False;
end;
procedure TformBrowser.LoadURL(AURL: string);
@ -993,6 +996,12 @@ begin
MyPageLoader.LoadFromURL(AURL);
Viewer.LoadFromString(MyPageLoader.Contents);
Caption := Viewer.DocumentTitle;
// Load source and debug info
memoSource.Lines.Clear();
memoSource.Lines.AddStrings(MyPageLoader.ContentsList);
memoDebug.Lines.Clear();
memoDebug.Lines.AddStrings(MyPageLoader.DebugInfo);
end;
procedure TformBrowser.Timer1Timer(Sender: TObject);

View File

@ -16,9 +16,12 @@ type
Contents: string;
LastPageURL: string;
ContentsList: TStringList;
DebugInfo: TStringList;
constructor Create;
destructor Destroy; override;
procedure LoadFromURL(AURL: string);
procedure LoadBinaryResource(AURL: string; var ADest: TMemoryStream);
function URLToAbsoluteURL(AInput: string): string;
end;
var
@ -33,6 +36,14 @@ uses httpsend;
constructor TPageLoader.Create;
begin
ContentsList := TStringList.Create;
DebugInfo := TStringList.Create;
end;
destructor TPageLoader.Destroy;
begin
ContentsList.Free;
DebugInfo.Free;
inherited Destroy;
end;
procedure TPageLoader.LoadFromURL(AURL: string);
@ -47,19 +58,26 @@ begin
Client := THttpSend.Create;
try
// if checkGZip.Checked then
// 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;
// Client.UserAgent := AUserAgent;
Client.HttpMethod('GET', LastPageURL);
Client.Document.Position := 0;
// Client.Headers;
Client.Document.Position := 0;
ContentsList.Clear();
ContentsList.LoadFromStream(Client.Document);
DebugInfo.Clear();
DebugInfo.Add(Format('Loading page: %s', [LastPageURL]));
DebugInfo.Add('');
DebugInfo.Add('HTTP Headers:');
DebugInfo.Add('');
DebugInfo.AddStrings(Client.Headers);
DebugInfo.Add('');
Contents := ContentsList.Text;
finally
@ -85,12 +103,30 @@ begin
Client.Document.Position := 0;
ADest := TMemoryStream.Create;
ADest.CopyFrom(Client.Document, Client.Document.Size);
// WriteLn(AURL, ' Size: ', ADest.Size);
DebugInfo.Add(Format('Loading image: %s Size: %d', [AURL, ADest.Size]));
finally
Client.Free;
end;
end;
function TPageLoader.URLToAbsoluteURL(AInput: string): string;
var
J: Integer;
begin
// Add the base URL if the URL is relative
J := Pos(':', UpperCase(AInput));
if J = 0 then
begin
if (Length(LastPageURL) > 0) and
(LastPageURL[Length(LastPageURL)] = '/') then
Result := LastPageURL + Copy(AInput, 2, Length(AInput)-1)
else
Result := LastPageURL + AInput;
end
else
Result := AInput;
end;
initialization
MyPageLoader := TPageLoader.Create;