Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Protected Attributes
bridge_ornament_rep Class Reference
Inheritance diagram for bridge_ornament_rep:
Inheritance graph
[legend]
Collaboration diagram for bridge_ornament_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 bridge_ornament_rep (typesetter ttt, tree st, path ip)
void my_typeset (int desired_status)
void initialize ()
void notify_assign (path p, tree u)
void notify_insert (path p, tree u)
void notify_remove (path p, int nr)
bool notify_macro (int type, string var, int level, path p, tree u)
void notify_change ()
void my_exec_until (path p)
bool my_typeset_will_be_complete ()
box typeset_ornament (int desired_status)
void insert_ornament (box b)
virtual void notify_split (path p)
virtual void notify_join (path p)
virtual void my_clean_links ()
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

Protected Attributes

int last
bridge body
tree with

Detailed Description

Definition at line 252 of file bridge_gui.cpp.


Constructor & Destructor Documentation

Definition at line 254 of file bridge_gui.cpp.

                                                        :
    bridge_ornamented_rep (ttt, st, ip) {}

Member Function Documentation

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

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_ornamented_rep::initialize ( ) [inherited]

Definition at line 51 of file bridge_gui.cpp.

                                   {
  last= N(st)-1;
  if (is_nil(body)) body= make_bridge (ttt, st[last], descend (ip, last));
  else replace_bridge (body, st[last], descend (ip, last));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 185 of file bridge_gui.cpp.

                                             {
  /*
  ttt->insert_marker (st, ip);
  array<page_item> l2= array<page_item> (1);
  l2[0]= page_item (b);
  ttt->insert_stack (l2, stack_border ());
  */
  lazy_paragraph par (env, ip);
  par->a= copy (ttt->a);
  par->a << line_item (STD_ITEM, env->mode_op, b, HYPH_INVALID);
  par->a << ttt->b;
  par->format_paragraph ();
  ttt->insert_stack (par->sss->l, par->sss->sb);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bridge_rep::my_clean_links ( ) [virtual, inherited]

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_ornamented_rep::my_exec_until ( path  p) [virtual, inherited]

Reimplemented from bridge_rep.

Definition at line 135 of file bridge_gui.cpp.

                                            {
  for (int i=0; i<N(with)-1; i+=2)
    env->monitored_write_update (with[i]->label, with[i+1]);
  body->exec_until (p->next);
}

Here is the call graph for this function:

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

Reimplemented from bridge_rep.

Definition at line 265 of file bridge_gui.cpp.

                                                   {
  SI    w     = env->get_length (ORNAMENT_BORDER);
  SI    xpad  = env->get_length (ORNAMENT_HPADDING);
  SI    ypad  = env->get_length (ORNAMENT_VPADDING);
  tree  bg    = env->read       (ORNAMENT_COLOR);
  int   a     = env->alpha;
  color sunny = env->get_color  (ORNAMENT_SUNNY_COLOR);
  color shadow= env->get_color  (ORNAMENT_SHADOW_COLOR);
  SI    l     = env->get_length (PAR_LEFT ) + w + xpad;
  SI    r     = env->get_length (PAR_RIGHT) + w + xpad;
  with        = tuple (PAR_LEFT , tree (TMLEN, as_string (l))) *
                tuple (PAR_RIGHT, tree (TMLEN, as_string (r)));
  box   b     = typeset_ornament (desired_status);
  box   hb    = highlight_box (ip, b, w, xpad, ypad, bg, a, sunny, shadow);
  box   mb    = move_box (decorate (ip), hb, -l, 0);
  insert_ornament (remember_box (decorate (ip), mb));
}

Here is the call graph for this function:

Reimplemented from bridge_rep.

Definition at line 142 of file bridge_gui.cpp.

                                                    {
  if (status != CORRUPTED) return false;
  return body->my_typeset_will_be_complete ();
}
void bridge_ornamented_rep::notify_assign ( path  p,
tree  u 
) [virtual, inherited]

Implements bridge_rep.

Definition at line 62 of file bridge_gui.cpp.

                                                    {
  // cout << "Assign " << p << ", " << u << " in " << st << "\n";
  if (is_nil (p)) {
    st= u;
    initialize ();
  }
  else {
    bool mp_flag= is_multi_paragraph (st);
    if (p->item == last) {
      if (is_atom (p)) body= make_bridge (ttt, u, descend (ip, last));
      else body->notify_assign (p->next, u);
      st= substitute (st, p->item, body->st);
    }
    else {
      st= substitute (st, p, u);
      body->notify_change ();
    }
    if (mp_flag != is_multi_paragraph (st)) initialize ();
  }
  status= CORRUPTED;
}

Here is the call graph for this function:

void bridge_ornamented_rep::notify_change ( ) [virtual, inherited]

Implements bridge_rep.

Definition at line 125 of file bridge_gui.cpp.

                                      {
  status= CORRUPTED;
  body->notify_change ();
}
void bridge_ornamented_rep::notify_insert ( path  p,
tree  u 
) [virtual, inherited]

Reimplemented from bridge_rep.

Definition at line 85 of file bridge_gui.cpp.

                                                    {
  // cout << "Insert " << p << ", " << u << " in " << st << "\n";
  ASSERT (!is_nil (p), "nil path");
  if (is_atom (p) || (p->item != last)) bridge_rep::notify_insert (p, u);
  else {
    bool mp_flag= is_multi_paragraph (st);
    body->notify_insert (p->next, u);
    st= substitute (st, last, body->st);
    if (mp_flag != is_multi_paragraph (st)) initialize ();
  }
  status= CORRUPTED;
}

Here is the call graph for this function:

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

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:

bool bridge_ornamented_rep::notify_macro ( int  type,
string  var,
int  level,
path  p,
tree  u 
) [virtual, inherited]

Implements bridge_rep.

Definition at line 113 of file bridge_gui.cpp.

{
  //cout << "Notify macro " << type << ", " << var << ", " << l
  //     << ", " << p << ", " << u << " in " << st << "\n";
  bool flag= body->notify_macro (type, var, l, p, u);
  flag= flag || env->depends (st (0, last), var, l);
  if (flag) status= CORRUPTED;
  return flag;
}
void bridge_ornamented_rep::notify_remove ( path  p,
int  nr 
) [virtual, inherited]

Reimplemented from bridge_rep.

Definition at line 99 of file bridge_gui.cpp.

                                                    {
  // cout << "Remove " << p << ", " << nr << " in " << st << "\n";
  ASSERT (!is_nil (p), "nil path");
  if (is_atom (p) || (p->item != last)) bridge_rep::notify_remove (p, nr);
  else {
    bool mp_flag= is_multi_paragraph (st);
    body->notify_remove (p->next, nr);
    st= substitute (st, last, body->st);
    if (mp_flag != is_multi_paragraph (st)) initialize ();
  }
  status= CORRUPTED;
}

Here is the call graph for this function:

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

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) [inherited]

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:

box bridge_ornamented_rep::typeset_ornament ( int  desired_status) [inherited]

Definition at line 163 of file bridge_gui.cpp.

                                                           {
  int i;
  tree old (TUPLE, N(with));
  for (i=0; i<N(with)-1; i+=2) {
    old[i+1]= env->read (with[i]->label);
    env->write_update (with[i]->label, with[i+1]);
  }
  array<page_item> l2;
  stack_border sb2;
  array<line_item> a2, b2;
  ttt->local_start (l2, sb2);
  a2= ttt->a; b2= ttt->b;
  ttt->a= array<line_item> (); ttt->b= array<line_item> ();
  body->typeset (desired_status);
  ttt->a= a2; ttt->b= b2;
  ttt->local_end (l2, sb2);
  for (i-=2; i>=0; i-=2)
    env->write_update (with[i]->label, old[i+1]);
  return make_ornament_body (ip, l2);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

bridge bridge_ornamented_rep::body [protected, inherited]

Definition at line 24 of file bridge_gui.cpp.

Definition at line 42 of file bridge.hpp.

edit_env& bridge_rep::env [inherited]

Definition at line 38 of file bridge.hpp.

path bridge_rep::ip [inherited]

Definition at line 40 of file bridge.hpp.

Definition at line 44 of file bridge.hpp.

int bridge_ornamented_rep::last [protected, inherited]

Definition at line 23 of file bridge_gui.cpp.

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.

tree bridge_rep::st [inherited]

Definition at line 39 of file bridge.hpp.

int bridge_rep::status [inherited]

Definition at line 41 of file bridge.hpp.

Definition at line 37 of file bridge.hpp.

tree bridge_ornamented_rep::with [protected, inherited]

Definition at line 25 of file bridge_gui.cpp.


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