diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index d60e868e..fdd0b8aa 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -478,6 +478,7 @@ Open Preferences dialog Show workspace dropdown menu Switch active tab + Zoom in/out REPOSITORY Commit staged changes Commit and push staged changes diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 8edb058b..148369dc 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -482,6 +482,7 @@ 打开偏好设置面板 显示工作区下拉菜单 切换显示页面 + 缩放内容 仓库页面快捷键 提交暂存区更改 提交暂存区更改并推送 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index a2a4443c..4e300af3 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -482,6 +482,7 @@ 開啟偏好設定面板 顯示工作區的下拉式選單 切換目前頁面 + 放大/縮小內容 存放庫頁面快速鍵 提交暫存區變更 提交暫存區變更並推送 diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index 2fc35091..0cfa642c 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -34,13 +34,20 @@ ClipToBounds="True"> - - - + + + + + + + + + @@ -129,13 +136,20 @@ BorderThickness="1" CornerRadius="{TemplateBinding CornerRadius}"> - - - + + + + + + + + + diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs index 564d415b..6c39df0e 100644 --- a/src/ViewModels/Preferences.cs +++ b/src/ViewModels/Preferences.cs @@ -104,6 +104,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _editorTabWidth, value); } + public double Zoom + { + get => _zoom; + set => SetProperty(ref _zoom, value); + } + public LayoutInfo Layout { get => _layout; @@ -770,6 +776,7 @@ namespace SourceGit.ViewModels private double _defaultFontSize = 13; private double _editorFontSize = 13; private int _editorTabWidth = 4; + private double _zoom = 1.0; private LayoutInfo _layout = new(); private int _maxHistoryCommits = 20000; diff --git a/src/Views/ChromelessWindow.cs b/src/Views/ChromelessWindow.cs index 9192cd74..2952b2a5 100644 --- a/src/Views/ChromelessWindow.cs +++ b/src/Views/ChromelessWindow.cs @@ -97,10 +97,30 @@ namespace SourceGit.Views { base.OnKeyDown(e); - if (e is { Handled: false, Key: Key.Escape, KeyModifiers: KeyModifiers.None } && CloseOnESC) + if (e.Handled) + return; + + if (e is { Key: Key.Escape, KeyModifiers: KeyModifiers.None } && CloseOnESC) { Close(); e.Handled = true; + return; + } + + if (e.KeyModifiers == (OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control)) + { + if (e.Key == Key.OemPlus) + { + var zoom = Math.Min(ViewModels.Preferences.Instance.Zoom + 0.05, 2.5); + ViewModels.Preferences.Instance.Zoom = zoom; + e.Handled = true; + } + else if (e.Key == Key.OemMinus) + { + var zoom = Math.Max(ViewModels.Preferences.Instance.Zoom - 0.05, 1); + ViewModels.Preferences.Instance.Zoom = zoom; + e.Handled = true; + } } } diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index 5a8bf5e9..f077b1f6 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -45,7 +45,7 @@ FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}" Margin="0,0,0,8"/> - + @@ -70,8 +70,11 @@ - - + + + + +