Back to index

texmacs  1.0.7.15
Classes | Functions | Variables
boxes.cpp File Reference
#include "boxes.hpp"
#include "formatter.hpp"
#include "Graphics/point.hpp"
#include "printer.hpp"
#include "file.hpp"
#include "merge_sort.hpp"

Go to the source code of this file.

Classes

struct  less_eq_gr_selection

Functions

bool outside (SI x, SI delta, SI x1, SI x2)
SI get_delta (SI x, SI x1, SI x2)
path find_innermost_scroll (box b, path p)
path find_scrolled_box_path (box b, path sp, SI x, SI y, SI delta)
path find_scrolled_tree_path (box b, path sp, SI x, SI y, SI delta)
void find_canvas_info (box b, path sp, SI &x, SI &y, SI &sx, SI &sy, rectangle &outer, rectangle &inner)
void clear_pattern_rectangles (renderer ren, rectangles l)
cursor copy (cursor cu)
bool operator== (cursor cu1, cursor cu2)
bool operator!= (cursor cu1, cursor cu2)
tm_ostreamoperator<< (tm_ostream &out, cursor cu)
bool operator== (selection sel1, selection sel2)
bool operator!= (selection sel1, selection sel2)
tm_ostreamoperator<< (tm_ostream &out, selection sel)
tm_ostreamoperator<< (tm_ostream &out, gr_selection sel)
void sort (gr_selections &sels)
tree as_tree (gr_selections sels)
tm_ostreamoperator<< (tm_ostream &out, box b)
path descend_decode (path ip, int side)
tree attach_dip (tree ref, path dip)
void make_eps (url name, box b, int dpi)

Variables

int nr_painted = 0

Function Documentation

Definition at line 654 of file boxes.cpp.

                             {
  sort (sels);
  int i, n= N(sels);
  array<array<path> > res (n);
  for (i=0; i<n; i++)
    res[i]= sels[i]->cp;
  return (tree) res;
}

Here is the call graph for this function:

tree attach_dip ( tree  ref,
path  dip 
)

