From 3ab6797d68162c6094964ad0c5c7e194bee06b80 Mon Sep 17 00:00:00 2001 From: jaortega Date: Tue, 13 Mar 2001 22:21:16 +0000 Subject: minor changes --- mixgtk/mixgtk_mixvm.c | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) (limited to 'mixgtk/mixgtk_mixvm.c') diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c index 1ef32a5..c90b453 100644 --- a/mixgtk/mixgtk_mixvm.c +++ b/mixgtk/mixgtk_mixvm.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mixgtk_mixvm.c : * Implementation of the functions declared in mixgtk_mixvm.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "01/03/13 00:24:56 jose" + * Last change: Time-stamp: "01/03/13 23:14:00 jose" * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -39,21 +39,25 @@ static GtkLabel *laptime_; static GtkLabel *progtime_; static GtkLabel *uptime_; static mix_vm_t *vm_; - +static GtkTooltips *tips_; static void update_register_ (mixgtk_widget_id_t reg) { static gchar BUFFER[20]; + mix_word_t tipval = MIX_WORD_ZERO; switch (reg) { case MIXGTK_WIDGET_rA: - mix_word_print_to_buffer (mix_vm_get_rA (vm_), BUFFER); + tipval = mix_vm_get_rA (vm_); + mix_word_print_to_buffer (tipval, BUFFER); break; case MIXGTK_WIDGET_rX: - mix_word_print_to_buffer (mix_vm_get_rX (vm_), BUFFER); + tipval = mix_vm_get_rX (vm_); + mix_word_print_to_buffer (tipval, BUFFER); break; case MIXGTK_WIDGET_rJ: + tipval = mix_short_to_word_fast (mix_vm_get_rJ (vm_)); mix_short_print_to_buffer (mix_vm_get_rJ (vm_), BUFFER); break; case MIXGTK_WIDGET_rI1: @@ -62,14 +66,22 @@ update_register_ (mixgtk_widget_id_t reg) case MIXGTK_WIDGET_rI4: case MIXGTK_WIDGET_rI5: case MIXGTK_WIDGET_rI6: - mix_short_print_to_buffer (mix_vm_get_rI (vm_, - reg - MIXGTK_WIDGET_rI1 + 1), - BUFFER); + { + gint k = reg - MIXGTK_WIDGET_rI1 + 1; + tipval = mix_short_to_word_fast (mix_vm_get_rI (vm_, k)); + mix_short_print_to_buffer (mix_vm_get_rI (vm_, k), BUFFER); + } break; default: g_assert_not_reached (); } gtk_entry_set_text (reg_entries_[reg - MIXGTK_WIDGET_rA], BUFFER); + snprintf (BUFFER, 20, "%s%ld", mix_word_is_negative (tipval)? "-" : "", + mix_word_magnitude (tipval)); + gtk_tooltips_set_tip (tips_, + GTK_WIDGET (reg_entries_[reg - MIXGTK_WIDGET_rA]), + BUFFER, NULL); + } @@ -92,6 +104,8 @@ mixgtk_mixvm_init (mix_vm_t *vm) g_return_val_if_fail (vm != NULL, FALSE); vm_ = vm; + tips_ = gtk_tooltips_new (); + for (k = 0; k < REGISTER_NO_; ++k) { reg_entries_[k] = @@ -323,7 +337,7 @@ register_i_ (mix_word_t w, gpointer reg) update_register_ (MIXGTK_WIDGET_rI1 - 1 + GPOINTER_TO_INT (reg)); } -void +gboolean on_register_click (GtkWidget *w, GdkEvent *e, gpointer data) { enum {SIZE = 20}; @@ -348,4 +362,25 @@ on_register_click (GtkWidget *w, GdkEvent *e, gpointer data) break; } } + return FALSE; +} + +static void +mem_cell_ (mix_word_t w, gpointer a) +{ + mix_short_t addr = mix_short_new (GPOINTER_TO_INT (a)); + mix_vm_set_addr_contents (vm_, addr, w); + mixgtk_mixvm_update_cells (); +} + +void +on_memory_cells_select_row (GtkCList *w, gint row, gint col, + GdkEvent *e, gpointer data) +{ + enum {SIZE = 20}; + static gchar BUFFER[SIZE]; + snprintf (BUFFER, SIZE, "Memory cell no. %d", row); + mixgtk_input_word (BUFFER, + mix_vm_get_addr_contents (vm_, mix_short_new (row)), + mem_cell_, GINT_TO_POINTER (row)); } -- cgit v1.2.3