Back to index

texmacs  1.0.7.15
Typedefs | Functions
typesetter.hpp File Reference
#include "boxes.hpp"
#include "env.hpp"
#include "array.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef typesetter_reptypesetter

Functions

typesetter new_typesetter (edit_env &env, tree et, path ip)
void delete_typesetter (typesetter ttt)
void notify_assign (typesetter ttt, path p, tree u)
void notify_insert (typesetter ttt, path p, tree u)
void notify_remove (typesetter ttt, path p, int nr)
void notify_split (typesetter ttt, path p)
void notify_join (typesetter ttt, path p)
void notify_assign_node (typesetter ttt, path p, tree_label op)
void notify_insert_node (typesetter ttt, path p, tree t)
void notify_remove_node (typesetter ttt, path p)
void exec_until (typesetter ttt, path p)
box typeset (typesetter ttt, SI &x1, SI &y1, SI &x2, SI &y2)
box typeset_as_concat (edit_env env, tree t, path ip)
box typeset_as_box (edit_env env, tree t, path ip)
box typeset_as_atomic (edit_env env, tree t, path ip)
box typeset_as_stack (edit_env env, tree t, path ip)
box typeset_as_table (edit_env env, tree t, path ip)
array< boxtypeset_as_var_table (edit_env env, tree t, path ip)
box typeset_as_paragraph (edit_env e, tree t, path ip)
box typeset_as_document (edit_env e, tree t, path ip)
tree box_info (edit_env env, tree t, string what)

Typedef Documentation

Definition at line 19 of file typesetter.hpp.


Function Documentation

tree box_info ( edit_env  env,
tree  t,
string  what 
)

