73
73
_gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
76
guint left_margin_accumulative = 0;
77
guint right_margin_accumulative = 0;
79
g_return_if_fail (!dest->realized);
81
for (; tags; tags = tags->next)
84
GtkTextAttributes *vals;
89
if (tag->bg_color_set)
91
dest->appearance.bg_color = vals->appearance.bg_color;
93
dest->appearance.draw_bg = TRUE;
95
if (tag->fg_color_set)
96
dest->appearance.fg_color = vals->appearance.fg_color;
98
if (tag->pg_bg_color_set)
100
dest->pg_bg_color = gdk_color_copy (vals->pg_bg_color);
103
if (tag->bg_stipple_set)
105
g_object_ref (vals->appearance.bg_stipple);
106
if (dest->appearance.bg_stipple)
107
g_object_unref (dest->appearance.bg_stipple);
108
dest->appearance.bg_stipple = vals->appearance.bg_stipple;
110
dest->appearance.draw_bg = TRUE;
113
if (tag->fg_stipple_set)
115
g_object_ref (vals->appearance.fg_stipple);
116
if (dest->appearance.fg_stipple)
117
g_object_unref (dest->appearance.fg_stipple);
118
dest->appearance.fg_stipple = vals->appearance.fg_stipple;
124
pango_font_description_merge (dest->font, vals->font, TRUE);
126
dest->font = pango_font_description_copy (vals->font);
129
/* multiply all the scales together to get a composite */
131
dest->font_scale *= vals->font_scale;
133
if (tag->justification_set)
134
dest->justification = vals->justification;
136
if (vals->direction != GTK_TEXT_DIR_NONE)
137
dest->direction = vals->direction;
139
if (tag->left_margin_set)
141
if (tag->accumulative_margin)
142
left_margin_accumulative += vals->left_margin;
144
dest->left_margin = vals->left_margin;
148
dest->indent = vals->indent;
151
dest->appearance.rise = vals->appearance.rise;
153
if (tag->right_margin_set)
155
if (tag->accumulative_margin)
156
right_margin_accumulative += vals->right_margin;
158
dest->right_margin = vals->right_margin;
161
if (tag->pixels_above_lines_set)
162
dest->pixels_above_lines = vals->pixels_above_lines;
164
if (tag->pixels_below_lines_set)
165
dest->pixels_below_lines = vals->pixels_below_lines;
167
if (tag->pixels_inside_wrap_set)
168
dest->pixels_inside_wrap = vals->pixels_inside_wrap;
173
pango_tab_array_free (dest->tabs);
174
dest->tabs = pango_tab_array_copy (vals->tabs);
177
if (tag->wrap_mode_set)
178
dest->wrap_mode = vals->wrap_mode;
180
if (tag->underline_set)
181
dest->appearance.underline = vals->appearance.underline;
183
if (tag->strikethrough_set)
184
dest->appearance.strikethrough = vals->appearance.strikethrough;
186
if (tag->invisible_set)
187
dest->invisible = vals->invisible;
189
if (tag->editable_set)
190
dest->editable = vals->editable;
192
if (tag->bg_full_height_set)
193
dest->bg_full_height = vals->bg_full_height;
195
if (tag->language_set)
196
dest->language = vals->language;
76
guint left_margin_accumulative = 0;
77
guint right_margin_accumulative = 0;
79
g_return_if_fail (!dest->realized);
81
for (; tags; tags = tags->next) {
83
gboolean accumulative_margin;
84
gboolean background_set;
85
gboolean fg_color_set;
86
gboolean pg_bg_color_set;
87
gboolean bg_stipple_set;
88
gboolean fg_stipple_set;
90
gboolean left_margin_set;
91
gboolean justification_set;
94
gboolean right_margin_set;
95
gboolean pixels_above_lines_set;
96
gboolean pixels_below_lines_set;
98
gboolean wrap_mode_set;
99
gboolean pixels_inside_wrap_set;
100
gboolean underline_set;
101
gboolean strikethrough_set;
102
gboolean invisible_set;
103
gboolean editable_set;
104
gboolean bg_full_height_set;
105
gboolean language_set;
106
GtkTextDirection direction;
107
PangoFontDescription *font_desc;
112
"accumulative-margin", &accumulative_margin,
113
"background-set", &background_set,
114
"foreground-set", &fg_color_set,
115
"paragraph-background-set", &pg_bg_color_set,
116
"background-stipple-set", &bg_stipple_set,
117
"foreground-stipple-set", &fg_stipple_set,
118
"scale-set", &scale_set,
119
"left-margin-set", &left_margin_set,
120
"justification-set", &justification_set,
121
"indent-set", &indent_set,
122
"rise-set", &rise_set,
123
"right-margin-set", &right_margin_set,
124
"pixels-above-lines-set", &pixels_above_lines_set,
125
"pixels-below-lines-set", &pixels_below_lines_set,
126
"tabs-set", &tabs_set,
127
"wrap-mode-set", &wrap_mode_set,
128
"pixels-inside-wrap-set", &pixels_inside_wrap_set,
129
"underline-set", &underline_set,
130
"strikethrough-set", &strikethrough_set,
131
"invisible-set", &invisible_set,
132
"editable-set", &editable_set,
133
"background-full-height-set", &bg_full_height_set,
134
"language-set", &language_set,
135
"direction", &direction,
136
"font-desc", &font_desc,
139
if (dest->appearance.draw_bg) {
140
GdkColor *color = NULL;
142
g_object_get (tag, "background-gdk", &color, NULL);
143
dest->appearance.bg_color = *color;
144
gdk_color_free (color);
146
dest->appearance.draw_bg = TRUE;
150
GdkColor *color = NULL;
152
g_object_get (tag, "foreground-gdk", &color, NULL);
153
dest->appearance.fg_color = *color;
154
gdk_color_free (color);
157
if (pg_bg_color_set) {
158
if (dest->pg_bg_color)
159
gdk_color_free (dest->pg_bg_color);
161
g_object_get (tag, "paragraph-background-gdk", &dest->pg_bg_color, NULL);
164
if (bg_stipple_set) {
165
if (dest->appearance.bg_stipple)
166
g_object_unref (dest->appearance.bg_stipple);
167
g_object_get (tag, "background-stipple", &dest->appearance.bg_stipple, NULL);
169
dest->appearance.draw_bg = TRUE;
172
if (fg_stipple_set) {
173
if (dest->appearance.fg_stipple)
174
g_object_unref (dest->appearance.fg_stipple);
175
g_object_get (tag, "foreground-stipple", &dest->appearance.fg_stipple, NULL);
180
pango_font_description_merge (dest->font, font_desc, TRUE);
181
pango_font_description_free (font_desc);
184
dest->font = font_desc;
187
/* multiply all the scales together to get a composite */
190
g_object_get (tag, "foreground-stipple", &font_scale, NULL);
191
dest->font_scale *= font_scale;
194
if (justification_set)
195
g_object_get (tag, "justification", &dest->justification, NULL);
197
if (direction != GTK_TEXT_DIR_NONE)
198
dest->direction = direction;
200
if (left_margin_set) {
203
g_object_get (tag, "left-margin", &left_margin, NULL);
204
if (accumulative_margin)
205
left_margin_accumulative += left_margin;
207
dest->left_margin = left_margin;
211
g_object_get (tag, "indent", &dest->indent, NULL);
214
g_object_get (tag, "rise", &dest->appearance.rise, NULL);
216
if (right_margin_set) {
219
g_object_get (tag, "right-margin", &right_margin, NULL);
221
if (accumulative_margin)
222
right_margin_accumulative += right_margin;
224
dest->right_margin = right_margin;
227
if (pixels_above_lines_set)
228
g_object_get (tag, "pixels-above-lines", &dest->pixels_above_lines, NULL);
230
if (pixels_below_lines_set)
231
g_object_get (tag, "pixels-below-lines", &dest->pixels_below_lines, NULL);
233
if (pixels_inside_wrap_set)
234
g_object_get (tag, "pixels-inside-wrap", &dest->pixels_inside_wrap, NULL);
238
pango_tab_array_free (dest->tabs);
239
g_object_get (tag, "pixels-inside-wrap", &dest->tabs, NULL);
243
g_object_get (tag, "wrap-mode", &dest->wrap_mode, NULL);
248
g_object_get (tag, "underline", &underline, NULL);
249
dest->appearance.underline = underline;
252
if (strikethrough_set) {
255
g_object_get (tag, "strikethrough", &strikethrough, NULL);
256
dest->appearance.strikethrough = strikethrough;
262
g_object_get (tag, "invisible", &invisible, NULL);
263
dest->invisible = invisible;
269
g_object_get (tag, "editable", &editable, NULL);
270
dest->editable = editable;
273
if (bg_full_height_set) {
276
g_object_get (tag, "background-full-height", &bg_full_height, NULL);
277
dest->bg_full_height = bg_full_height;
281
g_free (dest->language);
282
g_object_get (tag, "language", &dest->language, NULL);
199
dest->left_margin += left_margin_accumulative;
200
dest->right_margin += right_margin_accumulative;
286
dest->left_margin += left_margin_accumulative;
287
dest->right_margin += right_margin_accumulative;