fixed calculating EffectiveMaxWidth and EffectiveMaxHeight

git-svn-id: trunk@6641 -
This commit is contained in:
vincents 2005-01-19 22:34:30 +00:00
parent dd8c50dc28
commit c2ffe68e8d

View File

@ -87,22 +87,32 @@ begin
Result:=MinInterfaceHeight; Result:=MinInterfaceHeight;
end; end;
// EffectiveMaxWidth is the minumum of MaxWidth and MaxInterfaceWidth,
// but is at least MinInterfaceWidth.
// A value of zero is interpreted as unconstraint.
function TSizeConstraints.EffectiveMaxWidth: integer; function TSizeConstraints.EffectiveMaxWidth: integer;
begin begin
if (MaxWidth<MaxInterfaceWidth) then begin if (MaxInterfaceWidth>0) and
((MaxWidth=0) or (MaxInterfaceWidth<MaxWidth)) then
Result := MaxInterfaceWidth
else
Result:=MaxWidth; Result:=MaxWidth;
if (Result<MinInterfaceWidth) then Result:=MinInterfaceWidth; if (Result>0) and (MinInterfaceWidth>0) and (Result<MinInterfaceWidth) then
end else Result:=MinInterfaceWidth;
Result:=MaxInterfaceWidth;
end; end;
// EffectiveMaxHeight is the minumum of MaxHeight and MaxInterfaceHeight,
// but is at least MinInterfaceHeight.
// A value of zero is interpreted as unconstraint.
function TSizeConstraints.EffectiveMaxHeight: integer; function TSizeConstraints.EffectiveMaxHeight: integer;
begin begin
if (MaxHeight<MaxInterfaceHeight) then begin if (MaxInterfaceHeight>0) and
((MaxHeight=0) or (MaxInterfaceHeight<MaxHeight)) then
Result := MaxInterfaceHeight
else
Result:=MaxHeight; Result:=MaxHeight;
if Result<MinInterfaceHeight then Result:=MinInterfaceHeight; if (Result>0) and (MinInterfaceHeight>0) and (Result<MinInterfaceHeight) then
end else Result:=MinInterfaceHeight;
Result:=MaxInterfaceHeight;
end; end;
function TSizeConstraints.MinMaxWidth(Width: integer): integer; function TSizeConstraints.MinMaxWidth(Width: integer): integer;