Mercurial > vim
comparison src/gui_w32.c @ 819:23f82b5d2814 v7.0c10
updated for version 7.0c10
author | vimboss |
---|---|
date | Wed, 05 Apr 2006 20:41:53 +0000 |
parents | 68c15f2c7d3f |
children | 8dd456c1e283 |
comparison
equal
deleted
inserted
replaced
818:1f929f3ca806 | 819:23f82b5d2814 |
---|---|
725 return 0; | 725 return 0; |
726 } | 726 } |
727 } | 727 } |
728 return MyWindowProc(hwnd, uMsg, wParam, lParam); | 728 return MyWindowProc(hwnd, uMsg, wParam, lParam); |
729 } | 729 } |
730 case WM_LBUTTONDBLCLK: | |
731 { | |
732 /* | |
733 * If the user double clicked the tabline, create a new tab | |
734 */ | |
735 if (gui_mch_showing_tabline()) | |
736 { | |
737 POINT pt; | |
738 RECT rect; | |
739 | |
740 GetCursorPos((LPPOINT)&pt); | |
741 GetWindowRect(s_textArea, &rect); | |
742 if (pt.y < rect.top) | |
743 { | |
744 char_u string[3]; | |
745 | |
746 string[0] = CSI; | |
747 string[1] = KS_TABMENU; | |
748 string[2] = KE_FILLER; | |
749 add_to_input_buf(string, 3); | |
750 string[0] = 0; | |
751 string[1] = (char_u)(long)TABLINE_MENU_NEW; | |
752 add_to_input_buf_csi(string, 2); | |
753 } | |
754 } | |
755 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
756 } | |
730 #endif | 757 #endif |
731 | 758 |
732 case WM_QUERYENDSESSION: /* System wants to go down. */ | 759 case WM_QUERYENDSESSION: /* System wants to go down. */ |
733 gui_shell_closed(); /* Will exit when no changed buffers. */ | 760 gui_shell_closed(); /* Will exit when no changed buffers. */ |
734 return FALSE; /* Do NOT allow system to go down. */ | 761 return FALSE; /* Do NOT allow system to go down. */ |
1150 #ifdef FEAT_MBYTE | 1177 #ifdef FEAT_MBYTE |
1151 /* First try using the wide version, so that we can use any title. | 1178 /* First try using the wide version, so that we can use any title. |
1152 * Otherwise only characters in the active codepage will work. */ | 1179 * Otherwise only characters in the active codepage will work. */ |
1153 if (GetClassInfoW(s_hinst, szVimWndClassW, &wndclassw) == 0) | 1180 if (GetClassInfoW(s_hinst, szVimWndClassW, &wndclassw) == 0) |
1154 { | 1181 { |
1155 wndclassw.style = 0; | 1182 wndclassw.style = CS_DBLCLKS; |
1156 wndclassw.lpfnWndProc = _WndProc; | 1183 wndclassw.lpfnWndProc = _WndProc; |
1157 wndclassw.cbClsExtra = 0; | 1184 wndclassw.cbClsExtra = 0; |
1158 wndclassw.cbWndExtra = 0; | 1185 wndclassw.cbWndExtra = 0; |
1159 wndclassw.hInstance = s_hinst; | 1186 wndclassw.hInstance = s_hinst; |
1160 wndclassw.hIcon = LoadIcon(wndclassw.hInstance, "IDR_VIM"); | 1187 wndclassw.hIcon = LoadIcon(wndclassw.hInstance, "IDR_VIM"); |
1181 if (!wide_WindowProc) | 1208 if (!wide_WindowProc) |
1182 #endif | 1209 #endif |
1183 | 1210 |
1184 if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0) | 1211 if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0) |
1185 { | 1212 { |
1186 wndclass.style = 0; | 1213 wndclass.style = CS_DBLCLKS; |
1187 wndclass.lpfnWndProc = _WndProc; | 1214 wndclass.lpfnWndProc = _WndProc; |
1188 wndclass.cbClsExtra = 0; | 1215 wndclass.cbClsExtra = 0; |
1189 wndclass.cbWndExtra = 0; | 1216 wndclass.cbWndExtra = 0; |
1190 wndclass.hInstance = s_hinst; | 1217 wndclass.hInstance = s_hinst; |
1191 wndclass.hIcon = LoadIcon(wndclass.hInstance, "IDR_VIM"); | 1218 wndclass.hIcon = LoadIcon(wndclass.hInstance, "IDR_VIM"); |
1410 RECT workarea_rect; | 1437 RECT workarea_rect; |
1411 int win_width, win_height; | 1438 int win_width, win_height; |
1412 int win_xpos, win_ypos; | 1439 int win_xpos, win_ypos; |
1413 WINDOWPLACEMENT wndpl; | 1440 WINDOWPLACEMENT wndpl; |
1414 | 1441 |
1415 /* try to keep window completely on screen */ | 1442 /* Try to keep window completely on screen. */ |
1416 /* get size of the screen work area (excludes taskbar, appbars) */ | 1443 /* Get position of the screen work area. This is the part that is not |
1444 * used by the taskbar or appbars. */ | |
1417 get_work_area(&workarea_rect); | 1445 get_work_area(&workarea_rect); |
1418 | 1446 |
1419 /* get current posision of our window */ | 1447 /* Get current posision of our window. Note that the .left and .top are |
1448 * relative to the work area. */ | |
1420 wndpl.length = sizeof(WINDOWPLACEMENT); | 1449 wndpl.length = sizeof(WINDOWPLACEMENT); |
1421 GetWindowPlacement(s_hwnd, &wndpl); | 1450 GetWindowPlacement(s_hwnd, &wndpl); |
1422 | 1451 |
1423 /* Resizing a maximized window looks very strange, unzoom it first. | 1452 /* Resizing a maximized window looks very strange, unzoom it first. |
1424 * But don't do it when still starting up, it may have been requested in | 1453 * But don't do it when still starting up, it may have been requested in |
1440 #ifdef FEAT_MENU | 1469 #ifdef FEAT_MENU |
1441 + gui_mswin_get_menu_height(FALSE) | 1470 + gui_mswin_get_menu_height(FALSE) |
1442 #endif | 1471 #endif |
1443 ; | 1472 ; |
1444 | 1473 |
1445 /* if the window is going off the screen, move it on to the screen */ | 1474 /* If the window is going off the screen, move it on to the screen. |
1446 if ((direction & RESIZE_HOR) && win_xpos + win_width > workarea_rect.right) | 1475 * win_xpos and win_ypos are relative to the workarea. */ |
1447 win_xpos = workarea_rect.right - win_width; | 1476 if ((direction & RESIZE_HOR) |
1448 | 1477 && workarea_rect.left + win_xpos + win_width > workarea_rect.right) |
1449 if ((direction & RESIZE_HOR) && win_xpos < workarea_rect.left) | 1478 win_xpos = workarea_rect.right - win_width - workarea_rect.left; |
1450 win_xpos = workarea_rect.left; | 1479 |
1480 if ((direction & RESIZE_HOR) && win_xpos < 0) | |
1481 win_xpos = 0; | |
1451 | 1482 |
1452 if ((direction & RESIZE_VERT) | 1483 if ((direction & RESIZE_VERT) |
1453 && win_ypos + win_height > workarea_rect.bottom) | 1484 && workarea_rect.top + win_ypos + win_height > workarea_rect.bottom) |
1454 win_ypos = workarea_rect.bottom - win_height; | 1485 win_ypos = workarea_rect.bottom - win_height - workarea_rect.top; |
1455 | 1486 |
1456 if ((direction & RESIZE_VERT) && win_ypos < workarea_rect.top) | 1487 if ((direction & RESIZE_VERT) && win_ypos < 0) |
1457 win_ypos = workarea_rect.top; | 1488 win_ypos = 0; |
1458 | |
1459 /* When the taskbar is placed on the left or top of the screen, | |
1460 * SetWindowPlacement() adds its width or height automatically, compensate | |
1461 * for that. When the offset is over 400 it's probably something else, | |
1462 * skip it then (just in case). */ | |
1463 if (workarea_rect.left > 0 && workarea_rect.left < 400) | |
1464 win_xpos -= workarea_rect.left; | |
1465 if (workarea_rect.top > 0 && workarea_rect.top < 400) | |
1466 win_ypos -= workarea_rect.top; | |
1467 | 1489 |
1468 wndpl.rcNormalPosition.left = win_xpos; | 1490 wndpl.rcNormalPosition.left = win_xpos; |
1469 wndpl.rcNormalPosition.right = win_xpos + win_width; | 1491 wndpl.rcNormalPosition.right = win_xpos + win_width; |
1470 wndpl.rcNormalPosition.top = win_ypos; | 1492 wndpl.rcNormalPosition.top = win_ypos; |
1471 wndpl.rcNormalPosition.bottom = win_ypos + win_height; | 1493 wndpl.rcNormalPosition.bottom = win_ypos + win_height; |
2288 { | 2310 { |
2289 RECT workarea_rect; | 2311 RECT workarea_rect; |
2290 | 2312 |
2291 get_work_area(&workarea_rect); | 2313 get_work_area(&workarea_rect); |
2292 | 2314 |
2293 *screen_w = workarea_rect.right | 2315 *screen_w = workarea_rect.right - workarea_rect.left |
2294 - GetSystemMetrics(SM_CXFRAME) * 2; | 2316 - GetSystemMetrics(SM_CXFRAME) * 2; |
2295 | 2317 |
2296 /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include | 2318 /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include |
2297 * the menubar for MSwin, we subtract it from the screen height, so that | 2319 * the menubar for MSwin, we subtract it from the screen height, so that |
2298 * the window size can be made to fit on the screen. */ | 2320 * the window size can be made to fit on the screen. */ |
2299 *screen_h = workarea_rect.bottom | 2321 *screen_h = workarea_rect.bottom - workarea_rect.top |
2300 - GetSystemMetrics(SM_CYFRAME) * 2 | 2322 - GetSystemMetrics(SM_CYFRAME) * 2 |
2301 - GetSystemMetrics(SM_CYCAPTION) | 2323 - GetSystemMetrics(SM_CYCAPTION) |
2302 #ifdef FEAT_MENU | 2324 #ifdef FEAT_MENU |
2303 - gui_mswin_get_menu_height(FALSE) | 2325 - gui_mswin_get_menu_height(FALSE) |
2304 #endif | 2326 #endif |
3954 | 3976 |
3955 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) | 3977 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) |
3956 static void | 3978 static void |
3957 initialise_tabline(void) | 3979 initialise_tabline(void) |
3958 { | 3980 { |
3981 # ifdef USE_SYSMENU_FONT | |
3982 LOGFONT lfSysmenu; | |
3983 # endif | |
3984 | |
3959 InitCommonControls(); | 3985 InitCommonControls(); |
3960 | 3986 |
3961 s_tabhwnd = CreateWindow(WC_TABCONTROL, "", WS_CHILD|TCS_FOCUSNEVER, | 3987 s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", |
3988 WS_CHILD|TCS_FOCUSNEVER, | |
3962 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | 3989 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
3963 CW_USEDEFAULT, s_hwnd, NULL, s_hinst, NULL); | 3990 CW_USEDEFAULT, s_hwnd, NULL, s_hinst, NULL); |
3991 | |
3992 # ifdef USE_SYSMENU_FONT | |
3993 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
3994 { | |
3995 HFONT font = CreateFontIndirect(&lfSysmenu); | |
3996 SendMessage(s_tabhwnd, WM_SETFONT, (WPARAM) font, TRUE); | |
3997 } | |
3998 # endif | |
3964 } | 3999 } |
3965 #endif | 4000 #endif |
3966 | 4001 |
3967 #if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO) | 4002 #if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO) |
3968 /* | 4003 /* |