[FancyZones] Split and reorganize FancyZonesData and JSON Helpers (#5028)

* Rename JsonHelpers to FancyZonesData
Add new JsonHelpers.[h|cpp] files

* Introduce FancyZonesDataTypes

* Move first part of JSON related stuff to JsonHelpers files

* Small refactor

* Move all json related stuff to JsonHelpers

* Minor refactoring

* Fix formating

* Remove GetPersistFancyZonesJSONPath() and GetPersistAppZoneHistoryFilePath()
Remove GetActiveZoneSetTmpPath(), GetDeletedCustomZoneSetsTmpPath and GetAppliedZoneSetTmpPath()
Simplify tests

* Address PR comment - Rename FancyZonesDataNS to FancyZonesData

* Address PR comment - Rename local var

* Delete obsolete stuff

* Remove double and uneeded includes
Introduce const non-localizable string variables
Address all othe PR comments

* Add comments to explain hardcoded values

* Remove FancyZonesData namespace

* Introduce const non-localizable string variables in FancyZonesDataTypes

* Add comments to explain FancyZonesData maps

Co-authored-by: Clint Rutkas <clint@rutkas.com>
This commit is contained in:
stefansjfw
2020-07-22 10:39:13 +02:00
committed by GitHub
parent 4f45cf1386
commit 0027a0af40
25 changed files with 1924 additions and 1934 deletions

View File

@@ -1,7 +1,11 @@
#pragma once
#include "Zone.h"
#include "JsonHelpers.h"
namespace FancyZonesDataTypes
{
enum class ZoneSetLayoutType;
}
/**
* Class representing single zone layout. ZoneSet is responsible for actual calculation of rectangle coordinates
@@ -16,7 +20,7 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
/**
* @returns Type of the zone layout. Layout type can be focus, columns, rows, grid, priority grid or custom.
*/
IFACEMETHOD_(JSONHelpers::ZoneSetLayoutType, LayoutType)() = 0;
IFACEMETHOD_(FancyZonesDataTypes::ZoneSetLayoutType, LayoutType)() = 0;
/**
* Add zone to the zone layout.
*
@@ -102,23 +106,11 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
IFACEMETHOD_(bool, IsZoneEmpty)(int zoneIndex) = 0;
};
#define VERSION_PERSISTEDDATA 0x0000F00D
struct ZoneSetPersistedData
{
static constexpr inline size_t MAX_ZONES = 40;
DWORD Version{VERSION_PERSISTEDDATA};
WORD LayoutId{};
DWORD ZoneCount{};
JSONHelpers::ZoneSetLayoutType Layout{};
RECT Zones[MAX_ZONES]{};
};
struct ZoneSetConfig
{
ZoneSetConfig(
GUID id,
JSONHelpers::ZoneSetLayoutType layoutType,
FancyZonesDataTypes::ZoneSetLayoutType layoutType,
HMONITOR monitor,
PCWSTR resolutionKey) noexcept :
Id(id),
@@ -129,7 +121,7 @@ struct ZoneSetConfig
}
GUID Id{};
JSONHelpers::ZoneSetLayoutType LayoutType{};
FancyZonesDataTypes::ZoneSetLayoutType LayoutType{};
HMONITOR Monitor{};
PCWSTR ResolutionKey{};
};