From b55afae47adfc8c273d49394c023403b0d16766c Mon Sep 17 00:00:00 2001 From: juha Date: Sun, 14 Oct 2012 23:31:29 +0000 Subject: [PATCH] IDE: formatting git-svn-id: trunk@39085 - --- ideintf/objectinspector.pp | 7 ++- ideintf/propedits.pp | 99 ++++++++++++++++++-------------------- 2 files changed, 50 insertions(+), 56 deletions(-) diff --git a/ideintf/objectinspector.pp b/ideintf/objectinspector.pp index 85ec223ea8..6f43fe408b 100644 --- a/ideintf/objectinspector.pp +++ b/ideintf/objectinspector.pp @@ -1252,8 +1252,7 @@ begin end; end; -function TOICustomPropertyGrid.GetRowByPath( - const PropPath: string): TOIPropertyGridRow; +function TOICustomPropertyGrid.GetRowByPath(const PropPath: string): TOIPropertyGridRow; // searches PropPath. Expands automatically parent rows var CurName:string; s,e:integer; @@ -1355,7 +1354,6 @@ var CurRow:TOIPropertyGridRow; OldChangeStep: integer; begin - //writeln('#################### TOICustomPropertyGrid.DoCallEdit ...'); if not CanEditRowValue then exit; OldChangeStep:=fChangeStep; @@ -1364,7 +1362,8 @@ begin {$IFNDEF DoNotCatchOIExceptions} try {$ENDIF} - DebugLn(['#################### TOICustomPropertyGrid.DoCallEdit for ',CurRow.Editor.ClassName,' Edit=',Edit=oiqeEdit]); + DebugLn(['#################### TOICustomPropertyGrid.DoCallEdit for ', + CurRow.Editor.ClassName,' Edit=',Edit=oiqeEdit]); Include(FStates,pgsApplyingValue); try if Edit=oiqeShowValue then diff --git a/ideintf/propedits.pp b/ideintf/propedits.pp index fb15850e76..c2472b7f64 100644 --- a/ideintf/propedits.pp +++ b/ideintf/propedits.pp @@ -350,8 +350,8 @@ type procedure SetOrdValue(const NewValue: Longint); procedure SetPtrValue(const NewValue: Pointer); procedure SetStrValue(const NewValue: AnsiString); - procedure SetVarValue(const NewValue: Variant); procedure SetWideStrValue(const NewValue: WideString); + procedure SetVarValue(const NewValue: Variant); procedure Modified; function ValueAvailable: Boolean; procedure ListMeasureWidth(const AValue: ansistring; Index:integer; @@ -2119,13 +2119,11 @@ begin PropEditor.SetPropEntry(0, Instance, PropInfo); PropEditor.Initialize; // check for multiselection, ValueAvailable and customfilter - if ((SelCount > 1) - and not (paMultiSelect in PropEditor.GetAttributes)) + if ((SelCount > 1) and not (paMultiSelect in PropEditor.GetAttributes)) or not PropEditor.ValueAvailable or (Assigned(AEditorFilterFunc) and not AEditorFilterFunc(PropEditor)) - then begin + then Candidates.Delete(I); - end; PropEditor.Free; end; @@ -2155,14 +2153,12 @@ begin for J := 0 to SelCount - 1 do begin if (ASelection[J].ClassType <> ClassTyp) and - (GetEditorClass(TPropInfoList(PropLists[J])[I], - ASelection[J]) <> EdClass) then + (GetEditorClass(TPropInfoList(PropLists[J])[I], ASelection[J])<>EdClass) then begin AddEditor := False; Break; end; - PropEditor.SetPropEntry(J, ASelection[J], - TPropInfoList(PropLists[J])[I]); + PropEditor.SetPropEntry(J, ASelection[J], TPropInfoList(PropLists[J])[I]); end; if AddEditor then begin @@ -2590,6 +2586,15 @@ begin PropertyHook.Modified(Self); end; +procedure TPropertyEditor.SetPropEntry(Index:Integer; + AnInstance:TPersistent; APropInfo:PPropInfo); +begin + with FPropList^[Index] do begin + Instance:=AnInstance; + PropInfo:=APropInfo; + end; +end; + procedure TPropertyEditor.SetFloatValue(const NewValue:Extended); var I:Integer; @@ -2625,6 +2630,22 @@ begin end; end; +procedure TPropertyEditor.SetInt64Value(const NewValue:Int64); +var + I:Integer; + Changed: boolean; +begin + Changed:=false; + for I:=0 to FPropCount-1 do + with FPropList^[I] do + Changed:=Changed or (GetInt64Prop(Instance,PropInfo)<>NewValue); + if Changed then begin + for I:=0 to FPropCount-1 do + with FPropList^[I] do SetInt64Prop(Instance,PropInfo,NewValue); + Modified; + end; +end; + procedure TPropertyEditor.SetOrdValue(const NewValue: Longint); var I:Integer; @@ -2658,15 +2679,6 @@ begin end; end; -procedure TPropertyEditor.SetPropEntry(Index:Integer; - AnInstance:TPersistent; APropInfo:PPropInfo); -begin - with FPropList^[Index] do begin - Instance:=AnInstance; - PropInfo:=APropInfo; - end; -end; - procedure TPropertyEditor.SetStrValue(const NewValue:AnsiString); var I:Integer; @@ -2683,22 +2695,6 @@ begin end; end; -procedure TPropertyEditor.SetVarValue(const NewValue:Variant); -var - I:Integer; - Changed: boolean; -begin - Changed:=false; - for I:=0 to FPropCount-1 do - with FPropList^[I] do - Changed:=Changed or (GetVariantProp(Instance,PropInfo)<>NewValue); - if Changed then begin - for I:=0 to FPropCount-1 do - with FPropList^[I] do SetVariantProp(Instance,PropInfo,NewValue); - Modified; - end; -end; - procedure TPropertyEditor.SetWideStrValue(const NewValue: WideString); var I:Integer; @@ -2715,6 +2711,22 @@ begin end; end; +procedure TPropertyEditor.SetVarValue(const NewValue:Variant); +var + I:Integer; + Changed: boolean; +begin + Changed:=false; + for I:=0 to FPropCount-1 do + with FPropList^[I] do + Changed:=Changed or (GetVariantProp(Instance,PropInfo)<>NewValue); + if Changed then begin + for I:=0 to FPropCount-1 do + with FPropList^[I] do SetVariantProp(Instance,PropInfo,NewValue); + Modified; + end; +end; + procedure TPropertyEditor.Revert; var I:Integer; begin @@ -2758,22 +2770,6 @@ begin with FPropList^[Index] do Result:=GetInt64Prop(Instance,PropInfo); end; -procedure TPropertyEditor.SetInt64Value(const NewValue:Int64); -var - I:Integer; - Changed: boolean; -begin - Changed:=false; - for I:=0 to FPropCount-1 do - with FPropList^[I] do - Changed:=Changed or (GetInt64Prop(Instance,PropInfo)<>NewValue); - if Changed then begin - for I:=0 to FPropCount-1 do - with FPropList^[I] do SetInt64Prop(Instance,PropInfo,NewValue); - Modified; - end; -end; - { these three procedures implement the default render behavior of the object inspector's drop down list editor. You don't need to override the two measure procedures if the default width or height don't @@ -6208,8 +6204,7 @@ begin TCollectionPropertyEditor.ShowCollectionEditor(ACollection, AComponent, APropertyName); end; -function IsInteresting( - const AEditor: TPropertyEditor; const AFilter: TTypeKinds): Boolean; +function IsInteresting(const AEditor: TPropertyEditor; const AFilter: TTypeKinds): Boolean; var visited: TFPList;