1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
---|
2 | /* This file is part of the GtkHTML library. |
---|
3 | |
---|
4 | Copyright (C) 2000 Helix Code, Inc. |
---|
5 | |
---|
6 | This library is free software; you can redistribute it and/or |
---|
7 | modify it under the terms of the GNU Library General Public |
---|
8 | License as published by the Free Software Foundation; either |
---|
9 | version 2 of the License, or (at your option) any later version. |
---|
10 | |
---|
11 | This library is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | Library General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU Library General Public License |
---|
17 | along with this library; see the file COPYING.LIB. If not, write to |
---|
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
19 | Boston, MA 02111-1307, USA. |
---|
20 | */ |
---|
21 | |
---|
22 | #include <config.h> |
---|
23 | #include "htmlengine.h" |
---|
24 | #include "htmlrule.h" |
---|
25 | #include "htmlcluealigned.h" |
---|
26 | #include "htmlengine-edit-cut-and-paste.h" |
---|
27 | #include "htmlengine-edit-rule.h" |
---|
28 | |
---|
29 | void |
---|
30 | html_engine_insert_rule (HTMLEngine *e, |
---|
31 | gint length, |
---|
32 | gint percent, |
---|
33 | gint size, |
---|
34 | gboolean shade, |
---|
35 | HTMLHAlignType halign) |
---|
36 | { |
---|
37 | HTMLObject *rule; |
---|
38 | |
---|
39 | g_return_if_fail (e != NULL); |
---|
40 | g_return_if_fail (HTML_IS_ENGINE (e)); |
---|
41 | |
---|
42 | rule = html_rule_new (length, percent, size, shade, halign); |
---|
43 | |
---|
44 | html_engine_paste_object (e, rule, 1); |
---|
45 | } |
---|
46 | |
---|
47 | #define SET(x) if (rule->x != x) { changed = TRUE; rule->x = x; } |
---|
48 | #define SETO(x) if (HTML_OBJECT (rule)->x != x) { changed = TRUE; HTML_OBJECT (rule)->x = x; } |
---|
49 | |
---|
50 | void |
---|
51 | html_rule_set (HTMLRule *rule, HTMLEngine *e, gint length, gint percent, gint size, gboolean shade, HTMLHAlignType halign) |
---|
52 | { |
---|
53 | gboolean changed = FALSE; |
---|
54 | |
---|
55 | SET (length); |
---|
56 | SET (size); |
---|
57 | SETO (percent); |
---|
58 | SET (shade); |
---|
59 | SET (halign); |
---|
60 | |
---|
61 | if (changed) |
---|
62 | html_engine_schedule_update (e); |
---|
63 | } |
---|
64 | |
---|
65 | void |
---|
66 | html_rule_set_length (HTMLRule *rule, HTMLEngine *e, gint length, gint percent) |
---|
67 | { |
---|
68 | gboolean changed = FALSE; |
---|
69 | |
---|
70 | SET (length); |
---|
71 | SETO (percent); |
---|
72 | |
---|
73 | if (changed) |
---|
74 | html_engine_schedule_update (e); |
---|
75 | } |
---|
76 | |
---|
77 | void |
---|
78 | html_rule_set_size (HTMLRule *rule, HTMLEngine *e, gint size) |
---|
79 | { |
---|
80 | gboolean changed = FALSE; |
---|
81 | |
---|
82 | SET (size); |
---|
83 | |
---|
84 | if (changed) |
---|
85 | html_engine_schedule_update (e); |
---|
86 | } |
---|
87 | |
---|
88 | void |
---|
89 | html_rule_set_shade (HTMLRule *rule, HTMLEngine *e, gboolean shade) |
---|
90 | { |
---|
91 | gboolean changed = FALSE; |
---|
92 | |
---|
93 | SET (shade); |
---|
94 | |
---|
95 | if (changed) |
---|
96 | html_engine_schedule_update (e); |
---|
97 | } |
---|
98 | |
---|
99 | void |
---|
100 | html_rule_set_align (HTMLRule *rule, HTMLEngine *e, HTMLHAlignType halign) |
---|
101 | { |
---|
102 | gboolean changed = FALSE; |
---|
103 | |
---|
104 | SET (halign); |
---|
105 | |
---|
106 | if (changed) |
---|
107 | html_engine_schedule_update (e); |
---|
108 | } |
---|