Exemplo n.º 1
0
path
find_scrolled_box_path (box b, path sp, SI x, SI y, SI delta) {
  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));
  }
}
Exemplo n.º 2
0
path
find_innermost_scroll (box b, path p) {
  // 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;
}