diff options
-rw-r--r-- | runtime/doc/usr_44.txt | 33 | ||||
-rw-r--r-- | src/feature.h | 2 | ||||
-rw-r--r-- | src/gui.c | 62 | ||||
-rw-r--r-- | src/gui.h | 2 | ||||
-rw-r--r-- | src/gui_athena.c | 4 | ||||
-rw-r--r-- | src/gui_motif.c | 4 | ||||
-rw-r--r-- | src/gui_riscos.c | 3 | ||||
-rw-r--r-- | src/gui_w16.c | 14 | ||||
-rw-r--r-- | src/gui_w48.c | 70 | ||||
-rw-r--r-- | src/mbyte.c | 8 | ||||
-rw-r--r-- | src/proto/gui.pro | 2 | ||||
-rw-r--r-- | src/proto/gui_gtk_x11.pro | 2 | ||||
-rw-r--r-- | src/proto/gui_photon.pro | 2 | ||||
-rw-r--r-- | src/proto/gui_w16.pro | 2 | ||||
-rw-r--r-- | src/proto/gui_w32.pro | 2 | ||||
-rw-r--r-- | src/vim.h | 7 |
16 files changed, 148 insertions, 71 deletions
diff --git a/runtime/doc/usr_44.txt b/runtime/doc/usr_44.txt index a11fd4275..383701355 100644 --- a/runtime/doc/usr_44.txt +++ b/runtime/doc/usr_44.txt @@ -1,4 +1,4 @@ -*usr_44.txt* For Vim version 7.0c. Last change: 2005 Apr 01 +*usr_44.txt* For Vim version 7.0c. Last change: 2006 Mar 27 VIM USER MANUAL - by Bram Moolenaar @@ -689,25 +689,20 @@ Do not include anything that is a user preference. Don't set 'tabstop', Do not include mappings or abbreviations. Only include setting 'iskeyword' if it is really necessary for recognizing keywords. -Avoid using specific colors. Link to the standard highlight groups whenever -possible. Don't forget that some people use a different background color, or -have only eight colors available. -For backwards compatibility with Vim 5.8 this construction is used: > - - if version >= 508 || !exists("did_c_syn_inits") - if version < 508 - let did_c_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink nameString String - HiLink nameNumber Number - ... etc ... +To allow users select their own preferred colors, make a different group name +for every kind of highlighted item. Then link each of them to one of the +standard highlight groups. That will make it work with every color scheme. +If you select specific colors it will look bad with some color schemes. And +don't forget that some people use a different background color, or have only +eight colors available. - delcommand HiLink - endif +For the linking use "hi def link", so that the user can select different +highlighting before your syntax file is loaded. Example: > + + hi def link nameString String + hi def link nameNumber Number + hi def link nameCommand Statement + ... etc ... Add the "display" argument to items that are not used when syncing, to speed up scrolling backwards and CTRL-L. diff --git a/src/feature.h b/src/feature.h index 5d395d737..b0a8774da 100644 --- a/src/feature.h +++ b/src/feature.h @@ -754,7 +754,7 @@ * GUI tabline */ #if defined(FEAT_WINDOWS) && (defined(FEAT_GUI_GTK) \ - || (defined(FEAT_GUI_MSWIN) && WINVER > 0x0400)) + || (defined(FEAT_GUI_MSWIN) && (!defined(_MSC_VER) || _MSC_VER > 1020))) # define FEAT_GUI_TABLINE #endif @@ -521,7 +521,7 @@ gui_init() #ifndef FEAT_GUI_GTK /* Set the shell size, adjusted for the screen size. For GTK this only * works after the shell has been opened, thus it is further down. */ - gui_set_shellsize(FALSE, TRUE); + gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH); #endif #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) /* Need to set the size of the menubar after all the menus have been @@ -547,7 +547,7 @@ gui_init() /* Give GTK+ a chance to put all widget's into place. */ gui_mch_update(); /* Now make sure the shell fits on the screen. */ - gui_set_shellsize(FALSE, TRUE); + gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH); #endif /* When 'lines' was set while starting up the topframe may have to be * resized. */ @@ -741,7 +741,7 @@ gui_init_font(font_list, fontset) #else FALSE #endif - ); + , RESIZE_BOTH); } return ret; @@ -1354,9 +1354,10 @@ gui_get_shellsize() */ /*ARGSUSED*/ void -gui_set_shellsize(mustset, fit_to_display) +gui_set_shellsize(mustset, fit_to_display, direction) int mustset; /* set by the user */ int fit_to_display; + int direction; /* RESIZE_HOR, RESIZE_VER */ { int base_width; int base_height; @@ -1399,14 +1400,14 @@ gui_set_shellsize(mustset, fit_to_display) if (fit_to_display) { gui_mch_get_screen_dimensions(&screen_w, &screen_h); - if (width > screen_w) + if ((direction & RESIZE_HOR) && width > screen_w) { Columns = (screen_w - base_width) / gui.char_width; if (Columns < MIN_COLUMNS) Columns = MIN_COLUMNS; width = Columns * gui.char_width + base_width; } - if (height > screen_h) + if ((direction & RESIZE_VERT) && height > screen_h) { Rows = (screen_h - base_height) / gui.char_height; check_shellsize(); @@ -1423,7 +1424,7 @@ gui_set_shellsize(mustset, fit_to_display) # endif gui_mch_set_shellsize(width, height, min_width, min_height, - base_width, base_height); + base_width, base_height, direction); if (fit_to_display) { int x, y; @@ -3087,9 +3088,7 @@ gui_menu_cb(menu) } #endif -#ifndef FEAT_WINDOWS -static int prev_which_scrollbars[3]; -#endif +static int prev_which_scrollbars[3]; /* * Set which components are present. @@ -3203,7 +3202,7 @@ gui_init_which_components(oldval) if (gui.in_use) { - need_set_size = FALSE; + need_set_size = 0; fix_size = FALSE; #ifdef FEAT_GUI_TABLINE @@ -3217,7 +3216,7 @@ gui_init_which_components(oldval) i = Rows; gui_update_tabline(); Rows = i; - need_set_size = TRUE; + need_set_size = RESIZE_VERT; if (using_tabline) fix_size = TRUE; if (!gui_use_tabline()) @@ -3227,11 +3226,14 @@ gui_init_which_components(oldval) for (i = 0; i < 3; i++) { - if (gui.which_scrollbars[i] != + /* The scrollbar needs to be updated when it is shown/unshown and + * when switching tab pages. But the size only changes when it's + * shown/unshown. Thus we need two places to remember whether a + * scrollbar is there or not. */ + if (gui.which_scrollbars[i] != prev_which_scrollbars[i] #ifdef FEAT_WINDOWS - curtab->tp_prev_which_scrollbars[i] -#else - prev_which_scrollbars[i] + || gui.which_scrollbars[i] + != curtab->tp_prev_which_scrollbars[i] #endif ) { @@ -3245,16 +3247,20 @@ gui_init_which_components(oldval) gui_do_scrollbar(wp, i, gui.which_scrollbars[i]); } } - need_set_size = TRUE; - if (gui.which_scrollbars[i]) - fix_size = TRUE; + if (gui.which_scrollbars[i] != prev_which_scrollbars[i]) + { + if (i == SBAR_BOTTOM) + need_set_size = RESIZE_VERT; + else + need_set_size = RESIZE_HOR; + if (gui.which_scrollbars[i]) + fix_size = TRUE; + } } #ifdef FEAT_WINDOWS - curtab->tp_prev_which_scrollbars[i] -#else - prev_which_scrollbars[i] + curtab->tp_prev_which_scrollbars[i] = gui.which_scrollbars[i]; #endif - = gui.which_scrollbars[i]; + prev_which_scrollbars[i] = gui.which_scrollbars[i]; } #ifdef FEAT_MENU @@ -3266,7 +3272,7 @@ gui_init_which_components(oldval) gui_mch_enable_menu(gui.menu_is_active); Rows = i; prev_menu_is_active = gui.menu_is_active; - need_set_size = TRUE; + need_set_size = RESIZE_VERT; if (gui.menu_is_active) fix_size = TRUE; } @@ -3277,7 +3283,7 @@ gui_init_which_components(oldval) { gui_mch_show_toolbar(using_toolbar); prev_toolbar = using_toolbar; - need_set_size = TRUE; + need_set_size = RESIZE_VERT; if (using_toolbar) fix_size = TRUE; } @@ -3287,7 +3293,7 @@ gui_init_which_components(oldval) { gui_mch_enable_footer(using_footer); prev_footer = using_footer; - need_set_size = TRUE; + need_set_size = RESIZE_VERT; if (using_footer) fix_size = TRUE; } @@ -3307,7 +3313,7 @@ gui_init_which_components(oldval) /* Adjust the size of the window to make the text area keep the * same size and to avoid that part of our window is off-screen * and a scrollbar can't be used, for example. */ - gui_set_shellsize(FALSE, fix_size); + gui_set_shellsize(FALSE, fix_size, need_set_size); #ifdef FEAT_GUI_GTK /* GTK has the annoying habit of sending us resize events when @@ -3379,7 +3385,7 @@ gui_update_tabline() /* When the tabs change from hidden to shown or from shown to * hidden the size of the text area should remain the same. */ if (!showit != !shown) - gui_set_shellsize(FALSE, showit); + gui_set_shellsize(FALSE, showit, RESIZE_VERT); } } @@ -159,7 +159,7 @@ #define TOOLBAR_BORDER_HEIGHT 12 /* room above+below buttons for MSWindows */ #ifdef FEAT_GUI_MSWIN -# define TABLINE_HEIGHT 24 +# define TABLINE_HEIGHT 22 #endif #if defined(NO_CONSOLE) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) diff --git a/src/gui_athena.c b/src/gui_athena.c index 9507e783a..df1367f83 100644 --- a/src/gui_athena.c +++ b/src/gui_athena.c @@ -1041,7 +1041,7 @@ gui_mch_new_menu_font() #endif ); } - gui_set_shellsize(FALSE, TRUE); + gui_set_shellsize(FALSE, TRUE, RESIZE_VERT); ui_new_shellsize(); if (oldpuller != None) XFreePixmap(gui.dpy, oldpuller); @@ -1418,7 +1418,7 @@ gui_mch_show_toolbar(int showit) XtUnmanageChild(toolBar); } - gui_set_shellsize(FALSE, FALSE); + gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); } diff --git a/src/gui_motif.c b/src/gui_motif.c index 14f65caeb..ac9468e53 100644 --- a/src/gui_motif.c +++ b/src/gui_motif.c @@ -1233,7 +1233,7 @@ gui_mch_new_menu_font() #endif ); } - gui_set_shellsize(FALSE, TRUE); + gui_set_shellsize(FALSE, TRUE, RESIZE_VERT); ui_new_shellsize(); } @@ -2799,7 +2799,7 @@ gui_mch_show_toolbar(int showit) XtUnmanageChild(XtParent(toolBar)); } - gui_set_shellsize(FALSE, FALSE); + gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); } /* diff --git a/src/gui_riscos.c b/src/gui_riscos.c index a5d54bd3b..59d2272e8 100644 --- a/src/gui_riscos.c +++ b/src/gui_riscos.c @@ -692,13 +692,14 @@ gui_mch_set_winpos(int x, int y) } void -gui_mch_set_shellsize(width, height, min_width, min_height, base_width, base_height) +gui_mch_set_shellsize(width, height, min_width, min_height, base_width, base_height, direction) int width; /* In OS units */ int height; int min_width; /* Smallest permissable window size (ignored) */ int min_height; int base_width; /* Space for scroll bars, etc */ int base_height; + int direction; { int s_width, s_height; int block[] = { diff --git a/src/gui_w16.c b/src/gui_w16.c index b8e8ca949..75726c805 100644 --- a/src/gui_w16.c +++ b/src/gui_w16.c @@ -128,7 +128,7 @@ gui_mswin_get_menu_height( if (fix_window && menu_height != old_menu_height) { old_menu_height = menu_height; - gui_set_shellsize(FALSE, FALSE); + gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); } return menu_height; @@ -488,7 +488,8 @@ gui_mch_init(void) */ void gui_mch_set_shellsize(int width, int height, - int min_width, int min_height, int base_width, int base_height) + int min_width, int min_height, int base_width, int base_height, + int direction) { RECT workarea_rect; int win_width, win_height; @@ -528,16 +529,17 @@ gui_mch_set_shellsize(int width, int height, ; /* if the window is going off the screen, move it on to the screen */ - if (win_xpos + win_width > workarea_rect.right) + if ((direction & RESIZE_HOR) && win_xpos + win_width > workarea_rect.right) win_xpos = workarea_rect.right - win_width; - if (win_xpos < workarea_rect.left) + if ((direction & RESIZE_HOR) && win_xpos < workarea_rect.left) win_xpos = workarea_rect.left; - if (win_ypos + win_height > workarea_rect.bottom) + if ((direction & RESIZE_VERT) + && win_ypos + win_height > workarea_rect.bottom) win_ypos = workarea_rect.bottom - win_height; - if (win_ypos < workarea_rect.top) + if ((direction & RESIZE_VERT) && win_ypos < workarea_rect.top) win_ypos = workarea_rect.top; /* set window position */ diff --git a/src/gui_w48.c b/src/gui_w48.c index b586af84f..c4ce0bc98 100644 --- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -1113,14 +1113,18 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h) #if defined(FEAT_GUI_TABLINE) if (showing_tabline) { - int top = 0; + int top = 0; + RECT rect; #ifdef FEAT_TOOLBAR if (vim_strchr(p_go, GO_TOOLBAR) != NULL) top = TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT; #endif - MoveWindow(s_tabhwnd, 0, top, w, TABLINE_HEIGHT, TRUE); + GetWindowRect(s_hwnd, &rect); + SetRect(&rect, 0, top, rect.right, TABLINE_HEIGHT); + TabCtrl_AdjustRect(s_tabhwnd, TRUE, &rect); + MoveWindow(s_tabhwnd, 0, top, rect.right, rect.bottom, TRUE); } #endif @@ -2176,6 +2180,68 @@ gui_mch_show_toolbar(int showit) #endif #if defined(FEAT_GUI_TABLINE) || defined(PROTO) + static void +show_tabline_popup_menu(void) +{ + HMENU tab_pmenu; + MENUITEMINFO minfo; + long rval; + POINT pt; + char_u string[3]; + + tab_pmenu = CreatePopupMenu(); + if (tab_pmenu == NULL) + return; + + minfo.cbSize = sizeof(MENUITEMINFO); + minfo.fMask = MIIM_TYPE|MIIM_ID; + minfo.fType = MFT_STRING; + + minfo.dwTypeData = _("Close tab"); + minfo.wID = TABLINE_MENU_CLOSE; + InsertMenuItem(tab_pmenu, TABLINE_MENU_CLOSE, FALSE, &minfo); + + minfo.dwTypeData = _("New tab"); + minfo.wID = TABLINE_MENU_NEW; + InsertMenuItem(tab_pmenu, TABLINE_MENU_NEW, FALSE, &minfo); + + minfo.dwTypeData = _("Open tab..."); + minfo.wID = TABLINE_MENU_OPEN; + InsertMenuItem(tab_pmenu, TABLINE_MENU_OPEN, FALSE, &minfo); + + GetCursorPos(&pt); + rval = TrackPopupMenuEx(tab_pmenu, TPM_RETURNCMD, pt.x, pt.y, s_tabhwnd, + NULL); + + DestroyMenu(tab_pmenu); + + /* Add the string cmd into input buffer */ + if (rval > 0) + { + TCHITTESTINFO htinfo; + int idx; + + if (ScreenToClient(s_tabhwnd, &pt) == 0) + return; + + htinfo.pt.x = pt.x; + htinfo.pt.y = pt.y; + idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); + if (idx == -1) + idx = 0; + else + idx += 1; + + string[0] = CSI; + string[1] = KS_TABMENU; + string[2] = KE_FILLER; + add_to_input_buf(string, 3); + string[0] = idx; + string[1] = (char_u)(long)rval; + add_to_input_buf_csi(string, 2); + } +} + /* * Show or hide the tabline. */ diff --git a/src/mbyte.c b/src/mbyte.c index d8e7cd780..e20870063 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -4899,7 +4899,7 @@ xim_instantiate_cb(display, client_data, call_data) return; xim_real_init(x11_window, x11_display); - gui_set_shellsize(FALSE, FALSE); + gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); if (xic != NULL) XUnregisterIMInstantiateCallback(x11_display, NULL, NULL, NULL, xim_instantiate_cb, NULL); @@ -4923,7 +4923,7 @@ xim_destroy_cb(im, client_data, call_data) xic = NULL; status_area_enabled = FALSE; - gui_set_shellsize(FALSE, FALSE); + gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL, xim_instantiate_cb, NULL); @@ -4947,7 +4947,7 @@ xim_init() if (xim_real_init(x11_window, x11_display)) return; - gui_set_shellsize(FALSE, FALSE); + gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); #ifdef USE_X11R6_XIM XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL, @@ -5162,7 +5162,7 @@ xim_real_init(x11_window, x11_display) status_area_enabled = TRUE; } else - gui_set_shellsize(FALSE, FALSE); + gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); } else { diff --git a/src/proto/gui.pro b/src/proto/gui.pro index 704cd1b59..b926eb0bd 100644 --- a/src/proto/gui.pro +++ b/src/proto/gui.pro @@ -15,7 +15,7 @@ extern int gui_get_base_height __ARGS((void)); extern void gui_resize_shell __ARGS((int pixel_width, int pixel_height)); extern void gui_may_resize_shell __ARGS((void)); extern int gui_get_shellsize __ARGS((void)); -extern void gui_set_shellsize __ARGS((int mustset, int fit_to_display)); +extern void gui_set_shellsize __ARGS((int mustset, int fit_to_display, int direction)); extern void gui_new_shellsize __ARGS((void)); extern void gui_reset_scroll_region __ARGS((void)); extern void gui_start_highlight __ARGS((int mask)); diff --git a/src/proto/gui_gtk_x11.pro b/src/proto/gui_gtk_x11.pro index 46fcc9f00..deb8039be 100644 --- a/src/proto/gui_gtk_x11.pro +++ b/src/proto/gui_gtk_x11.pro @@ -16,7 +16,7 @@ extern int gui_mch_open __ARGS((void)); extern void gui_mch_exit __ARGS((int rc)); extern int gui_mch_get_winpos __ARGS((int *x, int *y)); extern void gui_mch_set_winpos __ARGS((int x, int y)); -extern void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height)); +extern void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); extern void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); extern void gui_mch_settitle __ARGS((char_u *title, char_u *icon)); extern void gui_mch_enable_menu __ARGS((int showit)); diff --git a/src/proto/gui_photon.pro b/src/proto/gui_photon.pro index 0ffbaaad5..bd5f43e2f 100644 --- a/src/proto/gui_photon.pro +++ b/src/proto/gui_photon.pro @@ -11,7 +11,7 @@ extern char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *default extern int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int default_button, char_u *textfield)); extern int gui_mch_get_winpos __ARGS((int *x, int *y)); extern void gui_mch_set_winpos __ARGS((int x, int y)); -extern void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height)); +extern void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); extern void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); extern void gui_mch_iconify __ARGS((void)); extern void gui_mch_set_foreground __ARGS((void)); diff --git a/src/proto/gui_w16.pro b/src/proto/gui_w16.pro index 6a22c3e9a..eebd67514 100644 --- a/src/proto/gui_w16.pro +++ b/src/proto/gui_w16.pro @@ -59,7 +59,7 @@ extern char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, c extern int get_cmd_args __ARGS((char *prog, char *cmdline, char ***argvp, char **tofree)); extern void gui_mch_prepare __ARGS((int *argc, char **argv)); extern int gui_mch_init __ARGS((void)); -extern void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height)); +extern void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); extern void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max)); extern void gui_mch_set_font __ARGS((GuiFont font)); extern void gui_mch_set_fg_color __ARGS((guicolor_T color)); diff --git a/src/proto/gui_w32.pro b/src/proto/gui_w32.pro index 731636d1e..5280291f5 100644 --- a/src/proto/gui_w32.pro +++ b/src/proto/gui_w32.pro @@ -61,7 +61,7 @@ extern int gui_is_win32s __ARGS((void)); extern void gui_mch_set_parent __ARGS((char *title)); extern void gui_mch_prepare __ARGS((int *argc, char **argv)); extern int gui_mch_init __ARGS((void)); -extern void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height)); +extern void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); extern void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max)); extern void gui_mch_set_font __ARGS((GuiFont font)); extern void gui_mch_set_fg_color __ARGS((guicolor_T color)); @@ -1014,6 +1014,13 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define WSP_ABOVE 64 /* put new window above/left */ /* + * arguments for gui_set_shellsize() + */ +#define RESIZE_VERT 1 /* resize vertically */ +#define RESIZE_HOR 2 /* resize horizontally */ +#define RESIZE_BOTH 15 /* resize in both directions */ + +/* * "flags" values for option-setting functions. * When OPT_GLOBAL and OPT_LOCAL are both missing, set both local and global * values, get local value. |