mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
[Monaco]Add option to set font size (#32559)
* Add setting to enable/disable it and add Peek support * Add ability to set font size
This commit is contained in:
committed by
GitHub
parent
5b4da37a43
commit
d9008186cf
@@ -16,12 +16,15 @@ namespace Settings.UI.Library
|
||||
|
||||
public BoolProperty SourceCodeTryFormat { get; set; }
|
||||
|
||||
public IntProperty SourceCodeFontSize { get; set; }
|
||||
|
||||
public BoolProperty SourceCodeStickyScroll { get; set; }
|
||||
|
||||
public PeekPreviewSettings()
|
||||
{
|
||||
SourceCodeWrapText = new BoolProperty(false);
|
||||
SourceCodeTryFormat = new BoolProperty(false);
|
||||
SourceCodeFontSize = new IntProperty(14);
|
||||
SourceCodeStickyScroll = new BoolProperty(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public const string DefaultStlThumbnailColor = "#FFC924";
|
||||
public const int DefaultMonacoMaxFileSize = 50;
|
||||
public const int DefaultMonacoFontSize = 14;
|
||||
public const int DefaultSvgBackgroundColorMode = (int)SvgPreviewColorMode.Default;
|
||||
public const string DefaultSvgBackgroundSolidColor = "#FFFFFF";
|
||||
public const int DefaultSvgBackgroundCheckeredShade = (int)SvgPreviewCheckeredShade.Light;
|
||||
@@ -133,6 +134,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("monaco-previewer-max-file-size")]
|
||||
public IntProperty MonacoPreviewMaxFileSize { get; set; }
|
||||
|
||||
[JsonPropertyName("monaco-previewer-font-size")]
|
||||
public IntProperty MonacoPreviewFontSize { get; set; }
|
||||
|
||||
private bool monacoPreviewStickyScroll = true;
|
||||
|
||||
[JsonPropertyName("monaco-previewer-sticky-scroll")]
|
||||
@@ -279,6 +283,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
SvgBackgroundCheckeredShade = new IntProperty(DefaultSvgBackgroundCheckeredShade);
|
||||
StlThumbnailColor = new StringProperty(DefaultStlThumbnailColor);
|
||||
MonacoPreviewMaxFileSize = new IntProperty(DefaultMonacoMaxFileSize);
|
||||
MonacoPreviewFontSize = new IntProperty(DefaultMonacoFontSize);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@@ -55,6 +55,14 @@
|
||||
IsChecked="{x:Bind ViewModel.SourceCodeTryFormat, Mode=TwoWay}"
|
||||
IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="Peek_SourceCode_FontSize" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
Maximum="100"
|
||||
Minimum="2"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.SourceCodeFontSize, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<CheckBox x:Uid="Peek_SourceCode_StickyScroll" IsChecked="{x:Bind ViewModel.SourceCodeStickyScroll, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
@@ -89,6 +89,14 @@
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.MonacoPreviewMaxFileSize, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="FileExplorerPreview_Toggle_Monaco_Font_Size" IsEnabled="{x:Bind ViewModel.MonacoRenderIsEnabled, Mode=OneWay}">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
Maximum="100"
|
||||
Minimum="2"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.MonacoPreviewFontSize, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.MonacoRenderIsEnabled, Mode=OneWay}">
|
||||
<CheckBox
|
||||
x:Uid="FileExplorerPreview_ToggleSwitch_Monaco_Sticky_Scroll"
|
||||
|
||||
@@ -4068,4 +4068,18 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="Peek_SourceCode_StickyScroll.Content" xml:space="preserve">
|
||||
<value>Enable sticky scroll</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_Toggle_Monaco_Font_Size.Description" xml:space="preserve">
|
||||
<value>Font size of the editor in pt. Recommended: 14pt</value>
|
||||
<comment>{Locked="pt"}</comment>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_Toggle_Monaco_Font_Size.Header" xml:space="preserve">
|
||||
<value>Font size </value>
|
||||
</data>
|
||||
<data name="Peek_SourceCode_FontSize.Description" xml:space="preserve">
|
||||
<value>Font size of the editor in pt. Recommended: 14pt</value>
|
||||
<comment>{Locked="pt"}</comment>
|
||||
</data>
|
||||
<data name="Peek_SourceCode_FontSize.Header" xml:space="preserve">
|
||||
<value>Font size</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -173,6 +173,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public int SourceCodeFontSize
|
||||
{
|
||||
get => _peekPreviewSettings.SourceCodeFontSize.Value;
|
||||
set
|
||||
{
|
||||
if (_peekPreviewSettings.SourceCodeFontSize.Value != value)
|
||||
{
|
||||
_peekPreviewSettings.SourceCodeFontSize.Value = value;
|
||||
OnPropertyChanged(nameof(SourceCodeFontSize));
|
||||
SavePreviewSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool SourceCodeStickyScroll
|
||||
{
|
||||
get => _peekPreviewSettings.SourceCodeStickyScroll.Value;
|
||||
|
||||
@@ -92,6 +92,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_monacoWrapText = Settings.Properties.EnableMonacoPreviewWordWrap;
|
||||
_monacoPreviewTryFormat = Settings.Properties.MonacoPreviewTryFormat;
|
||||
_monacoMaxFileSize = Settings.Properties.MonacoPreviewMaxFileSize.Value;
|
||||
_monacoFontSize = Settings.Properties.MonacoPreviewFontSize.Value;
|
||||
_monacoStickyScroll = Settings.Properties.MonacoPreviewStickyScroll;
|
||||
|
||||
_pdfRenderEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredPdfPreviewEnabledValue();
|
||||
@@ -233,6 +234,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private bool _monacoPreviewTryFormat;
|
||||
private int _monacoMaxFileSize;
|
||||
private bool _monacoStickyScroll;
|
||||
private int _monacoFontSize;
|
||||
|
||||
private GpoRuleConfigured _pdfRenderEnabledGpoRuleConfiguration;
|
||||
private bool _pdfRenderEnabledStateIsGPOConfigured;
|
||||
@@ -615,6 +617,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public int MonacoPreviewFontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return _monacoFontSize;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_monacoFontSize != value)
|
||||
{
|
||||
_monacoFontSize = value;
|
||||
Settings.Properties.MonacoPreviewFontSize.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool PDFRenderIsEnabled
|
||||
{
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user