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

View File

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

View File

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

View File

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

View File

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