mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-01 08:50:31 +02:00
LCL: Change variable names to avoid confusion. Unnest a function.
git-svn-id: trunk@64588 -
This commit is contained in:
parent
54dc02b128
commit
afae437ee4
@ -191,22 +191,22 @@ procedure TScaledImageListResolution.DrawOverlay(ACanvas: TCanvas; AX, AY,
|
||||
AIndex: Integer; AOverlay: TOverlay; ADrawingStyle: TDrawingStyle;
|
||||
AImageType: TImageType; ADrawEffect: TGraphicsDrawEffect);
|
||||
var
|
||||
OverlayIndex: Integer;
|
||||
OverlayI: Integer;
|
||||
begin
|
||||
OverlayIndex := Resolution.FImageList.FOverlays[AOverlay];
|
||||
OverlayI := Resolution.FImageList.FOverlays[AOverlay];
|
||||
|
||||
if SameValue(FScaleFactor, 1) then
|
||||
begin
|
||||
Resolution.Draw(ACanvas, AX, AY, AIndex, ADrawingStyle, AImageType, ADrawEffect);
|
||||
if (OverlayIndex >= 0) and (OverlayIndex < Resolution.Count) then
|
||||
Resolution.Draw(ACanvas, AX, AY, OverlayIndex, ADrawingStyle, AImageType, ADrawEffect);
|
||||
if (OverlayI >= 0) and (OverlayI < Resolution.Count) then
|
||||
Resolution.Draw(ACanvas, AX, AY, OverlayI, ADrawingStyle, AImageType, ADrawEffect);
|
||||
end else
|
||||
begin
|
||||
Resolution.StretchDraw(ACanvas, AIndex,
|
||||
Rect(AX, AY, AX + Width, AY + Height),
|
||||
ADrawEffect<>gdeDisabled);
|
||||
if (OverlayIndex >= 0) and (OverlayIndex < Resolution.Count) then
|
||||
Resolution.StretchDraw(ACanvas, OverlayIndex,
|
||||
if (OverlayI >= 0) and (OverlayI < Resolution.Count) then
|
||||
Resolution.StretchDraw(ACanvas, OverlayI,
|
||||
Rect(AX, AY, AX + Width, AY + Height),
|
||||
ADrawEffect<>gdeDisabled);
|
||||
end;
|
||||
@ -418,7 +418,7 @@ procedure TCustomImageListResolution.DrawOverlay(ACanvas: TCanvas; AX, AY,
|
||||
AIndex: Integer; AOverlay: TOverlay; ADrawingStyle: TDrawingStyle;
|
||||
AImageType: TImageType; ADrawEffect: TGraphicsDrawEffect);
|
||||
var
|
||||
OverlayIndex: Integer;
|
||||
OverlayI: Integer;
|
||||
begin
|
||||
if (AIndex < 0) or (AIndex >= FCount) then Exit;
|
||||
|
||||
@ -426,10 +426,10 @@ begin
|
||||
TWSCustomImageListResolutionClass(WidgetSetClass).Draw(Self, AIndex, ACanvas, Rect(AX, AY, FWidth, FHeight),
|
||||
FImageList.BkColor, FImageList.BlendColor, ADrawEffect, ADrawingStyle, AImageType);
|
||||
|
||||
OverlayIndex := FImageList.FOverlays[AOverlay];
|
||||
if (OverlayIndex < 0) or (OverlayIndex >= FCount) then Exit;
|
||||
OverlayI := FImageList.FOverlays[AOverlay];
|
||||
if (OverlayI < 0) or (OverlayI >= FCount) then Exit;
|
||||
|
||||
TWSCustomImageListResolutionClass(WidgetSetClass).Draw(Self, OverlayIndex, ACanvas, Rect(AX, AY, FWidth, FHeight),
|
||||
TWSCustomImageListResolutionClass(WidgetSetClass).Draw(Self, OverlayI, ACanvas, Rect(AX, AY, FWidth, FHeight),
|
||||
clNone, FImageList.BlendColor, ADrawEffect, ADrawingStyle, AImageType);
|
||||
end;
|
||||
|
||||
|
@ -4958,28 +4958,29 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function InvertNdColor(AColor: TColor): TColor;
|
||||
var
|
||||
Red, Green, Blue: integer;
|
||||
begin
|
||||
if AColor<>clHighlight then begin
|
||||
Result:=clWhite;
|
||||
Red:=(AColor shr 16) and $ff;
|
||||
Green:=(AColor shr 8) and $ff;
|
||||
Blue:=AColor and $ff;
|
||||
if Red+Green+Blue>$180 then
|
||||
Result:=clBlack;
|
||||
//DebugLn(['[TCustomTreeView.DoPaintNode.InvertColor] Result=',Result,' ',Red,',',Green,',',Blue]);
|
||||
end
|
||||
else
|
||||
Result := clHighlightText;
|
||||
end;
|
||||
|
||||
procedure TCustomTreeView.DoPaintNode(Node: TTreeNode);
|
||||
var
|
||||
NodeRect: TRect;
|
||||
VertMid, VertDelta, RealExpandSignSize, RealIndent: integer;
|
||||
NodeSelected, HasExpandSign: boolean;
|
||||
|
||||
function InvertColor(AColor: TColor): TColor;
|
||||
var Red, Green, Blue: integer;
|
||||
begin
|
||||
if AColor<>clHighlight then begin
|
||||
Result:=clWhite;
|
||||
Red:=(AColor shr 16) and $ff;
|
||||
Green:=(AColor shr 8) and $ff;
|
||||
Blue:=AColor and $ff;
|
||||
if Red+Green+Blue>$180 then
|
||||
Result:=clBlack;
|
||||
//DebugLn(['[TCustomTreeView.DoPaintNode.InvertColor] Result=',Result,' ',Red,',',Green,',',Blue]);
|
||||
end
|
||||
else
|
||||
Result := clHighlightText;
|
||||
end;
|
||||
|
||||
procedure DrawVertLine(X, Y1, Y2: Integer);
|
||||
begin
|
||||
if Y1 > Y2 then
|
||||
@ -5293,7 +5294,7 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure DrawNodeText(IsSelected: Boolean; NodeRect: TRect; AText: String);
|
||||
procedure DrawNodeText(IsSelected: Boolean; NdRect: TRect; AText: String);
|
||||
var
|
||||
Details: TThemedElementDetails;
|
||||
NeedUnderline: Boolean;
|
||||
@ -5308,19 +5309,21 @@ var
|
||||
Details := ThemeServices.GetElementDetails(ttItemSelectedNotFocus);
|
||||
if not (tvoRowSelect in Options) then
|
||||
if (tvoThemedDraw in Options) then
|
||||
ThemeServices.DrawElement(Canvas.Handle, Details, NodeRect, nil)
|
||||
ThemeServices.DrawElement(Canvas.Handle, Details, NdRect, nil)
|
||||
else
|
||||
begin
|
||||
Canvas.Brush.Color := FSelectedColor;
|
||||
Canvas.Font.Color := IfThen(FSelectedFontColorUsed, FSelectedFontColor, InvertColor(FSelectedColor));
|
||||
Canvas.FillRect(NodeRect);
|
||||
Canvas.Font.Color := IfThen(FSelectedFontColorUsed,
|
||||
FSelectedFontColor, InvertNdColor(FSelectedColor));
|
||||
Canvas.FillRect(NdRect);
|
||||
end
|
||||
else
|
||||
if not (tvoThemedDraw in Options) then
|
||||
begin
|
||||
Canvas.Brush.Color := FSelectedColor;
|
||||
Canvas.Font.Color := IfThen(FSelectedFontColorUsed, FSelectedFontColor, InvertColor(FSelectedColor));
|
||||
Canvas.FillRect(NodeRect);
|
||||
Canvas.Font.Color := IfThen(FSelectedFontColorUsed,
|
||||
FSelectedFontColor, InvertNdColor(FSelectedColor));
|
||||
Canvas.FillRect(NdRect);
|
||||
end;
|
||||
end
|
||||
else
|
||||
@ -5336,18 +5339,18 @@ var
|
||||
Canvas.Font.Color := FHotTrackColor;
|
||||
end;
|
||||
|
||||
NodeRect.Offset(ScaleX(2, 96), 0);
|
||||
NdRect.Offset(ScaleX(2, 96), 0);
|
||||
if (tvoThemedDraw in Options) then
|
||||
begin
|
||||
if not Enabled then
|
||||
Details.State := 4; // TmSchema.TREIS_DISABLED = 4
|
||||
ThemeServices.DrawText(Canvas, Details, AText, NodeRect, DT_LEFT or DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX, 0);
|
||||
ThemeServices.DrawText(Canvas, Details, AText, NdRect, DT_LEFT or DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX, 0);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if not Enabled and (FDisabledFontColor<>clNone) then
|
||||
Canvas.Font.Color := FDisabledFontColor;
|
||||
DrawText(Canvas.Handle, PChar(AText), -1, NodeRect, DT_LEFT or DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX);
|
||||
DrawText(Canvas.Handle, PChar(AText), -1, NdRect, DT_LEFT or DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX);
|
||||
end;
|
||||
|
||||
if NeedUnderline then
|
||||
|
Loading…
Reference in New Issue
Block a user