2019-09-04 18:26:26 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-02-23 17:25:28 +03:00
|
|
|
#include <unordered_set>
|
|
|
|
|
|
|
|
|
|
#include <common/SettingsAPI/settings_helpers.h>
|
2020-12-15 15:16:09 +03:00
|
|
|
#include <common/SettingsAPI/settings_objects.h>
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2022-02-23 17:25:28 +03:00
|
|
|
#include <FancyZonesLib/ModuleConstants.h>
|
|
|
|
|
#include <FancyZonesLib/SettingsConstants.h>
|
|
|
|
|
|
|
|
|
|
class SettingsObserver;
|
|
|
|
|
class FileWatcher;
|
|
|
|
|
|
2021-07-07 13:18:52 +03:00
|
|
|
enum struct OverlappingZonesAlgorithm : int
|
|
|
|
|
{
|
|
|
|
|
Smallest = 0,
|
|
|
|
|
Largest = 1,
|
|
|
|
|
Positional = 2,
|
|
|
|
|
ClosestCenter = 3,
|
|
|
|
|
EnumElements = 4, // number of elements in the enum, not counting this
|
|
|
|
|
};
|
|
|
|
|
|
2021-12-15 12:56:52 +01:00
|
|
|
// in reality, this file needs to be kept in sync currently with src/settings-ui/Settings.UI.Library/FZConfigProperties.cs
|
2019-09-04 18:26:26 +02:00
|
|
|
struct Settings
|
|
|
|
|
{
|
|
|
|
|
// The values specified here are the defaults.
|
|
|
|
|
bool shiftDrag = true;
|
2020-05-07 02:21:32 +03:00
|
|
|
bool mouseSwitch = false;
|
2019-09-04 18:26:26 +02:00
|
|
|
bool displayChange_moveWindows = false;
|
2019-09-11 21:11:55 +02:00
|
|
|
bool zoneSetChange_flashZones = false;
|
2019-09-04 18:26:26 +02:00
|
|
|
bool zoneSetChange_moveWindows = false;
|
|
|
|
|
bool overrideSnapHotkeys = false;
|
2020-05-01 16:17:16 +02:00
|
|
|
bool moveWindowAcrossMonitors = false;
|
2020-08-21 12:53:03 +02:00
|
|
|
bool moveWindowsBasedOnPosition = false;
|
2019-09-04 18:26:26 +02:00
|
|
|
bool appLastZone_moveWindows = false;
|
2020-07-08 10:37:42 +02:00
|
|
|
bool openWindowOnActiveMonitor = false;
|
2020-07-01 15:36:05 +02:00
|
|
|
bool restoreSize = false;
|
2021-03-25 15:44:55 +03:00
|
|
|
bool quickLayoutSwitch = true;
|
|
|
|
|
bool flashZonesOnQuickSwitch = true;
|
2019-09-28 15:29:29 +01:00
|
|
|
bool use_cursorpos_editor_startupscreen = true;
|
2020-03-13 15:56:23 +01:00
|
|
|
bool showZonesOnAllMonitors = false;
|
2020-08-07 10:06:25 +02:00
|
|
|
bool spanZonesAcrossMonitors = false;
|
2020-03-25 15:38:44 +01:00
|
|
|
bool makeDraggedWindowTransparent = true;
|
2021-11-04 15:30:06 +01:00
|
|
|
bool systemTheme = true;
|
2021-12-20 17:50:51 +01:00
|
|
|
bool showZoneNumber = true;
|
2022-02-23 17:25:28 +03:00
|
|
|
bool allowSnapPopupWindows = false;
|
|
|
|
|
bool allowSnapChildWindows = false;
|
2022-04-01 18:28:19 +02:00
|
|
|
bool disableRoundCorners = false;
|
2020-10-15 17:08:55 +02:00
|
|
|
std::wstring zoneColor = L"#AACDFF";
|
2020-03-25 15:38:44 +01:00
|
|
|
std::wstring zoneBorderColor = L"#FFFFFF";
|
2020-05-27 10:55:46 -04:00
|
|
|
std::wstring zoneHighlightColor = L"#008CFF";
|
2021-12-20 17:50:51 +01:00
|
|
|
std::wstring zoneNumberColor = L"#000000";
|
2020-03-25 15:38:44 +01:00
|
|
|
int zoneHighlightOpacity = 50;
|
2021-02-25 16:23:05 +01:00
|
|
|
OverlappingZonesAlgorithm overlappingZonesAlgorithm = OverlappingZonesAlgorithm::Smallest;
|
2021-04-15 02:11:08 -07:00
|
|
|
PowerToysSettings::HotkeyObject editorHotkey = PowerToysSettings::HotkeyObject::from_settings(true, false, false, true, VK_OEM_3);
|
2021-11-03 17:11:42 +02:00
|
|
|
bool windowSwitching = true;
|
|
|
|
|
PowerToysSettings::HotkeyObject nextTabHotkey = PowerToysSettings::HotkeyObject::from_settings(true, false, false, false, VK_NEXT);
|
|
|
|
|
PowerToysSettings::HotkeyObject prevTabHotkey = PowerToysSettings::HotkeyObject::from_settings(true, false, false, false, VK_PRIOR);
|
2019-11-18 10:29:56 +01:00
|
|
|
std::wstring excludedApps = L"";
|
|
|
|
|
std::vector<std::wstring> excludedAppsArray;
|
2019-09-04 18:26:26 +02:00
|
|
|
};
|
|
|
|
|
|
2022-02-23 17:25:28 +03:00
|
|
|
class FancyZonesSettings
|
2019-09-04 18:26:26 +02:00
|
|
|
{
|
2022-02-23 17:25:28 +03:00
|
|
|
public:
|
|
|
|
|
static FancyZonesSettings& instance();
|
|
|
|
|
static inline const Settings& settings()
|
|
|
|
|
{
|
|
|
|
|
return instance().m_settings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline static std::wstring GetSettingsFileName()
|
|
|
|
|
{
|
|
|
|
|
std::wstring saveFolderPath = PTSettingsHelper::get_module_save_folder_location(NonLocalizable::ModuleKey);
|
|
|
|
|
#if defined(UNIT_TESTS)
|
|
|
|
|
return saveFolderPath + L"\\test-settings.json";
|
|
|
|
|
#endif
|
|
|
|
|
return saveFolderPath + L"\\settings.json";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddObserver(SettingsObserver& observer);
|
|
|
|
|
void RemoveObserver(SettingsObserver& observer);
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2022-02-23 17:25:28 +03:00
|
|
|
void LoadSettings();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
FancyZonesSettings();
|
|
|
|
|
~FancyZonesSettings() = default;
|
|
|
|
|
|
|
|
|
|
Settings m_settings;
|
|
|
|
|
std::unique_ptr<FileWatcher> m_settingsFileWatcher;
|
|
|
|
|
std::unordered_set<SettingsObserver*> m_observers;
|
|
|
|
|
|
|
|
|
|
void SetBoolFlag(const PowerToysSettings::PowerToyValues& values, const wchar_t* id, SettingId notificationId, bool& out);
|
|
|
|
|
|
|
|
|
|
void NotifyObservers(SettingId id) const;
|
|
|
|
|
};
|