summaryrefslogtreecommitdiff
path: root/src/gtkext
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext')
-rw-r--r--src/gtkext/gtkbufferview.c4
-rw-r--r--src/gtkext/gtkstatusstack.c121
-rw-r--r--src/gtkext/gtkstatusstack.h2
3 files changed, 98 insertions, 29 deletions
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c
index 0d11de2..0e3beeb 100644
--- a/src/gtkext/gtkbufferview.c
+++ b/src/gtkext/gtkbufferview.c
@@ -296,8 +296,6 @@ static gboolean gtk_buffer_view_button_press(GtkWidget *widget, GdkEventButton *
view = GTK_BUFFER_VIEW(widget);
- gtk_widget_grab_focus(widget);
-
real_x = event->x;
real_y = event->y;
gtk_view_panel_compute_real_coord(GTK_VIEW_PANEL(view), &real_x, &real_y);
@@ -319,6 +317,8 @@ static gboolean gtk_buffer_view_button_press(GtkWidget *widget, GdkEventButton *
else
_gtk_buffer_view_move_caret_to(view, real_x, real_y);
+ gtk_widget_grab_focus(widget);
+
return FALSE;
}
diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c
index 148dd03..dbadb22 100644
--- a/src/gtkext/gtkstatusstack.c
+++ b/src/gtkext/gtkstatusstack.c
@@ -41,7 +41,7 @@
/* Navigation au sein d'assemblage */
-typedef struct _assembly_info assembly_info;
+typedef union _assembly_info assembly_info;
/* Abstration d'une gestion de barre de statut (instance) */
@@ -83,19 +83,25 @@ static void gtk_status_stack_switch(GtkStatusStack *, GtkWidget *);
/* Navigation au sein d'assemblage */
-struct _assembly_info
+union _assembly_info
{
- mrange_t current; /* Emplacement correspondant */
+ bool reset; /* Réinitialisation */
- char *segment; /* Segment d'appartenance */
+ struct
+ {
+ mrange_t current; /* Emplacement correspondant */
+
+ char *segment; /* Segment d'appartenance */
+
+ VMPA_BUFFER(phys); /* Localisation physique */
+ VMPA_BUFFER(virt); /* Localisation virtuelle */
- VMPA_BUFFER(phys); /* Localisation physique */
- VMPA_BUFFER(virt); /* Localisation virtuelle */
+ char *symbol; /* Eventuel symbole concerné */
- char *symbol; /* Eventuel symbole concerné */
+ const char *encoding; /* Encodage de l'instruction */
+ phys_t size; /* Taille de l'instruction */
- const char *encoding; /* Encodage de l'instruction */
- phys_t size; /* Taille de l'instruction */
+ };
};
@@ -167,6 +173,8 @@ static void gtk_status_stack_init(GtkStatusStack *stack)
stack->asm_status = build_assembly_status_stack(stack);
stack->asm_info = (assembly_info *)calloc(1, sizeof(assembly_info));
+ reset_assembly_info(stack->asm_info);
+
}
@@ -285,6 +293,8 @@ static void gtk_status_stack_switch(GtkStatusStack *stack, GtkWidget *next)
static void reset_assembly_info(assembly_info *info)
{
+ info->reset = true;
+
if (info->segment != NULL)
{
free(info->segment);
@@ -552,6 +562,31 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL
/******************************************************************************
* *
+* Paramètres : stack = barre de statut à actualiser. *
+* *
+* Description : Réinitialise les informations associées une position. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_status_stack_reset_current_instruction(GtkStatusStack *stack)
+{
+ assembly_info *info; /* Informations à constituer */
+
+ info = stack->asm_info;
+
+ reset_assembly_info(info);
+
+ gtk_status_stack_show_current_instruction(stack);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : stack = pile de statuts à manipuler. *
* *
* Description : S'assure de l'affichage à jour de la partie "assemblage". *
@@ -577,35 +612,67 @@ static void gtk_status_stack_show_current_instruction(GtkStatusStack *stack)
/* Première partie : navigation */
- label = GTK_LABEL(g_object_get_data(ref, "segment"));
- gtk_label_set_text(label, info->segment);
+ if (info->reset)
+ {
+ label = GTK_LABEL(g_object_get_data(ref, "segment"));
+ gtk_label_set_text(label, NULL);
+
+ label = GTK_LABEL(g_object_get_data(ref, "phys"));
+ gtk_label_set_text(label, NULL);
+
+ label = GTK_LABEL(g_object_get_data(ref, "virt"));
+ gtk_label_set_text(label, NULL);
- snprintf(raw_pos, sizeof(raw_pos), "phys: %s", info->phys);
+ label = GTK_LABEL(g_object_get_data(ref, "offset"));
+ gtk_label_set_text(label, NULL);
- label = GTK_LABEL(g_object_get_data(ref, "phys"));
- gtk_label_set_text(label, raw_pos);
+ }
+ else
+ {
+ label = GTK_LABEL(g_object_get_data(ref, "segment"));
+ gtk_label_set_text(label, info->segment);
- snprintf(raw_pos, sizeof(raw_pos), "virt: %s", info->virt);
+ snprintf(raw_pos, sizeof(raw_pos), "phys: %s", info->phys);
- label = GTK_LABEL(g_object_get_data(ref, "virt"));
- gtk_label_set_text(label, raw_pos);
+ label = GTK_LABEL(g_object_get_data(ref, "phys"));
+ gtk_label_set_text(label, raw_pos);
- label = GTK_LABEL(g_object_get_data(ref, "offset"));
- gtk_label_set_text(label, info->symbol != NULL ? info->symbol : "");
+ snprintf(raw_pos, sizeof(raw_pos), "virt: %s", info->virt);
+
+ label = GTK_LABEL(g_object_get_data(ref, "virt"));
+ gtk_label_set_text(label, raw_pos);
+
+ label = GTK_LABEL(g_object_get_data(ref, "offset"));
+ gtk_label_set_text(label, info->symbol != NULL ? info->symbol : "");
+
+ }
/* Seconde partie : architecture */
- label = GTK_LABEL(g_object_get_data(ref, "arch"));
- gtk_label_set_text(label, info->encoding);
+ if (info->reset)
+ {
+ label = GTK_LABEL(g_object_get_data(ref, "arch"));
+ gtk_label_set_text(label, NULL);
+
+ label = GTK_LABEL(g_object_get_data(ref, "size"));
+ gtk_label_set_text(label, NULL);
- if (info->size > 1)
- asprintf(&content, "%" PRIu64 " %s", (uint64_t)info->size, _("bytes"));
+ }
else
- asprintf(&content, "%" PRIu64 " %s", (uint64_t)info->size, _("byte"));
+ {
+ label = GTK_LABEL(g_object_get_data(ref, "arch"));
+ gtk_label_set_text(label, info->encoding);
+
+ if (info->size > 1)
+ asprintf(&content, "%" PRIu64 " %s", (uint64_t)info->size, _("bytes"));
+ else
+ asprintf(&content, "%" PRIu64 " %s", (uint64_t)info->size, _("byte"));
- label = GTK_LABEL(g_object_get_data(ref, "size"));
- gtk_label_set_text(label, content);
+ label = GTK_LABEL(g_object_get_data(ref, "size"));
+ gtk_label_set_text(label, content);
- free(content);
+ free(content);
+
+ }
}
diff --git a/src/gtkext/gtkstatusstack.h b/src/gtkext/gtkstatusstack.h
index 9d25c8f..8e93708 100644
--- a/src/gtkext/gtkstatusstack.h
+++ b/src/gtkext/gtkstatusstack.h
@@ -71,6 +71,8 @@ GtkWidget *gtk_status_stack_new(void);
/* Actualise les informations liées une position d'assemblage. */
void gtk_status_stack_update_current_instruction(GtkStatusStack *, const GLoadedBinary *, const GArchInstruction *);
+/* Réinitialise les informations associées une position. */
+void gtk_status_stack_reset_current_instruction(GtkStatusStack *);