- Notifications
You must be signed in to change notification settings - Fork 8.5k
/
Copy pathsettings.hpp
244 lines (181 loc) · 7.85 KB
/
settings.hpp
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- settings.hpp
Abstract:
- This module is used for all configurable settings in the console
Author(s):
- Michael Niksa (MiNiksa) 23-Jul-2014
- Paul Campbell (PaulCam) 23-Jul-2014
Revision History:
- From components of consrv.h
- This is a reduced/de-duplicated version of settings that were stored in the registry, link files, and in the console information state.
--*/
#pragma once
// To prevent invisible windows, set a lower threshold on window alpha channel.
constexprunsignedshort MIN_WINDOW_OPACITY = 0x4D; // 0x4D is approximately 30% visible/opaque (70% transparent). Valid range is 0x00-0xff.
#include"ConsoleArguments.hpp"
#include"../renderer/inc/RenderSettings.hpp"
enumclassSettingsTextMeasurementMode : DWORD
{
Graphemes,
Wcswidth,
Console,
};
classSettings
{
using RenderSettings = Microsoft::Console::Render::RenderSettings;
public:
Settings();
voidApplyDesktopSpecificDefaults();
voidApplyStartupInfo(const Settings* const pStartupSettings);
voidApplyCommandlineArguments(const ConsoleArguments& consoleArgs);
voidInitFromStateInfo(_In_ PCONSOLE_STATE_INFO pStateInfo);
voidValidate();
CONSOLE_STATE_INFO CreateConsoleStateInfo() const;
RenderSettings& GetRenderSettings() noexcept { return _renderSettings; };
const RenderSettings& GetRenderSettings() constnoexcept { return _renderSettings; };
DWORD GetDefaultVirtTermLevel() const;
voidSetDefaultVirtTermLevel(const DWORD dwVirtTermLevel);
boolIsAltF4CloseAllowed() const;
voidSetAltF4CloseAllowed(constboolfAllowAltF4Close);
boolGetFilterOnPaste() const;
voidSetFilterOnPaste(constboolfFilterOnPaste);
const std::wstring_view GetLaunchFaceName() const;
voidSetLaunchFaceName(const std::wstring_view launchFaceName);
UINT GetCodePage() const;
voidSetCodePage(const UINT uCodePage);
UINT GetScrollScale() const;
voidSetScrollScale(const UINT uScrollScale);
boolGetTrimLeadingZeros() const;
voidSetTrimLeadingZeros(constboolfTrimLeadingZeros);
boolGetEnableColorSelection() const;
voidSetEnableColorSelection(constboolfEnableColorSelection);
boolGetLineSelection() const;
voidSetLineSelection(constbool bLineSelection);
boolGetWrapText() const;
voidSetWrapText(constbool bWrapText);
boolGetCtrlKeyShortcutsDisabled() const;
voidSetCtrlKeyShortcutsDisabled(constboolfCtrlKeyShortcutsDisabled);
BYTE GetWindowAlpha() const;
voidSetWindowAlpha(const BYTE bWindowAlpha);
DWORD GetHotKey() const;
voidSetHotKey(const DWORD dwHotKey);
boolIsStartupTitleIsLinkNameSet() const;
DWORD GetStartupFlags() const;
voidSetStartupFlags(const DWORD dwStartupFlags);
voidUnsetStartupFlag(const DWORD dwFlagToUnset);
WORD GetFillAttribute() const;
voidSetFillAttribute(const WORD wFillAttribute);
WORD GetPopupFillAttribute() const;
voidSetPopupFillAttribute(const WORD wPopupFillAttribute);
WORD GetShowWindow() const;
voidSetShowWindow(const WORD wShowWindow);
WORD GetReserved() const;
voidSetReserved(const WORD wReserved);
til::size GetScreenBufferSize() const;
voidSetScreenBufferSize(const til::size dwScreenBufferSize);
til::size GetWindowSize() const;
voidSetWindowSize(const til::size dwWindowSize);
boolIsWindowSizePixelsValid() const;
til::size GetWindowSizePixels() const;
voidSetWindowSizePixels(const til::size dwWindowSizePixels);
til::size GetWindowOrigin() const;
voidSetWindowOrigin(const til::size dwWindowOrigin);
DWORD GetFont() const;
voidSetFont(const DWORD dwFont);
til::size GetFontSize() const;
voidSetFontSize(const til::size dwFontSize);
UINT GetFontFamily() const;
voidSetFontFamily(const UINT uFontFamily);
UINT GetFontWeight() const;
voidSetFontWeight(const UINT uFontWeight);
const WCHAR* constGetFaceName() const;
boolIsFaceNameSet() const;
voidSetFaceName(const std::wstring_view faceName);
UINT GetCursorSize() const;
voidSetCursorSize(const UINT uCursorSize);
boolGetFullScreen() const;
voidSetFullScreen(constboolfFullScreen);
boolGetQuickEdit() const;
voidSetQuickEdit(constboolfQuickEdit);
boolGetInsertMode() const;
voidSetInsertMode(constboolfInsertMode);
boolGetAutoPosition() const;
voidSetAutoPosition(constboolfAutoPosition);
UINT GetHistoryBufferSize() const;
voidSetHistoryBufferSize(const UINT uHistoryBufferSize);
UINT GetNumberOfHistoryBuffers() const;
voidSetNumberOfHistoryBuffers(const UINT uNumberOfHistoryBuffers);
boolGetHistoryNoDup() const;
voidSetHistoryNoDup(constboolfHistoryNoDup);
voidSetColorTableEntry(constsize_t index, const COLORREF color);
COLORREF GetColorTableEntry(constsize_t index) const;
voidSetLegacyColorTableEntry(constsize_t index, const COLORREF color);
COLORREF GetLegacyColorTableEntry(constsize_t index) const;
CursorType GetCursorType() constnoexcept;
voidSetCursorType(const CursorType cursorType) noexcept;
boolGetInterceptCopyPaste() constnoexcept;
voidSetInterceptCopyPaste(constbool interceptCopyPaste) noexcept;
voidCalculateDefaultColorIndices() noexcept;
voidSaveDefaultRenderSettings() noexcept;
boolIsTerminalScrolling() constnoexcept;
voidSetTerminalScrolling(constbool terminalScrollingEnabled) noexcept;
std::wstring_view GetAnswerbackMessage() constnoexcept;
boolGetUseDx() constnoexcept;
boolGetCopyColor() constnoexcept;
SettingsTextMeasurementMode GetTextMeasurementMode() constnoexcept;
voidSetTextMeasurementMode(SettingsTextMeasurementMode mode) noexcept;
boolGetEnableBuiltinGlyphs() constnoexcept;
private:
RenderSettings _renderSettings;
DWORD _dwHotKey;
DWORD _dwStartupFlags;
WORD _wFillAttribute;
WORD _wPopupFillAttribute;
WORD _wShowWindow; // used when window is created
WORD _wReserved;
// START - This section filled via memcpy from shortcut properties. Do not rearrange/change.
COORD _dwScreenBufferSize;
COORD _dwWindowSize; // this is in characters.
COORD _dwWindowOrigin; // used when window is created
DWORD _nFont;
COORD _dwFontSize;
UINT _uFontFamily;
UINT _uFontWeight;
WCHAR _FaceName[LF_FACESIZE];
UINT _uCursorSize;
BOOL _bFullScreen; // deprecated
BOOL _bQuickEdit;
BOOL _bInsertMode; // used by command line editing
BOOL _bAutoPosition;
UINT _uHistoryBufferSize;
UINT _uNumberOfHistoryBuffers;
BOOL _bHistoryNoDup;
// END - memcpy
UINT _uCodePage;
UINT _uScrollScale;
bool _fTrimLeadingZeros;
bool _fEnableColorSelection;
bool _bLineSelection;
bool _bWrapText; // whether to use text wrapping when resizing the window
bool _fCtrlKeyShortcutsDisabled; // disables Ctrl+<something> key intercepts
BYTE _bWindowAlpha; // describes the opacity of the window
bool _fFilterOnPaste; // should we filter text when the user pastes? (e.g. remove <tab>)
std::wstring _LaunchFaceName;
bool _fAllowAltF4Close;
DWORD _dwVirtTermLevel;
SettingsTextMeasurementMode _textMeasurement = SettingsTextMeasurementMode::Graphemes;
bool _fUseDx;
bool _fCopyColor;
bool _fEnableBuiltinGlyphs = true;
// this is used for the special STARTF_USESIZE mode.
bool _fUseWindowSizePixels;
COORD _dwWindowSizePixels;
CursorType _CursorType;
bool _fInterceptCopyPaste;
bool _TerminalScrolling;
WCHAR _answerbackMessage[32] = {};
friendclassRegistrySerialization;
};