comparison src/gui.c @ 687:d4b8e06e7c96

updated for version 7.0207
author vimboss
date Sat, 25 Feb 2006 21:47:41 +0000
parents d7e33248b9c8
children 8106f3da02d0
comparison
equal deleted inserted replaced
686:473847b050f8 687:d4b8e06e7c96
3197 { 3197 {
3198 need_set_size = FALSE; 3198 need_set_size = FALSE;
3199 fix_size = FALSE; 3199 fix_size = FALSE;
3200 3200
3201 #ifdef FEAT_GUI_TABLINE 3201 #ifdef FEAT_GUI_TABLINE
3202 /* Update the tab line, it may appear or disappear. */ 3202 /* Update the GUI tab line, it may appear or disappear. This may
3203 * cause the non-GUI tab line to disappear or appear. */
3203 using_tabline = gui_has_tabline(); 3204 using_tabline = gui_has_tabline();
3204 if (prev_has_tabline != using_tabline) 3205 if (prev_has_tabline != using_tabline)
3205 { 3206 {
3206 prev_has_tabline = using_tabline; 3207 prev_has_tabline = using_tabline;
3207 gui_update_tabline(); 3208 gui_update_tabline();
3277 } 3278 }
3278 #endif 3279 #endif
3279 if (need_set_size) 3280 if (need_set_size)
3280 { 3281 {
3281 #ifdef FEAT_GUI_GTK 3282 #ifdef FEAT_GUI_GTK
3282 long r = Rows;
3283 long c = Columns; 3283 long c = Columns;
3284 #endif 3284 #endif
3285 /* Adjust the size of the window to make the text area keep the 3285 /* Adjust the size of the window to make the text area keep the
3286 * same size and to avoid that part of our window is off-screen 3286 * same size and to avoid that part of our window is off-screen
3287 * and a scrollbar can't be used, for example. */ 3287 * and a scrollbar can't be used, for example. */
3293 * waiting for a character to arrive, quite unpredictably, and may 3293 * waiting for a character to arrive, quite unpredictably, and may
3294 * change Columns and Rows when we don't want it. Wait for a 3294 * change Columns and Rows when we don't want it. Wait for a
3295 * character here to avoid this effect. 3295 * character here to avoid this effect.
3296 * If you remove this, please test this command for resizing 3296 * If you remove this, please test this command for resizing
3297 * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q". 3297 * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
3298 * Don't do this while starting up though. */ 3298 * Don't do this while starting up though.
3299 * And don't change Rows, it may have be reduced intentionally
3300 * when adding menu/toolbar/tabline. */
3299 if (!gui.starting) 3301 if (!gui.starting)
3300 (void)char_avail(); 3302 (void)char_avail();
3301 Rows = r;
3302 Columns = c; 3303 Columns = c;
3303 #endif 3304 #endif
3304 } 3305 }
3306 #ifdef FEAT_WINDOWS
3307 /* When the console tabline appears or disappears the window positions
3308 * change. */
3309 if (firstwin->w_winrow != tabline_height())
3310 shell_new_rows(); /* recompute window positions and heights */
3311 #endif
3305 } 3312 }
3306 } 3313 }
3307 3314
3308 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) 3315 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
3309 /* 3316 /*
3357 int modified = FALSE; 3364 int modified = FALSE;
3358 char_u buf[40]; 3365 char_u buf[40];
3359 int wincount; 3366 int wincount;
3360 win_T *wp; 3367 win_T *wp;
3361 3368
3362 /* Get the buffer name into NameBuff[] */ 3369 /* Use 'guitablabel' if it's set. */
3363 get_trans_bufname(tp == curtab ? curbuf : tp->tp_curwin->w_buffer); 3370 if (*p_gtl != NUL)
3364 3371 {
3365 wp = (tp == curtab) ? firstwin : tp->tp_firstwin; 3372 int use_sandbox = FALSE;
3366 for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount) 3373 int save_called_emsg = called_emsg;
3367 if (bufIsChanged(wp->w_buffer)) 3374 char_u res[MAXPATHL];
3368 modified = TRUE; 3375
3369 if (modified || wincount > 1) 3376 called_emsg = FALSE;
3370 { 3377
3371 if (wincount > 1) 3378 printer_page_num = tabpage_index(tp);
3372 vim_snprintf((char *)buf, sizeof(buf), "%d", wincount); 3379 # ifdef FEAT_EVAL
3373 else 3380 set_vim_var_nr(VV_LNUM, printer_page_num);
3374 buf[0] = NUL; 3381 use_sandbox = was_set_insecurely((char_u *)"guitablabel", 0);
3375 if (modified) 3382 # endif
3376 STRCAT(buf, "+"); 3383 /* Can't use NameBuff directly, build_stl_str_hl() uses it. */
3377 STRCAT(buf, " "); 3384 build_stl_str_hl(tp == curtab ? curwin : tp->tp_curwin,
3378 mch_memmove(NameBuff + STRLEN(buf), NameBuff, STRLEN(NameBuff) + 1); 3385 res, MAXPATHL, p_gtl, use_sandbox,
3379 mch_memmove(NameBuff, buf, STRLEN(buf)); 3386 0, (int)Columns, NULL, NULL);
3387 STRCPY(NameBuff, res);
3388
3389 if (called_emsg)
3390 {
3391 set_string_option_direct((char_u *)"guitablabel", -1,
3392 (char_u *)"", OPT_FREE);
3393 # ifdef FEAT_EVAL
3394 set_option_scriptID((char_u *)"guitablabel", SID_ERROR);
3395 # endif
3396 }
3397 called_emsg |= save_called_emsg;
3398 }
3399 else
3400 {
3401 /* Get the buffer name into NameBuff[] */
3402 get_trans_bufname(tp == curtab ? curbuf : tp->tp_curwin->w_buffer);
3403
3404 wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
3405 for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount)
3406 if (bufIsChanged(wp->w_buffer))
3407 modified = TRUE;
3408 if (modified || wincount > 1)
3409 {
3410 if (wincount > 1)
3411 vim_snprintf((char *)buf, sizeof(buf), "%d", wincount);
3412 else
3413 buf[0] = NUL;
3414 if (modified)
3415 STRCAT(buf, "+");
3416 STRCAT(buf, " ");
3417 mch_memmove(NameBuff + STRLEN(buf), NameBuff, STRLEN(NameBuff) + 1);
3418 mch_memmove(NameBuff, buf, STRLEN(buf));
3419 }
3380 } 3420 }
3381 } 3421 }
3382 3422
3383 #endif 3423 #endif
3384 3424