Back to index

texmacs  1.0.7.15
Functions
make_pages.cpp File Reference
#include "Format/page_item.hpp"
#include "Format/stack_border.hpp"
#include "pager.hpp"
#include "Boxes/construct.hpp"

Go to the source code of this file.

Functions

box format_stack (path ip, array< box > bx, array< space > ht, SI height, bool may_stretch)
array< page_itemsub (array< page_item > l, path p, path q)
SI stretch_space (space spc, double stretch)
page_item access (array< page_item > l, path p)
skeleton break_pages (array< page_item > l, space ph, int qual, space fn_sep, space fnote_sep, space float_sep, font fn)
box page_box (path ip, box b, tree page, SI width, SI height, SI left, SI top, SI bot, box header, box footer, SI head_sep, SI foot_sep)

Function Documentation

page_item access ( array< page_item l,
path  p 
)

Definition at line 202 of file page_breaker.cpp.

                                    {
  page_item item= l[p->item];
  if (is_nil (p->next)) return item;
  else {
    lazy_vstream ins= (lazy_vstream) item->fl[p->next->item];
    return access (ins->l, p->next->next);
  }
}

Here is the call graph for this function:

skeleton break_pages ( array< page_item l,
space  ph,
int  qual,
space  fn_sep,
space  fnote_sep,
space  float_sep,
font  fn 
)

Definition at line 1501 of file page_breaker.cpp.

{
  page_breaker_rep* H=
    tm_new<page_breaker_rep> (l, ph, qual, fn_sep, fnote_sep, float_sep, fn);
  // cout << HRULE << LF;
  skeleton sk= H->make_skeleton ();
  tm_delete (H);
  return sk;
}

Here is the call graph for this function:

Here is the caller graph for this function:

box format_stack ( path  ip,
array< box bx,
array< space ht,
SI  height,
bool  may_stretch 
)

Definition at line 66 of file pager.cpp.

{
  int i, n= N(bx);
  array<SI> spc (n);
  space total (0);
  for (i=0; i<n-1; i++) total += space (bx[i]->h()) + ht[i];
  total += space (bx[i]->h());

  // stretching case
  if (may_stretch && (total->def < height) && (total->max > total->def)) {
    double f=
      ((double) (height - total->def)) /
      ((double) (total->max - total->def));
    for (i=0; i<n-1; i++)
      spc[i]= ht[i]->def+
       ((SI) (f*((double) ht[i]->max- ht[i]->def)));
  }

  // shrinking case
  else if ((total->def > height) && (total->def > total->min)) {
    double f=
      ((double) (total->def - height)) /
      ((double) (total->def - total->min));
    if (f>1.0) f=1.0;
    for (i=0; i<n-1; i++)
      spc[i]= ht[i]->def-
       ((SI) (f*((double) ht[i]->def- ht[i]->min)));
  }

  // normal case
  else for (i=0; i<n-1; i++) spc[i]= ht[i]->def;

  return stack_box (ip, bx, spc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

box page_box ( path  ip,
box  b,
tree  page,
SI  width,
SI  height,
SI  left,
SI  top,
SI  bot,
box  header,
box  footer,
SI  head_sep,
SI  foot_sep 
)

Definition at line 129 of file pager.cpp.

{
  SI h_y= -top- header->y1+ head_sep;
  SI f_y= -bot- footer->y2- foot_sep;

  array<box> bs     (1); bs     [0]= b;
  array<SI>  bs_x   (1); bs_x   [0]= left;
  array<SI>  bs_y   (1); bs_y   [0]= -top;
  array<box> decs   (2); decs   [0]= header; decs   [1]= footer;
  array<SI>  decs_x (2); decs_x [0]= left  ; decs_x [1]= left;
  array<SI>  decs_y (2); decs_y [0]= h_y   ; decs_y [1]= f_y;

  return page_box (ip, page, width, height,
                 bs, bs_x, bs_y,
                 decs, decs_x, decs_y);
}

Here is the call graph for this function:

SI stretch_space ( space  spc,
double  stretch 
)

Definition at line 906 of file page_breaker.cpp.

                                          {
  if (stretch > 0.0) return (SI) (spc->def + stretch * (spc->max - spc->def));
  if (stretch < 0.0) return (SI) (spc->def + stretch * (spc->def - spc->min));
  return spc->def;
}

Here is the caller graph for this function:

array<page_item> sub ( array< page_item l,
path  p,
path  q 
)

Definition at line 212 of file page_breaker.cpp.

                                         {
  if (is_atom (p) && is_atom (q)) {
    int i= p->item, j= q->item, k;
    array<page_item> r (j-i);
    for (k=i; k<j; k++) r[k-i]= l[k];
    return r;
  }
  else {
    if ((N(p) <= 2) || (N(q) <= 2)) {
      cerr << "\nThe paths were " << p << " and " << q << "\n";
      FAILED ("paths to short");
    }
    if ((p->item != q->item) || (p->next->item != q->next->item)) {
      cerr << "\nThe paths were " << p << " and " << q << "\n";
      FAILED ("paths don't match");
    }
    page_item item= l[p->item];
    lazy_vstream ins= (lazy_vstream) item->fl[p->next->item];
    return sub (ins->l, p->next->next, q->next->next);
  }
}

Here is the call graph for this function: