diff options
Diffstat (limited to 'src/gui/core/items.c')
-rw-r--r-- | src/gui/core/items.c | 158 |
1 files changed, 44 insertions, 114 deletions
diff --git a/src/gui/core/items.c b/src/gui/core/items.c index a25d1b9..ad2de2c 100644 --- a/src/gui/core/items.c +++ b/src/gui/core/items.c @@ -34,14 +34,11 @@ static GEditorItem *_editem_list = NULL; -/* Suit les changements de focus des panneaux d'affichage. */ -static gboolean notify_view_panel_focus_change(GLoadedPanel *, GdkEventFocus *, gpointer); - /* Lance une procédure de déplacement de la position courante. */ static void start_moving_to_cursor_in_loaded_panel(GLoadedPanel *, const GLineCursor *, gboolean, gpointer); /* Suit les changements de position dans du code d'assembleur. */ -static void track_caret_address_on_view_panel(GtkDisplayPanel *, const vmpa2t *, gpointer); +static void track_cursor_on_view_panel(GLoadedPanel *, const GLineCursor *, gpointer); @@ -66,9 +63,9 @@ void register_editor_item(GEditorItem *item) /****************************************************************************** * * -* Paramètres : binary = nouvelle instance de binaire analysé. * +* Paramètres : content = nouvelle instance de contenu analysé. * * * -* Description : Lance une actualisation du fait d'un changement de binaire. * +* Description : Lance une actualisation du fait d'un changement de contenu. * * * * Retour : - * * * @@ -76,49 +73,26 @@ void register_editor_item(GEditorItem *item) * * ******************************************************************************/ -void change_editor_items_current_binary(GLoadedBinary *binary) +void change_editor_items_current_content(GLoadedContent *content) { + GLoadedContent *old; /* Ancien contenu */ GEditorItem *iter; /* Boucle de parcours */ - GEditorItemClass *klass; /* Classe correspondante */ - set_current_binary(binary); + old = get_current_content(); - editem_list_for_each(iter, _editem_list) + if (content != old) { - klass = G_EDITOR_ITEM_GET_CLASS(iter); - - if (klass->update_binary != NULL) - klass->update_binary(iter, binary); - - } - -} - - -/****************************************************************************** -* * -* Paramètres : panel = composant d'affichage concerné par l'opération. * -* event = informations liées à l'événement. * -* unused = adresse non utilisée ici. * -* * -* Description : Suit les changements de focus des panneaux d'affichage. * -* * -* Retour : FALSE pour continuer la propagation. * -* * -* Remarques : - * -* * -******************************************************************************/ + set_current_content(content); -static gboolean notify_view_panel_focus_change(GLoadedPanel *panel, GdkEventFocus *event, gpointer unused) -{ - GEditorItem *iter; /* Boucle de parcours */ + editem_list_for_each(iter, _editem_list) + { + g_editor_item_change_content(iter, old, content); + } - editem_list_for_each(iter, _editem_list) - { - notify_focus_change_for_editor_item(iter, event->in ? panel : NULL); } - return FALSE; + if (old != NULL) + g_object_unref(G_OBJECT(old)); } @@ -157,7 +131,7 @@ static void start_moving_to_cursor_in_loaded_panel(GLoadedPanel *panel, const GL } else - gtk_display_panel_scroll_to_cursor(panel, cursor, SPT_CENTER); + g_loaded_panel_scroll_to_cursor(panel, cursor, SPT_CENTER, true); if (src != NULL) g_object_unref(G_OBJECT(src)); @@ -168,7 +142,7 @@ static void start_moving_to_cursor_in_loaded_panel(GLoadedPanel *panel, const GL /****************************************************************************** * * * Paramètres : panel = composant d'affichage parcouru. * -* addr = nouvelle adresse du curseur courant. * +* cursor = nouvel emplacement du curseur courant. * * unused = adresse non utilisée ici. * * * * Description : Suit les changements de position dans du code d'assembleur. * @@ -179,18 +153,13 @@ static void start_moving_to_cursor_in_loaded_panel(GLoadedPanel *panel, const GL * * ******************************************************************************/ -static void track_caret_address_on_view_panel(GtkDisplayPanel *panel, const vmpa2t *addr, gpointer unused) +static void track_cursor_on_view_panel(GLoadedPanel *panel, const GLineCursor *cursor, gpointer unused) { GEditorItem *iter; /* Boucle de parcours */ - GEditorItemClass *klass; /* Classe correspondante */ editem_list_for_each(iter, _editem_list) { - klass = G_EDITOR_ITEM_GET_CLASS(iter); - - if (klass->track_caret != NULL) - klass->track_caret(iter, panel, addr); - + g_editor_item_track_cursor(iter, panel, cursor); } } @@ -210,59 +179,32 @@ static void track_caret_address_on_view_panel(GtkDisplayPanel *panel, const vmpa void change_editor_items_current_view(GLoadedPanel *panel) { - GLoadedPanel *view; /* Affichage actif */ + GLoadedPanel *old; /* Ancien affichage */ GEditorItem *iter; /* Boucle de parcours */ - GEditorItemClass *klass; /* Classe correspondante */ - GObject *caret; /* Support du curseur actif */ /* Suivi des affichages */ - view = get_current_view(); + old = get_current_view(); - if (view != NULL) + if (panel != old) { - g_signal_handlers_disconnect_by_func(view, G_CALLBACK(notify_view_panel_focus_change), NULL); - g_signal_handlers_disconnect_by_func(view, G_CALLBACK(notify_view_panel_focus_change), NULL); + set_current_view(panel); - g_object_unref(view); - - } - - set_current_view(panel); - - editem_list_for_each(iter, _editem_list) - { - klass = G_EDITOR_ITEM_GET_CLASS(iter); - - if (klass->update_view != NULL) - klass->update_view(iter, panel); - - } - - if (panel != NULL) - { - g_signal_connect(panel, "focus-in-event", G_CALLBACK(notify_view_panel_focus_change), NULL); - g_signal_connect(panel, "focus-out-event", G_CALLBACK(notify_view_panel_focus_change), NULL); - } + editem_list_for_each(iter, _editem_list) + { + g_editor_item_change_view(iter, old, panel); + } - /* Suivi du curseur */ + /* Suivi du curseur */ - if (GTK_IS_DISPLAY_PANEL(panel)) - { - caret = get_caret_instance(); - - if (caret != NULL) + if (old != NULL) { - g_signal_handlers_disconnect_by_func(caret, + g_signal_handlers_disconnect_by_func(old, G_CALLBACK(start_moving_to_cursor_in_loaded_panel), NULL); - g_signal_handlers_disconnect_by_func(caret, - G_CALLBACK(track_caret_address_on_view_panel), + g_signal_handlers_disconnect_by_func(old, + G_CALLBACK(track_cursor_on_view_panel), NULL); - - set_caret_instance(NULL); - g_object_unref(caret); - } if (panel != NULL) @@ -271,19 +213,16 @@ void change_editor_items_current_view(GLoadedPanel *panel) G_CALLBACK(start_moving_to_cursor_in_loaded_panel), NULL); - g_signal_connect(panel, "caret-moved", - G_CALLBACK(track_caret_address_on_view_panel), + g_signal_connect(panel, "cursor-moved", + G_CALLBACK(track_cursor_on_view_panel), NULL); - - caret = G_OBJECT(panel); - - g_object_ref(caret); - set_caret_instance(caret); - } } + if (old != NULL) + g_object_unref(G_OBJECT(old)); + } @@ -299,18 +238,13 @@ void change_editor_items_current_view(GLoadedPanel *panel) * * ******************************************************************************/ -void change_editor_items_current_view_content(GLoadedPanel *panel) +void update_editor_items_current_view(GLoadedPanel *panel) { GEditorItem *iter; /* Boucle de parcours */ - GEditorItemClass *klass; /* Classe correspondante */ editem_list_for_each(iter, _editem_list) { - klass = G_EDITOR_ITEM_GET_CLASS(iter); - - if (klass->update_content != NULL) - klass->update_content(iter, panel); - + g_editor_item_update_view(iter, panel); } } @@ -318,9 +252,9 @@ void change_editor_items_current_view_content(GLoadedPanel *panel) /****************************************************************************** * * -* Paramètres : binary = binaire contenant l'adresse à représenter. * -* addr = adresse mémoire à mettre en avant. * -* source = composant à l'origine du changement. * +* Paramètres : content = contenu contenant le curseur à représenter. * +* cursor = nouvel emplacement du curseur courant. * +* source = composant à l'origine du changement. * * * * Description : Concentre l'attention de l'ensemble sur une adresse donnée. * * * @@ -330,18 +264,14 @@ void change_editor_items_current_view_content(GLoadedPanel *panel) * * ******************************************************************************/ -void focus_address_in_editor_items(GLoadedBinary *binary, const vmpa2t *addr, GEditorItem *source) +void focus_cursor_in_editor_items(GLoadedContent *content, const GLineCursor *cursor, GEditorItem *source) { GEditorItem *iter; /* Boucle de parcours */ - GEditorItemClass *klass; /* Classe correspondante */ editem_list_for_each(iter, _editem_list) { - klass = G_EDITOR_ITEM_GET_CLASS(iter); - - if (klass->focus_addr != NULL && iter != source) - klass->focus_addr(iter, binary, addr); - + if (iter != source) + g_editor_item_focus_cursor(iter, content, cursor); } } |