Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes
bridge_rep Class Reference

#include <bridge.hpp>

Inheritance diagram for bridge_rep:
Inheritance graph
[legend]
Collaboration diagram for bridge_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 bridge_rep (typesetter ttt, tree st, path ip)
virtual ~bridge_rep ()
virtual void notify_assign (path p, tree u)=0
virtual void notify_insert (path p, tree u)
virtual void notify_remove (path p, int nr)
virtual void notify_split (path p)
virtual void notify_join (path p)
virtual bool notify_macro (int type, string var, int l, path p, tree u)=0
virtual void notify_change ()=0
virtual void my_clean_links ()
virtual void my_exec_until (path p)
virtual bool my_typeset_will_be_complete ()
virtual void my_typeset (int desired_status)
virtual void exec_until (path p, bool skip_flag=false)
void typeset (int desired_status)

Public Attributes

typesetter ttt
edit_envenv
tree st
path ip
int status
hashmap< string, treechanges
array< page_iteml
stack_border sb
link_repository link_env
int ref_count

Detailed Description

Definition at line 35 of file bridge.hpp.


Constructor & Destructor Documentation

bridge_rep::bridge_rep ( typesetter  ttt,
tree  st,
path  ip 
)

Definition at line 38 of file bridge.cpp.

                                                          :
  ttt (ttt2), env (ttt->env), st (st2), ip (ip2),
  status (CORRUPTED), changes (UNINIT) {}
virtual bridge_rep::~bridge_rep ( ) [inline, virtual]

Definition at line 50 of file bridge.hpp.

{}

Member Function Documentation

void bridge_rep::exec_until ( path  p,
bool  skip_flag = false 
) [virtual]

Reimplemented in bridge_auto_rep.

