diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-10-23 21:16:35 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-10-23 21:16:35 (GMT) |
commit | 4563123b929366e93973a1d6aa3269bd7b3f47d6 (patch) | |
tree | 0ffd8d788adb9228c137254f8817c4397a280b16 | |
parent | acbd3ac3899bd1230097df2f1afea6c3690a5cb8 (diff) |
Indented code labels in the assembly views.
-rw-r--r-- | src/core/params.c | 3 | ||||
-rw-r--r-- | src/core/params.h | 1 | ||||
-rw-r--r-- | src/format/symbol.c | 6 | ||||
-rw-r--r-- | src/glibext/gbinportion.c | 4 | ||||
-rw-r--r-- | src/glibext/gbuffercache.c | 5 | ||||
-rw-r--r-- | src/glibext/gbuffercache.h | 2 | ||||
-rw-r--r-- | src/glibext/gbufferline.c | 13 | ||||
-rw-r--r-- | src/glibext/gbufferline.h | 6 | ||||
-rw-r--r-- | src/glibext/gbufferview.c | 5 | ||||
-rw-r--r-- | src/glibext/gbufferview.h | 2 | ||||
-rw-r--r-- | src/glibext/generators/rborder.c | 4 | ||||
-rw-r--r-- | src/gtkext/gtkblockdisplay.c | 2 | ||||
-rw-r--r-- | src/gtkext/gtkbufferdisplay-int.h | 1 | ||||
-rw-r--r-- | src/gtkext/gtkbufferdisplay.c | 9 |
14 files changed, 38 insertions, 25 deletions
diff --git a/src/core/params.c b/src/core/params.c index 8cc7b3a..d71a0eb 100644 --- a/src/core/params.c +++ b/src/core/params.c @@ -204,6 +204,9 @@ bool load_main_config_parameters(void) param = g_generic_config_create_param(config, MPK_WELCOME_CHECK, CPT_BOOLEAN, false); if (param == NULL) return false; + param = g_generic_config_create_param(config, MPK_LABEL_OFFSET, CPT_INTEGER, 10); + if (param == NULL) return false; + param = g_generic_config_create_param(config, MPK_SELECTION_LINE, CPT_BOOLEAN, true); if (param == NULL) return false; diff --git a/src/core/params.h b/src/core/params.h index bcb6f53..da9dcb9 100644 --- a/src/core/params.h +++ b/src/core/params.h @@ -62,6 +62,7 @@ #define MPK_ELLIPSIS_TAB "gui.editor.panels.ellipsis_tab" #define MPK_WELCOME_STARTUP "gui.editor.panels.welcome.show_at_startup" #define MPK_WELCOME_CHECK "gui.editor.panels.welcome.check_version" +#define MPK_LABEL_OFFSET "gui.editor.views.label_offset" #define MPK_SELECTION_LINE "gui.editor.views.selection_line" #define MPK_TOOLTIP_MAX_CALLS "gui.editor.views.tooltip_max_calls" #define MPK_TOOLTIP_MAX_STRINGS "gui.editor.views.tooltip_max_strings" diff --git a/src/format/symbol.c b/src/format/symbol.c index 9c8a6e0..899740a 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -621,9 +621,9 @@ static void g_binary_symbol_print(GBinSymbol *symbol, GBufferLine *line, size_t if (label != NULL) { - g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_HEAD); - g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, SL(label), RTT_LABEL, NULL); - g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, ":", 1, RTT_PUNCT, NULL); + g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_LABEL); + g_buffer_line_append_text(line, BLC_ASSEMBLY_LABEL, SL(label), RTT_LABEL, NULL); + g_buffer_line_append_text(line, BLC_ASSEMBLY_LABEL, ":", 1, RTT_PUNCT, NULL); free(label); diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c index 2ffe253..8247910 100644 --- a/src/glibext/gbinportion.c +++ b/src/glibext/gbinportion.c @@ -1138,9 +1138,9 @@ static void g_binary_portion_print(GBinPortion *portion, GBufferLine *line, size if (portion->text[repeat] != NULL) { - g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_HEAD); + g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_LABEL); - g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, SL(portion->text[repeat]), RTT_COMMENT, NULL); + g_buffer_line_append_text(line, BLC_ASSEMBLY_LABEL, SL(portion->text[repeat]), RTT_COMMENT, NULL); } diff --git a/src/glibext/gbuffercache.c b/src/glibext/gbuffercache.c index 866d696..e4ddf06 100644 --- a/src/glibext/gbuffercache.c +++ b/src/glibext/gbuffercache.c @@ -1466,6 +1466,7 @@ void g_buffer_cache_collect_widths(GBufferCache *cache, size_t index, line_width * last = dernière ligne à dessiner. * * area = position et surface à traiter. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * selected = ordonnée d'une ligne sélectionnée ou NULL. * * list = liste de contenus à mettre en évidence. * * * @@ -1477,7 +1478,7 @@ void g_buffer_cache_collect_widths(GBufferCache *cache, size_t index, line_width * * ******************************************************************************/ -void g_buffer_cache_draw(const GBufferCache *cache, cairo_t *cr, size_t first, size_t last, const cairo_rectangle_int_t *area, const GDisplayOptions *options, const gint *selected, const segcnt_list *list) +void g_buffer_cache_draw(const GBufferCache *cache, cairo_t *cr, size_t first, size_t last, const cairo_rectangle_int_t *area, const GDisplayOptions *options, const line_width_summary *offsets, const gint *selected, const segcnt_list *list) { GBufferCacheClass *class; /* Classe des tampons */ gint y; /* Point de départ en ordonnée */ @@ -1515,7 +1516,7 @@ void g_buffer_cache_draw(const GBufferCache *cache, cairo_t *cr, size_t first, s line = get_cache_info_line(info, i, cache->content); - g_buffer_line_draw(line, cr, &summary, class->text_pos, y, options, list); + g_buffer_line_draw(line, cr, &summary, class->text_pos, y, options, offsets, list); g_object_unref(G_OBJECT(line)); diff --git a/src/glibext/gbuffercache.h b/src/glibext/gbuffercache.h index 077c5f9..8059357 100644 --- a/src/glibext/gbuffercache.h +++ b/src/glibext/gbuffercache.h @@ -106,7 +106,7 @@ GBufferLine *g_buffer_cache_find_line_by_index(const GBufferCache *, size_t); void g_buffer_cache_collect_widths(GBufferCache *, size_t, line_width_summary *); /* Imprime une partie choisie du tampon contenant des lignes. */ -void g_buffer_cache_draw(const GBufferCache *, cairo_t *, size_t, size_t, const cairo_rectangle_int_t *, const GDisplayOptions *, const gint *, const segcnt_list *); +void g_buffer_cache_draw(const GBufferCache *, cairo_t *, size_t, size_t, const cairo_rectangle_int_t *, const GDisplayOptions *, const line_width_summary *, const gint *, const segcnt_list *); /* Indique l'indice correspondant à une adresse donnée. */ size_t _g_buffer_cache_find_index_by_cursor(const GBufferCache *, const GLineCursor *, bool, size_t, size_t); diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c index 39ef0ce..af27426 100644 --- a/src/glibext/gbufferline.c +++ b/src/glibext/gbufferline.c @@ -959,13 +959,6 @@ void g_buffer_line_collect_widths(GBufferLine *line, line_width_summary *summary { width = get_column_width(&line->columns[i]); - - /* - if (i == BLC_ASSEMBLY_HEAD) - assert(width > 0); - */ - - if (i < line->merge_start) summary->max_widths[i] = MAX(summary->max_widths[i], width); @@ -1484,6 +1477,7 @@ bool g_buffer_line_find_near_coord(const GBufferLine *line, col_coord_t *coord, * x_init = abscisse du point d'impression de départ. * * y = ordonnée du point d'impression. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * list = liste de contenus à mettre en évidence. * * * * Description : Imprime la ligne de texte représentée. * @@ -1494,7 +1488,7 @@ bool g_buffer_line_find_near_coord(const GBufferLine *line, col_coord_t *coord, * * ******************************************************************************/ -void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, const line_width_summary *summary, gint x_init, gint y, const GDisplayOptions *options, const segcnt_list *list) +void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, const line_width_summary *summary, gint x_init, gint y, const GDisplayOptions *options, const line_width_summary *offsets, const segcnt_list *list) { GBufferLineClass *class; /* Stockage de briques de base */ bool has_src_surface; /* Note une présence définie */ @@ -1543,6 +1537,9 @@ void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, const line_width_summ { max_width = g_buffer_line_compute_max_width(line, i, summary); + if (max_width == 0) + max_width = offsets->max_widths[i]; + if (max_width > 0) x += max_width + COL_MARGIN; diff --git a/src/glibext/gbufferline.h b/src/glibext/gbufferline.h index 21b3ec9..3fb21fc 100644 --- a/src/glibext/gbufferline.h +++ b/src/glibext/gbufferline.h @@ -44,7 +44,6 @@ #define G_BUFFER_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BUFFER_LINE, GBufferLineClass)) - /* Représentation de fragments de texte en ligne (instance) */ typedef struct _GBufferLine GBufferLine; @@ -58,6 +57,7 @@ typedef enum _BufferLineColumn BLC_PHYSICAL, /* Position physique */ BLC_VIRTUAL, /* Adresse virtuelle */ BLC_BINARY, /* Contenu sous forme binaire */ + BLC_ASSEMBLY_LABEL, /* Etiquette dans les données */ BLC_ASSEMBLY_HEAD, /* Instruction pour assembleur */ BLC_ASSEMBLY, /* Code pour assembleur */ BLC_COMMENTS, /* Commentaires éventuels */ @@ -74,7 +74,7 @@ typedef enum _BufferLineColumn #define BLC_FIRST BLC_PHYSICAL /* Première colonne toujours affichée */ -#define BLC_DISPLAY BLC_ASSEMBLY_HEAD +#define BLC_DISPLAY BLC_ASSEMBLY_LABEL /* Confort pour l'insertion de texte */ @@ -211,7 +211,7 @@ GObject *g_buffer_line_get_creator_at(const GBufferLine *, const line_width_summ bool g_buffer_line_find_near_coord(const GBufferLine *, col_coord_t *, const line_width_summary *, const GDisplayOptions *, GdkScrollDirection, gint *); /* Imprime la ligne de texte représentée. */ -void g_buffer_line_draw(GBufferLine *, cairo_t *, const line_width_summary *, gint, gint, const GDisplayOptions *, const segcnt_list *); +void g_buffer_line_draw(GBufferLine *, cairo_t *, const line_width_summary *, gint, gint, const GDisplayOptions *, const line_width_summary *, const segcnt_list *); diff --git a/src/glibext/gbufferview.c b/src/glibext/gbufferview.c index f3b0147..79a475e 100644 --- a/src/glibext/gbufferview.c +++ b/src/glibext/gbufferview.c @@ -1083,6 +1083,7 @@ bool g_buffer_view_highlight_segments(GBufferView *view, gint x, gint y, const G * virt_y = ordonnée réelle du point 0 à l'écran. * * area = position et surface à traiter. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * selected = ordonnée d'une ligne sélectionnée ou NULL. * * * * Description : Imprime la visualisation du tampon de lignes quelconques. * @@ -1093,7 +1094,7 @@ bool g_buffer_view_highlight_segments(GBufferView *view, gint x, gint y, const G * * ******************************************************************************/ -void g_buffer_view_draw(const GBufferView *view, cairo_t *cr, gint virt_y, const cairo_rectangle_int_t *area, const GDisplayOptions *options, gint *selected) +void g_buffer_view_draw(const GBufferView *view, cairo_t *cr, gint virt_y, const cairo_rectangle_int_t *area, const GDisplayOptions *options, const line_width_summary *offsets, gint *selected) { gint line_height; /* Hauteur d'une ligne */ gint cr_y; /* Ordonnée pour le dessin */ @@ -1128,7 +1129,7 @@ void g_buffer_view_draw(const GBufferView *view, cairo_t *cr, gint virt_y, const if (selected != NULL) *selected -= cr_y; - g_buffer_cache_draw(view->cache, cr, first, last, area, options, selected, view->highlighted); + g_buffer_cache_draw(view->cache, cr, first, last, area, options, offsets, selected, view->highlighted); } diff --git a/src/glibext/gbufferview.h b/src/glibext/gbufferview.h index 04e4bbb..2a678f6 100644 --- a/src/glibext/gbufferview.h +++ b/src/glibext/gbufferview.h @@ -98,7 +98,7 @@ bool g_buffer_view_unhighlight_segments(GBufferView *); bool g_buffer_view_highlight_segments(GBufferView *, gint, gint, const GDisplayOptions *); /* Imprime la visualisation du tampon de lignes quelconques. */ -void g_buffer_view_draw(const GBufferView *, cairo_t *, gint, const cairo_rectangle_int_t *, const GDisplayOptions *, gint *); +void g_buffer_view_draw(const GBufferView *, cairo_t *, gint, const cairo_rectangle_int_t *, const GDisplayOptions *, const line_width_summary *, gint *); diff --git a/src/glibext/generators/rborder.c b/src/glibext/generators/rborder.c index 62c374d..640fa2d 100644 --- a/src/glibext/generators/rborder.c +++ b/src/glibext/generators/rborder.c @@ -364,8 +364,8 @@ static void g_border_generator_print(GBorderGenerator *generator, GBufferLine *l text = strdup(generator->start ? ROUTINE_INTRO_MSG : ROUTINE_OUTRO_MSG); g_coding_language_encapsulate_comment(generator->lang, &text); - g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_HEAD); - g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, SL(text), RTT_COMMENT, NULL); + g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_LABEL); + g_buffer_line_append_text(line, BLC_ASSEMBLY_LABEL, SL(text), RTT_COMMENT, NULL); free(text); diff --git a/src/gtkext/gtkblockdisplay.c b/src/gtkext/gtkblockdisplay.c index a6f16a5..6aaaac6 100644 --- a/src/gtkext/gtkblockdisplay.c +++ b/src/gtkext/gtkblockdisplay.c @@ -464,4 +464,6 @@ void gtk_block_display_override_view_index(GtkBlockDisplay *display, unsigned in panel->view_index = index; panel->options = g_loaded_content_get_display_options(G_LOADED_CONTENT(panel->binary), index); + GTK_BUFFER_DISPLAY(display)->offsets.max_widths[BLC_ASSEMBLY_LABEL] = 0; + } diff --git a/src/gtkext/gtkbufferdisplay-int.h b/src/gtkext/gtkbufferdisplay-int.h index 9a5980f..2d78b1d 100644 --- a/src/gtkext/gtkbufferdisplay-int.h +++ b/src/gtkext/gtkbufferdisplay-int.h @@ -42,6 +42,7 @@ struct _GtkBufferDisplay GtkDisplayPanel parent; /* A laisser en premier */ GBufferView *view; /* Vue sur le contenu affiché */ + line_width_summary offsets; /* Décalages supplémentaires */ cairo_rectangle_int_t caret; /* Emplacement du curseur #1 */ vmpa2t caret_addr; /* Position mémoire du curseur */ diff --git a/src/gtkext/gtkbufferdisplay.c b/src/gtkext/gtkbufferdisplay.c index 60b1f40..6329668 100644 --- a/src/gtkext/gtkbufferdisplay.c +++ b/src/gtkext/gtkbufferdisplay.c @@ -186,6 +186,13 @@ static void gtk_buffer_display_class_init(GtkBufferDisplayClass *class) static void gtk_buffer_display_init(GtkBufferDisplay *display) { + int offset; /* Décalage des étiquettes */ + + memset(&display->offsets, 0, sizeof(line_width_summary)); + + g_generic_config_get_value(get_main_configuration(), MPK_LABEL_OFFSET, &offset); + display->offsets.max_widths[BLC_ASSEMBLY_LABEL] = offset; + display->cursor = NULL; } @@ -439,7 +446,7 @@ static gboolean gtk_buffer_display_draw(GtkWidget *widget, cairo_t *cr) area.x -= virt_x; virt_y += area.y; - g_buffer_view_draw(display->view, cr, virt_y, &area, parent->options, selected); + g_buffer_view_draw(display->view, cr, virt_y, &area, parent->options, &display->offsets, selected); } |