-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEdittime.cpp
343 lines (294 loc) · 11.9 KB
/
Edittime.cpp
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
// ============================================================================
// This file contains routines that are handled only during the Edittime,
// under the Frame and Event editors.
//
// Including creating, display, and setting up your object.
// ============================================================================
#include "Common.hpp"
// ============================================================================
// ROUTINES USED UNDER FRAME EDITOR
// ============================================================================
#if EditorBuild
// Called once object is created or modified, just after setup.
// Also called before showing the "Insert an object" dialog if your object
// has no icon resource
int FusionAPI MakeIconEx(mv * mV, cSurface * pIconSf, TCHAR * lpName, ObjInfo * oiPtr, EDITDATA * edPtr)
{
#pragma DllExportHint
pIconSf->Delete();
pIconSf->Clone(*Edif::SDK->Icon);
pIconSf->SetTransparentColor(RGB(255, 0, 255));
return 0;
}
// Called when you choose "Create new object". It should display the setup box
// and initialize everything in the datazone.
int FusionAPI CreateObject(mv * mV, LevelObject * loPtr, EDITDATA * edPtr)
{
#pragma DllExportHint
if (!Edif::IS_COMPATIBLE(mV))
return -1;
Edif::Init(mV, edPtr);
// Init any custom EDITDATA stuff here, between Init and DLL_CreateObject
return DarkEdif::DLL::DLL_CreateObject(mV, loPtr, edPtr);
}
// Displays the object under the frame editor
void FusionAPI EditorDisplay(mv *mV, ObjectInfo * oiPtr, LevelObject * loPtr, EDITDATA * edPtr, RECT * rc)
{
#pragma DllExportHint
cSurface * Surface = WinGetSurface((int) mV->IdEditWin);
if (!Surface)
return;
// If you don't have this function run in Edittime.cpp, SDK Updater will be disabled for your ext
// Don't comment or preprocessor-it out if you're removing it; delete the line entirely.
DarkEdif::SDKUpdater::RunUpdateNotifs(mV, edPtr);
// Draw to surface here with Surface->Rectangle(), Surface->Line(), Surface->SetPixel(), etc.
// Note writing text is not possible in Direct3D display mode, unless you create a
// software + DC surface type, write the text there, then blit it into Surface.
// RunUpdateNotifs does this, to write "minor/major update" text onto the ext icon.
//
// Positions are absolute, and refer to the whole Fusion editor window, so to draw
// on your object's left, draw at X = rc->left, and be careful to only use the
// Surface functions that take X/Y positions.
//
// If you're making your object different to 32x32, don't forget to
// pre-set the size in CreateObject() above, and uncomment GetObjectRect() below
// so Fusion can read the current size.
// If it's partially transparent, implement IsTransparent() below as well.
// If it's resizeable, also implement SetEditSize() below.
// If you don't want to draw the icon, you can take this out.
// To display updates in a custom way, you can use DarkEdif::SDKUpdater::ReadUpdateStatus(NULL);
// to get the type of update.
// Note the message box for major updates will still show, and cannot be disabled.
Edif::SDK->Icon->Blit(*Surface, rc->left, rc->top, BMODE_TRANSP, BOP_COPY, 0);
}
// This routine tells Fusion if the mouse pointer is over a transparent zone of the object.
// If not exported, the entire display is assumed to be opaque.
/*
BOOL FusionAPI IsTransparent(mv *mV, LevelObject * loPtr, EDITDATA * edPtr, int dx, int dy)
{
#pragma DllExportHint
// Don't forget to pre-set the size in CreateObject() above,
// and uncomment GetObjectRect() below so Fusion can read the current size.
// You should display in EditorDisplay() above.
return FALSE;
}
*/
// Called when the object has been resized
/*
BOOL FusionAPI SetEditSize(mv * mv, EDITDATA * edPtr, int cx, int cy)
{
#pragma DllExportHint
// Check compatibility
if (!Edif::IS_COMPATIBLE(mV))
return FALSE;
// Don't forget to pre-set the size in CreateObject() above,
// and uncomment GetObjectRect() below so Fusion can read the current size.
// You should display in EditorDisplay() above.
edPtr->swidth = cx;
edPtr->sheight = cy;
return TRUE;
}
*/
// Returns the size of the rectangle of the object in the frame editor.
// If this function isn't defined, a size of 32x32 is assumed.
/* void FusionAPI GetObjectRect(mv * mV, RECT * rc, LevelObject * loPtr, EDITDATA * edPtr)
{
#pragma DllExportHint
if (!mV || !rc || !edPtr)
return;
// Don't forget to pre-set the size in CreateObject() above,
// and uncomment SetEditSize() if you want the user to be able to resize it.
// You should display it in EditorDisplay() above.
rc->right = rc->left + Edif::SDK->Icon->GetWidth(); // edPtr->swidth;
rc->bottom = rc->top + Edif::SDK->Icon->GetHeight(); // edPtr->sheight;
}*/
// Called when the user selects the Edit command in the object's popup menu
/*
BOOL FusionAPI EditObject(mv *mV, ObjInfo * oiPtr, LevelObject * loPtr, EDITDATA * edPtr)
{
#pragma DllExportHint
// Check compatibility
if (!Edif::IS_COMPATIBLE(mV))
return FALSE;
// do stuff
return TRUE;
}
*/
// ============================================================================
// PROPERTIES
// ============================================================================
// Inserts properties into the properties of the object.
BOOL FusionAPI GetProperties(mv * mV, EDITDATA * edPtr, BOOL bMasterItem)
{
#pragma DllExportHint
return DarkEdif::DLL::DLL_GetProperties(mV, edPtr, bMasterItem);
}
// Called when the properties are removed from the property window.
void FusionAPI ReleaseProperties(mv * mV, EDITDATA * edPtr, BOOL bMasterItem)
{
#pragma DllExportHint
return DarkEdif::DLL::DLL_ReleaseProperties(mV, edPtr, bMasterItem);
}
// Returns the value of properties that have a value.
// Note: see GetPropCheck for checkbox properties
void * FusionAPI GetPropValue(mv * mV, EDITDATA * edPtr, unsigned int PropID)
{
#pragma DllExportHint
return DarkEdif::DLL::DLL_GetPropValue(mV, edPtr, PropID);
}
// Returns the checked state of properties that have a check box.
BOOL FusionAPI GetPropCheck(mv * mV, EDITDATA * edPtr, unsigned int PropID)
{
#pragma DllExportHint
return DarkEdif::DLL::DLL_GetPropCheck(mV, edPtr, PropID);
}
// Called by Fusion after a property has been modified.
void FusionAPI SetPropValue(mv * mV, EDITDATA * edPtr, unsigned int PropID, void * Param)
{
#pragma DllExportHint
DarkEdif::DLL::DLL_SetPropValue(mV, edPtr, PropID, Param);
}
// Called by Fusion when the user modifies a checkbox in the properties.
void FusionAPI SetPropCheck(mv * mV, EDITDATA * edPtr, unsigned int PropID, BOOL checked)
{
#pragma DllExportHint
DarkEdif::DLL::DLL_SetPropCheck(mV, edPtr, PropID, checked);
}
// Called by Fusion when the user clicks the button of a Button or EditButton property.
/*BOOL FusionAPI EditProp(mv * mV, EDITDATA * edPtr, unsigned int PropID)
{
#pragma DllExportHint
// Example
// -------
/*
if (nPropID==PROPID_EDITCONTENT)
{
if ( EditObject(mV, NULL, NULL, edPtr) )
return TRUE;
}
*\/
return FALSE;
}*/
// Called by Fusion to request the enabled state of a property.
BOOL FusionAPI IsPropEnabled(mv * mV, EDITDATA * edPtr, unsigned int PropID)
{
#pragma DllExportHint
// Example
// -------
/*
switch (nPropID) {
case PROPID_CHECK:
return (edPtr->nComboIndex != 0);
}
*/
return DarkEdif::DLL::DLL_IsPropEnabled(mV, edPtr, PropID);
}
// Called when a property is initialized and its creation parameter is NULL (in the PropData).
// Allows you, for example, to change the content of a combobox property according to specific settings in the EDITDATA structure.
/*LPARAM FusionAPI GetPropCreateParam(mv *mV, EDITDATA *edPtr, unsigned int PropID)
{
#pragma DllExportHint
// Example
// -------
// if ( PropID == PROPID_COMBO )
// {
// switch (edPtr->sType)
// {
// case TYPE1:
// return (LPARAM)ComboList1;
// case TYPE2:
// return (LPARAM)ComboList2;
// }
// }
return DarkEdif::DLL::DLL_GetPropCreateParam(mV, edPtr, PropID);
}*/
// Called after a property has been initialized.
// Allows you, for example, to free memory allocated in GetPropCreateParam.
/*void FusionAPI ReleasePropCreateParam(mv *mV, EDITDATA *edPtr, unsigned int PropID, LPARAM lParam)
{
#pragma DllExportHint
return DarkEdif::DLL::DLL_ReleasePropCreateParam(mV, edPtr, PropID, lParam);
}*/
// ============================================================================
// TEXT PROPERTIES
// ============================================================================
// Return the text capabilities of the object under the frame editor; affects what options
// appear if you right-click the object in frame editor and use Text submenu.
// @remarks Introduced in MMF1.5, missing in MMF1.2 and below.
/*std::uint32_t FusionAPI GetTextCaps(mv * mV, EDITDATA * edPtr)
{
#pragma DllExportHint
return 0; // (TEXT_ALIGN_LEFT|TEXT_ALIGN_HCENTER|TEXT_ALIGN_RIGHT|TEXT_ALIGN_TOP|TEXT_ALIGN_VCENTER|TEXT_ALIGN_BOTTOM|TEXT_FONT|TEXT_COLOR);
}*/
// Return the font used in the object.
// @remarks Introduced in MMF1.5, missing in MMF1.2 and below.
// Must be defined if GetTextCaps() returns TEXT_FONT.
// The pStyle and cbSize parameters are obsolete in MMF2 and passed for compatibility reasons only.
/*BOOL FusionAPI GetTextFont(mv * mV, EDITDATA * edPtr, LOGFONT * Font, TCHAR * pStyle, unsigned int cbSize)
{
#pragma DllExportHint
// Example: copy LOGFONT structure from EDITDATA
// memcpy(plf, &edPtr->m_lf, sizeof(LOGFONT));
return TRUE;
}*/
// Change the font used the object.
// @remarks Introduced in MMF1.5, missing in MMF1.2 and below.
// Must be defined if GetTextCaps() returns TEXT_FONT.
// The pStyle and cbSize parameters are obsolete in MMF2 and passed for compatibility reasons only.
/*BOOL FusionAPI SetTextFont(mv * mV, EDITDATA * edPtr, LOGFONT * Font, [[deprecated]] const char * pStyle)
{
#pragma DllExportHint
// Example: copy LOGFONT structure to EDITDATA
// memcpy(&edPtr->m_lf, plf, sizeof(LOGFONT));
return TRUE;
}*/
// Get the text color of the object.
// @remarks Introduced in MMF1.5, missing in MMF1.2 and below.
// Must be defined if GetTextCaps() returns TEXT_COLOR.
/*COLORREF FusionAPI GetTextClr(mv * mV, EDITDATA * edPtr)
{
#pragma DllExportHint
return 0; // try RGB()
}*/
// Called by Fusion to set the text color of the object.
// @remarks Introduced in MMF1.5, missing in MMF1.2 and below.
// Must be defined if GetTextCaps() returns TEXT_COLOR.
/*void FusionAPI SetTextClr(mv *mV, EDITDATA * edPtr, COLORREF color)
{
#pragma DllExportHint
// Example
// edPtr->fontColor = color;
}*/
// Get the text alignment of the object.
// @remarks Introduced in MMF1.5, missing in MMF1.2 and below.
// Must be defined if GetTextCaps() returns any TEXT_ALIGN_XXX flags
/*std::uint32_t FusionAPI GetTextAlignment(mv *mV, EDITDATA * edPtr)
{
#pragma DllExportHint
return 0;
}*/
// Set the text alignment of the object.
// @remarks Introduced in MMF1.5, missing in MMF1.2 and below.
// Must be defined if GetTextCaps() returns any TEXT_ALIGN_XXX flags
/*void FusionAPI SetTextAlignment(mv *mV, EDITDATA * edPtr, unsigned int AlignFlags)
{
#pragma DllExportHint
}*/
// ============================================================================
// ROUTINES USED WHEN BUILDING
// ============================================================================
// This routine is called by Fusion when an Android build is prepared before building.
// It enables you to modify the Android manifest file to add your own content, or otherwise check the Android build.
// It is called in the Extensions[\Unicode] MFX, for any extension in the MFA that defines PrepareAndroidBuild,
// including exts that have no corresponding Data\Runtime\Android file and would create a not-compatible build warning.
/*void FusionAPI PrepareAndroidBuild(mv* mV, EDITDATA* edPtr, LPCTSTR androidDirectoryPathname)
{
#pragma DllExportHint
// Erase the manifest file so the build will fail
std::tstring manifestPath = androidDirectoryPathname;
manifestPath += _T("app\\src\\main\\AndroidManifest.xml"sv);
// Open manifestPath as a file, say with
// _tfopen(manifestPath.c_str(), _T("ab"))
// and you're free to edit the manifest
}*/
#endif // EditorBuild