Definition at line 805 of file boxes.cpp.

                                {
  path old_ip= obtain_ip (ref);
  if (old_ip != path (DETACHED)) return ref;
  if (is_atomic (ref)) {
    tree r (ref->label);
    r->obs= list_observer (ip_observer (dip), r->obs);
    return r;
  }
  else {
    int i, n= N(ref);
    tree r (ref, n);
    for (i=0; i<n; i++)
      r[i]= attach_dip (ref[i], descend (dip, i));
    r->obs= list_observer (ip_observer (dip), r->obs);
    return r;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 465 of file boxes.cpp.

                                                      {
  while (!is_nil (l)) {
    rectangle r (l->item);
    ren->clear_pattern (r->x1- ren->ox, r->y1- ren->oy,
                     r->x2- ren->ox, r->y2- ren->oy);
    l= l->next;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

cursor copy ( cursor  cu)

Definition at line 568 of file boxes.cpp.

                 {
  return cursor (cu->ox, cu->oy, cu->delta, cu->y1, cu->y2,
               cu->slope, cu->valid);
}
path descend_decode ( path  ip,
int  side 
)

Definition at line 793 of file boxes.cpp.

                                   {
  if (is_nil (ip)) return descend (ip, side);
  else switch (ip->item) {
  case DECORATION       : return ip->next;
  case DECORATION_LEFT  : return descend (ip->next, 0);
  case DECORATION_MIDDLE: return descend (ip->next, side);
  case DECORATION_RIGHT : return descend (ip->next, 1);
  default               : return descend (ip, side);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void find_canvas_info ( box  b,
path  sp,
SI x,
SI y,
SI sx,
SI sy,
rectangle outer,
rectangle inner 
)

Definition at line 244 of file boxes.cpp.

{
  if (is_nil (sp)) {
    x= y= sx= sy= 0;
    outer= inner= rectangle (0, 0, 0, 0);
  }
  else if (is_atom (sp)) {
    x    = 0;
    y    = 0;
    sx   = b->sx (0);
    sy   = b->sy (0);
    outer= rectangle (b->x1, b->y1, b->x2, b->y2);
    inner= rectangle (b[0]->x1, b[0]->y1, b[0]->x2, b[0]->y2);
  }
  else {
    find_canvas_info (b[sp->item], sp->next, x, y, sx, sy, outer, inner);
    x += b->sx (sp->item);
    y += b->sy (sp->item);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 201 of file boxes.cpp.

                                      {
  // Given a box b and a logical path p, this routine returns 
  // the longest box path sp such that b[sp] is a scroll node
  path bp;
  while (true) {
    bool found= false;
    bp= b->find_box_path (p, found);
    if (found) break;
    p= path_up (p);
    if (is_nil (p)) return path ();
  }
  bp= path_up (bp);
  path cp, sp;
  while (!is_nil (bp)) {
    if (b->get_type () == SCROLL_BOX) sp= reverse (cp);
    b = b[bp->item];
    cp= path (bp->item, cp);
    bp= bp->next;
  }
  if (is_nil (sp)) return sp;
  else return sp * 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

path find_scrolled_box_path ( box  b,
path  sp,
SI  x,
SI  y,
SI  delta 
)

Definition at line 225 of file boxes.cpp.

                                                              {
  if (is_nil (sp)) return b->find_box_path (x, y, delta, false);
  else {
    int m= sp->item;
    SI xx= x - b->sx (m), yy= y - b->sy (m);
    SI dd= delta + get_delta (xx, b[m]->x1, b[m]->x2);
    return path (m, find_scrolled_box_path (b[m], sp->next, xx, yy, dd));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

path find_scrolled_tree_path ( box  b,
path  sp,
SI  x,
SI  y,
SI  delta 
)

Definition at line 236 of file boxes.cpp.

                                                               {
  path bp= find_scrolled_box_path (b, sp, x, y, delta);
  //cout << "Find " << x << ", " << y << "; " << delta;
  //cout << " -> " << bp << "\n";
  return b->find_tree_path (bp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

SI get_delta ( SI  x,
SI  x1,
SI  x2 
)

Definition at line 53 of file boxes.cpp.

                               {
  if (x1==x2) return 0;
  if (x==x1) return -1;
  if (x==x2) return 1;
  return 0;
}

Here is the caller graph for this function:

void make_eps ( url  name,
box  b,
int  dpi = 600 
)

Definition at line 828 of file boxes.cpp.

                                    {
  double inch= ((double) dpi * PIXEL);
  double cm  = inch / 2.54;
  SI w= b->x4 - b->x3;
  SI h= b->y4 - b->y3;
  b->x0= -b->x3;
  b->y0= -b->y4;
  renderer ren= printer (name, dpi, 1, "user", false, w/cm, h/cm);
  ren->set_color (black);
  ren->set_background (white);
  rectangles rs;
  b->redraw (ren, path (0), rs);
  tm_delete (ren);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool operator!= ( cursor  cu1,
cursor  cu2 
)

Definition at line 583 of file boxes.cpp.

                                     {
  return ! (cu1 == cu2);
}
bool operator!= ( selection  sel1,
selection  sel2 
)

Definition at line 617 of file boxes.cpp.

                                             {
  return !(sel1 == sel2);
}
tm_ostream& operator<< ( tm_ostream out,
cursor  cu 
)

Definition at line 588 of file boxes.cpp.

                                         {
  out << "cursor (" << (cu->ox>>8) << ", " << (cu->oy>>8) << ": "
      << cu->delta << ": "
      << (cu->y1>>8) << ", " << (cu->y2>>8) << ": "
      << cu->slope << ")";
  return out;
}
tm_ostream& operator<< ( tm_ostream out,
selection  sel 
)

Definition at line 622 of file boxes.cpp.

                                             {
  return out << "selection (" << sel->start << ", " << sel->end << ")";
}
tm_ostream& operator<< ( tm_ostream out,
gr_selection  sel 
)

Definition at line 638 of file boxes.cpp.

                                                {
  return out << "gr_selection (" << sel->type << ", "
            << sel->dist << ", " << sel->cp << ")";
}
tm_ostream& operator<< ( tm_ostream out,
box  b 
)

Definition at line 790 of file boxes.cpp.

{ return out << ((tree) b); }
bool operator== ( cursor  cu1,
cursor  cu2 
)

Definition at line 574 of file boxes.cpp.

                                     {
  return
    (cu1->ox == cu2->ox) && (cu1->oy == cu2->oy) &&
    // (cu1->delta == cu2->delta) &&
    (cu1->y1 == cu2->y1) && (cu1->y2 == cu2->y2) &&
    (cu1->slope == cu2->slope);
}
bool operator== ( selection  sel1,
selection  sel2 
)

Definition at line 610 of file boxes.cpp.

                                             {
  return
    (sel1->start == sel2->start) &&
    (sel1->end == sel2->end);
}
bool outside ( SI  x,
SI  delta,
SI  x1,
SI  x2 
)

Definition at line 46 of file boxes.cpp.

                                       {
  return
    (x<x1) || ((x==x1) && (delta<0)) ||
    (x>x2) || ((x==x2) && (delta>=0));
}

Here is the caller graph for this function:

void sort ( gr_selections sels)

Definition at line 649 of file boxes.cpp.

                           {
  merge_sort_leq <gr_selection, less_eq_gr_selection> (sels);
}

Variable Documentation

int nr_painted = 0

Definition at line 462 of file boxes.cpp.