From 70c7c7616d42ca479dac1ea951cf40bdc9b6bd17 Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 20 May 2013 01:59:45 +0000 Subject: [PATCH] IDE: mode matrix: center text git-svn-id: trunk@41306 - --- ide/frames/compiler_modematrix.pas | 11 +++++++---- ide/frames/modematrixctrl.pas | 10 ++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ide/frames/compiler_modematrix.pas b/ide/frames/compiler_modematrix.pas index 852a22e78d..185f244fb0 100644 --- a/ide/frames/compiler_modematrix.pas +++ b/ide/frames/compiler_modematrix.pas @@ -34,10 +34,13 @@ unit Compiler_ModeMatrix; interface uses - Classes, SysUtils, types, LazFileUtils, LazLogger, KeywordFuncLists, - IDEOptionsIntf, IDEImagesIntf, CompOptsIntf, LResources, Forms, Controls, - Graphics, ComCtrls, Menus, ModeMatrixCtrl, EnvironmentOpts, ModeMatrixOpts, - Project, LazarusIDEStrConsts, TransferMacros, PackageSystem, PackageDefs; + Classes, SysUtils, types, LazFileUtils, LazLogger, + LResources, Forms, Controls, Graphics, ComCtrls, Menus, + KeywordFuncLists, + IDEOptionsIntf, IDEImagesIntf, CompOptsIntf, + EnvironmentOpts, + PackageSystem, PackageDefs, Project, LazarusIDEStrConsts, TransferMacros, + ModeMatrixOpts, ModeMatrixCtrl; type diff --git a/ide/frames/modematrixctrl.pas b/ide/frames/modematrixctrl.pas index a501e879ce..9810e3188c 100644 --- a/ide/frames/modematrixctrl.pas +++ b/ide/frames/modematrixctrl.pas @@ -238,7 +238,7 @@ type const aState: TCheckboxState); override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer ); override; - procedure PrepareGridCanvas; + procedure PrepareGridCanvas; // prepare canvas for drawing the lines of the grid procedure SetEditText(ACol, ARow: Longint; const Value: string); override; public constructor Create(AOwner: TComponent); override; @@ -1091,6 +1091,8 @@ var i: Integer; GroupRow: TGroupedMatrixGroup; x: Integer; + s: String; + h: Integer; begin aRect:=Rect(0,0,0,0); // Upper and Lower bounds for this row @@ -1114,8 +1116,11 @@ begin // background //Canvas.Brush.Color:=GroupRow.GetEffectiveColor; Canvas.GradientFill(Rect(x,aRect.Top-1,x+2*Indent,aRect.Bottom),GroupRow.GetEffectiveColor,Color,gdHorizontal); + Canvas.FillRect(x+2*Indent,aRect.Top-1,aRect.Right,aRect.Bottom); // draw group caption - Canvas.TextRect(aRect,constCellPadding+x,aRect.Top,GroupRow.Caption+GroupRow.Value); + s:=GroupRow.Caption+GroupRow.Value; + h:=Canvas.TextHeight(s); + Canvas.TextRect(aRect,constCellPadding+x,(aRect.Top+aRect.Bottom-h) div 2,s); // draw focus rect if aRow=Row then DrawFocusRect(0,aRow,Rect(x,aRect.Top,aRect.Right,aRect.Bottom)); @@ -1484,6 +1489,7 @@ begin Column:=Columns[aCol-1]; MatRow:=Matrix.Rows[aRow-1]; if MatRow is TGroupedMatrixValue then begin + Canvas.FillRect(aRect); ValueRow:=TGroupedMatrixValue(MatRow); if aCol<=ModeColLast then begin ModeColor:=Modes[aCol-ModeColFirst].Color;