View Issue Details

IDProjectCategoryView StatusLast Update
0035584PatchesLCLpublic2019-05-16 23:05
ReporterAlexey Tor.Assigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityN/A
Status assignedResolutionopen 
Product Version2.1 (SVN)Product Build 
Target VersionFixed in Version 
Summary0035584: Grids: renamed global var/consts
Description9 var/consts were renamed to have more concrete names starting with "Grid" (old names may confuse programmers when they popup in autocompletions, etc).
TagsNo tags attached.
Fixed in Revision
LazTarget
Widgetset
Attached Files
  • gr.diff (13,745 bytes)
    Index: ide/frames/modematrixctrl.pas
    ===================================================================
    --- ide/frames/modematrixctrl.pas	(revision 61228)
    +++ ide/frames/modematrixctrl.pas	(working copy)
    @@ -1188,8 +1188,8 @@
           if (aRow<>Row) or (not EditorMode) then
             s+=GroupRow.Value;
           h:=Canvas.TextHeight(s);
    -      Canvas.TextRect(aRect,constCellPadding+x,(aRect.Top+aRect.Bottom-h) div 2,s);
    -      GroupRow.LastDrawValueX:=constCellPadding+x+Canvas.TextWidth(GroupRow.Caption);
    +      Canvas.TextRect(aRect,GridConstCellPadding+x,(aRect.Top+aRect.Bottom-h) div 2,s);
    +      GroupRow.LastDrawValueX:=GridConstCellPadding+x+Canvas.TextWidth(GroupRow.Caption);
           // draw focus rect
           if aRow=Row then
             DrawFocusRect(0,aRow,Rect(x,aRect.Top,aRect.Right,aRect.Bottom));
    @@ -1310,7 +1310,7 @@
       TitleHeight:=20;
       for i:=0 to Modes.Count-1 do
         TitleHeight:=Max(TitleHeight,Canvas.TextWidth(Modes[i].Caption));
    -  RowHeights[0]:=TitleHeight+2*constCellPadding;
    +  RowHeights[0]:=TitleHeight+2*GridConstCellPadding;
     
       // tree column width
       ColWidths[0]:=Matrix.GetMaxLevel*Indent;
    @@ -1326,7 +1326,7 @@
           W:=Max(W,Canvas.TextWidth(ValueRow.Typ));
         end;
       end;
    -  TypeColumn.Width:=W+2*constCellPadding;
    +  TypeColumn.Width:=W+2*GridConstCellPadding;
     
       // value width
       W:=0;
    Index: lcl/dbgrids.pas
    ===================================================================
    --- lcl/dbgrids.pas	(revision 61228)
    +++ lcl/dbgrids.pas	(working copy)
    @@ -711,7 +711,7 @@
       DebugLnEnter('CalcColumnFieldWidth INIT');
       {$endif}
       if (Field=nil) or (Field.DisplayWidth=0) then
    -    Result := DEFCOLWIDTH
    +    Result := GridDefaultColumnWidth
       else begin
     
         aCharWidth := CalcCanvasCharWidth(Canvas);
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 61228)
    +++ lcl/grids.pas	(working copy)
    @@ -72,9 +72,9 @@
       EO_IMPLEMENTED  =   $20;
     
     const
    -  DEFCOLWIDTH         = 64;
    -  DEFBUTTONWIDTH      = 25;
    -  DEFIMAGEPADDING     = 2;
    +  GridDefaultColumnWidth    = 64;
    +  GridDefaultButtonWidth    = 25;
    +  GridDefaultImagePadding   = 2;
     
     type
       EGridException = class(Exception);
    @@ -185,15 +185,15 @@
            goVertLine, goHorzLine, goRangeSelect, goSmoothScroll ];
       DefaultGridOptions2 = [];
     
    -  constRubberSpace: byte = 2;
    -  constCellPadding: byte = 3;
    -  constColRowBorderTolerance: byte = 3;
    +  GridConstRubberSpace: byte = 2;
    +  GridConstCellPadding: byte = 3;
    +  GirdConstColRowBorderTolerance: byte = 3;
     
     var
       // Values to be used after HighDPI scaling
    -  varRubberSpace: byte;
    -  varCellpadding: byte;
    -  varColRowBorderTolerance: byte;
    +  GridVarRubberSpace: byte;
    +  GridVarCellPadding: byte;
    +  GridVarColRowBorderTolerance: byte;
     
     type
     
    @@ -2082,12 +2082,12 @@
         if Y2<Y1 then
           while Y2<Y1 do begin
             Canvas.Pixels[X1, Y1] := Color;
    -        dec(Y1, varRubberSpace);
    +        dec(Y1, GridVarRubberSpace);
           end
         else
           while Y1<Y2 do begin
             Canvas.Pixels[X1, Y1] := Color;
    -        inc(Y1, varRubberSpace);
    +        inc(Y1, GridVarRubberSpace);
           end;
       end;
       procedure DrawHorzLine(X1,Y1,X2: integer);
    @@ -2095,12 +2095,12 @@
         if X2<X1 then
           while X2<X1 do begin
             Canvas.Pixels[X1, Y1] := Color;
    -        dec(X1, varRubberSpace);
    +        dec(X1, GridVarRubberSpace);
           end
         else
           while X1<X2 do begin
             Canvas.Pixels[X1, Y1] := Color;
    -        inc(X1, varRubberSpace);
    +        inc(X1, GridVarRubberSpace);
           end;
       end;
     begin
    @@ -3982,7 +3982,7 @@
           txt2 := GetTruncCellHintText(cell.x, cell.y);
           gds := GetGridDrawState(cell.x, cell.y);
           PrepareCanvas(cell.x, cell.y, gds);
    -      w := Canvas.TextWidth(txt2) + varCellPadding*2;
    +      w := Canvas.TextWidth(txt2) + GridVarCellPadding*2;
           if w < ColWidths[cell.x] then
             txt2 := '';
         end;
    @@ -4192,11 +4192,11 @@
           h := Scale96ToFont(s.cy);
     
           if IsRightToLeft then begin
    -        r.Left := ARect.Left + DEFIMAGEPADDING;
    -        Inc(ARect.Left, w + DEFIMAGEPADDING);
    +        r.Left := ARect.Left + GridDefaultImagePadding;
    +        Inc(ARect.Left, w + GridDefaultImagePadding);
           end else begin
    -        Dec(ARect.Right, w + DEFIMAGEPADDING);
    -        r.Left := ARect.Right - DEFIMAGEPADDING;
    +        Dec(ARect.Right, w + GridDefaultImagePadding);
    +        r.Left := ARect.Right - GridDefaultImagePadding;
           end;
           r.Right := r.Left + w;
           r.Top := ARect.Top + (ARect.Bottom - ARect.Top - h) div 2;
    @@ -4210,11 +4210,11 @@
           h := ImgRes.Height;
     
           if IsRightToLeft then begin
    -        P.X := ARect.Left + DEFIMAGEPADDING;
    -        Inc(ARect.Left, w + DEFIMAGEPADDING);
    +        P.X := ARect.Left + GridDefaultImagePadding;
    +        Inc(ARect.Left, w + GridDefaultImagePadding);
           end else begin
    -        Dec(ARect.Right, w + DEFIMAGEPADDING);
    -        p.X := ARect.Right - DEFIMAGEPADDING;
    +        Dec(ARect.Right, w + GridDefaultImagePadding);
    +        p.X := ARect.Right - GridDefaultImagePadding;
           end;
           p.Y := ARect.Top + (ARect.Bottom - ARect.Top - h) div 2;
     
    @@ -4230,31 +4230,31 @@
           ImgRes := FTitleImageList.ResolutionForPPI[FTitleImageListWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
           w := ImgRes.Width;
           h := ImgRes.Height;
    -      rw := ARect.Right - ARect.Left - DEFIMAGEPADDING * 2;
    -      rh := ARect.Bottom - ARect.Top - DEFIMAGEPADDING * 2;
    +      rw := ARect.Right - ARect.Left - GridDefaultImagePadding * 2;
    +      rh := ARect.Bottom - ARect.Top - GridDefaultImagePadding * 2;
     
           case ImgLayout of
             blGlyphRight, blGlyphLeft:
    -          p.Y := ARect.Top + (rh - h) div 2 + DEFIMAGEPADDING;
    +          p.Y := ARect.Top + (rh - h) div 2 + GridDefaultImagePadding;
             blGlyphTop, blGlyphBottom:
    -          p.X := ARect.Left + (rw - w) div 2 + DEFIMAGEPADDING;
    +          p.X := ARect.Left + (rw - w) div 2 + GridDefaultImagePadding;
           end;
           case ImgLayout of
             blGlyphRight: begin
    -          Dec(ARect.Right, w + DEFIMAGEPADDING * 2);
    -          p.X := ARect.Right + DEFIMAGEPADDING;
    +          Dec(ARect.Right, w + GridDefaultImagePadding * 2);
    +          p.X := ARect.Right + GridDefaultImagePadding;
             end;
             blGlyphLeft: begin
    -          p.X := ARect.Left + DEFIMAGEPADDING;
    -          Inc(ARect.Left, w + DEFIMAGEPADDING * 2);
    +          p.X := ARect.Left + GridDefaultImagePadding;
    +          Inc(ARect.Left, w + GridDefaultImagePadding * 2);
             end;
             blGlyphTop: begin
    -          p.Y := ARect.Top + DEFIMAGEPADDING;
    -          Inc(ARect.Top, w + DEFIMAGEPADDING * 2);
    +          p.Y := ARect.Top + GridDefaultImagePadding;
    +          Inc(ARect.Top, w + GridDefaultImagePadding * 2);
             end;
             blGlyphBottom: begin
    -          Dec(ARect.Bottom, w + DEFIMAGEPADDING * 2);
    -          p.Y := ARect.Bottom + DEFIMAGEPADDING;
    +          Dec(ARect.Bottom, w + GridDefaultImagePadding * 2);
    +          p.Y := ARect.Bottom + GridDefaultImagePadding;
             end;
           end;
     
    @@ -4562,14 +4562,14 @@
     procedure TCustomGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect;
       aState: TGridDrawState; aText: String);
     begin
    -  dec(ARect.Right, varCellPadding);
    +  dec(ARect.Right, GridVarCellPadding);
       case Canvas.TextStyle.Alignment of
    -    Classes.taLeftJustify: Inc(ARect.Left, varCellPadding);
    +    Classes.taLeftJustify: Inc(ARect.Left, GridVarCellPadding);
         Classes.taRightJustify: Dec(ARect.Right, 1);
       end;
       case Canvas.TextStyle.Layout of
    -    tlTop: Inc(ARect.Top, varCellPadding);
    -    tlBottom: Dec(ARect.Bottom, varCellPadding);
    +    tlTop: Inc(ARect.Top, GridVarCellPadding);
    +    tlBottom: Dec(ARect.Bottom, GridVarCellPadding);
       end;
     
       if ARect.Right<ARect.Left then
    @@ -4630,8 +4630,8 @@
     
       case bmpAlign of
         taCenter: PaintRect.Left := Trunc((aRect.Left + aRect.Right - CSize.cx)/2);
    -    taLeftJustify: PaintRect.Left := ARect.Left + varCellPadding;
    -    taRightJustify: PaintRect.Left := ARect.Right - CSize.Cx - varCellPadding - 1;
    +    taLeftJustify: PaintRect.Left := ARect.Left + GridVarCellPadding;
    +    taRightJustify: PaintRect.Left := ARect.Right - CSize.Cx - GridVarCellPadding - 1;
       end;
       PaintRect.Top  := Trunc((aRect.Top + aRect.Bottom - CSize.cy)/2);
       PaintRect := Bounds(PaintRect.Left, PaintRect.Top, CSize.cx, CSize.cy);
    @@ -5410,7 +5410,7 @@
       if FDefColWidth<0 then
       begin
         if FRealizedDefColWidth <= 0 then
    -      FRealizedDefColWidth := Scale96ToFont(DEFCOLWIDTH);
    +      FRealizedDefColWidth := Scale96ToFont(GridDefaultColumnWidth);
         Result := FRealizedDefColWidth;
       end else
         Result := FDefColWidth;
    @@ -5904,7 +5904,7 @@
         end;
     
         // check if cursor is near boundary and it's a valid column
    -    if (Abs(Offset-x)<=varColRowBorderTolerance) then begin
    +    if (Abs(Offset-x)<=GridVarColRowBorderTolerance) then begin
           if goFixedColSizing in Options then
             Offset := 0
           else
    @@ -5976,7 +5976,7 @@
     
         // check if it's not fixed row and if cursor is close enough to
         // selected boundary
    -    if (Index>=FFixedRows)and(Abs(Offset-Y)<=varColRowBorderTolerance) then begin
    +    if (Index>=FFixedRows)and(Abs(Offset-Y)<=GridVarColRowBorderTolerance) then begin
           // start resizing
           if Cursor<>crVSplit then begin
             ChangeCursor(crVSplit);
    @@ -9701,9 +9701,9 @@
     
       FValidateOnSetSelection := false;
     
    -  varRubberSpace := MulDiv(constRubberSpace, Screen.PixelsPerInch, 96);
    -  varCellPadding := MulDiv(constCellPadding, Screen.PixelsPerInch, 96);
    -  varColRowBorderTolerance := MulDiv(constColRowBorderTolerance, Screen.PixelsPerInch, 96);
    +  GridVarRubberSpace := MulDiv(GridConstRubberSpace, Screen.PixelsPerInch, 96);
    +  GridVarCellPadding := MulDiv(GridConstCellPadding, Screen.PixelsPerInch, 96);
    +  GridVarColRowBorderTolerance := MulDiv(GirdConstColRowBorderTolerance, Screen.PixelsPerInch, 96);
     end;
     
     destructor TCustomGrid.Destroy;
    @@ -11189,12 +11189,12 @@
     
       GetTitleImageInfo(aCol, i, aLayout);
       if (i>=0) and (FTitleImageList<>nil) and (aLayout in [blGlyphLeft, blGlyphRight]) then
    -    imgWidth := FTitleImageList.WidthForPPI[FTitleImageListWidth, Font.PixelsPerInch] + 2*DEFIMAGEPADDING
    +    imgWidth := FTitleImageList.WidthForPPI[FTitleImageListWidth, Font.PixelsPerInch] + 2*GridDefaultImagePadding
       else
         imgWidth := 0;
       GetSortTitleImageInfo(aCol, imgList, i, W, B);
       if (imgList<>nil) and (i>=0) then
    -    Inc(imgWidth, imgList.WidthForPPI[W, Font.PixelsPerInch] + DEFIMAGEPADDING);
    +    Inc(imgWidth, imgList.WidthForPPI[W, Font.PixelsPerInch] + GridDefaultImagePadding);
     
       tmpCanvas := GetWorkingCanvas(Canvas);
     
    @@ -11241,7 +11241,7 @@
       if W=0 then
         W := DefaultColWidth
       else
    -    W := W + 2*varCellpadding + 1;
    +    W := W + 2*GridVarCellPadding + 1;
     
       ColWidths[aCol] := W;
     end;
    @@ -12978,8 +12978,8 @@
     begin
       r := Msg.CellRect;
       FGrid.AdjustInnerCellRect(r);
    -  if r.Right-r.Left>DEFBUTTONWIDTH then
    -    r.Left:=r.Right-DEFBUTTONWIDTH;
    +  if r.Right-r.Left>GridDefaultButtonWidth then
    +    r.Left:=r.Right-GridDefaultButtonWidth;
       SetBounds(r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top);
     end;
     
    @@ -12991,7 +12991,7 @@
     
     procedure TButtonCellEditor.msg_Ready(var Msg: TGridMessage);
     begin
    -  Width := DEFBUTTONWIDTH;
    +  Width := GridDefaultButtonWidth;
     end;
     
     procedure TButtonCellEditor.msg_GetGrid(var Msg: TGridMessage);
    Index: lcl/interfaces/gtk2/gtk2wsgrids.pp
    ===================================================================
    --- lcl/interfaces/gtk2/gtk2wsgrids.pp	(revision 61228)
    +++ lcl/interfaces/gtk2/gtk2wsgrids.pp	(working copy)
    @@ -58,9 +58,9 @@
       Dec(Result.Bottom);
       TextHeight := ACanvas.TextHeight(' ');
       case AColumnLayout of
    -    tlTop: EditorTop:=Result.Top+constCellPadding;
    +    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
         tlCenter: EditorTop:=Result.Top+(Result.Bottom-Result.Top-TextHeight+1) div 2;
    -    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
    +    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
       end;
       if EditorTop>Result.Top then Result.Top:=EditorTop;
       Result.Bottom:=Result.Top+TextHeight;
    Index: lcl/interfaces/qt/qtwsgrids.pp
    ===================================================================
    --- lcl/interfaces/qt/qtwsgrids.pp	(revision 61228)
    +++ lcl/interfaces/qt/qtwsgrids.pp	(working copy)
    @@ -53,9 +53,9 @@
       Dec(Result.Bottom);
       TextHeight := ACanvas.TextHeight(' ');
       case AColumnLayout of
    -    tlTop: EditorTop:=Result.Top+constCellPadding;
    +    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
         tlCenter: EditorTop:=Result.Top+Round((Result.Bottom-Result.Top-TextHeight+1) div 2);
    -    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
    +    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
       end;
       if EditorTop>Result.Top then Result.Top:=EditorTop;
       Result.Bottom:=Result.Top+TextHeight;
    Index: lcl/interfaces/qt5/qtwsgrids.pp
    ===================================================================
    --- lcl/interfaces/qt5/qtwsgrids.pp	(revision 61228)
    +++ lcl/interfaces/qt5/qtwsgrids.pp	(working copy)
    @@ -52,9 +52,9 @@
       Dec(Result.Bottom);
       TextHeight := ACanvas.TextHeight(' ');
       case AColumnLayout of
    -    tlTop: EditorTop:=Result.Top+constCellPadding;
    +    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
         tlCenter: EditorTop:=Result.Top+Round((Result.Bottom-Result.Top-TextHeight+1) div 2);
    -    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
    +    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
       end;
       if EditorTop>Result.Top then Result.Top:=EditorTop;
       Result.Bottom:=Result.Top+TextHeight;
    
    gr.diff (13,745 bytes)
  • gr2.diff (14,648 bytes)
    Index: ide/frames/modematrixctrl.pas
    ===================================================================
    --- ide/frames/modematrixctrl.pas	(revision 61228)
    +++ ide/frames/modematrixctrl.pas	(working copy)
    @@ -1188,8 +1188,8 @@
           if (aRow<>Row) or (not EditorMode) then
             s+=GroupRow.Value;
           h:=Canvas.TextHeight(s);
    -      Canvas.TextRect(aRect,constCellPadding+x,(aRect.Top+aRect.Bottom-h) div 2,s);
    -      GroupRow.LastDrawValueX:=constCellPadding+x+Canvas.TextWidth(GroupRow.Caption);
    +      Canvas.TextRect(aRect,GridConstCellPadding+x,(aRect.Top+aRect.Bottom-h) div 2,s);
    +      GroupRow.LastDrawValueX:=GridConstCellPadding+x+Canvas.TextWidth(GroupRow.Caption);
           // draw focus rect
           if aRow=Row then
             DrawFocusRect(0,aRow,Rect(x,aRect.Top,aRect.Right,aRect.Bottom));
    @@ -1310,7 +1310,7 @@
       TitleHeight:=20;
       for i:=0 to Modes.Count-1 do
         TitleHeight:=Max(TitleHeight,Canvas.TextWidth(Modes[i].Caption));
    -  RowHeights[0]:=TitleHeight+2*constCellPadding;
    +  RowHeights[0]:=TitleHeight+2*GridConstCellPadding;
     
       // tree column width
       ColWidths[0]:=Matrix.GetMaxLevel*Indent;
    @@ -1326,7 +1326,7 @@
           W:=Max(W,Canvas.TextWidth(ValueRow.Typ));
         end;
       end;
    -  TypeColumn.Width:=W+2*constCellPadding;
    +  TypeColumn.Width:=W+2*GridConstCellPadding;
     
       // value width
       W:=0;
    Index: lcl/dbgrids.pas
    ===================================================================
    --- lcl/dbgrids.pas	(revision 61228)
    +++ lcl/dbgrids.pas	(working copy)
    @@ -711,7 +711,7 @@
       DebugLnEnter('CalcColumnFieldWidth INIT');
       {$endif}
       if (Field=nil) or (Field.DisplayWidth=0) then
    -    Result := DEFCOLWIDTH
    +    Result := GridDefaultColumnWidth
       else begin
     
         aCharWidth := CalcCanvasCharWidth(Canvas);
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 61228)
    +++ lcl/grids.pas	(working copy)
    @@ -72,10 +72,14 @@
       EO_IMPLEMENTED  =   $20;
     
     const
    -  DEFCOLWIDTH         = 64;
    -  DEFBUTTONWIDTH      = 25;
    -  DEFIMAGEPADDING     = 2;
    +  GridDefaultColumnWidth    = 64;
    +  GridDefaultButtonWidth    = 25;
    +  GridDefaultImagePadding   = 2;
     
    +  DEFCOLWIDTH = GridDefaultColumnWidth deprecated 'Use GridDefaultColumnWidth';
    +  DEFBUTTONWIDTH = GridDefaultButtonWidth deprecated 'Use GridDefaultButtonWidth';
    +  DEFIMAGEPADDING = GridDefaultImagePadding deprecated 'Use GridDefaultImagePadding';
    +
     type
       EGridException = class(Exception);
     
    @@ -185,16 +189,25 @@
            goVertLine, goHorzLine, goRangeSelect, goSmoothScroll ];
       DefaultGridOptions2 = [];
     
    -  constRubberSpace: byte = 2;
    -  constCellPadding: byte = 3;
    -  constColRowBorderTolerance: byte = 3;
    +  GridConstRubberSpace: byte = 2;
    +  GridConstCellPadding: byte = 3;
    +  GridConstColRowBorderTolerance: byte = 3;
     
     var
       // Values to be used after HighDPI scaling
    -  varRubberSpace: byte;
    -  varCellpadding: byte;
    -  varColRowBorderTolerance: byte;
    +  GridVarRubberSpace: byte;
    +  GridVarCellPadding: byte;
    +  GridVarColRowBorderTolerance: byte;
     
    +var
    +  constRubberSpace: byte absolute GridConstRubberSpace deprecated 'Use GridConstRubberSpace';
    +  constCellPadding: byte absolute GridConstCellPadding deprecated 'Use GridConstCellPadding';
    +  constColRowBorderTolerance: byte absolute GridConstColRowBorderTolerance deprecated 'Use GridConstColRowBorderTolerance';
    +
    +  varRubberSpace: byte absolute GridVarRubberSpace deprecated 'Use GridVarRubberSpace';
    +  varCellpadding: byte absolute GridVarCellPadding deprecated 'Use GridVarCellPadding';
    +  varColRowBorderTolerance: byte absolute GridVarColRowBorderTolerance deprecated 'Use GridVarColRowBorderTolerance';
    +
     type
     
       TCustomGrid = class;
    @@ -2082,12 +2095,12 @@
         if Y2<Y1 then
           while Y2<Y1 do begin
             Canvas.Pixels[X1, Y1] := Color;
    -        dec(Y1, varRubberSpace);
    +        dec(Y1, GridVarRubberSpace);
           end
         else
           while Y1<Y2 do begin
             Canvas.Pixels[X1, Y1] := Color;
    -        inc(Y1, varRubberSpace);
    +        inc(Y1, GridVarRubberSpace);
           end;
       end;
       procedure DrawHorzLine(X1,Y1,X2: integer);
    @@ -2095,12 +2108,12 @@
         if X2<X1 then
           while X2<X1 do begin
             Canvas.Pixels[X1, Y1] := Color;
    -        dec(X1, varRubberSpace);
    +        dec(X1, GridVarRubberSpace);
           end
         else
           while X1<X2 do begin
             Canvas.Pixels[X1, Y1] := Color;
    -        inc(X1, varRubberSpace);
    +        inc(X1, GridVarRubberSpace);
           end;
       end;
     begin
    @@ -3982,7 +3995,7 @@
           txt2 := GetTruncCellHintText(cell.x, cell.y);
           gds := GetGridDrawState(cell.x, cell.y);
           PrepareCanvas(cell.x, cell.y, gds);
    -      w := Canvas.TextWidth(txt2) + varCellPadding*2;
    +      w := Canvas.TextWidth(txt2) + GridVarCellPadding*2;
           if w < ColWidths[cell.x] then
             txt2 := '';
         end;
    @@ -4192,11 +4205,11 @@
           h := Scale96ToFont(s.cy);
     
           if IsRightToLeft then begin
    -        r.Left := ARect.Left + DEFIMAGEPADDING;
    -        Inc(ARect.Left, w + DEFIMAGEPADDING);
    +        r.Left := ARect.Left + GridDefaultImagePadding;
    +        Inc(ARect.Left, w + GridDefaultImagePadding);
           end else begin
    -        Dec(ARect.Right, w + DEFIMAGEPADDING);
    -        r.Left := ARect.Right - DEFIMAGEPADDING;
    +        Dec(ARect.Right, w + GridDefaultImagePadding);
    +        r.Left := ARect.Right - GridDefaultImagePadding;
           end;
           r.Right := r.Left + w;
           r.Top := ARect.Top + (ARect.Bottom - ARect.Top - h) div 2;
    @@ -4210,11 +4223,11 @@
           h := ImgRes.Height;
     
           if IsRightToLeft then begin
    -        P.X := ARect.Left + DEFIMAGEPADDING;
    -        Inc(ARect.Left, w + DEFIMAGEPADDING);
    +        P.X := ARect.Left + GridDefaultImagePadding;
    +        Inc(ARect.Left, w + GridDefaultImagePadding);
           end else begin
    -        Dec(ARect.Right, w + DEFIMAGEPADDING);
    -        p.X := ARect.Right - DEFIMAGEPADDING;
    +        Dec(ARect.Right, w + GridDefaultImagePadding);
    +        p.X := ARect.Right - GridDefaultImagePadding;
           end;
           p.Y := ARect.Top + (ARect.Bottom - ARect.Top - h) div 2;
     
    @@ -4230,31 +4243,31 @@
           ImgRes := FTitleImageList.ResolutionForPPI[FTitleImageListWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
           w := ImgRes.Width;
           h := ImgRes.Height;
    -      rw := ARect.Right - ARect.Left - DEFIMAGEPADDING * 2;
    -      rh := ARect.Bottom - ARect.Top - DEFIMAGEPADDING * 2;
    +      rw := ARect.Right - ARect.Left - GridDefaultImagePadding * 2;
    +      rh := ARect.Bottom - ARect.Top - GridDefaultImagePadding * 2;
     
           case ImgLayout of
             blGlyphRight, blGlyphLeft:
    -          p.Y := ARect.Top + (rh - h) div 2 + DEFIMAGEPADDING;
    +          p.Y := ARect.Top + (rh - h) div 2 + GridDefaultImagePadding;
             blGlyphTop, blGlyphBottom:
    -          p.X := ARect.Left + (rw - w) div 2 + DEFIMAGEPADDING;
    +          p.X := ARect.Left + (rw - w) div 2 + GridDefaultImagePadding;
           end;
           case ImgLayout of
             blGlyphRight: begin
    -          Dec(ARect.Right, w + DEFIMAGEPADDING * 2);
    -          p.X := ARect.Right + DEFIMAGEPADDING;
    +          Dec(ARect.Right, w + GridDefaultImagePadding * 2);
    +          p.X := ARect.Right + GridDefaultImagePadding;
             end;
             blGlyphLeft: begin
    -          p.X := ARect.Left + DEFIMAGEPADDING;
    -          Inc(ARect.Left, w + DEFIMAGEPADDING * 2);
    +          p.X := ARect.Left + GridDefaultImagePadding;
    +          Inc(ARect.Left, w + GridDefaultImagePadding * 2);
             end;
             blGlyphTop: begin
    -          p.Y := ARect.Top + DEFIMAGEPADDING;
    -          Inc(ARect.Top, w + DEFIMAGEPADDING * 2);
    +          p.Y := ARect.Top + GridDefaultImagePadding;
    +          Inc(ARect.Top, w + GridDefaultImagePadding * 2);
             end;
             blGlyphBottom: begin
    -          Dec(ARect.Bottom, w + DEFIMAGEPADDING * 2);
    -          p.Y := ARect.Bottom + DEFIMAGEPADDING;
    +          Dec(ARect.Bottom, w + GridDefaultImagePadding * 2);
    +          p.Y := ARect.Bottom + GridDefaultImagePadding;
             end;
           end;
     
    @@ -4562,14 +4575,14 @@
     procedure TCustomGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect;
       aState: TGridDrawState; aText: String);
     begin
    -  dec(ARect.Right, varCellPadding);
    +  dec(ARect.Right, GridVarCellPadding);
       case Canvas.TextStyle.Alignment of
    -    Classes.taLeftJustify: Inc(ARect.Left, varCellPadding);
    +    Classes.taLeftJustify: Inc(ARect.Left, GridVarCellPadding);
         Classes.taRightJustify: Dec(ARect.Right, 1);
       end;
       case Canvas.TextStyle.Layout of
    -    tlTop: Inc(ARect.Top, varCellPadding);
    -    tlBottom: Dec(ARect.Bottom, varCellPadding);
    +    tlTop: Inc(ARect.Top, GridVarCellPadding);
    +    tlBottom: Dec(ARect.Bottom, GridVarCellPadding);
       end;
     
       if ARect.Right<ARect.Left then
    @@ -4630,8 +4643,8 @@
     
       case bmpAlign of
         taCenter: PaintRect.Left := Trunc((aRect.Left + aRect.Right - CSize.cx)/2);
    -    taLeftJustify: PaintRect.Left := ARect.Left + varCellPadding;
    -    taRightJustify: PaintRect.Left := ARect.Right - CSize.Cx - varCellPadding - 1;
    +    taLeftJustify: PaintRect.Left := ARect.Left + GridVarCellPadding;
    +    taRightJustify: PaintRect.Left := ARect.Right - CSize.Cx - GridVarCellPadding - 1;
       end;
       PaintRect.Top  := Trunc((aRect.Top + aRect.Bottom - CSize.cy)/2);
       PaintRect := Bounds(PaintRect.Left, PaintRect.Top, CSize.cx, CSize.cy);
    @@ -5410,7 +5423,7 @@
       if FDefColWidth<0 then
       begin
         if FRealizedDefColWidth <= 0 then
    -      FRealizedDefColWidth := Scale96ToFont(DEFCOLWIDTH);
    +      FRealizedDefColWidth := Scale96ToFont(GridDefaultColumnWidth);
         Result := FRealizedDefColWidth;
       end else
         Result := FDefColWidth;
    @@ -5904,7 +5917,7 @@
         end;
     
         // check if cursor is near boundary and it's a valid column
    -    if (Abs(Offset-x)<=varColRowBorderTolerance) then begin
    +    if (Abs(Offset-x)<=GridVarColRowBorderTolerance) then begin
           if goFixedColSizing in Options then
             Offset := 0
           else
    @@ -5976,7 +5989,7 @@
     
         // check if it's not fixed row and if cursor is close enough to
         // selected boundary
    -    if (Index>=FFixedRows)and(Abs(Offset-Y)<=varColRowBorderTolerance) then begin
    +    if (Index>=FFixedRows)and(Abs(Offset-Y)<=GridVarColRowBorderTolerance) then begin
           // start resizing
           if Cursor<>crVSplit then begin
             ChangeCursor(crVSplit);
    @@ -9701,9 +9714,9 @@
     
       FValidateOnSetSelection := false;
     
    -  varRubberSpace := MulDiv(constRubberSpace, Screen.PixelsPerInch, 96);
    -  varCellPadding := MulDiv(constCellPadding, Screen.PixelsPerInch, 96);
    -  varColRowBorderTolerance := MulDiv(constColRowBorderTolerance, Screen.PixelsPerInch, 96);
    +  GridVarRubberSpace := MulDiv(GridConstRubberSpace, Screen.PixelsPerInch, 96);
    +  GridVarCellPadding := MulDiv(GridConstCellPadding, Screen.PixelsPerInch, 96);
    +  GridVarColRowBorderTolerance := MulDiv(GridConstColRowBorderTolerance, Screen.PixelsPerInch, 96);
     end;
     
     destructor TCustomGrid.Destroy;
    @@ -11189,12 +11202,12 @@
     
       GetTitleImageInfo(aCol, i, aLayout);
       if (i>=0) and (FTitleImageList<>nil) and (aLayout in [blGlyphLeft, blGlyphRight]) then
    -    imgWidth := FTitleImageList.WidthForPPI[FTitleImageListWidth, Font.PixelsPerInch] + 2*DEFIMAGEPADDING
    +    imgWidth := FTitleImageList.WidthForPPI[FTitleImageListWidth, Font.PixelsPerInch] + 2*GridDefaultImagePadding
       else
         imgWidth := 0;
       GetSortTitleImageInfo(aCol, imgList, i, W, B);
       if (imgList<>nil) and (i>=0) then
    -    Inc(imgWidth, imgList.WidthForPPI[W, Font.PixelsPerInch] + DEFIMAGEPADDING);
    +    Inc(imgWidth, imgList.WidthForPPI[W, Font.PixelsPerInch] + GridDefaultImagePadding);
     
       tmpCanvas := GetWorkingCanvas(Canvas);
     
    @@ -11241,7 +11254,7 @@
       if W=0 then
         W := DefaultColWidth
       else
    -    W := W + 2*varCellpadding + 1;
    +    W := W + 2*GridVarCellPadding + 1;
     
       ColWidths[aCol] := W;
     end;
    @@ -12978,8 +12991,8 @@
     begin
       r := Msg.CellRect;
       FGrid.AdjustInnerCellRect(r);
    -  if r.Right-r.Left>DEFBUTTONWIDTH then
    -    r.Left:=r.Right-DEFBUTTONWIDTH;
    +  if r.Right-r.Left>GridDefaultButtonWidth then
    +    r.Left:=r.Right-GridDefaultButtonWidth;
       SetBounds(r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top);
     end;
     
    @@ -12991,7 +13004,7 @@
     
     procedure TButtonCellEditor.msg_Ready(var Msg: TGridMessage);
     begin
    -  Width := DEFBUTTONWIDTH;
    +  Width := GridDefaultButtonWidth;
     end;
     
     procedure TButtonCellEditor.msg_GetGrid(var Msg: TGridMessage);
    Index: lcl/interfaces/gtk2/gtk2wsgrids.pp
    ===================================================================
    --- lcl/interfaces/gtk2/gtk2wsgrids.pp	(revision 61228)
    +++ lcl/interfaces/gtk2/gtk2wsgrids.pp	(working copy)
    @@ -58,9 +58,9 @@
       Dec(Result.Bottom);
       TextHeight := ACanvas.TextHeight(' ');
       case AColumnLayout of
    -    tlTop: EditorTop:=Result.Top+constCellPadding;
    +    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
         tlCenter: EditorTop:=Result.Top+(Result.Bottom-Result.Top-TextHeight+1) div 2;
    -    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
    +    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
       end;
       if EditorTop>Result.Top then Result.Top:=EditorTop;
       Result.Bottom:=Result.Top+TextHeight;
    Index: lcl/interfaces/qt/qtwsgrids.pp
    ===================================================================
    --- lcl/interfaces/qt/qtwsgrids.pp	(revision 61228)
    +++ lcl/interfaces/qt/qtwsgrids.pp	(working copy)
    @@ -53,9 +53,9 @@
       Dec(Result.Bottom);
       TextHeight := ACanvas.TextHeight(' ');
       case AColumnLayout of
    -    tlTop: EditorTop:=Result.Top+constCellPadding;
    +    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
         tlCenter: EditorTop:=Result.Top+Round((Result.Bottom-Result.Top-TextHeight+1) div 2);
    -    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
    +    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
       end;
       if EditorTop>Result.Top then Result.Top:=EditorTop;
       Result.Bottom:=Result.Top+TextHeight;
    Index: lcl/interfaces/qt5/qtwsgrids.pp
    ===================================================================
    --- lcl/interfaces/qt5/qtwsgrids.pp	(revision 61228)
    +++ lcl/interfaces/qt5/qtwsgrids.pp	(working copy)
    @@ -52,9 +52,9 @@
       Dec(Result.Bottom);
       TextHeight := ACanvas.TextHeight(' ');
       case AColumnLayout of
    -    tlTop: EditorTop:=Result.Top+constCellPadding;
    +    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
         tlCenter: EditorTop:=Result.Top+Round((Result.Bottom-Result.Top-TextHeight+1) div 2);
    -    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
    +    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
       end;
       if EditorTop>Result.Top then Result.Top:=EditorTop;
       Result.Bottom:=Result.Top+TextHeight;
    
    gr2.diff (14,648 bytes)

