summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mixgtk/Makefile.am7
-rw-r--r--mixgtk/mixgtk.c39
-rw-r--r--mixgtk/mixgtk.glade560
-rw-r--r--mixgtk/mixgtk_cmd_dispatcher.c62
-rw-r--r--mixgtk/mixgtk_cmd_dispatcher.h12
-rw-r--r--mixgtk/mixgtk_device.c155
-rw-r--r--mixgtk/mixgtk_device.h42
-rw-r--r--mixgtk/mixgtk_gen_handlers.c20
-rw-r--r--mixgtk/mixgtk_gen_handlers.h5
-rw-r--r--mixgtk/mixgtk_mixvm.c220
-rw-r--r--mixgtk/mixgtk_mixvm.h75
-rw-r--r--mixgtk/mixgtk_widgets.c38
-rw-r--r--mixgtk/mixgtk_widgets.h18
13 files changed, 975 insertions, 278 deletions
diff --git a/mixgtk/Makefile.am b/mixgtk/Makefile.am
index bb1881f..881ec99 100644
--- a/mixgtk/Makefile.am
+++ b/mixgtk/Makefile.am
@@ -17,4 +17,9 @@ LDADD = $(top_builddir)/mixlib/libmix.a
bin_PROGRAMS = mixgtk
mixgtk_SOURCES = mixgtk.c mixgtk_gen_handlers.h mixgtk_gen_handlers.c \
mixgtk_cmd_dispatcher.h mixgtk_cmd_dispatcher.c \
- mixgtk_widgets.h mixgtk_widgets.c
+ mixgtk_widgets.h mixgtk_widgets.c \
+ mixgtk_device.h mixgtk_device.c \
+ mixgtk_mixvm.h mixgtk_mixvm.c
+
+
+
diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c
index 01b57c0..1e4abf1 100644
--- a/mixgtk/mixgtk.c
+++ b/mixgtk/mixgtk.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk.c :
* Main function of the mix gtk front-end
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/02/27 01:55:13 jose"
+ * Last change: Time-stamp: "01/03/07 23:14:56 jose"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -26,25 +26,46 @@
#include <mixlib/mix.h>
#include "mixgtk_widgets.h"
#include "mixgtk_cmd_dispatcher.h"
+#include "mixgtk_device.h"
+#include "mixgtk_mixvm.h"
int
main(int argc, char *argv[])
{
const gchar *glade_file = "mixgtk.glade";
+ mix_vm_t *vm;
gtk_init(&argc, &argv);
mix_init_lib ();
- if (!mixgtk_widget_factory_init (glade_file)) {
- g_error ("Unable to initialise application (using %s)\n", glade_file);
- return EXIT_FAILURE;
- }
+ if (!mixgtk_widget_factory_init (glade_file))
+ {
+ g_error ("Unable to initialise application (using %s)\n", glade_file);
+ return EXIT_FAILURE;
+ }
- if (!mixgtk_cmd_dispatcher_init ()) {
- g_error ("Unable to initialise application\n");
- 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;
+ }
gtk_main();
diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade
index 0100ad4..188332e 100644
--- a/mixgtk/mixgtk.glade
+++ b/mixgtk/mixgtk.glade
@@ -9,8 +9,10 @@
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>False</gnome_support>
- <gettext_support>True</gettext_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>
@@ -161,60 +163,18 @@
<widget>
<class>GtkFixed</class>
<name>mixvm_widget</name>
- <border_width>10</border_width>
<width>375</width>
<height>287</height>
<widget>
- <class>GtkCList</class>
- <name>cells_clist</name>
- <x>128</x>
- <y>64</y>
- <width>225</width>
- <height>208</height>
- <can_focus>True</can_focus>
- <columns>2</columns>
- <column_widths>80,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>label95</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>label96</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>
<class>GtkEntry</class>
<name>rJ_entry</name>
- <x>40</x>
- <y>48</y>
+ <x>304</x>
+ <y>88</y>
<width>60</width>
- <height>22</height>
+ <height>24</height>
<can_focus>True</can_focus>
- <editable>True</editable>
+ <editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>- 00 23</text>
@@ -224,11 +184,11 @@
<class>GtkEntry</class>
<name>rA_entry</name>
<x>40</x>
- <y>8</y>
+ <y>24</y>
<width>118</width>
<height>22</height>
<can_focus>True</can_focus>
- <editable>True</editable>
+ <editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>+ 01 45 34 49 49</text>
@@ -237,12 +197,12 @@
<widget>
<class>GtkEntry</class>
<name>rX_entry</name>
- <x>232</x>
- <y>8</y>
+ <x>248</x>
+ <y>24</y>
<width>118</width>
<height>22</height>
<can_focus>True</can_focus>
- <editable>True</editable>
+ <editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@@ -252,11 +212,11 @@
<class>GtkEntry</class>
<name>rI2_entry</name>
<x>40</x>
- <y>120</y>
+ <y>144</y>
<width>60</width>
<height>22</height>
<can_focus>True</can_focus>
- <editable>True</editable>
+ <editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@@ -268,9 +228,9 @@
<x>40</x>
<y>88</y>
<width>60</width>
- <height>22</height>
+ <height>24</height>
<can_focus>True</can_focus>
- <editable>True</editable>
+ <editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@@ -280,11 +240,11 @@
<class>GtkEntry</class>
<name>rI3_entry</name>
<x>40</x>
- <y>152</y>
+ <y>200</y>
<width>60</width>
<height>22</height>
<can_focus>True</can_focus>
- <editable>True</editable>
+ <editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@@ -293,12 +253,12 @@
<widget>
<class>GtkEntry</class>
<name>rI4_entry</name>
- <x>40</x>
- <y>184</y>
+ <x>168</x>
+ <y>88</y>
<width>60</width>
- <height>22</height>
+ <height>24</height>
<can_focus>True</can_focus>
- <editable>True</editable>
+ <editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@@ -307,12 +267,12 @@
<widget>
<class>GtkEntry</class>
<name>rI5_entry</name>
- <x>40</x>
- <y>216</y>
+ <x>168</x>
+ <y>144</y>
<width>60</width>
<height>22</height>
<can_focus>True</can_focus>
- <editable>True</editable>
+ <editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@@ -321,12 +281,12 @@
<widget>
<class>GtkEntry</class>
<name>rI6_entry</name>
- <x>40</x>
- <y>248</y>
+ <x>168</x>
+ <y>200</y>
<width>60</width>
<height>22</height>
<can_focus>True</can_focus>
- <editable>True</editable>
+ <editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@@ -334,12 +294,12 @@
<widget>
<class>GtkLabel</class>
- <name>label99</name>
+ <name>label100</name>
<x>8</x>
- <y>50</y>
+ <y>91</y>
<width>31</width>
<height>16</height>
- <label>J</label>
+ <label>I1</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -350,12 +310,12 @@
<widget>
<class>GtkLabel</class>
- <name>label100</name>
+ <name>label102</name>
<x>8</x>
- <y>91</y>
+ <y>200</y>
<width>31</width>
<height>16</height>
- <label>I1</label>
+ <label>I3</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -368,7 +328,7 @@
<class>GtkLabel</class>
<name>label101</name>
<x>8</x>
- <y>124</y>
+ <y>144</y>
<width>31</width>
<height>16</height>
<label>I2</label>
@@ -382,12 +342,28 @@
<widget>
<class>GtkLabel</class>
- <name>label102</name>
- <x>8</x>
- <y>155</y>
+ <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>I3</label>
+ <label>I5</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -398,12 +374,12 @@
<widget>
<class>GtkLabel</class>
- <name>label103</name>
- <x>8</x>
- <y>187</y>
+ <name>label105</name>
+ <x>136</x>
+ <y>200</y>
<width>31</width>
<height>16</height>
- <label>I4</label>
+ <label>I6</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -414,12 +390,12 @@
<widget>
<class>GtkLabel</class>
- <name>label104</name>
- <x>8</x>
- <y>219</y>
+ <name>label98</name>
+ <x>216</x>
+ <y>24</y>
<width>31</width>
<height>16</height>
- <label>I5</label>
+ <label>X</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -430,12 +406,12 @@
<widget>
<class>GtkLabel</class>
- <name>label105</name>
+ <name>label97</name>
<x>8</x>
- <y>251</y>
+ <y>24</y>
<width>31</width>
<height>16</height>
- <label>I6</label>
+ <label>A</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -445,129 +421,122 @@
</widget>
<widget>
- <class>GtkNotebook</class>
- <name>devices_notebook</name>
- <x>380</x>
- <y>10</y>
- <width>252</width>
- <height>262</height>
- <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>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow45</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>
-
- <widget>
- <class>GtkText</class>
- <name>text37</name>
- <can_focus>True</can_focus>
- <editable>False</editable>
- <text></text>
- </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>
- <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>
+ <class>GtkVSeparator</class>
+ <name>vseparator2</name>
+ <x>0</x>
+ <y>8</y>
+ <width>16</width>
+ <height>263</height>
+ </widget>
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow46</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>
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator3</name>
+ <x>6</x>
+ <y>1</y>
+ <width>627</width>
+ <height>16</height>
+ </widget>
- <widget>
- <class>GtkText</class>
- <name>text38</name>
- <can_focus>True</can_focus>
- <editable>False</editable>
- <text></text>
- </widget>
- </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>
- <child_name>Notebook:tab</child_name>
- <name>label157</name>
- <label>disk1</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>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>GtkScrolledWindow</class>
- <name>scrolledwindow47</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>
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator2</name>
+ <x>6</x>
+ <y>265</y>
+ <width>627</width>
+ <height>16</height>
+ </widget>
- <widget>
- <class>GtkText</class>
- <name>text39</name>
- <can_focus>True</can_focus>
- <editable>False</editable>
- <text></text>
- </widget>
- </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>
- <child_name>Notebook:tab</child_name>
- <name>label158</name>
- <label>paper</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>GtkVSeparator</class>
- <name>vseparator1</name>
- <x>360</x>
- <y>8</y>
- <width>16</width>
- <height>264</height>
+ <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>GtkLabel</class>
- <name>label97</name>
- <x>8</x>
- <y>12</y>
- <width>31</width>
+ <name>elapsed_label</name>
+ <x>64</x>
+ <y>248</y>
+ <width>48</width>
<height>16</height>
- <label>A</label>
+ <label>000000</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -578,12 +547,12 @@
<widget>
<class>GtkLabel</class>
- <name>label98</name>
- <x>200</x>
- <y>11</y>
- <width>31</width>
+ <name>program_label</name>
+ <x>184</x>
+ <y>248</y>
+ <width>56</width>
<height>16</height>
- <label>X</label>
+ <label>000000</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -593,56 +562,156 @@
</widget>
<widget>
- <class>GtkRadioButton</class>
- <name>lesser_radio</name>
- <x>136</x>
- <y>40</y>
- <width>35</width>
- <height>24</height>
- <can_focus>True</can_focus>
- <label>L</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
+ <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>GtkRadioButton</class>
<name>equal_radio</name>
- <x>176</x>
- <y>40</y>
+ <x>312</x>
+ <y>136</y>
<width>31</width>
<height>24</height>
<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>216</x>
- <y>40</y>
+ <x>336</x>
+ <y>160</y>
<width>32</width>
<height>24</height>
<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>GtkRadioButton</class>
- <name>over_radio</name>
- <x>279</x>
- <y>45</y>
- <width>76</width>
- <height>14</height>
+ <name>lesser_radio</name>
+ <x>288</x>
+ <y>160</y>
+ <width>35</width>
+ <height>24</height>
+ <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>GtkVSeparator</class>
+ <name>vseparator1</name>
+ <x>376</x>
+ <y>10</y>
+ <width>16</width>
+ <height>263</height>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>over_toggle</name>
+ <x>296</x>
+ <y>200</y>
+ <width>72</width>
+ <height>24</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>GtkScrolledWindow</class>
+ <name>memory_scroll</name>
+ <x>392</x>
+ <y>16</y>
+ <width>215</width>
+ <height>248</height>
+ <hscrollbar_policy>GTK_POLICY_NEVER</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>memory_cells</name>
+ <width>200</width>
+ <height>248</height>
+ <can_focus>True</can_focus>
+ <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>
@@ -659,6 +728,51 @@
</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>Devices</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>GtkVBox</class>
<name>vbox2</name>
<homogeneous>False</homogeneous>
@@ -795,7 +909,7 @@ START LDA 1000
<widget>
<class>GtkScrolledWindow</class>
- <name>scrolledwindow48</name>
+ <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>
diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c
index c5fef58..dc64f2f 100644
--- a/mixgtk/mixgtk_cmd_dispatcher.c
+++ b/mixgtk/mixgtk_cmd_dispatcher.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_cmd_dispatcher.c :
* Implementation of the functions declared in mixgtk_cmd_dispatcher.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/02/26 03:15:18 jose"
+ * Last change: Time-stamp: "01/03/07 23:17:54 jose"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -26,6 +26,8 @@
#include <stdio.h>
#include <mixlib/mix_vm_command.h>
#include "mixgtk_cmd_dispatcher.h"
+#include "mixgtk_mixvm.h"
+
/* a mix vm command dispatcher */
struct mixgtk_dispatch_
@@ -61,7 +63,7 @@ global_pre_hook_ (mix_vm_cmd_dispatcher_t *dis,
else
{
gtk_text_insert (GTK_TEXT (dis_data_.log), NULL, NULL, NULL,
- _("*** Invalid command\n"), -1);
+ _("\n*** Invalid command ***\n"), -1);
}
}
@@ -76,6 +78,25 @@ global_post_hook_ (mix_vm_cmd_dispatcher_t *dis,
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 void
+run_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg,
+ gpointer data)
+{
+}
+
+static void
+next_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg,
+ gpointer data)
+{
}
@@ -98,14 +119,41 @@ mixgtk_cmd_dispatcher_init (void)
if (!out) return FALSE;
dis_data_.out = out;
dis_data_.dispatcher = mix_vm_cmd_dispatcher_new (out, out);
- mix_vm_cmd_dispatcher_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_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);
}
return TRUE;
}
+/* dispatch an externally provided command */
+void
+mixgtk_cmd_dispatcher_dispatch (const gchar *command)
+{
+ GtkWidget *entry = mixgtk_widget_factory_get (MIXGTK_WIDGET_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 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)
@@ -115,3 +163,5 @@ on_mixvm_cmd_entry_activate (GtkWidget *w, gpointer e)
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
index 0169a5d..b0beb17 100644
--- a/mixgtk/mixgtk_cmd_dispatcher.h
+++ b/mixgtk/mixgtk_cmd_dispatcher.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_cmd_dispatcher.h :
* functions to access the command dispatcher
* ------------------------------------------------------------------
- * Last change: Time-stamp: <01/02/25 17:24:28 jose>
+ * Last change: Time-stamp: <01/03/06 22:29:57 jose>
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -25,12 +25,20 @@
#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 ();
+mixgtk_cmd_dispatcher_init (void);
+/* dispatch an externally provided command */
+extern void
+mixgtk_cmd_dispatcher_dispatch (const gchar *command);
+
+/* get the underlying vm */
+extern mix_vm_t *
+mixgtk_cmd_dispatcher_get_vm (void);
/* make gtk signal callbacks accessible to glade */
/* new command handler */
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
index e472341..8f0c07c 100644
--- a/mixgtk/mixgtk_gen_handlers.c
+++ b/mixgtk/mixgtk_gen_handlers.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_gen_handlers.c :
* Implementation of the functions declared in mixgtk_gen_handlers.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/02/23 00:36:31 jose"
+ * Last change: Time-stamp: "01/03/07 23:25:10 jose"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -21,8 +21,9 @@
*
*/
-
+#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)
@@ -34,8 +35,12 @@ static void
on_file_open_ok_ (GtkWidget *w, gpointer fs)
{
const gchar *file = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
- g_print ("File %s selected\n", file);
+ 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
@@ -65,15 +70,6 @@ on_file_open_activate (GtkWidget *w, gpointer data)
void
on_file_exit_activate (GtkWidget *w, gpointer data)
{
- g_message ("File_exit activated");
gtk_main_quit ();
}
-void
-on_debug_activate (GtkWidget *w, gpointer data)
-{
-}
-
-
-
-
diff --git a/mixgtk/mixgtk_gen_handlers.h b/mixgtk/mixgtk_gen_handlers.h
index e1aed47..5b1d788 100644
--- a/mixgtk/mixgtk_gen_handlers.h
+++ b/mixgtk/mixgtk_gen_handlers.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_gen_handlers.h :
* general signal handlers declarations
* ------------------------------------------------------------------
- * Last change: Time-stamp: <01/02/23 00:36:35 jose>
+ * Last change: Time-stamp: <01/03/07 23:23:25 jose>
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -36,8 +36,7 @@ on_file_open_activate (GtkWidget *w, gpointer data);
extern void
on_file_exit_activate (GtkWidget *w, gpointer data);
-extern void
-on_debug_activate (GtkWidget *w, gpointer data);
+
diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c
new file mode 100644
index 0000000..ba5023a
--- /dev/null
+++ b/mixgtk/mixgtk_mixvm.c
@@ -0,0 +1,220 @@
+/* -*-c-*- -------------- mixgtk_mixvm.c :
+ * Implementation of the functions declared in mixgtk_mixvm.h
+ * ------------------------------------------------------------------
+ * Last change: Time-stamp: "01/03/08 23:22:49 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/xmix_vm.h>
+#include "mixgtk_widgets.h"
+#include "mixgtk_mixvm.h"
+
+/* register widgets */
+#define REGISTER_NO_ (MIXGTK_WIDGET_rI6 - MIXGTK_WIDGET_rA + 1)
+
+static GtkEntry *reg_entries_[REGISTER_NO_];
+static GtkToggleButton *over_button_;
+static GtkToggleButton *cmp_buttons_[3];
+static GtkCList *memory_;
+static mix_vm_t *vm_;
+
+
+static void
+update_register_ (mixgtk_widget_id_t reg)
+{
+ static gchar BUFFER[20];
+ switch (reg)
+ {
+ case MIXGTK_WIDGET_rA:
+ mix_word_print_to_buffer (mix_vm_get_rA (vm_), BUFFER);
+ break;
+ case MIXGTK_WIDGET_rX:
+ mix_word_print_to_buffer (mix_vm_get_rX (vm_), BUFFER);
+ break;
+ case MIXGTK_WIDGET_rJ:
+ 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:
+ mix_short_print_to_buffer (mix_vm_get_rI (vm_,
+ reg - MIXGTK_WIDGET_rI1 + 1),
+ BUFFER);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ gtk_entry_set_text (reg_entries_[reg - MIXGTK_WIDGET_rA], BUFFER);
+}
+
+
+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;
+
+ 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);
+ }
+
+ 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_by_name ("memory_scroll");
+ 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);
+
+ 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_ != NULL);
+ gtk_toggle_button_set_active (over_button_,
+ mix_vm_get_overflow (vm_));
+}
+
+/* update the comparison flag */
+void
+mixgtk_mixvm_update_cmp (void)
+{
+ gint toggle;
+ 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;
+
+ 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_);
+}
+
+
+/* update all mixvm widgets */
+void
+mixgtk_mixvm_update_vm_widgets (void)
+{
+ mixgtk_mixvm_update_registers ();
+ mixgtk_mixvm_update_over_toggle ();
+ mixgtk_mixvm_update_cmp ();
+ mixgtk_mixvm_update_cells ();
+}
+
+
+/* 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);
+}
+
+
diff --git a/mixgtk/mixgtk_mixvm.h b/mixgtk/mixgtk_mixvm.h
new file mode 100644
index 0000000..a2699cb
--- /dev/null
+++ b/mixgtk/mixgtk_mixvm.h
@@ -0,0 +1,75 @@
+/* -*-c-*- ---------------- mixgtk_mixvm.h :
+ * Functions dealing with the mixvm widgets
+ * ------------------------------------------------------------------
+ * Last change: Time-stamp: <01/03/07 23:58:35 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);
+
+/* update all mixvm widgets */
+extern void
+mixgtk_mixvm_update_vm_widgets (void);
+
+/* callbacks */
+/* cmp flag changed */
+extern void
+on_cmp_e_toggled (GtkWidget *widget, gpointer data);
+
+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_memory_cells_scroll_vertical (GtkWidget *widget, GtkScrollType,
+ gfloat, gpointer);
+
+
+
+#endif /* MIXGTK_MIXVM_H */
+
diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c
index aa06643..276a6fb 100644
--- a/mixgtk/mixgtk_widgets.c
+++ b/mixgtk/mixgtk_widgets.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_widgets.c :
* Implementation of the functions declared in mixgtk_widgets.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/02/26 02:57:02 jose"
+ * Last change: Time-stamp: "01/03/08 22:32:35 jose"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -34,11 +34,29 @@ static const gchar *names_[] = {
"main_window",
"word_dialog",
"command_prompt",
- "command_log"
+ "command_log",
+ "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",
+ "devices_notebook",
+ NULL
};
#define WIDGET_NO_ (sizeof (names_) / sizeof (names_[0]))
+
+
/* create a new factory from an xml glade file */
gboolean
mixgtk_widget_factory_init (const char *glade_file)
@@ -47,6 +65,7 @@ mixgtk_widget_factory_init (const char *glade_file)
xml_ = glade_xml_new (glade_file, NULL);
if (!xml_) return FALSE;
glade_xml_signal_autoconnect (xml_);
+
return TRUE;
}
@@ -58,14 +77,11 @@ mixgtk_widget_factory_get (mixgtk_widget_id_t widget)
return glade_xml_get_widget (xml_, names_[widget]);
}
-/* update a widget from a virtual machine */
-extern void
-mixgtk_widget_factory_update_widget (mixgtk_widget_id_t widget,
- const mix_vm_t *vm);
-
-/* update the virtual machine from a widget */
-extern void
-mixgtk_widget_factory_update_vm (mixgtk_widget_id_t widget,
- mix_vm_t *vm);
+/* Get a widget by name */
+GtkWidget *
+mixgtk_widget_factory_get_by_name (const gchar *name)
+{
+ return glade_xml_get_widget (xml_, name);
+}
diff --git a/mixgtk/mixgtk_widgets.h b/mixgtk/mixgtk_widgets.h
index 60781e4..26e8b4d 100644
--- a/mixgtk/mixgtk_widgets.h
+++ b/mixgtk/mixgtk_widgets.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_widgets.h :
* glade-based factory of mixvm widgets
* ------------------------------------------------------------------
- * Last change: Time-stamp: <01/02/25 12:51:58 jose>
+ * Last change: Time-stamp: <01/03/08 22:27:01 jose>
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -43,7 +43,9 @@ typedef enum {
MIXGTK_WIDGET_rI4,
MIXGTK_WIDGET_rI5,
MIXGTK_WIDGET_rI6,
- MIXGTK_WIDGET_CMP,
+ MIXGTK_WIDGET_CMP_L,
+ MIXGTK_WIDGET_CMP_E,
+ MIXGTK_WIDGET_CMP_G,
MIXGTK_WIDGET_OVER,
MIXGTK_WIDGET_CELLS,
MIXGTK_WIDGET_DEVICE,
@@ -60,15 +62,9 @@ mixgtk_widget_factory_init (const char *glade_file);
extern GtkWidget *
mixgtk_widget_factory_get (mixgtk_widget_id_t widget);
-/* update a widget from a virtual machine */
-extern void
-mixgtk_widget_factory_update_widget (mixgtk_widget_id_t widget,
- const mix_vm_t *vm);
-
-/* update the virtual machine from a widget */
-extern void
-mixgtk_widget_factory_update_vm (mixgtk_widget_id_t widget,
- mix_vm_t *vm);
+/* Get a widget by name */
+extern GtkWidget *
+mixgtk_widget_factory_get_by_name (const gchar *name);
#endif /* MIXGTK_WIDGETS_H */