mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 04:07:57 +02:00
IDE: show readonly icon for readonly properties, bug #16851
git-svn-id: trunk@26511 -
This commit is contained in:
parent
e407f241fb
commit
2e8ba297f0
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -3873,6 +3873,7 @@ images/codeexplorer/ce_interface.png -text
|
||||
images/codeexplorer/ce_procedure.png -text
|
||||
images/codeexplorer/ce_program.png -text
|
||||
images/codeexplorer/ce_property.png -text
|
||||
images/codeexplorer/ce_property_readonly.png -text svneol=unset#image/png
|
||||
images/codeexplorer/ce_section.png -text svneol=unset#image/png
|
||||
images/codeexplorer/ce_type.png -text
|
||||
images/codeexplorer/ce_unit.png -text
|
||||
|
@ -86,7 +86,11 @@ type
|
||||
iliKeyword,
|
||||
iliResultTypeValid,
|
||||
iliHasIndexValid,
|
||||
iliHasIndex
|
||||
iliHasIndex,
|
||||
iliHasParamListValid,
|
||||
iliHasParamList,
|
||||
iliIsReadOnlyValid,
|
||||
iliIsReadOnly
|
||||
);
|
||||
TIdentListItemFlags = set of TIdentListItemFlag;
|
||||
|
||||
@ -137,6 +141,7 @@ type
|
||||
NewDefaultDesc: TCodeTreeNodeDesc);
|
||||
function IsProcNodeWithParams: boolean;
|
||||
function IsPropertyWithParams: boolean;
|
||||
function IsPropertyReadOnly: boolean;
|
||||
function CheckHasChilds: boolean;
|
||||
function CanBeAssigned: boolean;
|
||||
procedure UpdateBaseContext;
|
||||
@ -2746,8 +2751,31 @@ function TIdentifierListItem.IsPropertyWithParams: boolean;
|
||||
var
|
||||
ANode: TCodeTreeNode;
|
||||
begin
|
||||
ANode:=Node;
|
||||
Result:=(ANode<>nil) and Tool.PropertyNodeHasParamList(ANode);
|
||||
if not (iliHasParamListValid in Flags) then begin
|
||||
ANode:=Node;
|
||||
if (ANode<>nil) and Tool.PropertyNodeHasParamList(ANode) then
|
||||
Include(Flags,iliHasParamList)
|
||||
else
|
||||
Exclude(Flags,iliHasParamList);
|
||||
Include(Flags,iliHasParamListValid)
|
||||
end;
|
||||
Result:=iliHasParamList in Flags;
|
||||
end;
|
||||
|
||||
function TIdentifierListItem.IsPropertyReadOnly: boolean;
|
||||
var
|
||||
ANode: TCodeTreeNode;
|
||||
begin
|
||||
if not (iliIsReadOnlyValid in Flags) then begin
|
||||
ANode:=Node;
|
||||
if (ANode<>nil) and Tool.PropertyHasSpecifier(ANode,'read',false)
|
||||
and not Tool.PropertyHasSpecifier(ANode,'write',false) then
|
||||
Include(Flags,iliIsReadOnly)
|
||||
else
|
||||
Exclude(Flags,iliIsReadOnly);
|
||||
Include(Flags,iliIsReadOnlyValid)
|
||||
end;
|
||||
Result:=iliIsReadOnly in Flags;
|
||||
end;
|
||||
|
||||
function TIdentifierListItem.CheckHasChilds: boolean;
|
||||
|
@ -188,6 +188,7 @@ type
|
||||
ImgIDFunction: Integer;
|
||||
ImgIDProgram: Integer;
|
||||
ImgIDProperty: Integer;
|
||||
ImgIDPropertyReadOnly: Integer;
|
||||
ImgIDType: Integer;
|
||||
ImgIDUnit: Integer;
|
||||
ImgIDVariable: Integer;
|
||||
@ -425,6 +426,7 @@ begin
|
||||
ImgIDProcedure := Imagelist1.AddLazarusResource('ce_procedure');
|
||||
ImgIDFunction := Imagelist1.AddLazarusResource('ce_function');
|
||||
ImgIDProperty := Imagelist1.AddLazarusResource('ce_property');
|
||||
ImgIDPropertyReadOnly := Imagelist1.AddLazarusResource('ce_property_readonly');
|
||||
// sections
|
||||
ImgIDSection := Imagelist1.AddLazarusResource('ce_section');
|
||||
ImgIDHint := Imagelist1.AddLazarusResource('state_hint');
|
||||
@ -693,7 +695,7 @@ begin
|
||||
else
|
||||
Result:=ImgIDProcedure;
|
||||
ctnProperty: Result:=ImgIDProperty;
|
||||
ctnUsesSection: Result:= ImgIDSection;
|
||||
ctnUsesSection: Result:=ImgIDSection;
|
||||
ctnUseUnit: Result:=ImgIDUnit;
|
||||
else
|
||||
Result:=ImgIDDefault;
|
||||
|
@ -39,7 +39,7 @@ uses
|
||||
CodeAtom, CodeCache, SourceChanger, CodeToolManager, PascalParserTool,
|
||||
KeywordFuncLists, FileProcs, IdentCompletionTool, PascalReaderTool,
|
||||
LazIDEIntf, TextTools, IDETextConverter, DialogProcs, MainIntf, EditorOptions,
|
||||
CodeToolsOptions;
|
||||
IDEImagesIntf, CodeToolsOptions;
|
||||
|
||||
type
|
||||
|
||||
@ -220,6 +220,8 @@ var
|
||||
ANode: TCodeTreeNode;
|
||||
ItemNode: TCodeTreeNode;
|
||||
SubNode: TCodeTreeNode;
|
||||
IsReadOnly: boolean;
|
||||
ImageIndex: longint;
|
||||
begin
|
||||
ForegroundColor := ColorToRGB(ACanvas.Font.Color);
|
||||
Result.X := 0;
|
||||
@ -236,6 +238,7 @@ begin
|
||||
BGRed:=(BackgroundColor shr 16) and $ff;
|
||||
BGGreen:=(BackgroundColor shr 8) and $ff;
|
||||
BGBlue:=BackgroundColor and $ff;
|
||||
ImageIndex:=-1;
|
||||
|
||||
// first write the type
|
||||
// var, procedure, property, function, type, const
|
||||
@ -285,6 +288,9 @@ begin
|
||||
begin
|
||||
AColor:=clPurple;
|
||||
s:='property';
|
||||
IsReadOnly:=IdentItem.IsPropertyReadOnly;
|
||||
if IsReadOnly then
|
||||
ImageIndex:=IDEImages.LoadImage(16,'ce_property_readonly');
|
||||
end;
|
||||
|
||||
ctnEnumIdentifier:
|
||||
@ -334,6 +340,17 @@ begin
|
||||
if x>MaxX then exit;
|
||||
end;
|
||||
ACanvas.Font.Style:=ACanvas.Font.Style-[fsBold];
|
||||
|
||||
// paint icon
|
||||
if ImageIndex>=0 then begin
|
||||
if MeasureOnly then
|
||||
Inc(Result.X, 18)
|
||||
else begin
|
||||
IDEImages.Images_16.Draw(ACanvas,x+1,y+(Result.Y-16) div 2,ImageIndex);
|
||||
inc(x,18);
|
||||
if x>MaxX then exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
// finally paint the type/value/parameters
|
||||
s:='';
|
||||
@ -500,6 +517,7 @@ var
|
||||
CanAddSemicolon: Boolean;
|
||||
CanAddComma: Boolean;
|
||||
ClassNode: TCodeTreeNode;
|
||||
IsReadOnly: Boolean;
|
||||
begin
|
||||
Result:='';
|
||||
CursorToLeft:=0;
|
||||
@ -507,8 +525,6 @@ begin
|
||||
ValueType:=icvIdentifier;
|
||||
Index:=aCompletion.Position;
|
||||
IdentList:=CodeToolBoss.IdentifierList;
|
||||
CanAddSemicolon:=CodeToolsOpts.IdentComplAddSemicolon and (AddChar<>';');
|
||||
CanAddComma:=(AddChar<>',');
|
||||
|
||||
IdentItem:=IdentList.FilteredItems[Index];
|
||||
if IdentItem=nil then begin
|
||||
@ -522,6 +538,10 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
CanAddSemicolon:=CodeToolsOpts.IdentComplAddSemicolon and (AddChar<>';');
|
||||
CanAddComma:=(AddChar<>',');
|
||||
IsReadOnly:=false;
|
||||
|
||||
Result:=IdentItem.Identifier;
|
||||
|
||||
case IdentItem.GetDesc of
|
||||
@ -537,8 +557,11 @@ begin
|
||||
end;
|
||||
|
||||
ctnProperty:
|
||||
if IdentItem.IsPropertyWithParams then
|
||||
ValueType:=icvIndexedProp;
|
||||
begin
|
||||
if IdentItem.IsPropertyWithParams then
|
||||
ValueType:=icvIndexedProp;
|
||||
IsReadOnly:=IdentItem.IsPropertyReadOnly;
|
||||
end;
|
||||
|
||||
ctnUnit, ctnPackage, ctnLibrary:
|
||||
ValueType:=icvUnitName;
|
||||
@ -624,6 +647,7 @@ begin
|
||||
and ((ilcfEndOfLine in IdentList.ContextFlags) or IdentList.StartUpAtomBehindIs(';'))
|
||||
and (not IdentItem.HasChilds)
|
||||
and (not IdentItem.HasIndex)
|
||||
and (not IsReadOnly)
|
||||
and (not IdentList.StartUpAtomBehindIs(':='))
|
||||
and (not IdentList.StartUpAtomBehindIs('('))
|
||||
and (IdentItem.CanBeAssigned)
|
||||
|
BIN
images/codeexplorer/ce_property_readonly.png
Normal file
BIN
images/codeexplorer/ce_property_readonly.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 695 B |
12229
images/laz_images.lrs
12229
images/laz_images.lrs
File diff suppressed because it is too large
Load Diff
@ -139,6 +139,7 @@ codeexplorer/ce_procedure.png
|
||||
codeexplorer/ce_function.png
|
||||
codeexplorer/ce_program.png
|
||||
codeexplorer/ce_property.png
|
||||
codeexplorer/ce_property_readonly.png
|
||||
codeexplorer/ce_section.png
|
||||
codeexplorer/ce_type.png
|
||||
codeexplorer/ce_unit.png
|
||||
|
Loading…
Reference in New Issue
Block a user