Class Editor : Add "Optional" column to the properties grid.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5271 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2016-10-20 11:49:17 +00:00
parent 28e7cd7c4b
commit 04fb8def2c
2 changed files with 30 additions and 48 deletions

View File

@ -8,7 +8,7 @@ object fClassEdit: TfClassEdit
ClientHeight = 556 ClientHeight = 556
ClientWidth = 552 ClientWidth = 552
Position = poDesktopCenter Position = poDesktopCenter
LCLVersion = '1.2.2.0' LCLVersion = '1.6.1.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 50 Height = 50
@ -63,27 +63,27 @@ object fClassEdit: TfClassEdit
OnChange = PCChange OnChange = PCChange
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Compound Object' Caption = 'Compound Object'
ClientHeight = 478 ClientHeight = 480
ClientWidth = 544 ClientWidth = 544
object Label1: TLabel object Label1: TLabel
Left = 4 Left = 4
Height = 15 Height = 13
Top = 18 Top = 18
Width = 32 Width = 27
Caption = 'Name' Caption = 'Name'
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
Left = 4 Left = 4
Height = 15 Height = 13
Top = 59 Top = 59
Width = 72 Width = 66
Caption = 'Inheritts from' Caption = 'Inheritts from'
ParentColor = False ParentColor = False
end end
object edtName: TEdit object edtName: TEdit
Left = 92 Left = 92
Height = 23 Height = 21
Top = 18 Top = 18
Width = 440 Width = 440
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
@ -91,17 +91,17 @@ object fClassEdit: TfClassEdit
end end
object GroupBox1: TGroupBox object GroupBox1: TGroupBox
Left = 4 Left = 4
Height = 303 Height = 305
Top = 98 Top = 98
Width = 529 Width = 529
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
Caption = ' Properties ' Caption = ' Properties '
ClientHeight = 285 ClientHeight = 287
ClientWidth = 525 ClientWidth = 525
TabOrder = 2 TabOrder = 2
object edtProp: TListView object edtProp: TListView
Left = 0 Left = 0
Height = 285 Height = 287
Top = 0 Top = 0
Width = 525 Width = 525
Align = alClient Align = alClient
@ -113,11 +113,15 @@ object fClassEdit: TfClassEdit
end end
item item
Caption = 'Type' Caption = 'Type'
Width = 200 Width = 190
end end
item item
Caption = 'Attribute' Caption = 'Attribute'
Width = 107 Width = 60
end
item
Caption = 'Optional'
Width = 55
end> end>
HideSelection = False HideSelection = False
PopupMenu = PopupMenu1 PopupMenu = PopupMenu1
@ -131,7 +135,7 @@ object fClassEdit: TfClassEdit
object Button3: TButton object Button3: TButton
Left = 4 Left = 4
Height = 25 Height = 25
Top = 411 Top = 413
Width = 100 Width = 100
Action = actPropAdd Action = actPropAdd
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
@ -141,7 +145,7 @@ object fClassEdit: TfClassEdit
object Button4: TButton object Button4: TButton
Left = 116 Left = 116
Height = 25 Height = 25
Top = 411 Top = 413
Width = 100 Width = 100
Action = actPropEdit Action = actPropEdit
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
@ -151,7 +155,7 @@ object fClassEdit: TfClassEdit
object Button5: TButton object Button5: TButton
Left = 228 Left = 228
Height = 25 Height = 25
Top = 411 Top = 413
Width = 100 Width = 100
Action = actPropDelete Action = actPropDelete
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
@ -160,18 +164,18 @@ object fClassEdit: TfClassEdit
end end
object edtParent: TComboBox object edtParent: TComboBox
Left = 92 Left = 92
Height = 23 Height = 21
Top = 58 Top = 58
Width = 440 Width = 440
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ItemHeight = 15 ItemHeight = 13
Style = csDropDownList Style = csDropDownList
TabOrder = 1 TabOrder = 1
end end
object Button7: TButton object Button7: TButton
Left = 372 Left = 372
Height = 25 Height = 25
Top = 411 Top = 413
Width = 70 Width = 70
Action = actMoveUp Action = actMoveUp
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
@ -181,7 +185,7 @@ object fClassEdit: TfClassEdit
object Button8: TButton object Button8: TButton
Left = 452 Left = 452
Height = 25 Height = 25
Top = 411 Top = 413
Width = 70 Width = 70
Action = actMoveDown Action = actMoveDown
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
@ -191,7 +195,7 @@ object fClassEdit: TfClassEdit
object Button9: TButton object Button9: TButton
Left = 372 Left = 372
Height = 25 Height = 25
Top = 440 Top = 442
Width = 70 Width = 70
Action = actMoveFirst Action = actMoveFirst
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
@ -200,7 +204,7 @@ object fClassEdit: TfClassEdit
object Button10: TButton object Button10: TButton
Left = 452 Left = 452
Height = 25 Height = 25
Top = 440 Top = 442
Width = 70 Width = 70
Action = actMoveLast Action = actMoveLast
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
@ -640,7 +644,6 @@ object fClassEdit: TfClassEdit
end> end>
VisibleSpecialChars = [vscSpace, vscTabAtLast] VisibleSpecialChars = [vscSpace, vscTabAtLast]
ReadOnly = True ReadOnly = True
SelectedColor.FrameEdges = sfeAround
SelectedColor.BackPriority = 50 SelectedColor.BackPriority = 50
SelectedColor.ForePriority = 50 SelectedColor.ForePriority = 50
SelectedColor.FramePriority = 50 SelectedColor.FramePriority = 50
@ -648,23 +651,17 @@ object fClassEdit: TfClassEdit
SelectedColor.ItalicPriority = 50 SelectedColor.ItalicPriority = 50
SelectedColor.UnderlinePriority = 50 SelectedColor.UnderlinePriority = 50
SelectedColor.StrikeOutPriority = 50 SelectedColor.StrikeOutPriority = 50
IncrementColor.FrameEdges = sfeAround
HighlightAllColor.FrameEdges = sfeAround
BracketHighlightStyle = sbhsBoth BracketHighlightStyle = sbhsBoth
BracketMatchColor.Background = clNone BracketMatchColor.Background = clNone
BracketMatchColor.Foreground = clNone BracketMatchColor.Foreground = clNone
BracketMatchColor.FrameEdges = sfeAround
BracketMatchColor.Style = [fsBold] BracketMatchColor.Style = [fsBold]
FoldedCodeColor.Background = clNone FoldedCodeColor.Background = clNone
FoldedCodeColor.Foreground = clGray FoldedCodeColor.Foreground = clGray
FoldedCodeColor.FrameColor = clGray FoldedCodeColor.FrameColor = clGray
FoldedCodeColor.FrameEdges = sfeAround
MouseLinkColor.Background = clNone MouseLinkColor.Background = clNone
MouseLinkColor.Foreground = clBlue MouseLinkColor.Foreground = clBlue
MouseLinkColor.FrameEdges = sfeAround
LineHighlightColor.Background = clNone LineHighlightColor.Background = clNone
LineHighlightColor.Foreground = clNone LineHighlightColor.Foreground = clNone
LineHighlightColor.FrameEdges = sfeAround
inline SynLeftGutterPartList1: TSynGutterPartList inline SynLeftGutterPartList1: TSynGutterPartList
end end
end end
@ -780,19 +777,6 @@ object fClassEdit: TfClassEdit
object SynXMLSyn1: TSynXMLSyn object SynXMLSyn1: TSynXMLSyn
DefaultFilter = 'Documents XML (*.xml,*.xsd,*.xsl,*.xslt,*.dtd)|*.xml;*.xsd;*.xsl;*.xslt;*.dtd' DefaultFilter = 'Documents XML (*.xml,*.xsd,*.xsl,*.xslt,*.dtd)|*.xml;*.xsd;*.xsl;*.xslt;*.dtd'
Enabled = False Enabled = False
ElementAttri.FrameEdges = sfeAround
AttributeAttri.FrameEdges = sfeAround
NamespaceAttributeAttri.FrameEdges = sfeAround
AttributeValueAttri.FrameEdges = sfeAround
NamespaceAttributeValueAttri.FrameEdges = sfeAround
TextAttri.FrameEdges = sfeAround
CDATAAttri.FrameEdges = sfeAround
EntityRefAttri.FrameEdges = sfeAround
ProcessingInstructionAttri.FrameEdges = sfeAround
CommentAttri.FrameEdges = sfeAround
DocTypeAttri.FrameEdges = sfeAround
SpaceAttri.FrameEdges = sfeAround
SymbolAttri.FrameEdges = sfeAround
WantBracesParsed = False WantBracesParsed = False
left = 210 left = 210
top = 171 top = 171