Definition at line 254 of file bridge.cpp.

                                              {
  // This virtual routine is redefined in bridge_auto in order to
  // treat cursor positions on the border in a special way depending
  // on skip_flag

  (void) skip_flag;
  // cout << "Exec until " << p << " in " << st << "\n";
  if ((status & VALID_MASK) != PROCESSED) {
    // cout << "  Re-execute until\n";
    env->exec_until (st, p);
  }
  else if (p == path (right_index (st))) {
    // cout << "  Patch env\n";
    env->patch_env (changes);
  }
  else if (p != path (0)) {
    // cout << "  My execute until\n";
    my_exec_until (p);
  }
  // cout << "  Done\n";
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bridge_rep::my_clean_links ( ) [virtual]

Reimplemented in bridge_surround_rep.

Definition at line 231 of file bridge.cpp.

                            {
  link_env= link_repository (true);
}

Here is the caller graph for this function:

void bridge_rep::my_exec_until ( path  p) [virtual]

Reimplemented in bridge_docrange_rep, bridge_ornamented_rep, bridge_auto_rep, bridge_surround_rep, bridge_document_rep, bridge_formatting_rep, bridge_locus_rep, bridge_with_rep, bridge_expand_as_rep, and bridge_mark_rep.

Definition at line 236 of file bridge.cpp.

                                 {
  env->exec_until (st, p);
}

Here is the caller graph for this function:

void bridge_rep::my_typeset ( int  desired_status) [virtual]

Reimplemented in bridge_ornament_rep, bridge_canvas_rep, bridge_docrange_rep, bridge_auto_rep, bridge_compound_rep, bridge_surround_rep, bridge_document_rep, bridge_formatting_rep, bridge_argument_rep, bridge_eval_rep, bridge_locus_rep, bridge_with_rep, bridge_expand_as_rep, bridge_mark_rep, bridge_rewrite_rep, and bridge_hidden_rep.

Definition at line 246 of file bridge.cpp.

                                          {
  if ((desired_status & WANTED_MASK) == WANTED_PARAGRAPH)
    ttt->insert_paragraph (st, ip);
  if ((desired_status & WANTED_MASK) == WANTED_PARUNIT)
    ttt->insert_parunit (st, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void bridge_rep::notify_assign ( path  p,
tree  u 
) [pure virtual]
virtual void bridge_rep::notify_change ( ) [pure virtual]
void bridge_rep::notify_insert ( path  p,
tree  u 
) [virtual]

Reimplemented in bridge_docrange_rep, bridge_ornamented_rep, bridge_compound_rep, bridge_auto_rep, bridge_document_rep, bridge_surround_rep, bridge_formatting_rep, bridge_locus_rep, bridge_with_rep, bridge_expand_as_rep, and bridge_mark_rep.

Definition at line 163 of file bridge.cpp.

                                         {
  // cout << "Insert " << p << ", " << u << " in " << st << "\n";
  path q= path_up (p);
  int  l= last_item (p);
  tree t= subtree (st, q);
  if (is_atomic (t)) {
    ASSERT (is_atomic (u), "two atoms expected");
    t= t->label (0, l) * u->label * t->label (l, N(t->label));
  }
  else t= (t (0, l) * u) * t (l, N(t));
  notify_assign (q, t);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bridge_rep::notify_join ( path  p) [virtual]

Definition at line 208 of file bridge.cpp.

                               {
  // cout << "Join " << p << " in " << st << "\n";
  path q  = path_up (p);
  int  pos= last_item (p);
  tree t  = subtree (st, q);

  if (is_atomic (t[pos]) && is_atomic (t[pos+1])) {
    string j= t[pos]->label * t[pos+1]->label;
    notify_remove (q * pos, 1);
    notify_assign (q * pos, j);
  }
  else {
    tree j= t[pos] * t[pos+1];
    notify_remove (q * pos, 1);
    notify_assign (q * pos, j);
  }
}

Here is the call graph for this function:

virtual bool bridge_rep::notify_macro ( int  type,
string  var,
int  l,
path  p,
tree  u 
) [pure virtual]
void bridge_rep::notify_remove ( path  p,
int  nr 
) [virtual]

Reimplemented in bridge_docrange_rep, bridge_ornamented_rep, bridge_compound_rep, bridge_auto_rep, bridge_document_rep, bridge_surround_rep, bridge_formatting_rep, bridge_locus_rep, bridge_with_rep, bridge_expand_as_rep, and bridge_mark_rep.

Definition at line 177 of file bridge.cpp.

                                         {
  // cout << "Insert " << p << ", " << nr << " in " << st << "\n";
  path q= path_up (p);
  int  l= last_item (p);
  tree t= subtree (st, q);
  if (is_atomic (t)) t= t->label (0, l) * t->label (l+nr, N(t->label));
  else t= t (0, l) * t (l+nr, N(t));
  notify_assign (q, t);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bridge_rep::notify_split ( path  p) [virtual]

Definition at line 188 of file bridge.cpp.

                                {
  // cout << "Split " << p << " in " << st << "\n";
  path q  = path_up (p, 2);
  int  pos= last_item (path_up (p));
  int  l  = last_item (p);
  tree t  = subtree (st, q);

  if (is_atomic (t[pos])) {
    string s1= t[pos]->label (0, l), s2= t[pos]->label (l, N (t[pos]->label));
    notify_insert (q * pos, tree (L(t), s1));
    notify_assign (q * (pos+1), s2);
  }
  else {
    tree t1= t[pos] (0, l), t2= t[pos] (l, N(t[pos]));
    notify_insert (q * pos, tree (L(t), t1));
    notify_assign (q * (pos+1), t2);
  }
}

Here is the call graph for this function:

void bridge_rep::typeset ( int  desired_status)

Definition at line 279 of file bridge.cpp.

                                       {
  // FIXME: this dirty hack ensures a perfect coherence between
  // the bridge and the edit tree at the typesetting stage.
  // This should not be necessary, but we use because the ip_observers
  // may become wrong otherwise.
  if (is_accessible (ip))
    st= subtree (the_et, reverse (ip));
  if (!is_accessible (ip)) {
    path ip2= obtain_ip (st);
    if (ip2 != path (DETACHED))
      ip= ip2;
  }

  //cout << "Typesetting " << st << ", " << desired_status << LF << INDENT;
  if ((status==desired_status) && (N(ttt->old_patch)==0)) {
    //cout << "cached" << LF;
    env->monitored_patch_env (changes);
    // cout << "changes       = " << changes << LF;
  }
  else {
    // cout << "Typesetting " << st << ", " << desired_status << LF << INDENT;
    //cout << "recomputing" << LF;
    hashmap<string,tree> prev_back (UNINIT);
    my_clean_links ();
    link_repository old_link_env= env->link_env;
    env->link_env= link_env;
    ttt->local_start (l, sb);
    env->local_start (prev_back);
    if (env->hl_lan != 0) env->lan->highlight (st);
    my_typeset (desired_status);
    env->local_update (ttt->old_patch, changes);
    env->local_end (prev_back);
    ttt->local_end (l, sb);
    env->link_env= old_link_env;
    status= desired_status;
    // cout << "old_patch     = " << ttt->old_patch << LF;
    // cout << "changes       = " << changes << LF;
    // cout << UNINDENT << "Typesetted " << st << ", " << desired_status << LF;
  }
  //cout << UNINDENT << "Typesetted " << st << ", " << desired_status << LF;

  // ttt->insert_stack (l, sb);
  //if (N(l) == 0); else
  if (ttt->paper || (N(l) <= 1)) ttt->insert_stack (l, sb);
  else {
    bool flag= false;
    int i, n= N(l);
    for (i=0; i<n; i++)
      flag= flag || (N (l[i]->fl) != 0) || (l[i]->nr_cols > 1);
    if (flag) ttt->insert_stack (l, sb);
    else {
      int first=-1, last=-1;
      array<box> bs;
      array<SI>  spc;
      for (i=0; i<n; i++)
       if (l[i]->type != PAGE_CONTROL_ITEM) {
         if (first == -1 && l[i]->type == PAGE_LINE_ITEM) first= N(bs);
         bs  << l[i]->b;
         spc << l[i]->spc->def;
         last= i;
       }
      box lb= stack_box (path (ip), bs, spc);
      if (first != -1) lb= move_box (path (ip), lb, 0, bs[first]->y2);
      array<page_item> new_l (1);
      new_l[0]= page_item (lb);
      new_l[0]->spc= l[last]->spc;
      ttt->insert_stack (new_l, sb);
    }
  }

  //cout << "l   = " << l << LF;
  //cout << "sb  = " << sb << LF;
  //cout << "l   = " << ttt->l << LF;
  //cout << "a   = " << ttt->a << LF;
  //cout << "b   = " << ttt->b << LF;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 42 of file bridge.hpp.

Definition at line 38 of file bridge.hpp.

Definition at line 40 of file bridge.hpp.

Definition at line 44 of file bridge.hpp.

Definition at line 46 of file bridge.hpp.

int abstract_struct::ref_count [inherited]

Definition at line 142 of file basic.hpp.

Definition at line 45 of file bridge.hpp.

Definition at line 39 of file bridge.hpp.

Definition at line 41 of file bridge.hpp.

Definition at line 37 of file bridge.hpp.


The documentation for this class was generated from the following files: