-\f
-/* Render contiguous strip consisting of columns C1...C2, exclusive,
- on row R, at location (X,Y). Return width of the strip thus
- rendered.
-
- Renders joined cells, even those outside the strip, within the
- rendering region (C1,R1)-(C2,R2).
-
- For the purposes of counting rows and columns in this function
- only, horizontal rules are considered rows and vertical rules are
- considered columns.
-
- FIXME: Doesn't use r1? Huh? */
-static int
-render_strip (int x, int y, int r, int c1, int c2, int r1 UNUSED, int r2)
-{
- int x_origin = x;
-
- /* Horizontal rules. */
- if ((r & 1) == 0)
- {
- int hrh = t->hrh[r / 2];
- int c;
-
- for (c = c1; c < c2; c++)
- {
- if (c & 1)
- {
- int style = t->rh[(c / 2) + (r / 2 * t->cf)];
-
- if (style != TAL_0)
- {
- const struct color clr = {0, 0, 0, 0};
- struct rect rct;
-
- rct.x1 = x;
- rct.y1 = y;
- rct.x2 = x + t->w[c / 2];
- rct.y2 = y + hrh;
- d->class->line_horz (d, &rct, &clr, style);
- }
- x += t->w[c / 2];
- } else {
- const struct color clr = {0, 0, 0, 0};
- struct rect rct;
- struct outp_styles s;
-
- rct.x1 = x;
- rct.y1 = y;
- rct.x2 = x + t->wrv[c / 2];
- rct.y2 = y + hrh;
-
- s.t = r > 0 ? t->rv[(c / 2) + (t->cf + 1) * (r / 2 - 1)] : 0;
- s.b = r < 2 * t->nr ? t->rv[(c / 2) + (t->cf + 1) * (r / 2)] : 0;
- s.l = c > 0 ? t->rh[(c / 2 - 1) + t->cf * (r / 2)] : 0;
- s.r = c < 2 * t->nc ? t->rh[(c / 2) + t->cf * (r / 2)] : 0;
-
- if (s.t | s.b | s.l | s.r)
- d->class->line_intersection (d, &rct, &clr, &s);
-
- x += t->wrv[c / 2];
- }
- }
- } else {
- int c;
-
- for (c = c1; c < c2; c++)
- {
- if (c & 1)
- {
- const int index = (c / 2) + (r / 2 * t->cf);
-
- if (!(t->ct[index] & TAB_JOIN))
- {
- struct outp_text text;
-
- text.options = ((t->ct[index] & OUTP_T_JUST_MASK)
- | OUTP_T_HORZ | OUTP_T_VERT);
- if ((t->ct[index] & TAB_EMPTY) == 0)
- {
- text.s = t->cc[index];
- assert (!ls_null_p (&text.s));
- text.h = t->w[c / 2];
- text.v = t->h[r / 2];
- text.x = x;
- text.y = y;
- d->class->text_draw (d, &text);
- }
- } else {
- struct tab_joined_cell *j =
- (struct tab_joined_cell *) ls_c_str (&t->cc[index]);
-
- if (j->hit != tab_hit)
- {
- j->hit = tab_hit;
-
- if (j->x1 == c / 2 && j->y1 == r / 2)
- {
- struct outp_text text;
-
- text.options = ((t->ct[index] & OUTP_T_JUST_MASK)
- | OUTP_T_HORZ | OUTP_T_VERT);
- text.s = j->contents;
- text.x = x;
- text.y = y;
-
- {
- int c;
-
- for (c = j->x1, text.h = -t->wrv[j->x2];
- c < j->x2 && c < c2 / 2; c++)
- text.h += t->w[c] + t->wrv[c + 1];
- }
-
- {
- int r;
-
- for (r = j->y1, text.v = -t->hrh[j->y2];
- r < j->y2 && r < r2 / 2; r++)
- text.v += t->h[r] + t->hrh[r + 1];
- }
- d->class->text_draw (d, &text);
- }
- }
- }
- x += t->w[c / 2];
- } else {
- int style = t->rv[(c / 2) + (r / 2 * (t->cf + 1))];
-
- if (style != TAL_0)
- {
- const struct color clr = {0, 0, 0, 0};
- struct rect rct;
-
- rct.x1 = x;
- rct.y1 = y;
- rct.x2 = x + t->wrv[c / 2];
- rct.y2 = y + t->h[r / 2];
- d->class->line_vert (d, &rct, &clr, style);
- }
- x += t->wrv[c / 2];
- }
- }
- }
-
- return x - x_origin;
-}
-
-/* Sets COMMAND_NAME as the name of the current command,
- for embedding in output. */
-void
-tab_set_command_name (const char *command_name_)
-{
- free (command_name);
- command_name = command_name_ ? xstrdup (command_name_) : NULL;
-}