Browse Source

adjust font size on windows

circular17 6 years ago
parent
commit
1155760465
5 changed files with 271 additions and 267 deletions
  1. 1 1
      lazpaint/dialog/ubrowseimages.pas
  2. 251 252
      lazpaint/lazpaintmainform.lfm
  3. 13 8
      lazpaint/ugraph.pas
  4. 3 3
      lazpaint/ulayerstack.pas
  5. 3 3
      lazpaint/umenu.pas

+ 1 - 1
lazpaint/dialog/ubrowseimages.pas

@@ -262,7 +262,7 @@ begin
   FPreview.OnValidate:= @PreviewValidate;
   FChosenImage := TImageEntry.Empty;
 
-  BCAssignSystemStyle(ComboBox_FileExtension, False);
+  BCAssignSystemStyle(ComboBox_FileExtension, False, 0.45);
   InitComboExt;
 
   bmp := TBitmap.Create;

File diff suppressed because it is too large
+ 251 - 252
lazpaint/lazpaintmainform.lfm


+ 13 - 8
lazpaint/ugraph.pas

@@ -58,8 +58,8 @@ procedure DrawPenStyle(AComboBox: TBCComboBox; ARect: TRect; APenStyle: TPenStyl
 procedure DrawPenStyle(ABitmap: TBGRABitmap; ARect: TRect; APenStyle: TPenStyle; c: TBGRAPixel); overload;
 procedure DrawArrow(AComboBox: TBCComboBox; ARect: TRect; AStart: boolean; AKindStr: string; ALineCap: TPenEndCap; State: TOwnerDrawState); overload;
 procedure DrawArrow(ABitmap: TBGRABitmap; ARect: TRect; AStart: boolean; AKindStr: string; ALineCap: TPenEndCap; AColor: TBGRAPixel); overload;
-procedure BCAssignSystemStyle(AButton: TBCButton; ADarkTheme: boolean; AFontHeightRatio: single = 0.45);
-procedure BCAssignSystemStyle(ACombo: TBCComboBox; ADarkTheme: boolean; AFontHeightRatio: single = 0.45);
+procedure BCAssignSystemStyle(AButton: TBCButton; ADarkTheme: boolean; AFontHeightRatio: single = 0.5);
+procedure BCAssignSystemStyle(ACombo: TBCComboBox; ADarkTheme: boolean; AFontHeightRatio: single = 0.5);
 
 implementation
 
@@ -128,6 +128,7 @@ procedure BCAssignSystemStyle(AButton: TBCButton; ADarkTheme: boolean; AFontHeig
   end;
 
 var highlight, btnFace, btnShadow, btnText: TColor;
+  fh: Int64;
 begin
   if ADarkTheme then
   begin
@@ -153,18 +154,19 @@ begin
     BCAssignSystemState(StateNormal, btnText, btnFace, highlight, btnFace, btnShadow, btnShadow);
     BCAssignSystemState(StateHover, HoverColor(btnText), HoverColor(btnFace), HoverColor(highlight), HoverColor(btnFace), HoverColor(btnShadow), HoverColor(btnShadow));
     BCAssignSystemState(StateClicked, HoverColor(btnText), HoverColor(MergeColor(btnFace,btnShadow)), HoverColor(btnFace), HoverColor(MergeColor(btnFace,btnShadow)), HoverColor(btnShadow), HoverColor(btnShadow));
+    fh := round((AButton.Height-4)*AFontHeightRatio);
     StateNormal.Border.LightWidth := 0;
-    StateNormal.FontEx.Height := round(AButton.Height*AFontHeightRatio);
+    StateNormal.FontEx.Height := fh;
     StateNormal.FontEx.ShadowColorOpacity:= 70;
     StateNormal.FontEx.TextAlignment:= bcaLeftCenter;
     StateNormal.FontEx.PaddingLeft:= DoScaleX(3, OriginalDPI);
     StateHover.Border.LightWidth := 0;
-    StateHover.FontEx.Height := round(AButton.Height*AFontHeightRatio);
+    StateHover.FontEx.Height := fh;
     StateHover.FontEx.ShadowColorOpacity:= 70;
     StateHover.FontEx.TextAlignment:= bcaLeftCenter;
     StateHover.FontEx.PaddingLeft:= DoScaleX(3, OriginalDPI);
     StateClicked.Border.LightWidth := 0;
-    StateClicked.FontEx.Height := round(AButton.Height*AFontHeightRatio);
+    StateClicked.FontEx.Height := fh;
     StateClicked.FontEx.ShadowColorOpacity:= 70;
     StateClicked.FontEx.TextAlignment:= bcaLeftCenter;
     StateClicked.FontEx.PaddingLeft:= DoScaleX(3, OriginalDPI);
@@ -173,15 +175,18 @@ end;
 
 procedure BCAssignSystemStyle(ACombo: TBCComboBox; ADarkTheme: boolean;
   AFontHeightRatio: single);
+var
+  fh: Int64;
 begin
   BCAssignSystemStyle(ACombo.Button, ADarkTheme, AFontHeightRatio);
   with ACombo do
   begin
-    Button.StateNormal.FontEx.Height := round(AFontHeightRatio*Height);
+    fh := round((Height-4)*AFontHeightRatio);
+    Button.StateNormal.FontEx.Height := fh;
     Button.StateNormal.FontEx.ShadowColorOpacity:= 96;
-    Button.StateClicked.FontEx.Height := round(AFontHeightRatio*Height);
+    Button.StateClicked.FontEx.Height := fh;
     Button.StateClicked.FontEx.ShadowColorOpacity:= 96;
-    Button.StateHover.FontEx.Height := round(AFontHeightRatio*Height);
+    Button.StateHover.FontEx.Height := fh;
     Button.StateHover.FontEx.ShadowColorOpacity:= 96;
     if ADarkTheme then
     begin

+ 3 - 3
lazpaint/ulayerstack.pas

@@ -279,8 +279,8 @@ begin
   Toolbar2.Top := Toolbar1.Top + Toolbar1.Height;
   Panel1.Height := Toolbar2.Top+Toolbar2.Height+2;
 
-  ComboBox_BlendOp.Top := ToolBar1.Top;
-  ComboBox_BlendOp.Height := ToolBar1.ButtonHeight+1;
+  ComboBox_BlendOp.Top := ToolBar1.Top-1;
+  ComboBox_BlendOp.Height := ToolBar1.ButtonHeight+2;
 
   if Toolbar2.Top+Toolbar2.Height+2 > Panel1.Height then
     Panel1.Height := Toolbar2.Top+Toolbar2.Height+2;
@@ -844,7 +844,7 @@ begin
   DarkThemeInstance.Apply(ToolBar2, DarkTheme);
   DarkThemeInstance.Apply(ToolBar3, DarkTheme);
   BGRALayerStack.Color:= GetBackColor(False);
-  BCAssignSystemStyle(ComboBox_BlendOp, DarkTheme, 0.5);
+  BCAssignSystemStyle(ComboBox_BlendOp, DarkTheme, 0.60);
 end;
 
 function TFLayerStack.GetTextColor(ASelected: boolean): TColor;

+ 3 - 3
lazpaint/umenu.pas

@@ -254,7 +254,7 @@ begin
           end;
         end else
         if Controls[j] is TBCComboBox then
-          BCAssignSystemStyle(TBCComboBox(Controls[j]), FDarkTheme, 0.4) else
+          BCAssignSystemStyle(TBCComboBox(Controls[j]), FDarkTheme, 0.65) else
         if Controls[j] is TBCTrackbarUpdown then
         begin
           if FDarkTheme then
@@ -339,9 +339,9 @@ begin
         if (Controls[j].Name = 'Label_Coordinates') or
            (Controls[j].Name = 'Label_CurrentZoom') or
            (Controls[j].Name = 'Label_CurrentDiff') then
-          Controls[j].Font.Size := Controls[j].Height*38 div ScreenInfo.PixelsPerInchY
+          Controls[j].Font.Height := -Controls[j].Height*55 div ScreenInfo.PixelsPerInchY
         else
-          Controls[j].Font.Size := Controls[j].Height*33 div ScreenInfo.PixelsPerInchY;
+          Controls[j].Font.Height := -Controls[j].Height*50 div ScreenInfo.PixelsPerInchY;
       end;
     end;
   end;

Some files were not shown because too many files changed in this diff