[FancyZones] Overlapping zones selection algorithm - settings (#9874)

* Started work

* Removed bools in favor of an enum, renamed some

* Done something but it still doesn't work

* Settings are now correctly saved

* I'm getting a crash, I need to rebuild from scratch

* Settings page looks alright

* Completed work. Unit tests?

* Use ComboBox instead

* Add telemetry

* Update text
This commit is contained in:
Ivan Stošić
2021-02-25 16:23:05 +01:00
committed by GitHub
parent 889360b5e4
commit f839a408de
15 changed files with 114 additions and 21 deletions

View File

@@ -32,6 +32,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
MoveWindowBasedOnPosition,
}
private enum OverlappingZonesAlgorithm
{
Smallest = 0,
Largest = 1,
Positional = 2,
}
public FancyZonesViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FancyZonesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
{
// To obtain the general settings configurations of PowerToys Settings.
@@ -58,6 +65,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
_overrideSnapHotkeys = Settings.Properties.FancyzonesOverrideSnapHotkeys.Value;
_moveWindowsAcrossMonitors = Settings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value;
_moveWindowBehaviour = Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value ? MoveWindowBehaviour.MoveWindowBasedOnPosition : MoveWindowBehaviour.MoveWindowBasedOnZoneIndex;
_overlappingZonesAlgorithm = (OverlappingZonesAlgorithm)Settings.Properties.FancyzonesOverlappingZonesAlgorithm.Value;
_displayChangemoveWindows = Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value;
_zoneSetChangeMoveWindows = Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value;
_appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value;
@@ -92,6 +100,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private bool _overrideSnapHotkeys;
private bool _moveWindowsAcrossMonitors;
private MoveWindowBehaviour _moveWindowBehaviour;
private OverlappingZonesAlgorithm _overlappingZonesAlgorithm;
private bool _displayChangemoveWindows;
private bool _zoneSetChangeMoveWindows;
private bool _appLastZoneMoveWindows;
@@ -257,6 +266,24 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public int OverlappingZonesAlgorithmIndex
{
get
{
return (int)_overlappingZonesAlgorithm;
}
set
{
if (value != (int)_overlappingZonesAlgorithm)
{
_overlappingZonesAlgorithm = (OverlappingZonesAlgorithm)value;
Settings.Properties.FancyzonesOverlappingZonesAlgorithm.Value = value;
NotifyPropertyChanged();
}
}
}
public bool DisplayChangeMoveWindows
{
get