Back to index

texmacs  1.0.7.15
Classes | Functions
table.cpp File Reference
#include "Table/table.hpp"
#include "Boxes/construct.hpp"
#include "Format/format.hpp"
#include "analyze.hpp"

Go to the source code of this file.

Classes

struct  lazy_table_rep
struct  lazy_table

Functions

lazy make_lazy_paragraph (edit_env env, array< box > bs, path ip)
static SI sum (SI *a, int n)
static double sum (double *a, int n)
static void blow_up (SI *w, SI *l, SI *r, SI *W, SI *L, SI *R, SI room, double *part, int n)
 EXTEND_NULL_CODE (lazy, lazy_table)
lazy make_lazy_table (edit_env env, tree t, path ip)
box typeset_as_table (edit_env env, tree t, path ip)
array< boxtypeset_as_var_table (edit_env env, tree t, path ip)

Function Documentation

static void blow_up ( SI w,
SI l,
SI r,
SI W,
SI L,
SI R,
SI  room,
double *  part,
int  n 
) [static]

Definition at line 365 of file table.cpp.

{
  int i;
  double total= sum (part, n);
  if (total <= 0)
    for (i=0; i<n; i++) part[i]= 1;
  int nr_ext= 0;
  for (i=0; i<n; i++)
    if (w[i] != W[i] && part[i] > 0)
      nr_ext++;
  if (nr_ext != 0)
    for (i=0; i<n; i++)
      if (w[i] == W[i])
       part[i]= 0;
  total= sum (part, n);

  STACK_NEW_ARRAY (Part, double, n);
  for (i=0; i<n; i++) Part[i]= part[i];

  SI old_room= room;
  while (true) {
    for (i=0; i<n; i++)
      if (part[i] > 0) {
       SI extra= (SI) ((part[i]/total) * old_room);
       if (w[i]+extra >= W[i]) {
         room    -= (W[i]-w[i]);
         w[i]     = W[i];
         l[i]     = L[i];
         r[i]     = R[i];
         part[i]  = 0;
       }
      }
    total= sum (part, n);
    if (room <= 0) {
      STACK_DELETE_ARRAY (Part);
      return;
    }
    if ((total <= 0) || (room == old_room) || (room <= 0)) break;
    old_room= room;
  }

  if (total <= 0) {
    for (i=0; i<n; i++) part[i]= Part[i];
    total= sum (part, n);
  }
  for (i=0; i<n; i++) {
    SI extra = (SI) ((part[i]/total) * room);
    w[i] += extra;
    if (L[i] + R[i] >= w[i]) {
      SI s= l[i] + r[i];
      SI S= L[i] + R[i];
      double lambda= ((double) (w[i] - s)) / ((double) (S - s));
      l[i] += (SI) (lambda * (L[i] - l[i]));
      r[i]  = w[i] - l[i];
    }
    else {
      l[i]= L[i];
      r[i]= R[i];
    }
  }
  STACK_DELETE_ARRAY (Part);
}

Here is the call graph for this function:

Here is the caller graph for this function:

lazy make_lazy_paragraph ( edit_env  env,
array< box bs,
path  ip 
)

Definition at line 518 of file lazy_paragraph.cpp.

                                                           {
  lazy_paragraph par (env, ip);
  par->a= convert (env, bs, ip);
  return par;
}

Here is the call graph for this function:

lazy make_lazy_table ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 865 of file table.cpp.

                                                {
  table T (env);
  T->typeset (t, ip);
  T->handle_decorations ();
  T->handle_span ();
  T->merge_borders (); // FIXME: introduce merge_border variables
  return lazy_table (T, ip);
}

Here is the caller graph for this function:

static SI sum ( SI a,
int  n 
) [static]

Definition at line 350 of file table.cpp.

                   {
  int i, s=0;
  for (i=0; i<n; i++) s+= a[i];
  return s;
}

Here is the caller graph for this function:

static double sum ( double *  a,
int  n 
) [static]

Definition at line 357 of file table.cpp.

                       {
  int i;
  double s=0.0;
  for (i=0; i<n; i++) s+= a[i];
  return s;
}
box typeset_as_table ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 879 of file table.cpp.

                                                 {
  table T (env);
  T->typeset (t, ip);
  T->handle_decorations ();
  T->handle_span ();
  T->merge_borders ();
  T->position_columns ();
  T->finish_horizontal ();
  T->position_rows ();
  T->finish ();
  return T->b;
}

Here is the caller graph for this function:

array<box> typeset_as_var_table ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 893 of file table.cpp.

                                                     {
  table T (env);
  T->typeset (t, ip);
  T->handle_decorations ();
  T->handle_span ();
  T->merge_borders ();
  T->position_columns ();
  T->finish_horizontal ();
  T->position_rows ();
  return T->var_finish ();
}

Here is the caller graph for this function: