lcl: fix TColor -> TColorRef assignments and vice versa

git-svn-id: trunk@29713 -
This commit is contained in:
paul 2011-03-03 08:35:06 +00:00
parent 1131d6231f
commit 3aace13834
6 changed files with 15 additions and 15 deletions

View File

@ -242,7 +242,7 @@ begin
begin begin
if LogBrush.lbStyle <> BS_PATTERN then if LogBrush.lbStyle <> BS_PATTERN then
if (LogBrush.lbStyle = BS_SOLID) and IsSysColor(TColor(LogBrush.lbColor)) then if (LogBrush.lbStyle = BS_SOLID) and IsSysColor(TColor(LogBrush.lbColor)) then
FReference._lclHandle := TLCLHandle(GetSysColorBrush(SysColorToSysColorIndex(LogBrush.lbColor))) FReference._lclHandle := TLCLHandle(GetSysColorBrush(SysColorToSysColorIndex(TColor(LogBrush.lbColor))))
else else
FReference._lclHandle := TLCLHandle(CreateBrushIndirect(LogBrush)) FReference._lclHandle := TLCLHandle(CreateBrushIndirect(LogBrush))
else else

View File

@ -196,7 +196,7 @@ begin
Include(FState, csBrushValid); Include(FState, csBrushValid);
// do not use color for hatched brushes. windows cannot draw hatches when SetBkColor is called // do not use color for hatched brushes. windows cannot draw hatches when SetBkColor is called
if ([Brush.Style] * HatchBrushes) = [] then if ([Brush.Style] * HatchBrushes) = [] then
SetBkColor(FHandle, Brush.GetColor); SetBkColor(FHandle, TColorRef(Brush.GetColor));
if Brush.Style = bsSolid then if Brush.Style = bsSolid then
SetBkMode(FHandle, OPAQUE) SetBkMode(FHandle, OPAQUE)
else else
@ -262,7 +262,7 @@ begin
if (OldHandle <> HFONT(Font.Reference.Handle)) and (FSavedFontHandle = 0) then if (OldHandle <> HFONT(Font.Reference.Handle)) and (FSavedFontHandle = 0) then
FSavedFontHandle := OldHandle; FSavedFontHandle := OldHandle;
Include(FState, csFontValid); Include(FState, csFontValid);
SetTextColor(FHandle, Font.GetColor); SetTextColor(FHandle, TColorRef(Font.GetColor));
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -1200,7 +1200,7 @@ begin
SetBkMode(DC, TRANSPARENT); SetBkMode(DC, TRANSPARENT);
if Style.SystemFont then if Style.SystemFont then
SetTextColor(DC, Font.GetColor); SetTextColor(DC, TColorRef(Font.GetColor));
//debugln('TCanvas.TextRect DRAW Text="',Text,'" ',dbgs(fRect)); //debugln('TCanvas.TextRect DRAW Text="',Text,'" ',dbgs(fRect));
DrawText(DC, pChar(Text), Length(Text), fRect, Options); DrawText(DC, pChar(Text), Length(Text), fRect, Options);

View File

@ -385,7 +385,7 @@ begin
else else
elpWidth := 0; elpWidth := 0;
elpBrushStyle := BS_SOLID; elpBrushStyle := BS_SOLID;
elpColor := FColor; elpColor := TColorRef(FColor);
end; end;
PenResourceCache.Lock; PenResourceCache.Lock;

View File

@ -971,7 +971,7 @@ var
LP: TLogPen; LP: TLogPen;
begin begin
LP := LogPen; LP := LogPen;
Lp.lopnColor := Windows.COLORREF(ColorToRGB(Lp.lopnColor)); Lp.lopnColor := Windows.COLORREF(ColorToRGB(TColor(Lp.lopnColor)));
Assert(False, 'Trace:[TWin32WidgetSet.CreatePenIndirect]'); Assert(False, 'Trace:[TWin32WidgetSet.CreatePenIndirect]');
Result := Windows.CreatePenIndirect(Windows.LOGPEN(LP)); Result := Windows.CreatePenIndirect(Windows.LOGPEN(LP));
end; end;
@ -1351,7 +1351,7 @@ var
LB: Windows.LogBrush; LB: Windows.LogBrush;
begin begin
LB.lbStyle := lplb.lbStyle; LB.lbStyle := lplb.lbStyle;
LB.lbColor := Windows.COLORREF(ColorToRGB(lplb.lbColor)); LB.lbColor := Windows.COLORREF(ColorToRGB(TColor(lplb.lbColor)));
LB.lbHatch := lplb.lbHatch; LB.lbHatch := lplb.lbHatch;
Result := Windows.ExtCreatePen(dwPenStyle, dwWidth, LB, dwStyleCount, lpStyle); Result := Windows.ExtCreatePen(dwPenStyle, dwWidth, LB, dwStyleCount, lpStyle);
end; end;
@ -2996,7 +2996,7 @@ end;
function TWin32WidgetSet.SetBKColor(DC: HDC; Color: TColorRef): TColorRef; function TWin32WidgetSet.SetBKColor(DC: HDC; Color: TColorRef): TColorRef;
begin begin
Assert(False, Format('Trace:> [TWin32WidgetSet.SetBKColor] DC: 0x%x Color: %8x', [Integer(DC), Color])); Assert(False, Format('Trace:> [TWin32WidgetSet.SetBKColor] DC: 0x%x Color: %8x', [Integer(DC), Color]));
Result := TColorRef(Windows.SetBkColor(DC, Windows.COLORREF(ColorToRGB(Color)))); Result := TColorRef(Windows.SetBkColor(DC, Windows.COLORREF(ColorToRGB(TColor(Color)))));
Assert(False, Format('Trace:< [TWin32WidgetSet.SetBKColor] DC: 0x%x Color: %8x --> %8x', [Integer(DC), Color, Result])); Assert(False, Format('Trace:< [TWin32WidgetSet.SetBKColor] DC: 0x%x Color: %8x --> %8x', [Integer(DC), Color, Result]));
end; end;
@ -3243,7 +3243,7 @@ end;
function TWin32WidgetSet.SetTextColor(DC: HDC; Color: TColorRef): TColorRef; function TWin32WidgetSet.SetTextColor(DC: HDC; Color: TColorRef): TColorRef;
begin begin
Assert(False, Format('Trace:> [TWin32WidgetSet.SetTextColor] DC: 0x%x Color: %8x', [Integer(DC), Color])); Assert(False, Format('Trace:> [TWin32WidgetSet.SetTextColor] DC: 0x%x Color: %8x', [Integer(DC), Color]));
Result := TColorRef(Windows.SetTextColor(DC, Windows.COLORREF(ColorToRGB(Color)))); Result := TColorRef(Windows.SetTextColor(DC, Windows.COLORREF(ColorToRGB(TColor(Color)))));
Assert(False, Format('Trace:< [TWin32WidgetSet.SetTextColor] DC: 0x%x Color: %8x --> %8x', [Integer(DC), Color, Result])); Assert(False, Format('Trace:< [TWin32WidgetSet.SetTextColor] DC: 0x%x Color: %8x --> %8x', [Integer(DC), Color, Result]));
end; end;

View File

@ -218,10 +218,10 @@ class procedure TWin32WSCustomCheckListBox.DefaultWndHandler(
OldColor := Windows.SetTextColor(Data^._HDC, Windows.GetSysColor(COLOR_HIGHLIGHTTEXT)) OldColor := Windows.SetTextColor(Data^._HDC, Windows.GetSysColor(COLOR_HIGHLIGHTTEXT))
else else
begin begin
OldColor := CheckListBox.Font.Color; OldColor := TColorRef(CheckListBox.Font.Color);
if OldColor = clDefault then if OldColor = clDefault then
OldColor := CheckListBox.GetDefaultColor(dctFont); OldColor := TColorRef(CheckListBox.GetDefaultColor(dctFont));
OldColor := Windows.SetTextColor(Data^._HDC, ColorToRGB(OldColor)); OldColor := Windows.SetTextColor(Data^._HDC, TColorRef(ColorToRGB(TColor(OldColor))));
end; end;
{$ifdef WindowsUnicodeSupport} {$ifdef WindowsUnicodeSupport}
if UnicodeEnabledOS then if UnicodeEnabledOS then

View File

@ -2022,10 +2022,10 @@ procedure TThemeServices.DrawElement(DC: HDC; Details: TThemedElementDetails; co
procedure FillWithDottedBrush(ARect: TRect; Color1, Color2: TColor); procedure FillWithDottedBrush(ARect: TRect; Color1, Color2: TColor);
var var
OldColor1, OldColor2: TColor; OldColor1, OldColor2: TColorRef;
begin begin
OldColor1 := SetBkColor(DC, ColorToRGB(Color1)); OldColor1 := SetBkColor(DC, TColorRef(ColorToRGB(Color1)));
OldColor2 := SetTextColor(DC, ColorToRGB(Color2)); OldColor2 := SetTextColor(DC, TColorRef(ColorToRGB(Color2)));
FillRect(DC, ARect, DottedBrush); FillRect(DC, ARect, DottedBrush);
SetBkColor(DC, OldColor1); SetBkColor(DC, OldColor1);
SetTextColor(DC, OldColor2); SetTextColor(DC, OldColor2);