summaryrefslogtreecommitdiff
path: root/src/analysis/line_comment.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-07-04 12:21:26 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-07-04 12:21:26 (GMT)
commita60e81ac70b3d829f486ce7b6534005a9d025206 (patch)
tree0e3b284a12a1f8f4932f5cd05247a556cf8c5bf9 /src/analysis/line_comment.c
parentb6893c7b85c34f7a3c65ac76bfd9d95b1c4ebf55 (diff)
Defined general rendering options using a GLib object.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@89 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/line_comment.c')
-rw-r--r--src/analysis/line_comment.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/analysis/line_comment.c b/src/analysis/line_comment.c
index 331bd19..a39cb11 100644
--- a/src/analysis/line_comment.c
+++ b/src/analysis/line_comment.c
@@ -38,7 +38,7 @@ struct _GCommentLine
GRenderingLine parent; /* Instance parente */
char *comment; /* Texte à afficher */
- const disass_options *options; /* Options de représentation */
+ const GRenderingOptions *options; /* Options de représentation */
};
@@ -58,7 +58,7 @@ static void g_comment_line_class_init(GCommentLineClass *);
static void g_comment_line_init(GCommentLine *);
/* Met à jour la ligne de représentation de commentaires. */
-void g_comment_line_refresh_markup(GCommentLine *, LinesMainOwner);
+void g_comment_line_refresh_markup(GCommentLine *, MainRendering);
@@ -112,8 +112,8 @@ static void g_comment_line_init(GCommentLine *line)
/******************************************************************************
* *
-* Paramètres : line = ligne de représentation à actualiser. *
-* owner = support effectif final des lignes de code. *
+* Paramètres : line = ligne de représentation à actualiser. *
+* rendering = support effectif final des lignes de code. *
* *
* Description : Met à jour la ligne de représentation de commentaires. *
* *
@@ -123,23 +123,28 @@ static void g_comment_line_init(GCommentLine *line)
* *
******************************************************************************/
-void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner)
+void g_comment_line_refresh_markup(GCommentLine *line, MainRendering rendering)
{
+ bool show_address; /* Affichage de l'adresse ? */
+ bool show_code; /* Affichage du code brut ? */
size_t len; /* Taille du contenu */
char *content; /* Contenu réellement imprimé */
char buffer[CODE_BUFFER_LEN]; /* Zone tampon à utiliser */
const off_t *max_bin_len; /* Taille de ligne max/globale */
size_t clen; /* Taille du commentaire */
+ show_address = g_rendering_options_has_to_show_address(line->options, rendering);
+ show_code = g_rendering_options_has_to_show_code(line->options, rendering);
+
len = strlen("<tt>") + 1;
content = (char *)calloc(len, sizeof(char));
strcpy(content, "<tt>");
/* Eventuelle adresse virtuelle */
- if (line->options->show_address)
+ if (show_address)
{
- switch (g_arch_processor_get_memory_size(line->options->proc))
+ switch (g_arch_processor_get_memory_size(g_rendering_options_get_processor(line->options)))
{
case MDS_8_BITS:
snprintf(buffer, CODE_BUFFER_LEN,
@@ -176,16 +181,16 @@ void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner)
/* Eventuel code brut (sauté) */
- if (line->options->show_code)
+ if (show_code)
{
- max_bin_len = &G_RENDERING_LINE(line)->max_bin_len[owner];
+ max_bin_len = &G_RENDERING_LINE(line)->max_bin_len[rendering];
- clen = (line->options->show_address ? strlen("\t") : 0);
+ clen = (show_address ? strlen("\t") : 0);
clen += *max_bin_len;
content = (char *)realloc(content, (len + clen) * sizeof(char));
- if (line->options->show_address)
+ if (show_address)
{
strcat(content, "\t");
len += strlen("\t");
@@ -201,14 +206,14 @@ void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner)
/* Commentaire proprement dit */
- clen = (line->options->show_address || line->options->show_code ? strlen("\t") : 0);
+ clen = (show_address || show_code ? strlen("\t") : 0);
clen += strlen("<b><span foreground='#003300'>");
clen += strlen("; ") + strlen(line->comment);
clen += strlen("</span></b>");
content = (char *)realloc(content, (len + clen) * sizeof(char));
- if (line->options->show_address || line->options->show_code)
+ if (show_address || show_code)
{
strcat(content, "\t");
len += strlen("\t");
@@ -225,7 +230,7 @@ void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner)
content = (char *)realloc(content, len * sizeof(char));
strcat(content, "</tt>");
- pango_layout_set_markup(G_RENDERING_LINE(line)->layout[owner], content, len - 1);
+ pango_layout_set_markup(G_RENDERING_LINE(line)->layout[rendering], content, len - 1);
free(content);
@@ -246,7 +251,7 @@ void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner)
* *
******************************************************************************/
-GRenderingLine *g_comment_line_new(uint64_t offset, const char *comment, const disass_options *options)
+GRenderingLine *g_comment_line_new(uint64_t offset, const char *comment, const GRenderingOptions *options)
{
GCommentLine *result; /* Structure à retourner */