1 | /*
|
---|
2 | * RichEdit32 functions
|
---|
3 | *
|
---|
4 | * This module is a simple wrapper for the edit controls.
|
---|
5 | * At the point, it is good only for application who use the RICHEDIT
|
---|
6 | * control to display RTF text.
|
---|
7 | *
|
---|
8 | * Copyright 2000 by Jean-Claude Batista
|
---|
9 | *
|
---|
10 | * This library is free software; you can redistribute it and/or
|
---|
11 | * modify it under the terms of the GNU Lesser General Public
|
---|
12 | * License as published by the Free Software Foundation; either
|
---|
13 | * version 2.1 of the License, or (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This library is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
18 | * Lesser General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU Lesser General Public
|
---|
21 | * License along with this library; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
23 | */
|
---|
24 |
|
---|
25 | #include <string.h>
|
---|
26 | #include "windef.h"
|
---|
27 | #include "winbase.h"
|
---|
28 | #include "wingdi.h"
|
---|
29 | #include "winreg.h"
|
---|
30 | #include "winerror.h"
|
---|
31 | #include "riched32.h"
|
---|
32 | #include "richedit.h"
|
---|
33 | #include "charlist.h"
|
---|
34 | #define NO_SHLWAPI_STREAM
|
---|
35 | #include "shlwapi.h"
|
---|
36 |
|
---|
37 | #include "rtf.h"
|
---|
38 | #include "rtf2text.h"
|
---|
39 | #include "wine/debug.h"
|
---|
40 |
|
---|
41 | #define ID_EDIT 1
|
---|
42 |
|
---|
43 | WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
---|
44 |
|
---|
45 | HANDLE RICHED32_hHeap = (HANDLE)NULL;
|
---|
46 | /* LPSTR RICHED32_aSubclass = (LPSTR)NULL; */
|
---|
47 |
|
---|
48 | #define DPRINTF_EDIT_MSG32(str) \
|
---|
49 | TRACE(\
|
---|
50 | "32 bit : " str ": hwnd=%p, wParam=%08x, lParam=%08x\n"\
|
---|
51 | , \
|
---|
52 | hwnd, (UINT)wParam, (UINT)lParam)
|
---|
53 |
|
---|
54 | #ifdef __WIN32OS2__
|
---|
55 | #define RICHEDIT_WND_PROP "RICHEDIT_PROP"
|
---|
56 |
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | /***********************************************************************
|
---|
60 | * DllMain [Internal] Initializes the internal 'RICHED32.DLL'.
|
---|
61 | *
|
---|
62 | * PARAMS
|
---|
63 | * hinstDLL [I] handle to the DLL's instance
|
---|
64 | * fdwReason [I]
|
---|
65 | * lpvReserved [I] reserved, must be NULL
|
---|
66 | *
|
---|
67 | * RETURNS
|
---|
68 | * Success: TRUE
|
---|
69 | * Failure: FALSE
|
---|
70 | */
|
---|
71 |
|
---|
72 | #ifdef __WIN32OS2__
|
---|
73 | BOOL WINAPI RICHED32_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
---|
74 | #else
|
---|
75 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
---|
76 | #endif
|
---|
77 | {
|
---|
78 | TRACE("\n");
|
---|
79 | switch (fdwReason)
|
---|
80 | {
|
---|
81 | case DLL_PROCESS_ATTACH:
|
---|
82 | /* create private heap */
|
---|
83 | RICHED32_hHeap = HeapCreate (0, 0x10000, 0);
|
---|
84 | /* register the Rich Edit class */
|
---|
85 | RICHED32_Register ();
|
---|
86 | break;
|
---|
87 |
|
---|
88 | case DLL_PROCESS_DETACH:
|
---|
89 | /* unregister all common control classes */
|
---|
90 | RICHED32_Unregister ();
|
---|
91 | HeapDestroy (RICHED32_hHeap);
|
---|
92 | RICHED32_hHeap = (HANDLE)NULL;
|
---|
93 | break;
|
---|
94 | }
|
---|
95 | return TRUE;
|
---|
96 | }
|
---|
97 |
|
---|
98 | /* Support routines for window procedure */
|
---|
99 | INT RICHEDIT_GetTextRange(HWND hwnd,TEXTRANGEA *tr);
|
---|
100 | INT RICHEDIT_GetSelText(HWND hwnd,LPSTR lpstrBuffer);
|
---|
101 |
|
---|
102 |
|
---|
103 | /*
|
---|
104 | *
|
---|
105 | * DESCRIPTION:
|
---|
106 | * Window procedure of the RichEdit control.
|
---|
107 | *
|
---|
108 | */
|
---|
109 | static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
---|
110 | LPARAM lParam)
|
---|
111 | {
|
---|
112 | int RTFToBuffer(char* pBuffer, int nBufferSize);
|
---|
113 | LONG newstyle = 0;
|
---|
114 | LONG style = 0;
|
---|
115 |
|
---|
116 | #ifdef __WIN32OS2__
|
---|
117 | HWND hwndEdit;
|
---|
118 | HWND hwndParent;
|
---|
119 | char* rtfBuffer;
|
---|
120 | HANDLE hProp = 0;
|
---|
121 | int rtfBufferSize;
|
---|
122 |
|
---|
123 | CHARRANGE *cr;
|
---|
124 | #else
|
---|
125 | static HWND hwndEdit;
|
---|
126 | static HWND hwndParent;
|
---|
127 | static char* rtfBuffer;
|
---|
128 | int rtfBufferSize;
|
---|
129 |
|
---|
130 | CHARRANGE *cr;
|
---|
131 | TRACE("previous hwndEdit: %p hwndParent %p\n",hwndEdit,hwndParent);
|
---|
132 | #endif
|
---|
133 | hwndEdit = GetWindow(hwnd,GW_CHILD);
|
---|
134 | TRACE("uMsg: 0x%x hwnd: %p hwndEdit: %p\n",uMsg,hwnd,hwndEdit);
|
---|
135 |
|
---|
136 | switch (uMsg)
|
---|
137 | {
|
---|
138 |
|
---|
139 | case WM_CREATE :
|
---|
140 | DPRINTF_EDIT_MSG32("WM_CREATE");
|
---|
141 |
|
---|
142 | /* remove SCROLLBARS from the current window style */
|
---|
143 | hwndParent = ((LPCREATESTRUCTA) lParam)->hwndParent;
|
---|
144 |
|
---|
145 | newstyle = style = ((LPCREATESTRUCTA) lParam)->style;
|
---|
146 | newstyle &= ~WS_HSCROLL;
|
---|
147 | newstyle &= ~WS_VSCROLL;
|
---|
148 | newstyle &= ~ES_AUTOHSCROLL;
|
---|
149 | newstyle &= ~ES_AUTOVSCROLL;
|
---|
150 |
|
---|
151 | TRACE("previous hwndEdit: %p\n",hwndEdit);
|
---|
152 | hwndEdit = CreateWindowA ("edit", ((LPCREATESTRUCTA) lParam)->lpszName,
|
---|
153 | style, 0, 0, 0, 0,
|
---|
154 | hwnd, (HMENU) ID_EDIT,
|
---|
155 | ((LPCREATESTRUCTA) lParam)->hInstance, NULL) ;
|
---|
156 | TRACE("hwndEdit: %p hwnd: %p\n",hwndEdit,hwnd);
|
---|
157 |
|
---|
158 | SetWindowLongA(hwnd,GWL_STYLE, newstyle);
|
---|
159 | #ifdef __WIN32OS2__
|
---|
160 | {
|
---|
161 | CHARFORMAT2A *pcf;
|
---|
162 |
|
---|
163 | hProp = GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT, sizeof(CHARFORMAT2A));
|
---|
164 | SetPropA(hwnd, RICHEDIT_WND_PROP, hProp);
|
---|
165 | pcf = (CHARFORMAT2A *)GlobalLock(hProp);
|
---|
166 | if(pcf) {
|
---|
167 | pcf->cbSize = sizeof(CHARFORMAT2A);
|
---|
168 | GlobalUnlock(hProp);
|
---|
169 | }
|
---|
170 | }
|
---|
171 | #endif
|
---|
172 | return 0 ;
|
---|
173 |
|
---|
174 | case WM_SETFOCUS :
|
---|
175 | DPRINTF_EDIT_MSG32("WM_SETFOCUS");
|
---|
176 | SetFocus (hwndEdit) ;
|
---|
177 | return 0 ;
|
---|
178 |
|
---|
179 | case WM_SIZE :
|
---|
180 | DPRINTF_EDIT_MSG32("WM_SIZE");
|
---|
181 | MoveWindow (hwndEdit, 0, 0, LOWORD (lParam), HIWORD (lParam), TRUE) ;
|
---|
182 | return 0 ;
|
---|
183 |
|
---|
184 | case WM_COMMAND :
|
---|
185 | DPRINTF_EDIT_MSG32("WM_COMMAND");
|
---|
186 | switch(HIWORD(wParam)) {
|
---|
187 | case EN_CHANGE:
|
---|
188 | case EN_HSCROLL:
|
---|
189 | case EN_KILLFOCUS:
|
---|
190 | case EN_SETFOCUS:
|
---|
191 | case EN_UPDATE:
|
---|
192 | case EN_VSCROLL:
|
---|
193 | return SendMessageA(hwndParent, WM_COMMAND,
|
---|
194 | wParam, (LPARAM)(hwnd));
|
---|
195 |
|
---|
196 | case EN_ERRSPACE:
|
---|
197 | case EN_MAXTEXT:
|
---|
198 | MessageBoxA (hwnd, "RichEdit control out of space.",
|
---|
199 | "ERROR", MB_OK | MB_ICONSTOP) ;
|
---|
200 | return 0 ;
|
---|
201 | }
|
---|
202 |
|
---|
203 | case EM_STREAMIN:
|
---|
204 | DPRINTF_EDIT_MSG32("EM_STREAMIN");
|
---|
205 |
|
---|
206 | /* setup the RTF parser */
|
---|
207 | RTFSetEditStream(( EDITSTREAM*)lParam);
|
---|
208 | rtfFormat = wParam&(SF_TEXT|SF_RTF);
|
---|
209 | WriterInit();
|
---|
210 | RTFInit ();
|
---|
211 | BeginFile();
|
---|
212 |
|
---|
213 | /* do the parsing */
|
---|
214 | RTFRead ();
|
---|
215 |
|
---|
216 | rtfBufferSize = RTFToBuffer(NULL, 0);
|
---|
217 | rtfBuffer = HeapAlloc(RICHED32_hHeap, 0,rtfBufferSize*sizeof(char));
|
---|
218 | if(rtfBuffer)
|
---|
219 | {
|
---|
220 | RTFToBuffer(rtfBuffer, rtfBufferSize);
|
---|
221 | SetWindowTextA(hwndEdit,rtfBuffer);
|
---|
222 | HeapFree(RICHED32_hHeap, 0,rtfBuffer);
|
---|
223 | }
|
---|
224 | else
|
---|
225 | WARN("Not enough memory for a allocating rtfBuffer\n");
|
---|
226 |
|
---|
227 | return 0;
|
---|
228 |
|
---|
229 | /* Messages specific to Richedit controls */
|
---|
230 |
|
---|
231 | case EM_AUTOURLDETECT:
|
---|
232 | DPRINTF_EDIT_MSG32("EM_AUTOURLDETECT Ignored");
|
---|
233 | return 0;
|
---|
234 |
|
---|
235 | case EM_CANPASTE:
|
---|
236 | DPRINTF_EDIT_MSG32("EM_CANPASTE Ignored");
|
---|
237 | return 0;
|
---|
238 |
|
---|
239 | case EM_CANREDO:
|
---|
240 | DPRINTF_EDIT_MSG32("EM_CANREDO Ignored");
|
---|
241 | return 0;
|
---|
242 |
|
---|
243 | case EM_DISPLAYBAND:
|
---|
244 | DPRINTF_EDIT_MSG32("EM_DISPLAYBAND Ignored");
|
---|
245 | return 0;
|
---|
246 |
|
---|
247 | case EM_EXGETSEL:
|
---|
248 | DPRINTF_EDIT_MSG32("EM_EXGETSEL -> EM_GETSEL");
|
---|
249 | cr = (VOID *) lParam;
|
---|
250 | if (hwndEdit) SendMessageA( hwndEdit, EM_GETSEL, (INT)&cr->cpMin, (INT)&cr->cpMax);
|
---|
251 | TRACE("cpMin: 0x%x cpMax: 0x%x\n",(INT)cr->cpMin,(INT)cr->cpMax);
|
---|
252 | return 0;
|
---|
253 |
|
---|
254 | case EM_EXLIMITTEXT:
|
---|
255 | {
|
---|
256 | DWORD limit = lParam;
|
---|
257 | DPRINTF_EDIT_MSG32("EM_EXLIMITTEXT");
|
---|
258 | if (limit > 65534)
|
---|
259 | {
|
---|
260 | limit = 0xFFFFFFFF;
|
---|
261 | }
|
---|
262 | return SendMessageA(hwndEdit,EM_SETLIMITTEXT,limit,0);
|
---|
263 | }
|
---|
264 |
|
---|
265 | case EM_EXLINEFROMCHAR:
|
---|
266 | DPRINTF_EDIT_MSG32("EM_EXLINEFROMCHAR -> LINEFROMCHAR");
|
---|
267 | if (hwndEdit) return SendMessageA( hwndEdit, EM_LINEFROMCHAR, lParam, wParam);
|
---|
268 | return 0;
|
---|
269 |
|
---|
270 | case EM_EXSETSEL:
|
---|
271 | DPRINTF_EDIT_MSG32("EM_EXSETSEL -> EM_SETSEL");
|
---|
272 | cr = (VOID *) lParam;
|
---|
273 | if (hwndEdit) SendMessageA( hwndEdit, EM_SETSEL, cr->cpMin, cr->cpMax);
|
---|
274 | return 0;
|
---|
275 |
|
---|
276 | case EM_FINDTEXT:
|
---|
277 | DPRINTF_EDIT_MSG32("EM_FINDTEXT Ignored");
|
---|
278 | return 0;
|
---|
279 |
|
---|
280 | case EM_FINDTEXTEX:
|
---|
281 | DPRINTF_EDIT_MSG32("EM_FINDTEXTEX Ignored");
|
---|
282 | return 0;
|
---|
283 |
|
---|
284 | case EM_FINDTEXTEXW:
|
---|
285 | DPRINTF_EDIT_MSG32("EM_FINDTEXTEXW Ignored");
|
---|
286 | return 0;
|
---|
287 |
|
---|
288 | case EM_FINDTEXTW:
|
---|
289 | DPRINTF_EDIT_MSG32("EM_FINDTEXTW Ignored");
|
---|
290 | return 0;
|
---|
291 |
|
---|
292 | case EM_FINDWORDBREAK:
|
---|
293 | DPRINTF_EDIT_MSG32("EM_FINDWORDBREAK Ignored");
|
---|
294 | return 0;
|
---|
295 |
|
---|
296 | case EM_FORMATRANGE:
|
---|
297 | DPRINTF_EDIT_MSG32("EM_FORMATRANGE Ignored");
|
---|
298 | return 0;
|
---|
299 |
|
---|
300 | case EM_GETAUTOURLDETECT:
|
---|
301 | DPRINTF_EDIT_MSG32("EM_GETAUTOURLDETECT Ignored");
|
---|
302 | return 0;
|
---|
303 |
|
---|
304 | case EM_GETBIDIOPTIONS:
|
---|
305 | DPRINTF_EDIT_MSG32("EM_GETBIDIOPTIONS Ignored");
|
---|
306 | return 0;
|
---|
307 |
|
---|
308 | case EM_GETCHARFORMAT:
|
---|
309 | DPRINTF_EDIT_MSG32("EM_GETCHARFORMAT Ignored");
|
---|
310 | return 0;
|
---|
311 |
|
---|
312 | case EM_GETEDITSTYLE:
|
---|
313 | DPRINTF_EDIT_MSG32("EM_GETEDITSTYLE Ignored");
|
---|
314 | return 0;
|
---|
315 |
|
---|
316 | case EM_GETEVENTMASK:
|
---|
317 | DPRINTF_EDIT_MSG32("EM_GETEVENTMASK Ignored");
|
---|
318 | return 0;
|
---|
319 |
|
---|
320 | case EM_GETIMECOLOR:
|
---|
321 | DPRINTF_EDIT_MSG32("EM_GETIMECOLOR Ignored");
|
---|
322 | return 0;
|
---|
323 |
|
---|
324 | case EM_GETIMECOMPMODE:
|
---|
325 | DPRINTF_EDIT_MSG32("EM_GETIMECOMPMODE Ignored");
|
---|
326 | return 0;
|
---|
327 |
|
---|
328 | case EM_GETIMEOPTIONS:
|
---|
329 | DPRINTF_EDIT_MSG32("EM_GETIMEOPTIONS Ignored");
|
---|
330 | return 0;
|
---|
331 |
|
---|
332 | case EM_GETLANGOPTIONS:
|
---|
333 | DPRINTF_EDIT_MSG32("STUB: EM_GETLANGOPTIONS");
|
---|
334 | return 0;
|
---|
335 |
|
---|
336 | case EM_GETOLEINTERFACE:
|
---|
337 | DPRINTF_EDIT_MSG32("EM_GETOLEINTERFACE Ignored");
|
---|
338 | return 0;
|
---|
339 |
|
---|
340 | case EM_GETOPTIONS:
|
---|
341 | DPRINTF_EDIT_MSG32("EM_GETOPTIONS Ignored");
|
---|
342 | return 0;
|
---|
343 |
|
---|
344 | case EM_GETPARAFORMAT:
|
---|
345 | DPRINTF_EDIT_MSG32("EM_GETPARAFORMAT Ignored");
|
---|
346 | return 0;
|
---|
347 |
|
---|
348 | case EM_GETPUNCTUATION:
|
---|
349 | DPRINTF_EDIT_MSG32("EM_GETPUNCTUATION Ignored");
|
---|
350 | return 0;
|
---|
351 |
|
---|
352 | case EM_GETREDONAME:
|
---|
353 | DPRINTF_EDIT_MSG32("EM_GETREDONAME Ignored");
|
---|
354 | return 0;
|
---|
355 |
|
---|
356 | case EM_GETSCROLLPOS:
|
---|
357 | DPRINTF_EDIT_MSG32("EM_GETSCROLLPOS Ignored");
|
---|
358 | return 0;
|
---|
359 |
|
---|
360 | case EM_GETSELTEXT:
|
---|
361 | DPRINTF_EDIT_MSG32("EM_GETSELTEXT");
|
---|
362 | return RICHEDIT_GetSelText(hwndEdit,(void *)lParam);
|
---|
363 |
|
---|
364 | case EM_GETTEXTEX:
|
---|
365 | DPRINTF_EDIT_MSG32("EM_GETTEXTEX Ignored");
|
---|
366 | return 0;
|
---|
367 |
|
---|
368 | case EM_GETTEXTLENGTHEX:
|
---|
369 | DPRINTF_EDIT_MSG32("EM_GETTEXTLENGTHEX Ignored");
|
---|
370 | return 0;
|
---|
371 |
|
---|
372 | case EM_GETTEXTMODE:
|
---|
373 | DPRINTF_EDIT_MSG32("EM_GETTEXTMODE Ignored");
|
---|
374 | return 0;
|
---|
375 |
|
---|
376 | case EM_GETTEXTRANGE:
|
---|
377 | DPRINTF_EDIT_MSG32("EM_GETTEXTRANGE");
|
---|
378 | return RICHEDIT_GetTextRange(hwndEdit,(TEXTRANGEA *)lParam);
|
---|
379 |
|
---|
380 | case EM_GETTYPOGRAPHYOPTIONS:
|
---|
381 | DPRINTF_EDIT_MSG32("EM_GETTYPOGRAPHYOPTIONS Ignored");
|
---|
382 | return 0;
|
---|
383 |
|
---|
384 | case EM_GETUNDONAME:
|
---|
385 | DPRINTF_EDIT_MSG32("EM_GETUNDONAME Ignored");
|
---|
386 | return 0;
|
---|
387 |
|
---|
388 | case EM_GETWORDBREAKPROCEX:
|
---|
389 | DPRINTF_EDIT_MSG32("EM_GETWORDBREAKPROCEX Ignored");
|
---|
390 | return 0;
|
---|
391 |
|
---|
392 | case EM_GETWORDWRAPMODE:
|
---|
393 | DPRINTF_EDIT_MSG32("EM_GETWORDWRAPMODE Ignored");
|
---|
394 | return 0;
|
---|
395 |
|
---|
396 | case EM_GETZOOM:
|
---|
397 | DPRINTF_EDIT_MSG32("EM_GETZOOM Ignored");
|
---|
398 | return 0;
|
---|
399 |
|
---|
400 | case EM_HIDESELECTION:
|
---|
401 | DPRINTF_EDIT_MSG32("EM_HIDESELECTION Ignored");
|
---|
402 | return 0;
|
---|
403 |
|
---|
404 | case EM_PASTESPECIAL:
|
---|
405 | DPRINTF_EDIT_MSG32("EM_PASTESPECIAL Ignored");
|
---|
406 | return 0;
|
---|
407 |
|
---|
408 | case EM_RECONVERSION:
|
---|
409 | DPRINTF_EDIT_MSG32("EM_RECONVERSION Ignored");
|
---|
410 | return 0;
|
---|
411 |
|
---|
412 | case EM_REDO:
|
---|
413 | DPRINTF_EDIT_MSG32("EM_REDO Ignored");
|
---|
414 | return 0;
|
---|
415 |
|
---|
416 | case EM_REQUESTRESIZE:
|
---|
417 | DPRINTF_EDIT_MSG32("EM_REQUESTRESIZE Ignored");
|
---|
418 | return 0;
|
---|
419 |
|
---|
420 | case EM_SELECTIONTYPE:
|
---|
421 | DPRINTF_EDIT_MSG32("EM_SELECTIONTYPE Ignored");
|
---|
422 | return 0;
|
---|
423 |
|
---|
424 | case EM_SETBIDIOPTIONS:
|
---|
425 | DPRINTF_EDIT_MSG32("EM_SETBIDIOPTIONS Ignored");
|
---|
426 | return 0;
|
---|
427 |
|
---|
428 | case EM_SETBKGNDCOLOR:
|
---|
429 | #ifdef __WIN32OS2__
|
---|
430 | {
|
---|
431 | CHARFORMAT2A *pcf;
|
---|
432 |
|
---|
433 | hProp = GetPropA(hwnd, RICHEDIT_WND_PROP);
|
---|
434 | pcf = (CHARFORMAT2A *)GlobalLock(hProp);
|
---|
435 | if(pcf)
|
---|
436 | {
|
---|
437 | pcf->dwMask |= CFM_BACKCOLOR;
|
---|
438 | pcf->crBackColor = (wParam) ? GetSysColor(COLOR_BACKGROUND) : (COLORREF)lParam;
|
---|
439 |
|
---|
440 | //Destroy old brush if present
|
---|
441 | if(pcf->dwReserved) DeleteObject(pcf->dwReserved);
|
---|
442 |
|
---|
443 | //Create a brush that we return in WM_CTLCOLORSTATIC
|
---|
444 | pcf->dwReserved = (DWORD)CreateSolidBrush(pcf->crBackColor);
|
---|
445 |
|
---|
446 | dprintf(("Set background color to %x brush %x", pcf->crBackColor, pcf->dwReserved));
|
---|
447 |
|
---|
448 | GlobalUnlock(hProp);
|
---|
449 | }
|
---|
450 | }
|
---|
451 | #endif
|
---|
452 | DPRINTF_EDIT_MSG32("EM_SETBKGNDCOLOR Ignored");
|
---|
453 | return 0;
|
---|
454 |
|
---|
455 | case EM_SETCHARFORMAT:
|
---|
456 | #ifdef __WIN32OS2__
|
---|
457 | {
|
---|
458 | CHARFORMAT2A *pnewcf = (CHARFORMAT2A *)lParam;
|
---|
459 | CHARFORMAT2A *pcf;
|
---|
460 |
|
---|
461 | hProp = GetPropA(hwnd, RICHEDIT_WND_PROP);
|
---|
462 | pcf = (CHARFORMAT2A *)GlobalLock(hProp);
|
---|
463 | if(pcf && pnewcf && pnewcf->cbSize >= sizeof(CHARFORMATA))
|
---|
464 | {
|
---|
465 | if((pnewcf->dwMask & CFM_COLOR) && !(pnewcf->dwEffects & CFE_AUTOCOLOR)) {
|
---|
466 | pcf->dwMask |= CFM_COLOR;
|
---|
467 | pcf->crTextColor = pnewcf->crTextColor;
|
---|
468 | dprintf(("Set text color to %x", pcf->crTextColor));
|
---|
469 | }
|
---|
470 | if(pnewcf->cbSize == sizeof(CHARFORMAT2A))
|
---|
471 | {
|
---|
472 | if((pnewcf->dwMask & CFM_BACKCOLOR) && !(pnewcf->dwEffects & CFE_AUTOBACKCOLOR))
|
---|
473 | {
|
---|
474 | pcf->dwMask |= CFM_BACKCOLOR;
|
---|
475 | pcf->crBackColor = pnewcf->crBackColor;
|
---|
476 |
|
---|
477 | //Destroy old brush if present
|
---|
478 | if(pcf->dwReserved) DeleteObject(pcf->dwReserved);
|
---|
479 |
|
---|
480 | //Create a brush that we return in WM_CTLCOLORSTATIC
|
---|
481 | pcf->dwReserved = (DWORD)CreateSolidBrush(pcf->crBackColor);
|
---|
482 |
|
---|
483 | dprintf(("Set background color to %x brush %x", pcf->crBackColor, pcf->dwReserved));
|
---|
484 | }
|
---|
485 | }
|
---|
486 | }
|
---|
487 |
|
---|
488 | if(pcf) GlobalUnlock(hProp);
|
---|
489 | }
|
---|
490 | #else
|
---|
491 | DPRINTF_EDIT_MSG32("EM_SETCHARFORMAT Ignored");
|
---|
492 | #endif
|
---|
493 | return 0;
|
---|
494 |
|
---|
495 | case EM_SETEDITSTYLE:
|
---|
496 | DPRINTF_EDIT_MSG32("EM_SETEDITSTYLE Ignored");
|
---|
497 | return 0;
|
---|
498 |
|
---|
499 | case EM_SETEVENTMASK:
|
---|
500 | DPRINTF_EDIT_MSG32("EM_SETEVENTMASK Ignored");
|
---|
501 | return 0;
|
---|
502 |
|
---|
503 | case EM_SETFONTSIZE:
|
---|
504 | DPRINTF_EDIT_MSG32("EM_SETFONTSIZE Ignored");
|
---|
505 | return 0;
|
---|
506 |
|
---|
507 | case EM_SETIMECOLOR:
|
---|
508 | DPRINTF_EDIT_MSG32("EM_SETIMECOLO Ignored");
|
---|
509 | return 0;
|
---|
510 |
|
---|
511 | case EM_SETIMEOPTIONS:
|
---|
512 | DPRINTF_EDIT_MSG32("EM_SETIMEOPTIONS Ignored");
|
---|
513 | return 0;
|
---|
514 |
|
---|
515 | case EM_SETLANGOPTIONS:
|
---|
516 | DPRINTF_EDIT_MSG32("EM_SETLANGOPTIONS Ignored");
|
---|
517 | return 0;
|
---|
518 |
|
---|
519 | case EM_SETOLECALLBACK:
|
---|
520 | DPRINTF_EDIT_MSG32("EM_SETOLECALLBACK Ignored");
|
---|
521 | return 0;
|
---|
522 |
|
---|
523 | case EM_SETOPTIONS:
|
---|
524 | DPRINTF_EDIT_MSG32("EM_SETOPTIONS Ignored");
|
---|
525 | return 0;
|
---|
526 |
|
---|
527 | case EM_SETPALETTE:
|
---|
528 | DPRINTF_EDIT_MSG32("EM_SETPALETTE Ignored");
|
---|
529 | return 0;
|
---|
530 |
|
---|
531 | case EM_SETPARAFORMAT:
|
---|
532 | DPRINTF_EDIT_MSG32("EM_SETPARAFORMAT Ignored");
|
---|
533 | return 0;
|
---|
534 |
|
---|
535 | case EM_SETPUNCTUATION:
|
---|
536 | DPRINTF_EDIT_MSG32("EM_SETPUNCTUATION Ignored");
|
---|
537 | return 0;
|
---|
538 |
|
---|
539 | case EM_SETSCROLLPOS:
|
---|
540 | DPRINTF_EDIT_MSG32("EM_SETSCROLLPOS Ignored");
|
---|
541 | return 0;
|
---|
542 |
|
---|
543 | case EM_SETTARGETDEVICE:
|
---|
544 | DPRINTF_EDIT_MSG32("EM_SETTARGETDEVICE Ignored");
|
---|
545 | return 0;
|
---|
546 |
|
---|
547 | case EM_SETTEXTEX:
|
---|
548 | DPRINTF_EDIT_MSG32("EM_SETTEXTEX Ignored");
|
---|
549 | return 0;
|
---|
550 |
|
---|
551 | case EM_SETTEXTMODE:
|
---|
552 | DPRINTF_EDIT_MSG32("EM_SETTEXTMODE Ignored");
|
---|
553 | return 0;
|
---|
554 |
|
---|
555 | case EM_SETTYPOGRAPHYOPTIONS:
|
---|
556 | DPRINTF_EDIT_MSG32("EM_SETTYPOGRAPHYOPTIONS Ignored");
|
---|
557 | return 0;
|
---|
558 |
|
---|
559 | case EM_SETUNDOLIMIT:
|
---|
560 | DPRINTF_EDIT_MSG32("EM_SETUNDOLIMIT Ignored");
|
---|
561 | return 0;
|
---|
562 |
|
---|
563 | case EM_SETWORDBREAKPROCEX:
|
---|
564 | DPRINTF_EDIT_MSG32("EM_SETWORDBREAKPROCEX Ignored");
|
---|
565 | return 0;
|
---|
566 |
|
---|
567 | case EM_SETWORDWRAPMODE:
|
---|
568 | DPRINTF_EDIT_MSG32("EM_SETWORDWRAPMODE Ignored");
|
---|
569 | return 0;
|
---|
570 |
|
---|
571 | case EM_SETZOOM:
|
---|
572 | DPRINTF_EDIT_MSG32("EM_SETZOOM Ignored");
|
---|
573 | return 0;
|
---|
574 |
|
---|
575 | case EM_SHOWSCROLLBAR:
|
---|
576 | DPRINTF_EDIT_MSG32("EM_SHOWSCROLLBAR Ignored");
|
---|
577 | return 0;
|
---|
578 |
|
---|
579 | case EM_STOPGROUPTYPING:
|
---|
580 | DPRINTF_EDIT_MSG32("EM_STOPGROUPTYPING Ignored");
|
---|
581 | return 0;
|
---|
582 |
|
---|
583 | case EM_STREAMOUT:
|
---|
584 | DPRINTF_EDIT_MSG32("EM_STREAMOUT Ignored");
|
---|
585 | return 0;
|
---|
586 |
|
---|
587 | /* Messages dispatched to the edit control */
|
---|
588 | case EM_CANUNDO:
|
---|
589 | DPRINTF_EDIT_MSG32("EM_CANUNDO Passed to edit control");
|
---|
590 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
591 | case EM_CHARFROMPOS:
|
---|
592 | DPRINTF_EDIT_MSG32("EM_CHARFROMPOS Passed to edit control");
|
---|
593 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
594 | case EM_EMPTYUNDOBUFFER:
|
---|
595 | DPRINTF_EDIT_MSG32("EM_EMPTYUNDOBUFFER Passed to edit control");
|
---|
596 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
597 | case EM_FMTLINES:
|
---|
598 | DPRINTF_EDIT_MSG32("EM_FMTLINES Passed to edit control");
|
---|
599 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
600 | case EM_GETFIRSTVISIBLELINE:
|
---|
601 | DPRINTF_EDIT_MSG32("EM_GETFIRSTVISIBLELINE Passed to edit control");
|
---|
602 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
603 | case EM_GETHANDLE:
|
---|
604 | DPRINTF_EDIT_MSG32("EM_GETHANDLE Passed to edit control");
|
---|
605 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
606 | /* case EM_GETIMESTATUS:*/
|
---|
607 | case EM_GETLIMITTEXT:
|
---|
608 | DPRINTF_EDIT_MSG32("EM_GETLIMITTEXT Passed to edit control");
|
---|
609 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
610 | case EM_GETLINE:
|
---|
611 | DPRINTF_EDIT_MSG32("EM_GETLINE Passed to edit control");
|
---|
612 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
613 | case EM_GETLINECOUNT:
|
---|
614 | DPRINTF_EDIT_MSG32("EM_GETLINECOUNT Passed to edit control");
|
---|
615 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
616 | case EM_GETMARGINS:
|
---|
617 | DPRINTF_EDIT_MSG32("EM_GETMARGINS Passed to edit control");
|
---|
618 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
619 | case EM_GETMODIFY:
|
---|
620 | DPRINTF_EDIT_MSG32("EM_GETMODIFY Passed to edit control");
|
---|
621 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
622 | case EM_GETPASSWORDCHAR:
|
---|
623 | DPRINTF_EDIT_MSG32("EM_GETPASSWORDCHAR Passed to edit control");
|
---|
624 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
625 | case EM_GETRECT:
|
---|
626 | DPRINTF_EDIT_MSG32("EM_GETRECT Passed to edit control");
|
---|
627 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
628 | case EM_GETSEL:
|
---|
629 | DPRINTF_EDIT_MSG32("EM_GETSEL Passed to edit control");
|
---|
630 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
631 | case EM_GETTHUMB:
|
---|
632 | DPRINTF_EDIT_MSG32("EM_GETTHUMB Passed to edit control");
|
---|
633 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
634 | case EM_GETWORDBREAKPROC:
|
---|
635 | DPRINTF_EDIT_MSG32("EM_GETWORDBREAKPROC Passed to edit control");
|
---|
636 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
637 | case EM_LINEFROMCHAR:
|
---|
638 | DPRINTF_EDIT_MSG32("EM_LINEFROMCHAR Passed to edit control");
|
---|
639 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
640 | case EM_LINEINDEX:
|
---|
641 | DPRINTF_EDIT_MSG32("EM_LINEINDEX Passed to edit control");
|
---|
642 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
643 | case EM_LINELENGTH:
|
---|
644 | DPRINTF_EDIT_MSG32("EM_LINELENGTH Passed to edit control");
|
---|
645 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
646 | case EM_LINESCROLL:
|
---|
647 | DPRINTF_EDIT_MSG32("EM_LINESCROLL Passed to edit control");
|
---|
648 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
649 | case EM_POSFROMCHAR:
|
---|
650 | DPRINTF_EDIT_MSG32("EM_POSFROMCHAR Passed to edit control");
|
---|
651 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
652 | case EM_REPLACESEL:
|
---|
653 | DPRINTF_EDIT_MSG32("case EM_REPLACESEL Passed to edit control");
|
---|
654 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
655 | case EM_SCROLL:
|
---|
656 | DPRINTF_EDIT_MSG32("case EM_SCROLL Passed to edit control");
|
---|
657 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
658 | case EM_SCROLLCARET:
|
---|
659 | DPRINTF_EDIT_MSG32("EM_SCROLLCARET Passed to edit control");
|
---|
660 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
661 | case EM_SETHANDLE:
|
---|
662 | DPRINTF_EDIT_MSG32("EM_SETHANDLE Passed to edit control");
|
---|
663 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
664 | /* case EM_SETIMESTATUS:*/
|
---|
665 | case EM_SETLIMITTEXT:
|
---|
666 | DPRINTF_EDIT_MSG32("EM_SETLIMITTEXT Passed to edit control");
|
---|
667 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
668 | case EM_SETMARGINS:
|
---|
669 | DPRINTF_EDIT_MSG32("case EM_SETMARGINS Passed to edit control");
|
---|
670 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
671 | case EM_SETMODIFY:
|
---|
672 | DPRINTF_EDIT_MSG32("EM_SETMODIFY Passed to edit control");
|
---|
673 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
674 | case EM_SETPASSWORDCHAR:
|
---|
675 | DPRINTF_EDIT_MSG32("EM_SETPASSWORDCHAR Passed to edit control");
|
---|
676 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
677 | case EM_SETREADONLY:
|
---|
678 | DPRINTF_EDIT_MSG32("EM_SETREADONLY Passed to edit control");
|
---|
679 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
680 | case EM_SETRECT:
|
---|
681 | DPRINTF_EDIT_MSG32("EM_SETRECT Passed to edit control");
|
---|
682 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
683 | case EM_SETRECTNP:
|
---|
684 | DPRINTF_EDIT_MSG32("EM_SETRECTNP Passed to edit control");
|
---|
685 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
686 | case EM_SETSEL:
|
---|
687 | DPRINTF_EDIT_MSG32("EM_SETSEL Passed to edit control");
|
---|
688 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
689 | case EM_SETTABSTOPS:
|
---|
690 | DPRINTF_EDIT_MSG32("EM_SETTABSTOPS Passed to edit control");
|
---|
691 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
692 | case EM_SETWORDBREAKPROC:
|
---|
693 | DPRINTF_EDIT_MSG32("EM_SETWORDBREAKPROC Passed to edit control");
|
---|
694 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
695 | case EM_UNDO:
|
---|
696 | DPRINTF_EDIT_MSG32("EM_UNDO Passed to edit control");
|
---|
697 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
698 |
|
---|
699 | case WM_STYLECHANGING:
|
---|
700 | DPRINTF_EDIT_MSG32("WM_STYLECHANGING Passed to edit control");
|
---|
701 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
702 | case WM_STYLECHANGED:
|
---|
703 | DPRINTF_EDIT_MSG32("WM_STYLECHANGED Passed to edit control");
|
---|
704 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
705 | case WM_NCCALCSIZE:
|
---|
706 | #ifdef __WIN32OS2__
|
---|
707 | break; //this is completely wrong, we resize the control in the WM_SIZE handler
|
---|
708 | #else
|
---|
709 | DPRINTF_EDIT_MSG32("WM_NCCALCSIZE Passed to edit control");
|
---|
710 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
711 | #endif
|
---|
712 | case WM_GETTEXT:
|
---|
713 | DPRINTF_EDIT_MSG32("WM_GETTEXT Passed to edit control");
|
---|
714 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
715 | case WM_GETTEXTLENGTH:
|
---|
716 | DPRINTF_EDIT_MSG32("WM_GETTEXTLENGTH Passed to edit control");
|
---|
717 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
718 | case WM_SETTEXT:
|
---|
719 | DPRINTF_EDIT_MSG32("WM_SETTEXT Passed to edit control");
|
---|
720 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
721 | case WM_CUT:
|
---|
722 | DPRINTF_EDIT_MSG32("WM_CUT Passed to edit control");
|
---|
723 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
724 | case WM_COPY:
|
---|
725 | DPRINTF_EDIT_MSG32("WM_COPY Passed to edit control");
|
---|
726 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
727 | case WM_PASTE:
|
---|
728 | DPRINTF_EDIT_MSG32("WM_PASTE Passed to edit control");
|
---|
729 | return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
---|
730 |
|
---|
731 | /* Messages passed to default handler. */
|
---|
732 | case WM_NCPAINT:
|
---|
733 | DPRINTF_EDIT_MSG32("WM_NCPAINT Passed to default");
|
---|
734 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
735 | case WM_PAINT:
|
---|
736 | DPRINTF_EDIT_MSG32("WM_PAINT Passed to default");
|
---|
737 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
738 | case WM_ERASEBKGND:
|
---|
739 | DPRINTF_EDIT_MSG32("WM_ERASEBKGND Passed to default");
|
---|
740 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
741 | case WM_KILLFOCUS:
|
---|
742 | DPRINTF_EDIT_MSG32("WM_KILLFOCUS Passed to default");
|
---|
743 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
744 | case WM_DESTROY:
|
---|
745 | #ifdef __WIN32OS2__
|
---|
746 | {
|
---|
747 | CHARFORMAT2A *pcf;
|
---|
748 |
|
---|
749 | hProp = GetPropA(hwnd, RICHEDIT_WND_PROP);
|
---|
750 | pcf = (CHARFORMAT2A *)GlobalLock(hProp);
|
---|
751 | if(pcf) {
|
---|
752 | //Destroy old brush if present
|
---|
753 | if(pcf->dwReserved) DeleteObject(pcf->dwReserved);
|
---|
754 | GlobalUnlock(hProp);
|
---|
755 | }
|
---|
756 |
|
---|
757 | if(hProp) GlobalFree(hProp);
|
---|
758 | RemovePropA(hwnd, RICHEDIT_WND_PROP);
|
---|
759 | }
|
---|
760 | #endif
|
---|
761 | DPRINTF_EDIT_MSG32("WM_DESTROY Passed to default");
|
---|
762 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
763 | case WM_CHILDACTIVATE:
|
---|
764 | DPRINTF_EDIT_MSG32("WM_CHILDACTIVATE Passed to default");
|
---|
765 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
766 |
|
---|
767 | case WM_WINDOWPOSCHANGING:
|
---|
768 | DPRINTF_EDIT_MSG32("WM_WINDOWPOSCHANGING Passed to default");
|
---|
769 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
770 | case WM_WINDOWPOSCHANGED:
|
---|
771 | DPRINTF_EDIT_MSG32("WM_WINDOWPOSCHANGED Passed to default");
|
---|
772 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
773 | /* case WM_INITIALUPDATE:
|
---|
774 | DPRINTF_EDIT_MSG32("WM_INITIALUPDATE Passed to default");
|
---|
775 | return DefWindowProcA( hwnd,uMsg,wParam,lParam); */
|
---|
776 | #ifndef __WIN32OS2__
|
---|
777 | case WM_CTLCOLOREDIT:
|
---|
778 | DPRINTF_EDIT_MSG32("WM_CTLCOLOREDIT Passed to default");
|
---|
779 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
780 | #endif
|
---|
781 | case WM_SETCURSOR:
|
---|
782 | DPRINTF_EDIT_MSG32("WM_SETCURSOR Passed to default");
|
---|
783 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
784 | case WM_MOVE:
|
---|
785 | DPRINTF_EDIT_MSG32("WM_MOVE Passed to default");
|
---|
786 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
787 | case WM_SHOWWINDOW:
|
---|
788 | DPRINTF_EDIT_MSG32("WM_SHOWWINDOW Passed to default");
|
---|
789 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
790 | case WM_NCCREATE:
|
---|
791 | DPRINTF_EDIT_MSG32("WM_NCCREATE Passed to default");
|
---|
792 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
793 | case WM_PARENTNOTIFY:
|
---|
794 | DPRINTF_EDIT_MSG32("WM_PARENTNOTIFY Passed to default");
|
---|
795 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
796 | case WM_SETREDRAW:
|
---|
797 | DPRINTF_EDIT_MSG32("WM_SETREDRAW Passed to default");
|
---|
798 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
799 | case WM_NCDESTROY:
|
---|
800 | DPRINTF_EDIT_MSG32("WM_NCDESTROY Passed to default");
|
---|
801 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
802 | case WM_NCHITTEST:
|
---|
803 | DPRINTF_EDIT_MSG32("WM_NCHITTEST Passed to default");
|
---|
804 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
805 | case WM_CTLCOLORSTATIC:
|
---|
806 | #ifdef __WIN32OS2__
|
---|
807 | case WM_CTLCOLOREDIT:
|
---|
808 | {
|
---|
809 | CHARFORMAT2A *pcf;
|
---|
810 | HBRUSH hBrush = 0;
|
---|
811 | HDC hdc = (HDC)wParam;
|
---|
812 |
|
---|
813 | hProp = GetPropA(hwnd, RICHEDIT_WND_PROP);
|
---|
814 | pcf = (CHARFORMAT2A *)GlobalLock(hProp);
|
---|
815 | if(pcf)
|
---|
816 | {
|
---|
817 | if(pcf->dwMask & CFM_BACKCOLOR) {
|
---|
818 | SetBkColor(hdc, pcf->crBackColor);
|
---|
819 | hBrush = pcf->dwReserved;
|
---|
820 | }
|
---|
821 | if(pcf->dwMask & CFM_COLOR) {
|
---|
822 | SetTextColor(hdc, pcf->crTextColor);
|
---|
823 | }
|
---|
824 | }
|
---|
825 | if(pcf) GlobalUnlock(hProp);
|
---|
826 |
|
---|
827 | if(hBrush) return hBrush;
|
---|
828 | }
|
---|
829 | #endif
|
---|
830 | DPRINTF_EDIT_MSG32("WM_CTLCOLORSTATIC Passed to default");
|
---|
831 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
832 | case WM_NCMOUSEMOVE:
|
---|
833 | DPRINTF_EDIT_MSG32("WM_NCMOUSEMOVE Passed to default");
|
---|
834 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
835 | case WM_CLEAR:
|
---|
836 | DPRINTF_EDIT_MSG32("WM_CLEAR Passed to default");
|
---|
837 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
838 | /*
|
---|
839 | * used by IE in the EULA box
|
---|
840 | */
|
---|
841 | case WM_ALTTABACTIVE:
|
---|
842 | DPRINTF_EDIT_MSG32("WM_ALTTABACTIVE");
|
---|
843 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
844 | case WM_GETDLGCODE:
|
---|
845 | DPRINTF_EDIT_MSG32("WM_GETDLGCODE");
|
---|
846 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
847 | case WM_SETFONT:
|
---|
848 | DPRINTF_EDIT_MSG32("WM_SETFONT");
|
---|
849 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
850 |
|
---|
851 | }
|
---|
852 |
|
---|
853 | FIXME("Unknown message 0x%x Passed to default hwnd=%p, wParam=%08x, lParam=%08x\n",
|
---|
854 | uMsg, hwnd, (UINT)wParam, (UINT)lParam);
|
---|
855 |
|
---|
856 | return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
---|
857 | }
|
---|
858 |
|
---|
859 | /***********************************************************************
|
---|
860 | * DllGetVersion [RICHED32.2]
|
---|
861 | *
|
---|
862 | * Retrieves version information of the 'RICHED32.DLL'
|
---|
863 | *
|
---|
864 | * PARAMS
|
---|
865 | * pdvi [O] pointer to version information structure.
|
---|
866 | *
|
---|
867 | * RETURNS
|
---|
868 | * Success: S_OK
|
---|
869 | * Failure: E_INVALIDARG
|
---|
870 | *
|
---|
871 | * NOTES
|
---|
872 | * Returns version of a comctl32.dll from IE4.01 SP1.
|
---|
873 | */
|
---|
874 |
|
---|
875 | HRESULT WINAPI
|
---|
876 | RICHED32_DllGetVersion (DLLVERSIONINFO *pdvi)
|
---|
877 | {
|
---|
878 | TRACE("\n");
|
---|
879 |
|
---|
880 | if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
|
---|
881 |
|
---|
882 | return E_INVALIDARG;
|
---|
883 | }
|
---|
884 |
|
---|
885 | pdvi->dwMajorVersion = 4;
|
---|
886 | pdvi->dwMinorVersion = 0;
|
---|
887 | pdvi->dwBuildNumber = 0;
|
---|
888 | pdvi->dwPlatformID = 0;
|
---|
889 |
|
---|
890 | return S_OK;
|
---|
891 | }
|
---|
892 |
|
---|
893 | /***
|
---|
894 | * DESCRIPTION:
|
---|
895 | * Registers the window class.
|
---|
896 | *
|
---|
897 | * PARAMETER(S):
|
---|
898 | * None
|
---|
899 | *
|
---|
900 | * RETURN:
|
---|
901 | * None
|
---|
902 | */
|
---|
903 | VOID RICHED32_Register(void)
|
---|
904 | {
|
---|
905 | WNDCLASSA wndClass;
|
---|
906 |
|
---|
907 | TRACE("\n");
|
---|
908 |
|
---|
909 | ZeroMemory(&wndClass, sizeof(WNDCLASSA));
|
---|
910 | wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
|
---|
911 | wndClass.lpfnWndProc = (WNDPROC)RICHED32_WindowProc;
|
---|
912 | wndClass.cbClsExtra = 0;
|
---|
913 | wndClass.cbWndExtra = 0; /*(sizeof(RICHED32_INFO *);*/
|
---|
914 | wndClass.hCursor = LoadCursorA(0, IDC_ARROWA);
|
---|
915 | wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
---|
916 | wndClass.lpszClassName = RICHEDIT_CLASS10A; /* WC_RICHED32A; */
|
---|
917 |
|
---|
918 | RegisterClassA (&wndClass);
|
---|
919 | }
|
---|
920 |
|
---|
921 | /***
|
---|
922 | * DESCRIPTION:
|
---|
923 | * Unregisters the window class.
|
---|
924 | *
|
---|
925 | * PARAMETER(S):
|
---|
926 | * None
|
---|
927 | *
|
---|
928 | * RETURN:
|
---|
929 | * None
|
---|
930 | */
|
---|
931 | VOID RICHED32_Unregister(void)
|
---|
932 | {
|
---|
933 | TRACE("\n");
|
---|
934 |
|
---|
935 | UnregisterClassA(RICHEDIT_CLASS10A, (HINSTANCE)NULL);
|
---|
936 | }
|
---|
937 |
|
---|
938 | INT RICHEDIT_GetTextRange(HWND hwnd,TEXTRANGEA *tr)
|
---|
939 | {
|
---|
940 | UINT alloc_size, text_size, range_size;
|
---|
941 | char *text;
|
---|
942 |
|
---|
943 | TRACE("start: 0x%x stop: 0x%x\n",(INT)tr->chrg.cpMin,(INT)tr->chrg.cpMax);
|
---|
944 |
|
---|
945 | if (!(alloc_size = SendMessageA(hwnd,WM_GETTEXTLENGTH,0,0))) return FALSE;
|
---|
946 | if (!(text = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (alloc_size+1))))
|
---|
947 | return FALSE;
|
---|
948 | text_size = SendMessageA(hwnd,WM_GETTEXT,alloc_size,(INT)text);
|
---|
949 |
|
---|
950 | if (text_size > tr->chrg.cpMin)
|
---|
951 | {
|
---|
952 | range_size = (text_size> tr->chrg.cpMax) ? (tr->chrg.cpMax - tr->chrg.cpMin) : (text_size - tr->chrg.cpMin);
|
---|
953 | TRACE("EditText: %.30s ...\n",text+tr->chrg.cpMin);
|
---|
954 | memcpy(tr->lpstrText,text+tr->chrg.cpMin,range_size);
|
---|
955 | }
|
---|
956 | else range_size = 0;
|
---|
957 | HeapFree(GetProcessHeap(), 0, text);
|
---|
958 |
|
---|
959 | return range_size;
|
---|
960 | }
|
---|
961 |
|
---|
962 | INT RICHEDIT_GetSelText(HWND hwnd,LPSTR lpstrBuffer)
|
---|
963 | {
|
---|
964 | TEXTRANGEA textrange;
|
---|
965 |
|
---|
966 | textrange.lpstrText = lpstrBuffer;
|
---|
967 | SendMessageA(hwnd,EM_GETSEL,(INT)&textrange.chrg.cpMin,(INT)&textrange.chrg.cpMax);
|
---|
968 | return RICHEDIT_GetTextRange(hwnd,&textrange);
|
---|
969 | }
|
---|