edit_main_rep::edit_main_rep (server_rep* sv, tm_buffer buf): editor_rep (sv, buf), props (UNKNOWN), ed_obs (edit_observer (this)) { #ifdef EXPERIMENTAL cct= copy (subtree (et, rp)); copy_ip (subtree (et, rp), cct); #endif attach_observer (subtree (et, rp), ed_obs); notify_change (THE_TREE); tp= correct_cursor (et, rp * 0); }
void edit_typeset_rep::typeset_exec_until (path p) { //time_t t1= texmacs_time (); if (has_changed (THE_TREE + THE_ENVIRONMENT)) if (p != correct_cursor (et, rp * 0)) { if (DEBUG_STD) std_warning << "resynchronizing for path " << p << "\n"; // apply_changes (); } if (p == tp && inside_graphics (true) && p != closest_inside (et, p)) { //cout << "TeXmacs] Warning: corrected cursor\n"; tp= closest_inside (et, tp); p = tp; } //cout << "Exec until " << p << LF; if (N(cur[p])!=0) return; if (N(cur)>=25) // avoids out of memory in weird cases typeset_invalidate_env (); typeset_prepare (); if (enable_fastenv) { if (!(rp < p)) { failed_error << "Erroneous path " << p << "\n"; FAILED ("invalid typesetting path"); } tree t= subtree (et, rp); path q= path_up (p / rp); while (!is_nil (q)) { int i= q->item; restricted_exec (env, t, i); tree w= drd->get_env_child (t, i, tree (ATTR)); if (w == "") break; //cout << "t= " << t << "\n"; //cout << "i= " << i << "\n"; //cout << "w= " << w << "\n"; for (int j=0; j<N(w); j+=2) { //cout << w[j] << " := " << env->exec (w[j+1]) << "\n"; env->write (w[j]->label, env->exec (w[j+1])); } t= t[i]; q= q->next; } if (env->read (PREAMBLE) == "true") env->write (MODE, "src"); } else exec_until (ttt, p / rp); env->read_env (cur (p)); //time_t t2= texmacs_time (); //if (t2 - t1 >= 10) cout << "typeset_exec_until took " << t2-t1 << "ms\n"; }
path edit_cursor_rep::tree_path (path sp, SI x, SI y, SI delta) { path stp= find_scrolled_tree_path (eb, sp, x, y, delta); path p= correct_cursor (et, stp /*, searching_forwards */); return make_cursor_accessible (p, searching_forwards); }