LCL: remove obsolete AlignNames, AnchorNames and AutoSizePhaseNames. Use WriteStr

git-svn-id: trunk@33233 -
This commit is contained in:
juha 2011-11-02 23:15:07 +00:00
parent 8c4df84f94
commit 123ceac181
7 changed files with 34 additions and 40 deletions

View File

@ -4364,7 +4364,7 @@ begin
Item.Checked:=HeaderPosition=TADLHeaderPosition(Item.Tag);
end;
for Side:=Low(TAnchorKind) to High(TAnchorKind) do begin
Item:=DockMaster.AddPopupMenuItem('HeaderPos'+AnchorNames[Side]+'MenuItem',
Item:=DockMaster.AddPopupMenuItem('HeaderPos'+DbgS(Side)+'MenuItem',
SideCaptions[Side], @HeaderPositionItemClick,
HeaderPosItem);
if Item=nil then continue;
@ -4375,7 +4375,7 @@ begin
// enlarge
for Side:=Low(TAnchorKind) to High(TAnchorKind) do begin
Item:=DockMaster.AddRemovePopupMenuItem(ParentSite.EnlargeSide(Side,true),
'Enlarge'+AnchorNames[Side]+'MenuItem', Format(adrsEnlargeSide, [
'Enlarge'+DbgS(Side)+'MenuItem', Format(adrsEnlargeSide, [
SideCaptions[Side]]),@EnlargeSideClick);
if Item<>nil then Item.Tag:=ord(Side);
end;

View File

@ -615,7 +615,7 @@ var
Info: PNodeInfo;
begin
Info:=GetNodeInfo(Node);
//DebugLn(['GetMinPos ',Node.Name,' ',AnchorNames[Side],' ',Info^.MinLeftCalculating]);
//DebugLn(['GetMinPos ',Node.Name,' ',DbgS(Side),' ',Info^.MinLeftCalculating]);
if Side=akLeft then
Result:=Compute(Info^.MinLeftValid,Info^.MinLeftCalculating,Info^.MinLeft)
else
@ -1145,7 +1145,7 @@ begin
Anchors[akTop]:=Config.GetValue('Anchors/Top','');
Anchors[akRight]:=Config.GetValue('Anchors/Right','');
Anchors[akBottom]:=Config.GetValue('Anchors/Bottom','');
Align:=NameToADLAlign(Config.GetValue('Anchors/Align',AlignNames[alNone]));
Align:=NameToADLAlign(Config.GetValue('Anchors/Align',dbgs(alNone)));
WindowState:=NameToADLWindowState(Config.GetValue('WindowState',ADLWindowStateNames[wsNormal]));
HeaderPosition:=NameToADLHeaderPosition(Config.GetValue('Header/Position',ADLHeaderPositionNames[adlhpAuto]));
TabPosition:=NameToADLTabPosition(Config.GetValue('Header/TabPosition',ADLTabPostionNames[tpTop]));

View File

@ -2373,18 +2373,6 @@ const
// akBottom -> asrTop, asrBottom, asrCenter
(akLeft,akRight,akLeft)
);
AlignNames: array[TAlign] of string = (
'alNone', 'alTop', 'alBottom', 'alLeft', 'alRight', 'alClient', 'alCustom');
AnchorNames: array[TAnchorKind] of string = (
'akTop', 'akLeft', 'akRight', 'akBottom');
AutoSizePhaseNames: array[TControlAutoSizePhase] of string = (
'caspNone',
'caspChangingProperties',
'caspCreatingHandles',
'caspComputingBounds',
'caspRealizingBounds',
'caspShowing'
);
function FindDragTarget(const Position: TPoint; AllowDisabled: Boolean): TControl;
function FindControlAtPosition(const Position: TPoint; AllowDisabled: Boolean): TControl;
@ -2595,7 +2583,7 @@ end;
function DbgS(a: TAnchorKind): string;
begin
Result:=AnchorNames[a];
WriteStr(Result, a);
end;
function DbgS(Anchors: TAnchors): string;
@ -2605,8 +2593,9 @@ begin
Result:='';
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
if a in Anchors then begin
if Result<>'' then Result:=Result+',';
Result:=Result+AnchorNames[a];
if Result<>'' then
Result:=Result+',';
Result:=Result+DbgS(a);
end;
end;
Result:='['+Result+']';
@ -2614,7 +2603,7 @@ end;
function DbgS(a: TAlign): string;
begin
Result:=AlignNames[a];
WriteStr(Result, a);
end;
function DbgS(a: TAnchorKind; Side: TAnchorSideReference): string;
@ -2629,7 +2618,7 @@ end;
function DbgS(p: TControlAutoSizePhase): string; overload;
begin
Result:=AutoSizePhaseNames[p];
WriteStr(Result, p);
end;
function DbgS(Phases: TControlAutoSizePhases): string; overload;
@ -2639,8 +2628,9 @@ begin
Result:='';
for p:=Low(TControlAutoSizePhase) to High(TControlAutoSizePhase) do begin
if p in Phases then begin
if Result<>'' then Result:=Result+',';
Result:=Result+AutoSizePhaseNames[p];
if Result<>'' then
Result:=Result+',';
Result:=Result+DbgS(p);
end;
end;
Result:='['+Result+']';

View File

@ -143,7 +143,7 @@ begin
alBottom: OffsetRect(ARect,0,NewDockSite.ClientHeight-ARect.Bottom);
end;
end;
//DebugLn('TControl.DoDock AFTER Adjusting ',DbgSName(Self),' ',dbgs(ARect),' Align=',AlignNames[Align],' NewDockSite.ClientRect=',dbgs(NewDockSite.ClientRect));
//DebugLn('TControl.DoDock AFTER Adjusting ',DbgSName(Self),' ',dbgs(ARect),' Align=',DbgS(Align),' NewDockSite.ClientRect=',dbgs(NewDockSite.ClientRect));
end;
//debugln('TControl.DoDock BEFORE MOVE ',Name,' BoundsRect=',dbgs(BoundsRect),' NewRect=',dbgs(ARect));
if Parent<>NewDockSite then
@ -3294,7 +3294,7 @@ var
a: TAnchorKind;
begin
if FAlign = Value then exit;
//DebugLn(['TControl.SetAlign ',DbgSName(Self),' Old=',AlignNames[FAlign],' New=',AlignNames[Value],' ',Anchors<>AnchorAlign[FAlign]]);
//DebugLn(['TControl.SetAlign ',DbgSName(Self),' Old=',DbgS(FAlign),' New=',DbgS(Value),' ',Anchors<>AnchorAlign[FAlign]]);
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.setalign'){$ENDIF};
OldAlign := FAlign;
FAlign := Value;
@ -3391,7 +3391,7 @@ begin
DbgOut(Prefix,'TControl.WriteLayoutDebugReport ');
DbgOut(DbgSName(Self),' Bounds=',dbgs(BoundsRect));
if Align<>alNone then
DbgOut(' Align=',AlignNames[Align]);
DbgOut(' Align=',DbgS(Align));
DbgOut(' Anchors=[');
NeedSeparator:=false;
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin

View File

@ -2653,7 +2653,10 @@ var
{$IFDEF CHECK_POSITION}
if CheckPosition(Control) then
with Control do
DebugLn('[TWinControl.AlignControls.DoPosition] A Control=',dbgsName(Control),' ',dbgs(Left),',',dbgs(Top),',',dbgs(Width),',',dbgs(Height),' recalculate the anchors=',dbgs(Control.Anchors <> AnchorAlign[AAlign]),' Align=',AlignNames[AAlign]);
DebugLn('[TWinControl.AlignControls.DoPosition] A Control=',dbgsName(Control),' ',
dbgs(Left),',',dbgs(Top),',',dbgs(Width),',',dbgs(Height),
' recalculate the anchors=',dbgs(Control.Anchors <> AnchorAlign[AAlign]),
' Align=',DbgS(AAlign));
{$ENDIF}
with Control do begin
@ -2818,7 +2821,7 @@ var
with Control do begin
DebugLn(['[TWinControl.AlignControls.DoPosition] After Anchoring',
' Self=',DbgSName(Self),
' Align=',AlignNames[AAlign],
' Align=',DbgS(AAlign),
' Control=',dbgsName(Control),
' Old= l=',Left,',t=',Top,',w=',Width,',h=',Height,
' New= l=',NewLeft,',t=',NewTop,',w=',NewWidth,',h=',NewHeight,
@ -2950,7 +2953,7 @@ var
with Control do
DebugLn('[TWinControl.AlignControls.DoPosition] After Aligning',
' ',Name,':',ClassName,
' Align=',AlignNames[AAlign],
' Align=',DbgS(AAlign),
' Control=',Name,':',ClassName,
' Old=',DbgS(Left,Top,Width,Height),
' New=',DbgS(NewLeft,NewTop,NewWidth,NewHeight),
@ -3058,7 +3061,7 @@ var
DebugLn('[TWinControl.AlignControls.DoPosition] END Control=',
Name,':',ClassName,
' ',DbgS(Left,Top,Width,Height),
' Align=',AlignNames[AAlign],
' Align=',DbgS(AAlign),
//' ARect=',ARect.Left,',',ARect.Top,',',ARect.Right-ARect.Left,',',ARect.Bottom-ARect.Top,
'');
{$ENDIF}
@ -3076,7 +3079,7 @@ var
if AlignList.Count>0 then
begin
DbgOut('[TWinControl.AlignControls.DoAlign] Self=',DbgSName(Self),' Control=',dbgsName(AControl),
' current align=',AlignNames[AAlign],' AlignList=[');
' current align=',DbgS(AAlign),' AlignList=[');
for i:=0 to AlignList.Count-1 do
begin
if i>0 then DbgOut(',');

View File

@ -1467,7 +1467,7 @@ procedure TCustomLazControlDocker.ShrinkNeighbourhood(
Neighbour: TControl;
i: Integer;
begin
DebugLn(['ShrinkNeighboursOnSide START ',DbgSName(CurControl),' ',AnchorNames[Side]]);
DebugLn(['ShrinkNeighboursOnSide START ',DbgSName(CurControl),' ',DbgS(Side)]);
if Side in CurControl.Anchors then begin
Neighbour:=CurControl.AnchorSide[Side].Control;
DebugLn(['ShrinkNeighboursOnSide Neighbour=',DbgSName(Neighbour)]);
@ -1488,7 +1488,7 @@ procedure TCustomLazControlDocker.ShrinkNeighbourhood(
Node: TLazDockConfigNode;
CurBounds: TRect;
begin
DebugLn(['ShrinkControl START ',DbgSName(CurControl),' Side=',AnchorNames[Side]]);
DebugLn(['ShrinkControl START ',DbgSName(CurControl),' Side=',DbgS(Side)]);
if (CurControl=nil) or (CurControl=AControl)
or (CurControl.Parent<>AControl.Parent) then
exit;
@ -1504,7 +1504,7 @@ procedure TCustomLazControlDocker.ShrinkNeighbourhood(
Node:=Layout.FindByName(NodeName,true);
if Node=nil then exit;
CurBounds:=Node.Bounds;
DebugLn(['ShrinkControl ',DbgSName(CurControl),' Side=',AnchorNames[Side],' LayoutBounds=',dbgs(CurBounds)]);
DebugLn(['ShrinkControl ',DbgSName(CurControl),' Side=',DbgS(Side),' LayoutBounds=',dbgs(CurBounds)]);
if Side in [akLeft,akRight] then
CurControl.Width:=Min(CurControl.Width,CurBounds.Right-CurBounds.Left)
else
@ -3075,7 +3075,7 @@ function TCustomLazDockingManager.ConfigIsCompatible(
procedure ErrorWrongSplitter;
begin
Error('invalid Node.Sides[a] Node="'+Node.Name+'"'
+' Node.Sides['+AnchorNames[a]+']="'+Node.Sides[a]+'"');
+' Node.Sides['+DbgS(a)+']="'+Node.Sides[a]+'"');
end;
begin
@ -3517,7 +3517,7 @@ begin
// Sides
for a:=Low(TAnchorKind) to High(TAnchorKind) do
Config.SetDeleteValue(Path+'Sides/'+AnchorNames[a]+'/Name',Sides[a],'');
Config.SetDeleteValue(Path+'Sides/'+DbgS(a)+'/Name',Sides[a],'');
// children
Config.SetDeleteValue(Path+'Children/Count',ChildCount,0);
@ -3549,7 +3549,7 @@ begin
// Sides
for a:=Low(TAnchorKind) to High(TAnchorKind) do
Sides[a]:=Config.GetValue(Path+'Sides/'+AnchorNames[a]+'/Name','');
Sides[a]:=Config.GetValue(Path+'Sides/'+DbgS(a)+'/Name','');
// children
NewChildCount:=Config.GetValue(Path+'Children/Count',0);
@ -3581,7 +3581,7 @@ procedure TLazDockConfigNode.WriteDebugReport;
s:=ANode.Sides[a];
if s='' then
s:='?';
DbgOut(' '+AnchorNames[a]+'="'+s+'"');
DbgOut(' '+DbgS(a)+'="'+s+'"');
end;
debugln;
for i:=0 to ANode.ChildCount-1 do begin
@ -3763,7 +3763,7 @@ var
Info: PNodeInfo;
begin
Info:=GetNodeInfo(Node);
//DebugLn(['GetMinPos ',Node.Name,' ',AnchorNames[Side],' ',Info^.MinLeftCalculating]);
//DebugLn(['GetMinPos ',Node.Name,' ',DbgS(Side),' ',Info^.MinLeftCalculating]);
if Side=akLeft then
Result:=Compute(Info^.MinLeftValid,Info^.MinLeftCalculating,Info^.MinLeft)
else

View File

@ -2655,7 +2655,8 @@ var
begin
Result:=false;
if Control=nil then exit;
DebugLn(['TCustomAnchoredDockManager.EnlargeControl Control=',DbgSName(Control),' Side=',AnchorNames[Side]]);
DebugLn(['TCustomAnchoredDockManager.EnlargeControl Control=',DbgSName(Control),
' Side=',DbgS(Side)]);
if Side in [akLeft,akRight] then
Side2:=akTop
else