Bläddra i källkod

Issue 2147 – Optional larger toolbar icons

https://winscp.net/tracker/2147

Source commit: 4ceed24135fe0abbe9c94709fe792e9262dfec87
Martin Prikryl 1 år sedan
förälder
incheckning
96e3df207c

+ 13 - 2
source/components/ThemePageControl.cpp

@@ -162,6 +162,7 @@ __fastcall TThemePageControl::TThemePageControl(TComponent * Owner) :
   FOnTabHint = NULL;
   FTabTheme = NULL;
   FActiveTabTheme = NULL;
+  FTextHeight = -1;
 }
 //----------------------------------------------------------------------------------------------------------
 int __fastcall TThemePageControl::GetTabsHeight()
@@ -218,6 +219,10 @@ void __fastcall TThemePageControl::PaintWindow(HDC DC)
 
   int SelectedIndex = TabIndex; // optimization
 
+  std::unique_ptr<TCanvas> ACanvas(new TCanvas());
+  ACanvas->Handle = DC;
+  FTextHeight = CalculateTextHeight(ACanvas.get());
+
   for (int Tab = 0; Tab < PageCount; Tab++)
   {
     if (Tab != SelectedIndex)
@@ -346,6 +351,12 @@ void __fastcall TThemePageControl::ItemTextRect(int Item, TRect & Rect)
     Rect.Left -= 2;
   }
   Rect.Right -= 3;
+  // Shouldn't get here until the control has (started) painted
+  if (DebugAlwaysTrue(FTextHeight > 0))
+  {
+    int AlignOffset = ((Rect.Height() - FTextHeight) / 2) - ScaleByTextHeight(this, 4) + 2;
+    Rect.Top += AlignOffset;
+  }
   OffsetRect(&Rect, 0, ((Item == TabIndex) ? 0 : -2));
 }
 //----------------------------------------------------------------------------------------------------------
@@ -408,7 +419,6 @@ void __fastcall TThemePageControl::DrawTabItem(HDC DC, int Item, TRect Rect, int
     Images->Draw(Canvas.get(), Left, Y, Pages[Item]->ImageIndex, !Shadowed);
   }
 
-  int TextHeight = 20;
   int OldMode = SetBkMode(DC, TRANSPARENT);
   if (!Text.IsEmpty())
   {
@@ -420,7 +430,7 @@ void __fastcall TThemePageControl::DrawTabItem(HDC DC, int Item, TRect Rect, int
     HFONT OldFont = (HFONT)SelectObject(DC, Font->Handle);
     wchar_t * Buf = new wchar_t[Text.Length() + 1 + 4];
     wcscpy(Buf, Text.c_str());
-    TRect TextRect(0, 0, Rect.Right - Rect.Left, TextHeight);
+    TRect TextRect(0, 0, Rect.Right - Rect.Left, 20);
     // Truncates too long texts with ellipsis
     ::DrawText(DC, Buf, -1, &TextRect, DT_CALCRECT | DT_SINGLELINE | DT_MODIFYSTRING | DT_END_ELLIPSIS);
 
@@ -509,6 +519,7 @@ TRect __fastcall TThemePageControl::TabButtonRect(int Index)
   Canvas->Font = Font;
   GetTextMetrics(Canvas->Handle, &TextMetric);
 
+  // TextMetric.tmAscent is approx the same thing as FTextHeight
   Rect.Top += TextMetric.tmAscent - ATabButtonSize + CrossPadding;
   Rect.Left = Rect.Right - ATabButtonSize - ScaleByTextHeight(this, 1);
   if (Index == TabIndex)

+ 1 - 0
source/components/ThemePageControl.h

@@ -109,6 +109,7 @@ private:
   int FSessionTabShrink;
   TTBXTheme * FTabTheme;
   TTBXTheme * FActiveTabTheme;
+  int FTextHeight;
 };
 //---------------------------------------------------------------------------
 #endif

+ 21 - 13
source/forms/CustomScpExplorer.cpp

@@ -263,7 +263,6 @@ __fastcall TCustomScpExplorerForm::TCustomScpExplorerForm(TComponent* Owner):
   SetSubmenu(NonVisualDataModule->ColorMenuItem, true);
 
   UseDesktopFont(SessionsPageControl);
-  UpdateSessionsPageControlHeight();
   UseDesktopFont(RemoteDirView);
   UseDesktopFont(RemoteDriveView);
   UseDesktopFont(QueueView3);
@@ -287,6 +286,8 @@ __fastcall TCustomScpExplorerForm::TCustomScpExplorerForm(TComponent* Owner):
   FSessionColors->ColorDepth = cd32Bit;
   AddFixedSessionImages();
   SessionsPageControl->Images = FSessionColors;
+  // Needed for Explorer (Commander calls it implicitly on its own)
+  UpdateSessionsPageControlHeight();
   UpdateQueueLabel();
   CheckStoreTransition();
 
@@ -1225,6 +1226,16 @@ void __fastcall TCustomScpExplorerForm::ConfigurationChanged()
   {
     SessionListChanged();
   }
+
+  if (GlyphsModule->LargerToolbar != WinConfiguration->LargerToolbar)
+  {
+    GlyphsModule->LargerToolbar = WinConfiguration->LargerToolbar;
+    if (FSessionColors != NULL)
+    {
+      RegenerateSessionColorsImageList();
+      UpdateSessionsPageControlHeight();
+    }
+  }
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::DoFileColorsChanged(TCustomDirView * DirView)
@@ -9908,15 +9919,20 @@ void __fastcall TCustomScpExplorerForm::UpdateImages()
   // noop
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::CMDpiChanged(TMessage & Message)
+void TCustomScpExplorerForm::RegenerateSessionColorsImageList()
 {
-  TForm::Dispatch(&Message);
   FSessionColors->Clear();
   AddFixedSessionImages();
-  RegenerateSessionColorsImageList(FSessionColors, FSessionColorMaskImageIndex);
+  ::RegenerateSessionColorsImageList(FSessionColors, FSessionColorMaskImageIndex);
   UpdateImages();
 }
 //---------------------------------------------------------------------------
+void __fastcall TCustomScpExplorerForm::CMDpiChanged(TMessage & Message)
+{
+  TForm::Dispatch(&Message);
+  RegenerateSessionColorsImageList();
+}
+//---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::WMDpiChanged(TMessage & Message)
 {
   TForm::Dispatch(&Message);
@@ -11108,15 +11124,7 @@ void __fastcall TCustomScpExplorerForm::ChangeScale(int M, int D)
 {
   TForm::ChangeScale(M, D);
   int APixelsPerInch = GetControlPixelsPerInch(this);
-  HANDLE ResourceModule = GUIConfiguration->ChangeToDefaultResourceModule();
-  try
-  {
-    GlyphsModule->SetPixelsPerInch(APixelsPerInch);
-  }
-  __finally
-  {
-    GUIConfiguration->ChangeResourceModule(ResourceModule);
-  }
+  GlyphsModule->PixelsPerInch = APixelsPerInch;
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::DockContextPopup(TObject * Sender, TPoint & MousePos, bool & /*Handled*/)

+ 1 - 0
source/forms/CustomScpExplorer.h

@@ -765,6 +765,7 @@ protected:
   bool NeedSecondarySessionForRemoteCopy(TStrings * FileList);
   void ReleaseHiContrastTheme();
   bool CanCalculateChecksum();
+  void RegenerateSessionColorsImageList();
 
 public:
   virtual __fastcall ~TCustomScpExplorerForm();

+ 66 - 31
source/forms/Glyphs.cpp

@@ -7,7 +7,9 @@
 #include "Glyphs120.h"
 #include "Glyphs144.h"
 #include "Glyphs192.h"
+#include "Common.h"
 #include "GUITools.h"
+#include "GUIConfiguration.h"
 //---------------------------------------------------------------------------
 #pragma package(smart_init)
 #pragma link "PngImageList"
@@ -19,6 +21,7 @@ __fastcall TGlyphsModule::TGlyphsModule(TComponent* Owner)
   : TDataModule(Owner)
 {
   FPixelsPerInch = USER_DEFAULT_SCREEN_DPI;
+  FLargerToolbar = 0;
   SetPixelsPerInch(Screen->PixelsPerInch);
 }
 //---------------------------------------------------------------------------
@@ -28,45 +31,77 @@ __fastcall TGlyphsModule::TGlyphsModule()
 {
 }
 //---------------------------------------------------------------------------
-void __fastcall TGlyphsModule::SetPixelsPerInch(int PixelsPerInch)
+void TGlyphsModule::SetPixelsPerInch(int PixelsPerInch)
 {
-  PixelsPerInch = NormalizePixelsPerInch(PixelsPerInch);
-  if (FPixelsPerInch != PixelsPerInch)
+  int BasePixelsPerInch = NormalizePixelsPerInch(PixelsPerInch);
+  if (FBasePixelsPerInch != BasePixelsPerInch)
   {
-    std::unique_ptr<TDataModule> ScaledModule;
-    if (PixelsPerInch >= 192)
-    {
-      ScaledModule.reset(new TGlyphs192Module(Application));
-    }
-    else if (PixelsPerInch >= 144)
-    {
-      ScaledModule.reset(new TGlyphs144Module(Application));
-    }
-    else if (PixelsPerInch >= 120)
-    {
-      ScaledModule.reset(new TGlyphs120Module(Application));
-    }
-    else
+    FBasePixelsPerInch = BasePixelsPerInch;
+    UpdatePixelsPerInch();
+  }
+}
+//---------------------------------------------------------------------------
+void TGlyphsModule::SetLargerToolbar(int LargerToolbar)
+{
+  if (FLargerToolbar != LargerToolbar)
+  {
+    FLargerToolbar = LargerToolbar;
+    UpdatePixelsPerInch();
+  }
+}
+//---------------------------------------------------------------------------
+bool TGlyphsModule::GetLargerToolbarPossible()
+{
+  return (LargerPixelsPerInch(FBasePixelsPerInch, 1) > FBasePixelsPerInch);
+}
+//---------------------------------------------------------------------------
+void TGlyphsModule::UpdatePixelsPerInch()
+{
+  HANDLE ResourceModule = GUIConfiguration->ChangeToDefaultResourceModule();
+  try
+  {
+    int PixelsPerInch = LargerPixelsPerInch(FBasePixelsPerInch, FLargerToolbar);
+    if (FPixelsPerInch != PixelsPerInch)
     {
-      // Do not have a separate 96 DPI module, as this module needs to
-      // have the images loaded as they are used on design time.
-      // Performance impact of loading 96 DPI images when they are not needed is not that big.
-      ScaledModule.reset(new TGlyphsModule());
-    }
+      std::unique_ptr<TDataModule> ScaledModule;
+      if (PixelsPerInch >= 192)
+      {
+        ScaledModule.reset(new TGlyphs192Module(Application));
+      }
+      else if (PixelsPerInch >= 144)
+      {
+        ScaledModule.reset(new TGlyphs144Module(Application));
+      }
+      else if (PixelsPerInch >= 120)
+      {
+        ScaledModule.reset(new TGlyphs120Module(Application));
+      }
+      else
+      {
+        // Do not have a separate 96 DPI module, as this module needs to
+        // have the images loaded as they are used on design time.
+        // Performance impact of loading 96 DPI images when they are not needed is not that big.
+        ScaledModule.reset(new TGlyphsModule());
+      }
 
-    if (ScaledModule.get() != NULL)
-    {
-      for (int Index = 0; Index < ComponentCount; Index++)
+      if (ScaledModule.get() != NULL)
       {
-        TComponent * TargetComponent = Components[Index];
-        TComponent * SourceComponent = ScaledModule->FindComponent(TargetComponent->Name);
-        if (DebugAlwaysTrue(SourceComponent != NULL))
+        for (int Index = 0; Index < ComponentCount; Index++)
         {
-          TargetComponent->Assign(SourceComponent);
+          TComponent * TargetComponent = Components[Index];
+          TComponent * SourceComponent = ScaledModule->FindComponent(TargetComponent->Name);
+          if (DebugAlwaysTrue(SourceComponent != NULL))
+          {
+            TargetComponent->Assign(SourceComponent);
+          }
         }
       }
-    }
 
-    FPixelsPerInch = PixelsPerInch;
+      FPixelsPerInch = PixelsPerInch;
+    }
+  }
+  __finally
+  {
+    GUIConfiguration->ChangeResourceModule(ResourceModule);
   }
 }

+ 9 - 1
source/forms/Glyphs.h

@@ -17,12 +17,20 @@ __published:
 public:
   __fastcall TGlyphsModule(TComponent * Owner);
 
-  void __fastcall SetPixelsPerInch(int PixelsPerInch);
+  __property int PixelsPerInch = { read = FBasePixelsPerInch, write = SetPixelsPerInch };
+  __property int LargerToolbar = { read = FLargerToolbar, write = SetLargerToolbar };
+  __property bool LargerToolbarPossible = { read = GetLargerToolbarPossible };
 
 private:
+  int FLargerToolbar;
+  int FBasePixelsPerInch;
   int FPixelsPerInch;
 
   __fastcall TGlyphsModule();
+  void UpdatePixelsPerInch();
+  void SetPixelsPerInch(int PixelsPerInch);
+  void SetLargerToolbar(int LargerToolbar);
+  bool GetLargerToolbarPossible();
 };
 //---------------------------------------------------------------------------
 extern PACKAGE TGlyphsModule * GlyphsModule;

+ 4 - 0
source/forms/NonVisual.cpp

@@ -17,6 +17,7 @@
 #include "TBX.hpp"
 #include "VCLCommon.h"
 #include <HistoryComboBox.hpp>
+#include "Glyphs.h"
 //---------------------------------------------------------------------------
 #pragma package(smart_init)
 #pragma link "TB2Item"
@@ -352,6 +353,8 @@ void __fastcall TNonVisualDataModule::ExplorerActionsUpdate(
     LockToolbarsAction->Checked = WinConfiguration->LockToolbars, )
   UPDEX(SelectiveToolbarTextAction, true,
     SelectiveToolbarTextAction->Checked = WinConfiguration->SelectiveToolbarText, )
+  UPDEX(LargerToolbarAction, GlyphsModule->LargerToolbarPossible,
+    LargerToolbarAction->Checked = WinConfiguration->LargerToolbar, )
   UPDCOMP(CustomCommandsBand)
   UPD(ColorMenuAction2, HasTerminal)
   UPD(GoToAddressAction, true)
@@ -703,6 +706,7 @@ void __fastcall TNonVisualDataModule::ExplorerActionsExecute(
     EXE(FileColorsPreferencesAction, PreferencesDialog(pmFileColors) )
     EXE(LockToolbarsAction, WinConfiguration->LockToolbars = !WinConfiguration->LockToolbars)
     EXE(SelectiveToolbarTextAction, WinConfiguration->SelectiveToolbarText = !WinConfiguration->SelectiveToolbarText)
+    EXE(LargerToolbarAction, WinConfiguration->LargerToolbar = (WinConfiguration->LargerToolbar > 0) ? 0 : 2)
     EXECOMP(CustomCommandsBand)
     EXE(ColorMenuAction2, CreateSessionColorMenu(ColorMenuAction2))
     EXE(GoToAddressAction, ScpExplorer->GoToAddress())

+ 27 - 0
source/forms/NonVisual.dfm

@@ -1798,6 +1798,13 @@ object NonVisualDataModule: TNonVisualDataModule
       HelpKeyword = 'ui_toolbars'
       Hint = 'Show text labels for selected important commands on toolbars'
     end
+    object LargerToolbarAction: TAction
+      Tag = 15
+      Category = 'View'
+      Caption = '&Larger Toolbar Icons'
+      HelpKeyword = 'ui_toolbars'
+      Hint = 'Show larger toolbar icons'
+    end
     object CustomCommandsBandAction: TAction
       Tag = 15
       Category = 'View'
@@ -2520,12 +2527,17 @@ object NonVisualDataModule: TNonVisualDataModule
     object TBXItem16: TTBXItem
       Action = ExplorerCustomCommandsBandAction
     end
+    object TBXSeparatorItem27: TTBXSeparatorItem
+    end
     object TBXItem7: TTBXItem
       Action = LockToolbarsAction
     end
     object TBXItem48: TTBXItem
       Action = SelectiveToolbarTextAction
     end
+    object TBXItem120: TTBXItem
+      Action = LargerToolbarAction
+    end
     object TBXSubmenuItem4: TTBXSubmenuItem
       Action = CustomizeToolbarAction
     end
@@ -2606,12 +2618,17 @@ object NonVisualDataModule: TNonVisualDataModule
     object TBXItem15: TTBXItem
       Action = CommanderCustomCommandsBandAction
     end
+    object TBXSeparatorItem24: TTBXSeparatorItem
+    end
     object TBXItem6: TTBXItem
       Action = LockToolbarsAction
     end
     object TBXItem46: TTBXItem
       Action = SelectiveToolbarTextAction
     end
+    object TBXItem117: TTBXItem
+      Action = LargerToolbarAction
+    end
     object TBXItem77: TTBXSubmenuItem
       Action = CustomizeToolbarAction
     end
@@ -2776,12 +2793,17 @@ object NonVisualDataModule: TNonVisualDataModule
     object TBXItem45: TTBXItem
       Action = CommanderRemoteSelectionBandAction2
     end
+    object TBXSeparatorItem26: TTBXSeparatorItem
+    end
     object TBXItem37: TTBXItem
       Action = LockToolbarsAction
     end
     object TBXItem49: TTBXItem
       Action = SelectiveToolbarTextAction
     end
+    object TBXItem119: TTBXItem
+      Action = LargerToolbarAction
+    end
     object TBXSubmenuItem9: TTBXSubmenuItem
       Action = CustomizeToolbarAction
     end
@@ -2860,12 +2882,17 @@ object NonVisualDataModule: TNonVisualDataModule
     object TBXItem44: TTBXItem
       Action = CommanderLocalSelectionBandAction2
     end
+    object TBXSeparatorItem25: TTBXSeparatorItem
+    end
     object TBXItem38: TTBXItem
       Action = LockToolbarsAction
     end
     object TBXItem47: TTBXItem
       Action = SelectiveToolbarTextAction
     end
+    object TBXItem118: TTBXItem
+      Action = LargerToolbarAction
+    end
     object TBXSubmenuItem6: TTBXSubmenuItem
       Action = CustomizeToolbarAction
     end

+ 9 - 0
source/forms/NonVisual.h

@@ -714,6 +714,15 @@ __published:    // IDE-managed Components
   TAction *RemoteThumbnailAction;
   TAction *LocalReportAction;
   TAction *LocalThumbnailAction;
+  TTBXSeparatorItem *TBXSeparatorItem24;
+  TAction *LargerToolbarAction;
+  TTBXItem *TBXItem117;
+  TTBXSeparatorItem *TBXSeparatorItem25;
+  TTBXSeparatorItem *TBXSeparatorItem26;
+  TTBXItem *TBXItem118;
+  TTBXItem *TBXItem119;
+  TTBXItem *TBXItem120;
+  TTBXSeparatorItem *TBXSeparatorItem27;
   void __fastcall ExplorerActionsUpdate(TBasicAction *Action, bool &Handled);
   void __fastcall ExplorerActionsExecute(TBasicAction *Action, bool &Handled);
   void __fastcall SessionIdleTimerTimer(TObject *Sender);

+ 16 - 0
source/forms/Progress.cpp

@@ -378,6 +378,22 @@ void __fastcall TProgressForm::UpdateControls()
     FileProgress->Position = FData.TransferProgress();
     FileProgress->Hint = FORMAT(L"%d%%", (FileProgress->Position));
   }
+
+  SizeToolbar(this, Toolbar, Dock, ToolbarPanel);
+}
+//---------------------------------------------------------------------
+void TProgressForm::SizeToolbar(TForm * Form, TTBXToolbar * Toolbar, TTBXDock * Dock, TPanel * ToolbarPanel)
+{
+  // particularly to adjust to LargerToolbar
+  Dock->ClientHeight = Toolbar->Height;
+  int Delta = Dock->Height - ToolbarPanel->ClientHeight;
+  if (Delta != 0)
+  {
+    ToolbarPanel->ClientHeight += Delta;
+    DebugAssert(ToolbarPanel->Anchors.Contains(akBottom));
+    ToolbarPanel->Top -= Delta; // to counter akBottom anchoring
+    Form->ClientHeight += Delta;
+  }
 }
 //---------------------------------------------------------------------
 static __int64 DelayStartInterval = MSecsPerSec / 2;