Activities

Alexey Tor.

2019-05-15 12:12

reporter  

gr.diff (13,745 bytes)
Index: ide/frames/modematrixctrl.pas
===================================================================
--- ide/frames/modematrixctrl.pas	(revision 61228)
+++ ide/frames/modematrixctrl.pas	(working copy)
@@ -1188,8 +1188,8 @@
       if (aRow<>Row) or (not EditorMode) then
         s+=GroupRow.Value;
       h:=Canvas.TextHeight(s);
-      Canvas.TextRect(aRect,constCellPadding+x,(aRect.Top+aRect.Bottom-h) div 2,s);
-      GroupRow.LastDrawValueX:=constCellPadding+x+Canvas.TextWidth(GroupRow.Caption);
+      Canvas.TextRect(aRect,GridConstCellPadding+x,(aRect.Top+aRect.Bottom-h) div 2,s);
+      GroupRow.LastDrawValueX:=GridConstCellPadding+x+Canvas.TextWidth(GroupRow.Caption);
       // draw focus rect
       if aRow=Row then
         DrawFocusRect(0,aRow,Rect(x,aRect.Top,aRect.Right,aRect.Bottom));
@@ -1310,7 +1310,7 @@
   TitleHeight:=20;
   for i:=0 to Modes.Count-1 do
     TitleHeight:=Max(TitleHeight,Canvas.TextWidth(Modes[i].Caption));
