code templates: fixed reading new lines at start of template

git-svn-id: trunk@9259 -
This commit is contained in:
mattias 2006-05-12 08:27:08 +00:00
parent b7000d9d8c
commit 2f2c92352b
24 changed files with 766 additions and 636 deletions

View File

@ -327,7 +327,8 @@ type
out NewCode: TCodeBuffer; out NewCode: TCodeBuffer;
out NewX, NewY, NewTopLine: integer): Boolean; out NewX, NewY, NewTopLine: integer): Boolean;
function FindDeclarationAndOverload(Code: TCodeBuffer; X,Y: integer; function FindDeclarationAndOverload(Code: TCodeBuffer; X,Y: integer;
var ListOfPCodeXYPosition: TFPList): boolean; var ListOfPCodeXYPosition: TFPList;
Flags: TFindDeclarationListFlags): boolean;
function FindMainDeclaration(Code: TCodeBuffer; X,Y: integer; function FindMainDeclaration(Code: TCodeBuffer; X,Y: integer;
out NewCode: TCodeBuffer; out NewCode: TCodeBuffer;
out NewX, NewY, NewTopLine: integer): boolean; out NewX, NewY, NewTopLine: integer): boolean;
@ -1596,7 +1597,8 @@ begin
end; end;
function TCodeToolManager.FindDeclarationAndOverload(Code: TCodeBuffer; X, function TCodeToolManager.FindDeclarationAndOverload(Code: TCodeBuffer; X,
Y: integer; var ListOfPCodeXYPosition: TFPList): boolean; Y: integer; var ListOfPCodeXYPosition: TFPList;
Flags: TFindDeclarationListFlags): boolean;
var var
CursorPos: TCodeXYPosition; CursorPos: TCodeXYPosition;
begin begin
@ -1613,7 +1615,7 @@ begin
{$ENDIF} {$ENDIF}
try try
Result:=FCurCodeTool.FindDeclarationAndOverload(CursorPos, Result:=FCurCodeTool.FindDeclarationAndOverload(CursorPos,
ListOfPCodeXYPosition); ListOfPCodeXYPosition,Flags);
except except
on e: Exception do Result:=HandleException(e); on e: Exception do Result:=HandleException(e);
end; end;

View File

@ -487,6 +487,11 @@ type
fsstIdentifier fsstIdentifier
); );
TFindDeclarationListFlag = (
fdlfWithoutEmptyProperties // omit properties without type and attributes
);
TFindDeclarationListFlags = set of TFindDeclarationListFlag;
const const
AllFindSmartFlags = [fsfIncludeDirective]; AllFindSmartFlags = [fsfIncludeDirective];
@ -713,7 +718,8 @@ type
Node: TCodeTreeNode): TFindContext; Node: TCodeTreeNode): TFindContext;
function FindDeclarationAndOverload(const CursorPos: TCodeXYPosition; function FindDeclarationAndOverload(const CursorPos: TCodeXYPosition;
out ListOfPCodeXYPosition: TFPList): boolean; out ListOfPCodeXYPosition: TFPList;
Flags: TFindDeclarationListFlags): boolean;
function FindClassAndAncestors(ClassNode: TCodeTreeNode; function FindClassAndAncestors(ClassNode: TCodeTreeNode;
out ListOfPFindContext: TFPList): boolean; out ListOfPFindContext: TFPList): boolean;
function FindContextClassAndAncestors(const CursorPos: TCodeXYPosition; function FindContextClassAndAncestors(const CursorPos: TCodeXYPosition;
@ -3030,8 +3036,8 @@ begin
end; end;
function TFindDeclarationTool.FindDeclarationAndOverload( function TFindDeclarationTool.FindDeclarationAndOverload(
const CursorPos: TCodeXYPosition; out ListOfPCodeXYPosition: TFPList const CursorPos: TCodeXYPosition; out ListOfPCodeXYPosition: TFPList;
): boolean; Flags: TFindDeclarationListFlags): boolean;
var var
CurCursorPos: TCodeXYPosition; CurCursorPos: TCodeXYPosition;
NewTool: TFindDeclarationTool; NewTool: TFindDeclarationTool;
@ -3039,15 +3045,19 @@ var
NewPos: TCodeXYPosition; NewPos: TCodeXYPosition;
NewTopLine: integer; NewTopLine: integer;
CurTool: TFindDeclarationTool; CurTool: TFindDeclarationTool;
OldPositions: TFPList;
Add: Boolean;
begin begin
Result:=true; Result:=true;
ListOfPCodeXYPosition:=nil; ListOfPCodeXYPosition:=nil;
AddCodePosition(ListOfPCodeXYPosition,CursorPos); AddCodePosition(ListOfPCodeXYPosition,CursorPos);
NewTool:=nil; NewTool:=nil;
NewNode:=nil; NewNode:=nil;
OldPositions:=nil;
ActivateGlobalWriteLock; ActivateGlobalWriteLock;
try try
AddCodePosition(OldPositions,CursorPos);
CurCursorPos:=CursorPos; CurCursorPos:=CursorPos;
CurTool:=Self; CurTool:=Self;
try try
@ -3055,7 +3065,14 @@ begin
+[fsfSearchSourceName], +[fsfSearchSourceName],
NewTool,NewNode,NewPos,NewTopLine) do NewTool,NewNode,NewPos,NewTopLine) do
begin begin
if IndexOfCodePosition(ListOfPCodeXYPosition,@NewPos)>=0 then break; if IndexOfCodePosition(OldPositions,@NewPos)>=0 then break;
AddCodePosition(OldPositions,NewPos);
Add:=true;
if (fdlfWithoutEmptyProperties in Flags)
and (NewNode.Desc=ctnProperty)
and (NewTool.PropNodeIsTypeLess(NewNode)) then
Add:=false;
if Add then
AddCodePosition(ListOfPCodeXYPosition,NewPos); AddCodePosition(ListOfPCodeXYPosition,NewPos);
CurCursorPos:=NewPos; CurCursorPos:=NewPos;
CurTool:=NewTool; CurTool:=NewTool;
@ -3074,6 +3091,7 @@ begin
end; end;
finally finally
DeactivateGlobalWriteLock; DeactivateGlobalWriteLock;
FreeListOfPCodeXYPosition(OldPositions);
end; end;
end; end;

View File

@ -1500,7 +1500,7 @@ begin
ReadNextAtom; // read 'property' ReadNextAtom; // read 'property'
end; end;
ReadNextAtom; // read name ReadNextAtom; // read name
ReadNextAtom; ReadNextAtom; // read colon, skip parameters
if CurPos.Flag=cafEdgedBracketOpen then begin if CurPos.Flag=cafEdgedBracketOpen then begin
ReadTilBracketClose(true); ReadTilBracketClose(true);
ReadNextAtom; ReadNextAtom;

View File

@ -474,6 +474,9 @@ var
BorlandDCI: boolean; BorlandDCI: boolean;
i, j, Len: integer; i, j, Len: integer;
s, sCompl, sComment, sComplValue: string; s, sCompl, sComment, sComplValue: string;
{$IFDEF SYN_LAZARUS}
TemplateStarted: Boolean;
{$ENDIF}
procedure SaveEntry; procedure SaveEntry;
begin begin
@ -497,6 +500,9 @@ begin
sCompl := ''; sCompl := '';
sComment := ''; sComment := '';
sComplValue := ''; sComplValue := '';
{$IFDEF SYN_LAZARUS}
TemplateStarted:=false;
{$ENDIF}
for i := 0 to fAutoCompleteList.Count - 1 do begin for i := 0 to fAutoCompleteList.Count - 1 do begin
s := fAutoCompleteList[i]; s := fAutoCompleteList[i];
Len := Length(s); Len := Length(s);
@ -521,9 +527,18 @@ begin
sComment := Copy(s, j, Len); sComment := Copy(s, j, Len);
if sComment[Length(sComment)] = ']' then if sComment[Length(sComment)] = ']' then
SetLength(sComment, Length(sComment) - 1); SetLength(sComment, Length(sComment) - 1);
{$IFDEF SYN_LAZARUS}
TemplateStarted:=true;
{$ENDIF}
end else begin end else begin
{$IFDEF SYN_LAZARUS}
if not TemplateStarted then
sComplValue := sComplValue + #13#10;
TemplateStarted:=false;
{$ELSE}
if sComplValue <> '' then if sComplValue <> '' then
sComplValue := sComplValue + #13#10; sComplValue := sComplValue + #13#10;
{$ENDIF}
sComplValue := sComplValue + s; sComplValue := sComplValue + s;
end; end;
end else begin end else begin
@ -534,9 +549,18 @@ begin
SaveEntry; SaveEntry;
// new completion entry // new completion entry
sCompl := s; sCompl := s;
{$IFDEF SYN_LAZARUS}
TemplateStarted:=true;
{$ENDIF}
end else if (Len > 0) and (s[1] = '=') then begin end else if (Len > 0) and (s[1] = '=') then begin
{$IFDEF SYN_LAZARUS}
if not TemplateStarted then
sComplValue := sComplValue + #13#10;
TemplateStarted:=false;
{$ELSE}
if sComplValue <> '' then if sComplValue <> '' then
sComplValue := sComplValue + #13#10; sComplValue := sComplValue + #13#10;
{$ENDIF}
sComplValue := sComplValue + Copy(s, 2, Len); sComplValue := sComplValue + Copy(s, 2, Len);
end; end;
end; end;

View File

@ -546,7 +546,7 @@ var
procedure ReadDelphiPackages; procedure ReadDelphiPackages;
var var
DelphiPackages: String; DelphiPackages: String;
Pkgs: TStringList; Pkgs: TStrings;
i: Integer; i: Integer;
Pkg: string; Pkg: string;
begin begin
@ -554,12 +554,16 @@ var
//DebugLn('ReadDelphiPackages DelphiPackages=',DelphiPackages); //DebugLn('ReadDelphiPackages DelphiPackages=',DelphiPackages);
Pkgs:=SplitString(DelphiPackages,';'); Pkgs:=SplitString(DelphiPackages,';');
if Pkgs=nil then exit; if Pkgs=nil then exit;
try
for i:=0 to Pkgs.Count-1 do begin for i:=0 to Pkgs.Count-1 do begin
Pkg:=Pkgs[i]; Pkg:=Pkgs[i];
DebugLn('ReadDelphiPackages Pkg=',Pkg); DebugLn('ReadDelphiPackages Pkg=',Pkg);
AddPackageDependency(Pkg,'rtl,dbrtl','FCL'); AddPackageDependency(Pkg,'rtl,dbrtl','FCL');
AddPackageDependency('LCL'); AddPackageDependency('LCL');
end; end;
finally
Pkgs.Free;
end;
end; end;
procedure AddSearchPath(const SearchPath: string); procedure AddSearchPath(const SearchPath: string);
@ -763,7 +767,7 @@ end;
function ExpandDelphiSearchPath(const SearchPath: string; function ExpandDelphiSearchPath(const SearchPath: string;
AProject: TProject): string; AProject: TProject): string;
var var
Paths: TStringList; Paths: TStrings;
i: Integer; i: Integer;
CurPath: String; CurPath: String;
j: Integer; j: Integer;

View File

