mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 01:28:16 +02:00
implemented context help for source editor
git-svn-id: trunk@5836 -
This commit is contained in:
parent
3907430a32
commit
07dd273dd2
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -654,6 +654,7 @@ ideintf/componenttreeview.pas svneol=native#text/pascal
|
||||
ideintf/configstorage.pas svneol=native#text/pascal
|
||||
ideintf/formeditingintf.pas svneol=native#text/pascal
|
||||
ideintf/graphpropedits.pas svneol=native#text/pascal
|
||||
ideintf/helpfpdoc.pas svneol=native#text/pascal
|
||||
ideintf/helphtml.pas svneol=native#text/pascal
|
||||
ideintf/helpintf.pas svneol=native#text/pascal
|
||||
ideintf/idecommands.pas svneol=native#text/pascal
|
||||
|
@ -140,6 +140,7 @@ type
|
||||
function AtomPosition(StartPos, EndPos: integer): TAtomPosition;
|
||||
function CodePosition(P: integer; Code: TCodeBuffer): TCodePosition;
|
||||
function CodeXYPosition(X, Y: integer; Code: TCodeBuffer): TCodeXYPosition;
|
||||
function CompareCodeXYPositions(Pos1, Pos2: PCodeXYPosition): integer;
|
||||
|
||||
var
|
||||
WordToAtomFlag: TWordToAtomFlag;
|
||||
@ -169,6 +170,17 @@ begin
|
||||
Result.Code:=Code;
|
||||
end;
|
||||
|
||||
function CompareCodeXYPositions(Pos1, Pos2: PCodeXYPosition): integer;
|
||||
begin
|
||||
if Pointer(Pos1^.Code)>Pointer(Pos2^.Code) then Result:=1
|
||||
else if Pointer(Pos1^.Code)<Pointer(Pos2^.Code) then Result:=-1
|
||||
else if Pos1^.Y<Pos2^.Y then Result:=1
|
||||
else if Pos1^.Y>Pos2^.Y then Result:=-1
|
||||
else if Pos1^.X<Pos2^.X then Result:=1
|
||||
else if Pos1^.Y<Pos2^.Y then Result:=-1
|
||||
else Result:=0;
|
||||
end;
|
||||
|
||||
{ TAtomRing }
|
||||
|
||||
constructor TAtomRing.Create;
|
||||
|
@ -105,13 +105,11 @@ type
|
||||
TheUnitInFilename: string): TCodeBuffer;
|
||||
function DoOnGetSrcPathForCompiledUnit(Sender: TObject;
|
||||
const AFilename: string): string;
|
||||
function GetMainCode(Code: TCodeBuffer): TCodeBuffer;
|
||||
function FindCodeOfMainUnitHint(Code: TCodeBuffer): TCodeBuffer;
|
||||
procedure CreateScanner(Code: TCodeBuffer);
|
||||
function InitCurCodeTool(Code: TCodeBuffer): boolean;
|
||||
function InitResourceTool: boolean;
|
||||
procedure ClearPositions;
|
||||
function FindCodeToolForSource(Code: TCodeBuffer): TCustomCodeTool;
|
||||
function GetCodeToolForSource(Code: TCodeBuffer;
|
||||
ExceptionOnError: boolean): TCustomCodeTool;
|
||||
procedure SetAbortable(const AValue: boolean);
|
||||
@ -163,6 +161,10 @@ type
|
||||
function SaveBufferAs(OldBuffer: TCodeBuffer;const ExpandedFilename: string;
|
||||
var NewBuffer: TCodeBuffer): boolean;
|
||||
function FilenameHasSourceExt(const AFilename: string): boolean;
|
||||
function GetMainCode(Code: TCodeBuffer): TCodeBuffer;
|
||||
function GetIncludeCodeChain(Code: TCodeBuffer;
|
||||
var ListOfCodeBuffer: TList): boolean;
|
||||
function FindCodeToolForSource(Code: TCodeBuffer): TCustomCodeTool;
|
||||
property OnSearchUsedUnit: TOnSearchUsedUnit
|
||||
read FOnSearchUsedUnit write FOnSearchUsedUnit;
|
||||
|
||||
@ -276,6 +278,8 @@ type
|
||||
function FindDeclarationInInterface(Code: TCodeBuffer;
|
||||
const Identifier: string; var NewCode: TCodeBuffer;
|
||||
var NewX, NewY, NewTopLine: integer): boolean;
|
||||
function FindDeclarationsAndAncestors(Code: TCodeBuffer; X,Y: integer;
|
||||
var ListOfPCodeXYPosition: TList): boolean;
|
||||
|
||||
// gather identifiers (i.e. all visible)
|
||||
function GatherIdentifiers(Code: TCodeBuffer; X,Y: integer): boolean;
|
||||
@ -698,6 +702,34 @@ begin
|
||||
CreateScanner(Result);
|
||||
end;
|
||||
|
||||
function TCodeToolManager.GetIncludeCodeChain(Code: TCodeBuffer;
|
||||
var ListOfCodeBuffer: TList): boolean;
|
||||
var
|
||||
OldCode: TCodeBuffer;
|
||||
begin
|
||||
// find MainCode (= the start source, e.g. a unit/program/package source)
|
||||
Result:=false;
|
||||
ListOfCodeBuffer:=nil;
|
||||
if Code=nil then exit;
|
||||
|
||||
Result:=true;
|
||||
ListOfCodeBuffer:=TList.Create;
|
||||
ListOfCodeBuffer.Add(Code);
|
||||
|
||||
// if this is an include file, find the top level source
|
||||
while (Code.LastIncludedByFile<>'') do begin
|
||||
Code:=SourceCache.LoadFile(Code.LastIncludedByFile);
|
||||
if Code=nil then exit;
|
||||
ListOfCodeBuffer.Insert(0,Code);
|
||||
end;
|
||||
if (not FilenameHasSourceExt(Code.Filename)) then begin
|
||||
OldCode:=Code;
|
||||
Code:=FindCodeOfMainUnitHint(OldCode);
|
||||
if Code<>OldCode then
|
||||
ListOfCodeBuffer.Insert(0,Code);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCodeToolManager.FindCodeOfMainUnitHint(Code: TCodeBuffer
|
||||
): TCodeBuffer;
|
||||
var
|
||||
@ -1191,6 +1223,33 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TCodeToolManager.FindDeclarationsAndAncestors(Code: TCodeBuffer; X,
|
||||
Y: integer; var ListOfPCodeXYPosition: TList): boolean;
|
||||
var
|
||||
CursorPos: TCodeXYPosition;
|
||||
begin
|
||||
Result:=false;
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('TCodeToolManager.FindDeclarationsAndAncestors A ',Code.Filename,' x=',x,' y=',y);
|
||||
{$ENDIF}
|
||||
if not InitCurCodeTool(Code) then exit;
|
||||
CursorPos.X:=X;
|
||||
CursorPos.Y:=Y;
|
||||
CursorPos.Code:=Code;
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('TCodeToolManager.FindDeclarationsAndAncestors B ',FCurCodeTool.Scanner<>nil);
|
||||
{$ENDIF}
|
||||
try
|
||||
Result:=FCurCodeTool.FindDeclarationsAndAncestors(CursorPos,
|
||||
ListOfPCodeXYPosition);
|
||||
except
|
||||
on e: Exception do Result:=HandleException(e);
|
||||
end;
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('TCodeToolManager.FindDeclarationsAndAncestors END ');
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TCodeToolManager.GatherIdentifiers(Code: TCodeBuffer; X, Y: integer
|
||||
): boolean;
|
||||
var
|
||||
|
@ -656,6 +656,8 @@ type
|
||||
function BaseTypeOfNodeHasSubIdents(ANode: TCodeTreeNode): boolean;
|
||||
function FindBaseTypeOfNode(Params: TFindDeclarationParams;
|
||||
Node: TCodeTreeNode): TFindContext;
|
||||
function FindDeclarationsAndAncestors(const CursorPos: TCodeXYPosition;
|
||||
var ListOfPCodeXYPosition: TList): boolean;
|
||||
|
||||
function JumpToNode(ANode: TCodeTreeNode;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
@ -2765,6 +2767,68 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TFindDeclarationTool.FindDeclarationsAndAncestors(
|
||||
const CursorPos: TCodeXYPosition; var ListOfPCodeXYPosition: TList): boolean;
|
||||
|
||||
procedure AddCodePosition(const NewCodePos: TCodeXYPosition);
|
||||
var
|
||||
AddCodePos: PCodeXYPosition;
|
||||
begin
|
||||
if ListOfPCodeXYPosition=nil then ListOfPCodeXYPosition:=TList.Create;
|
||||
New(AddCodePos);
|
||||
AddCodePos^:=NewCodePos;
|
||||
ListOfPCodeXYPosition.Add(AddCodePos);
|
||||
end;
|
||||
|
||||
function IndexOfCodePosition(APosition: PCodeXYPosition): integer;
|
||||
begin
|
||||
if ListOfPCodeXYPosition=nil then
|
||||
Result:=-1
|
||||
else begin
|
||||
Result:=ListOfPCodeXYPosition.Count-1;
|
||||
while (Result>=0)
|
||||
and (CompareCodeXYPositions(APosition,
|
||||
PCodeXYPosition(ListOfPCodeXYPosition[Result]))<>0)
|
||||
do
|
||||
dec(Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
CurCursorPos: TCodeXYPosition;
|
||||
NewTool: TFindDeclarationTool;
|
||||
NewNode: TCodeTreeNode;
|
||||
NewPos: TCodeXYPosition;
|
||||
NewTopLine: integer;
|
||||
CurTool: TFindDeclarationTool;
|
||||
begin
|
||||
Result:=true;
|
||||
ListOfPCodeXYPosition:=nil;
|
||||
AddCodePosition(CursorPos);
|
||||
|
||||
ActivateGlobalWriteLock;
|
||||
try
|
||||
CurCursorPos:=CursorPos;
|
||||
CurTool:=Self;
|
||||
try
|
||||
while CurTool.FindDeclaration(CurCursorPos,AllFindSmartFlags,
|
||||
NewTool,NewNode,NewPos,NewTopLine) do
|
||||
begin
|
||||
if IndexOfCodePosition(@NewPos)>=0 then break;
|
||||
AddCodePosition(NewPos);
|
||||
CurCursorPos:=NewPos;
|
||||
CurTool:=NewTool;
|
||||
end;
|
||||
except
|
||||
// just stop on errors
|
||||
on E: ECodeToolError do ;
|
||||
on E: ELinkScannerError do ;
|
||||
end;
|
||||
finally
|
||||
DeactivateGlobalWriteLock;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFindDeclarationTool.JumpToNode(ANode: TCodeTreeNode;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
IgnoreJumpCentered: boolean): boolean;
|
||||
|
@ -119,6 +119,7 @@ type
|
||||
DefinitionNode: TCodeTreeNode): TCodeTreeNode;
|
||||
function NodeIsPartOfTypeDefinition(ANode: TCodeTreeNode): boolean;
|
||||
function ExtractDefinitionNodeType(DefinitionNode: TCodeTreeNode): string;
|
||||
function ExtractDefinitionName(DefinitionNode: TCodeTreeNode): string;
|
||||
|
||||
// sections
|
||||
function GetSourceType: TCodeTreeNodeDesc;
|
||||
@ -1221,6 +1222,15 @@ begin
|
||||
Result:=GetIdentifier(@Src[TypeNode.StartPos]);
|
||||
end;
|
||||
|
||||
function TPascalReaderTool.ExtractDefinitionName(DefinitionNode: TCodeTreeNode
|
||||
): string;
|
||||
var
|
||||
Len: LongInt;
|
||||
begin
|
||||
Len:=GetIdentLen(@Src[DefinitionNode.StartPos]);
|
||||
Result:=copy(Src,DefinitionNode.StartPos,Len);
|
||||
end;
|
||||
|
||||
function TPascalReaderTool.PropertyIsDefault(PropertyNode: TCodeTreeNode
|
||||
): boolean;
|
||||
begin
|
||||
|
@ -94,7 +94,7 @@ var
|
||||
begin
|
||||
Dir:=TrimFilename(DirectoryCombobox.Text);
|
||||
if (DefineTree=nil) or (not FilenameIsAbsolute(Dir))
|
||||
or (not DirectoryExists(Dir)) then begin
|
||||
or (not DirPathExists(Dir)) then begin
|
||||
ClearValues;
|
||||
exit;
|
||||
end;
|
||||
|
@ -3318,6 +3318,9 @@ end;
|
||||
|
||||
procedure TEditorOptionsForm.SetupGeneralPage;
|
||||
var MaxX,ChkBoxW:integer;
|
||||
ChkBoxH: Integer;
|
||||
x: Integer;
|
||||
y: Integer;
|
||||
begin
|
||||
MaxX:=Width-5;
|
||||
ChkBoxW:=(MaxX-20) div 2;
|
||||
@ -3337,305 +3340,265 @@ begin
|
||||
// many, many checkboxes ...
|
||||
|
||||
// left side
|
||||
x:=5;
|
||||
y:=2;
|
||||
ChkBoxH:=21;
|
||||
|
||||
AltSetsColumnModeCheckBox:=TCheckBox.Create(Self);
|
||||
with AltSetsColumnModeCheckBox do begin
|
||||
Name:='AltSetsColumnModeCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=5;
|
||||
Left:=5;
|
||||
Width:=ChkBoxW;
|
||||
Height:=16;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgAltSetClMode;
|
||||
Checked:=eoAltSetsColumnMode in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
AutoIndentCheckBox:=TCheckBox.Create(Self);
|
||||
with AutoIndentCheckBox do begin
|
||||
Name:='AutoIndentCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=AltSetsColumnModeCheckBox.Top+AltSetsColumnModeCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgAutoIdent;
|
||||
Checked:=eoAutoIndent in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
BracketHighlightCheckBox:=TCheckBox.Create(Self);
|
||||
with BracketHighlightCheckBox do begin
|
||||
Name:='BracketHighlightCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=AutoIndentCheckBox.Top+AutoIndentCheckBox.Height+5;
|
||||
Left:=AutoIndentCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgBracHighlight;
|
||||
Checked:=eoBracketHighlight in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
DragDropEditingCheckBox:=TCheckBox.Create(Self);
|
||||
with DragDropEditingCheckBox do begin
|
||||
Name:='DragDropEditingCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=BracketHighlightCheckBox.Top+BracketHighlightCheckBox.Height+5;
|
||||
Left:=BracketHighlightCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgDragDropEd;
|
||||
Checked:=eoDragDropEditing in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
DropFilesCheckBox:=TCheckBox.Create(Self);
|
||||
with DropFilesCheckBox do begin
|
||||
Name:='DropFilesCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=DragDropEditingCheckBox.Top+DragDropEditingCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgDropFiles;
|
||||
Checked:=eoDropFiles in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
Enabled:=false;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
HalfPageScrollCheckBox:=TCheckBox.Create(Self);
|
||||
with HalfPageScrollCheckBox do begin
|
||||
Name:='HalfPageScrollCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=DropFilesCheckBox.Top+DropFilesCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgHalfPageScroll;
|
||||
Checked:=eoHalfPageScroll in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
KeepCaretXCheckBox:=TCheckBox.Create(Self);
|
||||
with KeepCaretXCheckBox do begin
|
||||
Name:='KeepCaretXCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=HalfPageScrollCheckBox.Top+HalfPageScrollCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgKeepCaretX;
|
||||
Checked:=eoKeepCaretX in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
PersistentCaretCheckBox:=TCheckBox.Create(Self);
|
||||
with PersistentCaretCheckBox do begin
|
||||
Name:='PersistentCaretCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=KeepCaretXCheckBox.Top+KeepCaretXCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgPersistentCaret;
|
||||
Checked:=eoPersistentCaret in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
ScrollByOneLessCheckBox:=TCheckBox.Create(Self);
|
||||
with ScrollByOneLessCheckBox do begin
|
||||
Name:='ScrollByOneLessCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=PersistentCaretCheckBox.Top+PersistentCaretCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgScrollByOneLess;
|
||||
Checked:=eoScrollByOneLess in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
ScrollPastEoFCheckBox:=TCheckBox.Create(Self);
|
||||
with ScrollPastEoFCheckBox do begin
|
||||
Name:='ScrollPastEoFCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=ScrollByOneLessCheckBox.Top+ScrollByOneLessCheckBox.Height+5;
|
||||
Left:=ScrollByOneLessCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgScrollPastEndFile;
|
||||
Checked:=eoScrollPastEoF in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
MouseLinksCheckBox:=TCheckBox.Create(Self);
|
||||
with MouseLinksCheckBox do begin
|
||||
Name:='MouseLinksCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=ScrollPastEoFCheckBox.Top+ScrollPastEoFCheckBox.Height+5;
|
||||
Left:=ScrollPastEoFCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgMouseLinks;
|
||||
Checked:=EditorOpts.CtrlMouseLinks;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
ShowGutterHintsCheckBox:=TCheckBox.Create(Self);
|
||||
with ShowGutterHintsCheckBox do begin
|
||||
Name:='ShowGutterHintsCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=MouseLinksCheckBox.Top+MouseLinksCheckBox.Height+5;
|
||||
Left:=MouseLinksCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgShowGutterHints;
|
||||
Checked:=EditorOpts.ShowGutterHints;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
// right side
|
||||
x:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
|
||||
y:=2;
|
||||
|
||||
ScrollPastEoLCheckBox:=TCheckBox.Create(Self);
|
||||
with ScrollPastEoLCheckBox do begin
|
||||
Name:='ScrollPastEoLCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Left:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
|
||||
Left:=ScrollPastEoFCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgScrollPastEndLine;
|
||||
Checked:=eoScrollPastEoL in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
ShowCloseBtnInNoteBookCheckBox:=TCheckBox.Create(Self);
|
||||
with ShowCloseBtnInNoteBookCheckBox do begin
|
||||
Name:='ShowCloseBtnInNoteBookCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=ScrollPastEoLCheckBox.Top+ScrollPastEoLCheckBox.Height+5;
|
||||
Left:=ScrollPastEoLCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgCloseButtonsNotebook;
|
||||
Checked:=EditorOpts.ShowTabCloseButtons;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
ShowScrollHintCheckBox:=TCheckBox.Create(Self);
|
||||
with ShowScrollHintCheckBox do begin
|
||||
Name:='ShowScrollHintCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=ShowCloseBtnInNoteBookCheckBox.Top
|
||||
+ShowCloseBtnInNoteBookCheckBox.Height+5;
|
||||
Left:=ShowCloseBtnInNoteBookCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgShowScrollHint;
|
||||
Checked:=eoShowScrollHint in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
SmartTabsCheckBox:=TCheckBox.Create(Self);
|
||||
with SmartTabsCheckBox do begin
|
||||
Name:='SmartTabsCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=ShowScrollHintCheckBox.Top+ShowScrollHintCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgSmartTabs;
|
||||
Checked:=eoSmartTabs in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
TabsToSpacesCheckBox:=TCheckBox.Create(Self);
|
||||
with TabsToSpacesCheckBox do begin
|
||||
Name:='TabsToSpacesCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=SmartTabsCheckBox.Top+SmartTabsCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgTabsToSpaces;
|
||||
Checked:=eoTabsToSpaces in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
TrimTrailingSpacesCheckBox:=TCheckBox.Create(Self);
|
||||
with TrimTrailingSpacesCheckBox do begin
|
||||
Name:='TrimTrailingSpacesCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=TabsToSpacesCheckBox.Top+TabsToSpacesCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgTrimTrailingSpaces;
|
||||
Checked:=eoTrimTrailingSpaces in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
UndoAfterSaveCheckBox:=TCheckBox.Create(Self);
|
||||
with UndoAfterSaveCheckBox do begin
|
||||
Name:='UndoAfterSaveCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=TrimTrailingSpacesCheckBox.Top+TrimTrailingSpacesCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgUndoAfterSave;
|
||||
Checked:=EditorOpts.UndoAfterSave;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
DoubleClickLineCheckBox:=TCheckBox.Create(Self);
|
||||
with DoubleClickLineCheckBox do begin
|
||||
Name:='DoubleClickLineCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=UndoAfterSaveCheckBox.Top+UndoAfterSaveCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgDoubleClickLine;
|
||||
Checked:=eoDoubleClickSelectsLine in EditorOpts.SynEditOptions;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
FindTextAtCursorCheckBox:=TCheckBox.Create(Self);
|
||||
with FindTextAtCursorCheckBox do begin
|
||||
Name:='FindTextAtCursorCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=DoubleClickLineCheckBox.Top+DoubleClickLineCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgFindTextatCursor;
|
||||
Checked:=EditorOpts.FindTextAtCursor;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
UseSyntaxHighlightCheckBox:=TCheckBox.Create(Self);
|
||||
with UseSyntaxHighlightCheckBox do begin
|
||||
Name:='UseSyntaxHighlightCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=FindTextAtCursorCheckBox.Top+FindTextAtCursorCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgUseSyntaxHighlight;
|
||||
Checked:=EditorOpts.UseSyntaxHighlight;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
CopyWordAtCursorOnCopyNoneCheckBox:=TCheckBox.Create(Self);
|
||||
with CopyWordAtCursorOnCopyNoneCheckBox do begin
|
||||
Name:='CopyWordAtCursorOnCopyNoneCheckBox';
|
||||
Parent:=EditorOptionsGroupBox;
|
||||
Top:=UseSyntaxHighlightCheckBox.Top+UseSyntaxHighlightCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
Caption:=dlgCopyWordAtCursorOnCopyNone;
|
||||
Checked:=EditorOpts.CopyWordAtCursorOnCopyNone;
|
||||
OnClick:=@GeneralCheckBoxOnClick;
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
//
|
||||
|
||||
@ -3728,10 +3691,14 @@ end;
|
||||
|
||||
procedure TEditorOptionsForm.ResizeGeneralPage;
|
||||
var MaxX,ChkBoxW:integer;
|
||||
ChkBoxH: Integer;
|
||||
x: Integer;
|
||||
y: Integer;
|
||||
begin
|
||||
MaxX:=Width-5;
|
||||
ChkBoxW:=(MaxX-20) div 2;
|
||||
|
||||
ChkBoxH:=21;
|
||||
|
||||
with EditorOptionsGroupBox do begin
|
||||
Top:=5;
|
||||
Left:=5;
|
||||
@ -3741,169 +3708,127 @@ begin
|
||||
|
||||
// many, many checkboxes ...
|
||||
|
||||
x:=5;
|
||||
y:=2;
|
||||
|
||||
with AltSetsColumnModeCheckBox do begin
|
||||
Top:=5;
|
||||
Left:=5;
|
||||
Width:=ChkBoxW;
|
||||
Height:=16;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with AutoIndentCheckBox do begin
|
||||
Top:=AltSetsColumnModeCheckBox.Top+AltSetsColumnModeCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with BracketHighlightCheckBox do begin
|
||||
Top:=AutoIndentCheckBox.Top+AutoIndentCheckBox.Height+5;
|
||||
Left:=AutoIndentCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with DragDropEditingCheckBox do begin
|
||||
Top:=BracketHighlightCheckBox.Top+BracketHighlightCheckBox.Height+5;
|
||||
Left:=BracketHighlightCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with DropFilesCheckBox do begin
|
||||
Top:=DragDropEditingCheckBox.Top+DragDropEditingCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with HalfPageScrollCheckBox do begin
|
||||
Top:=DropFilesCheckBox.Top+DropFilesCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with KeepCaretXCheckBox do begin
|
||||
Top:=HalfPageScrollCheckBox.Top+HalfPageScrollCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with PersistentCaretCheckBox do begin
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Top:=KeepCaretXCheckBox.Top+KeepCaretXCheckBox.Height+5;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with ScrollByOneLessCheckBox do begin
|
||||
Top:=PersistentCaretCheckBox.Top+PersistentCaretCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with ScrollPastEoFCheckBox do begin
|
||||
Top:=ScrollByOneLessCheckBox.Top+ScrollByOneLessCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with MouseLinksCheckBox do begin
|
||||
Top:=ScrollPastEoFCheckBox.Top+ScrollPastEoFCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with ShowGutterHintsCheckBox do begin
|
||||
Top:=MouseLinksCheckBox.Top+MouseLinksCheckBox.Height+5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
// right side
|
||||
x:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
|
||||
y:=2;
|
||||
|
||||
with ScrollPastEoLCheckBox do begin
|
||||
Top:=5;
|
||||
Left:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with ShowCloseBtnInNoteBookCheckBox do begin
|
||||
Top:=ScrollPastEoLCheckBox.Top+ScrollPastEoLCheckBox.Height+5;
|
||||
Left:=ScrollPastEoLCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with ShowScrollHintCheckBox do begin
|
||||
Top:=ShowCloseBtnInNoteBookCheckBox.Top
|
||||
+ShowCloseBtnInNoteBookCheckBox.Height+5;
|
||||
Left:=ShowCloseBtnInNoteBookCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with SmartTabsCheckBox do begin
|
||||
Top:=ShowScrollHintCheckBox.Top+ShowScrollHintCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with TabsToSpacesCheckBox do begin
|
||||
Top:=SmartTabsCheckBox.Top+SmartTabsCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with TrimTrailingSpacesCheckBox do begin
|
||||
Top:=TabsToSpacesCheckBox.Top+TabsToSpacesCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with UndoAfterSaveCheckBox do begin
|
||||
Top:=TrimTrailingSpacesCheckBox.Top+TrimTrailingSpacesCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with DoubleClickLineCheckBox do begin
|
||||
Top:=UndoAfterSaveCheckBox.Top+UndoAfterSaveCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with FindTextAtCursorCheckBox do begin
|
||||
Top:=DoubleClickLineCheckBox.Top+DoubleClickLineCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with UseSyntaxHighlightCheckBox do begin
|
||||
Top:=FindTextAtCursorCheckBox.Top+FindTextAtCursorCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
with CopyWordAtCursorOnCopyNoneCheckBox do begin
|
||||
Top:=UseSyntaxHighlightCheckBox.Top+UseSyntaxHighlightCheckBox.Height+5;
|
||||
Left:=ShowScrollHintCheckBox.Left;
|
||||
Width:=ChkBoxW;
|
||||
Height:=AltSetsColumnModeCheckBox.Height;
|
||||
SetBounds(x,y,ChkBoxW,Height);
|
||||
end;
|
||||
inc(y,ChkBoxH);
|
||||
|
||||
//
|
||||
|
||||
|
@ -34,7 +34,9 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, Buttons, StdCtrls, Dialogs,
|
||||
HelpIntf, HelpHTML,
|
||||
CodeToolManager, CodeAtom, CodeCache, CustomCodeTool, CodeTree,
|
||||
PascalParserTool, FindDeclarationTool,
|
||||
HelpIntf, HelpHTML, DialogProcs,
|
||||
IDEOptionDefs, EnvironmentOpts, AboutFrm, Project, PackageDefs, MainBar,
|
||||
HelpOptions, MainIntf;
|
||||
|
||||
@ -49,6 +51,10 @@ type
|
||||
procedure ConnectMainBarEvents; virtual;
|
||||
procedure LoadHelpOptions; virtual; abstract;
|
||||
procedure SaveHelpOptions; virtual; abstract;
|
||||
|
||||
function ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint;
|
||||
var ErrMsg: string): TShowHelpResult; virtual; abstract;
|
||||
end;
|
||||
|
||||
|
||||
@ -59,7 +65,10 @@ type
|
||||
function ShowHelpSelector(Nodes: TList; var ErrMsg: string;
|
||||
var Selection: THelpNode): TShowHelpResult; override;
|
||||
procedure ShowError(ShowResult: TShowHelpResult; const ErrMsg: string); override;
|
||||
function GetBaseURLForBasePathObject(BasePathObject: TObject): string; override;
|
||||
function GetBaseDirectoryForBasePathObject(BasePathObject: TObject): string; override;
|
||||
function ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint;
|
||||
var ErrMsg: string): TShowHelpResult; override;
|
||||
end;
|
||||
|
||||
|
||||
@ -86,6 +95,10 @@ type
|
||||
procedure ShowIDEHelpForContext(HelpContext: THelpContext);
|
||||
procedure ShowIDEHelpForKeyword(const Keyword: string);
|
||||
|
||||
function ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint;
|
||||
var ErrMsg: string): TShowHelpResult; override;
|
||||
public
|
||||
property MainHelpDB: THelpDatabase read FMainHelpDB;
|
||||
end;
|
||||
|
||||
@ -261,8 +274,8 @@ begin
|
||||
MessageDlg(ErrorCaption,ErrMsg,mtError,[mbCancel],0);
|
||||
end;
|
||||
|
||||
function TIDEHelpDatabases.GetBaseURLForBasePathObject(BasePathObject: TObject
|
||||
): string;
|
||||
function TIDEHelpDatabases.GetBaseDirectoryForBasePathObject(
|
||||
BasePathObject: TObject): string;
|
||||
begin
|
||||
Result:='';
|
||||
if (BasePathObject=HelpBoss) or (BasePathObject=MainIDEInterface) then
|
||||
@ -271,7 +284,12 @@ begin
|
||||
Result:=TProject(BasePathObject).ProjectDirectory
|
||||
else if BasePathObject is TLazPackage then
|
||||
Result:=TLazPackage(BasePathObject).Directory;
|
||||
Result:=FilenameToURL(Result);
|
||||
end;
|
||||
|
||||
function TIDEHelpDatabases.ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint; var ErrMsg: string): TShowHelpResult;
|
||||
begin
|
||||
Result:=HelpBoss.ShowHelpForSourcePosition(Filename,CodePos,ErrMsg);
|
||||
end;
|
||||
|
||||
{ THelpManager }
|
||||
@ -366,5 +384,160 @@ begin
|
||||
ShowHelpOrErrorForKeyword(MainHelpDB.ID,Keyword);
|
||||
end;
|
||||
|
||||
function THelpManager.ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint; var ErrMsg: string): TShowHelpResult;
|
||||
|
||||
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.ExtractProcHead(Node,
|
||||
[phpWithoutClassName]));
|
||||
ctnProcedureHead:
|
||||
AddContext(pihcParameterList,'');
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
MainCodeBuffer: TCodeBuffer;
|
||||
Tool: TCustomCodeTool;
|
||||
CleanPos: integer;
|
||||
i: Integer;
|
||||
Node: TCodeTreeNode;
|
||||
IncludeChain: TList;
|
||||
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,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)');
|
||||
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;
|
||||
|
||||
var
|
||||
CodeBuffer: TCodeBuffer;
|
||||
i: Integer;
|
||||
CurCodePos: PCodeXYPosition;
|
||||
ListOfPCodeXYPosition: TList;
|
||||
PascalHelpContextLists: TList;
|
||||
NewList: TPascalHelpContextList;
|
||||
begin
|
||||
debugln('THelpManager.ShowHelpForSourcePosition A Filename=',Filename,' ',dbgs(CodePos));
|
||||
Result:=shrSuccess;
|
||||
ErrMsg:='No help found for "'+Filename+'"'
|
||||
+' at ('+IntToStr(CodePos.Y)+','+IntToStr(CodePos.X)+')';
|
||||
// commit editor changes
|
||||
if not CodeToolBoss.GatherExternalChanges then exit;
|
||||
// get code buffer for Filename
|
||||
if mrOk<>LoadCodeBuffer(CodeBuffer,FileName,[lbfCheckIfText]) then
|
||||
exit;
|
||||
ListOfPCodeXYPosition:=nil;
|
||||
PascalHelpContextLists:=nil;
|
||||
try
|
||||
// get all possible declarations for this identifier
|
||||
if CodeToolBoss.FindDeclarationsAndAncestors(CodeBuffer,CodePos.X,CodePos.Y,
|
||||
ListOfPCodeXYPosition) then
|
||||
begin
|
||||
debugln('THelpManager.ShowHelpForSourcePosition B Success ',dbgs(ListOfPCodeXYPosition.Count));
|
||||
// convert the source positions in pascal help context list
|
||||
if ListOfPCodeXYPosition=nil then exit;
|
||||
for i:=0 to ListOfPCodeXYPosition.Count-1 do begin
|
||||
CurCodePos:=PCodeXYPosition(ListOfPCodeXYPosition[i]);
|
||||
debugln('THelpManager.ShowHelpForSourcePosition C ',CurCodePos^.Code.Filename,' X=',dbgs(CurCodePos^.X),' Y=',dbgs(CurCodePos^.Y));
|
||||
NewList:=ConvertCodePosToPascalHelpContext(CurCodePos);
|
||||
if NewList<>nil then begin
|
||||
if PascalHelpContextLists=nil then
|
||||
PascalHelpContextLists:=TList.Create;
|
||||
PascalHelpContextLists.Add(NewList);
|
||||
end;
|
||||
end;
|
||||
if PascalHelpContextLists=nil then exit;
|
||||
|
||||
// invoke help system
|
||||
debugln('THelpManager.ShowHelpForSourcePosition D PascalHelpContextLists.Count=',dbgs(PascalHelpContextLists.Count));
|
||||
Result:=ShowHelpForPascalContexts(PascalHelpContextLists,ErrMsg);
|
||||
end else begin
|
||||
MainIDEInterface.DoJumpToCodeToolBossError;
|
||||
end;
|
||||
finally
|
||||
if ListOfPCodeXYPosition<>nil then begin
|
||||
for i:=0 to ListOfPCodeXYPosition.Count-1 do begin
|
||||
CurCodePos:=PCodeXYPosition(ListOfPCodeXYPosition[i]);
|
||||
Dispose(CurCodePos);
|
||||
end;
|
||||
ListOfPCodeXYPosition.Free;
|
||||
end;
|
||||
if PascalHelpContextLists<>nil then begin
|
||||
for i:=0 to PascalHelpContextLists.Count-1 do
|
||||
TObject(PascalHelpContextLists[i]).Free;
|
||||
PascalHelpContextLists.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -42,7 +42,7 @@ end;
|
||||
|
||||
procedure IfDirectoryExistsAdd(const Directory: string; List: TStrings);
|
||||
begin
|
||||
if DirectoryExists(Directory) then List.Add(Directory);
|
||||
if DirPathExists(Directory) then List.Add(Directory);
|
||||
end;
|
||||
|
||||
procedure GetDefaultLCLLibPaths(List: TStrings);
|
||||
@ -55,6 +55,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2004/08/22 22:47:43 mattias
|
||||
implemented context help for source editor
|
||||
|
||||
Revision 1.3 2004/08/20 09:47:36 mattias
|
||||
added darwin libpaths to Makefile and LCL Usage lib paths
|
||||
|
||||
|
@ -40,7 +40,7 @@ end;
|
||||
|
||||
procedure IfDirectoryExistsAdd(const Directory: string; List: TStrings);
|
||||
begin
|
||||
if DirectoryExists(Directory) then List.Add(Directory);
|
||||
if DirPathExists(Directory) then List.Add(Directory);
|
||||
end;
|
||||
|
||||
procedure GetDefaultLCLLibPaths(List: TStrings);
|
||||
@ -55,6 +55,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.19 2004/08/22 22:47:43 mattias
|
||||
implemented context help for source editor
|
||||
|
||||
Revision 1.18 2004/08/20 09:47:36 mattias
|
||||
added darwin libpaths to Makefile and LCL Usage lib paths
|
||||
|
||||
|
@ -2411,7 +2411,7 @@ Begin
|
||||
exit;
|
||||
end;
|
||||
if mrOk<>LoadCodeBuffer(PreReadBuf,AFileName,
|
||||
[lbfCheckIfText,lbfUpdateFromDisk,lbfRevert])
|
||||
[lbfCheckIfText,lbfUpdateFromDisk,lbfRevert])
|
||||
then
|
||||
exit;
|
||||
if DoCreateProjectForProgram(PreReadBuf)=mrOk then begin
|
||||
@ -10576,6 +10576,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.757 2004/08/22 22:47:43 mattias
|
||||
implemented context help for source editor
|
||||
|
||||
Revision 1.756 2004/08/21 23:16:11 mattias
|
||||
implemented simple HTML help viewer
|
||||
|
||||
|
@ -1313,6 +1313,5 @@ begin
|
||||
SourceNotebook.FindInFiles(AProject, FindText);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
@ -41,7 +41,7 @@ uses
|
||||
{$IFDEF IDE_MEM_CHECK}
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, Controls, LCLProc, LCLType, LCLIntf, FileCtrl,
|
||||
Classes, SysUtils, Controls, LCLProc, LCLType, LResources, LCLIntf, FileCtrl,
|
||||
Forms, Buttons, ComCtrls, Dialogs, StdCtrls, GraphType, Graphics,
|
||||
Extctrls, Menus,
|
||||
// codetools
|
||||
@ -49,14 +49,15 @@ uses
|
||||
// synedit
|
||||
SynEditTypes, SynEdit, SynRegExpr, SynEditHighlighter, //SynHighlighterPas,
|
||||
SynEditAutoComplete, SynEditKeyCmds, SynCompletion,
|
||||
// IDE interface
|
||||
HelpIntf, SrcEditorIntf,
|
||||
// IDE units
|
||||
IDECommands, EditorOptions, KeyMapping, Project,
|
||||
FindReplaceDialog, WordCompletion, FindInFilesDlg, IDEProcs, IDEOptionDefs,
|
||||
MsgView, SearchResultView, InputHistory, LazarusIDEStrConsts,
|
||||
BaseDebugManager, Debugger, LResources, LazConf, EnvironmentOpts,
|
||||
LazarusIDEStrConsts, LazConf, IDECommands, EditorOptions, KeyMapping, Project,
|
||||
WordCompletion, FindReplaceDialog, FindInFilesDlg, IDEProcs, IDEOptionDefs,
|
||||
EnvironmentOpts, MsgView, SearchResultView, InputHistory,
|
||||
SortSelectionDlg, EncloseSelectionDlg, DiffDialog, ConDef,
|
||||
SourceEditProcs, SourceMarks, CharacterMapDlg, frmSearch,
|
||||
SrcEditorIntf;
|
||||
BaseDebugManager, Debugger, MainIntf;
|
||||
|
||||
type
|
||||
TSourceNoteBook = class;
|
||||
@ -241,6 +242,9 @@ type
|
||||
procedure InsertDateTime;
|
||||
procedure InsertChangeLogEntry;
|
||||
procedure InsertCVSKeyword(const AKeyWord: string);
|
||||
|
||||
// context help
|
||||
procedure FindHelpForSourceAtCursor;
|
||||
|
||||
// editor commands
|
||||
procedure DoEditorExecuteCommand(EditorCommand: integer);
|
||||
@ -902,7 +906,9 @@ begin
|
||||
end;
|
||||
|
||||
Procedure TSourceEditor.ProcessCommand(Sender: TObject;
|
||||
var Command: TSynEditorCommand; var AChar: TCharacter; Data: pointer);
|
||||
var Command: TSynEditorCommand; var AChar: TCharacter; Data: pointer);
|
||||
// these are normal commands for synedit, define extra actions here
|
||||
// otherwise use ProcessUserCommand
|
||||
begin
|
||||
if (FSourceNoteBook<>nil)
|
||||
and (snIncrementalFind in FSourceNoteBook.States) then begin
|
||||
@ -933,7 +939,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
case Command of
|
||||
|
||||
ecSelEditorTop, ecSelEditorBottom, ecEditorTop, ecEditorBottom:
|
||||
@ -962,6 +967,7 @@ end;
|
||||
|
||||
Procedure TSourceEditor.ProcessUserCommand(Sender: TObject;
|
||||
var Command: TSynEditorCommand; var AChar: TCharacter; Data: pointer);
|
||||
// define all extra keys here, that should are not handled by synedit
|
||||
var
|
||||
I: Integer;
|
||||
P: TPoint;
|
||||
@ -970,8 +976,13 @@ var
|
||||
Begin
|
||||
Handled:=true;
|
||||
|
||||
//debugln('TSourceEditor.ProcessUserCommand A ',dbgs(Command));
|
||||
|
||||
case Command of
|
||||
|
||||
ecContextHelp:
|
||||
FindHelpForSourceAtCursor;
|
||||
|
||||
ecIdentCompletion :
|
||||
if not TCustomSynEdit(Sender).ReadOnly then begin
|
||||
CurrentCompletionType:=ctIdentCompletion;
|
||||
@ -1410,6 +1421,12 @@ begin
|
||||
FEditor.SelText:='$'+AKeyWord+'$'+LineEnding;
|
||||
end;
|
||||
|
||||
procedure TSourceEditor.FindHelpForSourceAtCursor;
|
||||
begin
|
||||
writeln('TSourceEditor.FindHelpForSourceAtCursor A');
|
||||
ShowHelpOrErrorForSourcePosition(Filename,FEditor.CaretXY);
|
||||
end;
|
||||
|
||||
procedure TSourceEditor.OnGutterClick(Sender: TObject; X, Y, Line: integer;
|
||||
mark: TSynEditMark);
|
||||
var
|
||||
|
@ -29,8 +29,9 @@ implicitunits=actionseditor \
|
||||
objectinspector \
|
||||
objinspstrconsts \
|
||||
propedits \
|
||||
helpintf \
|
||||
helpfpdoc \
|
||||
helphtml \
|
||||
helpintf \
|
||||
texttools \
|
||||
actionseditor \
|
||||
formeditingintf \
|
||||
|
@ -22,7 +22,8 @@ uses
|
||||
IDECommands, PropEdits, ObjInspStrConsts, ObjectInspector, ColumnDlg,
|
||||
ComponentEditors, GraphPropEdits, ListViewPropEdit, ImageListEditor,
|
||||
ComponentTreeView, ActionsEditor, HelpIntf, TextTools, FormEditingIntf,
|
||||
SrcEditorIntf, ComponentReg, PackageIntf, HelpHTML, ConfigStorage;
|
||||
SrcEditorIntf, ComponentReg, PackageIntf, HelpHTML, ConfigStorage,
|
||||
HelpFPDoc;
|
||||
|
||||
implementation
|
||||
|
||||
|
37
ideintf/helpfpdoc.pas
Normal file
37
ideintf/helpfpdoc.pas
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
*****************************************************************************
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Mattias Gaertner
|
||||
|
||||
Abstract:
|
||||
Help database for FPDoc.
|
||||
}
|
||||
unit HelpFPDoc;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, HelpIntf;
|
||||
|
||||
type
|
||||
{ TFPDocHelpDatabase }
|
||||
|
||||
TFPDocHelpDatabase = class(THelpDatabase)
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
@ -22,7 +22,7 @@ unit HelpIntf;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Controls, FileCtrl, ConfigStorage;
|
||||
Classes, SysUtils, Controls, FileCtrl, ConfigStorage, ObjInspStrConsts;
|
||||
|
||||
type
|
||||
// All help-specific error messages should be thrown as this type.
|
||||
@ -39,17 +39,19 @@ type
|
||||
shrSelectorError
|
||||
);
|
||||
TShowHelpResults = set of TShowHelpResult;
|
||||
|
||||
|
||||
{ TPascalHelpContextList }
|
||||
|
||||
TPascalHelpContextType = (
|
||||
pihcFilename,
|
||||
pihcSourceName, // unit name, library name, ..
|
||||
pihcClass,
|
||||
pihcObject,
|
||||
pihcInterface,
|
||||
pihcRecord,
|
||||
pihcEnumeration,
|
||||
pihcProperty,
|
||||
pihcProcedure,
|
||||
pihcParameterList,
|
||||
pihcVariable,
|
||||
pihcType,
|
||||
pihcConst,
|
||||
pihcIdentifier
|
||||
);
|
||||
TPascalHelpContext = record
|
||||
@ -57,8 +59,23 @@ type
|
||||
Context: string;
|
||||
end;
|
||||
TPascalHelpContextPtr = ^TPascalHelpContext;
|
||||
|
||||
|
||||
|
||||
TPascalHelpContextList = class
|
||||
private
|
||||
FCount: integer;
|
||||
fItems: TPascalHelpContextPtr;
|
||||
function GetItems(Index: integer): TPascalHelpContext;
|
||||
public
|
||||
procedure Add(const Context: TPascalHelpContext);
|
||||
procedure Insert(Index: integer; const Context: TPascalHelpContext);
|
||||
procedure Clear;
|
||||
destructor Destroy; override;
|
||||
property Count: integer read FCount;
|
||||
property Items[Index: integer]: TPascalHelpContext read GetItems;
|
||||
property List: TPascalHelpContextPtr read fItems;
|
||||
end;
|
||||
|
||||
|
||||
THelpDatabase = class;
|
||||
|
||||
{ THelpNode
|
||||
@ -139,9 +156,14 @@ type
|
||||
private
|
||||
FBasePathObject: TObject;
|
||||
FFilename: string;
|
||||
procedure SetFilename(const AValue: string);
|
||||
public
|
||||
function FileMatches(const AFilename: string): boolean; virtual;
|
||||
function GetFullFilename: string; virtual;
|
||||
function GetBasePath: string; virtual;
|
||||
published
|
||||
property BasePathObject: TObject read FBasePathObject write FBasePathObject;
|
||||
property Filename: string read FFilename write FFilename;
|
||||
property Filename: string read FFilename write SetFilename;
|
||||
end;
|
||||
|
||||
|
||||
@ -159,6 +181,8 @@ type
|
||||
private
|
||||
FFileMask: string;
|
||||
FWithSubDirectories: boolean;
|
||||
public
|
||||
function FileMatches(const AFilename: string): boolean; override;
|
||||
published
|
||||
property FileMask: string read FFileMask write FFileMask;
|
||||
property WithSubDirectories: boolean read FWithSubDirectories
|
||||
@ -226,6 +250,9 @@ type
|
||||
function GetNodesForContext(HelpContext: THelpContext;
|
||||
var ListOfNodes: TList; var ErrMsg: string
|
||||
): TShowHelpResult; virtual;
|
||||
function GetNodesForPascalContexts(ListOfPascalHelpContextList: TList;
|
||||
var ListOfNodes: TList;
|
||||
var ErrMsg: string): TShowHelpResult; virtual;
|
||||
function FindViewer(const MimeType: string; var ErrMsg: string;
|
||||
var Viewer: THelpViewer): TShowHelpResult; virtual;
|
||||
public
|
||||
@ -262,6 +289,8 @@ type
|
||||
property Items[Index: integer]: THelpDatabase read GetItems; default;
|
||||
public
|
||||
function FindDatabase(ID: THelpDatabaseID): THelpDatabase;
|
||||
function GetDatabase(ID: THelpDatabaseID; HelpDB: THelpDatabase;
|
||||
var HelpResult: TShowHelpResult; var ErrMsg: string): boolean;
|
||||
function IndexOf(ID: THelpDatabaseID): integer;
|
||||
function CreateUniqueDatabaseID(const WishID: string): THelpDatabaseID;
|
||||
function CreateHelpDatabase(const WishID: string;
|
||||
@ -270,6 +299,7 @@ type
|
||||
function ShowTableOfContents(var ErrMsg: string): TShowHelpResult;
|
||||
procedure ShowError(ShowResult: TShowHelpResult; const ErrMsg: string); virtual; abstract;
|
||||
function GetBaseURLForBasePathObject(BasePathObject: TObject): string; virtual;
|
||||
function GetBaseDirectoryForBasePathObject(BasePathObject: TObject): string; virtual;
|
||||
public
|
||||
// show help for ...
|
||||
function ShowHelpForNodes(Nodes: TList; var ErrMsg: string): TShowHelpResult;
|
||||
@ -279,8 +309,11 @@ type
|
||||
function ShowHelpForKeyword(HelpDatabaseID: THelpDatabaseID;
|
||||
const HelpKeyword: string;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
function ShowHelpForPascalSource(ContextList: TPascalHelpContextPtr;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
function ShowHelpForPascalContexts(ListOfPascalHelpContextList: TList;
|
||||
var ErrMsg: string): TShowHelpResult; virtual;
|
||||
function ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint;
|
||||
var ErrMsg: string): TShowHelpResult; virtual;
|
||||
function ShowHelpForMessageLine(const MessageLine: string;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
function ShowHelpForClass(const AClass: TClass;
|
||||
@ -291,6 +324,9 @@ type
|
||||
function GetNodesForContext(HelpContext: THelpContext;
|
||||
var ListOfNodes: TList; var ErrMsg: string
|
||||
): TShowHelpResult; virtual;
|
||||
function GetNodesForPascalContexts(ListOfPascalHelpContextList: TList;
|
||||
var ListOfNodes: TList;
|
||||
var ErrMsg: string): TShowHelpResult; virtual;
|
||||
function ShowHelpSelector(Nodes: TList; var ErrMsg: string;
|
||||
var Selection: THelpNode): TShowHelpResult; virtual;
|
||||
public
|
||||
@ -390,8 +426,12 @@ function ShowHelpForKeyword(const HelpKeyword: string; var ErrMsg: string
|
||||
): TShowHelpResult;
|
||||
|
||||
// help for pascal identifier
|
||||
function ShowHelpForPascalSource(ContextList: TPascalHelpContextPtr;
|
||||
function ShowHelpForPascalContexts(ListOfPascalHelpContextList: TList;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
function ShowHelpForPascalContext(ContextList: TPascalHelpContextList;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
function ShowHelpOrErrorForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint): TShowHelpResult;
|
||||
|
||||
// help for messages (compiler messages, codetools messages, make messages, ...)
|
||||
function ShowHelpForMessageLine(const MessageLine: string;
|
||||
@ -463,10 +503,35 @@ begin
|
||||
Result:=ShowHelpForKeyword('',HelpKeyword,ErrMsg);
|
||||
end;
|
||||
|
||||
function ShowHelpForPascalSource(ContextList: TPascalHelpContextPtr;
|
||||
function ShowHelpForPascalContexts(ListOfPascalHelpContextList: TList;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
begin
|
||||
Result:=HelpDatabases.ShowHelpForPascalSource(ContextList,ErrMsg);
|
||||
Result:=HelpDatabases.ShowHelpForPascalContexts(ListOfPascalHelpContextList,
|
||||
ErrMsg);
|
||||
end;
|
||||
|
||||
function ShowHelpForPascalContext(ContextList: TPascalHelpContextList;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
var
|
||||
List: TList;
|
||||
begin
|
||||
List:=TList.Create;
|
||||
try
|
||||
List.Add(ContextList);
|
||||
Result:=ShowHelpForPascalContexts(List,ErrMsg);
|
||||
finally
|
||||
List.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ShowHelpOrErrorForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint): TShowHelpResult;
|
||||
var
|
||||
ErrMsg: String;
|
||||
begin
|
||||
ErrMsg:='';
|
||||
Result:=HelpDatabases.ShowHelpForSourcePosition(Filename,CodePos,ErrMsg);
|
||||
HelpDatabases.ShowError(Result,ErrMsg);
|
||||
end;
|
||||
|
||||
function ShowHelpForMessageLine(const MessageLine: string;
|
||||
@ -499,7 +564,7 @@ begin
|
||||
URLPath:='';
|
||||
URLParams:='';
|
||||
Len:=length(URL);
|
||||
// search color
|
||||
// search colon
|
||||
ColonPos:=1;
|
||||
while (ColonPos<=len) and (URL[ColonPos]<>':') do
|
||||
inc(ColonPos);
|
||||
@ -600,14 +665,14 @@ end;
|
||||
procedure THelpDatabase.RegisterSelf;
|
||||
begin
|
||||
if Databases<>nil then
|
||||
raise EHelpSystemException.Create(ID+': Already registered');
|
||||
raise EHelpSystemException.Create(Format(oisHelpAlreadyRegistered, [ID]));
|
||||
Databases:=HelpDatabases;
|
||||
end;
|
||||
|
||||
procedure THelpDatabase.UnregisterSelf;
|
||||
begin
|
||||
if Databases=nil then
|
||||
raise EHelpSystemException.Create(ID+': Not registered');
|
||||
raise EHelpSystemException.Create(Format(oisHelpNotRegistered, [ID]));
|
||||
Databases:=nil;
|
||||
end;
|
||||
|
||||
@ -685,7 +750,7 @@ begin
|
||||
Node:=THelpDBSearchItem(FSearchItems[i]).Node;
|
||||
if (Node=nil) or (not Node.IDValid) then continue;
|
||||
if AnsiCompareText(Node.ID,HelpKeyword)<>0 then continue;
|
||||
CreateListAndAdd(Node, ListOfNodes);
|
||||
CreateListAndAdd(Node,ListOfNodes);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -702,11 +767,44 @@ begin
|
||||
ErrMsg:='';
|
||||
// add the registered nodes
|
||||
if FSearchItems<>nil then begin
|
||||
for i:=0 to FSearchItems.COunt-1 do begin
|
||||
for i:=0 to FSearchItems.Count-1 do begin
|
||||
Node:=THelpDBSearchItem(FSearchItems[i]).Node;
|
||||
if (Node=nil) or (not Node.ContextValid) then continue;
|
||||
if Node.Context<>HelpContext then continue;
|
||||
CreateListAndAdd(Node, ListOfNodes);
|
||||
CreateListAndAdd(Node,ListOfNodes);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function THelpDatabase.GetNodesForPascalContexts(
|
||||
ListOfPascalHelpContextList: TList; var ListOfNodes: TList; var ErrMsg: string
|
||||
): TShowHelpResult;
|
||||
// if ListOfNodes<>nil new nodes will be appended
|
||||
// if ListOfNodes=nil and nodes exists a new list will be created
|
||||
var
|
||||
i: Integer;
|
||||
j: Integer;
|
||||
SearchItem: THelpDBSearchItem;
|
||||
PascalContext: TPascalHelpContextList;
|
||||
FileItem: THelpDBSISourceFile;
|
||||
begin
|
||||
Result:=shrSuccess;
|
||||
ErrMsg:='';
|
||||
if (ListOfPascalHelpContextList=nil)
|
||||
or (ListOfPascalHelpContextList.Count=0) then exit;
|
||||
// add the registered nodes
|
||||
if FSearchItems<>nil then begin
|
||||
for i:=0 to FSearchItems.Count-1 do begin
|
||||
SearchItem:=THelpDBSearchItem(FSearchItems[i]);
|
||||
if not (SearchItem is THelpDBSISourceFile) then continue;
|
||||
FileItem:=THelpDBSISourceFile(SearchItem);
|
||||
// check every pascal context
|
||||
for j:=0 to ListOfPascalHelpContextList.Count-1 do begin
|
||||
PascalContext:=TPascalHelpContextList(ListOfPascalHelpContextList[j]);
|
||||
if (PascalContext.List[0].Descriptor=pihcFilename)
|
||||
and (FileItem.FileMatches(PascalContext.List[0].Context)) then
|
||||
CreateListAndAdd(FileItem.Node,ListOfNodes);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -720,7 +818,8 @@ begin
|
||||
Viewers:=HelpViewers.GetViewersSupportingMimeType(MimeType);
|
||||
try
|
||||
if (Viewers=nil) or (Viewers.Count=0) then begin
|
||||
ErrMsg:='Help Database "'+ID+'" did not found a viewer for a help page of type '+MimeType;
|
||||
ErrMsg:=Format(oisHelpHelpDatabaseDidNotFoundAViewerForAHelpPageOfType, [
|
||||
'"', ID, '"', MimeType]);
|
||||
Result:=shrViewerNotFound;
|
||||
end else begin
|
||||
Viewer:=THelpViewer(Viewers[0]);
|
||||
@ -834,6 +933,21 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function THelpDatabases.GetDatabase(ID: THelpDatabaseID; HelpDB: THelpDatabase;
|
||||
var HelpResult: TShowHelpResult; var ErrMsg: string): boolean;
|
||||
begin
|
||||
HelpDB:=FindDatabase(ID);
|
||||
if HelpDB=nil then begin
|
||||
Result:=false;
|
||||
HelpResult:=shrDatabaseNotFound;
|
||||
ErrMsg:=Format(oisHelpHelpDatabaseNotFound, ['"', ID, '"']);
|
||||
end else begin
|
||||
HelpResult:=shrSuccess;
|
||||
Result:=true;
|
||||
ErrMsg:='';
|
||||
end;
|
||||
end;
|
||||
|
||||
function THelpDatabases.IndexOf(ID: THelpDatabaseID): integer;
|
||||
begin
|
||||
Result:=Count-1;
|
||||
@ -875,6 +989,14 @@ end;
|
||||
|
||||
function THelpDatabases.GetBaseURLForBasePathObject(BasePathObject: TObject
|
||||
): string;
|
||||
begin
|
||||
Result:=GetBaseDirectoryForBasePathObject(BasePathObject);
|
||||
if Result='' then exit;
|
||||
Result:=FilenameToURL(Result);
|
||||
end;
|
||||
|
||||
function THelpDatabases.GetBaseDirectoryForBasePathObject(BasePathObject: TObject
|
||||
): string;
|
||||
begin
|
||||
Result:='';
|
||||
end;
|
||||
@ -897,7 +1019,7 @@ begin
|
||||
// show node
|
||||
if Node.Owner=nil then begin
|
||||
Result:=shrDatabaseNotFound;
|
||||
ErrMsg:='Help node has no Help Database';
|
||||
ErrMsg:=Format(oisHelpHelpNodeHasNoHelpDatabase, ['"', Node.Title, '"']);
|
||||
exit;
|
||||
end;
|
||||
Result:=Node.Owner.ShowHelp(nil,Node,ErrMsg);
|
||||
@ -916,12 +1038,8 @@ begin
|
||||
Nodes:=nil;
|
||||
try
|
||||
if HelpDatabaseID<>'' then begin
|
||||
HelpDB:=FindDatabase(HelpDatabaseID);
|
||||
if HelpDB=nil then begin
|
||||
Result:=shrDatabaseNotFound;
|
||||
ErrMsg:='Help Database "'+HelpDatabaseID+'" not found';
|
||||
exit;
|
||||
end;
|
||||
HelpDB:=nil;
|
||||
if not GetDatabase(HelpDatabaseID,HelpDB,Result,ErrMsg) then exit;
|
||||
Result:=HelpDB.GetNodesForContext(HelpContext,Nodes,ErrMsg);
|
||||
if Result<>shrSuccess then exit;
|
||||
end else begin
|
||||
@ -934,10 +1052,10 @@ begin
|
||||
if (Nodes=nil) or (Nodes.Count=0) then begin
|
||||
Result:=shrContextNotFound;
|
||||
if HelpDatabaseID<>'' then
|
||||
ErrMsg:='Help context '+IntToStr(HelpContext)+' not found'
|
||||
+' in Database "'+HelpDatabaseID+'".'
|
||||
ErrMsg:=Format(oisHelpHelpContextNotFoundInDatabase, [IntToStr(
|
||||
HelpContext), '"', HelpDatabaseID, '"'])
|
||||
else
|
||||
ErrMsg:='Help context '+IntToStr(HelpContext)+' not found.';
|
||||
ErrMsg:=Format(oisHelpHelpContextNotFound, [IntToStr(HelpContext)]);
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -960,12 +1078,8 @@ begin
|
||||
Nodes:=nil;
|
||||
try
|
||||
if HelpDatabaseID<>'' then begin
|
||||
HelpDB:=FindDatabase(HelpDatabaseID);
|
||||
if HelpDB=nil then begin
|
||||
Result:=shrDatabaseNotFound;
|
||||
ErrMsg:='Help Database "'+HelpDatabaseID+'" not found';
|
||||
exit;
|
||||
end;
|
||||
HelpDB:=nil;
|
||||
if not GetDatabase(HelpDatabaseID,HelpDB,Result,ErrMsg) then exit;
|
||||
Result:=HelpDB.GetNodesForKeyword(HelpKeyword,Nodes,ErrMsg);
|
||||
if Result<>shrSuccess then exit;
|
||||
end else begin
|
||||
@ -978,10 +1092,10 @@ begin
|
||||
if (Nodes=nil) or (Nodes.Count=0) then begin
|
||||
Result:=shrContextNotFound;
|
||||
if HelpDatabaseID<>'' then
|
||||
ErrMsg:='Help keyword "'+HelpKeyword+'" not found'
|
||||
+' in Database "'+HelpDatabaseID+'".'
|
||||
ErrMsg:=Format(oisHelpHelpKeywordNotFoundInDatabase, ['"', HelpKeyword,
|
||||
'"', '"', HelpDatabaseID, '"'])
|
||||
else
|
||||
ErrMsg:='Help keyword "'+HelpKeyword+'" not found.';
|
||||
ErrMsg:=Format(oisHelpHelpKeywordNotFound, ['"', HelpKeyword, '"']);
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -991,28 +1105,54 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function THelpDatabases.ShowHelpForPascalSource(
|
||||
ContextList: TPascalHelpContextPtr; var ErrMsg: string): TShowHelpResult;
|
||||
function THelpDatabases.ShowHelpForPascalContexts(
|
||||
ListOfPascalHelpContextList: TList; var ErrMsg: string): TShowHelpResult;
|
||||
var
|
||||
Nodes: TList;
|
||||
begin
|
||||
ErrMsg:='';
|
||||
Result:=shrSuccess;
|
||||
|
||||
// search node
|
||||
Nodes:=nil;
|
||||
try
|
||||
Result:=GetNodesForPascalContexts(ListOfPascalHelpContextList,Nodes,ErrMsg);
|
||||
if Result<>shrSuccess then exit;
|
||||
|
||||
// check if at least one node found
|
||||
if (Nodes<>nil) then Nodes.Pack;
|
||||
if (Nodes=nil) or (Nodes.Count=0) then begin
|
||||
// no node found for the source is not a bug
|
||||
Result:=shrSuccess;
|
||||
ErrMsg:='';
|
||||
exit;
|
||||
end;
|
||||
|
||||
Result:=ShowHelpForNodes(Nodes,ErrMsg);
|
||||
finally
|
||||
Nodes.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function THelpDatabases.ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint; var ErrMsg: string): TShowHelpResult;
|
||||
begin
|
||||
Result:=shrHelpNotFound;
|
||||
// ToDo
|
||||
ErrMsg:='THelpDatabases.ShowHelpForPascalSource not implemented yet';
|
||||
ErrMsg:='THelpDatabases.ShowHelpForPascalSource not implemented';
|
||||
end;
|
||||
|
||||
function THelpDatabases.ShowHelpForMessageLine(const MessageLine: string;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
begin
|
||||
Result:=shrHelpNotFound;
|
||||
// ToDo
|
||||
ErrMsg:='THelpDatabases.ShowHelpForMessageLine not implemented yet';
|
||||
ErrMsg:='THelpDatabases.ShowHelpForMessageLine not implemented';
|
||||
end;
|
||||
|
||||
function THelpDatabases.ShowHelpForClass(const AClass: TClass;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
begin
|
||||
Result:=shrHelpNotFound;
|
||||
// ToDo
|
||||
ErrMsg:='THelpDatabases.ShowHelpForClass not implemented yet';
|
||||
ErrMsg:='THelpDatabases.ShowHelpForClass not implemented';
|
||||
end;
|
||||
|
||||
function THelpDatabases.GetNodesForKeyword(const HelpKeyword: string;
|
||||
@ -1045,6 +1185,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function THelpDatabases.GetNodesForPascalContexts(
|
||||
ListOfPascalHelpContextList: TList; var ListOfNodes: TList;
|
||||
var ErrMsg: string): TShowHelpResult;
|
||||
// if ListOfNodes<>nil then new nodes will be appended
|
||||
// if ListOfNodes=nil and nodes exists a new list will be created
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=shrSuccess;
|
||||
ErrMsg:='';
|
||||
for i:=Count-1 downto 0 do begin
|
||||
Result:=Items[i].GetNodesForPascalContexts(ListOfPascalHelpContextList,
|
||||
ListOfNodes,ErrMsg);
|
||||
if Result<>shrSuccess then exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
function THelpDatabases.ShowHelpSelector(Nodes: TList; var ErrMsg: string;
|
||||
var Selection: THelpNode): TShowHelpResult;
|
||||
// Nodes is a list of THelpNode
|
||||
@ -1357,6 +1514,98 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{ TPascalHelpContextList }
|
||||
|
||||
function TPascalHelpContextList.GetItems(Index: integer): TPascalHelpContext;
|
||||
begin
|
||||
Result:=fItems[Index];
|
||||
end;
|
||||
|
||||
procedure TPascalHelpContextList.Add(const Context: TPascalHelpContext);
|
||||
begin
|
||||
inc(FCount);
|
||||
ReAllocMem(fItems,SizeOf(TPascalHelpContext)*FCount);
|
||||
fItems[FCount-1]:=Context;
|
||||
end;
|
||||
|
||||
procedure TPascalHelpContextList.Insert(Index: integer;
|
||||
const Context: TPascalHelpContext);
|
||||
begin
|
||||
inc(FCount);
|
||||
ReAllocMem(fItems,SizeOf(TPascalHelpContext)*FCount);
|
||||
if Index<FCount-1 then
|
||||
System.Move(fItems[Index],fItems[Index+1],
|
||||
SizeOf(TPascalHelpContext)*(FCount-Index-1));
|
||||
fItems[Index]:=Context;
|
||||
end;
|
||||
|
||||
procedure TPascalHelpContextList.Clear;
|
||||
begin
|
||||
ReAllocMem(fItems,0);
|
||||
end;
|
||||
|
||||
destructor TPascalHelpContextList.Destroy;
|
||||
begin
|
||||
Clear;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{ THelpDBSISourceFile }
|
||||
|
||||
procedure THelpDBSISourceFile.SetFilename(const AValue: string);
|
||||
begin
|
||||
FFilename:=TrimFilename(AValue);
|
||||
end;
|
||||
|
||||
function THelpDBSISourceFile.FileMatches(const AFilename: string): boolean;
|
||||
begin
|
||||
if (FFilename='') or (AFilename='') then
|
||||
Result:=false
|
||||
else
|
||||
Result:=CompareFilenames(GetFullFilename,AFilename)=0;
|
||||
end;
|
||||
|
||||
function THelpDBSISourceFile.GetFullFilename: string;
|
||||
var
|
||||
BaseDir: String;
|
||||
begin
|
||||
if FilenameIsAbsolute(FFilename) then
|
||||
Result:=FFilename
|
||||
else begin
|
||||
BaseDir:=GetBasePath;
|
||||
Result:=BaseDir+FFilename;
|
||||
end;
|
||||
end;
|
||||
|
||||
function THelpDBSISourceFile.GetBasePath: string;
|
||||
begin
|
||||
if BasePathObject=nil then
|
||||
Result:=''
|
||||
else
|
||||
Result:=AppendPathDelim(
|
||||
HelpDatabases.GetBaseDirectoryForBasePathObject(BasePathObject));
|
||||
end;
|
||||
|
||||
{ THelpDBSISourceDirectory }
|
||||
|
||||
function THelpDBSISourceDirectory.FileMatches(const AFilename: string
|
||||
): boolean;
|
||||
var
|
||||
TheDirectory: String;
|
||||
begin
|
||||
Result:=false;
|
||||
if (FFilename='') or (AFilename='') then exit;
|
||||
TheDirectory:=GetFullFilename;
|
||||
if WithSubDirectories then begin
|
||||
if not FileIsInPath(AFilename,TheDirectory) then exit;
|
||||
end else begin
|
||||
if not FileIsInDirectory(AFilename,TheDirectory) then exit;
|
||||
end;
|
||||
if (FileMask<>'')
|
||||
and (not FileInFilenameMasks(ExtractFilename(AFilename),FileMask)) then exit;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
initialization
|
||||
HelpDatabases:=nil;
|
||||
|
||||
|
@ -102,6 +102,18 @@ resourcestring
|
||||
oisHelpBrowserNotFound = 'Browser %s%s%s not found.';
|
||||
oisHelpBrowserNotExecutable = 'Browser %s%s%s not executable.';
|
||||
oisHelpErrorWhileExecuting = 'Error while executing %s%s%s:%s%s';
|
||||
oisHelpHelpNodeHasNoHelpDatabase = 'Help node %s%s%s has no Help Database';
|
||||
oisHelpHelpDatabaseDidNotFoundAViewerForAHelpPageOfType = 'Help Database %s%'
|
||||
+'s%s did not found a viewer for a help page of type %s';
|
||||
oisHelpAlreadyRegistered = '%s: Already registered';
|
||||
oisHelpNotRegistered = '%s: Not registered';
|
||||
oisHelpHelpDatabaseNotFound = 'Help Database %s%s%s not found';
|
||||
oisHelpHelpKeywordNotFoundInDatabase = 'Help keyword %s%s%s not found in '
|
||||
+'Database %s%s%s.';
|
||||
oisHelpHelpKeywordNotFound = 'Help keyword %s%s%s not found.';
|
||||
oisHelpHelpContextNotFoundInDatabase = 'Help context %s not found in '
|
||||
+'Database %s%s%s.';
|
||||
oisHelpHelpContextNotFound = 'Help context %s not found.';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -20,12 +20,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
}
|
||||
|
||||
{
|
||||
@author(DirectoryExists - Curtis White <cwhite@aracnet.com>)
|
||||
@created(23-Apr-2000)
|
||||
@lastmod(23-Apr-2000)
|
||||
|
||||
This unit contains file and directory controls and supporting handling functions.
|
||||
}
|
||||
@ -93,10 +87,10 @@ Type
|
||||
property OnChange: TNotifyEvent Read FOnChange Write FOnChange;
|
||||
property Sorted default true;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
{ TFileListBox }
|
||||
|
||||
|
||||
TFileListBox = class(TCustomFileListBox)
|
||||
published
|
||||
property Align;
|
||||
@ -174,6 +168,8 @@ function TrimFilename(const AFilename: string): string;
|
||||
function CleanAndExpandFilename(const Filename: string): string;
|
||||
function CleanAndExpandDirectory(const Filename: string): string;
|
||||
function FileIsInPath(const Filename, Path: string): boolean;
|
||||
function FileIsInDirectory(const Filename, Directory: string): boolean;
|
||||
function FileInFilenameMasks(const Filename, Masks: string): boolean;
|
||||
|
||||
// file search
|
||||
type
|
||||
@ -400,6 +396,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.28 2004/08/22 22:47:43 mattias
|
||||
implemented context help for source editor
|
||||
|
||||
Revision 1.27 2004/04/21 21:22:52 mattias
|
||||
fixed updatinf Filename when setting Filename from Luis
|
||||
|
||||
|
@ -798,6 +798,36 @@ begin
|
||||
and (CompareFilenames(ExpPath,LeftStr(ExpFile,l))=0);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function FileIsInPath(const Filename, Path: string): boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function FileIsInDirectory(const Filename, Directory: string): boolean;
|
||||
var
|
||||
ExpFile: String;
|
||||
ExpDir: String;
|
||||
LenFile: Integer;
|
||||
LenDir: Integer;
|
||||
p: LongInt;
|
||||
begin
|
||||
ExpFile:=CleanAndExpandFilename(Filename);
|
||||
ExpDir:=CleanAndExpandDirectory(Directory);
|
||||
LenFile:=length(ExpFile);
|
||||
LenDir:=length(ExpDir);
|
||||
p:=LenFile;
|
||||
while (p>0) and (ExpFile[p]<>PathDelim) do dec(p);
|
||||
Result:=(p=LenDir) and (p<LenFile)
|
||||
and (CompareFilenames(ExpDir,LeftStr(ExpFile,p))=0);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function FileInFilenameMasks(const Filename, Masks: string): boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function FileInFilenameMasks(const Filename, Masks: string): boolean;
|
||||
begin
|
||||
// TODO
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function CopyFile(const SrcFilename, DestFilename: string): boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
@ -928,6 +958,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.47 2004/08/22 22:47:43 mattias
|
||||
implemented context help for source editor
|
||||
|
||||
Revision 1.46 2004/08/04 23:47:32 mattias
|
||||
implemented FileExecutable for win32
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user