summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mixgtk/mixgtk.glade422
-rw-r--r--mixgtk/mixgtk_input.c42
-rw-r--r--mixgtk/mixgtk_mixvm.c51
-rw-r--r--mixgtk/mixgtk_widgets.c24
-rw-r--r--mixgtk/mixgtk_widgets.h3
-rw-r--r--mixlib/mix.c6
-rw-r--r--mixlib/mix_types.c13
7 files changed, 390 insertions, 171 deletions
diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade
index 247d08b..25df994 100644
--- a/mixgtk/mixgtk.glade
+++ b/mixgtk/mixgtk.glade
@@ -47,7 +47,7 @@
<child>
<padding>0</padding>
<expand>False</expand>
- <fill>False</fill>
+ <fill>True</fill>
</child>
<widget>
@@ -143,6 +143,30 @@
</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>
@@ -231,10 +255,9 @@
<name>rA_entry</name>
<x>40</x>
<y>24</y>
- <width>118</width>
- <height>22</height>
+ <width>120</width>
+ <height>24</height>
<can_focus>True</can_focus>
- <events>GDK_BUTTON_PRESS_MASK</events>
<signal>
<name>button_press_event</name>
<handler>on_register_click</handler>
@@ -251,8 +274,8 @@
<name>rX_entry</name>
<x>248</x>
<y>24</y>
- <width>118</width>
- <height>22</height>
+ <width>120</width>
+ <height>24</height>
<can_focus>True</can_focus>
<signal>
<name>button_press_event</name>
@@ -598,58 +621,6 @@
</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>
<class>GtkEntry</class>
<name>rI5_entry</name>
<x>168</x>
@@ -683,63 +654,6 @@
</widget>
<widget>
- <class>GtkRadioButton</class>
- <name>lesser_radio</name>
- <x>264</x>
- <y>128</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>GtkRadioButton</class>
- <name>equal_radio</name>
- <x>304</x>
- <y>128</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>336</x>
- <y>128</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>GtkLabel</class>
<name>label167</name>
<x>256</x>
@@ -846,6 +760,125 @@
<active>False</active>
<draw_indicator>True</draw_indicator>
</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>
+ <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>
+ <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>
<widget>
@@ -863,7 +896,7 @@
<widget>
<class>GtkScrolledWindow</class>
- <name>scrolledwindow28</name>
+ <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>
@@ -1061,9 +1094,24 @@
<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_NONE</position>
+ <position>GTK_WIN_POS_MOUSE</position>
<modal>True</modal>
<default_width>250</default_width>
<allow_shrink>False</allow_shrink>
@@ -1154,7 +1202,7 @@
<widget>
<class>GtkFixed</class>
- <name>fixed3</name>
+ <name>word_layout</name>
<width>250</width>
<height>97</height>
<child>
@@ -1171,6 +1219,7 @@
<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>
@@ -1179,8 +1228,8 @@
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text>-63</text>
+ <text_max_length>11</text_max_length>
+ <text>0</text>
</widget>
<widget>
@@ -1270,6 +1319,7 @@
<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>
@@ -1289,8 +1339,13 @@
<x>88</x>
<y>64</y>
<width>16</width>
- <height>22</height>
+ <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>
@@ -1348,4 +1403,129 @@
</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>
+
</GTK-Interface>
diff --git a/mixgtk/mixgtk_input.c b/mixgtk/mixgtk_input.c
index 8f4a777..fa98056 100644
--- a/mixgtk/mixgtk_input.c
+++ b/mixgtk/mixgtk_input.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_input.c :
* Implementation of the functions declared in mixgtk_input.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/03/13 01:27:32 jose"
+ * Last change: Time-stamp: "01/03/13 08:31:20 jose"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -21,6 +21,7 @@
*
*/
+#include <ctype.h>
#include <stdlib.h>
#include "mixgtk_widgets.h"
#include "mixgtk_input.h"
@@ -34,7 +35,6 @@ static const gchar *WGT_NAMES_[SIZE_] = {
"word_b4", "word_b5", "word_decimal", "word_reset", "word_ok"
};
-
static GtkDialog *dialog_;
static GtkWidget *childs_[SIZE_];
static input_callback_t callback_;
@@ -53,8 +53,8 @@ mixgtk_input_init (void)
childs_[k] = mixgtk_widget_factory_get_by_name (WGT_NAMES_[k]);
g_return_val_if_fail (childs_[k] != NULL, FALSE);
}
-
return TRUE;
+
}
static void
@@ -71,7 +71,7 @@ set_word_ (mix_word_t word)
for (k = 1; k < 6; ++k)
{
mix_byte_t b = mix_word_get_byte (word, k);
- snprintf (BUFFER, SIZE, "%02d", (int)b);
+ snprintf (BUFFER, SIZE, "%d", (int)b);
gtk_entry_set_text (GTK_ENTRY (childs_[SIGN_ + k]), BUFFER);
}
}
@@ -105,32 +105,29 @@ mixgtk_input_short (const gchar *message, mix_short_t def,
gtk_widget_hide (childs_[B1_]);
gtk_widget_hide (childs_[B2_]);
gtk_widget_hide (childs_[B3_]);
- /* gtk_widget_draw (GTK_WIDGET (dialog_));*/
}
#include <gdk/gdkkeysyms.h>
/* dec and bytes input handler */
-void
+gboolean
on_word_dec_key_press (GtkWidget *dec, GdkEvent *event, gpointer *data)
{
GdkEventKey *key = (GdkEventKey *)event;
- if (key->string && strlen (key->string) > 0)
+ 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));
}
- if (key->keyval == GDK_KP_Tab || key->keyval == GDK_Tab ||
- key->keyval == GDK_ISO_Left_Tab)
- gtk_window_set_focus (GTK_WINDOW (dialog_), childs_[SIGN_]);
+ return FALSE;
}
-void
+gboolean
on_word_byte_key_press (GtkWidget *widget, GdkEvent *event, gpointer *data)
{
GdkEventKey *key = (GdkEventKey *)event;
- if (key->string && strlen (key->string) > 0)
+ if (key->string && strlen (key->string) > 0 && !iscntrl (key->string[0]))
{
mix_byte_t bytes[5];
gint k;
@@ -147,20 +144,14 @@ on_word_byte_key_press (GtkWidget *widget, GdkEvent *event, gpointer *data)
if (s && s[0] == '-') mix_word_reverse_sign (w);
set_word_ (w);
}
- if (key->keyval == GDK_KP_Tab || key->keyval == GDK_Tab ||
- key->keyval == GDK_ISO_Left_Tab)
- {
- gint k = 0;
- while (widget != childs_[k]) ++k;
- gtk_window_set_focus (GTK_WINDOW (dialog_), childs_[(k + 1)%SIZE_]);
- }
+ return FALSE;
}
-void
+gboolean
on_word_sign_key_press (GtkWidget *widget, GdkEvent *event, gpointer *data)
{
GdkEventKey *key = (GdkEventKey *)event;
- if (key->string && strlen (key->string) > 0)
+ 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_]));
@@ -173,9 +164,7 @@ on_word_sign_key_press (GtkWidget *widget, GdkEvent *event, gpointer *data)
set_word_ (mix_word_negative (w));
}
}
- if (key->keyval == GDK_KP_Tab || key->keyval == GDK_Tab ||
- key->keyval == GDK_ISO_Left_Tab)
- gtk_window_set_focus (GTK_WINDOW (dialog_), childs_[B1_]);
+ return FALSE;
}
void
@@ -198,8 +187,3 @@ on_word_reset_clicked (GtkWidget *w, gpointer *data)
{
set_word_ (MIX_WORD_ZERO);
}
-
-
-
-
-
diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c
index 1ef32a5..c90b453 100644
--- a/mixgtk/mixgtk_mixvm.c
+++ b/mixgtk/mixgtk_mixvm.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_mixvm.c :
* Implementation of the functions declared in mixgtk_mixvm.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/03/13 00:24:56 jose"
+ * Last change: Time-stamp: "01/03/13 23:14:00 jose"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -39,21 +39,25 @@ static GtkLabel *laptime_;
static GtkLabel *progtime_;
static GtkLabel *uptime_;
static mix_vm_t *vm_;
-
+static GtkTooltips *tips_;
static void
update_register_ (mixgtk_widget_id_t reg)
{
static gchar BUFFER[20];
+ mix_word_t tipval = MIX_WORD_ZERO;
switch (reg)
{
case MIXGTK_WIDGET_rA:
- mix_word_print_to_buffer (mix_vm_get_rA (vm_), BUFFER);
+ tipval = mix_vm_get_rA (vm_);
+ mix_word_print_to_buffer (tipval, BUFFER);
break;
case MIXGTK_WIDGET_rX:
- mix_word_print_to_buffer (mix_vm_get_rX (vm_), BUFFER);
+ tipval = mix_vm_get_rX (vm_);
+ mix_word_print_to_buffer (tipval, BUFFER);
break;
case MIXGTK_WIDGET_rJ:
+ tipval = mix_short_to_word_fast (mix_vm_get_rJ (vm_));
mix_short_print_to_buffer (mix_vm_get_rJ (vm_), BUFFER);
break;
case MIXGTK_WIDGET_rI1:
@@ -62,14 +66,22 @@ update_register_ (mixgtk_widget_id_t reg)
case MIXGTK_WIDGET_rI4:
case MIXGTK_WIDGET_rI5:
case MIXGTK_WIDGET_rI6:
- mix_short_print_to_buffer (mix_vm_get_rI (vm_,
- reg - MIXGTK_WIDGET_rI1 + 1),
- BUFFER);
+ {
+ gint k = reg - MIXGTK_WIDGET_rI1 + 1;
+ tipval = mix_short_to_word_fast (mix_vm_get_rI (vm_, k));
+ mix_short_print_to_buffer (mix_vm_get_rI (vm_, k), BUFFER);
+ }
break;
default:
g_assert_not_reached ();
}
gtk_entry_set_text (reg_entries_[reg - MIXGTK_WIDGET_rA], BUFFER);
+ snprintf (BUFFER, 20, "%s%ld", mix_word_is_negative (tipval)? "-" : "",
+ mix_word_magnitude (tipval));
+ gtk_tooltips_set_tip (tips_,
+ GTK_WIDGET (reg_entries_[reg - MIXGTK_WIDGET_rA]),
+ BUFFER, NULL);
+
}
@@ -92,6 +104,8 @@ mixgtk_mixvm_init (mix_vm_t *vm)
g_return_val_if_fail (vm != NULL, FALSE);
vm_ = vm;
+ tips_ = gtk_tooltips_new ();
+
for (k = 0; k < REGISTER_NO_; ++k)
{
reg_entries_[k] =
@@ -323,7 +337,7 @@ register_i_ (mix_word_t w, gpointer reg)
update_register_ (MIXGTK_WIDGET_rI1 - 1 + GPOINTER_TO_INT (reg));
}
-void
+gboolean
on_register_click (GtkWidget *w, GdkEvent *e, gpointer data)
{
enum {SIZE = 20};
@@ -348,4 +362,25 @@ on_register_click (GtkWidget *w, GdkEvent *e, gpointer data)
break;
}
}
+ return FALSE;
+}
+
+static void
+mem_cell_ (mix_word_t w, gpointer a)
+{
+ mix_short_t addr = mix_short_new (GPOINTER_TO_INT (a));
+ mix_vm_set_addr_contents (vm_, addr, w);
+ mixgtk_mixvm_update_cells ();
+}
+
+void
+on_memory_cells_select_row (GtkCList *w, gint row, gint col,
+ GdkEvent *e, gpointer data)
+{
+ enum {SIZE = 20};
+ static gchar BUFFER[SIZE];
+ snprintf (BUFFER, SIZE, "Memory cell no. %d", row);
+ mixgtk_input_word (BUFFER,
+ mix_vm_get_addr_contents (vm_, mix_short_new (row)),
+ mem_cell_, GINT_TO_POINTER (row));
}
diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c
index 3ff6436..5a2cd91 100644
--- a/mixgtk/mixgtk_widgets.c
+++ b/mixgtk/mixgtk_widgets.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_widgets.c :
* Implementation of the functions declared in mixgtk_widgets.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/03/09 22:29:47 jose"
+ * Last change: Time-stamp: "01/03/13 14:09:05 jose"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -22,9 +22,10 @@
*/
-#include "mixgtk_widgets.h"
#include <glade/glade.h>
+#include <mixlib/mix.h>
+#include "mixgtk_widgets.h"
/* the glade spec */
static GladeXML *xml_ = NULL;
@@ -33,6 +34,7 @@ static GladeXML *xml_ = NULL;
static const gchar *names_[] = {
"main_window",
"word_dialog",
+ "about_dialog",
"command_prompt",
"command_log",
"mixal_clist",
@@ -61,17 +63,28 @@ static const gchar *names_[] = {
#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);
+ g_print ("%s", VERSION);
return TRUE;
}
@@ -90,4 +103,9 @@ 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
index e457518..43b1426 100644
--- a/mixgtk/mixgtk_widgets.h
+++ b/mixgtk/mixgtk_widgets.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_widgets.h :
* glade-based factory of mixvm widgets
* ------------------------------------------------------------------
- * Last change: Time-stamp: <01/03/11 14:07:32 jose>
+ * Last change: Time-stamp: <01/03/13 10:20:50 jose>
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -32,6 +32,7 @@
typedef enum {
MIXGTK_WIDGET_MAIN, /* main app window */
MIXGTK_WIDGET_WORD_DIALOG, /* input dialog for a mix word */
+ MIXGTK_WIDGET_ABOUT_DIALOG,
MIXGTK_WIDGET_PROMPT, /* command prompt */
MIXGTK_WIDGET_LOG, /* command output */
MIXGTK_WIDGET_MIXAL, /* mixal source file */
diff --git a/mixlib/mix.c b/mixlib/mix.c
index db41bf2..305bb65 100644
--- a/mixlib/mix.c
+++ b/mixlib/mix.c
@@ -48,12 +48,12 @@ mix_release_lib (void)
}
const char *MIX_GPL_LICENSE =
-"Copyright (C) 2000 Free Software Foundation, Inc.\n"
-"This program is free software; you can redistribute it and/or modify\n"
+"Copyright (C) 2000, 2001 Free Software Foundation, Inc.\n"
+"GNU MDK is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 2 of the License, or\n"
"(at your option) any later version.\n"
-"This program is distributed in the hope that it will be useful,\n"
+"GNU MDK is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n"
diff --git a/mixlib/mix_types.c b/mixlib/mix_types.c
index 79e0bb6..40246cd 100644
--- a/mixlib/mix_types.c
+++ b/mixlib/mix_types.c
@@ -479,13 +479,14 @@ mix_word_print_to_file (mix_word_t word, const char *message, FILE *f)
void
mix_word_print_to_buffer (mix_word_t word, gchar *buf)
{
- guint k;
g_return_if_fail (buf != NULL);
- sprintf (buf, "%s ", mix_word_sign (word) == 0 ? "+" : "-");
- for ( k = 1; k < 6; ++k ) {
- sprintf (buf + 2 + 3 * (k -1), "%02d ", mix_word_get_byte (word,k));
- }
- /* sprintf (buf, "(%010ld)", mix_word_magnitude (word));*/
+ sprintf (buf, "%s %02d %02d %02d %02d %02d",
+ mix_word_sign (word) == 0 ? "+" : "-",
+ mix_word_get_byte (word, 1),
+ mix_word_get_byte (word, 2),
+ mix_word_get_byte (word, 3),
+ mix_word_get_byte (word, 4),
+ mix_word_get_byte (word, 5));
}
/* Conversions between words and shorts */