mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 05:01:09 +00:00
gtk-demo: Use top/bottom-margin for text views
This lets us replace the hack of inserting tags in the first and last paragraph to set a above/below-paragraph space.
This commit is contained in:
parent
d1381569fd
commit
ab09ffaa8c
@ -781,41 +781,9 @@ load_file (const gchar *demoname,
|
||||
|
||||
fontify (source_buffer);
|
||||
|
||||
gtk_text_buffer_create_tag (source_buffer, "top-margin",
|
||||
"pixels-above-lines", 20,
|
||||
NULL);
|
||||
gtk_text_buffer_get_start_iter (source_buffer, &start);
|
||||
end = start;
|
||||
gtk_text_iter_forward_word_end (&end);
|
||||
gtk_text_buffer_apply_tag_by_name (source_buffer, "top-margin", &start, &end);
|
||||
|
||||
gtk_text_buffer_create_tag (source_buffer, "bottom-margin",
|
||||
"pixels-below-lines", 20,
|
||||
NULL);
|
||||
gtk_text_buffer_get_end_iter (source_buffer, &end);
|
||||
start = end;
|
||||
gtk_text_iter_backward_word_start (&start);
|
||||
gtk_text_buffer_apply_tag_by_name (source_buffer, "bottom-margin", &start, &end);
|
||||
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (source_view), source_buffer);
|
||||
g_object_unref (source_buffer);
|
||||
|
||||
gtk_text_buffer_create_tag (info_buffer, "top-margin",
|
||||
"pixels-above-lines", 20,
|
||||
NULL);
|
||||
gtk_text_buffer_get_start_iter (info_buffer, &start);
|
||||
end = start;
|
||||
gtk_text_iter_forward_word_end (&end);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "top-margin", &start, &end);
|
||||
|
||||
gtk_text_buffer_create_tag (info_buffer, "bottom-margin",
|
||||
"pixels-below-lines", 20,
|
||||
NULL);
|
||||
gtk_text_buffer_get_end_iter (info_buffer, &end);
|
||||
start = end;
|
||||
gtk_text_iter_backward_word_start (&start);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "bottom-margin", &start, &end);
|
||||
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (info_view), info_buffer);
|
||||
g_object_unref (info_buffer);
|
||||
}
|
||||
@ -866,6 +834,8 @@ create_text (GtkWidget **view,
|
||||
g_object_set (text_view,
|
||||
"left-margin", 20,
|
||||
"right-margin", 20,
|
||||
"top-margin", 20,
|
||||
"bottom-margin", 20,
|
||||
NULL);
|
||||
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
|
@ -135,6 +135,8 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="left-margin">20</property>
|
||||
<property name="right-margin">20</property>
|
||||
<property name="top-margin">20</property>
|
||||
<property name="bottom-margin">20</property>
|
||||
<property name="pixels_above_lines">2</property>
|
||||
<property name="pixels_below_lines">2</property>
|
||||
<property name="editable">False</property>
|
||||
@ -170,6 +172,8 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="left-margin">20</property>
|
||||
<property name="right-margin">20</property>
|
||||
<property name="top-margin">20</property>
|
||||
<property name="bottom-margin">20</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user