From cb22a7b04822316abffe8d4b90152616169cd1dc Mon Sep 17 00:00:00 2001 From: hanwen Date: Wed, 31 Dec 2003 00:44:33 +0000 Subject: [PATCH] * lily/melisma-engraver.cc (try_music): use melisma_busy() * lily/lyric-engraver.cc (process_music): remove alignment kludge * lily/lyric-combine-music-iterator.cc (melisma_busy): new function. * lily/stanza-number-engraver.cc (acknowledge_grob): rewrite * scm/define-grobs.scm (all-grob-descriptions): change StanzaNumber description: make side support, i.s.o. breakable. use Instrument_name_engraver for texts in the margin. * scm/define-translator-properties.scm: remove melismaEngraverBusy, stz property. * lily/self-aligment-interface.cc (aligned_on_parent): new function. * input/regression/lyric-phrasing-new.ly: new file. * lily/new-phrasing-engraver.cc (process_acknowledged_grobs): new engraver, redo lyric phrasing, but cleaner and simpler. Lyrics on melismata are now left-aligned. --- ChangeLog | 27 ++++ Documentation/user/refman.itely | 17 +- VERSION | 2 +- flower/file-path.cc | 6 +- flower/include/interval.hh | 6 +- flower/include/interval.tcc | 2 +- flower/include/string.hh | 2 +- flower/string.cc | 2 +- input/mutopia/F.Schubert/morgenlied.ly | 15 +- input/regression/lyric-phrasing-new.ly | 41 +++++ input/regression/stanza-number.ly | 13 +- lily/accidental-engraver.cc | 4 +- lily/accidental-placement.cc | 2 +- lily/accidental.cc | 2 +- lily/align-interface.cc | 2 +- lily/all-font-metrics.cc | 12 +- lily/ambitus.cc | 2 +- lily/arpeggio.cc | 2 +- lily/auto-change-iterator.cc | 2 +- lily/axis-group-interface.cc | 2 +- lily/beam-engraver.cc | 26 ++- lily/beam.cc | 18 +-- lily/break-algorithm.cc | 2 +- lily/break-align-interface.cc | 6 +- lily/break-substitution.cc | 2 +- lily/change-iterator.cc | 2 +- lily/clef.cc | 2 +- lily/custos.cc | 2 +- lily/font-metric.cc | 2 +- lily/gregorian-ligature.cc | 2 +- lily/hairpin.cc | 4 +- lily/hyphen-spanner.cc | 6 +- lily/include/molecule.hh | 2 +- lily/include/self-alignment-interface.hh | 1 + lily/include/translator-group.hh | 6 +- lily/include/translator.hh | 2 +- lily/input-file-results.cc | 6 +- lily/key-signature-interface.cc | 2 +- lily/lyric-combine-music-iterator.cc | 14 ++ lily/lyric-engraver.cc | 10 -- lily/lyric-phrasing-engraver.cc | 8 +- lily/main.cc | 12 +- lily/measure-grouping-spanner.cc | 2 +- lily/melisma-engraver.cc | 19 +-- lily/molecule.cc | 10 +- lily/new-accidental-engraver.cc | 2 +- lily/new-fingering-engraver.cc | 3 +- lily/new-phrasing-engraver.cc | 191 +++++++++++++++++++++++ lily/note-head-line-engraver.cc | 4 +- lily/note-head.cc | 6 +- lily/note-spacing.cc | 16 +- lily/part-combine-music-iterator.cc | 4 +- lily/rest-collision.cc | 2 +- lily/rest.cc | 2 +- lily/self-aligment-interface.cc | 49 ++++-- lily/separating-group-spanner.cc | 6 +- lily/separation-item.cc | 2 +- lily/side-position-interface.cc | 4 +- lily/skyline.cc | 10 +- lily/slur.cc | 2 +- lily/span-bar.cc | 10 +- lily/staff-spacing.cc | 6 +- lily/stanza-number-engraver.cc | 80 ++++------ lily/stem.cc | 10 +- lily/streams.cc | 2 +- lily/sustain-pedal.cc | 2 +- lily/system-start-delimiter.cc | 6 +- lily/system.cc | 2 +- lily/text-spanner.cc | 4 +- lily/time-signature.cc | 2 +- lily/translator-group.cc | 8 +- lily/translator-scheme.cc | 2 +- lily/translator.cc | 2 +- lily/virtual-font-metric.cc | 4 +- ly/engraver-init.ly | 1 + scm/define-grobs.scm | 18 +-- scm/define-translator-properties.scm | 5 +- scripts/convert-ly.py | 6 + 78 files changed, 548 insertions(+), 256 deletions(-) create mode 100644 input/regression/lyric-phrasing-new.ly create mode 100644 lily/new-phrasing-engraver.cc diff --git a/ChangeLog b/ChangeLog index 17a94eb201..b6dfe37b36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2003-12-31 Han-Wen Nienhuys + + * lily/melisma-engraver.cc (try_music): use melisma_busy() + + * lily/lyric-engraver.cc (process_music): remove alignment kludge + + * lily/lyric-combine-music-iterator.cc (melisma_busy): new function. + + * lily/stanza-number-engraver.cc (acknowledge_grob): rewrite + + * scm/define-grobs.scm (all-grob-descriptions): change + StanzaNumber description: make side support, i.s.o. breakable. + use Instrument_name_engraver for texts in the margin. + + * scm/define-translator-properties.scm: remove + melismaEngraverBusy, stz property. + + * *.cc: naming: change empty_b () into is_empty () + + * lily/self-aligment-interface.cc (aligned_on_parent): new function. + + * input/regression/lyric-phrasing-new.ly: new file. + + * lily/new-phrasing-engraver.cc (process_acknowledged_grobs): new + engraver, redo lyric phrasing, but cleaner and simpler. Lyrics on + melismata are now left-aligned. + 2003-12-30 Han-Wen Nienhuys * input/mutopia/F.Schubert/GNUmakefile: add morgenlied.ly diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 2a739ba89c..7006f6860e 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -3517,10 +3517,11 @@ The complete example is shown here: } @end lilypond -Stanza numbers, or the names of the singers can be added by setting -@code{LyricsVoice.Stanza} (for the first system) and -@code{LyricsVoice.stz} for the following systems. Notice how dots are -surrounded with spaces in @code{\lyrics} mode: +@cindex stanza number +@cindex singer's names +@cindex name of singer + +Stanza numbers can be added by setting @code{LyricsVoice.stanza}, e.g. @example \property LyricsVoice . stanza = "Bert" @@ -3528,6 +3529,14 @@ surrounded with spaces in @code{\lyrics} mode: \property LyricsVoice . stanza = "Ernie" @end example +Notice how dots are surrounded with spaces in @code{\lyrics} mode, to +prevent @code{LyricsVoice.stanza} being interpreted as a single +string. + +Names of the singers should be added using @code{LyricsVoice +. instrument} and @code{LyricsVoice . instr}, analogous to instrument +annotations for staves. + To make empty spaces in lyrics, use @code{\skip}. diff --git a/VERSION b/VERSION index aa9226608c..9f1c3eb43e 100644 --- a/VERSION +++ b/VERSION @@ -2,5 +2,5 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=1 PATCH_LEVEL=4 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=hwn1 diff --git a/flower/file-path.cc b/flower/file-path.cc index 14babc23ec..c59d218cd1 100644 --- a/flower/file-path.cc +++ b/flower/file-path.cc @@ -75,12 +75,12 @@ String Path::to_string () const { String s; - if (!root.empty_b ()) + if (!root.is_empty ()) s = root + ::to_string (ROOTSEP); - if (!dir.empty_b ()) + if (!dir.is_empty ()) s += dir + ::to_string (DIRSEP); s += base; - if (!ext.empty_b ()) + if (!ext.is_empty ()) s += ::to_string (EXTSEP) + ext; return s; } diff --git a/flower/include/interval.hh b/flower/include/interval.hh index 44a5d9ce7c..df96ce3966 100644 --- a/flower/include/interval.hh +++ b/flower/include/interval.hh @@ -25,7 +25,7 @@ struct Interval_t : public Drul_array { static T infinity () ; static String T_to_string (T arg); T center () const { - assert (!empty_b ()); + assert (!is_empty ()); return (elem (LEFT) + elem (RIGHT)) / T (2); } void translate (T t) @@ -57,7 +57,7 @@ struct Interval_t : public Drul_array { /* TODO: strip hungarian suffix. */ - bool empty_b () const { return elem (LEFT) > elem (RIGHT); } + bool is_empty () const { return elem (LEFT) > elem (RIGHT); } bool contains_b (Interval_t const&) const; Interval_t () { set_empty (); @@ -76,7 +76,7 @@ struct Interval_t : public Drul_array { return *this; } Interval_t &operator *= (T r) { - if (!empty_b ()) + if (!is_empty ()) { elem (LEFT) *= r; elem (RIGHT) *= r; diff --git a/flower/include/interval.tcc b/flower/include/interval.tcc index ddd2e1763b..7d316fce13 100644 --- a/flower/include/interval.tcc +++ b/flower/include/interval.tcc @@ -129,7 +129,7 @@ template String Interval_t::to_string () const { - if (empty_b ()) + if (is_empty ()) return "[empty]"; String s ("["); diff --git a/flower/include/string.hh b/flower/include/string.hh index 5f9f53ca72..bee1cf986a 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -89,7 +89,7 @@ public: void operator += (char const* s) { strh_ += s; } void operator += (String s); - bool empty_b () const; + bool is_empty () const; void append (String); void prepend (String); diff --git a/flower/string.cc b/flower/string.cc index e1216ec3a4..1b4a4ed857 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -153,7 +153,7 @@ String::get_str0 () } bool -String::empty_b () const +String::is_empty () const { return !length (); } diff --git a/input/mutopia/F.Schubert/morgenlied.ly b/input/mutopia/F.Schubert/morgenlied.ly index dc7eba773d..c3d13e6882 100644 --- a/input/mutopia/F.Schubert/morgenlied.ly +++ b/input/mutopia/F.Schubert/morgenlied.ly @@ -14,8 +14,7 @@ not be in the PD - but I am assuming there are no notable ones in this small piece. - The original compresses the entire music onto a single page, in 4 -systems. " + The original compresses the entire music onto a single page, in 4 systems." } @@ -35,7 +34,6 @@ systems. " melody = \notes \relative c'' \repeat volta 2 \context Voice = singer { \time 6/8 \autoBeamOff - \property Voice.automaticMelismata = ##t s1*0^\markup { \bold \bigger\bigger { \hspace #-3.0 Lieblich, etwas geschwind } } R2. r4 r8 c4 g8 | @@ -57,6 +55,8 @@ melody = \notes \relative c'' \repeat volta 2 \context Voice = singer { firstVerse = \lyrics { + \property LyricsVoice . stanza = "1." + Sü -- ßes Licht! Aus gol -- de -- nen Pfor -- ten brichst du __ \break sie -- gend durch __ die Nacht. Schö -- ner Tag, du __ bist er -- wacht. __ Mit \break ge -- heim -- nis -- vol -- len Wor -- ten, in me -- lo -- di -- schen Ak -- kor -- den, grüß __ ich __ \break @@ -64,6 +64,8 @@ firstVerse = \lyrics { } secondVerse = \lyrics { + \property LyricsVoice . stanza = "2." + Ach, der Lie -- be sanf "" -- tes We -- hen schwellt mir das be -- weg -- te __ Herz, sanft, wie ein ge -- lieb -- ter Schmerz. __ Dürft ich nur auf gold -- nen Hö -- hen mich im Mor -- gen -- duft er -- ge -- hen! Sehn -- sucht @@ -117,7 +119,7 @@ pianoLH = \notes \relative c'' \repeat volta 2 { \context LyricsVoice = "singer-2" \secondVerse >> \new PianoStaff << - \property PianoStaff.instrument = #"2 " + \property PianoStaff.instrument = \markup { \bold \bigger "2. " } \new Staff \pianoRH \new Staff \pianoLH >> @@ -136,6 +138,11 @@ pianoLH = \notes \relative c'' \repeat volta 2 { \translator { \PianoStaffContext VerticalAlignment \override #'forced-distance = #10 } + \translator { + \ScoreContext + \remove "Lyric_phrasing_engraver" + \consists "New_phrasing_engraver" + } } } diff --git a/input/regression/lyric-phrasing-new.ly b/input/regression/lyric-phrasing-new.ly new file mode 100644 index 0000000000..af1e074ffd --- /dev/null +++ b/input/regression/lyric-phrasing-new.ly @@ -0,0 +1,41 @@ +\header { + +texidoc = "Lyric phrasing: + + Normally, the lyric is centered on the note head. However, on + melismata, the text is left aligned on the left-side of the note head. + +" +} + + +\score{ +\context Staff { + \addlyrics + \notes \relative c' \context Voice = "bla" { + \autoBeamOff + c4( c16 d c b) c4 + d16[ e f g] + + } + \lyrics \context LyricsVoice = "bla-1" { + al tijd + izzz + } + + } + +\paper { raggedright = ##t + + \translator { + \ScoreContext + \remove "Lyric_phrasing_engraver" + \consists "New_phrasing_engraver" + } + \translator { + \VoiceContext + + } + } +} + diff --git a/input/regression/stanza-number.ly b/input/regression/stanza-number.ly index 3810db1d7a..cba123eb4f 100644 --- a/input/regression/stanza-number.ly +++ b/input/regression/stanza-number.ly @@ -1,17 +1,18 @@ -\version "1.9.8" +\version "2.1.4" + \header { -texidoc = "Stanza numbers may differ for the first and following systems." +texidoc = "Stanza numbers are put left of their lyric." } \score { << + \notes { r4 r4 c4 c4 } \context LyricsVoice \lyrics { - \property LyricsVoice . stanza = "first" - \property LyricsVoice . stz = \markup { "32" \super "nd" } - Foo1 Bar1 + \skip 2 + \property LyricsVoice . stanza = "1." + Foo8 Bar8 } - \notes { c''1 \break c''1 } >> \paper { raggedright = ##t } diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index e7ee765463..19fb8b16e8 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -117,7 +117,7 @@ calculates the number of accidentals on basis of the current local key sig */ static int -number_accidentals (SCM sig, Music * note, Pitch *pitch, SCM curbarnum, SCM lazyness, +number_accidentals (SCM sig, Music *, Pitch *pitch, SCM curbarnum, SCM lazyness, bool ignore_octave_b) { int n = pitch->get_notename (); @@ -204,7 +204,7 @@ number_accidentals (Music * note, Pitch *pitch, Translator_group * origin, else if (gh_symbol_p (ly_car (accidentals))) { SCM context =ly_car (accidentals); - while (origin && !origin->is_alias_b (context)) + while (origin && !origin->is_alias (context)) origin = origin->daddy_trans_; if (!origin) diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc index 2784ce198e..d8bd7aaeb8 100644 --- a/lily/accidental-placement.cc +++ b/lily/accidental-placement.cc @@ -119,7 +119,7 @@ Accidental_placement::get_relevant_accidental_extent (Grob *me, extent.unite (which->elem(i)->extent (item_col, X_AXIS)); } - if (!extent.empty_b()) + if (!extent.is_empty ()) { Real p = gh_scm2double (me->get_grob_property ("left-padding")); extent[LEFT] -= p; diff --git a/lily/accidental.cc b/lily/accidental.cc index 3daa6f26c2..759b492dc0 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -209,7 +209,7 @@ Accidental_interface::brew_molecule (SCM smob) String font_char = get_fontcharname (style, alteration); Molecule acc (fm->find_by_name ("accidentals-" + font_char)); - if (acc.empty_b()) + if (acc.is_empty ()) { me->warning (_f ("accidental `%s' not found", font_char)); } diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 5f7306d2b1..68ee8e506a 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -151,7 +151,7 @@ Align_interface::align_elements_to_extents (Grob * me, Axis a) for (int i=0; i < all_grobs.size (); i++) { Interval y = all_grobs[i]->extent (me, a); - if (!y.empty_b ()) + if (!y.is_empty ()) { Grob *e =dynamic_cast (all_grobs[i]); diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index e6eddd883f..7633665225 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -53,17 +53,17 @@ All_font_metrics::find_afm (String name) { String path; - if (path.empty_b ()) + if (path.is_empty ()) path = search_path_.find (name + ".afm"); - if (path.empty_b ()) + if (path.is_empty ()) { String p = kpathsea_find_afm (name.to_str0 ()); if (p.length ()) path = p; } - if (path.empty_b ()) + if (path.is_empty ()) return 0; if (verbose_global_b) @@ -127,16 +127,16 @@ All_font_metrics::find_tfm (String name) { String path; - if (path.empty_b ()) + if (path.is_empty ()) { String p = kpathsea_find_tfm (name.to_str0 ()); if (p.length ()) path = p; } - if (path.empty_b ()) + if (path.is_empty ()) path = search_path_.find (name + ".tfm"); - if (path.empty_b ()) + if (path.is_empty ()) return 0; if (verbose_global_b) diff --git a/lily/ambitus.cc b/lily/ambitus.cc index 853b2830b8..48eaa61711 100644 --- a/lily/ambitus.cc +++ b/lily/ambitus.cc @@ -143,7 +143,7 @@ Ambitus::brew_molecule (SCM smob) { note_head_style = String ("noteheads-2"); } - if (Font_interface::get_default_font (me)->find_by_name (note_head_style).empty_b ()) + if (Font_interface::get_default_font (me)->find_by_name (note_head_style).is_empty ()) { String message = "Ambitus: no such note head: `" + note_head_style + "'"; me->warning (_ (message.to_str0 ())); diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index ed040e70c5..aa14910a2d 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -54,7 +54,7 @@ Arpeggio::brew_molecule (SCM smob) - my_y); } - if (heads.empty_b ()) + if (heads.is_empty ()) { /* Dumb blonde error diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index 51e2284b2f..4bcb65314e 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -31,7 +31,7 @@ Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym, If \translator Staff = bass, then look for Staff = * */ - while (current && !current->is_alias_b (to_type_sym)) + while (current && !current->is_alias (to_type_sym)) { last = current; current = current->daddy_trans_; diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 674ac1d326..4d734640ed 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -45,7 +45,7 @@ Axis_group_interface::relative_group_extent (Axis a, Grob *common, SCM elts) { Grob * se = unsmob_grob (ly_car (s)); Interval dims = se->extent (common, a); - if (!dims.empty_b ()) + if (!dims.is_empty ()) r.unite (dims); } return r; diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 6bd0be9e63..2ee7b31778 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -112,7 +112,9 @@ Beam_engraver::try_music (Music *m) return false; if (d == START) - evs_drul_[d] = m; + { + evs_drul_[d] = m; + } else if (d==STOP) { now_stop_ev_ = m; @@ -123,9 +125,13 @@ Beam_engraver::try_music (Music *m) } void -Beam_engraver::set_melisma (bool m) +Beam_engraver::set_melisma (bool ml) { - daddy_trans_->set_property ("beamMelismaBusy", m ? SCM_BOOL_T :SCM_BOOL_F); + SCM m = get_property ("automaticMelismata"); + SCM b = get_property ("autoBeaming"); + + if (to_boolean (m) && !to_boolean (b)) + daddy_trans_->set_property ("beamMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F); } void @@ -154,6 +160,7 @@ Beam_engraver::process_music () return; } + set_melisma (true); prev_start_ev_ = evs_drul_[START]; beam_ = new Spanner (get_property ("Beam")); SCM smp = get_property ("measurePosition"); @@ -194,12 +201,8 @@ Beam_engraver::start_translation_timestep () if (beam_) { - SCM m = get_property ("automaticMelismata"); - SCM b = get_property ("autoBeaming"); - if (to_boolean (m) && !to_boolean (b)) - { - set_melisma (true); - } + set_melisma (true); + subdivide_beams_ = to_boolean(get_property("subdivideBeams")); beat_length_ = *unsmob_moment (get_property ("beatLength")); } @@ -218,12 +221,7 @@ Beam_engraver::stop_translation_timestep () beam_ = 0; beam_info_ = 0; typeset_beam(); - - if (to_boolean (get_property ("automaticMelismata")) - && !to_boolean (get_property ("autoBeaming"))) - { set_melisma (false); - } } } diff --git a/lily/beam.cc b/lily/beam.cc index 65da185282..6f509ce91b 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -266,7 +266,7 @@ Beam::connect_beams (Grob *me) } while (flip (&d) != LEFT); - if (!new_slice.empty_b()) + if (!new_slice.is_empty ()) last_int = new_slice; } else @@ -609,7 +609,7 @@ struct Int_set s.intersect (allowed_regions_[i]); - if (!s.empty_b ()) + if (!s.is_empty ()) { Interval before = allowed_regions_[i]; Interval after = allowed_regions_[i]; @@ -617,13 +617,13 @@ struct Int_set before[RIGHT] = s[LEFT]; after[LEFT] = s[RIGHT]; - if (!before.empty_b() && before.length () > 0.0) + if (!before.is_empty () && before.length () > 0.0) { allowed_regions_.insert (before, i); i++; } allowed_regions_.del (i); - if (!after.empty_b () && after.length () > 0.0) + if (!after.is_empty () && after.length () > 0.0) { allowed_regions_.insert (after, i); i++; @@ -669,7 +669,7 @@ Beam::consider_auto_knees (Grob* me) continue; Interval hps = Stem::head_positions (stem); - if(!hps.empty_b()) + if(!hps.is_empty ()) { hps[LEFT] += -1; hps[RIGHT] += 1; @@ -732,7 +732,7 @@ Beam::consider_auto_knees (Grob* me) stem->set_grob_property ("direction", scm_int2num (d)); hps.intersect (max_gap); - assert (hps.empty_b () || hps.length () < 1e-6 ); + assert (hps.is_empty () || hps.length () < 1e-6 ); } } } @@ -1003,7 +1003,7 @@ Beam::shift_region_to_valid (SCM grob) feasible_left_point.intersect (flp); } - if (feasible_left_point.empty_b()) + if (feasible_left_point.is_empty ()) { warning (_("Not sure that we can find a nice beam slope (no viable initial configuration found).")); } @@ -1231,13 +1231,13 @@ Beam::calc_stem_y (Grob *me, Grob* s, Grob ** common, if (french) { Slice bm = where_are_the_whole_beams (beaming); - if (!bm.empty_b()) + if (!bm.is_empty ()) stem_y += beam_translation * bm[-my_dir]; } else { Slice bm = Stem::beam_multiplicity(s); - if (!bm.empty_b()) + if (!bm.is_empty ()) stem_y +=bm[my_dir] * beam_translation; } diff --git a/lily/break-algorithm.cc b/lily/break-algorithm.cc index c9b74c3f47..cf0f0b04fc 100644 --- a/lily/break-algorithm.cc +++ b/lily/break-algorithm.cc @@ -72,7 +72,7 @@ Break_algorithm::generate_spacing_problem (Link_array const &curline, /* sort out how interfacing this should work; */ - if (line.empty_b ()) + if (line.is_empty ()) { sp->line_len_ = -1; } diff --git a/lily/break-align-interface.cc b/lily/break-align-interface.cc index c18f8ff78e..3584e3d077 100644 --- a/lily/break-align-interface.cc +++ b/lily/break-align-interface.cc @@ -82,12 +82,12 @@ Break_align_interface::do_alignment (Grob *me) { Interval y = elems[i]->extent (elems[i], X_AXIS); extents.push (y); - if (!y.empty_b()) + if (!y.is_empty ()) last_nonempty = i; } int idx = 0; - while (idx < extents.size () && extents[idx].empty_b ()) + while (idx < extents.size () && extents[idx].is_empty ()) idx++; Array offsets; @@ -102,7 +102,7 @@ Break_align_interface::do_alignment (Grob *me) { int next_idx = idx+1; while (next_idx < elems.size() && - extents[next_idx].empty_b() + extents[next_idx].is_empty () ) next_idx++; diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc index b97380ee7b..d9a766ff9f 100644 --- a/lily/break-substitution.cc +++ b/lily/break-substitution.cc @@ -282,7 +282,7 @@ struct Substitution_entry /* duh, don't support scores with more than 32000 systems. */ - if (sr.empty_b()) + if (sr.is_empty ()) { /* overflow if we don't treat this specially. diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc index b8ccb356b1..7d458029c9 100644 --- a/lily/change-iterator.cc +++ b/lily/change-iterator.cc @@ -49,7 +49,7 @@ Change_iterator::process (Moment m) If \translator Staff = bass, then look for Staff = * */ - while (current && !current->is_alias_b (to_type)) + while (current && !current->is_alias (to_type)) { last = current; current = current->daddy_trans_; diff --git a/lily/clef.cc b/lily/clef.cc index 0b72e88a88..41cf576c15 100644 --- a/lily/clef.cc +++ b/lily/clef.cc @@ -59,7 +59,7 @@ Clef::brew_molecule (SCM smob) String glyph = String (ly_scm2string (glyph_scm)); Font_metric *fm = Font_interface::get_default_font (me); Molecule out = fm->find_by_name (glyph); - if (out.empty_b()) + if (out.is_empty ()) { me->warning (_f ("clef `%s' not found", glyph.to_str0 ())); } diff --git a/lily/custos.cc b/lily/custos.cc index ad8d408ea9..121357c476 100644 --- a/lily/custos.cc +++ b/lily/custos.cc @@ -87,7 +87,7 @@ Custos::brew_molecule (SCM smob) Molecule molecule = Font_interface::get_default_font (me)->find_by_name (font_char); - if (molecule.empty_b ()) + if (molecule.is_empty ()) { me->warning (_f ("custos `%s' not found", font_char)); return SCM_EOL; diff --git a/lily/font-metric.cc b/lily/font-metric.cc index 37fc1c80e2..40a0269824 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -68,7 +68,7 @@ Font_metric::text_dimension (String text) const break; } } - if (ydims.empty_b ()) + if (ydims.is_empty ()) ydims = Interval (0,0); return Box (Interval (0, w), ydims); diff --git a/lily/gregorian-ligature.cc b/lily/gregorian-ligature.cc index 8e6f7194c7..f3043eeb84 100644 --- a/lily/gregorian-ligature.cc +++ b/lily/gregorian-ligature.cc @@ -13,7 +13,7 @@ void check_prefix (String name, int mask, int prefix_set, String *str) { if (prefix_set & mask) { - if (!str->empty_b ()) + if (!str->is_empty ()) *str += ", "; *str += name; } diff --git a/lily/hairpin.cc b/lily/hairpin.cc index c757f4ce1e..ab3dabeee3 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -75,7 +75,7 @@ Hairpin::brew_molecule (SCM smob) make the padding a little smaller, here. */ Interval e =b->extent (common, X_AXIS); - if (e.empty_b ()) + if (e.is_empty ()) e = Interval (0,0) + b->relative_coordinate (common, X_AXIS); x_points[d] = e.center () - d * padding /3; // ugh. @@ -83,7 +83,7 @@ Hairpin::brew_molecule (SCM smob) else { Interval e =b->extent (common, X_AXIS); - if (!e.empty_b ()) + if (!e.is_empty ()) x_points[d] = e[-d] - d*padding; } } diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index e8227bbf81..c3bea14259 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -59,7 +59,7 @@ Hyphen_spanner::brew_molecule (SCM smob) { Interval iv = sp->get_bound (d)->extent (common, X_AXIS); - bounds[d] = iv.empty_b () + bounds[d] = iv.is_empty () ? sp->get_bound (d)->relative_coordinate (common, X_AXIS) : iv[-d]; } @@ -91,7 +91,7 @@ Hyphen_spanner::brew_molecule (SCM smob) we should probably do something more intelligent when bounds is empty, but at least this doesn't crash. */ - Real w = bounds.empty_b () ? 0 : bounds.length (); + Real w = bounds.is_empty () ? 0 : bounds.length (); /* for length, use a geometric mean of the available space and some minimum */ @@ -125,7 +125,7 @@ Hyphen_spanner::brew_molecule (SCM smob) } Box b (Interval (-l/2,l/2), Interval (h,h+th)); Molecule mol (Lookup::filledbox (b)); - Real ct = bounds.empty_b () ? 0 : bounds.center () ; + Real ct = bounds.is_empty () ? 0 : bounds.center () ; mol.translate_axis (ct -sp->relative_coordinate (common, X_AXIS), X_AXIS); return mol.smobbed_copy (); } diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index eedacf62a9..17746ccafb 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -71,7 +71,7 @@ public: codify THIS into a Scheme expression. */ SCM create_scheme () const; - bool empty_b () const; + bool is_empty () const; static SCM ly_get_molecule_extent (SCM mol, SCM axis); diff --git a/lily/include/self-alignment-interface.hh b/lily/include/self-alignment-interface.hh index b725f81148..f7a45bb933 100644 --- a/lily/include/self-alignment-interface.hh +++ b/lily/include/self-alignment-interface.hh @@ -17,6 +17,7 @@ struct Self_alignment_interface static bool has_interface (Grob*); DECLARE_SCHEME_CALLBACK (aligned_on_self, (SCM element, SCM axis)); DECLARE_SCHEME_CALLBACK (centered_on_parent, (SCM element, SCM axis)); + DECLARE_SCHEME_CALLBACK (aligned_on_parent, (SCM element, SCM axis)); DECLARE_SCHEME_CALLBACK (centered_on_other_axis_parent, (SCM element, SCM axis)); }; #endif diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 87b9616339..5a1fc1f6ea 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -59,7 +59,7 @@ public: Translator_group* get_ancestor (int l=1); int get_depth () const; bool is_bottom_translator_b () const; - bool removable_b () const; + bool is_removable () const; void terminate_translator (Translator*r); Translator *remove_translator (Translator*trans); void check_removal (); @@ -82,4 +82,8 @@ public: virtual void each (Method_pointer); }; + +bool melisma_busy (Translator* tr); // where to put this? --hwn + + #endif // TRANSLATOR_GROUP_HH diff --git a/lily/include/translator.hh b/lily/include/translator.hh index 81b95bbdf7..ae0109329b 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -38,7 +38,7 @@ class Translator public: Music_output_def * output_def_; - bool is_alias_b (SCM) const; + bool is_alias (SCM) const; Translator (Translator const &); diff --git a/lily/input-file-results.cc b/lily/input-file-results.cc index ef55dee50c..90bf8d4e2a 100644 --- a/lily/input-file-results.cc +++ b/lily/input-file-results.cc @@ -88,7 +88,7 @@ write_dependency_file (String fn, out = " "; } String dep = deps[i]; - if (!dependency_prefix_global.empty_b ()) + if (!dependency_prefix_global.is_empty ()) { if (dep.index ('/') < 0) dep = dependency_prefix_global + dep; @@ -154,14 +154,14 @@ Input_file_results::Input_file_results (String init, String in_file, String out_ void do_one_file (String init, String in_file, String out_file) { - if (init.length () && global_path.find (init).empty_b ()) + if (init.length () && global_path.find (init).is_empty ()) { warning (_f ("can't find file: `%s'", init)); warning (_f ("(search path: `%s')", global_path.to_string ().to_str0 ())); return; } - if ((in_file != "-") && global_path.find (in_file).empty_b ()) + if ((in_file != "-") && global_path.find (in_file).is_empty ()) { warning (_f ("can't find file: `%s'", in_file)); return; diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index 76817e5e4b..7c175e20a0 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -134,7 +134,7 @@ Key_signature_interface::brew_molecule (SCM smob) Accidental_interface::get_fontcharname (style, alteration); Molecule acc (fm->find_by_name ("accidentals-" + font_char)); - if (acc.empty_b()) + if (acc.is_empty ()) { me->warning (_f ("accidental `%s' not found", font_char)); } diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc index 4715b76998..138a4ddcf1 100644 --- a/lily/lyric-combine-music-iterator.cc +++ b/lily/lyric-combine-music-iterator.cc @@ -39,6 +39,20 @@ private: }; +bool +melisma_busy (Translator* tr) +{ + SCM melisma_properties = tr->get_property ("melismaBusyProperties"); + bool busy = false; + + for (; gh_pair_p (melisma_properties); + melisma_properties = gh_cdr (melisma_properties)) + busy = busy || to_boolean (tr->internal_get_property (gh_car (melisma_properties))); + + return busy; +} + + /* Ugh, why static? diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index bbaa005cdf..33ced39172 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -63,16 +63,6 @@ Lyric_engraver::process_music () text_= new Item (get_property ("LyricText")); text_->set_grob_property ("text", req_->get_mus_property ("text")); - - /* - We can't reach the notehead where we're centered from here. So - we kludge. - - (UGH UGH, pulled amount of space out of thin air) - */ - - text_->translate_axis (0.66, X_AXIS); - announce_grob (text_, req_->self_scm()); } } diff --git a/lily/lyric-phrasing-engraver.cc b/lily/lyric-phrasing-engraver.cc index fab2a8e607..b3275a5705 100644 --- a/lily/lyric-phrasing-engraver.cc +++ b/lily/lyric-phrasing-engraver.cc @@ -204,7 +204,7 @@ Lyric_phrasing_engraver::acknowledge_grob (Grob_info i) record_notehead (voice_context_id, h); /* is it in a melisma ? */ - if (to_boolean (i.origin_trans_->get_property ("melismaEngraverBusy"))) + if (melisma_busy (i.origin_trans_)) { record_melisma (voice_context_id); } @@ -255,12 +255,12 @@ Lyric_phrasing_engraver::acknowledge_grob (Grob_info i) String get_context_id (Translator_group * ancestor, SCM type) { - while (ancestor != 0 && !ancestor->is_alias_b(type)) + while (ancestor && !ancestor->is_alias(type)) { ancestor = ancestor->daddy_trans_; } - if (ancestor != 0) + if (ancestor) { return ancestor->id_string_; } @@ -362,5 +362,5 @@ ENTER_DESCRIPTION(Lyric_phrasing_engraver, /* creats*/ "", /* accepts */ "", /* acks */ "lyric-syllable-interface note-head-interface lyric-extender-interface", - /* reads */ "automaticPhrasing melismaEngraverBusy associatedVoice phrasingPunctuation", + /* reads */ "automaticPhrasing associatedVoice phrasingPunctuation", /* write */ ""); diff --git a/lily/main.cc b/lily/main.cc index 44e2acf622..58d7553430 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -271,7 +271,7 @@ Path distill_inname (String str) { Path p = split_path (str); - if (str.empty_b () || str == "-") + if (str.is_empty () || str == "-") p.base = "-"; else { @@ -280,10 +280,10 @@ distill_inname (String str) for (int i = 0; extensions[i]; i++) { p.ext = orig_ext; - if (*extensions[i] && !p.ext.empty_b ()) + if (*extensions[i] && !p.ext.is_empty ()) p.ext += "."; p.ext += extensions[i]; - if (!global_path.find (p.to_string ()).empty_b ()) + if (!global_path.find (p.to_string ()).is_empty ()) break; } /* Reshuffle extension */ @@ -356,11 +356,11 @@ main_prog (void *, int, char **) outpath.root = ""; outpath.dir = ""; - if (!output_name_global.empty_b ()) + if (!output_name_global.is_empty ()) outpath = split_path (output_name_global); String init; - if (!init_name_global.empty_b ()) + if (!init_name_global.is_empty ()) init = init_name_global; else init = "init.ly"; @@ -420,7 +420,7 @@ main (int argc, char **argv) { String s = oparser_p_static->optional_argument_str0_; Path p = split_path (s); - if (s != "-" && p.ext.empty_b ()) + if (s != "-" && p.ext.is_empty ()) p.ext = output_format_global; output_name_global = p.to_string (); diff --git a/lily/measure-grouping-spanner.cc b/lily/measure-grouping-spanner.cc index b29f91a1d9..7c42896fe5 100644 --- a/lily/measure-grouping-spanner.cc +++ b/lily/measure-grouping-spanner.cc @@ -32,7 +32,7 @@ Measure_grouping::brew_molecule (SCM grob) Interval rext = me->get_bound (RIGHT)->extent (common, X_AXIS); - Real w =(rext.empty_b() + Real w =(rext.is_empty () ? me->get_bound (RIGHT)->relative_coordinate (common, X_AXIS) : rext[RIGHT]) - me->get_bound (LEFT)->relative_coordinate (common, X_AXIS); diff --git a/lily/melisma-engraver.cc b/lily/melisma-engraver.cc index 72dfb94ac7..d63150f7e3 100644 --- a/lily/melisma-engraver.cc +++ b/lily/melisma-engraver.cc @@ -24,21 +24,12 @@ public: bool -Melisma_engraver::try_music (Music *m) +Melisma_engraver::try_music (Music *) { - SCM melisma_properties = get_property ("melismaBusyProperties"); - bool busy = false; - - for (; gh_pair_p (melisma_properties); - melisma_properties = gh_cdr (melisma_properties)) - - busy = busy || to_boolean (internal_get_property (gh_car (melisma_properties))); - /* - for the phrasing engraver we also need this. + This can only be melisma-playing-event. */ - daddy_trans_->set_property ("melismaEngraverBusy",gh_bool2scm (busy)); - return busy; + return melisma_busy (this); } Melisma_engraver::Melisma_engraver() @@ -46,9 +37,9 @@ Melisma_engraver::Melisma_engraver() } ENTER_DESCRIPTION(Melisma_engraver, -/* descr */ "", +/* descr */ "This engraver collects melisma information about ties, beams, and user settings (@code{melismaBusy}, and signals it to the @code{\addlyrics} code. ", /* creats*/ "", /* accepts */ "melisma-playing-event", /* acks */ "", /* reads */ "melismaBusy melismaBusyProperties slurMelismaBusy tieMelismaBusy beamMelismaBusy", -/* write */ "melismaEngraverBusy"); +/* write */ ""); diff --git a/lily/molecule.cc b/lily/molecule.cc index 6e60f05660..bfbc525666 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -64,7 +64,7 @@ Molecule::translate (Offset o) expr_ = scm_list_n (ly_symbol2scm ("translate-molecule"), ly_offset2scm (o), expr_, SCM_UNDEFINED); - if (!empty_b ()) + if (!is_empty ()) dim_.translate (o); } @@ -107,7 +107,7 @@ Molecule::set_empty (bool e) void Molecule::align_to (Axis a, Real x) { - if (empty_b()) + if (is_empty ()) return ; Interval i (extent (a)); @@ -121,10 +121,10 @@ void Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding, Real minimum) { - Real my_extent= empty_b () ? 0.0 : dim_[a][d]; + Real my_extent= is_empty () ? 0.0 : dim_[a][d]; Interval i (m.extent (a)); Real his_extent; - if (i.empty_b ()) + if (i.is_empty ()) { programming_error ("Molecule::add_at_edge: adding empty molecule."); his_extent = 0.0; @@ -148,7 +148,7 @@ Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding, while expr_ == '() */ bool -Molecule::empty_b () const +Molecule::is_empty () const { return expr_ == SCM_EOL; } diff --git a/lily/new-accidental-engraver.cc b/lily/new-accidental-engraver.cc index 4d2cad0b29..5a12cf716a 100644 --- a/lily/new-accidental-engraver.cc +++ b/lily/new-accidental-engraver.cc @@ -272,7 +272,7 @@ number_accidentals (Music * note, Pitch *pitch, Translator_group * origin, { SCM context = ly_car (accidentals); - while (origin && !origin->is_alias_b (context)) + while (origin && !origin->is_alias (context)) origin = origin->daddy_trans_; if (!origin) diff --git a/lily/new-fingering-engraver.cc b/lily/new-fingering-engraver.cc index a468aea0a1..433fd96b21 100644 --- a/lily/new-fingering-engraver.cc +++ b/lily/new-fingering-engraver.cc @@ -102,7 +102,7 @@ extern Grob *make_script_from_event (SCM * descr, Translator_group*tg, Music * e void New_fingering_engraver::add_script (Grob * head, Music * event, - Music * head_event) + Music * ) { Finger_tuple ft ; @@ -113,7 +113,6 @@ New_fingering_engraver::add_script (Grob * head, articulations_.push (ft); announce_grob (g, event->self_scm ()); - ft.script_->set_parent (head, X_AXIS); } diff --git a/lily/new-phrasing-engraver.cc b/lily/new-phrasing-engraver.cc new file mode 100644 index 0000000000..234c430c14 --- /dev/null +++ b/lily/new-phrasing-engraver.cc @@ -0,0 +1,191 @@ +/* + new-phrasing-engraver.cc -- implement New_phrasing_engraver + +source file of the GNU LilyPond music typesetter + +(c) 2003--2004 Han-Wen Nienhuys + + */ + +#include "translator-group.hh" +#include "engraver.hh" +#include "note-head.hh" +#include "grob.hh" + +struct Phrasing_association +{ + String name_; + Link_array lyrics_; + Link_array heads_; + bool melisma_; + bool last_melisma_; + + Phrasing_association() + { + melisma_ = false; + last_melisma_ = false; + } + + void clear () { + lyrics_.clear (); + heads_.clear (); + } + +}; + +class New_phrasing_engraver : public Engraver +{ +public: + ~New_phrasing_engraver (); + TRANSLATOR_DECLARATIONS(New_phrasing_engraver); +protected: + virtual void acknowledge_grob (Grob_info); + virtual void process_acknowledged_grobs (); + virtual void stop_translation_timestep (); + + Link_array assocs_; + void add_lyric_phrasing (Grob_info); + void add_voice_phrasing (Grob_info); +}; + +New_phrasing_engraver::New_phrasing_engraver() +{ + +} + +void +New_phrasing_engraver::acknowledge_grob (Grob_info i) +{ + Grob *h = i.grob_; + + if (Note_head::has_interface (h)) + { + add_voice_phrasing (i); + } + else if (h->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface"))) + { + add_lyric_phrasing (i); + } +} + +void +New_phrasing_engraver::add_voice_phrasing (Grob_info inf) +{ + Translator_group * tr = inf.origin_trans_->daddy_trans_; + while (tr && !tr->is_alias (ly_symbol2scm ("Voice"))) + tr = tr->daddy_trans_; + + if (!tr) + return; + + /* + should use dict? + */ + Phrasing_association *a =0; + for (int i =0; !a && i < assocs_.size (); i++) + { + if (assocs_[i]->name_ == tr->id_string_) + a = assocs_[i]; + } + + if (!a) + { + a = new Phrasing_association ; + a->name_ = tr->id_string_; + assocs_.push (a); + } + + a->heads_.push (inf.grob_); + a->melisma_ = melisma_busy (inf.origin_trans_); +} + +void +New_phrasing_engraver::add_lyric_phrasing (Grob_info inf) +{ + Translator_group * tr = inf.origin_trans_->daddy_trans_; + while (tr && !tr->is_alias (ly_symbol2scm ("LyricsVoice"))) + tr = tr->daddy_trans_; + + if (!tr) + return; + + SCM voice = get_property ("associatedVoice"); + String nm = tr->id_string_; + if (gh_string_p (voice)) + nm = ly_scm2string (voice); + else + { + int idx = nm.index_last ('-'); + if (idx >= 0) + nm = nm.left_string (idx); + } + + Phrasing_association * a=0; + for (int i=0 ; !a && i < assocs_.size (); i++) + { + if (assocs_[i]->name_ == nm) + a = assocs_[i]; + } + + if (!a) + { + a = new Phrasing_association ; + a->name_ = nm; + assocs_.push (a); + } + + a->lyrics_.push (inf.grob_); +} + +void +New_phrasing_engraver::stop_translation_timestep () +{ + for (int i = assocs_.size (); i--; ) + { + assocs_[i]->clear (); + assocs_[i]->last_melisma_ = assocs_[i]->melisma_; + } +} + +void +New_phrasing_engraver::process_acknowledged_grobs () +{ + for (int i = 0; i < assocs_.size (); i++) + { + Phrasing_association * a = assocs_[i]; + if (!a->heads_.size() || !a->lyrics_.size ()) + continue; + + Grob *h = a->heads_[0]; + Direction alignment = CENTER; + if (a->melisma_ && !a->last_melisma_) + alignment = LEFT; + + for (int j = 0; j < a->lyrics_.size (); j++) + { + + Grob *l = a->lyrics_[j]; + if (!l->get_parent (X_AXIS)) + { + l->set_parent (h, X_AXIS); + if (alignment) + l->set_grob_property ("self-alignment-X", gh_int2scm (alignment)); + } + } + } +} + +New_phrasing_engraver::~New_phrasing_engraver () +{ + for (int i =assocs_.size(); i--;) + delete assocs_[i]; +} + +ENTER_DESCRIPTION(New_phrasing_engraver, + "This engraver combines note heads and lyrics for alignment. ", + "", + "", + "lyric-syllable-interface note-head-interface lyric-extender-interface", + "automaticPhrasing associatedVoice", + ""); + diff --git a/lily/note-head-line-engraver.cc b/lily/note-head-line-engraver.cc index 84e8af2652..12578a2b5c 100644 --- a/lily/note-head-line-engraver.cc +++ b/lily/note-head-line-engraver.cc @@ -60,10 +60,10 @@ Note_head_line_engraver::acknowledge_grob (Grob_info info) if (to_boolean (get_property ("followVoice"))) { Translator_group * tr = daddy_trans_; - while (tr && !tr->is_alias_b (ly_symbol2scm ( "Staff"))) + while (tr && !tr->is_alias (ly_symbol2scm ( "Staff"))) tr = tr->daddy_trans_ ; - if (tr && tr->is_alias_b (ly_symbol2scm ("Staff")) && tr != last_staff_) + if (tr && tr->is_alias (ly_symbol2scm ("Staff")) && tr != last_staff_) { if (last_head_) follow_ = true; diff --git a/lily/note-head.cc b/lily/note-head.cc index 76eb2a6939..bce006a920 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -124,7 +124,7 @@ internal_brew_molecule (Grob *me, bool with_ledgers) Font_metric * fm = Font_interface::get_default_font (me); Molecule out = fm->find_by_name (font_char); - if (out.empty_b()) + if (out.is_empty ()) { me->warning (_f ("note head `%s' not found", font_char.to_str0 ())); } @@ -190,7 +190,7 @@ Note_head::head_extent (Grob *me, Axis a) { Molecule mol = internal_brew_molecule (me, false); - if (!mol.empty_b()) + if (!mol.is_empty ()) return mol.extent (a); } else @@ -285,7 +285,7 @@ Note_head::stem_attachment_coordinate (Grob *me, Axis a) Box b = fm->get_indexed_char (k); Offset wxwy = fm->get_indexed_wxwy (k); Interval v = b[a]; - if (!v.empty_b ()) + if (!v.is_empty ()) return 2 * (wxwy[a] - v.center()) / v.length (); } } diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index de08af4efa..9964632f30 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -92,7 +92,7 @@ Note_spacing::get_spacing (Grob *me, Item* right_col, } } - if (extents[d].empty_b ()) + if (extents[d].is_empty ()) extents[d] = Interval (0,0); } while (flip (&d) != LEFT); @@ -108,7 +108,7 @@ Note_spacing::get_spacing (Grob *me, Item* right_col, FIXED also includes the left part of the right object. */ *fixed = - (left_head_wid.empty_b () ? increment : + (left_head_wid.is_empty () ? increment : /* Size of the head: */ @@ -122,7 +122,7 @@ Note_spacing::get_spacing (Grob *me, Item* right_col, /* What is sticking out of the right note: */ - + (extents[RIGHT].empty_b() ? 0.0 : - extents[RIGHT][LEFT] / 2); + + (extents[RIGHT].is_empty () ? 0.0 : - extents[RIGHT][LEFT] / 2); /* We don't do complicated stuff: (base_space - increment) is the @@ -327,7 +327,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, Real correction = 0.0; - if (!bar_yextent.empty_b()) + if (!bar_yextent.is_empty ()) { stem_dirs[RIGHT] = - stem_dirs[LEFT]; stem_posns[RIGHT] = bar_yextent; @@ -350,7 +350,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, { head_extent = head->extent (rcolumn, X_AXIS); - if (!head_extent.empty_b()) + if (!head_extent.is_empty ()) note_head_width = head_extent[RIGHT]; if (st) @@ -370,7 +370,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, { intersect = stem_posns[LEFT]; intersect.intersect(stem_posns[RIGHT]); - correct_stem_dirs = correct_stem_dirs && !intersect.empty_b (); + correct_stem_dirs = correct_stem_dirs && !intersect.is_empty (); if (correct_stem_dirs) { @@ -386,7 +386,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, gh_scm2double (me->get_grob_property ("stem-spacing-correction")); } - if (!bar_yextent.empty_b()) + if (!bar_yextent.is_empty ()) { correction *= 0.5; } @@ -416,7 +416,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, Interval hp = head_posns[LEFT]; hp.intersect (head_posns[RIGHT]); - if (!hp.empty_b()) + if (!hp.is_empty ()) return ; Direction lowest = diff --git a/lily/part-combine-music-iterator.cc b/lily/part-combine-music-iterator.cc index 0aa59eb11d..e9bdc0ec42 100644 --- a/lily/part-combine-music-iterator.cc +++ b/lily/part-combine-music-iterator.cc @@ -108,7 +108,7 @@ Part_combine_music_iterator::change_to (Music_iterator *it, SCM to_type, If \translator Staff = bass, then look for Staff = * */ - while (current && !current->is_alias_b (to_type)) + while (current && !current->is_alias (to_type)) { last = current; current = current->daddy_trans_; @@ -355,7 +355,7 @@ s Consider thread switching: threads "one", "two" and "both". thread level! */ - if (suffix_.empty_b ()) + if (suffix_.is_empty ()) suffix_ = first_iter_->report_to () ->daddy_trans_->id_string_.cut_string (3, INT_MAX); diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 57e6f9310a..776d4baaa6 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -208,7 +208,7 @@ Rest_collision::do_shift (Grob *me) Grob * r = unsmob_grob (rcol->get_grob_property ("rest")); Interval restdim = r->extent (r, Y_AXIS); // ?? - if (restdim.empty_b ()) + if (restdim.is_empty ()) return SCM_UNSPECIFIED; diff --git a/lily/rest.cc b/lily/rest.cc index 7e3c5ddac6..d2744d98c2 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -134,7 +134,7 @@ Rest::brew_internal_molecule (SCM smob) Font_metric *fm = Font_interface::get_default_font (me); String font_char = glyph_name (me, balltype, style); Molecule out = fm->find_by_name (font_char); - if (out.empty_b()) + if (out.is_empty ()) { me->warning (_f ("rest `%s' not found, ", font_char.to_str0 ())); } diff --git a/lily/self-aligment-interface.cc b/lily/self-aligment-interface.cc index ff47fb92f3..365409461f 100644 --- a/lily/self-aligment-interface.cc +++ b/lily/self-aligment-interface.cc @@ -13,10 +13,44 @@ Self_alignment_interface::centered_on_parent (SCM element_smob, SCM axis) Grob *him = me->get_parent (a); Interval he = him->extent (him,a); - return gh_double2scm (he.empty_b () ? 0.0 : he.center ()); + return gh_double2scm (he.is_empty () ? 0.0 : he.center ()); } +MAKE_SCHEME_CALLBACK (Self_alignment_interface,aligned_on_parent,2); +SCM +Self_alignment_interface::aligned_on_parent (SCM element_smob, SCM axis) +{ + Grob *me = unsmob_grob (element_smob); + Axis a = (Axis) gh_scm2int (axis); + Grob *him = me->get_parent (a); + Interval he = him->extent (him,a); + + SCM sym= (a == X_AXIS) ? ly_symbol2scm ("self-alignment-X"): ly_symbol2scm ("self-alignment-Y"); + SCM align_prop (me->internal_get_grob_property (sym)); + + if (!gh_number_p (align_prop)) + return gh_int2scm (0); + + Real x = 0.0; + Real align = gh_scm2double (align_prop); + + Interval ext (me->extent (me,a)); + if (ext.is_empty ()) + { + programming_error ("I'm empty. Can't align on self"); + + } + else + x -= ext.linear_combination (align) ; + + if (!he.is_empty ()) + { + x += he.linear_combination (align); + } + + return gh_double2scm (x); +} /* Position centered on parent. @@ -31,7 +65,7 @@ Self_alignment_interface::centered_on_other_axis_parent (SCM element_smob, Grob *him = me->get_parent (other_axis (a)); Interval he = him->extent (him,a); - return gh_double2scm (he.empty_b () ? 0.0 : he.center ()); + return gh_double2scm (he.is_empty () ? 0.0 : he.center ()); } @@ -48,20 +82,15 @@ Self_alignment_interface::aligned_on_self (SCM element_smob, SCM axis) { Grob *me = unsmob_grob (element_smob); Axis a = (Axis) gh_scm2int (axis); - static SCM prop_syms[2]; - if (!prop_syms[0]) - { - prop_syms[X_AXIS] = ly_symbol2scm ("self-alignment-X"); - prop_syms[Y_AXIS] = ly_symbol2scm ("self-alignment-Y"); - } + SCM sym= (a == X_AXIS) ? ly_symbol2scm ("self-alignment-X"): ly_symbol2scm ("self-alignment-Y"); - SCM align (me->internal_get_grob_property (prop_syms[a])); + SCM align (me->internal_get_grob_property (sym)); if (gh_number_p (align)) { Interval ext (me->extent (me,a)); - if (ext.empty_b ()) + if (ext.is_empty ()) { programming_error ("I'm empty. Can't align on self"); return gh_double2scm (0.0); diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 567371967a..cfe9409140 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -24,7 +24,7 @@ Separating_group_spanner::find_rods (Item * r, SCM next) most cases, the interesting L will just be the first entry of NEXT, making it linear in most of the cases. */ - if (Separation_item::width (r).empty_b ()) + if (Separation_item::width (r).is_empty ()) return; for(; gh_pair_p (next); next = ly_cdr (next)) @@ -36,7 +36,7 @@ Separating_group_spanner::find_rods (Item * r, SCM next) { Interval li (Separation_item::width (lb)); Interval ri (Separation_item::conditional_width (r, lb)); - if (!li.empty_b () && !ri.empty_b()) + if (!li.is_empty () && !ri.is_empty ()) { Rod rod; @@ -50,7 +50,7 @@ Separating_group_spanner::find_rods (Item * r, SCM next) Interval li (Separation_item::width (l)); Interval ri (Separation_item::conditional_width (r, l)); - if (!li.empty_b () && !ri.empty_b()) + if (!li.is_empty () && !ri.is_empty ()) { Rod rod; diff --git a/lily/separation-item.cc b/lily/separation-item.cc index 3ca590a500..3a9b491789 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -108,7 +108,7 @@ Separation_item::width (Grob *me) } Interval iv (il->extent (pc, X_AXIS)); - if (!iv.empty_b ()) + if (!iv.is_empty ()) { w.unite (iv); } diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 592d53834f..40a8e0767f 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -95,7 +95,7 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte } } - if (dim.empty_b ()) + if (dim.is_empty ()) { dim = Interval (0,0); } @@ -199,7 +199,7 @@ Side_position_interface::aligned_side (SCM element_smob, SCM axis) Interval iv = me->extent (me, a); - if (!iv.empty_b ()) + if (!iv.is_empty ()) { if (!d) { diff --git a/lily/skyline.cc b/lily/skyline.cc index 1cc6b6877e..45938efe0f 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -51,7 +51,7 @@ insert_extent_into_skyline (Array *line, Box b, Axis line_axis, Direction d) { Interval extent = b[line_axis]; - if (extent.empty_b()) + if (extent.is_empty ()) return; Real stick_out = b[other_axis (line_axis)][d]; @@ -69,19 +69,19 @@ insert_extent_into_skyline (Array *line, Box b, Axis line_axis, Real my_height = line->elem(i).height_; - if (!w.empty_b () && + if (!w.is_empty () && w.length() > EPS && d* (my_height - stick_out) < 0) { Interval e1 (line->elem(i).width_[LEFT], extent[LEFT]); Interval e3 (extent[RIGHT], line->elem(i).width_[RIGHT]); - if (!e3.empty_b () && e3.length() > EPS) + if (!e3.is_empty () && e3.length() > EPS) line->insert (Skyline_entry (e3, my_height), i+1); line->elem_ref(i).height_ = stick_out; line->elem_ref(i).width_ = w; - if (!e1.empty_b () && e1.length() > EPS) + if (!e1.is_empty () && e1.length() > EPS) line->insert (Skyline_entry (e1, my_height), i ); } @@ -162,7 +162,7 @@ skyline_meshing_distance (Array const &buildings, Interval w = buildings[i].width_; w.intersect(clouds[j].width_); - if (!w.empty_b()) + if (!w.is_empty ()) distance = distance >? (buildings[i].height_ - clouds[j].height_); if (i>0 && buildings[i].width_[LEFT] >= clouds[j].width_[LEFT]) diff --git a/lily/slur.cc b/lily/slur.cc index 5a42fcb7da..713ec88cc3 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -438,7 +438,7 @@ Slur::encompass_offset (Grob*me, o[X_AXIS] -= 0.5 * stem_dir * x_extent; if ((stem_dir == dir) - && !stem->extent (stem, Y_AXIS).empty_b ()) + && !stem->extent (stem, Y_AXIS).is_empty ()) { o[Y_AXIS] = stem->extent (common[Y_AXIS], Y_AXIS)[dir]; } diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 5e8947b7e9..fc2b4f0dc8 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -79,15 +79,15 @@ Span_bar::brew_molecule (SCM smobbed_me) SCM smobbed_staff_bar = ly_car (elts); Grob *staff_bar = unsmob_grob (smobbed_staff_bar); Interval ext = staff_bar->extent (refp, Y_AXIS); - if (ext.empty_b ()) + if (ext.is_empty ()) continue; - if (!prev_extent.empty_b ()) + if (!prev_extent.is_empty ()) { Interval l (prev_extent [UP], ext[DOWN]); - if (l.empty_b ()) + if (l.is_empty ()) { /* There is overlap between the bar lines. Do nothing. */ } @@ -152,7 +152,7 @@ Span_bar::center_on_spanned_callback (SCM element_smob, SCM axis) /* Bar_line::brew_molecule delivers a barline of y-extent (-h/2,h/2), so we have to translate ourselves to be in the center of the interval that we span. */ - if (i.empty_b ()) + if (i.is_empty ()) { me->suicide (); return gh_double2scm (0.0); @@ -229,7 +229,7 @@ Span_bar::get_bar_size (SCM smob) { Grob* me = unsmob_grob (smob); Interval iv (get_spanned_interval (me)); - if (iv.empty_b ()) + if (iv.is_empty ()) { /* This happens if the bars are hara-kiried from under us. */ me->suicide (); diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc index 62bdd7070d..f1deb19f64 100644 --- a/lily/staff-spacing.cc +++ b/lily/staff-spacing.cc @@ -60,10 +60,10 @@ Staff_spacing::next_note_correction (Grob * me, Let's decrease the space a little if the problem is not located after a barline. */ - if (bar_size.empty_b ()) + if (bar_size.is_empty ()) max_corr *= 0.75; - if (!bar_size.empty_b()) + if (!bar_size.is_empty ()) if (Grob *stem = Note_column::get_stem (g)) { Direction d = Stem::get_direction (stem); @@ -163,7 +163,7 @@ Staff_spacing::extremal_break_aligned_grob (Grob *separation_item, Direction d, Interval ext = break_item->extent (col, X_AXIS); - if (ext.empty_b ()) + if (ext.is_empty ()) continue; if (!last_grob || (last_grob && d * (ext[d]- (*last_ext)[d]) > 0) ) diff --git a/lily/stanza-number-engraver.cc b/lily/stanza-number-engraver.cc index d9887cfefd..6d76b38041 100644 --- a/lily/stanza-number-engraver.cc +++ b/lily/stanza-number-engraver.cc @@ -4,97 +4,83 @@ source file of the GNU LilyPond music typesetter (c) 2000--2003 Han-Wen Nienhuys , Glen Prideaux - - Similar to (and derived from) Instrument_name_engraver. - */ + +*/ #include "engraver.hh" #include "item.hh" -#include "bar-line.hh" +#include "side-position-interface.hh" class Stanza_number_engraver : public Engraver { Item *text_; - bool bar_b_; - void create_text (SCM s); + /* + This is naughty, since last_stanza_ may be GCd from under us. But + since we don't look at the contents, we are/should be (knock on + wood) OK. + */ + SCM last_stanza_; public: TRANSLATOR_DECLARATIONS(Stanza_number_engraver); - virtual void process_music (); virtual void stop_translation_timestep (); + virtual void acknowledge_grob (Grob_info); }; +/* + TODO: should make engraver that collects all the stanzas on a higher + level, and then groups them to the side. Stanza numbers should be + all aligned. + */ Stanza_number_engraver::Stanza_number_engraver () { text_ = 0; - bar_b_ = false; } void Stanza_number_engraver::process_music () { - if (gh_string_p (get_property ("whichBar"))) + SCM stanza = get_property ("stanza"); + + if (gh_string_p (stanza) && stanza != last_stanza_) { - SCM s = get_property ("stanza"); + last_stanza_ = stanza; - if (now_mom () > Moment (0)) - s = get_property ("stz"); - - - // TODO - if (gh_string_p (s) || gh_pair_p (s)) - - /* - if (i.grob_->internal_has_interface (symbol ("lyric-syllable-interface"))) - - Tried catching lyric items to generate stanza numbers, but it - spoils lyric spacing. - - Works, but requires bar_engraver in LyricsVoice context apart - from at beginning. Is there any score element we can catch - that will do the trick? - - What happens if we try anything at all EXCEPT a lyric? Is - there anything else? Not sure what it's catching, but it - still mucks up lyrics. - - */ - - create_text (s); + text_ = new Item (get_property ("StanzaNumber")); + text_->set_grob_property ("text", stanza); + announce_grob (text_, SCM_EOL); } } + void -Stanza_number_engraver::stop_translation_timestep () +Stanza_number_engraver::acknowledge_grob (Grob_info inf) { - if (text_) + if (text_ + && inf.grob_->internal_has_interface (ly_symbol2scm ("lyric-text-interface"))) { - typeset_grob (text_); - text_ = 0; + Side_position_interface::add_support (text_, inf.grob_); } } void -Stanza_number_engraver::create_text (SCM txt) +Stanza_number_engraver::stop_translation_timestep () { - if (!text_) + if (text_) { - text_ = new Item (get_property ("StanzaNumber")); - text_->set_grob_property ("text", txt); - announce_grob (text_, SCM_EOL); + typeset_grob (text_); + text_ = 0; } } - - ENTER_DESCRIPTION(Stanza_number_engraver, /* descr */ "", /* creats*/ "StanzaNumber", /* accepts */ "", -/* acks */ "", -/* reads */ "stz stanza", +/* acks */ "lyric-syllable-interface", +/* reads */ "stanza", /* write */ ""); diff --git a/lily/stem.cc b/lily/stem.cc index 6b69ae4092..9899a99fca 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -259,7 +259,7 @@ Stem::get_default_dir (Grob*me) { int staff_center = 0; Interval hp = head_positions (me); - if (hp.empty_b()) + if (hp.is_empty ()) { return CENTER; } @@ -356,7 +356,7 @@ Stem::get_default_stem_end_position (Grob*me) if (durlog >= 3) { Interval flag_ext = flag (me).extent (Y_AXIS) ; - if (!flag_ext.empty_b()) + if (!flag_ext.is_empty ()) minlen += 2 * flag_ext.length () / ss ; /* @@ -646,7 +646,7 @@ Stem::flag (Grob*me) flag_style + to_string (dir) + staffline_offs + to_string (duration_log (me)); Font_metric *fm = Font_interface::get_default_font (me); Molecule flag = fm->find_by_name ("flags-" + font_char); - if (flag.empty_b ()) + if (flag.is_empty ()) { me->warning (_f ("flag `%s' not found", font_char)); } @@ -655,11 +655,11 @@ Stem::flag (Grob*me) if (gh_string_p (stroke_style_scm)) { String stroke_style = ly_scm2string (stroke_style_scm); - if (!stroke_style.empty_b ()) + if (!stroke_style.is_empty ()) { String font_char = to_string (dir) + stroke_style; Molecule stroke = fm->find_by_name ("flags-" + font_char); - if (stroke.empty_b ()) + if (stroke.is_empty ()) { me->warning (_f ("flag stroke `%s' not found", font_char)); } diff --git a/lily/streams.cc b/lily/streams.cc index ebc42cc15f..022b3abbf9 100644 --- a/lily/streams.cc +++ b/lily/streams.cc @@ -29,7 +29,7 @@ open_file_stream (String filename, int mode) else { Path p = split_path (filename); - if (!p.dir.empty_b ()) + if (!p.dir.is_empty ()) if (mkdir (p.dir.to_str0 (), 0777) == -1 && errno != EEXIST) error (_f ("can't create directory: `%s'", p.dir)); os = new std::ofstream (filename.to_str0 (), mode); diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc index 4973d87870..2a01f3455e 100644 --- a/lily/sustain-pedal.cc +++ b/lily/sustain-pedal.cc @@ -58,7 +58,7 @@ Sustain_pedal::brew_molecule (SCM smob) else idx += String (&text.to_bytes ()[i], 1); Molecule m = Font_interface::get_default_font (e)->find_by_name (idx); - if (!m.empty_b ()) + if (!m.is_empty ()) mol.add_at_edge (X_AXIS, RIGHT, m, 0, 0); } diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index 1c68e112d4..35bb3aeeeb 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -87,7 +87,7 @@ System_start_delimiter::after_line_breaking (SCM smob) { Interval v = unsmob_grob (gh_car (s))->extent (common, Y_AXIS); - if (!v.empty_b ()) + if (!v.is_empty ()) count ++; } @@ -118,7 +118,7 @@ System_start_delimiter::brew_molecule (SCM smob) (me->self_scm (), gh_int2scm (Y_AXIS))); Real l = ext.length () / staff_space; - if (ext.empty_b () + if (ext.is_empty () || (gh_number_p (c) && l <= gh_scm2double (c))) { me->suicide (); @@ -165,7 +165,7 @@ System_start_delimiter::staff_brace (Grob*me, Real y) { int cmp = (lo + hi) / 2; b = fm->get_indexed_char (cmp); - if (b[Y_AXIS].empty_b () || b[Y_AXIS].length () > y) + if (b[Y_AXIS].is_empty () || b[Y_AXIS].length () > y) hi = cmp; else lo = cmp; diff --git a/lily/system.cc b/lily/system.cc index 8aadfedb6d..4cf53c114a 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -379,7 +379,7 @@ System::post_processing (bool last_line) } Interval i (extent (this, Y_AXIS)); - if (i.empty_b ()) + if (i.is_empty ()) programming_error ("Huh? Empty System?"); else translate_axis (- i[MAX], Y_AXIS); diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 6de80dd798..b441bdf8c9 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -89,7 +89,7 @@ Text_spanner::brew_molecule (SCM smob) if (Text_item::markup_p (text)) edge[d] = *unsmob_molecule (Text_item::interpret_markup (paper->self_scm (), properties, text)); - if (!edge[d].empty_b ()) + if (!edge[d].is_empty ()) edge[d].align_to (Y_AXIS, CENTER); } while (flip (&d) != LEFT); @@ -152,7 +152,7 @@ Text_spanner::brew_molecule (SCM smob) m.add_molecule (edge[d]); edge_line[d].translate_axis (span_points[d], X_AXIS); m.add_molecule (edge_line[d]); - if (!ext.empty_b ()) + if (!ext.is_empty ()) span_points[d] += -d * ext[-d]; } while (flip (&d) != LEFT); diff --git a/lily/time-signature.cc b/lily/time-signature.cc index 7f50d89f74..4c96b21771 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -87,7 +87,7 @@ Time_signature::special_time_signature (Grob *me, SCM scm_style, int n, int d) me->set_grob_property ("font-family", ly_symbol2scm ("music")); Molecule out = Font_interface::get_default_font (me) ->find_by_name ("timesig-" + char_name); - if (!out.empty_b ()) + if (!out.is_empty ()) return out; /* If there is no such symbol, we default to the numbered style. diff --git a/lily/translator-group.cc b/lily/translator-group.cc index f34b0c2e76..e85ced8d6d 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -35,7 +35,7 @@ Translator_group::properties_dict () const Translator_group::~Translator_group () { - //assert (removable_b ()); + //assert (is_removable ()); } @@ -59,7 +59,7 @@ Translator_group::check_removal () Translator_group *trg = dynamic_cast (unsmob_translator (ly_car (p))); trg->check_removal (); - if (trg->removable_b ()) + if (trg->is_removable ()) terminate_translator (trg); } } @@ -99,7 +99,7 @@ Translator_group::add_fresh_group_translator (Translator*t) bool -Translator_group::removable_b () const +Translator_group::is_removable () const { return trans_group_list_ == SCM_EOL && ! iterator_count_; } @@ -107,7 +107,7 @@ Translator_group::removable_b () const Translator_group * Translator_group::find_existing_translator (SCM n, String id) { - if ((is_alias_b (n) && (id_string_ == id || id.empty_b ())) || n == ly_symbol2scm ("Current")) + if ((is_alias (n) && (id_string_ == id || id.is_empty ())) || n == ly_symbol2scm ("Current")) return this; Translator_group* r = 0; diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index 9a7bf5c065..ac2d1d5d0a 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -113,7 +113,7 @@ LY_DEFINE(ly_translator_find, while (tr) { - if (tr->is_alias_b (name)) + if (tr->is_alias (name)) return tr->self_scm(); tr = tr->daddy_trans_ ; } diff --git a/lily/translator.cc b/lily/translator.cc index 5d4af073f5..5c53e35449 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -48,7 +48,7 @@ Translator::Translator (Translator const &s) } bool -Translator::is_alias_b (SCM sym) const +Translator::is_alias (SCM sym) const { Translator_def * td = unsmob_translator_def (definition_); bool b = (sym == td->type_name_); diff --git a/lily/virtual-font-metric.cc b/lily/virtual-font-metric.cc index 1bf489302c..11b431c5ae 100644 --- a/lily/virtual-font-metric.cc +++ b/lily/virtual-font-metric.cc @@ -54,7 +54,7 @@ Molecule Virtual_font_metric::find_by_name (String glyph) const { Molecule m; - for (SCM s = font_list_; m.empty_b () && gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = font_list_; m.is_empty () && gh_pair_p (s); s = gh_cdr (s)) { m = unsmob_metrics (gh_car (s))->find_by_name (glyph); } @@ -121,7 +121,7 @@ Virtual_font_metric::name_to_index (String glyph) const { Molecule m; int total = 0; - for (SCM s = font_list_; m.empty_b () && gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = font_list_; m.is_empty () && gh_pair_p (s); s = gh_cdr (s)) { Font_metric *m =unsmob_metrics (gh_car (s)); int k = m->name_to_index (glyph); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 01f27a16d2..708fd03967 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -311,6 +311,7 @@ LyricsVoiceContext= \translator{ \consists "Extender_engraver" \consists "Hyphen_engraver" \consists "Stanza_number_engraver" + \consists "Instrument_name_engraver" \consists "Skip_event_swallow_translator" phrasingPunctuation = #".,:!?\"" SeparationItem \set #'padding = #0.5 diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index a132929ac9..875faf5b5a 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -488,10 +488,8 @@ )) (LyricText - . ( - (molecule-callback . ,Text_item::brew_molecule) - (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent - ,Self_alignment_interface::aligned_on_self)) + . ((molecule-callback . ,Text_item::brew_molecule) + (X-offset-callbacks . (,Self_alignment_interface::aligned_on_parent)) (self-alignment-X . 0) (word-space . 0.6) (ignore-length-mismatch . #f) @@ -850,13 +848,13 @@ )) (StanzaNumber - . ( - (breakable . #t) - (molecule-callback . ,Text_item::brew_molecule) - (break-align-symbol . clef) - (break-visibility . ,begin-of-line-visible) + . ((molecule-callback . ,Text_item::brew_molecule) (font-family . roman) - (meta . ((interfaces . (break-aligned-interface text-interface font-interface item-interface )))) + (font-series . bold) + (padding . 1.5) + (X-offset-callbacks . (,Side_position_interface::aligned_side)) + (direction . ,LEFT) + (meta . ((interfaces . (text-interface font-interface item-interface )))) )) (StaffSpacing diff --git a/scm/define-translator-properties.scm b/scm/define-translator-properties.scm index 2fd1825b49..b3abc1366d 100644 --- a/scm/define-translator-properties.scm +++ b/scm/define-translator-properties.scm @@ -319,7 +319,6 @@ top of those automatically detected. ") (translator-property-description 'melismaBusyProperties list? "List of properties (symbols) to determine whether a melisma is playing.") -(translator-property-description 'melismaEngraverBusy boolean? "See melismaBusy. This is set automatically.") (translator-property-description 'metronomeMarkFormatter procedure? "How to produce a metronome markup. Called with 2 arguments, event and context.") @@ -407,7 +406,8 @@ squashing for Pitch_squash_engraver.") (translator-property-description 'stringOneTopmost boolean? "Whether the 1st string is printed on the top line of the tablature.") (translator-property-description 'stavesFound list? "list of all staff-symbols found.") -(translator-property-description 'stanza markup? "Stanza `number' to print at start of a verse. Use in LyricsVoice context.") +(translator-property-description 'stanza markup? "Stanza `number' to +print before the start of a verse. Use in LyricsVoice context.") (translator-property-description 'stemLeftBeamCount integer? " Specify the number of beams to draw on the left side of the next note. Overrides automatic beaming. The value is only used once, and then it @@ -415,7 +415,6 @@ is erased. .") (translator-property-description 'stemRightBeamCount integer? "idem, for the right side.") (translator-property-description 'stringTunings list? "The tablature strings tuning. Must be a list of the different semitons pitch of each string (starting by the lower one).") -(translator-property-description 'stz markup? "Abbreviated form for a stanza, see also Stanza property.") (translator-property-description 'subdivideBeams boolean? "If set, multiple beams will be subdivided at beat positions - by only drawing one beam over the beat.") (translator-property-description 'systemStartDelimiter symbol? "Which grob to make for the start of the system/staff?") diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index b3b107fd1f..bdcce0cb97 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -1620,6 +1620,12 @@ def conv (str): conversions.append (((2,1,2), conv, """ly:get-music-length -> ly:music-length""")) +def conv (str): + str =re.sub (r"\.\s+stz=", ". instr ", str) + return str + +conversions.append (((2,1,2), conv, """ly:get-music-length -> ly:music-length""")) + ################################ # END OF CONVERSIONS ################################ -- 2.39.5