From f063f42ed7e23ea77628c6c1a7b05a663bfcac9b Mon Sep 17 00:00:00 2001 From: Seraphima Zykova Date: Wed, 17 Mar 2021 15:39:50 +0300 Subject: [PATCH] [FZ Settings] Options for layout quick swap (#10265) --- .github/actions/spell-check/expect.txt | 2 + src/modules/fancyzones/lib/Resources.resx | 6 +++ src/modules/fancyzones/lib/Settings.cpp | 6 ++- src/modules/fancyzones/lib/Settings.h | 2 + .../tests/UnitTests/FancyZones.Spec.cpp | 4 ++ .../ConfigDefaults.cs | 2 + .../FZConfigProperties.cs | 8 +++ .../ViewModels/FancyZonesViewModel.cs | 50 +++++++++++++++++++ .../Strings/en-us/Resources.resw | 9 ++++ .../Views/FancyZonesPage.xaml | 14 ++++++ 10 files changed, 102 insertions(+), 1 deletion(-) diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index e87682e2a391..8a4cb9032185 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -714,6 +714,7 @@ finalizer findstr FIXEDFILEINFO FLASHZONES +FLASHZONESONQUICKSWITCH Fle fluentui flyout @@ -1685,6 +1686,7 @@ Queryable QUERYENDSESSION QUERYOPEN QUEUESYNC +QUICKLAYOUTSWITCH qwertyuiopasdfghjklzxcvbnm qword qwrtyuiopsghjklzxvnm diff --git a/src/modules/fancyzones/lib/Resources.resx b/src/modules/fancyzones/lib/Resources.resx index 641609a08e17..f0dff6271a1d 100644 --- a/src/modules/fancyzones/lib/Resources.resx +++ b/src/modules/fancyzones/lib/Resources.resx @@ -247,4 +247,10 @@ Failed to save the FancyZones settings. Please retry again later, if the problem persists report the bug to "Report bug to" will have a URL after. FancyZone is a product name, keep as is. + + Enable quick layout switch + + + Flash zones when switching layout + \ No newline at end of file diff --git a/src/modules/fancyzones/lib/Settings.cpp b/src/modules/fancyzones/lib/Settings.cpp index 137d81357904..111a50c3170f 100644 --- a/src/modules/fancyzones/lib/Settings.cpp +++ b/src/modules/fancyzones/lib/Settings.cpp @@ -21,6 +21,8 @@ namespace NonLocalizable const wchar_t AppLastZoneMoveWindowsID[] = L"fancyzones_appLastZone_moveWindows"; const wchar_t OpenWindowOnActiveMonitorID[] = L"fancyzones_openWindowOnActiveMonitor"; const wchar_t RestoreSizeID[] = L"fancyzones_restoreSize"; + const wchar_t QuickLayoutSwitch[] = L"fancyzones_quickLayoutSwitch"; + const wchar_t FlashZonesOnQuickSwitch[] = L"fancyzones_flashZonesOnQuickSwitch"; const wchar_t UseCursorPosEditorStartupScreenID[] = L"use_cursorpos_editor_startupscreen"; const wchar_t ShowOnAllMonitorsID[] = L"fancyzones_show_on_all_monitors"; const wchar_t SpanZonesAcrossMonitorsID[] = L"fancyzones_span_zones_across_monitors"; @@ -80,7 +82,7 @@ struct FancyZonesSettings : winrt::implements settingsReposito _appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value; _openWindowOnActiveMonitor = Settings.Properties.FancyzonesOpenWindowOnActiveMonitor.Value; _restoreSize = Settings.Properties.FancyzonesRestoreSize.Value; + _quickLayoutSwitch = Settings.Properties.FancyzonesQuickLayoutSwitch.Value; + _flashZonesOnQuickLayoutSwitch = Settings.Properties.FancyzonesFlashZonesOnQuickSwitch.Value; _useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value; _showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value; _spanZonesAcrossMonitors = Settings.Properties.FancyzonesSpanZonesAcrossMonitors.Value; @@ -107,6 +109,8 @@ public FancyZonesViewModel(ISettingsRepository settingsReposito private bool _openWindowOnActiveMonitor; private bool _spanZonesAcrossMonitors; private bool _restoreSize; + private bool _quickLayoutSwitch; + private bool _flashZonesOnQuickLayoutSwitch; private bool _useCursorPosEditorStartupScreen; private bool _showOnAllMonitors; private bool _makeDraggedWindowTransparent; @@ -138,6 +142,7 @@ public bool IsEnabled SendConfigMSG(snd.ToString()); OnPropertyChanged(nameof(IsEnabled)); OnPropertyChanged(nameof(SnapHotkeysCategoryEnabled)); + OnPropertyChanged(nameof(QuickSwitchEnabled)); } } } @@ -150,6 +155,14 @@ public bool SnapHotkeysCategoryEnabled } } + public bool QuickSwitchEnabled + { + get + { + return _isEnabled && _quickLayoutSwitch; + } + } + public bool ShiftDrag { get @@ -374,6 +387,43 @@ public bool RestoreSize } } + public bool QuickLayoutSwitch + { + get + { + return _quickLayoutSwitch; + } + + set + { + if (value != _quickLayoutSwitch) + { + _quickLayoutSwitch = value; + Settings.Properties.FancyzonesQuickLayoutSwitch.Value = value; + NotifyPropertyChanged(); + OnPropertyChanged(nameof(QuickSwitchEnabled)); + } + } + } + + public bool FlashZonesOnQuickSwitch + { + get + { + return _flashZonesOnQuickLayoutSwitch; + } + + set + { + if (value != _flashZonesOnQuickLayoutSwitch) + { + _flashZonesOnQuickLayoutSwitch = value; + Settings.Properties.FancyzonesFlashZonesOnQuickSwitch.Value = value; + NotifyPropertyChanged(); + } + } + } + public bool UseCursorPosEditorStartupScreen { get diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw index 9cc66b5d461d..e8a429e8f0c5 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw @@ -1176,4 +1176,13 @@ Win + Shift + O to toggle your video Move the color up + + Flash zones when switching layout + + + Enable quick layout switch + + + Quick layout switch + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml index f20aa59cde27..a72cec950835 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml @@ -189,6 +189,20 @@ IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> + + + + + +