Recent

Author Topic: [SOLVED] Open all help/CHM files when first opening context-sensitive help  (Read 4742 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
(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

Code: [Select]
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);
« Last Edit: December 15, 2012, 04:29:00 pm by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Open all help/CHM files when first opening context-sensitive help
« Reply #1 on: December 15, 2012, 04:28:48 pm »
Ok, I found a way to open all CHM files in the help files directories.
For the patch, see the bug report at
http://bugs.freepascal.org/view.php?id=22110
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12771
  • FPC developer.
Re: [SOLVED] Open all help/CHM files when first opening context-sensitive help
« Reply #2 on: December 15, 2012, 08:12:41 pm »
Note that the textmode IDE also does this (combining the indexes of the CHM files). But that code looks convoluted due to mixing classes and TP objects code and the limited TP helpsystem.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: [SOLVED] Open all help/CHM files when first opening context-sensitive help
« Reply #3 on: December 15, 2012, 08:33:31 pm »
@Marco: yes, you also posted that on the mantis issue. Any suggestions for improving the code in the patch based on your experience with the textmode IDE?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018