-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEsmDlgArray.h
161 lines (124 loc) · 5.19 KB
/
EsmDlgArray.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
/*===========================================================================
*
* File: Esmdlgarray.H
* Author: Dave Humphrey (uesp@m0use.net)
* Created On: February 8, 2003
*
* Handles a general array of ESM record dialogs.
*
*=========================================================================*/
#ifndef __ESMDLGARRAY_H
#define __ESMDLGARRAY_H
/*===========================================================================
*
* Begin Required Includes
*
*=========================================================================*/
#include "EsmRecDialog.h"
#include "MainFrm.h"
/*===========================================================================
* End of Required Includes
*=========================================================================*/
/*===========================================================================
*
* Begin Type Definitions
*
*=========================================================================*/
/* Array of dialog pointers */
typedef TPtrArray<CFrameWnd> CEsmFrameArray;
/* Type for dialog static creation methods */
typedef CEsmRecDialog* (*ESMRECDLG_CREATEFUNC) (void);
/* Function typedef for custom dialog creation */
class CEsmDlgHandler;
typedef CFrameWnd* (CEsmDlgHandler::*DLGCREATE_FUNC) (esmrecinfo_t* pRecInfo);
/* Used to create the various dialogs */
struct esmdlgcreateinfo_t {
const TCHAR* Type;
const TCHAR* pTitle;
int ResourceID;
CRuntimeClass* pViewClass;
CRuntimeClass* pFrameClass;
DLGCREATE_FUNC CreateFunc;
};
/* Class forward definitions */
class CEsmScriptCompareDlg;
/*===========================================================================
* End of Type Definitions
*=========================================================================*/
/*===========================================================================
*
* Begin Class CEsmDlgHandler Definition
*
* Description
*
*=========================================================================*/
class CEsmDlgHandler {
/*---------- Begin Private Class Members ----------------------*/
protected:
CEsmFrameArray m_Frames; /* Array of ESM frame windows */
CMWEditDoc* m_pDocument; /* Current document */
CMainFrame* m_pMainFrame;
CFrameWnd* m_pFindDlg; /* Find dialog parent frame */
CFrameWnd* m_pUsesDlg;
CFrameWnd* m_pScrTempDlg;
CFrameWnd* m_pScriptCompareDlg;
/*---------- Begin Protected Class Methods --------------------*/
protected:
/* Create a new dialog based on the input type */
CFrameWnd* CreateESMDialog (esmrecinfo_t* pRecInfo, const bool IsNew);
CFrameWnd* CreateESMDialog (esmdlgcreateinfo_t& CreateInfo);
/*---------- Begin Public Class Methods -----------------------*/
public:
/* Class Constructors/Destructors */
CEsmDlgHandler();
virtual ~CEsmDlgHandler() { Destroy(); }
virtual void Destroy (void);
/* Delete all the dialogs current in the array */
void ClearDlgArray (void);
/* Create a copy of a record */
CEsmRecord* CreateCopy (CEsmRecord* pRecord);
/* Custom dialog creation methods */
CFrameWnd* CreateDialogueDlg (esmrecinfo_t* pRecInfo);
/* Attempt to open a new edit window */
bool EditRecord (esmrecinfo_t* pRecInfo, const bool IsNew = false);
/* Find an existing dialog */
CFrameWnd* FindDialog (esmrecinfo_t* pRecInfo);
/* Get the current active filename */
const TCHAR* GetDocFilename (void);
CMWEditDoc* GetDocument (void) { return (m_pDocument); }
CEsmFile* GetActiveFile (void);
CMainFrame* GetMainFrame (void) { return (m_pMainFrame); }
/* Try and find a magic effect record */
esmrecinfo_t* GetEffectRecord (const int EffectID);
/* Checks the validity of a new ID */
bool IsValidID (const TCHAR* pID);
bool IsExistingID (const TCHAR* pID);
/* Notifies when the find dialog is closed */
void OnCloseFindDlg (void) { m_pFindDlg = NULL; }
void OnCloseUsesDlg (void) { m_pUsesDlg = NULL; }
void OnCloseScrTempDlg (void) { m_pScrTempDlg = NULL; }
void OnCloseScriptCompareDlg (void) { m_pScriptCompareDlg = NULL; }
/* Indicates that changes are about to be written to the given object */
int OnPreSaveRecord (esmreceditinfo_t* pRecEditInfo);
int OnPostSaveRecord (esmreceditinfo_t* pRecEditInfo);
/* Request to create a new item of the given type */
CEsmRecord* OnAddNew (const TCHAR* pType);
CEsmRecord* OnAddNewDialog (const int DialType);
/* Display other dialog types */
void OpenFindDlg (void);
void OpenUsesDlg (esmrecinfo_t* pRecInfo);
CEsmScriptCompareDlg* OpenScriptCompareDlg (void);
void OpenScrTempDlg (void);
/* Removes a frame from the array */
void RemoveFrame (CFrameWnd* pFrame);
/* Set class members */
void SetDocument (CMWEditDoc* pDoc) { m_pDocument = pDoc; }
void SetMainFrame (CMainFrame* pMainFrame) { m_pMainFrame = pMainFrame; }
};
/*===========================================================================
* End of Class CEsmDlgHandler Definition
*=========================================================================*/
#endif
/*===========================================================================
* End of File Esmdlgarray.H
*=========================================================================*/