From 795708fdc77fccf592103e995d97ea5fda9e094f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 15 Dec 1999 21:35:17 +0100 Subject: [PATCH] patch::: 1.3.11.hwn1 pl 11.hwn1 - bf: dots - revise stem, notehead, rest --- CHANGES | 4 + VERSION | 2 +- lily/beam.cc | 70 +++++++++++------- lily/beaming-info.cc | 97 +++++++++++++++++++++++++ lily/chord-tremolo-engraver.cc | 9 +-- lily/include/beam.hh | 5 +- lily/include/lily-guile.hh | 2 +- lily/include/note-head.hh | 4 - lily/include/staff-symbol-referencer.hh | 3 + lily/include/stem.hh | 7 +- lily/lily-guile.cc | 9 +++ lily/misc.cc | 17 ----- lily/new-beaming.cc | 97 ------------------------- lily/note-head.cc | 52 +++---------- lily/slur.cc | 4 +- lily/staff-symbol-referencer.cc | 24 ++++-- lily/stem-engraver.cc | 4 +- lily/stem-tremolo.cc | 4 +- lily/stem.cc | 72 ++++++++++-------- lily/tie.cc | 11 +-- 20 files changed, 244 insertions(+), 253 deletions(-) create mode 100644 lily/beaming-info.cc diff --git a/CHANGES b/CHANGES index db957bac39..c997cae9da 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ +pl 11.hwn1 + - bf: dots + - revise stem, notehead, rest +************ pl 10.uu1 - various small bfs - bf: alignment reversed diff --git a/VERSION b/VERSION index b5129961d5..a68f071212 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=11 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=hwn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/lily/beam.cc b/lily/beam.cc index 8b25aeb5d5..0c62245892 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -40,7 +40,6 @@ Beam::Beam () slope_f_ = 0; left_y_ = 0; - multiplicity_i_ = 0; } /* @@ -377,7 +376,9 @@ Beam::solve_slope () Real Beam::check_stemlengths_f (bool set_b) { - Real interbeam_f = paper_l ()->interbeam_f (multiplicity_i_); + int multiplicity = multiplicity_i (); + + Real interbeam_f = paper_l ()->interbeam_f (multiplicity); Real beam_f = gh_scm2double (get_elt_property ("beam-thickness")); Real staffline_f = paper_l ()-> get_var ("stafflinethickness"); @@ -397,7 +398,7 @@ Beam::check_stemlengths_f (bool set_b) if (get_direction () != s->get_direction ()) { y -= get_direction () * (beam_f / 2 - + (multiplicity_i_ - 1) * interbeam_f); + + (multiplicity - 1) * interbeam_f); Staff_symbol_referencer_interface s1 (s); @@ -405,7 +406,7 @@ Beam::check_stemlengths_f (bool set_b) if (!i && s1.staff_symbol_l () != s2.staff_symbol_l ()) - y += get_direction () * (multiplicity_i_ - (s->flag_i () - 2) >? 0) + y += get_direction () * (multiplicity - (s->flag_i () - 2) >? 0) * interbeam_f; } @@ -433,9 +434,15 @@ Beam::set_stem_shorten () { if(!stem_count ()) return; - - assert (multiplicity_i_); + int multiplicity = multiplicity_i(); + + if (multiplicity <= 0) + { + programming_error ("Singular beam"); + return; + } + int total_count_i = 0; int forced_count_i = 0; for (int i=0; i < stem_count (); i++) @@ -455,7 +462,7 @@ Beam::set_stem_shorten () String type_str = grace_b ? "grace_" : ""; int stem_max = (int)rint(paper_l ()->get_var ("stem_max")); Real shorten_f = paper_l ()->get_var (type_str + "forced_stem_shorten" - + to_str (multiplicity_i_ hpos_f () - first_visible_stem ()->hpos_f (); Real beamdy_f = beamdx_f * slope_f_; + int multiplicity = multiplicity_i (); + Array allowed_position; if (q == ly_symbol2scm ("normal")) { - if ((multiplicity_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2)) + if ((multiplicity <= 2) || (abs (beamdy_f) >= staffline_f / 2)) allowed_position.push (straddle); - if ((multiplicity_i_ <= 1) || (abs (beamdy_f) >= staffline_f / 2)) + if ((multiplicity <= 1) || (abs (beamdy_f) >= staffline_f / 2)) allowed_position.push (sit); allowed_position.push (hang); } else if (q == ly_symbol2scm ("traditional")) { // TODO: check and fix TRADITIONAL - if ((multiplicity_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2)) + if ((multiplicity <= 2) || (abs (beamdy_f) >= staffline_f / 2)) allowed_position.push (straddle); - if ((multiplicity_i_ <= 1) && (beamdy_f <= staffline_f / 2)) + if ((multiplicity <= 1) && (beamdy_f <= staffline_f / 2)) allowed_position.push (sit); if (beamdy_f >= -staffline_f / 2) allowed_position.push (hang); @@ -692,29 +701,29 @@ Beam::set_beaming (Beaming_info_list *beaming) { do { - if (stem (i)->beams_i_drul_[d] < 0) - stem (i)->beams_i_drul_[d] = beaming->infos_.elem (i).beams_i_drul_[d]; + if (stem (i)->beam_count (d) < 0) + stem (i)->set_beaming (beaming->infos_.elem (i).beams_i_drul_[d], d); } while (flip (&d) != LEFT); } } -void -Beam::do_add_processing () + +int +Beam::multiplicity_i () const { - for (int i=0; i < stem_count () ; i++) + int m = 0; + for (SCM s = get_elt_property ("stems"); gh_pair_p (s); s = gh_cdr (s)) { - Direction d = LEFT; - do { - multiplicity_i_ = multiplicity_i_ >? stem (i)->beams_i_drul_[d]; - } while ((flip (&d)) != LEFT); - } + Score_element * sc = unsmob_element (gh_car (s)); + if (Stem * st = dynamic_cast (sc)) + m = m >? st->beam_count (LEFT) >? st->beam_count (RIGHT); + } + return m; } - - /* beams to go with one stem. @@ -727,8 +736,12 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const (prev && !(prev->hpos_f () < here->hpos_f ()))) programming_error ("Beams are not left-to-right"); + + int multiplicity = multiplicity_i(); + Real staffline_f = paper_l ()->get_var ("stafflinethickness"); - Real interbeam_f = paper_l ()->interbeam_f (multiplicity_i_); + Real interbeam_f = paper_l ()->interbeam_f (multiplicity); + Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));; Real dy = interbeam_f; @@ -752,8 +765,9 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const /* half beams extending to the left. */ if (prev) { - int lhalfs= lhalfs = here->beams_i_drul_[LEFT] - prev->beams_i_drul_[RIGHT] ; - int lwholebeams= here->beams_i_drul_[LEFT] beams_i_drul_[RIGHT] ; + int lhalfs= lhalfs = here->beam_count (LEFT) + - prev->beam_count (RIGHT); + int lwholebeams= here->beam_count (LEFT) beam_count (RIGHT); /* Half beam should be one note-width, but let's make sure two half-beams never touch @@ -774,8 +788,8 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const if (next) { - int rhalfs = here->beams_i_drul_[RIGHT] - next->beams_i_drul_[LEFT]; - int rwholebeams = here->beams_i_drul_[RIGHT] beams_i_drul_[LEFT]; + int rhalfs = here->beam_count (RIGHT) - next->beam_count (LEFT); + int rwholebeams = here->beam_count(RIGHT) beam_count (LEFT); Real w = next->hpos_f () - here->hpos_f (); Molecule a = lookup_l ()->beam (sl, w + stemdx, beam_f); diff --git a/lily/beaming-info.cc b/lily/beaming-info.cc new file mode 100644 index 0000000000..ef0bb29041 --- /dev/null +++ b/lily/beaming-info.cc @@ -0,0 +1,97 @@ +/* + beaming-info.cc -- implement Beaming_info, Beaming_info_list + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#include "beaming.hh" + +Beaming_info::Beaming_info( ) +{ + start_mom_ = 0; + beams_i_drul_[LEFT] = 0; + beams_i_drul_[RIGHT] = 0; +} + +Beaming_info::Beaming_info(Moment m, int i) +{ + start_mom_ = m; + beams_i_drul_[LEFT] = i; + beams_i_drul_[RIGHT] = i; +} + +const int infinity_i = 1000; // guh. + +int +Beaming_info_list::min_denominator_index () const +{ + int minden = infinity_i; + int minidx = -1; + + for (int i=1; i < infos_.size ( ); i++) + { + if (infos_[i].start_mom_.den_i () < minden) + { + minidx = i; + minden = infos_[i].start_mom_.den_i (); + } + } + + return minidx; +} + +int +Beaming_info_list::beam_extend_count (Direction d) const +{ + if (infos_.size () == 1) + return infos_[0].beams_i_drul_[d]; + + Beaming_info thisbeam = infos_.boundary (d, 0); + Beaming_info next = infos_.boundary (d, 1); + + return thisbeam.beams_i_drul_[-d] splits; + int m = min_denominator_index (); + splits[LEFT].infos_ = infos_.slice (0,m); + splits[RIGHT].infos_ = infos_.slice (m, infos_.size ()); + + Direction d = LEFT; + + do + { + splits[d].beamify (); + } + while (flip (&d) != LEFT); + + int middle_beams = splits[RIGHT].beam_extend_count (LEFT) type_i_; s->set_elt_property ("duration-log", gh_int2scm (intlog2 (type_i) - 2)); - s->beams_i_drul_[LEFT] = s->flag_i (); - s->beams_i_drul_[RIGHT] = s->flag_i (); + s->set_beaming (s->flag_i (), LEFT); + s->set_beaming ( s->flag_i (), RIGHT); - abeam_p_->multiplicity_i_ = s->flag_i (); - /* - abbrev gaps on all but half note - */ + #if 0 if (s->type_i () != 1) { diff --git a/lily/include/beam.hh b/lily/include/beam.hh index d3d3c71afd..258c538d9d 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -45,10 +45,7 @@ public: Real left_y_; /** - highest number of beams present, for opening-up of beam-spacing - and calculation of stem lengths */ - int multiplicity_i_; Beam (); void add_stem (Stem*); @@ -57,6 +54,7 @@ public: void set_beaming (Beaming_info_list *); void set_stemlens (); VIRTUAL_COPY_CONS(Score_element); + int multiplicity_i () const; protected: Offset center () const; @@ -68,7 +66,6 @@ protected: virtual void do_pre_processing (); virtual void do_post_processing (); - virtual void do_add_processing (); virtual void do_print() const; virtual Molecule*do_brew_molecule_p () const; diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index ddb21f4c5c..84af73262b 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -44,7 +44,7 @@ void init_ly_protection (); unsigned int ly_scm_hash (SCM s); SCM index_cell (SCM cellp, Direction d); - +SCM index_set_cell (SCM cellp, Direction d, SCM val); /* snarfing. diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index bbc051d239..d08b85143d 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -18,13 +18,9 @@ class Note_head : public Rhythmic_head { public: - Note_head (); - void flip_around_stem (Direction); static int compare (Note_head * const &a, Note_head *const &b) ; protected: - Molecule make_molecule () const; - static Interval dim_callback (Dimension_cache const*); virtual void do_pre_processing(); virtual Molecule* do_brew_molecule_p() const; }; diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index 60e9ac2787..a9cb5056cd 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -12,6 +12,7 @@ #include "score-element.hh" + /** A notation object that needs access to variables of the staff (no lines, leading). @@ -38,6 +39,8 @@ public: Real position_f () const; }; +int compare_position (Score_element *const&,Score_element *const&); + Staff_symbol_referencer_interface staff_symbol_referencer_interface (Score_element const*); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index a40484123c..6ca04e8079 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -54,16 +54,14 @@ public: /// log of the duration. Eg. 4 -> 16th note -> 2 flags int flag_i () const; - Drul_array beams_i_drul_; - - + int beam_count (Direction) const; + void set_beaming (int, Direction d); /** don't print flag when in beam. our beam, for aligning abbrev flags */ Beam* beam_l () const; Note_head * first_head () const; - Stem (); /// ensure that this Stem also encompasses the Notehead #n# void add_head (Rhythmic_head*n); @@ -83,7 +81,6 @@ public: void set_default_extents(); void set_noteheads(); - Real stem_length_f() const; Real stem_end_f() const; Real stem_begin_f() const; Real note_delta_f () const; diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 20abc957b4..93e1651cc0 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -187,6 +187,15 @@ index_cell (SCM s, Direction d) return (d == LEFT) ? SCM_CAR (s) : SCM_CDR (s); } +SCM +index_set_cell (SCM s, Direction d, SCM v) +{ + if (d == LEFT) + gh_set_car_x (s, v); + else if (d == RIGHT) + gh_set_cdr_x (s, v); + return s; +} SCM array_to_list (SCM *a , int l) diff --git a/lily/misc.cc b/lily/misc.cc index 3f1f2ad949..ab6cceb5f5 100644 --- a/lily/misc.cc +++ b/lily/misc.cc @@ -32,23 +32,6 @@ log_2(double x) { return log (x) /log (2.0); } -#ifndef STANDALONE -Interval -itemlist_width (const Array &its) -{ - Interval iv ; - iv.set_empty(); - - for (int j =0; j < its.size(); j++) - { - iv.unite (its[j]->extent (X_AXIS)); - - } - return iv; -} - -#endif - /* TODO diff --git a/lily/new-beaming.cc b/lily/new-beaming.cc index 6406d2a61e..e69de29bb2 100644 --- a/lily/new-beaming.cc +++ b/lily/new-beaming.cc @@ -1,97 +0,0 @@ -/* - beaming.cc -- implement Beaming_info, Beaming_info_list - - source file of the GNU LilyPond music typesetter - - (c) 1999 Han-Wen Nienhuys - - */ - -#include "beaming.hh" - -Beaming_info::Beaming_info( ) -{ - start_mom_ = 0; - beams_i_drul_[LEFT] = 0; - beams_i_drul_[RIGHT] = 0; -} - -Beaming_info::Beaming_info(Moment m, int i) -{ - start_mom_ = m; - beams_i_drul_[LEFT] = i; - beams_i_drul_[RIGHT] = i; -} - -const int infinity_i = 1000; // guh. - -int -Beaming_info_list::min_denominator_index () const -{ - int minden = infinity_i; - int minidx = -1; - - for (int i=1; i < infos_.size ( ); i++) - { - if (infos_[i].start_mom_.den_i () < minden) - { - minidx = i; - minden = infos_[i].start_mom_.den_i (); - } - } - - return minidx; -} - -int -Beaming_info_list::beam_extend_count (Direction d) const -{ - if (infos_.size () == 1) - return infos_[0].beams_i_drul_[d]; - - Beaming_info thisbeam = infos_.boundary (d, 0); - Beaming_info next = infos_.boundary (d, 1); - - return thisbeam.beams_i_drul_[-d] splits; - int m = min_denominator_index (); - splits[LEFT].infos_ = infos_.slice (0,m); - splits[RIGHT].infos_ = infos_.slice (m, infos_.size ()); - - Direction d = LEFT; - - do - { - splits[d].beamify (); - } - while (flip (&d) != LEFT); - - int middle_beams = splits[RIGHT].beam_extend_count (LEFT) (c->element_l ()); - return n->make_molecule ().dim_[X_AXIS]; -} -Note_head::Note_head () -{ - dim_cache_[X_AXIS]->callback_l_ = dim_callback; -} void Note_head::do_pre_processing () @@ -41,7 +25,7 @@ Note_head::do_pre_processing () // 8 ball looks the same as 4 ball: String type; SCM style = get_elt_property ("style"); - if (style != SCM_UNDEFINED) + if (gh_string_p (style)) { type = ly_scm2string (style); } @@ -60,28 +44,8 @@ Note_head::do_pre_processing () } } -int -Note_head::compare (Note_head *const &a, Note_head * const &b) -{ - Staff_symbol_referencer_interface s1(a); - Staff_symbol_referencer_interface s2(b); - return sign(s1.position_f () - s2.position_f ()); -} -Molecule -Note_head::make_molecule () const -{ - String type; - SCM style = get_elt_property ("style"); - if (style != SCM_UNDEFINED) - { - type = ly_scm2string (style); - } - - return lookup_l()->afm_find (String ("noteheads-") - + to_str (balltype_i ()) + type); -} Molecule* Note_head::do_brew_molecule_p() const @@ -95,9 +59,17 @@ Note_head::do_brew_molecule_p() const ? 0 : (abs((int)p) - sz) /2; - Molecule* out = new Molecule (make_molecule ()); + String type; + SCM style = get_elt_property ("style"); + if (style != SCM_UNDEFINED) + { + type = ly_scm2string (style); + } + + Molecule* out = + new Molecule (lookup_l()->afm_find (String ("noteheads-") + to_str (balltype_i ()) + type)); - Box b = out->dim_; + Box ledgerless = out->dim_; if (streepjes_i) { @@ -120,7 +92,7 @@ Note_head::do_brew_molecule_p() const } } - out->dim_ = b; + out->dim_ = ledgerless; return out; } diff --git a/lily/slur.cc b/lily/slur.cc index aff1365a27..0a351dc2c2 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -180,7 +180,7 @@ Slur::do_post_processing () if ((stem_l->extent (Y_AXIS).empty_b () || !((stem_l->get_direction () == get_direction ()) && (get_direction () != d))) && !((get_direction () == stem_l->get_direction ()) - && stem_l->beam_l () && (stem_l->beams_i_drul_[-d] >= 1))) + && stem_l->beam_l () && (stem_l->beam_count (-d) >= 1))) { dx_f_drul_[d] = spanned_drul_[d]->extent (X_AXIS).length () / 2; dx_f_drul_[d] -= d * x_gap_f; @@ -206,7 +206,7 @@ Slur::do_post_processing () /* side attached to beamed stem */ - if (stem_l->beam_l () && (stem_l->beams_i_drul_[-d] >= 1)) + if (stem_l->beam_l () && (stem_l->beam_count (-d) >= 1)) { dy_f_drul_[d] = stem_l->extent (Y_AXIS)[get_direction ()]; dy_f_drul_[d] += get_direction () * 2 * y_gap_f; diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 8bd451109a..64a46b8117 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -65,19 +65,22 @@ Real Staff_symbol_referencer_interface::position_f () const { Real p =0.0; - SCM pos = elt_l_->get_elt_property ("staff-position"); - if (gh_number_p (pos)) - p = gh_scm2double (pos); - Staff_symbol * st = staff_symbol_l (); - if (st) + Score_element * c = st ? elt_l_->common_refpoint (st, Y_AXIS) : 0; + if (st && c) { - Score_element * c = elt_l_->common_refpoint (st, Y_AXIS); Real y = elt_l_->relative_coordinate (c, Y_AXIS) - st->relative_coordinate (c, Y_AXIS); p += 2.0 * y / st->staff_line_leading_f (); } + else + { + SCM pos = elt_l_->get_elt_property ("staff-position"); + if (gh_number_p (pos)) + return gh_scm2double (pos); + } + return p; } @@ -134,3 +137,12 @@ staff_symbol_referencer_interface (Score_element const*e) { return e; // gee, I'm so smart! } + +int +compare_position (Score_element *const &a, Score_element * const &b) +{ + Staff_symbol_referencer_interface s1(a); + Staff_symbol_referencer_interface s2(b); + + return sign(s1.position_f () - s2.position_f ()); +} diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index e6bd43c2bd..09e490bdff 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -104,13 +104,13 @@ Stem_engraver::do_pre_move_processing() SCM prop = get_property ("stemLeftBeamCount", &which); if (gh_number_p(prop)) { - stem_p_->beams_i_drul_[LEFT] = gh_scm2int (prop); + stem_p_->set_beaming (gh_scm2int (prop),LEFT); ((Translator_group*)which)->set_property ("stemLeftBeamCount", SCM_UNDEFINED); } prop = get_property ("stemRightBeamCount", &which); if (gh_number_p(prop)) { - stem_p_->beams_i_drul_[RIGHT] = gh_scm2int (prop); + stem_p_->set_beaming (gh_scm2int (prop), RIGHT); ((Translator_group*)which)->set_property ("stemRightBeamCount", SCM_UNDEFINED); } diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 069ef6259c..0a984d5d68 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -55,7 +55,7 @@ Stem_tremolo::do_brew_molecule_p () const int mult =0; if (Beam * b = st->beam_l ()) { - mult = b->multiplicity_i_; + mult = b->multiplicity_i (); } Real interbeam_f = paper_l ()->interbeam_f (mult); @@ -70,7 +70,7 @@ Stem_tremolo::do_brew_molecule_p () const if (st && st->beam_l ()) { slope_f = st->beam_l ()->slope_f_; // ugh, rather calc from Stem_tremolo_req - beams_i = st->beams_i_drul_[RIGHT] >? st->beams_i_drul_[LEFT]; + beams_i = st->beam_count (RIGHT) >? st->beam_count (LEFT); } Molecule a (lookup_l ()->beam (slope_f, w, beam_f)); diff --git a/lily/stem.cc b/lily/stem.cc index a6ca3d3df5..507772b54e 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -8,6 +8,7 @@ TODO: This is way too hairy */ + #include "dimension-cache.hh" #include "stem.hh" #include "debug.hh" @@ -23,9 +24,26 @@ #include "cross-staff.hh" #include "staff-symbol-referencer.hh" -Stem::Stem () + +void +Stem::set_beaming (int i, Direction d ) +{ + SCM pair = get_elt_property ("beaming"); + + if (!gh_pair_p (pair)) + pair = gh_cons (gh_int2scm (0),gh_int2scm (0)); + + index_set_cell (pair, d, gh_int2scm (i)); +} + +int +Stem::beam_count (Direction d) const { - beams_i_drul_[LEFT] = beams_i_drul_[RIGHT] = -1; + SCM p=get_elt_property ("beaming"); + if (gh_pair_p (p)) + return gh_scm2int (index_cell (p,d)); + else + return 0; } Interval_t @@ -55,13 +73,6 @@ Stem::head_positions () const return r; } - -Real -Stem::stem_length_f () const -{ - return yextent_.length(); -} - Real Stem::stem_begin_f () const { @@ -96,7 +107,7 @@ Stem::set_stemend (Real se) int Stem::type_i () const { - return first_head ()->balltype_i (); + return first_head () ? first_head ()->balltype_i () : 2; } Note_head* @@ -205,9 +216,8 @@ Stem::flag_i () const void Stem::set_default_extents () { - if (!stem_length_f ()) + if (yextent_.empty_b ()) set_default_stemlen (); - } void @@ -215,21 +225,20 @@ Stem::set_noteheads () { if (!first_head ()) return; - - Link_array head_l_arr = - Group_interface__extract_elements (this, (Note_head*)0, "heads"); + Link_array head_l_arr = + Group_interface__extract_elements (this, (Score_element*)0, "heads"); - head_l_arr.sort (Note_head::compare); + head_l_arr.sort (compare_position); if (get_direction () < 0) head_l_arr.reverse (); - Note_head * beginhead = first_head (); + Score_element * beginhead = head_l_arr[0]; beginhead->set_elt_property ("extremal", SCM_BOOL_T); if (beginhead != head_l_arr.top ()) head_l_arr.top ()->set_elt_property ("extremal", SCM_BOOL_T); - int parity=1; + bool parity= true; int lastpos = int (Staff_symbol_referencer_interface (beginhead).position_f ()); for (int i=1; i < head_l_arr.size (); i ++) { @@ -239,11 +248,15 @@ Stem::set_noteheads () if (dy <= 1) { if (parity) - head_l_arr[i]->flip_around_stem (get_direction ()); + { + Real l = head_l_arr[i]->extent (X_AXIS).length (); + head_l_arr[i]->translate_axis (l * get_direction (), X_AXIS); + } parity = !parity; } else - parity = 1; + parity = true; + lastpos = int (p); } } @@ -262,7 +275,6 @@ Stem::do_pre_processing () set_empty (X_AXIS); } - set_spacing_hints (); } @@ -329,8 +341,6 @@ Stem::dim_callback (Dimension_cache const* c) } - - const Real ANGLE = 20* (2.0*M_PI/360.0); // ugh! Molecule* @@ -354,8 +364,7 @@ Stem::do_brew_molecule_p () const mol_p->add_molecule (ss); } - if (get_elt_property ("beam") == SCM_UNDEFINED - && abs (flag_i ()) > 2) + if (!beam_l () && abs (flag_i ()) > 2) { Molecule fl = flag (); fl.translate_axis(stem_y[get_direction ()]*dy, Y_AXIS); @@ -402,6 +411,7 @@ Stem::beam_l ()const } +// ugh still very long. Stem_info Stem::calc_stem_info () const { @@ -424,7 +434,7 @@ Stem::calc_stem_info () const beam_dir = UP; // GURAUGRNAGURAGU! urg ! } - Real interbeam_f = paper_l ()->interbeam_f (beam_l ()->multiplicity_i_); + Real interbeam_f = paper_l ()->interbeam_f (beam_l ()->multiplicity_i ()); Real beam_f = gh_scm2double (beam_l ()->get_elt_property ("beam-thickness")); info.idealy_f_ = chord_start_f (); @@ -438,17 +448,17 @@ Stem::calc_stem_info () const int stem_max = (int)rint(paper_l ()->get_var ("stem_max")); String type_str = grace_b ? "grace_" : ""; Real min_stem_f = paper_l ()->get_var (type_str + "minimum_stem_length" - + to_str (beam_l ()->multiplicity_i_ multiplicity_i () get_var (type_str + "stem_length" - + to_str (beam_l ()->multiplicity_i_ multiplicity_i () multiplicity_i_) + if (beam_l ()->multiplicity_i ()) { info.idealy_f_ += beam_f; - info.idealy_f_ += (beam_l ()->multiplicity_i_ - 1) * interbeam_f; + info.idealy_f_ += (beam_l ()->multiplicity_i () - 1) * interbeam_f; } info.miny_f_ = info.idealy_f_; info.maxy_f_ = INT_MAX; @@ -472,7 +482,7 @@ Stem::calc_stem_info () const info.miny_f_ = info.miny_f_ >? 0; //lowest beam of (UP) beam must never be lower than second staffline info.miny_f_ = info.miny_f_ >? (- 2 * internote_f - beam_f - + (beam_l ()->multiplicity_i_ > 0) * beam_f + interbeam_f * (beam_l ()->multiplicity_i_ - 1)); + + (beam_l ()->multiplicity_i () > 0) * beam_f + interbeam_f * (beam_l ()->multiplicity_i () - 1)); } } else diff --git a/lily/tie.cc b/lily/tie.cc index f7ea46e801..c891d0bb68 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -17,13 +17,9 @@ void Tie::set_head (Direction d, Note_head * head_l) { assert (!head (d)); - if (d == LEFT) - gh_set_car_x (get_elt_property ("heads"), head_l->self_scm_ ); - else if (d == RIGHT) - gh_set_cdr_x (get_elt_property ("heads"), head_l->self_scm_ ); + index_set_cell (get_elt_property ("heads"), d, head_l->self_scm_); set_bounds (d, head_l); - add_dependency (head_l); } @@ -76,8 +72,9 @@ Tie::do_add_processing() new_head_drul[d] = head((Direction)-d); } while (flip(&d) != LEFT); - gh_set_car_x (get_elt_property ("heads"), new_head_drul[LEFT]->self_scm_ ); - gh_set_cdr_x (get_elt_property ("heads"), new_head_drul[RIGHT]->self_scm_ ); + index_set_cell (get_elt_property ("heads"), LEFT, new_head_drul[LEFT]->self_scm_ ); + index_set_cell (get_elt_property ("heads"), RIGHT, new_head_drul[LEFT]->self_scm_ ); + } void -- 2.39.5