summaryrefslogtreecommitdiff
path: root/tests/testtext.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2000-11-13 18:49:52 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-11-13 18:49:52 +0000
commit15e0004b109b85f15556b2d09d0d703c9c0534f7 (patch)
tree5747ab72346376c1500efa71aedb0156efc1cbd0 /tests/testtext.c
parentbe698675c7c043e3161362b99b9dc656531c91b4 (diff)
downloadgdk-pixbuf-15e0004b109b85f15556b2d09d0d703c9c0534f7.tar.gz
Free the filename of the module file.
2000-11-13 Havoc Pennington <hp@redhat.com> * gtk/gtkimmodule.c (gtk_im_module_init): Free the filename of the module file. * gtk/gtktexttag.c (gtk_text_attributes_copy): fix memory leak of dest->language * gtk/testtext.c: Test pixels above/below/inside paragraphs settings * gtk/gtktextview.c: Implement object args and setters/getters for all the aspects of the GtkTextAttributes that are not set from GtkWidget attributes. This is spacing, justification, margins, etc. (gtk_text_view_set_arg) (gtk_text_view_get_arg): implement get/set for editable, wrap mode args (gtk_text_view_class_init): Add args for justify, left_margin, right_margin, indent, and tabs * gtk/gtktextlayout.c (set_para_values): fix to display indent attribute properly * gtk/gtktexttag.c: Remove left_wrapped_line_margin attribute, replace with indent attribute * gtk/gtktextlayout.c (set_para_values): multiply indent by PANGO_SCALE * gtk/gtktextdisplay.c (render_para): Use PangoLayoutIter, rearranging code to do that (gtk_text_layout_draw): Pass in the y for the whole LineDisplay, i.e. don't subtract the top_margin first, just to keep all margin-futzing in one place. * gdk/gdkpango.c (gdk_draw_layout): Use PangoLayoutIter * gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Remove special case of last line, Pango now handles this itself. (gtk_text_layout_get_iter_at_pixel): Fix incorrect clamp of the Y coordinate (gtk_text_layout_move_iter_to_x): port to use PangoLayoutIter (find_display_line_above): wasn't moving the byte index as it iterated over lines, so always returned byte 0. Also, port to use PangoLayoutIter. (find_display_line_below): same problem as find_display_line_above. Also, port to use PangoLayoutIter.
Diffstat (limited to 'tests/testtext.c')
-rw-r--r--tests/testtext.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/tests/testtext.c b/tests/testtext.c
index 1f9be694b..ec964bcf9 100644
--- a/tests/testtext.c
+++ b/tests/testtext.c
@@ -503,12 +503,10 @@ fill_example_buffer (GtkTextBuffer *buffer)
gtk_object_set (GTK_OBJECT (tag),
"wrap_mode", GTK_WRAPMODE_WORD,
"direction", GTK_TEXT_DIR_RTL,
- "left_wrapped_line_margin", 20,
+ "indent", 30,
"left_margin", 20,
"right_margin", 20,
NULL);
-
-
pixbuf = gdk_pixbuf_new_from_xpm_data (book_closed_xpm);
@@ -859,6 +857,34 @@ do_direction_changed (gpointer callback_data,
gtk_widget_queue_resize (view->text_view);
}
+
+static void
+do_spacing_changed (gpointer callback_data,
+ guint callback_action,
+ GtkWidget *widget)
+{
+ View *view = view_from_widget (widget);
+
+ if (callback_action)
+ {
+ gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (view->text_view),
+ 23);
+ gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (view->text_view),
+ 21);
+ gtk_text_view_set_pixels_inside_wrap (GTK_TEXT_VIEW (view->text_view),
+ 9);
+ }
+ else
+ {
+ gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (view->text_view),
+ 0);
+ gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (view->text_view),
+ 0);
+ gtk_text_view_set_pixels_inside_wrap (GTK_TEXT_VIEW (view->text_view),
+ 0);
+ }
+}
+
static void
do_editable_changed (gpointer callback_data,
guint callback_action,
@@ -1112,6 +1138,10 @@ static GtkItemFactoryEntry menu_items[] =
{ "/Settings/Left-to-Right", NULL, do_direction_changed, GTK_TEXT_DIR_LTR, "<RadioItem>" },
{ "/Settings/Right-to-Left", NULL, do_direction_changed, GTK_TEXT_DIR_RTL, "/Settings/Left-to-Right" },
+
+ { "/Settings/sep1", NULL, 0, 0, "<Separator>" },
+ { "/Settings/Sane spacing", NULL, do_spacing_changed, FALSE, "<RadioItem>" },
+ { "/Settings/Funky spacing", NULL, do_spacing_changed, TRUE, "/Settings/Sane spacing" },
{ "/_Attributes", NULL, 0, 0, "<Branch>" },
{ "/Attributes/Editable", NULL, do_apply_editable, TRUE, NULL },
{ "/Attributes/Not editable", NULL, do_apply_editable, FALSE, NULL },
@@ -1864,8 +1894,7 @@ create_view (Buffer *buffer)
view->text_view = gtk_text_view_new_with_buffer (buffer->buffer);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view->text_view),
GTK_WRAPMODE_WORD);
-
-
+
/* Draw tab stops in the top and bottom windows. */
gtk_text_view_set_border_window_size (GTK_TEXT_VIEW (view->text_view),