From 011a87474b4a7d925b94dd570a79726c6b8d9440 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 02:03:37 +0000 Subject: [PATCH] lilypond-1.5.17 --- lily/include/new-spacing-spanner.hh | 19 -------- lily/new-spacing-spanner.cc | 47 +++++++++++++++++--- lily/slur.cc | 14 +++++- lily/spacing-spanner.cc | 67 ----------------------------- scm/engraver-documentation-lib.scm | 1 - 5 files changed, 52 insertions(+), 96 deletions(-) diff --git a/lily/include/new-spacing-spanner.hh b/lily/include/new-spacing-spanner.hh index ac1ac80696..6238dde3f1 100644 --- a/lily/include/new-spacing-spanner.hh +++ b/lily/include/new-spacing-spanner.hh @@ -10,22 +10,3 @@ #ifndef SPACING_SPANNER_HH #define SPACING_SPANNER_HH -#include "spanner.hh" -#include "spring.hh" - -class New_spacing_spanner -{ -public: - static void set_interface (Grob*); - static void do_measure (Grob*,Link_array *) ; - static void stretch_to_regularity (Grob*, Array *, Link_array const &); - static void breakable_column_spacing (Item* l, Item *r); - DECLARE_SCHEME_CALLBACK (set_springs, (SCM )); - static Real stem_dir_correction (Grob*,Grob*,Grob*) ; - static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment) ; - static Real note_spacing (Grob*,Grob*,Grob*,Moment) ; - static Real get_duration_space (Grob*,Moment dur, Moment shortest) ; -}; - -#endif /* SPACING_SPANNER_HH */ - diff --git a/lily/new-spacing-spanner.cc b/lily/new-spacing-spanner.cc index 682dc0847f..5fc0aaf498 100644 --- a/lily/new-spacing-spanner.cc +++ b/lily/new-spacing-spanner.cc @@ -7,7 +7,6 @@ */ -#include "new-spacing-spanner.hh" #include "paper-column.hh" #include "dimensions.hh" #include "paper-def.hh" @@ -16,7 +15,23 @@ #include "line-of-score.hh" #include "misc.hh" #include "separation-item.hh" +#include "spanner.hh" +#include "spring.hh" +class New_spacing_spanner +{ +public: + static void set_interface (Grob*); + static void do_measure (Grob*,Link_array *) ; + static void stretch_to_regularity (Grob*, Array *, Link_array const &); + static void breakable_column_spacing (Item* l, Item *r); + DECLARE_SCHEME_CALLBACK (set_springs, (SCM )); + static Real stem_dir_correction (Grob*,Grob*,Grob*) ; + static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment) ; + static Real note_spacing (Grob*,Grob*,Grob*,Moment) ; + static Real get_duration_space (Grob*,Moment dur, Moment shortest) ; + static void prune_loose_colunms (Link_array*); +}; void New_spacing_spanner::set_interface (Grob*me) @@ -25,6 +40,29 @@ New_spacing_spanner::set_interface (Grob*me) me->set_extent_callback (SCM_EOL, Y_AXIS) ; } +/* + Remove all columns that are not tightly + fitting part of the spacing problem. + */ +void +New_spacing_spanner::prune_loose_colunms (Link_array *cols) +{ + for (int i = cols->size(); i--;) + { + SCM between = cols->elem(i)->get_grob_property ("between-cols"); + if (!gh_pair_p (between)) + continue; + + Item * l = dynamic_cast (unsmob_grob (gh_car (between))); + Item * r = dynamic_cast (unsmob_grob (gh_cdr (between))); + if (l->column_l () != cols->elem (i-1) + || r->column_l () != cols->elem (i +1)) + { + cols->del (i); + } + } +} + /* The algorithm is partly taken from : @@ -49,12 +87,7 @@ New_spacing_spanner::do_measure (Grob*me, Link_array *cols) Moment base_shortest_duration = *unsmob_moment (me->get_grob_property ("maximum-duration-for-spacing")); shortest_in_measure.set_infinite (1); - for (int i = cols->size(); i--;) - { - if (gh_pair_p (cols->elem(i)->get_grob_property ("between-cols"))) - cols->del (i); - } - + prune_loose_colunms (cols); for (int i =0 ; i < cols->size (); i++) { diff --git a/lily/slur.cc b/lily/slur.cc index 4cc9bf3e5a..e0f4836d04 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -175,7 +175,17 @@ Slur::set_extremities (Grob *me) Direction dir = LEFT; do { - if (!gh_symbol_p (index_cell (me->get_grob_property ("attachment"), dir))) + SCM att = me->get_grob_property ("attachment"); + /* + */ + if (!gh_pair_p (att)) + { + programming_error ("attachment is not a cons?!"); + att = gh_cons (SCM_EOL, SCM_EOL); + me->set_grob_property ("attachment", att); + } + + if (!gh_symbol_p (index_cell (att, dir))) { for (SCM s = me->get_grob_property ("extremity-rules"); s != SCM_EOL; s = ly_cdr (s)) @@ -184,7 +194,7 @@ Slur::set_extremities (Grob *me) gh_int2scm ((int)dir)); if (r != SCM_BOOL_F) { - index_set_cell (me->get_grob_property ("attachment"), dir, + index_set_cell (att, dir, ly_cdar (s)); break; } diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 6a0a62806e..92b7cb7480 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -23,73 +23,6 @@ Spacing_spanner::set_interface (Grob*me) me->set_extent_callback (SCM_EOL, Y_AXIS) ; } -#if 0 -struct Note_run -{ - Array idxes; - int start, end; - Moment duration; - int count; -}; - -int -column_compare (Grob *const &t1, Grob *const &t2) -{ - return Moment::compare (Paper_column::when_mom (t1), - Paper_column::when_mom (t2)); -} - - -Note_run -run_length (Moment dt, int i, Array const &moms, - Link_array runs) -{ - int k = 0; - Array idxes; - - idxes.push (i); - while (1) - { - Moment next = moms[i] + dt; - while (i < moms.size () && moms[i] < next) - i++; - if (i == moms.size () || moms[i] != next) - break; - - idxes.push (i); - k++; - } - - Moment dur = idxes.size () -} - -void -find_runs (Grob*me, Link_array cols) -{ - Link_array filter_cols; - Array col_moments; - for (int i = 0; i < cols.size (); i++) - { - Moment w = Paper_column::when_mom (cols[i]); - - if (!w.grace_part_ && Paper_column::musical_b (cols[i])) - { - filter_cols.push (cols[i]); - col_moments.push (w); - } - } - - Moment end_mom = col_moments.top (); - for (int i = 0; i < col_moments.size () ; i++) - { - for (int j = i+1; j < col_moments.size (); j++) - { - Moment dt = Paper_column::col_momentsfilter_cols - } - } -} -#endif - /* The algorithm is partly taken from : diff --git a/scm/engraver-documentation-lib.scm b/scm/engraver-documentation-lib.scm index e19bce865b..f1e67ab88d 100644 --- a/scm/engraver-documentation-lib.scm +++ b/scm/engraver-documentation-lib.scm @@ -7,7 +7,6 @@ ;;; Jan Nieuwenhuizen -(eval-string (ly-gulp-file "translator-description.scm")) ;; alist of translater descriptions (define (document-translator-property sym) -- 2.39.5