Mercurial > vim
comparison src/gui_gtk_x11.c @ 207:4968de555941
updated for version 7.0060
author | vimboss |
---|---|
date | Tue, 15 Mar 2005 22:48:14 +0000 |
parents | 7fd70926e2e1 |
children | 1c1cbdc42f75 |
comparison
equal
deleted
inserted
replaced
206:87857ffdbf46 | 207:4968de555941 |
---|---|
2964 gui.scrollbar_height = SB_DEFAULT_WIDTH; | 2964 gui.scrollbar_height = SB_DEFAULT_WIDTH; |
2965 /* LINTED: avoid warning: conversion to 'unsigned long' */ | 2965 /* LINTED: avoid warning: conversion to 'unsigned long' */ |
2966 gui.fgcolor = g_new0(GdkColor, 1); | 2966 gui.fgcolor = g_new0(GdkColor, 1); |
2967 /* LINTED: avoid warning: conversion to 'unsigned long' */ | 2967 /* LINTED: avoid warning: conversion to 'unsigned long' */ |
2968 gui.bgcolor = g_new0(GdkColor, 1); | 2968 gui.bgcolor = g_new0(GdkColor, 1); |
2969 /* LINTED: avoid warning: conversion to 'unsigned long' */ | |
2970 gui.spcolor = g_new0(GdkColor, 1); | |
2969 | 2971 |
2970 /* Initialise atoms */ | 2972 /* Initialise atoms */ |
2971 #ifdef FEAT_MBYTE | 2973 #ifdef FEAT_MBYTE |
2972 utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE); | 2974 utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE); |
2973 #endif | 2975 #endif |
4982 gui_mch_set_bg_color(guicolor_T color) | 4984 gui_mch_set_bg_color(guicolor_T color) |
4983 { | 4985 { |
4984 gui.bgcolor->pixel = (unsigned long)color; | 4986 gui.bgcolor->pixel = (unsigned long)color; |
4985 } | 4987 } |
4986 | 4988 |
4989 /* | |
4990 * Set the current text special color. | |
4991 */ | |
4992 void | |
4993 gui_mch_set_sp_color(guicolor_T color) | |
4994 { | |
4995 gui.spcolor->pixel = (unsigned long)color; | |
4996 } | |
4997 | |
4987 #ifdef HAVE_GTK2 | 4998 #ifdef HAVE_GTK2 |
4988 /* | 4999 /* |
4989 * Function-like convenience macro for the sake of efficiency. | 5000 * Function-like convenience macro for the sake of efficiency. |
4990 */ | 5001 */ |
4991 #define INSERT_PANGO_ATTR(Attribute, AttrList, Start, End) \ | 5002 #define INSERT_PANGO_ATTR(Attribute, AttrList, Start, End) \ |
5160 TEXT_Y(row), | 5171 TEXT_Y(row), |
5161 glyphs); | 5172 glyphs); |
5162 } | 5173 } |
5163 | 5174 |
5164 #endif /* HAVE_GTK2 */ | 5175 #endif /* HAVE_GTK2 */ |
5176 | |
5177 /* | |
5178 * Draw underline and undercurl at the bottom of the character cell. | |
5179 */ | |
5180 static void | |
5181 draw_under(int flags, int row, int col, int cells) | |
5182 { | |
5183 int i; | |
5184 int offset; | |
5185 const static int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 }; | |
5186 int y = FILL_Y(row + 1) - 1; | |
5187 | |
5188 /* Undercurl: draw curl at the bottom of the character cell. */ | |
5189 if (flags & DRAW_UNDERC) | |
5190 { | |
5191 gdk_gc_set_foreground(gui.text_gc, gui.spcolor); | |
5192 for (i = FILL_X(col); i < FILL_X(col + cells); ++i) | |
5193 { | |
5194 offset = val[i % 8]; | |
5195 gdk_draw_point(gui.drawarea->window, gui.text_gc, i, y - offset); | |
5196 } | |
5197 gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); | |
5198 } | |
5199 | |
5200 /* Underline: draw a line at the bottom of the character cell. */ | |
5201 if (flags & DRAW_UNDERL) | |
5202 { | |
5203 /* When p_linespace is 0, overwrite the bottom row of pixels. | |
5204 * Otherwise put the line just below the character. */ | |
5205 if (p_linespace > 1) | |
5206 y -= p_linespace - 1; | |
5207 gdk_draw_line(gui.drawarea->window, gui.text_gc, | |
5208 FILL_X(col), y, | |
5209 FILL_X(col + cells) - 1, y); | |
5210 } | |
5211 } | |
5165 | 5212 |
5166 #if defined(HAVE_GTK2) || defined(PROTO) | 5213 #if defined(HAVE_GTK2) || defined(PROTO) |
5167 int | 5214 int |
5168 gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) | 5215 gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) |
5169 { | 5216 { |
5411 | 5458 |
5412 pango_attr_list_unref(attr_list); | 5459 pango_attr_list_unref(attr_list); |
5413 } | 5460 } |
5414 | 5461 |
5415 skipitall: | 5462 skipitall: |
5416 if (flags & DRAW_UNDERL) | 5463 /* Draw underline and undercurl. */ |
5417 gdk_draw_line(gui.drawarea->window, | 5464 draw_under(flags, row, col, column_offset); |
5418 gui.text_gc, | |
5419 FILL_X(col), | |
5420 FILL_Y(row + 1) - 1, | |
5421 FILL_X(col + column_offset) - 1, | |
5422 FILL_Y(row + 1) - 1); | |
5423 | 5465 |
5424 pango_glyph_string_free(glyphs); | 5466 pango_glyph_string_free(glyphs); |
5425 vim_free(conv_buf); | 5467 vim_free(conv_buf); |
5426 | 5468 |
5427 gdk_gc_set_clip_rectangle(gui.text_gc, NULL); | 5469 gdk_gc_set_clip_rectangle(gui.text_gc, NULL); |
5542 gui.current_font, | 5584 gui.current_font, |
5543 gui.text_gc, | 5585 gui.text_gc, |
5544 TEXT_X(col) + 1, TEXT_Y(row), | 5586 TEXT_X(col) + 1, TEXT_Y(row), |
5545 (const gchar *)text, textlen); | 5587 (const gchar *)text, textlen); |
5546 | 5588 |
5547 if (flags & DRAW_UNDERL) | 5589 /* Draw underline and undercurl. */ |
5548 { | 5590 draw_under(flags, row, col, width); |
5549 gdk_draw_line(gui.drawarea->window, | |
5550 gui.text_gc, FILL_X(col), | |
5551 FILL_Y(row + 1) - 1, FILL_X(col + width) - 1, FILL_Y(row + 1) - 1); | |
5552 } | |
5553 } | 5591 } |
5554 #endif /* !HAVE_GTK2 */ | 5592 #endif /* !HAVE_GTK2 */ |
5555 | 5593 |
5556 /* | 5594 /* |
5557 * Return OK if the key with the termcap name "name" is supported. | 5595 * Return OK if the key with the termcap name "name" is supported. |