Definition at line 874 of file concater.cpp.

                                             {
  box b= typeset_as_atomic (env, attach_here (t, decorate ()));

  tree r= tuple();
  for (int i=0; i<N(what); i++) {
    switch (what[i]) {
    case 'l': r << as_string (b->x1); break;
    case 'b': r << as_string (b->y1); break;
    case 'r': r << as_string (b->x2); break;
    case 't': r << as_string (b->y2); break;
    case 'w': r << as_string (b->x2 - b->x1); break;
    case 'h': r << as_string (b->y2 - b->y1); break;
    case 'L': r << as_string (b->x3); break;
    case 'B': r << as_string (b->y3); break;
    case 'R': r << as_string (b->x4); break;
    case 'T': r << as_string (b->y4); break;
    case 'W': r << as_string (b->x4 - b->x3); break;
    case 'H': r << as_string (b->y4 - b->y3); break;
    case '.':
      if (N(r)==1) return as_string (r[0]) * "tmpt";
      else if (N(r)==0) return tree (ERROR, "No query for box-info");
      else return tree (ERROR, "More than one query for box-info");
    }
  }
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 33 of file typesetter.cpp.

                                   {
  tm_delete (ttt);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void exec_until ( typesetter  ttt,
path  p 
)

Definition at line 256 of file typesetter.cpp.

                                    {
  ttt->br->exec_until (p);
}

Here is the caller graph for this function:

typesetter new_typesetter ( edit_env env,
tree  et,
path  ip 
)

Definition at line 28 of file typesetter.cpp.

                                                 {
  return tm_new<typesetter_rep> (env, et, ip);
}

Here is the caller graph for this function:

void notify_assign ( typesetter  ttt,
path  p,
tree  u 
)

Definition at line 190 of file typesetter.cpp.

                                               {
  // cout << "Assign " << p << ", " << u << "\n";
  if (is_nil (p)) ttt->br= make_bridge (ttt, u, ttt->br->ip);
  else ttt->br->notify_assign (p, u);
}

Here is the call graph for this function:

void notify_assign_node ( typesetter  ttt,
path  p,
tree_label  op 
)

Definition at line 221 of file typesetter.cpp.

                                                           {
  // cout << "Assign node " << p << ", " << as_string (op) << "\n";
  tree t= subtree (ttt->br->st, p);
  int i, n= N(t);
  tree r (op, n);
  for (i=0; i<n; i++) r[i]= t[i];
  if (is_nil (p)) ttt->br= make_bridge (ttt, r, ttt->br->ip);
  else ttt->br->notify_assign (p, r);
}

Here is the call graph for this function:

void notify_insert ( typesetter  ttt,
path  p,
tree  u 
)

Definition at line 197 of file typesetter.cpp.

                                               {
  // cout << "Insert " << p << ", " << u << "\n";
  ttt->br->notify_insert (p, u);
}
void notify_insert_node ( typesetter  ttt,
path  p,
tree  t 
)

Definition at line 232 of file typesetter.cpp.

                                                    {
  // cout << "Insert node " << p << ", " << t << "\n";
  int i, pos= last_item (p), n= N(t);
  tree r (t, n+1);
  for (i=0; i<pos; i++) r[i]= t[i];
  r[pos]= subtree (ttt->br->st, path_up (p));
  for (i=pos; i<n; i++) r[i+1]= t[i];
  if (is_nil (path_up (p))) ttt->br= make_bridge (ttt, r, ttt->br->ip);
  else ttt->br->notify_assign (path_up (p), r);
}

Here is the call graph for this function:

void notify_join ( typesetter  ttt,
path  p 
)

Definition at line 215 of file typesetter.cpp.

                                     {
  // cout << "Join " << p << "\n";
  ttt->br->notify_join (p);
}
void notify_remove ( typesetter  ttt,
path  p,
int  nr 
)

Definition at line 203 of file typesetter.cpp.

                                               {
  // cout << "Remove " << p << ", " << nr << "\n";
  ttt->br->notify_remove (p, nr);
}
void notify_remove_node ( typesetter  ttt,
path  p 
)

Definition at line 244 of file typesetter.cpp.

                                            {
  // cout << "Remove node " << p << "\n";
  tree t= subtree (ttt->br->st, p);
  if (is_nil (path_up (p))) ttt->br= make_bridge (ttt, t, ttt->br->ip);
  else ttt->br->notify_assign (path_up (p), t);
}

Here is the call graph for this function:

void notify_split ( typesetter  ttt,
path  p 
)

Definition at line 209 of file typesetter.cpp.

                                      {
  // cout << "Split " << p << "\n";
  ttt->br->notify_split (p);
}
box typeset ( typesetter  ttt,
SI x1,
SI y1,
SI x2,
SI y2 
)

Definition at line 261 of file typesetter.cpp.

                                                         {
  return ttt->typeset (x1, y1, x2, y2);
}

Here is the call graph for this function:

box typeset_as_atomic ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 808 of file concater.cpp.

                                                  {
  if (is_func (t, WITH)) {
    int i, n= N(t), k= (n-1)>>1; // is k=0 allowed ?
    if ((n&1) != 1) return empty_box (ip);

    STACK_NEW_ARRAY(vars,string,k);
    STACK_NEW_ARRAY(oldv,tree,k);
    STACK_NEW_ARRAY(newv,tree,k);
    for (i=0; i<k; i++) {
      tree var_t= env->exec (t[i<<1]);
      if (is_atomic (var_t)) {
       string var= var_t->label;
       vars[i]= var;
       oldv[i]= env->read (var);
       newv[i]= env->exec (t[(i<<1)+1]);
      }
      else {
       STACK_DELETE_ARRAY(vars);
       STACK_DELETE_ARRAY(oldv);
       STACK_DELETE_ARRAY(newv);
       return empty_box (ip);
      }
    }

    // for (i=0; i<k; i++) env->monitored_write_update (vars[i], newv[i]);
    for (i=0; i<k; i++) env->write_update (vars[i], newv[i]);
    box b= typeset_as_atomic (env, t[n-1], descend (ip, n-1));
    for (i=k-1; i>=0; i--) env->write_update (vars[i], oldv[i]);
    STACK_DELETE_ARRAY(vars);
    STACK_DELETE_ARRAY(oldv);
    STACK_DELETE_ARRAY(newv);
    return b;
  }
  else if (is_func (t, LOCUS) && N(t) != 0) {
    string ref;
    string anchor;
    int last= N(t)-1;
    list<string> ids;
    string col;
    (void) build_locus (env, t, ids, col, ref, anchor);
    tree old= env->local_begin (COLOR, col);
    box b= typeset_as_atomic (env, t[last], descend (ip, last));
    env->local_end (COLOR, old);
    return b;
  }
  else {
    array<line_item> a= typeset_concat (env, t, ip);
    if (N(a) == 1) return a[0]->b;

    int i, n=N(a);
    if (n == 0) return empty_box (ip); // FIXME: n=0 should never happen
    array<box> items (n);
    array<SI>  spc (n);
    if (n>0) {
      spc[0]=0;
      for (i=0; i<n-1; i++) {
       items[i]  = a[i]->b;
       spc  [i+1]= a[i]->spc->def;
      }
      items[i]= a[i]->b;
    }
    return concat_box (ip, items, spc);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

box typeset_as_box ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 786 of file concater.cpp.

                                               {
  box b= typeset_as_concat (env, t, ip);

  SI ox= 0;
  int i, n=N(b);
  for (i=0; i<n; i++)
    if (b[i]->w() != 0)
      ox= b[i]->x1;

  array<box> bs (1);
  array<SI>  xs (1);
  array<SI>  ys (1);
  bs[0]= b;
  xs[0]= ox;
  ys[0]= 0;
  return composite_box (ip, bs, xs, ys);
}

Here is the call graph for this function:

Here is the caller graph for this function:

box typeset_as_concat ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 761 of file concater.cpp.

                                                  {
  concater ccc= tm_new<concater_rep> (env, true);
  ccc->typeset (t, ip);
  ccc->finish ();
  array<line_item> a= ccc->a;

  int i, n=N(a);
  if (n == 0) return empty_box (ip); // FIXME: n=0 should never happen
  array<box> items (n);
  array<SI>  spc (n);
  if (n>0) {
    spc[0]=0;
    for (i=0; i<n-1; i++) {
      items[i]  = a[i]->b;
      spc  [i+1]= a[i]->spc->def;
    }
    items[i]= a[i]->b;
  }
  box b= concat_box (ip, items, spc);

  tm_delete (ccc);
  return b;
}

Here is the call graph for this function:

Here is the caller graph for this function:

box typeset_as_document ( edit_env  e,
tree  t,
path  ip 
)

Definition at line 266 of file typesetter.cpp.

                                                    {
  env->style_init_env ();
  env->update ();
  typesetter ttt= new_typesetter (env, t, ip);
  box b= ttt->typeset ();
  delete_typesetter (ttt);
  return b;
}

Here is the call graph for this function:

Here is the caller graph for this function:

box typeset_as_paragraph ( edit_env  e,
tree  t,
path  ip 
)

Definition at line 73 of file lazy_vstream.cpp.

                                                     {
  // cout << "Typeset paragraph " << t << "\n";
  lazy_paragraph par (env, ip);
  par->a= typeset_concat_or_table (env, t, ip);
  par->format_paragraph ();
  array<page_item> l= par->sss->l;
  return format_vstream_as_box (l, ip, 1, -env->fn->y1, env->fn->y2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

box typeset_as_stack ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 344 of file stacker.cpp.

                                                 {
  // cout << "Typeset as stack " << t << "\n";
  int i, n= N(t);
  stacker sss= tm_new<stacker_rep> ();
  SI sep       = env->get_length (PAR_SEP);
  SI hor_sep   = env->get_length (PAR_HOR_SEP);
  SI ver_sep   = env->get_length (PAR_VER_SEP);
  SI height    = env->as_length (string ("1fn"))+ sep;
  SI bot       = 0;
  SI top       = env->fn->yx;
  sss->set_env_vars (height, sep, hor_sep, ver_sep, bot, top);
  for (i=0; i<n; i++)
    sss->print (typeset_as_concat (env, t[i], descend (ip, i)));

  n= N(sss->l);
  array<box> lines_bx (n);
  array<SI>  lines_ht (n);
  for (i=0; i<n; i++) {
    page_item item= copy (sss->l[i]);
    lines_bx[i]= item->b;
    lines_ht[i]= item->spc->def;
  }

  tm_delete (sss);
  box b= stack_box (ip, lines_bx, lines_ht);
  SI dy= n==0? 0: b[0]->y2;
  return move_box (ip, stack_box (ip, lines_bx, lines_ht), 0, dy);
}

Here is the call graph for this function:

Here is the caller graph for this function:

box typeset_as_table ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 879 of file table.cpp.

                                                 {
  table T (env);
  T->typeset (t, ip);
  T->handle_decorations ();
  T->handle_span ();
  T->merge_borders ();
  T->position_columns ();
  T->finish_horizontal ();
  T->position_rows ();
  T->finish ();
  return T->b;
}

Here is the caller graph for this function:

array<box> typeset_as_var_table ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 893 of file table.cpp.

                                                     {
  table T (env);
  T->typeset (t, ip);
  T->handle_decorations ();
  T->handle_span ();
  T->merge_borders ();
  T->position_columns ();
  T->finish_horizontal ();
  T->position_rows ();
  return T->var_finish ();
}

Here is the caller graph for this function: