Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Protected Attributes | Friends
table_rep Class Reference

#include <table.hpp>

Inheritance diagram for table_rep:
Inheritance graph
[legend]
Collaboration diagram for table_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 table_rep (edit_env env, int status, int i0, int j0)
 ~table_rep ()
void display (bool flag=true)
void typeset (tree t, path ip)
void typeset_table (tree fm, tree t, path ip)
void typeset_row (int i, tree fm, tree t, path ip)
void format_table (tree fm)
void format_item (tree with)
void handle_decorations ()
void handle_span ()
void merge_borders ()
void compute_width (SI &tmw, SI &tlw, SI &trw)
void compute_widths (SI *Mw, SI *Lw, SI *Rw, bool large)
void compute_horizontal_parts (double *parts)
void position_columns ()
void compute_height (SI &mh, SI &bh, SI &th)
void compute_heights (SI *mh, SI *bh, SI *th)
void compute_vertical_parts (double *parts)
void position_rows ()
void finish_horizontal ()
void finish ()
array< boxvar_finish ()

Public Attributes

edit_env env
int status
int i0
int j0
path ip
box b
SI x1
SI y1
SI x2
SI y2
cell ** T
int nr_rows
int nr_cols
SImw
SIlw
SIrw
SI width
SI height
SI lsep
SI rsep
SI bsep
SI tsep
SI lborder
SI rborder
SI bborder
SI tborder
string hmode
string vmode
string halign
string valign
string hyphen
int row_origin
int col_origin
int ref_count

Protected Attributes

hashmap< string, treevar

Friends

class lazy_table_rep

Detailed Description

Definition at line 23 of file table.hpp.


Constructor & Destructor Documentation

table_rep::table_rep ( edit_env  env,
int  status,
int  i0,
int  j0 
)

Definition at line 23 of file table.cpp.

                                                                 :
  var (""), env (env2), status (status2), i0 (i0b), j0 (j0b),
  T (NULL), nr_rows (0), mw (NULL), lw (NULL), rw (NULL),
  width (0), height (0) {}

Definition at line 28 of file table.cpp.

                       {
  if (T != NULL) {
    int i;
    for (i=0; i<nr_rows; i++) tm_delete_array (T[i]);
    tm_delete_array (T);
  }
  if (mw != NULL) tm_delete_array (mw);
  if (lw != NULL) tm_delete_array (lw);
  if (rw != NULL) tm_delete_array (rw);
}

Here is the call graph for this function:


Member Function Documentation

void table_rep::compute_height ( SI mh,
SI bh,
SI th 
)

Definition at line 694 of file table.cpp.

                                                    {
  position_rows ();
  tmh= y2 - y1;
  tbh= -y1;
  tth= y2;
}

Here is the call graph for this function:

void table_rep::compute_heights ( SI mh,
SI bh,
SI th 
)

