summaryrefslogtreecommitdiffhomepage
path: root/mixgtk
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2004-07-04 22:34:15 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2004-07-04 22:34:15 +0000
commit6d482456bec9690d49b29f7bb0ddf029d71b3081 (patch)
treef6c0abd5037595d13be71a4fb5fd66a21e8acca0 /mixgtk
parentd60d488228a8850742954dbc4b91895998641487 (diff)
downloadmdk-6d482456bec9690d49b29f7bb0ddf029d71b3081.tar.gz
mdk-6d482456bec9690d49b29f7bb0ddf029d71b3081.tar.bz2
new menu item to change all fonts at once.
Diffstat (limited to 'mixgtk')
-rw-r--r--mixgtk/mixgtk.glade47
-rw-r--r--mixgtk/mixgtk_cmd_dispatcher.c9
-rw-r--r--mixgtk/mixgtk_cmd_dispatcher.h15
-rw-r--r--mixgtk/mixgtk_device.c32
-rw-r--r--mixgtk/mixgtk_device.h3
-rw-r--r--mixgtk/mixgtk_fontsel.c42
-rw-r--r--mixgtk/mixgtk_fontsel.h3
-rw-r--r--mixgtk/mixgtk_mixal.c19
-rw-r--r--mixgtk/mixgtk_mixal.h5
-rw-r--r--mixgtk/mixgtk_mixvm.c43
-rw-r--r--mixgtk/mixgtk_mixvm.h5
11 files changed, 171 insertions, 52 deletions
diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade
index aaac693..0f8b6bc 100644
--- a/mixgtk/mixgtk.glade
+++ b/mixgtk/mixgtk.glade
@@ -12,6 +12,7 @@
<property name="default_height">550</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
+ <property name="role">gmixvm-main</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
@@ -48,7 +49,7 @@
<accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image362">
+ <widget class="GtkImage" id="image376">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@@ -71,7 +72,7 @@
<accelerator key="E" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image363">
+ <widget class="GtkImage" id="image377">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
@@ -94,7 +95,7 @@
<accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image364">
+ <widget class="GtkImage" id="image378">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@@ -123,7 +124,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image365">
+ <widget class="GtkImage" id="image379">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@@ -159,7 +160,7 @@
<accelerator key="R" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image366">
+ <widget class="GtkImage" id="image380">
<property name="visible">True</property>
<property name="stock">gtk-go-forward</property>
<property name="icon_size">1</property>
@@ -182,7 +183,7 @@
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image367">
+ <widget class="GtkImage" id="image381">
<property name="visible">True</property>
<property name="stock">gtk-goto-last</property>
<property name="icon_size">1</property>
@@ -205,7 +206,7 @@
<accelerator key="C" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image368">
+ <widget class="GtkImage" id="image382">
<property name="visible">True</property>
<property name="stock">gtk-clear</property>
<property name="icon_size">1</property>
@@ -228,7 +229,7 @@
<accelerator key="Y" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image369">
+ <widget class="GtkImage" id="image383">
<property name="visible">True</property>
<property name="stock">gtk-index</property>
<property name="icon_size">1</property>
@@ -270,7 +271,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image370">
+ <widget class="GtkImage" id="image384">
<property name="visible">True</property>
<property name="stock">gtk-dnd-multiple</property>
<property name="icon_size">1</property>
@@ -335,7 +336,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image371">
+ <widget class="GtkImage" id="image385">
<property name="visible">True</property>
<property name="stock">gtk-select-font</property>
<property name="icon_size">1</property>
@@ -393,6 +394,22 @@
<signal name="activate" handler="on_devices_font_activate"/>
</widget>
</child>
+
+ <child>
+ <widget class="GtkSeparatorMenuItem" id="separator4">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="all_fonts">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Change all fonts at once</property>
+ <property name="label" translatable="yes">_All</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_all_fonts_activate" last_modification_time="Sat, 03 Jul 2004 00:34:07 GMT"/>
+ </widget>
+ </child>
</widget>
</child>
</widget>
@@ -407,7 +424,7 @@
<signal name="activate" handler="on_devform_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image372">
+ <widget class="GtkImage" id="image386">
<property name="visible">True</property>
<property name="stock">gtk-zoom-100</property>
<property name="icon_size">1</property>
@@ -428,7 +445,7 @@
<signal name="activate" handler="on_devdir_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image373">
+ <widget class="GtkImage" id="image387">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
@@ -449,7 +466,7 @@
<signal name="activate" handler="on_external_programs_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image374">
+ <widget class="GtkImage" id="image388">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@@ -477,7 +494,7 @@
<signal name="activate" handler="on_save_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image375">
+ <widget class="GtkImage" id="image389">
<property name="visible">True</property>
<property name="stock">gtk-save</property>
<property name="icon_size">1</property>
@@ -522,7 +539,7 @@
<signal name="activate" handler="on_about_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image376">
+ <widget class="GtkImage" id="image390">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c
index a87913b..1ea7df7 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
* ------------------------------------------------------------------
- * $Id: mixgtk_cmd_dispatcher.c,v 1.18 2004/07/02 00:06:26 jao Exp $
+ * $Id: mixgtk_cmd_dispatcher.c,v 1.19 2004/07/04 22:34:15 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
*
@@ -539,3 +539,10 @@ on_prompt_font_activate ()
GtkWidget *w[] = { dis_data_.prompt };
mixgtk_fontsel_query_font (MIX_FONT_PROMPT, w, 1);
}
+
+void
+mixgtk_cmd_dispatcher_update_fonts (void)
+{
+ mixgtk_fontsel_set_font (MIX_FONT_LOG, dis_data_.log);
+ mixgtk_fontsel_set_font (MIX_FONT_PROMPT, dis_data_.prompt);
+}
diff --git a/mixgtk/mixgtk_cmd_dispatcher.h b/mixgtk/mixgtk_cmd_dispatcher.h
index 6ea840c..d72160f 100644
--- a/mixgtk/mixgtk_cmd_dispatcher.h
+++ b/mixgtk/mixgtk_cmd_dispatcher.h
@@ -1,24 +1,24 @@
/* -*-c-*- ---------------- mixgtk_cmd_dispatcher.h :
* functions to access the command dispatcher
* ------------------------------------------------------------------
- * Last change: Time-stamp: <01/03/09 22:08:08 jose>
+ * $Id: mixgtk_cmd_dispatcher.h,v 1.5 2004/07/04 22:34:15 jao Exp $
* ------------------------------------------------------------------
- * Copyright (C) 2001 Free Software Foundation, Inc.
- *
+ * Copyright (C) 2001, 2004 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.
- *
+ *
*/
@@ -33,6 +33,9 @@
extern gboolean
mixgtk_cmd_dispatcher_init (mixgtk_dialog_id_t top);
+extern void
+mixgtk_cmd_dispatcher_update_fonts (void);
+
/* dispatch an externally provided command */
extern void
mixgtk_cmd_dispatcher_dispatch (const gchar *command);
diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c
index 1b3a78a..30e5bf3 100644
--- a/mixgtk/mixgtk_device.c
+++ b/mixgtk/mixgtk_device.c
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_device.c :
* actual types for mixgtk devices
* ------------------------------------------------------------------
- * $Id: mixgtk_device.c,v 1.24 2004/07/02 00:08:28 jao Exp $
+ * $Id: mixgtk_device.c,v 1.25 2004/07/04 22:34:15 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
*
@@ -578,8 +578,11 @@ on_devdir_ok_clicked ()
g_free (cmd);
}
-void
-on_devices_font_activate ()
+
+
+/* fonts */
+static GtkWidget **
+font_widgets_ (gint * n)
{
gint no = gtk_notebook_get_n_pages (dev_nb_);
GtkWidget **w = g_new (GtkWidget *, no + 1);
@@ -595,7 +598,28 @@ on_devices_font_activate ()
g_assert (k == no);
w[k] = GTK_WIDGET (dev_nb_);
- mixgtk_fontsel_query_font (MIX_FONT_DEVICES, w, no + 1);
+ if (n) *n = no;
+ return w;
+}
+
+void
+on_devices_font_activate ()
+{
+ gint no = 0;
+ GtkWidget **w = font_widgets_ (&no);
+ mixgtk_fontsel_query_font (MIX_FONT_DEVICES, w, no + 1);
g_free (w);
}
+
+void
+mixgtk_device_update_fonts (void)
+{
+ gint k, n = 0;
+ GtkWidget **w = font_widgets_ (&n);
+
+ g_assert (n >= 0);
+
+ for (k = 0; k < n; ++k)
+ mixgtk_fontsel_set_font (MIX_FONT_DEVICES, w[k]);
+}
diff --git a/mixgtk/mixgtk_device.h b/mixgtk/mixgtk_device.h
index b15cbb4..a4f095f 100644
--- a/mixgtk/mixgtk_device.h
+++ b/mixgtk/mixgtk_device.h
@@ -33,6 +33,9 @@
extern GtkWidget *
mixgtk_device_init (mix_vm_t *vm);
+extern void
+mixgtk_device_update_fonts (void);
+
/* change the output format of a device */
extern void
mixgtk_device_set_format (mix_device_type_t dev, gboolean dec);
diff --git a/mixgtk/mixgtk_fontsel.c b/mixgtk/mixgtk_fontsel.c
index 59849b1..37cc9c8 100644
--- a/mixgtk/mixgtk_fontsel.c
+++ b/mixgtk/mixgtk_fontsel.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_fontsel.c :
* Implementation of the functions declared in mixgtk_fontsel.h
* ------------------------------------------------------------------
- * $Id: mixgtk_fontsel.c,v 1.16 2004/06/24 01:40:47 jao Exp $
+ * $Id: mixgtk_fontsel.c,v 1.17 2004/07/04 22:34:15 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
*
@@ -24,12 +24,17 @@
#include <mixlib/mix.h>
#include "mixgtk_widgets.h"
#include "mixgtk_config.h"
+#include "mixgtk_mixvm.h"
+#include "mixgtk_mixal.h"
+#include "mixgtk_cmd_dispatcher.h"
+#include "mixgtk_device.h"
#include "mixgtk_fontsel.h"
static GtkFontSelectionDialog *fontsel_dialog_ = NULL;
static const gchar *keys_[MIX_FONT_NO] = {
- "MIX.font", "Prompt.font", "Log.font", "MIXAL.font", "Devices.font"
+ "MIX.font", "Prompt.font", "Log.font", "MIXAL.font", "Devices.font",
+ "Default.font"
};
@@ -72,7 +77,7 @@ mixgtk_fontsel_set_font (mixgtk_font_t f, GtkWidget *w)
}
-extern gboolean
+gboolean
mixgtk_fontsel_query_font (mixgtk_font_t f, GtkWidget **w, size_t no)
{
gint result = GTK_RESPONSE_APPLY;
@@ -104,3 +109,34 @@ mixgtk_fontsel_query_font (mixgtk_font_t f, GtkWidget **w, size_t no)
return ret;
}
+void
+on_all_fonts_activate (void)
+{
+ gint result = GTK_RESPONSE_APPLY;
+ const gchar *current;
+
+ if (!fontsel_dialog_) init_fontsel_ ();
+
+ current = mixgtk_config_get (keys_[MIX_FONT_DEFAULT]);
+ gtk_font_selection_dialog_set_font_name (fontsel_dialog_,
+ current? current : "Monospace");
+
+ while (result == GTK_RESPONSE_APPLY)
+ {
+ result = gtk_dialog_run (GTK_DIALOG (fontsel_dialog_));
+ if (result != GTK_RESPONSE_CANCEL)
+ {
+ gint k;
+ current = gtk_font_selection_dialog_get_font_name (fontsel_dialog_);
+
+ for (k = 0; k < MIX_FONT_NO; ++k)
+ mixgtk_config_update (keys_[k], current);
+
+ mixgtk_mixal_update_fonts ();
+ mixgtk_mixvm_update_fonts ();
+ mixgtk_device_update_fonts ();
+ mixgtk_cmd_dispatcher_update_fonts ();
+ }
+ }
+ gtk_widget_hide (GTK_WIDGET (fontsel_dialog_));
+}
diff --git a/mixgtk/mixgtk_fontsel.h b/mixgtk/mixgtk_fontsel.h
index 0b288d4..df2a040 100644
--- a/mixgtk/mixgtk_fontsel.h
+++ b/mixgtk/mixgtk_fontsel.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_fontsel.h :
* Functions for handling font selection.
* ------------------------------------------------------------------
- * $Id: mixgtk_fontsel.h,v 1.5 2004/06/24 01:40:47 jao Exp $
+ * $Id: mixgtk_fontsel.h,v 1.6 2004/07/04 22:34:15 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
*
@@ -34,6 +34,7 @@ typedef enum {
MIX_FONT_PROMPT,
MIX_FONT_MIXAL,
MIX_FONT_DEVICES,
+ MIX_FONT_DEFAULT,
MIX_FONT_NO
} mixgtk_font_t;
diff --git a/mixgtk/mixgtk_mixal.c b/mixgtk/mixgtk_mixal.c
index 1ee9475..3b2d42d 100644
--- a/mixgtk/mixgtk_mixal.c
+++ b/mixgtk/mixgtk_mixal.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_mixal.c :
* Implementation of the functions declared in mixgtk_mixal.h
* ------------------------------------------------------------------
- * $Id: mixgtk_mixal.c,v 1.19 2004/06/30 14:07:53 jao Exp $
+ * $Id: mixgtk_mixal.c,v 1.20 2004/07/04 22:34:15 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
*
@@ -83,6 +83,8 @@ init_symbols_ (void)
(MIXGTK_SYMBOLS_DIALOG, SYMBOLS_VIEW_NAME_));
g_assert (symbols_view_);
+ mixgtk_fontsel_set_font (MIX_FONT_DEFAULT, GTK_WIDGET (symbols_view_));
+
symbols_store_ = gtk_list_store_new (SYMBOLS_COL_NO,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -241,6 +243,13 @@ mixgtk_mixal_reparent (GtkStatusbar *status)
}
void
+mixgtk_mixal_update_fonts (void)
+{
+ mixgtk_fontsel_set_font (MIX_FONT_MIXAL, GTK_WIDGET (clist_));
+ mixgtk_fontsel_set_font (MIX_FONT_DEFAULT, GTK_WIDGET (symbols_view_));
+}
+
+void
mixgtk_mixal_pop_status (void)
{
if (status_ != NULL)
@@ -548,14 +557,6 @@ on_symbols_activate ()
}
void
-on_notebook_switch_page (GtkNotebook *notebook)
-{
-/* gint p = gtk_notebook_get_current_page (notebook); */
-/* if (p != MIXAL_TAB_POS_) gtk_statusbar_pop (status_, status_context_); */
-/* if (p == MIXAL_TAB_POS_) mixgtk_mixal_update (); */
-}
-
-void
on_mixal_leave_notify_event ()
{
if (status_ != NULL) gtk_statusbar_pop (status_, status_context_);
diff --git a/mixgtk/mixgtk_mixal.h b/mixgtk/mixgtk_mixal.h
index 248cf64..5fb7cbb 100644
--- a/mixgtk/mixgtk_mixal.h
+++ b/mixgtk/mixgtk_mixal.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_mixal.h :
* Declarations for functions displaying the mixal source file
* ------------------------------------------------------------------
- * $Id: mixgtk_mixal.h,v 1.6 2004/06/30 14:07:53 jao Exp $
+ * $Id: mixgtk_mixal.h,v 1.7 2004/07/04 22:34:15 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
*
@@ -46,6 +46,9 @@ extern void
mixgtk_mixal_update (void);
extern void
+mixgtk_mixal_update_fonts (void);
+
+extern void
mixgtk_mixal_pop_status (void);
/* breakpoints */
diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c
index cea52bb..10a34e1 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
* ------------------------------------------------------------------
- * $Id: mixgtk_mixvm.c,v 1.14 2004/07/02 00:09:55 jao Exp $
+ * $Id: mixgtk_mixvm.c,v 1.15 2004/07/04 22:34:15 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
*
@@ -122,6 +122,34 @@ mixgtk_mixvm_init (mix_vm_t *vm)
return TRUE;
}
+static GtkWidget **
+text_widgets_ (gint *n)
+{
+ static GtkWidget *w[REGISTER_NO_ + 2] = { NULL};
+
+ if (w[0] == NULL)
+ {
+ gint k;
+ w[0] = GTK_WIDGET (loc_entry_);
+ w[1] = GTK_WIDGET (memory_);
+ for (k = 0; k < REGISTER_NO_; ++k)
+ w[k + 2] = GTK_WIDGET (reg_entries_[k]);
+ };
+
+ if (n) *n = REGISTER_NO_ + 2;
+
+ return w;
+}
+
+void
+mixgtk_mixvm_update_fonts (void)
+{
+ gint k, n = 0;
+ GtkWidget **w = text_widgets_ (&n);
+ for (k = 0; k < n; ++k)
+ mixgtk_fontsel_set_font (MIX_FONT_MIXVM, w[k]);
+}
+
/* update register widgets */
void
mixgtk_mixvm_update_registers (void)
@@ -329,16 +357,9 @@ mem_cell_ (mix_word_t w, gpointer a)
void
on_mix_font_activate (void)
{
- GtkWidget *w[REGISTER_NO_ + 2] = {
- GTK_WIDGET (loc_entry_), GTK_WIDGET (memory_)
- };
-
- gint k;
-
- for (k = 0; k < REGISTER_NO_; ++k) w[k + 2] = GTK_WIDGET (reg_entries_[k]);
-
- mixgtk_fontsel_query_font (MIX_FONT_MIXVM, w, REGISTER_NO_ + 2);
-
+ gint n;
+ GtkWidget **w = text_widgets_ (&n);
+ mixgtk_fontsel_query_font (MIX_FONT_MIXVM, w, n);
}
diff --git a/mixgtk/mixgtk_mixvm.h b/mixgtk/mixgtk_mixvm.h
index 2288715..6e80f70 100644
--- a/mixgtk/mixgtk_mixvm.h
+++ b/mixgtk/mixgtk_mixvm.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_mixvm.h :
* Functions dealing with the mixvm widgets
* ------------------------------------------------------------------
- * $Id: mixgtk_mixvm.h,v 1.4 2004/06/30 14:07:53 jao Exp $
+ * $Id: mixgtk_mixvm.h,v 1.5 2004/07/04 22:34:15 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
*
@@ -33,6 +33,9 @@
extern gboolean
mixgtk_mixvm_init (mix_vm_t *vm);
+extern void
+mixgtk_mixvm_update_fonts (void);
+
/* update register widgets */
extern void
mixgtk_mixvm_update_registers (void);