forked from uesp/skyedit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Srresourceview.h
220 lines (175 loc) · 7.03 KB
/
Srresourceview.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
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
/*===========================================================================
*
* File: Srresourceview.H
* Author: Dave Humphrey ([email protected])
* Created On: 26 November 2011
*
* Description
*
*=========================================================================*/
#ifndef __SRRESOURCEVIEW_H
#define __SRRESOURCEVIEW_H
/*===========================================================================
*
* Begin Required Includes
*
*=========================================================================*/
#include "srimagectrl.h"
#include "bsafile/srresourcehandler.h"
/*===========================================================================
* End of Required Includes
*=========================================================================*/
/*===========================================================================
*
* Begin Definitions
*
*=========================================================================*/
/* Custom window messages */
#define ID_SRRESOURCE_CHECKDROP (WM_APP + 901)
#define ID_SRRESOURCE_DROP (WM_APP + 902)
/* Return values from notify messages */
#define SRRESOURCE_DROPCHECK_OK 2345
#define SRRESOURCE_DROPCHECK_ERROR 5432
#define SRRESOURCE_DROPCHECK_NOCHANGE 2346
/* Default main resource paths */
#define SRRESOURCE_PATH_TEXTURES "textures\\"
#define SRRESOURCE_PATH_MESHES "meshes\\"
#define SRRESOURCE_PATH_SOUNDS "sound\\"
#define SRRESOURCE_PATH_SCRIPTS "scripts\\"
/*===========================================================================
* End of Definitions
*=========================================================================*/
/*===========================================================================
*
* Begin Type Definitions
*
*=========================================================================*/
struct srrespreviewinfo_t
{
CSrResourceInstance* pInstance;
CString Filename;
int64 Filesize;
int64 StartOffset;
bool PlainFile;
};
/* Used to test drop targets */
struct srresourcedropinfo_t
{
NMHDR Notify;
CSrResourceFile* pResourceFile;
dword ParentThread;
};
/*===========================================================================
* End of Type Definitions
*=========================================================================*/
/*===========================================================================
*
* Begin Class CSrResourceView Definition
*
*=========================================================================*/
class CSrResourceView : public CFormView
{
DECLARE_DYNCREATE(CSrResourceView);
/*---------- Begin Protected Class Members ------------------------------*/
protected:
CSrResourceHandler* m_pResourceHandler; /* References to resource objects */
CSrBsaFileArray* m_pBsaFiles;
CSrResourceInstance* m_pCurrentInstance;
CImageList m_ImageList;
CSrResourceFile* m_pDragResource;
CImageList* m_pDragImage;
bool m_IsDragging;
HCURSOR m_hGoodDropCursor;
HCURSOR m_hBadDropCursor;
bool m_LastDropValid;
CWnd* m_pLastDropWnd;
bool m_EnablePreview;
CBitmap m_Bitmaps[10];
/*---------- Begin Protected Class Methods ------------------------------*/
protected:
/* Create from serialization only */
CSrResourceView();
/* Update helpers */
void FillResourceTree (void);
void FillResourceTree (CSrResourceFolder* pFolder, HTREEITEM hParent);
HTREEITEM AddResourceTree (CSrResourceFile* pFile, HTREEITEM hParent);
void UpdateResourceTree (CSrResourceFile* pFile, HTREEITEM hItem);
void ClearDisplayedInstance (void);
void UpdateDisplayedInstance (void);
void PreviewInstance (CSrResourceInstance* pInstance);
void PreviewImage (CSrResourceInstance* pInstance, srrespreviewinfo_t& PreviewInfo);
void PreviewUnknown (CSrResourceInstance* pInstance, srrespreviewinfo_t& PreviewInfo);
void PreviewText (CSrResourceInstance* pInstance, srrespreviewinfo_t& PreviewInfo);
void ClearPreview (void);
void CleanupDrag (void);
int SendDropNotify (CPoint Point, const int MessageID);
void EditSelectedItem (const bool UseInternal);
bool EditItem (CSrResourceBase* pBase, const bool UseInternal);
/*---------- Begin Public Class Methods ---------------------------------*/
public:
/* Destructor */
virtual ~CSrResourceView();
/* Set class members */
void SetEnablePreview (const bool Flag) { m_EnablePreview = Flag; }
void SetResourceHandler (CSrResourceHandler* pHandler) { m_pResourceHandler = pHandler; }
void SetBsaFileArray (CSrBsaFileArray* pArray) { m_pBsaFiles = pArray; }
/* Find and select a particular resource */
bool SelectResource (const char* pResource);
/* Resource members */
//{{AFX_DATA(CSrResourceView)
enum { IDD = IDD_RESOURCE_VIEW };
CRichEditCtrl m_PreviewText;
CEdit m_Filetime;
CEdit m_Filesize;
CEdit m_Filename;
CStatic m_HBar;
CTreeCtrl m_ResourceTree;
CSrImageCtrl m_PreviewImage;
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual void OnInitialUpdate();
public:
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
afx_msg void OnDblclkResourceTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSelchangedResourceTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnBegindragResourceTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnCaptureChanged(CWnd *pWnd);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnHelp (void);
DECLARE_MESSAGE_MAP();
public:
afx_msg void OnResourcemenuEdit();
afx_msg void OnUpdateResourcemenuEdit(CCmdUI *pCmdUI);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
virtual BOOL PreTranslateMessage(MSG* pMsg);
afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
afx_msg void OnInitMenu(CMenu* pMenu);
afx_msg void OnResourcemenuEditexternal();
afx_msg void OnUpdateResourcemenuEditexternal(CCmdUI *pCmdUI);
afx_msg void OnNMRDblclkResourceTree(NMHDR *pNMHDR, LRESULT *pResult);
};
/*===========================================================================
* End of Class CSrResourceView Definition
*=========================================================================*/
/*===========================================================================
*
* Begin Function Prototypes
*
*=========================================================================*/
/*===========================================================================
* End of Function Prototypes
*=========================================================================*/
#endif
/*===========================================================================
* End of File Obresourceview.H
*=========================================================================*/