示例#1
0
box
wide_check_box (path ip, SI x1, SI x2, pencil pen) {
    SI width, height;
    get_wide_parameters (x1, x2, pen, width, height);
    array<box> bs (2);
    array<SI>  xs (2);
    array<SI>  ys (2);
    xs[0]= ys[0]= xs[1]= ys[1]= 0;
    bs[0]= line_box (decorate_middle (ip), 0, height, width/2, 0, pen);
    bs[1]= line_box (decorate_middle (ip), width/2, 0, width, height, pen);
    return composite_box (ip, bs, xs, ys);
}
示例#2
0
box
pager_rep::pages_format (array<page_item> l, SI ht, SI tcor, SI bcor) {
  // cout << "Formatting insertion of height " << ht << LF;
  ht -= (tcor + bcor);
  int i, n= N(l);
  array<box>   bs;
  array<space> spc;
  for (i=0; i<n; i++) {
    page_item item= l[i];
    if (item->type == PAGE_CONTROL_ITEM) {
      if (is_tuple (item->t, "env_page")) {
	if (((item->t[1] == PAGE_THIS_HEADER) ||
	     (item->t[1] == PAGE_THIS_FOOTER)) &&
	    (item->t[2] == "")) style (item->t[1]->label)= " ";
	else if (item->t[1] == PAGE_NR)
	  page_offset= as_int (item->t[2]->label)- N(pages)- 1;
	else style (item->t[1]->label)= copy (item->t[2]);
      }
    }
    else {
      bs  << item->b;
      spc << item->spc;
    }
  }
  if (N(bs) == 0) {
    box b= empty_box (decorate_middle (ip), 0, -ht, 0, 0);
    return vcorrect_box (b->ip, b, tcor, bcor);
  }
  else {
    box b= format_stack (ip, bs, spc, ht, true);
    return vcorrect_box (b->ip, b, tcor, bcor);
  }
}
示例#3
0
box
wide_vect_box (path ip, SI x1, SI x2, pencil pen) {
    SI penw= pen->get_width ();
    SI width, height, arrow= 2*penw, delta=penw/2;
    get_wide_parameters (x1, x2, pen, width, height);
    height= 10*penw;
    array<box> bs (3);
    array<SI>  xs (3);
    array<SI>  ys (3);
    xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0;
    bs[0]= line_box (decorate_middle (ip), 0, arrow, width, arrow, pen);
    bs[1]= line_box (decorate_middle (ip),
                     width- arrow- delta, 0, width, arrow, pen);
    bs[2]= line_box (decorate_middle (ip),
                     width+ delta- arrow, 2*arrow, width, arrow, pen);
    return composite_box (ip, bs, xs, ys);
}
示例#4
0
box
wide_tilda_box (path ip, SI x1, SI x2, pencil pen) {
    SI width, height, w, h, uw, hh;
    get_wide_parameters (x1, x2, pen, width, height);
    h = height/2;
    hh= (SI) (0.8660254 * ((double) h));
    w = width;
    uw= (SI) (((double) w) / 4.2679492);
    array<box> bs (3);
    array<SI>  xs (3);
    array<SI>  ys (3);
    xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0;
    bs[0]= arc_box (decorate_middle (ip),
                    0, -h, 2*uw, h, 60<<6, 180<<6, pen);
    bs[1]= line_box (decorate_middle (ip),
                     3*uw/2, hh, w-(3*uw/2), h-hh, pen);
    bs[2]= arc_box (decorate_middle (ip),
                    w- (2*uw), 0, w, 2*h, 240<<6, 360<<6, pen);
    return composite_box (ip, bs, xs, ys);
}
示例#5
0
box
wide_sqobr_box (path ip, SI x1, SI x2, pencil pen) {
    SI penw= pen->get_width ();
    pencil demipen= pencil (pen->get_color (), penw/2);
    path dip= decorate_middle (ip);
    SI width= max (x2-x1, 6*penw), height= 6*penw;
    array<box> bs (3);
    array<SI>  xs (3);
    array<SI>  ys (3);
    xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0;
    bs[0]= line_box (dip, 0, height, width, height, pen);
    bs[1]= line_box (dip, 0, height, 0, 0, demipen);
    bs[2]= line_box (dip, width, height, width, 0, demipen);
    return composite_box (ip, bs, xs, ys);
}
示例#6
0
box
pager_rep::pages_format (pagelet pg) {
  // cout << "Formatting pagelet " << (N(pages)+1)
  //      << " stretch " << pg->stretch
  //      << " height " << stretch_space (pg->ht, pg->stretch) << LF << INDENT;
  if (N (pg->ins) == 0) {
    if (N(pages) == 0) return dummy_box (decorate_middle (ip));
    return dummy_box (decorate_middle (pages [N(pages)-1] -> find_rip ()));
  }
  else if (N (pg->ins) == 1) {
    insertion ins= pg->ins[0];
    // cout << ins << " stretch " << ins->stretch
    //      << " height " << stretch_space (ins->ht, ins->stretch) << LF;
    //      << UNINDENT << "Formatted pagelet " << (N(pages)+1) << LF << LF;
    return pages_format (ins);
  }
  else {
    int i, n= N(pg->ins);
    array<box> bs (n);
    array<SI>  bx (n);
    array<SI>  by (n);
    SI y= 0, fnote_y= MAX_SI;
    for (i=0; i<n; i++) {
      insertion ins= pg->ins[i];
      // cout << ins << " at " << y << " stretch " << ins->stretch
      //      << " height " << stretch_space (ins->ht, ins->stretch) << LF;
      bs[i]= pages_format (ins);
      bx[i]= 0;
      by[i]= y;
      y -= bs[i]->h();
      if (i < n-1) {
	insertion next= pg->ins[i+1];
	if (ins->type != next->type) {
	  if (is_tuple (next->type, "footnote")) {
	    // cout << "sep " << stretch_space (fnote_sep, ins->stretch) << LF;
	    y -= stretch_space (fnote_sep, ins->stretch);
	    fnote_y= y;
	  }
	  else if (is_tuple (ins->type, "float")) {
	    if (!is_tuple (next->type, "float")) {
	      // cout << "sep " << stretch_space(float_sep, ins->stretch) << LF;
	      y -= stretch_space (float_sep, ins->stretch);
	    }
	  }
	  else if (is_tuple (ins->type, "multi-column") ||
		   is_tuple (next->type, "multi-column")) {
	    page_item item= access (l, path_dec (ins->end));
	    // cout << "sep " << stretch_space (item->spc, ins->stretch) << LF;
	    y -= stretch_space (item->spc, ins->stretch);
	  }
	}
	if (is_tuple (ins->type, "footnote"))
	  if (is_tuple (next->type, "footnote")) {
	    page_item item= access (l, path_dec (ins->end));
	    SI sep= stretch_space (item->spc + fn_sep, ins->stretch);
	    // cout << "sep " << sep << LF;
	    y -= sep;
	  }
	if (is_tuple (next->type, "float")) {
	  // cout << "sep " << stretch_space (float_sep, ins->stretch) << LF;
	  y -= stretch_space (float_sep, ins->stretch);
	}
      }
    }
    if (fnote_y != MAX_SI) {
      pencil pen= env->pen->set_width (env->fn->wline);
      bs << line_box (decorate(), 0, 0, fnote_bl, 0, pen);
      bx << 0;
      by << (fnote_y + env->fn->sep);
    }
    // cout << UNINDENT << "Formatted pagelet " << (N(pages)+1) << LF << LF;
    return scatter_box (ip, bs, bx, by);
  }
}