mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-08 04:17:55 +08:00
646d61bd4d
* Removed MetroWindow, added theming support and modernWPF * Rmoved MahApps refs * Removed MahApps * Updated canvas zones * Updated GridEditor * Fixes * UI updates * New layout type selection dialog * New editor UI * Updates * Fix * UI enhancements * Updated UI * Added styles to layoutpreview * Accesibility improvements * Accesibility and styling improvements * Fix * Cleaned up brushes * Updated UX * Updated UI * Added no layouts description * Fix * UI fixes * [FZ Editor] Serialize/deserialize settings (#8615) * conflicts fix * [FZ Editor] Parse json file instead of command line args (#8649) * [FZ Editor] Serialize/deserialize settings fix (#8707) * [FZ Editor] Hide unsupported settings in custom layouts flyouts (#8716) * [FZ Editor] Duplicate custom layouts (#8718) * [FZ Editor] Duplicate layout behavior (#8720) * New UX proposal * Updated spacing * Switching to toggleswitches * Revert toggleswitch * Updated colorbrush * Updated string for saving label * Updated UI * Dark theme color fixes * Removed space * [FZ Editor] Bind dialog properties (#9199) * Resize editor window to fit the content in single-monitor mode (#9203) * Editor opening fix (#9207) * Disable "Create" button if the Name textbox is empty (#9212) * [FZ Editor] Changed edit dialog for template layouts. (#9233) * [FZ Editor] Small fixes and refactoring. (#9236) * new layout creation refactoring * "Save and apply" applies the layout * number of zones header hide * [FZ Editor] Empty layout template. (#9237) * [FZ Editor] Move "Duplicate" and "Delete" buttons to the Edit dialog. (#9272) * [FZ Editor] Preview the applied layout after editing another layout. (#9278) * Fixed "Save and apply" button behavior (#9286) * [FZ Editor] Save template layouts in the settings. (#9283) * Added default custom layout name (#9291) * close dialog before opening zones editor (#9302) * Pressing Esc closes dialogs (#9301) * [FZ Editor] Reset applied layout to "No layout" if it was deleted. (#9315) * [FZ Editor] Dark theme colors (#9317) * "Number of zones" buttons colors. (#9321) * rebase fix * added ModernWpf.dll * address PR comments: updated colors * added comments, replaced magic numbers * refactoring * merge zones crash fix * removed redundant using directive Co-authored-by: Niels Laute <niels9001@hotmail.com> Co-authored-by: Niels Laute <niels.laute@live.nl>
96 lines
3.4 KiB
C++
96 lines
3.4 KiB
C++
#pragma once
|
|
|
|
#include "FancyZonesDataTypes.h"
|
|
|
|
#include <common/utils/json.h>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <unordered_map>
|
|
|
|
namespace JSONHelpers
|
|
{
|
|
namespace CanvasLayoutInfoJSON
|
|
{
|
|
json::JsonObject ToJson(const FancyZonesDataTypes::CanvasLayoutInfo& canvasInfo);
|
|
std::optional<FancyZonesDataTypes::CanvasLayoutInfo> FromJson(const json::JsonObject& infoJson);
|
|
}
|
|
|
|
namespace GridLayoutInfoJSON
|
|
{
|
|
json::JsonObject ToJson(const FancyZonesDataTypes::GridLayoutInfo& gridInfo);
|
|
std::optional<FancyZonesDataTypes::GridLayoutInfo> FromJson(const json::JsonObject& infoJson);
|
|
}
|
|
|
|
struct CustomZoneSetJSON
|
|
{
|
|
std::wstring uuid;
|
|
FancyZonesDataTypes::CustomZoneSetData data;
|
|
|
|
static json::JsonObject ToJson(const CustomZoneSetJSON& device);
|
|
static std::optional<CustomZoneSetJSON> FromJson(const json::JsonObject& customZoneSet);
|
|
};
|
|
|
|
namespace ZoneSetDataJSON
|
|
{
|
|
json::JsonObject ToJson(const FancyZonesDataTypes::ZoneSetData& zoneSet);
|
|
std::optional<FancyZonesDataTypes::ZoneSetData> FromJson(const json::JsonObject& zoneSet);
|
|
};
|
|
|
|
struct AppZoneHistoryJSON
|
|
{
|
|
std::wstring appPath;
|
|
std::vector<FancyZonesDataTypes::AppZoneHistoryData> data;
|
|
|
|
static json::JsonObject ToJson(const AppZoneHistoryJSON& appZoneHistory);
|
|
static std::optional<AppZoneHistoryJSON> FromJson(const json::JsonObject& zoneSet);
|
|
};
|
|
|
|
struct DeviceInfoJSON
|
|
{
|
|
std::wstring deviceId;
|
|
FancyZonesDataTypes::DeviceInfoData data;
|
|
|
|
static json::JsonObject ToJson(const DeviceInfoJSON& device);
|
|
static std::optional<DeviceInfoJSON> FromJson(const json::JsonObject& device);
|
|
};
|
|
|
|
using TAppZoneHistoryMap = std::unordered_map<std::wstring, std::vector<FancyZonesDataTypes::AppZoneHistoryData>>;
|
|
using TDeviceInfoMap = std::unordered_map<std::wstring, FancyZonesDataTypes::DeviceInfoData>;
|
|
using TCustomZoneSetsMap = std::unordered_map<std::wstring, FancyZonesDataTypes::CustomZoneSetData>;
|
|
|
|
struct MonitorInfo
|
|
{
|
|
int dpi;
|
|
std::wstring id;
|
|
int top;
|
|
int left;
|
|
bool isSelected = false;
|
|
|
|
static json::JsonObject ToJson(const MonitorInfo& monitor);
|
|
};
|
|
|
|
struct EditorArgs
|
|
{
|
|
DWORD processId;
|
|
bool spanZonesAcrossMonitors;
|
|
std::vector<MonitorInfo> monitors;
|
|
|
|
static json::JsonObject ToJson(const EditorArgs& args);
|
|
};
|
|
|
|
json::JsonObject GetPersistFancyZonesJSON(const std::wstring& zonesSettingsFileName, const std::wstring& appZoneHistoryFileName);
|
|
|
|
void SaveZoneSettings(const std::wstring& zonesSettingsFileName, const TDeviceInfoMap& deviceInfoMap, const TCustomZoneSetsMap& customZoneSetsMap);
|
|
void SaveAppZoneHistory(const std::wstring& appZoneHistoryFileName, const TAppZoneHistoryMap& appZoneHistoryMap);
|
|
|
|
TAppZoneHistoryMap ParseAppZoneHistory(const json::JsonObject& fancyZonesDataJSON);
|
|
json::JsonArray SerializeAppZoneHistory(const TAppZoneHistoryMap& appZoneHistoryMap);
|
|
|
|
TDeviceInfoMap ParseDeviceInfos(const json::JsonObject& fancyZonesDataJSON);
|
|
json::JsonArray SerializeDeviceInfos(const TDeviceInfoMap& deviceInfoMap);
|
|
|
|
TCustomZoneSetsMap ParseCustomZoneSets(const json::JsonObject& fancyZonesDataJSON);
|
|
json::JsonArray SerializeCustomZoneSets(const TCustomZoneSetsMap& customZoneSetsMap);
|
|
}
|