-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.h
87 lines (78 loc) · 1.81 KB
/
Config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#pragma once
#include "stdafx.h"
#include <memory>
enum class FileNameOrdering : DWORD
{
Default = 0,
Natural,
Ordinal,
Culture,
};
enum class Direction : DWORD
{
Default = 0,
TopToDown,
RightToLeft,
LeftToRight,
};
enum class PluginMode : DWORD
{
Buffer,
File,
Folder,
};
class Config final
{
DWORD m_Mode{static_cast<DWORD>(PluginMode::Folder)};
DWORD m_forceD2D1{0};
DWORD m_scale{10};
DWORD m_fileNameOrdering{static_cast<DWORD>(FileNameOrdering::Natural)};
DWORD m_backgroundColor{0x0FFFFFF};
DWORD m_imageLimit{0xFFFFFFFF};
public:
static constexpr LPCWSTR key_FileMode{L"PluginMode"};
static constexpr LPCWSTR key_Scale{L"Scale"};
static constexpr LPCWSTR key_ForceD2D1{L"ForceD2D1"};
static constexpr LPCWSTR key_FileNameOrdering{L"FileNameOrdering"};
static constexpr LPCWSTR key_BackgroundColor{L"BackgroundColor"};
static std::unique_ptr<Config> Load();
Config(const Config &) = delete;
Config &operator=(const Config &) = delete;
Config(Config &&) = default;
Config() noexcept
{
}
Config &operator=(Config &&) = default;
PluginMode pluginMode() const
{
return static_cast<PluginMode>(m_Mode);
}
bool fileMode() const
{
return m_Mode == static_cast<DWORD>(PluginMode::File);
}
bool forceD2D1() const
{
return m_forceD2D1 == 1;
}
FLOAT scale() const
{
return scaleInt() / 100.f;
}
DWORD scaleInt() const
{
return m_scale;
}
FileNameOrdering fileNameOrdering() const
{
return static_cast<FileNameOrdering>(m_fileNameOrdering);
}
UINT backgroundColor() const
{
return m_backgroundColor & 0xFFFFFF;
}
UINT imageLimit() const
{
return m_imageLimit;
}
};