diff options
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkblockdisplay.c | 21 | ||||
-rw-r--r-- | src/gtkext/gtkblockdisplay.h | 28 | ||||
-rw-r--r-- | src/gtkext/gtkbufferdisplay-int.h | 1 | ||||
-rw-r--r-- | src/gtkext/gtkbufferdisplay.c | 20 | ||||
-rw-r--r-- | src/gtkext/hexdisplay.c | 11 | ||||
-rw-r--r-- | src/gtkext/hexdisplay.h | 13 |
6 files changed, 61 insertions, 33 deletions
diff --git a/src/gtkext/gtkblockdisplay.c b/src/gtkext/gtkblockdisplay.c index b53f59d..f34df3c 100644 --- a/src/gtkext/gtkblockdisplay.c +++ b/src/gtkext/gtkblockdisplay.c @@ -264,9 +264,7 @@ static gboolean gtk_block_display_button_press(GtkWidget *widget, GdkEventButton view = gtk_buffer_display_get_view(GTK_BUFFER_DISPLAY(display)); - changed = g_buffer_view_highlight_segments(view, real_x, real_y, - GTK_DISPLAY_PANEL(display)->options, - >K_BUFFER_DISPLAY(display)->offsets); + changed = g_buffer_view_highlight_segments(view, real_x, real_y, GTK_DISPLAY_PANEL(display)->options); g_object_unref(G_OBJECT(view)); @@ -317,8 +315,7 @@ static gboolean gtk_block_display_query_tooltip(GtkWidget *widget, gint x, gint real_y = y; gtk_display_panel_compute_real_coord(panel, &real_x, &real_y); - creator = g_buffer_view_find_creator(GTK_BUFFER_DISPLAY(display)->view, real_x, real_y, - panel->options, >K_BUFFER_DISPLAY(display)->offsets); + creator = g_buffer_view_find_creator(GTK_BUFFER_DISPLAY(display)->view, real_x, real_y, panel->options); if (creator != NULL) { @@ -391,9 +388,7 @@ static bool gtk_block_display_notify_caret_relocation(GtkBlockDisplay *display, view = gtk_buffer_display_get_view(GTK_BUFFER_DISPLAY(display)); - result = g_buffer_view_highlight_segments(view, area->x, area->y, - GTK_DISPLAY_PANEL(display)->options, - >K_BUFFER_DISPLAY(display)->offsets); + result = g_buffer_view_highlight_segments(view, area->x, area->y, GTK_DISPLAY_PANEL(display)->options); g_object_unref(G_OBJECT(view)); @@ -421,13 +416,21 @@ static bool gtk_block_display_notify_caret_relocation(GtkBlockDisplay *display, void gtk_block_display_override_view_index(GtkBlockDisplay *display, unsigned int index) { GtkDisplayPanel *panel; /* Version de plus haut niveau */ + GBufferCache *cache; /* Tampon de données affiché */ + GWidthTracker *tracker; /* Gestionnaire de largeurs */ panel = GTK_DISPLAY_PANEL(display); 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; + cache = g_buffer_view_get_cache(GTK_BUFFER_DISPLAY(display)->view); + + tracker = g_buffer_cache_get_width_tracker(cache); + g_width_tracker_set_column_min_width(tracker, BLC_ASSEMBLY_LABEL, 0); + g_object_unref(G_OBJECT(tracker)); + + g_object_unref(G_OBJECT(cache)); gtk_buffer_display_add_block_bar(GTK_BUFFER_DISPLAY(display)); diff --git a/src/gtkext/gtkblockdisplay.h b/src/gtkext/gtkblockdisplay.h index 2effb9b..196fe2e 100644 --- a/src/gtkext/gtkblockdisplay.h +++ b/src/gtkext/gtkblockdisplay.h @@ -33,12 +33,12 @@ -#define GTK_TYPE_BLOCK_DISPLAY (gtk_block_display_get_type()) -#define GTK_BLOCK_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_BLOCK_DISPLAY, GtkBlockDisplay)) -#define GTK_BLOCK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_BLOCK_DISPLAY, GtkBlockDisplayClass)) -#define GTK_IS_BLOCK_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_BLOCK_DISPLAY)) -#define GTK_IS_BLOCK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_BLOCK_DISPLAY)) -#define GTK_BLOCK_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_BLOCK_DISPLAY, GtkBlockDisplayClass)) +#define GTK_TYPE_BLOCK_DISPLAY (gtk_block_display_get_type()) +#define GTK_BLOCK_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_BLOCK_DISPLAY, GtkBlockDisplay)) +#define GTK_BLOCK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_BLOCK_DISPLAY, GtkBlockDisplayClass)) +#define GTK_IS_BLOCK_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_BLOCK_DISPLAY)) +#define GTK_IS_BLOCK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_BLOCK_DISPLAY)) +#define GTK_BLOCK_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_BLOCK_DISPLAY, GtkBlockDisplayClass)) /* Composant d'affichage de code d'assembleur (instance) */ @@ -48,6 +48,22 @@ typedef struct _GtkBlockDisplay GtkBlockDisplay; typedef struct _GtkBlockDisplayClass GtkBlockDisplayClass; +/* Désignation des colonnes d'une ligne */ +typedef enum _DisassLineColumn +{ + DLC_PHYSICAL, /* Position physique */ + DLC_VIRTUAL, /* Adresse virtuelle */ + DLC_BINARY, /* Contenu sous forme binaire */ + DLC_ASSEMBLY_LABEL, /* Etiquette dans les données */ + DLC_ASSEMBLY_HEAD, /* Instruction pour assembleur */ + DLC_ASSEMBLY, /* Code pour assembleur */ + DLC_COMMENTS, /* Commentaires éventuels */ + + DLC_COUNT, + +} DisassLineColumn; + + /* Détermine le type du composant d'affichage de bloc en langage d'assemblage. */ GType gtk_block_display_get_type(void); diff --git a/src/gtkext/gtkbufferdisplay-int.h b/src/gtkext/gtkbufferdisplay-int.h index 9fc8331..d02aa37 100644 --- a/src/gtkext/gtkbufferdisplay-int.h +++ b/src/gtkext/gtkbufferdisplay-int.h @@ -42,7 +42,6 @@ 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 */ GLineCursor *cursor; /* Emplacement du curseur #2 */ diff --git a/src/gtkext/gtkbufferdisplay.c b/src/gtkext/gtkbufferdisplay.c index eec0e5b..e419125 100644 --- a/src/gtkext/gtkbufferdisplay.c +++ b/src/gtkext/gtkbufferdisplay.c @@ -28,8 +28,6 @@ #include "gtkbufferdisplay-int.h" - - #include "../core/params.h" #include "../glibext/gbinarycursor.h" // REMME @@ -215,13 +213,6 @@ 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; } @@ -522,7 +513,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, &display->offsets, + g_buffer_view_draw(display->view, cr, virt_y, &area, parent->options, selected, parent->scale, parent->export); } @@ -613,8 +604,7 @@ static gboolean gtk_buffer_display_key_press(GtkWidget *widget, GdkEventKey *eve ctrl = (event->state & GDK_CONTROL_MASK); area = display->caret; - status = g_buffer_view_move_caret(display->view, ctrl, dir, panel->options, &display->offsets, - &area, &cursor); + status = g_buffer_view_move_caret(display->view, ctrl, dir, panel->options, &area, &cursor); if (status) { @@ -828,8 +818,7 @@ GObject *gtk_buffer_display_get_active_object(const GtkBufferDisplay *display) else result = g_buffer_view_find_creator(display->view, display->caret.x, display->caret.y, - GTK_DISPLAY_PANEL(display)->options, - &display->offsets); + GTK_DISPLAY_PANEL(display)->options); return result; @@ -996,8 +985,7 @@ static bool _gtk_buffer_display_move_caret_to(GtkBufferDisplay *display, gint x, panel = GTK_DISPLAY_PANEL(display); - result = g_buffer_view_compute_caret_full(display->view, x, y, panel->options, &display->offsets, - &new, &cursor); + result = g_buffer_view_compute_caret_full(display->view, x, y, panel->options, &new, &cursor); if (result) gtk_buffer_display_relocate_caret(display, &new, cursor); diff --git a/src/gtkext/hexdisplay.c b/src/gtkext/hexdisplay.c index 0f0bd30..cf1f600 100644 --- a/src/gtkext/hexdisplay.c +++ b/src/gtkext/hexdisplay.c @@ -25,6 +25,7 @@ #include "gtkbufferdisplay-int.h" +#include "../core/params.h" #include "../format/format.h" #include "../glibext/generators/hex.h" @@ -185,12 +186,20 @@ GtkWidget *gtk_hex_display_new(GBinContent *content) { GtkHexDisplay *result; /* Composant à retourner */ GBufferView *view; /* Vue pointée sur un tampon */ + int padding; /* Bourrage entre colonnes */ + GWidthTracker *tracker; /* Gestionnaire de largeurs */ result = g_object_new(GTK_TYPE_HEX_DISPLAY, NULL); - result->cache = g_buffer_cache_new(content); + result->cache = g_buffer_cache_new(content, HLC_COUNT); g_object_ref_sink(G_OBJECT(result->cache)); + g_generic_config_get_value(get_main_configuration(), MPK_HEX_PADDING, &padding); + + tracker = g_buffer_cache_get_width_tracker(result->cache); + g_width_tracker_set_column_min_width(tracker, HLC_PADDING, padding); + g_object_unref(G_OBJECT(tracker)); + result->generator = g_hex_generator_new(content); gtk_hex_display_populate_cache(result); diff --git a/src/gtkext/hexdisplay.h b/src/gtkext/hexdisplay.h index 9190548..45a1da9 100644 --- a/src/gtkext/hexdisplay.h +++ b/src/gtkext/hexdisplay.h @@ -48,6 +48,19 @@ typedef struct _GtkHexDisplay GtkHexDisplay; typedef struct _GtkHexDisplayClass GtkHexDisplayClass; +/* Désignation des colonnes d'une ligne */ +typedef enum _HexLineColumn +{ + HLC_PHYSICAL, /* Position physique */ + HLC_BINARY, /* Données binaires brutes */ + HLC_PADDING, /* Espacement forcé */ + HLC_TRANSLATION, /* Traduction de contenu */ + + HLC_COUNT, + +} HexLineColumn; + + /* Détermine le type du composant d'affichage sous forme hexadécimale. */ GType gtk_hex_display_get_type(void); |