From 6a35e3295305d7ac6a37c4ccccc82158d3bd061b Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 1 Aug 2019 11:56:35 +0000 Subject: [PATCH] jvcllaz: Fix painting of FullColor property editor. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7095 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../design/JvMM/jvfullcolorspaceseditors.pas | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/components/jvcllaz/design/JvMM/jvfullcolorspaceseditors.pas b/components/jvcllaz/design/JvMM/jvfullcolorspaceseditors.pas index d9282c935..fc68c04d7 100644 --- a/components/jvcllaz/design/JvMM/jvfullcolorspaceseditors.pas +++ b/components/jvcllaz/design/JvMM/jvfullcolorspaceseditors.pas @@ -37,7 +37,7 @@ uses type TJvDEFFamily = (pfConstant, pfSystem); - TJvFullColorProperty = class(TPropertyEditor) //, ICustomPropertyDrawing) + TJvFullColorProperty = class(TPropertyEditor) private function GetIsColorProperty: Boolean; procedure DialogApply(Sender: TObject; AFullColor: TJvFullColor); @@ -50,8 +50,6 @@ type procedure Edit; override; procedure EditSpace(AColorID: TJvFullColorSpaceID); procedure SetColor(AFullColor: TJvFullColor); - // ICustomPropertyDrawing - procedure PropDrawName(ACanvas: TCanvas; const ARect: TRect; {%H-}AState: TPropEditDrawState); override; procedure PropDrawValue(ACanvas: TCanvas; const ARect: TRect; {%H-}AState: TPropEditDrawState); override; property IsColorProperty: Boolean read GetIsColorProperty; end; @@ -147,6 +145,7 @@ type procedure FormApply(Sender: TObject); end; + procedure RegisterFullColorSpaceEditor(AColorSpaceID: TJvFullColorSpaceID; AEditorClass: TJvFullColorSpacePropertyClass); @@ -303,18 +302,12 @@ begin Proc(ColorSpaceByIndex[I].ShortName); end; -procedure TJvFullColorProperty.PropDrawName(ACanvas: TCanvas; - const ARect: TRect; AState: TPropEditDrawState); -begin - ACanvas.TextOut(ARect.Left, ARect.Top, GetName); -// DefaultPropertyDrawName(Self, ACanvas, ARect); -end; - procedure TJvFullColorProperty.PropDrawValue(ACanvas: TCanvas; const ARect: TRect; AState: TPropEditDrawState); var OldPenColor, OldBrushColor: TColor; Right: Integer; + h: Integer; begin with ACanvas do begin @@ -330,13 +323,13 @@ begin Right := (ARect.Bottom - ARect.Top) + ARect.Left; - Rectangle(ARect.Left + 1, ARect.Top + 1, Right - 1, ARect.Bottom - 1); + Rectangle(ARect.Left + 2, ARect.Top + 2, Right - 2, ARect.Bottom - 2); Pen.Color := OldPenColor; Brush.Color := OldBrushColor; end; - ACanvas.TextOut(ARect.Left, ARect.Top, GetVisualValue); -// DefaultPropertyDrawValue(Self, ACanvas, Rect(Right, ARect.Top, ARect.Right, ARect.Bottom)); + h := ACanvas.TextHeight('Tg'); + ACanvas.TextOut(Right + 2, (ARect.Top + ARect.Bottom - h) div 2, GetVisualValue); end; procedure TJvFullColorProperty.SetColor(AFullColor: TJvFullColor); @@ -368,6 +361,7 @@ begin end; end; + //=== { TJvFullColorSpaceProperty } ========================================== constructor TJvFullColorSpaceProperty.Create(AParent: TJvFullColorProperty; @@ -408,6 +402,7 @@ begin Result := ColorSpace.Name; end; + //=== { TJvFullColorAxisProperty } =========================================== constructor TJvFullColorAxisProperty.Create(AParent: TJvFullColorSpaceProperty;