From bc30d5ab67f4cf1e2c5cd953f6ea27867ae2fc05 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 13 Jul 2002 18:05:19 +0000 Subject: [PATCH] bfs --- ChangeLog | 2 ++ lily/beam.cc | 42 +++++++++++--------------------------- lily/include/lily-guile.hh | 1 + lily/include/stem.hh | 1 + lily/lily-guile.cc | 15 ++++++++++++++ lily/stem-tremolo.cc | 5 ++--- lily/stem.cc | 15 ++++++++++++++ 7 files changed, 48 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index c55040994f..fc55e0ef80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2002-07-13 Han-Wen + * lily/stem-tremolo.cc (brew_molecule): add code for stem tremolos. + * lily/auto-beam-engraver.cc (create_beam_p): remember Beam settings at the start of a potential auto beam. diff --git a/lily/beam.cc b/lily/beam.cc index acfb18ff7a..2cd3887e25 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -71,33 +71,6 @@ shrink_extra_weight (Real x) return fabs (x) * ((x < 0) ? 1.5 : 1.0); } -// move to somewhree? -Slice -int_list_to_slice (SCM l) -{ - Slice s; - s.set_empty (); - for (; gh_pair_p (l); l = gh_cdr (l)) - { - if (gh_number_p (gh_car (l))) - s.add_point (gh_scm2int (gh_car (l))); - } - - return s; -} - -// move to stem? -Slice -stem_beam_multiplicity (Grob *stem) -{ - SCM beaming= stem->get_grob_property ("beaming"); - Slice l = int_list_to_slice (gh_car (beaming)); - Slice r = int_list_to_slice (gh_cdr (beaming)); - l.unite (r); - - return l; -} - void Beam::add_stem (Grob *me, Grob *s) { @@ -130,7 +103,7 @@ Beam::get_beam_count (Grob *me) { Grob *sc = unsmob_grob (ly_car (s)); - m = m >? (stem_beam_multiplicity (sc).length () + 1); + m = m >? (Stem::beam_multiplicity (sc).length () + 1); } return m; } @@ -306,7 +279,9 @@ Beam::brew_molecule (SCM grob) SCM last_beaming = SCM_EOL;; Real last_xposn = -1; Real last_width = -1 ; - + + + SCM gap = me->get_grob_property ("gap"); Molecule the_beam; Real lt = me->paper_l ()->get_var ("linethickness"); for (int i = 0; i< stems.size(); i++) @@ -363,6 +338,13 @@ Beam::brew_molecule (SCM grob) { width_corr += stem_width/2; } + + if (gh_number_p (gap)) + { + Real g = gh_scm2double (gap); + stem_offset += g; + width_corr -= 2*g; + } Molecule whole = Lookup::beam (dydx, w + width_corr, thick); for (int j = fullbeams.size(); j--;) @@ -1388,7 +1370,7 @@ Beam::calc_stem_y (Grob *me, Grob* s, Interval pos, bool french) } else { - stem_y += (stem_beam_multiplicity(s)[my_dir]) * beam_space; + stem_y += (Stem::beam_multiplicity(s)[my_dir]) * beam_space; } return stem_y; diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 105c1030f0..03bdd0bbf4 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -146,6 +146,7 @@ Offset ly_scm2offset (SCM); SCM ly_assoc_chain (SCM key, SCM achain); SCM ly_assoc_cdr (SCM key, SCM alist); Interval ly_scm2interval (SCM); +Slice int_list_to_slice (SCM l); SCM ly_interval2scm (Drul_array); void taint (SCM *); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 13146d2165..db82579fd3 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -31,6 +31,7 @@ public: static Direction get_direction (Grob*) ; static void set_stemend (Grob *,Real); static Direction get_default_dir (Grob *) ; + static Slice Stem::beam_multiplicity (Grob *stem); static int head_count (Grob *) ; static bool invisible_b (Grob *) ; diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 8e31e897e6..69990c82b1 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -797,3 +797,18 @@ display_list (SCM s) scm_puts (")", p); return SCM_UNSPECIFIED; } + +Slice +int_list_to_slice (SCM l) +{ + Slice s; + s.set_empty (); + for (; gh_pair_p (l); l = gh_cdr (l)) + { + if (gh_number_p (gh_car (l))) + s.add_point (gh_scm2int (gh_car (l))); + } + + return s; +} + diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index dc31df0270..24f15420f0 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -120,14 +120,13 @@ Stem_tremolo::brew_molecule (SCM smob) Interval mol_ext = mol.extent (Y_AXIS); // ugh, rather calc from Stem_tremolo_req + int beams_i = (beam) ? (Stem::beam_multiplicity (stem).length ()+ 1): 0; /* TODO. */ - - assert(false); - int beams_i = 0; + Real beamthickness = 0.0; SCM sbt = (beam) ? beam->get_grob_property ("thickness") : SCM_EOL ; if (gh_number_p (sbt)) diff --git a/lily/stem.cc b/lily/stem.cc index f7a8752e9f..4803c3ba06 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -920,7 +920,22 @@ Stem::calc_stem_info (Grob*me) return si; } + +// move to stem? +Slice +Stem::beam_multiplicity (Grob *stem) +{ + SCM beaming= stem->get_grob_property ("beaming"); + Slice l = int_list_to_slice (gh_car (beaming)); + Slice r = int_list_to_slice (gh_cdr (beaming)); + l.unite (r); + + return l; +} + + ADD_INTERFACE (Stem,"stem-interface", "A stem", "up-to-staff avoid-note-head adjust-if-on-staffline thickness stem-info beamed-lengths beamed-minimum-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head note-heads direction length style no-stem-extend flag-style dir-forced"); + -- 2.39.2