IDE: mode matrix: center text

git-svn-id: trunk@41306 -
This commit is contained in:
mattias 2013-05-20 01:59:45 +00:00
parent ee5e22c587
commit 70c7c7616d
2 changed files with 15 additions and 6 deletions

View File

@ -34,10 +34,13 @@ unit Compiler_ModeMatrix;
interface interface
uses uses
Classes, SysUtils, types, LazFileUtils, LazLogger, KeywordFuncLists, Classes, SysUtils, types, LazFileUtils, LazLogger,
IDEOptionsIntf, IDEImagesIntf, CompOptsIntf, LResources, Forms, Controls, LResources, Forms, Controls, Graphics, ComCtrls, Menus,
Graphics, ComCtrls, Menus, ModeMatrixCtrl, EnvironmentOpts, ModeMatrixOpts, KeywordFuncLists,
Project, LazarusIDEStrConsts, TransferMacros, PackageSystem, PackageDefs; IDEOptionsIntf, IDEImagesIntf, CompOptsIntf,
EnvironmentOpts,
PackageSystem, PackageDefs, Project, LazarusIDEStrConsts, TransferMacros,
ModeMatrixOpts, ModeMatrixCtrl;
type type

View File

@ -238,7 +238,7 @@ type
const aState: TCheckboxState); override; const aState: TCheckboxState); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer
); override; ); override;
procedure PrepareGridCanvas; procedure PrepareGridCanvas; // prepare canvas for drawing the lines of the grid
procedure SetEditText(ACol, ARow: Longint; const Value: string); override; procedure SetEditText(ACol, ARow: Longint; const Value: string); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@ -1091,6 +1091,8 @@ var
i: Integer; i: Integer;
GroupRow: TGroupedMatrixGroup; GroupRow: TGroupedMatrixGroup;
x: Integer; x: Integer;
s: String;
h: Integer;
begin begin
aRect:=Rect(0,0,0,0); aRect:=Rect(0,0,0,0);
// Upper and Lower bounds for this row // Upper and Lower bounds for this row
@ -1114,8 +1116,11 @@ begin
// background // background
//Canvas.Brush.Color:=GroupRow.GetEffectiveColor; //Canvas.Brush.Color:=GroupRow.GetEffectiveColor;
Canvas.GradientFill(Rect(x,aRect.Top-1,x+2*Indent,aRect.Bottom),GroupRow.GetEffectiveColor,Color,gdHorizontal); 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 // 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 // draw focus rect
if aRow=Row then if aRow=Row then
DrawFocusRect(0,aRow,Rect(x,aRect.Top,aRect.Right,aRect.Bottom)); DrawFocusRect(0,aRow,Rect(x,aRect.Top,aRect.Right,aRect.Bottom));
@ -1484,6 +1489,7 @@ begin
Column:=Columns[aCol-1]; Column:=Columns[aCol-1];
MatRow:=Matrix.Rows[aRow-1]; MatRow:=Matrix.Rows[aRow-1];
if MatRow is TGroupedMatrixValue then begin if MatRow is TGroupedMatrixValue then begin
Canvas.FillRect(aRect);
ValueRow:=TGroupedMatrixValue(MatRow); ValueRow:=TGroupedMatrixValue(MatRow);
if aCol<=ModeColLast then begin if aCol<=ModeColLast then begin
ModeColor:=Modes[aCol-ModeColFirst].Color; ModeColor:=Modes[aCol-ModeColFirst].Color;