diff options
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkblockview.c | 25 | ||||
-rw-r--r-- | src/gtkext/gtkbufferview.c | 1 | ||||
-rw-r--r-- | src/gtkext/gtkgraphview.c | 41 | ||||
-rw-r--r-- | src/gtkext/gtksourceview.c | 2 |
4 files changed, 64 insertions, 5 deletions
diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c index 1c7ba43..2b72ff4 100644 --- a/src/gtkext/gtkblockview.c +++ b/src/gtkext/gtkblockview.c @@ -43,6 +43,10 @@ struct _GtkBlockViewClass { GtkBufferViewClass parent; /* A laisser en premier */ + /* Signaux */ + + void (* highlight_changed) (GtkBlockView *); + }; @@ -99,6 +103,14 @@ static void gtk_block_view_class_init(GtkBlockViewClass *class) buffer_class->notify_caret = (notify_caret_relocation_fc)gtk_block_view_notify_caret_relocation; + g_signal_new("highlight-changed", + GTK_TYPE_BLOCK_VIEW, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GtkBlockViewClass, highlight_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + } @@ -143,8 +155,15 @@ static void gtk_block_view_init(GtkBlockView *view) static bool gtk_block_view_notify_caret_relocation(GtkBlockView *view, const GdkRectangle *area, const vmpa2t *addr) { - return g_buffer_view_highlight_segments(GTK_BUFFER_VIEW(view)->buffer_view, area->x, area->y, - GTK_VIEW_PANEL(view)->display); + bool result; /* Bilan à retourner */ + + result = g_buffer_view_highlight_segments(GTK_BUFFER_VIEW(view)->buffer_view, area->x, area->y, + GTK_VIEW_PANEL(view)->display); + + if (result) + g_signal_emit_by_name(view, "highlight-changed"); + + return result; } @@ -260,7 +279,7 @@ static void gtk_block_view_attach_binary(GtkBlockView *view, GLoadedBinary *bina GBufferView *bview; /* Vue sur ce même tampon */ buffer = g_loaded_binary_get_disassembled_buffer(binary); - bview = g_buffer_view_new(buffer); + bview = g_buffer_view_new(buffer, NULL); gtk_buffer_view_attach_buffer(GTK_BUFFER_VIEW(view), bview); diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index 54c521e..f54ecff 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -423,6 +423,7 @@ static gboolean gtk_buffer_view_draw(GtkWidget *widget, cairo_t *cr) gtk_buffer_view_compute_fake_coord(view, &fake_x, &fake_y); g_generic_config_get_value(get_main_configuration(), MPK_SELECTION_LINE, &sel_line); + sel_line &= gtk_widget_has_focus(widget); if (!sel_line || view->caret_addr == NULL) selected = NULL; diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c index 6d7ab0d..e0eb870 100644 --- a/src/gtkext/gtkgraphview.c +++ b/src/gtkext/gtkgraphview.c @@ -46,6 +46,7 @@ struct _GtkGraphView vmpa_t start; /* Début de la portion vue */ /* FIXME : à garder ? */ vmpa_t end; /* Fin de la portion affichée */ /* FIXME : à garder ? */ + segcnt_list *highlighted; /* Segments mis en évidence */ GtkBufferView **children; /* Liste des sous-blocs */ GtkAllocation *allocs; /* Emplacements prévisibles */ size_t children_count; /* Taille de cette liste */ @@ -99,6 +100,9 @@ static void gtk_graph_view_reset(GtkGraphView *); /* Définit la liste complète des éléments du futur graphique. */ static GtkBufferView **gtk_graph_view_load_nodes(GtkGraphView *, GLoadedBinary *, const GBinRoutine *); +/* Notifie un changement de surbrillance au sein d'un noeud. */ +static void gtk_graph_view_changed_highlights(GtkBlockView *, GtkGraphView *); + /* Notifie une incapacité de déplacement au sein d'un noeud. */ static void gtk_graph_view_reach_caret_limit(GtkBufferView *, GdkScrollDirection, GtkGraphView *); @@ -348,6 +352,8 @@ static void gtk_graph_view_define_main_address(GtkGraphView *view, const vmpa2t view->routine = routines[i]; g_object_ref(G_OBJECT(view->routine)); + view->highlighted = init_segment_content_list(); + view->children = gtk_graph_view_load_nodes(view, GTK_VIEW_PANEL(view)->binary, routines[i]); @@ -557,6 +563,9 @@ static void gtk_graph_view_reset(GtkGraphView *view) } */ + if (view->highlighted) + exit_segment_content_list(view->highlighted); + for (i = 0; i < view->children_count; i++) { g_signal_handlers_disconnect_by_func(view->children[i], gtk_graph_view_reach_caret_limit, view); @@ -618,6 +627,7 @@ static GtkBufferView **gtk_graph_view_load_nodes(GtkGraphView *view, GLoadedBina { result[i] = GTK_VIEW_PANEL(gtk_block_view_new()); g_signal_connect(result[i], "reach-limit", G_CALLBACK(gtk_graph_view_reach_caret_limit), view); + g_signal_connect(result[i], "highlight-changed", G_CALLBACK(gtk_graph_view_changed_highlights), view); gtk_widget_show(GTK_WIDGET(result[i])); gtk_view_panel_attach_binary(result[i], binary, BVW_BLOCK); @@ -626,7 +636,7 @@ static GtkBufferView **gtk_graph_view_load_nodes(GtkGraphView *view, GLoadedBina g_flow_block_get_boundary_addresses(G_FLOW_BLOCK(blocks[i]), &first, &last); - subview = g_buffer_view_new(buffer); + subview = g_buffer_view_new(buffer, view->highlighted); g_buffer_view_restrict(subview, &first, &last); gtk_buffer_view_attach_buffer(GTK_BUFFER_VIEW(result[i]), subview); @@ -640,6 +650,35 @@ static GtkBufferView **gtk_graph_view_load_nodes(GtkGraphView *view, GLoadedBina /****************************************************************************** * * * Paramètres : node = composant d'affichage GTK impliqué dans la procédure. * +* view = support graphique de tous les noeuds. * +* * +* Description : Notifie un changement de surbrillance au sein d'un noeud. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_graph_view_changed_highlights(GtkBlockView *node, GtkGraphView *view) +{ + size_t i; /* Boucle de parcours */ + + for (i = 0; i < view->children_count; i++) + { + if (view->children[i] == node) + continue; + + gtk_widget_queue_draw(GTK_WIDGET(view->children[i])); + + } + +} + + +/****************************************************************************** +* * +* Paramètres : node = composant d'affichage GTK impliqué dans la procédure. * * dir = direction du déplacement souhaité et impossible. * * view = support graphique de tous les noeuds. * * * diff --git a/src/gtkext/gtksourceview.c b/src/gtkext/gtksourceview.c index 113b9bb..254f798 100644 --- a/src/gtkext/gtksourceview.c +++ b/src/gtkext/gtksourceview.c @@ -151,6 +151,6 @@ static void gtk_source_view_attach_binary(GtkSourceView *view, GLoadedBinary *bi /* Si une source existe... */ if (buffer != NULL) - gtk_buffer_view_attach_buffer(GTK_BUFFER_VIEW(view), g_buffer_view_new(buffer)); + gtk_buffer_view_attach_buffer(GTK_BUFFER_VIEW(view), g_buffer_view_new(buffer, NULL)); } |