View File

@ -365,7 +365,8 @@ end;
function TfClassEdit.LoadProperty(APropDef: TPasProperty; const AIndex : Integer) : TListItem; function TfClassEdit.LoadProperty(APropDef: TPasProperty; const AIndex : Integer) : TListItem;
var var
itm : TListItem; itm : TListItem;
s, extName : string; extName : string;
optionalProp : Boolean;
begin begin
extName := FSymbolTable.GetExternalName(APropDef); extName := FSymbolTable.GetExternalName(APropDef);
itm := FindItem(extName,edtProp.Items); itm := FindItem(extName,edtProp.Items);
@ -377,12 +378,9 @@ begin
end; end;
itm.Caption := extName; itm.Caption := extName;
itm.SubItems.Add(FSymbolTable.GetExternalName(APropDef.VarType)); itm.SubItems.Add(FSymbolTable.GetExternalName(APropDef.VarType));
if FSymbolTable.IsAttributeProperty(APropDef) then begin itm.SubItems.Add(BOOL_STR[FSymbolTable.IsAttributeProperty(APropDef)]);
s := 'Y'; optionalProp := (AnsiPos(sWST_PROP_STORE_PREFIX,APropDef.StoredAccessorName) = 1);
end else begin itm.SubItems.Add(BOOL_STR[optionalProp]);
s := 'N';
end;
itm.SubItems.Add(s);
itm.Data := APropDef; itm.Data := APropDef;
Result := itm; Result := itm;
end; end;