diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-07-08 21:55:13 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-07-08 21:55:13 +0000 |
commit | b86afb94db26dba9d67d274736f07866b41b185d (patch) | |
tree | 3666eb485b19844e193cfde9f008dcca0edde810 | |
parent | 44d6a545a0cc61c8c986ce6bcf126548386ba246 (diff) | |
download | mdk-b86afb94db26dba9d67d274736f07866b41b185d.tar.gz mdk-b86afb94db26dba9d67d274736f07866b41b185d.tar.bz2 |
devdir command via menu
-rw-r--r-- | NEWS | 21 | ||||
-rw-r--r-- | mixgtk/mixgtk.glade | 184 | ||||
-rw-r--r-- | mixgtk/mixgtk_device.c | 54 | ||||
-rw-r--r-- | mixgtk/mixgtk_gen_handlers.c | 28 | ||||
-rw-r--r-- | mixgtk/mixgtk_gen_handlers.h | 6 | ||||
-rw-r--r-- | mixgtk/mixgtk_widgets.c | 3 | ||||
-rw-r--r-- | mixgtk/mixgtk_widgets.h | 3 |
7 files changed, 284 insertions, 15 deletions
@@ -17,6 +17,27 @@ Please send mdk bug reports to bug-mdk@gnu.org. ** The gmixvm main window displays the path to the current MIX file in its title bar. +** The mixvm and gmixvm configuration files are now stored in ~/.mdk + (instead of ~/.gmixvm). + +** The default device files directory is also ~/.mdk. It can be + configured using the new command 'devdir' or (in gmixvm) with the + new Settings->Devices dir menu command. + +** The commands 'tron' and 'troff' have been substituted by 'tracing + on|off'. + +** The trace flag is saved as a configuration parameter in mixvm and + gmixvm. + +** New vm commands: 'pedit'/'sedit' (print/set editor command) and + 'pasm'/'sasm' (print/set compile command). Their value is stored as + a config param also in mixvm. + +** New command 'timing' for setting on/off and printing the timing + statistics (both in gmixvm and mixvm). Its value is also stored as + a config param. + ** Bug fix: changes in the device format are now correctly stored (gmixvm). --------------------------------------------------------------------------- diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade index cd73289..34eab7e 100644 --- a/mixgtk/mixgtk.glade +++ b/mixgtk/mixgtk.glade @@ -335,6 +335,18 @@ <widget> <class>GtkMenuItem</class> + <name>devices_dir</name> + <signal> + <name>activate</name> + <handler>on_devdir_activate</handler> + <last_modification_time>Sun, 08 Jul 2001 20:58:13 GMT</last_modification_time> + </signal> + <label>De_vices dir...</label> + <right_justify>False</right_justify> + </widget> + + <widget> + <class>GtkMenuItem</class> <name>external_programs1</name> <signal> <name>activate</name> @@ -1733,6 +1745,18 @@ <widget> <class>GtkMenuItem</class> + <name>devices_dir</name> + <signal> + <name>activate</name> + <handler>on_devdir_activate</handler> + <last_modification_time>Sun, 08 Jul 2001 20:58:35 GMT</last_modification_time> + </signal> + <label>De_vices dir...</label> + <right_justify>False</right_justify> + </widget> + + <widget> + <class>GtkMenuItem</class> <name>external_programs1</name> <signal> <name>activate</name> @@ -1791,7 +1815,7 @@ <last_modification_time>Sun, 29 Apr 2001 10:26:16 GMT</last_modification_time> </signal> <label>Save on _exit</label> - <active>False</active> + <active>True</active> <always_show_toggle>True</always_show_toggle> </widget> </widget> @@ -4327,4 +4351,162 @@ </widget> </widget> +<widget> + <class>GtkDialog</class> + <name>devdir_dialog</name> + <visible>False</visible> + <signal> + <name>delete_event</name> + <handler>gtk_widget_hide</handler> + <last_modification_time>Sun, 08 Jul 2001 20:42:29 GMT</last_modification_time> + </signal> + <signal> + <name>destroy_event</name> + <handler>gtk_widget_hide</handler> + <last_modification_time>Sun, 08 Jul 2001 20:42:41 GMT</last_modification_time> + </signal> + <signal> + <name>destroy</name> + <handler>gtk_widget_hide</handler> + <last_modification_time>Sun, 08 Jul 2001 20:42:53 GMT</last_modification_time> + </signal> + <title>Devices directory</title> + <type>GTK_WINDOW_TOPLEVEL</type> + <position>GTK_WIN_POS_NONE</position> + <modal>False</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>False</allow_grow> + <auto_shrink>True</auto_shrink> + + <widget> + <class>GtkVBox</class> + <child_name>Dialog:vbox</child_name> + <name>dialog-vbox11</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkHBox</class> + <child_name>Dialog:action_area</child_name> + <name>dialog-action_area11</name> + <border_width>1</border_width> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkHButtonBox</class> + <name>hbuttonbox10</name> + <layout_style>GTK_BUTTONBOX_END</layout_style> + <spacing>0</spacing> + <child_min_width>91</child_min_width> + <child_min_height>25</child_min_height> + <child_ipad_x>0</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>devdir_cancel</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <signal> + <name>clicked</name> + <handler>on_devdir_cancel_clicked</handler> + <last_modification_time>Sun, 08 Jul 2001 20:44:06 GMT</last_modification_time> + </signal> + <label>_Cancel</label> + <relief>GTK_RELIEF_NORMAL</relief> + </widget> + + <widget> + <class>GtkButton</class> + <name>devdir_ok</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <signal> + <name>clicked</name> + <handler>on_devdir_ok_clicked</handler> + <last_modification_time>Sun, 08 Jul 2001 20:44:28 GMT</last_modification_time> + </signal> + <label>_OK</label> + <relief>GTK_RELIEF_NORMAL</relief> + </widget> + </widget> + </widget> + + <widget> + <class>GtkHBox</class> + <name>hbox1</name> + <border_width>25</border_width> + <homogeneous>False</homogeneous> + <spacing>11</spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkLabel</class> + <name>label239</name> + <label>Directory</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>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>devdir_entry</name> + <can_focus>True</can_focus> + <editable>False</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>devdir_browse</name> + <can_focus>True</can_focus> + <signal> + <name>clicked</name> + <handler>on_devdir_browse_clicked</handler> + <last_modification_time>Sun, 08 Jul 2001 20:43:50 GMT</last_modification_time> + </signal> + <label>_Browse...</label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> + </widget> +</widget> + </GTK-Interface> diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c index 2b0bf2e..274d5eb 100644 --- a/mixgtk/mixgtk_device.c +++ b/mixgtk/mixgtk_device.c @@ -24,10 +24,13 @@ #include <stdio.h> #include <stdlib.h> +#include <mixlib/mix_vm_command.h> #include <mixlib/xmix_device.h> #include "mixgtk.h" +#include "mixgtk_gen_handlers.h" #include "mixgtk_widgets.h" #include "mixgtk_config.h" +#include "mixgtk_cmd_dispatcher.h" #include "mixgtk_device.h" #define BIN_DEV_COL_ 5 @@ -36,6 +39,10 @@ static const gchar *DEV_FORMAT_KEY_ = "Device.format"; /* device container */ static GtkNotebook *container_ = NULL; +/* devdir dialog */ +static GtkWidget *devdir_dlg_ = NULL; +static GtkEntry *devdir_entry_ = NULL; + /** configuration stuff */ #define LAST_BIN_DEV_ mix_dev_DISK_7 static GtkWidget *devdlg_ = NULL; @@ -364,6 +371,8 @@ mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm) vm_ = vm; last_pos_ = 0; devdlg_ = NULL; + devdir_dlg_ = NULL; + devdir_entry_ = NULL; dtoggle_ = NULL; wtoggle_ = NULL; combo_ = NULL; @@ -513,3 +522,48 @@ on_devset_button_clicked () ON : OFF; } +void +on_devdir_activate () +{ + static const gchar *DEVDIR_ENTRY_NAME = "devdir_entry"; + if (devdir_dlg_ == NULL) + { + devdir_dlg_ = mixgtk_widget_factory_get_dialog (MIXGTK_DEVDIR_DIALOG); + g_assert (devdir_dlg_); + devdir_entry_ = GTK_ENTRY + (mixgtk_widget_factory_get_child_by_name (MIXGTK_DEVDIR_DIALOG, + DEVDIR_ENTRY_NAME)); + g_assert (devdir_entry_); + } + gtk_entry_set_text (devdir_entry_, mix_device_get_dir ()); + gtk_widget_show (devdir_dlg_); +} + +static void +devdir_callback (const gchar *file) +{ + gtk_entry_set_text (devdir_entry_, file); +} + +void +on_devdir_browse_clicked () +{ + mixgtk_get_file (devdir_callback, "Devices dir", mix_device_get_dir ()); +} + +void +on_devdir_cancel_clicked () +{ + gtk_widget_hide (devdir_dlg_); +} + +void +on_devdir_ok_clicked () +{ + const gchar *dirname = gtk_entry_get_text (devdir_entry_); + gchar *cmd = g_strconcat (mix_vm_command_to_string (MIX_CMD_DEVDIR), + " ", dirname, NULL); + gtk_widget_hide (devdir_dlg_); + mixgtk_cmd_dispatcher_dispatch (cmd); + g_free (cmd); +} diff --git a/mixgtk/mixgtk_gen_handlers.c b/mixgtk/mixgtk_gen_handlers.c index 63314f1..0d3daa3 100644 --- a/mixgtk/mixgtk_gen_handlers.c +++ b/mixgtk/mixgtk_gen_handlers.c @@ -26,10 +26,9 @@ #include "mixgtk_cmd_dispatcher.h" #include "mixgtk_config.h" -typedef void (*file_callback_t)(const gchar *file); - static file_callback_t callback_ = NULL; + static void on_file_ok_ (GtkWidget *w, gpointer fs) { @@ -66,6 +65,17 @@ static void show_dlg_ (const gchar *title, const gchar *pattern) gtk_grab_add (file); } +/* grab a file with an externally provided callback */ +void +mixgtk_get_file (file_callback_t callback, + const gchar *title, const gchar *pattern) +{ + g_return_if_fail (callback != NULL); + callback_ = callback; + show_dlg_ (title, pattern); +} + + /* exec prompt command */ static void exec_cmd_ (mix_vm_command_t cmd, const gchar *arg) { @@ -90,8 +100,7 @@ static void open_cb_ (const gchar *file) void on_file_open_activate (GtkWidget *w, gpointer data) { - callback_ = open_cb_; - show_dlg_ ("Load MIX program...", "*.mix"); + mixgtk_get_file (open_cb_, "Load MIX program...", "*.mix"); } /* edit mixal source */ @@ -103,9 +112,8 @@ static void edit_cb_ (const gchar *file) void on_file_edit_activate (GtkWidget *w, gpointer data) { - callback_ = edit_cb_; - show_dlg_ ("Edit MIXAL source file...", - mixgtk_cmd_dispatcher_get_src_path ()); + mixgtk_get_file (edit_cb_, "Edit MIXAL source file...", + mixgtk_cmd_dispatcher_get_src_path ()); } /* compile mixal source */ @@ -117,9 +125,8 @@ static void compile_cb_ (const gchar *file) void on_file_compile_activate (GtkWidget *w, gpointer data) { - callback_ = compile_cb_; - show_dlg_ ("Compile MIXAL source file...", - mixgtk_cmd_dispatcher_get_src_path ()); + mixgtk_get_file (compile_cb_, "Compile MIXAL source file...", + mixgtk_cmd_dispatcher_get_src_path ()); } void @@ -141,7 +148,6 @@ on_file_exit_activate (GtkWidget *w, gpointer data) gtk_main_quit (); } - void on_clear_breakpoints_activate (GtkWidget *w, gpointer data) { diff --git a/mixgtk/mixgtk_gen_handlers.h b/mixgtk/mixgtk_gen_handlers.h index 7b63b68..1e435c3 100644 --- a/mixgtk/mixgtk_gen_handlers.h +++ b/mixgtk/mixgtk_gen_handlers.h @@ -42,7 +42,6 @@ on_file_edit_activate (GtkWidget *w, gpointer data); extern void on_file_compile_activate (GtkWidget *w, gpointer data); - extern void on_clear_breakpoints_activate (GtkWidget *w, gpointer data); @@ -52,6 +51,11 @@ on_save_on_exit_toggle (GtkWidget *w, gpointer data); extern void on_save_activate (GtkWidget *w, gpointer data); +typedef void (*file_callback_t)(const gchar *file); + +extern void +mixgtk_get_file (file_callback_t callback, const gchar *title, + const gchar *pattern); #endif /* MIXGTK_GEN_HANDLERS_H */ diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c index 0a1acda..c286467 100644 --- a/mixgtk/mixgtk_widgets.c +++ b/mixgtk/mixgtk_widgets.c @@ -42,7 +42,8 @@ static const gchar * dnames_[] = { "fontsel_dialog", "devform_dialog", "external_dialog", - "symbols_dialog" + "symbols_dialog", + "devdir_dialog" }; const gchar *SPLIT_MAIN_NAME_ = "split_main_window"; diff --git a/mixgtk/mixgtk_widgets.h b/mixgtk/mixgtk_widgets.h index 1fafc71..a38d4e9 100644 --- a/mixgtk/mixgtk_widgets.h +++ b/mixgtk/mixgtk_widgets.h @@ -42,7 +42,8 @@ typedef enum { MIXGTK_FONTSEL_DIALOG, /* font selection dialog */ MIXGTK_DEVFORM_DIALOG, /* device format config dialog */ MIXGTK_EXTERNPROG_DIALOG, /* external programs dialog */ - MIXGTK_SYMBOLS_DIALOG /* symbol table dialog */ + MIXGTK_SYMBOLS_DIALOG, /* symbol table dialog */ + MIXGTK_DEVDIR_DIALOG } mixgtk_dialog_id_t; /* enumeration of mixvm widget ids */ |