-  RowHeights[0]:=TitleHeight+2*constCellPadding;
+  RowHeights[0]:=TitleHeight+2*GridConstCellPadding;
 
   // tree column width
   ColWidths[0]:=Matrix.GetMaxLevel*Indent;
@@ -1326,7 +1326,7 @@
       W:=Max(W,Canvas.TextWidth(ValueRow.Typ));
     end;
   end;
-  TypeColumn.Width:=W+2*constCellPadding;
+  TypeColumn.Width:=W+2*GridConstCellPadding;
 
   // value width
   W:=0;
Index: lcl/dbgrids.pas
===================================================================
--- lcl/dbgrids.pas	(revision 61228)
+++ lcl/dbgrids.pas	(working copy)
@@ -711,7 +711,7 @@
   DebugLnEnter('CalcColumnFieldWidth INIT');
   {$endif}
   if (Field=nil) or (Field.DisplayWidth=0) then
-    Result := DEFCOLWIDTH
+    Result := GridDefaultColumnWidth
   else begin
 
     aCharWidth := CalcCanvasCharWidth(Canvas);
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 61228)
+++ lcl/grids.pas	(working copy)
@@ -72,9 +72,9 @@
   EO_IMPLEMENTED  =   $20;
 
 const
-  DEFCOLWIDTH         = 64;
-  DEFBUTTONWIDTH      = 25;
-  DEFIMAGEPADDING     = 2;
+  GridDefaultColumnWidth    = 64;
+  GridDefaultButtonWidth    = 25;
+  GridDefaultImagePadding   = 2;
 
 type
   EGridException = class(Exception);
