From e4fb8081020936c4a0191cc8d76be27cec742e56 Mon Sep 17 00:00:00 2001 From: hanwen Date: Fri, 23 Jul 2004 18:41:35 +0000 Subject: [PATCH] * lily/ledger-line-engraver.cc: new file. * lily/ledger-line-spanner.cc (print): new file. Set limits to ledger line length to avoid clashes. --- VERSION | 2 +- input/regression/auto-beam-no-beam.ly | 8 ++++-- input/regression/auto-beam.ly | 8 +----- input/regression/bar-check-redefine.ly | 5 ++-- input/regression/lyric-combine-polyphonic.ly | 6 ++-- input/regression/lyric-hyphen.ly | 13 +++++---- input/regression/multi-measure-rest-grace.ly | 10 +++---- input/regression/new-slur.ly | 10 +++---- input/regression/newaddlyrics.ly | 9 +----- input/regression/part-combine-solo-end.ly | 15 +++++----- input/regression/property-grace-polyphony.ly | 3 +- input/regression/property-once.ly | 18 ++++++------ input/regression/quote-transposition.ly | 21 +++++++------- input/regression/rhythmic-staff.ly | 9 +++--- lily/ambitus.cc | 3 +- lily/include/paper-column.hh | 2 +- lily/include/spanner.hh | 2 +- lily/include/stem.hh | 2 +- lily/ledger-line-engraver.cc | 1 - lily/ledger-line-spanner.cc | 12 +++++--- lily/new-slur.cc | 2 +- lily/note-spacing.cc | 3 +- lily/slur-quanting.cc | 29 +++++++++++++++++--- lily/stem-tremolo.cc | 7 ++--- lily/stem.cc | 4 +-- ly/engraver-init.ly | 3 +- scm/define-grob-properties.scm | 8 ------ 27 files changed, 109 insertions(+), 106 deletions(-) diff --git a/VERSION b/VERSION index 6da315743f..5e56c23773 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=3 -PATCH_LEVEL=7 +PATCH_LEVEL=8 MY_PATCH_LEVEL= diff --git a/input/regression/auto-beam-no-beam.ly b/input/regression/auto-beam-no-beam.ly index 96c4c89a09..ac170d5505 100644 --- a/input/regression/auto-beam-no-beam.ly +++ b/input/regression/auto-beam-no-beam.ly @@ -5,8 +5,10 @@ } + \version "2.3.4" +\paper { + raggedright = ##t +} -\score { - { c8 c-\noBeam c c } - } +{ c8 c-\noBeam c c } diff --git a/input/regression/auto-beam.ly b/input/regression/auto-beam.ly index e5e61b0ea6..38c0f2de08 100644 --- a/input/regression/auto-beam.ly +++ b/input/regression/auto-beam.ly @@ -1,15 +1,10 @@ - \header { - texidoc="Beams are place automatically; the last measure should have a single beam." - } \version "2.3.4" - - \paper { raggedright = ##t } \score { @@ -20,8 +15,7 @@ beam." \paper { \context { \Staff - \remove "Clef_engraver" -%% \remove "Staff_symbol_engraver" + \remove "Clef_engraver" } } } diff --git a/input/regression/bar-check-redefine.ly b/input/regression/bar-check-redefine.ly index 24860d30d3..b8f5c885ba 100644 --- a/input/regression/bar-check-redefine.ly +++ b/input/regression/bar-check-redefine.ly @@ -6,7 +6,6 @@ identifier @code{pipeSymbol}." pipeSymbol = \bar "||" -\score { - { c'2 | c'2 | } -} +\paper { raggedright = ##t } +{ c'2 | c'2 | } diff --git a/input/regression/lyric-combine-polyphonic.ly b/input/regression/lyric-combine-polyphonic.ly index 53ff8461b9..0c2a3ae6c8 100644 --- a/input/regression/lyric-combine-polyphonic.ly +++ b/input/regression/lyric-combine-polyphonic.ly @@ -12,6 +12,9 @@ texidoc ="Polyphonic rhythms and rests do not disturb \time 8/8 \key des \major << + \lyricsto "one" \new Lyrics \lyrics { + Do mi nus ex + } \context Voice = one { \voiceOne bes'4 bes'4 @@ -24,9 +27,6 @@ texidoc ="Polyphonic rhythms and rests do not disturb \lyricsto "two" \new Lyrics \lyrics { Do na } - \lyricsto "one" \new Lyrics \lyrics { - Do mi nus ex - } >> } \paper { raggedright = ##t} diff --git a/input/regression/lyric-hyphen.ly b/input/regression/lyric-hyphen.ly index 886796a0d3..95a9865d7c 100644 --- a/input/regression/lyric-hyphen.ly +++ b/input/regression/lyric-hyphen.ly @@ -2,13 +2,16 @@ \header { texidoc = "In lyrics, hyphens may be used." } -\score{ - << - \context Staff { c' (c') c'( c') } - \context Lyrics \lyrics { bla -- alb xxx -- yyy } - >> +\paper { + + raggedright= ##t } +<< + \context Staff { c' (c') c'( c') } + \context Lyrics \lyrics { bla -- alb xxx -- yyy } +>> + diff --git a/input/regression/multi-measure-rest-grace.ly b/input/regression/multi-measure-rest-grace.ly index e766b599e6..d1b4d66478 100644 --- a/input/regression/multi-measure-rest-grace.ly +++ b/input/regression/multi-measure-rest-grace.ly @@ -5,9 +5,9 @@ texidoc= "Multi-measure rests are centered also in the case of grace notes." } -\score { - << - \new Staff { R1 R1 R1*3 } - \new Staff { \clef bass c1 \grace c8 c2 c2 c1 \grace c16 c2 c2 c1 } +\paper { raggedright = ##t } + +<< + \new Staff { R1 R1 R1*3 } + \new Staff { \clef bass c1 \grace c8 c2 c2 c1 \grace c16 c2 c2 c1 } >> -} diff --git a/input/regression/new-slur.ly b/input/regression/new-slur.ly index a3ae44c1c3..9f7fd0daa5 100644 --- a/input/regression/new-slur.ly +++ b/input/regression/new-slur.ly @@ -12,12 +12,9 @@ %% \score \relative { - \override Slur #'after-line-breaking-callback = #New_slur::after_line_breaking - \override Slur #'print-function = #New_slur::print - \override Slur #'height = ##f - + \grace e=''16( d8.[) c16] - d8.[ \grace f16( e16)] + d=''8.[ \grace f16( e16)] s2 << {c=''8.([ es16] bes4~bes )} \\ @@ -41,7 +38,6 @@ c,^( c'' c) c,,^( c'') c,,^( c') - s4 | b='2( a4) s4 | b='4.( c8) s2 | << c=''1_( @@ -49,6 +45,8 @@ \break b4) e=''4.( c8) s4 + | << { b='8[( c]) } \\ + { b='8[( c]) }>> diff --git a/input/regression/newaddlyrics.ly b/input/regression/newaddlyrics.ly index 6011d3c194..1a469c7844 100644 --- a/input/regression/newaddlyrics.ly +++ b/input/regression/newaddlyrics.ly @@ -3,32 +3,25 @@ texidoc = "newlyrics, multiple stanzas, multiple lyric voices." } - -%% only this works as advertised... +\paper { raggedright = ##t } << \new Staff \relative { d'2 d c4 bes a2 \break - c2 c d4 f g2 } \newlyrics { My first Li -- ly song, - Not much can go wrong! } \newlyrics { - My next Li -- ly verse Not much can go wrong! } \new Staff \relative { \clef bass d2 d c4 bes a2 \break - c2 c d4 f g2 } \newlyrics { MY FIRST LI -- LY SONG, - NOT MUCH CAN GO WRONG! } \newlyrics { - MY NEXT LI -- LY VERSE NOT MUCH CAN GO WRONG! } >> diff --git a/input/regression/part-combine-solo-end.ly b/input/regression/part-combine-solo-end.ly index 8a5169d034..5a91736369 100644 --- a/input/regression/part-combine-solo-end.ly +++ b/input/regression/part-combine-solo-end.ly @@ -6,12 +6,11 @@ } \version "2.3.4" +\paper { raggedright = ##t } -\score { - << - \new Staff - \partcombine - { R1 * 2 } - { c'8\> c'\! r2. } - >> -} +<< + \new Staff + \partcombine + { R1 * 2 } + { c'8\> c'\! r2. } +>> diff --git a/input/regression/property-grace-polyphony.ly b/input/regression/property-grace-polyphony.ly index 46202ef924..72e8798d41 100644 --- a/input/regression/property-grace-polyphony.ly +++ b/input/regression/property-grace-polyphony.ly @@ -5,13 +5,12 @@ not interfere with the overrides and reverts from polyphony." } +\paper { raggedright = ##t } \version "2.3.4" -\score { \relative c'' { << { \grace e8 d2 } \\ { a2 } >> } -} diff --git a/input/regression/property-once.ly b/input/regression/property-once.ly index 233a809603..a7e410ea7e 100644 --- a/input/regression/property-once.ly +++ b/input/regression/property-once.ly @@ -4,15 +4,15 @@ texidoc = "Once properties take effect during a single time step only." } -\score { - \relative c' { - c4 - \once \set Stem = #'() - c4 - \once \override Stem #'thickness = #5.0 - c4 - c4 - } +\paper { raggedright = ##t } + +\relative c' { + c4 + \once \set Stem = #'() + c4 + \once \override Stem #'thickness = #5.0 + c4 + c4 } diff --git a/input/regression/quote-transposition.ly b/input/regression/quote-transposition.ly index d7c2a5cc7a..98349f27fa 100644 --- a/input/regression/quote-transposition.ly +++ b/input/regression/quote-transposition.ly @@ -8,6 +8,8 @@ In this example, all instruments play sounding central C, the target is a instru } \version "2.3.4" +\paper { raggedright = ##t } + \addquote clarinet { \transposition bes @@ -15,19 +17,16 @@ In this example, all instruments play sounding central C, the target is a instru d'16 d'16 d'8 d'16 d'16 d'8 d'16 d'16 d'8 - } +} \addquote sax { \transposition es' a8 a a a a a a a - } - -\score { - { - \transposition f % french horn - - g'4 - << \quote clarinet 4 s4^"clar" >> - << \quote sax 4 s4^"sax" >> - } +} +{ + \transposition f % french horn + + g'4 + << \quote clarinet 4 s4^"clar" >> + << \quote sax 4 s4^"sax" >> } diff --git a/input/regression/rhythmic-staff.ly b/input/regression/rhythmic-staff.ly index 8274163b01..e0955ed56d 100644 --- a/input/regression/rhythmic-staff.ly +++ b/input/regression/rhythmic-staff.ly @@ -5,9 +5,10 @@ texidoc = "In rhythmic staves stems should go up, and bar lines have the size for a 5 line staff. The whole note hangs from the rhythmic staff." } -\score { \context RhythmicStaff - { - r4 c4. c8 r8 c8 | c2 r2 | r1 - } +\paper { raggedright = ##t } + +\context RhythmicStaff +{ + r4 c4. c8 r8 c8 | c2 r2 | r1 } diff --git a/lily/ambitus.cc b/lily/ambitus.cc index cb46229ec0..739b68b09c 100644 --- a/lily/ambitus.cc +++ b/lily/ambitus.cc @@ -49,7 +49,8 @@ Ambitus::print (SCM smob) if (pmin < pmax) { - Real linethickness = me->get_paper ()->get_dimension (ly_symbol2scm ("linethickness")) * robust_scm2double (me->get_property ("thickness"), 1.0); + Real linethickness = me->get_paper ()->get_dimension (ly_symbol2scm ("linethickness")) + * robust_scm2double (me->get_property ("thickness"), 1.0); Real blotdiameter = me->get_paper ()->get_dimension (ly_symbol2scm ("blotdiameter")); Interval x_extent = 0.5 * linethickness *Interval (-1,1); Interval y_extent = Interval (pmin, pmax); diff --git a/lily/include/paper-column.hh b/lily/include/paper-column.hh index 935e7b8fe4..f69ced7147 100644 --- a/lily/include/paper-column.hh +++ b/lily/include/paper-column.hh @@ -30,7 +30,7 @@ public: virtual System *get_system () const; static int get_rank (Grob*); - + DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM)); diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index f04c3aca56..c4670d0122 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -68,7 +68,7 @@ protected: }; void add_bound_item (Spanner*, Grob*); -///DECLARE_UNSMOB (Spanner, spanner); +bool spanner_less ( Spanner *s1, Spanner* s2); int broken_spanner_index (Spanner * sp); #endif diff --git a/lily/include/stem.hh b/lily/include/stem.hh index e3078a13d6..22721dad31 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -19,7 +19,7 @@ public: static int duration_log (Grob *); static void set_beaming (Grob *, int, Direction d); static int get_beaming (Grob *, Direction d); - static Grob *get_beam (Grob *); + static Spanner *get_beam (Grob *); static Grob *first_head (Grob *); static Grob *last_head (Grob *); static Drul_array extremal_heads (Grob *); diff --git a/lily/ledger-line-engraver.cc b/lily/ledger-line-engraver.cc index 55913f0bea..7fda2b047b 100644 --- a/lily/ledger-line-engraver.cc +++ b/lily/ledger-line-engraver.cc @@ -11,7 +11,6 @@ #include "group-interface.hh" #include "spanner.hh" #include "engraver.hh" -#include "ambitus.hh" class Ledger_line_engraver : public Engraver { diff --git a/lily/ledger-line-spanner.cc b/lily/ledger-line-spanner.cc index ad03ae3649..2a213f9591 100644 --- a/lily/ledger-line-spanner.cc +++ b/lily/ledger-line-spanner.cc @@ -17,7 +17,6 @@ #include "spanner.hh" #include "group-interface.hh" #include "paper-column.hh" -#include "ambitus.hh" struct Ledger_line_spanner { @@ -110,6 +109,12 @@ Ledger_line_spanner::print (SCM smob) if (heads.is_empty ()) return SCM_EOL; + + // find size of note heads. + Grob * staff = Staff_symbol_referencer::get_staff_symbol (me); + if (!staff) + return SCM_EOL; + Stencil ledgers; Stencil default_ledger; @@ -125,8 +130,6 @@ Ledger_line_spanner::print (SCM smob) common[a] = common[a]->common_refpoint (g, a); } - // find size of note heads. - Grob * staff = Staff_symbol_referencer::get_staff_symbol (me); int interspaces = Staff_symbol::line_count (staff)-1; Ledger_requests reqs; Real length_fraction = 0.25; @@ -135,7 +138,8 @@ Ledger_line_spanner::print (SCM smob) Item *h = dynamic_cast (heads[i]); int pos = Staff_symbol_referencer::get_rounded_position (h); - if (abs (pos) > interspaces) + if (pos + && abs (pos) > interspaces) { Interval head_extent = h->extent (common[X_AXIS], X_AXIS); Interval ledger_extent = head_extent; diff --git a/lily/new-slur.cc b/lily/new-slur.cc index 53a004a16d..f617c320f1 100644 --- a/lily/new-slur.cc +++ b/lily/new-slur.cc @@ -1,5 +1,5 @@ /* - slur.cc -- implement score based Slur + slur.cc -- implement external interface for Slur source file of the GNU LilyPond music typesetter diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 54a391a881..57af38e0e2 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -250,7 +250,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, Drul_array props (me->get_property ("left-items"), me->get_property ("right-items")); - Drul_array beams_drul (0,0); + Drul_array beams_drul (0,0); Drul_array stems_drul (0,0); stem_dirs[LEFT] = stem_dirs[RIGHT] = CENTER; @@ -301,7 +301,6 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, stems_drul[d] = stem; beams_drul[d] = Stem::get_beam (stem); - Direction sd = Stem::get_direction (stem); if (stem_dirs[d] && stem_dirs[d] != sd) diff --git a/lily/slur-quanting.cc b/lily/slur-quanting.cc index 970a5a873d..cc33c91b17 100644 --- a/lily/slur-quanting.cc +++ b/lily/slur-quanting.cc @@ -1,5 +1,5 @@ /* - slur.cc -- implement score based Slur + slur-quanting.cc -- Score based slur formatting source file of the GNU LilyPond music typesetter @@ -24,6 +24,8 @@ #include "staff-symbol.hh" #include "stem.hh" #include "warn.hh" +#include "paper-column.hh" + struct Slur_score { @@ -92,7 +94,7 @@ struct Bound_info { Box stem_extent_; Direction stem_dir_; - Grob *bound_; + Item *bound_; Grob *note_column_; Grob *slur_head_; Grob *staff_; @@ -504,6 +506,22 @@ get_y_attachment_range (Spanner*me, return end_ys; } +bool +spanner_less (Spanner *s1, Spanner* s2) +{ + Slice b1, b2; + Direction d = LEFT; + do + { + b1[d] = s1->get_bound (d)->get_column ()->rank_; + b2[d] = s2->get_bound (d)->get_column ()->rank_; + } while (flip (&d) != LEFT); + + return b2[LEFT] <= b1[LEFT] && b2[RIGHT] >= b1[RIGHT] + && (b2[LEFT] != b1[LEFT] || b2[RIGHT] != b1[RIGHT]); +} + + Drul_array get_base_attachments (Spanner *me, Grob **common, Drul_array extremes) @@ -531,11 +549,14 @@ get_base_attachments (Spanner *me, } else { + bool same_beam = + (extremes[d].stem_ && extremes[-d].stem_ + && Stem::get_beam (extremes[d].stem_) == Stem::get_beam (extremes[-d].stem_)); if (stem && extremes[d].stem_dir_ == dir && Stem::get_beaming (stem, -d) - && columns.size () > 2 - ) + && (!spanner_less (me, Stem::get_beam (stem)) + || same_beam)) y = extremes[d].stem_extent_[Y_AXIS][dir]; else if (head) y = head->extent (common[Y_AXIS], Y_AXIS)[dir]; diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 84a70cc432..0a64888da4 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -6,7 +6,7 @@ (c) 1997--2004 Han-Wen Nienhuys */ - +#include "spanner.hh" #include "beam.hh" #include "directional-element-interface.hh" #include "item.hh" @@ -52,8 +52,7 @@ Stencil Stem_tremolo::raw_stencil (Grob *me) { Grob *stem = unsmob_grob (me->get_property ("stem")); - Grob *beam = Stem::get_beam (stem); - + Spanner*beam = Stem::get_beam (stem); Real dydx; if (beam) { @@ -119,7 +118,7 @@ Stem_tremolo::print (SCM grob) return SCM_EOL; } - Grob *beam = Stem::get_beam (stem); + Spanner *beam = Stem::get_beam (stem); Direction stemdir = Stem::get_direction (stem); if (stemdir == 0) stemdir = UP; diff --git a/lily/stem.cc b/lily/stem.cc index faca4aa184..c15682728e 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -736,11 +736,11 @@ Stem::off_callback (SCM element_smob, SCM) return scm_make_real (r); } -Grob * +Spanner * Stem::get_beam (Grob *me) { SCM b = me->get_property ("beam"); - return unsmob_grob (b); + return dynamic_cast (unsmob_grob (b)); } Stem_info diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 611e4ffd0d..a28944421b 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -30,6 +30,7 @@ \consists "Clef_engraver" \consists "Key_engraver" \consists "Time_signature_engraver" + \consists "Ledger_line_engraver" \consists "Staff_symbol_engraver" \consists "Collision_engraver" \consists "Rest_collision_engraver" @@ -137,6 +138,7 @@ \consists "Bar_engraver" \consists "Time_signature_engraver" \consists "Staff_symbol_engraver" + \consists "Ledger_line_engraver" \consists "Instrument_name_engraver" \consistsend "Axis_group_engraver" \accepts "Voice" @@ -175,7 +177,6 @@ \consists "Breathing_sign_engraver" % \consists "Rest_engraver" \consists "Note_heads_engraver" - \consists "Ledger_line_engraver" \consists "Rest_engraver" \consists "Stem_engraver" diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 65f0c23270..f338a60d78 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -367,9 +367,6 @@ this column. 10000 or more means forbid line break, -10000 or less means force line break. Other values influence line breaking decisions as a real penalty.") - (pitch-max ,ly:pitch? "Top pitch for ambitus.") - (pitch-min ,ly:pitch? "Bottom pitch for ambitus.") - (positions ,pair? "Pair of staff coordinates @code{(@var{left} . @var{right})}, where both @var{left} and @var{right} are in the @@ -536,7 +533,6 @@ sizes (like the dynamic @b{p} and @b{f}) on their baselines.") (after-line-breaking-callback ,procedure? "This procedure is called after line breaking. Its return value is ignored.") (all-elements ,grob-list? "list of all grobs in this line. Its function is to protect objects from being garbage collected.") - (ambituses ,grob-list? "list of Ambitus objects") (arpeggio ,ly:grob? "pointer to arpeggio object.") (beam ,ly:grob? "pointer to the beam, if applicable.") (center-element ,ly:grob? "grob which will be at the center of @@ -661,7 +657,6 @@ than a whole rest.") (join-left ,boolean? "is this ligature head joined with the previous one by a vertical line?") (context-info ,integer? "DOCME") (inclinatum ,boolean? "is this neume an inclinatum?") - (note-head-style ,string? "name of the font character to be used as note heads in the ambitus grob.") (oriscus ,boolean? "is this neume an oriscus?") (quilisma ,boolean? "is this neume a quilisma?") (pes-or-flexa ,boolean? "shall this neume be joined with the previous head?") @@ -673,9 +668,6 @@ than a whole rest.") ;; end ancient notation - ; ugh. - (accidentals-style ,symbol? "style for ambitus.") - ))) (define-public all-backend-properties -- 2.39.5