From f40f9b8ac4eedc6b0ed6e5245a093d18710cf918 Mon Sep 17 00:00:00 2001 From: jaortega Date: Sat, 10 Mar 2001 02:34:32 +0000 Subject: gui update --- mixgtk/Makefile.am | 3 +- mixgtk/mixgtk.c | 9 +- mixgtk/mixgtk.glade | 496 +++++++++++++++++++++-------------------- mixgtk/mixgtk_cmd_dispatcher.c | 20 +- mixgtk/mixgtk_cmd_dispatcher.h | 6 +- mixgtk/mixgtk_mixal.c | 115 ++++++++++ mixgtk/mixgtk_mixal.h | 45 ++++ mixgtk/mixgtk_mixvm.c | 83 ++++++- mixgtk/mixgtk_mixvm.h | 17 +- mixgtk/mixgtk_widgets.c | 8 +- mixgtk/mixgtk_widgets.h | 8 +- 11 files changed, 554 insertions(+), 256 deletions(-) create mode 100644 mixgtk/mixgtk_mixal.c create mode 100644 mixgtk/mixgtk_mixal.h (limited to 'mixgtk') diff --git a/mixgtk/Makefile.am b/mixgtk/Makefile.am index 881ec99..ab7d069 100644 --- a/mixgtk/Makefile.am +++ b/mixgtk/Makefile.am @@ -19,7 +19,8 @@ mixgtk_SOURCES = mixgtk.c mixgtk_gen_handlers.h mixgtk_gen_handlers.c \ mixgtk_cmd_dispatcher.h mixgtk_cmd_dispatcher.c \ mixgtk_widgets.h mixgtk_widgets.c \ mixgtk_device.h mixgtk_device.c \ - mixgtk_mixvm.h mixgtk_mixvm.c + mixgtk_mixvm.h mixgtk_mixvm.c \ + mixgtk_mixal.h mixgtk_mixal.c diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c index 1e4abf1..ac460ec 100644 --- a/mixgtk/mixgtk.c +++ b/mixgtk/mixgtk.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mixgtk.c : * Main function of the mix gtk front-end * ------------------------------------------------------------------ - * Last change: Time-stamp: "01/03/07 23:14:56 jose" + * Last change: Time-stamp: "01/03/10 00:03:23 jose" * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -28,6 +28,7 @@ #include "mixgtk_cmd_dispatcher.h" #include "mixgtk_device.h" #include "mixgtk_mixvm.h" +#include "mixgtk_mixal.h" int main(int argc, char *argv[]) @@ -66,6 +67,12 @@ main(int argc, char *argv[]) g_error ("Unable to initialise application (mixvm widgets)\n"); return EXIT_FAILURE; } + + if (!mixgtk_mixal_init (vm)) + { + g_error ("Unable to initialise application (mixal widgets)\n"); + return EXIT_FAILURE; + } gtk_main(); diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade index 188332e..b1d7927 100644 --- a/mixgtk/mixgtk.glade +++ b/mixgtk/mixgtk.glade @@ -177,7 +177,7 @@ False True 0 - - 00 23 + @@ -191,7 +191,7 @@ False True 0 - + 01 45 34 49 49 + @@ -264,20 +264,6 @@ - - GtkEntry - rI5_entry - 168 - 144 - 60 - 22 - True - False - True - 0 - - - GtkEntry rI6_entry @@ -420,15 +406,6 @@ 0 - - GtkHSeparator - hseparator1 - 8 - 232 - 377 - 16 - - GtkVSeparator vseparator2 @@ -530,58 +507,118 @@ - GtkLabel - elapsed_label - 64 - 248 - 48 - 16 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 + GtkVSeparator + vseparator1 + 376 + 10 + 16 + 263 - GtkLabel - program_label - 184 - 248 - 56 - 16 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 + GtkScrolledWindow + memory_scroll + 392 + 16 + 215 + 248 + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + + GtkCList + memory_cells + 200 + 248 + True + 2 + 53,135 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN + + + GtkLabel + CList:title + label165 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + label166 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + - GtkLabel - uptime_label - 296 - 248 - 72 - 16 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 + GtkEntry + rI5_entry + 168 + 144 + 60 + 22 + True + False + True + 0 + + + + + GtkEntry + loc_entry + 300 + 200 + 40 + 22 + True + False + True + 0 + + + + + GtkRadioButton + lesser_radio + 264 + 128 + 35 + 24 + True + + toggled + on_cmp_l_toggled + Tue, 06 Mar 2001 21:21:51 GMT + + + False + True + cmp_group GtkRadioButton equal_radio - 312 - 136 + 304 + 128 31 24 True @@ -600,7 +637,7 @@ GtkRadioButton greater_radio 336 - 160 + 128 32 24 True @@ -616,38 +653,100 @@ - GtkRadioButton - lesser_radio - 288 - 160 - 35 - 24 + GtkLabel + label167 + 256 + 200 + 48 + 16 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkButton + loc_arrow + 346 + 202 + 29 + 18 True - toggled - on_cmp_l_toggled - Tue, 06 Mar 2001 21:21:51 GMT + clicked + on_loc_arrow_clicked + Fri, 09 Mar 2001 20:18:22 GMT - - False - True - cmp_group + + GTK_RELIEF_NONE - GtkVSeparator - vseparator1 - 376 - 10 - 16 - 263 + GtkHSeparator + hseparator1 + 8 + 232 + 377 + 16 + + + + GtkLabel + program_label + 184 + 248 + 56 + 16 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + elapsed_label + 64 + 248 + 48 + 16 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + uptime_label + 296 + 248 + 72 + 16 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 GtkCheckButton over_toggle - 296 - 200 + 288 + 156 72 24 True @@ -660,56 +759,76 @@ False True + + + + GtkLabel + Notebook:tab + label105 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkScrolledWindow + mixal_scroll + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS - GtkScrolledWindow - memory_scroll - 392 - 16 - 215 - 248 - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS + GtkCList + mixal_clist + True + 3 + 60,114,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN - GtkCList - memory_cells - 200 - 248 - True - 2 - 53,135 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_IN + GtkLabel + CList:title + label168 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + - - GtkLabel - CList:title - label165 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - + + GtkLabel + CList:title + label169 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + - - GtkLabel - CList:title - label166 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - + + GtkLabel + CList:title + label170 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 @@ -717,8 +836,8 @@ GtkLabel Notebook:tab - label105 - + label106 + GTK_JUSTIFY_CENTER False 0.5 @@ -771,115 +890,6 @@ 0 0 - - - GtkVBox - vbox2 - False - 0 - - - GtkScrolledWindow - scrolledwindow26 - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - - - - GtkText - mixal_text - True - False - *** sample program - ORG 2000 -START LDA 1000 -.... - - - - - GtkScrolledWindow - scrolledwindow27 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - - - - GtkCList - prog_info_clist - True - 3 - 80,173,80 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_IN - - - GtkLabel - CList:title - label110 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkLabel - CList:title - label111 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkLabel - CList:title - label112 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - GtkLabel - Notebook:tab - label106 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c index dc64f2f..d14c5ee 100644 --- a/mixgtk/mixgtk_cmd_dispatcher.c +++ b/mixgtk/mixgtk_cmd_dispatcher.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mixgtk_cmd_dispatcher.c : * Implementation of the functions declared in mixgtk_cmd_dispatcher.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "01/03/07 23:17:54 jose" + * Last change: Time-stamp: "01/03/10 00:49:04 jose" * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -27,6 +27,7 @@ #include #include "mixgtk_cmd_dispatcher.h" #include "mixgtk_mixvm.h" +#include "mixgtk_mixal.h" /* a mix vm command dispatcher */ @@ -85,18 +86,22 @@ static void load_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg, gpointer data) { + mixgtk_mixal_load_file (); + mixgtk_mixal_update (); } static void run_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg, gpointer data) { + mixgtk_mixal_update (); } static void next_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg, gpointer data) { + mixgtk_mixal_update (); } @@ -119,6 +124,7 @@ mixgtk_cmd_dispatcher_init (void) if (!out) return FALSE; dis_data_.out = out; dis_data_.dispatcher = mix_vm_cmd_dispatcher_new (out, out); + mix_vm_cmd_dispatcher_print_time (dis_data_.dispatcher, FALSE); mix_vm_cmd_dispatcher_global_pre_hook (dis_data_.dispatcher, global_pre_hook_, NULL); mix_vm_cmd_dispatcher_global_post_hook (dis_data_.dispatcher, @@ -147,6 +153,18 @@ mixgtk_cmd_dispatcher_dispatch (const gchar *command) on_mixvm_cmd_entry_activate (entry, NULL); } +/* get times */ +void +mixgtk_cmd_dispatcher_get_times (gint *uptime, gint *progtime, gint *laptime) +{ + if (uptime != NULL) + *uptime = mix_vm_cmd_dispatcher_get_uptime (dis_data_.dispatcher); + if (progtime != NULL) + *progtime = mix_vm_cmd_dispatcher_get_progtime (dis_data_.dispatcher); + if (laptime != NULL) + *laptime = mix_vm_cmd_dispatcher_get_laptime (dis_data_.dispatcher); +} + /* get the underlying vm */ extern mix_vm_t * mixgtk_cmd_dispatcher_get_vm (void) diff --git a/mixgtk/mixgtk_cmd_dispatcher.h b/mixgtk/mixgtk_cmd_dispatcher.h index b0beb17..686ba4d 100644 --- a/mixgtk/mixgtk_cmd_dispatcher.h +++ b/mixgtk/mixgtk_cmd_dispatcher.h @@ -1,7 +1,7 @@ /* -*-c-*- ---------------- mixgtk_cmd_dispatcher.h : * functions to access the command dispatcher * ------------------------------------------------------------------ - * Last change: Time-stamp: <01/03/06 22:29:57 jose> + * Last change: Time-stamp: <01/03/09 22:08:08 jose> * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -36,6 +36,10 @@ mixgtk_cmd_dispatcher_init (void); extern void mixgtk_cmd_dispatcher_dispatch (const gchar *command); +/* get times */ +extern void +mixgtk_cmd_dispatcher_get_times (gint *uptime, gint *progtime, gint *laptime); + /* get the underlying vm */ extern mix_vm_t * mixgtk_cmd_dispatcher_get_vm (void); diff --git a/mixgtk/mixgtk_mixal.c b/mixgtk/mixgtk_mixal.c new file mode 100644 index 0000000..d3ce72b --- /dev/null +++ b/mixgtk/mixgtk_mixal.c @@ -0,0 +1,115 @@ +/* -*-c-*- -------------- mixgtk_mixal.c : + * Implementation of the functions declared in mixgtk_mixal.h + * ------------------------------------------------------------------ + * Last change: Time-stamp: "01/03/10 02:27:52 jose" + * ------------------------------------------------------------------ + * Copyright (C) 2001 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + + +#include +#include "mixgtk_widgets.h" +#include "mixgtk_mixal.h" + +static const mix_vm_t *vm_; +static GtkCList *clist_; +static gulong lineno_; + + +/* initialise the mixal widgets */ +gboolean +mixgtk_mixal_init (const mix_vm_t *vm) +{ + g_return_val_if_fail (vm != NULL, FALSE); + vm_ = vm; + clist_ = GTK_CLIST (mixgtk_widget_factory_get (MIXGTK_WIDGET_MIXAL)); + g_return_val_if_fail (clist_ != NULL, FALSE); + return TRUE; +} + +/* load the corresponding mixal file */ +void +mixgtk_mixal_load_file (void) +{ + enum {ADDR_SIZE = 10, CONT_SIZE = 20}; + static gchar ADDR[ADDR_SIZE], CONT[CONT_SIZE]; + static const gchar *TEXT[3]; + + const mix_src_file_t *file; + + g_assert (vm_); + g_assert (clist_); + + gtk_clist_clear (clist_); + + file = mix_vm_get_src_file (vm_); + if (file != NULL) + { + gint k; + mix_address_t addr; + + lineno_ = mix_src_file_get_line_no (file); + + gtk_clist_freeze (clist_); + for (k = 0; k < lineno_; ++k) + { + TEXT[0] = TEXT[1] = ""; + TEXT[2] = mix_src_file_get_line (file, k + 1); + addr = mix_vm_get_lineno_address (vm_, k + 1); + if (addr != MIX_VM_CELL_NO) + { + snprintf (ADDR, ADDR_SIZE, "%04d", mix_short_magnitude (addr)); + mix_word_print_to_buffer (mix_vm_get_addr_contents (vm_, addr), + CONT); + TEXT[0] = ADDR; + TEXT[1] = CONT; + } + gtk_clist_append (clist_, (gchar **)TEXT); + } + TEXT[0] = TEXT[1] = TEXT[2] = NULL; + gtk_clist_append (clist_, (gchar **)TEXT); + + gtk_clist_thaw (clist_); + } + else + lineno_ = 0; +} + + +/* update the widgets */ +void +mixgtk_mixal_update (void) +{ + gint addr = 0; + gint k = 0; + gchar *addrval = NULL; + + g_assert (vm_); + g_assert (clist_); + + addr = mix_short_magnitude (mix_vm_get_prog_count (vm_)); + while (k < lineno_) + { + gtk_clist_get_text (clist_, k, 0, &addrval); + if (addrval && atoi(addrval) == addr) break; + ++k; + } + gtk_clist_select_row (clist_, k, 0); + if (gtk_clist_row_is_visible (clist_, k) != GTK_VISIBILITY_FULL) + gtk_clist_moveto (clist_, k, 0, 0.25, 0); +} diff --git a/mixgtk/mixgtk_mixal.h b/mixgtk/mixgtk_mixal.h new file mode 100644 index 0000000..076603c --- /dev/null +++ b/mixgtk/mixgtk_mixal.h @@ -0,0 +1,45 @@ +/* -*-c-*- ---------------- mixgtk_mixal.h : + * Declarations for functions displaying the mixal source file + * ------------------------------------------------------------------ + * Last change: Time-stamp: <01/03/09 23:57:14 jose> + * ------------------------------------------------------------------ + * Copyright (C) 2001 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + + +#ifndef MIXGTK_MIXAL_H +#define MIXGTK_MIXAL_H + +#include + +/* initialise the mixal widgets */ +extern gboolean +mixgtk_mixal_init (const mix_vm_t *vm); + +/* load the corresponding mixal file */ +extern void +mixgtk_mixal_load_file (void); + +/* update the widgets */ +extern void +mixgtk_mixal_update (void); + + + +#endif /* MIXGTK_MIXAL_H */ + diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c index ba5023a..16fa410 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/08 23:22:49 jose" + * Last change: Time-stamp: "01/03/09 22:20:59 jose" * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -24,14 +24,19 @@ #include #include "mixgtk_widgets.h" #include "mixgtk_mixvm.h" +#include "mixgtk_cmd_dispatcher.h" /* register widgets */ #define REGISTER_NO_ (MIXGTK_WIDGET_rI6 - MIXGTK_WIDGET_rA + 1) static GtkEntry *reg_entries_[REGISTER_NO_]; +static GtkEntry *loc_entry_; static GtkToggleButton *over_button_; static GtkToggleButton *cmp_buttons_[3]; static GtkCList *memory_; +static GtkLabel *laptime_; +static GtkLabel *progtime_; +static GtkLabel *uptime_; static mix_vm_t *vm_; @@ -93,6 +98,18 @@ mixgtk_mixvm_init (mix_vm_t *vm) g_return_val_if_fail (reg_entries_[k] != NULL, FALSE); } + loc_entry_ = GTK_ENTRY (mixgtk_widget_factory_get (MIXGTK_WIDGET_LOC)); + g_return_val_if_fail (loc_entry_ != NULL, FALSE); + + uptime_ = GTK_LABEL (mixgtk_widget_factory_get (MIXGTK_WIDGET_UPTIME)); + g_return_val_if_fail (uptime_ != NULL, FALSE); + + progtime_ = GTK_LABEL (mixgtk_widget_factory_get (MIXGTK_WIDGET_PROGTIME)); + g_return_val_if_fail (progtime_ != NULL, FALSE); + + laptime_ = GTK_LABEL (mixgtk_widget_factory_get (MIXGTK_WIDGET_LAPTIME)); + g_return_val_if_fail (laptime_ != NULL, FALSE); + over_button_ = GTK_TOGGLE_BUTTON (mixgtk_widget_factory_get (MIXGTK_WIDGET_OVER)); g_return_val_if_fail (over_button_ != NULL, FALSE); @@ -118,7 +135,8 @@ mixgtk_mixvm_init (mix_vm_t *vm) } gtk_clist_thaw (memory_); - scrol = mixgtk_widget_factory_get_by_name ("memory_scroll"); + scrol = mixgtk_widget_factory_get (MIXGTK_WIDGET_CELLS_SCROLL); + g_return_val_if_fail (scrol != NULL, FALSE); adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrol)); gtk_signal_connect (GTK_OBJECT (adj), "value_changed", GTK_SIGNAL_FUNC (on_mem_adj_change_), NULL); @@ -142,7 +160,7 @@ mixgtk_mixvm_update_registers (void) void mixgtk_mixvm_update_over_toggle (void) { - g_assert (over_button_ != NULL); + g_assert (over_button_); gtk_toggle_button_set_active (over_button_, mix_vm_get_overflow (vm_)); } @@ -152,6 +170,9 @@ void mixgtk_mixvm_update_cmp (void) { gint toggle; + + g_assert (cmp_buttons_); + toggle = mix_vm_get_cmpflag (vm_); gtk_toggle_button_set_active (cmp_buttons_[toggle], TRUE); } @@ -164,6 +185,8 @@ mixgtk_mixvm_update_cells (void) static gchar BUFFER[20]; gint k = 0; + g_assert (memory_); + gtk_clist_freeze (memory_); while (gtk_clist_row_is_visible (memory_, k) == GTK_VISIBILITY_NONE) ++k; @@ -177,15 +200,62 @@ mixgtk_mixvm_update_cells (void) gtk_clist_thaw (memory_); } +void +mixgtk_mixvm_update_cells_to_address (gint address) +{ + g_assert (memory_); + g_return_if_fail (address < MIX_VM_CELL_NO); + + gtk_clist_freeze (memory_); + gtk_clist_moveto (memory_, address, 0, 0, 0); + gtk_clist_thaw (memory_); + mixgtk_mixvm_update_cells (); +} + +/* update the loc pointer */ +void +mixgtk_mixvm_update_loc (void) +{ + enum {SIZE = 10 }; + static gchar BUFFER[SIZE]; + mix_short_t locval; + + g_assert (loc_entry_); + + locval = mix_vm_get_prog_count (vm_); + snprintf (BUFFER, SIZE, "%04d", mix_short_magnitude (locval)); + gtk_entry_set_text (loc_entry_, BUFFER); +} + +/* update times */ +void +mixgtk_mixvm_update_times (void) +{ + enum {SIZE = 20 }; + static gchar BUFFER[SIZE]; + gint uptime, progtime, laptime; + + g_assert (uptime_ && progtime_ && laptime_); + mixgtk_cmd_dispatcher_get_times (&uptime, &progtime, &laptime); + snprintf (BUFFER, SIZE, "%d", uptime); + gtk_label_set_text (uptime_, BUFFER); + snprintf (BUFFER, SIZE, "%d", progtime); + gtk_label_set_text (progtime_, BUFFER); + snprintf (BUFFER, SIZE, "%d", laptime); + gtk_label_set_text (laptime_, BUFFER); +} + /* update all mixvm widgets */ void mixgtk_mixvm_update_vm_widgets (void) { mixgtk_mixvm_update_registers (); + mixgtk_mixvm_update_loc (); mixgtk_mixvm_update_over_toggle (); mixgtk_mixvm_update_cmp (); mixgtk_mixvm_update_cells (); + mixgtk_mixvm_update_times (); } @@ -218,3 +288,10 @@ on_overflow_toggled (GtkWidget *widget, gpointer data) } +void +on_loc_arrow_clicked (GtkWidget *widget, gpointer data) +{ + gint address = mix_short_magnitude (mix_vm_get_prog_count (vm_)); + mixgtk_mixvm_update_cells_to_address (address); +} + diff --git a/mixgtk/mixgtk_mixvm.h b/mixgtk/mixgtk_mixvm.h index a2699cb..8207d91 100644 --- a/mixgtk/mixgtk_mixvm.h +++ b/mixgtk/mixgtk_mixvm.h @@ -1,7 +1,7 @@ /* -*-c-*- ---------------- mixgtk_mixvm.h : * Functions dealing with the mixvm widgets * ------------------------------------------------------------------ - * Last change: Time-stamp: <01/03/07 23:58:35 jose> + * Last change: Time-stamp: <01/03/09 22:12:04 jose> * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -47,12 +47,22 @@ mixgtk_mixvm_update_cmp (void); extern void mixgtk_mixvm_update_cells (void); +extern void +mixgtk_mixvm_update_cells_to_address (gint address); + +/* update the loc pointer */ +extern void +mixgtk_mixvm_update_loc (void); + +/* update times */ +extern void +mixgtk_mixvm_update_times (void); + /* update all mixvm widgets */ extern void mixgtk_mixvm_update_vm_widgets (void); /* callbacks */ -/* cmp flag changed */ extern void on_cmp_e_toggled (GtkWidget *widget, gpointer data); @@ -66,8 +76,7 @@ extern void on_overflow_toggled (GtkWidget *widget, gpointer data); extern void -on_memory_cells_scroll_vertical (GtkWidget *widget, GtkScrollType, - gfloat, gpointer); +on_loc_arrow_clicked (GtkWidget *widget, gpointer data); diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c index 276a6fb..3ff6436 100644 --- a/mixgtk/mixgtk_widgets.c +++ b/mixgtk/mixgtk_widgets.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mixgtk_widgets.c : * Implementation of the functions declared in mixgtk_widgets.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "01/03/08 22:32:35 jose" + * Last change: Time-stamp: "01/03/09 22:29:47 jose" * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -35,6 +35,7 @@ static const gchar *names_[] = { "word_dialog", "command_prompt", "command_log", + "mixal_clist", "rA_entry", "rX_entry", "rJ_entry", @@ -49,7 +50,12 @@ static const gchar *names_[] = { "greater_radio", "over_toggle", "memory_cells", + "memory_scroll", "devices_notebook", + "loc_entry", + "elapsed_label", + "program_label", + "uptime_label", NULL }; diff --git a/mixgtk/mixgtk_widgets.h b/mixgtk/mixgtk_widgets.h index 26e8b4d..ac221cc 100644 --- a/mixgtk/mixgtk_widgets.h +++ b/mixgtk/mixgtk_widgets.h @@ -1,7 +1,7 @@ /* -*-c-*- ---------------- mixgtk_widgets.h : * glade-based factory of mixvm widgets * ------------------------------------------------------------------ - * Last change: Time-stamp: <01/03/08 22:27:01 jose> + * Last change: Time-stamp: <01/03/09 23:08:10 jose> * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -34,6 +34,7 @@ typedef enum { MIXGTK_WIDGET_WORD_DIALOG, /* input dialog for a mix word */ MIXGTK_WIDGET_PROMPT, /* command prompt */ MIXGTK_WIDGET_LOG, /* command output */ + MIXGTK_WIDGET_MIXAL, /* mixal source file */ MIXGTK_WIDGET_rA, MIXGTK_WIDGET_rX, MIXGTK_WIDGET_rJ, @@ -48,7 +49,12 @@ typedef enum { MIXGTK_WIDGET_CMP_G, MIXGTK_WIDGET_OVER, MIXGTK_WIDGET_CELLS, + MIXGTK_WIDGET_CELLS_SCROLL, MIXGTK_WIDGET_DEVICE, + MIXGTK_WIDGET_LOC, + MIXGTK_WIDGET_LAPTIME, + MIXGTK_WIDGET_PROGTIME, + MIXGTK_WIDGET_UPTIME, MIXGTK_WIDGET_NONE } mixgtk_widget_id_t; -- cgit v1.2.3