LCL: calculatepreferredsize: anchored both sides, check for anchor kind when adding preferred width

git-svn-id: trunk@24931 -
This commit is contained in:
mattias 2010-04-25 19:12:09 +00:00
parent 292ea01d2b
commit 1aa4e0f860
5 changed files with 90 additions and 71 deletions

View File

@ -1,8 +1,9 @@
object CompileInfoDlg: TCompileInfoDlg
Left = 677
Height = 201
Top = 462
Width = 384
Left = 445
Height = 199
Top = 464
Width = 386
ActiveControl = PnlTitle
AutoSize = True
BorderIcons = []
BorderStyle = bsDialog
@ -11,8 +12,8 @@ object CompileInfoDlg: TCompileInfoDlg
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ClientHeight = 201
ClientWidth = 384
ClientHeight = 199
ClientWidth = 386
FormStyle = fsStayOnTop
KeyPreview = True
OnClose = FormClose
@ -61,7 +62,7 @@ object CompileInfoDlg: TCompileInfoDlg
Left = 4
Height = 22
Top = 2
Width = 41
Width = 49
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 4
BorderSpacing.Top = 2
@ -118,7 +119,7 @@ object CompileInfoDlg: TCompileInfoDlg
Left = 4
Height = 22
Top = 2
Width = 60
Width = 68
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 4
BorderSpacing.Top = 2
@ -135,21 +136,21 @@ object CompileInfoDlg: TCompileInfoDlg
AnchorSideRight.Control = PnlTitle
AnchorSideRight.Side = asrBottom
Left = 6
Height = 26
Top = 141
Height = 32
Top = 144
Width = 372
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
BevelOuter = bvNone
ClientHeight = 26
ClientHeight = 32
ClientWidth = 372
TabOrder = 2
object BClose: TBitBtn
AnchorSideBottom.Side = asrBottom
Left = 149
Height = 26
Height = 32
Top = 0
Width = 75
Anchors = [akTop]
@ -187,23 +188,23 @@ object CompileInfoDlg: TCompileInfoDlg
TabOrder = 3
object pnlLines: TPanel
Left = 0
Height = 40
Height = 44
Top = 0
Width = 110
Width = 109
AutoSize = True
BorderSpacing.Right = 4
BevelInner = bvRaised
BevelOuter = bvLowered
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ClientHeight = 40
ClientWidth = 110
ClientHeight = 44
ClientWidth = 109
TabOrder = 0
object LNLines: TLabel
Left = 37
Height = 36
Left = 44
Height = 40
Top = 2
Width = 67
Width = 59
Align = alClient
Alignment = taRightJustify
AutoSize = False
@ -214,9 +215,9 @@ object CompileInfoDlg: TCompileInfoDlg
end
object LInfoLines: TLabel
Left = 6
Height = 36
Height = 40
Top = 2
Width = 31
Width = 38
Align = alLeft
BorderSpacing.Left = 4
Caption = 'Lines:'
@ -225,8 +226,8 @@ object CompileInfoDlg: TCompileInfoDlg
end
end
object Panel3: TPanel
Left = 114
Height = 40
Left = 113
Height = 44
Top = 0
Width = 137
AutoSize = True
@ -238,12 +239,12 @@ object CompileInfoDlg: TCompileInfoDlg
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 40
ClientHeight = 44
ClientWidth = 137
TabOrder = 1
object pnlHints: TPanel
Left = 2
Height = 17
Height = 19
Top = 4
Width = 133
AutoSize = True
@ -251,14 +252,14 @@ object CompileInfoDlg: TCompileInfoDlg
BorderSpacing.Top = 4
BorderSpacing.Right = 2
BevelOuter = bvNone
ClientHeight = 17
ClientHeight = 19
ClientWidth = 133
TabOrder = 0
object LNHint: TLabel
Left = 38
Height = 17
Left = 44
Height = 19
Top = 0
Width = 91
Width = 85
Align = alClient
Alignment = taRightJustify
AutoSize = False
@ -270,9 +271,9 @@ object CompileInfoDlg: TCompileInfoDlg
end
object LInfoHint: TLabel
Left = 4
Height = 17
Height = 19
Top = 0
Width = 32
Width = 38
Align = alLeft
BorderSpacing.Left = 4
Caption = 'Hints:'
@ -281,32 +282,32 @@ object CompileInfoDlg: TCompileInfoDlg
end
object pnlWarnings: TPanel
Left = 2
Height = 17
Top = 21
Height = 19
Top = 23
Width = 133
BorderSpacing.Left = 2
BorderSpacing.Top = 2
BorderSpacing.Right = 2
BorderSpacing.Bottom = 2
BevelOuter = bvNone
ClientHeight = 17
ClientHeight = 19
ClientWidth = 133
TabOrder = 1
object LInfoWarning: TLabel
Left = 4
Height = 17
Height = 19
Top = 0
Width = 54
Width = 62
Align = alLeft
BorderSpacing.Left = 4
Caption = 'Warnings:'
ParentColor = False
end
object LNWarning: TLabel
Left = 60
Height = 17
Left = 68
Height = 19
Top = 0
Width = 69
Width = 61
Align = alClient
Alignment = taRightJustify
AutoSize = False
@ -319,10 +320,10 @@ object CompileInfoDlg: TCompileInfoDlg
end
end
object pnlNotesErrors: TPanel
Left = 255
Height = 40
Left = 254
Height = 44
Top = 0
Width = 117
Width = 118
AutoSize = True
BorderSpacing.Left = 4
BevelInner = bvRaised
@ -331,37 +332,37 @@ object CompileInfoDlg: TCompileInfoDlg
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 2
ClientHeight = 40
ClientWidth = 117
ClientHeight = 44
ClientWidth = 118
TabOrder = 2
object pnlNotes: TPanel
Left = 2
Height = 17
Height = 19
Top = 4
Width = 113
Width = 114
AutoSize = True
BorderSpacing.Left = 2
BorderSpacing.Top = 4
BorderSpacing.Right = 2
BevelOuter = bvNone
ClientHeight = 17
ClientWidth = 113
ClientHeight = 19
ClientWidth = 114
TabOrder = 0
object LInfoNote: TLabel
Left = 4
Height = 17
Height = 19
Top = 0
Width = 35
Width = 43
Align = alLeft
BorderSpacing.Left = 4
Caption = 'Notes:'
ParentColor = False
end
object LNNote: TLabel
Left = 41
Height = 17
Left = 49
Height = 19
Top = 0
Width = 68
Width = 61
Align = alClient
Alignment = taRightJustify
AutoSize = False
@ -374,33 +375,33 @@ object CompileInfoDlg: TCompileInfoDlg
end
object pnlErrors: TPanel
Left = 2
Height = 17
Top = 21
Width = 113
Height = 19
Top = 23
Width = 114
AutoSize = True
BorderSpacing.Left = 2
BorderSpacing.Top = 2
BorderSpacing.Right = 2
BorderSpacing.Bottom = 2
BevelOuter = bvNone
ClientHeight = 17
ClientWidth = 113
ClientHeight = 19
ClientWidth = 114
TabOrder = 1
object LInfoError: TLabel
Left = 4
Height = 17
Height = 19
Top = 0
Width = 34
Width = 43
Align = alLeft
BorderSpacing.Left = 4
Caption = 'Errors:'
ParentColor = False
end
object LNError: TLabel
Left = 40
Height = 17
Left = 49
Height = 19
Top = 0
Width = 69
Width = 61
Align = alClient
Alignment = taRightJustify
AutoSize = False
@ -420,7 +421,7 @@ object CompileInfoDlg: TCompileInfoDlg
AnchorSideRight.Control = PnlTitle
AnchorSideRight.Side = asrBottom
Left = 6
Height = 19
Height = 22
Top = 116
Width = 372
Anchors = [akTop, akLeft, akRight]
@ -433,7 +434,7 @@ object CompileInfoDlg: TCompileInfoDlg
Enabled = False
Interval = 2000
OnTimer = tmrCloseFormTimer
left = 256
top = 48
left = 275
top = 150
end
end

