diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-03-04 01:38:27 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-03-04 01:38:27 (GMT) |
commit | 674739bedc853681be5a2657a7a4f497d6e82c9b (patch) | |
tree | 10e65041c0607d4e5a20c0a7a77fe75e1bbd7737 /src/gtksnippet.c | |
parent | bbd04bf5f23e7dca1917247cb92824805b22a2a4 (diff) |
Added a line type for binary code display.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@51 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtksnippet.c')
-rw-r--r-- | src/gtksnippet.c | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/src/gtksnippet.c b/src/gtksnippet.c index 791338e..989e22b 100644 --- a/src/gtksnippet.c +++ b/src/gtksnippet.c @@ -124,7 +124,8 @@ int compare_code_line_info(const code_line_info **a, const code_line_info **b) - +/* Réclame une nouvelle taille adaptée au contenu présent. */ +void gtk_snippet_recompute_size_request(GtkSnippet *); @@ -569,11 +570,70 @@ void gtk_snippet_set_processor(GtkSnippet *snippet, const asm_processor *proc) void gtk_snippet_set_rendering_lines(GtkSnippet *snippet, rendering_line *lines) { + rendering_line *iter; /* Boucle de parcours */ + off_t bin_len; /* Taille d'instruction */ + snippet->lines = lines; + bin_len = 0; + + dl_list_for_each(iter, lines, rendering_line *) + get_rendering_line_binary_len(iter, &bin_len); + + dl_list_for_each(iter, lines, rendering_line *) + set_rendering_line_max_binary_len(iter, bin_len); + + gtk_snippet_recompute_size_request(snippet); + } + + + +/****************************************************************************** +* * +* Paramètres : snippet = composant GTK à mettre à jour. * +* * +* Description : Réclame une nouvelle taille adaptée au contenu présent. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void gtk_snippet_recompute_size_request(GtkSnippet *snippet) +{ + int width; /* Largeur de l'objet actuelle */ + int height; /* Hauteur de l'objet actuelle */ + rendering_line *iter; /* Boucle de parcours */ + + width = 0; + height = 0; + + dl_list_for_each(iter, snippet->lines, rendering_line *) + { + get_rendering_line_size(iter, &width, &height); + + if (iter == snippet->lines) + snippet->line_height = height; + + } + + gtk_widget_set_size_request(GTK_WIDGET(snippet), width + 2 * MARGIN_SPACE + snippet->line_height, height); + +} + + + + + + + + + + /****************************************************************************** * * * Paramètres : snippet = composant GTK à mettre à jour. * @@ -775,7 +835,7 @@ void gtk_snippet_build_content(GtkSnippet *snippet) pango_layout_iter_free(iter); - gtk_widget_set_size_request(GTK_WIDGET(snippet), width + 2 * MARGIN_SPACE + snippet->line_height, height); + //gtk_widget_set_size_request(GTK_WIDGET(snippet), width + 2 * MARGIN_SPACE + snippet->line_height, height); } |