comparison src/gui_w48.c @ 1752:a8aae2e1d2ae v7.2.049

updated for version 7.2-049
author vimboss
date Thu, 20 Nov 2008 16:10:17 +0000
parents 1ddec6983d9e
children c22ded254d05
comparison
equal deleted inserted replaced
1751:aeac63ad9430 1752:a8aae2e1d2ae
545 } 545 }
546 } 546 }
547 else 547 else
548 { 548 {
549 len = 1; 549 len = 1;
550 ws = ucs2_to_enc(wstring, &len); 550 ws = utf16_to_enc(wstring, &len);
551 if (ws == NULL) 551 if (ws == NULL)
552 len = 0; 552 len = 0;
553 else 553 else
554 { 554 {
555 if (len > slen) /* just in case */ 555 if (len > slen) /* just in case */
2126 2126
2127 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 2127 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2128 { 2128 {
2129 /* 'encoding' differs from active codepage: convert text and use wide 2129 /* 'encoding' differs from active codepage: convert text and use wide
2130 * function */ 2130 * function */
2131 wstr = enc_to_ucs2(str, &wlen); 2131 wstr = enc_to_utf16(str, &wlen);
2132 if (wstr != NULL) 2132 if (wstr != NULL)
2133 { 2133 {
2134 n = GetTextExtentPointW(hdc, wstr, wlen, &size); 2134 n = GetTextExtentPointW(hdc, wstr, wlen, &size);
2135 vim_free(wstr); 2135 vim_free(wstr);
2136 if (n) 2136 if (n)
2250 2250
2251 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 2251 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2252 { 2252 {
2253 /* 'encoding' differs from active codepage: convert menu name 2253 /* 'encoding' differs from active codepage: convert menu name
2254 * and use wide function */ 2254 * and use wide function */
2255 wn = enc_to_ucs2(item_text, NULL); 2255 wn = enc_to_utf16(item_text, NULL);
2256 if (wn != NULL) 2256 if (wn != NULL)
2257 { 2257 {
2258 MENUITEMINFOW infow; 2258 MENUITEMINFOW infow;
2259 2259
2260 infow.cbSize = sizeof(infow); 2260 infow.cbSize = sizeof(infow);
2420 #ifdef FEAT_MBYTE 2420 #ifdef FEAT_MBYTE
2421 wstr = NULL; 2421 wstr = NULL;
2422 if (use_unicode) 2422 if (use_unicode)
2423 { 2423 {
2424 /* Need to go through Unicode. */ 2424 /* Need to go through Unicode. */
2425 wstr = enc_to_ucs2(NameBuff, NULL); 2425 wstr = enc_to_utf16(NameBuff, NULL);
2426 if (wstr != NULL) 2426 if (wstr != NULL)
2427 { 2427 {
2428 TCITEMW tiw; 2428 TCITEMW tiw;
2429 2429
2430 tiw.mask = TCIF_TEXT; 2430 tiw.mask = TCIF_TEXT;
2519 if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP()) 2519 if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP())
2520 { 2520 {
2521 WCHAR *wbuf; 2521 WCHAR *wbuf;
2522 int n; 2522 int n;
2523 2523
2524 /* Convert the title from 'encoding' to ucs2. */ 2524 /* Convert the title from 'encoding' to UTF-16. */
2525 wbuf = (WCHAR *)enc_to_ucs2((char_u *)title, NULL); 2525 wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL);
2526 if (wbuf != NULL) 2526 if (wbuf != NULL)
2527 { 2527 {
2528 n = SetWindowTextW(hwnd, wbuf); 2528 n = SetWindowTextW(hwnd, wbuf);
2529 vim_free(wbuf); 2529 vim_free(wbuf);
2530 if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) 2530 if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
3220 char_u *dflt, 3220 char_u *dflt,
3221 char_u *ext, 3221 char_u *ext,
3222 char_u *initdir, 3222 char_u *initdir,
3223 char_u *filter) 3223 char_u *filter)
3224 { 3224 {
3225 /* We always use the wide function. This means enc_to_ucs2() must work, 3225 /* We always use the wide function. This means enc_to_utf16() must work,
3226 * otherwise it fails miserably! */ 3226 * otherwise it fails miserably! */
3227 OPENFILENAMEW fileStruct; 3227 OPENFILENAMEW fileStruct;
3228 WCHAR fileBuf[MAXPATHL]; 3228 WCHAR fileBuf[MAXPATHL];
3229 WCHAR *wp; 3229 WCHAR *wp;
3230 int i; 3230 int i;
3236 3236
3237 if (dflt == NULL) 3237 if (dflt == NULL)
3238 fileBuf[0] = NUL; 3238 fileBuf[0] = NUL;
3239 else 3239 else
3240 { 3240 {
3241 wp = enc_to_ucs2(dflt, NULL); 3241 wp = enc_to_utf16(dflt, NULL);
3242 if (wp == NULL) 3242 if (wp == NULL)
3243 fileBuf[0] = NUL; 3243 fileBuf[0] = NUL;
3244 else 3244 else
3245 { 3245 {
3246 for (i = 0; wp[i] != NUL && i < MAXPATHL - 1; ++i) 3246 for (i = 0; wp[i] != NUL && i < MAXPATHL - 1; ++i)
3261 #else 3261 #else
3262 fileStruct.lStructSize = sizeof(fileStruct); 3262 fileStruct.lStructSize = sizeof(fileStruct);
3263 #endif 3263 #endif
3264 3264
3265 if (title != NULL) 3265 if (title != NULL)
3266 titlep = enc_to_ucs2(title, NULL); 3266 titlep = enc_to_utf16(title, NULL);
3267 fileStruct.lpstrTitle = titlep; 3267 fileStruct.lpstrTitle = titlep;
3268 3268
3269 if (ext != NULL) 3269 if (ext != NULL)
3270 extp = enc_to_ucs2(ext, NULL); 3270 extp = enc_to_utf16(ext, NULL);
3271 fileStruct.lpstrDefExt = extp; 3271 fileStruct.lpstrDefExt = extp;
3272 3272
3273 fileStruct.lpstrFile = fileBuf; 3273 fileStruct.lpstrFile = fileBuf;
3274 fileStruct.nMaxFile = MAXPATHL; 3274 fileStruct.nMaxFile = MAXPATHL;
3275 fileStruct.lpstrFilter = filterp; 3275 fileStruct.lpstrFilter = filterp;
3276 fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/ 3276 fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/
3277 /* has an initial dir been specified? */ 3277 /* has an initial dir been specified? */
3278 if (initdir != NULL && *initdir != NUL) 3278 if (initdir != NULL && *initdir != NUL)
3279 { 3279 {
3280 /* Must have backslashes here, no matter what 'shellslash' says */ 3280 /* Must have backslashes here, no matter what 'shellslash' says */
3281 initdirp = enc_to_ucs2(initdir, NULL); 3281 initdirp = enc_to_utf16(initdir, NULL);
3282 if (initdirp != NULL) 3282 if (initdirp != NULL)
3283 { 3283 {
3284 for (wp = initdirp; *wp != NUL; ++wp) 3284 for (wp = initdirp; *wp != NUL; ++wp)
3285 if (*wp == '/') 3285 if (*wp == '/')
3286 *wp = '\\'; 3286 *wp = '\\';
3316 vim_free(initdirp); 3316 vim_free(initdirp);
3317 vim_free(titlep); 3317 vim_free(titlep);
3318 vim_free(extp); 3318 vim_free(extp);
3319 3319
3320 /* Convert from UCS2 to 'encoding'. */ 3320 /* Convert from UCS2 to 'encoding'. */
3321 p = ucs2_to_enc(fileBuf, NULL); 3321 p = utf16_to_enc(fileBuf, NULL);
3322 if (p != NULL) 3322 if (p != NULL)
3323 /* when out of memory we get garbage for non-ASCII chars */ 3323 /* when out of memory we get garbage for non-ASCII chars */
3324 STRCPY(fileBuf, p); 3324 STRCPY(fileBuf, p);
3325 vim_free(p); 3325 vim_free(p);
3326 3326
3516 if (fnames != NULL) 3516 if (fnames != NULL)
3517 for (i = 0; i < cFiles; ++i) 3517 for (i = 0; i < cFiles; ++i)
3518 { 3518 {
3519 #ifdef FEAT_MBYTE 3519 #ifdef FEAT_MBYTE
3520 if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0) 3520 if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0)
3521 fnames[i] = ucs2_to_enc(wszFile, NULL); 3521 fnames[i] = utf16_to_enc(wszFile, NULL);
3522 else 3522 else
3523 #endif 3523 #endif
3524 { 3524 {
3525 DragQueryFile(hDrop, i, szFile, BUFPATHLEN); 3525 DragQueryFile(hDrop, i, szFile, BUFPATHLEN);
3526 fnames[i] = vim_strsave(szFile); 3526 fnames[i] = vim_strsave(szFile);