You've already forked lazarus-ccr
fpbrowser: Starts moving the controls to the tabs
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1949 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -27,6 +27,7 @@ type
|
|||||||
function GetDocumentTitle: string; virtual; abstract;
|
function GetDocumentTitle: string; virtual; abstract;
|
||||||
procedure SetShowImages(AValue: Boolean); virtual; abstract;
|
procedure SetShowImages(AValue: Boolean); virtual; abstract;
|
||||||
procedure HandlePageLoaderTerminated(Sender: TObject); virtual;
|
procedure HandlePageLoaderTerminated(Sender: TObject); virtual;
|
||||||
|
procedure Reload; virtual; abstract;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TBrowserViewerClass = class of TBrowserViewer;
|
TBrowserViewerClass = class of TBrowserViewer;
|
||||||
|
@ -44,63 +44,13 @@ object formBrowser: TformBrowser
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object panelTop: TPanel
|
|
||||||
Left = 0
|
|
||||||
Height = 33
|
|
||||||
Top = 0
|
|
||||||
Width = 621
|
|
||||||
Align = alTop
|
|
||||||
BevelOuter = bvNone
|
|
||||||
ClientHeight = 33
|
|
||||||
ClientWidth = 621
|
|
||||||
TabOrder = 1
|
|
||||||
object editURL: TEdit
|
|
||||||
Left = 190
|
|
||||||
Height = 24
|
|
||||||
Top = 4
|
|
||||||
Width = 337
|
|
||||||
AutoSize = False
|
|
||||||
OnKeyDown = editURLKeyDown
|
|
||||||
TabStop = False
|
|
||||||
TabOrder = 3
|
|
||||||
end
|
|
||||||
object buttonReload: TButton
|
|
||||||
Left = 10
|
|
||||||
Height = 24
|
|
||||||
Top = 4
|
|
||||||
Width = 59
|
|
||||||
Caption = '&Reload'
|
|
||||||
OnClick = buttonReloadClick
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object buttonBack: TButton
|
|
||||||
Left = 69
|
|
||||||
Height = 24
|
|
||||||
Top = 4
|
|
||||||
Width = 59
|
|
||||||
Caption = '&Back'
|
|
||||||
Enabled = False
|
|
||||||
OnClick = FwdBackClick
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object buttonForward: TButton
|
|
||||||
Left = 128
|
|
||||||
Height = 24
|
|
||||||
Top = 4
|
|
||||||
Width = 59
|
|
||||||
Caption = '&Forward'
|
|
||||||
Enabled = False
|
|
||||||
OnClick = FwdBackClick
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
object pageBrowser: TPageControl
|
object pageBrowser: TPageControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 388
|
Height = 421
|
||||||
Top = 33
|
Top = 0
|
||||||
Width = 621
|
Width = 621
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabOrder = 2
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object OpenDialog: TOpenDialog
|
object OpenDialog: TOpenDialog
|
||||||
DefaultExt = '.htm'
|
DefaultExt = '.htm'
|
||||||
|
@ -13,58 +13,47 @@ LazarusResources.Add('TformBrowser','FORMDATA',[
|
|||||||
+#0#12'TProgressBar'#11'ProgressBar'#4'Left'#3#214#1#6'Height'#2#16#3'Top'#2#1
|
+#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#0#0#6'TLabel'#13'lab'
|
+#5'Width'#3#150#0#5'Align'#7#7'alRight'#8'TabOrder'#2#0#0#0#6'TLabel'#13'lab'
|
||||||
+'elProgress'#4'Left'#3'?'#1#6'Height'#2#16#3'Top'#2#3#5'Width'#2#22#7'Captio'
|
+'elProgress'#4'Left'#3'?'#1#6'Height'#2#16#3'Top'#2#3#5'Width'#2#22#7'Captio'
|
||||||
+'n'#6#4'Idle'#11'ParentColor'#8#0#0#0#6'TPanel'#8'panelTop'#4'Left'#2#0#6'He'
|
+'n'#6#4'Idle'#11'ParentColor'#8#0#0#0#12'TPageControl'#11'pageBrowser'#4'Lef'
|
||||||
+'ight'#2'!'#3'Top'#2#0#5'Width'#3'm'#2#5'Align'#7#5'alTop'#10'BevelOuter'#7#6
|
+'t'#2#0#6'Height'#3#165#1#3'Top'#2#0#5'Width'#3'm'#2#5'Align'#7#8'alClient'#8
|
||||||
+'bvNone'#12'ClientHeight'#2'!'#11'ClientWidth'#3'm'#2#8'TabOrder'#2#1#0#5'TE'
|
+'TabOrder'#2#1#0#0#11'TOpenDialog'#10'OpenDialog'#10'DefaultExt'#6#4'.htm'#6
|
||||||
+'dit'#7'editURL'#4'Left'#3#190#0#6'Height'#2#24#3'Top'#2#4#5'Width'#3'Q'#1#8
|
+'Filter'#6'%html files|*.htm;*.html|all files|*.*'#7'Options'#11#14'ofHideRe'
|
||||||
+'AutoSize'#8#9'OnKeyDown'#7#14'editURLKeyDown'#7'TabStop'#8#8'TabOrder'#2#3#0
|
+'adOnly'#15'ofPathMustExist'#15'ofFileMustExist'#0#4'left'#3'I'#1#3'top'#2#2
|
||||||
+#0#7'TButton'#12'buttonReload'#4'Left'#2#10#6'Height'#2#24#3'Top'#2#4#5'Widt'
|
+#0#0#9'TMainMenu'#8'MainMenu'#4'left'#3'#'#1#3'top'#2#4#0#9'TMenuItem'#5'Fil'
|
||||||
+'h'#2';'#7'Caption'#6#7'&Reload'#7'OnClick'#7#17'buttonReloadClick'#8'TabOrd'
|
+'e1'#7'Caption'#6#5'&File'#0#9'TMenuItem'#4'Open'#7'Caption'#6#5'&Open'#8'Sh'
|
||||||
+'er'#2#0#0#0#7'TButton'#10'buttonBack'#4'Left'#2'E'#6'Height'#2#24#3'Top'#2#4
|
+'ortCut'#2'r'#7'OnClick'#7#13'OpenFileClick'#0#0#9'TMenuItem'#12'OpenTextFil'
|
||||||
+#5'Width'#2';'#7'Caption'#6#5'&Back'#7'Enabled'#8#7'OnClick'#7#12'FwdBackCli'
|
+'e'#7'Caption'#6#15'Open &Text File'#7'OnClick'#7#17'OpenTextFileClick'#0#0#9
|
||||||
+'ck'#8'TabOrder'#2#1#0#0#7'TButton'#13'buttonForward'#4'Left'#3#128#0#6'Heig'
|
+'TMenuItem'#13'OpenImageFile'#7'Caption'#6#16'Open &Image File'#7'OnClick'#7
|
||||||
+'ht'#2#24#3'Top'#2#4#5'Width'#2';'#7'Caption'#6#8'&Forward'#7'Enabled'#8#7'O'
|
+#18'OpenImageFileClick'#0#0#9'TMenuItem'#13'PrinterSetup1'#7'Caption'#6#16'P'
|
||||||
+'nClick'#7#12'FwdBackClick'#8'TabOrder'#2#2#0#0#0#12'TPageControl'#11'pageBr'
|
+'rinter Setup...'#7'OnClick'#7#18'PrinterSetup1Click'#0#0#9'TMenuItem'#12'Pr'
|
||||||
+'owser'#4'Left'#2#0#6'Height'#3#132#1#3'Top'#2'!'#5'Width'#3'm'#2#5'Align'#7
|
+'intpreview'#7'Caption'#6#14'Print pre&view'#7'Enabled'#8#7'OnClick'#7#17'Pr'
|
||||||
+#8'alClient'#8'TabOrder'#2#2#0#0#11'TOpenDialog'#10'OpenDialog'#10'DefaultEx'
|
+'intpreviewClick'#0#0#9'TMenuItem'#6'Print1'#7'Caption'#6#9'&Print...'#7'Ena'
|
||||||
+'t'#6#4'.htm'#6'Filter'#6'%html files|*.htm;*.html|all files|*.*'#7'Options'
|
+'bled'#8#7'OnClick'#7#11'Print1Click'#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1
|
||||||
+#11#14'ofHideReadOnly'#15'ofPathMustExist'#15'ofFileMustExist'#0#4'left'#3'I'
|
+'-'#0#0#9'TMenuItem'#5'Exit1'#7'Caption'#6#5'E&xit'#7'OnClick'#7#10'Exit1Cli'
|
||||||
+#1#3'top'#2#2#0#0#9'TMainMenu'#8'MainMenu'#4'left'#3'#'#1#3'top'#2#4#0#9'TMe'
|
+'ck'#0#0#0#9'TMenuItem'#5'Edit2'#7'Caption'#6#5'&Edit'#7'OnClick'#7#10'Edit2'
|
||||||
+'nuItem'#5'File1'#7'Caption'#6#5'&File'#0#9'TMenuItem'#4'Open'#7'Caption'#6#5
|
+'Click'#0#9'TMenuItem'#5'Find1'#7'Caption'#6#5'&Find'#7'Enabled'#8#7'OnClick'
|
||||||
+'&Open'#8'ShortCut'#2'r'#7'OnClick'#7#13'OpenFileClick'#0#0#9'TMenuItem'#12
|
+#7#10'Find1Click'#0#0#9'TMenuItem'#8'CopyItem'#7'Caption'#6#5'&Copy'#8'Short'
|
||||||
+'OpenTextFile'#7'Caption'#6#15'Open &Text File'#7'OnClick'#7#17'OpenTextFile'
|
+'Cut'#3'C@'#7'OnClick'#7#13'CopyItemClick'#0#0#9'TMenuItem'#2'N2'#7'Caption'
|
||||||
+'Click'#0#0#9'TMenuItem'#13'OpenImageFile'#7'Caption'#6#16'Open &Image File'
|
+#6#1'-'#0#0#9'TMenuItem'#13'SelectAllItem'#7'Caption'#6#11'Select &All'#7'En'
|
||||||
+#7'OnClick'#7#18'OpenImageFileClick'#0#0#9'TMenuItem'#13'PrinterSetup1'#7'Ca'
|
+'abled'#8#7'OnClick'#7#18'SelectAllItemClick'#0#0#0#9'TMenuItem'#8'options1'
|
||||||
+'ption'#6#16'Printer Setup...'#7'OnClick'#7#18'PrinterSetup1Click'#0#0#9'TMe'
|
+#7'Caption'#6#6'&Tools'#0#9'TMenuItem'#10'ShowImages'#7'Caption'#6#12'&Show '
|
||||||
+'nuItem'#12'Printpreview'#7'Caption'#6#14'Print pre&view'#7'Enabled'#8#7'OnC'
|
+'images'#7'OnClick'#7#15'ShowImagesClick'#0#0#9'TMenuItem'#5'Fonts'#7'Captio'
|
||||||
+'lick'#7#17'PrintpreviewClick'#0#0#9'TMenuItem'#6'Print1'#7'Caption'#6#9'&Pr'
|
+'n'#6#23'Default &Font/Colors...'#7'OnClick'#7#15'FontColorsClick'#0#0#9'TMe'
|
||||||
+'int...'#7'Enabled'#8#7'OnClick'#7#11'Print1Click'#0#0#9'TMenuItem'#2'N1'#7
|
+'nuItem'#13'menuViewDebug'#7'Caption'#6#26'View Source and Debug info'#7'OnC'
|
||||||
+'Caption'#6#1'-'#0#0#9'TMenuItem'#5'Exit1'#7'Caption'#6#5'E&xit'#7'OnClick'#7
|
+'lick'#7#18'menuViewDebugClick'#0#0#0#9'TMenuItem'#15'HistoryMenuItem'#7'Cap'
|
||||||
+#10'Exit1Click'#0#0#0#9'TMenuItem'#5'Edit2'#7'Caption'#6#5'&Edit'#7'OnClick'
|
+'tion'#6#8'&History'#7'Visible'#8#0#0#9'TMenuItem'#6'About1'#7'Caption'#6#6
|
||||||
+#7#10'Edit2Click'#0#9'TMenuItem'#5'Find1'#7'Caption'#6#5'&Find'#7'Enabled'#8
|
+'&About'#7'OnClick'#7#11'About1Click'#0#0#0#12'TPrintDialog'#11'PrintDialog'
|
||||||
+#7'OnClick'#7#10'Find1Click'#0#0#9'TMenuItem'#8'CopyItem'#7'Caption'#6#5'&Co'
|
+#8'FromPage'#2#1#7'MinPage'#2#1#7'MaxPage'#3#15''''#7'Options'#11#10'poPageN'
|
||||||
+'py'#8'ShortCut'#3'C@'#7'OnClick'#7#13'CopyItemClick'#0#0#9'TMenuItem'#2'N2'
|
+'ums'#0#6'ToPage'#2#1#4'left'#3'j'#1#3'top'#2#1#0#0#11'TFindDialog'#10'FindD'
|
||||||
+#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'SelectAllItem'#7'Caption'#6#11'Select'
|
+'ialog'#7'Options'#11#6'frDown'#15'frHideWholeWord'#18'frDisableWholeWord'#0
|
||||||
+' &All'#7'Enabled'#8#7'OnClick'#7#18'SelectAllItemClick'#0#0#0#9'TMenuItem'#8
|
+#6'OnFind'#7#14'FindDialogFind'#4'left'#3#248#0#3'top'#2#4#0#0#10'TPopupMenu'
|
||||||
+'options1'#7'Caption'#6#6'&Tools'#0#9'TMenuItem'#10'ShowImages'#7'Caption'#6
|
+#9'PopupMenu'#4'left'#3#144#1#3'top'#2#1#0#9'TMenuItem'#9'Viewimage'#7'Capti'
|
||||||
+#12'&Show images'#7'OnClick'#7#15'ShowImagesClick'#0#0#9'TMenuItem'#5'Fonts'
|
+'on'#6#11'&View image'#7'OnClick'#7#14'ViewimageClick'#0#0#9'TMenuItem'#20'C'
|
||||||
+#7'Caption'#6#23'Default &Font/Colors...'#7'OnClick'#7#15'FontColorsClick'#0
|
+'opyImageToClipboard'#7'Caption'#6#24'&Copy image to clipboard'#7'OnClick'#7
|
||||||
+#0#9'TMenuItem'#13'menuViewDebug'#7'Caption'#6#26'View Source and Debug info'
|
+#25'CopyImageToClipboardClick'#0#0#9'TMenuItem'#2'N3'#7'Caption'#6#1'-'#0#0#9
|
||||||
+#7'OnClick'#7#18'menuViewDebugClick'#0#0#0#9'TMenuItem'#15'HistoryMenuItem'#7
|
+'TMenuItem'#15'OpenInNewWindow'#7'Caption'#6#19'&Open in new window'#7'OnCli'
|
||||||
+'Caption'#6#8'&History'#7'Visible'#8#0#0#9'TMenuItem'#6'About1'#7'Caption'#6
|
+'ck'#7#20'OpenInNewWindowClick'#0#0#0#6'TTimer'#9'MetaTimer'#7'Enabled'#8#7
|
||||||
+#6'&About'#7'OnClick'#7#11'About1Click'#0#0#0#12'TPrintDialog'#11'PrintDialo'
|
+'OnTimer'#7#14'MetaTimerTimer'#4'left'#3#242#0#3'top'#2'K'#0#0#6'TTimer'#6'T'
|
||||||
+'g'#8'FromPage'#2#1#7'MinPage'#2#1#7'MaxPage'#3#15''''#7'Options'#11#10'poPa'
|
+'imer1'#8'Interval'#3#200#0#7'OnTimer'#7#11'Timer1Timer'#4'left'#3'0'#1#3'to'
|
||||||
+'geNums'#0#6'ToPage'#2#1#4'left'#3'j'#1#3'top'#2#1#0#0#11'TFindDialog'#10'Fi'
|
+'p'#2'G'#0#0#19'TPrinterSetupDialog'#18'PrinterSetupDialog'#4'left'#3#192#1#0
|
||||||
+'ndDialog'#7'Options'#11#6'frDown'#15'frHideWholeWord'#18'frDisableWholeWord'
|
+#0#0
|
||||||
+#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
|
|
||||||
]);
|
]);
|
||||||
|
@ -4,10 +4,13 @@ unit mainform;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
LclIntf, LMessages, LclType, LResources, FPimage,
|
// RTL
|
||||||
SysUtils, Classes, Graphics, Controls,
|
SysUtils, Classes, fpimage,
|
||||||
|
// LCL
|
||||||
|
LclIntf, LMessages, LclType, LResources,
|
||||||
|
Graphics, Controls,
|
||||||
Forms, Dialogs, ExtCtrls, Menus, StdCtrls, Clipbrd,
|
Forms, Dialogs, ExtCtrls, Menus, StdCtrls, Clipbrd,
|
||||||
PrintersDlgs,
|
PrintersDlgs, buttons,
|
||||||
ComCtrls,
|
ComCtrls,
|
||||||
{$IFDEF MSWINDOWS} ShellAPI, {$ELSE} Unix, {$ENDIF}
|
{$IFDEF MSWINDOWS} ShellAPI, {$ELSE} Unix, {$ENDIF}
|
||||||
HTMLabt,
|
HTMLabt,
|
||||||
@ -26,16 +29,11 @@ type
|
|||||||
MainMenu: TMainMenu;
|
MainMenu: TMainMenu;
|
||||||
pageBrowser: TPageControl;
|
pageBrowser: TPageControl;
|
||||||
panelBottom: TPanel;
|
panelBottom: TPanel;
|
||||||
panelTop: TPanel;
|
|
||||||
File1: TMenuItem;
|
File1: TMenuItem;
|
||||||
Open: TMenuItem;
|
Open: TMenuItem;
|
||||||
options1: TMenuItem;
|
options1: TMenuItem;
|
||||||
ShowImages: TMenuItem;
|
ShowImages: TMenuItem;
|
||||||
Fonts: TMenuItem;
|
Fonts: TMenuItem;
|
||||||
editURL: TEdit;
|
|
||||||
buttonReload: TButton;
|
|
||||||
buttonBack: TButton;
|
|
||||||
buttonForward: TButton;
|
|
||||||
HistoryMenuItem: TMenuItem;
|
HistoryMenuItem: TMenuItem;
|
||||||
Exit1: TMenuItem;
|
Exit1: TMenuItem;
|
||||||
PrintDialog: TPrintDialog;
|
PrintDialog: TPrintDialog;
|
||||||
@ -66,7 +64,6 @@ type
|
|||||||
procedure ShowImagesClick(Sender: TObject);
|
procedure ShowImagesClick(Sender: TObject);
|
||||||
procedure buttonReloadClick(Sender: TObject);
|
procedure buttonReloadClick(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FwdBackClick(Sender: TObject);
|
|
||||||
procedure HistoryClick(Sender: TObject);
|
procedure HistoryClick(Sender: TObject);
|
||||||
procedure HistoryChange(Sender: TObject);
|
procedure HistoryChange(Sender: TObject);
|
||||||
procedure Exit1Click(Sender: TObject);
|
procedure Exit1Click(Sender: TObject);
|
||||||
@ -115,6 +112,8 @@ type
|
|||||||
procedure DropFiles( Sender : TObject;
|
procedure DropFiles( Sender : TObject;
|
||||||
const FileNames: array of string);
|
const FileNames: array of string);
|
||||||
procedure CloseAll;
|
procedure CloseAll;
|
||||||
|
procedure ForwardClick(Sender: TObject);
|
||||||
|
procedure BackClick(Sender: TObject);
|
||||||
public
|
public
|
||||||
{ Public declarations }
|
{ Public declarations }
|
||||||
CurrentTab: Integer;
|
CurrentTab: Integer;
|
||||||
@ -212,10 +211,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TformBrowser.editURLKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure TformBrowser.editURLKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
|
var
|
||||||
|
lEdit: TEdit;
|
||||||
begin
|
begin
|
||||||
|
lEdit := Sender as TEdit;
|
||||||
if Key = VK_RETURN then
|
if Key = VK_RETURN then
|
||||||
begin
|
begin
|
||||||
LoadURL(editURL.Text);
|
LoadURL(lEdit.Text);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -234,17 +236,15 @@ end;
|
|||||||
procedure TformBrowser.buttonReloadClick(Sender: TObject);
|
procedure TformBrowser.buttonReloadClick(Sender: TObject);
|
||||||
{the Reload button was clicked}
|
{the Reload button was clicked}
|
||||||
begin
|
begin
|
||||||
{$ifdef FPBROWSER_THTMLCOMP}
|
GetCurrentBrowserViewer().Reload();
|
||||||
buttonReload.Enabled := False;
|
|
||||||
Viewer.ReLoad;
|
|
||||||
buttonReload.Enabled := Viewer.CurrentFile <> '';
|
|
||||||
Viewer.SetFocus;
|
|
||||||
{$endif}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TformBrowser.FwdBackClick(Sender: TObject);
|
{Forward button was clicked}
|
||||||
{Either the Forward or Back button was clicked}
|
procedure TformBrowser.ForwardClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
lButton: TWinControl;
|
||||||
begin
|
begin
|
||||||
|
lButton := Sender as TWinControl;
|
||||||
{$ifdef FPBROWSER_THTMLCOMP}
|
{$ifdef FPBROWSER_THTMLCOMP}
|
||||||
{ if Sender = buttonBack then
|
{ if Sender = buttonBack then
|
||||||
Viewer.HistoryIndex := Viewer.HistoryIndex +1
|
Viewer.HistoryIndex := Viewer.HistoryIndex +1
|
||||||
@ -253,17 +253,23 @@ begin
|
|||||||
Self.Caption := Viewer.DocumentTitle;}
|
Self.Caption := Viewer.DocumentTitle;}
|
||||||
{$endif}
|
{$endif}
|
||||||
LoadURL(History.Strings[HistoryIndex]);
|
LoadURL(History.Strings[HistoryIndex]);
|
||||||
if Sender = buttonBack then
|
|
||||||
begin
|
HistoryIndex := HistoryIndex+1;
|
||||||
HistoryIndex := HistoryIndex-1;
|
if HistoryIndex >= History.Count then lButton.Enabled := False;
|
||||||
if HistoryIndex < 0 then buttonBack.Enabled := False;
|
end;
|
||||||
buttonForward.Enabled := True;
|
|
||||||
end
|
{Back button was clicked}
|
||||||
else
|
procedure TformBrowser.BackClick(Sender: TObject);
|
||||||
begin
|
var
|
||||||
HistoryIndex := HistoryIndex+1;
|
lButton, lForwardButton: TWinControl;
|
||||||
if HistoryIndex >= History.Count then buttonForward.Enabled := False;
|
begin
|
||||||
end;
|
lButton := Sender as TWinControl;
|
||||||
|
|
||||||
|
LoadURL(History.Strings[HistoryIndex]);
|
||||||
|
|
||||||
|
HistoryIndex := HistoryIndex-1;
|
||||||
|
if HistoryIndex < 0 then lButton.Enabled := False;
|
||||||
|
//buttonForward.Enabled := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TformBrowser.HistoryChange(Sender: TObject);
|
procedure TformBrowser.HistoryChange(Sender: TObject);
|
||||||
@ -604,57 +610,6 @@ begin
|
|||||||
History.Free;
|
History.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef FPBROWSER_THTMLCOMP}
|
|
||||||
procedure TformBrowser.RightClick(Sender: TObject; Parameters: TRightClickParameters);
|
|
||||||
var
|
|
||||||
Pt: TPoint;
|
|
||||||
S, Dest: string;
|
|
||||||
I: integer;
|
|
||||||
HintWindow: THintWindow;
|
|
||||||
ARect: TRect;
|
|
||||||
begin
|
|
||||||
with Parameters do
|
|
||||||
begin
|
|
||||||
FoundObject := Image;
|
|
||||||
ViewImage.Enabled := (FoundObject <> Nil) and (FoundObject.Bitmap <> Nil);
|
|
||||||
CopyImageToClipboard.Enabled := (FoundObject <> Nil) and (FoundObject.Bitmap <> Nil);
|
|
||||||
if URL <> '' then
|
|
||||||
begin
|
|
||||||
S := URL;
|
|
||||||
I := Pos('#', S);
|
|
||||||
if I >= 1 then
|
|
||||||
begin
|
|
||||||
Dest := System.Copy(S, I, 255); {local destination}
|
|
||||||
S := System.Copy(S, 1, I-1); {the file name}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Dest := ''; {no local destination}
|
|
||||||
if S = '' then S := Viewer.CurrentFile
|
|
||||||
else S := Viewer.HTMLExpandFileName(S);
|
|
||||||
NewWindowFile := S+Dest;
|
|
||||||
OpenInNewWindow.Enabled := FileExists(S);
|
|
||||||
end
|
|
||||||
else OpenInNewWindow.Enabled := False;
|
|
||||||
|
|
||||||
GetCursorPos(Pt);
|
|
||||||
if Length(CLickWord) > 0 then
|
|
||||||
begin
|
|
||||||
HintWindow := THintWindow.Create(Self);
|
|
||||||
try
|
|
||||||
ARect := Rect(0,0,0,0);
|
|
||||||
DrawTextW(HintWindow.Canvas.Handle, @ClickWord[1], Length(ClickWord), ARect, DT_CALCRECT);
|
|
||||||
with ARect do
|
|
||||||
HintWindow.ActivateHint(Rect(Pt.X+20, Pt.Y-(Bottom-Top)-15, Pt.x+30+Right, Pt.Y-15), ClickWord);
|
|
||||||
PopupMenu.Popup(Pt.X, Pt.Y);
|
|
||||||
finally
|
|
||||||
HintWindow.Free;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else PopupMenu.Popup(Pt.X, Pt.Y);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
procedure TformBrowser.OpenInNewWindowClick(Sender: TObject);
|
procedure TformBrowser.OpenInNewWindowClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
PC: array[0..255] of char;
|
PC: array[0..255] of char;
|
||||||
@ -726,26 +681,6 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef FPBROWSER_THTMLCOMP}
|
|
||||||
procedure TformBrowser.ViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
|
||||||
var
|
|
||||||
TitleStr: string;
|
|
||||||
begin
|
|
||||||
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
|
|
||||||
begin
|
|
||||||
TimerCount := 0;
|
|
||||||
Timer1.Enabled := True;
|
|
||||||
OldTitle := TitleStr;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
procedure TformBrowser.CloseAll;
|
procedure TformBrowser.CloseAll;
|
||||||
begin
|
begin
|
||||||
Timer1.Enabled := False;
|
Timer1.Enabled := False;
|
||||||
@ -762,9 +697,54 @@ procedure TformBrowser.AddBrowserTab(AURL: string; AGoToTab: Boolean);
|
|||||||
var
|
var
|
||||||
lViewer: TBrowserViewer;
|
lViewer: TBrowserViewer;
|
||||||
lTabSheet: TTabSheet;
|
lTabSheet: TTabSheet;
|
||||||
|
lTopPanel: TPanel;
|
||||||
|
lbuttonReload, lbuttonBack, lbuttonForward: TBitBtn;
|
||||||
|
leditURL: TEdit;
|
||||||
begin
|
begin
|
||||||
lTabSheet := pageBrowser.AddTabSheet(); // This call requires Lazarus 0.9.31+
|
lTabSheet := pageBrowser.AddTabSheet(); // This call requires Lazarus 0.9.31+
|
||||||
|
|
||||||
|
// Add the top panel of the tab with buttons and the edit box
|
||||||
|
lTopPanel := TPanel.Create(lTabSheet);
|
||||||
|
lTopPanel.Parent := lTabSheet;
|
||||||
|
lTopPanel.Align := alTop;
|
||||||
|
lTopPanel.Height := 33;
|
||||||
|
|
||||||
|
lbuttonReload := TBitBtn.Create(lTopPanel);
|
||||||
|
lbuttonReload.Top := 4;
|
||||||
|
lbuttonReload.Left := 10;
|
||||||
|
lbuttonReload.Width := 59;
|
||||||
|
lbuttonReload.Height := 24;
|
||||||
|
lbuttonReload.Parent := lTopPanel;
|
||||||
|
lbuttonReload.Caption := 'Reload';
|
||||||
|
lbuttonReload.OnClick := buttonReloadClick;
|
||||||
|
|
||||||
|
lbuttonBack := TBitBtn.Create(lTopPanel);
|
||||||
|
lbuttonBack.Top := 4;
|
||||||
|
lbuttonBack.Left := 69;
|
||||||
|
lbuttonBack.Width := 59;
|
||||||
|
lbuttonBack.Height := 24;
|
||||||
|
lbuttonBack.Parent := lTopPanel;
|
||||||
|
lbuttonBack.Caption := 'Back';
|
||||||
|
lbuttonBack.OnClick := ForwardClick;
|
||||||
|
|
||||||
|
lbuttonForward := TBitBtn.Create(lTopPanel);
|
||||||
|
lbuttonForward.Top := 4;
|
||||||
|
lbuttonForward.Left := 128;
|
||||||
|
lbuttonForward.Width := 59;
|
||||||
|
lbuttonForward.Height := 24;
|
||||||
|
lbuttonForward.Parent := lTopPanel;
|
||||||
|
lbuttonForward.Caption := 'Forward';
|
||||||
|
lbuttonForward.OnClick := BackClick;
|
||||||
|
|
||||||
|
leditURL := TEdit.Create(lTopPanel);
|
||||||
|
leditURL.Top := 4;
|
||||||
|
leditURL.Left := 190;
|
||||||
|
leditURL.Width := 337;
|
||||||
|
leditURL.Height := 24;
|
||||||
|
leditURL.Parent := lTopPanel;
|
||||||
|
leditURL.OnKeyDown := editURLKeyDown;
|
||||||
|
|
||||||
|
// Add the HTML Viewer
|
||||||
lViewer := AddBrowserViewer();
|
lViewer := AddBrowserViewer();
|
||||||
lViewer.CreateViewer(lTabSheet, Self);
|
lViewer.CreateViewer(lTabSheet, Self);
|
||||||
|
|
||||||
@ -777,9 +757,9 @@ end;
|
|||||||
|
|
||||||
procedure TformBrowser.AddURLToHistory(AURL: string);
|
procedure TformBrowser.AddURLToHistory(AURL: string);
|
||||||
begin
|
begin
|
||||||
History.Add(AURL);
|
{ History.Add(AURL);
|
||||||
HistoryIndex := History.Count-1;
|
HistoryIndex := History.Count-1;
|
||||||
buttonBack.Enabled := True;
|
buttonBack.Enabled := True;}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TformBrowser.HandlePageLoaderProgress(APercent: Integer);
|
procedure TformBrowser.HandlePageLoaderProgress(APercent: Integer);
|
||||||
@ -843,22 +823,6 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef FPBROWSER_THTMLCOMP}
|
|
||||||
procedure TformBrowser.ViewerProgress(Sender: TObject; Stage: TProgressStage;
|
|
||||||
PercentDone: Integer);
|
|
||||||
begin
|
|
||||||
ProgressBar.Position := PercentDone;
|
|
||||||
case Stage of
|
|
||||||
psStarting:
|
|
||||||
ProgressBar.Visible := True;
|
|
||||||
psRunning:;
|
|
||||||
psEnding:
|
|
||||||
ProgressBar.Visible := False;
|
|
||||||
end;
|
|
||||||
ProgressBar.Update;
|
|
||||||
end;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
{HTML for print header and footer}
|
{HTML for print header and footer}
|
||||||
const
|
const
|
||||||
HFText: string = '<html><head><style>'+
|
HFText: string = '<html><head><style>'+
|
||||||
@ -886,28 +850,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef FPBROWSER_THTMLCOMP}
|
|
||||||
procedure TformBrowser.ViewerPrintHTMLHeader(Sender: TObject;
|
|
||||||
HFViewer: THTMLViewer; NumPage: Integer; LastPage: boolean; var XL, XR: integer; var StopPrinting: Boolean);
|
|
||||||
var
|
|
||||||
S: string;
|
|
||||||
begin
|
|
||||||
S := ReplaceStr(HFText, '#left', Viewer.DocumentTitle);
|
|
||||||
S := ReplaceStr(S, '#right', Viewer.CurrentFile);
|
|
||||||
HFViewer.LoadFromString(S);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TformBrowser.ViewerPrintHTMLFooter(Sender: TObject;
|
|
||||||
HFViewer: THTMLViewer; NumPage: Integer; LastPage: boolean; var XL, XR: integer; var StopPrinting: Boolean);
|
|
||||||
var
|
|
||||||
S: string;
|
|
||||||
begin
|
|
||||||
S := ReplaceStr(HFText, '#left', DateToStr(Date));
|
|
||||||
S := ReplaceStr(S, '#right', 'Page '+IntToStr(NumPage));
|
|
||||||
HFViewer.LoadFromString(S);
|
|
||||||
end;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{$IFDEF LCL}
|
{$IFDEF LCL}
|
||||||
{$I mainform.lrs} {Include form's resource file}
|
{$I mainform.lrs} {Include form's resource file}
|
||||||
|
@ -43,6 +43,7 @@ type
|
|||||||
function GetDocumentTitle: string; override;
|
function GetDocumentTitle: string; override;
|
||||||
procedure SetShowImages(AValue: Boolean); override;
|
procedure SetShowImages(AValue: Boolean); override;
|
||||||
procedure HandlePageLoaderTerminated(Sender: TObject); override;
|
procedure HandlePageLoaderTerminated(Sender: TObject); override;
|
||||||
|
procedure Reload; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -192,6 +193,10 @@ begin
|
|||||||
ShowHTML(MyPageLoader.Contents);
|
ShowHTML(MyPageLoader.Contents);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TiProViewer.Reload;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
SetBrowserViewerClass(TiProViewer);
|
SetBrowserViewerClass(TiProViewer);
|
||||||
end.
|
end.
|
||||||
|
@ -43,6 +43,7 @@ type
|
|||||||
function GetDocumentTitle: string; override;
|
function GetDocumentTitle: string; override;
|
||||||
procedure SetShowImages(AValue: Boolean); override;
|
procedure SetShowImages(AValue: Boolean); override;
|
||||||
procedure HandlePageLoaderTerminated(Sender: TObject); override;
|
procedure HandlePageLoaderTerminated(Sender: TObject); override;
|
||||||
|
procedure Reload; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -52,28 +53,57 @@ implementation
|
|||||||
|
|
||||||
procedure THtmlCompViewer.ViewerMouseMove(Sender: TObject; Shift: TShiftState;
|
procedure THtmlCompViewer.ViewerMouseMove(Sender: TObject; Shift: TShiftState;
|
||||||
X, Y: Integer);
|
X, Y: Integer);
|
||||||
|
var
|
||||||
|
TitleStr: string;
|
||||||
begin
|
begin
|
||||||
|
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
|
||||||
|
begin
|
||||||
|
TimerCount := 0;
|
||||||
|
Timer1.Enabled := True;
|
||||||
|
OldTitle := TitleStr;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure THtmlCompViewer.ViewerProgress(Sender: TObject;
|
procedure THtmlCompViewer.ViewerProgress(Sender: TObject;
|
||||||
Stage: TProgressStage; PercentDone: Integer);
|
Stage: TProgressStage; PercentDone: Integer);
|
||||||
begin
|
begin
|
||||||
|
ProgressBar.Position := PercentDone;
|
||||||
|
case Stage of
|
||||||
|
psStarting:
|
||||||
|
ProgressBar.Visible := True;
|
||||||
|
psRunning:;
|
||||||
|
psEnding:
|
||||||
|
ProgressBar.Visible := False;
|
||||||
|
end;
|
||||||
|
ProgressBar.Update;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure THtmlCompViewer.ViewerPrintHTMLFooter(Sender: TObject;
|
procedure THtmlCompViewer.ViewerPrintHTMLFooter(Sender: TObject;
|
||||||
HFViewer: THTMLViewer; NumPage: Integer; LastPage: Boolean; var XL,
|
HFViewer: THTMLViewer; NumPage: Integer; LastPage: Boolean; var XL,
|
||||||
XR: Integer; var StopPrinting: Boolean);
|
XR: Integer; var StopPrinting: Boolean);
|
||||||
|
var
|
||||||
|
S: string;
|
||||||
begin
|
begin
|
||||||
|
S := ReplaceStr(HFText, '#left', Viewer.DocumentTitle);
|
||||||
|
S := ReplaceStr(S, '#right', Viewer.CurrentFile);
|
||||||
|
HFViewer.LoadFromString(S);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure THtmlCompViewer.ViewerPrintHTMLHeader(Sender: TObject;
|
procedure THtmlCompViewer.ViewerPrintHTMLHeader(Sender: TObject;
|
||||||
HFViewer: THTMLViewer; NumPage: Integer; LastPage: Boolean; var XL,
|
HFViewer: THTMLViewer; NumPage: Integer; LastPage: Boolean; var XL,
|
||||||
XR: Integer; var StopPrinting: Boolean);
|
XR: Integer; var StopPrinting: Boolean);
|
||||||
|
var
|
||||||
|
S: string;
|
||||||
begin
|
begin
|
||||||
|
S := ReplaceStr(HFText, '#left', DateToStr(Date));
|
||||||
|
S := ReplaceStr(S, '#right', 'Page '+IntToStr(NumPage));
|
||||||
|
HFViewer.LoadFromString(S);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure THtmlCompViewer.HotSpotChange(Sender: TObject; const URL: string);
|
procedure THtmlCompViewer.HotSpotChange(Sender: TObject; const URL: string);
|
||||||
@ -215,8 +245,52 @@ end;
|
|||||||
|
|
||||||
procedure THtmlCompViewer.RightClick(Sender: TObject;
|
procedure THtmlCompViewer.RightClick(Sender: TObject;
|
||||||
Parameters: TRightClickParameters);
|
Parameters: TRightClickParameters);
|
||||||
|
var
|
||||||
|
Pt: TPoint;
|
||||||
|
S, Dest: string;
|
||||||
|
I: integer;
|
||||||
|
HintWindow: THintWindow;
|
||||||
|
ARect: TRect;
|
||||||
begin
|
begin
|
||||||
|
with Parameters do
|
||||||
|
begin
|
||||||
|
FoundObject := Image;
|
||||||
|
ViewImage.Enabled := (FoundObject <> Nil) and (FoundObject.Bitmap <> Nil);
|
||||||
|
CopyImageToClipboard.Enabled := (FoundObject <> Nil) and (FoundObject.Bitmap <> Nil);
|
||||||
|
if URL <> '' then
|
||||||
|
begin
|
||||||
|
S := URL;
|
||||||
|
I := Pos('#', S);
|
||||||
|
if I >= 1 then
|
||||||
|
begin
|
||||||
|
Dest := System.Copy(S, I, 255); {local destination}
|
||||||
|
S := System.Copy(S, 1, I-1); {the file name}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Dest := ''; {no local destination}
|
||||||
|
if S = '' then S := Viewer.CurrentFile
|
||||||
|
else S := Viewer.HTMLExpandFileName(S);
|
||||||
|
NewWindowFile := S+Dest;
|
||||||
|
OpenInNewWindow.Enabled := FileExists(S);
|
||||||
|
end
|
||||||
|
else OpenInNewWindow.Enabled := False;
|
||||||
|
|
||||||
|
GetCursorPos(Pt);
|
||||||
|
if Length(CLickWord) > 0 then
|
||||||
|
begin
|
||||||
|
HintWindow := THintWindow.Create(Self);
|
||||||
|
try
|
||||||
|
ARect := Rect(0,0,0,0);
|
||||||
|
DrawTextW(HintWindow.Canvas.Handle, @ClickWord[1], Length(ClickWord), ARect, DT_CALCRECT);
|
||||||
|
with ARect do
|
||||||
|
HintWindow.ActivateHint(Rect(Pt.X+20, Pt.Y-(Bottom-Top)-15, Pt.x+30+Right, Pt.Y-15), ClickWord);
|
||||||
|
PopupMenu.Popup(Pt.X, Pt.Y);
|
||||||
|
finally
|
||||||
|
HintWindow.Free;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else PopupMenu.Popup(Pt.X, Pt.Y);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ In this event we should provide images for the html component }
|
{ In this event we should provide images for the html component }
|
||||||
@ -305,6 +379,12 @@ begin
|
|||||||
Caption := Viewer.DocumentTitle;
|
Caption := Viewer.DocumentTitle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure THtmlCompViewer.Reload;
|
||||||
|
begin
|
||||||
|
Viewer.ReLoad;
|
||||||
|
Viewer.SetFocus;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
SetBrowserViewerClass(THtmlCompViewer);
|
SetBrowserViewerClass(THtmlCompViewer);
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user