lcl: fix few 'Childs' -> 'Children' spelling, formatting

git-svn-id: trunk@25163 -
This commit is contained in:
paul 2010-05-04 05:36:08 +00:00
parent 5889dfa247
commit 940b4f4c6b

View File

@ -92,7 +92,7 @@ type
destructor Destroy; override; destructor Destroy; override;
procedure Clear; procedure Clear;
procedure SetControl(AControl: TControl); procedure SetControl(AControl: TControl);
procedure ApplyChildsizingBorders(ChildSizing: TControlChildSizing); procedure ApplyChildSizingBorders(ChildSizing: TControlChildSizing);
// for rows and columns // for rows and columns
procedure AllocateChildsArray(Orientation: TAutoSizeBoxOrientation; procedure AllocateChildsArray(Orientation: TAutoSizeBoxOrientation;
@ -100,9 +100,9 @@ type
procedure InitSums; procedure InitSums;
procedure SumLine(Orientation: TAutoSizeBoxOrientation; procedure SumLine(Orientation: TAutoSizeBoxOrientation;
DoInit: boolean); DoInit: boolean);
procedure ResizeChilds(ChildSizing: TControlChildSizing; procedure ResizeChildren(ChildSizing: TControlChildSizing;
Orientation: TAutoSizeBoxOrientation; Orientation: TAutoSizeBoxOrientation;
TargetSize: integer); TargetSize: integer);
procedure ComputeLeftTops(Orientation: TAutoSizeBoxOrientation); procedure ComputeLeftTops(Orientation: TAutoSizeBoxOrientation);
// for tables // for tables
@ -166,11 +166,11 @@ type
TAutoSizeCtrlData = class TAutoSizeCtrlData = class
private private
FChilds: TAvgLvlTree;// tree of TAutoSizeCtrlData FChilds: TAvgLvlTree;// tree of TAutoSizeCtrlData
function GetChilds(AControl: TControl): TAutoSizeCtrlData; function GetChildren(AControl: TControl): TAutoSizeCtrlData;
procedure DoMoveNonAlignedChilds(Side: TAnchorKind; procedure DoMoveNonAlignedChildren(Side: TAnchorKind;
var MoveDiff: integer; FindMinimum: boolean); var MoveDiff: integer; FindMinimum: boolean);
procedure SetupNonAlignedChilds(MoveNonAlignedChilds: boolean); procedure SetupNonAlignedChildren(MoveNonAlignedChildren: boolean);
procedure AlignChilds; procedure AlignChildren;
procedure SetupSpace; procedure SetupSpace;
function ComputePositions: boolean;// false if recomputation is needed (a property changed) function ComputePositions: boolean;// false if recomputation is needed (a property changed)
public public
@ -192,7 +192,7 @@ type
procedure ClearSides; procedure ClearSides;
procedure SetFixedLeftTop(ChildData: TAutoSizeCtrlData; Side: TAnchorKind; procedure SetFixedLeftTop(ChildData: TAutoSizeCtrlData; Side: TAnchorKind;
NewLeftTop: integer); NewLeftTop: integer);
property Childs[AControl: TControl]: TAutoSizeCtrlData read GetChilds; default; property Children[AControl: TControl]: TAutoSizeCtrlData read GetChildren; default;
procedure WriteDebugReport(const Title, Prefix: string; OnlyVisible: boolean = true); procedure WriteDebugReport(const Title, Prefix: string; OnlyVisible: boolean = true);
end; end;
@ -245,7 +245,7 @@ end;
{ TAutoSizeCtrlData } { TAutoSizeCtrlData }
function TAutoSizeCtrlData.GetChilds(AControl: TControl): TAutoSizeCtrlData; function TAutoSizeCtrlData.GetChildren(AControl: TControl): TAutoSizeCtrlData;
var var
AVLNode: TAvgLvlTreeNode; AVLNode: TAvgLvlTreeNode;
begin begin
@ -262,7 +262,7 @@ begin
end; end;
end; end;
procedure TAutoSizeCtrlData.AlignChilds; procedure TAutoSizeCtrlData.AlignChildren;
var var
AlignList: TFPList; AlignList: TFPList;
AlignBoundaryControls: array[TAnchorKind] of TAutoSizeCtrlData; AlignBoundaryControls: array[TAnchorKind] of TAutoSizeCtrlData;
@ -274,28 +274,30 @@ var
ChildData: TAutoSizeCtrlData; ChildData: TAutoSizeCtrlData;
a: TAnchorKind; a: TAnchorKind;
begin begin
WinControl.CreateControlAlignList(TheAlign,AlignList,nil); WinControl.CreateControlAlignList(TheAlign, AlignList, nil);
for i := 0 to AlignList.Count - 1 do begin for i := 0 to AlignList.Count - 1 do
Child:=TControl(AlignList[i]); begin
ChildData:=Childs[Child]; Child := TControl(AlignList[i]);
ChildData := Children[Child];
//DebugLn('DoAlign ',DbgSName(Child),' ',dbgs(Child.Align)); //DebugLn('DoAlign ',DbgSName(Child),' ',dbgs(Child.Align));
for a:=Low(TAnchorKind) to High(TAnchorKind) do for a := Low(TAnchorKind) to High(TAnchorKind) do
if a in AnchorAlign[TheAlign] then begin if a in AnchorAlign[TheAlign] then
ChildData.Sides[a].CtrlData:=AlignBoundaryControls[a]; begin
if (a in [akLeft,akTop]) = (ChildData.Sides[a].CtrlData=Self) then ChildData.Sides[a].CtrlData := AlignBoundaryControls[a];
ChildData.Sides[a].Side:=asrLeft if (a in [akLeft, akTop]) = (ChildData.Sides[a].CtrlData = Self) then
ChildData.Sides[a].Side := asrLeft
else else
ChildData.Sides[a].Side:=asrRight; ChildData.Sides[a].Side := asrRight;
//DebugLn('DoAlign ',DbgSName(Child),' ',dbgs(a),' ',dbgs(a,ChildData.Sides[a].Side)); //DebugLn('DoAlign ',DbgSName(Child),' ',dbgs(a),' ',dbgs(a,ChildData.Sides[a].Side));
end; end;
case TheAlign of case TheAlign of
alTop: AlignBoundaryControls[akTop]:=ChildData; alTop: AlignBoundaryControls[akTop] := ChildData;
alBottom: AlignBoundaryControls[akBottom]:=ChildData; alBottom: AlignBoundaryControls[akBottom] := ChildData;
alLeft: AlignBoundaryControls[akLeft]:=ChildData; alLeft: AlignBoundaryControls[akLeft] := ChildData;
alRight: AlignBoundaryControls[akRight]:=ChildData; alRight: AlignBoundaryControls[akRight] := ChildData;
alClient: ; // Delphi compatibility: multiple alClient controls overlap alClient: ; // Delphi compatibility: multiple alClient controls overlap
end; end;
{DebugLn(['DoAlign AlignBoundaryControls:', {DebugLn(['DoAlign AlignBoundaryControls:',
' Left=',DbgSName(AlignBoundaryControls[akLeft].Control), ' Left=',DbgSName(AlignBoundaryControls[akLeft].Control),
@ -308,12 +310,12 @@ var
var var
a: TAnchorKind; a: TAnchorKind;
begin begin
if ChildCount=0 then exit; if ChildCount = 0 then exit;
AlignList := TFPList.Create; AlignList := TFPList.Create;
try try
// align and anchor child controls // align and anchor child controls
for a:=Low(TAnchorKind) to High(TAnchorKind) do for a := Low(TAnchorKind) to High(TAnchorKind) do
AlignBoundaryControls[a]:=Self; AlignBoundaryControls[a] := Self;
DoAlign(alTop); DoAlign(alTop);
DoAlign(alBottom); DoAlign(alBottom);
DoAlign(alLeft); DoAlign(alLeft);
@ -335,7 +337,7 @@ var
begin begin
for i:=0 to ChildCount-1 do begin for i:=0 to ChildCount-1 do begin
Child:=WinControl.Controls[i]; Child:=WinControl.Controls[i];
ChildData:=Childs[Child]; ChildData:=Children[Child];
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
if ChildData.Sides[a].CtrlData=Self then begin if ChildData.Sides[a].CtrlData=Self then begin
// aligned or anchored to parent // aligned or anchored to parent
@ -727,7 +729,7 @@ begin
// for every side try to find a good distance to the client area // for every side try to find a good distance to the client area
for i:=0 to ChildCount-1 do begin for i:=0 to ChildCount-1 do begin
Child:=WinControl.Controls[i]; Child:=WinControl.Controls[i];
ChildData:=Childs[Child]; ChildData:=Children[Child];
if not ChildData.Visible then continue; if not ChildData.Visible then continue;
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
if ComputePosition(ChildData,a,assddLeftTop)<>crSuccess then begin if ComputePosition(ChildData,a,assddLeftTop)<>crSuccess then begin
@ -797,7 +799,7 @@ begin
FChilds.FreeAndClear; FChilds.FreeAndClear;
end; end;
procedure TAutoSizeCtrlData.DoMoveNonAlignedChilds(Side: TAnchorKind; procedure TAutoSizeCtrlData.DoMoveNonAlignedChildren(Side: TAnchorKind;
var MoveDiff: integer; FindMinimum: boolean); var MoveDiff: integer; FindMinimum: boolean);
var var
i: Integer; i: Integer;
@ -810,7 +812,7 @@ begin
MoveDiffValid:=false; MoveDiffValid:=false;
for i:=0 to ChildCount-1 do begin for i:=0 to ChildCount-1 do begin
Child:=WinControl.Controls[i]; Child:=WinControl.Controls[i];
ChildData:=Childs[Child]; ChildData:=Children[Child];
if not ChildData.Visible then continue; if not ChildData.Visible then continue;
if IsNotAligned(Child) then begin if IsNotAligned(Child) then begin
// this is a non aligned control // this is a non aligned control
@ -844,7 +846,7 @@ begin
end; end;
end; end;
procedure TAutoSizeCtrlData.SetupNonAlignedChilds(MoveNonAlignedChilds: boolean); procedure TAutoSizeCtrlData.SetupNonAlignedChildren(MoveNonAlignedChildren: boolean);
var var
ChildSizing: TControlChildSizing; ChildSizing: TControlChildSizing;
Box: TAutoSizeBox; Box: TAutoSizeBox;
@ -865,15 +867,15 @@ begin
// move the non-aligned controls (i.e. not aligned or fixed anchored) // move the non-aligned controls (i.e. not aligned or fixed anchored)
// Find the leftmost and topmost of those controls // Find the leftmost and topmost of those controls
MoveDiff:=0; MoveDiff:=0;
DoMoveNonAlignedChilds(akLeft,MoveDiff,true); DoMoveNonAlignedChildren(akLeft,MoveDiff,true);
//DebugLn(['TAutoSizeCtrlData.ComputePreferredClientArea akLeft MoveDiff=',MoveDiff]); //DebugLn(['TAutoSizeCtrlData.ComputePreferredClientArea akLeft MoveDiff=',MoveDiff]);
if not MoveNonAlignedChilds then MoveDiff:=0; if not MoveNonAlignedChildren then MoveDiff:=0;
DoMoveNonAlignedChilds(akLeft,MoveDiff,false); DoMoveNonAlignedChildren(akLeft,MoveDiff,false);
MoveDiff:=0; MoveDiff:=0;
DoMoveNonAlignedChilds(akTop,MoveDiff,true); DoMoveNonAlignedChildren(akTop,MoveDiff,true);
//DebugLn(['TAutoSizeCtrlData.ComputePreferredClientArea akTop MoveDiff=',MoveDiff]); //DebugLn(['TAutoSizeCtrlData.ComputePreferredClientArea akTop MoveDiff=',MoveDiff]);
if not MoveNonAlignedChilds then MoveDiff:=0; if not MoveNonAlignedChildren then MoveDiff:=0;
DoMoveNonAlignedChilds(akTop,MoveDiff,false); DoMoveNonAlignedChildren(akTop,MoveDiff,false);
end else begin end else begin
// there is an automatic layout for non aligned childs // there is an automatic layout for non aligned childs
// use the layout engine, but with static values // use the layout engine, but with static values
@ -910,7 +912,7 @@ begin
if Child=nil then continue; if Child=nil then continue;
NewBounds:=ControlBox.NewControlBounds; NewBounds:=ControlBox.NewControlBounds;
//DebugLn(['TAutoSizeCtrlData.SetupNonAlignedChilds ',DbgSName(Child),' ',dbgs(NewBounds)]); //DebugLn(['TAutoSizeCtrlData.SetupNonAlignedChilds ',DbgSName(Child),' ',dbgs(NewBounds)]);
ChildData:=Childs[Child]; ChildData:=Children[Child];
// set left // set left
SetFixedLeftTop(ChildData,akLeft,NewBounds.Left); SetFixedLeftTop(ChildData,akLeft,NewBounds.Left);
// set width // set width
@ -978,7 +980,7 @@ procedure TAutoSizeCtrlData.ComputePreferredClientArea(
begin begin
for i:=0 to ChildCount-1 do begin for i:=0 to ChildCount-1 do begin
Child:=WinControl.Controls[i]; Child:=WinControl.Controls[i];
ChildData:=Childs[Child]; ChildData:=Children[Child];
if ChildData.Visible then begin if ChildData.Visible then begin
CurAnchors:=Child.Anchors; CurAnchors:=Child.Anchors;
if Child.Align in [alLeft,alRight,alTop,alBottom,alClient] then if Child.Align in [alLeft,alRight,alTop,alBottom,alClient] then
@ -1039,7 +1041,7 @@ procedure TAutoSizeCtrlData.ComputePreferredClientArea(
if ReferenceControl=Control then if ReferenceControl=Control then
ChildData.Sides[a].CtrlData:=Self ChildData.Sides[a].CtrlData:=Self
else if (ReferenceControl<>nil) and (ReferenceControl.Parent=Control) then else if (ReferenceControl<>nil) and (ReferenceControl.Parent=Control) then
ChildData.Sides[a].CtrlData:=Childs[ReferenceControl]; ChildData.Sides[a].CtrlData:=Children[ReferenceControl];
ChildData.Sides[a].Side:=ReferenceSide; ChildData.Sides[a].Side:=ReferenceSide;
//if ChildData.Sides[a].CtrlData<>nil then DebugLn(['GetSideAnchor AAA1 Child=',DbgSName(Child),', a=',dbgs(a),' ReferenceControl=',DbgSName(ChildData.Sides[a].CtrlData.Control),' ReferenceSide=',dbgs(a,ChildData.Sides[a].Side)]); //if ChildData.Sides[a].CtrlData<>nil then DebugLn(['GetSideAnchor AAA1 Child=',DbgSName(Child),', a=',dbgs(a),' ReferenceControl=',DbgSName(ChildData.Sides[a].CtrlData.Control),' ReferenceSide=',dbgs(a,ChildData.Sides[a].Side)]);
end; end;
@ -1065,7 +1067,7 @@ begin
for i:=0 to ChildCount-1 do begin for i:=0 to ChildCount-1 do begin
Child:=WinControl.Controls[i]; Child:=WinControl.Controls[i];
FixControlProperties(Child); FixControlProperties(Child);
ChildData:=Childs[Child]; ChildData:=Children[Child];
if ChildData.Visible then if ChildData.Visible then
inc(VisibleCount); inc(VisibleCount);
end; end;
@ -1081,7 +1083,7 @@ begin
// init dependencies // init dependencies
for i:=0 to ChildCount-1 do begin for i:=0 to ChildCount-1 do begin
Child:=WinControl.Controls[i]; Child:=WinControl.Controls[i];
ChildData:=Childs[Child]; ChildData:=Children[Child];
ChildData.ClearSides; ChildData.ClearSides;
if not ChildData.Visible then continue; if not ChildData.Visible then continue;
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
@ -1100,10 +1102,10 @@ begin
end; end;
//WriteDebugReport('anchored',''); //WriteDebugReport('anchored','');
SetupNonAlignedChilds(MoveNonAlignedChilds); SetupNonAlignedChildren(MoveNonAlignedChilds);
//WriteDebugReport('nonaligned',''); //WriteDebugReport('nonaligned','');
// setup the dependencies for Aligned controls // setup the dependencies for Aligned controls
AlignChilds; AlignChildren;
//WriteDebugReport('aligned',''); //WriteDebugReport('aligned','');
// setup space for dependencies // setup space for dependencies
@ -1122,7 +1124,7 @@ begin
// compute needed clientwidth/clientheight // compute needed clientwidth/clientheight
for i:=0 to ChildCount-1 do begin for i:=0 to ChildCount-1 do begin
Child:=WinControl.Controls[i]; Child:=WinControl.Controls[i];
ChildData:=Childs[Child]; ChildData:=Children[Child];
if not ChildData.Visible then continue; if not ChildData.Visible then continue;
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
if (ChildData.Sides[a].DistanceState[assddLeftTop]=assdfValid) if (ChildData.Sides[a].DistanceState[assddLeftTop]=assdfValid)
@ -1149,7 +1151,7 @@ begin
for i:=0 to ChildCount-1 do for i:=0 to ChildCount-1 do
begin begin
Child:=WinControl.Controls[i]; Child:=WinControl.Controls[i];
ChildData:=Childs[Child]; ChildData:=Children[Child];
if not ChildData.Visible then continue; if not ChildData.Visible then continue;
if (Child.Align<>alNone) then continue; if (Child.Align<>alNone) then continue;
if (akLeft in Child.Anchors) and (Child.AnchorSide[akLeft].Control=nil) if (akLeft in Child.Anchors) and (Child.AnchorSide[akLeft].Control=nil)
@ -1322,7 +1324,7 @@ begin
end; end;
for i:=0 to ChildCount-1 do for i:=0 to ChildCount-1 do
if WinControl.Controls[i].Visible or (not OnlyVisible) then if WinControl.Controls[i].Visible or (not OnlyVisible) then
Childs[WinControl.Controls[i]].WriteDebugReport('',Prefix+dbgs(i)+': '); Children[WinControl.Controls[i]].WriteDebugReport('',Prefix+dbgs(i)+': ');
end; end;
{ TAutoSizeBox } { TAutoSizeBox }
@ -1506,8 +1508,7 @@ begin
end; end;
end; end;
procedure TAutoSizeBox.ApplyChildsizingBorders(ChildSizing: TControlChildSizing procedure TAutoSizeBox.ApplyChildSizingBorders(ChildSizing: TControlChildSizing);
);
var var
MinBorder: LongInt; MinBorder: LongInt;
begin begin
@ -1678,7 +1679,7 @@ begin
end; end;
end; end;
procedure TAutoSizeBox.ResizeChilds(ChildSizing: TControlChildSizing; procedure TAutoSizeBox.ResizeChildren(ChildSizing: TControlChildSizing;
Orientation: TAutoSizeBoxOrientation; TargetSize: integer); Orientation: TAutoSizeBoxOrientation; TargetSize: integer);
type type
TResizeFactor = record TResizeFactor = record
@ -2061,9 +2062,9 @@ procedure TAutoSizeBox.ResizeTable(ChildSizing: TControlChildSizing;
TargetWidth, TargetHeight: integer); TargetWidth, TargetHeight: integer);
begin begin
// resize rows and columns // resize rows and columns
ResizeChilds(ChildSizing,asboHorizontal,TargetWidth); ResizeChildren(ChildSizing,asboHorizontal,TargetWidth);
ComputeLeftTops(asboHorizontal); ComputeLeftTops(asboHorizontal);
ResizeChilds(ChildSizing,asboVertical,TargetHeight); ResizeChildren(ChildSizing,asboVertical,TargetHeight);
ComputeLeftTops(asboVertical); ComputeLeftTops(asboVertical);
end; end;
@ -2424,11 +2425,8 @@ begin
AlignList.Clear; AlignList.Clear;
// first add the current control // first add the current control
if (StartControl <> nil) if (StartControl <> nil) and (StartControl.Align = TheAlign) and
and (StartControl.Align = TheAlign) ((TheAlign = alNone) or StartControl.IsControlVisible) then
and ((TheAlign = alNone)
or StartControl.IsControlVisible)
then
AlignList.Add(StartControl); AlignList.Add(StartControl);
// then add all other // then add all other
@ -2441,8 +2439,8 @@ begin
if Control = StartControl then Continue; if Control = StartControl then Continue;
X := 0; X := 0;
while (X < AlignList.Count) while (X < AlignList.Count) and
and not InsertBefore(Control, TControl(AlignList[X]), TheAlign) do not InsertBefore(Control, TControl(AlignList[X]), TheAlign) do
Inc(X); Inc(X);
AlignList.Insert(X, Control); AlignList.Insert(X, Control);
end; end;
@ -3040,10 +3038,12 @@ var
CreateControlAlignList(AAlign,AlignList,AControl); CreateControlAlignList(AAlign,AlignList,AControl);
{$IFDEF CHECK_POSITION} {$IFDEF CHECK_POSITION}
if CheckPosition(Self) then if CheckPosition(Self) then
if AlignList.Count>0 then begin if AlignList.Count>0 then
begin
DbgOut('[TWinControl.AlignControls.DoAlign] Self=',DbgSName(Self),' Control=',dbgsName(AControl), DbgOut('[TWinControl.AlignControls.DoAlign] Self=',DbgSName(Self),' Control=',dbgsName(AControl),
' current align=',AlignNames[AAlign],' AlignList=['); ' current align=',AlignNames[AAlign],' AlignList=[');
for i:=0 to AlignList.Count-1 do begin for i:=0 to AlignList.Count-1 do
begin
if i>0 then DbgOut(','); if i>0 then DbgOut(',');
DbgOut(DbgSName(TObject(AlignList[i]))); DbgOut(DbgSName(TObject(AlignList[i])));
end; end;
@ -3052,12 +3052,13 @@ var
{$ENDIF} {$ENDIF}
// let override handle them // let override handle them
if DoAlignChildControls(AAlign,AControl,AlignList,RemainingClientRect) then if DoAlignChildControls(AAlign, AControl, AlignList, RemainingClientRect) then
exit; exit;
// remove controls that are positioned by other means // remove controls that are positioned by other means
if (AAlign=alNone) and (AutoSize or (ChildSizing.Layout<>cclNone)) then if (AAlign = alNone) and (AutoSize or (ChildSizing.Layout <> cclNone)) then
for I := AlignList.Count - 1 downto 0 do begin for I := AlignList.Count - 1 downto 0 do
Control:=TControl(AlignList[I]); begin
Control := TControl(AlignList[I]);
if IsNotAligned(Control) then AlignList.Delete(I); if IsNotAligned(Control) then AlignList.Delete(I);
end; end;
// anchor/align control // anchor/align control
@ -3072,21 +3073,22 @@ var
Control: TControl; Control: TControl;
begin begin
// check if ChildSizing aligning is enabled // check if ChildSizing aligning is enabled
if (ChildSizing.Layout=cclNone) then if (ChildSizing.Layout = cclNone) then
exit; exit;
/// collect all 'not aligned' controls /// collect all 'not aligned' controls
AlignList.Clear; AlignList.Clear;
for i:=0 to ControlCount-1 do begin for i := 0 to ControlCount - 1 do
begin
Control := Controls[i]; Control := Controls[i];
if IsNotAligned(Control) and Control.IsControlVisible then if IsNotAligned(Control) and Control.IsControlVisible then
AlignList.Add(Control); AlignList.Add(Control);
end; end;
//debugln('DoAlignNotAligned ',DbgSName(Self),' AlignList.Count=',dbgs(AlignList.Count)); //debugln('DoAlignNotAligned ',DbgSName(Self),' AlignList.Count=',dbgs(AlignList.Count));
if AlignList.Count=0 then exit; if AlignList.Count = 0 then exit;
LastBoundsMutated:=nil; LastBoundsMutated := nil;
AlignNonAlignedControls(AlignList,BoundsMutated); AlignNonAlignedControls(AlignList, BoundsMutated);
end; end;
var var