mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 06:21:12 +02:00
Carbon: fixed various rangecheck errors.patch by Ludo Brands. issue #19177
git-svn-id: trunk@31541 -
This commit is contained in:
parent
63e915c3b0
commit
1a2fe11014
@ -581,8 +581,9 @@ function TCarbonClipboard.GetOwnerShip(ClipboardType: TClipboardType;
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
AddData(FFormats[Formats[I]], CFDataCreate(nil, @DataStream.DataString[1],
|
if DataStream.Size>0 then
|
||||||
DataStream.Size));
|
AddData(FFormats[Formats[I]], CFDataCreate(nil, @DataStream.DataString[1],
|
||||||
|
DataStream.Size));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DataStream.Free;
|
DataStream.Free;
|
||||||
|
@ -889,7 +889,8 @@ var
|
|||||||
begin
|
begin
|
||||||
// keep copy of text
|
// keep copy of text
|
||||||
FTextBuffer := UTF8ToUTF16(Text);
|
FTextBuffer := UTF8ToUTF16(Text);
|
||||||
|
if Text='' then
|
||||||
|
FTextBuffer:=#0#0;
|
||||||
TextStyle := Font.Style;
|
TextStyle := Font.Style;
|
||||||
|
|
||||||
// create text layout
|
// create text layout
|
||||||
@ -1555,10 +1556,10 @@ begin
|
|||||||
FBitmap := nil;
|
FBitmap := nil;
|
||||||
case ALogBrush.lbStyle of
|
case ALogBrush.lbStyle of
|
||||||
BS_SOLID:
|
BS_SOLID:
|
||||||
inherited Create(ColorToRGB(ALogBrush.lbColor), True, False);
|
inherited Create(ColorToRGB(TColor(ALogBrush.lbColor)), True, False);
|
||||||
BS_HATCHED: // Hatched brush.
|
BS_HATCHED: // Hatched brush.
|
||||||
begin
|
begin
|
||||||
inherited Create(ColorToRGB(ALogBrush.lbColor), True, False);
|
inherited Create(ColorToRGB(TColor(ALogBrush.lbColor)), True, False);
|
||||||
SetHatchStyle(ALogBrush.lbHatch);
|
SetHatchStyle(ALogBrush.lbHatch);
|
||||||
end;
|
end;
|
||||||
BS_DIBPATTERN,
|
BS_DIBPATTERN,
|
||||||
@ -1567,11 +1568,11 @@ begin
|
|||||||
BS_PATTERN,
|
BS_PATTERN,
|
||||||
BS_PATTERN8X8:
|
BS_PATTERN8X8:
|
||||||
begin
|
begin
|
||||||
inherited Create(ColorToRGB(ALogBrush.lbColor), False, False);
|
inherited Create(ColorToRGB(TColor(ALogBrush.lbColor)), False, False);
|
||||||
SetBitmap(TCarbonBitmap(ALogBrush.lbHatch));
|
SetBitmap(TCarbonBitmap(ALogBrush.lbHatch));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
inherited Create(ColorToRGB(ALogBrush.lbColor), False, False);
|
inherited Create(ColorToRGB(TColor(ALogBrush.lbColor)), False, False);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1660,12 +1661,12 @@ begin
|
|||||||
PS_SOLID..PS_DASHDOTDOT,
|
PS_SOLID..PS_DASHDOTDOT,
|
||||||
PS_INSIDEFRAME:
|
PS_INSIDEFRAME:
|
||||||
begin
|
begin
|
||||||
inherited Create(ColorToRGB(ALogPen.lopnColor), True, False);
|
inherited Create(ColorToRGB(TColor(ALogPen.lopnColor)), True, False);
|
||||||
FWidth := Max(1, ALogPen.lopnWidth.x);
|
FWidth := Max(1, ALogPen.lopnWidth.x);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
inherited Create(ColorToRGB(ALogPen.lopnColor), False, False);
|
inherited Create(ColorToRGB(TColor(ALogPen.lopnColor)), False, False);
|
||||||
FWidth := 1;
|
FWidth := 1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1681,11 +1682,11 @@ begin
|
|||||||
PS_SOLID..PS_DASHDOTDOT,
|
PS_SOLID..PS_DASHDOTDOT,
|
||||||
PS_USERSTYLE:
|
PS_USERSTYLE:
|
||||||
begin
|
begin
|
||||||
inherited Create(ColorToRGB(lplb.lbColor), True, False);
|
inherited Create(ColorToRGB(TColor(lplb.lbColor)), True, False);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
inherited Create(ColorToRGB(lplb.lbColor), False, False);
|
inherited Create(ColorToRGB(TColor(lplb.lbColor)), False, False);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -225,7 +225,8 @@ begin
|
|||||||
FillChar(Msg, SizeOf(Msg), 0);
|
FillChar(Msg, SizeOf(Msg), 0);
|
||||||
Msg.msg := LM_ACTIVATE;
|
Msg.msg := LM_ACTIVATE;
|
||||||
CarbonMenu.LCLMenuItem.Dispatch(Msg);
|
CarbonMenu.LCLMenuItem.Dispatch(Msg);
|
||||||
CarbonMenu.Parent.Dismissed:=0;
|
if assigned(CarbonMenu.Parent) then // if parent not closed
|
||||||
|
CarbonMenu.Parent.Dismissed:=0;
|
||||||
Result := noErr;
|
Result := noErr;
|
||||||
Exit;
|
Exit;
|
||||||
end else
|
end else
|
||||||
|
@ -924,8 +924,11 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCarbonTabsControl.ScrollTabsLeft;
|
procedure TCarbonTabsControl.ScrollTabsLeft;
|
||||||
begin
|
begin
|
||||||
Dec(FFirstIndex);
|
if FFirstIndex > 0 then
|
||||||
UpdateTabs;
|
begin
|
||||||
|
Dec(FFirstIndex);
|
||||||
|
UpdateTabs;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -933,8 +936,11 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCarbonTabsControl.ScrollTabsRight;
|
procedure TCarbonTabsControl.ScrollTabsRight;
|
||||||
begin
|
begin
|
||||||
Inc(FLastIndex);
|
if FFirstIndex < FTabs.Count - 1 then
|
||||||
UpdateTabs(True);
|
begin
|
||||||
|
Inc(FLastIndex);
|
||||||
|
UpdateTabs(True);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCarbonTabsControl.StartScrollingTabsLeft;
|
procedure TCarbonTabsControl.StartScrollingTabsLeft;
|
||||||
|
@ -3102,8 +3102,8 @@ begin
|
|||||||
|
|
||||||
if not CheckDC(DC, 'SetBkColor') then Exit;
|
if not CheckDC(DC, 'SetBkColor') then Exit;
|
||||||
|
|
||||||
Result := TCarbonDeviceContext(DC).BkColor;
|
Result := TColorRef(TCarbonDeviceContext(DC).BkColor);
|
||||||
TCarbonDeviceContext(DC).BkColor := Color;
|
TCarbonDeviceContext(DC).BkColor := TColor(Color);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -3445,8 +3445,8 @@ begin
|
|||||||
|
|
||||||
if not CheckDC(DC, 'SetTextColor') then Exit;
|
if not CheckDC(DC, 'SetTextColor') then Exit;
|
||||||
|
|
||||||
Result := TCarbonDeviceContext(DC).TextColor;
|
Result := TColorRef(TCarbonDeviceContext(DC).TextColor);
|
||||||
TCarbonDeviceContext(DC).TextColor := Color;
|
TCarbonDeviceContext(DC).TextColor := TColor(Color);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCarbonWidgetSet.SetViewPortOrgEx(DC: HDC; NewX, NewY: Integer;
|
function TCarbonWidgetSet.SetViewPortOrgEx(DC: HDC; NewX, NewY: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user