@@ -185,15 +185,15 @@
        goVertLine, goHorzLine, goRangeSelect, goSmoothScroll ];
   DefaultGridOptions2 = [];
 
-  constRubberSpace: byte = 2;
-  constCellPadding: byte = 3;
-  constColRowBorderTolerance: byte = 3;
+  GridConstRubberSpace: byte = 2;
+  GridConstCellPadding: byte = 3;
+  GirdConstColRowBorderTolerance: byte = 3;
 
 var
   // Values to be used after HighDPI scaling
-  varRubberSpace: byte;
-  varCellpadding: byte;
-  varColRowBorderTolerance: byte;
+  GridVarRubberSpace: byte;
+  GridVarCellPadding: byte;
+  GridVarColRowBorderTolerance: byte;
 
 type
 
@@ -2082,12 +2082,12 @@
     if Y2<Y1 then
       while Y2<Y1 do begin
         Canvas.Pixels[X1, Y1] := Color;
-        dec(Y1, varRubberSpace);
+        dec(Y1, GridVarRubberSpace);
       end
     else
       while Y1<Y2 do begin
         Canvas.Pixels[X1, Y1] := Color;
-        inc(Y1, varRubberSpace);
+        inc(Y1, GridVarRubberSpace);
       end;
   end;
   procedure DrawHorzLine(X1,Y1,X2: integer);
