[FancyZones] Configurable sensitivity radius (#6554)

* Add the setting for the Sensitivity Radius to JSON and the Editor
Use the setting when determining Zones to highligh

* Fix FanzyZones unit tests
Add test for Json upgrade

* Updated texts in FancyZone Editor
More Text to Resources / Use Resources

* Added constant for default of Sensitivity Radius

* When installing from scratch of when a new device is added set the sensitivity radius to the default.
Move all the constant values to a single namespace

* restore correct formatting

Co-authored-by: Remy Blok <remy.blok@prodware.nl>
This commit is contained in:
Remy Blok
2020-09-18 09:16:06 +02:00
committed by GitHub
parent 00187269de
commit 7893f387d5
15 changed files with 341 additions and 276 deletions

View File

@@ -1,6 +1,7 @@
#include "pch.h"
#include "JsonHelpers.h"
#include "FancyZonesData.h"
#include "FancyZonesDataTypes.h"
#include "trace.h"
#include "util.h"
@@ -27,6 +28,7 @@ namespace NonLocalizable
const wchar_t EditorShowSpacingStr[] = L"editor-show-spacing";
const wchar_t EditorSpacingStr[] = L"editor-spacing";
const wchar_t EditorZoneCountStr[] = L"editor-zone-count";
const wchar_t EditorSensitivityRadiusStr[] = L"editor-sensitivity-radius";
const wchar_t GridStr[] = L"grid";
const wchar_t HeightStr[] = L"height";
const wchar_t HistoryStr[] = L"history";
@@ -404,6 +406,7 @@ namespace JSONHelpers
result.SetNamedValue(NonLocalizable::EditorShowSpacingStr, json::value(device.data.showSpacing));
result.SetNamedValue(NonLocalizable::EditorSpacingStr, json::value(device.data.spacing));
result.SetNamedValue(NonLocalizable::EditorZoneCountStr, json::value(device.data.zoneCount));
result.SetNamedValue(NonLocalizable::EditorSensitivityRadiusStr, json::value(device.data.sensitivityRadius));
return result;
}
@@ -431,8 +434,8 @@ namespace JSONHelpers
result.data.showSpacing = device.GetNamedBoolean(NonLocalizable::EditorShowSpacingStr);
result.data.spacing = static_cast<int>(device.GetNamedNumber(NonLocalizable::EditorSpacingStr));
result.data.zoneCount = static_cast<int>(
device.GetNamedNumber(NonLocalizable::EditorZoneCountStr));
result.data.zoneCount = static_cast<int>(device.GetNamedNumber(NonLocalizable::EditorZoneCountStr));
result.data.sensitivityRadius = static_cast<int>(device.GetNamedNumber(NonLocalizable::EditorSensitivityRadiusStr, DefaultValues::SensitivityRadius));
return result;
}