Browse Source

Scaling menu spacing

Source commit: 52006cdcf0a49cd9cbd9e77e2c4847e19a4a96f7
Martin Prikryl 10 years ago
parent
commit
734cab66de
1 changed files with 6 additions and 4 deletions
  1. 6 4
      source/packages/tbx/TBX.pas

+ 6 - 4
source/packages/tbx/TBX.pas

@@ -1358,12 +1358,13 @@ begin
       AHeight := 3;
       AHeight := 3;
     end;
     end;
 
 
+    Two := ScaleByTextHeightRunTime(Canvas, 2);
     if CaptionShown then
     if CaptionShown then
     begin
     begin
       Inc(AWidth, TextSize.CX);
       Inc(AWidth, TextSize.CX);
       Inc(AHeight, TextSize.CY);
       Inc(AHeight, TextSize.CY);
-      if not IsTextRotated then Inc(AWidth, 4)
-      else Inc(AHeight, 4);
+      if not IsTextRotated then Inc(AWidth, 2 * Two)
+      else Inc(AHeight, 2 * Two);
     end;
     end;
 
 
     if GetImageShown and (ImgSize.CX > 0) and (ImgSize.CY > 0) then
     if GetImageShown and (ImgSize.CX > 0) and (ImgSize.CY > 0) then
@@ -1388,7 +1389,6 @@ begin
       begin
       begin
         if (ItemLayout <> tbxlGlyphTop) or (ImgSize.CX = 0) or IsTextRotated then
         if (ItemLayout <> tbxlGlyphTop) or (ImgSize.CX = 0) or IsTextRotated then
         begin
         begin
-          Two := ScaleByTextHeightRunTime(Canvas, 2);
           if View.Orientation <> tbvoVertical then Inc(AWidth, Two + DropdownArrowWidth)
           if View.Orientation <> tbvoVertical then Inc(AWidth, Two + DropdownArrowWidth)
           else Inc(AHeight, DropdownArrowWidth + Two + DropdownArrowMargin);
           else Inc(AHeight, DropdownArrowWidth + Two + DropdownArrowMargin);
         end
         end
@@ -1654,6 +1654,7 @@ var
   TextMetrics: TTextMetric;
   TextMetrics: TTextMetric;
   TextSize: TSize;
   TextSize: TSize;
   Margins: TTBXMargins;
   Margins: TTBXMargins;
+  Two: Integer;
 begin
 begin
   Item := TTBXCustomItem(Self.Item);
   Item := TTBXCustomItem(Self.Item);
   View := TTBViewAccess(Self.View);
   View := TTBViewAccess(Self.View);
@@ -1845,11 +1846,12 @@ begin
     begin
     begin
       CaptionRect := R;
       CaptionRect := R;
       TextFlags := TextFlags or DT_CENTER or DT_VCENTER;
       TextFlags := TextFlags or DT_CENTER or DT_VCENTER;
+      Two := ScaleByTextHeightRunTime(Canvas, 2);
       if ImageIsShown then with CaptionRect do
       if ImageIsShown then with CaptionRect do
         case ItemLayout of
         case ItemLayout of
         tbxlGlyphLeft:
         tbxlGlyphLeft:
           begin
           begin
-            Inc(Left, ImgSize.CX + 3);
+            Inc(Left, ImgSize.CX + Two + 1);
             Top := (Top + Bottom  - TextSize.CY) div 2;
             Top := (Top + Bottom  - TextSize.CY) div 2;
             Bottom := Top + TextSize.CY;
             Bottom := Top + TextSize.CY;
             Left := (Left + Right - TextSize.CX) div 2;
             Left := (Left + Right - TextSize.CX) div 2;