~ubuntu-branches/ubuntu/quantal/texmacs/quantal

« back to all changes in this revision

Viewing changes to src/Edit/Editor/edit_typeset.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Atsuhito KOHDA
  • Date: 2010-04-23 07:09:40 UTC
  • mfrom: (4.1.8 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100423070940-72mjdmdepfgrvo8f
Tags: 1:1.0.7.4-2
Re-upload, former upload failed with wrong diff.gz perhaps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#endif // EXPERIMENTAL
22
22
 
23
23
//box empty_box (path ip, int x1=0, int y1=0, int x2=0, int y2=0);
 
24
bool enable_fastenv= false;
24
25
 
25
26
/******************************************************************************
26
27
* Contructors, destructors and notification of modifications
182
183
 
183
184
void
184
185
edit_typeset_rep::typeset_exec_until (path p) {
 
186
  //time_t t1= texmacs_time ();
185
187
  if (has_changed (THE_TREE + THE_ENVIRONMENT))
186
188
    if (p != correct_cursor (et, rp * 0)) {
187
189
      if (DEBUG_STD)
192
194
  if (N(cur)>=25) // avoids out of memory in weird cases
193
195
    typeset_invalidate_env ();
194
196
  typeset_prepare ();
195
 
  exec_until (ttt, p / rp);
 
197
  if (enable_fastenv) {
 
198
    tree t= subtree (et, rp);
 
199
    path q= path_up (p / rp);
 
200
    while (!is_nil (q)) {
 
201
      int i= q->item;
 
202
      tree w= drd->get_env_child (t, i, tree (WITH));
 
203
      if (w == "") break;
 
204
      //cout << "w= " << w << "\n";
 
205
      for (int j=0; j<N(w); j+=2) {
 
206
        //cout << w[j] << " := " << env->exec (w[j+1]) << "\n";
 
207
        env->write (w[j]->label, env->exec (w[j+1]));
 
208
      }
 
209
      t= t[i];
 
210
      q= q->next;
 
211
    }
 
212
  }
 
213
  else exec_until (ttt, p / rp);
196
214
  env->read_env (cur (p));
 
215
  //time_t t2= texmacs_time ();
 
216
  //if (t2 - t1 >= 10) cout << "typeset_exec_until took " << t2-t1 << "ms\n";
197
217
}
198
218
 
199
219
bool
475
495
 
476
496
void
477
497
edit_typeset_rep::typeset (SI& x1, SI& y1, SI& x2, SI& y2) {
 
498
  //time_t t1= texmacs_time ();
478
499
  typeset_prepare ();
479
500
  eb= empty_box (reverse (rp));
480
501
  // saves memory, also necessary for change_log update
481
502
  bench_start ("typeset");
482
503
  eb= ::typeset (ttt, x1, y1, x2, y2);
483
504
  bench_end ("typeset");
 
505
  //time_t t2= texmacs_time ();
 
506
  //if (t2 - t1 >= 12) cout << "typeset took " << t2-t1 << "ms\n";
484
507
}
485
508
 
486
509
void
487
510
edit_typeset_rep::typeset_invalidate (path p) {
488
511
  if (rp <= p) {
 
512
    //cout << "Invalidate " << p << "\n";
489
513
    notify_change (THE_TREE);
490
514
    ::notify_assign (ttt, p / rp, subtree (et, p));
491
515
  }
493
517
 
494
518
void
495
519
edit_typeset_rep::typeset_invalidate_all () {
 
520
  //cout << "Invalidate all\n";
496
521
  notify_change (THE_ENVIRONMENT);
497
522
  typeset_preamble ();
498
523
  ::notify_assign (ttt, path(), subtree (et, rp));