+ 1 - 0
source/forms/Progress.h

@@ -141,6 +141,7 @@ protected:
 public:
   static UnicodeString __fastcall ProgressStr(
     const TSynchronizeProgress * SynchronizeProgress, const TFileOperationProgressType * ProgressData);
+  static void SizeToolbar(TForm * Form, TTBXToolbar * Toolbar, TTBXDock * Dock, TPanel * ToolbarPanel);
 
   virtual __fastcall TProgressForm(
     TComponent * AOwner, bool AllowMoveToQueue, bool AllowSkip, TSynchronizeProgress * SynchronizeProgress);

+ 3 - 0
source/forms/ScpCommander.dfm

@@ -550,6 +550,9 @@ inherited ScpCommanderForm: TScpCommanderForm
           object TBXItem133: TTBXItem
             Action = NonVisualDataModule.SelectiveToolbarTextAction
           end
+          object TBXItem272: TTBXItem
+            Action = NonVisualDataModule.LargerToolbarAction
+          end
         end
         object TBXSubmenuItem11: TTBXSubmenuItem
           Action = NonVisualDataModule.CommanderLocalPanelAction

+ 1 - 0
source/forms/ScpCommander.h

@@ -476,6 +476,7 @@ __published:
   TTBXItem *TBXItem270;
   TTBXSeparatorItem *TBXSeparatorItem76;
   TTBXItem *TBXItem271;
