-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDialogImposterManager.h
127 lines (103 loc) · 3.79 KB
/
DialogImposterManager.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
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
#pragma once
namespace cse
{
// refreshes the imposter's form list
#define WM_OBJECTWINDOWIMPOSTER_REFRESHFORMLIST (WM_USER + 2400)
// refreshes the imposter's tree view
#define WM_OBJECTWINDOWIMPOSTER_REFRESHTREEVIEW (WM_USER + 2404)
// initializes the imposter's controls and data
#define WM_OBJECTWINDOWIMPOSTER_INITIALIZE (WM_USER + 2402)
// initializes the extra fittings subclass, works around the delayed subclassing
// handled elsewhere by the subclass
#define WM_OBJECTWINDOWIMPOSTER_INITIALIZEXTRA (WM_USER + 2403)
// this implementation isn't without its share of bugs
// most of them are related to form creation, control updates, i.e., failed sorting
// hence we pick up the slack whenever necessary
class ObjectWindowImposterManager
{
INT_PTR ImposterDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
struct ImposterData
{
UInt32 TreeSelection; // last selected tree node
int SortColumns[TESObjectWindow::TreeEntryInfo::kTreeEntryCount];
ImposterData();
};
// stores the original values of the caches and restores them on destruction
// an added advantage is that the changes are transparent to the existing object window related additions
// limitations: the addition of newly created forms will not be propagated immediately through all instances
class CacheOperator
{
HWND MainWindow;
HWND FormList;
HWND TreeView;
HWND Splitter;
ImposterData* ParentData;
UInt32 TreeSelection;
int SortColumns[TESObjectWindow::TreeEntryInfo::kTreeEntryCount];
public:
CacheOperator(HWND Imposter);
~CacheOperator();
};
typedef std::map<HWND, ImposterData*> ImposterTableT;
ImposterTableT ImposterRegistry;
bgsee::util::ThunkStdCall<ObjectWindowImposterManager, INT_PTR, HWND, UINT, WPARAM, LPARAM> ThunkImposterDlgProc;
void DisposeImposter(HWND Imposter);
ImposterData* GetImposterData(HWND Imposter) const;
public:
ObjectWindowImposterManager();
~ObjectWindowImposterManager();
void SpawnImposter(void);
void RefreshImposters(void) const;
void DestroyImposters(void);
bool IsImposter(HWND hWnd) const;
void HandleObjectWindowSizing(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) const;
void HandleObjectWindowActivating(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) const;
static ObjectWindowImposterManager Instance;
};
#define WM_PREVIEWWINDOWIMPOSTER_INITIALIZE (WM_USER + 2405)
// same as above but for the preview window
class PreviewWindowImposterManager
{
INT_PTR ImposterDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
struct ImposterData
{
DWORD InitTickCount;
TESObjectREFR* PreviewRef;
TESObjectSTAT* PreviewGround;
TESPreviewControl* Renderer;
RECT Bounds;
TESBoundObject* PreviewSource;
BaseExtraList* DialogExtraList;
ImposterData();
~ImposterData();
};
class CacheOperator
{
HWND MainWindow;
HWND AnimationList;
DWORD InitTicks;
TESObjectREFR* PreviewRef;
TESObjectSTAT* PreviewGround;
TESPreviewControl* Renderer;
ImposterData* ParentData;
public:
CacheOperator(HWND Imposter);
~CacheOperator();
};
typedef std::map<HWND, ImposterData*> ImposterTableT;
ImposterTableT ImposterRegistry;
bgsee::util::ThunkStdCall<PreviewWindowImposterManager, INT_PTR, HWND, UINT, WPARAM, LPARAM> ThunkImposterDlgProc;
bool Enabled;
void DisposeImposterData(HWND Imposter);
ImposterData* GetImposterData(HWND Imposter) const;
public:
PreviewWindowImposterManager();
~PreviewWindowImposterManager();
void SpawnImposter(TESBoundObject* Object);
void DestroyImposters(void);
bool IsImposter(HWND hWnd) const;
bool GetEnabled(void) const;
void SetEnabled(bool State);
static PreviewWindowImposterManager Instance;
};
}