diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glibext/gbufferline.c | 157 |
1 files changed, 11 insertions, 146 deletions
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c index 907b5bd..e3a33bf 100644 --- a/src/glibext/gbufferline.c +++ b/src/glibext/gbufferline.c @@ -29,6 +29,7 @@ #include "../common/extstr.h" +#include "../gtkext/support.h" #include <malloc.h> /* FIXME : à virer */ @@ -86,8 +87,6 @@ struct _GBufferLine BufferLineColumn merge_start; /* Début de la zone globale */ BufferLineColumn last_used; /* Dernière colonne utilisée */ - cairo_surface_t *bookmark_img; /* Image pour les signets */ - }; /* Représentation de fragments de texte en ligne (classe) */ @@ -95,7 +94,7 @@ struct _GBufferLineClass { GObjectClass parent; /* A laisser en premier */ - PangoAttrList *attribs[RTT_COUNT]; /* Décorateurs pour tampons */ + cairo_surface_t *bookmark_img; /* Image pour les signets */ }; @@ -316,144 +315,14 @@ G_DEFINE_TYPE(GBufferLine, g_buffer_line, G_TYPE_OBJECT); static void g_buffer_line_class_init(GBufferLineClass *class) { - PangoAttribute *attrib; /* Propriété de rendu */ - - /* RTT_RAW */ - - class->attribs[RTT_RAW] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(0, 0, 0); - pango_attr_list_insert(class->attribs[RTT_RAW], attrib); - - /* RTT_COMMENT */ - - class->attribs[RTT_COMMENT] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(14335, 45311, 23551); - pango_attr_list_insert(class->attribs[RTT_COMMENT], attrib); - - /* RTT_INDICATION */ - - class->attribs[RTT_INDICATION] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(33410, 33410, 33410); - pango_attr_list_insert(class->attribs[RTT_INDICATION], attrib); - - attrib = pango_attr_style_new(PANGO_STYLE_ITALIC); - pango_attr_list_insert(class->attribs[RTT_INDICATION], attrib); - - /* RTT_RAW_CODE */ - - class->attribs[RTT_RAW_CODE] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(48895, 48895, 48895); - pango_attr_list_insert(class->attribs[RTT_RAW_CODE], attrib); - - /* RTT_INSTRUCTION */ - - class->attribs[RTT_INSTRUCTION] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(0, 0, 0); - pango_attr_list_insert(class->attribs[RTT_INSTRUCTION], attrib); - - /* RTT_IMMEDIATE */ - - class->attribs[RTT_IMMEDIATE] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(41215, 8447, 61695); - pango_attr_list_insert(class->attribs[RTT_IMMEDIATE], attrib); - - /* RTT_REGISTER */ - - class->attribs[RTT_REGISTER] = pango_attr_list_new(); - - //attrib = pango_attr_foreground_new(23551, 23551, 51455); - attrib = pango_attr_foreground_new(16895, 16895, 53759); - pango_attr_list_insert(class->attribs[RTT_REGISTER], attrib); - - /* RTT_PUNCT */ - - class->attribs[RTT_PUNCT] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(0, 0, 0); - pango_attr_list_insert(class->attribs[RTT_PUNCT], attrib); - - attrib = pango_attr_weight_new(PANGO_WEIGHT_BOLD); - pango_attr_list_insert(class->attribs[RTT_PUNCT], attrib); - - /* RTT_HOOK */ - - class->attribs[RTT_HOOK] = pango_attr_list_new(); + gchar *filename; /* Chemin d'accès à utiliser */ - attrib = pango_attr_foreground_new(0, 0, 0); - pango_attr_list_insert(class->attribs[RTT_HOOK], attrib); + filename = find_pixmap_file("bookmark.png"); + /* assert(filename != NULL); */ - attrib = pango_attr_weight_new(PANGO_WEIGHT_BOLD); - pango_attr_list_insert(class->attribs[RTT_HOOK], attrib); + class->bookmark_img = cairo_image_surface_create_from_png(filename); - /* RTT_SIGNS */ - - class->attribs[RTT_SIGNS] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(0, 0, 0); - pango_attr_list_insert(class->attribs[RTT_SIGNS], attrib); - - attrib = pango_attr_weight_new(PANGO_WEIGHT_SEMIBOLD); - pango_attr_list_insert(class->attribs[RTT_SIGNS], attrib); - - /* RTT_LTGT */ - - class->attribs[RTT_LTGT] = pango_attr_list_new(); - - /* RTT_SECTION */ - - class->attribs[RTT_SECTION] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(51200, 2560, 2560); - pango_attr_list_insert(class->attribs[RTT_SECTION], attrib); - - /* - attrib = pango_attr_foreground_new(56832, 26880, 43008); - pango_attr_list_insert(class->attribs[RTT_SECTION], attrib); - - attrib = pango_attr_weight_new(PANGO_WEIGHT_BOLD); - pango_attr_list_insert(class->attribs[RTT_SECTION], attrib); - */ - - /* RTT_SEGMENT */ - - class->attribs[RTT_SEGMENT] = pango_attr_list_new(); - - /* RTT_STRING */ - - class->attribs[RTT_STRING] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(52224, 32256, 0); - pango_attr_list_insert(class->attribs[RTT_STRING], attrib); - - /* RTT_VAR_NAME */ - - class->attribs[RTT_VAR_NAME] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(0, 0, 0); - pango_attr_list_insert(class->attribs[RTT_VAR_NAME], attrib); - - /* RTT_KEY_WORD */ - - class->attribs[RTT_KEY_WORD] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(0, 0, 0); - pango_attr_list_insert(class->attribs[RTT_KEY_WORD], attrib); - - /* RTT_ERROR */ - - class->attribs[RTT_ERROR] = pango_attr_list_new(); - - attrib = pango_attr_foreground_new(65535, 0, 0); - pango_attr_list_insert(class->attribs[RTT_ERROR], attrib); - - attrib = pango_attr_weight_new(PANGO_WEIGHT_BOLD); - pango_attr_list_insert(class->attribs[RTT_ERROR], attrib); + g_free(filename); } @@ -473,7 +342,6 @@ static void g_buffer_line_class_init(GBufferLineClass *class) static void g_buffer_line_init(GBufferLine *line) { BufferLineColumn i; /* Boucle de parcours */ - char *filename; /* Chemin d'accès à utiliser */ for (i = BLC_ADDRESS; i < BLC_COUNT; i++) reset_column(&line->columns[i]); @@ -481,9 +349,6 @@ static void g_buffer_line_init(GBufferLine *line) line->merge_start = BLC_COUNT; line->last_used = BLC_COUNT; - filename = "/home/ocb/prog/chrysalide.cdb/pixmaps/bookmark.png"; - line->bookmark_img = cairo_image_surface_create_from_png(filename); - } @@ -673,7 +538,6 @@ GSList *g_buffer_line_highlight_all_same_segments(const GBufferLine *line, GSLis void g_buffer_line_insert_text(GBufferLine *line, BufferLineColumn column, const char *text, size_t length, RenderingTagType type) { - GBufferLineClass *class; /* Stockage de briques de base */ GBufferSegment *segment; /* Portion de texte à ajouter */ if (column == BLC_MAIN) @@ -687,8 +551,6 @@ void g_buffer_line_insert_text(GBufferLine *line, BufferLineColumn column, const if (length == 0) return; - class = G_BUFFER_LINE_GET_CLASS(line); - segment = g_buffer_segment_new(type, text, length); g_buffer_line_add_segment(line, column, segment); @@ -829,10 +691,13 @@ void g_buffer_line_start_merge_at(GBufferLine *line, BufferLineColumn start) void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, const gint max_widths[BLC_COUNT], gint x_init, gint y, bool addr, bool code) { + GBufferLineClass *class; /* Stockage de briques de base */ gint x; /* Point de départ d'impression*/ BufferLineColumn i; /* Boucle de parcours */ - cairo_set_source_surface(cairo, line->bookmark_img, 5, y); + class = G_BUFFER_LINE_GET_CLASS(line); + + cairo_set_source_surface(cairo, class->bookmark_img, 5, y); cairo_paint(cairo); x = x_init; |