comparison src/gui.c @ 839:1f3b1021f002 v7.0e05

updated for version 7.0e05
author vimboss
date Fri, 21 Apr 2006 22:12:41 +0000
parents 8e5830943bff
children 9f279ebda751
comparison
equal deleted inserted replaced
838:8e5830943bff 839:1f3b1021f002
3405 gui_set_shellsize(FALSE, showit, RESIZE_VERT); 3405 gui_set_shellsize(FALSE, showit, RESIZE_VERT);
3406 } 3406 }
3407 } 3407 }
3408 3408
3409 /* 3409 /*
3410 * Get the label for tab page "tp" into NameBuff[]. 3410 * Get the label or tooltip for tab page "tp" into NameBuff[].
3411 */ 3411 */
3412 void 3412 void
3413 get_tabline_label(tp) 3413 get_tabline_label(tp, tooltip)
3414 tabpage_T *tp; 3414 tabpage_T *tp;
3415 int tooltip; /* TRUE: get tooltip */
3415 { 3416 {
3416 int modified = FALSE; 3417 int modified = FALSE;
3417 char_u buf[40]; 3418 char_u buf[40];
3418 int wincount; 3419 int wincount;
3419 win_T *wp; 3420 win_T *wp;
3420 3421 char_u *opt;
3421 /* Use 'guitablabel' if it's set. */ 3422
3422 if (*p_gtl != NUL) 3423 /* Use 'guitablabel' or 'guitabtooltip' if it's set. */
3424 opt = (tooltip ? p_gtt : p_gtl);
3425 if (*opt != NUL)
3423 { 3426 {
3424 int use_sandbox = FALSE; 3427 int use_sandbox = FALSE;
3425 int save_called_emsg = called_emsg; 3428 int save_called_emsg = called_emsg;
3426 char_u res[MAXPATHL]; 3429 char_u res[MAXPATHL];
3427 tabpage_T *save_curtab; 3430 tabpage_T *save_curtab;
3431 char_u *opt_name = (char_u *)(tooltip ? "guitabtooltip"
3432 : "guitablabel");
3428 3433
3429 called_emsg = FALSE; 3434 called_emsg = FALSE;
3430 3435
3431 printer_page_num = tabpage_index(tp); 3436 printer_page_num = tabpage_index(tp);
3432 # ifdef FEAT_EVAL 3437 # ifdef FEAT_EVAL
3433 set_vim_var_nr(VV_LNUM, printer_page_num); 3438 set_vim_var_nr(VV_LNUM, printer_page_num);
3434 use_sandbox = was_set_insecurely((char_u *)"guitablabel", 0); 3439 use_sandbox = was_set_insecurely(opt_name, 0);
3435 # endif 3440 # endif
3436 /* It's almost as going to the tabpage, but without autocommands. */ 3441 /* It's almost as going to the tabpage, but without autocommands. */
3437 curtab->tp_firstwin = firstwin; 3442 curtab->tp_firstwin = firstwin;
3438 curtab->tp_lastwin = lastwin; 3443 curtab->tp_lastwin = lastwin;
3439 curtab->tp_curwin = curwin; 3444 curtab->tp_curwin = curwin;
3444 lastwin = curtab->tp_lastwin; 3449 lastwin = curtab->tp_lastwin;
3445 curwin = curtab->tp_curwin; 3450 curwin = curtab->tp_curwin;
3446 curbuf = curwin->w_buffer; 3451 curbuf = curwin->w_buffer;
3447 3452
3448 /* Can't use NameBuff directly, build_stl_str_hl() uses it. */ 3453 /* Can't use NameBuff directly, build_stl_str_hl() uses it. */
3449 build_stl_str_hl(curwin, res, MAXPATHL, p_gtl, use_sandbox, 3454 build_stl_str_hl(curwin, res, MAXPATHL, opt, use_sandbox,
3450 0, (int)Columns, NULL, NULL); 3455 0, (int)Columns, NULL, NULL);
3451 STRCPY(NameBuff, res); 3456 STRCPY(NameBuff, res);
3452 3457
3453 /* Back to the original curtab. */ 3458 /* Back to the original curtab. */
3454 curtab = save_curtab; 3459 curtab = save_curtab;
3457 lastwin = curtab->tp_lastwin; 3462 lastwin = curtab->tp_lastwin;
3458 curwin = curtab->tp_curwin; 3463 curwin = curtab->tp_curwin;
3459 curbuf = curwin->w_buffer; 3464 curbuf = curwin->w_buffer;
3460 3465
3461 if (called_emsg) 3466 if (called_emsg)
3462 set_string_option_direct((char_u *)"guitablabel", -1, 3467 set_string_option_direct(opt_name, -1,
3463 (char_u *)"", OPT_FREE, SID_ERROR); 3468 (char_u *)"", OPT_FREE, SID_ERROR);
3464 called_emsg |= save_called_emsg; 3469 called_emsg |= save_called_emsg;
3465 } 3470 }
3466 else 3471 else
3467 { 3472 {
3468 /* Get the buffer name into NameBuff[] and shorten it. */ 3473 /* Get the buffer name into NameBuff[] and shorten it. */
3469 get_trans_bufname(tp == curtab ? curbuf : tp->tp_curwin->w_buffer); 3474 get_trans_bufname(tp == curtab ? curbuf : tp->tp_curwin->w_buffer);
3470 shorten_dir(NameBuff); 3475 if (!tooltip)
3476 shorten_dir(NameBuff);
3471 3477
3472 wp = (tp == curtab) ? firstwin : tp->tp_firstwin; 3478 wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
3473 for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount) 3479 for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount)
3474 if (bufIsChanged(wp->w_buffer)) 3480 if (bufIsChanged(wp->w_buffer))
3475 modified = TRUE; 3481 modified = TRUE;