diff options
Diffstat (limited to 'src/gui')
| -rw-r--r-- | src/gui/dialogs/export_disass.c | 37 | 
1 files changed, 21 insertions, 16 deletions
| diff --git a/src/gui/dialogs/export_disass.c b/src/gui/dialogs/export_disass.c index 314b9cf..c15dcbc 100644 --- a/src/gui/dialogs/export_disass.c +++ b/src/gui/dialogs/export_disass.c @@ -41,6 +41,7 @@  #include "../../core/queue.h"  #include "../../glibext/seq.h"  #include "../../gtkext/easygtk.h" +#include "../../gtkext/gtkblockdisplay.h" @@ -60,14 +61,14 @@ typedef struct _export_info_t      buffer_export_context *ctx;             /* Contexte d'exportation      */      BufferExportType type;                  /* Type d'exportation menée    */ -    bool display[BLC_COUNT];                /* Paramètres d'affichage      */ +    GDisplayOptions *options;               /* Paramètres d'affichage      */      activity_id_t msg;                      /* Message de progression      */  } export_info_t;  /* Lance l'exportation d'un contenu binaire comme demandé. */ -static void start_binary_export(GBufferCache *, buffer_export_context *, BufferExportType, const bool *); +static void start_binary_export(GBufferCache *, buffer_export_context *, BufferExportType, GDisplayOptions *);  /* Réalise l'exportation d'une ligne particulière. */  static void export_one_binary_line(const export_info_t *, size_t, GtkStatusStack *, activity_id_t); @@ -211,8 +212,9 @@ static void export_assistant_close(GtkAssistant *assistant, GObject *ref)      GtkEntry *entry;                        /* Zone de saisie              */      const gchar *filename;                  /* Chemin d'accès du fichier   */      GtkToggleButton *checkbutton;           /* Coche à retrouver           */ -    bool display[BLC_DISPLAY];              /* Affichage à garantir        */      GLoadedBinary *binary;                  /* Binaire chargé à parcourir  */ +    GDisplayOptions *template;              /* Options courantes           */ +    GDisplayOptions *options;               /* Options d'affichage         */      GBufferCache *cache;                    /* Tampon de code à traiter    */      GObject *support;                       /* Support interne à supprimer */ @@ -236,14 +238,20 @@ static void export_assistant_close(GtkAssistant *assistant, GObject *ref)      /* Eléments à afficher */ +    binary = G_LOADED_BINARY(g_object_get_data(ref, "binary")); + +    template = g_loaded_content_get_display_options(G_LOADED_CONTENT(binary), BVW_BLOCK); +    options = g_display_options_dup(template); +    g_object_unref(G_OBJECT(template)); +      checkbutton = GTK_TOGGLE_BUTTON(g_object_get_data(ref, "physical_off")); -    display[BLC_PHYSICAL] = gtk_toggle_button_get_active(checkbutton); +    g_display_options_set(options, BLC_PHYSICAL, gtk_toggle_button_get_active(checkbutton));      checkbutton = GTK_TOGGLE_BUTTON(g_object_get_data(ref, "virtual_addr")); -    display[BLC_VIRTUAL] = gtk_toggle_button_get_active(checkbutton); +    g_display_options_set(options, BLC_VIRTUAL, gtk_toggle_button_get_active(checkbutton));      checkbutton = GTK_TOGGLE_BUTTON(g_object_get_data(ref, "binary_code")); -    display[BLC_BINARY] = gtk_toggle_button_get_active(checkbutton); +    g_display_options_set(options, BLC_BINARY, gtk_toggle_button_get_active(checkbutton));      /* Options éventuelles */ @@ -275,11 +283,9 @@ static void export_assistant_close(GtkAssistant *assistant, GObject *ref)      /* Programmation de la tâche */ -    binary = G_LOADED_BINARY(g_object_get_data(ref, "binary")); -      cache = g_loaded_binary_get_disassembly_cache(binary); -    start_binary_export(cache, &ctx, type, display); +    start_binary_export(cache, &ctx, type, options);      g_object_unref(G_OBJECT(cache)); @@ -301,7 +307,7 @@ static void export_assistant_close(GtkAssistant *assistant, GObject *ref)  *  Paramètres  : cache    = tampon de données à utiliser.                     *  *                template = paramètres dont s'inspirer pour l'exportation.    *  *                type     = type d'exportation attendue.                      * -*                display  = règles d'affichage des colonnes modulables.       * +*                options  = règles d'affichage des colonnes modulables.       *  *                                                                             *  *  Description : Lance l'exportation d'un contenu binaire comme demandé.      *  *                                                                             * @@ -311,10 +317,9 @@ static void export_assistant_close(GtkAssistant *assistant, GObject *ref)  *                                                                             *  ******************************************************************************/ -static void start_binary_export(GBufferCache *cache, buffer_export_context *template, BufferExportType type, const bool *display) +static void start_binary_export(GBufferCache *cache, buffer_export_context *template, BufferExportType type, GDisplayOptions *options)  {      export_info_t *info;                    /* Infos à faire circuler      */ -    BufferLineColumn i;                     /* Boucle de parcours          */      GWorkQueue *queue;                      /* Gestionnaire de différés    */      size_t count;                           /* Quantité de lignes à traiter*/      GSeqWork *work;                         /* Tâche de chargement à lancer*/ @@ -347,9 +352,7 @@ static void start_binary_export(GBufferCache *cache, buffer_export_context *temp      }      info->type = type; - -    for (i = 0; i < BLC_DISPLAY; i++) -        info->display[i] = display[i]; +    info->options = options;      /* Données exportées initiales */ @@ -421,7 +424,7 @@ static void export_one_binary_line(const export_info_t *info, size_t i, GtkStatu      line = g_buffer_cache_find_line_by_index(info->cache, i); -    g_buffer_line_export(line, info->ctx, info->type, info->display); +    g_buffer_line_export(line, info->ctx, info->type, info->options);      g_object_unref(G_OBJECT(line)); @@ -463,6 +466,8 @@ static void on_binary_export_completed(GSeqWork *work, export_info_t *info)      g_buffer_cache_unlock(info->cache);      g_object_unref(G_OBJECT(info->cache)); +    g_object_unref(G_OBJECT(info->options)); +      close(info->ctx->fd);      switch (info->type) | 