+  TTBXItem *TBXItem272;
   void __fastcall SplitterMoved(TObject *Sender);
   void __fastcall SplitterCanResize(TObject *Sender, int &NewSize,
     bool &Accept);

+ 3 - 0
source/forms/ScpExplorer.dfm

@@ -393,6 +393,9 @@ inherited ScpExplorerForm: TScpExplorerForm
           object TBXItem140: TTBXItem
             Action = NonVisualDataModule.SelectiveToolbarTextAction
           end
+          object TBXItem169: TTBXItem
+            Action = NonVisualDataModule.LargerToolbarAction
+          end
         end
         object SessionsTabs3: TTBXItem
           Action = NonVisualDataModule.SessionsTabsAction2

+ 1 - 0
source/forms/ScpExplorer.h

@@ -336,6 +336,7 @@ __published:
   TTBXSeparatorItem *TBXSeparatorItem51;
   TTBXItem *TBXItem115;
   TTBXItem *TBXItem266;
+  TTBXItem *TBXItem169;
   void __fastcall RemoteDirViewUpdateStatusBar(TObject *Sender,
           const TStatusFileInfo &FileInfo);
   void __fastcall UnixPathComboBoxBeginEdit(TTBEditItem *Sender,

+ 3 - 0
source/forms/SynchronizeProgress.cpp

@@ -10,6 +10,7 @@
 #include <TextsWin.h>
 #include <VCLCommon.h>
 #include <GUITools.h>
+#include <Progress.h>
 //---------------------------------------------------------------------------
 #pragma package(smart_init)
 #pragma link "PathLabel"
@@ -138,6 +139,8 @@ void __fastcall TSynchronizeProgressForm::UpdateControls()
   }
   TimeLeftLabel->Caption = TimeLeftCaption;
   CancelItem->Enabled = !FCanceled;
