GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit c3940d4a authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Select the right item in the family list. (Reported by Mark Patton, Patch

Mon Feb 18 18:27:45 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Select
        the right item in the family list. (Reported by Mark Patton,
        Patch from Satajyit Kanungo, #64240)

        * gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Update
        the size and face entry lists as well, fix memory leak.
        (Also #64240)

        * gtk/gtkfontsel.c (gtk_font_selection_show_available_sizes):
        Allow fractional sizes, unselect the selected row if none
        matches.

        * gtk/gtkscrolledwindow.c (gtk_scrolled_window_focus): Fix
        a bug where the scrolled window would always get focus
        when focusing out of the child.
parent 911700a3
Mon Feb 18 18:27:45 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Select
the right item in the family list. (Reported by Mark Patton,
Patch from Satajyit Kanungo, #64240)
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Update
the size and face entry lists as well, fix memory leak.
(Also #64240)
* gtk/gtkfontsel.c (gtk_font_selection_show_available_sizes):
Allow fractional sizes, unselect the selected row if none
matches.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_focus): Fix
a bug where the scrolled window would always get focus
when focusing out of the child.
2002-02-18 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkevents-win32.c : process WM_PAINT messages
......
Mon Feb 18 18:27:45 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Select
the right item in the family list. (Reported by Mark Patton,
Patch from Satajyit Kanungo, #64240)
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Update
the size and face entry lists as well, fix memory leak.
(Also #64240)
* gtk/gtkfontsel.c (gtk_font_selection_show_available_sizes):
Allow fractional sizes, unselect the selected row if none
matches.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_focus): Fix
a bug where the scrolled window would always get focus
when focusing out of the child.
2002-02-18 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkevents-win32.c : process WM_PAINT messages
......
Mon Feb 18 18:27:45 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Select
the right item in the family list. (Reported by Mark Patton,
Patch from Satajyit Kanungo, #64240)
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Update
the size and face entry lists as well, fix memory leak.
(Also #64240)
* gtk/gtkfontsel.c (gtk_font_selection_show_available_sizes):
Allow fractional sizes, unselect the selected row if none
matches.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_focus): Fix
a bug where the scrolled window would always get focus
when focusing out of the child.
2002-02-18 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkevents-win32.c : process WM_PAINT messages
......
Mon Feb 18 18:27:45 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Select
the right item in the family list. (Reported by Mark Patton,
Patch from Satajyit Kanungo, #64240)
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Update
the size and face entry lists as well, fix memory leak.
(Also #64240)
* gtk/gtkfontsel.c (gtk_font_selection_show_available_sizes):
Allow fractional sizes, unselect the selected row if none
matches.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_focus): Fix
a bug where the scrolled window would always get focus
when focusing out of the child.
2002-02-18 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkevents-win32.c : process WM_PAINT messages
......
Mon Feb 18 18:27:45 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Select
the right item in the family list. (Reported by Mark Patton,
Patch from Satajyit Kanungo, #64240)
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Update
the size and face entry lists as well, fix memory leak.
(Also #64240)
* gtk/gtkfontsel.c (gtk_font_selection_show_available_sizes):
Allow fractional sizes, unselect the selected row if none
matches.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_focus): Fix
a bug where the scrolled window would always get focus
when focusing out of the child.
2002-02-18 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkevents-win32.c : process WM_PAINT messages
......
Mon Feb 18 18:27:45 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Select
the right item in the family list. (Reported by Mark Patton,
Patch from Satajyit Kanungo, #64240)
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Update
the size and face entry lists as well, fix memory leak.
(Also #64240)
* gtk/gtkfontsel.c (gtk_font_selection_show_available_sizes):
Allow fractional sizes, unselect the selected row if none
matches.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_focus): Fix
a bug where the scrolled window would always get focus
when focusing out of the child.
2002-02-18 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkevents-win32.c : process WM_PAINT messages
......
Mon Feb 18 18:27:45 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Select
the right item in the family list. (Reported by Mark Patton,
Patch from Satajyit Kanungo, #64240)
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Update
the size and face entry lists as well, fix memory leak.
(Also #64240)
* gtk/gtkfontsel.c (gtk_font_selection_show_available_sizes):
Allow fractional sizes, unselect the selected row if none
matches.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_focus): Fix
a bug where the scrolled window would always get focus
when focusing out of the child.
2002-02-18 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkevents-win32.c : process WM_PAINT messages
......
......@@ -824,7 +824,8 @@ gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
GtkListStore *model;
GtkTreeSelection *selection;
gchar buffer[128];
gchar *p;
model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->size_list)));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list));
......@@ -847,20 +848,44 @@ gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
else
{
GtkTreeIter iter;
gboolean found = FALSE;
gtk_tree_model_get_iter_root (GTK_TREE_MODEL (model), &iter);
for (i = 0; i < G_N_ELEMENTS (font_sizes); i++)
for (i = 0; i < G_N_ELEMENTS (font_sizes) && !found; i++)
{
if (font_sizes[i] * PANGO_SCALE == fontsel->size)
set_cursor_to_iter (GTK_TREE_VIEW (fontsel->size_list), &iter);
{
set_cursor_to_iter (GTK_TREE_VIEW (fontsel->size_list), &iter);
found = TRUE;
}
gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter);
}
if (!found)
{
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list));
gtk_tree_selection_unselect_all (selection);
}
}
/* Set the entry to the new size, rounding to 1 digit,
* trimming of trailing 0's and a trailing period
*/
sprintf (buffer, "%.1f", fontsel->size / (1.0 * PANGO_SCALE));
if (strchr (buffer, '.'))
{
p = buffer + strlen (buffer) - 1;
while (*p == '0')
p--;
if (*p == '.')
p--;
p[1] = '\0';
}
sprintf (buffer, "%i", fontsel->size / PANGO_SCALE);
gtk_entry_set_text (GTK_ENTRY (fontsel->size_entry), buffer);
/* Compare, to avoid moving the cursor unecessarily */
if (strcmp (gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry)), buffer) != 0)
gtk_entry_set_text (GTK_ENTRY (fontsel->size_entry), buffer);
}
static void
......@@ -869,6 +894,19 @@ gtk_font_selection_select_best_size (GtkFontSelection *fontsel)
gtk_font_selection_load_font (fontsel);
}
static void
gtk_font_selection_set_size (GtkFontSelection *fontsel,
gint new_size)
{
if (fontsel->size != new_size)
{
fontsel->size = new_size;
gtk_font_selection_show_available_sizes (fontsel, FALSE);
gtk_font_selection_load_font (fontsel);
}
}
/* If the user hits return in the font size entry, we change to the new font
size. */
static void
......@@ -882,13 +920,9 @@ gtk_font_selection_size_activate (GtkWidget *w,
fontsel = GTK_FONT_SELECTION (data);
text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry));
new_size = atoi (text) * PANGO_SCALE;
if (fontsel->size != new_size)
{
fontsel->size = new_size;
gtk_font_selection_load_font (fontsel);
}
new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
gtk_font_selection_set_size (fontsel, new_size);
}
/* This is called when a size is selected in the list. */
......@@ -900,25 +934,13 @@ gtk_font_selection_select_size (GtkTreeSelection *selection,
GtkTreeModel *model;
GtkTreeIter iter;
gint new_size;
gchar buffer[128];
fontsel = GTK_FONT_SELECTION (data);
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter, SIZE_COLUMN, &new_size, -1);
new_size *= PANGO_SCALE;
if (fontsel->size != new_size)
{
/* If the size was selected by the user we set the selected_size. */
fontsel->size = new_size;
sprintf (buffer, "%i", fontsel->size / PANGO_SCALE);
gtk_entry_set_text (GTK_ENTRY (fontsel->size_entry), buffer);
gtk_font_selection_load_font (fontsel);
}
gtk_font_selection_set_size (fontsel, new_size * PANGO_SCALE);
}
}
......@@ -1025,6 +1047,7 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
PangoFontDescription *new_desc;
GtkTreeModel *model;
GtkTreeIter iter;
GtkTreeIter match_iter;
gboolean valid;
g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), FALSE);
......@@ -1056,6 +1079,7 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
return FALSE;
fontsel->family = new_family;
set_cursor_to_iter (GTK_TREE_VIEW (fontsel->family_list), &iter);
gtk_font_selection_show_available_styles (fontsel);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->face_list));
......@@ -1073,26 +1097,36 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
new_face = face;
if (!fallback_face)
fallback_face = face;
{
fallback_face = face;
match_iter = iter;
}
pango_font_description_free (tmp_desc);
g_object_unref (face);
if (new_face)
break;
{
match_iter = iter;
break;
}
}
if (!new_face)
new_face = fallback_face;
fontsel->face = new_face;
gtk_font_selection_select_best_size (fontsel);
set_cursor_to_iter (GTK_TREE_VIEW (fontsel->face_list), &match_iter);
gtk_font_selection_set_size (fontsel, pango_font_description_get_size (new_desc));
g_object_freeze_notify (G_OBJECT (fontsel));
g_object_notify (G_OBJECT (fontsel), "font_name");
g_object_notify (G_OBJECT (fontsel), "font");
g_object_thaw_notify (G_OBJECT (fontsel));
pango_font_description_free (new_desc);
return TRUE;
}
......
......@@ -1234,6 +1234,7 @@ gtk_scrolled_window_focus (GtkWidget *widget,
GtkDirectionType direction)
{
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
gboolean had_focus_child = GTK_CONTAINER (widget)->focus_child != NULL;
if (scrolled_window->focus_out)
{
......@@ -1253,8 +1254,13 @@ gtk_scrolled_window_focus (GtkWidget *widget,
return TRUE;
}
gtk_widget_grab_focus (widget);
return TRUE;
if (!had_focus_child)
{
gtk_widget_grab_focus (widget);
return TRUE;
}
else
return FALSE;
}
static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment