mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 23:49:28 +02:00
codetools: FindDeclarationAndOverload now starts at property names, proc names, vars, consts and types
git-svn-id: trunk@13006 -
This commit is contained in:
parent
f30565766c
commit
9a550b80fd
@ -3328,6 +3328,21 @@ var
|
||||
end;
|
||||
AddCodePosition(ListOfPCodeXYPosition,NewPos);
|
||||
end;
|
||||
|
||||
function StartPositionAtDefinition: boolean;
|
||||
begin
|
||||
if (NewNode.Desc in AllIdentifierDefinitions)
|
||||
and (PositionInDefinitionName(NewNode,CleanPos)) then
|
||||
Result:=true
|
||||
else if (NewNode.Desc=ctnProcedure)
|
||||
and (PositionInProcName(NewNode,false,CleanPos)) then
|
||||
Result:=true
|
||||
else if (NewNode.Desc=ctnProperty)
|
||||
and (PositionInPropertyName(NewNode,CleanPos)) then
|
||||
Result:=true
|
||||
else
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:=true;
|
||||
@ -3345,10 +3360,8 @@ begin
|
||||
NewTool:=Self;
|
||||
NewNode:=FindDeepestExpandedNodeAtPos(CleanPos,true);
|
||||
NewPos:=CursorPos;
|
||||
if (NewNode.Desc in AllIdentifierDefinitions)
|
||||
and (PositionInDefinitionName(NewNode,CleanPos)) then begin
|
||||
if StartPositionAtDefinition then
|
||||
AddPos;
|
||||
end;
|
||||
|
||||
CurCursorPos:=CursorPos;
|
||||
CurTool:=Self;
|
||||
|
@ -76,6 +76,8 @@ type
|
||||
Attr: TProcHeadAttributes): string;
|
||||
function GetPropertyNameIdentifier(PropNode: TCodeTreeNode): PChar;
|
||||
function GetPropertyTypeIdentifier(PropNode: TCodeTreeNode): PChar;
|
||||
function PositionInPropertyName(PropNode: TCodeTreeNode;
|
||||
CleanPos: integer): boolean;
|
||||
function PropertyIsDefault(PropertyNode: TCodeTreeNode): boolean;
|
||||
function PropertyNodeHasParamList(PropNode: TCodeTreeNode): boolean;
|
||||
function PropNodeIsTypeLess(PropNode: TCodeTreeNode): boolean;
|
||||
@ -101,6 +103,8 @@ type
|
||||
ProcSpec: TProcedureSpecifier): boolean;
|
||||
procedure MoveCursorToProcName(ProcNode: TCodeTreeNode;
|
||||
SkipClassName: boolean);
|
||||
function PositionInProcName(ProcNode: TCodeTreeNode;
|
||||
SkipClassName: boolean; CleanPos: integer): boolean;
|
||||
function ProcNodeHasParamList(ProcNode: TCodeTreeNode): boolean;
|
||||
function NodeIsInAMethod(Node: TCodeTreeNode): boolean;
|
||||
function NodeIsMethodBody(ProcNode: TCodeTreeNode): boolean;
|
||||
@ -733,6 +737,43 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TPascalReaderTool.PositionInProcName(ProcNode: TCodeTreeNode;
|
||||
SkipClassName: boolean; CleanPos: integer): boolean;
|
||||
var
|
||||
InFirstAtom: Boolean;
|
||||
begin
|
||||
if (ProcNode.Desc=ctnProcedure) and (ProcNode.FirstChild<>nil)
|
||||
and (ProcNode.FirstChild.Desc=ctnProcedureHead) then
|
||||
ProcNode:=ProcNode.FirstChild;
|
||||
MoveCursorToNodeStart(ProcNode);
|
||||
ReadNextAtom;
|
||||
if (ProcNode.Desc=ctnProcedure) then begin
|
||||
if UpAtomIs('CLASS') then ReadNextAtom;
|
||||
ReadNextAtom; // skip proc keyword
|
||||
end;
|
||||
if CurPos.Flag<>cafWord then exit(false);
|
||||
// now CurPos is either the classname or the procname
|
||||
InFirstAtom:=(CleanPos>=CurPos.StartPos) and (CleanPos<=CurPos.EndPos);
|
||||
ReadNextAtom;
|
||||
// read point
|
||||
if CurPos.Flag<>cafPoint then begin
|
||||
// procname without classname
|
||||
exit(InFirstAtom);
|
||||
end;
|
||||
// there is a classname
|
||||
if (CleanPos>=CurPos.StartPos) and (CleanPos<=CurPos.EndPos)
|
||||
and (not SkipClassName) then
|
||||
exit(true); // position at point
|
||||
// now read the procname
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafWord then exit(false); // no valid procname
|
||||
if (CleanPos>=CurPos.StartPos) and (CleanPos<=CurPos.EndPos) then
|
||||
exit(true); // position at procname
|
||||
if (not SkipClassName) and InFirstAtom then
|
||||
exit(true); // position at classname
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TPascalReaderTool.MoveCursorToPropType(PropNode: TCodeTreeNode
|
||||
): boolean;
|
||||
begin
|
||||
@ -896,7 +937,7 @@ begin
|
||||
if PropNode=nil then exit;
|
||||
MoveCursorToNodeStart(PropNode);
|
||||
if (PropNode.Desc=ctnProperty) then begin
|
||||
ReadNextAtom; // read 'propery'
|
||||
ReadNextAtom; // read 'property'
|
||||
end;
|
||||
ReadNextAtom; // read name
|
||||
Result:=@Src[CurPos.StartPos];
|
||||
@ -914,6 +955,19 @@ begin
|
||||
Result:=@Src[CurPos.StartPos];
|
||||
end;
|
||||
|
||||
function TPascalReaderTool.PositionInPropertyName(PropNode: TCodeTreeNode;
|
||||
CleanPos: integer): boolean;
|
||||
begin
|
||||
if PropNode=nil then exit(false);
|
||||
MoveCursorToNodeStart(PropNode);
|
||||
if (PropNode.Desc=ctnProperty) then begin
|
||||
ReadNextAtom; // read 'property'
|
||||
end;
|
||||
ReadNextAtom; // read name
|
||||
Result:=(CurPos.Flag=cafWord)
|
||||
and (CleanPos>=CurPos.StartPos) and (CleanPos<=CurPos.EndPos);
|
||||
end;
|
||||
|
||||
function TPascalReaderTool.ExtractIdentCharsFromStringConstant(StartPos,
|
||||
MinPos, MaxPos, MaxLen: integer): string;
|
||||
var
|
||||
|
@ -621,7 +621,6 @@ end;
|
||||
Shift:
|
||||
X, Y:
|
||||
Returns: nothing
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomSpeedButton.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||
X, Y: Integer);
|
||||
|
@ -146,7 +146,6 @@ var
|
||||
ClientWidget: PGtkWidget;
|
||||
begin
|
||||
Result.Style := nil;
|
||||
|
||||
if not GTKWidgetSet.IsValidDC(DC) then Exit;
|
||||
|
||||
Result.Widget := DevCtx.Widget;
|
||||
@ -181,7 +180,6 @@ begin
|
||||
Result.Shadow := GTK_SHADOW_OUT;
|
||||
|
||||
Result.IsHot:= Result.State = GTK_STATE_PRELIGHT;
|
||||
|
||||
Result.Detail := 'button';
|
||||
Result.Painter := gptBox;
|
||||
end;
|
||||
|
@ -48,7 +48,7 @@ interface
|
||||
uses
|
||||
// no Graphics or Controls can be used here to prevent circular references
|
||||
//
|
||||
Types, Math, Classes, LCLType, TmSchema;
|
||||
Types, Math, Classes, LCLProc, LCLType, TmSchema;
|
||||
|
||||
type
|
||||
// These are all elements which can be themed.
|
||||
@ -1856,7 +1856,6 @@ begin
|
||||
ADrawFlags := ADrawFlags or DFCS_PUSHED else
|
||||
if IsHot(Details) then
|
||||
ADrawFlags := ADrawFlags or DFCS_HOT;
|
||||
|
||||
if IsChecked(Details) then
|
||||
ADrawFlags := ADrawFlags or DFCS_CHECKED;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user