@@ -2095,12 +2095,12 @@
     if X2<X1 then
       while X2<X1 do begin
         Canvas.Pixels[X1, Y1] := Color;
-        dec(X1, varRubberSpace);
+        dec(X1, GridVarRubberSpace);
       end
     else
       while X1<X2 do begin
         Canvas.Pixels[X1, Y1] := Color;
-        inc(X1, varRubberSpace);
+        inc(X1, GridVarRubberSpace);
       end;
   end;
 begin
@@ -3982,7 +3982,7 @@
       txt2 := GetTruncCellHintText(cell.x, cell.y);
       gds := GetGridDrawState(cell.x, cell.y);
       PrepareCanvas(cell.x, cell.y, gds);
-      w := Canvas.TextWidth(txt2) + varCellPadding*2;
+      w := Canvas.TextWidth(txt2) + GridVarCellPadding*2;
       if w < ColWidths[cell.x] then
         txt2 := '';
     end;
@@ -4192,11 +4192,11 @@
       h := Scale96ToFont(s.cy);
 
       if IsRightToLeft then begin
-        r.Left := ARect.Left + DEFIMAGEPADDING;
-        Inc(ARect.Left, w + DEFIMAGEPADDING);
+        r.Left := ARect.Left + GridDefaultImagePadding;
+        Inc(ARect.Left, w + GridDefaultImagePadding);
       end else begin
-        Dec(ARect.Right, w + DEFIMAGEPADDING);
-        r.Left := ARect.Right - DEFIMAGEPADDING;
+        Dec(ARect.Right, w + GridDefaultImagePadding);
+        r.Left := ARect.Right - GridDefaultImagePadding;
       end;
       r.Right := r.Left + w;
       r.Top := ARect.Top + (ARect.Bottom - ARect.Top - h) div 2;
@@ -4210,11 +4210,11 @@
       h := ImgRes.Height;
 
       if IsRightToLeft then begin
-        P.X := ARect.Left + DEFIMAGEPADDING;
-        Inc(ARect.Left, w + DEFIMAGEPADDING);
+        P.X := ARect.Left + GridDefaultImagePadding;
+        Inc(ARect.Left, w + GridDefaultImagePadding);
       end else begin
-        Dec(ARect.Right, w + DEFIMAGEPADDING);
-        p.X := ARect.Right - DEFIMAGEPADDING;
+        Dec(ARect.Right, w + GridDefaultImagePadding);
+        p.X := ARect.Right - GridDefaultImagePadding;
       end;
       p.Y := ARect.Top + (ARect.Bottom - ARect.Top - h) div 2;
 
@@ -4230,31 +4230,31 @@
       ImgRes := FTitleImageList.ResolutionForPPI[FTitleImageListWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
       w := ImgRes.Width;
       h := ImgRes.Height;
-      rw := ARect.Right - ARect.Left - DEFIMAGEPADDING * 2;
-      rh := ARect.Bottom - ARect.Top - DEFIMAGEPADDING * 2;
+      rw := ARect.Right - ARect.Left - GridDefaultImagePadding * 2;
+      rh := ARect.Bottom - ARect.Top - GridDefaultImagePadding * 2;
 
       case ImgLayout of
         blGlyphRight, blGlyphLeft:
-          p.Y := ARect.Top + (rh - h) div 2 + DEFIMAGEPADDING;
+          p.Y := ARect.Top + (rh - h) div 2 + GridDefaultImagePadding;
         blGlyphTop, blGlyphBottom:
-          p.X := ARect.Left + (rw - w) div 2 + DEFIMAGEPADDING;
+          p.X := ARect.Left + (rw - w) div 2 + GridDefaultImagePadding;
       end;
       case ImgLayout of
         blGlyphRight: begin
-          Dec(ARect.Right, w + DEFIMAGEPADDING * 2);
-          p.X := ARect.Right + DEFIMAGEPADDING;
+          Dec(ARect.Right, w + GridDefaultImagePadding * 2);
+          p.X := ARect.Right + GridDefaultImagePadding;
         end;
         blGlyphLeft: begin
-          p.X := ARect.Left + DEFIMAGEPADDING;
-          Inc(ARect.Left, w + DEFIMAGEPADDING * 2);
+          p.X := ARect.Left + GridDefaultImagePadding;
+          Inc(ARect.Left, w + GridDefaultImagePadding * 2);
         end;
         blGlyphTop: begin
-          p.Y := ARect.Top + DEFIMAGEPADDING;
-          Inc(ARect.Top, w + DEFIMAGEPADDING * 2);
+          p.Y := ARect.Top + GridDefaultImagePadding;
+          Inc(ARect.Top, w + GridDefaultImagePadding * 2);
         end;
         blGlyphBottom: begin
-          Dec(ARect.Bottom, w + DEFIMAGEPADDING * 2);
-          p.Y := ARect.Bottom + DEFIMAGEPADDING;
+          Dec(ARect.Bottom, w + GridDefaultImagePadding * 2);
+          p.Y := ARect.Bottom + GridDefaultImagePadding;
         end;
       end;
 
@@ -4562,14 +4562,14 @@
 procedure TCustomGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect;
   aState: TGridDrawState; aText: String);
 begin
-  dec(ARect.Right, varCellPadding);
+  dec(ARect.Right, GridVarCellPadding);
   case Canvas.TextStyle.Alignment of
