implemented context help for source editor

git-svn-id: trunk@5836 -
This commit is contained in:
mattias 2004-08-22 22:47:43 +00:00
parent 3907430a32
commit 07dd273dd2
20 changed files with 868 additions and 267 deletions

1
.gitattributes vendored
View File

@ -654,6 +654,7 @@ ideintf/componenttreeview.pas svneol=native#text/pascal
ideintf/configstorage.pas svneol=native#text/pascal ideintf/configstorage.pas svneol=native#text/pascal
ideintf/formeditingintf.pas svneol=native#text/pascal ideintf/formeditingintf.pas svneol=native#text/pascal
ideintf/graphpropedits.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/helphtml.pas svneol=native#text/pascal
ideintf/helpintf.pas svneol=native#text/pascal ideintf/helpintf.pas svneol=native#text/pascal
ideintf/idecommands.pas svneol=native#text/pascal ideintf/idecommands.pas svneol=native#text/pascal

View File

@ -140,6 +140,7 @@ type
function AtomPosition(StartPos, EndPos: integer): TAtomPosition; function AtomPosition(StartPos, EndPos: integer): TAtomPosition;
function CodePosition(P: integer; Code: TCodeBuffer): TCodePosition; function CodePosition(P: integer; Code: TCodeBuffer): TCodePosition;
function CodeXYPosition(X, Y: integer; Code: TCodeBuffer): TCodeXYPosition; function CodeXYPosition(X, Y: integer; Code: TCodeBuffer): TCodeXYPosition;
function CompareCodeXYPositions(Pos1, Pos2: PCodeXYPosition): integer;
var var
WordToAtomFlag: TWordToAtomFlag; WordToAtomFlag: TWordToAtomFlag;
@ -169,6 +170,17 @@ begin
Result.Code:=Code; Result.Code:=Code;
end; 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 } { TAtomRing }
constructor TAtomRing.Create; constructor TAtomRing.Create;

View File

@ -105,13 +105,11 @@ type
TheUnitInFilename: string): TCodeBuffer; TheUnitInFilename: string): TCodeBuffer;
function DoOnGetSrcPathForCompiledUnit(Sender: TObject; function DoOnGetSrcPathForCompiledUnit(Sender: TObject;
const AFilename: string): string; const AFilename: string): string;
function GetMainCode(Code: TCodeBuffer): TCodeBuffer;
function FindCodeOfMainUnitHint(Code: TCodeBuffer): TCodeBuffer; function FindCodeOfMainUnitHint(Code: TCodeBuffer): TCodeBuffer;
procedure CreateScanner(Code: TCodeBuffer); procedure CreateScanner(Code: TCodeBuffer);
function InitCurCodeTool(Code: TCodeBuffer): boolean; function InitCurCodeTool(Code: TCodeBuffer): boolean;
function InitResourceTool: boolean; function InitResourceTool: boolean;
procedure ClearPositions; procedure ClearPositions;
function FindCodeToolForSource(Code: TCodeBuffer): TCustomCodeTool;
function GetCodeToolForSource(Code: TCodeBuffer; function GetCodeToolForSource(Code: TCodeBuffer;
ExceptionOnError: boolean): TCustomCodeTool; ExceptionOnError: boolean): TCustomCodeTool;
procedure SetAbortable(const AValue: boolean); procedure SetAbortable(const AValue: boolean);
@ -163,6 +161,10 @@ type
function SaveBufferAs(OldBuffer: TCodeBuffer;const ExpandedFilename: string; function SaveBufferAs(OldBuffer: TCodeBuffer;const ExpandedFilename: string;
var NewBuffer: TCodeBuffer): boolean; var NewBuffer: TCodeBuffer): boolean;
function FilenameHasSourceExt(const AFilename: string): 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 property OnSearchUsedUnit: TOnSearchUsedUnit
read FOnSearchUsedUnit write FOnSearchUsedUnit; read FOnSearchUsedUnit write FOnSearchUsedUnit;
@ -276,6 +278,8 @@ type
function FindDeclarationInInterface(Code: TCodeBuffer; function FindDeclarationInInterface(Code: TCodeBuffer;
const Identifier: string; var NewCode: TCodeBuffer; const Identifier: string; var NewCode: TCodeBuffer;
var NewX, NewY, NewTopLine: integer): boolean; var NewX, NewY, NewTopLine: integer): boolean;
function FindDeclarationsAndAncestors(Code: TCodeBuffer; X,Y: integer;
var ListOfPCodeXYPosition: TList): boolean;
// gather identifiers (i.e. all visible) // gather identifiers (i.e. all visible)
function GatherIdentifiers(Code: TCodeBuffer; X,Y: integer): boolean; function GatherIdentifiers(Code: TCodeBuffer; X,Y: integer): boolean;
@ -698,6 +702,34 @@ begin
CreateScanner(Result); CreateScanner(Result);
end; 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 function TCodeToolManager.FindCodeOfMainUnitHint(Code: TCodeBuffer
): TCodeBuffer; ): TCodeBuffer;
var var
@ -1191,6 +1223,33 @@ begin
{$ENDIF} {$ENDIF}
end; 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 function TCodeToolManager.GatherIdentifiers(Code: TCodeBuffer; X, Y: integer
): boolean; ): boolean;
var var

View File

@ -656,6 +656,8 @@ type
function BaseTypeOfNodeHasSubIdents(ANode: TCodeTreeNode): boolean; function BaseTypeOfNodeHasSubIdents(ANode: TCodeTreeNode): boolean;
function FindBaseTypeOfNode(Params: TFindDeclarationParams; function FindBaseTypeOfNode(Params: TFindDeclarationParams;
Node: TCodeTreeNode): TFindContext; Node: TCodeTreeNode): TFindContext;
function FindDeclarationsAndAncestors(const CursorPos: TCodeXYPosition;
var ListOfPCodeXYPosition: TList): boolean;
function JumpToNode(ANode: TCodeTreeNode; function JumpToNode(ANode: TCodeTreeNode;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewPos: TCodeXYPosition; var NewTopLine: integer;
@ -2765,6 +2767,68 @@ begin
{$ENDIF} {$ENDIF}
end; 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; function TFindDeclarationTool.JumpToNode(ANode: TCodeTreeNode;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewPos: TCodeXYPosition; var NewTopLine: integer;
IgnoreJumpCentered: boolean): boolean; IgnoreJumpCentered: boolean): boolean;

View File

@ -119,6 +119,7 @@ type
DefinitionNode: TCodeTreeNode): TCodeTreeNode; DefinitionNode: TCodeTreeNode): TCodeTreeNode;
function NodeIsPartOfTypeDefinition(ANode: TCodeTreeNode): boolean; function NodeIsPartOfTypeDefinition(ANode: TCodeTreeNode): boolean;
function ExtractDefinitionNodeType(DefinitionNode: TCodeTreeNode): string; function ExtractDefinitionNodeType(DefinitionNode: TCodeTreeNode): string;
function ExtractDefinitionName(DefinitionNode: TCodeTreeNode): string;
// sections // sections
function GetSourceType: TCodeTreeNodeDesc; function GetSourceType: TCodeTreeNodeDesc;
@ -1221,6 +1222,15 @@ begin
Result:=GetIdentifier(@Src[TypeNode.StartPos]); Result:=GetIdentifier(@Src[TypeNode.StartPos]);
end; 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 function TPascalReaderTool.PropertyIsDefault(PropertyNode: TCodeTreeNode
): boolean; ): boolean;
begin begin

View File

@ -94,7 +94,7 @@ var
begin begin
Dir:=TrimFilename(DirectoryCombobox.Text); Dir:=TrimFilename(DirectoryCombobox.Text);
if (DefineTree=nil) or (not FilenameIsAbsolute(Dir)) if (DefineTree=nil) or (not FilenameIsAbsolute(Dir))
or (not DirectoryExists(Dir)) then begin or (not DirPathExists(Dir)) then begin
ClearValues; ClearValues;
exit; exit;
end; end;

View File

@ -3318,6 +3318,9 @@ end;
procedure TEditorOptionsForm.SetupGeneralPage; procedure TEditorOptionsForm.SetupGeneralPage;
var MaxX,ChkBoxW:integer; var MaxX,ChkBoxW:integer;
ChkBoxH: Integer;
x: Integer;
y: Integer;
begin begin
MaxX:=Width-5; MaxX:=Width-5;
ChkBoxW:=(MaxX-20) div 2; ChkBoxW:=(MaxX-20) div 2;
@ -3337,305 +3340,265 @@ begin
// many, many checkboxes ... // many, many checkboxes ...
// left side // left side
x:=5;
y:=2;
ChkBoxH:=21;
AltSetsColumnModeCheckBox:=TCheckBox.Create(Self); AltSetsColumnModeCheckBox:=TCheckBox.Create(Self);
with AltSetsColumnModeCheckBox do begin with AltSetsColumnModeCheckBox do begin
Name:='AltSetsColumnModeCheckBox'; Name:='AltSetsColumnModeCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=5; SetBounds(x,y,ChkBoxW,Height);
Left:=5;
Width:=ChkBoxW;
Height:=16;
Caption:=dlgAltSetClMode; Caption:=dlgAltSetClMode;
Checked:=eoAltSetsColumnMode in EditorOpts.SynEditOptions; Checked:=eoAltSetsColumnMode in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
AutoIndentCheckBox:=TCheckBox.Create(Self); AutoIndentCheckBox:=TCheckBox.Create(Self);
with AutoIndentCheckBox do begin with AutoIndentCheckBox do begin
Name:='AutoIndentCheckBox'; Name:='AutoIndentCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=AltSetsColumnModeCheckBox.Top+AltSetsColumnModeCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgAutoIdent; Caption:=dlgAutoIdent;
Checked:=eoAutoIndent in EditorOpts.SynEditOptions; Checked:=eoAutoIndent in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
BracketHighlightCheckBox:=TCheckBox.Create(Self); BracketHighlightCheckBox:=TCheckBox.Create(Self);
with BracketHighlightCheckBox do begin with BracketHighlightCheckBox do begin
Name:='BracketHighlightCheckBox'; Name:='BracketHighlightCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=AutoIndentCheckBox.Top+AutoIndentCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AutoIndentCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgBracHighlight; Caption:=dlgBracHighlight;
Checked:=eoBracketHighlight in EditorOpts.SynEditOptions; Checked:=eoBracketHighlight in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
DragDropEditingCheckBox:=TCheckBox.Create(Self); DragDropEditingCheckBox:=TCheckBox.Create(Self);
with DragDropEditingCheckBox do begin with DragDropEditingCheckBox do begin
Name:='DragDropEditingCheckBox'; Name:='DragDropEditingCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=BracketHighlightCheckBox.Top+BracketHighlightCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=BracketHighlightCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgDragDropEd; Caption:=dlgDragDropEd;
Checked:=eoDragDropEditing in EditorOpts.SynEditOptions; Checked:=eoDragDropEditing in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
DropFilesCheckBox:=TCheckBox.Create(Self); DropFilesCheckBox:=TCheckBox.Create(Self);
with DropFilesCheckBox do begin with DropFilesCheckBox do begin
Name:='DropFilesCheckBox'; Name:='DropFilesCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=DragDropEditingCheckBox.Top+DragDropEditingCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgDropFiles; Caption:=dlgDropFiles;
Checked:=eoDropFiles in EditorOpts.SynEditOptions; Checked:=eoDropFiles in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
Enabled:=false; Enabled:=false;
end; end;
inc(y,ChkBoxH);
HalfPageScrollCheckBox:=TCheckBox.Create(Self); HalfPageScrollCheckBox:=TCheckBox.Create(Self);
with HalfPageScrollCheckBox do begin with HalfPageScrollCheckBox do begin
Name:='HalfPageScrollCheckBox'; Name:='HalfPageScrollCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=DropFilesCheckBox.Top+DropFilesCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgHalfPageScroll; Caption:=dlgHalfPageScroll;
Checked:=eoHalfPageScroll in EditorOpts.SynEditOptions; Checked:=eoHalfPageScroll in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
KeepCaretXCheckBox:=TCheckBox.Create(Self); KeepCaretXCheckBox:=TCheckBox.Create(Self);
with KeepCaretXCheckBox do begin with KeepCaretXCheckBox do begin
Name:='KeepCaretXCheckBox'; Name:='KeepCaretXCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=HalfPageScrollCheckBox.Top+HalfPageScrollCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgKeepCaretX; Caption:=dlgKeepCaretX;
Checked:=eoKeepCaretX in EditorOpts.SynEditOptions; Checked:=eoKeepCaretX in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
PersistentCaretCheckBox:=TCheckBox.Create(Self); PersistentCaretCheckBox:=TCheckBox.Create(Self);
with PersistentCaretCheckBox do begin with PersistentCaretCheckBox do begin
Name:='PersistentCaretCheckBox'; Name:='PersistentCaretCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=KeepCaretXCheckBox.Top+KeepCaretXCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgPersistentCaret; Caption:=dlgPersistentCaret;
Checked:=eoPersistentCaret in EditorOpts.SynEditOptions; Checked:=eoPersistentCaret in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
ScrollByOneLessCheckBox:=TCheckBox.Create(Self); ScrollByOneLessCheckBox:=TCheckBox.Create(Self);
with ScrollByOneLessCheckBox do begin with ScrollByOneLessCheckBox do begin
Name:='ScrollByOneLessCheckBox'; Name:='ScrollByOneLessCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=PersistentCaretCheckBox.Top+PersistentCaretCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgScrollByOneLess; Caption:=dlgScrollByOneLess;
Checked:=eoScrollByOneLess in EditorOpts.SynEditOptions; Checked:=eoScrollByOneLess in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
ScrollPastEoFCheckBox:=TCheckBox.Create(Self); ScrollPastEoFCheckBox:=TCheckBox.Create(Self);
with ScrollPastEoFCheckBox do begin with ScrollPastEoFCheckBox do begin
Name:='ScrollPastEoFCheckBox'; Name:='ScrollPastEoFCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=ScrollByOneLessCheckBox.Top+ScrollByOneLessCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ScrollByOneLessCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgScrollPastEndFile; Caption:=dlgScrollPastEndFile;
Checked:=eoScrollPastEoF in EditorOpts.SynEditOptions; Checked:=eoScrollPastEoF in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
MouseLinksCheckBox:=TCheckBox.Create(Self); MouseLinksCheckBox:=TCheckBox.Create(Self);
with MouseLinksCheckBox do begin with MouseLinksCheckBox do begin
Name:='MouseLinksCheckBox'; Name:='MouseLinksCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=ScrollPastEoFCheckBox.Top+ScrollPastEoFCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ScrollPastEoFCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgMouseLinks; Caption:=dlgMouseLinks;
Checked:=EditorOpts.CtrlMouseLinks; Checked:=EditorOpts.CtrlMouseLinks;
end; end;
inc(y,ChkBoxH);
ShowGutterHintsCheckBox:=TCheckBox.Create(Self); ShowGutterHintsCheckBox:=TCheckBox.Create(Self);
with ShowGutterHintsCheckBox do begin with ShowGutterHintsCheckBox do begin
Name:='ShowGutterHintsCheckBox'; Name:='ShowGutterHintsCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=MouseLinksCheckBox.Top+MouseLinksCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=MouseLinksCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgShowGutterHints; Caption:=dlgShowGutterHints;
Checked:=EditorOpts.ShowGutterHints; Checked:=EditorOpts.ShowGutterHints;
end; end;
inc(y,ChkBoxH);
// right side // right side
x:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
y:=2;
ScrollPastEoLCheckBox:=TCheckBox.Create(Self); ScrollPastEoLCheckBox:=TCheckBox.Create(Self);
with ScrollPastEoLCheckBox do begin with ScrollPastEoLCheckBox do begin
Name:='ScrollPastEoLCheckBox'; Name:='ScrollPastEoLCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Left:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ScrollPastEoFCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgScrollPastEndLine; Caption:=dlgScrollPastEndLine;
Checked:=eoScrollPastEoL in EditorOpts.SynEditOptions; Checked:=eoScrollPastEoL in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
ShowCloseBtnInNoteBookCheckBox:=TCheckBox.Create(Self); ShowCloseBtnInNoteBookCheckBox:=TCheckBox.Create(Self);
with ShowCloseBtnInNoteBookCheckBox do begin with ShowCloseBtnInNoteBookCheckBox do begin
Name:='ShowCloseBtnInNoteBookCheckBox'; Name:='ShowCloseBtnInNoteBookCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=ScrollPastEoLCheckBox.Top+ScrollPastEoLCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ScrollPastEoLCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgCloseButtonsNotebook; Caption:=dlgCloseButtonsNotebook;
Checked:=EditorOpts.ShowTabCloseButtons; Checked:=EditorOpts.ShowTabCloseButtons;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
ShowScrollHintCheckBox:=TCheckBox.Create(Self); ShowScrollHintCheckBox:=TCheckBox.Create(Self);
with ShowScrollHintCheckBox do begin with ShowScrollHintCheckBox do begin
Name:='ShowScrollHintCheckBox'; Name:='ShowScrollHintCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=ShowCloseBtnInNoteBookCheckBox.Top SetBounds(x,y,ChkBoxW,Height);
+ShowCloseBtnInNoteBookCheckBox.Height+5;
Left:=ShowCloseBtnInNoteBookCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgShowScrollHint; Caption:=dlgShowScrollHint;
Checked:=eoShowScrollHint in EditorOpts.SynEditOptions; Checked:=eoShowScrollHint in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
SmartTabsCheckBox:=TCheckBox.Create(Self); SmartTabsCheckBox:=TCheckBox.Create(Self);
with SmartTabsCheckBox do begin with SmartTabsCheckBox do begin
Name:='SmartTabsCheckBox'; Name:='SmartTabsCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=ShowScrollHintCheckBox.Top+ShowScrollHintCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgSmartTabs; Caption:=dlgSmartTabs;
Checked:=eoSmartTabs in EditorOpts.SynEditOptions; Checked:=eoSmartTabs in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
TabsToSpacesCheckBox:=TCheckBox.Create(Self); TabsToSpacesCheckBox:=TCheckBox.Create(Self);
with TabsToSpacesCheckBox do begin with TabsToSpacesCheckBox do begin
Name:='TabsToSpacesCheckBox'; Name:='TabsToSpacesCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=SmartTabsCheckBox.Top+SmartTabsCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgTabsToSpaces; Caption:=dlgTabsToSpaces;
Checked:=eoTabsToSpaces in EditorOpts.SynEditOptions; Checked:=eoTabsToSpaces in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
TrimTrailingSpacesCheckBox:=TCheckBox.Create(Self); TrimTrailingSpacesCheckBox:=TCheckBox.Create(Self);
with TrimTrailingSpacesCheckBox do begin with TrimTrailingSpacesCheckBox do begin
Name:='TrimTrailingSpacesCheckBox'; Name:='TrimTrailingSpacesCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=TabsToSpacesCheckBox.Top+TabsToSpacesCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgTrimTrailingSpaces; Caption:=dlgTrimTrailingSpaces;
Checked:=eoTrimTrailingSpaces in EditorOpts.SynEditOptions; Checked:=eoTrimTrailingSpaces in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
UndoAfterSaveCheckBox:=TCheckBox.Create(Self); UndoAfterSaveCheckBox:=TCheckBox.Create(Self);
with UndoAfterSaveCheckBox do begin with UndoAfterSaveCheckBox do begin
Name:='UndoAfterSaveCheckBox'; Name:='UndoAfterSaveCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=TrimTrailingSpacesCheckBox.Top+TrimTrailingSpacesCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgUndoAfterSave; Caption:=dlgUndoAfterSave;
Checked:=EditorOpts.UndoAfterSave; Checked:=EditorOpts.UndoAfterSave;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
DoubleClickLineCheckBox:=TCheckBox.Create(Self); DoubleClickLineCheckBox:=TCheckBox.Create(Self);
with DoubleClickLineCheckBox do begin with DoubleClickLineCheckBox do begin
Name:='DoubleClickLineCheckBox'; Name:='DoubleClickLineCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=UndoAfterSaveCheckBox.Top+UndoAfterSaveCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgDoubleClickLine; Caption:=dlgDoubleClickLine;
Checked:=eoDoubleClickSelectsLine in EditorOpts.SynEditOptions; Checked:=eoDoubleClickSelectsLine in EditorOpts.SynEditOptions;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
FindTextAtCursorCheckBox:=TCheckBox.Create(Self); FindTextAtCursorCheckBox:=TCheckBox.Create(Self);
with FindTextAtCursorCheckBox do begin with FindTextAtCursorCheckBox do begin
Name:='FindTextAtCursorCheckBox'; Name:='FindTextAtCursorCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=DoubleClickLineCheckBox.Top+DoubleClickLineCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgFindTextatCursor; Caption:=dlgFindTextatCursor;
Checked:=EditorOpts.FindTextAtCursor; Checked:=EditorOpts.FindTextAtCursor;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
UseSyntaxHighlightCheckBox:=TCheckBox.Create(Self); UseSyntaxHighlightCheckBox:=TCheckBox.Create(Self);
with UseSyntaxHighlightCheckBox do begin with UseSyntaxHighlightCheckBox do begin
Name:='UseSyntaxHighlightCheckBox'; Name:='UseSyntaxHighlightCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=FindTextAtCursorCheckBox.Top+FindTextAtCursorCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgUseSyntaxHighlight; Caption:=dlgUseSyntaxHighlight;
Checked:=EditorOpts.UseSyntaxHighlight; Checked:=EditorOpts.UseSyntaxHighlight;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
CopyWordAtCursorOnCopyNoneCheckBox:=TCheckBox.Create(Self); CopyWordAtCursorOnCopyNoneCheckBox:=TCheckBox.Create(Self);
with CopyWordAtCursorOnCopyNoneCheckBox do begin with CopyWordAtCursorOnCopyNoneCheckBox do begin
Name:='CopyWordAtCursorOnCopyNoneCheckBox'; Name:='CopyWordAtCursorOnCopyNoneCheckBox';
Parent:=EditorOptionsGroupBox; Parent:=EditorOptionsGroupBox;
Top:=UseSyntaxHighlightCheckBox.Top+UseSyntaxHighlightCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
Caption:=dlgCopyWordAtCursorOnCopyNone; Caption:=dlgCopyWordAtCursorOnCopyNone;
Checked:=EditorOpts.CopyWordAtCursorOnCopyNone; Checked:=EditorOpts.CopyWordAtCursorOnCopyNone;
OnClick:=@GeneralCheckBoxOnClick; OnClick:=@GeneralCheckBoxOnClick;
end; end;
inc(y,ChkBoxH);
// //
@ -3728,10 +3691,14 @@ end;
procedure TEditorOptionsForm.ResizeGeneralPage; procedure TEditorOptionsForm.ResizeGeneralPage;
var MaxX,ChkBoxW:integer; var MaxX,ChkBoxW:integer;
ChkBoxH: Integer;
x: Integer;
y: Integer;
begin begin
MaxX:=Width-5; MaxX:=Width-5;
ChkBoxW:=(MaxX-20) div 2; ChkBoxW:=(MaxX-20) div 2;
ChkBoxH:=21;
with EditorOptionsGroupBox do begin with EditorOptionsGroupBox do begin
Top:=5; Top:=5;
Left:=5; Left:=5;
@ -3741,169 +3708,127 @@ begin
// many, many checkboxes ... // many, many checkboxes ...
x:=5;
y:=2;
with AltSetsColumnModeCheckBox do begin with AltSetsColumnModeCheckBox do begin
Top:=5; SetBounds(x,y,ChkBoxW,Height);
Left:=5;
Width:=ChkBoxW;
Height:=16;
end; end;
inc(y,ChkBoxH);
with AutoIndentCheckBox do begin with AutoIndentCheckBox do begin
Top:=AltSetsColumnModeCheckBox.Top+AltSetsColumnModeCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with BracketHighlightCheckBox do begin with BracketHighlightCheckBox do begin
Top:=AutoIndentCheckBox.Top+AutoIndentCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AutoIndentCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with DragDropEditingCheckBox do begin with DragDropEditingCheckBox do begin
Top:=BracketHighlightCheckBox.Top+BracketHighlightCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=BracketHighlightCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with DropFilesCheckBox do begin with DropFilesCheckBox do begin
Top:=DragDropEditingCheckBox.Top+DragDropEditingCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with HalfPageScrollCheckBox do begin with HalfPageScrollCheckBox do begin
Top:=DropFilesCheckBox.Top+DropFilesCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with KeepCaretXCheckBox do begin with KeepCaretXCheckBox do begin
Top:=HalfPageScrollCheckBox.Top+HalfPageScrollCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with PersistentCaretCheckBox do begin with PersistentCaretCheckBox do begin
Left:=AltSetsColumnModeCheckBox.Left; SetBounds(x,y,ChkBoxW,Height);
Top:=KeepCaretXCheckBox.Top+KeepCaretXCheckBox.Height+5;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with ScrollByOneLessCheckBox do begin with ScrollByOneLessCheckBox do begin
Top:=PersistentCaretCheckBox.Top+PersistentCaretCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with ScrollPastEoFCheckBox do begin with ScrollPastEoFCheckBox do begin
Top:=ScrollByOneLessCheckBox.Top+ScrollByOneLessCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with MouseLinksCheckBox do begin with MouseLinksCheckBox do begin
Top:=ScrollPastEoFCheckBox.Top+ScrollPastEoFCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with ShowGutterHintsCheckBox do begin with ShowGutterHintsCheckBox do begin
Top:=MouseLinksCheckBox.Top+MouseLinksCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
// right side // right side
x:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
y:=2;
with ScrollPastEoLCheckBox do begin with ScrollPastEoLCheckBox do begin
Top:=5; SetBounds(x,y,ChkBoxW,Height);
Left:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with ShowCloseBtnInNoteBookCheckBox do begin with ShowCloseBtnInNoteBookCheckBox do begin
Top:=ScrollPastEoLCheckBox.Top+ScrollPastEoLCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ScrollPastEoLCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with ShowScrollHintCheckBox do begin with ShowScrollHintCheckBox do begin
Top:=ShowCloseBtnInNoteBookCheckBox.Top SetBounds(x,y,ChkBoxW,Height);
+ShowCloseBtnInNoteBookCheckBox.Height+5;
Left:=ShowCloseBtnInNoteBookCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with SmartTabsCheckBox do begin with SmartTabsCheckBox do begin
Top:=ShowScrollHintCheckBox.Top+ShowScrollHintCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with TabsToSpacesCheckBox do begin with TabsToSpacesCheckBox do begin
Top:=SmartTabsCheckBox.Top+SmartTabsCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with TrimTrailingSpacesCheckBox do begin with TrimTrailingSpacesCheckBox do begin
Top:=TabsToSpacesCheckBox.Top+TabsToSpacesCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with UndoAfterSaveCheckBox do begin with UndoAfterSaveCheckBox do begin
Top:=TrimTrailingSpacesCheckBox.Top+TrimTrailingSpacesCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with DoubleClickLineCheckBox do begin with DoubleClickLineCheckBox do begin
Top:=UndoAfterSaveCheckBox.Top+UndoAfterSaveCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with FindTextAtCursorCheckBox do begin with FindTextAtCursorCheckBox do begin
Top:=DoubleClickLineCheckBox.Top+DoubleClickLineCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with UseSyntaxHighlightCheckBox do begin with UseSyntaxHighlightCheckBox do begin
Top:=FindTextAtCursorCheckBox.Top+FindTextAtCursorCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
with CopyWordAtCursorOnCopyNoneCheckBox do begin with CopyWordAtCursorOnCopyNoneCheckBox do begin
Top:=UseSyntaxHighlightCheckBox.Top+UseSyntaxHighlightCheckBox.Height+5; SetBounds(x,y,ChkBoxW,Height);
Left:=ShowScrollHintCheckBox.Left;
Width:=ChkBoxW;
Height:=AltSetsColumnModeCheckBox.Height;
end; end;
inc(y,ChkBoxH);
// //

View File

@ -34,7 +34,9 @@ interface
uses uses
Classes, SysUtils, LCLProc, Forms, Controls, Buttons, StdCtrls, Dialogs, 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, IDEOptionDefs, EnvironmentOpts, AboutFrm, Project, PackageDefs, MainBar,
HelpOptions, MainIntf; HelpOptions, MainIntf;
@ -49,6 +51,10 @@ type
procedure ConnectMainBarEvents; virtual; procedure ConnectMainBarEvents; virtual;
procedure LoadHelpOptions; virtual; abstract; procedure LoadHelpOptions; virtual; abstract;
procedure SaveHelpOptions; virtual; abstract; procedure SaveHelpOptions; virtual; abstract;
function ShowHelpForSourcePosition(const Filename: string;
const CodePos: TPoint;
var ErrMsg: string): TShowHelpResult; virtual; abstract;
end; end;
@ -59,7 +65,10 @@ type
function ShowHelpSelector(Nodes: TList; var ErrMsg: string; function ShowHelpSelector(Nodes: TList; var ErrMsg: string;
var Selection: THelpNode): TShowHelpResult; override; var Selection: THelpNode): TShowHelpResult; override;
procedure ShowError(ShowResult: TShowHelpResult; const ErrMsg: string); 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; end;
@ -86,6 +95,10 @@ type
procedure ShowIDEHelpForContext(HelpContext: THelpContext); procedure ShowIDEHelpForContext(HelpContext: THelpContext);
procedure ShowIDEHelpForKeyword(const Keyword: string); procedure ShowIDEHelpForKeyword(const Keyword: string);
function ShowHelpForSourcePosition(const Filename: string;
const CodePos: TPoint;
var ErrMsg: string): TShowHelpResult; override;
public
property MainHelpDB: THelpDatabase read FMainHelpDB; property MainHelpDB: THelpDatabase read FMainHelpDB;
end; end;
@ -261,8 +274,8 @@ begin
MessageDlg(ErrorCaption,ErrMsg,mtError,[mbCancel],0); MessageDlg(ErrorCaption,ErrMsg,mtError,[mbCancel],0);
end; end;
function TIDEHelpDatabases.GetBaseURLForBasePathObject(BasePathObject: TObject function TIDEHelpDatabases.GetBaseDirectoryForBasePathObject(
): string; BasePathObject: TObject): string;
begin begin
Result:=''; Result:='';
if (BasePathObject=HelpBoss) or (BasePathObject=MainIDEInterface) then if (BasePathObject=HelpBoss) or (BasePathObject=MainIDEInterface) then
@ -271,7 +284,12 @@ begin
Result:=TProject(BasePathObject).ProjectDirectory Result:=TProject(BasePathObject).ProjectDirectory
else if BasePathObject is TLazPackage then else if BasePathObject is TLazPackage then
Result:=TLazPackage(BasePathObject).Directory; 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; end;
{ THelpManager } { THelpManager }
@ -366,5 +384,160 @@ begin
ShowHelpOrErrorForKeyword(MainHelpDB.ID,Keyword); ShowHelpOrErrorForKeyword(MainHelpDB.ID,Keyword);
end; 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. end.

