summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-04-23 22:54:41 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-04-23 22:54:41 (GMT)
commit53183d3333a280b9256eb971731f87ada5854460 (patch)
tree84a670ef185c98efe3613259b3d907e6acbdf7c3
parente25b4d02bba5dbd5cbc34b8f24a8c980396f86fb (diff)
Fixed a bug by avoiding one hardcoded path when looking for a picture.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@371 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog13
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac3
-rw-r--r--src/glibext/gbufferline.c157
4 files changed, 27 insertions, 148 deletions
diff --git a/ChangeLog b/ChangeLog
index 325fb4f..e685ee7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+14-04-24 Cyrille Bagard <nocbos@gmail.com>
+
+ * configure.ac:
+ Do not reject deprecated features of GTK in order to be able to compile
+ the program.
+
+ * Makefile.am:
+ Clean the content.
+
+ * src/glibext/gbufferline.c:
+ Fix a bug by avoiding one hardcoded path when looking for a picture.
+ Clean the code.
+
14-04-14 Cyrille Bagard <nocbos@gmail.com>
* src/glibext/gcodebuffer.c:
diff --git a/Makefile.am b/Makefile.am
index 3a50fb0..033527f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,7 @@ revision.h: .svn
cat $@.in | sed "s/#define REVISION .*$$/#define REVISION $$nb/" > $@ ; \
[ -f $< ] && rm $< || true
-EXTRA_DIST = config.rpath config.rpath config.rpath config.rpath ChangeLog
+EXTRA_DIST = config.rpath ChangeLog
SUBDIRS = pixmaps src plugins po
diff --git a/configure.ac b/configure.ac
index 5a9ab81..7982079 100644
--- a/configure.ac
+++ b/configure.ac
@@ -155,7 +155,8 @@ AC_SUBST(WARNING_FLAGS)
# _XOPEN_SOURCE: strdup, snprintf
# _ISOC99_SOURCE: INFINITY; NAN
# GTK_DISABLE_DEPRECATED: on reste conforme au C99
-COMPLIANCE_FLAGS="-D_BSD_SOURCE -D_GNU_SOURCE -DGTK_DISABLE_DEPRECATED"
+#COMPLIANCE_FLAGS="-D_BSD_SOURCE -D_GNU_SOURCE -DGTK_DISABLE_DEPRECATED"
+COMPLIANCE_FLAGS="-D_BSD_SOURCE -D_GNU_SOURCE"
AC_SUBST(COMPLIANCE_FLAGS)
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;