diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-02-22 22:02:24 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-02-22 22:02:24 +0000 |
commit | de78784eb1902f24f483cb3f4855559b9cf032c6 (patch) | |
tree | 2e4e1da26c0a7bd7ca6b41558dc28975c5fd2793 | |
parent | abba4bdf73dbaec1b26e8dce83cc3383bad83ca2 (diff) | |
download | gdk-pixbuf-de78784eb1902f24f483cb3f4855559b9cf032c6.tar.gz |
Update the current font from the contents of the entry. (#3123)
Thu Feb 22 16:45:17 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c (gtk_font_selection_get_font[_name]):
Update the current font from the contents of the entry.
(#3123)
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 6 | ||||
-rw-r--r-- | gtk/gtkfontsel.c | 86 |
8 files changed, 85 insertions, 43 deletions
@@ -1,3 +1,9 @@ +Thu Feb 22 16:45:17 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkfontsel.c (gtk_font_selection_get_font[_name]): + Update the current font from the contents of the entry. + (#3123) + Tue Feb 2 11:22:33 2001 Jody Goldberg <jgoldberg@home.com> * gtk/gtkstyle.c : Remove duplicate fwd decl for diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 897c82978..a67f471da 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +Thu Feb 22 16:45:17 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkfontsel.c (gtk_font_selection_get_font[_name]): + Update the current font from the contents of the entry. + (#3123) + Tue Feb 2 11:22:33 2001 Jody Goldberg <jgoldberg@home.com> * gtk/gtkstyle.c : Remove duplicate fwd decl for diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 897c82978..a67f471da 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Thu Feb 22 16:45:17 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkfontsel.c (gtk_font_selection_get_font[_name]): + Update the current font from the contents of the entry. + (#3123) + Tue Feb 2 11:22:33 2001 Jody Goldberg <jgoldberg@home.com> * gtk/gtkstyle.c : Remove duplicate fwd decl for diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 897c82978..a67f471da 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Thu Feb 22 16:45:17 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkfontsel.c (gtk_font_selection_get_font[_name]): + Update the current font from the contents of the entry. + (#3123) + Tue Feb 2 11:22:33 2001 Jody Goldberg <jgoldberg@home.com> * gtk/gtkstyle.c : Remove duplicate fwd decl for diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 897c82978..a67f471da 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Thu Feb 22 16:45:17 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkfontsel.c (gtk_font_selection_get_font[_name]): + Update the current font from the contents of the entry. + (#3123) + Tue Feb 2 11:22:33 2001 Jody Goldberg <jgoldberg@home.com> * gtk/gtkstyle.c : Remove duplicate fwd decl for diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 897c82978..a67f471da 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Thu Feb 22 16:45:17 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkfontsel.c (gtk_font_selection_get_font[_name]): + Update the current font from the contents of the entry. + (#3123) + Tue Feb 2 11:22:33 2001 Jody Goldberg <jgoldberg@home.com> * gtk/gtkstyle.c : Remove duplicate fwd decl for diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 897c82978..a67f471da 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Thu Feb 22 16:45:17 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkfontsel.c (gtk_font_selection_get_font[_name]): + Update the current font from the contents of the entry. + (#3123) + Tue Feb 2 11:22:33 2001 Jody Goldberg <jgoldberg@home.com> * gtk/gtkstyle.c : Remove duplicate fwd decl for diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c index 6827997d2..d577c1371 100644 --- a/gtk/gtkfontsel.c +++ b/gtk/gtkfontsel.c @@ -305,9 +305,9 @@ static void gtk_font_selection_select_style (GtkWidget *w, gpointer data); static void gtk_font_selection_show_available_sizes (GtkFontSelection *fs); -static gint gtk_font_selection_size_key_press (GtkWidget *w, - GdkEventKey *event, - gpointer data); +static void gtk_font_selection_size_activate (GtkWidget *w, + gpointer data); + static void gtk_font_selection_select_best_size (GtkFontSelection *fs); static void gtk_font_selection_select_size (GtkWidget *w, gint row, @@ -534,8 +534,8 @@ gtk_font_selection_init(GtkFontSelection *fontsel) gtk_widget_show (fontsel->size_entry); gtk_table_attach (GTK_TABLE (table), fontsel->size_entry, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); - gtk_signal_connect (GTK_OBJECT (fontsel->size_entry), "key_press_event", - (GtkSignalFunc) gtk_font_selection_size_key_press, + gtk_signal_connect (GTK_OBJECT (fontsel->size_entry), "activate", + GTK_SIGNAL_FUNC (gtk_font_selection_size_activate), fontsel); /* Create the clists */ @@ -1495,56 +1495,51 @@ gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel) gtk_clist_thaw (GTK_CLIST(fontsel->size_clist)); } - -/* If the user hits return in the font size entry, we change to the new font - size. */ -static gint -gtk_font_selection_size_key_press (GtkWidget *w, - GdkEventKey *event, - gpointer data) +static void +gtk_font_selection_update_size (GtkFontSelection *fontsel) { - GtkFontSelection *fontsel; gint new_size; gfloat new_size_float; gchar *text; #ifdef FONTSEL_DEBUG - g_message("In size_key_press\n"); + g_message("In update_size\n"); #endif - fontsel = GTK_FONT_SELECTION(data); - if (event->keyval == GDK_Return) + text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry)); + if (fontsel->metric == GTK_FONT_METRIC_PIXELS) { - text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry)); - if (fontsel->metric == GTK_FONT_METRIC_PIXELS) - { - new_size = atoi (text); - if (new_size < 2) - new_size = 2; - } - else - { - new_size_float = atof (text) * 10; - new_size = (gint) new_size_float; - if (new_size < 20) - new_size = 20; - } - - /* Remember that this size was set explicitly. */ - fontsel->selected_size = new_size; - - /* Check if the font size has changed, and return if it hasn't. */ - if (fontsel->size == new_size) - return TRUE; - - fontsel->size = new_size; - gtk_font_selection_select_best_size (fontsel); - return TRUE; + new_size = atoi (text); + if (new_size < 2) + new_size = 2; + } + else + { + new_size_float = atof (text) * 10; + new_size = (gint) new_size_float; + if (new_size < 20) + new_size = 20; } - return FALSE; + /* Remember that this size was set explicitly. */ + fontsel->selected_size = new_size; + + /* Check if the font size has changed, and return if it hasn't. */ + if (fontsel->size == new_size) + return; + + fontsel->size = new_size; + gtk_font_selection_select_best_size (fontsel); } +/* If the user hits return in the font size entry, we change to the new font + size. */ +static void +gtk_font_selection_size_activate (GtkWidget *w, + gpointer data) +{ + gtk_font_selection_update_size (data); +} /* This tries to select the closest size to the current size, though it may have to change the size if only unscaled bitmaps are available. @@ -3099,7 +3094,10 @@ gtk_font_selection_insert_field (gchar *fontname, GdkFont* gtk_font_selection_get_font (GtkFontSelection *fontsel) { - g_return_val_if_fail (fontsel != NULL, NULL); + g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL); + + gtk_font_selection_update_size (fontsel); + return fontsel->font; } @@ -3115,6 +3113,8 @@ gtk_font_selection_get_font_name (GtkFontSelection *fontsel) g_return_val_if_fail (fontsel != NULL, NULL); g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL); + gtk_font_selection_update_size (fontsel); + /* If no family has been selected return NULL. */ if (fontsel->font_index == -1) return NULL; |