comparison src/gui_w32.c @ 843:9f279ebda751 v7.0f01

updated for version 7.0f01
author vimboss
date Tue, 25 Apr 2006 22:13:59 +0000
parents a209672376fd
children 8cd729851562
comparison
equal deleted inserted replaced
842:a209672376fd 843:9f279ebda751
179 179
180 #ifdef FEAT_BEVAL 180 #ifdef FEAT_BEVAL
181 # define ID_BEVAL_TOOLTIP 200 181 # define ID_BEVAL_TOOLTIP 200
182 # define BEVAL_TEXT_LEN MAXPATHL 182 # define BEVAL_TEXT_LEN MAXPATHL
183 183
184 #ifndef UINT_PTR 184 #if _MSC_VER < 1300
185 /* Work around old versions of basetsd.h which wrongly declare
186 * UINT_PTR as unsigned long */
185 # define UINT_PTR UINT 187 # define UINT_PTR UINT
186 #endif 188 #endif
187 189
188 static void make_tooltip __ARGS((BalloonEval *beval, char *text, POINT pt)); 190 static void make_tooltip __ARGS((BalloonEval *beval, char *text, POINT pt));
189 static void delete_tooltip __ARGS((BalloonEval *beval)); 191 static void delete_tooltip __ARGS((BalloonEval *beval));
193 static UINT_PTR BevalTimerId = 0; 195 static UINT_PTR BevalTimerId = 0;
194 static DWORD LastActivity = 0; 196 static DWORD LastActivity = 0;
195 197
196 /* 198 /*
197 * excerpts from headers since this may not be presented 199 * excerpts from headers since this may not be presented
198 * in the extremelly old compilers 200 * in the extremely old compilers
199 */ 201 */
200 #include <pshpack1.h> 202 #include <pshpack1.h>
201 203
202 typedef struct _DllVersionInfo 204 typedef struct _DllVersionInfo
203 { 205 {
566 } 568 }
567 else 569 else
568 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_PAGEUP : SB_PAGEDOWN, 0); 570 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_PAGEUP : SB_PAGEDOWN, 0);
569 } 571 }
570 572
573 #ifdef USE_SYSMENU_FONT
574 /*
575 * Get Menu Font.
576 * Return OK or FAIL.
577 */
578 static int
579 gui_w32_get_menu_font(LOGFONT *lf)
580 {
581 NONCLIENTMETRICS nm;
582
583 nm.cbSize = sizeof(NONCLIENTMETRICS);
584 if (!SystemParametersInfo(
585 SPI_GETNONCLIENTMETRICS,
586 sizeof(NONCLIENTMETRICS),
587 &nm,
588 0))
589 return FAIL;
590 *lf = nm.lfMenuFont;
591 return OK;
592 }
593 #endif
594
595
596 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT)
597 /*
598 * Set the GUI tabline font to the system menu font
599 */
600 static void
601 set_tabline_font(void)
602 {
603 LOGFONT lfSysmenu;
604 HFONT font;
605 HWND hwnd;
606 HDC hdc;
607 HFONT hfntOld;
608 TEXTMETRIC tm;
609
610 if (gui_w32_get_menu_font(&lfSysmenu) != OK)
611 return;
612
613 font = CreateFontIndirect(&lfSysmenu);
614
615 SendMessage(s_tabhwnd, WM_SETFONT, (WPARAM)font, TRUE);
616
617 /*
618 * Compute the height of the font used for the tab text
619 */
620 hwnd = GetDesktopWindow();
621 hdc = GetWindowDC(hwnd);
622 hfntOld = SelectFont(hdc, font);
623
624 GetTextMetrics(hdc, &tm);
625
626 SelectFont(hdc, hfntOld);
627 ReleaseDC(hwnd, hdc);
628
629 /*
630 * The space used by the tab border and the space between the tab label
631 * and the tab border is included as 7.
632 */
633 gui.tabline_height = tm.tmHeight + tm.tmInternalLeading + 7;
634 }
635 #endif
636
571 /* 637 /*
572 * Invoked when a setting was changed. 638 * Invoked when a setting was changed.
573 */ 639 */
574 static LRESULT CALLBACK 640 static LRESULT CALLBACK
575 _OnSettingChange(UINT n) 641 _OnSettingChange(UINT n)
576 { 642 {
577 if (n == SPI_SETWHEELSCROLLLINES) 643 if (n == SPI_SETWHEELSCROLLLINES)
578 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, 644 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
579 &mouse_scroll_lines, 0); 645 &mouse_scroll_lines, 0);
646 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT)
647 if (n == SPI_SETNONCLIENTMETRICS)
648 set_tabline_font();
649 #endif
580 return 0; 650 return 0;
581 } 651 }
582 652
583 #if 0 /* disabled, a gap appears below and beside the window, and the window 653 #if 0 /* disabled, a gap appears below and beside the window, and the window
584 can be moved (in a strange way) */ 654 can be moved (in a strange way) */
871 wstr = enc_to_ucs2(NameBuff, NULL); 941 wstr = enc_to_ucs2(NameBuff, NULL);
872 if (wstr != NULL) 942 if (wstr != NULL)
873 { 943 {
874 int wlen; 944 int wlen;
875 945
876 wlen = (wcslen(wstr) + 1) 946 wlen = ((int)wcslen(wstr) + 1)
877 * sizeof(WCHAR); 947 * sizeof(WCHAR);
878 if (tt_text_len < wlen) 948 if (tt_text_len < wlen)
879 { 949 {
880 tt_text = vim_realloc(tt_text, 950 tt_text = vim_realloc(tt_text,
881 wlen); 951 wlen);
891 if (wstr == NULL) 961 if (wstr == NULL)
892 # endif 962 # endif
893 { 963 {
894 int len; 964 int len;
895 965
896 len = STRLEN(NameBuff) + 1; 966 len = (int)STRLEN(NameBuff) + 1;
897 if (tt_text_len < len) 967 if (tt_text_len < len)
898 { 968 {
899 tt_text = vim_realloc(tt_text, len); 969 tt_text = vim_realloc(tt_text, len);
900 if (tt_text != NULL) 970 if (tt_text != NULL)
901 tt_text_len = len; 971 tt_text_len = len;
2867 "IDR_VIM_ERROR", 2937 "IDR_VIM_ERROR",
2868 "IDR_VIM_ALERT", 2938 "IDR_VIM_ALERT",
2869 "IDR_VIM_INFO", 2939 "IDR_VIM_INFO",
2870 "IDR_VIM_QUESTION" 2940 "IDR_VIM_QUESTION"
2871 }; 2941 };
2872
2873 #ifdef USE_SYSMENU_FONT
2874 /*
2875 * Get Menu Font.
2876 * Return OK or FAIL.
2877 */
2878 static int
2879 gui_w32_get_menu_font(LOGFONT *lf)
2880 {
2881 NONCLIENTMETRICS nm;
2882
2883 nm.cbSize = sizeof(NONCLIENTMETRICS);
2884 if (!SystemParametersInfo(
2885 SPI_GETNONCLIENTMETRICS,
2886 sizeof(NONCLIENTMETRICS),
2887 &nm,
2888 0))
2889 return FAIL;
2890 *lf = nm.lfMenuFont;
2891 return OK;
2892 }
2893 #endif
2894 2942
2895 int 2943 int
2896 gui_mch_dialog( 2944 gui_mch_dialog(
2897 int type, 2945 int type,
2898 char_u *title, 2946 char_u *title,
4068 4116
4069 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) 4117 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
4070 static void 4118 static void
4071 initialise_tabline(void) 4119 initialise_tabline(void)
4072 { 4120 {
4073 # ifdef USE_SYSMENU_FONT
4074 LOGFONT lfSysmenu;
4075 # endif
4076
4077 InitCommonControls(); 4121 InitCommonControls();
4078 4122
4079 s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", 4123 s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline",
4080 WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS, 4124 WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS,
4081 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 4125 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
4082 CW_USEDEFAULT, s_hwnd, NULL, s_hinst, NULL); 4126 CW_USEDEFAULT, s_hwnd, NULL, s_hinst, NULL);
4083 4127
4128 gui.tabline_height = TABLINE_HEIGHT;
4129
4084 # ifdef USE_SYSMENU_FONT 4130 # ifdef USE_SYSMENU_FONT
4085 if (gui_w32_get_menu_font(&lfSysmenu) == OK) 4131 set_tabline_font();
4086 {
4087 HFONT font = CreateFontIndirect(&lfSysmenu);
4088 SendMessage(s_tabhwnd, WM_SETFONT, (WPARAM) font, TRUE);
4089 }
4090 # endif 4132 # endif
4091 } 4133 }
4092 #endif 4134 #endif
4093 4135
4094 #if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO) 4136 #if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO)
4557 { 4599 {
4558 // TRACE0("gui_mch_enable_beval_area |||"); 4600 // TRACE0("gui_mch_enable_beval_area |||");
4559 if (beval == NULL) 4601 if (beval == NULL)
4560 return; 4602 return;
4561 // TRACE0("gui_mch_enable_beval_area {{{"); 4603 // TRACE0("gui_mch_enable_beval_area {{{");
4562 BevalTimerId = SetTimer(s_textArea, 0, p_bdlay / 2, 4604 BevalTimerId = SetTimer(s_textArea, 0, p_bdlay / 2, BevalTimerProc);
4563 (TIMERPROC)BevalTimerProc);
4564 // TRACE0("gui_mch_enable_beval_area }}}"); 4605 // TRACE0("gui_mch_enable_beval_area }}}");
4565 } 4606 }
4566 4607
4567 void 4608 void
4568 gui_mch_post_balloon(beval, mesg) 4609 gui_mch_post_balloon(beval, mesg)