View File

@ -42,7 +42,7 @@ end;
procedure IfDirectoryExistsAdd(const Directory: string; List: TStrings); procedure IfDirectoryExistsAdd(const Directory: string; List: TStrings);
begin begin
if DirectoryExists(Directory) then List.Add(Directory); if DirPathExists(Directory) then List.Add(Directory);
end; end;
procedure GetDefaultLCLLibPaths(List: TStrings); procedure GetDefaultLCLLibPaths(List: TStrings);
@ -55,6 +55,9 @@ end;
{ {
$Log$ $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 Revision 1.3 2004/08/20 09:47:36 mattias
added darwin libpaths to Makefile and LCL Usage lib paths added darwin libpaths to Makefile and LCL Usage lib paths

View File

@ -40,7 +40,7 @@ end;
procedure IfDirectoryExistsAdd(const Directory: string; List: TStrings); procedure IfDirectoryExistsAdd(const Directory: string; List: TStrings);
begin begin
if DirectoryExists(Directory) then List.Add(Directory); if DirPathExists(Directory) then List.Add(Directory);
end; end;
procedure GetDefaultLCLLibPaths(List: TStrings); procedure GetDefaultLCLLibPaths(List: TStrings);
@ -55,6 +55,9 @@ end;
{ {
$Log$ $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 Revision 1.18 2004/08/20 09:47:36 mattias
added darwin libpaths to Makefile and LCL Usage lib paths added darwin libpaths to Makefile and LCL Usage lib paths

View File

@ -2411,7 +2411,7 @@ Begin
exit; exit;
end; end;
if mrOk<>LoadCodeBuffer(PreReadBuf,AFileName, if mrOk<>LoadCodeBuffer(PreReadBuf,AFileName,
[lbfCheckIfText,lbfUpdateFromDisk,lbfRevert]) [lbfCheckIfText,lbfUpdateFromDisk,lbfRevert])
then then
exit; exit;
if DoCreateProjectForProgram(PreReadBuf)=mrOk then begin if DoCreateProjectForProgram(PreReadBuf)=mrOk then begin
@ -10576,6 +10576,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.756 2004/08/21 23:16:11 mattias
implemented simple HTML help viewer implemented simple HTML help viewer

View File

@ -1313,6 +1313,5 @@ begin
SourceNotebook.FindInFiles(AProject, FindText); SourceNotebook.FindInFiles(AProject, FindText);
end; end;
end. end.

View File

@ -41,7 +41,7 @@ uses
{$IFDEF IDE_MEM_CHECK} {$IFDEF IDE_MEM_CHECK}
MemCheck, MemCheck,
{$ENDIF} {$ENDIF}
Classes, SysUtils, Controls, LCLProc, LCLType, LCLIntf, FileCtrl, Classes, SysUtils, Controls, LCLProc, LCLType, LResources, LCLIntf, FileCtrl,
Forms, Buttons, ComCtrls, Dialogs, StdCtrls, GraphType, Graphics, Forms, Buttons, ComCtrls, Dialogs, StdCtrls, GraphType, Graphics,
Extctrls, Menus, Extctrls, Menus,
// codetools // codetools
@ -49,14 +49,15 @@ uses
// synedit // synedit
SynEditTypes, SynEdit, SynRegExpr, SynEditHighlighter, //SynHighlighterPas, SynEditTypes, SynEdit, SynRegExpr, SynEditHighlighter, //SynHighlighterPas,
SynEditAutoComplete, SynEditKeyCmds, SynCompletion, SynEditAutoComplete, SynEditKeyCmds, SynCompletion,
// IDE interface
HelpIntf, SrcEditorIntf,
// IDE units // IDE units
IDECommands, EditorOptions, KeyMapping, Project, LazarusIDEStrConsts, LazConf, IDECommands, EditorOptions, KeyMapping, Project,
FindReplaceDialog, WordCompletion, FindInFilesDlg, IDEProcs, IDEOptionDefs, WordCompletion, FindReplaceDialog, FindInFilesDlg, IDEProcs, IDEOptionDefs,
MsgView, SearchResultView, InputHistory, LazarusIDEStrConsts, EnvironmentOpts, MsgView, SearchResultView, InputHistory,
BaseDebugManager, Debugger, LResources, LazConf, EnvironmentOpts,
SortSelectionDlg, EncloseSelectionDlg, DiffDialog, ConDef, SortSelectionDlg, EncloseSelectionDlg, DiffDialog, ConDef,
SourceEditProcs, SourceMarks, CharacterMapDlg, frmSearch, SourceEditProcs, SourceMarks, CharacterMapDlg, frmSearch,
SrcEditorIntf; BaseDebugManager, Debugger, MainIntf;
type type
TSourceNoteBook = class; TSourceNoteBook = class;
@ -241,6 +242,9 @@ type
procedure InsertDateTime; procedure InsertDateTime;
procedure InsertChangeLogEntry; procedure InsertChangeLogEntry;
procedure InsertCVSKeyword(const AKeyWord: string); procedure InsertCVSKeyword(const AKeyWord: string);
// context help
procedure FindHelpForSourceAtCursor;
// editor commands // editor commands
procedure DoEditorExecuteCommand(EditorCommand: integer); procedure DoEditorExecuteCommand(EditorCommand: integer);
@ -902,7 +906,9 @@ begin
end; end;
Procedure TSourceEditor.ProcessCommand(Sender: TObject; 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 begin
if (FSourceNoteBook<>nil) if (FSourceNoteBook<>nil)
and (snIncrementalFind in FSourceNoteBook.States) then begin and (snIncrementalFind in FSourceNoteBook.States) then begin
@ -933,7 +939,6 @@ begin
end; end;
end; end;
case Command of case Command of
ecSelEditorTop, ecSelEditorBottom, ecEditorTop, ecEditorBottom: ecSelEditorTop, ecSelEditorBottom, ecEditorTop, ecEditorBottom:
@ -962,6 +967,7 @@ end;
Procedure TSourceEditor.ProcessUserCommand(Sender: TObject; Procedure TSourceEditor.ProcessUserCommand(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TCharacter; Data: pointer); var Command: TSynEditorCommand; var AChar: TCharacter; Data: pointer);
// define all extra keys here, that should are not handled by synedit
var var
I: Integer; I: Integer;
P: TPoint; P: TPoint;
@ -970,8 +976,13 @@ var
Begin Begin
Handled:=true; Handled:=true;
//debugln('TSourceEditor.ProcessUserCommand A ',dbgs(Command));
case Command of case Command of
ecContextHelp:
FindHelpForSourceAtCursor;
ecIdentCompletion : ecIdentCompletion :
if not TCustomSynEdit(Sender).ReadOnly then begin if not TCustomSynEdit(Sender).ReadOnly then begin
CurrentCompletionType:=ctIdentCompletion; CurrentCompletionType:=ctIdentCompletion;
@ -1410,6 +1421,12 @@ begin
FEditor.SelText:='$'+AKeyWord+'$'+LineEnding; FEditor.SelText:='$'+AKeyWord+'$'+LineEnding;
end; end;
procedure TSourceEditor.FindHelpForSourceAtCursor;
begin
writeln('TSourceEditor.FindHelpForSourceAtCursor A');
ShowHelpOrErrorForSourcePosition(Filename,FEditor.CaretXY);
end;
procedure TSourceEditor.OnGutterClick(Sender: TObject; X, Y, Line: integer; procedure TSourceEditor.OnGutterClick(Sender: TObject; X, Y, Line: integer;
mark: TSynEditMark); mark: TSynEditMark);
var var

View File

@ -29,8 +29,9 @@ implicitunits=actionseditor \
objectinspector \ objectinspector \
objinspstrconsts \ objinspstrconsts \
propedits \ propedits \
helpintf \ helpfpdoc \
helphtml \ helphtml \
helpintf \
texttools \ texttools \
actionseditor \ actionseditor \
formeditingintf \ formeditingintf \

View File

@ -22,7 +22,8 @@ uses
IDECommands, PropEdits, ObjInspStrConsts, ObjectInspector, ColumnDlg, IDECommands, PropEdits, ObjInspStrConsts, ObjectInspector, ColumnDlg,
ComponentEditors, GraphPropEdits, ListViewPropEdit, ImageListEditor, ComponentEditors, GraphPropEdits, ListViewPropEdit, ImageListEditor,
ComponentTreeView, ActionsEditor, HelpIntf, TextTools, FormEditingIntf, ComponentTreeView, ActionsEditor, HelpIntf, TextTools, FormEditingIntf,
SrcEditorIntf, ComponentReg, PackageIntf, HelpHTML, ConfigStorage; SrcEditorIntf, ComponentReg, PackageIntf, HelpHTML, ConfigStorage,
HelpFPDoc;
implementation implementation

37
ideintf/helpfpdoc.pas Normal file
View 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.

View File

@ -22,7 +22,7 @@ unit HelpIntf;
interface interface
uses uses
Classes, SysUtils, Controls, FileCtrl, ConfigStorage; Classes, SysUtils, Controls, FileCtrl, ConfigStorage, ObjInspStrConsts;
type type
// All help-specific error messages should be thrown as this type. // All help-specific error messages should be thrown as this type.
@ -39,17 +39,19 @@ type
shrSelectorError shrSelectorError
); );
TShowHelpResults = set of TShowHelpResult; TShowHelpResults = set of TShowHelpResult;
{ TPascalHelpContextList }
TPascalHelpContextType = ( TPascalHelpContextType = (
pihcFilename, pihcFilename,
pihcSourceName, // unit name, library name, .. pihcSourceName, // unit name, library name, ..
pihcClass, pihcProperty,
pihcObject,
pihcInterface,
pihcRecord,
pihcEnumeration,
pihcProcedure, pihcProcedure,
pihcParameterList, pihcParameterList,
pihcVariable,
pihcType,
pihcConst,
pihcIdentifier pihcIdentifier
); );
TPascalHelpContext = record TPascalHelpContext = record
@ -57,8 +59,23 @@ type
Context: string; Context: string;
end; end;
TPascalHelpContextPtr = ^TPascalHelpContext; 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; THelpDatabase = class;
{ THelpNode { THelpNode
@ -139,9 +156,14 @@ type
private private
FBasePathObject: TObject; FBasePathObject: TObject;
FFilename: string; FFilename: string;
procedure SetFilename(const AValue: string);
public
function FileMatches(const AFilename: string): boolean; virtual;
function GetFullFilename: string; virtual;
function GetBasePath: string; virtual;
published published
property BasePathObject: TObject read FBasePathObject write FBasePathObject; property BasePathObject: TObject read FBasePathObject write FBasePathObject;
property Filename: string read FFilename write FFilename; property Filename: string read FFilename write SetFilename;
end; end;
@ -159,6 +181,8 @@ type
private private
FFileMask: string; FFileMask: string;
FWithSubDirectories: boolean; FWithSubDirectories: boolean;
public
function FileMatches(const AFilename: string): boolean; override;
published published
property FileMask: string read FFileMask write FFileMask; property FileMask: string read FFileMask write FFileMask;
property WithSubDirectories: boolean read FWithSubDirectories property WithSubDirectories: boolean read FWithSubDirectories
@ -226,6 +250,9 @@ type
function GetNodesForContext(HelpContext: THelpContext; function GetNodesForContext(HelpContext: THelpContext;
var ListOfNodes: TList; var ErrMsg: string var ListOfNodes: TList; var ErrMsg: string
): TShowHelpResult; virtual; ): TShowHelpResult; virtual;
function GetNodesForPascalContexts(ListOfPascalHelpContextList: TList;
var ListOfNodes: TList;
var ErrMsg: string): TShowHelpResult; virtual;
function FindViewer(const MimeType: string; var ErrMsg: string; function FindViewer(const MimeType: string; var ErrMsg: string;
var Viewer: THelpViewer): TShowHelpResult; virtual; var Viewer: THelpViewer): TShowHelpResult; virtual;
public public
@ -262,6 +289,8 @@ type
property Items[Index: integer]: THelpDatabase read GetItems; default; property Items[Index: integer]: THelpDatabase read GetItems; default;
public public
function FindDatabase(ID: THelpDatabaseID): THelpDatabase; function FindDatabase(ID: THelpDatabaseID): THelpDatabase;
function GetDatabase(ID: THelpDatabaseID; HelpDB: THelpDatabase;
var HelpResult: TShowHelpResult; var ErrMsg: string): boolean;
function IndexOf(ID: THelpDatabaseID): integer; function IndexOf(ID: THelpDatabaseID): integer;
function CreateUniqueDatabaseID(const WishID: string): THelpDatabaseID; function CreateUniqueDatabaseID(const WishID: string): THelpDatabaseID;
function CreateHelpDatabase(const WishID: string; function CreateHelpDatabase(const WishID: string;
@ -270,6 +299,7 @@ type
function ShowTableOfContents(var ErrMsg: string): TShowHelpResult; function ShowTableOfContents(var ErrMsg: string): TShowHelpResult;
procedure ShowError(ShowResult: TShowHelpResult; const ErrMsg: string); virtual; abstract; procedure ShowError(ShowResult: TShowHelpResult; const ErrMsg: string); virtual; abstract;
function GetBaseURLForBasePathObject(BasePathObject: TObject): string; virtual; function GetBaseURLForBasePathObject(BasePathObject: TObject): string; virtual;
function GetBaseDirectoryForBasePathObject(BasePathObject: TObject): string; virtual;
public public
// show help for ... // show help for ...
function ShowHelpForNodes(Nodes: TList; var ErrMsg: string): TShowHelpResult; function ShowHelpForNodes(Nodes: TList; var ErrMsg: string): TShowHelpResult;
@ -279,8 +309,11 @@ type
function ShowHelpForKeyword(HelpDatabaseID: THelpDatabaseID; function ShowHelpForKeyword(HelpDatabaseID: THelpDatabaseID;
const HelpKeyword: string; const HelpKeyword: string;
var ErrMsg: string): TShowHelpResult; var ErrMsg: string): TShowHelpResult;
function ShowHelpForPascalSource(ContextList: TPascalHelpContextPtr; function ShowHelpForPascalContexts(ListOfPascalHelpContextList: TList;
var ErrMsg: string): TShowHelpResult; var ErrMsg: string): TShowHelpResult; virtual;
function ShowHelpForSourcePosition(const Filename: string;
const CodePos: TPoint;
var ErrMsg: string): TShowHelpResult; virtual;
function ShowHelpForMessageLine(const MessageLine: string; function ShowHelpForMessageLine(const MessageLine: string;
var ErrMsg: string): TShowHelpResult; var ErrMsg: string): TShowHelpResult;
function ShowHelpForClass(const AClass: TClass; function ShowHelpForClass(const AClass: TClass;
@ -291,6 +324,9 @@ type
function GetNodesForContext(HelpContext: THelpContext; function GetNodesForContext(HelpContext: THelpContext;
var ListOfNodes: TList; var ErrMsg: string var ListOfNodes: TList; var ErrMsg: string
): TShowHelpResult; virtual; ): TShowHelpResult; virtual;
function GetNodesForPascalContexts(ListOfPascalHelpContextList: TList;
var ListOfNodes: TList;
var ErrMsg: string): TShowHelpResult; virtual;
function ShowHelpSelector(Nodes: TList; var ErrMsg: string; function ShowHelpSelector(Nodes: TList; var ErrMsg: string;
var Selection: THelpNode): TShowHelpResult; virtual; var Selection: THelpNode): TShowHelpResult; virtual;
public public
@ -390,8 +426,12 @@ function ShowHelpForKeyword(const HelpKeyword: string; var ErrMsg: string
): TShowHelpResult; ): TShowHelpResult;
// help for pascal identifier // help for pascal identifier
function ShowHelpForPascalSource(ContextList: TPascalHelpContextPtr; function ShowHelpForPascalContexts(ListOfPascalHelpContextList: TList;
var ErrMsg: string): TShowHelpResult; 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, ...) // help for messages (compiler messages, codetools messages, make messages, ...)
function ShowHelpForMessageLine(const MessageLine: string; function ShowHelpForMessageLine(const MessageLine: string;
@ -463,10 +503,35 @@ begin
Result:=ShowHelpForKeyword('',HelpKeyword,ErrMsg); Result:=ShowHelpForKeyword('',HelpKeyword,ErrMsg);
end; end;
function ShowHelpForPascalSource(ContextList: TPascalHelpContextPtr; function ShowHelpForPascalContexts(ListOfPascalHelpContextList: TList;
var ErrMsg: string): TShowHelpResult; var ErrMsg: string): TShowHelpResult;
begin 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; end;
function ShowHelpForMessageLine(const MessageLine: string; function ShowHelpForMessageLine(const MessageLine: string;
@ -499,7 +564,7 @@ begin
URLPath:=''; URLPath:='';
URLParams:=''; URLParams:='';
Len:=length(URL); Len:=length(URL);
// search color // search colon
ColonPos:=1; ColonPos:=1;
while (ColonPos<=len) and (URL[ColonPos]<>':') do while (ColonPos<=len) and (URL[ColonPos]<>':') do
inc(ColonPos); inc(ColonPos);
@ -600,14 +665,14 @@ end;
procedure THelpDatabase.RegisterSelf; procedure THelpDatabase.RegisterSelf;
begin begin
if Databases<>nil then if Databases<>nil then
raise EHelpSystemException.Create(ID+': Already registered'); raise EHelpSystemException.Create(Format(oisHelpAlreadyRegistered, [ID]));
Databases:=HelpDatabases; Databases:=HelpDatabases;
end; end;
procedure THelpDatabase.UnregisterSelf; procedure THelpDatabase.UnregisterSelf;
begin begin
if Databases=nil then if Databases=nil then
raise EHelpSystemException.Create(ID+': Not registered'); raise EHelpSystemException.Create(Format(oisHelpNotRegistered, [ID]));
Databases:=nil; Databases:=nil;
end; end;
@ -685,7 +750,7 @@ begin
Node:=THelpDBSearchItem(FSearchItems[i]).Node; Node:=THelpDBSearchItem(FSearchItems[i]).Node;
if (Node=nil) or (not Node.IDValid) then continue; if (Node=nil) or (not Node.IDValid) then continue;
if AnsiCompareText(Node.ID,HelpKeyword)<>0 then continue; if AnsiCompareText(Node.ID,HelpKeyword)<>0 then continue;
CreateListAndAdd(Node, ListOfNodes); CreateListAndAdd(Node,ListOfNodes);
end; end;
end; end;
end; end;
@ -702,11 +767,44 @@ begin
ErrMsg:=''; ErrMsg:='';
// add the registered nodes // add the registered nodes
if FSearchItems<>nil then begin 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; Node:=THelpDBSearchItem(FSearchItems[i]).Node;
if (Node=nil) or (not Node.ContextValid) then continue; if (Node=nil) or (not Node.ContextValid) then continue;
if Node.Context<>HelpContext 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; end;
end; end;
@ -720,7 +818,8 @@ begin
Viewers:=HelpViewers.GetViewersSupportingMimeType(MimeType); Viewers:=HelpViewers.GetViewersSupportingMimeType(MimeType);
try try
if (Viewers=nil) or (Viewers.Count=0) then begin 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; Result:=shrViewerNotFound;
end else begin end else begin
Viewer:=THelpViewer(Viewers[0]); Viewer:=THelpViewer(Viewers[0]);
@ -834,6 +933,21 @@ begin
Result:=nil; Result:=nil;
end; 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; function THelpDatabases.IndexOf(ID: THelpDatabaseID): integer;
begin begin
Result:=Count-1; Result:=Count-1;
@ -875,6 +989,14 @@ end;
function THelpDatabases.GetBaseURLForBasePathObject(BasePathObject: TObject function THelpDatabases.GetBaseURLForBasePathObject(BasePathObject: TObject
): string; ): string;
begin
Result:=GetBaseDirectoryForBasePathObject(BasePathObject);
if Result='' then exit;
Result:=FilenameToURL(Result);
end;
function THelpDatabases.GetBaseDirectoryForBasePathObject(BasePathObject: TObject
): string;
begin begin
Result:=''; Result:='';
end; end;
@ -897,7 +1019,7 @@ begin
// show node // show node
if Node.Owner=nil then begin if Node.Owner=nil then begin
Result:=shrDatabaseNotFound; Result:=shrDatabaseNotFound;
ErrMsg:='Help node has no Help Database'; ErrMsg:=Format(oisHelpHelpNodeHasNoHelpDatabase, ['"', Node.Title, '"']);
exit; exit;
end; end;
Result:=Node.Owner.ShowHelp(nil,Node,ErrMsg); Result:=Node.Owner.ShowHelp(nil,Node,ErrMsg);
@ -916,12 +1038,8 @@ begin
Nodes:=nil; Nodes:=nil;
try try
if HelpDatabaseID<>'' then begin if HelpDatabaseID<>'' then begin
HelpDB:=FindDatabase(HelpDatabaseID); HelpDB:=nil;
if HelpDB=nil then begin if not GetDatabase(HelpDatabaseID,HelpDB,Result,ErrMsg) then exit;
Result:=shrDatabaseNotFound;
ErrMsg:='Help Database "'+HelpDatabaseID+'" not found';
exit;
end;
Result:=HelpDB.GetNodesForContext(HelpContext,Nodes,ErrMsg); Result:=HelpDB.GetNodesForContext(HelpContext,Nodes,ErrMsg);
if Result<>shrSuccess then exit; if Result<>shrSuccess then exit;
end else begin end else begin
@ -934,10 +1052,10 @@ begin
if (Nodes=nil) or (Nodes.Count=0) then begin if (Nodes=nil) or (Nodes.Count=0) then begin
Result:=shrContextNotFound; Result:=shrContextNotFound;
if HelpDatabaseID<>'' then if HelpDatabaseID<>'' then
ErrMsg:='Help context '+IntToStr(HelpContext)+' not found' ErrMsg:=Format(oisHelpHelpContextNotFoundInDatabase, [IntToStr(
+' in Database "'+HelpDatabaseID+'".' HelpContext), '"', HelpDatabaseID, '"'])
else else
ErrMsg:='Help context '+IntToStr(HelpContext)+' not found.'; ErrMsg:=Format(oisHelpHelpContextNotFound, [IntToStr(HelpContext)]);
exit; exit;
end; end;
@ -960,12 +1078,8 @@ begin
Nodes:=nil; Nodes:=nil;
try try
if HelpDatabaseID<>'' then begin if HelpDatabaseID<>'' then begin
HelpDB:=FindDatabase(HelpDatabaseID); HelpDB:=nil;
if HelpDB=nil then begin if not GetDatabase(HelpDatabaseID,HelpDB,Result,ErrMsg) then exit;
Result:=shrDatabaseNotFound;
ErrMsg:='Help Database "'+HelpDatabaseID+'" not found';
exit;
end;
Result:=HelpDB.GetNodesForKeyword(HelpKeyword,Nodes,ErrMsg); Result:=HelpDB.GetNodesForKeyword(HelpKeyword,Nodes,ErrMsg);
if Result<>shrSuccess then exit; if Result<>shrSuccess then exit;
end else begin end else begin
@ -978,10 +1092,10 @@ begin
if (Nodes=nil) or (Nodes.Count=0) then begin if (Nodes=nil) or (Nodes.Count=0) then begin
Result:=shrContextNotFound; Result:=shrContextNotFound;
if HelpDatabaseID<>'' then if HelpDatabaseID<>'' then
ErrMsg:='Help keyword "'+HelpKeyword+'" not found' ErrMsg:=Format(oisHelpHelpKeywordNotFoundInDatabase, ['"', HelpKeyword,
+' in Database "'+HelpDatabaseID+'".' '"', '"', HelpDatabaseID, '"'])
else else
ErrMsg:='Help keyword "'+HelpKeyword+'" not found.'; ErrMsg:=Format(oisHelpHelpKeywordNotFound, ['"', HelpKeyword, '"']);
exit; exit;
end; end;
@ -991,28 +1105,54 @@ begin
end; end;
end; end;
function THelpDatabases.ShowHelpForPascalSource( function THelpDatabases.ShowHelpForPascalContexts(
ContextList: TPascalHelpContextPtr; var ErrMsg: string): TShowHelpResult; 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 begin
Result:=shrHelpNotFound; Result:=shrHelpNotFound;
// ToDo ErrMsg:='THelpDatabases.ShowHelpForPascalSource not implemented';
ErrMsg:='THelpDatabases.ShowHelpForPascalSource not implemented yet';
end; end;
function THelpDatabases.ShowHelpForMessageLine(const MessageLine: string; function THelpDatabases.ShowHelpForMessageLine(const MessageLine: string;
var ErrMsg: string): TShowHelpResult; var ErrMsg: string): TShowHelpResult;
begin begin
Result:=shrHelpNotFound; Result:=shrHelpNotFound;
// ToDo ErrMsg:='THelpDatabases.ShowHelpForMessageLine not implemented';
ErrMsg:='THelpDatabases.ShowHelpForMessageLine not implemented yet';
end; end;
function THelpDatabases.ShowHelpForClass(const AClass: TClass; function THelpDatabases.ShowHelpForClass(const AClass: TClass;
var ErrMsg: string): TShowHelpResult; var ErrMsg: string): TShowHelpResult;
begin begin
Result:=shrHelpNotFound; Result:=shrHelpNotFound;
// ToDo ErrMsg:='THelpDatabases.ShowHelpForClass not implemented';
ErrMsg:='THelpDatabases.ShowHelpForClass not implemented yet';
end; end;
function THelpDatabases.GetNodesForKeyword(const HelpKeyword: string; function THelpDatabases.GetNodesForKeyword(const HelpKeyword: string;
@ -1045,6 +1185,23 @@ begin
end; end;
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; function THelpDatabases.ShowHelpSelector(Nodes: TList; var ErrMsg: string;
var Selection: THelpNode): TShowHelpResult; var Selection: THelpNode): TShowHelpResult;
// Nodes is a list of THelpNode // Nodes is a list of THelpNode
@ -1357,6 +1514,98 @@ begin
inherited Destroy; inherited Destroy;
end; 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 initialization
HelpDatabases:=nil; HelpDatabases:=nil;

View File

@ -102,6 +102,18 @@ resourcestring
oisHelpBrowserNotFound = 'Browser %s%s%s not found.'; oisHelpBrowserNotFound = 'Browser %s%s%s not found.';
oisHelpBrowserNotExecutable = 'Browser %s%s%s not executable.'; oisHelpBrowserNotExecutable = 'Browser %s%s%s not executable.';
oisHelpErrorWhileExecuting = 'Error while executing %s%s%s:%s%s'; 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 implementation

View File

@ -20,12 +20,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * 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. This unit contains file and directory controls and supporting handling functions.
} }
@ -93,10 +87,10 @@ Type
property OnChange: TNotifyEvent Read FOnChange Write FOnChange; property OnChange: TNotifyEvent Read FOnChange Write FOnChange;
property Sorted default true; property Sorted default true;
end; end;
{ TFileListBox } { TFileListBox }
TFileListBox = class(TCustomFileListBox) TFileListBox = class(TCustomFileListBox)
published published
property Align; property Align;
@ -174,6 +168,8 @@ function TrimFilename(const AFilename: string): string;
function CleanAndExpandFilename(const Filename: string): string; function CleanAndExpandFilename(const Filename: string): string;
function CleanAndExpandDirectory(const Filename: string): string; function CleanAndExpandDirectory(const Filename: string): string;
function FileIsInPath(const Filename, Path: string): boolean; function FileIsInPath(const Filename, Path: string): boolean;
function FileIsInDirectory(const Filename, Directory: string): boolean;
function FileInFilenameMasks(const Filename, Masks: string): boolean;
// file search // file search
type type
@ -400,6 +396,9 @@ end.
{ {
$Log$ $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 Revision 1.27 2004/04/21 21:22:52 mattias
fixed updatinf Filename when setting Filename from Luis fixed updatinf Filename when setting Filename from Luis

View File

@ -798,6 +798,36 @@ begin
and (CompareFilenames(ExpPath,LeftStr(ExpFile,l))=0); and (CompareFilenames(ExpPath,LeftStr(ExpFile,l))=0);
end; 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; function CopyFile(const SrcFilename, DestFilename: string): boolean;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
@ -928,6 +958,9 @@ end;
{ {
$Log$ $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 Revision 1.46 2004/08/04 23:47:32 mattias
implemented FileExecutable for win32 implemented FileExecutable for win32