29 #include "../../idlib/precompiled.h"
32 #include "../../sys/win32/rc/guied_resource.h"
39 WNDPROC wndproc = (WNDPROC) GetWindowLong ( hwnd, GWL_USERDATA );
44 if ( wParam == VK_ESCAPE )
46 SendMessage (
GetParent ( hwnd ), WM_CLOSE, 0, 0 );
51 return DLGC_WANTALLKEYS;
54 return CallWindowProc ( wndproc, hwnd, msg, wParam, lParam );
64 window = (
idWindow*)GetWindowLong ( hwnd, GWL_USERDATA );
75 SendMessage ( script, EM_SETTABSTOPS, 1, (
LPARAM)&tabsize );
76 SetWindowLong ( script, GWL_USERDATA, GetWindowLong ( script, GWL_WNDPROC ) );
81 dc = GetDC ( script );
82 GetTextMetrics ( dc, &tm );
83 ReleaseDC ( script, dc );
86 ZeroMemory ( &lf,
sizeof(lf) );
87 lf.lfHeight = tm.tmHeight;
88 strcpy ( lf.lfFaceName,
"Courier New" );
90 SendMessage ( script, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 );
92 SendMessage ( script, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(10,10) );
100 SendMessage ( script, EM_SETSEL, -1, -1 );
102 SendMessage ( script, EM_SETSEL, -1, -1 );
103 SendMessage ( script, EM_REPLACESEL,
FALSE, (
LPARAM)
"\t" );
104 SendMessage ( script, EM_SETSEL, -1, -1 );
106 SendMessage ( script, EM_SETSEL, -1, -1 );
107 SendMessage ( script, EM_REPLACESEL,
FALSE, (
LPARAM)
"\r\n" );
112 SendMessage ( script, EM_SETSEL, -1, -1 );
113 SendMessage ( script, EM_REPLACESEL,
FALSE, (
LPARAM)
"\r\n" );
120 SendMessage ( script, EM_SETSEL, -1, -1 );
122 SendMessage ( script, EM_SETSEL, -1, -1 );
124 SendMessage ( script, EM_SETSEL, -1, -1 );
125 SendMessage ( script, EM_REPLACESEL,
FALSE, (
LPARAM)
"\r\n\r\n" );
128 SendMessage ( script, EM_SETSEL, 0, 0 );
129 SendMessage ( script, EM_SCROLLCARET, 0, 0 );
141 window = (
idWindow*)GetWindowLong ( hwnd, GWL_USERDATA );
151 GETTEXTLENGTHEX textLen;
153 textLen.flags = GTL_DEFAULT|GTL_USECRLF;
154 textLen.codepage = CP_ACP;
155 chars = SendMessage ( script, EM_GETTEXTLENGTHEX, (WPARAM)&textLen, 0 );
157 char* text =
new char[chars+1];
160 getText.cb = chars+1;
161 getText.codepage = CP_ACP;
162 getText.flags = GT_DEFAULT|GT_USECRLF;
163 getText.lpDefaultChar =
NULL;
164 getText.lpUsedDefChar =
NULL;
165 SendMessage ( script, EM_GETTEXTEX, (WPARAM)&getText, (
LPARAM)text );
178 while (
src.ReadToken ( &token ) )
183 if ( !token.Icmp (
"definevec4") )
188 if ( !
src.ReadToken ( &token2 ) )
190 src.Error (
"expected define name" );
201 for ( i = 0; i < 3; i ++ )
204 src.ExpectTokenString(
",");
208 src.GetStringFromMarker ( out,
true );
214 else if ( !token.Icmp (
"definefloat" ) || !token.Icmp (
"float" ) )
219 if ( !
src.ReadToken ( &token2 ) )
221 src.Error (
"expected define name" );
232 src.GetStringFromMarker ( out,
true );
241 else if ( !token.Icmp (
"scriptdef" ) )
243 scriptName =
"scriptDef";
245 else if ( !token.Icmp (
"ontime" ) )
247 if ( !
src.ReadToken ( &token ) )
249 src.Error (
"expected time" );
253 scriptName =
"onTime ";
254 scriptName.
Append ( token );
256 else if ( !token.Icmp (
"onevent" ) )
258 if ( !
src.ReadToken ( &token ) )
260 src.Error (
"expected time" );
264 scriptName =
"onEvent ";
265 scriptName.
Append ( token );
280 if ( i >= idWindow::SCRIPT_COUNT )
282 src.Error (
"expected script name" );
287 if ( !
src.ParseBracedSectionExact ( out, 1) )
297 MessageBox ( hwnd, e.
error,
"Script Error", MB_OK|MB_ICONERROR);
309 SetWindowLong ( hwnd, GWL_USERDATA, lParam );
319 GetClientRect ( hwnd, &rClient );
321 rClient.left, rClient.top,
322 rClient.right - rClient.left,
323 rClient.bottom - rClient.top,
338 EndDialog ( hwnd, 1 );
354 LoadLibrary (
"Riched20.dll" );
assert(prefInfo.fullscreenBtn)
bool GEItemScriptsDlg_DoModal(HWND parent, idWindow *window)
CONST PIXELFORMATDESCRIPTOR UINT
const idStr & GetKey(void) const
void SetWindowPlacement(const char *name, HWND hwnd)
bool GetWindowPlacement(const char *name, HWND hwnd)
void Set(const char *key, const char *value)
HINSTANCE GetInstance(void)
INT_PTR CALLBACK GEItescriptsDlg_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int Icmp(const char *text) const
rvGEOptions & GetOptions(void)
idDict & GetScriptDict(void)
idDict & GetVariableDict(void)
static const char * ScriptNames[SCRIPT_COUNT]
const idStr & GetValue(void) const
typedef HDC(WINAPI *PFNWGLGETCURRENTREADDCARBPROC)(void)
#define IDD_GUIED_SCRIPTS
bool GEItescriptsDlg_Init(HWND hwnd)
int ParseExpression(idParser *src, idWinVar *var=NULL, int component=0)
static rvGEWindowWrapper * GetWrapper(idWindow *window)
void Append(const char a)
char error[MAX_STRING_CHARS]
MFnDagNode * GetParent(MFnDagNode *joint)
bool GEItescriptsDlg_Apply(HWND hwnd)
const char * c_str(void) const
const idKeyValue * GetKeyVal(int index) const
LRESULT CALLBACK GEScriptEdit_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
char * va(const char *fmt,...)
int GetNumKeyVals(void) const