(Posted this earlier to the lazarus mailing list but no solutions yet. Perhaps somebody here has one)
Editing ChmHelpPkg to try and solve bug 22110 Help (at least CHM help)
should open all help files to enable content/index search, as well as browsing through all help files.
(I hate it when you just get e.g. LCL help, because you can't look up e.g. RTL help)
I want to open all .chm files in the help database when starting up
lhelp, which allows browsing and searching through the entire
documentation set.
See modified code below.
Though this seems to work (I get the RTL, FCL, LCL and reference guide
CHMs displayed, and the proper help subject is shown), it's clunky:
- using built-in sleep periods seems clunky. Tried removing this, but
IIRC the reference guide then fails to load.
- the commented out mime type support detection seems to fail, which
causes other help databases to display (e.g. browser-based help)
- lhelp flashes while the dbs are being loaded; I suppose there's
nothing we can do about that?
Any suggestions?
Thanks,
Reinier
lazarus\components\chmhelp\packages\idehelp\lazchmhelp.pas
function TChmHelpViewer.ShowNode(Node: THelpNode; var ErrMsg: string):
TShowHelpResult;
var
...
WasRunning: boolean;
...
if ExtractFileNameOnly(GetHelpExe) = 'lhelp' then begin
//start of modifications
WasRunning:=fHelpConnection.ServerRunning;
fHelpConnection.StartHelpServer(HelpLabel, GetHelpExe);
// If the server is not already running, open all chm files after it
has started
// This will allow cross-chm (LCL, FCL etc) searching and browsing
in lhelp.
if not(WasRunning) then begin
for i := 0 to HelpDatabases.Count-1 do begin
//this doesn't seem to work - no dbs opened:
//if HelpDatabases[i].SupportsMimeType('application/x-chm') then
begin // Only open chm help files
HelpDatabases[i].ShowTableOfContents;
Sleep(200); //give viewer chance to open file. todo: better way
of doing this?
end;
end;
//end of modifications
Res := fHelpConnection.OpenURL(FileName, Url);