added example for HTML help

git-svn-id: trunk@9311 -
This commit is contained in:
mattias 2006-05-19 21:56:07 +00:00
parent 3cd3f331af
commit 84a4d25163
17 changed files with 652 additions and 18 deletions

10
.gitattributes vendored
View File

@ -919,6 +919,14 @@ examples/groupboxnested.pas svneol=native#text/pascal
examples/hello.lpi svneol=native#text/plain
examples/hello.pp svneol=native#text/pascal
examples/helloform.pp svneol=native#text/pascal
examples/helphtml/html/edit1.html svneol=native#text/plain
examples/helphtml/html/edit2.html svneol=native#text/plain
examples/helphtml/html/index.html svneol=native#text/plain
examples/helphtml/htmlhelp1.lpi svneol=native#text/plain
examples/helphtml/htmlhelp1.lpr svneol=native#text/plain
examples/helphtml/unit1.lfm svneol=native#text/plain
examples/helphtml/unit1.lrs svneol=native#text/plain
examples/helphtml/unit1.pas svneol=native#text/plain
examples/idequickfix/quickfixdemo1.pas svneol=native#text/plain
examples/idequickfix/quickfixexample.lpk svneol=native#text/plain
examples/idequickfix/quickfixexample.pas svneol=native#text/plain
@ -1539,8 +1547,8 @@ images/components/tfontdialog.ico -text svneol=unset#image/x-icon
images/components/tfontdialog.xpm -text svneol=native#image/x-xpixmap
images/components/tgroupbox.ico -text svneol=unset#image/x-icon
images/components/tgroupbox.xpm -text svneol=native#image/x-xpixmap
images/components/thtmlbrowserhelpviewer.xpm svneol=native#text/plain
images/components/thtmlhelpdatabase.xpm svneol=native#text/plain
images/components/thtmlhelpviewer.xpm svneol=native#text/plain
images/components/tidedialoglayoutstorage.xpm -text svneol=unset#image/xpm
images/components/tidletimer.xpm -text svneol=native#image/x-xpixmap
images/components/timage.ico -text svneol=unset#image/x-icon

View File

@ -0,0 +1,5 @@
<html>
<body>
Help page for TEdit1
</body>
</html>

View File

@ -0,0 +1,6 @@
<html>
<body>
Help page for TEdit2
</body>
</html>

View File

@ -0,0 +1,9 @@
<html>
<body>
Table of content:<br>
<br>
<a href="edit1.html">edit1.html</a><br>
<a href="edit2.html">edit2.html</a><br>
</body>
</html>

View File

@ -0,0 +1,75 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<Version Value="5"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="5">
<Unit0>
<Filename Value="htmlhelp1.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="HTMLHelp1"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<ComponentName Value="Form1"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="unit1.lrs"/>
<UnitName Value="Unit1"/>
</Unit1>
<Unit2>
<Filename Value="html/edit1.html"/>
<IsPartOfProject Value="True"/>
</Unit2>
<Unit3>
<Filename Value="html/edit2.html"/>
<IsPartOfProject Value="True"/>
</Unit3>
<Unit4>
<Filename Value="html/index.html"/>
<IsPartOfProject Value="True"/>
</Unit4>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@ -0,0 +1,18 @@
program HTMLHelp1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms
{ add your units here }, Unit1;
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,55 @@
object Form1: TForm1
Caption = 'Form1'
ClientHeight = 300
ClientWidth = 400
PixelsPerInch = 112
HorzScrollBar.Page = 399
VertScrollBar.Page = 299
Left = 290
Height = 300
Top = 163
Width = 400
object Edit1: TEdit
TabOrder = 0
Text = 'Edit1 - Press F1 for help'
Left = 60
Height = 23
Top = 40
Width = 207
HelpType = htKeyword
HelpKeyword = 'HTML/edit1.html'
end
object Edit2: TEdit
TabOrder = 1
Text = 'Edit2 - Press F1 for help'
Left = 60
Height = 23
Top = 95
Width = 207
HelpType = htKeyword
HelpKeyword = 'HTML/edit2.html'
end
object HelpButton: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Help'
OnClick = HelpButtonClick
TabOrder = 2
Left = 60
Height = 25
Top = 155
Width = 98
end
object HTMLHelpDatabase1: THTMLHelpDatabase
BaseURL = 'file://html/'
AutoRegister = True
KeywordPrefix = 'HTML/'
left = 200
top = 110
end
object HTMLBrowserHelpViewer1: THTMLBrowserHelpViewer
BrowserParams = '%s'
AutoRegister = True
left = 200
top = 175
end
end

View File

@ -0,0 +1,19 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#7'Caption'#6#5'Form1'#12'ClientHeight'#3','#1#11'Cl'
+'ientWidth'#3#144#1#13'PixelsPerInch'#2'p'#18'HorzScrollBar.Page'#3#143#1#18
+'VertScrollBar.Page'#3'+'#1#4'Left'#3'"'#1#6'Height'#3','#1#3'Top'#3#163#0#5
+'Width'#3#144#1#0#5'TEdit'#5'Edit1'#8'TabOrder'#2#0#4'Text'#6#25'Edit1 - Pre'
+'ss F1 for help'#4'Left'#2'<'#6'Height'#2#23#3'Top'#2'('#5'Width'#3#207#0#8
+'HelpType'#7#9'htKeyword'#11'HelpKeyword'#6#15'HTML/edit1.html'#0#0#5'TEdit'
+#5'Edit2'#8'TabOrder'#2#1#4'Text'#6#25'Edit2 - Press F1 for help'#4'Left'#2
+'<'#6'Height'#2#23#3'Top'#2'_'#5'Width'#3#207#0#8'HelpType'#7#9'htKeyword'#11
+'HelpKeyword'#6#15'HTML/edit2.html'#0#0#7'TButton'#10'HelpButton'#25'BorderS'
+'pacing.InnerBorder'#2#2#7'Caption'#6#4'Help'#7'OnClick'#7#15'HelpButtonClic'
+'k'#8'TabOrder'#2#2#4'Left'#2'<'#6'Height'#2#25#3'Top'#3#155#0#5'Width'#2'b'
+#0#0#17'THTMLHelpDatabase'#17'HTMLHelpDatabase1'#7'BaseURL'#6#12'file://html'
+'/'#12'AutoRegister'#9#13'KeywordPrefix'#6#5'HTML/'#4'left'#3#200#0#3'top'#2
+'n'#0#0#22'THTMLBrowserHelpViewer'#22'HTMLBrowserHelpViewer1'#13'BrowserPara'
+'ms'#6#2'%s'#12'AutoRegister'#9#4'left'#3#200#0#3'top'#3#175#0#0#0#0
]);

