[Monaco]Make minimap toggleable (#33742)

This commit is contained in:
PesBandi
2025-01-14 12:47:53 +01:00
committed by GitHub
parent f11c885184
commit 80461c0241
16 changed files with 144 additions and 34 deletions

View File

@@ -21,12 +21,15 @@ namespace Settings.UI.Library
public BoolProperty SourceCodeStickyScroll { get; set; }
public BoolProperty SourceCodeMinimap { get; set; }
public PeekPreviewSettings()
{
SourceCodeWrapText = new BoolProperty(false);
SourceCodeTryFormat = new BoolProperty(false);
SourceCodeFontSize = new IntProperty(14);
SourceCodeStickyScroll = new BoolProperty(true);
SourceCodeMinimap = new BoolProperty(false);
}
public string ToJsonString()

View File

@@ -155,6 +155,23 @@ namespace Microsoft.PowerToys.Settings.UI.Library
}
}
private bool monacoPreviewMinimap;
[JsonPropertyName("monaco-previewer-minimap")]
[JsonConverter(typeof(BoolPropertyJsonConverter))]
public bool MonacoPreviewMinimap
{
get => monacoPreviewMinimap;
set
{
if (value != monacoPreviewMinimap)
{
LogTelemetryEvent(value);
monacoPreviewMinimap = value;
}
}
}
private bool enablePdfPreview;
[JsonPropertyName("pdf-previewer-toggle-setting")]

View File

@@ -66,6 +66,9 @@
<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>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
<CheckBox x:Uid="Peek_SourceCode_Minimap" IsChecked="{x:Bind ViewModel.SourceCodeMinimap, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>
</controls:SettingsGroup>

View File

@@ -103,6 +103,12 @@
IsChecked="{x:Bind ViewModel.MonacoPreviewStickyScroll, Mode=TwoWay}"
IsEnabled="{x:Bind ViewModel.MonacoRenderIsEnabled, Mode=OneWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.MonacoRenderIsEnabled, Mode=OneWay}">
<CheckBox
x:Uid="FileExplorerPreview_ToggleSwitch_Monaco_Minimap"
IsChecked="{x:Bind ViewModel.MonacoPreviewMinimap, Mode=TwoWay}"
IsEnabled="{x:Bind ViewModel.MonacoRenderIsEnabled, Mode=OneWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>

View File

@@ -4405,6 +4405,9 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="Peek_SourceCode_WrapText.Content" xml:space="preserve">
<value>Wrap text</value>
</data>
<data name="Peek_SourceCode_Minimap.Content" xml:space="preserve">
<value>Show minimap</value>
</data>
<data name="ShowPluginsOverview_All.Content" xml:space="preserve">
<value>All</value>
</data>
@@ -4451,6 +4454,9 @@ 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_ToggleSwitch_Monaco_Minimap.Content" xml:space="preserve">
<value>Show minimap</value>
</data>
<data name="PrivacyLink.Text" xml:space="preserve">
<value>OpenAI Privacy</value>
</data>

View File

@@ -202,6 +202,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool SourceCodeMinimap
{
get => _peekPreviewSettings.SourceCodeMinimap.Value;
set
{
if (_peekPreviewSettings.SourceCodeMinimap.Value != value)
{
_peekPreviewSettings.SourceCodeMinimap.Value = value;
OnPropertyChanged(nameof(SourceCodeMinimap));
SavePreviewSettings();
}
}
}
private void NotifySettingsChanged()
{
// Using InvariantCulture as this is an IPC message

View File

@@ -95,6 +95,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_monacoMaxFileSize = Settings.Properties.MonacoPreviewMaxFileSize.Value;
_monacoFontSize = Settings.Properties.MonacoPreviewFontSize.Value;
_monacoStickyScroll = Settings.Properties.MonacoPreviewStickyScroll;
_monacoMinimap = Settings.Properties.MonacoPreviewMinimap;
_pdfRenderEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredPdfPreviewEnabledValue();
if (_pdfRenderEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _pdfRenderEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
@@ -236,6 +237,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private int _monacoMaxFileSize;
private bool _monacoStickyScroll;
private int _monacoFontSize;
private bool _monacoMinimap;
private GpoRuleConfigured _pdfRenderEnabledGpoRuleConfiguration;
private bool _pdfRenderEnabledStateIsGPOConfigured;
@@ -618,6 +620,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool MonacoPreviewMinimap
{
get => _monacoMinimap;
set
{
if (_monacoMinimap != value)
{
_monacoMinimap = value;
Settings.Properties.MonacoPreviewMinimap = value;
RaisePropertyChanged();
}
}
}
public int MonacoPreviewFontSize
{
get