Mercurial > dwindows
comparison os2/dw.c @ 1757:7b049aaca615
Fixes for building on OS/2 in ANSI mode.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 17 Jun 2012 17:04:53 +0000 |
parents | 873960d28f01 |
children | 47e503ecc812 |
comparison
equal
deleted
inserted
replaced
1756:873960d28f01 | 1757:7b049aaca615 |
---|---|
2330 } | 2330 } |
2331 else | 2331 else |
2332 WinSetFocus(HWND_DESKTOP, handle); | 2332 WinSetFocus(HWND_DESKTOP, handle); |
2333 } | 2333 } |
2334 | 2334 |
2335 #define ENTRY_CUT 60901 | |
2336 #define ENTRY_COPY 60902 | |
2337 #define ENTRY_PASTE 60903 | |
2338 #define ENTRY_UNDO 60904 | |
2339 #define ENTRY_SALL 60905 | |
2340 | |
2335 #ifdef UNICODE | 2341 #ifdef UNICODE |
2336 void _combine_text(HWND handle, USHORT pos1, char *text, char *pastetext) | 2342 void _combine_text(HWND handle, USHORT pos1, char *text, char *pastetext) |
2337 { | 2343 { |
2338 char *combined = calloc((text ? strlen(text) : 0) + strlen(pastetext) + 1, 1); | 2344 char *combined = calloc((text ? strlen(text) : 0) + strlen(pastetext) + 1, 1); |
2339 SHORT newsel = pos1 + strlen(pastetext); | 2345 SHORT newsel = pos1 + strlen(pastetext); |
2350 /* Move the cursor to the old selection start plus paste length */ | 2356 /* Move the cursor to the old selection start plus paste length */ |
2351 WinSendMsg(handle, EM_SETSEL, MPFROM2SHORT(newsel, newsel), 0); | 2357 WinSendMsg(handle, EM_SETSEL, MPFROM2SHORT(newsel, newsel), 0); |
2352 /* Free temporary memory */ | 2358 /* Free temporary memory */ |
2353 free(combined); | 2359 free(combined); |
2354 } | 2360 } |
2355 #endif | |
2356 | |
2357 #define ENTRY_CUT 60901 | |
2358 #define ENTRY_COPY 60902 | |
2359 #define ENTRY_PASTE 60903 | |
2360 #define ENTRY_UNDO 60904 | |
2361 #define ENTRY_SALL 60905 | |
2362 | 2361 |
2363 /* Internal function to handle Unicode enabled MLE cut, copy and paste */ | 2362 /* Internal function to handle Unicode enabled MLE cut, copy and paste */ |
2364 void _MleCopyPaste(HWND hWnd, int command) | 2363 void _MleCopyPaste(HWND hWnd, int command) |
2365 { | 2364 { |
2366 /* MLE insertion points (for querying selection) */ | 2365 /* MLE insertion points (for querying selection) */ |
2432 } | 2431 } |
2433 } | 2432 } |
2434 if(text) | 2433 if(text) |
2435 free(text); | 2434 free(text); |
2436 } | 2435 } |
2436 #endif | |
2437 | 2437 |
2438 /* Originally just intended for entryfields, it now serves as a generic | 2438 /* Originally just intended for entryfields, it now serves as a generic |
2439 * procedure for handling TAB presses to change input focus on controls. | 2439 * procedure for handling TAB presses to change input focus on controls. |
2440 */ | 2440 */ |
2441 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2441 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2625 | 2625 |
2626 if(handle) | 2626 if(handle) |
2627 { | 2627 { |
2628 char *text = dw_window_get_text(handle); | 2628 char *text = dw_window_get_text(handle); |
2629 ULONG sel = (ULONG)WinSendMsg(hWnd, EM_QUERYSEL, 0, 0); | 2629 ULONG sel = (ULONG)WinSendMsg(hWnd, EM_QUERYSEL, 0, 0); |
2630 SHORT pos1 = SHORT1FROMMP(sel), pos2 = SHORT2FROMMP(sel); | 2630 SHORT pos1 = SHORT1FROMMP(sel); |
2631 | 2631 |
2632 WinSendMsg(handle, EM_CLEAR, 0, 0); | 2632 WinSendMsg(handle, EM_CLEAR, 0, 0); |
2633 _combine_text(handle, pos1, text, utf8); | 2633 _combine_text(handle, pos1, text, utf8); |
2634 | 2634 |
2635 if(text) | 2635 if(text) |
2682 if(_wndproc(hWnd, msg, mp1, mp2)) | 2682 if(_wndproc(hWnd, msg, mp1, mp2)) |
2683 return MPFROMSHORT(FALSE); | 2683 return MPFROMSHORT(FALSE); |
2684 break; | 2684 break; |
2685 case WM_CONTEXTMENU: | 2685 case WM_CONTEXTMENU: |
2686 case WM_COMMAND: | 2686 case WM_COMMAND: |
2687 #ifdef UNICODE | |
2687 case EM_PASTE: | 2688 case EM_PASTE: |
2688 case EM_CUT: | 2689 case EM_CUT: |
2689 case EM_COPY: | 2690 case EM_COPY: |
2691 #endif | |
2690 return _entryproc(hWnd, msg, mp1, mp2); | 2692 return _entryproc(hWnd, msg, mp1, mp2); |
2691 case WM_SETFOCUS: | 2693 case WM_SETFOCUS: |
2692 _run_event(hWnd, msg, mp1, mp2); | 2694 _run_event(hWnd, msg, mp1, mp2); |
2693 break; | 2695 break; |
2694 case WM_CHAR: | 2696 case WM_CHAR: |
2741 if(_wndproc(hWnd, msg, mp1, mp2)) | 2743 if(_wndproc(hWnd, msg, mp1, mp2)) |
2742 return MPFROMSHORT(FALSE); | 2744 return MPFROMSHORT(FALSE); |
2743 break; | 2745 break; |
2744 case WM_CONTEXTMENU: | 2746 case WM_CONTEXTMENU: |
2745 case WM_COMMAND: | 2747 case WM_COMMAND: |
2748 #ifdef UNICODE | |
2746 case EM_PASTE: | 2749 case EM_PASTE: |
2747 case EM_CUT: | 2750 case EM_CUT: |
2748 case EM_COPY: | 2751 case EM_COPY: |
2752 #endif | |
2749 return _entryproc(hWnd, msg, mp1, mp2); | 2753 return _entryproc(hWnd, msg, mp1, mp2); |
2750 } | 2754 } |
2751 | 2755 |
2752 if(oldproc) | 2756 if(oldproc) |
2753 return oldproc(hWnd, msg, mp1, mp2); | 2757 return oldproc(hWnd, msg, mp1, mp2); |