lcl: reset Brush.Color and Style on setting Bitmap and vice versa, perform only 1 Change event after Assign(), based on patch of David Jenkins, issue #0021762

git-svn-id: trunk@36807 -
This commit is contained in:
paul 2012-04-16 06:03:24 +00:00
parent a34725fc50
commit 2286675357

View File

@ -57,6 +57,8 @@ begin
if Style <> Value then if Style <> Value then
begin begin
FreeReference; FreeReference;
// reset bitmap
FBitmap := nil;
inherited SetStyle(Value); inherited SetStyle(Value);
Changed; Changed;
end; end;
@ -75,6 +77,10 @@ begin
begin begin
FreeReference; FreeReference;
FBitmap := Value; FBitmap := Value;
// reset style and color
inherited SetStyle(bsSolid);
FColor := clWhite;
inherited SetFPColor(TColorToFPColor(FColor));
Changed; Changed;
end; end;
end; end;
@ -121,9 +127,11 @@ procedure TBrush.Assign(Source: TPersistent);
begin begin
if Source is TBrush then if Source is TBrush then
begin begin
Bitmap := TBrush(Source).Bitmap; FColor := TBrush(Source).Color;
SetColor(TBrush(Source).Color, TFPCanvasHelper(Source).FPColor); inherited SetFPColor(TFPCanvasHelper(Source).FPColor);
Style := TBrush(Source).Style; inherited SetStyle(TBrush(Source).Style);
FBitmap := TBrush(Source).Bitmap;
Changed;
end end
else else
inherited Assign(Source); inherited Assign(Source);
@ -290,6 +298,8 @@ procedure TBrush.SetColor(const NewColor: TColor; const NewFPColor: TFPColor);
begin begin
if (NewColor = Color) and (NewFPColor = FPColor) then Exit; if (NewColor = Color) and (NewFPColor = FPColor) then Exit;
FreeReference; FreeReference;
// reset bitmap
FBitmap := nil;
FColor := NewColor; FColor := NewColor;
inherited SetFPColor(NewFPColor); inherited SetFPColor(NewFPColor);
Changed; Changed;