diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-03-15 22:48:14 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-03-15 22:48:14 +0000 |
commit | f36d3693dd743d46449d3fbfd88969589a62bb38 (patch) | |
tree | 1fc29cbafb5a3f53cde9bda30f07fedc606a46ba /src | |
parent | fb26980c317c19f68e16e587fde88880e4e1e4ad (diff) | |
download | vim-f36d3693dd743d46449d3fbfd88969589a62bb38.zip |
updated for version 7.0060
Diffstat (limited to 'src')
-rw-r--r-- | src/gui_gtk_x11.c | 64 | ||||
-rw-r--r-- | src/proto/gui_beval.pro | 18 |
2 files changed, 60 insertions, 22 deletions
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index debc11bc4..819e3b491 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -2966,6 +2966,8 @@ gui_mch_init(void) gui.fgcolor = g_new0(GdkColor, 1); /* LINTED: avoid warning: conversion to 'unsigned long' */ gui.bgcolor = g_new0(GdkColor, 1); + /* LINTED: avoid warning: conversion to 'unsigned long' */ + gui.spcolor = g_new0(GdkColor, 1); /* Initialise atoms */ #ifdef FEAT_MBYTE @@ -4984,6 +4986,15 @@ gui_mch_set_bg_color(guicolor_T color) gui.bgcolor->pixel = (unsigned long)color; } +/* + * Set the current text special color. + */ + void +gui_mch_set_sp_color(guicolor_T color) +{ + gui.spcolor->pixel = (unsigned long)color; +} + #ifdef HAVE_GTK2 /* * Function-like convenience macro for the sake of efficiency. @@ -5163,6 +5174,42 @@ draw_glyph_string(int row, int col, int num_cells, int flags, #endif /* HAVE_GTK2 */ +/* + * Draw underline and undercurl at the bottom of the character cell. + */ + static void +draw_under(int flags, int row, int col, int cells) +{ + int i; + int offset; + const static int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 }; + int y = FILL_Y(row + 1) - 1; + + /* Undercurl: draw curl at the bottom of the character cell. */ + if (flags & DRAW_UNDERC) + { + gdk_gc_set_foreground(gui.text_gc, gui.spcolor); + for (i = FILL_X(col); i < FILL_X(col + cells); ++i) + { + offset = val[i % 8]; + gdk_draw_point(gui.drawarea->window, gui.text_gc, i, y - offset); + } + gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); + } + + /* Underline: draw a line at the bottom of the character cell. */ + if (flags & DRAW_UNDERL) + { + /* When p_linespace is 0, overwrite the bottom row of pixels. + * Otherwise put the line just below the character. */ + if (p_linespace > 1) + y -= p_linespace - 1; + gdk_draw_line(gui.drawarea->window, gui.text_gc, + FILL_X(col), y, + FILL_X(col + cells) - 1, y); + } +} + #if defined(HAVE_GTK2) || defined(PROTO) int gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) @@ -5413,13 +5460,8 @@ not_ascii: } skipitall: - if (flags & DRAW_UNDERL) - gdk_draw_line(gui.drawarea->window, - gui.text_gc, - FILL_X(col), - FILL_Y(row + 1) - 1, - FILL_X(col + column_offset) - 1, - FILL_Y(row + 1) - 1); + /* Draw underline and undercurl. */ + draw_under(flags, row, col, column_offset); pango_glyph_string_free(glyphs); vim_free(conv_buf); @@ -5544,12 +5586,8 @@ gui_mch_draw_string(int row, int col, char_u *s, int len, int flags) TEXT_X(col) + 1, TEXT_Y(row), (const gchar *)text, textlen); - if (flags & DRAW_UNDERL) - { - gdk_draw_line(gui.drawarea->window, - gui.text_gc, FILL_X(col), - FILL_Y(row + 1) - 1, FILL_X(col + width) - 1, FILL_Y(row + 1) - 1); - } + /* Draw underline and undercurl. */ + draw_under(flags, row, col, width); } #endif /* !HAVE_GTK2 */ diff --git a/src/proto/gui_beval.pro b/src/proto/gui_beval.pro index 42e0082f9..33c1738d3 100644 --- a/src/proto/gui_beval.pro +++ b/src/proto/gui_beval.pro @@ -1,11 +1,11 @@ /* gui_beval.c */ -extern void general_beval_cb __ARGS((BalloonEval *beval, int state)); -extern BalloonEval *gui_mch_create_beval_area __ARGS((void *target, char_u *mesg, void (*mesgCB)(BalloonEval *, int), void *clientData)); -extern void gui_mch_destroy_beval_area __ARGS((BalloonEval *beval)); -extern void gui_mch_enable_beval_area __ARGS((BalloonEval *beval)); -extern void gui_mch_disable_beval_area __ARGS((BalloonEval *beval)); -extern BalloonEval *gui_mch_currently_showing_beval __ARGS((void)); -extern int get_beval_info __ARGS((BalloonEval *beval, int getword, win_T **winp, linenr_T *lnump, char_u **textp, int *colp)); -extern void gui_mch_post_balloon __ARGS((BalloonEval *beval, char_u *mesg)); -extern void gui_mch_unpost_balloon __ARGS((BalloonEval *beval)); +void general_beval_cb __ARGS((BalloonEval *beval, int state)); +BalloonEval *gui_mch_create_beval_area __ARGS((void *target, char_u *mesg, void (*mesgCB)(BalloonEval *, int), void *clientData)); +void gui_mch_destroy_beval_area __ARGS((BalloonEval *beval)); +void gui_mch_enable_beval_area __ARGS((BalloonEval *beval)); +void gui_mch_disable_beval_area __ARGS((BalloonEval *beval)); +BalloonEval *gui_mch_currently_showing_beval __ARGS((void)); +int get_beval_info __ARGS((BalloonEval *beval, int getword, win_T **winp, linenr_T *lnump, char_u **textp, int *colp)); +void gui_mch_post_balloon __ARGS((BalloonEval *beval, char_u *mesg)); +void gui_mch_unpost_balloon __ARGS((BalloonEval *beval)); /* vim: set ft=c : */ |