diff options
author | wlemb <wlemb> | 2002-10-03 22:19:48 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2002-10-03 22:19:48 +0000 |
commit | d0768118ab6175d6b9f748856dcf23f6ce76bd90 (patch) | |
tree | 5e64733f1ad531145e0a6d12eacfb39d55c74b43 | |
parent | 5e220a10774165282e48b0bdcb7ec585a0bb5c6f (diff) | |
download | groff-d0768118ab6175d6b9f748856dcf23f6ce76bd90.tar.gz |
* src/roff/troff/node.cc (break_char_node::col): New variable.
Updated constructor.
(space_node::tprint, word_space_node::tprint): Call `fill_color'
unconditionally.
(space_node::space_node): Remove assertion.
(break_char_node::add_self): Pass color argument to space node.
* src/roff/troff/input.cc (token::add_to_node_list, token::process):
Ditto.
* src/roff/troff/env.cc (environment::do_break,
environment::add_padding): Ditto.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | src/roff/troff/env.cc | 6 | ||||
-rw-r--r-- | src/roff/troff/input.cc | 4 | ||||
-rw-r--r-- | src/roff/troff/node.cc | 25 |
4 files changed, 29 insertions, 19 deletions
@@ -1,3 +1,16 @@ +2002-10-03 Werner LEMBERG <wl@gnu.org> + + * src/roff/troff/node.cc (break_char_node::col): New variable. + Updated constructor. + (space_node::tprint, word_space_node::tprint): Call `fill_color' + unconditionally. + (space_node::space_node): Remove assertion. + (break_char_node::add_self): Pass color argument to space node. + * src/roff/troff/input.cc (token::add_to_node_list, token::process): + Ditto. + * src/roff/troff/env.cc (environment::do_break, + environment::add_padding): Ditto. + 2002-10-02 Werner LEMBERG <wl@gnu.org> Redesigning color support in troff. Colors are no longer diff --git a/src/roff/troff/env.cc b/src/roff/troff/env.cc index 78e7f6a8..40c9e3cf 100644 --- a/src/roff/troff/env.cc +++ b/src/roff/troff/env.cc @@ -2288,7 +2288,7 @@ void environment::do_break(int spread) wrap_up_tab(); if (line) { // this is so that hyphenation works - line = new space_node(H0, 0, line); + line = new space_node(H0, get_fill_color(), line); space_total++; possibly_break_line(0, spread); } @@ -2973,13 +2973,13 @@ void environment::wrap_up_field() void environment::add_padding() { if (current_tab) { - tab_contents = new space_node(H0, 0, tab_contents); + tab_contents = new space_node(H0, get_fill_color(), tab_contents); tab_field_spaces++; } else { if (line == 0) start_line(); - line = new space_node(H0, 0, line); + line = new space_node(H0, get_fill_color(), line); field_spaces++; } } diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc index 359caadf..7a90e4b1 100644 --- a/src/roff/troff/input.cc +++ b/src/roff/troff/input.cc @@ -6116,7 +6116,7 @@ int token::add_to_node_list(node **pp) n = new transparent_dummy_node; break; case TOKEN_ZERO_WIDTH_BREAK: - n = new space_node(H0, 0); + n = new space_node(H0, curenv->get_fill_color()); n->freeze_space(); n->is_escape_colon(); break; @@ -6219,7 +6219,7 @@ void token::process() break; case TOKEN_ZERO_WIDTH_BREAK: { - node *tmp = new space_node(H0, 0); + node *tmp = new space_node(H0, curenv->get_fill_color()); tmp->freeze_space(); tmp->is_escape_colon(); curenv->add_node(tmp); diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc index b1cc061b..650bf0e8 100644 --- a/src/roff/troff/node.cc +++ b/src/roff/troff/node.cc @@ -2572,8 +2572,9 @@ int italic_corrected_node::character_type() class break_char_node : public node { node *ch; char break_code; + color *col; public: - break_char_node(node *, int, node * = 0); + break_char_node(node *, int, color *, node * = 0); ~break_char_node(); node *copy(); hunits width(); @@ -2597,8 +2598,8 @@ public: int force_tprint(); }; -break_char_node::break_char_node(node *n, int c, node *x) -: node(x), ch(n), break_code(c) +break_char_node::break_char_node(node *n, int bc, color *c, node *x) +: node(x), ch(n), break_code(bc), col(c) { } @@ -2609,7 +2610,7 @@ break_char_node::~break_char_node() node *break_char_node::copy() { - return new break_char_node(ch->copy(), break_code); + return new break_char_node(ch->copy(), break_code, col); } hunits break_char_node::width() @@ -2641,13 +2642,13 @@ node *break_char_node::add_self(node *n, hyphen_list **p) { assert((*p)->hyphenation_code == 0); if ((*p)->breakable && (break_code & 1)) { - n = new space_node(H0, 0, n); + n = new space_node(H0, col, n); n->freeze_space(); } next = n; n = this; if ((*p)->breakable && (break_code & 2)) { - n = new space_node(H0, 0, n); + n = new space_node(H0, col, n); n->freeze_space(); } hyphen_list *pp = *p; @@ -2926,14 +2927,11 @@ inline void space_node::operator delete(void *p) space_node::space_node(hunits nn, color *c, node *p) : node(p), n(nn), set(0), was_escape_colon(0), col(c) { - // zero color pointer allowed only for zero width - assert(c != 0 || nn == H0); } space_node::space_node(hunits nn, int s, int flag, color *c, node *p) : node(p), n(nn), set(s), was_escape_colon(flag), col(c) { - assert(c != 0 || nn == H0); } #if 0 @@ -4018,8 +4016,7 @@ int word_space_node::set_unformat_flag() void word_space_node::tprint(troff_output_file *out) { - if (col) - out->fill_color(col); + out->fill_color(col); out->word_marker(); out->right(n); } @@ -4375,8 +4372,7 @@ void node::zero_width_tprint(troff_output_file *out) void space_node::tprint(troff_output_file *out) { - if (col) - out->fill_color(col); + out->fill_color(col); out->right(n); } @@ -4642,7 +4638,7 @@ node *node::add_char(charinfo *ci, environment *env, if (break_code) { node *next1 = res->next; res->next = 0; - res = new break_char_node(res, break_code, next1); + res = new break_char_node(res, break_code, env->get_fill_color(), next1); } return res; } @@ -5171,6 +5167,7 @@ int dbreak_node::force_tprint() int break_char_node::same(node *nd) { return break_code == ((break_char_node *)nd)->break_code + && col == ((break_char_node *)nd)->col && same_node(ch, ((break_char_node *)nd)->ch); } |