diff --git a/ide/idehelpmanager.pas b/ide/idehelpmanager.pas index 12695f5845..d8fe01694f 100644 --- a/ide/idehelpmanager.pas +++ b/ide/idehelpmanager.pas @@ -1224,9 +1224,14 @@ function TIDEHelpManager.ShowHelpForSourcePosition(const Filename: string; if p<1 then exit; GetIdentStartEndAtPosition(CodeBuffer.Source,p,IdentStart,IdentEnd); if IdentEnd<=IdentStart then exit; + if (IdentStart > 1) and (CodeBuffer.Source[IdentStart - 1] = '$') then + Dec(IdentStart); KeyWord:=copy(CodeBuffer.Source,IdentStart,IdentEnd-IdentStart); ErrorMsg:=''; - Result:=ShowHelpForKeyword('',FPCKeyWordHelpPrefix+Keyword,ErrorMsg); + if KeyWord[1] = '$' then + Result:=ShowHelpForDirective('',FPCDirectiveHelpPrefix+Keyword,ErrorMsg) + else + Result:=ShowHelpForKeyword('',FPCKeyWordHelpPrefix+Keyword,ErrorMsg); if Result=shrHelpNotFound then exit; HelpManager.ShowError(Result,ErrorMsg); end; diff --git a/ideintf/idehelpintf.pas b/ideintf/idehelpintf.pas index 01c6afff59..75505ecfed 100644 --- a/ideintf/idehelpintf.pas +++ b/ideintf/idehelpintf.pas @@ -141,6 +141,7 @@ var var FPCKeyWordHelpPrefix: string = 'FPCKeyword_'; + FPCDirectiveHelpPrefix: string = 'FPCDirective_'; implementation diff --git a/lcl/helpintfs.pas b/lcl/helpintfs.pas index 668b1f9463..dc6853ebd5 100644 --- a/lcl/helpintfs.pas +++ b/lcl/helpintfs.pas @@ -101,6 +101,18 @@ type end; + { THelpQueryDirective } + + THelpQueryDirective = class(THelpQuery) + private + FDirective: string; + public + constructor Create(const TheHelpDatabaseID: THelpDatabaseID; + const TheDirective: string); + property Directive: string read FDirective write FDirective; + end; + + { THelpQuerySourcePosition } THelpQuerySourcePosition = class(THelpQuery) @@ -202,6 +214,8 @@ type var ErrMsg: string): TShowHelpResult; virtual; function ShowHelpForKeyword(Query: THelpQueryKeyword; var ErrMsg: string): TShowHelpResult; virtual; + function ShowHelpForDirective(Query: THelpQueryDirective; + var ErrMsg: string): TShowHelpResult; virtual; function ShowHelpForPascalContexts(Query: THelpQueryPascalContexts; var ErrMsg: string): TShowHelpResult; virtual; function ShowHelpForSourcePosition(Query: THelpQuerySourcePosition; @@ -249,6 +263,12 @@ function ShowHelpForKeyword(HelpDatabaseID: THelpDatabaseID; function ShowHelpForKeyword(const HelpKeyword: string; var ErrMsg: string ): TShowHelpResult; overload; +// help by compiler directive +function ShowHelpForDirective(HelpDatabaseID: THelpDatabaseID; + const HelpDirective: string; var ErrMsg: string): TShowHelpResult; overload; +function ShowHelpForDirective(const HelpDirective: string; var ErrMsg: string + ): TShowHelpResult; overload; + // help for pascal sources function ShowHelpForPascalContexts(const Filename: string; const SourcePosition: TPoint; ListOfPascalHelpContextList: TList; @@ -339,6 +359,20 @@ begin Result:=ShowHelpForKeyword('',HelpKeyword,ErrMsg); end; +function ShowHelpForDirective(HelpDatabaseID: THelpDatabaseID; + const HelpDirective: string; var ErrMsg: string): TShowHelpResult; +begin + Result:=HelpManager.ShowHelpForQuery( + THelpQueryDirective.Create(HelpDatabaseID,HelpDirective), + true,ErrMsg); +end; + +function ShowHelpForDirective(const HelpDirective: string; + var ErrMsg: string): TShowHelpResult; +begin + Result:=ShowHelpForDirective('',HelpDirective,ErrMsg); +end; + function ShowHelpForPascalContexts(const Filename: string; const SourcePosition: TPoint; ListOfPascalHelpContextList: TList; var ErrMsg: string): TShowHelpResult; @@ -430,6 +464,15 @@ begin Result:=ResultNames[HelpResult]; end; +{ THelpQueryDirective } + +constructor THelpQueryDirective.Create( + const TheHelpDatabaseID: THelpDatabaseID; const TheDirective: string); +begin + inherited Create(TheHelpDatabaseID); + FDirective := TheDirective; +end; + { THelpQuery } constructor THelpQuery.Create(const TheHelpDatabaseID: THelpDatabaseID); @@ -532,6 +575,12 @@ begin Result:=DoHelpNotFound(ErrMsg); end; +function THelpManager.ShowHelpForDirective(Query: THelpQueryDirective; + var ErrMsg: string): TShowHelpResult; +begin + Result:=DoHelpNotFound(ErrMsg); +end; + function THelpManager.ShowHelpForPascalContexts( Query: THelpQueryPascalContexts; var ErrMsg: string): TShowHelpResult; begin diff --git a/lcl/languages/lclstrconsts.ca.po b/lcl/languages/lclstrconsts.ca.po index 4c349aeace..afdd64260f 100644 --- a/lcl/languages/lclstrconsts.ca.po +++ b/lcl/languages/lclstrconsts.ca.po @@ -678,6 +678,14 @@ msgstr "La base de dades de l'ajuda %s%s%s no ha trobat un visor per una pàgina msgid "Help Database %s%s%s not found" msgstr "Base de dades de l'ajuda %s%s%s no trobada" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Paraula clau d'ajuda %s%s%s no trobada" diff --git a/lcl/languages/lclstrconsts.cs.po b/lcl/languages/lclstrconsts.cs.po index e891dee799..dd1ba9d466 100644 --- a/lcl/languages/lclstrconsts.cs.po +++ b/lcl/languages/lclstrconsts.cs.po @@ -676,6 +676,14 @@ msgstr "Databáze nápovědy %s%s%s nenalezla prohlížeč pro stránku nápově msgid "Help Database %s%s%s not found" msgstr "Databáze nápovědy %s%s%s nenalezena" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Klíčové slovo %s%s%s nenalezeno." diff --git a/lcl/languages/lclstrconsts.de.po b/lcl/languages/lclstrconsts.de.po index 4000532821..d1f8522224 100644 --- a/lcl/languages/lclstrconsts.de.po +++ b/lcl/languages/lclstrconsts.de.po @@ -681,6 +681,14 @@ msgstr "Die Hilfedatenbank %s%s%s fand keinen Betrachter für eine Hilfeseite de msgid "Help Database %s%s%s not found" msgstr "Hilfedatenbank %s%s%s nicht gefunden" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Hilfeschlüsselwort %s%s%s nciht gefunden." diff --git a/lcl/languages/lclstrconsts.es.po b/lcl/languages/lclstrconsts.es.po index 5c1e079e45..444cf7b402 100644 --- a/lcl/languages/lclstrconsts.es.po +++ b/lcl/languages/lclstrconsts.es.po @@ -676,6 +676,14 @@ msgstr "La base de datos de ayuda %s%s%s no encontró un visor para el tipo de p msgid "Help Database %s%s%s not found" msgstr "Base de datos de ayuda %s%s%s no encotrada" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Clave de ayuda %s%s%s no encontrada" diff --git a/lcl/languages/lclstrconsts.fi.po b/lcl/languages/lclstrconsts.fi.po index 061e139a80..456af01540 100644 --- a/lcl/languages/lclstrconsts.fi.po +++ b/lcl/languages/lclstrconsts.fi.po @@ -665,6 +665,14 @@ msgstr "" msgid "Help Database %s%s%s not found" msgstr "" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "" diff --git a/lcl/languages/lclstrconsts.fr.po b/lcl/languages/lclstrconsts.fr.po index 163c14746b..b136d2eefc 100644 --- a/lcl/languages/lclstrconsts.fr.po +++ b/lcl/languages/lclstrconsts.fr.po @@ -680,6 +680,14 @@ msgstr "La base de données d'aide %s%s%s n'a pas trouvé une visionneuse pour u msgid "Help Database %s%s%s not found" msgstr "Base de données d'aide %s%s%s non trouvée" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Mot-clé d'aide %s%s%s non trouvé." diff --git a/lcl/languages/lclstrconsts.he.po b/lcl/languages/lclstrconsts.he.po index 95fa0309e6..c8283f2e8c 100644 --- a/lcl/languages/lclstrconsts.he.po +++ b/lcl/languages/lclstrconsts.he.po @@ -674,6 +674,14 @@ msgstr "בסיס הנתונים של העזרה %s%s%s לא מצא תוכנה msgid "Help Database %s%s%s not found" msgstr "בסיס הנתונים של העזרה %s%s%s לא נמצא " +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "מלת מפתח לעזרה %s%s%s לא נמצאה. " diff --git a/lcl/languages/lclstrconsts.id.po b/lcl/languages/lclstrconsts.id.po index c0427e79f8..e3fad9732c 100644 --- a/lcl/languages/lclstrconsts.id.po +++ b/lcl/languages/lclstrconsts.id.po @@ -679,6 +679,14 @@ msgstr "Database Bantuan %s%s%s tidak ditemukan peninjau untuk halaman bantuan d msgid "Help Database %s%s%s not found" msgstr "Database Bantuan %s%s%s tidak ditemukan" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Kata kunci Bantuan %s%s%s tidak ditemukan." diff --git a/lcl/languages/lclstrconsts.it.po b/lcl/languages/lclstrconsts.it.po index 36798003b2..8b88f0aa4d 100644 --- a/lcl/languages/lclstrconsts.it.po +++ b/lcl/languages/lclstrconsts.it.po @@ -681,6 +681,14 @@ msgstr "L'archivio Help %s%s%s non trova un visualizzatore per le pagine di aiut msgid "Help Database %s%s%s not found" msgstr "Archivio Help %s%s%s non trovato" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Aiuto sulla parola chiave %s%s%s non trovato." diff --git a/lcl/languages/lclstrconsts.lt.po b/lcl/languages/lclstrconsts.lt.po index e0436bc8c3..43536733f4 100644 --- a/lcl/languages/lclstrconsts.lt.po +++ b/lcl/languages/lclstrconsts.lt.po @@ -680,6 +680,14 @@ msgstr "Žinyno duomenų bazė %s%s%s nerado žiūryklės %s tipo žinyno lapui. msgid "Help Database %s%s%s not found" msgstr "Žinyno duomenų bazė %s%s%s nerasta." +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Žinyno raktažodis %s%s%s nerastas." diff --git a/lcl/languages/lclstrconsts.nl.po b/lcl/languages/lclstrconsts.nl.po index ec96d337c4..ed4c93a21b 100644 --- a/lcl/languages/lclstrconsts.nl.po +++ b/lcl/languages/lclstrconsts.nl.po @@ -678,6 +678,14 @@ msgstr "Help Database %s%s%s heeft geen viewer gevonden voor help pagina van typ msgid "Help Database %s%s%s not found" msgstr "Help Database %s%s%s niet gevonden" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Help sleutelwoord %s%s%s niet gevonden." diff --git a/lcl/languages/lclstrconsts.no.po b/lcl/languages/lclstrconsts.no.po index e38f07df68..83cf8f1495 100644 --- a/lcl/languages/lclstrconsts.no.po +++ b/lcl/languages/lclstrconsts.no.po @@ -680,6 +680,14 @@ msgstr "Hjelp-database %s%s%s fant ingen viser for en hjelpeside av type %s" msgid "Help Database %s%s%s not found" msgstr "Hjelp-database %s%s%s ikke funnet" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Hjelp-nøkkelord %s%s%s ikke funnet." diff --git a/lcl/languages/lclstrconsts.pl.po b/lcl/languages/lclstrconsts.pl.po index 26838ea933..8e97c04546 100644 --- a/lcl/languages/lclstrconsts.pl.po +++ b/lcl/languages/lclstrconsts.pl.po @@ -678,6 +678,14 @@ msgstr "" msgid "Help Database %s%s%s not found" msgstr "" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "" diff --git a/lcl/languages/lclstrconsts.po b/lcl/languages/lclstrconsts.po index 74415a8100..575709a708 100644 --- a/lcl/languages/lclstrconsts.po +++ b/lcl/languages/lclstrconsts.po @@ -665,6 +665,14 @@ msgstr "" msgid "Help Database %s%s%s not found" msgstr "" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "" diff --git a/lcl/languages/lclstrconsts.pt.po b/lcl/languages/lclstrconsts.pt.po index ece9c62e56..f94fcb500f 100644 --- a/lcl/languages/lclstrconsts.pt.po +++ b/lcl/languages/lclstrconsts.pt.po @@ -677,6 +677,14 @@ msgstr "Banco de dados Ajuda %s%s%s não encontra visualizador para página de a msgid "Help Database %s%s%s not found" msgstr "Banco de dados de ajuda %s%s%s não encontrado" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Palavra-chave Ajuda %s%s%s não encontrada." diff --git a/lcl/languages/lclstrconsts.pt_BR.po b/lcl/languages/lclstrconsts.pt_BR.po index 10d705de15..c88ed73a61 100644 --- a/lcl/languages/lclstrconsts.pt_BR.po +++ b/lcl/languages/lclstrconsts.pt_BR.po @@ -674,6 +674,14 @@ msgstr "Banco de dados Ajuda %s%s%s não encontra visualizador para página de a msgid "Help Database %s%s%s not found" msgstr "Banco de dados de ajuda %s%s%s não encontrado" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Palavra-chave Ajuda %s%s%s não encontrada." diff --git a/lcl/languages/lclstrconsts.ru.po b/lcl/languages/lclstrconsts.ru.po index 32272452cc..d7a9f19105 100644 --- a/lcl/languages/lclstrconsts.ru.po +++ b/lcl/languages/lclstrconsts.ru.po @@ -675,6 +675,14 @@ msgstr "База данных справки %s%s%s не нашла програ msgid "Help Database %s%s%s not found" msgstr "База данных справки %s%s%s не найдена" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Ключевое слово справки %s%s%s не найдено." diff --git a/lcl/languages/lclstrconsts.sk.po b/lcl/languages/lclstrconsts.sk.po index 821398c995..4fc0e9c2d5 100644 --- a/lcl/languages/lclstrconsts.sk.po +++ b/lcl/languages/lclstrconsts.sk.po @@ -681,6 +681,14 @@ msgstr "Databáza pomoci %s%s%s nenašla zobrazovač pre stránku pomocníka typ msgid "Help Database %s%s%s not found" msgstr "Databáza pomoci %s%s%s nenájdená" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Kľúčové slovo pomoci %s%s%s nenájdené." diff --git a/lcl/languages/lclstrconsts.tr.po b/lcl/languages/lclstrconsts.tr.po index ea78196593..9207d76720 100644 --- a/lcl/languages/lclstrconsts.tr.po +++ b/lcl/languages/lclstrconsts.tr.po @@ -678,6 +678,14 @@ msgstr "%s%s%s yardım veritabanı %s türündeki yardım sayfası için bir gö msgid "Help Database %s%s%s not found" msgstr "%s%s%s Yardım veritabanı bulunamadı" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "%s%s%s yardım anahtar sözcüğü bulunamadı." diff --git a/lcl/languages/lclstrconsts.uk.po b/lcl/languages/lclstrconsts.uk.po index 0a1ba4c62d..a05c177591 100644 --- a/lcl/languages/lclstrconsts.uk.po +++ b/lcl/languages/lclstrconsts.uk.po @@ -674,6 +674,14 @@ msgstr "База даних довідки %s%s%s не знайшла прогр msgid "Help Database %s%s%s not found" msgstr "Базу даних довідки %s%s%s не знайдено" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "Ключове слово довідки %s%s%s не знайдено." diff --git a/lcl/languages/lclstrconsts.zh_CN.po b/lcl/languages/lclstrconsts.zh_CN.po index c5416a86a1..02936b3fec 100644 --- a/lcl/languages/lclstrconsts.zh_CN.po +++ b/lcl/languages/lclstrconsts.zh_CN.po @@ -679,6 +679,14 @@ msgstr "帮助数据库 %s%s%s 未找到浏览器可以阅读帮助页 %s 的类 msgid "Help Database %s%s%s not found" msgstr "未找到帮助数据库 %s%s%s" +#: lclstrconsts.rshelphelpdirectivenotfound +msgid "Help directive %s%s%s not found." +msgstr "" + +#: lclstrconsts.rshelphelpdirectivenotfoundindatabase +msgid "Help directive %s%s%s not found in Database %s%s%s." +msgstr "" + #: lclstrconsts.rshelphelpkeywordnotfound msgid "Help keyword %s%s%s not found." msgstr "关键字 %s%s%s 未找到帮助." diff --git a/lcl/lazhelpintf.pas b/lcl/lazhelpintf.pas index 0115161adf..4ade9708eb 100644 --- a/lcl/lazhelpintf.pas +++ b/lcl/lazhelpintf.pas @@ -350,6 +350,9 @@ type function GetNodesForKeyword(const HelpKeyword: string; var ListOfNodes: THelpNodeQueryList; var ErrMsg: string): TShowHelpResult; virtual; + function GetNodesForDirective(const HelpDirective: string; + var ListOfNodes: THelpNodeQueryList; + var ErrMsg: string): TShowHelpResult; virtual; function GetNodesForContext(HelpContext: THelpContext; var ListOfNodes: THelpNodeQueryList; var ErrMsg: string): TShowHelpResult; virtual; @@ -430,6 +433,8 @@ type var ErrMsg: string): TShowHelpResult; override; function ShowHelpForKeyword(Query: THelpQueryKeyword; var ErrMsg: string): TShowHelpResult; override; + function ShowHelpForDirective(Query: THelpQueryDirective; + var ErrMsg: string): TShowHelpResult; override; function ShowHelpForPascalContexts(Query: THelpQueryPascalContexts; var ErrMsg: string): TShowHelpResult; override; function ShowHelpForSourcePosition(Query: THelpQuerySourcePosition; @@ -446,6 +451,9 @@ type function GetNodesForKeyword(const HelpKeyword: string; var ListOfNodes: THelpNodeQueryList; var ErrMsg: string): TShowHelpResult; virtual; + function GetNodesForDirective(const HelpDirective: string; + var ListOfNodes: THelpNodeQueryList; + var ErrMsg: string): TShowHelpResult; virtual; function GetNodesForContext(HelpContext: THelpContext; var ListOfNodes: THelpNodeQueryList; var ErrMsg: string): TShowHelpResult; virtual; @@ -1072,6 +1080,28 @@ begin end; end; +function THelpDatabase.GetNodesForDirective(const HelpDirective: string; + var ListOfNodes: THelpNodeQueryList; var ErrMsg: string): TShowHelpResult; +// if ListOfNodes<>nil new nodes will be appended +// if ListOfNodes=nil and nodes exists a new list will be created +var + i: Integer; + Node: THelpNode; +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 + Node:=THelpDBItem(FSearchItems[i]).Node; + if (Node=nil) or (not Node.IDValid) then continue; + if AnsiCompareText(Node.ID,HelpDirective)<>0 then continue; + CreateNodeQueryListAndAdd(Node,nil,ListOfNodes,true); + end; + end; +end; + function THelpDatabase.GetNodesForContext(HelpContext: THelpContext; var ListOfNodes: THelpNodeQueryList; var ErrMsg: string): TShowHelpResult; // if ListOfNodes<>nil new nodes will be appended @@ -1520,6 +1550,8 @@ begin Result:=ShowHelpForContext(THelpQueryContext(Query),ErrMsg) else if Query is THelpQueryKeyword then Result:=ShowHelpForKeyword(THelpQueryKeyword(Query),ErrMsg) + else if Query is THelpQueryDirective then + Result:=ShowHelpForDirective(THelpQueryDirective(Query),ErrMsg) else if Query is THelpQuerySourcePosition then Result:=ShowHelpForSourcePosition(THelpQuerySourcePosition(Query),ErrMsg) else if Query is THelpQueryMessage then @@ -1612,6 +1644,45 @@ begin end; end; +function THelpDatabases.ShowHelpForDirective(Query: THelpQueryDirective; + var ErrMsg: string): TShowHelpResult; +var + Nodes: THelpNodeQueryList; + HelpDB: THelpDatabase; +begin + ErrMsg:=''; + Result:=shrHelpNotFound; + + // search node + Nodes:=nil; + try + if Query.HelpDatabaseID<>'' then begin + HelpDB:=nil; + if not GetDatabase(Query.HelpDatabaseID,HelpDB,Result,ErrMsg) then exit; + Result:=HelpDB.GetNodesForKeyword(Query.Directive,Nodes,ErrMsg); + if Result<>shrSuccess then exit; + end else begin + Result:=GetNodesForDirective(Query.Directive,Nodes,ErrMsg); + if Result<>shrSuccess then exit; + end; + + // check if at least one node found + if (Nodes=nil) or (Nodes.Count=0) then begin + Result:=shrContextNotFound; + if Query.HelpDatabaseID<>'' then + ErrMsg:=Format(rsHelpHelpDirectiveNotFoundInDatabase, ['"',Query.Directive, + '"', '"', Query.HelpDatabaseID, '"']) + else + ErrMsg:=Format(rsHelpHelpDirectiveNotFound, ['"',Query.Directive,'"']); + exit; + end; + + Result:=ShowHelpForNodes(Query,Nodes,ErrMsg); + finally + Nodes.Free; + end; +end; + function THelpDatabases.ShowHelpForPascalContexts( Query: THelpQueryPascalContexts; var ErrMsg: string): TShowHelpResult; var @@ -1756,6 +1827,21 @@ begin end; end; +function THelpDatabases.GetNodesForDirective(const HelpDirective: string; + var ListOfNodes: THelpNodeQueryList; var ErrMsg: string): TShowHelpResult; +// if ListOfNodes<>nil then new nodes will be appended +// if ListOfNodes=nil and nodes exists a new list will be created +var + i: Integer; +begin + Result:=shrSuccess; + ErrMsg:=''; + for i:=Count-1 downto 0 do begin + Result:=Items[i].GetNodesForDirective(HelpDirective,ListOfNodes,ErrMsg); + if Result<>shrSuccess then exit; + end; +end; + function THelpDatabases.GetNodesForContext(HelpContext: THelpContext; var ListOfNodes: THelpNodeQueryList; var ErrMsg: string): TShowHelpResult; // if ListOfNodes<>nil then new nodes will be appended diff --git a/lcl/lclstrconsts.pas b/lcl/lclstrconsts.pas index 116f92bb71..1ce785a098 100644 --- a/lcl/lclstrconsts.pas +++ b/lcl/lclstrconsts.pas @@ -397,6 +397,9 @@ resourceString rsHelpHelpKeywordNotFoundInDatabase = 'Help keyword %s%s%s not found in ' +'Database %s%s%s.'; rsHelpHelpKeywordNotFound = 'Help keyword %s%s%s not found.'; + rsHelpHelpDirectiveNotFoundInDatabase = 'Help directive %s%s%s not found in ' + +'Database %s%s%s.'; + rsHelpHelpDirectiveNotFound = 'Help directive %s%s%s not found.'; rsHelpHelpContextNotFoundInDatabase = 'Help context %s not found in ' +'Database %s%s%s.'; rsHelpHelpContextNotFound = 'Help context %s not found.';