Author: jimtabor
Date: Fri Jun 16 19:33:59 2006
New Revision: 22377
URL:
http://svn.reactos.ru/svn/reactos?rev=22377&view=rev
Log:
Vitaly Lipatov : Fix character conversion in combo box. Which needed to be synced to
wine.
Modified:
trunk/reactos/dll/win32/user32/controls/combo.c
Modified: trunk/reactos/dll/win32/user32/controls/combo.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/user32/controls/c…
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/combo.c (original)
+++ trunk/reactos/dll/win32/user32/controls/combo.c Fri Jun 16 19:33:59 2006
@@ -432,6 +432,10 @@
lprLB->right = lprLB->left + lphc->droppedWidth;
}
+ /* don't allow negative window width */
+ if (lprEdit->right < lprEdit->left)
+ lprEdit->right = lprEdit->left;
+
TRACE("\ttext\t= (%ld,%ld-%ld,%ld)\n",
lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom);
@@ -1839,6 +1843,19 @@
pcbi->hwndItem = lphc->hWndEdit;
pcbi->hwndList = lphc->hWndLBox;
return TRUE;
+}
+
+static char *strdupA(LPCSTR str)
+{
+ char *ret;
+ DWORD len;
+
+ if(!str) return NULL;
+
+ len = strlen(str);
+ ret = HeapAlloc(GetProcessHeap(), 0, len + 1);
+ memcpy(ret, str, len + 1);
+ return ret;
}
/***********************************************************************
@@ -2068,17 +2085,33 @@
/* fall through */
#endif
case CB_ADDSTRING:
- {
- UINT msg = LB_ADDSTRING;
- if( lphc->dwStyle & CBS_LOWERCASE )
- msg = LB_ADDSTRING_LOWER;
- else if( lphc->dwStyle & CBS_UPPERCASE )
- msg = LB_ADDSTRING_UPPER;
- if( unicode )
- return SendMessageW(lphc->hWndLBox, msg, 0, lParam);
- else
- return SendMessageA(lphc->hWndLBox, msg, 0, lParam);
- }
+ if( unicode )
+ {
+ if( lphc->dwStyle & CBS_LOWERCASE )
+ CharLowerW((LPWSTR)lParam);
+ else if( lphc->dwStyle & CBS_UPPERCASE )
+ CharUpperW((LPWSTR)lParam);
+ return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
+ }
+ else /* unlike the unicode version, the ansi version does not overwrite
+ the string if converting case */
+ {
+ char *p, *string = NULL;
+ LRESULT ret;
+ if( lphc->dwStyle & CBS_LOWERCASE )
+ {
+ string = strdupA((LPSTR)lParam);
+ CharLowerA(string);
+ }
+ else if( lphc->dwStyle & CBS_UPPERCASE )
+ {
+ string = strdupA((LPSTR)lParam);
+ CharUpperA(string);
+ }
+ ret = SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, string ?
(LPARAM)string : lParam);
+ HeapFree(GetProcessHeap(), 0, string);
+ return ret;
+ }
#ifndef __REACTOS__
case CB_INSERTSTRING16:
wParam = (INT)(INT16)wParam;
@@ -2086,17 +2119,23 @@
/* fall through */
#endif
case CB_INSERTSTRING:
- {
- UINT msg = LB_INSERTSTRING;
- if( lphc->dwStyle & CBS_LOWERCASE )
- msg = LB_INSERTSTRING_LOWER;
- else if( lphc->dwStyle & CBS_UPPERCASE )
- msg = LB_INSERTSTRING_UPPER;
- if( unicode )
- return SendMessageW(lphc->hWndLBox, msg, 0, lParam);
+ if( unicode )
+ {
+ if( lphc->dwStyle & CBS_LOWERCASE )
+ CharLowerW((LPWSTR)lParam);
+ else if( lphc->dwStyle & CBS_UPPERCASE )
+ CharUpperW((LPWSTR)lParam);
+ return SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam,
lParam);
+ }
else
- return SendMessageA(lphc->hWndLBox, msg, 0, lParam);
- }
+ {
+ char *p;
+ if( lphc->dwStyle & CBS_LOWERCASE )
+ CharLowerA((LPSTR)lParam);
+ else if( lphc->dwStyle & CBS_UPPERCASE )
+ CharUpperA((LPSTR)lParam);
+ return SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam,
lParam);
+ }
#ifndef __REACTOS__
case CB_DELETESTRING16:
#endif