View File

@ -0,0 +1,92 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Abstract:
This example demonstrates the html help components.
THTMLHelpDatabase is a database - it contains the mapping from Keyword to
page.
THTMLBrowserHelpViewer is a viewer for HTML pages. It simply starts a
browser.
How was the example created:
Put a THTMLHelpDatabase on a form.
Set AutoRegister to true.
Set KeywordPrefix to 'HTML/'
Set BaseURL to 'file://html/'
Put a THTMLBrowserHelpViewer on the form.
Set AutoRegister to true.
Put a TEdit on a form.
Set HelpType to htKeyword
Set HelpKeyword to 'HTML/edit1.html'
Run the program.
Focus the edit field and press F1. A browser will be started to show
the page 'html/edit1.html'.
}
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
LazHelpHTML, StdCtrls, Buttons, HelpIntfs;
type
{ TForm1 }
TForm1 = class(TForm)
HelpButton: TButton;
Edit1: TEdit;
Edit2: TEdit;
HTMLBrowserHelpViewer1: THTMLBrowserHelpViewer;
HTMLHelpDatabase1: THTMLHelpDatabase;
procedure HelpButtonClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.HelpButtonClick(Sender: TObject);
begin
// This demonstrates how to show a help item manually:
ShowHelpOrErrorForKeyword('','HTML/index.html');
end;
initialization
{$I unit1.lrs}
end.

View File

@ -84,7 +84,6 @@ begin
CodeContexts))
or (CodeContexts=nil) or (CodeContexts.Count=0) then
exit;
DebugLn('ShowCodeContext show');
{$IFNDEF EnableCodeContext}
exit;
{$ENDIF}

View File

@ -564,7 +564,6 @@ begin
{$ENDIF}
end;
initialization
{$I ../images/components_images.lrs}

View File