@ -79,7 +79,6 @@ begin
LazarusIDE.SaveSourceEditorChangesToCodeCache(-1); LazarusIDE.SaveSourceEditorChangesToCodeCache(-1);
// remove first line (i.e. macro enabled flag) // remove first line (i.e. macro enabled flag)
Pattern:=TemplateValue;
i:=length(CodeTemplateMakroMagic); i:=length(CodeTemplateMakroMagic);
while (i<=length(Pattern)) and (not (Pattern[i] in [#10,#13])) do inc(i); while (i<=length(Pattern)) and (not (Pattern[i] in [#10,#13])) do inc(i);
if (i<length(Pattern)) and (Pattern[i+1] in [#10,#13]) if (i<length(Pattern)) and (Pattern[i+1] in [#10,#13])
@ -115,7 +114,7 @@ begin
if (p.y>0) and (p.y<=AEditor.Lines.Count) then begin if (p.y>0) and (p.y<=AEditor.Lines.Count) then begin
s:=AEditor.Lines[p.y-1]; s:=AEditor.Lines[p.y-1];
while (IndentLen<p.x) while (IndentLen<p.x)
and ((IndentLen>length(s)) or (s[IndentLen]<=' ')) do and ((IndentLen>length(s)) or (s[IndentLen] in [#9,' '])) do
inc(IndentLen); inc(IndentLen);
end; end;
IndentLen:=AEditor.LogicalToPhysicalCol(s,IndentLen);// consider tabs IndentLen:=AEditor.LogicalToPhysicalCol(s,IndentLen);// consider tabs

View File

@ -257,7 +257,7 @@ function CodeMakroProcedureHead(const Parameter: string;
InteractiveValue: TPersistent; SrcEdit: TSourceEditorInterface; var Value, InteractiveValue: TPersistent; SrcEdit: TSourceEditorInterface; var Value,
ErrorMsg: string): boolean; ErrorMsg: string): boolean;
var var
Params: TStringList; Params: TStrings;
Param: string; Param: string;
i: Integer; i: Integer;
Attributes: TProcHeadAttributes; Attributes: TProcHeadAttributes;
@ -266,6 +266,7 @@ begin
// parse attributes // parse attributes
Params:=SplitString(Parameter,','); Params:=SplitString(Parameter,',');
if Params<>nil then begin
try try
Attributes:=[]; Attributes:=[];
for i:=0 to Params.Count-1 do begin for i:=0 to Params.Count-1 do begin
@ -320,6 +321,7 @@ begin
finally finally
Params.Free; Params.Free;
end; end;
end;
//debugln('CodeMakroProcedureHead B '); //debugln('CodeMakroProcedureHead B ');
if not CodeToolBoss.ExtractProcedureHeader( if not CodeToolBoss.ExtractProcedureHeader(
@ -916,6 +918,7 @@ begin
if UseMakrosCheckBox.Checked then if UseMakrosCheckBox.Checked then
NewValue:=CodeTemplateMakroMagic+LineEnding+NewValue; NewValue:=CodeTemplateMakroMagic+LineEnding+NewValue;
SynAutoComplete.CompletionValues[a]:=NewValue; SynAutoComplete.CompletionValues[a]:=NewValue;
//DebugLn('TCodeTemplateDialog.SaveCurCodeTemplate NewValue="',NewValue,'" SynAutoComplete.CompletionValues[a]="',SynAutoComplete.CompletionValues[a],'"');
end; end;
{ TLazCodeMacros } { TLazCodeMacros }

View File

@ -566,7 +566,7 @@ procedure TfrmCompilerOptions.InhTreeViewSelectionChanged(Sender: TObject);
var var
ANode: TTreeNode; ANode: TTreeNode;
ChildData: PInheritedNodeData; ChildData: PInheritedNodeData;
sl: TStringList; sl: TStrings;
begin begin
ANode:=InhTreeView.Selected; ANode:=InhTreeView.Selected;
if (ANode=nil) or (ANode.Data=nil) then begin if (ANode=nil) or (ANode.Data=nil) then begin

View File

@ -42,7 +42,7 @@ uses
InputHistory, EditorOptions, IDETranslations; InputHistory, EditorOptions, IDETranslations;
const const
EnvOptsVersion: integer = 105; EnvOptsVersion: integer = 106;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -222,7 +222,7 @@ type
fCharcaseFileAction : TCharCaseFileAction; fCharcaseFileAction : TCharCaseFileAction;
fAmbiguousFileAction: TAmbiguousFileAction; fAmbiguousFileAction: TAmbiguousFileAction;
FLazDocPathList: TStrings; FLazDocPaths: string;
// language ID (see LazarusTranslations in translations.pas) // language ID (see LazarusTranslations in translations.pas)
fLanguageID: string; fLanguageID: string;
@ -396,7 +396,7 @@ type
write fCharcaseFileAction; write fCharcaseFileAction;
// lazdoc // lazdoc
property LazDocPathList: TStrings read FLazDocPathList write FLazDocPathList; property LazDocPaths: string read FLazDocPaths write FLazDocPaths;
// language // language
property LanguageID: string read fLanguageID write fLanguageID; property LanguageID: string read fLanguageID write fLanguageID;
@ -649,6 +649,9 @@ procedure SetComboBoxText(AComboBox:TComboBox; const AText:AnsiString);
procedure SetComboBoxText(AComboBox:TComboBox; const AText:AnsiString; procedure SetComboBoxText(AComboBox:TComboBox; const AText:AnsiString;
MaxCount: integer); MaxCount: integer);
const
DefaultLazDocPath = '$(LazarusDir)/docs/xml/lcl';
implementation implementation
@ -892,7 +895,7 @@ begin
fPascalFileExtension:=petPAS; fPascalFileExtension:=petPAS;
fCharcaseFileAction:=ccfaAutoRename; fCharcaseFileAction:=ccfaAutoRename;
FLazDocPathList:=TStringList.Create; FLazDocPaths:=SetDirSeparators(DefaultLazDocPath);
end; end;
destructor TEnvironmentOptions.Destroy; destructor TEnvironmentOptions.Destroy;
@ -914,7 +917,6 @@ begin
fIDEWindowLayoutList.Free; fIDEWindowLayoutList.Free;
FConfigStore.Free; FConfigStore.Free;
FXMLCfg.Free; FXMLCfg.Free;
FLazDocPathList.Free;
inherited Destroy; inherited Destroy;
end; end;
@ -1175,9 +1177,9 @@ begin
LoadPascalFileExt(Path+''); LoadPascalFileExt(Path+'');
//lazdoc //lazdoc
if FLazDocPathList<>nil then FLazDocPaths := XMLConfig.GetValue(Path+'LazDoc/Paths', DefaultLazDocPath);
FLazDocPathList.Text := if FileVersion<=105 then
XMLConfig.GetValue(Path+'LazDoc/Paths', FLazDocPathList.Text); FLazDocPaths:=LineBreaksToDelimiter(FLazDocPaths,';');
if FileVersion>=103 then begin if FileVersion>=103 then begin
fCharcaseFileAction:=CharCaseFileActionNameToType(XMLConfig.GetValue( fCharcaseFileAction:=CharCaseFileActionNameToType(XMLConfig.GetValue(
@ -1399,8 +1401,7 @@ begin
AmbiguousFileActionNames[afaAsk]); AmbiguousFileActionNames[afaAsk]);
//lazdoc //lazdoc
if FLazDocPathList<>nil then XMLConfig.SetDeleteValue(Path+'LazDoc/Paths',FLazDocPaths,DefaultLazDocPath);
XMLConfig.SetValue(Path+'LazDoc/Paths', FLazDocPathList.Text);
// object inspector // object inspector
FObjectInspectorOptions.SaveBounds:=false; FObjectInspectorOptions.SaveBounds:=false;
@ -2332,7 +2333,7 @@ begin
AmbiguousFileActionRadioGroup.ItemIndex := ord(AmbiguousFileAction); AmbiguousFileActionRadioGroup.ItemIndex := ord(AmbiguousFileAction);
//lazdoc //lazdoc
LazDocListBox.Items.AddStrings(LazDocPathList); SplitString(LazDocPaths,';',LazDocListBox.Items);
end; end;
end; end;
@ -2473,7 +2474,7 @@ begin
PascalFileExtension:=petPAS; PascalFileExtension:=petPAS;
//lazdoc //lazdoc
LazDocPathList.Assign(LazDocListBox.Items); LazDocPaths:=StringListToText(LazDocListBox.Items,';',true);
CharcaseFileAction := TCharCaseFileAction(CharcaseFileActionRadioGroup.ItemIndex); CharcaseFileAction := TCharCaseFileAction(CharcaseFileActionRadioGroup.ItemIndex);
AmbiguousFileAction := TAmbiguousFileAction(AmbiguousFileActionRadioGroup.ItemIndex); AmbiguousFileAction := TAmbiguousFileAction(AmbiguousFileActionRadioGroup.ItemIndex);

View File

@ -352,13 +352,9 @@ end;
procedure TFindRenameIdentifierDialog.SaveToOptions( procedure TFindRenameIdentifierDialog.SaveToOptions(
Options: TFindRenameIdentifierOptions); Options: TFindRenameIdentifierOptions);
var
ExtraFileList: TStringList;
begin begin
Options.Rename:=RenameCheckBox.Checked; Options.Rename:=RenameCheckBox.Checked;
ExtraFileList:=SplitString(ExtraFilesEdit.Text,';'); SplitString(ExtraFilesEdit.Text,';',Options.ExtraFiles,true);
Options.ExtraFiles.Assign(ExtraFileList);
ExtraFileList.Free;
Options.RenameTo:=NewEdit.Text; Options.RenameTo:=NewEdit.Text;
Options.SearchInComments:=ScopeCommentsCheckBox.Checked; Options.SearchInComments:=ScopeCommentsCheckBox.Checked;
case ScopeRadioGroup.ItemIndex of case ScopeRadioGroup.ItemIndex of

View File

@ -69,14 +69,14 @@ type
procedure mnuHelpConfigureHelpClicked(Sender: TObject); procedure mnuHelpConfigureHelpClicked(Sender: TObject);
procedure mnuHelpOnlineHelpClicked(Sender: TObject); procedure mnuHelpOnlineHelpClicked(Sender: TObject);
private private
FFCLHelpDBPath: THelpBasePathObject; FFCLHelpDBPath: THelpBaseURLObject;
FLCLHelpDBPath: THelpBasePathObject; FLCLHelpDBPath: THelpBaseURLObject;
FMainHelpDB: THelpDatabase; FMainHelpDB: THelpDatabase;
FMainHelpDBPath: THelpBasePathObject; FMainHelpDBPath: THelpBasePathObject;
FRTLHelpDB: THelpDatabase; FRTLHelpDB: THelpDatabase;
FFCLHelpDB: THelpDatabase; FFCLHelpDB: THelpDatabase;
FLCLHelpDB: THelpDatabase; FLCLHelpDB: THelpDatabase;
FRTLHelpDBPath: THelpBasePathObject; FRTLHelpDBPath: THelpBaseURLObject;
procedure RegisterIDEHelpDatabases; procedure RegisterIDEHelpDatabases;
procedure RegisterDefaultIDEHelpViewers; procedure RegisterDefaultIDEHelpViewers;
procedure FindDefaultBrowser(var DefaultBrowser, Params: string); procedure FindDefaultBrowser(var DefaultBrowser, Params: string);
@ -97,15 +97,20 @@ type
var ErrMsg: string): TShowHelpResult; override; var ErrMsg: string): TShowHelpResult; override;
procedure ShowHelpForMessage(Line: integer); override; procedure ShowHelpForMessage(Line: integer); override;
procedure ShowHelpForObjectInspector(Sender: TObject); override; procedure ShowHelpForObjectInspector(Sender: TObject); override;
function ConvertSourcePosToPascalHelpContext(const CaretPos: TPoint;
const Filename: string): TPascalHelpContextList; override;
function ConvertCodePosToPascalHelpContext(
ACodePos: PCodeXYPosition): TPascalHelpContextList;
public public
property FCLHelpDB: THelpDatabase read FFCLHelpDB; property FCLHelpDB: THelpDatabase read FFCLHelpDB;
property FCLHelpDBPath: THelpBasePathObject read FFCLHelpDBPath; property FCLHelpDBPath: THelpBaseURLObject read FFCLHelpDBPath;
property LCLHelpDB: THelpDatabase read FLCLHelpDB; property LCLHelpDB: THelpDatabase read FLCLHelpDB;
property LCLHelpDBPath: THelpBasePathObject read FLCLHelpDBPath; property LCLHelpDBPath: THelpBaseURLObject read FLCLHelpDBPath;
property MainHelpDB: THelpDatabase read FMainHelpDB; property MainHelpDB: THelpDatabase read FMainHelpDB;
property MainHelpDBPath: THelpBasePathObject read FMainHelpDBPath; property MainHelpDBPath: THelpBasePathObject read FMainHelpDBPath;
property RTLHelpDB: THelpDatabase read FRTLHelpDB; property RTLHelpDB: THelpDatabase read FRTLHelpDB;
property RTLHelpDBPath: THelpBasePathObject read FRTLHelpDBPath; property RTLHelpDBPath: THelpBaseURLObject read FRTLHelpDBPath;
end; end;
{ THelpSelectorDialog } { THelpSelectorDialog }
@ -205,6 +210,8 @@ begin
Selection:=Nodes[i]; Selection:=Nodes[i];
Result:=shrSuccess; Result:=shrSuccess;
end; end;
end else begin
Result:=shrCancel;
end; end;
finally finally
Dialog.Free; Dialog.Free;
@ -219,6 +226,7 @@ begin
case ShowResult of case ShowResult of
shrNone: ErrorCaption:=lisCodeTemplError; shrNone: ErrorCaption:=lisCodeTemplError;
shrSuccess: exit; shrSuccess: exit;
shrCancel: exit;
shrDatabaseNotFound: ErrorCaption:=lisHelpDatabaseNotFound; shrDatabaseNotFound: ErrorCaption:=lisHelpDatabaseNotFound;
shrContextNotFound: ErrorCaption:=lisHelpContextNotFound; shrContextNotFound: ErrorCaption:=lisHelpContextNotFound;
shrViewerNotFound: ErrorCaption:=lisHelpViewerNotFound; shrViewerNotFound: ErrorCaption:=lisHelpViewerNotFound;
@ -234,6 +242,7 @@ function TIDEHelpDatabases.GetBaseDirectoryForBasePathObject(
BasePathObject: TObject): string; BasePathObject: TObject): string;
begin begin
Result:=''; Result:='';
DebugLn('TIDEHelpDatabases.GetBaseDirectoryForBasePathObject BasePathObject=',dbgsName(BasePathObject));
if (BasePathObject is THelpBasePathObject) then if (BasePathObject is THelpBasePathObject) then
Result:=THelpBasePathObject(BasePathObject).BasePath Result:=THelpBasePathObject(BasePathObject).BasePath
else if (BasePathObject=HelpBoss) or (BasePathObject=MainIDEInterface) then else if (BasePathObject=HelpBoss) or (BasePathObject=MainIDEInterface) then
@ -302,7 +311,7 @@ procedure THelpManager.RegisterIDEHelpDatabases;
TFPDocHTMLHelpDatabase,true); TFPDocHTMLHelpDatabase,true);
HTMLHelp:=FRTLHelpDB as TFPDocHTMLHelpDatabase; HTMLHelp:=FRTLHelpDB as TFPDocHTMLHelpDatabase;
HTMLHelp.DefaultBaseURL:=lihRTLURL; HTMLHelp.DefaultBaseURL:=lihRTLURL;
FRTLHelpDBPath:=THelpBasePathObject.Create; FRTLHelpDBPath:=THelpBaseURLObject.Create;
HTMLHelp.BasePathObject:=FRTLHelpDBPath; HTMLHelp.BasePathObject:=FRTLHelpDBPath;
// FPDoc nodes for units in the RTL // FPDoc nodes for units in the RTL
@ -325,7 +334,7 @@ procedure THelpManager.RegisterIDEHelpDatabases;
TFPDocHTMLHelpDatabase,true); TFPDocHTMLHelpDatabase,true);
HTMLHelp:=FFCLHelpDB as TFPDocHTMLHelpDatabase; HTMLHelp:=FFCLHelpDB as TFPDocHTMLHelpDatabase;
HTMLHelp.DefaultBaseURL:=lihFCLURL; HTMLHelp.DefaultBaseURL:=lihFCLURL;
FFCLHelpDBPath:=THelpBasePathObject.Create; FFCLHelpDBPath:=THelpBaseURLObject.Create;
HTMLHelp.BasePathObject:=FFCLHelpDBPath; HTMLHelp.BasePathObject:=FFCLHelpDBPath;
// FPDoc nodes for units in the FCL // FPDoc nodes for units in the FCL
@ -348,7 +357,7 @@ procedure THelpManager.RegisterIDEHelpDatabases;
TFPDocHTMLHelpDatabase,true); TFPDocHTMLHelpDatabase,true);
HTMLHelp:=FLCLHelpDB as TFPDocHTMLHelpDatabase; HTMLHelp:=FLCLHelpDB as TFPDocHTMLHelpDatabase;
HTMLHelp.DefaultBaseURL:=lihLCLURL; HTMLHelp.DefaultBaseURL:=lihLCLURL;
FLCLHelpDBPath:=THelpBasePathObject.Create; FLCLHelpDBPath:=THelpBaseURLObject.Create;
HTMLHelp.BasePathObject:=FLCLHelpDBPath; HTMLHelp.BasePathObject:=FLCLHelpDBPath;
// FPDoc nodes for units in the LCL // FPDoc nodes for units in the LCL
@ -387,6 +396,7 @@ constructor THelpManager.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
HelpBoss:=Self; HelpBoss:=Self;
LazarusHelp:=Self;
HelpOpts:=THelpOptions.Create; HelpOpts:=THelpOptions.Create;
HelpOpts.SetDefaultFilename; HelpOpts.SetDefaultFilename;
HelpDatabases:=TIDEHelpDatabases.Create; HelpDatabases:=TIDEHelpDatabases.Create;
@ -410,6 +420,7 @@ begin
FreeThenNil(FFCLHelpDBPath); FreeThenNil(FFCLHelpDBPath);
FreeThenNil(FLCLHelpDBPath); FreeThenNil(FLCLHelpDBPath);
HelpBoss:=nil; HelpBoss:=nil;
LazarusHelp:=nil;
inherited Destroy; inherited Destroy;
end; end;
@ -513,97 +524,6 @@ function THelpManager.ShowHelpForSourcePosition(const Filename: string;
Result:=ShowHelpForFPCKeyWord(KeyWord); Result:=ShowHelpForFPCKeyWord(KeyWord);
end; end;
function ConvertCodePosToPascalHelpContext(ACodePos: PCodeXYPosition
): TPascalHelpContextList;
procedure AddContext(Descriptor: TPascalHelpContextType;
const Context: string);
var
CurContext: TPascalHelpContext;
begin
CurContext.Descriptor:=Descriptor;
CurContext.Context:=Context;
Result.Add(CurContext);
debugln(' AddContext Descriptor=',dbgs(ord(Descriptor)),' Context="',Context,'"');
end;
procedure AddContextsBackwards(Tool: TCodeTool;
Node: TCodeTreeNode);
begin
if Node=nil then exit;
AddContextsBackwards(Tool,Node.Parent);
case Node.Desc of
ctnUnit, ctnPackage, ctnProgram, ctnLibrary:
AddContext(pihcSourceName,Tool.GetSourceName);
ctnVarDefinition:
AddContext(pihcVariable,Tool.ExtractDefinitionName(Node));
ctnTypeDefinition:
AddContext(pihcType,Tool.ExtractDefinitionName(Node));
ctnConstDefinition:
AddContext(pihcConst,Tool.ExtractDefinitionName(Node));
ctnProperty:
AddContext(pihcProperty,Tool.ExtractPropName(Node,false));
ctnProcedure:
AddContext(pihcProcedure,Tool.ExtractProcName(Node,
[phpWithoutClassName]));
ctnProcedureHead:
AddContext(pihcParameterList,'');
end;
end;
var
MainCodeBuffer: TCodeBuffer;
Tool: TCustomCodeTool;
CleanPos: integer;
i: Integer;
Node: TCodeTreeNode;
IncludeChain: TFPList;
ConversionResult: LongInt;
begin
Result:=nil;
// find code buffer
if ACodePos^.Code=nil then begin
debugln('WARNING: ConvertCodePosToPascalHelpContext ACodePos.Code=nil');
exit;
end;
Result:=TPascalHelpContextList.Create;
// add filename and all filenames of the include chain
IncludeChain:=nil;
try
CodeToolBoss.GetIncludeCodeChain(ACodePos^.Code,true,IncludeChain);
if IncludeChain=nil then begin
debugln('WARNING: ConvertCodePosToPascalHelpContext IncludeChain=nil');
exit;
end;
for i:=0 to IncludeChain.Count-1 do
AddContext(pihcFilename,TCodeBuffer(IncludeChain[i]).Filename);
MainCodeBuffer:=TCodeBuffer(IncludeChain[0]);
finally
IncludeChain.Free;
end;
// find code tool
Tool:=CodeToolBoss.FindCodeToolForSource(MainCodeBuffer);
if not (Tool is TCodeTool) then begin
debugln('WARNING: ConvertCodePosToPascalHelpContext not (Tool is TCodeTool) MainCodeBuffer=',MainCodeBuffer.Filename);
exit;
end;
// convert cursor position to clean position
ConversionResult:=Tool.CaretToCleanPos(ACodePos^,CleanPos);
if ConversionResult<>0 then begin
// position not in clean code, maybe a comment, maybe behind last line
// => ignore
exit;
end;
// find node
Node:=Tool.FindDeepestNodeAtPos(CleanPos,false);
if Node=nil then begin
// position not in a scanned pascal node, maybe in between
// => ignore
exit;
end;
AddContextsBackwards(TCodeTool(Tool),Node);
end;
procedure CollectDeclarations(CodeBuffer: TCodeBuffer); procedure CollectDeclarations(CodeBuffer: TCodeBuffer);
var var
NewList: TPascalHelpContextList; NewList: TPascalHelpContextList;
@ -617,7 +537,7 @@ function THelpManager.ShowHelpForSourcePosition(const Filename: string;
try try
// get all possible declarations of this identifier // get all possible declarations of this identifier
if CodeToolBoss.FindDeclarationAndOverload(CodeBuffer,CodePos.X,CodePos.Y, if CodeToolBoss.FindDeclarationAndOverload(CodeBuffer,CodePos.X,CodePos.Y,
ListOfPCodeXYPosition) then ListOfPCodeXYPosition,[fdlfWithoutEmptyProperties]) then
begin begin
debugln('THelpManager.ShowHelpForSourcePosition B Success ',dbgs(ListOfPCodeXYPosition.Count)); debugln('THelpManager.ShowHelpForSourcePosition B Success ',dbgs(ListOfPCodeXYPosition.Count));
// convert the source positions in pascal help context list // convert the source positions in pascal help context list
@ -668,6 +588,99 @@ begin
CollectDeclarations(CodeBuffer); CollectDeclarations(CodeBuffer);
end; end;
function THelpManager.ConvertCodePosToPascalHelpContext(
ACodePos: PCodeXYPosition): TPascalHelpContextList;
procedure AddContext(Descriptor: TPascalHelpContextType;
const Context: string);
var
CurContext: TPascalHelpContext;
begin
CurContext.Descriptor:=Descriptor;
CurContext.Context:=Context;
Result.Add(CurContext);
//debugln(' AddContext Descriptor=',dbgs(ord(Descriptor)),' Context="',Context,'"');
end;
procedure AddContextsBackwards(Tool: TCodeTool;
Node: TCodeTreeNode);
begin
if Node=nil then exit;
AddContextsBackwards(Tool,Node.Parent);
case Node.Desc of
ctnUnit, ctnPackage, ctnProgram, ctnLibrary:
AddContext(pihcSourceName,Tool.GetSourceName);
ctnVarDefinition:
AddContext(pihcVariable,Tool.ExtractDefinitionName(Node));
ctnTypeDefinition:
AddContext(pihcType,Tool.ExtractDefinitionName(Node));
ctnConstDefinition:
AddContext(pihcConst,Tool.ExtractDefinitionName(Node));
ctnProperty:
AddContext(pihcProperty,Tool.ExtractPropName(Node,false));
ctnProcedure:
AddContext(pihcProcedure,Tool.ExtractProcName(Node,
[phpWithoutClassName]));
ctnProcedureHead:
AddContext(pihcParameterList,Tool.ExtractProcHead(Node,
[phpWithoutClassKeyword,phpWithoutClassName,phpWithoutName,
phpWithoutSemicolon]));
end;
end;
var
MainCodeBuffer: TCodeBuffer;
Tool: TCustomCodeTool;
CleanPos: integer;
i: Integer;
Node: TCodeTreeNode;
IncludeChain: TFPList;
ConversionResult: LongInt;
begin
Result:=nil;
// find code buffer
if ACodePos^.Code=nil then begin
debugln('WARNING: ConvertCodePosToPascalHelpContext ACodePos.Code=nil');
exit;
end;
Result:=TPascalHelpContextList.Create;
// add filename and all filenames of the include chain
IncludeChain:=nil;
try
CodeToolBoss.GetIncludeCodeChain(ACodePos^.Code,true,IncludeChain);
if IncludeChain=nil then begin
debugln('WARNING: ConvertCodePosToPascalHelpContext IncludeChain=nil');
exit;
end;
for i:=0 to IncludeChain.Count-1 do
AddContext(pihcFilename,TCodeBuffer(IncludeChain[i]).Filename);
MainCodeBuffer:=TCodeBuffer(IncludeChain[0]);
finally
IncludeChain.Free;
end;
// find code tool
Tool:=CodeToolBoss.FindCodeToolForSource(MainCodeBuffer);
if not (Tool is TCodeTool) then begin
debugln('WARNING: ConvertCodePosToPascalHelpContext not (Tool is TCodeTool) MainCodeBuffer=',MainCodeBuffer.Filename);
exit;
end;
// convert cursor position to clean position
ConversionResult:=Tool.CaretToCleanPos(ACodePos^,CleanPos);
if ConversionResult<>0 then begin
// position not in clean code, maybe a comment, maybe behind last line
// => ignore
exit;
end;
// find node
Node:=Tool.FindDeepestNodeAtPos(CleanPos,false);
if Node=nil then begin
// position not in a scanned pascal node, maybe in between
// => ignore
exit;
end;
AddContextsBackwards(TCodeTool(Tool),Node);
end;
procedure THelpManager.ShowHelpForMessage(Line: integer); procedure THelpManager.ShowHelpForMessage(Line: integer);
function ParseMessage(MsgItem: TIDEMessageLine): TStringList; function ParseMessage(MsgItem: TIDEMessageLine): TStringList;
@ -720,6 +733,23 @@ begin
end; end;
end; end;
function THelpManager.ConvertSourcePosToPascalHelpContext(
const CaretPos: TPoint; const Filename: string): TPascalHelpContextList;
var
CodePos: TCodeXYPosition;
Code: TCodeBuffer;
ACodeTool: TCodeTool;
begin
Result:=nil;
Code:=CodeToolBoss.FindFile(Filename);
if Code=nil then exit;
CodePos.Code:=Code;
CodePos.X:=CaretPos.X;
CodePos.Y:=CaretPos.Y;
if not CodeToolBoss.Explore(Code,ACodeTool,false) then exit;
Result:=ConvertCodePosToPascalHelpContext(@CodePos);
end;
initialization initialization
{$i helpmanager.lrs} {$i helpmanager.lrs}

View File

@ -183,8 +183,11 @@ function CrossReplaceChars(const Src: string; PrefixChar: char;
function SimpleSyntaxToRegExpr(const Src: string): string; function SimpleSyntaxToRegExpr(const Src: string): string;
function NameToValidIdentifier(const s: string): string; function NameToValidIdentifier(const s: string): string;
function BinaryStrToText(const s: string): string; function BinaryStrToText(const s: string): string;
function SplitString(const s: string; Delimiter: char): TStringList; function SplitString(const s: string; Delimiter: char): TStrings;
procedure SplitString(const s: string; Delimiter: char; AddTo: TStrings;
ClearList: boolean = true);
function SpecialCharsToSpaces(const s: string): string; function SpecialCharsToSpaces(const s: string): string;
function LineBreaksToDelimiter(const s: string; Delimiter: char): string;
function StringListToText(List: TStrings; const Delimiter: string; function StringListToText(List: TStrings; const Delimiter: string;
IgnoreEmptyLines: boolean = false): string; IgnoreEmptyLines: boolean = false): string;
@ -1471,6 +1474,30 @@ begin
//DebugLn('TabsToSpaces ',dbgs(length(Result))); //DebugLn('TabsToSpaces ',dbgs(length(Result)));
end; end;
procedure SplitString(const s: string; Delimiter: char; AddTo: TStrings;
ClearList: boolean);
var
SLen: Integer;
StartPos: Integer;
EndPos: Integer;
begin
if ClearList then AddTo.Clear;
SLen:=length(s);
StartPos:=1;
EndPos:=1;
repeat
if (EndPos<=sLen) and (s[EndPos]<>Delimiter) then
inc(EndPos)
else begin
if EndPos>StartPos then
AddTo.Add(copy(s,StartPos,EndPos-StartPos));
StartPos:=EndPos+1;
if StartPos>sLen then exit;
inc(EndPos);
end;
until false;
end;
{------------------------------------------------------------------------------- {-------------------------------------------------------------------------------
function SpecialCharsToSpaces(const s: string): string; function SpecialCharsToSpaces(const s: string): string;
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
@ -1486,6 +1513,29 @@ begin
Result:=Trim(Result); Result:=Trim(Result);
end; end;
function LineBreaksToDelimiter(const s: string; Delimiter: char): string;
var
p: Integer;
StartPos: LongInt;
begin
Result:=s;
p:=1;
while (p<=length(Result)) do begin
if Result[p] in [#10,#13] then begin
StartPos:=p;
repeat
inc(p);
until (p>length(Result)) or (not (Result[p] in [#10,#13]));
if p<=length(Result) then
Result:=copy(Result,1,StartPos-1)+Delimiter+copy(Result,p,length(Result))
else
Result:=copy(Result,1,StartPos-1);
end else begin
inc(p);
end;
end;
end;
function StringListToText(List: TStrings; const Delimiter: string; function StringListToText(List: TStrings; const Delimiter: string;
IgnoreEmptyLines: boolean): string; IgnoreEmptyLines: boolean): string;
var var
@ -1602,29 +1652,12 @@ begin
end; end;
{------------------------------------------------------------------------------- {-------------------------------------------------------------------------------
function SplitString(const s: string; Delimiter: char): TStringList; function SplitString(const s: string; Delimiter: char): TStrings;
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function SplitString(const s: string; Delimiter: char): TStringList; function SplitString(const s: string; Delimiter: char): TStrings;
var
SLen: Integer;
StartPos: Integer;
EndPos: Integer;
begin begin
Result:=TStringList.Create; Result:=TStringList.Create;
SLen:=length(s); SplitString(s,Delimiter,Result,false);
StartPos:=1;
EndPos:=1;
repeat
if (EndPos<=sLen) and (s[EndPos]<>Delimiter) then
inc(EndPos)
else begin
if EndPos>StartPos then
Result.Add(copy(s,StartPos,EndPos-StartPos));
StartPos:=EndPos+1;
if StartPos>sLen then exit;
inc(EndPos);
end;
until false;
end; end;
{------------------------------------------------------------------------------- {-------------------------------------------------------------------------------

View File

@ -4,8 +4,9 @@ object LazDocForm: TLazDocForm
ClientHeight = 117 ClientHeight = 117
ClientWidth = 753 ClientWidth = 753
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy
OnResize = FormResize OnResize = FormResize
PixelsPerInch = 96 PixelsPerInch = 95
HorzScrollBar.Page = 752 HorzScrollBar.Page = 752
VertScrollBar.Page = 116 VertScrollBar.Page = 116
Left = 390 Left = 390
@ -23,27 +24,30 @@ object LazDocForm: TLazDocForm
Width = 736 Width = 736
object ShortTabSheet: TTabSheet object ShortTabSheet: TTabSheet
Caption = 'ShortTabSheet' Caption = 'ShortTabSheet'
ClientHeight = 91 ClientHeight = 87
ClientWidth = 728 ClientWidth = 732
Height = 91 Left = 2
Width = 728 Height = 87
Top = 2
Width = 732
object ShortEdit: TEdit object ShortEdit: TEdit
Align = alTop Align = alTop
BorderSpacing.OnChange = nil
BorderSpacing.Right = 2 BorderSpacing.Right = 2
OnChange = DocumentationTagChange OnChange = DocumentationTagChange
TabOrder = 0 TabOrder = 0
Text = 'ShortEdit' Text = 'ShortEdit'
Height = 23 Height = 23
Width = 726 Width = 730
end end
end end
object DescrTabSheet: TTabSheet object DescrTabSheet: TTabSheet
Caption = 'DescrTabSheet' Caption = 'DescrTabSheet'
ClientHeight = 91 ClientHeight = 87
ClientWidth = 728 ClientWidth = 732
Height = 91 Left = 2
Width = 728 Height = 87
Top = 2
Width = 732
object DescrMemo: TMemo object DescrMemo: TMemo
Align = alClient Align = alClient
BorderSpacing.Right = 2 BorderSpacing.Right = 2
@ -53,19 +57,20 @@ object LazDocForm: TLazDocForm
) )
OnChange = DocumentationTagChange OnChange = DocumentationTagChange
TabOrder = 0 TabOrder = 0
Height = 87 Height = 83
Width = 726 Width = 730
end end
end end
object ErrorsTabSheet: TTabSheet object ErrorsTabSheet: TTabSheet
Caption = 'ErrorsTabSheet' Caption = 'ErrorsTabSheet'
ClientHeight = 91 ClientHeight = 87
ClientWidth = 728 ClientWidth = 732
Height = 91 Left = 2
Width = 728 Height = 87
Top = 2
Width = 732
object ErrorsMemo: TMemo object ErrorsMemo: TMemo
Align = alClient Align = alClient
BorderSpacing.OnChange = nil
BorderSpacing.Right = 2 BorderSpacing.Right = 2
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Lines.Strings = ( Lines.Strings = (
@ -73,56 +78,55 @@ object LazDocForm: TLazDocForm
) )
OnChange = DocumentationTagChange OnChange = DocumentationTagChange
TabOrder = 0 TabOrder = 0
Height = 87 Height = 83
Width = 726 Width = 730
end end
end end
object SeeAlsoTabSheet: TTabSheet object SeeAlsoTabSheet: TTabSheet
Caption = 'SeeAlsoTabSheet' Caption = 'SeeAlsoTabSheet'
ClientHeight = 91 ClientHeight = 87
ClientWidth = 728 ClientWidth = 732
Height = 91 Left = 2
Width = 728 Height = 87
Top = 2
Width = 732
object LinkListBox: TListBox object LinkListBox: TListBox
Align = alBottom Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.OnChange = nil
BorderSpacing.Right = 2 BorderSpacing.Right = 2
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
OnClick = LinkListBoxClick OnClick = LinkListBoxClick
TabOrder = 0 TabOrder = 0
Height = 60 TopIndex = -1
Height = 56
Top = 27 Top = 27
Width = 726 Width = 730
end end
object AddLinkButton: TButton object AddLinkButton: TButton
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = True AutoSize = True
BorderSpacing.OnChange = nil
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.InnerBorder = 2 BorderSpacing.InnerBorder = 2
Caption = 'AddLinkButton' Caption = 'AddLinkButton'
OnClick = AddLinkButtonClick OnClick = AddLinkButtonClick
TabOrder = 1 TabOrder = 1
AnchorSideRight.Control = DeleteLinkButton AnchorSideRight.Control = DeleteLinkButton
Left = 570 Left = 574
Height = 23 Height = 23
Width = 75 Width = 75
end end
object DeleteLinkButton: TButton object DeleteLinkButton: TButton
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = True AutoSize = True
BorderSpacing.OnChange = nil
BorderSpacing.InnerBorder = 2 BorderSpacing.InnerBorder = 2
Caption = 'DeleteLinkButton' Caption = 'DeleteLinkButton'
OnClick = DeleteLinkButtonClick OnClick = DeleteLinkButtonClick
TabOrder = 2 TabOrder = 2
Left = 651 Left = 655
Height = 23 Height = 23
Width = 75 Width = 75
end end
object LinkTextEdit: TEdit object LinkTextEdit: TEdit
BorderSpacing.OnChange = nil
OnChange = LinkChange OnChange = LinkChange
TabOrder = 3 TabOrder = 3
Text = 'LinkTextEdit' Text = 'LinkTextEdit'
@ -132,6 +136,7 @@ object LazDocForm: TLazDocForm
Width = 328 Width = 328
end end
object LinkIdComboBox: TComboBox object LinkIdComboBox: TComboBox
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
MaxLength = 0 MaxLength = 0
OnChange = LinkChange OnChange = LinkChange
TabOrder = 4 TabOrder = 4
@ -143,29 +148,29 @@ object LazDocForm: TLazDocForm
end end
object ExampleTabSheet: TTabSheet object ExampleTabSheet: TTabSheet
Caption = 'ExampleTabSheet' Caption = 'ExampleTabSheet'
ClientHeight = 91 ClientHeight = 87
ClientWidth = 728 ClientWidth = 732
Height = 91 Left = 2
Width = 728 Height = 87
Top = 2
Width = 732
object ExampleEdit: TEdit object ExampleEdit: TEdit
Align = alTop Align = alTop
BorderSpacing.OnChange = nil
BorderSpacing.Right = 2 BorderSpacing.Right = 2
OnChange = DocumentationTagChange OnChange = DocumentationTagChange
TabOrder = 0 TabOrder = 0
Text = 'ExampleEdit' Text = 'ExampleEdit'
Height = 23 Height = 23
Width = 726 Width = 730
end end
object BrowseExampleButton: TButton object BrowseExampleButton: TButton
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = True AutoSize = True
BorderSpacing.OnChange = nil
BorderSpacing.InnerBorder = 2 BorderSpacing.InnerBorder = 2
Caption = 'BrowseExampleButton' Caption = 'BrowseExampleButton'
OnClick = BrowseExampleButtonClick OnClick = BrowseExampleButtonClick
TabOrder = 1 TabOrder = 1
Left = 651 Left = 655
Height = 25 Height = 25
Top = 28 Top = 28
Width = 75 Width = 75
@ -174,7 +179,6 @@ object LazDocForm: TLazDocForm
end end
object Panel1: TPanel object Panel1: TPanel
Align = alLeft Align = alLeft
BorderSpacing.OnChange = nil
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 117 ClientHeight = 117
ClientWidth = 17 ClientWidth = 17
@ -186,7 +190,7 @@ object LazDocForm: TLazDocForm
Width = 17 Width = 17
object BoldFormatButton: TSpeedButton object BoldFormatButton: TSpeedButton
Align = alTop Align = alTop
BorderSpacing.OnChange = nil Color = clBtnFace
Glyph.Data = { Glyph.Data = {
B20100002F2A2058504D202A2F0A7374617469632063686172202A6772617068 B20100002F2A2058504D202A2F0A7374617469632063686172202A6772617068
69635B5D203D207B0A22313720313720322031222C0A222E2063204E6F6E6522 69635B5D203D207B0A22313720313720322031222C0A222E2063204E6F6E6522
@ -210,7 +214,7 @@ object LazDocForm: TLazDocForm
end end
object ItalicFormatButton: TSpeedButton object ItalicFormatButton: TSpeedButton
Align = alTop Align = alTop
BorderSpacing.OnChange = nil Color = clBtnFace
Glyph.Data = { Glyph.Data = {
C10100002F2A2058504D202A2F0A7374617469632063686172202A6772617068 C10100002F2A2058504D202A2F0A7374617469632063686172202A6772617068
69635B5D203D207B0A22313720313720332031222C0A222E2063204E6F6E6522 69635B5D203D207B0A22313720313720332031222C0A222E2063204E6F6E6522
@ -237,7 +241,7 @@ object LazDocForm: TLazDocForm
end end
object UnderlineFormatButton: TSpeedButton object UnderlineFormatButton: TSpeedButton
Align = alTop Align = alTop
BorderSpacing.OnChange = nil Color = clBtnFace
Glyph.Data = { Glyph.Data = {
C10100002F2A2058504D202A2F0A7374617469632063686172202A6772617068 C10100002F2A2058504D202A2F0A7374617469632063686172202A6772617068
69635B5D203D207B0A22313720313720332031222C0A222E2063204E6F6E6522 69635B5D203D207B0A22313720313720332031222C0A222E2063204E6F6E6522
@ -264,6 +268,7 @@ object LazDocForm: TLazDocForm
end end
object InsertCodeTagButton: TSpeedButton object InsertCodeTagButton: TSpeedButton
Align = alTop Align = alTop
Color = clBtnFace
Glyph.Data = { Glyph.Data = {
F90900002F2A2058504D202A2F0D0A7374617469632063686172202A20496E73 F90900002F2A2058504D202A2F0D0A7374617469632063686172202A20496E73
657274436F64655461675F78706D5B5D203D207B0D0A22313720313520313132 657274436F64655461675F78706D5B5D203D207B0D0A22313720313520313132
@ -355,6 +360,7 @@ object LazDocForm: TLazDocForm
end end
object InsertRemarkButton: TSpeedButton object InsertRemarkButton: TSpeedButton
Align = alTop Align = alTop
Color = clBtnFace
Glyph.Data = { Glyph.Data = {
D60100002F2A2058504D202A2F0D0A7374617469632063686172202A20496E73 D60100002F2A2058504D202A2F0D0A7374617469632063686172202A20496E73
65727452656D61726B5F78706D5B5D203D207B0D0A2231372031372032203122 65727452656D61726B5F78706D5B5D203D207B0D0A2231372031372032203122
@ -381,6 +387,7 @@ object LazDocForm: TLazDocForm
end end
object InsertVarTagButton: TSpeedButton object InsertVarTagButton: TSpeedButton
Align = alTop Align = alTop
Color = clBtnFace
Glyph.Data = { Glyph.Data = {
D70200002F2A2058504D202A2F0D0A7374617469632063686172202A20496E73 D70200002F2A2058504D202A2F0D0A7374617469632063686172202A20496E73
6572745661725461675F78706D5B5D203D207B0D0A2231372031372031382031 6572745661725461675F78706D5B5D203D207B0D0A2231372031372031382031

View File

@ -3,168 +3,168 @@
LazarusResources.Add('TLazDocForm','FORMDATA',[ LazarusResources.Add('TLazDocForm','FORMDATA',[
'TPF0'#11'TLazDocForm'#10'LazDocForm'#11'BorderStyle'#7#13'bsSizeToolWin'#7'C' 'TPF0'#11'TLazDocForm'#10'LazDocForm'#11'BorderStyle'#7#13'bsSizeToolWin'#7'C'
+'aption'#6#13'LazDoc editor'#12'ClientHeight'#2'u'#11'ClientWidth'#3#241#2#8 +'aption'#6#13'LazDoc editor'#12'ClientHeight'#2'u'#11'ClientWidth'#3#241#2#8
+'OnCreate'#7#10'FormCreate'#8'OnResize'#7#10'FormResize'#13'PixelsPerInch'#2 +'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#8'OnResize'#7#10
+'`'#18'HorzScrollBar.Page'#3#240#2#18'VertScrollBar.Page'#2't'#4'Left'#3#134 +'FormResize'#13'PixelsPerInch'#2'_'#18'HorzScrollBar.Page'#3#240#2#18'VertSc'
+#1#6'Height'#2'u'#3'Top'#3'p'#2#5'Width'#3#241#2#0#12'TPageControl'#11'PageC' +'rollBar.Page'#2't'#4'Left'#3#134#1#6'Height'#2'u'#3'Top'#3'p'#2#5'Width'#3
+'ontrol'#10'ActivePage'#7#14'ErrorsTabSheet'#5'Align'#7#8'alClient'#8'TabInd' +#241#2#0#12'TPageControl'#11'PageControl'#10'ActivePage'#7#14'ErrorsTabSheet'
+'ex'#2#2#8'TabOrder'#2#0#11'TabPosition'#7#8'tpBottom'#4'Left'#2#17#6'Height' +#5'Align'#7#8'alClient'#8'TabIndex'#2#2#8'TabOrder'#2#0#11'TabPosition'#7#8
+#2'u'#5'Width'#3#224#2#0#9'TTabSheet'#13'ShortTabSheet'#7'Caption'#6#13'Shor' +'tpBottom'#4'Left'#2#17#6'Height'#2'u'#5'Width'#3#224#2#0#9'TTabSheet'#13'Sh'
+'tTabSheet'#12'ClientHeight'#2'['#11'ClientWidth'#3#216#2#6'Height'#2'['#5'W' +'ortTabSheet'#7'Caption'#6#13'ShortTabSheet'#12'ClientHeight'#2'W'#11'Client'
+'idth'#3#216#2#0#5'TEdit'#9'ShortEdit'#5'Align'#7#5'alTop'#22'BorderSpacing.' +'Width'#3#220#2#4'Left'#2#2#6'Height'#2'W'#3'Top'#2#2#5'Width'#3#220#2#0#5'T'
+'OnChange'#13#19'BorderSpacing.Right'#2#2#8'OnChange'#7#22'DocumentationTagC' +'Edit'#9'ShortEdit'#5'Align'#7#5'alTop'#19'BorderSpacing.Right'#2#2#8'OnChan'
+'hange'#8'TabOrder'#2#0#4'Text'#6#9'ShortEdit'#6'Height'#2#23#5'Width'#3#214 +'ge'#7#22'DocumentationTagChange'#8'TabOrder'#2#0#4'Text'#6#9'ShortEdit'#6'H'
+#2#0#0#0#9'TTabSheet'#13'DescrTabSheet'#7'Caption'#6#13'DescrTabSheet'#12'Cl' +'eight'#2#23#5'Width'#3#218#2#0#0#0#9'TTabSheet'#13'DescrTabSheet'#7'Caption'
+'ientHeight'#2'['#11'ClientWidth'#3#216#2#6'Height'#2'['#5'Width'#3#216#2#0#5 +#6#13'DescrTabSheet'#12'ClientHeight'#2'W'#11'ClientWidth'#3#220#2#4'Left'#2
+'TMemo'#9'DescrMemo'#5'Align'#7#8'alClient'#19'BorderSpacing.Right'#2#2#20'B' +#2#6'Height'#2'W'#3'Top'#2#2#5'Width'#3#220#2#0#5'TMemo'#9'DescrMemo'#5'Alig'
+'orderSpacing.Bottom'#2#4#13'Lines.Strings'#1#6#9'DescrMemo'#0#8'OnChange'#7 +'n'#7#8'alClient'#19'BorderSpacing.Right'#2#2#20'BorderSpacing.Bottom'#2#4#13
+#22'DocumentationTagChange'#8'TabOrder'#2#0#6'Height'#2'W'#5'Width'#3#214#2#0 +'Lines.Strings'#1#6#9'DescrMemo'#0#8'OnChange'#7#22'DocumentationTagChange'#8
+#0#0#9'TTabSheet'#14'ErrorsTabSheet'#7'Caption'#6#14'ErrorsTabSheet'#12'Clie' +'TabOrder'#2#0#6'Height'#2'S'#5'Width'#3#218#2#0#0#0#9'TTabSheet'#14'ErrorsT'
+'ntHeight'#2'['#11'ClientWidth'#3#216#2#6'Height'#2'['#5'Width'#3#216#2#0#5 +'abSheet'#7'Caption'#6#14'ErrorsTabSheet'#12'ClientHeight'#2'W'#11'ClientWid'
+'TMemo'#10'ErrorsMemo'#5'Align'#7#8'alClient'#22'BorderSpacing.OnChange'#13 +'th'#3#220#2#4'Left'#2#2#6'Height'#2'W'#3'Top'#2#2#5'Width'#3#220#2#0#5'TMem'
+#19'BorderSpacing.Right'#2#2#20'BorderSpacing.Bottom'#2#4#13'Lines.Strings'#1 +'o'#10'ErrorsMemo'#5'Align'#7#8'alClient'#19'BorderSpacing.Right'#2#2#20'Bor'
+#6#10'ErrorsMemo'#0#8'OnChange'#7#22'DocumentationTagChange'#8'TabOrder'#2#0 +'derSpacing.Bottom'#2#4#13'Lines.Strings'#1#6#10'ErrorsMemo'#0#8'OnChange'#7
+#6'Height'#2'W'#5'Width'#3#214#2#0#0#0#9'TTabSheet'#15'SeeAlsoTabSheet'#7'Ca' +#22'DocumentationTagChange'#8'TabOrder'#2#0#6'Height'#2'S'#5'Width'#3#218#2#0
+'ption'#6#15'SeeAlsoTabSheet'#12'ClientHeight'#2'['#11'ClientWidth'#3#216#2#6 +#0#0#9'TTabSheet'#15'SeeAlsoTabSheet'#7'Caption'#6#15'SeeAlsoTabSheet'#12'Cl'
+'Height'#2'['#5'Width'#3#216#2#0#8'TListBox'#11'LinkListBox'#5'Align'#7#8'al' +'ientHeight'#2'W'#11'ClientWidth'#3#220#2#4'Left'#2#2#6'Height'#2'W'#3'Top'#2
+'Bottom'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#22'Border' +#2#5'Width'#3#220#2#0#8'TListBox'#11'LinkListBox'#5'Align'#7#8'alBottom'#7'A'
+'Spacing.OnChange'#13#19'BorderSpacing.Right'#2#2#20'BorderSpacing.Bottom'#2 +'nchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#19'BorderSpacing.Rig'
+#4#7'OnClick'#7#16'LinkListBoxClick'#8'TabOrder'#2#0#6'Height'#2'<'#3'Top'#2 +'ht'#2#2#20'BorderSpacing.Bottom'#2#4#7'OnClick'#7#16'LinkListBoxClick'#8'Ta'
+#27#5'Width'#3#214#2#0#0#7'TButton'#13'AddLinkButton'#7'Anchors'#11#5'akTop' +'bOrder'#2#0#8'TopIndex'#2#255#6'Height'#2'8'#3'Top'#2#27#5'Width'#3#218#2#0
+#7'akRight'#0#8'AutoSize'#9#22'BorderSpacing.OnChange'#13#19'BorderSpacing.R' +#0#7'TButton'#13'AddLinkButton'#7'Anchors'#11#5'akTop'#7'akRight'#0#8'AutoSi'
+'ight'#2#6#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#13'AddLinkButton'#7 +'ze'#9#19'BorderSpacing.Right'#2#6#25'BorderSpacing.InnerBorder'#2#2#7'Capti'
+'OnClick'#7#18'AddLinkButtonClick'#8'TabOrder'#2#1#23'AnchorSideRight.Contro' +'on'#6#13'AddLinkButton'#7'OnClick'#7#18'AddLinkButtonClick'#8'TabOrder'#2#1
+'l'#7#16'DeleteLinkButton'#4'Left'#3':'#2#6'Height'#2#23#5'Width'#2'K'#0#0#7 +#23'AnchorSideRight.Control'#7#16'DeleteLinkButton'#4'Left'#3'>'#2#6'Height'
+'TButton'#16'DeleteLinkButton'#7'Anchors'#11#5'akTop'#7'akRight'#0#8'AutoSiz' +#2#23#5'Width'#2'K'#0#0#7'TButton'#16'DeleteLinkButton'#7'Anchors'#11#5'akTo'
+'e'#9#22'BorderSpacing.OnChange'#13#25'BorderSpacing.InnerBorder'#2#2#7'Capt' +'p'#7'akRight'#0#8'AutoSize'#9#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6
+'ion'#6#16'DeleteLinkButton'#7'OnClick'#7#21'DeleteLinkButtonClick'#8'TabOrd' +#16'DeleteLinkButton'#7'OnClick'#7#21'DeleteLinkButtonClick'#8'TabOrder'#2#2
+'er'#2#2#4'Left'#3#139#2#6'Height'#2#23#5'Width'#2'K'#0#0#5'TEdit'#12'LinkTe' +#4'Left'#3#143#2#6'Height'#2#23#5'Width'#2'K'#0#0#5'TEdit'#12'LinkTextEdit'#8
+'xtEdit'#22'BorderSpacing.OnChange'#13#8'OnChange'#7#10'LinkChange'#8'TabOrd' +'OnChange'#7#10'LinkChange'#8'TabOrder'#2#3#4'Text'#6#12'LinkTextEdit'#4'Lef'
+'er'#2#3#4'Text'#6#12'LinkTextEdit'#4'Left'#3#235#0#6'Height'#2#21#3'Top'#2#1 +'t'#3#235#0#6'Height'#2#21#3'Top'#2#1#5'Width'#3'H'#1#0#0#9'TComboBox'#14'Li'
+#5'Width'#3'H'#1#0#0#9'TComboBox'#14'LinkIdComboBox'#9'MaxLength'#2#0#8'OnCh' +'nkIdComboBox'#16'AutoCompleteText'#11#22'cbactEndOfLineComplete'#20'cbactSe'
+'ange'#7#10'LinkChange'#8'TabOrder'#2#4#4'Text'#6#14'LinkIdComboBox'#6'Heigh' +'archAscending'#0#9'MaxLength'#2#0#8'OnChange'#7#10'LinkChange'#8'TabOrder'#2
+'t'#2#21#3'Top'#2#1#5'Width'#3#227#0#0#0#0#9'TTabSheet'#15'ExampleTabSheet'#7 +#4#4'Text'#6#14'LinkIdComboBox'#6'Height'#2#21#3'Top'#2#1#5'Width'#3#227#0#0
+'Caption'#6#15'ExampleTabSheet'#12'ClientHeight'#2'['#11'ClientWidth'#3#216#2 +#0#0#9'TTabSheet'#15'ExampleTabSheet'#7'Caption'#6#15'ExampleTabSheet'#12'Cl'
+#6'Height'#2'['#5'Width'#3#216#2#0#5'TEdit'#11'ExampleEdit'#5'Align'#7#5'alT' +'ientHeight'#2'W'#11'ClientWidth'#3#220#2#4'Left'#2#2#6'Height'#2'W'#3'Top'#2
+'op'#22'BorderSpacing.OnChange'#13#19'BorderSpacing.Right'#2#2#8'OnChange'#7 +#2#5'Width'#3#220#2#0#5'TEdit'#11'ExampleEdit'#5'Align'#7#5'alTop'#19'Border'
+#22'DocumentationTagChange'#8'TabOrder'#2#0#4'Text'#6#11'ExampleEdit'#6'Heig' +'Spacing.Right'#2#2#8'OnChange'#7#22'DocumentationTagChange'#8'TabOrder'#2#0
+'ht'#2#23#5'Width'#3#214#2#0#0#7'TButton'#19'BrowseExampleButton'#7'Anchors' +#4'Text'#6#11'ExampleEdit'#6'Height'#2#23#5'Width'#3#218#2#0#0#7'TButton'#19
+#11#5'akTop'#7'akRight'#0#8'AutoSize'#9#22'BorderSpacing.OnChange'#13#25'Bor' +'BrowseExampleButton'#7'Anchors'#11#5'akTop'#7'akRight'#0#8'AutoSize'#9#25'B'
+'derSpacing.InnerBorder'#2#2#7'Caption'#6#19'BrowseExampleButton'#7'OnClick' +'orderSpacing.InnerBorder'#2#2#7'Caption'#6#19'BrowseExampleButton'#7'OnClic'
+#7#24'BrowseExampleButtonClick'#8'TabOrder'#2#1#4'Left'#3#139#2#6'Height'#2 +'k'#7#24'BrowseExampleButtonClick'#8'TabOrder'#2#1#4'Left'#3#143#2#6'Height'
+#25#3'Top'#2#28#5'Width'#2'K'#0#0#0#0#6'TPanel'#6'Panel1'#5'Align'#7#6'alLef' +#2#25#3'Top'#2#28#5'Width'#2'K'#0#0#0#0#6'TPanel'#6'Panel1'#5'Align'#7#6'alL'
+'t'#22'BorderSpacing.OnChange'#13#10'BevelOuter'#7#6'bvNone'#12'ClientHeight' +'eft'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'u'#11'ClientWidth'#2#17
+#2'u'#11'ClientWidth'#2#17#11'FullRepaint'#8#14'ParentShowHint'#8#8'ShowHint' +#11'FullRepaint'#8#14'ParentShowHint'#8#8'ShowHint'#9#8'TabOrder'#2#1#6'Heig'
+#9#8'TabOrder'#2#1#6'Height'#2'u'#5'Width'#2#17#0#12'TSpeedButton'#16'BoldFo' +'ht'#2'u'#5'Width'#2#17#0#12'TSpeedButton'#16'BoldFormatButton'#5'Align'#7#5
+'rmatButton'#5'Align'#7#5'alTop'#22'BorderSpacing.OnChange'#13#10'Glyph.Data' +'alTop'#5'Color'#7#9'clBtnFace'#10'Glyph.Data'#10#182#1#0#0#178#1#0#0'/* XPM'
+#10#182#1#0#0#178#1#0#0'/* XPM */'#10'static char *graphic[] = {'#10'"17 17 ' +' */'#10'static char *graphic[] = {'#10'"17 17 2 1",'#10'". c None",'#10'", '
+'2 1",'#10'". c None",'#10'", c #000000",'#10'".................",'#10'"....' +'c #000000",'#10'".................",'#10'".................",'#10'"........'
+'.............",'#10'".................",'#10'".................",'#10'"....' +'.........",'#10'".................",'#10'"....,,,,,,,,.....",'#10'".....,,,'
+',,,,,,,,.....",'#10'".....,,,..,,,....",'#10'".....,,,..,,,....",'#10'"....' +'..,,,....",'#10'".....,,,..,,,....",'#10'".....,,,..,,,....",'#10'".....,,,'
+'.,,,..,,,....",'#10'".....,,,,,,,.....",'#10'".....,,,..,,,....",'#10'"....' +',,,,.....",'#10'".....,,,..,,,....",'#10'".....,,,..,,,....",'#10'".....,,,'
+'.,,,..,,,....",'#10'".....,,,..,,,....",'#10'"....,,,,,,,,.....",'#10'"....' +'..,,,....",'#10'"....,,,,,,,,.....",'#10'".................",'#10'"........'
+'.............",'#10'".................",'#10'".................",'#10'"....' +'.........",'#10'".................",'#10'"................."}'#10#9'NumGlyp'
+'............."}'#10#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#6'H' +'hs'#2#0#7'OnClick'#7#17'FormatButtonClick'#6'Height'#2#17#5'Width'#2#17#0#0
+'eight'#2#17#5'Width'#2#17#0#0#12'TSpeedButton'#18'ItalicFormatButton'#5'Ali' +#12'TSpeedButton'#18'ItalicFormatButton'#5'Align'#7#5'alTop'#5'Color'#7#9'cl'
,'gn'#7#5'alTop'#22'BorderSpacing.OnChange'#13#10'Glyph.Data'#10#197#1#0#0#193 ,'BtnFace'#10'Glyph.Data'#10#197#1#0#0#193#1#0#0'/* XPM */'#10'static char *g'
+#1#0#0'/* XPM */'#10'static char *graphic[] = {'#10'"17 17 3 1",'#10'". c No' +'raphic[] = {'#10'"17 17 3 1",'#10'". c None",'#10'", c #000000",'#10'"- c #'
+'ne",'#10'", c #000000",'#10'"- c #9696AF",'#10'".................",'#10'"..' +'9696AF",'#10'".................",'#10'".................",'#10'"...........'
+'...............",'#10'".................",'#10'"........,,,,,....",'#10'"..' +'......",'#10'"........,,,,,....",'#10'".........,,-.....",'#10'"........-,,'
+'.......,,-.....",'#10'"........-,,......",'#10'"........,,-......",'#10'"..' +'......",'#10'"........,,-......",'#10'".......-,,.......",'#10'".......,,-.'
+'.....-,,.......",'#10'".......,,-.......",'#10'"......-,,........",'#10'"..' +'......",'#10'"......-,,........",'#10'"......,,-........",'#10'"....,,,,,,.'
+'....,,-........",'#10'"....,,,,,,.......",'#10'".................",'#10'"..' +'......",'#10'".................",'#10'".................",'#10'"...........'
+'...............",'#10'".................",'#10'".................",'#10'"..' +'......",'#10'".................",'#10'"................."}'#10#9'NumGlyphs'
+'..............."}'#10#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#6 +#2#0#7'OnClick'#7#17'FormatButtonClick'#6'Height'#2#17#3'Top'#2#17#5'Width'#2
+'Height'#2#17#3'Top'#2#17#5'Width'#2#17#3'Tag'#2#1#0#0#12'TSpeedButton'#21'U' +#17#3'Tag'#2#1#0#0#12'TSpeedButton'#21'UnderlineFormatButton'#5'Align'#7#5'a'
+'nderlineFormatButton'#5'Align'#7#5'alTop'#22'BorderSpacing.OnChange'#13#10 +'lTop'#5'Color'#7#9'clBtnFace'#10'Glyph.Data'#10#197#1#0#0#193#1#0#0'/* XPM '
+'Glyph.Data'#10#197#1#0#0#193#1#0#0'/* XPM */'#10'static char *graphic[] = {' +'*/'#10'static char *graphic[] = {'#10'"17 17 3 1",'#10'". c None",'#10'", c'
+#10'"17 17 3 1",'#10'". c None",'#10'", c #000000",'#10'"- c #848484",'#10'"' +' #000000",'#10'"- c #848484",'#10'".................",'#10'"...............'
+'.................",'#10'".................",'#10'".................",'#10'"' +'..",'#10'".................",'#10'"....,,,,.,,,,....",'#10'".....,,...,,...'
+'....,,,,.,,,,....",'#10'".....,,...,,.....",'#10'".....,,...,,.....",'#10'"' +'..",'#10'".....,,...,,.....",'#10'".....,,...,,.....",'#10'".....,,...,,...'
+'.....,,...,,.....",'#10'".....,,...,,.....",'#10'".....,,...,,.....",'#10'"' +'..",'#10'".....,,...,,.....",'#10'".....,,...,,.....",'#10'".....,,-.-,,...'
+'.....,,...,,.....",'#10'".....,,-.-,,.....",'#10'"......,,,,,......",'#10'"' +'..",'#10'"......,,,,,......",'#10'".................",'#10'"....,,,,,,,,,..'
+'.................",'#10'"....,,,,,,,,,....",'#10'".................",'#10'"' +'..",'#10'".................",'#10'".................",'#10'"...............'
+'.................",'#10'"................."}'#10#9'NumGlyphs'#2#0#7'OnClick' +'.."}'#10#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#6'Height'#2#17
+#7#17'FormatButtonClick'#6'Height'#2#17#3'Top'#2'"'#5'Width'#2#17#3'Tag'#2#2 +#3'Top'#2'"'#5'Width'#2#17#3'Tag'#2#2#0#0#12'TSpeedButton'#19'InsertCodeTagB'
+#0#0#12'TSpeedButton'#19'InsertCodeTagButton'#5'Align'#7#5'alTop'#10'Glyph.D' +'utton'#5'Align'#7#5'alTop'#5'Color'#7#9'clBtnFace'#10'Glyph.Data'#10#253#9#0
+'ata'#10#253#9#0#0#249#9#0#0'/* XPM */'#13#10'static char * InsertCodeTag_xp' +#0#249#9#0#0'/* XPM */'#13#10'static char * InsertCodeTag_xpm[] = {'#13#10'"'
+'m[] = {'#13#10'"17 15 112 2",'#13#10'" '#9'c None",'#13#10'". '#9'c #ECE9D' +'17 15 112 2",'#13#10'" '#9'c None",'#13#10'". '#9'c #ECE9D8",'#13#10'"+ '#9
+'8",'#13#10'"+ '#9'c #FFF0CF",'#13#10'"@ '#9'c #FFEDC5",'#13#10'"# '#9'c #FB' +'c #FFF0CF",'#13#10'"@ '#9'c #FFEDC5",'#13#10'"# '#9'c #FBE8C5",'#13#10'"$ '
+'E8C5",'#13#10'"$ '#9'c #EDDAC5",'#13#10'"% '#9'c #F4E8DB",'#13#10'"& '#9'c ' +#9'c #EDDAC5",'#13#10'"% '#9'c #F4E8DB",'#13#10'"& '#9'c #FAEDD5",'#13#10'"*'
+'#FAEDD5",'#13#10'"* '#9'c #F3D49E",'#13#10'"= '#9'c #BF9855",'#13#10'"- '#9 +' '#9'c #F3D49E",'#13#10'"= '#9'c #BF9855",'#13#10'"- '#9'c #C89D55",'#13#10
+'c #C89D55",'#13#10'"; '#9'c #BC8E5A",'#13#10'"> '#9'c #7C6135",'#13#10'", ' +'"; '#9'c #BC8E5A",'#13#10'"> '#9'c #7C6135",'#13#10'", '#9'c #B18655",'#13
+#9'c #B18655",'#13#10'"'' '#9'c #916940",'#13#10'") '#9'c #C3AC93",'#13#10'"' +#10'"'' '#9'c #916940",'#13#10'") '#9'c #C3AC93",'#13#10'"! '#9'c #CCA76A",'
+'! '#9'c #CCA76A",'#13#10'"~ '#9'c #80684A",'#13#10'"{ '#9'c #DCAA63",'#13#10 +#13#10'"~ '#9'c #80684A",'#13#10'"{ '#9'c #DCAA63",'#13#10'"] '#9'c #A8834A"'
+'"] '#9'c #A8834A",'#13#10'"^ '#9'c #977443",'#13#10'"/ '#9'c #B99052",'#13 +','#13#10'"^ '#9'c #977443",'#13#10'"/ '#9'c #B99052",'#13#10'"( '#9'c #9470'
+#10'"( '#9'c #947047",'#13#10'"_ '#9'c #896842",'#13#10'": '#9'c #C4955E",' +'47",'#13#10'"_ '#9'c #896842",'#13#10'": '#9'c #C4955E",'#13#10'"< '#9'c #8'
+#13#10'"< '#9'c #87653F",'#13#10'"[ '#9'c #A37A4E",'#13#10'"} '#9'c #F0E1CF"' +'7653F",'#13#10'"[ '#9'c #A37A4E",'#13#10'"} '#9'c #F0E1CF",'#13#10'"| '#9'c'
+','#13#10'"| '#9'c #BD964F",'#13#10'"1 '#9'c #977740",'#13#10'"2 '#9'c #7C60' +' #BD964F",'#13#10'"1 '#9'c #977740",'#13#10'"2 '#9'c #7C6038",'#13#10'"3 '#9
+'38",'#13#10'"3 '#9'c #9C7749",'#13#10'"4 '#9'c #866340",'#13#10'"5 '#9'c #B' +'c #9C7749",'#13#10'"4 '#9'c #866340",'#13#10'"5 '#9'c #BA8D59",'#13#10'"6 '
+'A8D59",'#13#10'"6 '#9'c #634430",'#13#10'"7 '#9'c #8A6542",'#13#10'"8 '#9'c' +#9'c #634430",'#13#10'"7 '#9'c #8A6542",'#13#10'"8 '#9'c #C99761",'#13#10'"9'
+' #C99761",'#13#10'"9 '#9'c #CC9B62",'#13#10'"0 '#9'c #6C5842",'#13#10'"a '#9 +' '#9'c #CC9B62",'#13#10'"0 '#9'c #6C5842",'#13#10'"a '#9'c #82705A",'#13#10
+'c #82705A",'#13#10'"b '#9'c #A47C4F",'#13#10'"c '#9'c #614A2F",'#13#10'"d ' +'"b '#9'c #A47C4F",'#13#10'"c '#9'c #614A2F",'#13#10'"d '#9'c #906C45",'#13
+#9'c #906C45",'#13#10'"e '#9'c #7C513C",'#13#10'"f '#9'c #AD7F54",'#13#10'"g' +#10'"e '#9'c #7C513C",'#13#10'"f '#9'c #AD7F54",'#13#10'"g '#9'c #B78858",'
+' '#9'c #B78858",'#13#10'"h '#9'c #A4825B",'#13#10'"i '#9'c #8D7A65",'#13#10 +#13#10'"h '#9'c #A4825B",'#13#10'"i '#9'c #8D7A65",'#13#10'"j '#9'c #927D67"'
+'"j '#9'c #927D67",'#13#10'"k '#9'c #93705B",'#13#10'"l '#9'c #3F3636",'#13 +','#13#10'"k '#9'c #93705B",'#13#10'"l '#9'c #3F3636",'#13#10'"m '#9'c #D3D3'
+#10'"m '#9'c #D3D3D3",'#13#10'"n '#9'c #CE9E60",'#13#10'"o '#9'c #755738",' +'D3",'#13#10'"n '#9'c #CE9E60",'#13#10'"o '#9'c #755738",'#13#10'"p '#9'c #A'
+#13#10'"p '#9'c #A77951",'#13#10'"q '#9'c #CE9C63",'#13#10'"r '#9'c #3B271D"' +'77951",'#13#10'"q '#9'c #CE9C63",'#13#10'"r '#9'c #3B271D",'#13#10'"s '#9'c'
+','#13#10'"s '#9'c #825F4B",'#13#10'"t '#9'c #D6D5D3",'#13#10'"u '#9'c #EEEA' +' #825F4B",'#13#10'"t '#9'c #D6D5D3",'#13#10'"u '#9'c #EEEAE0",'#13#10'"v '#9
+'E0",'#13#10'"v '#9'c #AB7A53",'#13#10'"w '#9'c #745438",'#13#10'"x '#9'c #A' +'c #AB7A53",'#13#10'"w '#9'c #745438",'#13#10'"x '#9'c #A77B50",'#13#10'"y '
+'77B50",'#13#10'"y '#9'c #948B83",'#13#10'"z '#9'c #261313",'#13#10'"A '#9'c' +#9'c #948B83",'#13#10'"z '#9'c #261313",'#13#10'"A '#9'c #8B6843",'#13#10'"B'
+' #8B6843",'#13#10'"B '#9'c #634730",'#13#10'"C '#9'c #4B3924",'#13#10'"D '#9 +' '#9'c #634730",'#13#10'"C '#9'c #4B3924",'#13#10'"D '#9'c #B58757",'#13#10
+'c #B58757",'#13#10'"E '#9'c #816347",'#13#10'"F '#9'c #ECEAE0",'#13#10'"G ' +'"E '#9'c #816347",'#13#10'"F '#9'c #ECEAE0",'#13#10'"G '#9'c #735438",'#13
+#9'c #735438",'#13#10'"H '#9'c #A2774E",'#13#10'"I '#9'c #C0915C",'#13#10'"J' +#10'"H '#9'c #A2774E",'#13#10'"I '#9'c #C0915C",'#13#10'"J '#9'c #A37B4E",'
+' '#9'c #A37B4E",'#13#10'"K '#9'c #6D5134",'#13#10'"L '#9'c #7C593C",'#13#10 +#13#10'"K '#9'c #6D5134",'#13#10'"L '#9'c #7C593C",'#13#10'"M '#9'c #917C63"'
+'"M '#9'c #917C63",'#13#10'"N '#9'c #99938C",'#13#10'"O '#9'c #B5B1AC",'#13 +','#13#10'"N '#9'c #99938C",'#13#10'"O '#9'c #B5B1AC",'#13#10'"P '#9'c #E8E8'
+#10'"P '#9'c #E8E8E8",'#13#10'"Q '#9'c #866B4D",'#13#10'"R '#9'c #8C6D49",' +'E8",'#13#10'"Q '#9'c #866B4D",'#13#10'"R '#9'c #8C6D49",'#13#10'"S '#9'c #6'
+#13#10'"S '#9'c #684F32",'#13#10'"T '#9'c #1D130E",'#13#10'"U '#9'c #B58657"' +'84F32",'#13#10'"T '#9'c #1D130E",'#13#10'"U '#9'c #B58657",'#13#10'"V '#9'c'
+','#13#10'"V '#9'c #8E6C44",'#13#10'"W '#9'c #A67E50",'#13#10'"X '#9'c #8162' +' #8E6C44",'#13#10'"W '#9'c #A67E50",'#13#10'"X '#9'c #81623E",'#13#10'"Y '#9
+'3E",'#13#10'"Y '#9'c #6D5234",'#13#10'"Z '#9'c #5F4D37",'#13#10'"` '#9'c #9' +'c #6D5234",'#13#10'"Z '#9'c #5F4D37",'#13#10'"` '#9'c #978E85",'#13#10'" .'
+'78E85",'#13#10'" .'#9'c #ECEAE2",'#13#10'"..'#9'c #CAC7C4",'#13#10'"+.'#9'c' +#9'c #ECEAE2",'#13#10'"..'#9'c #CAC7C4",'#13#10'"+.'#9'c #8F7658",'#13#10'"@'
+' #8F7658",'#13#10'"@.'#9'c #4A3124",'#13#10'"#.'#9'c #B98859",'#13#10'"$.'#9 +'.'#9'c #4A3124",'#13#10'"#.'#9'c #B98859",'#13#10'"$.'#9'c #885842",'#13#10
+'c #885842",'#13#10'"%.'#9'c #463222",'#13#10'"&.'#9'c #CB9A62",'#13#10'"*.' +'"%.'#9'c #463222",'#13#10'"&.'#9'c #CB9A62",'#13#10'"*.'#9'c #3D231E",'#13
+#9'c #3D231E",'#13#10'"=.'#9'c #39271C",'#13#10'"-.'#9'c #876E51",'#13#10'";' +#10'"=.'#9'c #39271C",'#13#10'"-.'#9'c #876E51",'#13#10'";.'#9'c #938778",'
+'.'#9'c #938778",'#13#10'">.'#9'c #D7D5D3",'#13#10'",.'#9'c #DFDFDF",'#13#10 +#13#10'">.'#9'c #D7D5D3",'#13#10'",.'#9'c #DFDFDF",'#13#10'"''.'#9'c #9E9891'
+'"''.'#9'c #9E9891",'#13#10'").'#9'c #908C87",'#13#10'"!.'#9'c #918A88",'#13 +'",'#13#10'").'#9'c #908C87",'#13#10'"!.'#9'c #918A88",'#13#10'"~.'#9'c #8F8'
+#10'"~.'#9'c #8F8B87",'#13#10'"{.'#9'c #989188",'#13#10'"].'#9'c #BEBAB5",' +'B87",'#13#10'"{.'#9'c #989188",'#13#10'"].'#9'c #BEBAB5",'#13#10'". . . . .'
+#13#10'". . . . . . . . . . . . . . . . . ",'#13#10'". . . . . . . . . . . .' +' . . . . . . . . . . . . ",'#13#10'". . . . . . . . . . . . . . . . . ",'#13
+' . . . . . ",'#13#10'". . . . . + @ # $ % . . . . . . . ",'#13#10'". . & * ' +#10'". . . . . + @ # $ % . . . . . . . ",'#13#10'". . & * = - ; > , '' ) . .'
+'= - ; > , '' ) . . . . . . ",'#13#10'"! ~ { ] ^ / ( _ : < [ } . . . . . ",' +' . . . . ",'#13#10'"! ~ { ] ^ / ( _ : < [ } . . . . . ",'#13#10'"| 1 2 3 4 '
,#13#10'"| 1 2 3 4 5 6 7 8 9 0 a . . . . . ",'#13#10'"b c d e f g h i j k l m' ,'5 6 7 8 9 0 a . . . . . ",'#13#10'"b c d e f g h i j k l m . . . . . ",'#13
+' . . . . . ",'#13#10'"n o p q r s t . . . u . . . . . . ",'#13#10'", q v w ' +#10'"n o p q r s t . . . u . . . . . . ",'#13#10'", q v w x y . . . . . . . '
+'x y . . . . . . . . . . . ",'#13#10'"z A B C D E F . . . . . . . . . . ",' +'. . . . ",'#13#10'"z A B C D E F . . . . . . . . . . ",'#13#10'"G H I J K L'
+#13#10'"G H I J K L M N N O P . . . . . . ",'#13#10'"Q R S T U V W X X Y Z `' +' M N N O P . . . . . . ",'#13#10'"Q R S T U V W X X Y Z ` .. . . . ",'#13
+' .. . . . ",'#13#10'". ..+.@.#.$.%.9 q &.*.=.X -.;.>.. ",'#13#10'". . . ,.' +#10'". ..+.@.#.$.%.9 q &.*.=.X -.;.>.. ",'#13#10'". . . ,.''.N ).N N N !.~.{'
+'''.N ).N N N !.~.{.-.-.].. ",'#13#10'". . . . . . . . . . . . . . . . . "};' +'.-.-.].. ",'#13#10'". . . . . . . . . . . . . . . . . "};'#13#10#9'NumGlyph'
+#13#10#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#6'Height'#2#17#3 +'s'#2#0#7'OnClick'#7#17'FormatButtonClick'#6'Height'#2#17#3'Top'#2'3'#5'Widt'
+'Top'#2'3'#5'Width'#2#17#3'Tag'#2#3#0#0#12'TSpeedButton'#18'InsertRemarkButt' +'h'#2#17#3'Tag'#2#3#0#0#12'TSpeedButton'#18'InsertRemarkButton'#5'Align'#7#5
+'on'#5'Align'#7#5'alTop'#10'Glyph.Data'#10#218#1#0#0#214#1#0#0'/* XPM */'#13 +'alTop'#5'Color'#7#9'clBtnFace'#10'Glyph.Data'#10#218#1#0#0#214#1#0#0'/* XPM'
+#10'static char * InsertRemark_xpm[] = {'#13#10'"17 17 2 1",'#13#10'" '#9'c ' +' */'#13#10'static char * InsertRemark_xpm[] = {'#13#10'"17 17 2 1",'#13#10
+'#ECE9D8",'#13#10'".'#9'c #0000FF",'#13#10'" ",'#13#10'" ' +'" '#9'c #ECE9D8",'#13#10'".'#9'c #0000FF",'#13#10'" ",'#13
+' ",'#13#10'" ",'#13#10'" ... ... ",'#13 +#10'" ",'#13#10'" ",'#13#10'" ... ... '
+#10'" .. .. ",'#13#10'" .. .. ",'#13#10'" .. .. ' +' ",'#13#10'" .. .. ",'#13#10'" .. .. ",'#13#10'" .. '
+' ",'#13#10'" .. .. ",'#13#10'" ... ... ",'#13#10'" .. ' +' .. ",'#13#10'" .. .. ",'#13#10'" ... ... ",'#13#10
+' .. ",'#13#10'" .. .. ",'#13#10'" .. .. ",'#13#10 +'" .. .. ",'#13#10'" .. .. ",'#13#10'" .. .. "'
+'" .. .. ",'#13#10'" ... ... ",'#13#10'" "' +','#13#10'" .. .. ",'#13#10'" ... ... ",'#13#10'" '
+','#13#10'" ",'#13#10'" "};'#13#10#9'NumGlyp' +' ",'#13#10'" ",'#13#10'" "};'#13#10#9
+'hs'#2#0#7'OnClick'#7#17'FormatButtonClick'#6'Height'#2#17#3'Top'#2'D'#5'Wid' +'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#6'Height'#2#17#3'Top'#2'D'
+'th'#2#17#3'Tag'#2#4#0#0#12'TSpeedButton'#18'InsertVarTagButton'#5'Align'#7#5 +#5'Width'#2#17#3'Tag'#2#4#0#0#12'TSpeedButton'#18'InsertVarTagButton'#5'Alig'
+'alTop'#10'Glyph.Data'#10#219#2#0#0#215#2#0#0'/* XPM */'#13#10'static char *' +'n'#7#5'alTop'#5'Color'#7#9'clBtnFace'#10'Glyph.Data'#10#219#2#0#0#215#2#0#0
+' InsertVarTag_xpm[] = {'#13#10'"17 17 18 1",'#13#10'" '#9'c #ECE9D8",'#13#10 +'/* XPM */'#13#10'static char * InsertVarTag_xpm[] = {'#13#10'"17 17 18 1",'
+'".'#9'c #D4D4D4",'#13#10'"+'#9'c #AAAAAA",'#13#10'"@'#9'c #E6E6E6",'#13#10 +#13#10'" '#9'c #ECE9D8",'#13#10'".'#9'c #D4D4D4",'#13#10'"+'#9'c #AAAAAA",'
+'"#'#9'c #000000",'#13#10'"$'#9'c #CCCCCC",'#13#10'"%'#9'c #C4C4C4",'#13#10 +#13#10'"@'#9'c #E6E6E6",'#13#10'"#'#9'c #000000",'#13#10'"$'#9'c #CCCCCC",'
+'"&'#9'c #888888",'#13#10'"*'#9'c #444444",'#13#10'"='#9'c #999999",'#13#10 +#13#10'"%'#9'c #C4C4C4",'#13#10'"&'#9'c #888888",'#13#10'"*'#9'c #444444",'
+'"-'#9'c #666666",'#13#10'";'#9'c #222222",'#13#10'">'#9'c #BBBBBB",'#13#10 +#13#10'"='#9'c #999999",'#13#10'"-'#9'c #666666",'#13#10'";'#9'c #222222",'
+'",'#9'c #5E5E5E",'#13#10'"'''#9'c #808080",'#13#10'")'#9'c #FFFFFF",'#13#10 +#13#10'">'#9'c #BBBBBB",'#13#10'",'#9'c #5E5E5E",'#13#10'"'''#9'c #808080",'
+'"!'#9'c #777777",'#13#10'"~'#9'c #4C4C4C",'#13#10'" ",'#13 +#13#10'")'#9'c #FFFFFF",'#13#10'"!'#9'c #777777",'#13#10'"~'#9'c #4C4C4C",'
+#10'" ",'#13#10'" ",'#13#10'" ' +#13#10'" ",'#13#10'" ",'#13#10'" '
+' ",'#13#10'" ",'#13#10'" ",'#13#10'" .+++.'
+'.++ .+++ ",'#13#10'" @#$#@%&*=@-;&> ",'#13#10'" ,*, ;>,'')'''' ",'#13
+#10'" .;. -!~~>~~> ",'#13#10'" ",'#13#10'" '
+' ",'#13#10'" ",'#13#10'" ",'#13#10'" ' +' ",'#13#10'" ",'#13#10'" ",'#13#10'" '
+' ",'#13#10'" ",'#13#10'" "};'#13 +' ",'#13#10'" .+++..++ .+++ ",'#13#10'" @#$#@%&*=@-;&> ",'#13
+#10#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#6'Height'#2#17#3'Top' +#10'" ,*, ;>,'')'''' ",'#13#10'" .;. -!~~>~~> ",'#13#10'" '
+#2'U'#5'Width'#2#17#3'Tag'#2#5#0#0#0#11'TOpenDialog'#10'OpenDialog'#5'Title' +' ",'#13#10'" ",'#13#10'" ",'#13#10'" '
+#6#17'Open example file'#6'Filter'#6#28'pascal file|*.pas; *.pp; *.p'#11'Fil' +' ",'#13#10'" ",'#13#10'" ",'#13
+'terIndex'#2#0#5'Title'#6#17'Open example file'#4'left'#2'@'#3'top'#2#24#0#0 +#10'" "};'#13#10#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButt'
+#0 +'onClick'#6'Height'#2#17#3'Top'#2'U'#5'Width'#2#17#3'Tag'#2#5#0#0#0#11'TOpen'
+'Dialog'#10'OpenDialog'#5'Title'#6#17'Open example file'#6'Filter'#6#28'pasc'
+'al file|*.pas; *.pp; *.p'#11'FilterIndex'#2#0#5'Title'#6#17'Open example fi'
+'le'#4'left'#2'@'#3'top'#2#24#0#0#0
]); ]);

View File

@ -38,25 +38,14 @@ unit LazDocFrm;
interface interface
uses uses
Buttons, Classes, SysUtils, StrUtils,
Classes, LCLProc, LResources, StdCtrls, Buttons, ComCtrls, Controls, Dialogs,
ComCtrls, ExtCtrls, Forms, Graphics,
Controls,
Dialogs,
DOM,
ExtCtrls,
Forms,
Graphics,
IDEProcs,
LazarusIDEStrConsts,
LCLProc,
LResources,
StdCtrls,
StrUtils,
SynEdit, SynEdit,
SysUtils, CodeToolManager, CodeCache,
XMLread, Laz_DOM, Laz_XMLRead, Laz_XMLWrite,
XMLwrite; HelpIntf,
IDEProcs, LazarusIDEStrConsts;
const const
SHORT = 1; SHORT = 1;
@ -101,43 +90,42 @@ type
procedure DeleteLinkButtonClick(Sender: TObject); procedure DeleteLinkButtonClick(Sender: TObject);
procedure DocumentationTagChange(Sender: TObject); procedure DocumentationTagChange(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormResize(Sender: TObject); procedure FormResize(Sender: TObject);
procedure FormatButtonClick(Sender: TObject); procedure FormatButtonClick(Sender: TObject);
procedure LinkChange(Sender: TObject); procedure LinkChange(Sender: TObject);
procedure LinkListBoxClick(Sender: TObject); procedure LinkListBoxClick(Sender: TObject);
private private
{ private declarations }
FLinkIndex: Integer;
FChanged: Boolean; FChanged: Boolean;
FCurrentElement: TPascalHelpContextList;
FDoc: TXMLdocument;
FDocFileName: String; FDocFileName: String;
FCurrentElement: String; FLinkIndex: Integer;
FLastElement: String;
function GetModuleNode: TDOMNode;
function GetFirstElement: TDOMNode;
procedure GetElementList;
function MakeLink: String;
procedure SetDocFileName(Value: String);
procedure InsertElement(ElementName: String);
function NodeByName(ElementName: String): TDOMNode;
function GetFirstChildValue(n: TDOMNode): String;
function ElementFromNode(Node: TDOMNode): TFPDocNode; function ElementFromNode(Node: TDOMNode): TFPDocNode;
function ExtractFuncProc(startpos: tpoint; keyword: String; function ExtractFuncProc(const startpos: TPoint; const keyword: String;
src: tStrings): String; src: tStrings): String;
function GetNearestSourceElement(source: tStrings; function GetFirstChildValue(n: TDOMNode): String;
caretpos: tpoint): String; function GetFirstElement: TDOMNode;
procedure SetCaption; function GetModuleNode: TDOMNode;
function GetNearestSourceElement(const SrcFilename: string;
const CaretPos: TPoint): TPascalHelpContextList;
function MakeLink: String;
function NodeByPascalContext(const AContext: TPascalHelpContextList): TDOMNode;
function GetElementName(const AContext: TPascalHelpContextList): string;
procedure GetElementList;
procedure InsertElement(const ElementName: String);
procedure Save; procedure Save;
procedure SetDocFileName(const Value: String);
procedure UpdateCaption;
public public
{ public declarations }
procedure Reset; procedure Reset;
procedure UpdateLazDoc(source: TStrings; pos: TPoint); procedure UpdateLazDoc(const SrcFilename: string; const Caret: TPoint);
property DocFileName: String read FDocFileName write SetDocFileName; property DocFileName: String read FDocFileName write SetDocFileName;
property Doc: TXMLdocument read FDoc;
end; end;
var var
LazDocForm: TLazDocForm; LazDocForm: TLazDocForm;
doc: TXMLdocument = Nil;
//maybe better to make it a member field of TLazFormDoc
procedure DoShowLazDoc; procedure DoShowLazDoc;
@ -173,17 +161,17 @@ end;
function TLazDocForm.GetFirstElement: TDOMNode; function TLazDocForm.GetFirstElement: TDOMNode;
var var
n: TDOMNode; Node: TDOMNode;
begin begin
//get first module node //get first module node
n := GetModuleNode; Node := GetModuleNode;
//proceed to element //proceed to element
n := n.FirstChild; Node := Node.FirstChild;
while n.NodeName <> 'element' do while Node.NodeName <> 'element' do
n := n.NextSibling; Node := Node.NextSibling;
Result := n; Result := Node;
end; end;
procedure TLazDocForm.GetElementList; procedure TLazDocForm.GetElementList;
@ -220,13 +208,13 @@ begin
end; end;
end; end;
procedure TLazDocForm.SetDocFileName(Value: String); procedure TLazDocForm.SetDocFileName(const Value: String);
begin begin
LinkIdComboBox.Clear; LinkIdComboBox.Clear;
if FileExists(Value) and (Value <> FDocFileName) then if FileExistsCached(Value) and (Value <> FDocFileName) then
begin begin
//reset Self // reset Self
Reset; Reset;
FDocFileName := Value; FDocFileName := Value;
@ -236,7 +224,7 @@ begin
ReadXMLFile(doc, FDocFileName); ReadXMLFile(doc, FDocFileName);
SetCaption; UpdateCaption;
GetElementList; GetElementList;
@ -275,8 +263,12 @@ begin
BrowseExampleButton.Caption := lisLazDocBrowseExampleButton; BrowseExampleButton.Caption := lisLazDocBrowseExampleButton;
Reset; Reset;
end;
Resize; procedure TLazDocForm.FormDestroy(Sender: TObject);
begin
FreeAndNil(fDoc);
FreeAndNil(FCurrentElement);
end; end;
procedure TLazDocForm.FormResize(Sender: TObject); procedure TLazDocForm.FormResize(Sender: TObject);
@ -355,7 +347,7 @@ begin
LinkTextEdit.Text := Copy(strTmp, 1, Length(strTmp) - Length('</link>')); LinkTextEdit.Text := Copy(strTmp, 1, Length(strTmp) - Length('</link>'));
end; end;
procedure TLazDocForm.InsertElement(ElementName: String); procedure TLazDocForm.InsertElement(const ElementName: String);
var var
n: TDOMNode; n: TDOMNode;
child: TDOMNode; child: TDOMNode;
@ -384,46 +376,73 @@ begin
WriteXMLFile(doc, FDocFileName); WriteXMLFile(doc, FDocFileName);
end; end;
function TLazDocForm.NodeByName(ElementName: String): TDOMNode; function TLazDocForm.NodeByPascalContext(
const AContext: TPascalHelpContextList): TDOMNode;
var var
n: TDOMNode; Node: TDOMNode;
ElementName: String;
begin begin
Result := Nil; Result := Nil;
if not Assigned(doc) then if not Assigned(doc) then Exit;
begin
{$ifdef dbgLazDoc}
DebugLn('TLazDocForm.NodeByName: document is not set');
{$endif}
Exit; // get first element node
ElementName:=GetElementName(AContext);
if ElementName='' then exit;
//DebugLn('TLazDocForm.NodeByPascalContext ElementName="',ElementName,'"');
// search elements for ElementName
Node:=GetFirstElement;
while Node<>nil do begin
if (Node is TDomElement)
and (CompareText(TDomElement(Node).GetAttribute('name'),ElementName)=0) then
begin
break;
end;
Node:=Node.NextSibling;
end; end;
//get first element node if Node=nil then begin
n := GetFirstElement; // no element found
if not Assigned(Node) then begin
//search elements for ElementName // if there is no node, then fpdoc has not created an element
while Assigned(n) and (TDomElement(n)['name'] <> ElementName) do
begin
n := n.NextSibling;
//no element found
if not Assigned(n) then
begin
InsertElement(ElementName); InsertElement(ElementName);
Exit; Exit;
end; end;
while n.NodeName = '#comment' do
n := n.NextSibling;
end; end;
{$ifdef dbgLazDoc} {$ifdef dbgLazDoc}
DebugLn('TLazDocForm.NodeByName: element node found where name is: ' + DebugLn('TLazDocForm.NodeByPascalContext: element node found where name is: ' +
ElementName); ElementName);
{$endif} {$endif}
Result := n; Result := Node;
end;
function TLazDocForm.GetElementName(const AContext: TPascalHelpContextList
): string;
var
Level: Integer;
begin
// get first element node
Level:=0;
Result:='';
while (Level<AContext.Count) do begin
case AContext.Items[Level].Descriptor of
pihcProperty,pihcProcedure,pihcVariable,pihcType,pihcConst:
begin
if Result<>'' then Result:=Result+'.';
Result:=Result+AContext.Items[Level].Context;
end;
pihcFilename: ;
pihcSourceName: ;
else
DebugLn('TLazDocForm.NodeByPascalContext unsupported type: "',AContext.Items[Level].Context,'"');
exit; // unsupported type
end;
inc(Level);
end;
end; end;
function TLazDocForm.GetFirstChildValue(n: TDOMNode): String; function TLazDocForm.GetFirstChildValue(n: TDOMNode): String;
@ -478,8 +497,8 @@ begin
end; end;
end; end;
function TLazDocForm.ExtractFuncProc(startpos: tpoint; function TLazDocForm.ExtractFuncProc(const startpos: TPoint;
keyword: String; src: tStrings): String; const keyword: String; src: tStrings): String;
var var
xpos: Integer; xpos: Integer;
ypos: Integer; ypos: Integer;
@ -501,57 +520,23 @@ begin
end; end;
end; end;
function TLazDocForm.GetNearestSourceElement(source: tStrings; function TLazDocForm.GetNearestSourceElement(const SrcFilename: string;
caretpos: tpoint): String; const CaretPos: TPoint): TPascalHelpContextList;
var
xpos: Integer;
ypos: Integer;
begin begin
//find preceding keyword Result:=LazarusHelp.ConvertSourcePosToPascalHelpContext(CaretPos,SrcFilename);
xpos := Succ(caretpos.x);
ypos := caretpos.y;
while (xpos > 0) or (ypos > 0) do
begin
Dec(xpos);
if xpos < 0 then //if Result<>nil then
begin // DebugLn('TLazDocForm.GetNearestSourceElement Result=',Result.AsString);
Dec(ypos);
xpos := length(source[ypos]);
end;
//check for keywords
if PosEx('procedure', source[ypos], xpos) = 1 then
begin
Result := ExtractFuncProc(Point(xpos, ypos), 'procedure', source);
Exit;
end;
if PosEx('function', source[ypos], xpos) = 1 then
begin
Result := ExtractFuncProc(Point(xpos, ypos), 'function', source);
Exit;
end;
if PosEx('constructor', source[ypos], xpos) = 1 then
begin
Result := ExtractFuncProc(Point(xpos, ypos), 'constructor', source);
Exit;
end;
if PosEx('desctructor', source[ypos], xpos) = 1 then
begin
Result := ExtractFuncProc(Point(xpos, ypos), 'desctructor', source);
Exit;
end;
end;
end; end;
procedure TLazDocForm.SetCaption; procedure TLazDocForm.UpdateCaption;
var var
strCaption: String; strCaption: String;
begin begin
strCaption := lisLazDocMainFormCaption + ' - '; strCaption := lisLazDocMainFormCaption + ' - ';
if FCurrentElement <> '' then if FCurrentElement <> nil then
strCaption := strCaption + FCurrentElement + ' - ' strCaption := strCaption + GetElementName(FCurrentElement) + ' - '
else else
strCaption := strCaption + lisLazDocNoTagCaption + ' - '; strCaption := strCaption + lisLazDocNoTagCaption + ' - ';
@ -564,9 +549,9 @@ end;
procedure TLazDocForm.Reset; procedure TLazDocForm.Reset;
begin begin
FreeAndNil(Doc); FreeAndNil(Doc);
FCurrentElement := ''; FreeAndNil(FCurrentElement);
FDocFileName := ''; FDocFileName := '';
SetCaption; UpdateCaption;
//clear all element editors/viewers //clear all element editors/viewers
ShortEdit.Clear; ShortEdit.Clear;
@ -580,11 +565,13 @@ begin
FChanged := False; FChanged := False;
end; end;
procedure TLazDocForm.UpdateLazDoc(source: TStrings; pos: TPoint); procedure TLazDocForm.UpdateLazDoc(const SrcFilename: string;
const Caret: TPoint);
var var
dn: TFPDocNode; dn: TFPDocNode;
n: TDOMNode; n: TDOMNode;
EnabledState: Boolean; EnabledState: Boolean;
NewElement: TPascalHelpContextList;
begin begin
if not Assigned(doc) then if not Assigned(doc) then
begin begin
@ -595,21 +582,22 @@ begin
Exit; Exit;
end; end;
//save the current changes to documentation // save the current changes to documentation
Save; Save;
FCurrentElement := GetNearestSourceElement(source, pos); NewElement:=GetNearestSourceElement(SrcFilename, Caret);
// avoid circles and overhead
if (NewElement<>nil) and (FCurrentElement<>nil)
and (NewElement.IsEqual(FCurrentElement)) then begin
NewElement.Free;
exit;
end;
//do not continue if FCurrentElement=FLastElement FCurrentElement := NewElement;
//or FCurrentElement is empty (J. Reyes)
if (FCurrentElement = FLastElement) or (FCurrentElement = '') then
Exit;
SetCaption; UpdateCaption;
FLastElement := FCurrentElement; n := NodeByPascalContext(FCurrentElement);
n := NodeByName(FCurrentElement);
EnabledState := Assigned(n); EnabledState := Assigned(n);
@ -675,7 +663,7 @@ end;
procedure TLazDocForm.Save; procedure TLazDocForm.Save;
var var
n: TDOMNode; Node: TDOMNode;
S: String; S: String;
NodeWritten: array [1..NODEITEMS] of Boolean; NodeWritten: array [1..NODEITEMS] of Boolean;
i: Integer; i: Integer;
@ -692,13 +680,13 @@ var
if S = NodeName then if S = NodeName then
begin begin
if not Assigned(n.FirstChild) then if not Assigned(Node.FirstChild) then
begin begin
child := doc.CreateTextNode(ToUnixLineEnding(NodeText)); child := doc.CreateTextNode(ToUnixLineEnding(NodeText));
n.AppendChild(child); Node.AppendChild(child);
end end
else else
n.FirstChild.NodeValue := ToUnixLineEnding(NodeText); Node.FirstChild.NodeValue := ToUnixLineEnding(NodeText);
NodeWritten[NodeIndex] := True; NodeWritten[NodeIndex] := True;
end; end;
end; end;
@ -714,30 +702,30 @@ var
child := doc.CreateElement(ElementName); child := doc.CreateElement(ElementName);
child.AppendChild(doc.CreateTextNode(ToUnixLineEnding(ElementText))); child.AppendChild(doc.CreateTextNode(ToUnixLineEnding(ElementText)));
n.AppendChild(child); Node.AppendChild(child);
end; end;
begin begin
//nothing changed, so exit // nothing changed, so exit
if not FChanged then if not FChanged then
Exit; Exit;
n := NodeByName(FCurrentElement); Node := NodeByPascalContext(FCurrentElement);
if not Assigned(n) then if not Assigned(Node) then
Exit; Exit;
//reset all nodes // reset all nodes
for i := 1 to NODEITEMS do for i := 1 to NODEITEMS do
NodeWritten[i] := False; NodeWritten[i] := False;
//write all known nodes to XML // write all known nodes to XML
n := n.FirstChild; Node := Node.FirstChild;
while Assigned(n) do while Assigned(Node) do
begin begin
if (n.NodeType = ELEMENT_NODE) then if (Node.NodeType = ELEMENT_NODE) then
begin begin
S := n.NodeName; S := Node.NodeName;
CheckAndWriteNode('short', ShortEdit.Text, SHORT); CheckAndWriteNode('short', ShortEdit.Text, SHORT);
CheckAndWriteNode('descr', DescrMemo.Text, DESCR); CheckAndWriteNode('descr', DescrMemo.Text, DESCR);
@ -746,11 +734,11 @@ begin
CheckAndWriteNode('example', '<example file="' + CheckAndWriteNode('example', '<example file="' +
ExampleEdit.Text + '"/>', EXAMPLE); ExampleEdit.Text + '"/>', EXAMPLE);
end; end;
n := n.NextSibling; Node := Node.NextSibling;
end; end;
//add new nodes to XML if not already updated // add new nodes to XML if not already updated
n := NodeByName(FCurrentElement); Node := NodeByPascalContext(FCurrentElement);
for i := 1 to NODEITEMS do for i := 1 to NODEITEMS do
if NodeWritten[i] = False then if NodeWritten[i] = False then
case i of case i of
@ -820,7 +808,4 @@ end;
initialization initialization
{$I lazdocfrm.lrs} {$I lazdocfrm.lrs}
finalization
FreeAndNil(doc)
end. end.

View File

@ -214,6 +214,7 @@ type
procedure mnuViewFormsClicked(Sender: TObject); procedure mnuViewFormsClicked(Sender: TObject);
procedure mnuViewUnitDependenciesClicked(Sender: TObject); procedure mnuViewUnitDependenciesClicked(Sender: TObject);
procedure mnuViewUnitInfoClicked(Sender: TObject); procedure mnuViewUnitInfoClicked(Sender: TObject);
procedure mnuViewLazDocClicked(Sender: TObject);
procedure mnuViewCodeExplorerClick(Sender: TObject); procedure mnuViewCodeExplorerClick(Sender: TObject);
procedure mnuViewMessagesClick(Sender: TObject); procedure mnuViewMessagesClick(Sender: TObject);
procedure mnuViewSearchResultsClick(Sender: TObject); procedure mnuViewSearchResultsClick(Sender: TObject);
@ -266,7 +267,6 @@ type
procedure mnuToolGuessMisplacedIFDEFClicked(Sender: TObject); procedure mnuToolGuessMisplacedIFDEFClicked(Sender: TObject);
procedure mnuToolMakeResourceStringClicked(Sender: TObject); procedure mnuToolMakeResourceStringClicked(Sender: TObject);
procedure mnuToolDiffClicked(Sender: TObject); procedure mnuToolDiffClicked(Sender: TObject);
procedure mnuToolLazDocClicked(Sender: TObject); //DBlaszijk 5-sep-05
procedure mnuToolConvertDFMtoLFMClicked(Sender: TObject); procedure mnuToolConvertDFMtoLFMClicked(Sender: TObject);
procedure mnuToolCheckLFMClicked(Sender: TObject); procedure mnuToolCheckLFMClicked(Sender: TObject);
procedure mnuToolConvertDelphiUnitClicked(Sender: TObject); procedure mnuToolConvertDelphiUnitClicked(Sender: TObject);
@ -1982,7 +1982,7 @@ begin
itmViewInspector.OnClick := @mnuViewInspectorClicked; itmViewInspector.OnClick := @mnuViewInspectorClicked;
itmViewSourceEditor.OnClick := @mnuViewSourceEditorClicked; itmViewSourceEditor.OnClick := @mnuViewSourceEditorClicked;
itmViewCodeExplorer.OnClick := @mnuViewCodeExplorerClick; itmViewCodeExplorer.OnClick := @mnuViewCodeExplorerClick;
itmViewLazDoc.OnClick := @mnuToolLazDocClicked; //DBlaszijk 5-sep-05 itmViewLazDoc.OnClick := @mnuViewLazDocClicked; //DBlaszijk 5-sep-05
itmViewUnits.OnClick := @mnuViewUnitsClicked; itmViewUnits.OnClick := @mnuViewUnitsClicked;
itmViewForms.OnClick := @mnuViewFormsClicked; itmViewForms.OnClick := @mnuViewFormsClicked;
itmViewUnitDependencies.OnClick := @mnuViewUnitDependenciesClicked; itmViewUnitDependencies.OnClick := @mnuViewUnitDependenciesClicked;
@ -3208,8 +3208,7 @@ begin
DoDiff; DoDiff;
end; end;
//DBlaszijk 5-sep-05 procedure TMainIDE.mnuViewLazDocClicked(Sender: TObject);
procedure TMainIDE.mnuToolLazDocClicked(Sender: TObject);
begin begin
SourceNotebook.ShowLazDoc; SourceNotebook.ShowLazDoc;
end; end;

View File

@ -1628,7 +1628,7 @@ begin
xmlconfig.SetDeleteValue(Path+'General/Title/Value', Title,''); xmlconfig.SetDeleteValue(Path+'General/Title/Value', Title,'');
//lazdoc //lazdoc
xmlconfig.SetValue(Path+'LazDoc/Paths', LazDocPathList.Text); xmlconfig.SetDeleteValue(Path+'LazDoc/Paths', LazDocPaths, '');
// Save the compiler options // Save the compiler options
CompilerOptions.SaveToXMLConfig(XMLConfig,'CompilerOptions/'); CompilerOptions.SaveToXMLConfig(XMLConfig,'CompilerOptions/');
@ -1973,7 +1973,7 @@ begin
Title := xmlconfig.GetValue(Path+'General/Title/Value', ''); Title := xmlconfig.GetValue(Path+'General/Title/Value', '');
// Lazdoc // Lazdoc
LazDocPathList.Text := xmlconfig.GetValue(Path+'LazDoc/Paths', ''); LazDocPaths := xmlconfig.GetValue(Path+'LazDoc/Paths', '');
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject E reading comp sets');{$ENDIF} {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject E reading comp sets');{$ENDIF}
// Load the compiler options // Load the compiler options

View File

@ -38,7 +38,7 @@ interface
uses uses
Arrow, Buttons, LCLProc, Classes, CodeToolManager, Controls, Dialogs, Arrow, Buttons, LCLProc, Classes, CodeToolManager, Controls, Dialogs,
ExtCtrls, Forms, Graphics, IDEOptionDefs, IDEWindowIntf, LazarusIDEStrConsts, ExtCtrls, Forms, Graphics, IDEOptionDefs, IDEWindowIntf, LazarusIDEStrConsts,
LCLIntf, LResources, Project, ProjectIntf, StdCtrls, SysUtils; LCLIntf, LResources, Project, ProjectIntf, StdCtrls, SysUtils, IDEProcs;
type type
@ -293,7 +293,7 @@ begin
AlwaysBuildCheckBox.Checked := (pfAlwaysBuild in AProject.Flags); AlwaysBuildCheckBox.Checked := (pfAlwaysBuild in AProject.Flags);
//lazdoc //lazdoc
LazDocListBox.Items.Assign(Project.LazDocPathList); SplitString(Project.LazDocPaths,';',LazDocListBox.Items,true);
end; end;
procedure TProjectOptionsDialog.ProjectOptionsClose(Sender: TObject; procedure TProjectOptionsDialog.ProjectOptionsClose(Sender: TObject;
@ -347,7 +347,8 @@ begin
SetProjectTitle; SetProjectTitle;
//lazdoc //lazdoc
Project.LazDocPathList.Assign(LazDocListBox.Items);
Project.LazDocPaths:=StringListToText(LazDocListBox.Items,';',true);
end; end;
IDEDialogLayoutList.SaveLayout(Self); IDEDialogLayoutList.SaveLayout(Self);

View File

@ -50,7 +50,8 @@ uses
SynEditTypes, SynEdit, SynRegExpr, SynEditHighlighter, SynEditAutoComplete, SynEditTypes, SynEdit, SynRegExpr, SynEditHighlighter, SynEditAutoComplete,
SynEditKeyCmds, SynCompletion, SynEditKeyCmds, SynCompletion,
// IDE interface // IDE interface
ProjectIntf, HelpIntf, SrcEditorIntf, MenuIntf, LazIDEIntf, IDEWindowIntf, MacroIntf, ProjectIntf, HelpIntf, SrcEditorIntf, MenuIntf, LazIDEIntf,
IDEWindowIntf,
// IDE units // IDE units
LazarusIDEStrConsts, LazConf, IDECommands, EditorOptions, KeyMapping, Project, LazarusIDEStrConsts, LazConf, IDECommands, EditorOptions, KeyMapping, Project,
WordCompletion, FindReplaceDialog, FindInFilesDlg, IDEProcs, IDEOptionDefs, WordCompletion, FindReplaceDialog, FindInFilesDlg, IDEProcs, IDEOptionDefs,
@ -567,9 +568,9 @@ type
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure ShowLazDoc; //DBlaszijk 11-sep-05 procedure ShowLazDoc;
procedure UpdateLazDoc; //DBlaszijk 11-sep-05 procedure UpdateLazDoc;
procedure LazDocNewPage; //DBlaszijk 11-sep-05 procedure LazDocNewPage;
property Editors[Index:integer]:TSourceEditor read GetEditors; property Editors[Index:integer]:TSourceEditor read GetEditors;
function EditorCount:integer; function EditorCount:integer;
@ -2812,52 +2813,70 @@ begin
LazDocNewPage; LazDocNewPage;
end; end;
function FindPathFromFile(FileNamePath: string): string; function FindLazDocPathFromFile(const AFileName: string): string;
var var
i: integer; i: integer;
fn: string; fn: string;
pathlist: TStrings; SearchPaths: String;
PathList: TStrings;
begin begin
Result := ''; Result := '';
pathlist := TStringList.Create; if not FilenameIsAbsolute(AFileName) then exit;
if not FilenameIsPascalSource(AFileName) then exit;
//get global lazdoc paths // add global lazdoc paths
pathlist.AddStrings(EnvironmentOptions.LazDocPathList); SearchPaths:=EnvironmentOptions.LazDocPaths;
//get project lazdoc paths // if this is a project file then add project lazdoc paths
pathlist.AddStrings(LazarusIDE.ActiveProject.LazDocPathList); if Project1.UnitInfoWithFilename(AFileName,[pfsfOnlyProjectFiles])<>nil then
SearchPaths:=LazarusIDE.ActiveProject.LazDocPaths+';'+SearchPaths;
fn := SetDirSeparators('/') + ChangeFileExt(ExtractFileName(FileNamePath), '.xml'); // replace macros
for i:= 0 to Pred(pathlist.Count) do IDEMacros.SubstituteMacros(SearchPaths);
if FileExists(pathlist[i] + fn) then SearchPaths:=TrimSearchPath(SearchPaths,'');
//DebugLn('FindLazDocPathFromFile AFileName="',AFileName,'" SearchPaths="',SearchPaths,'"');
// search xml file in all directories
fn := PathDelim + ChangeFileExt(ExtractFileName(AFileName), '.xml');
PathList:=SplitString(SearchPaths,';');
try
for i:=0 to PathList.Count-1 do begin
if FilenameIsAbsolute(PathList[i])
and FileExistsCached(TrimFilename(PathList[i] + fn)) then
begin begin
Result := pathlist[i]; Result := PathList[i];
pathlist.Free; break;
Exit;
end; end;
pathlist.Free; end;
finally
PathList.Free;
end;
//DebugLn('FindLazDocPathFromFile Result="',Result,'"');
end; end;
procedure TSourceNotebook.LazDocNewPage; procedure TSourceNotebook.LazDocNewPage;
var var
SrcEdit: TSourceEditor; SrcEdit: TSourceEditor;
DocPath: string; DocPath: string;
NewDocPath: string;
begin begin
//try to find if the file belongs to LCL //DebugLn('TSourceNotebook.LazDocNewPage ',dbgs(Assigned(LazDocForm)));
//for other projects the location of the doc file could
//be found through the lpi file
if Assigned(LazDocForm) then if Assigned(LazDocForm) then
begin begin
SrcEdit:=GetActiveSE; SrcEdit:=GetActiveSE;
if SrcEdit=nil then exit;
DocPath := FindPathFromFile(SrcEdit.FileName); DocPath := FindLazDocPathFromFile(SrcEdit.FileName);
if DocPath <> '' then if DocPath <> '' then
begin begin
//load the .xml file // load the .xml file
LazDocForm.DocFileName := DocPath + SetDirSeparators('/') + NewDocPath:=DocPath + PathDelim +
ChangeFileExt(ExtractFileName(SrcEdit.FileName),'.xml'); ChangeFileExt(ExtractFileName(SrcEdit.FileName),'.xml');
if NewDocPath<>LazDocForm.DocFileName then begin
LazDocForm.DocFileName := NewDocPath;
UpdateLazDoc; UpdateLazDoc;
end;
end end
else else
LazDocForm.Reset; LazDocForm.Reset;
@ -2870,19 +2889,17 @@ var
DocPath: string; DocPath: string;
CaretPos: TPoint; CaretPos: TPoint;
begin begin
if LazDocForm = nil then exit;
SrcEdit:=GetActiveSE; SrcEdit:=GetActiveSE;
//find a path that contains the .xml file // find a path that contains the .xml file
DocPath := FindPathFromFile(SrcEdit.FileName); DocPath := FindLazDocPathFromFile(SrcEdit.FileName);
if DocPath <> '' then if DocPath <> '' then
begin begin
CaretPos := SrcEdit.EditorComponent.CaretXY; CaretPos := SrcEdit.EditorComponent.CaretXY;
Dec(CaretPos.x); LazDocForm.UpdateLazDoc(SrcEdit.Filename,CaretPos);
Dec(CaretPos.y);
LazDocForm.UpdateLazDoc(SrcEdit.EditorComponent.Lines,
CaretPos);
end end
else else
LazDocForm.Reset; LazDocForm.Reset;
@ -5128,6 +5145,8 @@ begin
Statusbar.Panels[3].Text := PanelFilename; Statusbar.Panels[3].Text := PanelFilename;
end; end;
Statusbar.EndUpdate; Statusbar.EndUpdate;
UpdateLazDoc;
End; End;
function TSourceNotebook.FindBookmark(BookmarkID: integer): TSourceEditor; function TSourceNotebook.FindBookmark(BookmarkID: integer): TSourceEditor;
@ -5460,17 +5479,12 @@ begin
FOnCtrlMouseUp(Sender,Button,Shift,X,Y); FOnCtrlMouseUp(Sender,Button,Shift,X,Y);
end; end;
end; end;
if Assigned(LazDocForm) then
UpdateLazDoc;
end; end;
procedure TSourceNotebook.EditorKeyDown(Sender: TObject; var Key: Word; procedure TSourceNotebook.EditorKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState); Shift: TShiftState);
begin begin
if not Assigned(LazDocForm) then Exit;
if Key in [VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT, VK_END, VK_HOME] then
UpdateLazDoc;
end; end;
procedure TSourceNotebook.ShowSynEditHint(const MousePos: TPoint); procedure TSourceNotebook.ShowSynEditHint(const MousePos: TPoint);

View File

@ -189,7 +189,8 @@ begin
end else if (BasePathObject<>nil) and (Databases<>nil) then begin end else if (BasePathObject<>nil) and (Databases<>nil) then begin
Result:=Databases.GetBaseURLForBasePathObject(BasePathObject); Result:=Databases.GetBaseURLForBasePathObject(BasePathObject);
//debugln('THTMLHelpDatabase.GetEffectiveBaseURL using BasePathObject="',Result,'"'); //debugln('THTMLHelpDatabase.GetEffectiveBaseURL using BasePathObject="',Result,'"');
end else if DefaultBaseURL<>'' then begin end;
if (Result='') and (DefaultBaseURL<>'') then begin
Result:=DefaultBaseURL; Result:=DefaultBaseURL;
if (IDEMacros<>nil) then if (IDEMacros<>nil) then
IDEMacros.SubstituteMacros(Result); IDEMacros.SubstituteMacros(Result);

View File

@ -38,6 +38,7 @@ type
TShowHelpResult = ( TShowHelpResult = (
shrNone, shrNone,
shrSuccess, shrSuccess,
shrCancel,
shrDatabaseNotFound, shrDatabaseNotFound,
shrContextNotFound, shrContextNotFound,
shrViewerNotFound, shrViewerNotFound,
@ -77,7 +78,6 @@ type
TPascalHelpContextList = class(THelpQueryItem) TPascalHelpContextList = class(THelpQueryItem)
private private
FCount: integer; FCount: integer;
// TODO: convert to dynamic array, when fpc 1.0 support is removed.
fItems: TPascalHelpContextPtr; fItems: TPascalHelpContextPtr;
function GetItems(Index: integer): TPascalHelpContext; function GetItems(Index: integer): TPascalHelpContext;
public public
@ -706,12 +706,16 @@ type
var ErrMsg: string): TShowHelpResult; virtual; abstract; var ErrMsg: string): TShowHelpResult; virtual; abstract;
procedure ShowHelpForMessage(Line: integer); virtual; abstract; procedure ShowHelpForMessage(Line: integer); virtual; abstract;
procedure ShowHelpForObjectInspector(Sender: TObject); virtual; abstract; procedure ShowHelpForObjectInspector(Sender: TObject); virtual; abstract;
function ConvertSourcePosToPascalHelpContext(const CaretPos: TPoint;
const Filename: string): TPascalHelpContextList; virtual; abstract;
end; end;
var var
HelpDatabases: THelpDatabases; // initialized by the IDE HelpDatabases: THelpDatabases; // initialized by the IDE
HelpViewers: THelpViewers; // initialized by the IDE HelpViewers: THelpViewers; // initialized by the IDE
LazarusHelp: TBaseHelpManager; // initialized by the IDE
//============================================================================== //==============================================================================
{ Showing help (how it works): { Showing help (how it works):
@ -1540,9 +1544,9 @@ function THelpDatabases.GetBaseURLForBasePathObject(BasePathObject: TObject
begin begin
// this method will be overriden by the IDE // this method will be overriden by the IDE
// provide some useful defaults: // provide some useful defaults:
if (BasePathObject is THelpBaseURLObject) then if (BasePathObject is THelpBaseURLObject) then begin
Result:=THelpBaseURLObject(BasePathObject).BaseURL Result:=THelpBaseURLObject(BasePathObject).BaseURL;
else begin end else begin
// otherwise fetch a filename // otherwise fetch a filename
Result:=GetBaseDirectoryForBasePathObject(BasePathObject); Result:=GetBaseDirectoryForBasePathObject(BasePathObject);
if Result='' then exit; if Result='' then exit;
@ -1927,10 +1931,10 @@ end;
function THelpDatabases.ShowHelpSelector(Query: THelpQuery; function THelpDatabases.ShowHelpSelector(Query: THelpQuery;
Nodes: THelpNodeQueryList; var ErrMsg: string; Nodes: THelpNodeQueryList; var ErrMsg: string;
var Selection: THelpNodeQuery): TShowHelpResult; var Selection: THelpNodeQuery): TShowHelpResult;
// to override
// Nodes is a list of THelpNode // Nodes is a list of THelpNode
begin begin
Result:=shrSelectorError; Result:=shrSelectorError;
// TODO
ErrMsg:='THelpDatabases.ShowHelpSelector not implemented'; ErrMsg:='THelpDatabases.ShowHelpSelector not implemented';
end; end;
@ -2371,10 +2375,23 @@ begin
end; end;
function TPascalHelpContextList.AsString: string; function TPascalHelpContextList.AsString: string;
var
i: Integer;
Item: TPascalHelpContext;
begin begin
Result:=''; Result:='';
if Count>0 then begin for i:=0 to Count-1 do begin
Result:=fItems[0].Context; Item:=Items[i];
case Item.Descriptor of
pihcFilename: Result:=Result+Item.Context;
pihcSourceName: ;
pihcProperty: Result:=Result+' property '+Item.Context;
pihcProcedure: Result:=Result+' procedure/function '+Item.Context;
pihcParameterList: Result:=Result+Item.Context;
pihcVariable: Result:=Result+' var '+Item.Context;
pihcType: Result:=Result+' type '+Item.Context;
pihcConst: Result:=Result+' const '+Item.Context;
end;
end; end;
end; end;

View File

@ -506,7 +506,7 @@ type
FSessionModified: boolean; FSessionModified: boolean;
fTitle: String; fTitle: String;
FSessionStorage: TProjectSessionStorage; FSessionStorage: TProjectSessionStorage;
FLazDocPathList: TStrings; FLazDocPaths: string;
protected protected
FFlags: TProjectFlags; FFlags: TProjectFlags;
procedure SetLazCompilerOptions(const AValue: TLazCompilerOptions); procedure SetLazCompilerOptions(const AValue: TLazCompilerOptions);
@ -557,7 +557,7 @@ type
write SetSessionModified; write SetSessionModified;
// project session data (not units, data), // project session data (not units, data),
// units have their own SessionModified // units have their own SessionModified
property LazDocPathList: TStrings read FLazDocPathList; property LazDocPaths: string read FLazDocPaths write FLazDocPaths;
end; end;
TLazProjectClass = class of TLazProject; TLazProjectClass = class of TLazProject;
@ -1067,12 +1067,10 @@ constructor TLazProject.Create(ProjectDescription: TProjectDescriptor);
begin begin
inherited Create; inherited Create;
FSessionStorage:=pssInProjectInfo; FSessionStorage:=pssInProjectInfo;
FLazDocPathList := TStringList.Create;
end; end;
destructor TLazProject.Destroy; destructor TLazProject.Destroy;
begin begin
FreeAndNil(FLazDocPathList);
inherited Destroy; inherited Destroy;
end; end;

View File

@ -1400,7 +1400,6 @@ begin
if Assigned(FOnEndSession) then FOnEndSession(Self); if Assigned(FOnEndSession) then FOnEndSession(Self);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
procedure TApplication.IntfQueryEndSession(var Cancel : Boolean); procedure TApplication.IntfQueryEndSession(var Cancel : Boolean);
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
@ -1410,8 +1409,6 @@ begin
if Assigned(FOnQueryEndSession) then FOnQueryEndSession(Cancel); if Assigned(FOnQueryEndSession) then FOnQueryEndSession(Cancel);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
procedure TApplication.DoBeforeMouseMessage(CurMouseControl: TControl); procedure TApplication.DoBeforeMouseMessage(CurMouseControl: TControl);
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}

View File

@ -1724,7 +1724,8 @@ function TLazPackageGraph.FindFPCConflictUnit(APackage: TLazPackage;
Cnt:=Pkg1.FileCount; Cnt:=Pkg1.FileCount;
for i:=0 to Cnt-1 do begin for i:=0 to Cnt-1 do begin
CurFile:=Pkg1.Files[i]; CurFile:=Pkg1.Files[i];
if CurFile.FileType in (PkgFileUnitTypes-[pftVirtualUnit]) then begin if (CurFile.FileType in (PkgFileUnitTypes-[pftVirtualUnit]))
and (pffAddToPkgUsesSection in CurFile.Flags) then begin
Result:=CheckUnitName(CurFile.UnitName); Result:=CheckUnitName(CurFile.UnitName);
if Result then begin if Result then begin
File1:=CurFile; File1:=CurFile;