diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2018-12-21 14:58:27 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2018-12-21 14:58:27 (GMT) | 
| commit | 223c2d906ccdb1ae680a474884448c799878a06f (patch) | |
| tree | 7da08923299dfd950e34f4041e6967d1000c8f99 /src/gtkext/gtkgraphdisplay.c | |
| parent | 6a444b273cf812c080c57d36a43436bf4aa4d55e (diff) | |
Updated the graph view when updating the current location.
Diffstat (limited to 'src/gtkext/gtkgraphdisplay.c')
| -rw-r--r-- | src/gtkext/gtkgraphdisplay.c | 51 | 
1 files changed, 13 insertions, 38 deletions
| diff --git a/src/gtkext/gtkgraphdisplay.c b/src/gtkext/gtkgraphdisplay.c index 0aee486..a991ace 100644 --- a/src/gtkext/gtkgraphdisplay.c +++ b/src/gtkext/gtkgraphdisplay.c @@ -111,8 +111,8 @@ static gboolean gtk_graph_display_button_release(GtkWidget *, GdkEventButton *,  /* Assure la suivi des déplacements de souris sur le composant. */  static gboolean gtk_graph_display_motion_notify(GtkWidget *, GdkEventMotion *, GtkGraphDisplay *); -/* Réagit à la sélection externe d'une adresse. */ -static void gtk_graph_display_define_main_address(GtkGraphDisplay *, const vmpa2t *); +/* Ajuste au besoin la zone affichée pour un curseur. */ +static void gtk_graph_display_prepare_for_cursor(GtkGraphDisplay *, const GLineCursor *);  /* Indique la position d'affichage d'un emplacement donné. */  static bool gtk_graph_display_get_cursor_coordinates(const GtkGraphDisplay *, const GLineCursor *, gint *, gint *, ScrollPositionTweak); @@ -123,9 +123,6 @@ static bool gtk_graph_display_move_caret_to(GtkGraphDisplay *, gint, gint);  /* Fournit le position courante dans un panneau de chargement. */  static GLineCursor *gtk_graph_display_get_cursor(const GtkGraphDisplay *); -/* Définit le position courante dans un panneau de chargement. */ -static void gtk_graph_display_set_cursor(GtkGraphDisplay *, const GLineCursor *); -  /* Place en cache un rendu destiné à l'aperçu graphique rapide. */  static void gtk_graph_display_cache_glance(GtkGraphDisplay *, cairo_t *, const GtkAllocation *, double); @@ -175,12 +172,11 @@ static void gtk_graph_display_class_init(GtkGraphDisplayClass *class)      panel_class->compute_size = (compute_requested_size_fc)gtk_graph_display_compute_requested_size;      panel_class->adjust = (adjust_scroll_value_fc)gtk_graph_display_adjust_scroll_value; -    panel_class->define = (define_address_fc)gtk_graph_display_define_main_address; +    panel_class->prepare = (prepare_for_cursor_fc)gtk_graph_display_prepare_for_cursor;      panel_class->get_coordinates = (get_coordinates_fc)gtk_graph_display_get_cursor_coordinates;      panel_class->move_caret_to = (move_caret_to_fc)gtk_graph_display_move_caret_to;      panel_class->get_cursor = (get_cursor_fc)gtk_graph_display_get_cursor; -    panel_class->set_cursor = (set_cursor_fc)gtk_graph_display_set_cursor;      panel_class->cache_glance = (cache_glance_fc)gtk_graph_display_cache_glance;  } @@ -587,9 +583,9 @@ static gboolean gtk_graph_display_motion_notify(GtkWidget *widget, GdkEventMotio  /******************************************************************************  *                                                                             *  *  Paramètres  : display = composant GTK à mettre à jour.                     * -*                addr    = adresse sélectionnée de manière externe.           * +*                cursor  = emplacement à présenter à l'écran.                 *  *                                                                             * -*  Description : Réagit à la sélection externe d'une adresse.                 * +*  Description : Ajuste au besoin la zone affichée pour un curseur.           *  *                                                                             *  *  Retour      : -                                                            *  *                                                                             * @@ -597,8 +593,9 @@ static gboolean gtk_graph_display_motion_notify(GtkWidget *widget, GdkEventMotio  *                                                                             *  ******************************************************************************/ -static void gtk_graph_display_define_main_address(GtkGraphDisplay *display, const vmpa2t *addr) +static void gtk_graph_display_prepare_for_cursor(GtkGraphDisplay *display, const GLineCursor *cursor)  { +    vmpa2t addr;                            /* Adresse ciblée              */      bool need_update;                       /* Mise à jour du contenu ?    */      const mrange_t *range;                  /* Couverture courante         */      GExeFormat *format;                     /* Type de fichier chargé      */ @@ -610,12 +607,16 @@ static void gtk_graph_display_define_main_address(GtkGraphDisplay *display, cons      gint bottom;                            /* Ordonnée du coin inférieur  */      GtkWidget *child;                       /* Composant sélectionné       */ +    assert(G_IS_BINARY_CURSOR(cursor)); + +    g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr); +      if (display->routine == NULL)          need_update = true;      else      {          range = g_binary_symbol_get_range(display->routine); -        need_update = !mrange_contains_addr(range, addr); +        need_update = !mrange_contains_addr(range, &addr);      }      if (need_update) @@ -624,7 +625,7 @@ static void gtk_graph_display_define_main_address(GtkGraphDisplay *display, cons          format = g_loaded_binary_get_format(GTK_DISPLAY_PANEL(display)->binary); -        found = g_binary_format_find_symbol_for(G_BIN_FORMAT(format), addr, &symbol); +        found = g_binary_format_find_symbol_for(G_BIN_FORMAT(format), &addr, &symbol);          if (!found)              goto ggddma_done; @@ -826,32 +827,6 @@ static GLineCursor *gtk_graph_display_get_cursor(const GtkGraphDisplay *display)  /******************************************************************************  *                                                                             * -*  Paramètres  : display = composant GTK à mettre à jour.                     * -*                cursor  = informations relatives à la position du curseur.   * -*                                                                             * -*  Description : Définit le position courante dans un panneau de chargement.  * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void gtk_graph_display_set_cursor(GtkGraphDisplay *display, const GLineCursor *cursor) -{ -    vmpa2t addr;                            /* Adresse ciblée              */ - -    assert(G_IS_BINARY_CURSOR(cursor)); - -    g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr); - -    gtk_graph_display_define_main_address(display, &addr); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : display = composant GTK à manipuler.                         *  *                cr      = assistant pour la création de rendus.              *  *                area    = taille de la surface réduite à disposition.        * | 