@ -202,6 +202,7 @@ begin
if Find('safari',Browser) then exit;
if Find('netscape',Browser) then exit;
if Find('opera',Browser) then exit;
if Find('iexplorer.exe',Browser) then exit;
end;
{---------------------------------------------------------------------------

View File

@ -1719,6 +1719,182 @@ LazarusResources.Add('tgroupbox','XPM',[
+'@@@@@@@@@@@@+#",'#10'"+#@@@@@@@@@@@@@@@@+#",'#10'"+@+++++++++++++++++#",'#10
+'" ###################"};'#10
]);
LazarusResources.Add('thtmlbrowserhelpviewer','XPM',[
'/* XPM */'#10'static char * thtmlhelpviewer_xpm[] = {'#10'"23 23 228 2",'#10
+'" '#9'c None",'#10'". '#9'c #030302",'#10'"+ '#9'c #1E180B",'#10'"@ '#9'c '
+'#413418",'#10'"# '#9'c #3D3116",'#10'"$ '#9'c #342913",'#10'"% '#9'c #0C0A0'
+'4",'#10'"& '#9'c #000000",'#10'"* '#9'c #070604",'#10'"= '#9'c #7F6838",'#10
+'"- '#9'c #C5AA74",'#10'"; '#9'c #E5C88B",'#10'"> '#9'c #D4B46F",'#10'", '#9
+'c #C4A565",'#10'"'' '#9'c #917844",'#10'") '#9'c #413318",'#10'"! '#9'c #04'
+'0301",'#10'"~ '#9'c #0C00FF",'#10'"{ '#9'c #120F0B",'#10'"] '#9'c #A28549",'
+#10'"^ '#9'c #F7DA9F",'#10'"/ '#9'c #E7C787",'#10'"( '#9'c #D3AE64",'#10'"_ '
+#9'c #D7AA4E",'#10'": '#9'c #F7C662",'#10'"< '#9'c #E8C377",'#10'"[ '#9'c #C'
+'AA558",'#10'"} '#9'c #755C2B",'#10'"| '#9'c #1B1B1B",'#10'"1 '#9'c #74633F"'
+','#10'"2 '#9'c #F7D99C",'#10'"3 '#9'c #E5BF71",'#10'"4 '#9'c #665125",'#10
+'"5 '#9'c #332A18",'#10'"6 '#9'c #372D1A",'#10'"7 '#9'c #C39A47",'#10'"8 '#9
+'c #F5C562",'#10'"9 '#9'c #E4BB67",'#10'"0 '#9'c #B9954D",'#10'"a '#9'c #2B2'
+'10F",'#10'"b '#9'c #050505",'#10'"c '#9'c #222222",'#10'"d '#9'c #3E3B32",'
+#10'"e '#9'c #C5A767",'#10'"f '#9'c #F1D396",'#10'"g '#9'c #635028",'#10'"h '
+#9'c #252525",'#10'"i '#9'c #C6C6C6",'#10'"j '#9'c #D9D9D9",'#10'"k '#9'c #4'
+'23720",'#10'"l '#9'c #E5B85C",'#10'"m '#9'c #E9BE68",'#10'"n '#9'c #CFA652"'
+','#10'"o '#9'c #4B3B1B",'#10'"p '#9'c #020202",'#10'"q '#9'c #212121",'#10
+'"r '#9'c #5B5B5B",'#10'"s '#9'c #493B1D",'#10'"t '#9'c #EAC373",'#10'"u '#9
+'c #D8AE5A",'#10'"v '#9'c #211A0C",'#10'"w '#9'c #7D7D7D",'#10'"x '#9'c #F7F'
+'7F7",'#10'"y '#9'c #F9F9F9",'#10'"z '#9'c #3C3321",'#10'"A '#9'c #E0B764",'
+#10'"B '#9'c #E7BF6C",'#10'"C '#9'c #CAA14E",'#10'"D '#9'c #3E3116",'#10'"E '
+#9'c #0A0A0A",'#10'"F '#9'c #0D0D0D",'#10'"G '#9'c #1F1F1F",'#10'"H '#9'c #B'
+'9B9B9",'#10'"I '#9'c #564522",'#10'"J '#9'c #E9BF69",'#10'"K '#9'c #BE9545"'
+','#10'"L '#9'c #1B150A",'#10'"M '#9'c #888888",'#10'"N '#9'c #FCFCFC",'#10
+'"O '#9'c #EDEDED",'#10'"P '#9'c #403623",'#10'"Q '#9'c #E1B763",'#10'"R '#9
+'c #D8B56B",'#10'"S '#9'c #AE8A42",'#10'"T '#9'c #1A1509",'#10'"U '#9'c #0E0'
+'E0E",'#10'"V '#9'c #6D6D6D",'#10'"W '#9'c #D2D2D2",'#10'"X '#9'c #201D16",'
+#10'"Y '#9'c #312815",'#10'"Z '#9'c #251D0D",'#10'"` '#9'c #070503",'#10'" .'
+#9'c #282828",'#10'"..'#9'c #B0B0B0",'#10'"+.'#9'c #957942",'#10'"@.'#9'c #D'
+'BBB79",'#10'"#.'#9'c #D7AE59",'#10'"$.'#9'c #6E5728",'#10'"%.'#9'c #7F7F7F"'
+','#10'"&.'#9'c #575757",'#10'"*.'#9'c #0A0398",'#10'"=.'#9'c #141414",'#10
+'"-.'#9'c #A8A8A8",'#10'";.'#9'c #D8D8D8",'#10'">.'#9'c #B4B4B4",'#10'",.'#9
+'c #6F6F6F",'#10'"''.'#9'c #F3F3F3",'#10'").'#9'c #C3C3C3",'#10'"!.'#9'c #5B'
+'513A",'#10'"~.'#9'c #DCB769",'#10'"{.'#9'c #DDBA72",'#10'"].'#9'c #A5823B",'
+#10'"^.'#9'c #130F07",'#10'"/.'#9'c #2A2A2A",'#10'"(.'#9'c #C7C7C7",'#10'"_.'
+#9'c #9B9B9B",'#10'":.'#9'c #060606",'#10'"<.'#9'c #111111",'#10'"[.'#9'c #C'
+'5C5C5",'#10'"}.'#9'c #DFDFDF",'#10'"|.'#9'c #EFEFEF",'#10'"1.'#9'c #434343"'
+','#10'"2.'#9'c #444444",'#10'"3.'#9'c #1E1A13",'#10'"4.'#9'c #9C7E40",'#10
+'"5.'#9'c #E8C57D",'#10'"6.'#9'c #CFA95D",'#10'"7.'#9'c #50401F",'#10'"8.'#9
+'c #939393",'#10'"9.'#9'c #D7D7D7",'#10'"0.'#9'c #BFBFBF",'#10'"a.'#9'c #E3E'
+'3E3",'#10'"b.'#9'c #ECECEC",'#10'"c.'#9'c #866B38",'#10'"d.'#9'c #D4B575",'
+#10'"e.'#9'c #CEAD6A",'#10'"f.'#9'c #9D8456",'#10'"g.'#9'c #070605",'#10'"h.'
+#9'c #232324",'#10'"i.'#9'c #DADADA",'#10'"j.'#9'c #D6D6D6",'#10'"k.'#9'c #B'
+'ABABA",'#10'"l.'#9'c #0901A8",'#10'"m.'#9'c #0B0B0B",'#10'"n.'#9'c #A5A5A5"'
+','#10'"o.'#9'c #E1E1E1",'#10'"p.'#9'c #E7E7E7",'#10'"q.'#9'c #9D8045",'#10
+'"r.'#9'c #D8B46D",'#10'"s.'#9'c #CBA561",'#10'"t.'#9'c #403624",'#10'"u.'#9
+'c #0F0F0F",'#10'"v.'#9'c #C8C8C9",'#10'"w.'#9'c #D1D1D1",'#10'"x.'#9'c #5F5'
+'F5F",'#10'"y.'#9'c #E6E6E6",'#10'"z.'#9'c #EBEBEB",'#10'"A.'#9'c #1E1E1E",'
+#10'"B.'#9'c #BD9A52",'#10'"C.'#9'c #D8B56C",'#10'"D.'#9'c #B9954F",'#10'"E.'
+#9'c #241E14",'#10'"F.'#9'c #747475",'#10'"G.'#9'c #D5D5D5",'#10'"H.'#9'c #D'
+'4D4D4",'#10'"I.'#9'c #CACACA",'#10'"J.'#9'c #4C4C4C",'#10'"K.'#9'c #0700A2"'
+','#10'"L.'#9'c #DCDCDC",'#10'"M.'#9'c #E2E2E2",'#10'"N.'#9'c #E5E5E5",'#10
+'"O.'#9'c #686868",'#10'"P.'#9'c #B09252",'#10'"Q.'#9'c #CEA85A",'#10'"R.'#9
+'c #795F2C",'#10'"S.'#9'c #10100E",'#10'"T.'#9'c #A9A9A9",'#10'"U.'#9'c #D3D'
+'3D3",'#10'"V.'#9'c #CBCBCB",'#10'"W.'#9'c #A1A1A1",'#10'"X.'#9'c #0900D0",'
+#10'"Y.'#9'c #3B3B3B",'#10'"Z.'#9'c #CCCCCC",'#10'"`.'#9'c #636363",'#10'" +'
+#9'c #564A2F",'#10'".+'#9'c #574829",'#10'"++'#9'c #404041",'#10'"@+'#9'c #C'
+'8C8C8",'#10'"#+'#9'c #BDBDBD",'#10'"$+'#9'c #2E2E2E",'#10'"%+'#9'c #515151"'
+','#10'"&+'#9'c #C2C2C2",'#10'"*+'#9'c #B5B5B5",'#10'"=+'#9'c #3C3C3C",'#10
+'"-+'#9'c #303030",'#10'";+'#9'c #4D4D4D",'#10'">+'#9'c #A3A3A3",'#10'",+'#9
+'c #C1C1C1",'#10'"''+'#9'c #B8B8B8",'#10'")+'#9'c #454545",'#10'"!+'#9'c #03'
+'0303",'#10'"~+'#9'c #313131",'#10'"{+'#9'c #999999",'#10'"]+'#9'c #BBBBBB",'
+#10'"^+'#9'c #666460",'#10'"/+'#9'c #505050",'#10'"(+'#9'c #898989",'#10'"_+'
,#9'c #909090",'#10'":+'#9'c #2B2B2B",'#10'"<+'#9'c #0800BC",'#10'"[+'#9'c #0'
+'10101",'#10'"}+'#9'c #414141",'#10'"|+'#9'c #3D3D3D",'#10'"1+'#9'c #C5A768"'
+','#10'"2+'#9'c #E2C280",'#10'"3+'#9'c #735A29",'#10'"4+'#9'c #E1C07D",'#10
+'"5+'#9'c #EBC880",'#10'"6+'#9'c #80642E",'#10'"7+'#9'c #D2B06B",'#10'"8+'#9
+'c #D4AB58",'#10'"9+'#9'c #6B5326",'#10'"0+'#9'c #040404",'#10'"a+'#9'c #4C3'
+'D1D",'#10'"b+'#9'c #4A3B1D",'#10'"c+'#9'c #1A1409",'#10'"d+'#9'c #3A3A3A",'
+#10'"e+'#9'c #020203",'#10'" . + @ # $ % & ",'
+#10'" * = - ; > , '' ) ! ~ ",'#10'" { ] ^ '
+'/ ( _ : < [ } & ~ ",'#10'" | 1 2 3 4 5 6 7 8 9 0 a b ~'
+' ~ ~ ~ ",'#10'" c d e f g h i j k l m n o p ",'#10'" '
+'q r s t u v w x y z A B C D E F ",'#10'" G H I J K L M N O P Q'
+' R S T h U ~ ~ ~ ~ ",'#10'" | V W X Y Z ` .N ..+.@.#.$.& %.&.*.~ '
+'",'#10'" =.-.;.>.,.G h ''.).!.~.{.].^./.(._.:. ~ ",'#10'" <.[.}.|.1.'
+'2.2.1.3.4.5.6.7.:.8.9.0.:. ~ ",'#10'" U i a.b.2.2.2./.c.d.e.f.g.h.i.j'
+'.k.l.~ ",'#10'" m.n.o.p.O 2.2.,.q.r.s.t.u.v.i.w.8.~ ~ ~ ~ ",'#10'"'
+' E x.j o.y.z.2.A.B.C.D.E.F.G.H.I.J.K. ",'#10'" E >.;.L.M.N.O.P.Q'
+'.R.S.T.U.V.W.p X. ",'#10'" :.Y.Z.W H.i.`. +.+Z ++i @+#+$+& ~ ~ ~ '
+'~ ",'#10'" b %+&+(.V.*+=+-+;+>+,+''+)+& ~ ",'#10'" '
+'!+~+{+]+#+^+/+/+(+_+:+& & & <+ ",'#10'" [+!+}+|+1+2+3+:.& &'
+' & & & & ",'#10'" & & 4+5+6+& p ~ ~ ~ ~ ~ ",'
+#10'" & 7+8+9+& 0+ & O.~ & & ",'#10'" '
+' a+b+c+& & ~ d+& & ",'#10'" [+[+e+ ~ ~ '
+'~ ~ ~ & ",'#10'" & & "};'#10
]);
LazarusResources.Add('thtmlhelpdatabase','XPM',[
'/* XPM */'#10'static char * thtmlhelpdatabase_xpm[] = {'#10'"23 23 221 2",'
+#10'" '#9'c None",'#10'". '#9'c #030302",'#10'"+ '#9'c #1E180B",'#10'"@ '#9
+'c #413418",'#10'"# '#9'c #3D3116",'#10'"$ '#9'c #342913",'#10'"% '#9'c #0C0'
+'A04",'#10'"& '#9'c #000000",'#10'"* '#9'c #040301",'#10'"= '#9'c #7F6838",'
+#10'"- '#9'c #C5AA74",'#10'"; '#9'c #E5C88B",'#10'"> '#9'c #D4B46F",'#10'", '
+#9'c #C4A565",'#10'"'' '#9'c #917844",'#10'") '#9'c #413318",'#10'"! '#9'c #'
+'0C00FF",'#10'"~ '#9'c #0C0904",'#10'"{ '#9'c #A28549",'#10'"] '#9'c #F7DA9F'
+'",'#10'"^ '#9'c #E7C787",'#10'"/ '#9'c #D3AE64",'#10'"( '#9'c #D7AA4E",'#10
+'"_ '#9'c #F7C662",'#10'": '#9'c #E8C377",'#10'"< '#9'c #CAA558",'#10'"[ '#9
+'c #755C2B",'#10'"} '#9'c #020201",'#10'"| '#9'c #76643E",'#10'"1 '#9'c #F7D'
+'99C",'#10'"2 '#9'c #E5BF71",'#10'"3 '#9'c #665125",'#10'"4 '#9'c #2C2310",'
+#10'"5 '#9'c #302612",'#10'"6 '#9'c #C39A47",'#10'"7 '#9'c #F5C562",'#10'"8 '
+#9'c #E4BB67",'#10'"9 '#9'c #B9954D",'#10'"0 '#9'c #2B210F",'#10'"a '#9'c #0'
+'10101",'#10'"b '#9'c #242013",'#10'"c '#9'c #C5A767",'#10'"d '#9'c #F1D396"'
+','#10'"e '#9'c #635028",'#10'"f '#9'c #423720",'#10'"g '#9'c #E5B85C",'#10
+'"h '#9'c #E9BE68",'#10'"i '#9'c #CFA652",'#10'"j '#9'c #4B3B1B",'#10'"k '#9
+'c #493B1D",'#10'"l '#9'c #EAC373",'#10'"m '#9'c #D8AE5A",'#10'"n '#9'c #211'
+'A0C",'#10'"o '#9'c #3C3321",'#10'"p '#9'c #E0B764",'#10'"q '#9'c #E7BF6C",'
+#10'"r '#9'c #CAA14E",'#10'"s '#9'c #3E3116",'#10'"t '#9'c #564522",'#10'"u '
+#9'c #E9BF69",'#10'"v '#9'c #BE9545",'#10'"w '#9'c #1B150A",'#10'"x '#9'c #0'
+'20202",'#10'"y '#9'c #403623",'#10'"z '#9'c #E1B763",'#10'"A '#9'c #D8B56B"'
+','#10'"B '#9'c #AE8A42",'#10'"C '#9'c #1A1509",'#10'"D '#9'c #141009",'#10
+'"E '#9'c #312815",'#10'"F '#9'c #251D0D",'#10'"G '#9'c #060402",'#10'"H '#9
+'c #030303",'#10'"I '#9'c #957942",'#10'"J '#9'c #DBBB79",'#10'"K '#9'c #D7A'
+'E59",'#10'"L '#9'c #6E5728",'#10'"M '#9'c #DCB769",'#10'"N '#9'c #DDBA72",'
+#10'"O '#9'c #A5823B",'#10'"P '#9'c #130F07",'#10'"Q '#9'c #303430",'#10'"R '
+#9'c #515A50",'#10'"S '#9'c #5B615A",'#10'"T '#9'c #595E58",'#10'"U '#9'c #2'
+'21F17",'#10'"V '#9'c #9C7E40",'#10'"W '#9'c #E8C57D",'#10'"X '#9'c #CFA95D"'
+','#10'"Y '#9'c #50401F",'#10'"Z '#9'c #080808",'#10'"` '#9'c #3B3F3A",'#10
+'" .'#9'c #5E635D",'#10'"..'#9'c #3F3F3F",'#10'"+.'#9'c #262D25",'#10'"@.'#9
+'c #6B8767",'#10'"#.'#9'c #73976F",'#10'"$.'#9'c #93B290",'#10'"%.'#9'c #6A7'
+'968",'#10'"&.'#9'c #896F3B",'#10'"*.'#9'c #D4B575",'#10'"=.'#9'c #CEAD6A",'
+#10'"-.'#9'c #9D8456",'#10'";.'#9'c #090906",'#10'">.'#9'c #5C685B",'#10'",.'
+#9'c #ADC3AA",'#10'"''.'#9'c #BED0BC",'#10'").'#9'c #5850F6",'#10'"!.'#9'c #'
+'150BDA",'#10'"~.'#9'c #272F26",'#10'"{.'#9'c #688465",'#10'"].'#9'c #597B55'
+'",'#10'"^.'#9'c #63885F",'#10'"/.'#9'c #71986E",'#10'"(.'#9'c #3C4C3B",'#10
+'"_.'#9'c #9D8045",'#10'":.'#9'c #D8B46D",'#10'"<.'#9'c #CBA561",'#10'"[.'#9
+'c #403624",'#10'"}.'#9'c #282D27",'#10'"|.'#9'c #99AD97",'#10'"1.'#9'c #AEC'
+'4AB",'#10'"2.'#9'c #BCCFB9",'#10'"3.'#9'c #101410",'#10'"4.'#9'c #192118",'
+#10'"5.'#9'c #5A7657",'#10'"6.'#9'c #597A55",'#10'"7.'#9'c #5C7F58",'#10'"8.'
+#9'c #5E815A",'#10'"9.'#9'c #2E3E2D",'#10'"0.'#9'c #BD9A52",'#10'"a.'#9'c #D'
+'8B56C",'#10'"b.'#9'c #B9954F",'#10'"c.'#9'c #252015",'#10'"d.'#9'c #3D4C3C"'
+','#10'"e.'#9'c #759272",'#10'"f.'#9'c #789574",'#10'"g.'#9'c #7C9879",'#10
+'"h.'#9'c #4C50CB",'#10'"i.'#9'c #95AA92",'#10'"j.'#9'c #738871",'#10'"k.'#9
+'c #192218",'#10'"l.'#9'c #0D120D",'#10'"m.'#9'c #698966",'#10'"n.'#9'c #658'
+'961",'#10'"o.'#9'c #2D3E2C",'#10'"p.'#9'c #B09252",'#10'"q.'#9'c #CEA85A",'
+#10'"r.'#9'c #795F2C",'#10'"s.'#9'c #0A0B07",'#10'"t.'#9'c #4F6A4C",'#10'"u.'
+#9'c #3139BC",'#10'"v.'#9'c #557552",'#10'"w.'#9'c #5D7E59",'#10'"x.'#9'c #5'
+'77854",'#10'"y.'#9'c #273626",'#10'"z.'#9'c #564A2F",'#10'"A.'#9'c #574829"'
+','#10'"B.'#9'c #1A241A",'#10'"C.'#9'c #547351",'#10'"D.'#9'c #4D6A4A",'#10
+'"E.'#9'c #1B251A",'#10'"F.'#9'c #161D15",'#10'"G.'#9'c #212D20",'#10'"H.'#9
+'c #476245",'#10'"I.'#9'c #2B32B7",'#10'"J.'#9'c #486445",'#10'"K.'#9'c #517'
+'04E",'#10'"L.'#9'c #526850",'#10'"M.'#9'c #536850",'#10'"N.'#9'c #303B29",'
+#10'"O.'#9'c #253324",'#10'"P.'#9'c #425B40",'#10'"Q.'#9'c #4C6849",'#10'"R.'
+#9'c #5A6E58",'#10'"S.'#9'c #50664E",'#10'"T.'#9'c #52714F",'#10'"U.'#9'c #2'
+'F38AE",'#10'"V.'#9'c #40593E",'#10'"W.'#9'c #9B9C9B",'#10'"X.'#9'c #5A5A5A"'
+','#10'"Y.'#9'c #C4A767",'#10'"Z.'#9'c #E2C280",'#10'"`.'#9'c #735A29",'#10
+'" +'#9'c #040504",'#10'".+'#9'c #4C504B",'#10'"++'#9'c #D1D1D1",'#10'"@+'#9
+'c #727272",'#10'"#+'#9'c #384E36",'#10'"$+'#9'c #547551",'#10'"%+'#9'c #384'
+'936",'#10'"&+'#9'c #313231",'#10'"*+'#9'c #E1C07D",'#10'"=+'#9'c #EBC880",'
+#10'"-+'#9'c #80642E",'#10'";+'#9'c #040404",'#10'">+'#9'c #4D4D4D",'#10'",+'
+#9'c #525552",'#10'"''+'#9'c #293528",'#10'")+'#9'c #415A3F",'#10'"!+'#9'c #'
+'567653",'#10'"~+'#9'c #253323",'#10'"{+'#9'c #D2B06B",'#10'"]+'#9'c #D4AB58'
+'",'#10'"^+'#9'c #6B5326",'#10'"/+'#9'c #030403",'#10'"(+'#9'c #354934",'#10
,'"_+'#9'c #486446",'#10'":+'#9'c #4A6748",'#10'"<+'#9'c #455F42",'#10'"[+'#9
+'c #4C4020",'#10'"}+'#9'c #4A3B1D",'#10'"|+'#9'c #1A1409",'#10'"1+'#9'c #040'
+'604",'#10'"2+'#9'c #445D41",'#10'"3+'#9'c #4F6C4C",'#10'"4+'#9'c #354A33",'
+#10'"5+'#9'c #131B13",'#10'"6+'#9'c #111811",'#10'"7+'#9'c #2B3C2A",'#10'"8+'
+#9'c #486345",'#10'" . + @ # $ % & ",'#10'" '
+' * = - ; > , '' ) * ! ",'#10'" ~ { ] ^ / ( '
+'_ : < [ & ! ",'#10'" } | 1 2 3 4 5 6 7 8 9 0 a ! ! ! ! !'
+' ",'#10'" b c d e & f g h i j & ",'#10'" k '
+'l m n a o p q r s & ",'#10'" t u v w x y z A B C'
+' & ! ! ! ! ! ",'#10'" D E F G H & I J K L & x ! ",'#10
+'" a x x s M N O P & ! ",'#10'" Q R S T U '
+'V W X Y Z ` ... ! ! ",'#10'" +.@.#.$.%.&.*.=.-.;.>.,.''.).!. '
+' ",'#10'" ~.{.].^./.(._.:.<.[.}.|.1.2.! ! ! ! ! ",'#10'" 3.4.5'
+'.6.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j.k.l. ",'#10'" m.n.n.n.n.n.n.o.p.q.r.s.t.'
+'n.n.n.u.n.n.n.v. ",'#10'" w.x.x.x.x.x.x.y.z.A.F B.C.x.x.x.! ! ! ! ! ",'
+#10'" w.x.x.x.x.x.x.D.E.F.G.H.x.x.x.x.I.x.x.x.J. ",'#10'" w.x.x.x.x.K.L.M'
+'.N.O.O.P.Q.R.S.T.U.x.x.x.J. ",'#10'" w.x.x.x.x.V.W.X.Y.Z.`. +.+++@+#+x.x.'
+'x.x.J. ",'#10'" w.x.x.x.x.$+%+&+*+=+-+;+>+,+''+)+! ! ! ! ! ",'#10'"& w.'
+'x.x.x.x.x.!+~+{+]+^+/+(+_+:+T.x.x.! x.J.& ",'#10'"& w.x.x.x.x.x.x.<+[+}+|+1'
+'+2+x.x.x.x.x.! x.J.& ",'#10'"& 3+J.J.J.J.J.J.J.4+5+6+7+8+J.J.J.! ! ! ! ! '
+'",'#10'" & & & & & & & & & & H H ;+a & & & & & & "};'#10
]);
LazarusResources.Add('tidedialoglayoutstorage','XPM',[
'/* XPM */'#10'static char *txmlstorage[]={'#10'"24 24 8 1",'#10'". c None",'
+#10'"d c #000000",'#10'"b c #000080",'#10'"f c #00ff00",'#10'"e c #00ffff",'

View File

@ -26,32 +26,63 @@ uses
LCLStrConsts, HelpIntfs, LazHelpIntf;
type
{ THTMLHelpDatabase }
{ THTMLHelpDatabase
KeywordPrefix: if set, then the database will handle all Keywords
beginning with this value. And when the path is created by replacing
the prefix with the BaseURL.
For example:
Put a THTMLHelpDatabase on a form.
Set AutoRegister to true.
Set KeywordPrefix to 'MyHelp/'
Set BaseURL to 'file://'
Put a THTMLBrowserHelpViewer on the form.
Set AutoRegister to true.
Set BrowserPath to '/usr/bin/mozilla'
Put a TEdit on a form.
Set HelpType to htKeyword
Set HelpKeyword to 'MyHelp/page.html'
Run the program.
Focus the edit field and press F1. The page 'page.html' will be shown.
}
THTMLHelpDatabase = class(THelpDatabase)
private
FBaseURL: string;
FDefaultBaseURL: string;
FKeywordPrefix: string;
FKeywordPrefixNode: THelpNode;
function IsBaseURLStored: boolean;
procedure SetBaseURL(const AValue: string);
procedure SetDefaultBaseURL(const AValue: string);
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function ShowURL(const URL, Title: string;
var ErrMsg: string): TShowHelpResult; virtual;
function ShowHelp(Query: THelpQuery; BaseNode, NewNode: THelpNode;
QueryItem: THelpQueryItem;
var ErrMsg: string): TShowHelpResult; override;
function GetNodesForKeyword(const HelpKeyword: string;
var ListOfNodes: THelpNodeQueryList;
var ErrMsg: string): TShowHelpResult; override;
function GetEffectiveBaseURL: string;
procedure Load(Storage: TConfigStorage); override;
procedure Save(Storage: TConfigStorage); override;
property DefaultBaseURL: string read FDefaultBaseURL write SetDefaultBaseURL;// used, if BaseURL is empty
published
property BaseURL: string read FBaseURL write SetBaseURL stored IsBaseURLStored;
property AutoRegister;
property KeywordPrefix: string read FKeywordPrefix write FKeywordPrefix;// see above
end;
{ THTMLBrowserHelpViewer }
{ THTMLBrowserHelpViewer
If no browser is specified it searches for a common browser. }
TOnFindDefaultBrowser = procedure(var DefaultBrowser, Params: string) of object;
@ -77,6 +108,7 @@ type
published
property BrowserPath: string read FBrowserPath write SetBrowserPath;
property BrowserParams: string read FBrowserParams write SetBrowserParams;
property AutoRegister;
end;
@ -120,6 +152,12 @@ begin
AddSupportedMimeType('text/html');
end;
destructor THTMLHelpDatabase.Destroy;
begin
FreeAndNil(FKeywordPrefixNode);
inherited Destroy;
end;
function THTMLHelpDatabase.ShowURL(const URL, Title: string; var ErrMsg: string
): TShowHelpResult;
var
@ -151,6 +189,9 @@ begin
URLType:=BaseURLType;
end;
end;
if (URLType='file') and (not FilenameIsUnixAbsolute(URLPath)) then
URLPath:=TrimFilename(GetCurrentDir+PathDelim+URLPath);
if (URLType='file') and (not FileExists(URLPath)) then begin
Result:=shrContextNotFound;
ErrMsg:=Format(hhsHelpTheHelpDatabaseWasUnableToFindFile, ['"', ID,
@ -181,7 +222,28 @@ begin
Result:=ShowURL(NewNode.URL,NewNode.Title,ErrMsg);
end else begin
Result:=shrContextNotFound;
ErrMsg:='THTMLHelpDatabase.ShowHelp Node.URLValid=false';
ErrMsg:='THTMLHelpDatabase.ShowHelp Node.URLValid=false Node.URL="'+NewNode.URL+'"';
end;
end;
function THTMLHelpDatabase.GetNodesForKeyword(const HelpKeyword: string;
var ListOfNodes: THelpNodeQueryList; var ErrMsg: string): TShowHelpResult;
var
Path: String;
begin
Result:=inherited GetNodesForKeyword(HelpKeyword, ListOfNodes, ErrMsg);
if Result<>shrSuccess then exit;
if not (csDesigning in ComponentState)
and (KeywordPrefix<>'')
and (LeftStr(HelpKeyword,length(KeywordPrefix))=KeywordPrefix) then begin
// HelpKeyword starts with KeywordPrefix -> add default node
if FKeywordPrefixNode=nil then
FKeywordPrefixNode:=THelpNode.CreateURL(Self,'','');
Path:=copy(HelpKeyword,length(KeywordPrefix)+1,length(HelpKeyword));
FKeywordPrefixNode.Title:='Show page '+Path;
FKeywordPrefixNode.URL:='file://'+Path;
CreateNodeQueryListAndAdd(FKeywordPrefixNode,nil,ListOfNodes,true);
end;
end;
@ -266,8 +328,12 @@ begin
if CommandLine='' then
FindDefaultBrowser(CommandLine, Params);
if CommandLine='' then begin
ErrMsg:=Format(hhsHelpNoHTMLBrowserFoundPleaseDefineOneInHelpConfigureHe, [
#13]);
if (HelpDatabases<>nil)
and (CompareText(HelpDatabases.ClassName,'TIDEHelpDatabases')=0) then
ErrMsg:=Format(hhsHelpNoHTMLBrowserFoundPleaseDefineOneInHelpConfigureHe,
[ #13])
else
ErrMsg:=hhsHelpNoHTMLBrowserFound;
exit;
end;
if (not FileExists(CommandLine)) then begin
@ -313,14 +379,46 @@ begin
end;
end;
procedure THTMLBrowserHelpViewer.FindDefaultBrowser(var Browser, Params: string);
procedure THTMLBrowserHelpViewer.FindDefaultBrowser(var Browser,
Params: string);
function Find(const ShortFilename: string): boolean;
var
Ext: String;
Filename: String;
begin
{$IFDEF MSWindows}
Ext:='.exe';
{$ELSE}
Ext:='';
{$ENDIF}
Filename:=SearchFileInPath(ShortFilename+Ext,'',
SysUtils.GetEnvironmentVariable('PATH'),PathSeparator,[]);
Result:=Filename<>'';
if Result then begin
FDefaultBrowser:=Filename;
FDefaultBrowserParams:='%s';
end;
end;
begin
if FDefaultBrowser='' then begin
if Assigned(OnFindDefaultBrowser) then
OnFindDefaultBrowser(FDefaultBrowser, FDefaultBrowserParams);
end;
if FDefaultBrowser='' then begin
// prefer open source ;)
if Find('mozilla')
or Find('galeon')
or Find('konqueror')
or Find('safari')
or Find('netscape')
or Find('opera')
or Find('iexplorer') then ;
end;
Browser:=FDefaultBrowser;
Params:=FDefaultBrowserParams;
DebugLn('THTMLBrowserHelpViewer.FindDefaultBrowser Browser=',Browser,' Params=',Params);
end;
procedure THTMLBrowserHelpViewer.Assign(Source: TPersistent);

View File

@ -286,13 +286,15 @@ type
THelpDatabase = class(TComponent)
private
FAutoRegister: boolean;
FBasePathObject: TObject;
FID: THelpDatabaseID;
FDatabases: THelpDatabases;
FRefCount: integer;
FSearchItems: TList;
FSearchItems: TFPList;
FSupportedMimeTypes: TStrings;
FTOCNode: THelpNode;
procedure SetAutoRegister(const AValue: boolean);
procedure SetID(const AValue: THelpDatabaseID);
procedure SetDatabases(const AValue: THelpDatabases);
protected
@ -350,6 +352,7 @@ type
property SupportedMimeTypes: TStrings read FSupportedMimeTypes;
property BasePathObject: TObject read FBasePathObject write FBasePathObject;
property TOCNode: THelpNode read FTOCNode write FTOCNode;
property AutoRegister: boolean read FAutoRegister write SetAutoRegister;
end;
THelpDatabaseClass = class of THelpDatabase;
@ -360,8 +363,8 @@ type
THelpDatabases = class(THelpManager)
private
FItems: TList;
FHelpDBClasses: TList;
FItems: TFPList;
FHelpDBClasses: TFPList;
function GetItems(Index: integer): THelpDatabase;
procedure DoRegisterDatabase(ADatabase: THelpDatabase);
procedure DoUnregisterDatabase(ADatabase: THelpDatabase);
@ -445,9 +448,11 @@ type
THelpViewer = class(TComponent)
private
FAutoRegister: boolean;
FParameterHelp: string;
FStorageName: string;
FSupportedMimeTypes: TStrings;
procedure SetAutoRegister(const AValue: boolean);
protected
procedure SetSupportedMimeTypes(List: TStrings); virtual;
procedure AddSupportedMimeType(const AMimeType: string); virtual;
@ -463,10 +468,13 @@ type
procedure Load(Storage: TConfigStorage); virtual;
procedure Save(Storage: TConfigStorage); virtual;
function GetLocalizedName: string; virtual;
procedure RegisterSelf; virtual;
procedure UnregisterSelf; virtual;
public
property SupportedMimeTypes: TStrings read FSupportedMimeTypes;
property ParameterHelp: string read FParameterHelp write FParameterHelp;
property StorageName: string read FStorageName write FStorageName;
property AutoRegister: boolean read FAutoRegister write SetAutoRegister;
end;
THelpViewerClass = class of THelpViewer;
@ -476,7 +484,7 @@ type
THelpViewers = class
private
FItems: TList;
FItems: TFPList;
function GetItems(Index: integer): THelpViewer;
public
constructor Create;
@ -488,6 +496,7 @@ type
procedure UnregisterViewer(AHelpViewer: THelpViewer);
procedure Load(Storage: TConfigStorage); virtual;
procedure Save(Storage: TConfigStorage); virtual;
function IndexOf(AHelpViewer: THelpViewer): integer;
public
property Items[Index: integer]: THelpViewer read GetItems; default;
end;
@ -527,6 +536,7 @@ var
procedure CreateLCLHelpSystem;
procedure FreeLCLHelpSystem;
procedure FreeUnusedLCLHelpSystem;
// URL functions
function FilenameToURL(const Filename: string): string;
@ -566,6 +576,13 @@ begin
HelpManager:=nil;
end;
procedure FreeUnusedLCLHelpSystem;
begin
if (HelpViewers<>nil) and (HelpViewers.Count>0) then exit;
if (HelpDatabases<>nil) and (HelpDatabases.Count>0) then exit;
FreeLCLHelpSystem;
end;
function FilenameToURL(const Filename: string): string;
var
i: Integer;
@ -730,6 +747,21 @@ begin
if OldRegistered then RegisterSelf;
end;
procedure THelpDatabase.SetAutoRegister(const AValue: boolean);
begin
if FAutoRegister=AValue then exit;
FAutoRegister:=AValue;
if not (csDesigning in ComponentState) then begin
if FAutoRegister then begin
if FID='' then
FID:=Name;
if Databases=nil then RegisterSelf;
end else begin
if Databases<>nil then UnregisterSelf;
end;
end;
end;
procedure THelpDatabase.SetDatabases(const AValue: THelpDatabases);
begin
if AValue=Databases then exit;
@ -777,6 +809,7 @@ procedure THelpDatabase.RegisterSelf;
begin
if Databases<>nil then
raise EHelpSystemException.Create(Format(rsHelpAlreadyRegistered, [ID]));
if HelpDatabases=nil then CreateLCLHelpSystem;
Databases:=HelpDatabases;
end;
@ -785,6 +818,7 @@ begin
if Databases=nil then
raise EHelpSystemException.Create(Format(rsHelpNotRegistered, [ID]));
Databases:=nil;
FreeUnusedLCLHelpSystem;
end;
function THelpDatabase.Registered: boolean;
@ -861,6 +895,7 @@ var
begin
Result:=shrSuccess;
ErrMsg:='';
if csDesigning in ComponentState then exit;
// add the registered nodes
if FSearchItems<>nil then begin
for i:=0 to FSearchItems.Count-1 do begin
@ -882,6 +917,7 @@ var
begin
Result:=shrSuccess;
ErrMsg:='';
if csDesigning in ComponentState then exit;
// add the registered nodes
if FSearchItems<>nil then begin
for i:=0 to FSearchItems.Count-1 do begin
@ -908,6 +944,7 @@ var
begin
Result:=shrSuccess;
ErrMsg:='';
if csDesigning in ComponentState then exit;
if (ListOfPascalHelpContextList=nil)
or (ListOfPascalHelpContextList.Count=0) then exit;
// add the registered nodes
@ -946,6 +983,7 @@ var
begin
Result:=shrSuccess;
ErrMsg:='';
if csDesigning in ComponentState then exit;
// add the registered nodes
if FSearchItems<>nil then begin
for i:=0 to FSearchItems.Count-1 do begin
@ -968,6 +1006,7 @@ var
begin
Result:=shrSuccess;
ErrMsg:='';
if csDesigning in ComponentState then exit;
// add the registered nodes
if FSearchItems<>nil then begin
for i:=0 to FSearchItems.Count-1 do begin
@ -1005,7 +1044,7 @@ procedure THelpDatabase.RegisterItem(NewItem: THelpDBItem);
begin
if NewItem=nil then
raise EHelpSystemException.Create('THelpDatabase.RegisterItem NewItem=nil');
if FSearchItems=nil then FSearchItems:=TList.Create;
if FSearchItems=nil then FSearchItems:=TFPList.Create;
if FSearchItems.IndexOf(NewItem)<0 then
FSearchItems.Add(NewItem)
else
@ -1082,7 +1121,7 @@ end;
procedure THelpDatabases.DoRegisterDatabase(ADatabase: THelpDatabase);
begin
ADatabase.Reference;
if FItems=nil then FItems:=TList.Create;
if FItems=nil then FItems:=TFPList.Create;
FItems.Add(ADatabase);
end;
@ -1614,7 +1653,7 @@ end;
procedure THelpDatabases.RegisterHelpDatabaseClass(NewHelpDB: THelpDatabaseClass
);
begin
if FHelpDBClasses=nil then FHelpDBClasses:=TList.Create;
if FHelpDBClasses=nil then FHelpDBClasses:=TFPList.Create;
if FHelpDBClasses.IndexOf(NewHelpDB)<0 then
FHelpDBClasses.Add(NewHelpDB);
end;
@ -1687,7 +1726,7 @@ end;
constructor THelpViewers.Create;
begin
FItems:=TList.Create;
FItems:=TFPList.Create;
end;
destructor THelpViewers.Destroy;
@ -1780,8 +1819,26 @@ begin
end;
end;
function THelpViewers.IndexOf(AHelpViewer: THelpViewer): integer;
begin
Result:=FItems.IndexOf(AHelpViewer);
end;
{ THelpViewer }
procedure THelpViewer.SetAutoRegister(const AValue: boolean);
begin
if FAutoRegister=AValue then exit;
FAutoRegister:=AValue;
if not (csDesigning in ComponentState) then begin
if FAutoRegister then begin
RegisterSelf;
end else begin
UnregisterSelf;
end;
end;
end;
procedure THelpViewer.SetSupportedMimeTypes(List: TStrings);
begin
if FSupportedMimeTypes<>nil then FSupportedMimeTypes.Free;
@ -1802,7 +1859,8 @@ end;
destructor THelpViewer.Destroy;
begin
FSupportedMimeTypes.Free;
UnregisterSelf;
FreeAndNil(FSupportedMimeTypes);
inherited Destroy;
end;
@ -1859,6 +1917,21 @@ begin
Result:=StorageName;
end;
procedure THelpViewer.RegisterSelf;
begin
if (HelpViewers<>nil) and (HelpViewers.IndexOf(Self)>=0) then
raise EHelpSystemException.Create('help viewer is already registered');
CreateLCLHelpSystem;
HelpViewers.RegisterViewer(Self);
end;
procedure THelpViewer.UnregisterSelf;
begin
if (HelpViewers=nil) or (HelpViewers.IndexOf(Self)<0) then exit;
HelpViewers.UnregisterViewer(Self);
FreeUnusedLCLHelpSystem;
end;
{ THelpNode }
constructor THelpNode.Create(TheOwner: THelpDatabase; Node: THelpNode);

View File

@ -280,6 +280,7 @@ ResourceString
+'BrowserParams will be replaced by the URL.';
hhsHelpNoHTMLBrowserFoundPleaseDefineOneInHelpConfigureHe = 'No HTML '
+'Browser found.%sPlease define one in Help -> Configure Help -> Viewers';
hhsHelpNoHTMLBrowserFound = 'Unable to find a HTML browser.';
hhsHelpBrowserNotFound = 'Browser %s%s%s not found.';
hhsHelpBrowserNotExecutable = 'Browser %s%s%s not executable.';
hhsHelpErrorWhileExecuting = 'Error while executing %s%s%s:%s%s';