mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 17:52:59 +02:00
fixed find declaration of with A,B do C; statements
git-svn-id: trunk@4345 -
This commit is contained in:
parent
d817351985
commit
a7a95534c8
@ -1935,6 +1935,9 @@ function TCustomCodeTool.FindDeepestNodeAtPos(StartNode: TCodeTreeNode;
|
|||||||
SaveRaiseException(ctsNoNodeFoundAtCursor);
|
SaveRaiseException(ctsNoNodeFoundAtCursor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
ChildNode: TCodeTreeNode;
|
||||||
|
Brother: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
if StartNode<>nil then begin
|
if StartNode<>nil then begin
|
||||||
//writeln('SearchInNode ',NodeDescriptionAsString(ANode.Desc),
|
//writeln('SearchInNode ',NodeDescriptionAsString(ANode.Desc),
|
||||||
@ -1943,14 +1946,20 @@ begin
|
|||||||
if (StartNode.StartPos<=P)
|
if (StartNode.StartPos<=P)
|
||||||
and ((StartNode.EndPos>P) or (StartNode.EndPos<1)) then begin
|
and ((StartNode.EndPos>P) or (StartNode.EndPos<1)) then begin
|
||||||
// StartNode contains P
|
// StartNode contains P
|
||||||
// -> search for a child that contains P
|
|
||||||
Result:=FindDeepestNodeAtPos(StartNode.FirstChild,P,false);
|
|
||||||
if Result=nil then begin
|
|
||||||
// no child found -> search in nextbrothers that contains P
|
|
||||||
while (StartNode.NextBrother<>nil)
|
|
||||||
and (StartNode.NextBrother.StartPos<=P) do
|
|
||||||
StartNode:=StartNode.NextBrother;
|
|
||||||
Result:=StartNode;
|
Result:=StartNode;
|
||||||
|
// -> search for a child that contains P
|
||||||
|
Brother:=StartNode;
|
||||||
|
while (Brother<>nil)
|
||||||
|
and (Brother.StartPos<=P) do begin
|
||||||
|
// brother also contains P
|
||||||
|
if Brother.FirstChild<>nil then begin
|
||||||
|
ChildNode:=FindDeepestNodeAtPos(Brother.FirstChild,P,false);
|
||||||
|
if ChildNode<>nil then begin
|
||||||
|
Result:=ChildNode;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Brother:=Brother.NextBrother;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
// search in next node
|
// search in next node
|
||||||
|
@ -59,6 +59,7 @@ interface
|
|||||||
{ $DEFINE ShowSearchPaths}
|
{ $DEFINE ShowSearchPaths}
|
||||||
{ $DEFINE ShowTriedFiles}
|
{ $DEFINE ShowTriedFiles}
|
||||||
{ $DEFINE ShowTriedContexts}
|
{ $DEFINE ShowTriedContexts}
|
||||||
|
{ $DEFINE ShowTriedBaseContexts}
|
||||||
{ $DEFINE ShowTriedParentContexts}
|
{ $DEFINE ShowTriedParentContexts}
|
||||||
{ $DEFINE ShowTriedIdentifiers}
|
{ $DEFINE ShowTriedIdentifiers}
|
||||||
{ $DEFINE ShowTriedUnits}
|
{ $DEFINE ShowTriedUnits}
|
||||||
@ -967,7 +968,7 @@ begin
|
|||||||
// raise exception
|
// raise exception
|
||||||
FindDeepestNodeAtPos(CleanCursorPos,true);
|
FindDeepestNodeAtPos(CleanCursorPos,true);
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('TFindDeclarationTool.FindDeclaration D CursorNode=',NodeDescriptionAsString(CursorNode.Desc));
|
writeln('TFindDeclarationTool.FindDeclaration D CursorNode=',NodeDescriptionAsString(CursorNode.Desc),' HasChilds=',CursorNode.FirstChild<>nil);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if (not IsDirtySrcValid)
|
if (not IsDirtySrcValid)
|
||||||
and (CursorNode.Desc=ctnUsesSection) then begin
|
and (CursorNode.Desc=ctnUsesSection) then begin
|
||||||
@ -1909,7 +1910,10 @@ var
|
|||||||
// -> there is no prior context accessible any more
|
// -> there is no prior context accessible any more
|
||||||
// -> identifier not found
|
// -> identifier not found
|
||||||
{$IFDEF ShowTriedContexts}
|
{$IFDEF ShowTriedContexts}
|
||||||
writeln('[TFindDeclarationTool.FindIdentifierInContext] no prior node accessible ContextNode=',ContextNode.DescAsString);
|
writeln('[TFindDeclarationTool.FindIdentifierInContext] no prior node accessible ',
|
||||||
|
' ContextNode=',ContextNode.DescAsString,
|
||||||
|
' "',StringToPascalConst(copy(Src,ContextNode.StartPos,15)),'"'
|
||||||
|
);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
ContextNode:=nil;
|
ContextNode:=nil;
|
||||||
Result:=false;
|
Result:=false;
|
||||||
@ -1929,6 +1933,7 @@ var
|
|||||||
|
|
||||||
if (ContextNode.Desc in [ctnClass,ctnClassInterface])
|
if (ContextNode.Desc in [ctnClass,ctnClassInterface])
|
||||||
and (fdfSearchInAncestors in Params.Flags) then begin
|
and (fdfSearchInAncestors in Params.Flags) then begin
|
||||||
|
// after searching in a class definiton, search in its ancestors
|
||||||
|
|
||||||
// ToDo: check for circles in ancestors
|
// ToDo: check for circles in ancestors
|
||||||
|
|
||||||
@ -1972,7 +1977,13 @@ var
|
|||||||
// check if StartContextNode is covered by the ContextNode
|
// check if StartContextNode is covered by the ContextNode
|
||||||
// a WithVariable ranges from the start of its expression
|
// a WithVariable ranges from the start of its expression
|
||||||
// to the end of the with statement
|
// to the end of the with statement
|
||||||
if StartContextNode.StartPos<ContextNode.EndPos then break;
|
{$IFDEF ShowExprEval}
|
||||||
|
writeln('SearchNextNode WithVar StartContextNode.StartPos=',StartContextNode.StartPos,
|
||||||
|
' ContextNode=',ContextNode.StartPos,'-',ContextNode.EndPos,
|
||||||
|
' WithStart="',StringToPascalConst(copy(Src,ContextNode.StartPos,15)),'"');
|
||||||
|
{$ENDIF}
|
||||||
|
if (StartContextNode.StartPos>=ContextNode.StartPos)
|
||||||
|
and (StartContextNode.StartPos<ContextNode.EndPos) then break;
|
||||||
{ ELSE: this with statement does not cover the startcontext
|
{ ELSE: this with statement does not cover the startcontext
|
||||||
-> skip it
|
-> skip it
|
||||||
for example:
|
for example:
|
||||||
@ -2055,7 +2066,7 @@ begin
|
|||||||
{$IFDEF ShowTriedContexts}
|
{$IFDEF ShowTriedContexts}
|
||||||
writeln('[TFindDeclarationTool.FindIdentifierInContext] Start Ident=',
|
writeln('[TFindDeclarationTool.FindIdentifierInContext] Start Ident=',
|
||||||
'"',GetIdentifier(Params.Identifier),'"',
|
'"',GetIdentifier(Params.Identifier),'"',
|
||||||
' Context="',ContextNode.DescAsString,'" "',copy(Src,ContextNode.StartPos,20),'"',
|
' Context="',ContextNode.DescAsString,'" "',StringToPascalConst(copy(Src,ContextNode.StartPos,20)),'"',
|
||||||
' File="',ExtractFilename(MainFilename)+'"',
|
' File="',ExtractFilename(MainFilename)+'"',
|
||||||
' Flags=[',FindDeclarationFlagsAsString(Params.Flags),']'
|
' Flags=[',FindDeclarationFlagsAsString(Params.Flags),']'
|
||||||
);
|
);
|
||||||
@ -2335,7 +2346,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
AddNodeToStack(@NodeStack,Result.Node);
|
AddNodeToStack(@NodeStack,Result.Node);
|
||||||
|
|
||||||
{$IFDEF ShowTriedContexts}
|
{$IFDEF ShowTriedBaseContexts}
|
||||||
writeln('[TFindDeclarationTool.FindBaseTypeOfNode] LOOP Result=',Result.Node.DescAsString,' ',HexStr(Cardinal(Result.Node),8));
|
writeln('[TFindDeclarationTool.FindBaseTypeOfNode] LOOP Result=',Result.Node.DescAsString,' ',HexStr(Cardinal(Result.Node),8));
|
||||||
writeln(' Flags=[',FindDeclarationFlagsAsString(Params.Flags),']');
|
writeln(' Flags=[',FindDeclarationFlagsAsString(Params.Flags),']');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -2352,7 +2363,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
// this is a forward defined class
|
// this is a forward defined class
|
||||||
// -> search the real class
|
// -> search the real class
|
||||||
{$IFDEF ShowTriedContexts}
|
{$IFDEF ShowTriedBaseContexts}
|
||||||
writeln('[TFindDeclarationTool.FindBaseTypeOfNode] Class is forward');
|
writeln('[TFindDeclarationTool.FindBaseTypeOfNode] Class is forward');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
@ -2865,8 +2876,9 @@ var
|
|||||||
OldInput: TFindDeclarationInput;
|
OldInput: TFindDeclarationInput;
|
||||||
begin
|
begin
|
||||||
{$IFDEF ShowExprEval}
|
{$IFDEF ShowExprEval}
|
||||||
writeln('[TFindDeclarationTool.FindIdentifierInWithVarContext] ',
|
writeln('[TFindDeclarationTool.FindIdentifierInWithVarContext] Ident=',
|
||||||
'"',GetIdentifier(Params.Identifier),'"'
|
'"',GetIdentifier(Params.Identifier),'"',
|
||||||
|
' WithStart=',StringToPascalConst(copy(Src,WithVarNode.StartPos,15))
|
||||||
);
|
);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
@ -710,6 +710,7 @@ type
|
|||||||
function GetScanline(Row: Integer): Pointer;
|
function GetScanline(Row: Integer): Pointer;
|
||||||
procedure SetHandleType(Value: TBitmapHandleType); virtual;
|
procedure SetHandleType(Value: TBitmapHandleType); virtual;
|
||||||
procedure SetPixelFormat(const AValue: TPixelFormat);
|
procedure SetPixelFormat(const AValue: TPixelFormat);
|
||||||
|
procedure UpdatePixelFormat;
|
||||||
protected
|
protected
|
||||||
procedure Changed(Sender: TObject); override;
|
procedure Changed(Sender: TObject); override;
|
||||||
procedure Changing(Sender: TObject); virtual;
|
procedure Changing(Sender: TObject); virtual;
|
||||||
@ -1029,6 +1030,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.73 2003/06/30 16:31:04 mattias
|
||||||
|
fixed find declaration of with A,B do C; statements
|
||||||
|
|
||||||
Revision 1.72 2003/06/30 14:58:29 mattias
|
Revision 1.72 2003/06/30 14:58:29 mattias
|
||||||
implemented multi file add to package editor
|
implemented multi file add to package editor
|
||||||
|
|
||||||
|
@ -163,6 +163,26 @@ begin
|
|||||||
writeln('WARNING: TBitmap.SetPixelFormat not implemented');
|
writeln('WARNING: TBitmap.SetPixelFormat not implemented');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBitmap.UpdatePixelFormat;
|
||||||
|
begin
|
||||||
|
FPixelFormat := pfCustom;
|
||||||
|
if HandleType = bmDDB then
|
||||||
|
FPixelFormat := pfDevice
|
||||||
|
else
|
||||||
|
with FImage.FDIB, dsbmih do
|
||||||
|
case biBitCount of
|
||||||
|
1: FPixelFormat := pf1Bit;
|
||||||
|
4: FPixelFormat := pf4Bit;
|
||||||
|
8: FPixelFormat := pf8Bit;
|
||||||
|
16: case biCompression of
|
||||||
|
BI_RGB : FPixelFormat := pf15Bit;
|
||||||
|
BI_BITFIELDS: if dsBitFields[1] = $7E0 then FPixelFormat := pf16Bit;
|
||||||
|
end;
|
||||||
|
24: FPixelFormat := pf24Bit;
|
||||||
|
32: if biCompression = BI_RGB then FPixelFormat := pf32Bit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBitmap.Changed(Sender: TObject);
|
procedure TBitmap.Changed(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
//FMaskBitsValid := False;
|
//FMaskBitsValid := False;
|
||||||
@ -711,6 +731,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.35 2003/06/30 16:31:04 mattias
|
||||||
|
fixed find declaration of with A,B do C; statements
|
||||||
|
|
||||||
Revision 1.34 2003/06/30 15:13:21 mattias
|
Revision 1.34 2003/06/30 15:13:21 mattias
|
||||||
fixed releasing bitmap handle
|
fixed releasing bitmap handle
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user