-    Classes.taLeftJustify: Inc(ARect.Left, varCellPadding);
+    Classes.taLeftJustify: Inc(ARect.Left, GridVarCellPadding);
     Classes.taRightJustify: Dec(ARect.Right, 1);
   end;
   case Canvas.TextStyle.Layout of
-    tlTop: Inc(ARect.Top, varCellPadding);
-    tlBottom: Dec(ARect.Bottom, varCellPadding);
+    tlTop: Inc(ARect.Top, GridVarCellPadding);
+    tlBottom: Dec(ARect.Bottom, GridVarCellPadding);
   end;
 
   if ARect.Right<ARect.Left then
@@ -4630,8 +4630,8 @@
 
   case bmpAlign of
     taCenter: PaintRect.Left := Trunc((aRect.Left + aRect.Right - CSize.cx)/2);
-    taLeftJustify: PaintRect.Left := ARect.Left + varCellPadding;
-    taRightJustify: PaintRect.Left := ARect.Right - CSize.Cx - varCellPadding - 1;
+    taLeftJustify: PaintRect.Left := ARect.Left + GridVarCellPadding;
+    taRightJustify: PaintRect.Left := ARect.Right - CSize.Cx - GridVarCellPadding - 1;
   end;
   PaintRect.Top  := Trunc((aRect.Top + aRect.Bottom - CSize.cy)/2);
   PaintRect := Bounds(PaintRect.Left, PaintRect.Top, CSize.cx, CSize.cy);
@@ -5410,7 +5410,7 @@
   if FDefColWidth<0 then
   begin
     if FRealizedDefColWidth <= 0 then
-      FRealizedDefColWidth := Scale96ToFont(DEFCOLWIDTH);
+      FRealizedDefColWidth := Scale96ToFont(GridDefaultColumnWidth);
     Result := FRealizedDefColWidth;
   end else
     Result := FDefColWidth;
@@ -5904,7 +5904,7 @@
     end;
 
     // check if cursor is near boundary and it's a valid column
-    if (Abs(Offset-x)<=varColRowBorderTolerance) then begin
+    if (Abs(Offset-x)<=GridVarColRowBorderTolerance) then begin
       if goFixedColSizing in Options then
         Offset := 0
       else
@@ -5976,7 +5976,7 @@
 
     // check if it's not fixed row and if cursor is close enough to
     // selected boundary
-    if (Index>=FFixedRows)and(Abs(Offset-Y)<=varColRowBorderTolerance) then begin
+    if (Index>=FFixedRows)and(Abs(Offset-Y)<=GridVarColRowBorderTolerance) then begin
       // start resizing
       if Cursor<>crVSplit then begin
         ChangeCursor(crVSplit);
@@ -9701,9 +9701,9 @@
 
   FValidateOnSetSelection := false;
 
-  varRubberSpace := MulDiv(constRubberSpace, Screen.PixelsPerInch, 96);
-  varCellPadding := MulDiv(constCellPadding, Screen.PixelsPerInch, 96);
-  varColRowBorderTolerance := MulDiv(constColRowBorderTolerance, Screen.PixelsPerInch, 96);
+  GridVarRubberSpace := MulDiv(GridConstRubberSpace, Screen.PixelsPerInch, 96);
+  GridVarCellPadding := MulDiv(GridConstCellPadding, Screen.PixelsPerInch, 96);
+  GridVarColRowBorderTolerance := MulDiv(GirdConstColRowBorderTolerance, Screen.PixelsPerInch, 96);
 end;
 
 destructor TCustomGrid.Destroy;
@@ -11189,12 +11189,12 @@
 
   GetTitleImageInfo(aCol, i, aLayout);
   if (i>=0) and (FTitleImageList<>nil) and (aLayout in [blGlyphLeft, blGlyphRight]) then
-    imgWidth := FTitleImageList.WidthForPPI[FTitleImageListWidth, Font.PixelsPerInch] + 2*DEFIMAGEPADDING
+    imgWidth := FTitleImageList.WidthForPPI[FTitleImageListWidth, Font.PixelsPerInch] + 2*GridDefaultImagePadding
   else
     imgWidth := 0;
   GetSortTitleImageInfo(aCol, imgList, i, W, B);
   if (imgList<>nil) and (i>=0) then
-    Inc(imgWidth, imgList.WidthForPPI[W, Font.PixelsPerInch] + DEFIMAGEPADDING);
+    Inc(imgWidth, imgList.WidthForPPI[W, Font.PixelsPerInch] + GridDefaultImagePadding);
 
   tmpCanvas := GetWorkingCanvas(Canvas);
 
@@ -11241,7 +11241,7 @@
   if W=0 then
     W := DefaultColWidth
   else
-    W := W + 2*varCellpadding + 1;
+    W := W + 2*GridVarCellPadding + 1;
 
   ColWidths[aCol] := W;
 end;
@@ -12978,8 +12978,8 @@
 begin
   r := Msg.CellRect;
   FGrid.AdjustInnerCellRect(r);
-  if r.Right-r.Left>DEFBUTTONWIDTH then
-    r.Left:=r.Right-DEFBUTTONWIDTH;
+  if r.Right-r.Left>GridDefaultButtonWidth then
+    r.Left:=r.Right-GridDefaultButtonWidth;
   SetBounds(r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top);
 end;
 
@@ -12991,7 +12991,7 @@
 
 procedure TButtonCellEditor.msg_Ready(var Msg: TGridMessage);
 begin
-  Width := DEFBUTTONWIDTH;
+  Width := GridDefaultButtonWidth;
 end;
 
 procedure TButtonCellEditor.msg_GetGrid(var Msg: TGridMessage);
Index: lcl/interfaces/gtk2/gtk2wsgrids.pp
===================================================================
--- lcl/interfaces/gtk2/gtk2wsgrids.pp	(revision 61228)
+++ lcl/interfaces/gtk2/gtk2wsgrids.pp	(working copy)
@@ -58,9 +58,9 @@
   Dec(Result.Bottom);
   TextHeight := ACanvas.TextHeight(' ');
   case AColumnLayout of
-    tlTop: EditorTop:=Result.Top+constCellPadding;
+    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
     tlCenter: EditorTop:=Result.Top+(Result.Bottom-Result.Top-TextHeight+1) div 2;
-    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
+    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
   end;
   if EditorTop>Result.Top then Result.Top:=EditorTop;
   Result.Bottom:=Result.Top+TextHeight;
Index: lcl/interfaces/qt/qtwsgrids.pp
===================================================================
--- lcl/interfaces/qt/qtwsgrids.pp	(revision 61228)
+++ lcl/interfaces/qt/qtwsgrids.pp	(working copy)
@@ -53,9 +53,9 @@
   Dec(Result.Bottom);
   TextHeight := ACanvas.TextHeight(' ');
   case AColumnLayout of
-    tlTop: EditorTop:=Result.Top+constCellPadding;
+    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
     tlCenter: EditorTop:=Result.Top+Round((Result.Bottom-Result.Top-TextHeight+1) div 2);
-    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
+    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
   end;
   if EditorTop>Result.Top then Result.Top:=EditorTop;
   Result.Bottom:=Result.Top+TextHeight;
Index: lcl/interfaces/qt5/qtwsgrids.pp
===================================================================
--- lcl/interfaces/qt5/qtwsgrids.pp	(revision 61228)
+++ lcl/interfaces/qt5/qtwsgrids.pp	(working copy)
@@ -52,9 +52,9 @@
   Dec(Result.Bottom);
   TextHeight := ACanvas.TextHeight(' ');
   case AColumnLayout of
-    tlTop: EditorTop:=Result.Top+constCellPadding;
+    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
     tlCenter: EditorTop:=Result.Top+Round((Result.Bottom-Result.Top-TextHeight+1) div 2);
-    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
+    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
   end;
   if EditorTop>Result.Top then Result.Top:=EditorTop;
   Result.Bottom:=Result.Top+TextHeight;
gr.diff (13,745 bytes)

Jesus Reyes

2019-05-15 16:19

developer   ~0116209

I don't agree on renaming vars/const that brake external or derived code.
in regarding of renaming of constants I think the convention of uppercasing constants is universal, not agree on changing that.

wp

2019-05-15 21:58

developer   ~0116212

Last edited: 2019-05-16 00:44

View 2 revisions

Searching for "constCellPadding" in ccr/components shows that this identifier is used by
- chemtext
- fpspreadsheetgrid
- rxdbgrid
- rxdbverticalgrid

Only a small fraction of external code which will be broken. Renaming globally accessible identifiers without good reason is not a good idea.

Bart Broersma

2019-05-15 22:33

developer   ~0116214

The renaming in itself is not a bad idea.
Maybe introduce the new constantnames, deprecate the old ones and remove after 2 major releases?

Alexey Tor.

2019-05-16 23:05

reporter   ~0116226

gr2.diff. It is the same KEEPING old 9 names as deprecated.

gr2.diff (14,648 bytes)
Index: ide/frames/modematrixctrl.pas
===================================================================
--- ide/frames/modematrixctrl.pas	(revision 61228)
+++ ide/frames/modematrixctrl.pas	(working copy)
@@ -1188,8 +1188,8 @@
       if (aRow<>Row) or (not EditorMode) then
         s+=GroupRow.Value;
       h:=Canvas.TextHeight(s);
