From: fred Date: Wed, 27 Mar 2002 01:20:44 +0000 (+0000) Subject: lilypond-1.5.4 X-Git-Tag: release/1.5.59~589 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d976f6a6c707b2ab3452eb4b73d87a0afd995cc3;p=lilypond.git lilypond-1.5.4 --- diff --git a/input/bugs/braces.ly b/input/bugs/braces.ly index 10d474ef81..04179b0ec3 100644 --- a/input/bugs/braces.ly +++ b/input/bugs/braces.ly @@ -1,3 +1,6 @@ +% this bug apparently caused by dvips + mf rounding. + + \header { texidoc="Run this through ly2dvi to show differerent brace sizes" } diff --git a/input/bugs/dots.ly b/input/bugs/dots.ly index f48fe19b75..ff1d7f20ff 100644 --- a/input/bugs/dots.ly +++ b/input/bugs/dots.ly @@ -1,6 +1,6 @@ \header { - texidoc = "Dots should remain close to the heads they belong to, but should not overlap."; + texidoc = "Dots should remain close to the heads they belong to, but should not overlap." } diff --git a/input/bugs/grace-dynamic.ly b/input/bugs/grace-dynamic.ly index b79d9753fd..89b002c4cf 100644 --- a/input/bugs/grace-dynamic.ly +++ b/input/bugs/grace-dynamic.ly @@ -1,3 +1,4 @@ - -\score { \notes {\grace {c'_\f} d e f g}} + % ? + + \score { \notes \context Voice {\grace {c'_\f} d e f g}} diff --git a/input/bugs/grace-finger.ly b/input/bugs/grace-finger.ly index 38095ef78b..077b407038 100644 --- a/input/bugs/grace-finger.ly +++ b/input/bugs/grace-finger.ly @@ -1,6 +1,7 @@ - + % ? + \score { \notes \context Voice = VA \relative c'' { \grace {[b8^1 c^2]} d4^3 diff --git a/input/bugs/grace-gets-slur.ly b/input/bugs/grace-gets-slur.ly index 65703e7b81..8b13789179 100644 --- a/input/bugs/grace-gets-slur.ly +++ b/input/bugs/grace-gets-slur.ly @@ -1,12 +1 @@ - -\score { - \notes\relative c''{ - \grace g8 g'2 ( )g - } - \paper { - linewidth=40.\mm; - indent=0.; - } -} - diff --git a/input/regression/grace-nest.ly b/input/regression/grace-nest.ly new file mode 100644 index 0000000000..71ca4b43e3 --- /dev/null +++ b/input/regression/grace-nest.ly @@ -0,0 +1,12 @@ +\header { +texidoc = "grace code should not be confused by nested sequential musics, containing grace notes; practically speaking, this means that the end-bar and measure bar coincide in this example." + +} +\score{ +\notes + +{ c''2 { \grace b'16 c''2 } \bar "|." } + \paper { +} + } + diff --git a/input/regression/grace-start.ly b/input/regression/grace-start.ly index 1094d3b5fd..5c0c5dff67 100644 --- a/input/regression/grace-start.ly +++ b/input/regression/grace-start.ly @@ -3,7 +3,9 @@ texidoc = "Pieces may begin with grace notes." } \score {\notes \relative c' \context Staff { \grace { [a'16 f] } g1 + \bar "||" % test if | and || are synced. \grace { [a16 bes] } c1 + \bar "||" % test if | and || are synced. } \paper { linewidth = -1. } } diff --git a/input/regression/grace-sync.ly b/input/regression/grace-sync.ly index 0ddcdf37f8..419ccdeb14 100644 --- a/input/regression/grace-sync.ly +++ b/input/regression/grace-sync.ly @@ -3,10 +3,10 @@ } \score {\notes < \context Staff { c2 - \ngrace c8 - c2 c4 } + \grace c8 + c2 c4 } \context Staff = SB { c2 \clef bass - %\ngrace { [dis8 ( d8] } + \grace { [dis8 ( d8] } ) c2 c4 } \context Staff = SC { c2 c2 c4 } diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 94671aabf0..781f03393f 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -399,7 +399,7 @@ Auto_beam_engraver::acknowledge_grob (Grob_info info) /* ignore grace notes. */ - if (bool (beam_start_location_.grace_mom_) != bool (now_mom ().grace_mom_)) + if (bool (beam_start_location_.grace_part_) != bool (now_mom ().grace_part_)) return ; diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 7b506953c8..122a7ecd3c 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -242,7 +242,7 @@ Beam_engraver::acknowledge_grob (Grob_info info) { Moment now = now_mom(); - if(bool (now.grace_mom_ ) != bool (beam_start_mom_.grace_mom_)) + if(bool (now.grace_part_ ) != bool (beam_start_mom_.grace_part_)) return ; Item *stem_l = dynamic_cast (info.elem_l_); diff --git a/lily/grace-iterator.cc b/lily/grace-iterator.cc index 9248e071f8..fde8167730 100644 --- a/lily/grace-iterator.cc +++ b/lily/grace-iterator.cc @@ -22,10 +22,10 @@ Grace_iterator::~Grace_iterator () void -Grace_iterator::process (Moment m ) +Grace_iterator::process (Moment m) { Moment main ; - main.main_part_ = m.grace_mom_; + main.main_part_ = music_length_.grace_part_ + m.grace_part_; Music_wrapper_iterator::process (main); } @@ -43,7 +43,7 @@ Grace_iterator::pending_moment () const Moment cp =Music_wrapper_iterator::pending_moment(); Moment pending; - pending.grace_mom_ = - music_length_.main_part_ + cp.main_part_; + pending.grace_part_ = cp.main_part_- music_length_.grace_part_ ; return pending; } diff --git a/lily/grace-music.cc b/lily/grace-music.cc index 9e88f7b835..27c88c6f7b 100644 --- a/lily/grace-music.cc +++ b/lily/grace-music.cc @@ -21,7 +21,7 @@ Grace_music::length_mom () const { Moment l = Music_wrapper::length_mom (); Moment gl; - gl.grace_mom_ = l.main_part_ + l.grace_mom_ ; + gl.grace_part_ = l.main_part_ + l.grace_part_ ; return gl; } @@ -29,7 +29,7 @@ Grace_music::length_mom () const Moment Grace_music::start_mom () const { - return Music::start_mom (); + return - length_mom (); } Grace_music::Grace_music () diff --git a/lily/include/moment.hh b/lily/include/moment.hh index fca85bb458..a882bb0986 100644 --- a/lily/include/moment.hh +++ b/lily/include/moment.hh @@ -14,7 +14,8 @@ #include "rational.hh" /** - Rationals with glue for Guilification; + Musical timing (Main-timing, grace-timing) with glue for + Guilification; */ class Moment { @@ -26,7 +27,8 @@ public: Moment (Rational m); - + Moment operator - () const; + void operator += (Moment const &m); void operator -= (Moment const &m); @@ -34,7 +36,7 @@ public: void operator /= (Moment const &m); Rational main_part_; - Rational grace_mom_; + Rational grace_part_; void set_infinite (int k); diff --git a/lily/include/sequential-music-iterator.hh b/lily/include/sequential-music-iterator.hh index 6f13f44141..fcedb517f7 100644 --- a/lily/include/sequential-music-iterator.hh +++ b/lily/include/sequential-music-iterator.hh @@ -12,11 +12,35 @@ #include "music-iterator.hh" +/* + + This is a lookahead list for grace notes. + + { ... X \grace Y Z ... } + + normally, the ending of X is the start of Z. In case of a grace + note, we take off a little at the end of X. What is stored: START + (start point of X), LENGTH (length of X), GRACE_START (start_music + of Y), and the next fixup element. + + This is also done for nested musics, i.e. + + voiceA = \notes { \grace b16 c'2 } + voiceB = \notes { c'2 \voiceA } + + the iterator for voiceB will contain a fixup entry with (START=0/1, + LENGTH=2/1, GRACE_START=(0G-1/16) ) + + Graces at the start of a sequential music iterator are handled + by initting here_mom_ with Music::start_music (); no fixups are needed. + +*/ struct Grace_skip { Moment start_; Rational length_; - Rational grace_length_; + + Rational grace_start_; Grace_skip *next_; }; diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 2e9d260163..11f6bd559f 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -98,7 +98,7 @@ String Midi_event::str () const { Rational rat_dt = (delta_mom_.main_part_ * Rational (384) + - delta_mom_.grace_mom_ * Rational (100))*Rational (4); + delta_mom_.grace_part_ * Rational (100))*Rational (4); int delta_i = int (rat_dt); String delta_str = Midi_item::i2varint_str (delta_i); diff --git a/lily/moment.cc b/lily/moment.cc index ca6188f944..5a3ff5f8fc 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -98,7 +98,7 @@ Moment::compare (Moment const &a, Moment const &b) if (c) return c; - return Rational::compare (a.grace_mom_, b.grace_mom_); + return Rational::compare (a.grace_part_, b.grace_part_); } Moment::Moment () @@ -109,32 +109,32 @@ Moment::Moment () Moment::Moment (int m) { main_part_ = Rational(m); - grace_mom_ = Rational( 0); + grace_part_ = Rational( 0); } Moment::Moment (int m, int n) { main_part_ = Rational (m,n); - grace_mom_ = Rational (0); + grace_part_ = Rational (0); } Moment::Moment (Rational m) { main_part_ = m; - grace_mom_ = Rational (0); + grace_part_ = Rational (0); } void Moment::operator += (Moment const &src) { main_part_ +=src.main_part_ ; - grace_mom_ += src.grace_mom_; + grace_part_ += src.grace_part_; } void Moment::operator -= (Moment const &src) { main_part_ -= src.main_part_ ; - grace_mom_ -= src.grace_mom_; + grace_part_ -= src.grace_part_; } /* @@ -144,7 +144,7 @@ void Moment::operator *= (Moment const &src) { main_part_ *= src.main_part_ ; - grace_mom_ *= src.main_part_; + grace_part_ *= src.main_part_; } /* @@ -154,7 +154,7 @@ void Moment::operator /= (Moment const &src) { main_part_ /= src.main_part_ ; - grace_mom_ /= src.main_part_; + grace_part_ /= src.main_part_; } @@ -174,7 +174,7 @@ Moment::num () const { return main_part_.num (); } Moment::operator bool () { - return main_part_ || grace_mom_; + return main_part_ || grace_part_; } void @@ -187,5 +187,19 @@ Moment::set_infinite (int k) String Moment::str () const { - return main_part_.str (); + String s = main_part_.str (); + if (grace_part_) + { + s += "G" + grace_part_.str (); + } + return s; +} + +Moment +Moment::operator - ( ) const +{ + Moment m; + m.grace_part_ = -grace_part_; + m.main_part_ = -main_part_; + return m; } diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index 47927f6cb9..17da5f4674 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -75,15 +75,15 @@ Music_sequence::cumulative_length () const for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) { Moment l = unsmob_music (gh_car (s))->length_mom (); - if (last_len.grace_mom_ && l.main_part_) + if (last_len.grace_part_ && l.main_part_) { - last_len.grace_mom_ = Rational (0); + last_len.grace_part_ = Rational (0); } cumulative += last_len; last_len = l; } - last_len.grace_mom_ = Rational (0); + last_len.grace_part_ = Rational (0); cumulative += last_len; return cumulative; @@ -170,9 +170,9 @@ Music_sequence::first_start () const if (l.main_part_) return mus->start_mom (); - else if (l.grace_mom_) + else if (l.grace_part_) { - m.grace_mom_ = - l.grace_mom_; + m.grace_part_ = - l.grace_part_; return m; } } diff --git a/lily/paper-stream.cc b/lily/paper-stream.cc index ba3c9ee115..d2bbeb3f9c 100644 --- a/lily/paper-stream.cc +++ b/lily/paper-stream.cc @@ -71,7 +71,8 @@ Paper_stream::Paper_stream (String filename) Paper_stream::~Paper_stream () { close_file_stream (os_); - assert (nest_level == 0); + if (nest_level != 0) + programming_error ("Brace nesting in paper output doesn't match"); } // print string. don't forget indent. diff --git a/lily/parser.yy b/lily/parser.yy index 4f4747ab5a..b9f4793d2c 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -806,7 +806,7 @@ Composite_music: chm->set_spot (*$3->origin ()); } | GRACE Music { -#if 1 +#if 0 /* The other version is for easier debugging of Sequential_music_iterator in combination with grace notes. diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 70844dc5b6..17aec42ba0 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -139,8 +139,10 @@ Script_engraver::acknowledge_grob (Grob_info inf) } if (Side_position_interface::get_axis (e) == X_AXIS && !e->parent_l (Y_AXIS)) - e->set_parent (inf.elem_l_, Y_AXIS); - + { + e->set_parent (inf.elem_l_, Y_AXIS); + e->add_dependency (inf.elem_l_); // ?? + } Side_position_interface::add_support (e,inf.elem_l_); } } diff --git a/lily/separation-item.cc b/lily/separation-item.cc index b5642dbc26..522cde9ac1 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -60,6 +60,14 @@ Separation_item::my_width (Grob *me) } } + SCM pad = me->get_grob_property ("padding"); + + if (gh_number_p (pad)) + { + w[RIGHT] += gh_scm2double (pad)/2; + w[LEFT] -= gh_scm2double (pad)/2; + } + return w; // add this->offset_ ? this-> relative_coordinate ()? } diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc index e02847f991..7a6b240a15 100644 --- a/lily/sequential-music-iterator.cc +++ b/lily/sequential-music-iterator.cc @@ -27,8 +27,6 @@ here_mom_ = sum (length (musiclist [start ... cursor>)) %) */ - - Sequential_music_iterator::Sequential_music_iterator () { cursor_ = SCM_EOL; @@ -59,33 +57,33 @@ Grace_skip * get_grace_skips (SCM cursor) { Moment here (0); - Moment last (here); + Moment last (-1); Grace_skip *head = 0; Grace_skip **tail = &head; - bool first = true; - for (; gh_pair_p (cursor); cursor = gh_cdr (cursor)) { Music * mus = unsmob_music (gh_car (cursor)); Moment l =mus->length_mom (); - if (l.main_part_) - { - first = false; - last = here; - here += l; - } - else if(l.grace_mom_ && !first) + Moment s = mus->start_mom (); + + if (s.grace_part_ && last >= Moment (0)) { - assert (!l.main_part_); Grace_skip *p =new Grace_skip; p->start_ = last; p->length_ = (here - last).main_part_; - p->grace_length_ = l.grace_mom_; + p->grace_start_ = s.grace_part_; p->next_ = 0; *tail = p; tail = &(*tail)->next_; } + + if (l.main_part_) + { + l.grace_part_ = Rational (0); + last = here; + here += l; + } } return head; } @@ -123,24 +121,31 @@ Sequential_music_iterator::next_element () Moment len =iter_p_->music_length_mom (); Moment start = iter_p_->music_start_mom (); assert (!grace_skips_ || grace_skips_->start_ >= here_mom_); - + if (len.main_part_ && grace_skips_ && grace_skips_->start_ == here_mom_) { Moment sk; sk.main_part_ = grace_skips_->length_; here_mom_ += sk; - here_mom_.grace_mom_ = - grace_skips_->grace_length_; + here_mom_.grace_part_ = grace_skips_->grace_start_; Grace_skip * n =grace_skips_->next_; - delete grace_skips_; + delete grace_skips_; grace_skips_ = n; } - else if (len.grace_mom_) + else if (len.grace_part_ && !len.main_part_) { - here_mom_.grace_mom_ =0; + here_mom_.grace_part_ =0; } else { + /* + !len.grace_part_ || len.main_part_ + + We skip over a big chunk (mainpart != 0). Any starting graces + in that chunk are compensated by subtracting START. + + */ here_mom_ += len - start; } @@ -157,7 +162,6 @@ Sequential_music_iterator::next_element () move to context of child iterator if it is deeper down in the hierarchy. */ - void Sequential_music_iterator::descend_to_child () { @@ -254,7 +258,7 @@ Sequential_music_iterator::process (Moment until) do the stuff/note/rest preceding a grace. */ Moment u = until; - u.grace_mom_ = 0; + u.grace_part_ = 0; iter_p_->process (u - here_mom_); } else @@ -279,16 +283,22 @@ Sequential_music_iterator::pending_moment () const { Moment cp = iter_p_->pending_moment (); - if (grace_skips_ - && here_mom_ == grace_skips_->start_ + /* + Fix-up a grace note halfway in the music. + */ + if (grace_skips_ && here_mom_ == grace_skips_->start_ && cp.main_part_ >= grace_skips_->length_) { - cp += here_mom_ ; - cp.grace_mom_ = - grace_skips_->grace_length_; - return cp; + cp += here_mom_ ; + cp.grace_part_ = grace_skips_->grace_start_; + return cp; + } - else - return cp + here_mom_ - iter_p_->music_start_mom (); + + /* + Fix-up a grace note at the start of the music. + */ + return cp + here_mom_ - iter_p_->music_start_mom (); } diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 497f4c934b..636757b94d 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -72,7 +72,7 @@ find_runs (Grob*me, Link_array cols) { Moment w = Paper_column::when_mom (cols[i]); - if (!w.grace_mom_ && Paper_column::musical_b (cols[i])) + if (!w.grace_part_ && Paper_column::musical_b (cols[i])) { filter_cols.push (cols[i]); col_moments.push (w); @@ -125,7 +125,7 @@ Spacing_spanner::do_measure (Grob*me, Link_array const & cols) /* ignore grace notes for shortest notes. */ - if (when && when->grace_mom_) + if (when && when->grace_part_) continue; SCM st = cols[i]->get_grob_property ("shortest-starter-duration"); @@ -469,7 +469,7 @@ Spacing_spanner::note_spacing (Grob*me, Grob *lc, Grob *rc, ugh: 0.1 is an arbitrary distance. */ dist *= (double) (delta_t.main_part_ / shortest_playing_len.main_part_) - + 0.1 * (double) (delta_t.grace_mom_ / shortest_playing_len.main_part_); + + 0.1 * (double) (delta_t.grace_part_ / shortest_playing_len.main_part_); @@ -486,9 +486,9 @@ Spacing_spanner::note_spacing (Grob*me, Grob *lc, Grob *rc, if (lm && rm) { - if (lm->grace_mom_ && rm->grace_mom_) + if (lm->grace_part_ && rm->grace_part_) dist *= 0.5; - else if (!rm->grace_mom_ && lm->grace_mom_) + else if (!rm->grace_part_ && lm->grace_part_) dist *= 0.7; } diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index c8ec356f52..729a926b01 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -381,7 +381,9 @@ ScoreContext = \translator { keyAccidentalOrder = #'( (6 . -1) (2 . -1) (5 . -1 ) (1 . -1) (4 . -1) (0 . -1) (3 . -1) (3 . 1) (0 . 1) (4 . 1) (1 . 1) (5 . 1) (2 . 1) (6 . 1) - ) + (6 . -2) (2 . -2) (5 . -2 ) (1 . -2) (4 . -2) (0 . -2) (3 . -2) + (3 . 2) (0 . 2) (4 . 2) (2 . 2) (5 . 2) (2 . 2) (6 . 2) + ) breakAlignOrder = #'( Instrument_name Left_edge_item diff --git a/ly/grace-init.ly b/ly/grace-init.ly index 92e9c30c2f..b9a895cdc4 100644 --- a/ly/grace-init.ly +++ b/ly/grace-init.ly @@ -18,8 +18,11 @@ startGraceMusic = { \property Voice.Beam \override #'space-function = #grace-beam-space-function \property Voice.Beam \override #'thickness = #0.3 - % must use staff. Accidentals should also be smaller. - \property Staff.fontSize = #-2 + % Can't use Staff.fontSize, since time sigs, keys sigs, etc. will + % be smaller as well. + + \property Voice.fontSize = #-2 + \property Staff.LocalKeyItem \override #'font-relative-size = #-2 } stopGraceMusic = { @@ -34,5 +37,9 @@ stopGraceMusic = { \property Voice.Stem \revert #'length \property Voice.Stem \revert #'direction - \property Staff.fontSize \unset + % Can't use Staff.fontSize, since time sigs, keys sigs, etc. will + % be smaller as well. + + \property Voice.fontSize \unset + \property Staff.LocalKeyItem \revert #'font-relative-size } diff --git a/scripts/etf2ly.py b/scripts/etf2ly.py index 1c9487df19..7b902765f2 100644 --- a/scripts/etf2ly.py +++ b/scripts/etf2ly.py @@ -174,16 +174,7 @@ def lily_notename (tuple2): (n, a) = tuple2 nn = chr ((n+ 2)%7 + ord ('a')) - if a == -1: - nn = nn + 'es' - elif a == -2: - nn = nn + 'eses' - elif a == 1: - nn = nn + 'is' - elif a == 2: - nn = nn + 'isis' - - return nn + return nn + {-2:'eses', -1:'es', 0:'', 1:'is', 2:'isis'}[a] class Tuplet: @@ -729,6 +720,10 @@ Add None to LIST until it contains entry number NO. return list def read_finale_value (str): + """ +Pry off one value from STR. The value may be $hex, decimal, or "string". +Return: (value, rest-of-STR) + """ while str and str[0] in ' \t\n': str = str[1:] diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 1e9a7329b3..63ded478b5 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -538,7 +538,8 @@ lily output file in TFILES after that, and return the Latex file constructed. ' ''' if extra['pagenumber'] and extra['pagenumber'][-1] and extra['pagenumber'][-1] != 'no': - s = s + '\\pagestyle{plain}\n' + s = s + '\setcounter{page}{%s}\n' % (extra['pagenumber'][-1]) + s = s + '\\pagestyle{plain}\n' else: s = s + '\\pagestyle{empty}\n'