diff options
| author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-03-22 03:01:01 +0000 | 
|---|---|---|
| committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-03-22 03:01:01 +0000 | 
| commit | 1c345e559710ec6200f7d508629bd24457a20a80 (patch) | |
| tree | 4ebccd7c4719cf56da7151af6659992bd1dbb276 /mixgtk | |
| parent | 50375f34b611281a3b05a37221e2baa143f5f5ca (diff) | |
| download | mdk-1c345e559710ec6200f7d508629bd24457a20a80.tar.gz mdk-1c345e559710ec6200f7d508629bd24457a20a80.tar.bz2 | |
initial import (sf 0.3beta)
Diffstat (limited to 'mixgtk')
| -rw-r--r-- | mixgtk/.cvsignore | 7 | ||||
| -rw-r--r-- | mixgtk/Makefile.am | 31 | ||||
| -rw-r--r-- | mixgtk/mixgtk.c | 91 | ||||
| -rw-r--r-- | mixgtk/mixgtk.glade | 1703 | ||||
| -rw-r--r-- | mixgtk/mixgtk_cmd_dispatcher.c | 314 | ||||
| -rw-r--r-- | mixgtk/mixgtk_cmd_dispatcher.h | 55 | ||||
| -rw-r--r-- | mixgtk/mixgtk_device.c | 155 | ||||
| -rw-r--r-- | mixgtk/mixgtk_device.h | 42 | ||||
| -rw-r--r-- | mixgtk/mixgtk_gen_handlers.c | 95 | ||||
| -rw-r--r-- | mixgtk/mixgtk_gen_handlers.h | 46 | ||||
| -rw-r--r-- | mixgtk/mixgtk_input.c | 189 | ||||
| -rw-r--r-- | mixgtk/mixgtk_input.h | 49 | ||||
| -rw-r--r-- | mixgtk/mixgtk_mixal.c | 213 | ||||
| -rw-r--r-- | mixgtk/mixgtk_mixal.h | 60 | ||||
| -rw-r--r-- | mixgtk/mixgtk_mixvm.c | 423 | ||||
| -rw-r--r-- | mixgtk/mixgtk_mixvm.h | 84 | ||||
| -rw-r--r-- | mixgtk/mixgtk_widgets.c | 112 | ||||
| -rw-r--r-- | mixgtk/mixgtk_widgets.h | 80 | 
18 files changed, 3749 insertions, 0 deletions
| diff --git a/mixgtk/.cvsignore b/mixgtk/.cvsignore new file mode 100644 index 0000000..12ed8c2 --- /dev/null +++ b/mixgtk/.cvsignore @@ -0,0 +1,7 @@ +.deps +Makefile +Makefile.in +gmixvm +hello.mix +mixgtk +paper.dev diff --git a/mixgtk/Makefile.am b/mixgtk/Makefile.am new file mode 100644 index 0000000..f8b1bcf --- /dev/null +++ b/mixgtk/Makefile.am @@ -0,0 +1,31 @@ +## Process this file with automake to produce Makefile.in + +# Copyright (C) 2001 Free Software Foundation, Inc.  +#   +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without  +# modifications, as long as this notice is preserved. +#  +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +EXTRA_DIST = mixgtk.glade +INCLUDES = -I$(includedir) -DGLADE_FILE=\""$(pkgdatadir)/mixgtk.glade"\"\ +           -DLOCAL_GLADE_FILE=\"mixgtk.glade\" +LDADD = $(top_builddir)/mixlib/libmix.a  + +if MAKE_GUI +pkgdata_DATA = mixgtk.glade +bin_PROGRAMS = gmixvm +gmixvm_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_mixal.h mixgtk_mixal.c \ +                 mixgtk_input.h mixgtk_input.c +endif + + + diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c new file mode 100644 index 0000000..1bbc175 --- /dev/null +++ b/mixgtk/mixgtk.c @@ -0,0 +1,91 @@ +/* -*-c-*- -------------- mixgtk.c : + * Main function of the mix gtk front-end + * ------------------------------------------------------------------ + *  Last change: Time-stamp: "01/03/14 23:08:50 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 <stdlib.h> +#include <gtk/gtk.h> +#include <mixlib/mix.h> +#include "mixgtk_widgets.h" +#include "mixgtk_cmd_dispatcher.h" +#include "mixgtk_device.h" +#include "mixgtk_mixvm.h" +#include "mixgtk_mixal.h" +#include "mixgtk_input.h" + +int +main(int argc, char *argv[]) +{ +  mix_vm_t *vm; +   +  gtk_init(&argc, &argv); + +  mix_init_lib (); +   +  if (!mixgtk_widget_factory_init (GLADE_FILE) +      && !mixgtk_widget_factory_init (LOCAL_GLADE_FILE)) +    { +      g_error ("Unable to initialise application (using %s and %s)\n", +	       GLADE_FILE, LOCAL_GLADE_FILE); +      return EXIT_FAILURE; +    } + +  if (!mixgtk_cmd_dispatcher_init ()) +    { +      g_error ("Unable to initialise application (command dispatcher)\n"); +      return EXIT_FAILURE; +    } + +  vm = mixgtk_cmd_dispatcher_get_vm (); +   +  if (!mixgtk_device_init (GTK_NOTEBOOK +			   (mixgtk_widget_factory_get (MIXGTK_WIDGET_DEVICE)), +			   vm)) +    { +      g_error ("Unable to initialise application (devices)\n"); +      return EXIT_FAILURE; +    } + +  if (!mixgtk_mixvm_init (vm)) +    { +      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; +    } + +  if (!mixgtk_input_init ()) +    { +      g_error ("Unable to initialise application (word input widgets)\n"); +      return EXIT_FAILURE; +    } +     +   +  gtk_main(); + +  mix_release_lib (); +   +  return EXIT_SUCCESS; +} diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade new file mode 100644 index 0000000..ced029b --- /dev/null +++ b/mixgtk/mixgtk.glade @@ -0,0 +1,1703 @@ +<?xml version="1.0"?> +<GTK-Interface> + +<project> +  <name>mixgtk</name> +  <program_name>mixgtk</program_name> +  <directory></directory> +  <source_directory>src</source_directory> +  <pixmaps_directory>pixmaps</pixmaps_directory> +  <language>C</language> +  <gnome_support>False</gnome_support> +  <gettext_support>False</gettext_support> +  <use_widget_names>True</use_widget_names> +  <output_build_files>False</output_build_files> +  <backup_source_files>False</backup_source_files> +</project> + +<widget> +  <class>GtkWindow</class> +  <name>main_window</name> +  <signal> +    <name>destroy</name> +    <handler>on_main_window_destroy</handler> +    <last_modification_time>Tue, 20 Feb 2001 21:58:29 GMT</last_modification_time> +  </signal> +  <title>gmixvm</title> +  <type>GTK_WINDOW_TOPLEVEL</type> +  <position>GTK_WIN_POS_NONE</position> +  <modal>False</modal> +  <default_width>650</default_width> +  <default_height>500</default_height> +  <allow_shrink>False</allow_shrink> +  <allow_grow>True</allow_grow> +  <auto_shrink>True</auto_shrink> + +  <widget> +    <class>GtkVBox</class> +    <name>main_vbox</name> +    <border_width>2</border_width> +    <homogeneous>False</homogeneous> +    <spacing>2</spacing> + +    <widget> +      <class>GtkMenuBar</class> +      <name>mainmenubar</name> +      <shadow_type>GTK_SHADOW_OUT</shadow_type> +      <child> +	<padding>0</padding> +	<expand>False</expand> +	<fill>True</fill> +      </child> + +      <widget> +	<class>GtkMenuItem</class> +	<name>file</name> +	<label>_File</label> +	<right_justify>False</right_justify> + +	<widget> +	  <class>GtkMenu</class> +	  <name>file_menu</name> + +	  <widget> +	    <class>GtkMenuItem</class> +	    <name>file_open</name> +	    <tooltip>Load a MIX file</tooltip> +	    <accelerator> +	      <modifiers>GDK_MOD1_MASK</modifiers> +	      <key>GDK_F3</key> +	      <signal>activate</signal> +	    </accelerator> +	    <signal> +	      <name>activate</name> +	      <handler>on_file_open_activate</handler> +	      <last_modification_time>Tue, 20 Feb 2001 22:37:58 GMT</last_modification_time> +	    </signal> +	    <label>_Load...</label> +	    <right_justify>False</right_justify> +	  </widget> + +	  <widget> +	    <class>GtkMenuItem</class> +	    <name>file_exit</name> +	    <tooltip>Exit application</tooltip> +	    <accelerator> +	      <modifiers>GDK_MOD1_MASK</modifiers> +	      <key>GDK_Q</key> +	      <signal>activate</signal> +	    </accelerator> +	    <signal> +	      <name>activate</name> +	      <handler>on_file_exit_activate</handler> +	      <last_modification_time>Tue, 20 Feb 2001 22:37:58 GMT</last_modification_time> +	    </signal> +	    <label>_Exit</label> +	    <right_justify>False</right_justify> +	  </widget> +	</widget> +      </widget> + +      <widget> +	<class>GtkMenuItem</class> +	<name>debug</name> +	<label>Debu_g</label> +	<right_justify>False</right_justify> + +	<widget> +	  <class>GtkMenu</class> +	  <name>debug_menu</name> + +	  <widget> +	    <class>GtkMenuItem</class> +	    <name>debug_run</name> +	    <accelerator> +	      <modifiers>GDK_MOD1_MASK</modifiers> +	      <key>GDK_R</key> +	      <signal>activate</signal> +	    </accelerator> +	    <signal> +	      <name>activate</name> +	      <handler>on_debug_run_activate</handler> +	      <last_modification_time>Sat, 10 Mar 2001 11:35:16 GMT</last_modification_time> +	    </signal> +	    <label>_Run</label> +	    <right_justify>False</right_justify> +	  </widget> + +	  <widget> +	    <class>GtkMenuItem</class> +	    <name>debug_next</name> +	    <accelerator> +	      <modifiers>GDK_MOD1_MASK</modifiers> +	      <key>GDK_N</key> +	      <signal>activate</signal> +	    </accelerator> +	    <signal> +	      <name>activate</name> +	      <handler>on_debug_next_activate</handler> +	      <last_modification_time>Sat, 10 Mar 2001 11:35:16 GMT</last_modification_time> +	    </signal> +	    <label>_Next</label> +	    <right_justify>False</right_justify> +	  </widget> + +	  <widget> +	    <class>GtkMenuItem</class> +	    <name>clear_breakpoints</name> +	    <tooltip>Clear all set breakpoints</tooltip> +	    <accelerator> +	      <modifiers>GDK_MOD1_MASK</modifiers> +	      <key>GDK_C</key> +	      <signal>activate</signal> +	    </accelerator> +	    <signal> +	      <name>activate</name> +	      <handler>on_clear_breakpoints_activate</handler> +	      <last_modification_time>Thu, 15 Mar 2001 23:26:49 GMT</last_modification_time> +	    </signal> +	    <label>_Clear breakpoints</label> +	    <right_justify>False</right_justify> +	  </widget> +	</widget> +      </widget> + +      <widget> +	<class>GtkMenuItem</class> +	<name>help</name> +	<label>_Help</label> +	<right_justify>True</right_justify> + +	<widget> +	  <class>GtkMenu</class> +	  <name>help_menu</name> + +	  <widget> +	    <class>GtkMenuItem</class> +	    <name>about</name> +	    <signal> +	      <name>activate</name> +	      <handler>on_about_activate</handler> +	      <last_modification_time>Tue, 13 Mar 2001 01:37:20 GMT</last_modification_time> +	    </signal> +	    <label>_About...</label> +	    <right_justify>True</right_justify> +	  </widget> +	</widget> +      </widget> +    </widget> + +    <widget> +      <class>GtkToolbar</class> +      <name>main_toolbar</name> +      <orientation>GTK_ORIENTATION_HORIZONTAL</orientation> +      <type>GTK_TOOLBAR_ICONS</type> +      <space_size>5</space_size> +      <space_style>GTK_TOOLBAR_SPACE_LINE</space_style> +      <relief>GTK_RELIEF_NORMAL</relief> +      <tooltips>True</tooltips> +      <child> +	<padding>1</padding> +	<expand>False</expand> +	<fill>False</fill> +      </child> + +      <widget> +	<class>Placeholder</class> +      </widget> + +      <widget> +	<class>Placeholder</class> +      </widget> + +      <widget> +	<class>Placeholder</class> +      </widget> +    </widget> + +    <widget> +      <class>GtkVBox</class> +      <name>inner_vbox</name> +      <homogeneous>False</homogeneous> +      <spacing>0</spacing> +      <child> +	<padding>0</padding> +	<expand>True</expand> +	<fill>True</fill> +      </child> + +      <widget> +	<class>GtkNotebook</class> +	<name>main_notebook</name> +	<can_focus>True</can_focus> +	<show_tabs>True</show_tabs> +	<show_border>True</show_border> +	<tab_pos>GTK_POS_TOP</tab_pos> +	<scrollable>False</scrollable> +	<tab_hborder>2</tab_hborder> +	<tab_vborder>2</tab_vborder> +	<popup_enable>False</popup_enable> +	<child> +	  <padding>0</padding> +	  <expand>False</expand> +	  <fill>True</fill> +	</child> + +	<widget> +	  <class>GtkFixed</class> +	  <name>mixvm_widget</name> +	  <width>375</width> +	  <height>287</height> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>rJ_entry</name> +	    <x>304</x> +	    <y>88</y> +	    <width>60</width> +	    <height>24</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>button_press_event</name> +	      <handler>on_register_click</handler> +	      <last_modification_time>Sun, 11 Mar 2001 11:45:00 GMT</last_modification_time> +	    </signal> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>rA_entry</name> +	    <x>40</x> +	    <y>24</y> +	    <width>120</width> +	    <height>24</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>button_press_event</name> +	      <handler>on_register_click</handler> +	      <last_modification_time>Mon, 12 Mar 2001 23:09:49 GMT</last_modification_time> +	    </signal> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>rX_entry</name> +	    <x>248</x> +	    <y>24</y> +	    <width>120</width> +	    <height>24</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>button_press_event</name> +	      <handler>on_register_click</handler> +	      <last_modification_time>Sun, 11 Mar 2001 11:43:29 GMT</last_modification_time> +	    </signal> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>rI2_entry</name> +	    <x>40</x> +	    <y>144</y> +	    <width>60</width> +	    <height>22</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>button_press_event</name> +	      <handler>on_register_click</handler> +	      <last_modification_time>Sun, 11 Mar 2001 11:45:39 GMT</last_modification_time> +	    </signal> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>rI1_entry</name> +	    <x>40</x> +	    <y>88</y> +	    <width>60</width> +	    <height>24</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>button_press_event</name> +	      <handler>on_register_click</handler> +	      <last_modification_time>Sun, 11 Mar 2001 11:43:44 GMT</last_modification_time> +	    </signal> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>rI3_entry</name> +	    <x>40</x> +	    <y>200</y> +	    <width>60</width> +	    <height>22</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>button_press_event</name> +	      <handler>on_register_click</handler> +	      <last_modification_time>Sun, 11 Mar 2001 11:46:37 GMT</last_modification_time> +	    </signal> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>rI4_entry</name> +	    <x>168</x> +	    <y>88</y> +	    <width>60</width> +	    <height>24</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>button_press_event</name> +	      <handler>on_register_click</handler> +	      <last_modification_time>Sun, 11 Mar 2001 11:44:21 GMT</last_modification_time> +	    </signal> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>rI6_entry</name> +	    <x>168</x> +	    <y>200</y> +	    <width>60</width> +	    <height>22</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>button_press_event</name> +	      <handler>on_register_click</handler> +	      <last_modification_time>Sun, 11 Mar 2001 11:46:58 GMT</last_modification_time> +	    </signal> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label100</name> +	    <x>8</x> +	    <y>91</y> +	    <width>31</width> +	    <height>16</height> +	    <label>I1</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label102</name> +	    <x>8</x> +	    <y>200</y> +	    <width>31</width> +	    <height>16</height> +	    <label>I3</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label101</name> +	    <x>8</x> +	    <y>144</y> +	    <width>31</width> +	    <height>16</height> +	    <label>I2</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label103</name> +	    <x>136</x> +	    <y>88</y> +	    <width>32</width> +	    <height>16</height> +	    <label>I4</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label104</name> +	    <x>136</x> +	    <y>144</y> +	    <width>31</width> +	    <height>16</height> +	    <label>I5</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label105</name> +	    <x>136</x> +	    <y>200</y> +	    <width>31</width> +	    <height>16</height> +	    <label>I6</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label98</name> +	    <x>216</x> +	    <y>24</y> +	    <width>31</width> +	    <height>16</height> +	    <label>X</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label97</name> +	    <x>8</x> +	    <y>24</y> +	    <width>31</width> +	    <height>16</height> +	    <label>A</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkVSeparator</class> +	    <name>vseparator2</name> +	    <x>0</x> +	    <y>8</y> +	    <width>16</width> +	    <height>263</height> +	  </widget> + +	  <widget> +	    <class>GtkHSeparator</class> +	    <name>hseparator3</name> +	    <x>6</x> +	    <y>1</y> +	    <width>627</width> +	    <height>16</height> +	  </widget> + +	  <widget> +	    <class>GtkVSeparator</class> +	    <name>vseparator3</name> +	    <x>626</x> +	    <y>8</y> +	    <width>16</width> +	    <height>267</height> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label99</name> +	    <x>272</x> +	    <y>88</y> +	    <width>31</width> +	    <height>16</height> +	    <label>J</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkHSeparator</class> +	    <name>hseparator2</name> +	    <x>6</x> +	    <y>265</y> +	    <width>627</width> +	    <height>16</height> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label159</name> +	    <x>8</x> +	    <y>248</y> +	    <width>64</width> +	    <height>16</height> +	    <label>Elapsed:</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label158</name> +	    <x>128</x> +	    <y>248</y> +	    <width>64</width> +	    <height>16</height> +	    <label>Program:</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label157</name> +	    <x>256</x> +	    <y>248</y> +	    <width>48</width> +	    <height>16</height> +	    <label>Uptime:</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkVSeparator</class> +	    <name>vseparator1</name> +	    <x>376</x> +	    <y>10</y> +	    <width>16</width> +	    <height>263</height> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>rI5_entry</name> +	    <x>168</x> +	    <y>144</y> +	    <width>60</width> +	    <height>22</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>button_press_event</name> +	      <handler>on_register_click</handler> +	      <last_modification_time>Sun, 11 Mar 2001 11:46:05 GMT</last_modification_time> +	    </signal> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>loc_entry</name> +	    <x>300</x> +	    <y>200</y> +	    <width>40</width> +	    <height>22</height> +	    <can_focus>True</can_focus> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>label167</name> +	    <x>256</x> +	    <y>200</y> +	    <width>48</width> +	    <height>16</height> +	    <label>LOC</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkButton</class> +	    <name>loc_arrow</name> +	    <x>346</x> +	    <y>202</y> +	    <width>29</width> +	    <height>18</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>clicked</name> +	      <handler>on_loc_arrow_clicked</handler> +	      <last_modification_time>Fri, 09 Mar 2001 20:18:22 GMT</last_modification_time> +	    </signal> +	    <label>-></label> +	    <relief>GTK_RELIEF_NONE</relief> +	  </widget> + +	  <widget> +	    <class>GtkHSeparator</class> +	    <name>hseparator1</name> +	    <x>8</x> +	    <y>232</y> +	    <width>377</width> +	    <height>16</height> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>program_label</name> +	    <x>184</x> +	    <y>248</y> +	    <width>56</width> +	    <height>16</height> +	    <label>000000</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>elapsed_label</name> +	    <x>64</x> +	    <y>248</y> +	    <width>48</width> +	    <height>16</height> +	    <label>000000</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>uptime_label</name> +	    <x>296</x> +	    <y>248</y> +	    <width>72</width> +	    <height>16</height> +	    <label>00000000</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkCheckButton</class> +	    <name>over_toggle</name> +	    <x>288</x> +	    <y>168</y> +	    <width>88</width> +	    <height>16</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>toggled</name> +	      <handler>on_overflow_toggled</handler> +	      <last_modification_time>Tue, 06 Mar 2001 21:32:39 GMT</last_modification_time> +	    </signal> +	    <label>Overflow</label> +	    <active>False</active> +	    <draw_indicator>True</draw_indicator> +	  </widget> + +	  <widget> +	    <class>GtkRadioButton</class> +	    <name>lesser_radio</name> +	    <x>264</x> +	    <y>128</y> +	    <width>35</width> +	    <height>24</height> +	    <tooltip>Comparison flag: lesser</tooltip> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>toggled</name> +	      <handler>on_cmp_l_toggled</handler> +	      <last_modification_time>Tue, 06 Mar 2001 21:21:51 GMT</last_modification_time> +	    </signal> +	    <label>L</label> +	    <active>False</active> +	    <draw_indicator>True</draw_indicator> +	    <group>cmp_group</group> +	  </widget> + +	  <widget> +	    <class>GtkRadioButton</class> +	    <name>equal_radio</name> +	    <x>304</x> +	    <y>128</y> +	    <width>31</width> +	    <height>24</height> +	    <tooltip>Comparison flag: equal</tooltip> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>toggled</name> +	      <handler>on_cmp_e_toggled</handler> +	      <last_modification_time>Tue, 06 Mar 2001 21:22:04 GMT</last_modification_time> +	    </signal> +	    <label>E</label> +	    <active>False</active> +	    <draw_indicator>True</draw_indicator> +	    <group>cmp_group</group> +	  </widget> + +	  <widget> +	    <class>GtkRadioButton</class> +	    <name>greater_radio</name> +	    <x>336</x> +	    <y>128</y> +	    <width>32</width> +	    <height>24</height> +	    <tooltip>Comparison flag: greater</tooltip> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>toggled</name> +	      <handler>on_cmp_g_toggled</handler> +	      <last_modification_time>Tue, 06 Mar 2001 21:21:40 GMT</last_modification_time> +	    </signal> +	    <label>G</label> +	    <active>False</active> +	    <draw_indicator>True</draw_indicator> +	    <group>cmp_group</group> +	  </widget> + +	  <widget> +	    <class>GtkScrolledWindow</class> +	    <name>memory_scroll</name> +	    <x>398</x> +	    <y>16</y> +	    <width>225</width> +	    <height>248</height> +	    <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> +	    <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> +	    <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> +	    <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + +	    <widget> +	      <class>GtkCList</class> +	      <name>memory_cells</name> +	      <width>195</width> +	      <height>248</height> +	      <tooltip>Click cell to change value</tooltip> +	      <can_focus>True</can_focus> +	      <signal> +		<name>select_row</name> +		<handler>on_memory_cells_select_row</handler> +		<after>True</after> +		<last_modification_time>Tue, 13 Mar 2001 07:38:52 GMT</last_modification_time> +	      </signal> +	      <signal> +		<name>click_column</name> +		<handler>on_memory_cells_click_column</handler> +		<last_modification_time>Wed, 14 Mar 2001 14:18:57 GMT</last_modification_time> +	      </signal> +	      <columns>2</columns> +	      <column_widths>53,135</column_widths> +	      <selection_mode>GTK_SELECTION_SINGLE</selection_mode> +	      <show_titles>True</show_titles> +	      <shadow_type>GTK_SHADOW_IN</shadow_type> + +	      <widget> +		<class>GtkLabel</class> +		<child_name>CList:title</child_name> +		<name>label165</name> +		<label>address</label> +		<justify>GTK_JUSTIFY_CENTER</justify> +		<wrap>False</wrap> +		<xalign>0.5</xalign> +		<yalign>0.5</yalign> +		<xpad>0</xpad> +		<ypad>0</ypad> +	      </widget> + +	      <widget> +		<class>GtkLabel</class> +		<child_name>CList:title</child_name> +		<name>label166</name> +		<label>contents</label> +		<justify>GTK_JUSTIFY_CENTER</justify> +		<wrap>False</wrap> +		<xalign>0.5</xalign> +		<yalign>0.5</yalign> +		<xpad>0</xpad> +		<ypad>0</ypad> +	      </widget> +	    </widget> +	  </widget> +	</widget> + +	<widget> +	  <class>GtkLabel</class> +	  <child_name>Notebook:tab</child_name> +	  <name>label105</name> +	  <label>_MIX</label> +	  <justify>GTK_JUSTIFY_CENTER</justify> +	  <wrap>False</wrap> +	  <xalign>0.5</xalign> +	  <yalign>0.5</yalign> +	  <xpad>0</xpad> +	  <ypad>0</ypad> +	</widget> + +	<widget> +	  <class>GtkScrolledWindow</class> +	  <name>mixal_scrol</name> +	  <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> +	  <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> +	  <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> +	  <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + +	  <widget> +	    <class>GtkCList</class> +	    <name>mixal_clist</name> +	    <tooltip>Click to toggle breakpoint</tooltip> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>select_row</name> +	      <handler>on_mixal_select_row</handler> +	      <after>True</after> +	      <last_modification_time>Sun, 11 Mar 2001 01:15:28 GMT</last_modification_time> +	    </signal> +	    <columns>2</columns> +	    <column_widths>152,80</column_widths> +	    <selection_mode>GTK_SELECTION_SINGLE</selection_mode> +	    <show_titles>True</show_titles> +	    <shadow_type>GTK_SHADOW_IN</shadow_type> + +	    <widget> +	      <class>GtkLabel</class> +	      <child_name>CList:title</child_name> +	      <name>label213</name> +	      <label>memory</label> +	      <justify>GTK_JUSTIFY_CENTER</justify> +	      <wrap>False</wrap> +	      <xalign>0.5</xalign> +	      <yalign>0.5</yalign> +	      <xpad>0</xpad> +	      <ypad>0</ypad> +	    </widget> + +	    <widget> +	      <class>GtkLabel</class> +	      <child_name>CList:title</child_name> +	      <name>label214</name> +	      <label>source</label> +	      <justify>GTK_JUSTIFY_CENTER</justify> +	      <wrap>False</wrap> +	      <xalign>0.5</xalign> +	      <yalign>0.5</yalign> +	      <xpad>0</xpad> +	      <ypad>0</ypad> +	    </widget> +	  </widget> +	</widget> + +	<widget> +	  <class>GtkLabel</class> +	  <child_name>Notebook:tab</child_name> +	  <name>label106</name> +	  <label>MI_XAL</label> +	  <justify>GTK_JUSTIFY_CENTER</justify> +	  <wrap>False</wrap> +	  <xalign>0.5</xalign> +	  <yalign>0.5</yalign> +	  <xpad>0</xpad> +	  <ypad>0</ypad> +	</widget> + +	<widget> +	  <class>GtkNotebook</class> +	  <name>devices_notebook</name> +	  <width>404</width> +	  <height>254</height> +	  <can_focus>True</can_focus> +	  <show_tabs>True</show_tabs> +	  <show_border>True</show_border> +	  <tab_pos>GTK_POS_RIGHT</tab_pos> +	  <scrollable>True</scrollable> +	  <tab_hborder>2</tab_hborder> +	  <tab_vborder>2</tab_vborder> +	  <popup_enable>True</popup_enable> + +	  <widget> +	    <class>Placeholder</class> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <child_name>Notebook:tab</child_name> +	    <name>label156</name> +	    <label>term</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> +	</widget> + +	<widget> +	  <class>GtkLabel</class> +	  <child_name>Notebook:tab</child_name> +	  <name>devices_label</name> +	  <label>De_vices</label> +	  <justify>GTK_JUSTIFY_CENTER</justify> +	  <wrap>False</wrap> +	  <xalign>0.5</xalign> +	  <yalign>0.5</yalign> +	  <xpad>0</xpad> +	  <ypad>0</ypad> +	</widget> +      </widget> + +      <widget> +	<class>GtkScrolledWindow</class> +	<name>scrolledwindow25</name> +	<border_width>2</border_width> +	<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> +	<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> +	<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> +	<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> +	<child> +	  <padding>0</padding> +	  <expand>True</expand> +	  <fill>True</fill> +	</child> + +	<widget> +	  <class>GtkViewport</class> +	  <name>viewport1</name> +	  <shadow_type>GTK_SHADOW_IN</shadow_type> + +	  <widget> +	    <class>GtkVBox</class> +	    <name>prompt_vbox</name> +	    <homogeneous>False</homogeneous> +	    <spacing>0</spacing> + +	    <widget> +	      <class>GtkScrolledWindow</class> +	      <name>mixlog_scrolledwindow</name> +	      <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> +	      <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> +	      <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> +	      <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> +	      <child> +		<padding>0</padding> +		<expand>True</expand> +		<fill>True</fill> +	      </child> + +	      <widget> +		<class>GtkText</class> +		<name>command_log</name> +		<editable>False</editable> +		<text></text> +	      </widget> +	    </widget> + +	    <widget> +	      <class>GtkEntry</class> +	      <name>command_prompt</name> +	      <tooltip>Enter MIXVM command here</tooltip> +	      <can_focus>True</can_focus> +	      <has_focus>True</has_focus> +	      <signal> +		<name>activate</name> +		<handler>on_mixvm_cmd_entry_activate</handler> +		<last_modification_time>Thu, 22 Feb 2001 23:26:28 GMT</last_modification_time> +	      </signal> +	      <editable>True</editable> +	      <text_visible>True</text_visible> +	      <text_max_length>0</text_max_length> +	      <text></text> +	      <child> +		<padding>0</padding> +		<expand>False</expand> +		<fill>False</fill> +	      </child> +	    </widget> +	  </widget> +	</widget> +      </widget> +    </widget> + +    <widget> +      <class>GtkStatusbar</class> +      <name>main_statusbar</name> +      <child> +	<padding>0</padding> +	<expand>False</expand> +	<fill>False</fill> +      </child> +    </widget> +  </widget> +</widget> + +<widget> +  <class>GtkDialog</class> +  <name>word_dialog</name> +  <visible>False</visible> +  <signal> +    <name>destroy</name> +    <handler>gtk_widget_hide</handler> +    <last_modification_time>Tue, 13 Mar 2001 00:53:39 GMT</last_modification_time> +  </signal> +  <signal> +    <name>destroy_event</name> +    <handler>gtk_widget_hide</handler> +    <last_modification_time>Tue, 13 Mar 2001 00:55:38 GMT</last_modification_time> +  </signal> +  <signal> +    <name>delete_event</name> +    <handler>gtk_widget_hide</handler> +    <last_modification_time>Tue, 13 Mar 2001 00:56:33 GMT</last_modification_time> +  </signal> +  <title>Enter value</title> +  <type>GTK_WINDOW_DIALOG</type> +  <position>GTK_WIN_POS_MOUSE</position> +  <modal>True</modal> +  <default_width>250</default_width> +  <allow_shrink>False</allow_shrink> +  <allow_grow>False</allow_grow> +  <auto_shrink>False</auto_shrink> + +  <widget> +    <class>GtkVBox</class> +    <child_name>Dialog:vbox</child_name> +    <name>dialog-vbox5</name> +    <homogeneous>False</homogeneous> +    <spacing>0</spacing> + +    <widget> +      <class>GtkHBox</class> +      <child_name>Dialog:action_area</child_name> +      <name>dialog-action_area5</name> +      <border_width>10</border_width> +      <width>250</width> +      <homogeneous>True</homogeneous> +      <spacing>5</spacing> +      <child> +	<padding>0</padding> +	<expand>False</expand> +	<fill>False</fill> +	<pack>GTK_PACK_END</pack> +      </child> + +      <widget> +	<class>GtkHButtonBox</class> +	<name>hbuttonbox5</name> +	<width>250</width> +	<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style> +	<spacing>30</spacing> +	<child_min_width>85</child_min_width> +	<child_min_height>27</child_min_height> +	<child_ipad_x>7</child_ipad_x> +	<child_ipad_y>0</child_ipad_y> +	<child> +	  <padding>0</padding> +	  <expand>False</expand> +	  <fill>False</fill> +	</child> + +	<widget> +	  <class>GtkButton</class> +	  <name>word_reset</name> +	  <can_default>True</can_default> +	  <can_focus>True</can_focus> +	  <signal> +	    <name>clicked</name> +	    <handler>on_word_reset_clicked</handler> +	    <last_modification_time>Mon, 12 Mar 2001 22:40:33 GMT</last_modification_time> +	  </signal> +	  <label>Reset</label> +	  <relief>GTK_RELIEF_NORMAL</relief> +	</widget> + +	<widget> +	  <class>GtkButton</class> +	  <name>word_ok</name> +	  <can_default>True</can_default> +	  <can_focus>True</can_focus> +	  <signal> +	    <name>clicked</name> +	    <handler>on_word_ok_clicked</handler> +	    <last_modification_time>Mon, 12 Mar 2001 22:40:45 GMT</last_modification_time> +	  </signal> +	  <label>OK</label> +	  <relief>GTK_RELIEF_NORMAL</relief> +	</widget> + +	<widget> +	  <class>GtkButton</class> +	  <name>word_cancel</name> +	  <can_default>True</can_default> +	  <can_focus>True</can_focus> +	  <signal> +	    <name>clicked</name> +	    <handler>on_word_cancel_clicked</handler> +	    <last_modification_time>Mon, 12 Mar 2001 23:18:49 GMT</last_modification_time> +	  </signal> +	  <label>Cancel</label> +	  <relief>GTK_RELIEF_NORMAL</relief> +	</widget> +      </widget> +    </widget> + +    <widget> +      <class>GtkFixed</class> +      <name>word_layout</name> +      <width>250</width> +      <height>97</height> +      <child> +	<padding>0</padding> +	<expand>False</expand> +	<fill>False</fill> +      </child> + +      <widget> +	<class>GtkEntry</class> +	<name>word_decimal</name> +	<x>88</x> +	<y>32</y> +	<width>143</width> +	<height>22</height> +	<can_focus>True</can_focus> +	<has_focus>True</has_focus> +	<signal> +	  <name>key_press_event</name> +	  <handler>on_word_dec_key_press</handler> +	  <after>True</after> +	  <last_modification_time>Mon, 12 Mar 2001 22:37:13 GMT</last_modification_time> +	</signal> +	<editable>True</editable> +	<text_visible>True</text_visible> +	<text_max_length>11</text_max_length> +	<text>0</text> +      </widget> + +      <widget> +	<class>GtkEntry</class> +	<name>word_b2</name> +	<x>136</x> +	<y>64</y> +	<width>22</width> +	<height>22</height> +	<can_focus>True</can_focus> +	<signal> +	  <name>key_press_event</name> +	  <handler>on_word_byte_key_press</handler> +	  <after>True</after> +	  <last_modification_time>Mon, 12 Mar 2001 22:38:56 GMT</last_modification_time> +	</signal> +	<editable>True</editable> +	<text_visible>True</text_visible> +	<text_max_length>3</text_max_length> +	<text>00</text> +      </widget> + +      <widget> +	<class>GtkEntry</class> +	<name>word_b3</name> +	<x>160</x> +	<y>64</y> +	<width>22</width> +	<height>22</height> +	<can_focus>True</can_focus> +	<signal> +	  <name>key_press_event</name> +	  <handler>on_word_byte_key_press</handler> +	  <after>True</after> +	  <last_modification_time>Mon, 12 Mar 2001 22:39:26 GMT</last_modification_time> +	</signal> +	<editable>True</editable> +	<text_visible>True</text_visible> +	<text_max_length>3</text_max_length> +	<text>00</text> +      </widget> + +      <widget> +	<class>GtkEntry</class> +	<name>word_b4</name> +	<x>184</x> +	<y>64</y> +	<width>22</width> +	<height>22</height> +	<can_focus>True</can_focus> +	<signal> +	  <name>key_press_event</name> +	  <handler>on_word_byte_key_press</handler> +	  <after>True</after> +	  <last_modification_time>Mon, 12 Mar 2001 22:39:50 GMT</last_modification_time> +	</signal> +	<editable>True</editable> +	<text_visible>True</text_visible> +	<text_max_length>3</text_max_length> +	<text>00</text> +      </widget> + +      <widget> +	<class>GtkEntry</class> +	<name>word_b5</name> +	<x>208</x> +	<y>64</y> +	<width>22</width> +	<height>22</height> +	<can_focus>True</can_focus> +	<signal> +	  <name>key_press_event</name> +	  <handler>on_word_byte_key_press</handler> +	  <after>True</after> +	  <last_modification_time>Mon, 12 Mar 2001 22:40:09 GMT</last_modification_time> +	</signal> +	<editable>True</editable> +	<text_visible>True</text_visible> +	<text_max_length>3</text_max_length> +	<text>00</text> +      </widget> + +      <widget> +	<class>GtkEntry</class> +	<name>word_b1</name> +	<x>112</x> +	<y>64</y> +	<width>22</width> +	<height>22</height> +	<can_default>True</can_default> +	<can_focus>True</can_focus> +	<signal> +	  <name>key_press_event</name> +	  <handler>on_word_byte_key_press</handler> +	  <after>True</after> +	  <last_modification_time>Mon, 12 Mar 2001 22:38:24 GMT</last_modification_time> +	</signal> +	<editable>True</editable> +	<text_visible>True</text_visible> +	<text_max_length>3</text_max_length> +	<text>00</text> +      </widget> + +      <widget> +	<class>GtkEntry</class> +	<name>word_sign</name> +	<x>88</x> +	<y>64</y> +	<width>16</width> +	<height>24</height> +	<can_focus>True</can_focus> +	<signal> +	  <name>key_press_event</name> +	  <handler>on_word_sign_key_press</handler> +	  <last_modification_time>Tue, 13 Mar 2001 00:15:28 GMT</last_modification_time> +	</signal> +	<editable>True</editable> +	<text_visible>True</text_visible> +	<text_max_length>1</text_max_length> +	<text>+</text> +      </widget> + +      <widget> +	<class>GtkLabel</class> +	<name>label61</name> +	<x>22</x> +	<y>67</y> +	<width>41</width> +	<height>16</height> +	<label>Bytes</label> +	<justify>GTK_JUSTIFY_CENTER</justify> +	<wrap>False</wrap> +	<xalign>0.5</xalign> +	<yalign>0.5</yalign> +	<xpad>0</xpad> +	<ypad>0</ypad> +      </widget> + +      <widget> +	<class>GtkLabel</class> +	<name>word_label</name> +	<x>16</x> +	<y>8</y> +	<width>216</width> +	<height>16</height> +	<label>Enter value</label> +	<justify>GTK_JUSTIFY_CENTER</justify> +	<wrap>False</wrap> +	<xalign>0.5</xalign> +	<yalign>0.5</yalign> +	<xpad>0</xpad> +	<ypad>0</ypad> +      </widget> + +      <widget> +	<class>GtkLabel</class> +	<name>label60</name> +	<x>16</x> +	<y>34</y> +	<width>67</width> +	<height>20</height> +	<label>Decimal</label> +	<justify>GTK_JUSTIFY_CENTER</justify> +	<wrap>False</wrap> +	<xalign>0.5</xalign> +	<yalign>0.5</yalign> +	<xpad>0</xpad> +	<ypad>0</ypad> +      </widget> +    </widget> +  </widget> +</widget> + +<widget> +  <class>GtkWindow</class> +  <name>about_dialog</name> +  <width>368</width> +  <height>99</height> +  <visible>False</visible> +  <signal> +    <name>delete_event</name> +    <handler>gtk_widget_hide</handler> +    <last_modification_time>Tue, 13 Mar 2001 13:13:42 GMT</last_modification_time> +  </signal> +  <signal> +    <name>destroy_event</name> +    <handler>gtk_widget_hide</handler> +    <last_modification_time>Tue, 13 Mar 2001 13:14:02 GMT</last_modification_time> +  </signal> +  <signal> +    <name>destroy</name> +    <handler>gtk_widget_hide</handler> +    <last_modification_time>Tue, 13 Mar 2001 13:14:25 GMT</last_modification_time> +  </signal> +  <title>MDK</title> +  <type>GTK_WINDOW_DIALOG</type> +  <position>GTK_WIN_POS_CENTER</position> +  <modal>True</modal> +  <allow_shrink>False</allow_shrink> +  <allow_grow>False</allow_grow> +  <auto_shrink>False</auto_shrink> + +  <widget> +    <class>GtkLayout</class> +    <name>layout1</name> +    <width>375</width> +    <height>190</height> +    <area_width>200</area_width> +    <area_height>120</area_height> +    <hstep>0</hstep> +    <vstep>0</vstep> + +    <widget> +      <class>GtkLabel</class> +      <name>label222</name> +      <x>56</x> +      <y>16</y> +      <width>247</width> +      <height>16</height> +      <label>GNU MIX Development Kit</label> +      <justify>GTK_JUSTIFY_CENTER</justify> +      <wrap>False</wrap> +      <xalign>0.5</xalign> +      <yalign>0.5</yalign> +      <xpad>0</xpad> +      <ypad>0</ypad> +    </widget> + +    <widget> +      <class>GtkLabel</class> +      <name>version_label</name> +      <x>152</x> +      <y>40</y> +      <width>56</width> +      <height>16</height> +      <label>label223</label> +      <justify>GTK_JUSTIFY_CENTER</justify> +      <wrap>False</wrap> +      <xalign>0.5</xalign> +      <yalign>0.5</yalign> +      <xpad>0</xpad> +      <ypad>0</ypad> +    </widget> + +    <widget> +      <class>GtkLabel</class> +      <name>label224</name> +      <x>0</x> +      <y>64</y> +      <width>358</width> +      <height>16</height> +      <label> Copyright (C) 2001 Free Software Foundation, Inc.</label> +      <justify>GTK_JUSTIFY_CENTER</justify> +      <wrap>False</wrap> +      <xalign>0.5</xalign> +      <yalign>0.5</yalign> +      <xpad>0</xpad> +      <ypad>0</ypad> +    </widget> + +    <widget> +      <class>GtkHSeparator</class> +      <name>hseparator4</name> +      <x>8</x> +      <y>0</y> +      <width>356</width> +      <height>16</height> +    </widget> + +    <widget> +      <class>GtkHSeparator</class> +      <name>hseparator5</name> +      <x>8</x> +      <y>80</y> +      <width>356</width> +      <height>16</height> +    </widget> + +    <widget> +      <class>GtkVSeparator</class> +      <name>vseparator4</name> +      <x>0</x> +      <y>7</y> +      <width>16</width> +      <height>83</height> +    </widget> + +    <widget> +      <class>GtkVSeparator</class> +      <name>vseparator5</name> +      <x>352</x> +      <y>8</y> +      <width>16</width> +      <height>83</height> +    </widget> +  </widget> +</widget> + +<widget> +  <class>GtkDialog</class> +  <name>goto_dialog</name> +  <width>190</width> +  <height>116</height> +  <visible>False</visible> +  <signal> +    <name>destroy_event</name> +    <handler>gtk_widget_hide</handler> +    <last_modification_time>Wed, 14 Mar 2001 14:39:17 GMT</last_modification_time> +  </signal> +  <signal> +    <name>delete_event</name> +    <handler>gtk_widget_hide</handler> +    <last_modification_time>Wed, 14 Mar 2001 14:39:41 GMT</last_modification_time> +  </signal> +  <signal> +    <name>destroy</name> +    <handler>gtk_widget_hide</handler> +    <last_modification_time>Wed, 14 Mar 2001 14:40:15 GMT</last_modification_time> +  </signal> +  <title>Go to memory cell</title> +  <type>GTK_WINDOW_DIALOG</type> +  <position>GTK_WIN_POS_MOUSE</position> +  <modal>True</modal> +  <allow_shrink>False</allow_shrink> +  <allow_grow>False</allow_grow> +  <auto_shrink>False</auto_shrink> + +  <widget> +    <class>GtkVBox</class> +    <child_name>Dialog:vbox</child_name> +    <name>dialog-vbox6</name> +    <homogeneous>False</homogeneous> +    <spacing>0</spacing> + +    <widget> +      <class>GtkHBox</class> +      <child_name>Dialog:action_area</child_name> +      <name>dialog-action_area6</name> +      <border_width>10</border_width> +      <homogeneous>True</homogeneous> +      <spacing>5</spacing> +      <child> +	<padding>0</padding> +	<expand>False</expand> +	<fill>True</fill> +	<pack>GTK_PACK_END</pack> +      </child> + +      <widget> +	<class>GtkHButtonBox</class> +	<name>hbuttonbox6</name> +	<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style> +	<spacing>30</spacing> +	<child_min_width>85</child_min_width> +	<child_min_height>27</child_min_height> +	<child_ipad_x>7</child_ipad_x> +	<child_ipad_y>0</child_ipad_y> +	<child> +	  <padding>0</padding> +	  <expand>True</expand> +	  <fill>True</fill> +	</child> + +	<widget> +	  <class>GtkButton</class> +	  <name>goto_cancel</name> +	  <can_default>True</can_default> +	  <can_focus>True</can_focus> +	  <signal> +	    <name>clicked</name> +	    <handler>on_goto_cancel_clicked</handler> +	    <last_modification_time>Wed, 14 Mar 2001 14:24:59 GMT</last_modification_time> +	  </signal> +	  <label>Cancel</label> +	  <relief>GTK_RELIEF_NORMAL</relief> +	</widget> + +	<widget> +	  <class>GtkButton</class> +	  <name>goto_ok</name> +	  <can_default>True</can_default> +	  <can_focus>True</can_focus> +	  <signal> +	    <name>clicked</name> +	    <handler>on_goto_ok_clicked</handler> +	    <last_modification_time>Wed, 14 Mar 2001 14:25:23 GMT</last_modification_time> +	  </signal> +	  <label>OK</label> +	  <relief>GTK_RELIEF_NORMAL</relief> +	</widget> +      </widget> +    </widget> + +    <widget> +      <class>GtkVBox</class> +      <name>vbox1</name> +      <border_width>12</border_width> +      <homogeneous>False</homogeneous> +      <spacing>0</spacing> +      <child> +	<padding>0</padding> +	<expand>False</expand> +	<fill>False</fill> +      </child> + +      <widget> +	<class>GtkLabel</class> +	<name>label225</name> +	<label>Go to address:</label> +	<justify>GTK_JUSTIFY_CENTER</justify> +	<wrap>False</wrap> +	<xalign>0.5</xalign> +	<yalign>0.5</yalign> +	<xpad>0</xpad> +	<ypad>0</ypad> +	<child> +	  <padding>0</padding> +	  <expand>True</expand> +	  <fill>True</fill> +	</child> +      </widget> + +      <widget> +	<class>GtkEntry</class> +	<name>goto_entry</name> +	<width>44</width> +	<can_focus>True</can_focus> +	<has_focus>True</has_focus> +	<signal> +	  <name>activate</name> +	  <handler>on_goto_ok_clicked</handler> +	  <last_modification_time>Wed, 14 Mar 2001 14:52:26 GMT</last_modification_time> +	</signal> +	<editable>True</editable> +	<text_visible>True</text_visible> +	<text_max_length>4</text_max_length> +	<text></text> +	<child> +	  <padding>10</padding> +	  <expand>False</expand> +	  <fill>False</fill> +	</child> +      </widget> +    </widget> +  </widget> +</widget> + +</GTK-Interface> diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c new file mode 100644 index 0000000..11acc1d --- /dev/null +++ b/mixgtk/mixgtk_cmd_dispatcher.c @@ -0,0 +1,314 @@ +/* -*-c-*- -------------- mixgtk_cmd_dispatcher.c : + * Implementation of the functions declared in mixgtk_cmd_dispatcher.h + * ------------------------------------------------------------------ + *  Last change: Time-stamp: "01/03/15 16:01:43 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. + *   + */ + +#define _GNU_SOURCE 1 + +#include <stdlib.h> +#include <stdio.h> +#include <mixlib/mix_vm_command.h> +#include "mixgtk_cmd_dispatcher.h" +#include "mixgtk_mixvm.h" +#include "mixgtk_mixal.h" + + +/* a mix vm command dispatcher */ +struct mixgtk_dispatch_ +{ +  mix_vm_cmd_dispatcher_t *dispatcher; +  FILE *out; +  char *out_buffer; +  size_t out_buffer_size; +  GtkWidget *prompt; +  GtkWidget *log; +  GtkWidget *status; +  guint context; +  GCompletion *completions; +}; + +static struct mixgtk_dispatch_ dis_data_ = {NULL}; + +/* completions */ +static void +init_completions_ (void) +{ +  GList *cmds = NULL; +  gint k; +   +  dis_data_.completions = g_completion_new (NULL); +  for (k = 0; k < MIX_CMD_INVALID; ++k) +    cmds = g_list_append (cmds, (gpointer) mix_vm_command_to_string (k)); +  g_completion_add_items (dis_data_.completions, cmds); +} + +/* global hooks for the command dispatcher */ +static void +global_pre_hook_ (mix_vm_cmd_dispatcher_t *dis, +		  mix_vm_command_t cmd, const gchar *arg, gpointer data) +{ +  if (cmd < MIX_CMD_INVALID) +    { +      gtk_text_insert (GTK_TEXT (dis_data_.log), NULL, NULL, NULL, +		       "MIX> ", -1); +      gtk_text_insert (GTK_TEXT (dis_data_.log), NULL, NULL, NULL, +		       mix_vm_command_to_string (cmd), -1); +      gtk_text_insert (GTK_TEXT (dis_data_.log), NULL, NULL, NULL, +		       " ", -1); +      gtk_text_insert (GTK_TEXT (dis_data_.log), NULL, NULL, NULL, +		       arg, -1); +      gtk_text_insert (GTK_TEXT (dis_data_.log), NULL, NULL, NULL, +		       "\n", -1); +    } +  else +    { +      gtk_text_insert (GTK_TEXT (dis_data_.log), NULL, NULL, NULL, +		       _("\n*** Invalid command ***\n"), -1); +    } +} + +static void +global_post_hook_ (mix_vm_cmd_dispatcher_t *dis, +		   mix_vm_command_t cmd, const gchar *arg, gpointer data) +{ +  fflush (dis_data_.out); +  if (cmd < MIX_CMD_INVALID) +    { +      gtk_text_insert (GTK_TEXT (dis_data_.log), NULL, NULL, NULL, +		       dis_data_.out_buffer, dis_data_.out_buffer_size); +    } +  rewind (dis_data_.out); +  mixgtk_mixvm_update_vm_widgets (); +} + +static void +load_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg, +		 gpointer data) +{ +  static glong id = -1; +  +  if (mix_vm_cmd_dispatcher_get_last_result (dis)) +    { +      gchar *file = g_strdup (arg); +      mixgtk_mixal_load_file (); +      mixgtk_mixal_update (); + +      if (id != -1) +	gtk_statusbar_remove (GTK_STATUSBAR (dis_data_.status), +			      dis_data_.context, (guint)id); +      id = +	gtk_statusbar_push (GTK_STATUSBAR (dis_data_.status), dis_data_.context, +			    file); +    } +} + +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 (); +} + +static void +linebp_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg, +		gpointer data) +{ +  if (arg && strlen (arg)) mixgtk_mixal_update_bp_at_line (atoi (arg)); +} + +static void +addrbp_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg, +		gpointer data) +{ +  if (arg && strlen (arg)) mixgtk_mixal_update_bp_at_address (atoi (arg)); +} + +static void +allbp_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg, +		  gpointer data) +{ +  mixgtk_mixal_update_bp_all (); +} + + +static void +install_hooks_ (void) +{ +  mix_vm_cmd_dispatcher_global_pre_hook (dis_data_.dispatcher, +					 global_pre_hook_, NULL); +  mix_vm_cmd_dispatcher_global_post_hook (dis_data_.dispatcher, +					  global_post_hook_, NULL); +  mix_vm_cmd_dispatcher_post_hook (dis_data_.dispatcher, +				   MIX_CMD_LOAD, load_post_hook_, +				   NULL); +  mix_vm_cmd_dispatcher_post_hook (dis_data_.dispatcher, +				   MIX_CMD_RUN, run_post_hook_, +				   NULL); +  mix_vm_cmd_dispatcher_post_hook (dis_data_.dispatcher, +				   MIX_CMD_NEXT, next_post_hook_, +				   NULL); +  mix_vm_cmd_dispatcher_post_hook (dis_data_.dispatcher, +				   MIX_CMD_SBP, linebp_post_hook_, +				   NULL); +  mix_vm_cmd_dispatcher_post_hook (dis_data_.dispatcher, +				   MIX_CMD_CBP, linebp_post_hook_, +				   NULL); +  mix_vm_cmd_dispatcher_post_hook (dis_data_.dispatcher, +				   MIX_CMD_SBPA, addrbp_post_hook_, +				   NULL); +  mix_vm_cmd_dispatcher_post_hook (dis_data_.dispatcher, +				   MIX_CMD_CBPA, addrbp_post_hook_, +				   NULL); +  mix_vm_cmd_dispatcher_post_hook (dis_data_.dispatcher, +				   MIX_CMD_CABP, allbp_post_hook_, +				   NULL); +} + + +/* initialise the command dispatcher */ +gboolean +mixgtk_cmd_dispatcher_init (void) +{ +  if (!dis_data_.prompt) +    { +      dis_data_.prompt = mixgtk_widget_factory_get (MIXGTK_WIDGET_PROMPT); +      g_return_val_if_fail (dis_data_.prompt != NULL, FALSE); +      dis_data_.log = mixgtk_widget_factory_get (MIXGTK_WIDGET_LOG); +      g_return_val_if_fail (dis_data_.log != NULL, FALSE); +    } +     +  if (!dis_data_.dispatcher) +    { +      FILE *out = open_memstream (&(dis_data_.out_buffer), +				  &(dis_data_.out_buffer_size)); +      g_return_val_if_fail (out != NULL, 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); +      install_hooks_ (); +    } +   +  if (!dis_data_.status) +    { +      dis_data_.status = mixgtk_widget_factory_get (MIXGTK_WIDGET_STATUSBAR); +      g_return_val_if_fail (dis_data_.status != NULL, FALSE); +      dis_data_.context = gtk_statusbar_get_context_id (GTK_STATUSBAR +							(dis_data_.status), +							"cmd_dis_context"); +    } +   +  if (!dis_data_.completions) init_completions_ (); +   +  return TRUE; +} + +/* dispatch an externally provided command */ +void +mixgtk_cmd_dispatcher_dispatch (const gchar *command) +{ +  GtkWidget *entry = dis_data_.prompt; +  g_return_if_fail (command != NULL); +  g_assert (entry != NULL); +  gtk_entry_set_text (GTK_ENTRY (entry), 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) +{ +  return (mix_vm_t *) mix_vm_cmd_dispatcher_get_vm (dis_data_.dispatcher); +} + +/* process new command */ +void +on_mixvm_cmd_entry_activate (GtkWidget *w, gpointer e) +{ +  gchar *text; +  GList *cmds = NULL; +  gchar *prefix = NULL; +   +  text = gtk_entry_get_text (GTK_ENTRY (w)); + +  if (mix_vm_command_from_string (g_strchomp (text)) != MIX_CMD_INVALID) +    { +      mix_vm_cmd_dispatcher_dispatch_text (dis_data_.dispatcher, text); +      gtk_entry_set_text (GTK_ENTRY (w), ""); +      return; +    } +   +  cmds = g_completion_complete (dis_data_.completions, text, &prefix); + +  if (prefix != NULL) +    { +      gtk_entry_set_text (GTK_ENTRY (w), prefix); +      g_free (prefix); +      if (g_list_length (cmds) > 1) +	{ +	  gint k = 0; +	  gtk_text_insert (GTK_TEXT (dis_data_.log), +			   NULL, NULL, NULL, "Completions:\n", -1); +	  while (cmds) +	    { +	      ++k; +	      gtk_text_insert (GTK_TEXT (dis_data_.log), +			       NULL, NULL, NULL, +			       (gchar *)(cmds->data), -1); +	      gtk_text_insert (GTK_TEXT (dis_data_.log), +			       NULL, NULL, NULL, "     ", -1); +	      if (k%5 == 0) +		gtk_text_insert (GTK_TEXT (dis_data_.log), +				 NULL, NULL, NULL, "\n", -1); +	       +	      cmds = cmds->next; +	    } +	  if (k%5 != 0) +	    gtk_text_insert (GTK_TEXT (dis_data_.log), +			     NULL, NULL, NULL, "\n", -1); +	} +      else +	gtk_entry_append_text (GTK_ENTRY (w), " "); +    } +  else +    { +      mix_vm_cmd_dispatcher_dispatch_text (dis_data_.dispatcher, text); +      gtk_entry_set_text (GTK_ENTRY (w), ""); +    } +} diff --git a/mixgtk/mixgtk_cmd_dispatcher.h b/mixgtk/mixgtk_cmd_dispatcher.h new file mode 100644 index 0000000..686ba4d --- /dev/null +++ b/mixgtk/mixgtk_cmd_dispatcher.h @@ -0,0 +1,55 @@ +/* -*-c-*- ---------------- mixgtk_cmd_dispatcher.h : + * functions to access the command dispatcher + * ------------------------------------------------------------------ + *  Last change: Time-stamp: <01/03/09 22:08:08 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_CMD_DISPATCHER_H +#define MIXGTK_CMD_DISPATCHER_H + +#include <mixlib/mix_vm.h> +#include "mixgtk_widgets.h" + +/* initialise the command dispatcher */ +extern gboolean +mixgtk_cmd_dispatcher_init (void); + +/* dispatch an externally provided command */ +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); + +/* make gtk signal callbacks accessible to glade */ +/* new command handler */ +extern void +on_mixvm_cmd_entry_activate (GtkWidget *w, gpointer e); + + + +#endif /* MIXGTK_CMD_DISPATCHER_H */ + diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c new file mode 100644 index 0000000..2e231a4 --- /dev/null +++ b/mixgtk/mixgtk_device.c @@ -0,0 +1,155 @@ +/* -*-c-*- ---------------- mixgtk_device.c : + * actual types for mixgtk devices + * ------------------------------------------------------------------ + *  Last change: Time-stamp: <01/03/05 01:13:40 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. + *   + */ + + +#define _GNU_SOURCE 1 + +#include <stdio.h> +#include <mixlib/xmix_device.h> +#include "mixgtk_device.h" + +/* device container */ +static GtkNotebook *container_ = NULL; +/* virtual machine */ +static mix_vm_t *vm_ = NULL; + +/* a mixgtk device */ +struct mixgtk_device_t +{ +  mix_device_t device; +  char *buffer; +  size_t buffer_len; +  GtkText *widget; +  gint pos; +}; + +/* callbacks for output devices */ +static gboolean +write_out_ (mix_device_t *dev, const mix_word_t *block) +{ +  struct mixgtk_device_t *gtkdev; +   +  if (!((DEF_DEV_VTABLE_->write) (dev, block))) return FALSE; +  gtkdev = (struct mixgtk_device_t *) dev; +  if (gtkdev->buffer_len > 0) +    { +      gtk_text_insert (gtkdev->widget, NULL, NULL, NULL, +		       gtkdev->buffer, gtkdev->buffer_len); +      rewind (mix_io_to_FILE (gtkdev->device.file)); +      gtk_notebook_set_page (container_, gtkdev->pos); +      gtk_widget_draw (GTK_WIDGET (container_), NULL); +    } +  return TRUE; +} + +static mix_device_vtable_t MIXGTK_OUT_VTABLE_; + +/* create a new mixgtk device */ +static struct mixgtk_device_t * +mixgtk_device_new_ (mix_device_type_t type) +{ +  struct mixgtk_device_t *dev = NULL; + +  g_return_val_if_fail (type < mix_dev_INVALID, NULL); + +  if (MODES_[type] == mix_dev_CHAR && FMODES_[type] == mix_io_WRITE) +    { +      FILE *f; +      dev = g_new (struct mixgtk_device_t, 1); +      f = open_memstream (&(dev->buffer), &(dev->buffer_len)); +      g_assert (f); +      dev->device.file = mix_io_new (f); +      dev->device.type = type; +      dev->device.vtable = &MIXGTK_OUT_VTABLE_; +      dev->widget = (GtkText *)gtk_text_new (NULL, NULL); +      g_assert (dev->widget); +      gtk_text_set_editable (dev->widget, FALSE); +    } +  return dev; +} + +/* connect a device */ +static void +mixgtk_device_connect_ (struct mixgtk_device_t *dev) +{ +  static gint last_pos = 0; +  GtkWidget *label = gtk_label_new (DEF_NAMES_[dev->device.type]); +  GtkWidget *box = gtk_hbox_new (0, 0); +  GtkWidget *scroll = gtk_vscrollbar_new (dev->widget->vadj); +  g_assert (label); +  g_assert (box); +  gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (dev->widget), +		      TRUE, TRUE, 0); +  gtk_box_pack_start (GTK_BOX (box), scroll, FALSE, FALSE, 0); +  dev->pos = last_pos++; +  gtk_notebook_insert_page (container_, box, label, dev->pos); +  gtk_widget_show (box); +  gtk_widget_show (label); +  gtk_widget_show (scroll); +  gtk_widget_show (GTK_WIDGET (dev->widget)); +  gtk_widget_draw (GTK_WIDGET (container_), NULL); +  (void) mix_vm_connect_device (vm_, (mix_device_t *)dev); +} + +/* init default devices */ +gboolean +mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm) +{ +  static mix_device_type_t def_types[] = { +    mix_dev_CONSOLE, mix_dev_PRINTER, mix_dev_PAPER_TAPE, mix_dev_INVALID +  }; +   +  gint k = 0; +				      +  g_return_val_if_fail (container != NULL, FALSE); +  g_return_val_if_fail (vm != NULL, FALSE); +  container_ = container; +  vm_ = vm; + +  /* remove dummy page from container */ +  gtk_notebook_remove_page (container_, 0); + +  /* initialise vtables */ +  MIXGTK_OUT_VTABLE_.write = write_out_; +  MIXGTK_OUT_VTABLE_.read = DEF_DEV_VTABLE_->read; +  MIXGTK_OUT_VTABLE_.ioc = DEF_DEV_VTABLE_->ioc; +  MIXGTK_OUT_VTABLE_.busy = DEF_DEV_VTABLE_->busy; +   +  /* connect default devices */ +  while (def_types[k] != mix_dev_INVALID) +    { +      struct mixgtk_device_t *dev = mixgtk_device_new_ (def_types[k]); +      if (dev != NULL) +	  mixgtk_device_connect_ (dev); +      ++k; +    } + +  /* set to first page */ +  gtk_notebook_set_page (container_, 0); +   +  return TRUE; +} + +/* connect a new (file-based) device */ +gboolean +mixgtk_device_connect (mix_device_type_t type, const gchar *name); diff --git a/mixgtk/mixgtk_device.h b/mixgtk/mixgtk_device.h new file mode 100644 index 0000000..7c21238 --- /dev/null +++ b/mixgtk/mixgtk_device.h @@ -0,0 +1,42 @@ +/* -*-c-*- ---------------- mixgtk_device.h : + * Block devices used by mixgtk + * ------------------------------------------------------------------ + *  Last change: Time-stamp: <01/03/04 23:43:59 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_DEVICE_H +#define MIXGTK_DEVICE_H + +#include <gtk/gtk.h> +#include <mixlib/mix_vm.h> +#include <mixlib/mix_device.h> + +/* init default devices */ +extern gboolean +mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm); + + +/* connect a new (file-based) device */ +extern gboolean +mixgtk_device_connect (mix_device_type_t type, const gchar *name); + +#endif /* MIXGTK_DEVICE_H */ + diff --git a/mixgtk/mixgtk_gen_handlers.c b/mixgtk/mixgtk_gen_handlers.c new file mode 100644 index 0000000..9f23310 --- /dev/null +++ b/mixgtk/mixgtk_gen_handlers.c @@ -0,0 +1,95 @@ +/* -*-c-*- -------------- mixgtk_gen_handlers.c : + * Implementation of the functions declared in mixgtk_gen_handlers.h + * ------------------------------------------------------------------ + *  Last change: Time-stamp: "01/03/16 00:30:40 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 <mixlib/mix_vm_command.h> +#include "mixgtk_gen_handlers.h" +#include "mixgtk_cmd_dispatcher.h" + +void +on_main_window_destroy (GtkWidget *w, gpointer data) +{ +  gtk_main_quit (); +} + +static void +on_file_open_ok_ (GtkWidget *w, gpointer fs) +{ +  const gchar *file = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)); +  gchar *command = g_strdup_printf ("%s %s", +				    mix_vm_command_to_string (MIX_CMD_LOAD), +				    file); +  gtk_widget_destroy (GTK_WIDGET (fs)); +  mixgtk_cmd_dispatcher_dispatch (command); +  g_free (command); +} + +static void +on_file_open_destroy_ (GtkWidget *w, gpointer data) +{ +  gtk_grab_remove (GTK_WIDGET (w)); +} +   +void +on_file_open_activate (GtkWidget *w, gpointer data) +{ +  GtkWidget *file = gtk_file_selection_new ("Open program"); +  gtk_signal_connect (GTK_OBJECT (file), "destroy", +		      (GtkSignalFunc) on_file_open_destroy_, +		      GTK_OBJECT (file)); +  gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file)->ok_button), +		      "clicked", (GtkSignalFunc) on_file_open_ok_, +		      GTK_OBJECT (file)); +  gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION +					 (file)->cancel_button), +			     "clicked", (GtkSignalFunc) gtk_widget_destroy, +			     GTK_OBJECT (file)); +  gtk_widget_show (file); +  gtk_grab_add (file); +} + +void +on_debug_run_activate (GtkWidget *w, gpointer p) +{ +  mixgtk_cmd_dispatcher_dispatch (mix_vm_command_to_string (MIX_CMD_RUN)); +} + +void +on_debug_next_activate (GtkWidget *w, gpointer p) +{ +  mixgtk_cmd_dispatcher_dispatch (mix_vm_command_to_string (MIX_CMD_NEXT)); +} + + +void +on_file_exit_activate (GtkWidget *w, gpointer data) +{ +  gtk_main_quit (); +} + + +void +on_clear_breakpoints_activate (GtkWidget *w, gpointer data) +{ +  mixgtk_cmd_dispatcher_dispatch (mix_vm_command_to_string (MIX_CMD_CABP)); +} + diff --git a/mixgtk/mixgtk_gen_handlers.h b/mixgtk/mixgtk_gen_handlers.h new file mode 100644 index 0000000..6e0a45d --- /dev/null +++ b/mixgtk/mixgtk_gen_handlers.h @@ -0,0 +1,46 @@ +/* -*-c-*- ---------------- mixgtk_gen_handlers.h : + * general signal handlers declarations + * ------------------------------------------------------------------ + *  Last change: Time-stamp: <01/03/16 00:29:45 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_GEN_HANDLERS_H +#define MIXGTK_GEN_HANDLERS_H + +#include <gtk/gtk.h> + +extern void +on_main_window_destroy (GtkWidget *w, gpointer data); + +extern void +on_file_open_activate (GtkWidget *w, gpointer data); + +extern void +on_file_exit_activate (GtkWidget *w, gpointer data); + +extern void +on_clear_breakpoints_activate (GtkWidget *w, gpointer data); + + + + +#endif /* MIXGTK_GEN_HANDLERS_H */ + diff --git a/mixgtk/mixgtk_input.c b/mixgtk/mixgtk_input.c new file mode 100644 index 0000000..fa98056 --- /dev/null +++ b/mixgtk/mixgtk_input.c @@ -0,0 +1,189 @@ +/* -*-c-*- -------------- mixgtk_input.c : + * Implementation of the functions declared in mixgtk_input.h + * ------------------------------------------------------------------ + *  Last change: Time-stamp: "01/03/13 08:31:20 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 <ctype.h> +#include <stdlib.h> +#include "mixgtk_widgets.h" +#include "mixgtk_input.h" + +enum { +  MSG_, SIGN_, B1_, B2_, B3_, B4_, B5_, DEC_, RESET_, OK_, SIZE_ +}; + +static const gchar *WGT_NAMES_[SIZE_] = { +  "word_label",  "word_sign", "word_b1", "word_b2", "word_b3", +  "word_b4", "word_b5", "word_decimal",  "word_reset", "word_ok" +}; + +static GtkDialog *dialog_; +static GtkWidget *childs_[SIZE_]; +static input_callback_t callback_; +static gpointer data_; + +/* init */ +extern gboolean +mixgtk_input_init (void) +{ +  gint k; +   +  dialog_ = GTK_DIALOG (mixgtk_widget_factory_get (MIXGTK_WIDGET_WORD_DIALOG)); +  g_return_val_if_fail (dialog_ != NULL, FALSE); +  for (k = 0; k < SIZE_; ++k) +    { +      childs_[k] = mixgtk_widget_factory_get_by_name (WGT_NAMES_[k]); +      g_return_val_if_fail (childs_[k] != NULL, FALSE); +    } +  return TRUE; +   +} + +static void +set_word_ (mix_word_t word) +{ +  enum {SIZE = 50}; +  static gchar BUFFER[SIZE] = {0}; +  gint k; +  gint val = mix_word_magnitude (word); +  gboolean neg = mix_word_is_negative (word); +  snprintf (BUFFER, SIZE, "%s%d", neg ? "-" : "", val); +  gtk_entry_set_text (GTK_ENTRY (childs_[DEC_]), BUFFER); +  gtk_entry_set_text (GTK_ENTRY (childs_[SIGN_]), neg ? "-" : "+"); +  for (k = 1; k < 6; ++k) +    { +      mix_byte_t b = mix_word_get_byte (word, k); +      snprintf (BUFFER, SIZE, "%d", (int)b); +      gtk_entry_set_text (GTK_ENTRY (childs_[SIGN_ + k]), BUFFER); +    } +} + + +/* get a word */ +void +mixgtk_input_word (const gchar *message, mix_word_t def, +		   input_callback_t cb, gpointer data) +{ +  gtk_label_set_text (GTK_LABEL (childs_[MSG_]), message); +  set_word_ (def); +  callback_ = cb; +  data_ = data; +  gtk_widget_show (childs_[B1_]); +  gtk_widget_show (childs_[B2_]); +  gtk_widget_show (childs_[B3_]); +  gtk_widget_show (GTK_WIDGET (dialog_)); +} + +/* get a short */ +void +mixgtk_input_short (const gchar *message, mix_short_t def, +		    input_callback_t cb, gpointer data) +{ +  gtk_label_set_text (GTK_LABEL (childs_[MSG_]), message); +  set_word_ (mix_word_to_short_fast (def)); +  callback_ = cb; +  data_ = data; +  gtk_widget_show (GTK_WIDGET (dialog_)); +  gtk_widget_hide (childs_[B1_]); +  gtk_widget_hide (childs_[B2_]); +  gtk_widget_hide (childs_[B3_]); +} + +#include <gdk/gdkkeysyms.h> + +/* dec and bytes input handler */ +gboolean +on_word_dec_key_press (GtkWidget *dec, GdkEvent *event, gpointer *data) +{ +  GdkEventKey *key = (GdkEventKey *)event; +  if (key->string && strlen (key->string) > 0 && !iscntrl (key->string[0])) +    { +      gchar *text = gtk_entry_get_text (GTK_ENTRY (childs_[DEC_])); +      gint val = atoi (text); +      set_word_ (mix_word_new (val)); +    } +  return FALSE; +} + +gboolean +on_word_byte_key_press (GtkWidget *widget, GdkEvent *event, gpointer *data) +{ +  GdkEventKey *key = (GdkEventKey *)event; +  if (key->string && strlen (key->string) > 0 && !iscntrl (key->string[0])) +    { +      mix_byte_t bytes[5]; +      gint k; +      gchar *s; +      mix_word_t w; +       +      for (k = 0; k < 5; ++k) +	{ +	  gchar *text = gtk_entry_get_text (GTK_ENTRY (childs_[B1_ + k])); +	  bytes[k] = mix_byte_new (atoi (text)); +	} +      w = mix_bytes_to_word (bytes, 5); +      s = gtk_entry_get_text (GTK_ENTRY (childs_[SIGN_])); +      if (s && s[0] == '-') mix_word_reverse_sign (w); +      set_word_ (w); +    } +  return FALSE; +} + +gboolean +on_word_sign_key_press (GtkWidget *widget, GdkEvent *event, gpointer *data) +{ +  GdkEventKey *key = (GdkEventKey *)event; +  if (key->string && strlen (key->string) > 0 && !iscntrl (key->string[0])) +    { +      gchar s = key->string[0]; +      gchar *txt = gtk_entry_get_text (GTK_ENTRY (childs_[SIGN_])); +      gchar c = txt ? txt[0] : '+'; +      if ( (s == '+' || s == '-') && s != c) +	{ +	  mix_word_t w =   +	    mix_word_new (atoi +			  (gtk_entry_get_text (GTK_ENTRY (childs_[DEC_])))); +	  set_word_ (mix_word_negative (w)); +	} +    } +  return FALSE; +} + +void +on_word_ok_clicked (GtkWidget *widget, gpointer *data) +{ +  const gchar *text = gtk_entry_get_text (GTK_ENTRY (childs_[DEC_])); +  mix_word_t w = mix_word_new (atoi (text)); +  callback_ (w, data_); +  gtk_widget_hide (GTK_WIDGET (dialog_)); +} + +void +on_word_cancel_clicked (GtkWidget *widget, gpointer *data) +{ +  gtk_widget_hide (GTK_WIDGET (dialog_)); +} + +void +on_word_reset_clicked (GtkWidget *w, gpointer *data) +{ +  set_word_ (MIX_WORD_ZERO); +} diff --git a/mixgtk/mixgtk_input.h b/mixgtk/mixgtk_input.h new file mode 100644 index 0000000..275894d --- /dev/null +++ b/mixgtk/mixgtk_input.h @@ -0,0 +1,49 @@ +/* -*-c-*- ---------------- mixgtk_input.h : + * Declaration of functions for user input + * ------------------------------------------------------------------ + *  Last change: Time-stamp: <01/03/12 23:35: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_INPUT_H +#define MIXGTK_INPUT_H + +#include <mixlib/mix_types.h> + +/* callback function type */ +typedef void (*input_callback_t)(mix_word_t result, gpointer data); + +/* init */ +extern gboolean +mixgtk_input_init (void); + +/* get a word */ +extern void +mixgtk_input_word (const gchar *message, mix_word_t def, +		   input_callback_t cb, gpointer data); + +/* get a short */ +extern void +mixgtk_input_short (const gchar *message, mix_short_t def, +		    input_callback_t cb, gpointer data ); + + +#endif /* MIXGTK_INPUT_H */ + diff --git a/mixgtk/mixgtk_mixal.c b/mixgtk/mixgtk_mixal.c new file mode 100644 index 0000000..b59688d --- /dev/null +++ b/mixgtk/mixgtk_mixal.c @@ -0,0 +1,213 @@ +/* -*-c-*- -------------- mixgtk_mixal.c : + * Implementation of the functions declared in mixgtk_mixal.h + * ------------------------------------------------------------------ + *  Last change: Time-stamp: "01/03/12 23:48:29 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 <stdlib.h> +#include "mixgtk_widgets.h" +#include "mixgtk_mixal.h" + + +static mix_vm_t *vm_; +static GtkCList *clist_; +static GdkColor sel_color_; +static GdkColor break_color_; +static GdkColor plain_color_; +static gulong lineno_; + +#define SEL_COLOR_ "lightgrey" +#define BREAK_COLOR_ "red" +#define PLAIN_COLOR_ "white" + +static gboolean +init_color_ (GdkColor *c, const gchar *name) +{ +  static GdkColormap *cmap = NULL; +  if (!cmap) cmap = gtk_widget_get_colormap (GTK_WIDGET (clist_)); +  return (gdk_color_parse (name, c) && +	  gdk_colormap_alloc_color (cmap, c, FALSE, TRUE)); +} + +/* initialise the mixal widgets */ +gboolean +mixgtk_mixal_init (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); + +  /* allocate colors */ +  g_return_val_if_fail (init_color_ (&sel_color_, SEL_COLOR_), FALSE); +  g_return_val_if_fail (init_color_ (&break_color_, BREAK_COLOR_), FALSE); +  g_return_val_if_fail (init_color_ (&plain_color_, PLAIN_COLOR_), FALSE); +   +  return TRUE; +} + +/* load the corresponding mixal file */ +void +mixgtk_mixal_load_file (void) +{ +  enum {ADDR_SIZE = 20, CONT_SIZE = 200}; +  static gchar ADDR[ADDR_SIZE], CONT[CONT_SIZE]; +  static gchar *TEXT[] = {ADDR, CONT}; +  static gchar *NULL_TEXT[] = {NULL, NULL}; +   +  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) +	{ +	  const gchar *line = mix_src_file_get_line (file, k + 1); +	  snprintf (CONT, CONT_SIZE, "%03d:     %s", k + 1, line); +	  addr = mix_vm_get_lineno_address (vm_, k + 1); +	  if (addr != MIX_VM_CELL_NO) +	    { +	      sprintf (ADDR, "%04d:   ", mix_short_magnitude (addr)); +	      mix_word_print_to_buffer (mix_vm_get_addr_contents (vm_, addr), +					ADDR + strlen (ADDR)); +	    } +	  else +	    ADDR[0] = '\0'; +	  gtk_clist_append (clist_, TEXT); +	  gtk_clist_set_row_data (clist_, k, GINT_TO_POINTER +				  (mix_short_magnitude (addr))); +	} +      gtk_clist_append (clist_, NULL_TEXT); +      gtk_clist_set_row_data (clist_, k, GINT_TO_POINTER (MIX_VM_CELL_NO)); +      gtk_clist_unselect_row (clist_, 0, 0); +      gtk_clist_thaw (clist_); +    } +  else +    lineno_ = 0; +} + + +/* update the widgets */ +static void +reset_bg_ (gint row) +{ +  gint addr = GPOINTER_TO_INT (gtk_clist_get_row_data (clist_, row)); +  gboolean isset = mix_vm_has_breakpoint_at_address (vm_, addr); +  gtk_clist_set_background (clist_, row, +			    isset ? &break_color_ : &plain_color_); +} +   +static void +select_row_ (gint row) +{ +  static gint last = -1; +   +  gtk_clist_set_background (clist_, row, &sel_color_); +  if (gtk_clist_row_is_visible (clist_, row) != GTK_VISIBILITY_FULL) +    gtk_clist_moveto (clist_, row, 0, 0.25, 0); +  if (last != -1 && last != row) reset_bg_ (last); +  last = row; +} + +void +mixgtk_mixal_update (void) +{ +  gint addr = 0; +  gint k = 0; +   +  g_assert (vm_); +  g_assert (clist_); +   +  addr = mix_short_magnitude (mix_vm_get_prog_count (vm_)); +  k = gtk_clist_find_row_from_data (clist_, GINT_TO_POINTER (addr)); +  select_row_ (k); +} + +/* breakpoints */ +void +mixgtk_mixal_update_bp_at_address (guint addr) +{ +  gint k; + +  g_assert (vm_); +  g_assert (clist_); + +  k = gtk_clist_find_row_from_data (clist_, GINT_TO_POINTER (addr)); +  reset_bg_ (k); +} + +void +mixgtk_mixal_update_bp_at_line (guint line) +{ +  if ( line < 1 ) return; +   +  while (line < lineno_) +    { +      gint addr = GPOINTER_TO_INT (gtk_clist_get_row_data (clist_, line - 1)); +      if (addr != MIX_VM_CELL_NO) break; +      ++line; +    } +  reset_bg_ (line - 1); +} + +void +mixgtk_mixal_update_bp_all () +{ +  gint k, addr; +  for (k = 0; k < lineno_; ++k) reset_bg_ (k); +  addr = mix_vm_get_prog_count (vm_); +  k = gtk_clist_find_row_from_data (clist_, GINT_TO_POINTER (addr)); +  select_row_ (k); +} + +/* callbacks */ +void +on_mixal_select_row (GtkWidget *w, gint row, gint col, GdkEventButton *e, +		     gpointer data) +{ +  gboolean isset; +  gint addr, pc; +   +  gtk_clist_unselect_row (clist_, row, col); +  addr = GPOINTER_TO_INT (gtk_clist_get_row_data (clist_, row)); +  pc = mix_vm_get_prog_count (vm_); +  if (addr < MIX_VM_CELL_NO && addr != pc) +    { +      isset = mix_vm_has_breakpoint_at_address (vm_, addr); +      if (isset) +	mix_vm_clear_breakpoint_address (vm_, addr); +      else +	mix_vm_set_breakpoint_address (vm_, addr); +      reset_bg_ (row); +    } +} + diff --git a/mixgtk/mixgtk_mixal.h b/mixgtk/mixgtk_mixal.h new file mode 100644 index 0000000..819819a --- /dev/null +++ b/mixgtk/mixgtk_mixal.h @@ -0,0 +1,60 @@ +/* -*-c-*- ---------------- mixgtk_mixal.h : + * Declarations for functions displaying the mixal source file + * ------------------------------------------------------------------ + *  Last change: Time-stamp: <01/03/11 00:19:30 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 <gtk/gtk.h> +#include <mixlib/mix_vm.h> + +/* initialise the mixal widget */ +extern gboolean +mixgtk_mixal_init (mix_vm_t *vm); + +/* load the corresponding mixal file */ +extern void +mixgtk_mixal_load_file (void); + +/* update the widget */ +extern void +mixgtk_mixal_update (void); + +/* breakpoints */ +extern void +mixgtk_mixal_update_bp_at_address (guint addr); + +extern void +mixgtk_mixal_update_bp_at_line (guint line); + +extern void +mixgtk_mixal_update_bp_all (void); + + +/* callbacks */ +extern void +on_mixal_select_row (GtkWidget *w, gint row, gint col, GdkEventButton *e, +		     gpointer data); + +#endif /* MIXGTK_MIXAL_H */ + diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c new file mode 100644 index 0000000..9c5d9bd --- /dev/null +++ b/mixgtk/mixgtk_mixvm.c @@ -0,0 +1,423 @@ +/* -*-c-*- -------------- mixgtk_mixvm.c : + * Implementation of the functions declared in mixgtk_mixvm.h + * ------------------------------------------------------------------ + *  Last change: Time-stamp: "01/03/14 16:34:31 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 <stdlib.h> +#include <mixlib/xmix_vm.h> +#include "mixgtk_widgets.h" +#include "mixgtk_mixvm.h" +#include "mixgtk_cmd_dispatcher.h" +#include "mixgtk_input.h" + +/* register widgets */ +#define REGISTER_NO_ (MIXGTK_WIDGET_rI6 - MIXGTK_WIDGET_rA + 1) + +static GtkEntry *reg_entries_[REGISTER_NO_]; +static GtkTooltips *tips_; +static GtkEntry *loc_entry_; +static GtkWidget *goto_; +static GtkEntry *goto_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_; + +#define GOTO_ENTRY_NAME_ "goto_entry" + +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: +      tipval = mix_vm_get_rA (vm_); +      mix_word_print_to_buffer (tipval, BUFFER); +      break; +    case MIXGTK_WIDGET_rX: +      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: +    case MIXGTK_WIDGET_rI2: +    case MIXGTK_WIDGET_rI3: +    case MIXGTK_WIDGET_rI4: +    case MIXGTK_WIDGET_rI5: +    case MIXGTK_WIDGET_rI6: +      { +	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); + +} + + +static void +on_mem_adj_change_ (GtkAdjustment *adj) +{ +  mixgtk_mixvm_update_cells (); +} + + +/* initialise the mixvm widgets */ +gboolean +mixgtk_mixvm_init (mix_vm_t *vm) +{ +  int k; +  gchar *text[] = {"", ""}; +  GtkWidget *scrol; +  GtkAdjustment *adj; +   +  g_return_val_if_fail (vm != NULL, FALSE); +  vm_ = vm; + +  tips_ = gtk_tooltips_new (); + +  for (k = 0; k < REGISTER_NO_; ++k) +    { +      reg_entries_[k] = +	GTK_ENTRY (mixgtk_widget_factory_get (MIXGTK_WIDGET_rA + k)); +      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); + +  for (k = 0; k < 3; ++k) +    { +      cmp_buttons_[k] = +	GTK_TOGGLE_BUTTON (mixgtk_widget_factory_get (MIXGTK_WIDGET_CMP_L +k)); +      g_return_val_if_fail (cmp_buttons_[k] != NULL, FALSE); +    } + +  memory_ = GTK_CLIST (mixgtk_widget_factory_get (MIXGTK_WIDGET_CELLS)); +  g_return_val_if_fail (memory_ != NULL, FALSE); +  gtk_clist_set_column_justification (memory_, 0, GTK_JUSTIFY_CENTER); +  gtk_clist_set_column_justification (memory_, 1, GTK_JUSTIFY_CENTER); +  gtk_clist_freeze (memory_); +  for (k = 0; k< MIX_VM_CELL_NO; ++k) +    { +      gchar buffer[20]; +      sprintf (buffer, "%04d", k); +      text[0] = buffer; +      gtk_clist_append (memory_, text); +    } +  gtk_clist_thaw (memory_); + +  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); +   +  goto_ = mixgtk_widget_factory_get (MIXGTK_WIDGET_GOTO_DIALOG); +  g_return_val_if_fail (goto_ != NULL, FALSE); + +  goto_entry_ = GTK_ENTRY (mixgtk_widget_factory_get_by_name +			   (GOTO_ENTRY_NAME_)); +  g_return_val_if_fail (goto_entry_ != NULL, FALSE); + +  mixgtk_mixvm_update_vm_widgets (); +   +  return TRUE; +} + + +/* update register widgets */ +void +mixgtk_mixvm_update_registers (void) +{ +  gint k; +  for (k = MIXGTK_WIDGET_rA; k <= MIXGTK_WIDGET_rI6; ++k) +    update_register_ (k); +} + +/* update the overflow toggle */ +void +mixgtk_mixvm_update_over_toggle (void) +{ +  g_assert (over_button_); +  gtk_toggle_button_set_active (over_button_, +				mix_vm_get_overflow (vm_)); +} + +/* update the comparison flag */ +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); +} + + +/* update the memory cells */ +void +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; +  while (gtk_clist_row_is_visible (memory_, k) != GTK_VISIBILITY_NONE) +    { +      mix_word_print_to_buffer (mix_vm_get_addr_contents (vm_, k), BUFFER); +      gtk_clist_set_text (memory_, k, 1, BUFFER); +      ++k; +    } +   +  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 (); +} + + +/* update cmp flag */ +void +on_cmp_e_toggled (GtkWidget *widget, gpointer data) +{ +  if (GTK_TOGGLE_BUTTON (widget)->active) +    mix_vm_set_cmpflag (vm_, mix_EQ); +} + +void +on_cmp_l_toggled (GtkWidget *widget, gpointer data) +{ +  if (GTK_TOGGLE_BUTTON (widget)->active) +    mix_vm_set_cmpflag (vm_, mix_LESS); +} + +void +on_cmp_g_toggled (GtkWidget *widget, gpointer data) +{ +  if (GTK_TOGGLE_BUTTON (widget)->active) +    mix_vm_set_cmpflag (vm_, mix_GREAT); +} + +void +on_overflow_toggled (GtkWidget *widget, gpointer data) +{ +  mix_vm_set_overflow (vm_, GTK_TOGGLE_BUTTON (widget)->active); +} + + +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); +} + + +static void +register_AX_ (mix_word_t w, gpointer reg) +{ +  gint k = GPOINTER_TO_INT (reg); +  if (k == 0) +    mix_vm_set_rA (vm_, w); +  else +    mix_vm_set_rX (vm_, w); +  update_register_ (MIXGTK_WIDGET_rA + k); +} + +static void +register_j_ (mix_word_t w, gpointer data) +{ +  if (mix_word_is_negative (w)) mix_word_reverse_sign (w); +  mix_vm_set_rJ (vm_, mix_word_to_short_fast (w)); +  update_register_ (MIXGTK_WIDGET_rJ); +} + +static void +register_i_ (mix_word_t w, gpointer reg) +{ +  mix_vm_set_rI (vm_, GPOINTER_TO_INT (reg), mix_word_to_short_fast (w)); +  update_register_ (MIXGTK_WIDGET_rI1 - 1 + GPOINTER_TO_INT (reg)); +} + +gboolean +on_register_click (GtkWidget *w, GdkEvent *e, gpointer data) +{ +  enum {SIZE = 20}; +  static gchar BUFFER[SIZE]; +  gint k; +   +  if (w == GTK_WIDGET (reg_entries_[0])) +    mixgtk_input_word ("Register A", mix_vm_get_rA (vm_), +		       register_AX_, GINT_TO_POINTER (0)); +  else if (w == GTK_WIDGET (reg_entries_[1])) +    mixgtk_input_word ("Register X", mix_vm_get_rX (vm_), +		       register_AX_, GINT_TO_POINTER(1)); +  else if (w == GTK_WIDGET (reg_entries_[2])) +    mixgtk_input_short ("Register J", mix_vm_get_rJ (vm_), register_j_, NULL); +  else for (k = 1; k < 7; ++k) +    { +      if (w == GTK_WIDGET (reg_entries_[2 + k])) +	{ +	  snprintf (BUFFER, SIZE, "Register I%d", k); +	  mixgtk_input_short (BUFFER, mix_vm_get_rI (vm_, k), +			      register_i_, GINT_TO_POINTER (k)); +	  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)); +} + +void +on_memory_cells_click_column (GtkCList *w, gint row, gpointer data) +{ +  gtk_widget_show (goto_); +} + +void +on_goto_cancel_clicked (GtkWidget *w, gpointer data) +{ +  gtk_widget_hide (goto_); +} + +void +on_goto_ok_clicked (GtkWidget *w, gpointer data) +{ +  gchar *txt = gtk_entry_get_text (goto_entry_); +  mix_short_t addr = mix_short_new (atoi (txt)); +  if (addr < MIX_VM_CELL_NO) +    { +      gtk_widget_hide (goto_); +      mixgtk_mixvm_update_cells_to_address (addr); +    } +} + diff --git a/mixgtk/mixgtk_mixvm.h b/mixgtk/mixgtk_mixvm.h new file mode 100644 index 0000000..8207d91 --- /dev/null +++ b/mixgtk/mixgtk_mixvm.h @@ -0,0 +1,84 @@ +/* -*-c-*- ---------------- mixgtk_mixvm.h : + * Functions dealing with the mixvm widgets + * ------------------------------------------------------------------ + *  Last change: Time-stamp: <01/03/09 22:12:04 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_MIXVM_H +#define MIXGTK_MIXVM_H + +#include <mixlib/mix_vm.h> + +/* initialise the mixvm widgets */ +extern gboolean +mixgtk_mixvm_init (mix_vm_t *vm); + +/* update register widgets */ +extern void +mixgtk_mixvm_update_registers (void); + +/* update the overflow toggle */ +extern void +mixgtk_mixvm_update_over_toggle (void); + +/* update the comparison flag */ +extern void +mixgtk_mixvm_update_cmp (void); + +/* update the memory cells */ +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 */ +extern void +on_cmp_e_toggled (GtkWidget *widget, gpointer data); + +extern void +on_cmp_g_toggled (GtkWidget *widget, gpointer data); + +extern void +on_cmp_l_toggled (GtkWidget *widget, gpointer data); + +extern void +on_overflow_toggled (GtkWidget *widget, gpointer data); + +extern void +on_loc_arrow_clicked (GtkWidget *widget, gpointer data); + +				  + +#endif /* MIXGTK_MIXVM_H */ + diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c new file mode 100644 index 0000000..165da81 --- /dev/null +++ b/mixgtk/mixgtk_widgets.c @@ -0,0 +1,112 @@ +/* -*-c-*- -------------- mixgtk_widgets.c : + * Implementation of the functions declared in mixgtk_widgets.h + * ------------------------------------------------------------------ + *  Last change: Time-stamp: "01/03/15 14:42:37 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 <glade/glade.h> +#include <mixlib/mix.h> +#include "mixgtk_widgets.h" + +/* the glade spec */ +static GladeXML *xml_ = NULL; + +/* widget names */ +static const gchar *names_[] = { +  "main_window", +  "main_statusbar", +  "word_dialog", +  "about_dialog", +  "goto_dialog", +  "command_prompt", +  "command_log", +  "mixal_clist", +  "rA_entry", +  "rX_entry", +  "rJ_entry", +  "rI1_entry", +  "rI2_entry", +  "rI3_entry", +  "rI4_entry", +  "rI5_entry", +  "rI6_entry", +  "lesser_radio", +  "equal_radio", +  "greater_radio", +  "over_toggle", +  "memory_cells", +  "memory_scroll", +  "devices_notebook", +  "loc_entry", +  "elapsed_label", +  "program_label", +  "uptime_label", +  NULL +}; + +#define WIDGET_NO_ (sizeof (names_) / sizeof (names_[0])) + +#define VERSION_LABEL_ "version_label" +#define GPL_TEXT_ "gpl_text" + +GtkWidget *about_; + +/* create a new factory from an xml glade file */ +gboolean +mixgtk_widget_factory_init (const char *glade_file) +{ +  GtkWidget *label; +  glade_init (); +  xml_ = glade_xml_new (glade_file, NULL); +  if (!xml_) return FALSE; +  glade_xml_signal_autoconnect (xml_); +   +  about_ = mixgtk_widget_factory_get (MIXGTK_WIDGET_ABOUT_DIALOG); +  g_return_val_if_fail (about_ != NULL, FALSE); +  label = mixgtk_widget_factory_get_by_name (VERSION_LABEL_); +  g_return_val_if_fail (label != NULL, FALSE); +  gtk_label_set_text (GTK_LABEL(label), VERSION); +  gtk_widget_show (label); +  return TRUE; +} + +/* get a widget */ +GtkWidget * +mixgtk_widget_factory_get (mixgtk_widget_id_t widget) +{ +  g_return_val_if_fail (widget < WIDGET_NO_, NULL); +  return glade_xml_get_widget (xml_, names_[widget]); +} + +/* Get a widget by name */ +GtkWidget * +mixgtk_widget_factory_get_by_name (const gchar *name) +{ +  return glade_xml_get_widget (xml_, name); +} + +/* about box */ +void +on_about_activate (GtkWidget *w, gpointer data) +{ +  gtk_widget_show (about_); +} diff --git a/mixgtk/mixgtk_widgets.h b/mixgtk/mixgtk_widgets.h new file mode 100644 index 0000000..f20ddc3 --- /dev/null +++ b/mixgtk/mixgtk_widgets.h @@ -0,0 +1,80 @@ +/* -*-c-*- ---------------- mixgtk_widgets.h : + * glade-based factory of mixvm widgets + * ------------------------------------------------------------------ + *  Last change: Time-stamp: <01/03/15 14:42:13 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_WIDGETS_H +#define MIXGTK_WIDGETS_H + +#include <gtk/gtk.h> +#include <mixlib/mix_vm.h> + +/* enumeration of mixvm widget ids */ +typedef enum { +  MIXGTK_WIDGET_MAIN,		/* main app window */ +  MIXGTK_WIDGET_STATUSBAR, +  MIXGTK_WIDGET_WORD_DIALOG,	/* input dialog for a mix word */ +  MIXGTK_WIDGET_ABOUT_DIALOG, +  MIXGTK_WIDGET_GOTO_DIALOG, +  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, +  MIXGTK_WIDGET_rI1, +  MIXGTK_WIDGET_rI2, +  MIXGTK_WIDGET_rI3, +  MIXGTK_WIDGET_rI4, +  MIXGTK_WIDGET_rI5, +  MIXGTK_WIDGET_rI6, +  MIXGTK_WIDGET_CMP_L, +  MIXGTK_WIDGET_CMP_E, +  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; + + +/* create a new factory from an xml glade file */ +extern gboolean +mixgtk_widget_factory_init (const char *glade_file); + + +/* get a widget */ +extern GtkWidget * +mixgtk_widget_factory_get (mixgtk_widget_id_t widget); + +/* Get a widget by name */ +extern GtkWidget * +mixgtk_widget_factory_get_by_name (const gchar *name); + + +#endif /* MIXGTK_WIDGETS_H */ + | 
