summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-06-30 19:35:44 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-06-30 19:35:44 +0000
commita27ae12b98f6ce945517164940a6eaf7a8301e66 (patch)
treef1da411876fc1330662af98fd3a6eec1cb9a38e9
parent83cc41c0600232d2d9385f84533d80d2adb20106 (diff)
downloadmdk-a27ae12b98f6ce945517164940a6eaf7a8301e66.tar.gz
mdk-a27ae12b98f6ce945517164940a6eaf7a8301e66.tar.bz2
split improved
-rw-r--r--mixgtk/mixgtk.c3
-rw-r--r--mixgtk/mixgtk_cmd_dispatcher.c22
-rw-r--r--mixgtk/mixgtk_device.c39
-rw-r--r--mixgtk/mixgtk_widgets.c10
-rw-r--r--mixgtk/mixgtk_wm.c7
5 files changed, 53 insertions, 28 deletions
diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c
index b94f819..1198fb3 100644
--- a/mixgtk/mixgtk.c
+++ b/mixgtk/mixgtk.c
@@ -49,6 +49,8 @@ mixgtk_restart (void)
return FALSE;
}
+ mixgtk_fontsel_load_defaults ();
+
if (!mixgtk_cmd_dispatcher_init (MIXGTK_MAIN))
{
g_error ("Unable to initialise application (command dispatcher)\n");
@@ -86,7 +88,6 @@ mixgtk_restart (void)
mixgtk_input_init ();
mixgtk_colorsel_init ();
- mixgtk_fontsel_load_defaults ();
gtk_widget_show (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN));
mixgtk_mixvm_update_vm_widgets ();
diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c
index f034cd3..c03db47 100644
--- a/mixgtk/mixgtk_cmd_dispatcher.c
+++ b/mixgtk/mixgtk_cmd_dispatcher.c
@@ -54,6 +54,7 @@ typedef struct mixgtk_dispatch_
GtkWidget *status; /* the status bar widget */
guint context; /* context of the status bar messages */
GCompletion *completions; /* mixvm command completions */
+ gchar *last_file;
} mixgtk_dispatch_data_t;
static struct mixgtk_dispatch_ dis_data_ = {NULL};
@@ -65,6 +66,7 @@ static GtkWidget *asm_entry_ = NULL;
static const gchar *ED_NAME_ = "editor_entry";
static const gchar *ASM_NAME_ = "mixasm_entry";
+static const gchar *TITLE_FORMAT_ = "gmixvm - %s";
static void
log_command_ (mixgtk_dispatch_data_t *dis, const gchar *cmd)
@@ -123,26 +125,26 @@ load_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg,
gpointer data)
{
static glong id = -1;
- static GtkWindow *mainw = NULL;
if (mix_vm_cmd_dispatcher_get_last_result (dis))
{
- gchar *file = g_strdup_printf ("gmixvm - %s", arg);
+ GtkWindow *mainw =
+ GTK_WINDOW (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN));
+
+ if (dis_data_.last_file) g_free (dis_data_.last_file);
+ dis_data_.last_file = g_strdup_printf (TITLE_FORMAT_, arg);
+ gtk_window_set_title (mainw, dis_data_.last_file);
+
mixgtk_mixal_load_file ();
mixgtk_mixal_update ();
mixgtk_mixal_update_bp_all ();
- if (!mainw)
- mainw = GTK_WINDOW (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN));
-
if (id != -1)
gtk_statusbar_remove (GTK_STATUSBAR (dis_data_.status),
dis_data_.context, (guint)id);
id =
gtk_statusbar_push (GTK_STATUSBAR (dis_data_.status), dis_data_.context,
- file);
- gtk_window_set_title (mainw, file);
- g_free (file);
+ dis_data_.last_file);
}
}
@@ -342,6 +344,10 @@ mixgtk_cmd_dispatcher_init (mixgtk_dialog_id_t top)
"cmd_dis_context");
if (!dis_data_.completions) init_completions_ ();
if (!restart) read_config_ ();
+ if (dis_data_.last_file)
+ gtk_window_set_title
+ (GTK_WINDOW (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN)),
+ dis_data_.last_file);
#ifdef HAVE_LIBHISTORY
if (!restart)
diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c
index ac0092d..71e83bd 100644
--- a/mixgtk/mixgtk_device.c
+++ b/mixgtk/mixgtk_device.c
@@ -316,21 +316,36 @@ mixgtk_device_new_ (mix_device_type_t type)
return (mix_device_t *)dev;
}
+static mix_device_t *
+mixgtk_device_copy_ (const struct mixgtk_device_t *from)
+{
+ struct mixgtk_device_t *result =
+ (struct mixgtk_device_t *)mixgtk_device_new_ (from->device.type);
+ g_return_val_if_fail (result != NULL, NULL);
+ if (MODES_[from->device.type] == mix_dev_CHAR)
+ {
+ gchar *text = gtk_editable_get_chars (GTK_EDITABLE (from->widget),
+ 0, -1);
+ gtk_text_insert (GTK_TEXT (result->widget), NULL, NULL, NULL, text, -1);
+ g_free (text);
+ }
+ else
+ {
+ }
+ return (mix_device_t *)result;
+}
+
/* 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_INVALID
- };
-
gint k = 0;
g_return_val_if_fail (container != NULL, FALSE);
g_return_val_if_fail (vm != NULL, FALSE);
container_ = container;
vm_ = vm;
- /** configuration stuff */
+ last_pos_ = 0;
devdlg_ = NULL;
dtoggle_ = NULL;
wtoggle_ = NULL;
@@ -345,12 +360,16 @@ mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm)
if (mixgtk_config_get (DEV_FORMAT_KEY_))
decs_ = atoi (mixgtk_config_get (DEV_FORMAT_KEY_));
- /* connect default devices */
- while (def_types[k] != mix_dev_INVALID)
+ /* re-create existing devices */
+ for (k = 0; k < mix_dev_INVALID; ++k)
{
- struct mix_device_t *dev = mixgtk_device_new_ (def_types[k]);
- if (dev != NULL) mix_vm_connect_device (vm, dev);
- ++k;
+ mix_device_t *dev = mix_vm_get_device (vm, k);
+ if (dev != NULL)
+ {
+ mix_device_t *newdev =
+ mixgtk_device_copy_ ((struct mixgtk_device_t *)dev);
+ mix_vm_connect_device (vm, newdev);
+ }
}
/* set to first page */
diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c
index be4d4ae..0a1acda 100644
--- a/mixgtk/mixgtk_widgets.c
+++ b/mixgtk/mixgtk_widgets.c
@@ -154,15 +154,7 @@ mixgtk_widget_factory_init (void)
else
{
gint k;
- for (k = 0; k < DLG_NO_; ++k)
- {
- if (xml_[k])
- {
- if (k != MIXGTK_MAIN)
- gtk_widget_destroy (mixgtk_widget_factory_get_dialog (k));
- xml_[k] = NULL;
- }
- }
+ for (k = 0; k < DLG_NO_; ++k) if (xml_[k]) xml_[k] = NULL;
}
split_ = split;
diff --git a/mixgtk/mixgtk_wm.c b/mixgtk/mixgtk_wm.c
index ce6a6c5..7e28baf 100644
--- a/mixgtk/mixgtk_wm.c
+++ b/mixgtk/mixgtk_wm.c
@@ -84,6 +84,13 @@ mixgtk_wm_init (void)
gtk_check_menu_item_set_active (infos_[i].menu, infos_[i].visible);
}
}
+ else
+ {
+ gint k;
+ for (k = 0; k < INF_NO_; ++k)
+ if (infos_[k].widget) gtk_widget_destroy (infos_[k].widget);
+ }
+
restart = TRUE;
return TRUE;
}