View File

@ -2846,6 +2846,7 @@ var
P: TPoint;
FloatHost: TWinControl;
begin
DebugLn(['TControl.DoFloatMsg ',DbgSName(Self),' Floating=',Floating]);
if Floating and (Parent <> nil) then
begin
P := Parent.ClientToScreen(Point(Left, Top));

View File

@ -490,7 +490,8 @@ begin
Accepted := ADockObjectCopy.Control.HostDockSite.DoUnDock(TWinControl(ADockObjectCopy.DragTarget), ADockObjectCopy.Control)
else
if ADockObjectCopy.DragTarget = nil then
Accepted := True else
Accepted := True
else
if ADockObjectCopy.Control.HostDockSite = nil then
Accepted := True;
end;

View File

@ -619,10 +619,16 @@ type
begin
// opposite side +- preferred size
NewDist:=ChildData.Sides[OppositeSide].Distance[Direction];
if Side in [akLeft,akRight] then
CurSize:=ChildData.PreferredSize[asboHorizontal]
else
CurSize:=ChildData.PreferredSize[asboVertical];
CurSize:=0;
if ((OppositeSide in [akLeft,akTop])
and (ChildData.Sides[OppositeSide].Side=asrRight))
or ((OppositeSide in [akRight,akBottom])
and (ChildData.Sides[OppositeSide].Side=asrLeft)) then begin
if Side in [akLeft,akRight] then
CurSize:=ChildData.PreferredSize[asboHorizontal]
else
CurSize:=ChildData.PreferredSize[asboVertical];
end;
inc(NewDist,CurSize);
// check if opposite side need a bigger distance
if ChildData.Sides[Side].Distance[Direction]<NewDist then
@ -711,6 +717,7 @@ begin
end;
end;
end;
//WriteDebugReport('ComputePositons',' ');
Result:=true;
end;

View File

@ -183,6 +183,7 @@ function StrToDouble(const s: string): double;
// debugging
procedure RaiseGDBException(const Msg: string);
procedure RaiseAndCatchException;
procedure DumpExceptionBackTrace;
procedure DumpStack;
function GetStackTrace(UseCache: boolean): string;
@ -1505,6 +1506,14 @@ begin
if (length(Msg) div (length(Msg) div 10000))=0 then ;
end;
procedure RaiseAndCatchException;
begin
try
raise Exception.Create('');
except
end;
end;
procedure DumpExceptionBackTrace;
var
FrameCount: integer;