Mercurial > vim
comparison src/gui_w32.c @ 8090:54cfe888c627 v7.4.1339
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 16 20:12:02 2016 +0100
patch 7.4.1339
Problem: Warnings when building the GUI with MingW. (Cesar Romani)
Solution: Add type cats. (Yasuhiro Matsumoto)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 16 Feb 2016 20:15:05 +0100 |
parents | 226ed297307f |
children | ae50910ce279 |
comparison
equal
deleted
inserted
replaced
8089:e5d330ffb650 | 8090:54cfe888c627 |
---|---|
1129 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, | 1129 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, |
1130 0, 500); | 1130 0, 500); |
1131 | 1131 |
1132 if (STRLEN(str) < sizeof(lpdi->szText) | 1132 if (STRLEN(str) < sizeof(lpdi->szText) |
1133 || ((tt_text = vim_strsave(str)) == NULL)) | 1133 || ((tt_text = vim_strsave(str)) == NULL)) |
1134 vim_strncpy(lpdi->szText, str, | 1134 vim_strncpy((char_u *)lpdi->szText, str, |
1135 sizeof(lpdi->szText) - 1); | 1135 sizeof(lpdi->szText) - 1); |
1136 else | 1136 else |
1137 lpdi->lpszText = tt_text; | 1137 lpdi->lpszText = tt_text; |
1138 } | 1138 } |
1139 } | 1139 } |
1745 */ | 1745 */ |
1746 s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); | 1746 s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); |
1747 | 1747 |
1748 /* Initialise the struct */ | 1748 /* Initialise the struct */ |
1749 s_findrep_struct.lStructSize = sizeof(s_findrep_struct); | 1749 s_findrep_struct.lStructSize = sizeof(s_findrep_struct); |
1750 s_findrep_struct.lpstrFindWhat = alloc(MSWIN_FR_BUFSIZE); | 1750 s_findrep_struct.lpstrFindWhat = (LPSTR)alloc(MSWIN_FR_BUFSIZE); |
1751 s_findrep_struct.lpstrFindWhat[0] = NUL; | 1751 s_findrep_struct.lpstrFindWhat[0] = NUL; |
1752 s_findrep_struct.lpstrReplaceWith = alloc(MSWIN_FR_BUFSIZE); | 1752 s_findrep_struct.lpstrReplaceWith = (LPSTR)alloc(MSWIN_FR_BUFSIZE); |
1753 s_findrep_struct.lpstrReplaceWith[0] = NUL; | 1753 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
1754 s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; | 1754 s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; |
1755 s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; | 1755 s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; |
1756 # if defined(FEAT_MBYTE) && defined(WIN3264) | 1756 # if defined(FEAT_MBYTE) && defined(WIN3264) |
1757 s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w); | 1757 s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w); |
2097 if (buf == NULL) | 2097 if (buf == NULL) |
2098 return NULL; | 2098 return NULL; |
2099 pImmGetCompositionStringA(hIMC, GCS, buf, ret); | 2099 pImmGetCompositionStringA(hIMC, GCS, buf, ret); |
2100 | 2100 |
2101 /* convert from codepage to UCS-2 */ | 2101 /* convert from codepage to UCS-2 */ |
2102 MultiByteToWideChar_alloc(GetACP(), 0, buf, ret, &wbuf, lenp); | 2102 MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp); |
2103 vim_free(buf); | 2103 vim_free(buf); |
2104 | 2104 |
2105 return (short_u *)wbuf; | 2105 return (short_u *)wbuf; |
2106 } | 2106 } |
2107 | 2107 |
3026 RECT roct; | 3026 RECT roct; |
3027 int x, y; | 3027 int x, y; |
3028 | 3028 |
3029 HWND thwnd = menu->tearoff_handle; | 3029 HWND thwnd = menu->tearoff_handle; |
3030 | 3030 |
3031 GetWindowText(thwnd, tbuf, 127); | 3031 GetWindowText(thwnd, (LPSTR)tbuf, 127); |
3032 if (GetWindowRect(thwnd, &trect) | 3032 if (GetWindowRect(thwnd, &trect) |
3033 && GetWindowRect(s_hwnd, &rct) | 3033 && GetWindowRect(s_hwnd, &rct) |
3034 && GetClientRect(s_hwnd, &roct)) | 3034 && GetClientRect(s_hwnd, &roct)) |
3035 { | 3035 { |
3036 x = trect.left - rct.left; | 3036 x = trect.left - rct.left; |
3172 vim_free(wp); | 3172 vim_free(wp); |
3173 } | 3173 } |
3174 else | 3174 else |
3175 # endif | 3175 # endif |
3176 GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2, | 3176 GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2, |
3177 s_textfield, IOSIZE); | 3177 (LPSTR)s_textfield, IOSIZE); |
3178 } | 3178 } |
3179 | 3179 |
3180 /* | 3180 /* |
3181 * Need to check for IDOK because if the user just hits Return to | 3181 * Need to check for IDOK because if the user just hits Return to |
3182 * accept the default value, some reason this is what we get. | 3182 * accept the default value, some reason this is what we get. |
3214 * -1 for unexpected error | 3214 * -1 for unexpected error |
3215 * | 3215 * |
3216 * If stubbing out this fn, return 1. | 3216 * If stubbing out this fn, return 1. |
3217 */ | 3217 */ |
3218 | 3218 |
3219 static const char_u *dlg_icons[] = /* must match names in resource file */ | 3219 static const char *dlg_icons[] = /* must match names in resource file */ |
3220 { | 3220 { |
3221 "IDR_VIM", | 3221 "IDR_VIM", |
3222 "IDR_VIM_ERROR", | 3222 "IDR_VIM_ERROR", |
3223 "IDR_VIM_ALERT", | 3223 "IDR_VIM_ALERT", |
3224 "IDR_VIM_INFO", | 3224 "IDR_VIM_INFO", |
3351 } | 3351 } |
3352 GetTextMetrics(hdc, &fontInfo); | 3352 GetTextMetrics(hdc, &fontInfo); |
3353 fontHeight = fontInfo.tmHeight; | 3353 fontHeight = fontInfo.tmHeight; |
3354 | 3354 |
3355 /* Minimum width for horizontal button */ | 3355 /* Minimum width for horizontal button */ |
3356 minButtonWidth = GetTextWidth(hdc, "Cancel", 6); | 3356 minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6); |
3357 | 3357 |
3358 /* Maximum width of a dialog, if possible */ | 3358 /* Maximum width of a dialog, if possible */ |
3359 if (s_hwnd == NULL) | 3359 if (s_hwnd == NULL) |
3360 { | 3360 { |
3361 RECT workarea_rect; | 3361 RECT workarea_rect; |
3615 PixelToDialogX(DLG_VERT_PADDING_X), | 3615 PixelToDialogX(DLG_VERT_PADDING_X), |
3616 PixelToDialogY(buttonYpos /* TBK */ | 3616 PixelToDialogY(buttonYpos /* TBK */ |
3617 + 2 * fontHeight * i), | 3617 + 2 * fontHeight * i), |
3618 PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), | 3618 PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), |
3619 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | 3619 (WORD)(PixelToDialogY(2 * fontHeight) - 1), |
3620 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, pstart); | 3620 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
3621 } | 3621 } |
3622 else | 3622 else |
3623 { | 3623 { |
3624 p = add_dialog_element(p, | 3624 p = add_dialog_element(p, |
3625 (i == dfltbutton | 3625 (i == dfltbutton |
3626 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | 3626 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, |
3627 PixelToDialogX(horizWidth + buttonPositions[i]), | 3627 PixelToDialogX(horizWidth + buttonPositions[i]), |
3628 PixelToDialogY(buttonYpos), /* TBK */ | 3628 PixelToDialogY(buttonYpos), /* TBK */ |
3629 PixelToDialogX(buttonWidths[i]), | 3629 PixelToDialogX(buttonWidths[i]), |
3630 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | 3630 (WORD)(PixelToDialogY(2 * fontHeight) - 1), |
3631 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, pstart); | 3631 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
3632 } | 3632 } |
3633 pstart = pend + 1; /*next button*/ | 3633 pstart = pend + 1; /*next button*/ |
3634 } | 3634 } |
3635 *pnumitems += numButtons; | 3635 *pnumitems += numButtons; |
3636 | 3636 |
3647 p = add_dialog_element(p, ES_LEFT|scroll_flag|ES_MULTILINE|ES_READONLY, | 3647 p = add_dialog_element(p, ES_LEFT|scroll_flag|ES_MULTILINE|ES_READONLY, |
3648 PixelToDialogX(2 * dlgPaddingX + DLG_ICON_WIDTH), | 3648 PixelToDialogX(2 * dlgPaddingX + DLG_ICON_WIDTH), |
3649 PixelToDialogY(dlgPaddingY), | 3649 PixelToDialogY(dlgPaddingY), |
3650 (WORD)(PixelToDialogX(messageWidth) + 1), | 3650 (WORD)(PixelToDialogX(messageWidth) + 1), |
3651 PixelToDialogY(msgheight), | 3651 PixelToDialogY(msgheight), |
3652 DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, message); | 3652 DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message); |
3653 | 3653 |
3654 /* Edit box */ | 3654 /* Edit box */ |
3655 if (textfield != NULL) | 3655 if (textfield != NULL) |
3656 { | 3656 { |
3657 p = add_dialog_element(p, ES_LEFT|ES_AUTOHSCROLL|WS_TABSTOP|WS_BORDER, | 3657 p = add_dialog_element(p, ES_LEFT|ES_AUTOHSCROLL|WS_TABSTOP|WS_BORDER, |
3658 PixelToDialogX(2 * dlgPaddingX), | 3658 PixelToDialogX(2 * dlgPaddingX), |
3659 PixelToDialogY(2 * dlgPaddingY + msgheight), | 3659 PixelToDialogY(2 * dlgPaddingY + msgheight), |
3660 PixelToDialogX(dlgwidth - 4 * dlgPaddingX), | 3660 PixelToDialogX(dlgwidth - 4 * dlgPaddingX), |
3661 PixelToDialogY(fontHeight + dlgPaddingY), | 3661 PixelToDialogY(fontHeight + dlgPaddingY), |
3662 DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, textfield); | 3662 DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, (char *)textfield); |
3663 *pnumitems += 1; | 3663 *pnumitems += 1; |
3664 } | 3664 } |
3665 | 3665 |
3666 *pnumitems += 2; | 3666 *pnumitems += 2; |
3667 | 3667 |
3796 WCHAR *wn; | 3796 WCHAR *wn; |
3797 | 3797 |
3798 if (enc_codepage == 0 && (int)GetACP() != enc_codepage) | 3798 if (enc_codepage == 0 && (int)GetACP() != enc_codepage) |
3799 { | 3799 { |
3800 /* Not a codepage, use our own conversion function. */ | 3800 /* Not a codepage, use our own conversion function. */ |
3801 wn = enc_to_utf16(lpAnsiIn, NULL); | 3801 wn = enc_to_utf16((char_u *)lpAnsiIn, NULL); |
3802 if (wn != NULL) | 3802 if (wn != NULL) |
3803 { | 3803 { |
3804 wcscpy(lpWCStr, wn); | 3804 wcscpy(lpWCStr, wn); |
3805 nChar = (int)wcslen(wn) + 1; | 3805 nChar = (int)wcslen(wn) + 1; |
3806 vim_free(wn); | 3806 vim_free(wn); |
4041 else | 4041 else |
4042 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | 4042 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); |
4043 | 4043 |
4044 /* Calculate width of a single space. Used for padding columns to the | 4044 /* Calculate width of a single space. Used for padding columns to the |
4045 * right width. */ | 4045 * right width. */ |
4046 spaceWidth = GetTextWidth(hdc, " ", 1); | 4046 spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1); |
4047 | 4047 |
4048 /* Figure out max width of the text column, the accelerator column and the | 4048 /* Figure out max width of the text column, the accelerator column and the |
4049 * optional submenu column. */ | 4049 * optional submenu column. */ |
4050 submenuWidth = 0; | 4050 submenuWidth = 0; |
4051 for (col = 0; col < 2; col++) | 4051 for (col = 0; col < 2; col++) |
4084 * Now find the total width of our 'menu'. | 4084 * Now find the total width of our 'menu'. |
4085 */ | 4085 */ |
4086 textWidth = columnWidths[0] + columnWidths[1]; | 4086 textWidth = columnWidths[0] + columnWidths[1]; |
4087 if (submenuWidth != 0) | 4087 if (submenuWidth != 0) |
4088 { | 4088 { |
4089 submenuWidth = GetTextWidth(hdc, TEAROFF_SUBMENU_LABEL, | 4089 submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL, |
4090 (int)STRLEN(TEAROFF_SUBMENU_LABEL)); | 4090 (int)STRLEN(TEAROFF_SUBMENU_LABEL)); |
4091 textWidth += submenuWidth; | 4091 textWidth += submenuWidth; |
4092 } | 4092 } |
4093 dlgwidth = GetTextWidthEnc(hdc, title, (int)STRLEN(title)); | 4093 dlgwidth = GetTextWidthEnc(hdc, title, (int)STRLEN(title)); |
4094 if (textWidth > dlgwidth) | 4094 if (textWidth > dlgwidth) |
4260 BS_PUSHBUTTON|BS_LEFT, | 4260 BS_PUSHBUTTON|BS_LEFT, |
4261 (WORD)PixelToDialogX(TEAROFF_PADDING_X), | 4261 (WORD)PixelToDialogX(TEAROFF_PADDING_X), |
4262 (WORD)(sepPadding + 1 + 13 * (*pnumitems)), | 4262 (WORD)(sepPadding + 1 + 13 * (*pnumitems)), |
4263 (WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X), | 4263 (WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X), |
4264 (WORD)12, | 4264 (WORD)12, |
4265 menuID, (WORD)0x0080, label); | 4265 menuID, (WORD)0x0080, (char *)label); |
4266 vim_free(label); | 4266 vim_free(label); |
4267 (*pnumitems)++; | 4267 (*pnumitems)++; |
4268 } | 4268 } |
4269 | 4269 |
4270 *ptrueheight = (WORD)(sepPadding + 1 + 13 * (*pnumitems)); | 4270 *ptrueheight = (WORD)(sepPadding + 1 + 13 * (*pnumitems)); |
4358 if (menu->iconfile != NULL) | 4358 if (menu->iconfile != NULL) |
4359 { | 4359 { |
4360 gui_find_iconfile(menu->iconfile, fname, "bmp"); | 4360 gui_find_iconfile(menu->iconfile, fname, "bmp"); |
4361 hbitmap = LoadImage( | 4361 hbitmap = LoadImage( |
4362 NULL, | 4362 NULL, |
4363 fname, | 4363 (LPCSTR)fname, |
4364 IMAGE_BITMAP, | 4364 IMAGE_BITMAP, |
4365 TOOLBAR_BUTTON_WIDTH, | 4365 TOOLBAR_BUTTON_WIDTH, |
4366 TOOLBAR_BUTTON_HEIGHT, | 4366 TOOLBAR_BUTTON_HEIGHT, |
4367 LR_LOADFROMFILE | | 4367 LR_LOADFROMFILE | |
4368 LR_LOADMAP3DCOLORS | 4368 LR_LOADMAP3DCOLORS |
4379 menu->en_dname != NULL ? menu->en_dname : | 4379 menu->en_dname != NULL ? menu->en_dname : |
4380 #endif | 4380 #endif |
4381 menu->dname, fname, "bmp") == OK)) | 4381 menu->dname, fname, "bmp") == OK)) |
4382 hbitmap = LoadImage( | 4382 hbitmap = LoadImage( |
4383 NULL, | 4383 NULL, |
4384 fname, | 4384 (LPCSTR)fname, |
4385 IMAGE_BITMAP, | 4385 IMAGE_BITMAP, |
4386 TOOLBAR_BUTTON_WIDTH, | 4386 TOOLBAR_BUTTON_WIDTH, |
4387 TOOLBAR_BUTTON_HEIGHT, | 4387 TOOLBAR_BUTTON_HEIGHT, |
4388 LR_LOADFROMFILE | | 4388 LR_LOADFROMFILE | |
4389 LR_LOADMAP3DCOLORS | 4389 LR_LOADMAP3DCOLORS |
4627 sign.uType = IMAGE_CURSOR; | 4627 sign.uType = IMAGE_CURSOR; |
4628 else | 4628 else |
4629 do_load = 0; | 4629 do_load = 0; |
4630 | 4630 |
4631 if (do_load) | 4631 if (do_load) |
4632 sign.hImage = (HANDLE)LoadImage(NULL, signfile, sign.uType, | 4632 sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType, |
4633 gui.char_width * 2, gui.char_height, | 4633 gui.char_width * 2, gui.char_height, |
4634 LR_LOADFROMFILE | LR_CREATEDIBSECTION); | 4634 LR_LOADFROMFILE | LR_CREATEDIBSECTION); |
4635 #ifdef FEAT_XPM_W32 | 4635 #ifdef FEAT_XPM_W32 |
4636 if (!STRICMP(ext, ".xpm")) | 4636 if (!STRICMP(ext, ".xpm")) |
4637 { | 4637 { |
4638 sign.uType = IMAGE_XPM; | 4638 sign.uType = IMAGE_XPM; |
4639 LoadXpmImage(signfile, (HBITMAP *)&sign.hImage, (HBITMAP *)&sign.hShape); | 4639 LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage, |
4640 (HBITMAP *)&sign.hShape); | |
4640 } | 4641 } |
4641 #endif | 4642 #endif |
4642 } | 4643 } |
4643 | 4644 |
4644 psign = NULL; | 4645 psign = NULL; |
4738 { | 4739 { |
4739 VS_FIXEDFILEINFO *ver; | 4740 VS_FIXEDFILEINFO *ver; |
4740 UINT vlen = 0; | 4741 UINT vlen = 0; |
4741 void *data = alloc(len); | 4742 void *data = alloc(len); |
4742 | 4743 |
4743 if (data != NULL | 4744 if ((data != NULL |
4744 && GetFileVersionInfo(comctl_dll, 0, len, data) | 4745 && GetFileVersionInfo(comctl_dll, 0, len, data) |
4745 && VerQueryValue(data, "\\", (void **)&ver, &vlen) | 4746 && VerQueryValue(data, "\\", (void **)&ver, &vlen) |
4746 && vlen | 4747 && vlen |
4747 && HIWORD(ver->dwFileVersionMS) > 4 | 4748 && HIWORD(ver->dwFileVersionMS) > 4) |
4748 || (HIWORD(ver->dwFileVersionMS) == 4 | 4749 || ((HIWORD(ver->dwFileVersionMS) == 4 |
4749 && LOWORD(ver->dwFileVersionMS) >= 70)) | 4750 && LOWORD(ver->dwFileVersionMS) >= 70))) |
4750 { | 4751 { |
4751 vim_free(data); | 4752 vim_free(data); |
4752 multiline_tip = TRUE; | 4753 multiline_tip = TRUE; |
4753 return multiline_tip; | 4754 return multiline_tip; |
4754 } | 4755 } |
4906 if (abs(beval->x - pt.x) < 3 && abs(beval->y - pt.y) < 3) | 4907 if (abs(beval->x - pt.x) < 3 && abs(beval->y - pt.y) < 3) |
4907 /* cursor is still here */ | 4908 /* cursor is still here */ |
4908 { | 4909 { |
4909 gui_mch_disable_beval_area(cur_beval); | 4910 gui_mch_disable_beval_area(cur_beval); |
4910 beval->showState = ShS_SHOWING; | 4911 beval->showState = ShS_SHOWING; |
4911 make_tooltip(beval, mesg, pt); | 4912 make_tooltip(beval, (char *)mesg, pt); |
4912 } | 4913 } |
4913 // TRACE0("gui_mch_post_balloon }}}"); | 4914 // TRACE0("gui_mch_post_balloon }}}"); |
4914 } | 4915 } |
4915 | 4916 |
4916 /*ARGSUSED*/ | 4917 /*ARGSUSED*/ |