comparison src/gui.c @ 11:4424b47a0797

updated for version 7.0003
author vimboss
date Wed, 30 Jun 2004 16:16:41 +0000
parents 3fc0f57ecb91
children db5102f7e29f
comparison
equal deleted inserted replaced
10:4e2284e71352 11:4424b47a0797
95 #endif 95 #endif
96 } 96 }
97 97
98 vim_free(old_term); 98 vim_free(old_term);
99 99
100 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) 100 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_KDE)
101 if (gui.in_use) 101 if (gui.in_use)
102 /* Display error messages in a dialog now. */ 102 /* Display error messages in a dialog now. */
103 display_errors(); 103 display_errors();
104 #endif 104 #endif
105 105
529 init_gui_options(); 529 init_gui_options();
530 #ifdef FEAT_ARABIC 530 #ifdef FEAT_ARABIC
531 /* Our GUI can't do bidi. */ 531 /* Our GUI can't do bidi. */
532 p_tbidi = FALSE; 532 p_tbidi = FALSE;
533 #endif 533 #endif
534 #ifdef FEAT_GUI_GTK 534 #if defined FEAT_GUI_GTK || defined FEAT_GUI_KDE
535 /* Give GTK+ a chance to put all widget's into place. */ 535 /* Give GTK+ a chance to put all widget's into place. */
536 gui_mch_update(); 536 gui_mch_update();
537 /* Now make sure the shell fits on the screen. */ 537 /* Now make sure the shell fits on the screen. */
538 gui_set_shellsize(FALSE, TRUE); 538 gui_set_shellsize(FALSE, TRUE);
539 #endif 539 #endif
573 #endif 573 #endif
574 gui.in_use = FALSE; 574 gui.in_use = FALSE;
575 gui_mch_exit(rc); 575 gui_mch_exit(rc);
576 } 576 }
577 577
578 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_MSWIN) \ 578 #if defined(FEAT_GUI_KDE) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_MSWIN) \
579 || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) || defined(PROTO) 579 || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) || defined(PROTO)
580 /* 580 /*
581 * Called when the GUI shell is closed by the user. If there are no changed 581 * Called when the GUI shell is closed by the user. If there are no changed
582 * files Vim exits, otherwise there will be a dialog to ask the user what to 582 * files Vim exits, otherwise there will be a dialog to ask the user what to
583 * do. 583 * do.
1056 1056
1057 #if defined(FEAT_MENU) || defined(PROTO) 1057 #if defined(FEAT_MENU) || defined(PROTO)
1058 void 1058 void
1059 gui_position_menu() 1059 gui_position_menu()
1060 { 1060 {
1061 # if !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF) 1061 # if !defined(FEAT_GUI_KDE) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF)
1062 if (gui.menu_is_active && gui.in_use) 1062 if (gui.menu_is_active && gui.in_use)
1063 gui_mch_set_menu_pos(0, 0, gui.menu_width, gui.menu_height); 1063 gui_mch_set_menu_pos(0, 0, gui.menu_width, gui.menu_height);
1064 # endif 1064 # endif
1065 } 1065 }
1066 #endif 1066 #endif
1162 #else 1162 #else
1163 # ifdef FEAT_MENU 1163 # ifdef FEAT_MENU
1164 if (gui.menu_is_active) 1164 if (gui.menu_is_active)
1165 base_height += gui.menu_height; 1165 base_height += gui.menu_height;
1166 # endif 1166 # endif
1167 #ifndef FEAT_GUI_KDE
1167 # ifdef FEAT_TOOLBAR 1168 # ifdef FEAT_TOOLBAR
1168 if (vim_strchr(p_go, GO_TOOLBAR) != NULL) 1169 if (vim_strchr(p_go, GO_TOOLBAR) != NULL)
1169 # if defined(FEAT_GUI_MSWIN) && defined(FEAT_TOOLBAR) 1170 # if defined(FEAT_GUI_MSWIN) && defined(FEAT_TOOLBAR)
1170 base_height += (TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT); 1171 base_height += (TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT);
1171 # else 1172 # else
1172 base_height += gui.toolbar_height; 1173 base_height += gui.toolbar_height;
1173 # endif 1174 # endif
1174 # endif 1175 # endif
1176 #endif
1175 # ifdef FEAT_FOOTER 1177 # ifdef FEAT_FOOTER
1176 if (vim_strchr(p_go, GO_FOOTER) != NULL) 1178 if (vim_strchr(p_go, GO_FOOTER) != NULL)
1177 base_height += gui.footer_height; 1179 base_height += gui.footer_height;
1178 # endif 1180 # endif
1179 # if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) 1181 # if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU)
1678 1680
1679 /* 1681 /*
1680 * We need to make sure this is cleared since Athena doesn't tell us when 1682 * We need to make sure this is cleared since Athena doesn't tell us when
1681 * he is done dragging. Do the same for GTK. 1683 * he is done dragging. Do the same for GTK.
1682 */ 1684 */
1683 #if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) 1685 #if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE)
1684 gui.dragged_sb = SBAR_NONE; 1686 gui.dragged_sb = SBAR_NONE;
1685 #endif 1687 #endif
1686 1688
1687 gui_mch_flush(); /* In case vim decides to take a nap */ 1689 gui_mch_flush(); /* In case vim decides to take a nap */
1688 } 1690 }
2069 * just after a blank. 2071 * just after a blank.
2070 */ 2072 */
2071 if (back != 0 && ((draw_flags & DRAW_BOLD) || (highlight_mask & HL_ITALIC))) 2073 if (back != 0 && ((draw_flags & DRAW_BOLD) || (highlight_mask & HL_ITALIC)))
2072 return FAIL; 2074 return FAIL;
2073 2075
2074 #if defined(RISCOS) || defined(HAVE_GTK2) 2076 #if defined(RISCOS) || defined(HAVE_GTK2) || defined(FEAT_GUI_KDE)
2075 /* If there's no italic font, then fake it. 2077 /* If there's no italic font, then fake it.
2076 * For GTK2, we don't need a different font for italic style. */ 2078 * For GTK2, we don't need a different font for italic style. */
2077 if (hl_mask_todo & HL_ITALIC) 2079 if (hl_mask_todo & HL_ITALIC)
2078 draw_flags |= DRAW_ITALIC; 2080 draw_flags |= DRAW_ITALIC;
2079 2081
2139 len = i + cl; /* len must be wrong "cannot happen" */ 2141 len = i + cl; /* len must be wrong "cannot happen" */
2140 2142
2141 /* print the string so far if it's the last character or there is 2143 /* print the string so far if it's the last character or there is
2142 * a composing character. */ 2144 * a composing character. */
2143 if (i + cl >= len || (comping && i > start) || dowide 2145 if (i + cl >= len || (comping && i > start) || dowide
2144 # if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) 2146 # if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined (FEAT_GUI_KDE)
2145 || (cn > 1 2147 || (cn > 1
2146 # ifdef FEAT_XFONTSET 2148 # ifdef FEAT_XFONTSET
2147 /* No fontset: At least draw char after wide char at 2149 /* No fontset: At least draw char after wide char at
2148 * right position. */ 2150 * right position. */
2149 && fontset == NOFONTSET 2151 && fontset == NOFONTSET
2171 s + start, cl, draw_flags); 2173 s + start, cl, draw_flags);
2172 gui_mch_set_font(font); 2174 gui_mch_set_font(font);
2173 start += cl; 2175 start += cl;
2174 } 2176 }
2175 2177
2176 # if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) 2178 # if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE)
2177 /* No fontset: draw a space to fill the gap after a wide char */ 2179 /* No fontset: draw a space to fill the gap after a wide char
2180 * */
2178 if (cn > 1 && (draw_flags & DRAW_TRANSP) == 0 2181 if (cn > 1 && (draw_flags & DRAW_TRANSP) == 0
2179 # ifdef FEAT_XFONTSET 2182 # ifdef FEAT_XFONTSET
2180 && fontset == NOFONTSET 2183 && fontset == NOFONTSET
2181 # endif 2184 # endif
2182 && !dowide) 2185 && !dowide)
4054 guicolor_T t; 4057 guicolor_T t;
4055 4058
4056 if (*name == NUL) 4059 if (*name == NUL)
4057 return INVALCOLOR; 4060 return INVALCOLOR;
4058 t = gui_mch_get_color(name); 4061 t = gui_mch_get_color(name);
4062
4059 if (t == INVALCOLOR 4063 if (t == INVALCOLOR
4060 #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) 4064 #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE)
4061 && gui.in_use 4065 && gui.in_use
4062 #endif 4066 #endif
4063 ) 4067 )
4064 EMSG2(_("E254: Cannot allocate color %s"), name); 4068 EMSG2(_("E254: Cannot allocate color %s"), name);
4065 return t; 4069 return t;
4181 wp->w_height + W_WINROW(wp)); 4185 wp->w_height + W_WINROW(wp));
4182 4186
4183 add_to_input_buf(st, 8); 4187 add_to_input_buf(st, 8);
4184 st[3] = (char_u)MOUSE_RELEASE; 4188 st[3] = (char_u)MOUSE_RELEASE;
4185 add_to_input_buf(st, 8); 4189 add_to_input_buf(st, 8);
4186
4187 #ifdef FEAT_GUI_GTK 4190 #ifdef FEAT_GUI_GTK
4188 /* Need to wake up the main loop */ 4191 /* Need to wake up the main loop */
4189 if (gtk_main_level() > 0) 4192 if (gtk_main_level() > 0)
4190 gtk_main_quit(); 4193 gtk_main_quit();
4191 #endif 4194 #endif
4299 if (!ends_excmd(*eap->arg)) 4302 if (!ends_excmd(*eap->arg))
4300 ex_next(eap); 4303 ex_next(eap);
4301 } 4304 }
4302 4305
4303 #if ((defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32) \ 4306 #if ((defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32) \
4304 || defined(FEAT_GUI_PHOTON)) && defined(FEAT_TOOLBAR)) || defined(PROTO) 4307 || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_KDE)) && defined(FEAT_TOOLBAR)) || defined(PROTO)
4305 /* 4308 /*
4306 * This is shared between Athena, Motif and GTK. 4309 * This is shared between Athena, Motif and GTK.
4307 */ 4310 */
4308 static char_u *gfp_buffer; 4311 static char_u *gfp_buffer;
4309 4312
4362 STRCPY(buffer, buf); 4365 STRCPY(buffer, buf);
4363 } 4366 }
4364 # endif 4367 # endif
4365 #endif 4368 #endif
4366 4369
4367 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(PROTO) 4370 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) || defined(FEAT_GUI_X11) || defined(PROTO)
4368 void 4371 void
4369 display_errors() 4372 display_errors()
4370 { 4373 {
4371 char_u *p; 4374 char_u *p;
4372 4375
4408 } 4411 }
4409 #endif 4412 #endif
4410 4413
4411 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \ 4414 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
4412 || defined(MSWIN_FIND_REPLACE) || defined(FEAT_SUN_WORKSHOP) \ 4415 || defined(MSWIN_FIND_REPLACE) || defined(FEAT_SUN_WORKSHOP) \
4413 || defined(PROTO) 4416 || defined(PROTO) || defined(FEAT_GUI_KDE)
4414 /* 4417 /*
4415 * Update the current window and the screen. 4418 * Update the current window and the screen.
4416 */ 4419 */
4417 void 4420 void
4418 gui_update_screen() 4421 gui_update_screen()
4426 gui_mch_flush(); 4429 gui_mch_flush();
4427 } 4430 }
4428 #endif 4431 #endif
4429 4432
4430 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \ 4433 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
4431 || defined(MSWIN_FIND_REPLACE) || defined(PROTO) 4434 || defined(MSWIN_FIND_REPLACE) || defined(PROTO) || defined(FEAT_GUI_KDE)
4432 static void concat_esc __ARGS((garray_T *gap, char_u *text, int what)); 4435 static void concat_esc __ARGS((garray_T *gap, char_u *text, int what));
4433 4436
4434 /* 4437 /*
4435 * Get the text to use in a find/replace dialog. Uses the last search pattern 4438 * Get the text to use in a find/replace dialog. Uses the last search pattern
4436 * if the argument is empty. 4439 * if the argument is empty.