Definition at line 567 of file table.cpp.

                                                  {
  int i, j;
  for (i=0; i<nr_rows; i++)
    mh[i]= bh[i]= th[i]= 0;

  for (i=0; i<nr_rows; i++)
    for (j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if ((!is_nil (C)) && (C->row_span==1)) {
       SI cmh, cbh, cth;
       C->compute_height (cmh, cbh, cth);
       mh[i]= max (mh[i], cmh);
       bh[i]= max (bh[i], cbh);
       th[i]= max (th[i], cth);
       mh[i]= max (mh[i], bh[i] + th[i]);
      }
    }

  for (i=0; i<nr_rows; i++)
    for (j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if ((!is_nil (C)) && (C->row_span!=1)) {
       SI cmh, cbh, cth;
       C->compute_height (cmh, cbh, cth);
       SI tot= sum (mh+i, C->row_span);
       if (cmh > tot) mh[i] += cmh - tot;
      }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void table_rep::compute_horizontal_parts ( double *  parts)

Definition at line 467 of file table.cpp.

                                                 {
  int i, j;
  for (j=0; j<nr_cols; j++) part[j]= 0.0;
  for (j=0; j<nr_cols; j++)
    for (i=0; i<nr_rows; i++) {
      cell C= T[i][j];
      if (!is_nil (C))
       part[j]= max (part[j], C->hpart);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void table_rep::compute_vertical_parts ( double *  parts)

Definition at line 598 of file table.cpp.

                                               {
  int i, j;
  for (i=0; i<nr_rows; i++) part[i]= 0.0;
  for (i=0; i<nr_rows; i++)
    for (j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if (!is_nil (C))
       part[i]= max (part[i], C->vpart);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void table_rep::compute_width ( SI tmw,
SI tlw,
SI trw 
)

Definition at line 555 of file table.cpp.

                                                   {
  position_columns ();
  tmw= x2 - x1;
  tlw= -x1;
  trw= x2;
}

Here is the call graph for this function:

void table_rep::compute_widths ( SI Mw,
SI Lw,
SI Rw,
bool  large 
)

Definition at line 434 of file table.cpp.

                                                             {
  int i, j;
  for (j=0; j<nr_cols; j++)
    Mw[j]= Lw[j]= Rw[j]= 0;

  for (j=0; j<nr_cols; j++)
    for (i=0; i<nr_rows; i++) {
      cell C= T[i][j];
      if ((!is_nil (C)) && (C->col_span == 1)) {
       SI cmw, clw, crw;
       C->compute_width (cmw, clw, crw, large);
       //cout << i << ", " << j << ": "
       //<< (cmw>>8) << "; " << (clw>>8) << ", " << (crw>>8) << "\n";
       Mw[j]= max (Mw[j], cmw);
       Lw[j]= max (Lw[j], clw);
       Rw[j]= max (Rw[j], crw);
       Mw[j]= max (Mw[j], Lw[j] + Rw[j]);
      }
    }

  for (j=0; j<nr_cols; j++)
    for (i=0; i<nr_rows; i++) {
      cell C= T[i][j];
      if ((!is_nil (C)) && (C->col_span != 1)) {
       SI cmw, clw, crw;
       C->compute_width (cmw, clw, crw, large);
       SI tot= sum (Mw+j, C->col_span);
       if (cmw > tot) Mw[j] += cmw - tot;
      }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void table_rep::display ( bool  flag = true)

Definition at line 40 of file table.cpp.

                             {
  int i, j;
  if (flag) cout << "---------------------------------------------------------------------------\n";
  else cout << "{ ";
  for (i=0; i<nr_rows; i++) {
    cout << "[ ";
    for (j=0; j<nr_cols; j++)
      if (!is_nil (T[i][j])) {
       cell C= T[i][j];
       if (j != 0) cout << ", ";
       if (!is_nil (C->b)) cout << C->b;
       else if (!is_nil (C->T)) {
         cout << "subtable ";
         C->T->display (false);
       }
       else cout << "nil";
       if (!is_nil (C->D)) {
         cout << " & decoration ";
         C->D->display (false);
       }
      }
    cout << " ]";
    if (flag) cout << "\n";
    else if (i<nr_rows-1) cout << ", ";
  }
  if (flag) cout << "---------------------------------------------------------------------------\n";
  else cout << " }";
}

Here is the call graph for this function:

Definition at line 726 of file table.cpp.

                   {
  int i, j;
  array<box> bs;
  array<SI>  x;
  array<SI>  y;
  for (i=0; i<nr_rows; i++)
    for (j=0; j<nr_cols; j++)
      if (!is_nil (T[i][j])) {
       cell C = T[i][j];
       C->finish ();
       bs << C->b;
       x  << C->x1;
       y  << C->y1;
      }

  box   tb = composite_box (ip, bs, x, y, false);
  SI    x1= tb->x1;
  SI    y1= tb->y1;
  SI    x2= tb->x2;
  SI    y2= tb->y2;
  color fg= env->col;
  b= cell_box (tb->ip, tb, 0, 0, x1, y1, x2, y2,
              lborder, rborder, bborder, tborder, fg, "", 0);
  SI Lsep= lsep+lborder, Rsep= rsep+rborder;
  SI Bsep= bsep+bborder, Tsep= tsep+tborder;
  if ((Lsep != 0) || (Rsep != 0) || (Bsep != 0) || (Tsep != 0))
    b= cell_box (b->ip, b, Lsep, 0, x1, y1-Bsep, x2+Lsep+Rsep, y2+Tsep,
               0, 0, 0, 0, fg, "", 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 706 of file table.cpp.

                              {
  int i, j;
  SI xoff= x1 + lborder + lsep;
  for (j=0; j<nr_cols; j++) {
    for (i=0; i<nr_rows; i++) {
      cell C= T[i][j];
      if (!is_nil (C)) {
       if (!is_nil (C->T))
         C->T->finish_horizontal ();
       else if (C->hyphen != "n")
         C->finish_horizontal ();
       SI tot= sum (mw+j, C->col_span);
       C->position_horizontally (xoff, tot, lw[j], rw[j+C->col_span-1]);
      }
    }
    xoff += mw[j];
  }
}

Here is the call graph for this function:

void table_rep::format_item ( tree  with)

Definition at line 191 of file table.cpp.

                                 {
  if (is_func (with, TWITH, 2))
    var (as_string (with[0]))= with[1];
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 124 of file table.cpp.

                                {
  int i, l= N(fm);
  for (i=0; i<l; i++)
    format_item (fm[i]);

  if (var->contains (TABLE_WIDTH)) {
    width= env->as_length (env->exec (var[TABLE_WIDTH]));
    if (var->contains (TABLE_HMODE))
      hmode= as_string (env->exec (var[TABLE_HMODE]));
    else hmode= "exact";
  }
  else {
    width= 0;
    hmode= "auto";
  }
  if (var->contains (TABLE_HEIGHT)) {
    height= env->as_length (env->exec (var[TABLE_HEIGHT]));
    if (var->contains (TABLE_VMODE))
      vmode= as_string (env->exec (var[TABLE_VMODE]));
    else vmode= "exact";
  }
  else {
    height= 0;
    vmode = "auto";
  }
  if (var->contains (TABLE_LSEP))
    lsep= env->as_length (env->exec (var[TABLE_LSEP]));
  else lsep= 0;
  if (var->contains (TABLE_RSEP))
    rsep= env->as_length (env->exec (var[TABLE_RSEP]));
  else rsep= 0;
  if (var->contains (TABLE_BSEP))
    bsep= env->as_length (env->exec (var[TABLE_BSEP]));
  else bsep= 0;
  if (var->contains (TABLE_TSEP))
    tsep= env->as_length (env->exec (var[TABLE_TSEP]));
  else tsep= 0;
  if (var->contains (TABLE_LBORDER))
    lborder= env->as_length (env->exec (var[TABLE_LBORDER])) >> 1;
  else lborder= 0;
  if (var->contains (TABLE_RBORDER))
    rborder= env->as_length (env->exec (var[TABLE_RBORDER])) >> 1;
  else rborder= 0;
  if (var->contains (TABLE_BBORDER))
    bborder= env->as_length (env->exec (var[TABLE_BBORDER])) >> 1;
  else bborder= 0;
  if (var->contains (TABLE_TBORDER))
    tborder= env->as_length (env->exec (var[TABLE_TBORDER])) >> 1;
  else tborder= 0;
  if (var->contains (TABLE_HALIGN))
    halign= as_string (env->exec (var[TABLE_HALIGN]));
  else halign= "l";
  if (var->contains (TABLE_VALIGN))
    valign= as_string (env->exec (var[TABLE_VALIGN]));
  else valign= "f";
  if (var->contains (TABLE_HYPHEN))
    hyphen= as_string (env->exec (var[TABLE_HYPHEN]));
  else hyphen= "n";
  if (var->contains (TABLE_ROW_ORIGIN))
    row_origin= as_int (env->exec (var[TABLE_ROW_ORIGIN]));
  else row_origin= 1;
  if (var->contains (TABLE_COL_ORIGIN))
    col_origin= as_int (env->exec (var[TABLE_COL_ORIGIN]));
  else col_origin= 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 201 of file table.cpp.

                               {
  bool flag= true;
  int i, j, ii, jj, di, dj;
  array<int> ex_i1 (nr_rows), ex_i2 (nr_rows), off_i (nr_rows);
  array<int> ex_j1 (nr_cols), ex_j2 (nr_cols), off_j (nr_cols);

  /*** determine amount of decoration there is for each row and column ***/
  for (i=0; i<nr_rows; i++)
    ex_i1[i]= ex_i2[i]= 0;
  for (j=0; j<nr_cols; j++)
    ex_j1[j]= ex_j2[j]= 0;
  for (i=0; i<nr_rows; i++)
    for (j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if ((!is_nil (C)) && (!is_nil (C->T))) C->T->handle_decorations ();
      if ((!is_nil (C)) && (!is_nil (C->D))) {
       C->D->handle_decorations ();
       if (C->D->status == 1) {
         ii= i+ C->row_span- 1;
         jj= j+ C->col_span- 1;
         ex_i1[i ]= max (ex_i1[i ], C->D->i0);
         ex_j1[j ]= max (ex_j1[j ], C->D->j0);
         ex_i2[ii]= max (ex_i2[ii], C->D->nr_rows- 1- C->D->i0);
         ex_j2[jj]= max (ex_j2[jj], C->D->nr_cols- 1- C->D->j0);
         flag= false;
       }
      }
    }
  if (flag) return;
  for (i=0, ii=0; i<nr_rows; ii+=ex_i1[i]+ex_i2[i]+1, i++)
    off_i[i]= ii;
  for (j=0, jj=0; j<nr_cols; jj+=ex_j1[j]+ex_j2[j]+1, j++)
    off_j[j]= jj;

  /*** compute decorated table ***/
  cell** U;
  int new_rows= nr_rows, new_cols= nr_cols;
  for (i=0; i<nr_rows; i++) new_rows += ex_i1[i] + ex_i2[i];
  for (j=0; j<nr_cols; j++) new_cols += ex_j1[j] + ex_j2[j];
  U= tm_new_array<cell*> (new_rows);
  for (i=0; i<new_rows; i++)
    U[i]= tm_new_array<cell> (new_cols);

  for (i=0; i<nr_rows; i++)
    for (j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if (!is_nil (C)) {
       if ((!is_nil (C->D)) && (C->D->status==1)) {
         for (di=0; di<C->D->nr_rows; di++)
           for (dj=0; dj<C->D->nr_cols; dj++) {
             ii= di+ off_i[i]+ ex_i1[i]- C->D->i0;
             jj= dj+ off_j[j]+ ex_j1[j]- C->D->j0;
             U[ii][jj]= C->D->T[di][dj];
           }
         C->D= table ();
       }
       ii= off_i[i]+ ex_i1[i];
       jj= off_j[j]+ ex_j1[j];
       U[ii][jj]= C;
       ii= i+ C->row_span- 1;
       jj= j+ C->col_span- 1;
       C->row_span= off_i[ii]+ ex_i1[ii]+ 1- off_i[i]- ex_i1[i];
       C->col_span= off_j[jj]+ ex_j1[jj]+ 1- off_j[j]- ex_j1[j];
      }
    }

  /*** replace old table by new one ***/
  for (i=0; i<nr_rows; i++) tm_delete_array (T[i]);
  tm_delete_array (T);
  T      = U;
  nr_rows= new_rows;
  nr_cols= new_cols;
  i0     = off_i[i0] + ex_i1[i0];
  j0     = off_j[j0] + ex_j1[j0];
}

Here is the call graph for this function:

Definition at line 278 of file table.cpp.

                        {
  int i, j, ii, jj;
  for (i=0; i<nr_rows; i++)
    for (j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if (!is_nil (C)) {
       for (ii=0; ii<C->row_span; ii++)
         for (jj=0; jj<C->col_span; jj++)
           if ((ii != 0) || (jj != 0))
             T[i+ii][j+jj]= cell ();
       if (!is_nil (C->T)) C->T->handle_span ();
      }
    }
}

Here is the call graph for this function:

Definition at line 298 of file table.cpp.

                          {
  int hh= nr_cols + 1, vv= nr_rows + 1, nn= hh * vv;
  array<SI> horb (nn), verb (nn);
  for (int i=0; i<nn; i++) horb[i]= verb[i]= 0;

  for (int i=0; i<nr_rows; i++)
    for (int j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if (!is_nil (C)) {
        for (int di=0; di < C->row_span; di++) {
          int ii= i+di, jj= j, kk= ii*hh + jj;
          horb[kk]= max (horb[kk], C->lborder);
          jj= j + C->col_span; kk= ii*hh + jj;
          horb[kk]= max (horb[kk], C->rborder);
        }
        for (int dj=0; dj < C->col_span; dj++) {
          int ii= i, jj= j+dj, kk= ii*hh + jj;
          verb[kk]= max (verb[kk], C->tborder);
          ii= i + C->row_span; kk= ii*hh + jj;
          verb[kk]= max (verb[kk], C->bborder);
        }
      }
    }

  for (int i=0; i<nr_rows; i++)
    for (int j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if (!is_nil (C)) {
        SI lb= 0, rb= 0, bb= 0, tb= 0;
        for (int di=0; di < C->row_span; di++) {
          int ii= i+di, jj= j, kk= ii*hh + jj;
          lb= max (horb[kk], lb);
          jj= j + C->col_span; kk= ii*hh + jj;
          rb= max (horb[kk], rb);
        }
        for (int dj=0; dj < C->col_span; dj++) {
          int ii= i, jj= j+dj, kk= ii*hh + jj;
          tb= max (verb[kk], tb);
          ii= i + C->row_span; kk= ii*hh + jj;
          bb= max (verb[kk], bb);
        }
        C->lborder= lb; C->rborder= rb;
        C->bborder= bb; C->tborder= tb;
      }
    }
}

Here is the call graph for this function:

Definition at line 479 of file table.cpp.

                             {
  //cout << "-------------------------------------\n";
  //cout << "Position columns " << (width >> 8) << "\n";
  compute_widths (mw, lw, rw, hmode == "auto");
  //for (int i=0; i<nr_cols; i++)
  //cout << "Column " << i << ": " << (mw[i]>>8) << "; "
  //<< (lw[i]>>8) << ", " << (rw[i]>>8) << "\n";
  if (hmode != "auto") {
    SI min_width= sum (mw, nr_cols);
    SI hextra= width - min_width;
    //cout << "Extra horizontal " << (hextra >> 8) << "\n";
    if (hextra > 0) {
      STACK_NEW_ARRAY (part, double, nr_cols);
      STACK_NEW_ARRAY (Mw, SI, nr_cols);
      STACK_NEW_ARRAY (Lw, SI, nr_cols);
      STACK_NEW_ARRAY (Rw, SI, nr_cols);
      compute_horizontal_parts (part);
      compute_widths (Mw, Lw, Rw, true);
      SI max_width= sum (Mw, nr_cols);
      SI computed_width= width;
      if (hmode == "min") computed_width= min (width, max_width);
      if (hmode == "max") computed_width= max (width, min_width);
      hextra= max (computed_width - min_width, 0);
      //for (int i=0; i<nr_cols; i++)
      //cout << "Column " << i << ": " << (Mw[i]>>8) << "; "
      //<< (Lw[i]>>8) << ", " << (Rw[i]>>8) << "\n";
      blow_up (mw, lw, rw, Mw, Lw, Rw, hextra, part, nr_cols);
      //for (int i=0; i<nr_cols; i++)
      //cout << "Column " << i << ": " << (mw[i]>>8) << "; "
      //<< (lw[i]>>8) << ", " << (rw[i]>>8) << "\n";
      STACK_DELETE_ARRAY (part);
      STACK_DELETE_ARRAY (Mw);
      STACK_DELETE_ARRAY (Lw);
      STACK_DELETE_ARRAY (Rw);
    }
  }

  int i, j;
  for (j=0; j<nr_cols; j++)
    for (i=0; i<nr_rows; i++) {
      cell C= T[i][j];
      if (!is_nil (C)) {
       if (!is_nil (C->T)) {
         C->T->width= mw[j]- C->lborder- C->rborder;
         C->T->hmode= "exact";
         C->T->position_columns ();
       }
       else if (C->hyphen != "n")
         C->width= mw[j];
      }
    }

  SI xoff;
  if (halign == "l") xoff= 0;
  else if (halign == "c") xoff= -sum (mw, nr_cols) >> 1;
  else if (halign == "r") xoff= -sum (mw, nr_cols);
  else if (halign == "L") xoff= -lw[0];
  else if (halign == "C")
    xoff= -(sum (mw, nr_cols>>1) + sum (mw, (nr_cols-1)>>1)+
           lw[nr_cols>>1] + lw[(nr_cols-1)>>1]) >> 1;
  else if (halign == "R") xoff= -sum (mw, nr_cols - 1) - lw[nr_cols - 1];
  else if (halign == "O") {
    int orig= col_origin;
    if (orig < 0) orig += nr_cols;
    else orig--;
    orig= max (min (orig, nr_cols - 1), 0);
    xoff= -sum (mw, orig) - lw[orig];
  }
  else xoff= -sum (mw, j0) - lw[j0];

  x1= xoff- lborder- lsep;
  for (j=0; j<nr_cols; j++) xoff += mw[j];
  x2= xoff+ rborder+ rsep;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 610 of file table.cpp.

                          {
  STACK_NEW_ARRAY (mh, SI, nr_rows);
  STACK_NEW_ARRAY (bh, SI, nr_rows);
  STACK_NEW_ARRAY (th, SI, nr_rows);

  compute_heights (mh, bh, th);
  if (vmode != "auto") {
    SI min_height= sum (mh, nr_rows);
    SI vextra= height - min_height;
    if (vextra > 0) {
      int i;
      STACK_NEW_ARRAY (part, double, nr_rows);
      STACK_NEW_ARRAY (Mh, SI, nr_rows);
      STACK_NEW_ARRAY (Bh, SI, nr_rows);
      STACK_NEW_ARRAY (Th, SI, nr_rows);
      compute_vertical_parts (part);
      for (i=0; i<nr_rows; i++) {
       Mh[i]= mh[i];
       Bh[i]= bh[i];
       Th[i]= th[i]; 
      }
      SI computed_height= height;
      if (vmode == "min") computed_height= min (height, min_height);
      if (vmode == "max") computed_height= max (height, min_height);
      vextra= max (computed_height - min_height, 0);
      blow_up (mh, bh, th, Mh, Bh, Th, vextra, part, nr_rows);
      STACK_DELETE_ARRAY (part);
      STACK_DELETE_ARRAY (Mh);
      STACK_DELETE_ARRAY (Bh);
      STACK_DELETE_ARRAY (Th);
    }
  }

  int i, j;
  for (i=0; i<nr_rows; i++) {
    for (j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if ((!is_nil (C)) && (!is_nil (C->T))) {
       C->T->height= mh[j]- C->bborder- C->tborder;
       C->T->vmode = "exact";
       C->T->position_rows ();
      }
    }
  }

  SI yoff;
  if (valign == "t") yoff= 0;
  else if (valign == "c") yoff= sum (mh, nr_rows) >> 1;
  else if (valign == "f") yoff= (sum (mh, nr_rows) >> 1) + env->fn->yfrac;
  else if (valign == "b") yoff= sum (mh, nr_rows);
  else if (valign == "T") yoff= th[0];
  else if (valign == "C")
    yoff= (sum (mh, nr_rows>>1) + sum (mh, (nr_rows-1)>>1) +
          th[nr_rows>>1] + th[(nr_rows-1)>>1]) >> 1;
  else if (valign == "B") yoff= sum (mh, nr_rows - 1) + th[nr_rows - 1];
  else if (valign == "O") {
    int orig= row_origin;
    if (orig < 0) orig += nr_rows;
    else orig--;
    orig= max (min (orig, nr_rows - 1), 0);
    yoff= sum (mh, orig) + th[orig];
  }
  else yoff= sum (mh, i0) + th[i0];

  y2= yoff+ tborder+ tsep;
  for (i=0; i<nr_rows; i++) {
    for (j=0; j<nr_cols; j++) {
      cell C= T[i][j];
      if (!is_nil (C)) {
       SI tot= sum (mh+i, C->row_span);
       C->position_vertically (yoff, tot, tot+ bh[i]- mh[i], th[i]);
       C->shift= -yoff+ tot- bh[i];
      }
    }
    yoff -= mh[i];
  }
  y1= yoff- bborder+ bsep;

  STACK_DELETE_ARRAY (mh);
  STACK_DELETE_ARRAY (bh);
  STACK_DELETE_ARRAY (th);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void table_rep::typeset ( tree  t,
path  ip 
)

Definition at line 70 of file table.cpp.

                                   {
  ip= iq;
  tree old_format= env->local_begin (CELL_FORMAT, tree (TFORMAT));
  tree new_format= old_format;
  if (!is_func (new_format, TFORMAT)) new_format= tree (TFORMAT);
  while (is_func (t, TFORMAT)) {
    new_format= new_format * t (0, N(t)-1);
    iq        = descend (iq, N(t)-1);
    t         = t[N(t)-1];
  }
  format_table (new_format);
  typeset_table (new_format, t, iq);
  env->local_end (CELL_FORMAT, old_format);
}

Here is the call graph for this function:

void table_rep::typeset_row ( int  i,
tree  fm,
tree  t,
path  ip 
)

Definition at line 102 of file table.cpp.

                                                       {
  int j;
  nr_cols= N(t);
  T[i]= tm_new_array<cell> (nr_cols);
  STACK_NEW_ARRAY (subformat, tree, nr_cols);
  extract_format (fm, subformat, nr_cols);
  for (j=0; j<nr_cols; j++) {
    cell& C= T[i][j];
    C= cell (env);
    C->typeset (subformat[j], t[j], descend (ip, j));
    C->row_span= min (C->row_span, nr_rows- i);
    C->col_span= min (C->col_span, nr_cols- j);
    if (hyphen == "y") C->row_span= 1;
  }
  STACK_DELETE_ARRAY (subformat);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void table_rep::typeset_table ( tree  fm,
tree  t,
path  ip 
)

Definition at line 86 of file table.cpp.

                                                  {
  int i;
  nr_rows= N(t);
  nr_cols= 0;
  T= tm_new_array<cell*> (nr_rows);
  STACK_NEW_ARRAY (subformat, tree, nr_rows);
  extract_format (fm, subformat, nr_rows);
  for (i=0; i<nr_rows; i++)
    typeset_row (i, subformat[i], t[i], descend (ip, i));
  STACK_DELETE_ARRAY (subformat);
  mw= tm_new_array<SI> (nr_cols);
  lw= tm_new_array<SI> (nr_cols);
  rw= tm_new_array<SI> (nr_cols);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 757 of file table.cpp.

                       {
  if (hyphen == "n") {
    array<box> bs (1);
    finish ();
    bs[0]= b;
    return bs;
  }

  int i, j;
  array<box> stack;
  for (i=0; i<nr_rows; i++) {
    array<box> bs;
    array<SI>  x;
    array<SI>  y;
    for (j=0; j<nr_cols; j++)
      if (!is_nil (T[i][j])) {
       cell C = T[i][j];
       C->finish ();
       bs << C->b;
       x  << C->x1;
       y  << (C->y1 + C->shift);
      }
    if (N(bs)==0) continue;

    box   tb= composite_box (ip, bs, x, y, false);
    SI    BB= (i==(nr_rows-1)? bborder: 0);
    SI    TB= (i==0? tborder: 0);
    SI    BS= (i==(nr_rows-1)? bsep: 0);
    SI    TS= (i==0? tsep: 0);
    SI    x1= tb->x1 - lborder;
    SI    x2= tb->x2 + rborder;
    SI    y1= tb->y1 - BB;
    SI    y2= tb->y2 + TB;
    color fg= env->col;
    b= cell_box (tb->ip, tb, 0, 0, x1, y1, x2, y2,
               lborder, rborder, BB, TB, fg, "", 0);
    SI Lsep= lsep+lborder, Rsep= rsep+rborder;
    SI Bsep= BS+BB, Tsep= TS+TB;
    if ((Lsep != 0) || (Rsep != 0) || (Bsep != 0) || (Tsep != 0))
      b= cell_box (b->ip, b, Lsep, 0, x1, y1-Bsep, x2+Lsep+Rsep, y2+Tsep,
                 0, 0, 0, 0, fg, "", 0);
    stack << b;
  }
  return stack;
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class lazy_table_rep [friend]

Definition at line 88 of file table.hpp.


Member Data Documentation

Definition at line 33 of file table.hpp.

Definition at line 54 of file table.hpp.

Definition at line 50 of file table.hpp.

Definition at line 62 of file table.hpp.

Definition at line 28 of file table.hpp.

Definition at line 58 of file table.hpp.

Definition at line 47 of file table.hpp.

Definition at line 56 of file table.hpp.

Definition at line 60 of file table.hpp.

Definition at line 30 of file table.hpp.

Definition at line 32 of file table.hpp.

Definition at line 31 of file table.hpp.

Definition at line 52 of file table.hpp.

Definition at line 48 of file table.hpp.

Definition at line 43 of file table.hpp.

Definition at line 42 of file table.hpp.

Definition at line 41 of file table.hpp.

Definition at line 40 of file table.hpp.

Definition at line 53 of file table.hpp.

int concrete_struct::ref_count [inherited]

Definition at line 135 of file basic.hpp.

Definition at line 61 of file table.hpp.

Definition at line 49 of file table.hpp.

Definition at line 44 of file table.hpp.

Definition at line 29 of file table.hpp.

Definition at line 39 of file table.hpp.

Definition at line 55 of file table.hpp.

Definition at line 51 of file table.hpp.

Definition at line 59 of file table.hpp.

Definition at line 25 of file table.hpp.

Definition at line 57 of file table.hpp.

Definition at line 46 of file table.hpp.

Definition at line 34 of file table.hpp.

Definition at line 36 of file table.hpp.

Definition at line 35 of file table.hpp.

Definition at line 37 of file table.hpp.


The documentation for this class was generated from the following files: