⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propfont.c

📁 具有IDE功能的编辑器
💻 C
📖 第 1 页 / 共 3 页
字号:
		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		break;	    }	    if (x >= x_max)		break;	    q++;	}    } else if ((m2 < q || m1 > last) && (edit->curs1 < q || edit->curs1 > last) && \	       (edit->found_start + edit->found_len < q || edit->found_start > last) &&	       (edit->bracket < q || edit->bracket > last)) {	for (;;) {	    c = edit_get_wide_byte (edit, q);	    *p = get_style_fast (edit, q, c);	    switch (c) {	    case -1:/* no character since used up by a multi-byte sequence */		break;	    case '\n':		(p++)->c.ch = ' ';		p->c.ch = p->style = 0;		if (x > edit->max_column)		    edit->max_column = x;		return;	    case '\t':		if (FIXED_FONT) {		    int t;		    t = next_tab_pos (x);		    t = min (t, x_max);		    s = *p;		    s.c.ch = ' ';		    while (x < t) {			x += FONT_PER_CHAR(' ');			*p++ = s;		    }		} else {		    (p++)->c.ch = '\t';		    x = next_tab_pos (x);		}		break;	    default:		x += convert_to_long_printable (c, text);		r = text;		s = *p;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		break;	    }	    if (x >= x_max)		break;	    q++;	}    } else {	for (;;) {	    c = edit_get_wide_byte (edit, q);#if 0	    if (wc_isgraph(c))	        printf ("(%d)%c", q, c);	    else	        printf ("(%d)%Xh", q, c);#endif	    *p = get_style (edit, q, c, m1, m2, x);	    switch (c) {	    case -1:/* no character since used up by a multi-byte sequence */		break;	    case '\n':		(p++)->c.ch = ' ';		p->c.ch = p->style = 0;		if (x > edit->max_column)		    edit->max_column = x;		return;	    case '\t':		if (FIXED_FONT) {		    int t;		    t = next_tab_pos (x);		    t = min (t, x_max);		    s = *p;		    s.c.ch = ' ';		    while (x < t) {			x += FONT_PER_CHAR(' ');			*p++ = s;		    }		} else {		    (p++)->c.ch = '\t';		    x = next_tab_pos (x);		}		break;	    default:		x += convert_to_long_printable (c, text);		r = text;		s = *p;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		if (!*r)		    break;		s.c.ch = *r++;		*p++ = s;		break;	    }	    if (x >= x_max)		break;	    q++;	}    }    if (x > edit->max_column)	edit->max_column = x;    p->c.ch = p->style = 0;}static void edit_set_cursor (Window win, int x, int y, int bg, int fg, int width, wchar_t t, int style){#ifdef GTK    gdk_gc_set_foreground (win->gc, &win->color[18]);    gdk_draw_rectangle (win->text_area, win->gc, 0, x, y + FONT_OVERHEAD, width - 1, FONT_HEIGHT - 1);#else    CSetColor (edit_cursor_color);    if (style & MOD_REVERSE)	CLine (win, x + width - 1, y + FONT_OVERHEAD, x + width - 1, y + FONT_HEIGHT - 1);	/* non focussed cursor form */    else	CLine (win, x, y + FONT_OVERHEAD, x, y + FONT_HEIGHT - 1);	/* non focussed cursor form */    CLine (win, x, y + FONT_OVERHEAD, x + width - 1, y + FONT_OVERHEAD);    set_cursor_position (win, x, y, width, FONT_HEIGHT, CURSOR_TYPE_EDITOR, t, bg, fg, style);	/* widget library's flashing cursor */#endif}static inline int next_tab (int x, int scroll_right){    return next_tab_pos (x - scroll_right - EDIT_TEXT_HORIZONTAL_OFFSET) - x + scroll_right + EDIT_TEXT_HORIZONTAL_OFFSET;}static int draw_tab (Window win, int x, int y, cache_type s, int scroll_right){    int l;#ifdef GTK    GdkColor fg, bg;#else    unsigned long fg, bg;#endif    l = next_tab (x, scroll_right);#ifdef GTK    set_style_color (s, &fg.pixel, &bg.pixel);    gdk_gc_set_foreground (win->gc, &bg);    gdk_draw_rectangle (win->text_area, win->gc, 1, x, y + FONT_OVERHEAD, l, FONT_HEIGHT);/* if we printed a cursor: */    if (s.c.style & MOD_CURSOR)	edit_set_cursor (win, x, y, bg.pixel, fg.pixel, FONT_PER_CHAR(' '), ' ', s.c.style);#else    set_style_color (s, &fg, &bg);    CSetColor (bg);    CRectangle (win, x, y + FONT_OVERHEAD, l, FONT_HEIGHT);/* if we printed a cursor: */    if (s.c.style & MOD_CURSOR)	edit_set_cursor (win, x, y, bg, fg, FONT_PER_CHAR(' '), ' ', s.c.style);#endif    return x + l;}#ifdef GTK#include <gdk/gdk.h>#endifstatic inline void draw_space (Window win, int x, int y, cache_type s, int l){#ifdef GTK    GdkColor fg, bg;#else    unsigned long fg, bg;#endif#ifdef GTK    set_style_color (s, &fg.pixel, &bg.pixel);    gdk_gc_set_foreground (win->gc, &bg);    gdk_draw_rectangle (win->text_area, win->gc, 1, x, y + FONT_OVERHEAD, l, FONT_HEIGHT);#else    set_style_color (s, &fg, &bg);    CSetColor (bg);    CRectangle (win, x, y + FONT_OVERHEAD, l, FONT_HEIGHT);/* if we printed a cursor: */    if (s.c.style & MOD_CURSOR)	edit_set_cursor (win, x, y, bg, fg, FONT_PER_CHAR(' '), ' ', s.c.style);#endif}#ifdef GTKvoidgdk_draw_image_text (GdkDrawable *drawable,	       GdkFont     *font,	       GdkGC       *gc,	       gint         x,	       gint         y,	       const gchar *text,	       gint         text_length){  GdkWindowPrivate *drawable_private;  GdkFontPrivate *font_private;  GdkGCPrivate *gc_private;  g_return_if_fail (drawable != NULL);  g_return_if_fail (font != NULL);  g_return_if_fail (gc != NULL);  g_return_if_fail (text != NULL);  drawable_private = (GdkWindowPrivate*) drawable;  if (drawable_private->destroyed)    return;  gc_private = (GdkGCPrivate*) gc;  font_private = (GdkFontPrivate*) font;  if (font->type == GDK_FONT_FONT)    {      XFontStruct *xfont = (XFontStruct *) font_private->xfont;      XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid);      if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))	{	  XDrawImageString (drawable_private->xdisplay, drawable_private->xwindow,		       gc_private->xgc, x, y, text, text_length);	}      else	{	  XDrawImageString16 (drawable_private->xdisplay, drawable_private->xwindow,			 gc_private->xgc, x, y, (XChar2b *) text, text_length / 2);	}    }  else if (font->type == GDK_FONT_FONTSET)    {      XFontSet fontset = (XFontSet) font_private->xfont;      XmbDrawImageString (drawable_private->xdisplay, drawable_private->xwindow,		     fontset, gc_private->xgc, x, y, text, text_length);    }  else    g_error("undefined font type\n");}#endifstatic int draw_string (Window win, int x, int y, cache_type s, XChar2b *text, wchar_t *textwc, int length){#ifdef GTK    GdkColor fg, bg;#else    unsigned long fg, bg;    int underlined, l;#endif#ifdef GTK    set_style_color (s, &fg.pixel, &bg.pixel);    gdk_gc_set_background (win->gc, &bg);    gdk_gc_set_foreground (win->gc, &fg);    gdk_draw_image_text (win->text_area, GTK_WIDGET (win)->style->font, win->gc, x + FONT_OFFSET_X, y + FONT_OFFSET_Y, text, length);#else    underlined = set_style_color (s, &fg, &bg);    CSetBackgroundColor (bg);    CSetColor (fg);    CImageTextWC (win, x + FONT_OFFSET_X, y + FONT_OFFSET_Y, text, textwc, length);    l = CImageTextWidthWC (text, textwc, length);    if (underlined) {	int i, h, inc;	inc = FONT_MEAN_WIDTH * 2 / 3;	CSetColor (color_palette (18));	h = (x / inc) & 1;	CLine (win, x, y + FONT_HEIGHT + FONT_OVERHEAD - 1 - h, x + min (l, inc - (x % inc) - 1), y + FONT_HEIGHT + FONT_OVERHEAD - 1 - h);	h = h ^ 1;	for (i = inc - min (l, (x % inc)); i < l; i += inc) {	    CLine (win, x + i, y + FONT_HEIGHT + FONT_OVERHEAD - 1 - h, x + min (l, i + inc - 1), y + FONT_HEIGHT + FONT_OVERHEAD - 1 - h);	    h = h ^ 1;	}    }#endif/* if we printed a cursor: */#ifdef GTK    if (s.c.style & MOD_CURSOR)	edit_set_cursor (win, x, y, bg.pixel, fg.pixel, FONT_PER_CHAR(*textwc), *textwc, s.c.style);    return x + gdk_text_width (GTK_WIDGET (win)->style->font, text, length);#else    if (s.c.style & MOD_CURSOR)	edit_set_cursor (win, x, y, bg, fg, FONT_PER_CHAR(*textwc), *textwc, s.c.style);    return x + l;#endif}#define STYLE_DIFF (cache->style != line->style || cache->c.ch != line->c.ch \	    || ((cache->c.style | line->c.style) & MOD_CURSOR) \	    || !(cache->c.ch | cache->style) || !(line->c.ch | line->style))int get_ignore_length (cache_type *cache, cache_type *line){    int i;    for (i = 0; i < cache_width; i++, line++, cache++) {	if (STYLE_DIFF)	    return i;    }    return cache_width;}static inline size_t lwstrnlen (const cache_type * s, size_t count){    const cache_type *sc;    for (sc = s; count-- && (sc->c.ch | sc->style) != 0; ++sc);    return sc - s;}static inline size_t lwstrlen (const cache_type * s){    const cache_type *sc;    for (sc = s; (sc->c.ch | sc->style) != 0; ++sc);    return sc - s;}int get_ignore_trailer (cache_type *cache, cache_type *line, int length){    int i;    int cache_len, line_len;    cache_len = lwstrnlen (cache, cache_width);    line_len = lwstrlen (line);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -