From 2957751eb22511572d9ba7862a22c64e617c7724 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 21 Jan 2004 13:58:22 +0000 Subject: [PATCH] * lily/new-part-combine-iterator.cc (construct_children): create Devnull from Voice context * scm/music-functions.scm (determine-split-list): bugfixes. * scm/music-functions.scm (determine-split-list): determine split list from music events. * lily/new-part-combine-iterator.cc: more states. --- ChangeLog | 13 +++++ input/regression/new-part-combine.ly | 23 +++++++++ lily/horizontal-bracket.cc | 1 + lily/line-spanner.cc | 2 +- lily/measure-grouping-spanner.cc | 16 +++--- lily/new-part-combine-iterator.cc | 10 ++-- lily/tie.cc | 2 +- scm/music-functions.scm | 73 ++++++++++++++++------------ 8 files changed, 95 insertions(+), 45 deletions(-) create mode 100644 input/regression/new-part-combine.ly diff --git a/ChangeLog b/ChangeLog index 5f97d1b6f4..5550ee9e7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2004-01-21 Han-Wen Nienhuys + * lily/new-part-combine-iterator.cc (construct_children): create + Devnull from Voice context + + * scm/music-functions.scm (determine-split-list): bugfixes. + + * lily/lily-guile.cc (robust_scm2int): new function + + * lily/staff-symbol-referencer.cc (line_thickness): new + function. Use throughout. + + * lily/font-size-engraver.cc (acknowledge_grob): only process grob + in its own context. Add to preset font-size. + * lily/stem.cc (thickness): new function. * lily/staff-symbol.cc (get_ledger_line_thickness): new function: diff --git a/input/regression/new-part-combine.ly b/input/regression/new-part-combine.ly new file mode 100644 index 0000000000..f258691e60 --- /dev/null +++ b/input/regression/new-part-combine.ly @@ -0,0 +1,23 @@ + +\header { + texidoc ="The new part combiner. +Apart for: +@itemize @bullet +@item different durations (start points) +@item different articulations (only slur/beam/tie work) +@item wide pitch ranges +@end itemize +" + } + +theMusic = \context Staff \notes { c4 d8-. } + + + +vone = \notes \relative a' { g2 g g g4 g f' c c( c) } +vtwo = \notes \relative a' { f2 f4 f f2 g4 g c, f f f } + +\score { + \newpartcombine \vone \vtwo +} + diff --git a/lily/horizontal-bracket.cc b/lily/horizontal-bracket.cc index ce9283060b..e9e1135a24 100644 --- a/lily/horizontal-bracket.cc +++ b/lily/horizontal-bracket.cc @@ -12,6 +12,7 @@ #include "group-interface.hh" #include "directional-element-interface.hh" #include "paper-def.hh" +#include "staff-symbol-referencer.hh" struct Horizontal_bracket { diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index 3daaab5557..211caca0ee 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -30,7 +30,7 @@ zigzag_molecule (Grob *me, Real dx = dz[X_AXIS]; Real dy = dz[Y_AXIS]; - Real thick = Staff_symbol_referencer::thickness (me); + Real thick = Staff_symbol_referencer::line_thickness (me); thick *= robust_scm2double (me->get_grob_property ("thickness"), 1.0); // todo: staff sym referencer? Real staff_space = Staff_symbol_referencer::staff_space (me); diff --git a/lily/measure-grouping-spanner.cc b/lily/measure-grouping-spanner.cc index 55a5417f4c..8f432c3320 100644 --- a/lily/measure-grouping-spanner.cc +++ b/lily/measure-grouping-spanner.cc @@ -1,16 +1,18 @@ /* -measure-grouping-spanner.cc -- implement Measure_grouping + measure-grouping-spanner.cc -- implement Measure_grouping -source file of the GNU LilyPond music typesetter + source file of the GNU LilyPond music typesetter -(c) 2002--2003 Han-Wen Nienhuys + (c) 2002--2003 Han-Wen Nienhuys */ + #include "paper-def.hh" #include "spanner.hh" #include "measure-grouping-spanner.hh" #include "lookup.hh" #include "item.hh" +#include "staff-symbol-referencer.hh" MAKE_SCHEME_CALLBACK (Measure_grouping, brew_molecule, 1); SCM @@ -22,9 +24,9 @@ Measure_grouping::brew_molecule (SCM grob) TODO: robustify. */ SCM which = me->get_grob_property ("style"); - SCM height = me->get_grob_property ("height"); + Real height = robust_scm2double (me->get_grob_property ("height"), 1); - Real t = Staff_symbol_referencer::thickness (me) * robust_scm2double (me->get_grob_property ("thickness")); + Real t = Staff_symbol_referencer::line_thickness (me) * robust_scm2double (me->get_grob_property ("thickness"), 1); Grob *common = me->get_bound(LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS); @@ -45,11 +47,11 @@ Measure_grouping::brew_molecule (SCM grob) */ if (which == ly_symbol2scm ("bracket")) { - m = Lookup::bracket (X_AXIS, iv, t,-gh_scm2double (height), t); + m = Lookup::bracket (X_AXIS, iv, t, -height, t); } else if (which == ly_symbol2scm ("triangle")) { - m = Lookup::triangle (iv, t, gh_scm2double (height)); + m = Lookup::triangle (iv, t, height); } m.align_to (Y_AXIS, DOWN); diff --git a/lily/new-part-combine-iterator.cc b/lily/new-part-combine-iterator.cc index 328efd7572..60e5c3649b 100644 --- a/lily/new-part-combine-iterator.cc +++ b/lily/new-part-combine-iterator.cc @@ -75,7 +75,7 @@ New_pc_iterator::derived_mark () const void New_pc_iterator::derived_substitute (Translator_group*f, - Translator_group*t) + Translator_group*t) { if (first_iter_) first_iter_->substitute_outlet (f,t); @@ -205,16 +205,16 @@ New_pc_iterator::construct_children () = report_to ()->find_create_translator (ly_symbol2scm ("Voice"), "shared",props); - Translator_group *null - = report_to ()->find_create_translator (ly_symbol2scm ("Devnull"), - "", SCM_EOL); - null_.set_translator (null); tr->execute_pushpop_property (ly_symbol2scm ("NoteHead"), ly_symbol2scm ("font-size"), gh_int2scm (3)); shared_ .set_translator (tr); set_translator (tr); + Translator_group *null + = report_to ()->find_create_translator (ly_symbol2scm ("Devnull"), + "", SCM_EOL); + null_.set_translator (null); Translator_group *one = tr->find_create_translator (ly_symbol2scm ("Voice"), "one", props); diff --git a/lily/tie.cc b/lily/tie.cc index ab1c43868f..4e935c9555 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -331,7 +331,7 @@ Tie::brew_molecule (SCM smob) } Real thick - = Staff_symbol_referencer::thickness (me) + = Staff_symbol_referencer::line_thickness (me) * robust_scm2double (me->get_grob_property ("thickness"), 1); Bezier b; diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 27269d495e..cc85acb355 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -852,28 +852,39 @@ Rest can contain a list of beat groupings active1 active2) - (define (analyse-span-event active ev) - (let* - ((name (ly:get-mus-property ev 'name)) - (key (cond - ((equal? name 'SlurEvent) 'slur) - ((equal? name 'TieEvent) 'tie) - ((equal? name 'Beam) 'beam) - (else #f))) - (sp (ly:get-mus-property ev 'span-direction))) - - (if (and (symbol? key) (ly:dir? sp)) - ((if (= sp STOP) delete! cons) key active)) - )) + (define (analyse-span-events active evs) + (define (analyse-span-event active ev) + (let* + ((name (ly:get-mus-property ev 'name)) + (key (cond + ((equal? name 'SlurEvent) 'slur) + ((equal? name 'TieEvent) 'tie) + ((equal? name 'Beam) 'beam) + (else #f))) + (sp (ly:get-mus-property ev 'span-direction))) + + (if (and (symbol? key) (ly:dir? sp)) + ((if (= sp STOP) delete! cons) key active) + active)) + ) + + (if (pair? evs) + (analyse-span-events + (analyse-span-event active (car evs)) + (cdr evs)) + active + )) (define (get-note-evs v i) (define (f? x) (equal? (ly:get-mus-property x 'name) 'NoteEvent)) (filter f? (map car (what v i)))) - (define (put x) - (set-cdr! (vector-ref result ri) x) ) + (define (put x . index) + (set-cdr! (vector-ref result (if (pair? index) + (car index) ri)) x) ) + (display (list ri i1 i2 active1 active2 "\n")) (cond ((= ri (vector-length result)) '()) ((= i1 (vector-length ev1)) (put 'apart)) @@ -881,8 +892,15 @@ Rest can contain a list of beat groupings (else (let* ((m1 (when ev1 i1)) - (m2 (when ev2 i2))) - + (m2 (when ev2 i2)) + (new-active1 + (sort + (analyse-span-events active1 (map car (what ev1 i1))) + symbol ri 0) (put 'apart (1- ri))) + (analyse-events (1+ i1) i2 (1+ ri) new-active1 new-active2)) ((ly:moment ri 0) (put 'apart (1- ri))) + (analyse-events i1 (1+ i2) (1+ ri) new-active1 new-active2)) (else - (if (not (equal? active1 active2)) + (if (or (not (equal? active1 active2)) (not (equal? new-active2 new-active1))) (put 'apart) (let* @@ -923,18 +935,17 @@ Rest can contain a list of beat groupings ((> (length notes1) 1) (put 'apart)) ((> (length notes2) 1) (put 'apart)) (else - (let* ((diff (ly:pitch-diff (car pitches1) (car pitches1)))) + (let* ((diff (ly:pitch-diff (car pitches1) (car pitches2)))) (if (< (ly:pitch-steps diff) chord-threshold) (put 'chords) (put 'apart)) )))) ) - (analyse-events (1+ i1) (1+ i2) (1+ ri) active1 active2)) + (analyse-events (1+ i1) (1+ i2) (1+ ri) new-active1 new-active2)) ))))) (analyse-events 0 0 0 '() '()) - (display result) (vector->list result)) -- 2.39.5