mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 03:37:59 +01:00
* lhelp opendialog remembers last dir
git-svn-id: trunk@26916 -
This commit is contained in:
parent
957fb24560
commit
c56eea9bf0
@ -57,6 +57,7 @@ type
|
||||
fStopTimer: Boolean;
|
||||
fFillingToc: Boolean;
|
||||
fActiveChmTitle: String;
|
||||
FLoadingSearchURL: Boolean; // use this to try to highlight search terms
|
||||
|
||||
function MakeURI(AUrl: String; AChm: TChmReader): String;
|
||||
|
||||
@ -67,6 +68,7 @@ type
|
||||
procedure DoLoadUri(Uri: String; AChm: TChmReader = nil);
|
||||
procedure DoError(Error: Integer);
|
||||
procedure NewChmOpened(ChmFileList: TChmFileList; Index: Integer);
|
||||
procedure LoadingHTMLStream(var AStream: TStream);
|
||||
|
||||
procedure FillTOC(Data: PtrInt);
|
||||
procedure IpHtmlPanelDocumentOpen(Sender: TObject);
|
||||
@ -294,6 +296,14 @@ begin
|
||||
Application.QueueAsyncCall(@FillToc, PtrInt(ChmFileList.Chm[Index]));
|
||||
end;
|
||||
|
||||
procedure TChmContentProvider.LoadingHTMLStream(var AStream: TStream);
|
||||
begin
|
||||
if not FLoadingSearchURL then
|
||||
Exit;
|
||||
// load html and add tags to highlight words then save back to stream
|
||||
|
||||
end;
|
||||
|
||||
procedure TChmContentProvider.FillTOC(Data: PtrInt);
|
||||
var
|
||||
Stream: TMemoryStream;
|
||||
@ -788,8 +798,9 @@ begin
|
||||
Item := fSearchResults.Selected;
|
||||
if (Item = nil) or (Item.Data = nil) then
|
||||
Exit;
|
||||
|
||||
FLoadingSearchURL:= True;
|
||||
DoLoadUri(MakeURI(Item.SubItems[2], TChmReader(Item.Data)));
|
||||
FLoadingSearchURL:= False;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
@ -1068,6 +1079,7 @@ begin
|
||||
fHtml := TIpHtmlPanel.Create(Parent);
|
||||
with fHtml do begin
|
||||
DataProvider := TIpChmDataProvider.Create(fHtml, fChms);
|
||||
TIpChmDataProvider(DataProvider).OnGetHtmlPage:=@LoadingHTMLStream;
|
||||
OnDocumentOpen := @IpHtmlPanelDocumentOpen;
|
||||
OnHotChange := @IpHtmlPanelHotChange;
|
||||
Parent := AParent;
|
||||
|
||||
@ -41,6 +41,7 @@ uses
|
||||
type
|
||||
|
||||
THelpPopupEvent = procedure(HelpFile: String; URL: String);
|
||||
THtmlPageLoadStreamEvent = procedure (var AStream: TStream) of object;
|
||||
|
||||
{ TIpChmDataProvider }
|
||||
|
||||
@ -49,6 +50,7 @@ type
|
||||
fChm: TChmFileList;
|
||||
fCurrentPage: String;
|
||||
fCurrentPath: String;
|
||||
FOnGetHtmlPage: THtmlPageLoadStreamEvent;
|
||||
fOnHelpPopup: THelpPopupEvent;
|
||||
function StripInPageLink(AURL: String): String;
|
||||
protected
|
||||
@ -71,6 +73,7 @@ type
|
||||
property OnHelpPopup: THelpPopupEvent read fOnHelpPopup write fOnHelpPopup;
|
||||
property CurrentPage: String read fCurrentPage;
|
||||
property CurrentPath: String read fCurrentPath write fCurrentPath;
|
||||
property OnGetHtmlPage: THtmlPageLoadStreamEvent read FOnGetHtmlPage write FOnGetHtmlPage;
|
||||
|
||||
end;
|
||||
|
||||
@ -98,6 +101,8 @@ begin
|
||||
Result := TMemoryStream.Create;
|
||||
Result.Write('<HTML>Page cannot be found!</HTML>',33);
|
||||
end;
|
||||
if Assigned(FOnGetHtmlPage) then
|
||||
FOnGetHtmlPage(Result);
|
||||
end;
|
||||
|
||||
function TIpChmDataProvider.DoCheckURL(const URL: string;
|
||||
|
||||
@ -170,6 +170,7 @@ end;
|
||||
|
||||
procedure THelpForm.FileMenuOpenItemClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
if OpenDialog1.Execute then
|
||||
begin
|
||||
if OpenURL('file://'+OpenDialog1.FileName) = Ord(srSuccess) then
|
||||
@ -296,6 +297,8 @@ begin
|
||||
Width := fConfig.GetValue('Position/Width/Value', Width);
|
||||
Height := fConfig.GetValue('Position/Height/Value', Height);
|
||||
|
||||
OpenDialog1.FileName := fConfig.GetValue('LastFileOpen/Value', OpenDialog1.FileName);
|
||||
|
||||
RecentCount:= fConfig.GetValue('Recent/ItemCount/Value', 0);
|
||||
|
||||
for i := RecentCount-1 downto 0 do // downto since oldest are knocked off the list
|
||||
@ -311,6 +314,8 @@ begin
|
||||
fConfig.SetValue('Position/Width/Value', Width);
|
||||
fConfig.SetValue('Position/Height/Value', Height);
|
||||
|
||||
fConfig.SetValue('LastFileOpen/Value', OpenDialog1.FileName);
|
||||
|
||||
fConfig.SetValue('Recent/ItemCount/Value', FileMenuOpenRecentItem.Count);
|
||||
for i := 0 to FileMenuOpenRecentItem.Count-1 do // downto since oldest are knocked off the list
|
||||
fConfig.SetValue('Recent/Item/'+IntToStr(i)+'/Value', TRecentMenuItem(FileMenuOpenRecentItem.Items[I]).URL);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user