comparison src/gui.c @ 574:25a70b1cd2da

updated for version 7.0163
author vimboss
date Tue, 06 Dec 2005 19:59:18 +0000
parents 2df7f3a5eb96
children ba54311bc43e
comparison
equal deleted inserted replaced
573:c85bf6a4999b 574:25a70b1cd2da
97 #endif 97 #endif
98 } 98 }
99 99
100 vim_free(old_term); 100 vim_free(old_term);
101 101
102 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_KDE) 102 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
103 if (gui.in_use) 103 if (gui.in_use)
104 /* Display error messages in a dialog now. */ 104 /* Display error messages in a dialog now. */
105 display_errors(); 105 display_errors();
106 #endif 106 #endif
107 107
538 init_gui_options(); 538 init_gui_options();
539 #ifdef FEAT_ARABIC 539 #ifdef FEAT_ARABIC
540 /* Our GUI can't do bidi. */ 540 /* Our GUI can't do bidi. */
541 p_tbidi = FALSE; 541 p_tbidi = FALSE;
542 #endif 542 #endif
543 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) 543 #if defined(FEAT_GUI_GTK)
544 /* Give GTK+ a chance to put all widget's into place. */ 544 /* Give GTK+ a chance to put all widget's into place. */
545 gui_mch_update(); 545 gui_mch_update();
546 /* Now make sure the shell fits on the screen. */ 546 /* Now make sure the shell fits on the screen. */
547 gui_set_shellsize(FALSE, TRUE); 547 gui_set_shellsize(FALSE, TRUE);
548 #endif 548 #endif
614 #endif 614 #endif
615 gui.in_use = FALSE; 615 gui.in_use = FALSE;
616 gui_mch_exit(rc); 616 gui_mch_exit(rc);
617 } 617 }
618 618
619 #if defined(FEAT_GUI_KDE) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_MSWIN) \ 619 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_MSWIN) \
620 || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) || defined(PROTO) 620 || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) || defined(PROTO)
621 /* 621 /*
622 * Called when the GUI shell is closed by the user. If there are no changed 622 * Called when the GUI shell is closed by the user. If there are no changed
623 * files Vim exits, otherwise there will be a dialog to ask the user what to 623 * files Vim exits, otherwise there will be a dialog to ask the user what to
624 * do. 624 * do.
1098 1098
1099 #if defined(FEAT_MENU) || defined(PROTO) 1099 #if defined(FEAT_MENU) || defined(PROTO)
1100 void 1100 void
1101 gui_position_menu() 1101 gui_position_menu()
1102 { 1102 {
1103 # if !defined(FEAT_GUI_KDE) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF) 1103 # if !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF)
1104 if (gui.menu_is_active && gui.in_use) 1104 if (gui.menu_is_active && gui.in_use)
1105 gui_mch_set_menu_pos(0, 0, gui.menu_width, gui.menu_height); 1105 gui_mch_set_menu_pos(0, 0, gui.menu_width, gui.menu_height);
1106 # endif 1106 # endif
1107 } 1107 }
1108 #endif 1108 #endif
1210 #else 1210 #else
1211 # ifdef FEAT_MENU 1211 # ifdef FEAT_MENU
1212 if (gui.menu_is_active) 1212 if (gui.menu_is_active)
1213 base_height += gui.menu_height; 1213 base_height += gui.menu_height;
1214 # endif 1214 # endif
1215 #ifndef FEAT_GUI_KDE
1216 # ifdef FEAT_TOOLBAR 1215 # ifdef FEAT_TOOLBAR
1217 if (vim_strchr(p_go, GO_TOOLBAR) != NULL) 1216 if (vim_strchr(p_go, GO_TOOLBAR) != NULL)
1218 # if defined(FEAT_GUI_MSWIN) && defined(FEAT_TOOLBAR) 1217 # if defined(FEAT_GUI_MSWIN) && defined(FEAT_TOOLBAR)
1219 base_height += (TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT); 1218 base_height += (TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT);
1220 # else 1219 # else
1221 base_height += gui.toolbar_height; 1220 base_height += gui.toolbar_height;
1222 # endif 1221 # endif
1223 # endif 1222 # endif
1224 #endif
1225 # ifdef FEAT_FOOTER 1223 # ifdef FEAT_FOOTER
1226 if (vim_strchr(p_go, GO_FOOTER) != NULL) 1224 if (vim_strchr(p_go, GO_FOOTER) != NULL)
1227 base_height += gui.footer_height; 1225 base_height += gui.footer_height;
1228 # endif 1226 # endif
1229 # if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) 1227 # if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU)
1722 1720
1723 /* 1721 /*
1724 * We need to make sure this is cleared since Athena doesn't tell us when 1722 * We need to make sure this is cleared since Athena doesn't tell us when
1725 * he is done dragging. Do the same for GTK. 1723 * he is done dragging. Do the same for GTK.
1726 */ 1724 */
1727 #if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) 1725 #if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK)
1728 gui.dragged_sb = SBAR_NONE; 1726 gui.dragged_sb = SBAR_NONE;
1729 #endif 1727 #endif
1730 1728
1731 gui_mch_flush(); /* In case vim decides to take a nap */ 1729 gui_mch_flush(); /* In case vim decides to take a nap */
1732 } 1730 }
1954 long_u highlight_mask; 1952 long_u highlight_mask;
1955 long_u hl_mask_todo; 1953 long_u hl_mask_todo;
1956 guicolor_T fg_color; 1954 guicolor_T fg_color;
1957 guicolor_T bg_color; 1955 guicolor_T bg_color;
1958 guicolor_T sp_color; 1956 guicolor_T sp_color;
1959 #if !defined(MSWIN16_FASTTEXT) && !defined(HAVE_GTK2) && !defined(FEAT_GUI_KDE) 1957 #if !defined(MSWIN16_FASTTEXT) && !defined(HAVE_GTK2)
1960 GuiFont font = NOFONT; 1958 GuiFont font = NOFONT;
1961 # ifdef FEAT_XFONTSET 1959 # ifdef FEAT_XFONTSET
1962 GuiFontset fontset = NOFONTSET; 1960 GuiFontset fontset = NOFONTSET;
1963 # endif 1961 # endif
1964 #endif 1962 #endif
2008 } 2006 }
2009 else 2007 else
2010 highlight_mask = gui.highlight_mask; 2008 highlight_mask = gui.highlight_mask;
2011 hl_mask_todo = highlight_mask; 2009 hl_mask_todo = highlight_mask;
2012 2010
2013 #if !defined(MSWIN16_FASTTEXT) && !defined(HAVE_GTK2) && !defined(FEAT_GUI_KDE) 2011 #if !defined(MSWIN16_FASTTEXT) && !defined(HAVE_GTK2)
2014 /* Set the font */ 2012 /* Set the font */
2015 if (aep != NULL && aep->ae_u.gui.font != NOFONT) 2013 if (aep != NULL && aep->ae_u.gui.font != NOFONT)
2016 font = aep->ae_u.gui.font; 2014 font = aep->ae_u.gui.font;
2017 # ifdef FEAT_XFONTSET 2015 # ifdef FEAT_XFONTSET
2018 else if (aep != NULL && aep->ae_u.gui.fontset != NOFONTSET) 2016 else if (aep != NULL && aep->ae_u.gui.fontset != NOFONTSET)
2122 * just after a blank. 2120 * just after a blank.
2123 */ 2121 */
2124 if (back != 0 && ((draw_flags & DRAW_BOLD) || (highlight_mask & HL_ITALIC))) 2122 if (back != 0 && ((draw_flags & DRAW_BOLD) || (highlight_mask & HL_ITALIC)))
2125 return FAIL; 2123 return FAIL;
2126 2124
2127 #if defined(RISCOS) || defined(HAVE_GTK2) || defined(FEAT_GUI_KDE) 2125 #if defined(RISCOS) || defined(HAVE_GTK2)
2128 /* If there's no italic font, then fake it. 2126 /* If there's no italic font, then fake it.
2129 * For GTK2, we don't need a different font for italic style. */ 2127 * For GTK2, we don't need a different font for italic style. */
2130 if (hl_mask_todo & HL_ITALIC) 2128 if (hl_mask_todo & HL_ITALIC)
2131 draw_flags |= DRAW_ITALIC; 2129 draw_flags |= DRAW_ITALIC;
2132 2130
2195 len = i + cl; /* len must be wrong "cannot happen" */ 2193 len = i + cl; /* len must be wrong "cannot happen" */
2196 2194
2197 /* print the string so far if it's the last character or there is 2195 /* print the string so far if it's the last character or there is
2198 * a composing character. */ 2196 * a composing character. */
2199 if (i + cl >= len || (comping && i > start) || dowide 2197 if (i + cl >= len || (comping && i > start) || dowide
2200 # if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) 2198 # if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
2201 || (cn > 1 2199 || (cn > 1
2202 # ifdef FEAT_XFONTSET 2200 # ifdef FEAT_XFONTSET
2203 /* No fontset: At least draw char after wide char at 2201 /* No fontset: At least draw char after wide char at
2204 * right position. */ 2202 * right position. */
2205 && fontset == NOFONTSET 2203 && fontset == NOFONTSET
2220 } 2218 }
2221 scol += cells; 2219 scol += cells;
2222 cells = 0; 2220 cells = 0;
2223 if (dowide) 2221 if (dowide)
2224 { 2222 {
2225 #ifndef FEAT_GUI_KDE
2226 gui_mch_set_font(gui.wide_font); 2223 gui_mch_set_font(gui.wide_font);
2227 #endif
2228 gui_mch_draw_string(gui.row, scol - cn, 2224 gui_mch_draw_string(gui.row, scol - cn,
2229 s + start, cl, draw_flags); 2225 s + start, cl, draw_flags);
2230 #ifndef FEAT_GUI_KDE
2231 gui_mch_set_font(font); 2226 gui_mch_set_font(font);
2232 #endif
2233 start += cl; 2227 start += cl;
2234 } 2228 }
2235 2229
2236 # if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) 2230 # if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
2237 /* No fontset: draw a space to fill the gap after a wide char 2231 /* No fontset: draw a space to fill the gap after a wide char
2238 * */ 2232 * */
2239 if (cn > 1 && (draw_flags & DRAW_TRANSP) == 0 2233 if (cn > 1 && (draw_flags & DRAW_TRANSP) == 0
2240 # ifdef FEAT_XFONTSET 2234 # ifdef FEAT_XFONTSET
2241 && fontset == NOFONTSET 2235 && fontset == NOFONTSET
4114 if (*name == NUL) 4108 if (*name == NUL)
4115 return INVALCOLOR; 4109 return INVALCOLOR;
4116 t = gui_mch_get_color(name); 4110 t = gui_mch_get_color(name);
4117 4111
4118 if (t == INVALCOLOR 4112 if (t == INVALCOLOR
4119 #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) 4113 #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
4120 && gui.in_use 4114 && gui.in_use
4121 #endif 4115 #endif
4122 ) 4116 )
4123 EMSG2(_("E254: Cannot allocate color %s"), name); 4117 EMSG2(_("E254: Cannot allocate color %s"), name);
4124 return t; 4118 return t;
4357 if (!ends_excmd(*eap->arg)) 4351 if (!ends_excmd(*eap->arg))
4358 ex_next(eap); 4352 ex_next(eap);
4359 } 4353 }
4360 4354
4361 #if ((defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32) \ 4355 #if ((defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32) \
4362 || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_KDE)) && defined(FEAT_TOOLBAR)) || defined(PROTO) 4356 || defined(FEAT_GUI_PHOTON)) && defined(FEAT_TOOLBAR)) || defined(PROTO)
4363 /* 4357 /*
4364 * This is shared between Athena, Motif and GTK. 4358 * This is shared between Athena, Motif and GTK.
4365 */ 4359 */
4366 static void gfp_setname __ARGS((char_u *fname, void *cookie)); 4360 static void gfp_setname __ARGS((char_u *fname, void *cookie));
4367 4361
4421 STRCPY(buffer, buf); 4415 STRCPY(buffer, buf);
4422 } 4416 }
4423 # endif 4417 # endif
4424 #endif 4418 #endif
4425 4419
4426 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) || defined(FEAT_GUI_X11) || defined(PROTO) 4420 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(PROTO)
4427 void 4421 void
4428 display_errors() 4422 display_errors()
4429 { 4423 {
4430 char_u *p; 4424 char_u *p;
4431 4425