mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 01:19:37 +02:00
splitted helpintf into helpintf and idehelpintf
git-svn-id: trunk@9272 -
This commit is contained in:
parent
9c1a175b91
commit
e58dd594be
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1301,6 +1301,7 @@ ideintf/helphtml.pas svneol=native#text/pascal
|
||||
ideintf/helpintf.pas svneol=native#text/pascal
|
||||
ideintf/idecommands.pas svneol=native#text/pascal
|
||||
ideintf/idedialogs.pas svneol=native#text/plain
|
||||
ideintf/idehelpintf.pas svneol=native#text/plain
|
||||
ideintf/idemsgintf.pas svneol=native#text/plain
|
||||
ideintf/idewindowintf.pas svneol=native#text/plain
|
||||
ideintf/imagelisteditor.lfm svneol=native#text/plain
|
||||
|
@ -38,7 +38,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Dialogs, FileUtil, TextTools, MacroIntf,
|
||||
LazarusIDEStrConsts, LazConfigStorage, HelpIntf, HelpHTML;
|
||||
LazarusIDEStrConsts, LazConfigStorage, IDEHelpIntf, HelpIntf, HelpHTML;
|
||||
|
||||
const
|
||||
lihcFPCMessages = 'FreePascal Compiler messages';
|
||||
|
@ -39,7 +39,7 @@ uses
|
||||
PascalParserTool, FindDeclarationTool,
|
||||
PropEdits, ObjectInspector, FormEditingIntf, ProjectIntf,
|
||||
HelpIntf, HelpHTML, HelpFPDoc, MacroIntf, IDEWindowIntf, IDEMsgIntf,
|
||||
LazIDEIntf,
|
||||
LazIDEIntf, IDEHelpIntf,
|
||||
LazarusIDEStrConsts, TransferMacros, DialogProcs, IDEOptionDefs,
|
||||
ObjInspExt, EnvironmentOpts, AboutFrm, MsgView, Project, PackageDefs, MainBar,
|
||||
OutputFilter, HelpOptions, MainIntf, LazConf, HelpFPCMessages,
|
||||
|
@ -44,7 +44,7 @@ uses
|
||||
SynEdit,
|
||||
CodeToolManager, CodeCache,
|
||||
Laz_DOM, Laz_XMLRead, Laz_XMLWrite,
|
||||
HelpIntf,
|
||||
IDEHelpIntf, HelpIntf,
|
||||
IDEProcs, LazarusIDEStrConsts;
|
||||
|
||||
const
|
||||
|
@ -35,6 +35,7 @@ uses
|
||||
HelpIntf,
|
||||
IDECommands,
|
||||
IDEDialogs,
|
||||
IDEHelpIntf,
|
||||
IDEMsgIntf,
|
||||
IDEWindowIntf,
|
||||
ImageListEditor,
|
||||
|
@ -28,8 +28,22 @@ unit HelpIntf;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Controls, FileUtil, LazConfigStorage, MacroIntf,
|
||||
TextTools, ObjInspStrConsts;
|
||||
Classes, SysUtils, LCLProc, Controls, FileUtil, LazConfigStorage;
|
||||
|
||||
resourcestring
|
||||
rsHelpHelpNodeHasNoHelpDatabase = 'Help node %s%s%s has no Help Database';
|
||||
rsHelpHelpDatabaseDidNotFoundAViewerForAHelpPageOfType = 'Help Database %s%'
|
||||
+'s%s did not found a viewer for a help page of type %s';
|
||||
rsHelpAlreadyRegistered = '%s: Already registered';
|
||||
rsHelpNotRegistered = '%s: Not registered';
|
||||
rsHelpHelpDatabaseNotFound = 'Help Database %s%s%s not found';
|
||||
rsHelpHelpKeywordNotFoundInDatabase = 'Help keyword %s%s%s not found in '
|
||||
+'Database %s%s%s.';
|
||||
rsHelpHelpKeywordNotFound = 'Help keyword %s%s%s not found.';
|
||||
rsHelpHelpContextNotFoundInDatabase = 'Help context %s not found in '
|
||||
+'Database %s%s%s.';
|
||||
rsHelpHelpContextNotFound = 'Help context %s not found.';
|
||||
rsHelpNoHelpFoundForSource = 'No help found for line %d, column %d of %s.';
|
||||
|
||||
type
|
||||
// All help-specific error messages should be thrown as this type.
|
||||
@ -284,29 +298,6 @@ type
|
||||
end;
|
||||
|
||||
|
||||
{ THelpDBIRegExprMessage
|
||||
Help registration item for matching a message (e.g. a fpc warning) with
|
||||
a regular expression.
|
||||
For example a line like
|
||||
"/usr/share/lazarus/components/synedit/syneditkeycmds.pp(532,10) Warning: Function result does not seem to be set"
|
||||
could be matched with
|
||||
Expression=') Warning: Function result does not seem to be set'
|
||||
}
|
||||
|
||||
THelpDBIRegExprMessage = class(THelpDBIMessage)
|
||||
private
|
||||
FExpression: string;
|
||||
FModifierStr: string;
|
||||
public
|
||||
constructor Create(TheNode: THelpNode; const RegularExpression,
|
||||
TheModifierStr: string);
|
||||
function MessageMatches(const TheMessage: string; MessageParts: TStrings
|
||||
): boolean; override;
|
||||
property Expression: string read FExpression write FExpression;
|
||||
property ModifierStr: string read FModifierStr write FModifierStr;
|
||||
end;
|
||||
|
||||
|
||||
{ THelpQuery }
|
||||
|
||||
THelpQuery = class(TPersistent)
|
||||
@ -693,29 +684,9 @@ type
|
||||
property BaseURL: string read FBaseURL write SetBaseURL;
|
||||
end;
|
||||
|
||||
{ TBaseHelpManager }
|
||||
|
||||
TBaseHelpManager = class(TComponent)
|
||||
public
|
||||
procedure ConnectMainBarEvents; virtual; abstract;
|
||||
procedure LoadHelpOptions; virtual; abstract;
|
||||
procedure SaveHelpOptions; virtual; abstract;
|
||||
|
||||
function ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint;
|
||||
var ErrMsg: string): TShowHelpResult; virtual; abstract;
|
||||
procedure ShowHelpForMessage(Line: integer); virtual; abstract;
|
||||
procedure ShowHelpForObjectInspector(Sender: TObject); virtual; abstract;
|
||||
|
||||
function ConvertSourcePosToPascalHelpContext(const CaretPos: TPoint;
|
||||
const Filename: string): TPascalHelpContextList; virtual; abstract;
|
||||
end;
|
||||
|
||||
|
||||
var
|
||||
HelpDatabases: THelpDatabases; // initialized by the IDE
|
||||
HelpViewers: THelpViewers; // initialized by the IDE
|
||||
LazarusHelp: TBaseHelpManager; // initialized by the IDE
|
||||
|
||||
//==============================================================================
|
||||
{ Showing help (how it works):
|
||||
@ -1136,14 +1107,14 @@ end;
|
||||
procedure THelpDatabase.RegisterSelf;
|
||||
begin
|
||||
if Databases<>nil then
|
||||
raise EHelpSystemException.Create(Format(oisHelpAlreadyRegistered, [ID]));
|
||||
raise EHelpSystemException.Create(Format(rsHelpAlreadyRegistered, [ID]));
|
||||
Databases:=HelpDatabases;
|
||||
end;
|
||||
|
||||
procedure THelpDatabase.UnregisterSelf;
|
||||
begin
|
||||
if Databases=nil then
|
||||
raise EHelpSystemException.Create(Format(oisHelpNotRegistered, [ID]));
|
||||
raise EHelpSystemException.Create(Format(rsHelpNotRegistered, [ID]));
|
||||
Databases:=nil;
|
||||
end;
|
||||
|
||||
@ -1349,7 +1320,7 @@ begin
|
||||
Viewers:=HelpViewers.GetViewersSupportingMimeType(MimeType);
|
||||
try
|
||||
if (Viewers=nil) or (Viewers.Count=0) then begin
|
||||
ErrMsg:=Format(oisHelpHelpDatabaseDidNotFoundAViewerForAHelpPageOfType, [
|
||||
ErrMsg:=Format(rsHelpHelpDatabaseDidNotFoundAViewerForAHelpPageOfType, [
|
||||
'"', ID, '"', MimeType]);
|
||||
Result:=shrViewerNotFound;
|
||||
end else begin
|
||||
@ -1492,7 +1463,7 @@ begin
|
||||
if HelpDB=nil then begin
|
||||
Result:=false;
|
||||
HelpResult:=shrDatabaseNotFound;
|
||||
ErrMsg:=Format(oisHelpHelpDatabaseNotFound, ['"', ID, '"']);
|
||||
ErrMsg:=Format(rsHelpHelpDatabaseNotFound, ['"', ID, '"']);
|
||||
end else begin
|
||||
HelpResult:=shrSuccess;
|
||||
Result:=true;
|
||||
@ -1618,7 +1589,7 @@ begin
|
||||
// show node
|
||||
if NodeQuery.Node.Owner=nil then begin
|
||||
Result:=shrDatabaseNotFound;
|
||||
ErrMsg:=Format(oisHelpHelpNodeHasNoHelpDatabase, ['"', NodeQuery.Node.Title, '"']);
|
||||
ErrMsg:=Format(rsHelpHelpNodeHasNoHelpDatabase, ['"', NodeQuery.Node.Title, '"']);
|
||||
exit;
|
||||
end;
|
||||
Result:=NodeQuery.Node.Owner.ShowHelp(Query,nil,
|
||||
@ -1677,10 +1648,10 @@ begin
|
||||
if (Nodes=nil) or (Nodes.Count=0) then begin
|
||||
Result:=shrContextNotFound;
|
||||
if Query.HelpDatabaseID<>'' then
|
||||
ErrMsg:=Format(oisHelpHelpContextNotFoundInDatabase, [IntToStr(
|
||||
ErrMsg:=Format(rsHelpHelpContextNotFoundInDatabase, [IntToStr(
|
||||
Query.Context), '"', Query.HelpDatabaseID, '"'])
|
||||
else
|
||||
ErrMsg:=Format(oisHelpHelpContextNotFound,
|
||||
ErrMsg:=Format(rsHelpHelpContextNotFound,
|
||||
[IntToStr(Query.Context)]);
|
||||
exit;
|
||||
end;
|
||||
@ -1717,10 +1688,10 @@ begin
|
||||
if (Nodes=nil) or (Nodes.Count=0) then begin
|
||||
Result:=shrContextNotFound;
|
||||
if Query.HelpDatabaseID<>'' then
|
||||
ErrMsg:=Format(oisHelpHelpKeywordNotFoundInDatabase, ['"',Query.Keyword,
|
||||
ErrMsg:=Format(rsHelpHelpKeywordNotFoundInDatabase, ['"',Query.Keyword,
|
||||
'"', '"', Query.HelpDatabaseID, '"'])
|
||||
else
|
||||
ErrMsg:=Format(oisHelpHelpKeywordNotFound, ['"',Query.Keyword,'"']);
|
||||
ErrMsg:=Format(rsHelpHelpKeywordNotFound, ['"',Query.Keyword,'"']);
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -1749,7 +1720,7 @@ begin
|
||||
// check if at least one node found
|
||||
if (Nodes=nil) or (Nodes.Count=0) then begin
|
||||
Result:=shrHelpNotFound;
|
||||
ErrMsg:=format(oisHelpNoHelpFoundForSource,
|
||||
ErrMsg:=format(rsHelpNoHelpFoundForSource,
|
||||
[Query.SourcePosition.y, Query.SourcePosition.x, Query.Filename]);
|
||||
exit;
|
||||
end;
|
||||
@ -2429,7 +2400,7 @@ var
|
||||
begin
|
||||
ExpFilename:=FFilename;
|
||||
if (HelpDatabases<>nil) then
|
||||
IDEMacros.SubstituteMacros(ExpFilename);
|
||||
HelpDatabases.SubstituteMacros(ExpFilename);
|
||||
ExpFilename:=TrimFilename(ExpFilename);
|
||||
if FilenameIsAbsolute(ExpFilename) then
|
||||
Result:=ExpFilename
|
||||
@ -2578,22 +2549,6 @@ begin
|
||||
BasePath:=TheBasePath;
|
||||
end;
|
||||
|
||||
{ THelpDBIRegExprMessage }
|
||||
|
||||
constructor THelpDBIRegExprMessage.Create(TheNode: THelpNode;
|
||||
const RegularExpression, TheModifierStr: string);
|
||||
begin
|
||||
FNode:=TheNode;
|
||||
FExpression:=RegularExpression;
|
||||
FModifierStr:=TheModifierStr;
|
||||
end;
|
||||
|
||||
function THelpDBIRegExprMessage.MessageMatches(const TheMessage: string;
|
||||
MessageParts: TStrings): boolean;
|
||||
begin
|
||||
Result:=REMatches(TheMessage,Expression,ModifierStr);
|
||||
end;
|
||||
|
||||
{ THelpNodeQuery }
|
||||
|
||||
constructor THelpNodeQuery.Create;
|
||||
|
91
ideintf/idehelpintf.pas
Normal file
91
ideintf/idehelpintf.pas
Normal file
@ -0,0 +1,91 @@
|
||||
{ $Id: helpintf.pas 9271 2006-05-13 12:00:43Z mattias $ }
|
||||
{
|
||||
*****************************************************************************
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program 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. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Mattias Gaertner
|
||||
|
||||
Abstract:
|
||||
This unit defines various base classes for the Help System used by the IDE.
|
||||
}
|
||||
unit IDEHelpIntf;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, HelpIntf, TextTools;
|
||||
|
||||
type
|
||||
{ THelpDBIRegExprMessage
|
||||
Help registration item for matching a message (e.g. a fpc warning) with
|
||||
a regular expression.
|
||||
For example a line like
|
||||
"/usr/share/lazarus/components/synedit/syneditkeycmds.pp(532,10) Warning: Function result does not seem to be set"
|
||||
could be matched with
|
||||
Expression=') Warning: Function result does not seem to be set'
|
||||
}
|
||||
|
||||
THelpDBIRegExprMessage = class(THelpDBIMessage)
|
||||
private
|
||||
FExpression: string;
|
||||
FModifierStr: string;
|
||||
public
|
||||
constructor Create(TheNode: THelpNode; const RegularExpression,
|
||||
TheModifierStr: string);
|
||||
function MessageMatches(const TheMessage: string; MessageParts: TStrings
|
||||
): boolean; override;
|
||||
property Expression: string read FExpression write FExpression;
|
||||
property ModifierStr: string read FModifierStr write FModifierStr;
|
||||
end;
|
||||
|
||||
{ TBaseHelpManager }
|
||||
|
||||
TBaseHelpManager = class(TComponent)
|
||||
public
|
||||
procedure ConnectMainBarEvents; virtual; abstract;
|
||||
procedure LoadHelpOptions; virtual; abstract;
|
||||
procedure SaveHelpOptions; virtual; abstract;
|
||||
|
||||
function ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint;
|
||||
var ErrMsg: string): TShowHelpResult; virtual; abstract;
|
||||
procedure ShowHelpForMessage(Line: integer); virtual; abstract;
|
||||
procedure ShowHelpForObjectInspector(Sender: TObject); virtual; abstract;
|
||||
|
||||
function ConvertSourcePosToPascalHelpContext(const CaretPos: TPoint;
|
||||
const Filename: string): TPascalHelpContextList; virtual; abstract;
|
||||
end;
|
||||
|
||||
var
|
||||
LazarusHelp: TBaseHelpManager; // initialized by the IDE
|
||||
|
||||
implementation
|
||||
|
||||
{ THelpDBIRegExprMessage }
|
||||
|
||||
constructor THelpDBIRegExprMessage.Create(TheNode: THelpNode;
|
||||
const RegularExpression, TheModifierStr: string);
|
||||
begin
|
||||
Node:=TheNode;
|
||||
FExpression:=RegularExpression;
|
||||
FModifierStr:=TheModifierStr;
|
||||
end;
|
||||
|
||||
function THelpDBIRegExprMessage.MessageMatches(const TheMessage: string;
|
||||
MessageParts: TStrings): boolean;
|
||||
begin
|
||||
Result:=REMatches(TheMessage,Expression,ModifierStr);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -278,19 +278,6 @@ resourcestring
|
||||
oisNone = '(none)';
|
||||
oisComponentNameIsNotAValidIdentifier = 'Component name %s%s%s is not a '
|
||||
+'valid identifier';
|
||||
oisHelpHelpNodeHasNoHelpDatabase = 'Help node %s%s%s has no Help Database';
|
||||
oisHelpHelpDatabaseDidNotFoundAViewerForAHelpPageOfType = 'Help Database %s%'
|
||||
+'s%s did not found a viewer for a help page of type %s';
|
||||
oisHelpAlreadyRegistered = '%s: Already registered';
|
||||
oisHelpNotRegistered = '%s: Not registered';
|
||||
oisHelpHelpDatabaseNotFound = 'Help Database %s%s%s not found';
|
||||
oisHelpHelpKeywordNotFoundInDatabase = 'Help keyword %s%s%s not found in '
|
||||
+'Database %s%s%s.';
|
||||
oisHelpHelpKeywordNotFound = 'Help keyword %s%s%s not found.';
|
||||
oisHelpHelpContextNotFoundInDatabase = 'Help context %s not found in '
|
||||
+'Database %s%s%s.';
|
||||
oisHelpHelpContextNotFound = 'Help context %s not found.';
|
||||
oisHelpNoHelpFoundForSource = 'No help found for line %d, column %d of %s.';
|
||||
oisLoadImageDialog = 'Load Image Dialog';
|
||||
oisOK = '&OK';
|
||||
oisCancel = '&Cancel';
|
||||
|
Loading…
Reference in New Issue
Block a user