From: hanwen Date: Tue, 19 Jul 2005 14:06:36 +0000 (+0000) Subject: * lily/grob-pq-engraver.cc (stop_translation_timestep): save up X-Git-Tag: release/2.7.2~17 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=fd4522d89c6edbab6382f5bf2dfa9b3fc1397e0d;p=lilypond.git * 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. --- diff --git a/ChangeLog b/ChangeLog index a6fe2bb27f..90dc1cbdb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2005-07-19 Han-Wen Nienhuys + * 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++ diff --git a/buildscripts/mf-to-table.py b/buildscripts/mf-to-table.py index c51b9a276a..4a663b73df 100644 --- a/buildscripts/mf-to-table.py +++ b/buildscripts/mf-to-table.py @@ -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') diff --git a/lily/forbid-break-engraver.cc b/lily/forbid-break-engraver.cc index c51e0b0ff5..0ba34fec52 100644 --- a/lily/forbid-break-engraver.cc +++ b/lily/forbid-break-engraver.cc @@ -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.", diff --git a/lily/grob-pq-engraver.cc b/lily/grob-pq-engraver.cc index 08def8d83b..60327dc7b6 100644 --- a/lily/grob-pq-engraver.cc +++ b/lily/grob-pq-engraver.cc @@ -11,6 +11,17 @@ #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 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"); diff --git a/lily/system.cc b/lily/system.cc index 898e07871d..115ab8720c 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -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);