From 736088f09a0b77acc84f6e1a54cddb8bad3d94c1 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 25 May 2000 00:20:46 +0200 Subject: [PATCH] release: 1.3.54 ========== * Bugfix: don't crash on tuplet spanners that don't contain any notes. * Small cleanup of Dimension_cache: removed a few redundant fields. Slightly lower memory usage. Dimension_cache is now a `dumb' struct again. * Add array index to priority field of text scripts to ensure that order is unique, and sensible. * Added an element count statistic. 1.3 --- AUTHORS.txt | 5 +- CHANGES | 17 +++ Documentation/regression-test.tely | 6 +- Documentation/topdocs/AUTHORS.texi | 10 +- VERSION | 2 +- lily/align-interface.cc | 16 +-- lily/align-note-column-engraver.cc | 4 +- lily/axis-group-engraver.cc | 2 +- lily/axis-group-interface.cc | 12 +- lily/bar-engraver.cc | 17 +-- lily/bezier-bow.cc | 8 -- lily/bezier.cc | 2 +- lily/break-align-engraver.cc | 2 +- lily/dimension-cache.cc | 104 +--------------- lily/dot-column-engraver.cc | 4 +- lily/dot-column.cc | 2 +- lily/dynamic-engraver.cc | 12 +- lily/extender-spanner.cc | 2 +- lily/grace-position-engraver.cc | 4 +- lily/hyphen-spanner.cc | 2 +- lily/include/align-interface.hh | 4 +- lily/include/axis-group-interface.hh | 2 +- lily/include/dimension-cache-callback.hh | 6 +- lily/include/dimension-cache.hh | 40 ++---- lily/include/item.hh | 2 +- lily/include/line-of-score.hh | 2 +- lily/include/score-element-callback.hh | 2 +- lily/include/score-element.hh | 53 ++++---- lily/include/side-position-interface.hh | 11 +- lily/include/span-bar.hh | 2 +- lily/include/staff-symbol-referencer.hh | 2 +- lily/include/stem-tremolo.hh | 2 +- lily/include/stem.hh | 6 +- lily/item.cc | 6 +- lily/lily-guile.cc | 8 -- lily/line-of-score.cc | 24 +++- lily/local-key-engraver.cc | 10 +- lily/paper-outputter.cc | 27 +--- lily/paper-score.cc | 6 +- lily/piano-pedal-engraver.cc | 2 +- lily/score-element.cc | 149 ++++++++++++++--------- lily/script-column-engraver.cc | 4 +- lily/script-engraver.cc | 9 +- lily/side-position-interface.cc | 35 ++---- lily/span-bar.cc | 10 +- lily/staff-symbol-referencer.cc | 7 +- lily/stem-tremolo.cc | 4 +- lily/stem.cc | 8 +- lily/system-start-delimiter.cc | 2 +- lily/text-engraver.cc | 12 +- lily/timing-engraver.cc | 18 --- lily/transposed-music.cc | 4 +- lily/tuplet-spanner.cc | 3 + lily/volta-spanner.cc | 8 +- make/out/lilypond.lsm | 8 +- make/out/lilypond.spec | 4 +- 56 files changed, 301 insertions(+), 434 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 83bef5a611..b0453ea529 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -58,7 +58,7 @@ list is alphabetically ordered. `http://www.iro.umontreal.ca/~pinard/' parts of Documentation/Vocab*, started internationalization stuff - * Stephen Peters , pdfTeX support + * Stephen Peters , pdfTeX support * Glen Prideaux , minor bug fix to script used to generate doc++ documentation @@ -70,6 +70,5 @@ list is alphabetically ordered. * Shay Rojanski Some mudela source. - Your name could be here! If you want to fix something, do it, and -send us a patch! + * August S.Sigov Russian translation diff --git a/CHANGES b/CHANGES index 5e4b8ca693..496aaedfee 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,22 @@ +1.3.53.uu1 +========== + +* Bugfix: don't crash on tuplet spanners that don't contain any notes. + +* Small cleanup of Dimension_cache: removed a few redundant +fields. Slightly lower memory usage. Dimension_cache is now a `dumb' +struct again. + +* Add array index to priority field of text scripts to ensure that +order is unique, and sensible. + +* Added an element count statistic. + 1.3.53 ====== + +* russian.po (thank you, August.) + * Small cleanups in Molecule interface * Spacing related elements perform suicide after calculating diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index 0b12f68e14..83848bfbdf 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -222,7 +222,8 @@ Folded. This doesn't make sense without alternatives, but it works. @mudelafile{repeat-fold.ly} -Across linebreaks, first and second bracket should be equal +Across linebreaks, the left edge of a first and second alternative +bracket should be equal @mudelafile{repeat-line-break.ly} @@ -379,7 +380,8 @@ signatures. @section Hacks and Features -As a last resort, the placement of items can be adjusted manually. +As a last resort, the placement of items can be adjusted manually, by +setting the @code{extra-offset} of an output object. @mudelafile{generic-output-property.ly} diff --git a/Documentation/topdocs/AUTHORS.texi b/Documentation/topdocs/AUTHORS.texi index 4a37c46e0f..9c0ce77848 100644 --- a/Documentation/topdocs/AUTHORS.texi +++ b/Documentation/topdocs/AUTHORS.texi @@ -60,19 +60,19 @@ list is alphabetically ordered. @uref{http://www.iro.umontreal.ca/~pinard/} parts of Documentation/Vocab*, started internationalization stuff @c urg: @c,{} in @email{} barfs. -@item @email{portnoy@@ai.mit.edu,Stephen Peters}, pdfTeX support +@item @email{portnoy@@ai.mit.edu,Stephen Peters}, + pdfTeX support @item @email{glenprideaux@@iname.com, Glen Prideaux}, minor bug fix to script used to generate doc++ documentation @item @email{Roy.Rankin@@alcatel.com.au, Roy R. Rankin}, major extension, fixes to abc2ly, lilypond bug fixes @item @email{daboys@@austin.rr.com, Jeffrey B. Reed}, Windows-NT support. + @item Shay Rojanski Some mudela source. +@item @email{august@@infran.ru, August S.Sigov} + Russian translation @end itemize -Your name could be here! If you want to fix something, do it, and send -us a patch! - - @bye diff --git a/VERSION b/VERSION index 9913331784..c3ec2ace94 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 -PATCH_LEVEL=53 +PATCH_LEVEL=54 MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 30e9fda247..af9089b0eb 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -18,28 +18,25 @@ not compute anything, but a side effect of a->do_side_processing () is that the elements are placed correctly. */ Real -Align_interface::alignment_callback (Dimension_cache const *c) +Align_interface::alignment_callback (Score_element const *sc, Axis ax) { - Axis ax = c->axis (); - Score_element * sc = c->element_l ()->parent_l (ax); - - if (sc && sc->get_elt_property ("alignment-done") == SCM_UNDEFINED) + Score_element * par = sc->parent_l (ax); + if (par && par->get_elt_property ("alignment-done") == SCM_UNDEFINED) { - Align_interface (sc).do_side_processing (ax); + Align_interface (par).do_side_processing (ax); } return 0.0; } Real -Align_interface::center_on_element (Dimension_cache const *c) +Align_interface::center_on_element (Score_element const *me, Axis a) { - Score_element *me = c->element_l (); Score_element *cent = unsmob_element (me->get_elt_property ("group-center-element")); if (cent) { - Real r = cent->relative_coordinate (me, c->axis ()); + Real r = cent->relative_coordinate (me, a); return -r; } return 0; @@ -154,7 +151,6 @@ Align_interface::add_element (Score_element* s) { s->add_offset_callback (alignment_callback, axis ()); Axis_group_interface (elt_l_).add_element (s); - } Align_interface::Align_interface (Score_element const*s) diff --git a/lily/align-note-column-engraver.cc b/lily/align-note-column-engraver.cc index a184e36131..dff753effc 100644 --- a/lily/align-note-column-engraver.cc +++ b/lily/align-note-column-engraver.cc @@ -46,8 +46,8 @@ void Align_note_column_engraver::do_creation_processing () { align_item_p_ = new Grace_align_item; - side_position (align_item_p_).set_axis (X_AXIS); - side_position (align_item_p_).set_direction (LEFT); + Side_position_interface (align_item_p_).set_axis (X_AXIS); + Side_position_interface (align_item_p_).set_direction (LEFT); // needed for setting font size. announce_element (Score_element_info (align_item_p_, 0)); } diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index a674757cbe..4639b176a9 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -43,7 +43,7 @@ Axis_group_engraver::do_removal_processing () if (gh_pair_p (dims) && gh_number_p (gh_car (dims)) && gh_number_p (gh_cdr (dims))) { - staffline_p_->dim_cache_[Y_AXIS]->set_extent_callback (&Score_element::preset_extent); + staffline_p_->set_extent_callback (&Score_element::preset_extent, Y_AXIS); staffline_p_->set_elt_property ("extent-Y", dims); } diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index e7dcde019b..06e7436685 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -46,7 +46,7 @@ Axis_group_interface::add_element (Score_element *e) bool Axis_group_interface::axis_b (Axis a )const { - return elt_l_->dim_cache_[a]->extent_callback_l_ == group_extent_callback; + return elt_l_->has_extent_callback_b (group_extent_callback, a); } Interval @@ -64,11 +64,9 @@ Axis_group_interface::relative_group_extent (Axis a, Score_element *common, SCM } Interval -Axis_group_interface::group_extent_callback (Dimension_cache const *c) +Axis_group_interface::group_extent_callback (Score_element const*me, Axis a) { - Axis a = c->axis (); - Score_element * me = c->element_l (); - Score_element * common = me; + Score_element * common =(Score_element*) me; for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s)) { @@ -111,8 +109,8 @@ Axis_group_interface::set_axes (Axis a1, Axis a2) if (a1 != Y_AXIS && a2 != Y_AXIS) elt_l_->set_extent_callback (0, Y_AXIS); - elt_l_->dim_cache_[a1]->set_extent_callback (Axis_group_interface::group_extent_callback); - elt_l_->dim_cache_[a2]->set_extent_callback (Axis_group_interface::group_extent_callback); + elt_l_->set_extent_callback (Axis_group_interface::group_extent_callback,a1); + elt_l_->set_extent_callback (Axis_group_interface::group_extent_callback,a2); } Link_array diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index c14198a0d2..2a8c2ae66d 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -32,26 +32,15 @@ Bar_engraver::create_bar () bar_p_->set_elt_property ("break-align-symbol", ly_symbol2scm ("Staff_bar")); // urg: "" != empty... + /* + TODO: use symbol. + */ SCM default_type = get_property ("defaultBarType"); if (gh_string_p (default_type)) { bar_p_->set_elt_property ("glyph", default_type); // ugh } -#if 0 - /* - urg. Why did I implement this? And did I implement this so - clumsily? - - input/test/just-friends.ly - Maybe a staffgroup of just one staff would be a better solution. - */ - SCM prop = get_property ("barAtLineStart"); - if (to_boolean (prop)) - { - bar_p_->set_elt_property ("at-line-start", SCM_BOOL_T); - } -#endif announce_element (Score_element_info (bar_p_, 0)); } } diff --git a/lily/bezier-bow.cc b/lily/bezier-bow.cc index 0a51f93614..8a92e9ddf4 100644 --- a/lily/bezier-bow.cc +++ b/lily/bezier-bow.cc @@ -102,20 +102,12 @@ Bezier_bow::get_default_bezier (Real h_inf, Real r_0) const Real Bezier_bow::get_default_height (Real h_inf, Real r_0, Real b) const { -#if 0 - Real pi = M_PI; - Real alpha = 2.0 * h_inf / pi; - Real beta = pi * r_0 / (2.0 * h_inf); - - return alpha * atan (beta * b); -#else SCM h = scm_eval (scm_listify (ly_symbol2scm ("slur-default-height"), gh_double2scm (h_inf), gh_double2scm (r_0), gh_double2scm (b), SCM_UNDEFINED)); return gh_scm2double (h); -#endif } diff --git a/lily/bezier.cc b/lily/bezier.cc index e7f02063f6..3e1e875a6d 100644 --- a/lily/bezier.cc +++ b/lily/bezier.cc @@ -9,7 +9,7 @@ #include #include "config.h" - +#include "libc-extension.hh" #include "bezier.hh" #include "polynomial.hh" diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index 9f2047dfda..c358df46c4 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -110,7 +110,7 @@ Break_align_engraver::acknowledge_element (Score_element_info inf) TODO: switch off ignoring empty stuff? */ - edge->dim_cache_[X_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback); + edge->set_extent_callback (Score_element::point_dimension_callback,X_AXIS); align_l_->set_elt_property ("group-center-element", edge->self_scm_); diff --git a/lily/dimension-cache.cc b/lily/dimension-cache.cc index ad4c630c0a..96a51cde5a 100644 --- a/lily/dimension-cache.cc +++ b/lily/dimension-cache.cc @@ -7,7 +7,6 @@ */ #include #include "warn.hh" - #include "dimension-cache.hh" #include "parray.hh" #include "score-element.hh" @@ -17,9 +16,7 @@ Dimension_cache::Dimension_cache (Dimension_cache const &d) { init(); extent_callback_l_ = d.extent_callback_l_; - basic_offset_ = d.basic_offset_; - extra_offset_ = d.extra_offset_; - off_valid_b_ = d.off_valid_b_; + offset_ = d.offset_; off_callbacks_ = d.off_callbacks_; parent_l_ = d.parent_l_; } @@ -33,112 +30,17 @@ void Dimension_cache::init() { extent_callback_l_ =0; - basic_offset_ =0.0; - extra_offset_ =0.0; + offset_ =0.0; + offset_ =0.0; - elt_l_ = 0; dim_.set_empty (); parent_l_ =0; valid_b_ = false; - off_valid_b_ = false; -} - - -void -Dimension_cache::translate (Real x) -{ - extra_offset_ += x; -} - -Real -Dimension_cache::relative_coordinate (Dimension_cache *refp) const -{ - if (refp == this) - return 0.0; - - /* - We catch PARENT_L_ == nil case with this, but we crash if we did - not ask for the absolute coordinate (ie. REFP == nil.) - - */ - if (refp == parent_l_) - return get_offset (); - else - return get_offset () + parent_l_->relative_coordinate (refp); -} - -Axis -Dimension_cache::axis () const -{ - if (elt_l_-> dim_cache_[X_AXIS] == this) - return X_AXIS; - else - return Y_AXIS; } -Real -Dimension_cache::get_offset () const -{ - Dimension_cache *me = (Dimension_cache*) this; - while (off_callbacks_.size ()) - { - Offset_cache_callback c = me->off_callbacks_[0]; - me->off_callbacks_.del (0); - Real r = (*c) (me); - if (isinf (r) || isnan (r)) - { - r = 0.0; - programming_error ("Infinity or NaN encountered"); - } - me->basic_offset_ +=r; - } - return basic_offset_ + extra_offset_; -} -Dimension_cache * -Dimension_cache::common_refpoint (Dimension_cache const* s) const -{ - /* - I don't like the quadratic aspect of this code. Maybe this should - be rewritten some time, but the largest chain of parents might be - 10 high or so, so it shouldn't be a real issue. */ - for (Dimension_cache const *c = this; c; c = c->parent_l_) - for (Dimension_cache const * d = s; d; d = d->parent_l_) - if (d == c) - return (Dimension_cache*)d; - return 0; -} -Interval -Dimension_cache::point_dimension_callback (Dimension_cache const* ) -{ - return Interval (0,0); -} -Interval -Dimension_cache::get_dim () const -{ - Interval r; - Dimension_cache *nc = ((Dimension_cache*)this); - if (!extent_callback_l_) - { - nc->dim_.set_empty (); - } - else if (!valid_b_) - { - nc->dim_= (*extent_callback_l_ ) (nc); - nc->valid_b_ = true; - } - - r=dim_; - return r; -} - -void -Dimension_cache::set_extent_callback (Dim_cache_callback c) -{ - extent_callback_l_ =c; -} diff --git a/lily/dot-column-engraver.cc b/lily/dot-column-engraver.cc index 675574b034..5c2cfd49c4 100644 --- a/lily/dot-column-engraver.cc +++ b/lily/dot-column-engraver.cc @@ -41,8 +41,8 @@ Dot_column_engraver::acknowledge_element (Score_element_info info) if (!dotcol_p_) { dotcol_p_ = new Dot_column; - side_position (dotcol_p_).set_axis (X_AXIS); - side_position (dotcol_p_).set_direction (RIGHT); + Side_position_interface (dotcol_p_).set_axis (X_AXIS); + Side_position_interface (dotcol_p_).set_direction (RIGHT); announce_element (Score_element_info (dotcol_p_, 0)); } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 2dc724e9f6..75f8391fe9 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -33,7 +33,7 @@ Dot_column::add_head (Rhythmic_head *r) if (!r->dots_l ()) return ; - side_position (this).add_support (r); + Side_position_interface (this).add_support (r); add_dots (r->dots_l ()); } diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 019ef105db..9a8675caee 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -48,7 +48,7 @@ public: Dynamic_line_spanner::Dynamic_line_spanner () { set_elt_property ("transparent", SCM_BOOL_T); - side_position (this).set_axis (Y_AXIS); + Side_position_interface (this).set_axis (Y_AXIS); Axis_group_interface (this).set_interface (); Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS); } @@ -222,8 +222,8 @@ Dynamic_engraver::do_process_music () for (int i = 0; i < pending_element_arr_.size (); i++) { Score_element* e = pending_element_arr_[i]; - side_position (e).set_axis (Y_AXIS); - side_position (e).add_staff_support (); + Side_position_interface (e).set_axis (Y_AXIS); + Side_position_interface (e).add_staff_support (); /* UGH UGH @@ -388,7 +388,7 @@ Dynamic_engraver::do_removal_processing () typeset_all (); if (line_spanner_) { - side_position (line_spanner_).add_staff_support (); + Side_position_interface (line_spanner_).add_staff_support (); typeset_element (line_spanner_); line_spanner_ = 0; } @@ -410,7 +410,7 @@ Dynamic_engraver::typeset_all () } if (finished_line_spanner_) { - side_position (finished_line_spanner_).add_staff_support (); + Side_position_interface (finished_line_spanner_).add_staff_support (); typeset_element (finished_line_spanner_); finished_line_spanner_ = 0; } @@ -423,7 +423,7 @@ Dynamic_engraver::acknowledge_element (Score_element_info i) { if (line_spanner_) { - side_position (line_spanner_).add_support (n); + Side_position_interface (line_spanner_).add_support (n); line_spanner_->add_column (n); } else diff --git a/lily/extender-spanner.cc b/lily/extender-spanner.cc index 5f0a9d2dae..4c1dedbcd6 100644 --- a/lily/extender-spanner.cc +++ b/lily/extender-spanner.cc @@ -24,7 +24,7 @@ Extender_spanner::Extender_spanner () : Spanner () { dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0; - dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback); + set_extent_callback (Score_element::point_dimension_callback, Y_AXIS); } diff --git a/lily/grace-position-engraver.cc b/lily/grace-position-engraver.cc index 3805612e1c..170d7b0350 100644 --- a/lily/grace-position-engraver.cc +++ b/lily/grace-position-engraver.cc @@ -66,7 +66,7 @@ Grace_position_engraver::process_acknowledged () if (align_l_) { for (int i=0; i < support_.size (); i++) - side_position (align_l_).add_support (support_[i]); + Side_position_interface (align_l_).add_support (support_[i]); support_.clear (); } } @@ -74,7 +74,7 @@ Grace_position_engraver::process_acknowledged () void Grace_position_engraver::do_pre_move_processing () { - if (align_l_ && !side_position (align_l_).supported_b ()) + if (align_l_ && !Side_position_interface (align_l_).supported_b ()) { /* We don't have support. Either some moron tried attaching us to a rest, diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index d1429698a3..acc40be05a 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -27,7 +27,7 @@ Hyphen_spanner::Hyphen_spanner () { dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0; - dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback); + set_extent_callback (Score_element::point_dimension_callback,Y_AXIS); } Molecule diff --git a/lily/include/align-interface.hh b/lily/include/align-interface.hh index ad9d51f876..c9e42d7be1 100644 --- a/lily/include/align-interface.hh +++ b/lily/include/align-interface.hh @@ -38,7 +38,7 @@ struct Align_interface { Score_element * elt_l_; Align_interface (Score_element const*); - static Real alignment_callback (Dimension_cache const *); + static Real alignment_callback (Score_element const*,Axis); void do_side_processing (Axis a); void set_axis (Axis); Axis axis () const; @@ -46,7 +46,7 @@ struct Align_interface { int get_count (Score_element*)const; void set_interface (); bool has_interface_b (); - static Real center_on_element (Dimension_cache const *c); + static Real center_on_element (Score_element const *c, Axis); }; #endif /* ALIGN_INTERFACE_HH */ diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh index 7bacbf8ac3..3d72a99494 100644 --- a/lily/include/axis-group-interface.hh +++ b/lily/include/axis-group-interface.hh @@ -31,7 +31,7 @@ struct Axis_group_interface Score_element *elt_l_; Axis_group_interface (Score_element*); - static Interval group_extent_callback (Dimension_cache const*); + static Interval group_extent_callback (Score_element const*,Axis); static Interval relative_group_extent (Axis, Score_element * common, SCM list); void add_element (Score_element*); diff --git a/lily/include/dimension-cache-callback.hh b/lily/include/dimension-cache-callback.hh index b12dc1078d..6c58b1d2e9 100644 --- a/lily/include/dimension-cache-callback.hh +++ b/lily/include/dimension-cache-callback.hh @@ -10,9 +10,9 @@ #ifndef DIMENSION_CACHE_CALLBACK_HH #define DIMENSION_CACHE_CALLBACK_HH -class Dimension_cache; -typedef Interval (*Dim_cache_callback)(Dimension_cache const *); -typedef Real (*Offset_cache_callback)(Dimension_cache const *); + +typedef Interval (*Dim_cache_callback)(Score_element const *,Axis); +typedef Real (*Offset_callback)(Score_element const *,Axis); #endif /* DIMENSION_CACHE_CALLBACK_HH */ diff --git a/lily/include/dimension-cache.hh b/lily/include/dimension-cache.hh index a5033b7914..ca4fad3c16 100644 --- a/lily/include/dimension-cache.hh +++ b/lily/include/dimension-cache.hh @@ -20,7 +20,7 @@ /** Adminstration of offset dimension info. */ -class Dimension_cache +struct Dimension_cache { bool valid_b_; Interval dim_; @@ -28,47 +28,21 @@ class Dimension_cache The offset wrt. to the center of #parent_l_# */ - Real extra_offset_; - Real basic_offset_; - bool off_valid_b_; + Real offset_; - Score_element *elt_l_; - friend class Score_element; - void init (); - Array off_callbacks_; + + Array off_callbacks_; + /** What to call to find extent. Nil means empty. */ -public: Dim_cache_callback extent_callback_l_; - static Interval point_dimension_callback (Dimension_cache const* ); - Axis axis () const; - Real get_offset () const; - void set_extent_callback (Dim_cache_callback); - Dimension_cache * parent_l_; - - Score_element *element_l () const { return elt_l_; } + Score_element * parent_l_; Dimension_cache(Dimension_cache const&); Dimension_cache (); - - - /** - Find the offset relative to D. If D equals THIS, then it is 0. - Otherwise, it recursively defd as - - OFFSET_ + PARENT_L_->relative_coordinate (D) - */ - Real relative_coordinate (Dimension_cache *d) const; - Dimension_cache*common_refpoint (Dimension_cache const* s) const; - - void set_empty (bool); - void translate (Real); - - bool valid_b () const { return valid_b_; } - bool empty_b() const; - Interval get_dim () const; + void init (); }; diff --git a/lily/include/item.hh b/lily/include/item.hh index d92a67fb04..7d327628ed 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -55,7 +55,7 @@ public: virtual Paper_column * column_l () const; virtual void handle_prebroken_dependencies (); protected: - virtual void do_breakable_col_processing(); + virtual void discretionary_processing (); void copy_breakable_items(); }; diff --git a/lily/include/line-of-score.hh b/lily/include/line-of-score.hh index 2a0af1ab1f..2856aa04c5 100644 --- a/lily/include/line-of-score.hh +++ b/lily/include/line-of-score.hh @@ -42,7 +42,7 @@ public: /// is #c# contained in #*this#? bool contains_b (Paper_column const *c) const; - + int element_count () const; void break_into_pieces (Array const&); void output_lines (); diff --git a/lily/include/score-element-callback.hh b/lily/include/score-element-callback.hh index 949ceec254..fe588510e9 100644 --- a/lily/include/score-element-callback.hh +++ b/lily/include/score-element-callback.hh @@ -1,5 +1,5 @@ /* - score-element-callback.hh -- declare Score_element callbacks + score-element-callback.hh -- declare Score_element callbacks source file of the GNU LilyPond music typesetter diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 8c4b9aa3a0..e803d487fe 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -12,10 +12,10 @@ #include "lily-guile.hh" #include "lily-proto.hh" #include "smobs.hh" -#include "dimension-cache-callback.hh" - - +#include "dimension-cache.hh" +typedef Interval (*Extent_callback)(Score_element const *,Axis); +typedef Real (*Offset_callback)(Score_element const *,Axis); /** @@ -85,12 +85,16 @@ public: bool used_b_; char const * name () const; - + + /* + IDEA: make this a global variable. This is the same for all + elements, I think it is safe to assume that we will not have + scores being formatted multithreadedly. + */ Paper_score *pscore_l_; Score_element (); Score_element (Score_element const&); - virtual void print () const; /* properties @@ -115,9 +119,6 @@ public: */ SCM remove_elt_property (String nm); - void Score_element::set_real (String, Real); - Real Score_element::get_real (String s) const; - /* related classes. */ @@ -148,13 +149,12 @@ public: static SCM handle_broken_smobs (SCM, SCM criterion); - void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)()); virtual void do_break_processing (); virtual Score_element *find_broken_piece (Line_of_score*) const; /// generate rods & springs virtual void do_space_processing (); - virtual void do_breakable_col_processing (); + virtual void discretionary_processing (); /// do calculations before determining horizontal spacing virtual void before_line_breaking (); @@ -163,9 +163,10 @@ public: Molecule get_molecule () const; void suicide (); - - static Interval preset_extent (Dimension_cache const*); - static Interval molecule_extent (Dimension_cache const*); + + static Interval preset_extent (Score_element const*,Axis); + static Interval point_dimension_callback (Score_element const*,Axis ); + static Interval molecule_extent (Score_element const*,Axis); protected: @@ -174,13 +175,10 @@ protected: be handled by GUILE gc. */ virtual ~Score_element (); - /// do printing of derived info. - virtual void do_print () const; /// generate the molecule virtual Molecule do_brew_molecule () const; ///executed directly after the item is added to the Paper_score virtual void do_add_processing (); - static Interval dim_cache_callback (Dimension_cache const*); @@ -196,9 +194,9 @@ public: void init (); -public: - Dimension_cache *dim_cache_[NO_AXES]; + Dimension_cache dim_cache_[NO_AXES]; +public: bool empty_b (Axis a) const; Interval extent (Axis) const; @@ -208,6 +206,12 @@ public: void translate_axis (Real, Axis); + /** + Find the offset relative to D. If D equals THIS, then it is 0. + Otherwise, it recursively defd as + + OFFSET_ + PARENT_L_->relative_coordinate (D) + */ Real relative_coordinate (Score_element const* refp, Axis) const; /** Find the group-element which has both #this# and #s# @@ -215,10 +219,15 @@ public: Score_element*common_refpoint (Score_element const* s, Axis a) const; Score_element*common_refpoint (SCM elt_list, Axis a) const; - bool has_offset_callback_b (Offset_cache_callback, Axis)const; - void add_offset_callback (Offset_cache_callback, Axis); - void set_extent_callback (Dim_cache_callback , Axis); - + bool has_offset_callback_b (Offset_callback, Axis)const; + void add_offset_callback (Offset_callback, Axis); + bool has_extent_callback_b (Extent_callback, Axis)const; + void set_extent_callback (Extent_callback , Axis); + + /** + Invoke callbacks to get offset relative to parent. + */ + Real get_offset (Axis a) const; /** Set the parent refpoint of THIS to E */ diff --git a/lily/include/side-position-interface.hh b/lily/include/side-position-interface.hh index 839c088c2c..8ace8fcad8 100644 --- a/lily/include/side-position-interface.hh +++ b/lily/include/side-position-interface.hh @@ -39,11 +39,11 @@ struct Side_position_interface Score_element * elt_l_; public: Side_position_interface (Score_element const*); - static Real side_position (Dimension_cache const *); - static Real aligned_on_self (Dimension_cache const *); - static Real aligned_side (Dimension_cache const *); - static Real quantised_position (Dimension_cache const*); - static Real centered_on_parent (Dimension_cache const*); + static Real side_position (Score_element const *, Axis); + static Real aligned_on_self (Score_element const *, Axis); + static Real aligned_side (Score_element const *, Axis); + static Real quantised_position (Score_element const*, Axis); + static Real centered_on_parent (Score_element const*, Axis); void set_axis (Axis); void set_minimum_space (Real); void set_padding (Real); @@ -59,7 +59,6 @@ public: void set_direction (Direction); }; -Side_position_interface side_position (Score_element*); #endif /* SIDE_POSITION_INTERFACE_HH */ diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index 796df94a1c..ff5c6b0700 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -32,7 +32,7 @@ public: protected: void evaluate_empty (); - static Interval width_callback(Dimension_cache const*) ; + static Interval width_callback(Score_element const*, Axis) ; virtual Real get_bar_size () const; virtual void before_line_breaking (); diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index edd3263978..20311c8abb 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -26,7 +26,7 @@ public: void set_interface (); bool has_interface_b (); void set_position (Real); - static Real callback (Dimension_cache const*); + static Real callback (Score_element const*, Axis a); /** Leading are the lead strips between the sticks (lines) of diff --git a/lily/include/stem-tremolo.hh b/lily/include/stem-tremolo.hh index 2e963007e2..59ac84f3e1 100644 --- a/lily/include/stem-tremolo.hh +++ b/lily/include/stem-tremolo.hh @@ -18,7 +18,7 @@ protected: Stem * stem_l () const; virtual Molecule do_brew_molecule () const; - static Interval dim_callback (Dimension_cache const*); + static Interval dim_callback (Score_element*, Axis); public: Stem_tremolo (); void set_stem (Stem *); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 8eee7cee7e..d843a9846c 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -80,17 +80,17 @@ public: protected: friend class Stem_tremolo; // ugh. - Real get_default_stem_end_position () const; + Real get_default_stem_end_position () const; void position_noteheads(); Real stem_end_position () const; - static Real off_callback (Dimension_cache const*); + static Real off_callback (Score_element const*, Axis); protected: Molecule flag () const; virtual void before_line_breaking(); - static Interval dim_callback (Dimension_cache const*); + static Interval dim_callback (Score_element const*,Axis); virtual Molecule do_brew_molecule() const; void set_spacing_hints () ; diff --git a/lily/item.cc b/lily/item.cc index 8547dd9f1a..ed98073452 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -72,8 +72,12 @@ Item::broken_b () const return broken_to_drul_[LEFT] || broken_to_drul_[RIGHT]; } + +/* + Generate items for begin and end-of line. + */ void -Item::do_breakable_col_processing() +Item::discretionary_processing() { if (broken_b ()) return; diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index ebe2ff5b69..9f5b91fa93 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -31,15 +31,7 @@ ly_str02scm (char const*c) } -#if 0 -/* - this all really sucks, LilyPond should not communicate with GUILE using strings. - */ -SCM -ly_eval_str (String s); -#endif - /* Pass string to scm parser, evaluate one expression. Return result value and #chars read. diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 06b20f4e44..abc8b0a455 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -29,6 +29,13 @@ Line_of_score::Line_of_score() Axis_group_interface (this).set_axes (Y_AXIS,X_AXIS); } +int +Line_of_score::element_count () const +{ + return scm_ilength ( get_elt_property ("all-elements")); +} + + /* Ugh. this is grossly hairy. */ @@ -48,20 +55,21 @@ Line_of_score::output_lines () { unsmob_element (gh_car (s))->do_break_processing (); } - /* fixups must be done in broken line_of_scores, because new elements are put over there. */ + int count = 0; for (int i=0; i < broken_into_l_arr_.size (); i++) { Score_element *se = broken_into_l_arr_[i]; - - for (SCM s = se->get_elt_property ("all-elements"); - gh_pair_p (s); s = gh_cdr (s)) + SCM all = se->get_elt_property ("all-elements"); + for (SCM s = all; gh_pair_p (s); s = gh_cdr (s)) { unsmob_element (gh_car (s))->fixup_refpoint (); } + count += scm_ilength (all); } + /* needed for doing items. @@ -78,6 +86,8 @@ Line_of_score::output_lines () unsmob_element (gh_car (s))->handle_broken_dependencies (); } handle_broken_dependencies (); + progress_indication ( _f("Element count %d.", count + element_count())); + for (int i=0; i < broken_into_l_arr_.size (); i++) { @@ -214,7 +224,11 @@ void Line_of_score::pre_processing () { for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s)) - unsmob_element (gh_car (s))->do_breakable_col_processing (); + unsmob_element (gh_car (s))->discretionary_processing (); + + progress_indication ( _f("Element count %d ", element_count ())); + + for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s)) unsmob_element (gh_car (s))->handle_prebroken_dependencies (); diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index 2051672ebe..f917dc7e8a 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -125,8 +125,8 @@ Local_key_engraver::process_acknowledged () if (!key_item_p_) { key_item_p_ = new Local_key_item; - side_position (key_item_p_).set_axis (X_AXIS); - side_position (key_item_p_).set_direction (LEFT); + Side_position_interface (key_item_p_).set_axis (X_AXIS); + Side_position_interface (key_item_p_).set_direction (LEFT); staff_symbol_referencer(key_item_p_).set_interface (); announce_element (Score_element_info (key_item_p_, 0)); @@ -135,7 +135,7 @@ Local_key_engraver::process_acknowledged () key_item_p_->add_pitch (note_l->pitch_, note_l->cautionary_b_, local_key_.double_to_single_acc(note_l->pitch_)); - side_position (key_item_p_).add_support (support_l); + Side_position_interface (key_item_p_).add_support (support_l); } if (!forget) @@ -154,7 +154,7 @@ Local_key_engraver::process_acknowledged () } if (key_item_p_ && grace_align_l_) { - side_position (grace_align_l_).add_support (key_item_p_); + Side_position_interface (grace_align_l_).add_support (key_item_p_); grace_align_l_ =0; } @@ -172,7 +172,7 @@ Local_key_engraver::do_pre_move_processing() if (key_item_p_) { for (int i=0; i < support_l_arr_.size(); i++) - side_position (key_item_p_).add_support (support_l_arr_[i]); + Side_position_interface (key_item_p_).add_support (support_l_arr_[i]); typeset_element (key_item_p_); key_item_p_ =0; diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 3e2bcaa7d2..4999f0800e 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -34,11 +34,6 @@ Paper_outputter::Paper_outputter (Paper_stream * ps ) { -#if 0 - molecules_ = gh_cons (SCM_EOL, SCM_EOL); - last_cons_ = molecules_; -#endif - /* lilypond -f scm x.ly guile -s x.scm @@ -124,28 +119,14 @@ Paper_outputter::output_comment (String str) void Paper_outputter::output_scheme (SCM scm) { -#if 0 - SCM c = gh_cons (scm,gh_cdr (last_cons_)); - gh_set_cdr_x(last_cons_, c); - last_cons_ = c; -#endif - + /* + we don't rename dump_scheme, because we might in the future want + to remember Scheme. We don't now, because it sucks up a lot of memory. + */ dump_scheme (scm); } -#if 0 -void -Paper_outputter::dump () -{ - - for (SCM s = gh_cdr (molecules_); gh_pair_p (s); s = gh_cdr (s)) - { - dump_scheme (gh_car (s)); - } -} -#endif - void Paper_outputter::dump_scheme (SCM s) { diff --git a/lily/paper-score.cc b/lily/paper-score.cc index a398ccac79..7e3388fedf 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -1,5 +1,5 @@ /* - p-score.cc -- implement Paper_score + paper-score.cc -- implement Paper_score source file of the GNU LilyPond music typesetter @@ -67,6 +67,8 @@ Paper_score::calc_breaking () void Paper_score::process () { + progress_indication ( _f("Element count %d ", line_l_->element_count ())); + progress_indication (_ ("Preprocessing elements...") + " "); /* @@ -81,7 +83,6 @@ Paper_score::process () Array breaking = calc_breaking (); line_l_->break_into_pieces (breaking); - outputter_l_ = new Paper_outputter (paper_l_->paper_stream_p ()); ; @@ -114,7 +115,6 @@ Paper_score::process () scm = gh_list (ly_symbol2scm ("end-output"), SCM_UNDEFINED); outputter_l_->output_scheme (scm); - // huh? delete outputter_l_; outputter_l_ = 0; diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index be57de3d8b..216670ca30 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -225,7 +225,7 @@ Piano_pedal_engraver::do_pre_move_processing () { if (p->item_p_) { - side_position (p->item_p_).add_staff_support (); + Side_position_interface (p->item_p_).add_staff_support (); /* Hmm. */ diff --git a/lily/score-element.cc b/lily/score-element.cc index 86ef757802..9aeac9c546 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -8,7 +8,9 @@ #include +#include +#include "libc-extension.hh" #include "group-interface.hh" #include "misc.hh" #include "paper-score.hh" @@ -37,15 +39,11 @@ remove dynamic_cast and put this code into respective Score_element::Score_element() { - dim_cache_[X_AXIS] = new Dimension_cache; - dim_cache_[Y_AXIS] = new Dimension_cache; - dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this; - // junkme. used_b_ = false; + set_extent_callback (molecule_extent, X_AXIS); + set_extent_callback (molecule_extent, Y_AXIS); - dim_cache_[X_AXIS]->set_extent_callback (molecule_extent); - dim_cache_[Y_AXIS]->set_extent_callback (molecule_extent); used_b_ = false; pscore_l_=0; lookup_l_ =0; @@ -55,19 +53,14 @@ Score_element::Score_element() element_property_alist_ = SCM_EOL; smobify_self (); - - set_elt_property ("dependencies", SCM_EOL); set_elt_property ("interfaces", SCM_EOL); } Score_element::Score_element (Score_element const&s) + : dim_cache_ (s.dim_cache_) { - dim_cache_[X_AXIS] = new Dimension_cache (*s.dim_cache_[X_AXIS]); - dim_cache_[Y_AXIS] = new Dimension_cache (*s.dim_cache_[Y_AXIS]); - dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this; - self_scm_ = SCM_EOL; used_b_ = true; original_l_ =(Score_element*) &s; @@ -82,8 +75,6 @@ Score_element::Score_element (Score_element const&s) Score_element::~Score_element() { - delete dim_cache_[X_AXIS]; - delete dim_cache_[Y_AXIS]; } // should also have one that takes SCM arg. @@ -132,18 +123,16 @@ Score_element::set_elt_property (String k, SCM v) } Interval -Score_element::molecule_extent (Dimension_cache const *c) +Score_element::molecule_extent (Score_element const *s, Axis a ) { - Score_element *s = dynamic_cast(c->element_l()); Molecule m = s->do_brew_molecule(); - return m.extent(c->axis ()); + return m.extent(a); } Interval -Score_element::preset_extent (Dimension_cache const *c) +Score_element::preset_extent (Score_element const *s , Axis a ) { - Score_element *s = dynamic_cast(c->element_l()); - SCM ext = s->get_elt_property ((c->axis () == X_AXIS) + SCM ext = s->get_elt_property ((a == X_AXIS) ? "extent-X" : "extent-Y"); @@ -160,22 +149,6 @@ Score_element::preset_extent (Dimension_cache const *c) } -void -Score_element::print() const -{ -#ifndef NPRINT - DEBUG_OUT << classname(this) << "{\n"; - - if (flower_dstream && !flower_dstream->silent_b ("Score_element")) - ly_display_scm (element_property_alist_); - - if (original_l_) - DEBUG_OUT << "Copy "; - do_print(); - - DEBUG_OUT << "}\n"; -#endif -} Paper_def* Score_element::paper_l () const @@ -472,11 +445,6 @@ Score_element::linked_b() const return used_b_; } -void -Score_element::do_print () const -{ -} - Score_element* Score_element::find_broken_piece (Line_of_score*) const { @@ -486,31 +454,79 @@ Score_element::find_broken_piece (Line_of_score*) const void Score_element::translate_axis (Real y, Axis a) { - dim_cache_[a]->translate (y); + dim_cache_[a].offset_ += y; } Real -Score_element::relative_coordinate (Score_element const*e, Axis a) const +Score_element::relative_coordinate (Score_element const*refp, Axis a) const +{ + if (refp == this) + return 0.0; + + /* + We catch PARENT_L_ == nil case with this, but we crash if we did + not ask for the absolute coordinate (ie. REFP == nil.) + + */ + if (refp == dim_cache_[a].parent_l_) + return get_offset (a); + else + return get_offset (a) + dim_cache_[a].parent_l_->relative_coordinate (refp, a); +} + +Real +Score_element::get_offset (Axis a) const { - return dim_cache_[a]->relative_coordinate (e ? e->dim_cache_[a] : 0); + Score_element *me = (Score_element*) this; + while (dim_cache_[a].off_callbacks_.size ()) + { + Offset_callback c = dim_cache_[a].off_callbacks_[0]; + me->dim_cache_[a].off_callbacks_.del (0); + Real r = (*c) (me,a ); + if (isinf (r) || isnan (r)) + { + r = 0.0; + programming_error ("Infinity or NaN encountered"); + } + me->dim_cache_[a].offset_ +=r; + } + return dim_cache_[a].offset_; +} + + +Interval +Score_element::point_dimension_callback (Score_element const* , Axis) +{ + return Interval (0,0); } bool Score_element::empty_b (Axis a)const { - return !dim_cache_[a]->extent_callback_l_; + return !dim_cache_[a].extent_callback_l_; } Interval Score_element::extent (Axis a) const { - Dimension_cache const * d = dim_cache_[a]; - Interval ext = d->get_dim (); + Dimension_cache * d = (Dimension_cache *)&dim_cache_[a]; + if (!d->extent_callback_l_) + { + d->dim_.set_empty (); + } + else if (!d->valid_b_) + { + d->dim_= (*d->extent_callback_l_ ) (this, a); + d->valid_b_ = true; + } + Interval ext = d->dim_; + if (empty_b (a)) return ext; - SCM extra = get_elt_property (a == X_AXIS ? "extra-extent-X" + SCM extra = get_elt_property (a == X_AXIS + ? "extra-extent-X" : "extra-extent-Y"); /* @@ -539,15 +555,22 @@ Score_element::extent (Axis a) const Score_element* Score_element::parent_l (Axis a) const { - Dimension_cache*d= dim_cache_[a]->parent_l_; - return d ? d->elt_l_ : 0; + return dim_cache_[a].parent_l_; } Score_element * Score_element::common_refpoint (Score_element const* s, Axis a) const { - Dimension_cache *dim = dim_cache_[a]->common_refpoint (s->dim_cache_[a]); - return dim ? dim->element_l () : 0; + /* + I don't like the quadratic aspect of this code. Maybe this should + be rewritten some time, but the largest chain of parents might be + 10 high or so, so it shouldn't be a real issue. */ + for (Score_element const *c = this; c; c = c->dim_cache_[a].parent_l_) + for (Score_element const * d = s; d; d = d->dim_cache_[a].parent_l_) + if (d == c) + return (Score_element*)d; + + return 0; } @@ -572,17 +595,23 @@ Score_element::name () const } void -Score_element::add_offset_callback (Offset_cache_callback cb, Axis a) +Score_element::add_offset_callback (Offset_callback cb, Axis a) +{ + dim_cache_[a].off_callbacks_.push (cb); +} + +bool +Score_element::has_extent_callback_b (Extent_callback cb, Axis a)const { - dim_cache_[a]->off_callbacks_.push (cb); + return cb == dim_cache_[a].extent_callback_l_; } bool -Score_element::has_offset_callback_b (Offset_cache_callback cb, Axis a)const +Score_element::has_offset_callback_b (Offset_callback cb, Axis a)const { - for (int i= dim_cache_[a]->off_callbacks_.size (); i--;) + for (int i= dim_cache_[a].off_callbacks_.size (); i--;) { - if (dim_cache_[a]->off_callbacks_[i] == cb) + if (dim_cache_[a].off_callbacks_[i] == cb) return true; } return false; @@ -591,14 +620,14 @@ Score_element::has_offset_callback_b (Offset_cache_callback cb, Axis a)const void Score_element::set_extent_callback (Dim_cache_callback dc, Axis a) { - dim_cache_[a]->extent_callback_l_ = dc ; + dim_cache_[a].extent_callback_l_ = dc ; } void Score_element::set_parent (Score_element *g, Axis a) { - dim_cache_[a]->parent_l_ = g ? g->dim_cache_[a]: 0; + dim_cache_[a].parent_l_ = g; } void @@ -744,6 +773,6 @@ init_functions () ADD_SCM_INIT_FUNC(scoreelt, init_functions); void -Score_element::do_breakable_col_processing () +Score_element::discretionary_processing() { } diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index 572fd3f807..131bf4bb63 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -56,12 +56,12 @@ Script_column_engraver::do_post_move_processing () void Script_column_engraver::acknowledge_element( Score_element_info inf) { - if (side_position (inf.elem_l_).has_interface_b ()) + if (Side_position_interface (inf.elem_l_).has_interface_b ()) { Item *thing = dynamic_cast (inf.elem_l_); if (thing && !thing->breakable_b () - && side_position (inf.elem_l_).get_axis () == Y_AXIS) + && Side_position_interface (inf.elem_l_).get_axis () == Y_AXIS) { script_l_arr_.push (thing); } diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 846cc192e6..3ea13a879a 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -159,9 +159,12 @@ Script_engraver::do_pre_move_processing() { for (int i=0; i < script_p_arr_.size(); i++) { - if (to_boolean (script_p_arr_[i]->remove_elt_property ("staff-support"))) - side_position (script_p_arr_[i]).add_staff_support (); - typeset_element (script_p_arr_[i]); + Script * sc = script_p_arr_[i]; + if (to_boolean (sc->remove_elt_property ("staff-support"))) + { + Side_position_interface (sc).add_staff_support (); + } + typeset_element (sc); } script_p_arr_.clear(); } diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index c11f2e8909..6e018180fd 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -21,7 +21,6 @@ Side_position_interface::Side_position_interface (Score_element const *e) elt_l_ = (Score_element*)e; } - void Side_position_interface::add_support (Score_element*e) { @@ -61,12 +60,9 @@ Side_position_interface::get_direction () const */ Real -Side_position_interface::side_position (Dimension_cache const * c) +Side_position_interface::side_position (Score_element const *cme, Axis axis) { - Score_element * me = (c->element_l ()); - - Interval dim; - Axis axis = c->axis (); + Score_element* me = (Score_element*)cme; Score_element *common = me->parent_l (axis); SCM support = me->get_elt_property ("side-support"); for (SCM s = support; s != SCM_EOL; s = gh_cdr (s)) @@ -76,6 +72,7 @@ Side_position_interface::side_position (Dimension_cache const * c) common = common->common_refpoint (e, axis); } + Interval dim; for (SCM s = support; s != SCM_EOL; s = gh_cdr (s)) { @@ -118,12 +115,12 @@ Side_position_interface::side_position (Dimension_cache const * c) callback that centers the element on itself */ Real -Side_position_interface::aligned_on_self (Dimension_cache const *c) +Side_position_interface::aligned_on_self (Score_element const*elm, Axis ax) { String s ("self-alignment-"); - Axis ax = c->axis (); + s += (ax == X_AXIS) ? "X" : "Y"; - Score_element *elm = c->element_l (); + SCM align (elm->get_elt_property (s)); if (isdir_b (align)) { @@ -160,9 +157,8 @@ directed_round (Real f, Direction d) Callback that quantises in staff-spaces, rounding in the direction of the elements "direction" elt property. */ Real -Side_position_interface::quantised_position (Dimension_cache const *c) +Side_position_interface::quantised_position (Score_element const *me, Axis a) { - Score_element * me = (c->element_l ()); Side_position_interface s(me); Direction d = s.get_direction (); Staff_symbol_referencer_interface si (me); @@ -188,13 +184,11 @@ Side_position_interface::quantised_position (Dimension_cache const *c) Position next to support, taking into account my own dimensions and padding. */ Real -Side_position_interface::aligned_side (Dimension_cache const *c) +Side_position_interface::aligned_side (Score_element const*me, Axis ax) { - Score_element * me = (c->element_l ()); Side_position_interface s(me); Direction d = s.get_direction (); - Axis ax = c->axis (); - Real o = side_position (c); + Real o = side_position (me,ax); Interval iv = me->extent (ax); @@ -213,11 +207,8 @@ Side_position_interface::aligned_side (Dimension_cache const *c) Position centered on parent. */ Real -Side_position_interface::centered_on_parent (Dimension_cache const *c) +Side_position_interface::centered_on_parent (Score_element const* me, Axis a) { - - Score_element *me = c->element_l (); - Axis a = c->axis (); Score_element *him = me->parent_l (a); return him->extent (a).center (); @@ -295,9 +286,3 @@ Side_position_interface::supported_b () const } -Side_position_interface -side_position (Score_element* e) -{ - Side_position_interface si (e); - return si; -} diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 84a9833236..c5f29de20f 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -26,9 +26,9 @@ Span_bar::add_bar (Score_element*b) Interval -Span_bar::width_callback (Dimension_cache const * c) +Span_bar::width_callback (Score_element const *se, Axis a) { - Span_bar* s= dynamic_cast (c->element_l ()); + Span_bar* s= dynamic_cast ((Score_element*)se); String gl = ly_scm2string (s->get_elt_property ("glyph")); /* @@ -94,7 +94,7 @@ Span_bar::evaluate_empty () Interval Span_bar::get_spanned_interval () const { - return Axis_group_interface::group_extent_callback (dim_cache_[Y_AXIS]); + return Axis_group_interface::group_extent_callback (this, Y_AXIS); } @@ -113,10 +113,10 @@ Span_bar::get_bar_size () const Span_bar::Span_bar () { group (this).set_interface (); - dim_cache_[X_AXIS]->set_extent_callback (width_callback); + set_extent_callback (width_callback, X_AXIS); // dim_cache_[Y_AXIS]->set_extent_callback (Axis_group_interface::group_extent_callback); - dim_cache_[Y_AXIS]->set_extent_callback (0); + set_extent_callback (0, Y_AXIS); } diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 8126bbbcf1..ed53435809 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -23,10 +23,8 @@ Staff_symbol_referencer_interface::set_interface () { elt_l_->set_elt_property ("staff-position", gh_double2scm (0.0)); elt_l_->add_offset_callback (callback, Y_AXIS); - } - bool Staff_symbol_referencer_interface::has_interface_b () { @@ -91,11 +89,8 @@ Staff_symbol_referencer_interface::position_f () const should use offset callback! */ Real -Staff_symbol_referencer_interface::callback (Dimension_cache const * c) +Staff_symbol_referencer_interface::callback (Score_element const* sc,Axis ) { - Score_element * sc = dynamic_cast (c->element_l ()); - - SCM pos = sc->get_elt_property ("staff-position"); Real off =0.0; if (gh_number_p (pos)) diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 1bc5041b29..3da86edc03 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -38,9 +38,9 @@ Stem_tremolo::stem_l ()const } Interval -Stem_tremolo::dim_callback (Dimension_cache const *c) +Stem_tremolo::dim_callback (Score_element * se, Axis a) { - Stem_tremolo * s = dynamic_cast (c->element_l ()); + Stem_tremolo * s = dynamic_cast (se); Real space = Staff_symbol_referencer_interface (s->stem_l ()) .staff_space (); return Interval (-space, space); diff --git a/lily/stem.cc b/lily/stem.cc index ce5103d7df..d883849bc6 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -438,9 +438,9 @@ Stem::flag () const } Interval -Stem::dim_callback (Dimension_cache const* c) +Stem::dim_callback (Score_element const *se, Axis ) { - Stem * s = dynamic_cast (c->element_l ()); + Stem * s = dynamic_cast ((Score_element*)se); Interval r (0, 0); if (unsmob_element (s->get_elt_property ("beam")) || abs (s->flag_i ()) <= 2) @@ -493,9 +493,9 @@ Stem::do_brew_molecule () const } Real -Stem::off_callback (Dimension_cache const * c) +Stem::off_callback (Score_element const* se, Axis) { - Stem * st = dynamic_cast (c->element_l ()); + Stem *st = dynamic_cast ((Score_element*)se); Real r=0; if (Note_head * f = st->first_head ()) diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index b851480961..928a1a9924 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -67,7 +67,7 @@ System_start_delimiter::after_line_breaking () Molecule System_start_delimiter::do_brew_molecule ()const { - Interval ext = Axis_group_interface::group_extent_callback (dim_cache_[Y_AXIS]); + Interval ext = Axis_group_interface::group_extent_callback (this, Y_AXIS); Real l = ext.length (); Molecule m; diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index c0ab613937..7c1e15c829 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -89,9 +89,12 @@ Text_engraver::do_process_music () } else stafy.set_axis (Y_AXIS); - + + /* + make sure they're in order by adding i to the priority field. + */ text->set_elt_property ("script-priority", - gh_int2scm (200)); + gh_int2scm (200 + i)); if (r->get_direction ()) stafy.set_direction (r->get_direction ()); @@ -118,8 +121,9 @@ Text_engraver::do_pre_move_processing () { for (int i=0; i < texts_.size (); i++) { - side_position (texts_[i]).add_staff_support (); - typeset_element (texts_[i]); + Text_item *ti = texts_[i]; + Side_position_interface (ti).add_staff_support (); + typeset_element (ti); } texts_.clear (); } diff --git a/lily/timing-engraver.cc b/lily/timing-engraver.cc index 00965fe582..68c34aeff6 100644 --- a/lily/timing-engraver.cc +++ b/lily/timing-engraver.cc @@ -37,24 +37,6 @@ Timing_engraver::do_try_music (Music*m) return Timing_translator::do_try_music (m); } -#if 0 -String -Timing_engraver::do_process_music () -{ - if (gh_string_p (get_property ("barType"))) - ; - else if (!now_mom ()) - { - daddy_trans_l_->set_property ("barType", ly_str02scm ("|")); - } - else - - { - } -} -#endif - - /* TODO make properties of this. */ diff --git a/lily/transposed-music.cc b/lily/transposed-music.cc index 2547fac08b..2bcb370865 100644 --- a/lily/transposed-music.cc +++ b/lily/transposed-music.cc @@ -27,9 +27,7 @@ Transposed_music::do_print () const Musical_pitch Transposed_music::to_relative_octave (Musical_pitch p) { -#if 0 // Mats? - warning (_ ("Will ignore \\relative for transposed music")); -#endif + return p; } diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index 6c690bb8e7..3bafebeec8 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -161,6 +161,9 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const *offset = - d * infinity_f; + + if (!column_arr.size ()) + return; Real x0 = column_arr[0]->relative_coordinate (0, X_AXIS); Real x1 = column_arr.top ()->relative_coordinate (0, X_AXIS); diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index ad7f9aa301..d4604f151a 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -25,7 +25,7 @@ Volta_spanner::Volta_spanner () { set_elt_property ("bars", SCM_EOL); - side_position (this).set_axis (Y_AXIS); + Side_position_interface (this).set_axis (Y_AXIS); directional_element (this).set (UP); } @@ -112,7 +112,7 @@ Volta_spanner::do_add_processing () void Volta_spanner::after_line_breaking () { - side_position (this).add_staff_support (); + Side_position_interface (this).add_staff_support (); } void @@ -121,13 +121,13 @@ Volta_spanner::add_bar (Bar* b) Group_interface gi(this, "bars"); gi.add_element (b); - side_position (this).add_support (b); + Side_position_interface (this).add_support (b); add_dependency (b); } void Volta_spanner::add_column (Note_column* c) { - side_position (this).add_support (c); + Side_position_interface (this).add_support (c); add_dependency (c); } diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index eea162f829..067d6f4816 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.3.53 -Entered-date: 22MAY00 +Version: 1.3.54 +Entered-date: 25MAY00 Description: Keywords: music notation typesetting midi fonts engraving Author: hanwen@cs.uu.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert - 1000k lilypond-1.3.53.tar.gz + 1000k lilypond-1.3.54.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.3.53.tar.gz + 1000k lilypond-1.3.54.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index a8c7eb39c7..d33d426034 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.3.53 +Version: 1.3.54 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.53.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.54.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond # Icon: lilypond-icon.gif -- 2.39.2