-      Canvas.TextRect(aRect,constCellPadding+x,(aRect.Top+aRect.Bottom-h) div 2,s);
-      GroupRow.LastDrawValueX:=constCellPadding+x+Canvas.TextWidth(GroupRow.Caption);
+      Canvas.TextRect(aRect,GridConstCellPadding+x,(aRect.Top+aRect.Bottom-h) div 2,s);
+      GroupRow.LastDrawValueX:=GridConstCellPadding+x+Canvas.TextWidth(GroupRow.Caption);
       // draw focus rect
       if aRow=Row then
         DrawFocusRect(0,aRow,Rect(x,aRect.Top,aRect.Right,aRect.Bottom));
@@ -1310,7 +1310,7 @@
   TitleHeight:=20;
   for i:=0 to Modes.Count-1 do
     TitleHeight:=Max(TitleHeight,Canvas.TextWidth(Modes[i].Caption));
-  RowHeights[0]:=TitleHeight+2*constCellPadding;
+  RowHeights[0]:=TitleHeight+2*GridConstCellPadding;
 
   // tree column width
   ColWidths[0]:=Matrix.GetMaxLevel*Indent;
@@ -1326,7 +1326,7 @@
       W:=Max(W,Canvas.TextWidth(ValueRow.Typ));
     end;
   end;
-  TypeColumn.Width:=W+2*constCellPadding;
+  TypeColumn.Width:=W+2*GridConstCellPadding;
 
   // value width
   W:=0;
Index: lcl/dbgrids.pas
===================================================================
--- lcl/dbgrids.pas	(revision 61228)
+++ lcl/dbgrids.pas	(working copy)
@@ -711,7 +711,7 @@
   DebugLnEnter('CalcColumnFieldWidth INIT');
   {$endif}
   if (Field=nil) or (Field.DisplayWidth=0) then
-    Result := DEFCOLWIDTH
+    Result := GridDefaultColumnWidth
   else begin
 
     aCharWidth := CalcCanvasCharWidth(Canvas);
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 61228)
+++ lcl/grids.pas	(working copy)
@@ -72,10 +72,14 @@
   EO_IMPLEMENTED  =   $20;
 
 const
-  DEFCOLWIDTH         = 64;
-  DEFBUTTONWIDTH      = 25;
-  DEFIMAGEPADDING     = 2;
+  GridDefaultColumnWidth    = 64;
+  GridDefaultButtonWidth    = 25;
+  GridDefaultImagePadding   = 2;
 
+  DEFCOLWIDTH = GridDefaultColumnWidth deprecated 'Use GridDefaultColumnWidth';
+  DEFBUTTONWIDTH = GridDefaultButtonWidth deprecated 'Use GridDefaultButtonWidth';
+  DEFIMAGEPADDING = GridDefaultImagePadding deprecated 'Use GridDefaultImagePadding';
+
 type
   EGridException = class(Exception);
 
@@ -185,16 +189,25 @@
        goVertLine, goHorzLine, goRangeSelect, goSmoothScroll ];
   DefaultGridOptions2 = [];
 
-  constRubberSpace: byte = 2;
-  constCellPadding: byte = 3;
-  constColRowBorderTolerance: byte = 3;
+  GridConstRubberSpace: byte = 2;
+  GridConstCellPadding: byte = 3;
+  GridConstColRowBorderTolerance: byte = 3;
 
 var
   // Values to be used after HighDPI scaling
-  varRubberSpace: byte;
-  varCellpadding: byte;
-  varColRowBorderTolerance: byte;
+  GridVarRubberSpace: byte;
+  GridVarCellPadding: byte;
+  GridVarColRowBorderTolerance: byte;
 
+var
+  constRubberSpace: byte absolute GridConstRubberSpace deprecated 'Use GridConstRubberSpace';
+  constCellPadding: byte absolute GridConstCellPadding deprecated 'Use GridConstCellPadding';
+  constColRowBorderTolerance: byte absolute GridConstColRowBorderTolerance deprecated 'Use GridConstColRowBorderTolerance';
+
+  varRubberSpace: byte absolute GridVarRubberSpace deprecated 'Use GridVarRubberSpace';
+  varCellpadding: byte absolute GridVarCellPadding deprecated 'Use GridVarCellPadding';
+  varColRowBorderTolerance: byte absolute GridVarColRowBorderTolerance deprecated 'Use GridVarColRowBorderTolerance';
+
 type
 
   TCustomGrid = class;
@@ -2082,12 +2095,12 @@
     if Y2<Y1 then
       while Y2<Y1 do begin
         Canvas.Pixels[X1, Y1] := Color;
-        dec(Y1, varRubberSpace);
+        dec(Y1, GridVarRubberSpace);
       end
     else
       while Y1<Y2 do begin
         Canvas.Pixels[X1, Y1] := Color;
-        inc(Y1, varRubberSpace);
+        inc(Y1, GridVarRubberSpace);
       end;
   end;
   procedure DrawHorzLine(X1,Y1,X2: integer);
@@ -2095,12 +2108,12 @@
     if X2<X1 then
       while X2<X1 do begin
         Canvas.Pixels[X1, Y1] := Color;
-        dec(X1, varRubberSpace);
+        dec(X1, GridVarRubberSpace);
       end
     else
       while X1<X2 do begin
         Canvas.Pixels[X1, Y1] := Color;
-        inc(X1, varRubberSpace);
+        inc(X1, GridVarRubberSpace);
       end;
   end;
 begin
@@ -3982,7 +3995,7 @@
       txt2 := GetTruncCellHintText(cell.x, cell.y);
       gds := GetGridDrawState(cell.x, cell.y);
       PrepareCanvas(cell.x, cell.y, gds);
-      w := Canvas.TextWidth(txt2) + varCellPadding*2;
+      w := Canvas.TextWidth(txt2) + GridVarCellPadding*2;
       if w < ColWidths[cell.x] then
         txt2 := '';
     end;
@@ -4192,11 +4205,11 @@
       h := Scale96ToFont(s.cy);
 
       if IsRightToLeft then begin
-        r.Left := ARect.Left + DEFIMAGEPADDING;
-        Inc(ARect.Left, w + DEFIMAGEPADDING);
+        r.Left := ARect.Left + GridDefaultImagePadding;
+        Inc(ARect.Left, w + GridDefaultImagePadding);
       end else begin
-        Dec(ARect.Right, w + DEFIMAGEPADDING);
-        r.Left := ARect.Right - DEFIMAGEPADDING;
+        Dec(ARect.Right, w + GridDefaultImagePadding);
+        r.Left := ARect.Right - GridDefaultImagePadding;
       end;
       r.Right := r.Left + w;
       r.Top := ARect.Top + (ARect.Bottom - ARect.Top - h) div 2;
@@ -4210,11 +4223,11 @@
       h := ImgRes.Height;
 
       if IsRightToLeft then begin
-        P.X := ARect.Left + DEFIMAGEPADDING;
-        Inc(ARect.Left, w + DEFIMAGEPADDING);
+        P.X := ARect.Left + GridDefaultImagePadding;
+        Inc(ARect.Left, w + GridDefaultImagePadding);
       end else begin
-        Dec(ARect.Right, w + DEFIMAGEPADDING);
-        p.X := ARect.Right - DEFIMAGEPADDING;
+        Dec(ARect.Right, w + GridDefaultImagePadding);
+        p.X := ARect.Right - GridDefaultImagePadding;
       end;
       p.Y := ARect.Top + (ARect.Bottom - ARect.Top - h) div 2;
 
@@ -4230,31 +4243,31 @@
       ImgRes := FTitleImageList.ResolutionForPPI[FTitleImageListWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
       w := ImgRes.Width;
       h := ImgRes.Height;
-      rw := ARect.Right - ARect.Left - DEFIMAGEPADDING * 2;
-      rh := ARect.Bottom - ARect.Top - DEFIMAGEPADDING * 2;
+      rw := ARect.Right - ARect.Left - GridDefaultImagePadding * 2;
+      rh := ARect.Bottom - ARect.Top - GridDefaultImagePadding * 2;
 
       case ImgLayout of
         blGlyphRight, blGlyphLeft:
-          p.Y := ARect.Top + (rh - h) div 2 + DEFIMAGEPADDING;
+          p.Y := ARect.Top + (rh - h) div 2 + GridDefaultImagePadding;
         blGlyphTop, blGlyphBottom:
-          p.X := ARect.Left + (rw - w) div 2 + DEFIMAGEPADDING;
+          p.X := ARect.Left + (rw - w) div 2 + GridDefaultImagePadding;
       end;
       case ImgLayout of
         blGlyphRight: begin
-          Dec(ARect.Right, w + DEFIMAGEPADDING * 2);
-          p.X := ARect.Right + DEFIMAGEPADDING;
+          Dec(ARect.Right, w + GridDefaultImagePadding * 2);
+          p.X := ARect.Right + GridDefaultImagePadding;
         end;
         blGlyphLeft: begin
-          p.X := ARect.Left + DEFIMAGEPADDING;
-          Inc(ARect.Left, w + DEFIMAGEPADDING * 2);
+          p.X := ARect.Left + GridDefaultImagePadding;
+          Inc(ARect.Left, w + GridDefaultImagePadding * 2);
         end;
         blGlyphTop: begin
-          p.Y := ARect.Top + DEFIMAGEPADDING;
-          Inc(ARect.Top, w + DEFIMAGEPADDING * 2);
+          p.Y := ARect.Top + GridDefaultImagePadding;
+          Inc(ARect.Top, w + GridDefaultImagePadding * 2);
         end;
         blGlyphBottom: begin
-          Dec(ARect.Bottom, w + DEFIMAGEPADDING * 2);
-          p.Y := ARect.Bottom + DEFIMAGEPADDING;
+          Dec(ARect.Bottom, w + GridDefaultImagePadding * 2);
+          p.Y := ARect.Bottom + GridDefaultImagePadding;
         end;
       end;
 
@@ -4562,14 +4575,14 @@
 procedure TCustomGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect;
   aState: TGridDrawState; aText: String);
 begin
-  dec(ARect.Right, varCellPadding);
+  dec(ARect.Right, GridVarCellPadding);
   case Canvas.TextStyle.Alignment of
-    Classes.taLeftJustify: Inc(ARect.Left, varCellPadding);
+    Classes.taLeftJustify: Inc(ARect.Left, GridVarCellPadding);
     Classes.taRightJustify: Dec(ARect.Right, 1);
   end;
   case Canvas.TextStyle.Layout of
-    tlTop: Inc(ARect.Top, varCellPadding);
-    tlBottom: Dec(ARect.Bottom, varCellPadding);
+    tlTop: Inc(ARect.Top, GridVarCellPadding);
+    tlBottom: Dec(ARect.Bottom, GridVarCellPadding);
   end;
 
   if ARect.Right<ARect.Left then
@@ -4630,8 +4643,8 @@
 
   case bmpAlign of
     taCenter: PaintRect.Left := Trunc((aRect.Left + aRect.Right - CSize.cx)/2);
-    taLeftJustify: PaintRect.Left := ARect.Left + varCellPadding;
-    taRightJustify: PaintRect.Left := ARect.Right - CSize.Cx - varCellPadding - 1;
+    taLeftJustify: PaintRect.Left := ARect.Left + GridVarCellPadding;
+    taRightJustify: PaintRect.Left := ARect.Right - CSize.Cx - GridVarCellPadding - 1;
   end;
   PaintRect.Top  := Trunc((aRect.Top + aRect.Bottom - CSize.cy)/2);
   PaintRect := Bounds(PaintRect.Left, PaintRect.Top, CSize.cx, CSize.cy);
@@ -5410,7 +5423,7 @@
   if FDefColWidth<0 then
   begin
     if FRealizedDefColWidth <= 0 then
-      FRealizedDefColWidth := Scale96ToFont(DEFCOLWIDTH);
+      FRealizedDefColWidth := Scale96ToFont(GridDefaultColumnWidth);
     Result := FRealizedDefColWidth;
   end else
     Result := FDefColWidth;
@@ -5904,7 +5917,7 @@
     end;
 
     // check if cursor is near boundary and it's a valid column
-    if (Abs(Offset-x)<=varColRowBorderTolerance) then begin
+    if (Abs(Offset-x)<=GridVarColRowBorderTolerance) then begin
       if goFixedColSizing in Options then
         Offset := 0
       else
@@ -5976,7 +5989,7 @@
 
     // check if it's not fixed row and if cursor is close enough to
     // selected boundary
-    if (Index>=FFixedRows)and(Abs(Offset-Y)<=varColRowBorderTolerance) then begin
+    if (Index>=FFixedRows)and(Abs(Offset-Y)<=GridVarColRowBorderTolerance) then begin
       // start resizing
       if Cursor<>crVSplit then begin
         ChangeCursor(crVSplit);
@@ -9701,9 +9714,9 @@
 
   FValidateOnSetSelection := false;
 
-  varRubberSpace := MulDiv(constRubberSpace, Screen.PixelsPerInch, 96);
-  varCellPadding := MulDiv(constCellPadding, Screen.PixelsPerInch, 96);
-  varColRowBorderTolerance := MulDiv(constColRowBorderTolerance, Screen.PixelsPerInch, 96);
+  GridVarRubberSpace := MulDiv(GridConstRubberSpace, Screen.PixelsPerInch, 96);
+  GridVarCellPadding := MulDiv(GridConstCellPadding, Screen.PixelsPerInch, 96);
+  GridVarColRowBorderTolerance := MulDiv(GridConstColRowBorderTolerance, Screen.PixelsPerInch, 96);
 end;
 
 destructor TCustomGrid.Destroy;
@@ -11189,12 +11202,12 @@
 
   GetTitleImageInfo(aCol, i, aLayout);
   if (i>=0) and (FTitleImageList<>nil) and (aLayout in [blGlyphLeft, blGlyphRight]) then
-    imgWidth := FTitleImageList.WidthForPPI[FTitleImageListWidth, Font.PixelsPerInch] + 2*DEFIMAGEPADDING
+    imgWidth := FTitleImageList.WidthForPPI[FTitleImageListWidth, Font.PixelsPerInch] + 2*GridDefaultImagePadding
   else
     imgWidth := 0;
   GetSortTitleImageInfo(aCol, imgList, i, W, B);
   if (imgList<>nil) and (i>=0) then
-    Inc(imgWidth, imgList.WidthForPPI[W, Font.PixelsPerInch] + DEFIMAGEPADDING);
+    Inc(imgWidth, imgList.WidthForPPI[W, Font.PixelsPerInch] + GridDefaultImagePadding);
 
   tmpCanvas := GetWorkingCanvas(Canvas);
 
@@ -11241,7 +11254,7 @@
   if W=0 then
     W := DefaultColWidth
   else
-    W := W + 2*varCellpadding + 1;
+    W := W + 2*GridVarCellPadding + 1;
 
   ColWidths[aCol] := W;
 end;
@@ -12978,8 +12991,8 @@
 begin
   r := Msg.CellRect;
   FGrid.AdjustInnerCellRect(r);
-  if r.Right-r.Left>DEFBUTTONWIDTH then
-    r.Left:=r.Right-DEFBUTTONWIDTH;
+  if r.Right-r.Left>GridDefaultButtonWidth then
+    r.Left:=r.Right-GridDefaultButtonWidth;
   SetBounds(r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top);
 end;
 
@@ -12991,7 +13004,7 @@
 
 procedure TButtonCellEditor.msg_Ready(var Msg: TGridMessage);
 begin
-  Width := DEFBUTTONWIDTH;
+  Width := GridDefaultButtonWidth;
 end;
 
 procedure TButtonCellEditor.msg_GetGrid(var Msg: TGridMessage);
Index: lcl/interfaces/gtk2/gtk2wsgrids.pp
===================================================================
--- lcl/interfaces/gtk2/gtk2wsgrids.pp	(revision 61228)
+++ lcl/interfaces/gtk2/gtk2wsgrids.pp	(working copy)
@@ -58,9 +58,9 @@
   Dec(Result.Bottom);
   TextHeight := ACanvas.TextHeight(' ');
   case AColumnLayout of
-    tlTop: EditorTop:=Result.Top+constCellPadding;
+    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
     tlCenter: EditorTop:=Result.Top+(Result.Bottom-Result.Top-TextHeight+1) div 2;
-    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
+    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
   end;
   if EditorTop>Result.Top then Result.Top:=EditorTop;
   Result.Bottom:=Result.Top+TextHeight;
Index: lcl/interfaces/qt/qtwsgrids.pp
===================================================================
--- lcl/interfaces/qt/qtwsgrids.pp	(revision 61228)
+++ lcl/interfaces/qt/qtwsgrids.pp	(working copy)
@@ -53,9 +53,9 @@
   Dec(Result.Bottom);
   TextHeight := ACanvas.TextHeight(' ');
   case AColumnLayout of
-    tlTop: EditorTop:=Result.Top+constCellPadding;
+    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
     tlCenter: EditorTop:=Result.Top+Round((Result.Bottom-Result.Top-TextHeight+1) div 2);
-    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
+    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
   end;
   if EditorTop>Result.Top then Result.Top:=EditorTop;
   Result.Bottom:=Result.Top+TextHeight;
Index: lcl/interfaces/qt5/qtwsgrids.pp
===================================================================
--- lcl/interfaces/qt5/qtwsgrids.pp	(revision 61228)
+++ lcl/interfaces/qt5/qtwsgrids.pp	(working copy)
@@ -52,9 +52,9 @@
   Dec(Result.Bottom);
   TextHeight := ACanvas.TextHeight(' ');
   case AColumnLayout of
-    tlTop: EditorTop:=Result.Top+constCellPadding;
+    tlTop: EditorTop:=Result.Top+GridConstCellPadding;
     tlCenter: EditorTop:=Result.Top+Round((Result.Bottom-Result.Top-TextHeight+1) div 2);
-    tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
+    tlBottom: EditorTop:=Result.Bottom-GridConstCellPadding-TextHeight+1;
   end;
   if EditorTop>Result.Top then Result.Top:=EditorTop;
   Result.Bottom:=Result.Top+TextHeight;
gr2.diff (14,648 bytes)

Issue History

Date Modified Username Field Change
2019-05-15 12:12 Alexey Tor. New Issue
2019-05-15 12:12 Alexey Tor. File Added: gr.diff
2019-05-15 16:08 Jesus Reyes Assigned To => Jesus Reyes
2019-05-15 16:08 Jesus Reyes Status new => assigned
2019-05-15 16:19 Jesus Reyes Note Added: 0116209
2019-05-15 21:58 wp Note Added: 0116212
2019-05-15 22:33 Bart Broersma Note Added: 0116214
2019-05-16 00:44 wp Note Edited: 0116212 View Revisions
2019-05-16 23:05 Alexey Tor. File Added: gr2.diff
2019-05-16 23:05 Alexey Tor. Note Added: 0116226