]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/grob-pq-engraver.cc (stop_translation_timestep): save up
authorhanwen <hanwen>
Tue, 19 Jul 2005 14:06:36 +0000 (14:06 +0000)
committerhanwen <hanwen>
Tue, 19 Jul 2005 14:06:36 +0000 (14:06 +0000)
all acknowledged grobs, and do potentially expensive merge and
write in one go.

* buildscripts/mf-to-table.py (write_fontlist): enforce noBreak.

ChangeLog
buildscripts/mf-to-table.py
lily/forbid-break-engraver.cc
lily/grob-pq-engraver.cc
lily/system.cc

index a6fe2bb27f5d4bae554df9dec55c1439bb6361d9..90dc1cbdb6ebde30edcf404338ccd0e6c9776bc6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-07-19  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/grob-pq-engraver.cc (stop_translation_timestep): save up
+       all acknowledged grobs, and do potentially expensive merge and
+       write in one go.
+
+       * buildscripts/mf-to-table.py (write_fontlist): enforce noBreak.
+
        * configure.in (reloc_b): add --enable-static-gxx to statically
        link to libstdc++
 
index c51b9a276a72a94efcc65eccd24048a1f496a2cc..4a663b73dfc5f587a61aaf21095e70dd326b790a 100644 (file)
@@ -211,7 +211,9 @@ r"""%% LilyPond file to list all font symbols and the corresponding names
 
                file.write ('''    \\markup { \\raise #0.75 \\vcenter
              \\musicglyph #"%s"
-             \\typewriter " %s" } 4\n''' % (scm_string, scm_string))
+             \\typewriter " %s" } 4
+             \\noBreak
+             ''' % (scm_string, scm_string))
 
                if (count % per_line) == 0:
                        file.write ('    \\skip 8 \\break\n')
index c51e0b0ff5d8ad702eb5b44a357a5bc87fdbe8f4..0ba34fec52818234c12a7b4e0280a68ae154f738 100644 (file)
@@ -13,6 +13,8 @@
 #include "duration.hh"
 #include "moment.hh"
 
+#include "translator.icc"
+
 class Forbid_line_break_engraver : public Engraver
 {
 public:
@@ -20,7 +22,9 @@ public:
   PRECOMPUTED_VIRTUAL void start_translation_timestep ();
 };
 
-Forbid_line_break_engraver::Forbid_line_break_engraver (){}
+Forbid_line_break_engraver::Forbid_line_break_engraver ()
+{
+}
 
 void
 Forbid_line_break_engraver::start_translation_timestep ()
@@ -37,7 +41,7 @@ Forbid_line_break_engraver::start_translation_timestep ()
   while (scm_is_pair (busy))
     {
       Grob *g = unsmob_grob (scm_cdar (busy));
-      if (Rhythmic_head::has_interface (g))
+      if (g->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface")))
        {
          get_score_engraver ()->forbid_breaks ();
        }
@@ -45,7 +49,6 @@ Forbid_line_break_engraver::start_translation_timestep ()
     }
 }
 
-#include "translator.icc"
 
 ADD_TRANSLATOR (Forbid_line_break_engraver,
                /* descr */ "Forbid line breaks when note heads are still playing at some point.",
index 08def8d83be11d20ffbf08fc4c42bfada4c9d42e..60327dc7b622c46ac7d6a0baa41a8611adf1ff60 100644 (file)
 #include "grob.hh"
 #include "warn.hh"
 
+struct Grob_pq_entry
+{
+  Grob *grob_;
+  Moment end_;
+  static int compare (Grob_pq_entry const &a,
+                     Grob_pq_entry const &b)
+  {
+    return Moment::compare (a.end_, b.end_);
+  }
+};
+
 class Grob_pq_engraver : public Engraver
 {
 public:
@@ -20,6 +31,8 @@ protected:
   virtual void acknowledge_grob (Grob_info);
   PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+
+  Array<Grob_pq_entry> started_now_;
 };
 
 Grob_pq_engraver::Grob_pq_engraver ()
@@ -64,13 +77,12 @@ Grob_pq_engraver::acknowledge_grob (Grob_info gi)
        }
 
       Moment end = n + l;
-      SCM lst = scm_acons (end.smobbed_copy (),
-                          gi.grob ()->self_scm (),
-                          SCM_EOL);
 
-      SCM busy = get_property ("busyGrobs");
-      busy = scm_merge_x (lst, busy, ly_grob_pq_less_p_proc);
-      context ()->set_property ("busyGrobs", busy);
+      Grob_pq_entry e;
+      e.grob_ = gi.grob ();
+      e.end_ = end;
+      
+      started_now_.push (e);
     }
 }
 
@@ -85,8 +97,21 @@ Grob_pq_engraver::stop_translation_timestep ()
       busy = scm_cdr (busy);
     }
 
-  if (start_busy != busy)
-    context ()->set_property ("busyGrobs", busy);
+  started_now_.sort (Grob_pq_entry::compare);
+  SCM lst = SCM_EOL;
+  SCM *tail = &lst;
+  for (int i = 0; i < started_now_.size (); i++)
+    {
+      *tail = scm_acons (started_now_[i].end_.smobbed_copy (),
+                        started_now_[i].grob_->self_scm (),
+                        SCM_EOL);
+      tail = SCM_CDRLOC(*tail);
+    }
+  
+  busy = scm_merge_x (lst, busy, ly_grob_pq_less_p_proc);
+  context ()->set_property ("busyGrobs", busy);
+
+  started_now_.clear ();
 }
 
 void
@@ -113,13 +138,9 @@ Grob_pq_engraver::start_translation_timestep ()
 
 ADD_TRANSLATOR (Grob_pq_engraver,
 
-               /* descr */ "Administrate when certain grobs (eg. note heads) stop playing; this \
-engraver is a sort-of a failure, since it doesn't handle all sorts of \
-borderline cases very well. \
-",
-
-               /* creats*/ "",\
-               /* accepts */ "",\
-               /* acks  */ "grob-interface",\
-               /* reads */ "busyGrobs",\
+               /* descr */ "Administrate when certain grobs (eg. note heads) stop playing",
+               /* creats*/ "",
+               /* accepts */ "",
+               /* acks  */ "grob-interface",
+               /* reads */ "busyGrobs",
                /* write */ "busyGrobs");
index 898e07871d62bdec8ee23141f24a43a50bf8a97b..115ab8720c6f11e3460a44773a8260c0eb5ac7f9 100644 (file)
@@ -310,7 +310,9 @@ System::post_processing ()
 
   Interval iv (extent (this, Y_AXIS));
   if (iv.is_empty ())
-    programming_error ("system with zero extent");
+    {
+      programming_error ("system with empty extent");
+    }
   else
     translate_axis (-iv[MAX], Y_AXIS);