From cbe9b39337764a3da17e7c6b7da8fce18fdcf55b Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sat, 9 Oct 2021 09:12:29 +0200 Subject: [PATCH] custom tools, enhance entry appearence when a custom color is associated --- src/u_toolseditor.pas | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/u_toolseditor.pas b/src/u_toolseditor.pas index c5eb9636..0703c3d8 100644 --- a/src/u_toolseditor.pas +++ b/src/u_toolseditor.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, RTTIGrids, Forms, Controls, Graphics, Dialogs, - ExtCtrls, Menus, Buttons, StdCtrls, Types, LCLType, + ExtCtrls, Menus, Buttons, StdCtrls, Types, LCLType, GraphUtil, u_widget, u_tools, u_sharedres, u_dsgncontrols, u_common, u_processes; type @@ -220,23 +220,45 @@ procedure TToolsEditorWidget.lstToolsDrawItem(Control: TWinControl; Index: Integer; ARect: TRect; State: TOwnerDrawState); var c0: TColor; + c1: TColor; + c2: TColor; + rc: TRect; + xo: integer = 0; begin c0 := CustomTools.tool[Index].backgroundColor; + rc := ARect; if odSelected in State then begin if c0 = clDefault then + begin c0 := clHighlight; - lstTools.Canvas.Brush.Color := c0; - lstTools.Canvas.FillRect(ARect); - lstTools.Canvas.Pen.Color := clHighlightText; - lstTools.Canvas.Rectangle(Arect); + c1 := c0; + c2 := c0; + end + else + begin + c1 := GetShadowColor(c0,-70); + c2 := GetShadowColor(c0,-30); + xo := 6; + end; + lstTools.Canvas.Brush.Color := c1; + lstTools.Canvas.FillRect(rc); + lstTools.Canvas.Brush.Color := c2; + lstTools.Canvas.Pen.Color := c0; + lstTools.Canvas.Pen.Width := 1; + lstTools.Canvas.Font.Style := [fsBold]; + rc.Left:= rc.Left + ScaleX(xo, 96); + lstTools.Canvas.FillRect(rc); end else begin + lstTools.Canvas.Font.Style := []; lstTools.Canvas.Brush.Color := c0; - lstTools.Canvas.FillRect(ARect); + lstTools.Canvas.FillRect(rc); end; - lstTools.Canvas.TextOut(Arect.Left+1, ARect.Top+1, CustomTools.tool[Index].toolAlias); + + rc.Left:= rc.Left + ScaleX(4, 96); + lstTools.Canvas.TextOut(rc.Left, rc.Top , CustomTools.tool[Index].toolAlias); end; end.