summaryrefslogtreecommitdiff
path: root/src/gtkext/gtkbinarystrip.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-12-28 23:27:12 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-12-28 23:27:12 (GMT)
commitb57e8ef5522dcbe126157fc2c50fcf879aa7d743 (patch)
tree1ecfd9de39073fee3a2c1a4afa9ce5da574b26df /src/gtkext/gtkbinarystrip.c
parent276b75e6e9ff99a930bd36045e55b1117bb29579 (diff)
Defined layers to register all kinds of binary portions.
Diffstat (limited to 'src/gtkext/gtkbinarystrip.c')
-rw-r--r--src/gtkext/gtkbinarystrip.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/gtkext/gtkbinarystrip.c b/src/gtkext/gtkbinarystrip.c
index e0016d2..0ad0763 100644
--- a/src/gtkext/gtkbinarystrip.c
+++ b/src/gtkext/gtkbinarystrip.c
@@ -211,7 +211,7 @@ static void gtk_binary_strip_size_allocate(GtkWidget *widget, GtkAllocation *all
{
GtkBinaryStrip *strip; /* Autre version du composant */
GExeFormat *format; /* Format du binaire */
- GBinPortion *portions; /* Portions binaires à dessiner*/
+ GPortionLayer *layer; /* Couche première de portions */
GdkRectangle area; /* Surface du composant */
GTK_WIDGET_CLASS(gtk_binary_strip_parent_class)->size_allocate(widget, allocation);
@@ -222,16 +222,18 @@ static void gtk_binary_strip_size_allocate(GtkWidget *widget, GtkAllocation *all
return;
format = g_loaded_binary_get_format(strip->binary);
- portions = g_exe_format_get_portions(format);
+ layer = g_exe_format_get_main_layer(format);
area.x = 0;
area.y = 0;
area.width = allocation->width;
area.height = allocation->height;
- if (!g_binary_portion_get_pos_from_addr(portions, &strip->cursor_addr, &area, &strip->cursor_pos))
+ if (!g_portion_layer_get_pos_from_addr(layer, &strip->cursor_addr, &area, &strip->cursor_pos))
strip->cursor_pos = 0;
+ g_object_unref(G_OBJECT(layer));
+
}
@@ -254,7 +256,7 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto
gint height; /* Hauteur du composant */
GtkBinaryStrip *strip; /* Autre version du composant */
GExeFormat *format; /* Format du binaire */
- GBinPortion *portions; /* Portions binaires à dessiner*/
+ GPortionLayer *layer; /* Couche première de portions */
GdkRectangle area; /* Surface du composant */
vmpa2t addr; /* Adresse à sélectionner */
@@ -269,27 +271,26 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto
strip = GTK_BINARY_STRIP(widget);
format = g_loaded_binary_get_format(strip->binary);
- portions = g_exe_format_get_portions(format);
+ layer = g_exe_format_get_main_layer(format);
area.x = 0;
area.y = 0;
area.width = width;
area.height = height;
- if (g_binary_portion_get_addr_from_pos(portions, event->x, &area, &addr))
+ if (g_portion_layer_get_addr_from_pos(layer, event->x, &area, &addr))
{
copy_vmpa(&strip->cursor_addr, &addr);
strip->cursor_pos = event->x;
gtk_widget_queue_draw(GTK_WIDGET(strip));
- printf("got :: %p\n", &addr);
- printf(" -> 0x%x 0x%x\n", (unsigned int)get_phy_addr(&addr), (unsigned int)get_virt_addr(&addr));
-
g_signal_emit_by_name(strip, "select-address");
}
+ g_object_unref(G_OBJECT(layer));
+
return FALSE;
}
@@ -312,7 +313,7 @@ static gboolean gtk_binary_strip_draw(GtkWidget *widget, cairo_t *cr)
{
GtkBinaryStrip *strip; /* Autre vision du composant */
GExeFormat *format; /* Format du binaire */
- GBinPortion *portions; /* Portions binaires à dessiner*/
+ GPortionLayer *layer; /* Couche première de portions */
GdkRectangle full; /* Taille totale de la surface */
GtkStyleContext *context; /* Contexte du thème actuel */
GdkRGBA *color; /* Couleur du curseur */
@@ -322,11 +323,11 @@ static gboolean gtk_binary_strip_draw(GtkWidget *widget, cairo_t *cr)
if (strip->binary == NULL)
return FALSE;
- format = g_loaded_binary_get_format(strip->binary);
- portions = g_exe_format_get_portions(format);
-
/* Dessin des portions de binaire */
+ format = g_loaded_binary_get_format(strip->binary);
+ layer = g_exe_format_get_main_layer(format);
+
full.x = 0;
full.y = 1;
full.width = gtk_widget_get_allocated_width(widget);
@@ -334,7 +335,9 @@ static gboolean gtk_binary_strip_draw(GtkWidget *widget, cairo_t *cr)
context = gtk_widget_get_style_context(widget);
- g_binary_portion_draw(portions, context, cr, &full);
+ g_portion_layer_draw(layer, context, cr, &full);
+
+ g_object_unref(G_OBJECT(layer));
/* Dessin de la position */
@@ -389,7 +392,7 @@ static gboolean gtk_binary_strip_query_tooltip(GtkWidget *widget, gint x, gint y
gboolean result; /* Bilan à retourner */
GtkBinaryStrip *strip; /* Autre version du composant */
GExeFormat *format; /* Format du binaire */
- GBinPortion *portions; /* Portions binaires à dessiner*/
+ GPortionLayer *layer; /* Couches binaires à consulter*/
GdkRectangle area; /* Surface du composant */
if (keyboard) return FALSE;
@@ -399,14 +402,16 @@ static gboolean gtk_binary_strip_query_tooltip(GtkWidget *widget, gint x, gint y
if (strip->binary != NULL)
{
format = g_loaded_binary_get_format(strip->binary);
- portions = g_exe_format_get_portions(format);
+ layer = g_exe_format_get_main_layer(format);
area.x = 0;
area.y = 0;
area.width = gtk_widget_get_allocated_width(widget);
area.height = gtk_widget_get_allocated_height(widget);
- result = g_binary_portion_query_tooltip(portions, x, y, &area, tooltip);
+ result = g_portion_layer_query_tooltip(layer, x, y, &area, tooltip);
+
+ g_object_unref(G_OBJECT(layer));
}
else result = FALSE;