summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-05-30 22:15:15 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-05-30 22:15:15 +0000
commit1d578c635f759a426e86944e351779ac581f3fda (patch)
tree04b786aee9c1bfc29d7f7b6a7db60c407d2a6fd8
parentb5f7d4a0d39ee53414adf6893a836f12f20ba362 (diff)
downloadmdk-1d578c635f759a426e86944e351779ac581f3fda.tar.gz
mdk-1d578c635f759a426e86944e351779ac581f3fda.tar.bz2
binary devices output formats added
-rw-r--r--NEWS8
-rw-r--r--mixgtk/mixgtk.glade347
-rw-r--r--mixgtk/mixgtk_device.c206
-rw-r--r--mixgtk/mixgtk_device.h6
-rw-r--r--mixgtk/mixgtk_widgets.c1
-rw-r--r--mixgtk/mixgtk_widgets.h1
-rw-r--r--mixlib/mix_vm.c9
-rw-r--r--mixlib/mix_vm.h5
8 files changed, 523 insertions, 60 deletions
diff --git a/NEWS b/NEWS
index 1600b1b..aed5b34 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,14 @@ See the end for copying conditions.
Please send mdk bug reports to bug-mdk@gnu.org.
---------------------------------------------------------------------------
+* Version 0.3.3
+
+** The output of the contents of binary devices in gmixvm can be
+ configured to be in decimal or word format (for each block device).
+
+** The main gmixvm window is not shown until it is completely drawn.
+
+---------------------------------------------------------------------------
* Version 0.3.2 (10/04/01)
** The colors used for highlighting MIXAL source lines in gmixvm are now
diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade
index 5dde85d..eaf7680 100644
--- a/mixgtk/mixgtk.glade
+++ b/mixgtk/mixgtk.glade
@@ -262,6 +262,19 @@
<widget>
<class>GtkMenuItem</class>
+ <name>device_output1</name>
+ <tooltip>Change format of binary devices output</tooltip>
+ <signal>
+ <name>activate</name>
+ <handler>on_devform_activate</handler>
+ <last_modification_time>Wed, 30 May 2001 20:44:48 GMT</last_modification_time>
+ </signal>
+ <label>_Device output...</label>
+ <right_justify>False</right_justify>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
<name>separator1</name>
<right_justify>False</right_justify>
</widget>
@@ -910,46 +923,6 @@
<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>
@@ -1040,6 +1013,46 @@
<width>627</width>
<height>16</height>
</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>
<widget>
@@ -1327,7 +1340,7 @@
<handler>on_word_reset_clicked</handler>
<last_modification_time>Mon, 12 Mar 2001 22:40:33 GMT</last_modification_time>
</signal>
- <label>Reset</label>
+ <label>_Reset</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
@@ -1341,7 +1354,7 @@
<handler>on_word_ok_clicked</handler>
<last_modification_time>Mon, 12 Mar 2001 22:40:45 GMT</last_modification_time>
</signal>
- <label>OK</label>
+ <label>_OK</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
@@ -1355,7 +1368,7 @@
<handler>on_word_cancel_clicked</handler>
<last_modification_time>Mon, 12 Mar 2001 23:18:49 GMT</last_modification_time>
</signal>
- <label>Cancel</label>
+ <label>_Cancel</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
@@ -1764,7 +1777,7 @@
<handler>on_goto_cancel_clicked</handler>
<last_modification_time>Wed, 14 Mar 2001 14:24:59 GMT</last_modification_time>
</signal>
- <label>Cancel</label>
+ <label>_Cancel</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
@@ -1778,7 +1791,7 @@
<handler>on_goto_ok_clicked</handler>
<last_modification_time>Wed, 14 Mar 2001 14:25:23 GMT</last_modification_time>
</signal>
- <label>OK</label>
+ <label>_OK</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
@@ -1913,7 +1926,7 @@
<handler>on_colors_ok_clicked</handler>
<last_modification_time>Thu, 12 Apr 2001 21:05:07 GMT</last_modification_time>
</signal>
- <label>OK</label>
+ <label>_OK</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
@@ -1927,7 +1940,7 @@
<handler>on_colors_apply_clicked</handler>
<last_modification_time>Thu, 12 Apr 2001 21:04:56 GMT</last_modification_time>
</signal>
- <label>Apply</label>
+ <label>_Apply</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
@@ -1941,7 +1954,7 @@
<handler>on_colors_cancel_clicked</handler>
<last_modification_time>Thu, 12 Apr 2001 21:04:45 GMT</last_modification_time>
</signal>
- <label>Cancel</label>
+ <label>_Cancel</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
@@ -2253,4 +2266,242 @@
</widget>
</widget>
+<widget>
+ <class>GtkDialog</class>
+ <name>devform_dialog</name>
+ <width>308</width>
+ <height>172</height>
+ <visible>False</visible>
+ <signal>
+ <name>delete_event</name>
+ <handler>gtk_widget_hide</handler>
+ <last_modification_time>Wed, 30 May 2001 20:14:53 GMT</last_modification_time>
+ </signal>
+ <signal>
+ <name>destroy_event</name>
+ <handler>gtk_widget_hide</handler>
+ <last_modification_time>Wed, 30 May 2001 20:15:13 GMT</last_modification_time>
+ </signal>
+ <signal>
+ <name>destroy</name>
+ <handler>gtk_widget_hide</handler>
+ <last_modification_time>Wed, 30 May 2001 20:15:29 GMT</last_modification_time>
+ </signal>
+ <title>Device output format</title>
+ <type>GTK_WINDOW_DIALOG</type>
+ <position>GTK_WIN_POS_NONE</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-vbox8</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <child_name>Dialog:action_area</child_name>
+ <name>dialog-action_area8</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>hbuttonbox8</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>devok_button</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>on_devok_button_clicked</handler>
+ <last_modification_time>Wed, 30 May 2001 20:13:56 GMT</last_modification_time>
+ </signal>
+ <label>_OK</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>devapp_button</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>on_devapp_button_clicked</handler>
+ <last_modification_time>Wed, 30 May 2001 20:14:05 GMT</last_modification_time>
+ </signal>
+ <label>_Apply</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>devcancel_button</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>on_devcancel_button_clicked</handler>
+ <last_modification_time>Wed, 30 May 2001 20:14:17 GMT</last_modification_time>
+ </signal>
+ <label>_Cancel</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFixed</class>
+ <name>fixed2</name>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>devset_button</name>
+ <x>208</x>
+ <y>80</y>
+ <width>79</width>
+ <height>24</height>
+ <tooltip>Set all devices to current format</tooltip>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>on_devset_button_clicked</handler>
+ <last_modification_time>Wed, 30 May 2001 20:13:37 GMT</last_modification_time>
+ </signal>
+ <label>S_et all</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label232</name>
+ <x>16</x>
+ <y>22</y>
+ <width>48</width>
+ <height>16</height>
+ <label>Device</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>label233</name>
+ <x>216</x>
+ <y>22</y>
+ <width>48</width>
+ <height>16</height>
+ <label>Format</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>GtkCombo</class>
+ <name>dev_combo</name>
+ <x>16</x>
+ <y>48</y>
+ <width>150</width>
+ <height>22</height>
+ <value_in_list>True</value_in_list>
+ <ok_if_empty>True</ok_if_empty>
+ <case_sensitive>False</case_sensitive>
+ <use_arrows>True</use_arrows>
+ <use_arrows_always>False</use_arrows_always>
+ <items></items>
+
+ <widget>
+ <class>GtkEntry</class>
+ <child_name>GtkCombo:entry</child_name>
+ <name>combo-entry1</name>
+ <tooltip>Choose a device</tooltip>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>changed</name>
+ <handler>on_deventry_changed</handler>
+ <last_modification_time>Wed, 30 May 2001 19:50:03 GMT</last_modification_time>
+ </signal>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>decradio</name>
+ <x>184</x>
+ <y>48</y>
+ <width>48</width>
+ <height>24</height>
+ <tooltip>Show output as decimal numbers</tooltip>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>on_decradio_toggled</handler>
+ <last_modification_time>Wed, 30 May 2001 20:13:03 GMT</last_modification_time>
+ </signal>
+ <label>Dec</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>format_group</group>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>wordradio</name>
+ <x>240</x>
+ <y>48</y>
+ <width>56</width>
+ <height>24</height>
+ <tooltip>Show output as MIX words</tooltip>
+ <can_focus>True</can_focus>
+ <label>Word</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>format_group</group>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
</GTK-Interface>
diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c
index 26e48f5..b152469 100644
--- a/mixgtk/mixgtk_device.c
+++ b/mixgtk/mixgtk_device.c
@@ -23,17 +23,30 @@
#include <stdio.h>
+#include <stdlib.h>
#include <mixlib/xmix_device.h>
#include "mixgtk.h"
+#include "mixgtk_widgets.h"
+#include "mixgtk_config.h"
#include "mixgtk_device.h"
#define BIN_DEV_COL_ 5
+static const gchar *DEV_FORMAT_KEY_ = "Device.format";
+
/* device container */
static GtkNotebook *container_ = NULL;
static gint last_pos_ = 0;
/* virtual machine */
static mix_vm_t *vm_ = NULL;
+/* dec settings */
+static gint32 decs_ = 0;
+static gint32 new_decs_ = 0;
+
+/* macros manipulating dec settings */
+#define IS_DEC(flags,type) (((flags) >> (type)) & 1)
+#define SET_DEC(flags,type) ((flags) |= (1<<(type)))
+#define CLEAR_DEC(flags,type) ((flags) &= ~(1<<(type)))
/* a mixgtk device */
struct mixgtk_device_t
@@ -48,6 +61,7 @@ struct mixgtk_bin_device_t
struct mixgtk_device_t gtk_device;
guint last_insert;
GtkWidget *scroll;
+ gboolean dec;
};
/* callbacks for output devices */
@@ -72,31 +86,81 @@ write_char_ (struct mixgtk_device_t *dev, const mix_word_t *block)
}
-static void
-write_bin_ (struct mixgtk_bin_device_t *dev, const mix_word_t *block)
+static const gchar *
+get_word_string_ (mix_word_t w, gboolean dec)
{
enum {BUFF_SIZE = 17};
static gchar BUFFER[BUFF_SIZE] = { 0 };
+ if (dec)
+ snprintf (BUFFER, BUFF_SIZE, "%s%011ld",
+ mix_word_is_negative (w)? "-" : "+",
+ mix_word_magnitude (w));
+ else
+ mix_word_print_to_buffer (w, BUFFER);
+ return BUFFER;
+}
+
+static void
+write_bin_ (struct mixgtk_bin_device_t *dev, const mix_word_t *block)
+{
static gchar *DEFTEXT[BIN_DEV_COL_] = { "0", "0", "0", "0", "0" };
guint k, col, row;
+ gboolean dec = FALSE;
+
GtkCList *list = GTK_CLIST (dev->gtk_device.widget);
+ dec = IS_DEC(decs_, dev->gtk_device.device.type);
+
gtk_clist_freeze (list);
for (k = 0; k < SIZES_[dev->gtk_device.device.type]; k++)
{
- mix_word_print_to_buffer (block[k], BUFFER);
row = dev->last_insert / BIN_DEV_COL_;
col = dev->last_insert % BIN_DEV_COL_;
- if (col == 0) gtk_clist_append (list, DEFTEXT);
- gtk_clist_set_text (list, row, col, BUFFER);
+ if (col == 0)
+ {
+ int j;
+ mix_word_t *words = g_new (mix_word_t, 5);
+ gtk_clist_append (list, DEFTEXT);
+ for (j = 0; j < 5; ++j) words[j] = block[k + j];
+ gtk_clist_set_row_data_full (list, row, (gpointer)words, g_free);
+ }
+ gtk_clist_set_text (list, row, col, get_word_string_ (block[k], dec));
dev->last_insert++;
}
gtk_clist_thaw (list);
}
+static void
+redraw_bin_device_ (struct mixgtk_bin_device_t *dev)
+{
+ gint k, col, row;
+ gboolean dec = FALSE;
+ mix_word_t *words = NULL;
+ GtkCList *list;
+
+ if (!dev) return;
+
+ list = GTK_CLIST (dev->gtk_device.widget);
+ dec = IS_DEC(decs_, dev->gtk_device.device.type);
+
+ gtk_clist_freeze (list);
+
+ for (k = 0; k < dev->last_insert; ++k)
+ {
+ row = k / BIN_DEV_COL_;
+ col = k % BIN_DEV_COL_;
+ if (col == 0)
+ words = gtk_clist_get_row_data (list, row);
+ gtk_clist_set_text (list, row, col, get_word_string_ (words[col], dec));
+ }
+
+ gtk_clist_thaw (list);
+}
+
+
static gboolean
write_ (mix_device_t *dev, const mix_word_t *block)
{
@@ -254,7 +318,7 @@ mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm)
};
gint k = 0;
-
+
g_return_val_if_fail (container != NULL, FALSE);
g_return_val_if_fail (vm != NULL, FALSE);
container_ = container;
@@ -265,6 +329,9 @@ mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm)
mix_vm_set_device_factory (vm, mixgtk_device_new_);
+ /* read format configuration */
+ decs_ = atoi (mixgtk_config_get (DEV_FORMAT_KEY_));
+
/* connect default devices */
while (def_types[k] != mix_dev_INVALID)
{
@@ -279,6 +346,127 @@ mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm)
return TRUE;
}
-/* connect a new (file-based) device */
-gboolean
-mixgtk_device_connect (mix_device_type_t type, const gchar *name);
+void
+mixgtk_device_set_format (mix_device_type_t dev, gboolean dec)
+{
+ gboolean changed;
+
+ g_return_if_fail (dev < mix_dev_INVALID);
+
+ changed = (dec && !IS_DEC (decs_, dev)) || (!dec && IS_DEC (decs_, dev));
+
+ if (changed && (MODES_[dev] == mix_dev_BIN))
+ {
+ if (dec) SET_DEC (decs_, dev);
+ else CLEAR_DEC (decs_, dev);
+ redraw_bin_device_ ((struct mixgtk_bin_device_t *)
+ mix_vm_get_device (vm_, dev));
+ }
+
+}
+
+
+/** configuration stuff */
+#define LAST_BIN_DEV_ mix_dev_DISK_7
+static GtkWidget *devdlg_ = NULL;
+static GtkWidget *dtoggle_ = NULL;
+static GtkWidget *wtoggle_ = NULL;
+static GtkWidget *combo_ = NULL;
+
+static mix_device_type_t
+get_device_idx_ (void)
+{
+ const gchar *name = gtk_entry_get_text
+ (GTK_ENTRY (GTK_COMBO (combo_)->entry));
+ /* inefficient, but the list is short */
+ int k;
+ for (k = 0; k <= LAST_BIN_DEV_; ++k)
+ if (!strcmp (name, DEF_NAMES_[k])) return k;
+ g_assert_not_reached ();
+ return 0;
+}
+
+static void
+init_devform_ (void)
+{
+ GList *names = NULL;
+ int k;
+
+ devdlg_ = mixgtk_widget_factory_get_dialog (MIXGTK_DEVFORM_DIALOG);
+ g_assert (devdlg_);
+ dtoggle_ = mixgtk_widget_factory_get_child_by_name
+ (MIXGTK_DEVFORM_DIALOG, "decradio");
+ g_assert (dtoggle_);
+ wtoggle_ = mixgtk_widget_factory_get_child_by_name
+ (MIXGTK_DEVFORM_DIALOG, "wordradio");
+ g_assert (wtoggle_);
+ combo_ = mixgtk_widget_factory_get_child_by_name
+ (MIXGTK_DEVFORM_DIALOG, "dev_combo");
+ g_assert (combo_);
+
+ for (k = 0; k <= LAST_BIN_DEV_; ++k)
+ names = g_list_append (names, (gchar *)DEF_NAMES_[k]);
+ gtk_combo_set_popdown_strings (GTK_COMBO (combo_), names);
+}
+
+void
+on_deventry_changed ()
+{
+ mix_device_type_t dev = get_device_idx_ ();
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dtoggle_),
+ IS_DEC (new_decs_, dev));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wtoggle_),
+ !IS_DEC (new_decs_, dev));
+}
+
+void
+on_devform_activate ()
+{
+ if (!devdlg_) init_devform_ ();
+ new_decs_ = decs_;
+ gtk_widget_show (devdlg_);
+ on_deventry_changed ();
+}
+
+
+void
+on_decradio_toggled (GtkToggleButton *button)
+{
+ if (gtk_toggle_button_get_active (button))
+ SET_DEC (new_decs_, get_device_idx_ ());
+ else
+ CLEAR_DEC (new_decs_, get_device_idx_ ());
+}
+
+void
+on_devapp_button_clicked ()
+{
+ int k;
+ gchar value[20];
+ for (k = 0; k <= LAST_BIN_DEV_; ++k)
+ mixgtk_device_set_format (k, IS_DEC (new_decs_, k));
+ snprintf (value, 20, "%d", decs_);
+ mixgtk_config_update (DEV_FORMAT_KEY_, value);
+}
+
+void
+on_devok_button_clicked ()
+{
+ on_devapp_button_clicked ();
+ gtk_widget_hide (devdlg_);
+}
+
+void
+on_devcancel_button_clicked ()
+{
+ gtk_widget_hide (devdlg_);
+}
+
+void
+on_devset_button_clicked ()
+{
+ static gint32 ON = 0xffff, OFF = 0;
+ new_decs_ = (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dtoggle_)))?
+ ON : OFF;
+}
+
diff --git a/mixgtk/mixgtk_device.h b/mixgtk/mixgtk_device.h
index 7c21238..cdfec66 100644
--- a/mixgtk/mixgtk_device.h
+++ b/mixgtk/mixgtk_device.h
@@ -33,10 +33,10 @@
extern gboolean
mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm);
+/* change the output format of a device */
+extern void
+mixgtk_device_set_format (mix_device_type_t dev, gboolean dec);
-/* 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_widgets.c b/mixgtk/mixgtk_widgets.c
index 18d60e1..b032898 100644
--- a/mixgtk/mixgtk_widgets.c
+++ b/mixgtk/mixgtk_widgets.c
@@ -37,6 +37,7 @@ static const gchar * dnames_[] = {
"color_dialog",
"colorsel_dialog",
"fontsel_dialog",
+ "devform_dialog"
};
#define DLG_NO_ (sizeof (dnames_) / sizeof(dnames_[0]))
diff --git a/mixgtk/mixgtk_widgets.h b/mixgtk/mixgtk_widgets.h
index 8054ed4..261ad12 100644
--- a/mixgtk/mixgtk_widgets.h
+++ b/mixgtk/mixgtk_widgets.h
@@ -37,6 +37,7 @@ typedef enum {
MIXGTK_COLOR_DIALOG, /* color customization dialog */
MIXGTK_COLORSEL_DIALOG, /* color selection dialog */
MIXGTK_FONTSEL_DIALOG, /* font selection dialog */
+ MIXGTK_DEVFORM_DIALOG /* device format config dialog */
} mixgtk_dialog_id_t;
/* enumeration of mixvm widget ids */
diff --git a/mixlib/mix_vm.c b/mixlib/mix_vm.c
index 4446bcf..9816cb5 100644
--- a/mixlib/mix_vm.c
+++ b/mixlib/mix_vm.c
@@ -124,6 +124,15 @@ mix_vm_connect_device (mix_vm_t *vm, mix_device_t *device)
return old;
}
+/* get device */
+mix_device_t *
+mix_vm_get_device (const mix_vm_t *vm, mix_device_type_t dev)
+{
+ g_return_val_if_fail (vm != NULL, NULL);
+ g_return_val_if_fail (dev < mix_dev_INVALID, NULL);
+ return vm->devices[dev];
+}
+
/* install a device factory for automatic connection */
void
mix_vm_set_device_factory (mix_vm_t *vm, mix_device_factory_t factory)
diff --git a/mixlib/mix_vm.h b/mixlib/mix_vm.h
index c4663bc..a8b826e 100644
--- a/mixlib/mix_vm.h
+++ b/mixlib/mix_vm.h
@@ -51,6 +51,11 @@ mix_vm_delete(mix_vm_t * vm);
extern mix_device_t * /* previously connected device */
mix_vm_connect_device (mix_vm_t *vm, mix_device_t *device);
+/* get device */
+extern mix_device_t *
+mix_vm_get_device (const mix_vm_t *vm, mix_device_type_t dev);
+
+
/* install a device factory for automatic connection */
typedef mix_device_t * (* mix_device_factory_t) (mix_device_type_t device);
extern void