Back to index

texmacs  1.0.7.15
Classes | Defines | Typedefs | Functions | Variables
boxes.hpp File Reference
#include "basic.hpp"
#include "rectangles.hpp"
#include "path.hpp"
#include "renderer.hpp"
#include "timer.hpp"
#include "font.hpp"
#include "language.hpp"
#include "hashmap.hpp"
#include "Graphics/frame.hpp"
#include "Graphics/grid.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cursor_rep
struct  cursor
struct  selection_rep
struct  selection
struct  gr_selection
class  box
class  box_rep
struct  gr_selection_rep

Defines

#define MAX_SI   0x7fffffff
#define MIN_SI   0x80000000
#define STD_BOX   0
#define STACK_BOX   1
#define CONTROL_BOX   2
#define MOVE_BOX   3
#define SCROLL_BOX   4
#define DECORATION   (-1)
#define DECORATION_LEFT   (-2)
#define DECORATION_MIDDLE   (-3)
#define DECORATION_RIGHT   (-4)
#define DETACHED   (-5)
#define is_accessible(p)   ((is_nil (p)) || ((p)->item >= 0))
#define is_decoration(p)   ((!is_nil (p)) && ((p)->item < 0))
#define attach_here(t, ip)   attach_dip(t,ip),ip
#define attach_deco(t, ip)   attach_dip(t,decorate(ip)),decorate(ip)
#define attach_left(t, ip)   attach_dip(t,decorate_left(ip)),decorate_left(ip)
#define attach_middle(t, ip)   attach_dip(t,decorate_middle(ip)),decorate_middle(ip)
#define attach_right(t, ip)   attach_dip(t,decorate_right(ip)),decorate_right(ip)

Typedefs

typedef array< gr_selectiongr_selections
typedef array< double > point

Functions

 CONCRETE_CODE (cursor)
cursor copy (cursor cu)
bool operator== (cursor cu1, cursor cu2)
bool operator!= (cursor cu1, cursor cu2)
tm_ostreamoperator<< (tm_ostream &out, cursor cu)
 CONCRETE_CODE (selection)
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)
 ABSTRACT_NULL_CODE (box)
int N (box b)
tm_ostreamoperator<< (tm_ostream &out, box b)
SI get_delta (SI x, SI x1, SI x2)
bool outside (SI x, SI delta, SI x1, SI x2)
void make_eps (url dest, box b, int dpi)
path find_innermost_scroll (box b, path p)
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 refresh_at (time_t t)
path descend (path ip, int i)
path decorate ()
path decorate (path ip)
path decorate_left (path ip)
path decorate_middle (path ip)
path decorate_right (path ip)
path descend_decode (path ip, int side)
tree attach_dip (tree ref, path ip)
 CONCRETE_CODE (gr_selection)

Variables

int box_count
bool refresh_needed
time_t refresh_next

Define Documentation

#define attach_deco (   t,
  ip 
)    attach_dip(t,decorate(ip)),decorate(ip)

Definition at line 318 of file boxes.hpp.

#define attach_here (   t,
  ip 
)    attach_dip(t,ip),ip

Definition at line 317 of file boxes.hpp.

#define attach_left (   t,
  ip 
)    attach_dip(t,decorate_left(ip)),decorate_left(ip)

Definition at line 319 of file boxes.hpp.

#define attach_middle (   t,
  ip 
)    attach_dip(t,decorate_middle(ip)),decorate_middle(ip)

Definition at line 320 of file boxes.hpp.

#define attach_right (   t,
  ip 
)    attach_dip(t,decorate_right(ip)),decorate_right(ip)

Definition at line 322 of file boxes.hpp.

#define CONTROL_BOX   2

Definition at line 31 of file boxes.hpp.

#define DECORATION   (-1)

Definition at line 292 of file boxes.hpp.

#define DECORATION_LEFT   (-2)

Definition at line 293 of file boxes.hpp.

#define DECORATION_MIDDLE   (-3)

Definition at line 294 of file boxes.hpp.

#define DECORATION_RIGHT   (-4)

Definition at line 295 of file boxes.hpp.

#define DETACHED   (-5)

Definition at line 296 of file boxes.hpp.

#define is_accessible (   p)    ((is_nil (p)) || ((p)->item >= 0))

Definition at line 297 of file boxes.hpp.

#define is_decoration (   p)    ((!is_nil (p)) && ((p)->item < 0))

Definition at line 298 of file boxes.hpp.

#define MAX_SI   0x7fffffff

Definition at line 26 of file boxes.hpp.

#define MIN_SI   0x80000000

Definition at line 27 of file boxes.hpp.

#define MOVE_BOX   3

Definition at line 32 of file boxes.hpp.

#define SCROLL_BOX   4

Definition at line 33 of file boxes.hpp.

#define STACK_BOX   1

Definition at line 30 of file boxes.hpp.

#define STD_BOX   0

Definition at line 29 of file boxes.hpp.


Typedef Documentation

Definition at line 95 of file boxes.hpp.

typedef array<double> point

Definition at line 104 of file boxes.hpp.


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  ip 
)

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:

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 decorate ( ) [inline]

Definition at line 301 of file boxes.hpp.

                        {
  return path (DECORATION); }

Here is the caller graph for this function:

path decorate ( path  ip) [inline]

Definition at line 303 of file boxes.hpp.

                               {
  return (is_nil (ip) || (ip->item >= 0))? path (DECORATION, ip): ip; }

Here is the call graph for this function:

path decorate_left ( path  ip) [inline]

Definition at line 305 of file boxes.hpp.

                                    {
  return (is_nil (ip) || (ip->item >= 0))? path (DECORATION_LEFT, ip): ip; }

Here is the call graph for this function:

Here is the caller graph for this function:

path decorate_middle ( path  ip) [inline]

Definition at line 307 of file boxes.hpp.

                                      {
  return (is_nil (ip) || (ip->item >= 0))? path (DECORATION_MIDDLE, ip): ip; }

Here is the call graph for this function:

Here is the caller graph for this function:

path decorate_right ( path  ip) [inline]

Definition at line 309 of file boxes.hpp.

                                     {
  return (is_nil (ip) || (ip->item >= 0))? path (DECORATION_RIGHT, ip): ip; }

Here is the call graph for this function:

path descend ( path  ip,
int  i 
) [inline]

Definition at line 299 of file boxes.hpp.

                                     {
  return (is_nil (ip) || (ip->item >= 0))? path (i, ip): ip; }

Here is the call graph for this function:

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_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  dest,
box  b,
int  dpi 
)

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:

int N ( box  b) [inline]

Definition at line 278 of file boxes.hpp.

{ return b.rep->subnr(); }
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 refresh_at ( time_t  t)

Definition at line 24 of file animate_boxes.cpp.

                      {
  time_t now= texmacs_time ();
  if (t - now < 0) t= now;
  if (refresh_needed) {
    if (refresh_next - now < 0) refresh_next= now;
    if (t - refresh_next < 0) refresh_next= t;
  }
  else {
    refresh_needed= true;
    refresh_next  = t;
  }
  //cout << "Refresh at " << t << " -> " << refresh_next << "\n";
}

Here is the call graph for this function:

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 box_count

Definition at line 20 of file animate_boxes.cpp.

Definition at line 21 of file animate_boxes.cpp.