+
+  TProgressForm::SizeToolbar(this, Toolbar, Dock, ToolbarPanel);
 }
 //---------------------------------------------------------------------------
 void __fastcall TSynchronizeProgressForm::CancelOperation()

+ 1 - 0
source/packages/my/PasTools.pas

@@ -54,6 +54,7 @@ function LoadPixelsPerInch(S: string; Control: TControl): Integer;
 function SavePixelsPerInch(Control: TControl): string;
 function SaveDefaultPixelsPerInch: string;
 
+function CalculateTextHeight(Canvas: TCanvas): Integer;
 function ScaleByTextHeight(Control: TControl; Dimension: Integer): Integer;
 function ScaleByTextHeightRunTime(Control: TControl; Dimension: Integer): Integer;
 function ScaleByControlTextHeightRunTime(Canvas: TCanvas; Dimension: Integer): Integer;

+ 21 - 5
source/windows/GUITools.cpp

@@ -1103,7 +1103,7 @@ static void __fastcall DoSelectScaledImageList(TImageList * ImageList)
 {
   TImageList * MatchingList = NULL;
   int MachingPixelsPerInch = 0;
-  int PixelsPerInch = GetComponentPixelsPerInch(ImageList);
+  int PixelsPerInch = LargerPixelsPerInch(GetComponentPixelsPerInch(ImageList), WinConfiguration->LargerToolbar);
 
   for (int Index = 0; Index < ImageList->Owner->ComponentCount; Index++)
   {
@@ -1822,7 +1822,7 @@ static std::map<int, TPngImageList *> AnimationsImages;
 static std::map<int, TImageList *> ButtonImages;
 static std::map<int, TPngImageList *> DialogImages;
 //---------------------------------------------------------------------------
-int __fastcall NormalizePixelsPerInch(int PixelsPerInch)
+int __fastcall DoNormalizePixelsPerInch(int PixelsPerInch, bool Larger)
 {
   if (PixelsPerInch >= 192)
   {
@@ -1830,19 +1830,35 @@ int __fastcall NormalizePixelsPerInch(int PixelsPerInch)
   }
   else if (PixelsPerInch >= 144)
   {
-    PixelsPerInch = 144;
+    PixelsPerInch = Larger ? 192 : 144;
   }
   else if (PixelsPerInch >= 120)
   {
-    PixelsPerInch = 120;
+    PixelsPerInch = Larger ? 144 : 120;
   }
   else
   {
-    PixelsPerInch = 96;
+    PixelsPerInch = Larger ? 120 : 96;
   }
   return PixelsPerInch;
 }
 //---------------------------------------------------------------------------
+int NormalizePixelsPerInch(int PixelsPerInch)
+{
+  return DoNormalizePixelsPerInch(PixelsPerInch, false);
+}
+//---------------------------------------------------------------------------
+int LargerPixelsPerInch(int PixelsPerInch, int Larger)
+{
+  int Result = PixelsPerInch;
+  while (Larger > 0)
+  {
+    Result = DoNormalizePixelsPerInch(Result, true);
+    Larger--;
+  }
+  return Result;
+}
+//---------------------------------------------------------------------------
 static int __fastcall NeedImagesModule(TControl * Control)
 {
   int PixelsPerInch = NormalizePixelsPerInch(GetControlPixelsPerInch(Control));

+ 2 - 1
source/windows/GUITools.h

@@ -42,7 +42,8 @@ void __fastcall SelectScaledImageList(TImageList * ImageList);
 void __fastcall CopyImageList(TImageList * TargetList, TImageList * SourceList);
 void __fastcall LoadDialogImage(TImage * Image, const UnicodeString & ImageName);
 int __fastcall DialogImageSize(TForm * Form);
-int __fastcall NormalizePixelsPerInch(int PixelsPerInch);
+int NormalizePixelsPerInch(int PixelsPerInch);
+int LargerPixelsPerInch(int PixelsPerInch, int Larger);
 void __fastcall HideComponentsPanel(TForm * Form);
 struct TIncrementalSearchState
 {

+ 7 - 0
source/windows/WinConfiguration.cpp

@@ -587,6 +587,7 @@ void __fastcall TWinConfiguration::Default()
   FCopyParamAutoSelectNotice = true;
   FLockToolbars = false;
   FSelectiveToolbarText = true;
+  FLargerToolbar = 0;
   FAutoOpenInPutty = false;
   FRefreshRemotePanel = false;
   FRefreshRemotePanelInterval = TDateTime(0, 1, 0, 0);
@@ -1075,6 +1076,7 @@ THierarchicalStorage * TWinConfiguration::CreateScpStorage(bool & SessionList)
     KEY(Bool,     CopyParamAutoSelectNotice); \
     KEY(Bool,     LockToolbars); \
     KEY(Bool,     SelectiveToolbarText); \
+    KEY(Integer,  LargerToolbar); \
     KEY(Bool,     AutoOpenInPutty); \
     KEY(Bool,     RefreshRemotePanel); \
     KEY(DateTime, RefreshRemotePanelInterval); \
@@ -2318,6 +2320,11 @@ void __fastcall TWinConfiguration::SetSelectiveToolbarText(bool value)
   SET_CONFIG_PROPERTY(SelectiveToolbarText);
 }
 //---------------------------------------------------------------------------
+void TWinConfiguration::SetLargerToolbar(int value)
+{
+  SET_CONFIG_PROPERTY(LargerToolbar);
+}
+//---------------------------------------------------------------------------
 void __fastcall TWinConfiguration::SetAutoOpenInPutty(bool value)
 {
   SET_CONFIG_PROPERTY(AutoOpenInPutty);

+ 3 - 0
source/windows/WinConfiguration.h

@@ -441,6 +441,7 @@ private:
   bool FCopyParamAutoSelectNotice;
   bool FLockToolbars;
   bool FSelectiveToolbarText;
+  int FLargerToolbar;
   TEditorList * FEditorList;
   TEditorPreferences * FLegacyEditor;
   UnicodeString FDefaultKeyFile;
@@ -561,6 +562,7 @@ private:
   void __fastcall SetVersionHistory(UnicodeString value);
   void __fastcall SetLockToolbars(bool value);
   void __fastcall SetSelectiveToolbarText(bool value);
+  void SetLargerToolbar(int value);
   const TEditorList * __fastcall GetEditorList();
   void __fastcall SetEditorList(const TEditorList * value);
   void __fastcall SetAutoOpenInPutty(bool value);
@@ -772,6 +774,7 @@ public:
   __property bool CopyParamAutoSelectNotice = { read = FCopyParamAutoSelectNotice, write = SetCopyParamAutoSelectNotice };
   __property bool LockToolbars = { read = FLockToolbars, write = SetLockToolbars };
   __property bool SelectiveToolbarText = { read = FSelectiveToolbarText, write = SetSelectiveToolbarText };
+  __property int LargerToolbar = { read = FLargerToolbar, write = SetLargerToolbar };
   __property bool AutoOpenInPutty = { read = FAutoOpenInPutty, write = SetAutoOpenInPutty };
   __property bool RefreshRemotePanel = { read = FRefreshRemotePanel, write = SetRefreshRemotePanel };
   __property TDateTime RefreshRemotePanelInterval = { read = FRefreshRemotePanelInterval, write = SetRefreshRemotePanelInterval };