mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 20:56:31 +02:00
lhelp: Fix lhelp to show popup hints (issue #31732).
git-svn-id: trunk@54872 -
This commit is contained in:
parent
9256ee10a2
commit
f9266d01ea
@ -640,8 +640,32 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChmContentProvider.IpHtmlPanelHotClick(Sender: TObject);
|
procedure TChmContentProvider.IpHtmlPanelHotClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
HelpFile: String;
|
||||||
|
aPos: integer;
|
||||||
|
lcURL: String;
|
||||||
begin
|
begin
|
||||||
OpenURL(fHtml.HotURL);
|
// chm-links look like: mk:@MSITStore:D:\LazPortable\docs\chm\iPro.chm::/html/lh3zs3.htm
|
||||||
|
lcURL := Lowercase(fHtml.HotURL);
|
||||||
|
if (Pos('javascript:helppopup(''', lcURL) = 1) or
|
||||||
|
(Pos('javascript:popuplink(''', lcURL) = 1)
|
||||||
|
then begin
|
||||||
|
HelpFile := Copy(fHtml.HotURL, 23, Length(fHtml.HotURL) - (23-1));
|
||||||
|
HelpFile := Copy(HelpFile, 1, Pos('''', HelpFile)-1);
|
||||||
|
|
||||||
|
if (Pos('/',HelpFile)=0) and (Pos('.chm:',HelpFile)=0) then begin //looks like?: 'xyz.htm'
|
||||||
|
aPos := LastDelimiter('/', fHtml.CurURL);
|
||||||
|
if aPos>0 then HelpFile := Copy(fHtml.CurURL,1,aPos) + HelpFile;
|
||||||
|
end
|
||||||
|
else if (Pos('.chm:',HelpFile)=0) then begin //looks like?: 'folder/xyz.htm' or '/folder/xyz.htm'
|
||||||
|
if HelpFile[1]<>'/' then HelpFile:='/'+HelpFile;
|
||||||
|
aPos := LastDelimiter(':', fHtml.CurURL);
|
||||||
|
if aPos>0 then HelpFile := Copy(fHtml.CurURL,1,aPos) + HelpFile;
|
||||||
|
end;
|
||||||
|
DoLoadUri(HelpFile); //open it in current iphtmlpanel.
|
||||||
|
end
|
||||||
|
else
|
||||||
|
OpenURL(fHtml.HotURL);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChmContentProvider.PopupCopyClick(Sender: TObject);
|
procedure TChmContentProvider.PopupCopyClick(Sender: TObject);
|
||||||
|
@ -154,21 +154,22 @@ end;
|
|||||||
|
|
||||||
function TIpChmDataProvider.CanHandle(const URL: string): Boolean;
|
function TIpChmDataProvider.CanHandle(const URL: string): Boolean;
|
||||||
var
|
var
|
||||||
HelpFile: String;
|
|
||||||
Reader: TChmReader = nil;
|
Reader: TChmReader = nil;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
if Pos('Java', URL) =1 then Result := False;
|
if Pos('Java', URL) = 1 then
|
||||||
if (fChm.ObjectExists(StripInPageLink(url), Reader)= 0)
|
Result := False;
|
||||||
and (fChm.ObjectExists(StripInPageLink(BuildUrl(fCurrentPath,Url)), Reader) = 0) then Result := False;
|
|
||||||
|
if (fChm.ObjectExists(StripInPageLink(url), Reader)= 0) and
|
||||||
|
(fChm.ObjectExists(StripInPageLink(BuildUrl(fCurrentPath,Url)), Reader) = 0)
|
||||||
|
then
|
||||||
|
Result := False;
|
||||||
|
|
||||||
//DebugLn('CanHandle ',Url,' = ', Result);
|
//DebugLn('CanHandle ',Url,' = ', Result);
|
||||||
//if not Result then if fChm.ObjectExists(BuildURL('', URL)) > 0 Then result := true;
|
//if not Result then if fChm.ObjectExists(BuildURL('', URL)) > 0 Then result := true;
|
||||||
if Pos('javascript:helppopup(''', LowerCase(URL)) = 1 then begin
|
|
||||||
HelpFile := Copy(URL, 23, Length(URL) - (23-1));
|
if (not Result) and (Pos('#', URL) = 1) then
|
||||||
HelpFile := Copy(HelpFile, 1, Pos('''', HelpFile)-1);
|
Result := True;
|
||||||
//DebugLn('HelpFile = ', HelpFile);
|
|
||||||
end;
|
|
||||||
if (not Result) and (Pos('#', URL) = 1) then Result := True;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIpChmDataProvider.BuildURL(const OldURL, NewURL: string): string;
|
function TIpChmDataProvider.BuildURL(const OldURL, NewURL: string): string;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="9"/>
|
<Version Value="10"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
|
Loading…
Reference in New Issue
Block a user