diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-09-16 20:08:57 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-09-16 20:08:57 (GMT) |
commit | af083f8bd6da340214ae392451dde5782fb79039 (patch) | |
tree | ffc45880157f4fdd986b1e16aa6498bef149185a /src/gtkext | |
parent | 74642fbdeefaec21885e5fb6cad432e3e3b47cdb (diff) |
Used the new vmpa_t type in binary portions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@405 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkbinarystrip.c | 38 | ||||
-rw-r--r-- | src/gtkext/gtkbinarystrip.h | 3 | ||||
-rw-r--r-- | src/gtkext/gtkbufferview.c | 2 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel-int.h | 2 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel.c | 4 |
5 files changed, 37 insertions, 12 deletions
diff --git a/src/gtkext/gtkbinarystrip.c b/src/gtkext/gtkbinarystrip.c index 4ed5cf9..e0016d2 100644 --- a/src/gtkext/gtkbinarystrip.c +++ b/src/gtkext/gtkbinarystrip.c @@ -36,7 +36,7 @@ struct _GtkBinaryStrip GLoadedBinary *binary; /* Binaire à représenter */ gint display_pos; /* Position à l'écran */ - gint cursor_addr; /* Adresse de la position */ + vmpa2t cursor_addr; /* Adresse de la position */ gint cursor_pos; /* Position à l'écran */ }; @@ -46,7 +46,7 @@ struct _GtkBinaryStripClass { GtkDrawingAreaClass parent; /* A laisser en premier */ - void (* select_address) (GtkBinaryStrip *, vmpa_t); + void (* select_address) (GtkBinaryStrip *); }; @@ -111,8 +111,8 @@ static void gtk_binary_strip_class_init(GtkBinaryStripClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(GtkBinaryStripClass, select_address), NULL, NULL, - g_cclosure_user_marshal_VOID__UINT64, - G_TYPE_NONE, 1, G_TYPE_UINT64); + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } @@ -229,7 +229,7 @@ static void gtk_binary_strip_size_allocate(GtkWidget *widget, GtkAllocation *all 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_binary_portion_get_pos_from_addr(portions, &strip->cursor_addr, &area, &strip->cursor_pos)) strip->cursor_pos = 0; } @@ -256,7 +256,7 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto GExeFormat *format; /* Format du binaire */ GBinPortion *portions; /* Portions binaires à dessiner*/ GdkRectangle area; /* Surface du composant */ - vmpa_t addr; /* Adresse à sélectionner */ + vmpa2t addr; /* Adresse à sélectionner */ if (event->x < 0 || event->y < 0) return FALSE; @@ -278,12 +278,15 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto if (g_binary_portion_get_addr_from_pos(portions, event->x, &area, &addr)) { - strip->cursor_addr = addr; + copy_vmpa(&strip->cursor_addr, &addr); strip->cursor_pos = event->x; gtk_widget_queue_draw(GTK_WIDGET(strip)); - g_signal_emit_by_name(strip, "select-address", addr); + 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"); } @@ -441,6 +444,25 @@ void gtk_binary_strip_attach(GtkBinaryStrip *strip, GLoadedBinary *binary) /****************************************************************************** * * +* Paramètres : strip = composant GTK à consulter. * +* * +* Description : Indique l'adresse physique et virtuelle représentée. * +* * +* Retour : Localisation, initialisée ou non. * +* * +* Remarques : - * +* * +******************************************************************************/ + +const vmpa2t *gtk_binary_strip_get_location(const GtkBinaryStrip *strip) +{ + return &strip->cursor_addr; + +} + + +/****************************************************************************** +* * * Paramètres : strip = composant GTK à mettre à jour. * * binary = nouveau contenu binaire à représenter. * * * diff --git a/src/gtkext/gtkbinarystrip.h b/src/gtkext/gtkbinarystrip.h index 09152a3..3f082f5 100644 --- a/src/gtkext/gtkbinarystrip.h +++ b/src/gtkext/gtkbinarystrip.h @@ -57,6 +57,9 @@ GtkWidget *gtk_binary_strip_new(void); /* Attache un nouveau binaire à la barre de représentation. */ void gtk_binary_strip_attach(GtkBinaryStrip *, GLoadedBinary *); +/* Indique l'adresse physique et virtuelle représentée. */ +const vmpa2t *gtk_binary_strip_get_location(const GtkBinaryStrip *); + #endif /* _GTKEXT_BINARYSTRIP_H */ diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index 87928b9..4b515b4 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -109,6 +109,7 @@ static void gtk_buffer_view_class_init(GtkBufferViewClass *class) widget_class->key_press_event = gtk_buffer_view_key_press; panel_class->compute_size = (compute_requested_size)gtk_buffer_view_compute_requested_size; + panel_class->get_coordinates = (get_addr_coordinates_fc)gtk_buffer_view_get_address_coordinates; g_signal_new("caret-moved", GTK_TYPE_BUFFER_VIEW, @@ -139,7 +140,6 @@ static void gtk_buffer_view_init(GtkBufferView *view) viewpanel = GTK_VIEW_PANEL(view); - viewpanel->get_coordinates = (get_addr_coordinates_fc)gtk_buffer_view_get_address_coordinates; viewpanel->cache_glance = (cache_glance_fc)gtk_buffer_view_cache_glance; view->caret.x = 10; diff --git a/src/gtkext/gtkviewpanel-int.h b/src/gtkext/gtkviewpanel-int.h index 1d55bf2..f89fdcf 100644 --- a/src/gtkext/gtkviewpanel-int.h +++ b/src/gtkext/gtkviewpanel-int.h @@ -70,7 +70,6 @@ struct _GtkViewPanel attach_binary_fc attach; /* Association avec un binaire */ define_address_fc define; /* Centrage sur une partie */ prepare_resize_fc resize; /* Prépare une nouvelle taille */ - get_addr_coordinates_fc get_coordinates;/* Conversion adresse <-> pos. */ cache_glance_fc cache_glance; /* Cache de la mignature */ bool *display_phys; /* Affichage des adresses ? */ @@ -85,6 +84,7 @@ struct _GtkViewPanelClass GtkFixedClass parent; /* A laisser en premier */ compute_requested_size compute_size; /* Calcul de la taille requise */ + get_addr_coordinates_fc get_coordinates;/* Conversion adresse <-> pos. */ }; diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c index 353022a..1933add 100644 --- a/src/gtkext/gtkviewpanel.c +++ b/src/gtkext/gtkviewpanel.c @@ -761,7 +761,7 @@ bool gtk_view_panel_contain_address(const GtkViewPanel *panel, vmpa_t addr) gint dummy_x; /* Abscisse pour l'appel */ gint dummy_y; /* Ordonnée pour l'appel */ - return panel->get_coordinates(panel, addr, &dummy_x, &dummy_y); + return GTK_VIEW_PANEL_GET_CLASS(panel)->get_coordinates(panel, addr, &dummy_x, &dummy_y); } @@ -794,7 +794,7 @@ void gtk_view_panel_scroll_to_address(GtkViewPanel *panel, const vmpa2t *addr) */ - if (panel->get_coordinates(panel, addr, &x, &y) && 0 /* ARG */) + if (GTK_VIEW_PANEL_GET_CLASS(panel)->get_coordinates(panel, addr, &x, &y)) { viewport = gtk_widget_get_parent(GTK_WIDGET(panel)); |