comparison src/gui.c @ 685:d7e33248b9c8 v7.0206

updated for version 7.0206
author vimboss
date Fri, 24 Feb 2006 23:53:04 +0000
parents 9364d114ed8d
children d4b8e06e7c96
comparison
equal deleted inserted replaced
684:a8caf7dd853d 685:d7e33248b9c8
24 static int gui_screenstr __ARGS((int off, int len, int flags, guicolor_T fg, guicolor_T bg, int back)); 24 static int gui_screenstr __ARGS((int off, int len, int flags, guicolor_T fg, guicolor_T bg, int back));
25 #endif 25 #endif
26 static void gui_delete_lines __ARGS((int row, int count)); 26 static void gui_delete_lines __ARGS((int row, int count));
27 static void gui_insert_lines __ARGS((int row, int count)); 27 static void gui_insert_lines __ARGS((int row, int count));
28 static void fill_mouse_coord __ARGS((char_u *p, int col, int row)); 28 static void fill_mouse_coord __ARGS((char_u *p, int col, int row));
29 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
30 static int gui_has_tabline __ARGS((void));
31 #endif
29 static void gui_do_scrollbar __ARGS((win_T *wp, int which, int enable)); 32 static void gui_do_scrollbar __ARGS((win_T *wp, int which, int enable));
30 static colnr_T scroll_line_len __ARGS((linenr_T lnum)); 33 static colnr_T scroll_line_len __ARGS((linenr_T lnum));
31 static void gui_update_horiz_scrollbar __ARGS((int)); 34 static void gui_update_horiz_scrollbar __ARGS((int));
32 static void gui_set_fg_color __ARGS((char_u *name)); 35 static void gui_set_fg_color __ARGS((char_u *name));
33 static void gui_set_bg_color __ARGS((char_u *name)); 36 static void gui_set_bg_color __ARGS((char_u *name));
1408 gui.num_rows = Rows; 1411 gui.num_rows = Rows;
1409 1412
1410 min_width = base_width + MIN_COLUMNS * gui.char_width; 1413 min_width = base_width + MIN_COLUMNS * gui.char_width;
1411 min_height = base_height + MIN_LINES * gui.char_height; 1414 min_height = base_height + MIN_LINES * gui.char_height;
1412 # ifdef FEAT_WINDOWS 1415 # ifdef FEAT_WINDOWS
1413 min_height += tabpageline_height() * gui.char_height; 1416 min_height += tabline_height() * gui.char_height;
1414 # endif 1417 # endif
1415 1418
1416 gui_mch_set_shellsize(width, height, min_width, min_height, 1419 gui_mch_set_shellsize(width, height, min_width, min_height,
1417 base_width, base_height); 1420 base_width, base_height);
1418 if (fit_to_display) 1421 if (fit_to_display)
3079 3082
3080 static int prev_which_scrollbars[3] = {-1, -1, -1}; 3083 static int prev_which_scrollbars[3] = {-1, -1, -1};
3081 3084
3082 /* 3085 /*
3083 * Set which components are present. 3086 * Set which components are present.
3084 * If "oldval" is not NULL, "oldval" is the previous value, the new * value is 3087 * If "oldval" is not NULL, "oldval" is the previous value, the new value is
3085 * in p_go. 3088 * in p_go.
3086 */ 3089 */
3087 /*ARGSUSED*/ 3090 /*ARGSUSED*/
3088 void 3091 void
3089 gui_init_which_components(oldval) 3092 gui_init_which_components(oldval)
3093 static int prev_menu_is_active = -1; 3096 static int prev_menu_is_active = -1;
3094 #endif 3097 #endif
3095 #ifdef FEAT_TOOLBAR 3098 #ifdef FEAT_TOOLBAR
3096 static int prev_toolbar = -1; 3099 static int prev_toolbar = -1;
3097 int using_toolbar = FALSE; 3100 int using_toolbar = FALSE;
3101 #endif
3102 #ifdef FEAT_GUI_TABLINE
3103 static int prev_has_tabline = FALSE;
3104 int using_tabline;
3098 #endif 3105 #endif
3099 #ifdef FEAT_FOOTER 3106 #ifdef FEAT_FOOTER
3100 static int prev_footer = -1; 3107 static int prev_footer = -1;
3101 int using_footer = FALSE; 3108 int using_footer = FALSE;
3102 #endif 3109 #endif
3183 break; 3190 break;
3184 default: 3191 default:
3185 /* Ignore options that are not supported */ 3192 /* Ignore options that are not supported */
3186 break; 3193 break;
3187 } 3194 }
3195
3188 if (gui.in_use) 3196 if (gui.in_use)
3189 { 3197 {
3190 need_set_size = FALSE; 3198 need_set_size = FALSE;
3191 fix_size = FALSE; 3199 fix_size = FALSE;
3200
3201 #ifdef FEAT_GUI_TABLINE
3202 /* Update the tab line, it may appear or disappear. */
3203 using_tabline = gui_has_tabline();
3204 if (prev_has_tabline != using_tabline)
3205 {
3206 prev_has_tabline = using_tabline;
3207 gui_update_tabline();
3208 need_set_size = TRUE;
3209 if (using_tabline)
3210 fix_size = TRUE;
3211 if (!gui_use_tabline())
3212 redraw_tabline = TRUE; /* may draw non-GUI tab line */
3213 }
3214 #endif
3215
3192 for (i = 0; i < 3; i++) 3216 for (i = 0; i < 3; i++)
3193 { 3217 {
3194 if (gui.which_scrollbars[i] != prev_which_scrollbars[i]) 3218 if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
3195 { 3219 {
3196 if (i == SBAR_BOTTOM) 3220 if (i == SBAR_BOTTOM)
3279 #endif 3303 #endif
3280 } 3304 }
3281 } 3305 }
3282 } 3306 }
3283 3307
3308 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
3309 /*
3310 * Return TRUE if the GUI is taking care of the tabline.
3311 * It may still be hidden if 'showtabline' is zero.
3312 */
3313 int
3314 gui_use_tabline()
3315 {
3316 return gui.in_use && vim_strchr(p_go, GO_TABLINE) != NULL;
3317 }
3318
3319 /*
3320 * Return TRUE if the GUI is showing the tabline.
3321 * This uses 'showtabline'.
3322 */
3323 static int
3324 gui_has_tabline()
3325 {
3326 if (!gui_use_tabline()
3327 || p_stal == 0
3328 || (p_stal == 1 && first_tabpage->tp_next == NULL))
3329 return FALSE;
3330 return TRUE;
3331 }
3332
3333 /*
3334 * Update the tabline.
3335 * This may display/undisplay the tabline and update the labels.
3336 */
3337 void
3338 gui_update_tabline()
3339 {
3340 int showit = gui_has_tabline();
3341
3342 if (!gui.starting && starting == 0)
3343 {
3344 gui_mch_show_tabline(showit);
3345 if (showit != 0)
3346 gui_mch_update_tabline();
3347 }
3348 }
3349
3350 /*
3351 * Get the label for tab page "tp" into NameBuff[].
3352 */
3353 void
3354 get_tabline_label(tp)
3355 tabpage_T *tp;
3356 {
3357 int modified = FALSE;
3358 char_u buf[40];
3359 int wincount;
3360 win_T *wp;
3361
3362 /* Get the buffer name into NameBuff[] */
3363 get_trans_bufname(tp == curtab ? curbuf : tp->tp_curwin->w_buffer);
3364
3365 wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
3366 for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount)
3367 if (bufIsChanged(wp->w_buffer))
3368 modified = TRUE;
3369 if (modified || wincount > 1)
3370 {
3371 if (wincount > 1)
3372 vim_snprintf((char *)buf, sizeof(buf), "%d", wincount);
3373 else
3374 buf[0] = NUL;
3375 if (modified)
3376 STRCAT(buf, "+");
3377 STRCAT(buf, " ");
3378 mch_memmove(NameBuff + STRLEN(buf), NameBuff, STRLEN(NameBuff) + 1);
3379 mch_memmove(NameBuff, buf, STRLEN(buf));
3380 }
3381 }
3382
3383 #endif
3284 3384
3285 /* 3385 /*
3286 * Scrollbar stuff: 3386 * Scrollbar stuff:
3287 */ 3387 */
3288 3388