Beispiel #1
0
path
edit_cursor_rep::make_cursor_accessible (path p, bool forwards) {
  //time_t t1= texmacs_time ();
  path start_p= p;
  bool inverse= false;
  int old_mode= get_access_mode ();
  if (get_init_string (MODE) == "src")
    set_access_mode (DRD_ACCESS_SOURCE);
  while (!is_accessible_cursor (et, p) && !in_source ()) {
    path pp;
    ASSERT (rp <= p, "path outside document");
    p= rp * closest_inside (subtree (et, rp), p / rp);
    if (forwards ^ inverse)
      pp= rp * next_valid (subtree (et, rp), p / rp);
    else
      pp= rp * previous_valid (subtree (et, rp), p / rp);
    if (pp == p) {
      if (inverse) break;
      else { p= start_p; inverse= true; }
    }
    else p= pp;
  }
  set_access_mode (old_mode);
  //time_t t2= texmacs_time ();
  //if (t2-t1 >= 1) cout << "made_cursor_accessible took " << t2-t1 << "ms\n";
  return p;
}
Beispiel #2
0
void
edit_select_rep::selection_correct (path i1, path i2, path& o1, path& o2) {
  ASSERT (rp <= i1 && rp <= i2, "paths not inside document");
  int old_mode= get_access_mode ();
  if (get_init_string (MODE) == "src")
    set_access_mode (DRD_ACCESS_SOURCE);
  ::selection_correct (subtree (et, rp), i1 / rp, i2 / rp, o1, o2);
  set_access_mode (old_mode);
  o1= rp * o1; o2= rp * o2;
}