forked from AuroraMiddleware/gtk
gtk-demo: Adapt textview example for stipple removal
This commit is contained in:
parent
3fc31e88b0
commit
4729460a4f
@ -14,17 +14,9 @@
|
|||||||
|
|
||||||
static void easter_egg_callback (GtkWidget *button, gpointer data);
|
static void easter_egg_callback (GtkWidget *button, gpointer data);
|
||||||
|
|
||||||
#define gray50_width 2
|
|
||||||
#define gray50_height 2
|
|
||||||
static char gray50_bits[] = {
|
|
||||||
0x02, 0x01
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_tags (GtkTextBuffer *buffer)
|
create_tags (GtkTextBuffer *buffer)
|
||||||
{
|
{
|
||||||
GdkBitmap *stipple;
|
|
||||||
|
|
||||||
/* Create a bunch of tags. Note that it's also possible to
|
/* Create a bunch of tags. Note that it's also possible to
|
||||||
* create tags with gtk_text_tag_new() then add them to the
|
* create tags with gtk_text_tag_new() then add them to the
|
||||||
* tag table for the buffer, gtk_text_buffer_create_tag() is
|
* tag table for the buffer, gtk_text_buffer_create_tag() is
|
||||||
@ -74,18 +66,6 @@ create_tags (GtkTextBuffer *buffer)
|
|||||||
gtk_text_buffer_create_tag (buffer, "red_background",
|
gtk_text_buffer_create_tag (buffer, "red_background",
|
||||||
"background", "red", NULL);
|
"background", "red", NULL);
|
||||||
|
|
||||||
stipple = gdk_bitmap_create_from_data (NULL,
|
|
||||||
gray50_bits, gray50_width,
|
|
||||||
gray50_height);
|
|
||||||
|
|
||||||
gtk_text_buffer_create_tag (buffer, "background_stipple",
|
|
||||||
"background_stipple", stipple, NULL);
|
|
||||||
|
|
||||||
gtk_text_buffer_create_tag (buffer, "foreground_stipple",
|
|
||||||
"foreground_stipple", stipple, NULL);
|
|
||||||
|
|
||||||
g_object_unref (stipple);
|
|
||||||
|
|
||||||
gtk_text_buffer_create_tag (buffer, "big_gap_before_line",
|
gtk_text_buffer_create_tag (buffer, "big_gap_before_line",
|
||||||
"pixels_above_lines", 30, NULL);
|
"pixels_above_lines", 30, NULL);
|
||||||
|
|
||||||
@ -227,17 +207,9 @@ insert_text (GtkTextBuffer *buffer)
|
|||||||
"red_background", NULL);
|
"red_background", NULL);
|
||||||
gtk_text_buffer_insert (buffer, &iter, " or even ", -1);
|
gtk_text_buffer_insert (buffer, &iter, " or even ", -1);
|
||||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||||
"a stippled red background", -1,
|
"a blue foreground on red background", -1,
|
||||||
"red_background",
|
|
||||||
"background_stipple",
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
gtk_text_buffer_insert (buffer, &iter, " or ", -1);
|
|
||||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
|
||||||
"a stippled blue foreground on solid red background", -1,
|
|
||||||
"blue_foreground",
|
"blue_foreground",
|
||||||
"red_background",
|
"red_background",
|
||||||
"foreground_stipple",
|
|
||||||
NULL);
|
NULL);
|
||||||
gtk_text_buffer_insert (buffer, &iter, " (select that to read it) can be used.\n\n", -1);
|
gtk_text_buffer_insert (buffer, &iter, " (select that to read it) can be used.\n\n", -1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user