From: Jan Nieuwenhuizen Date: Sun, 8 Oct 2000 17:47:27 +0000 (+0200) Subject: patch::: 1.3.94.jcn1 X-Git-Tag: release/1.3.95~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c36e72d6b4f840837d7923a61e537b24695b5388;p=lilypond.git patch::: 1.3.94.jcn1 1.3.94.jcn1 =========== * Added backend framework for arpeggios. * Fixes for les-nereides. Should we do asymmetric slurs...? 1.3.94 ====== --- diff --git a/CHANGES b/CHANGES index e414a5881f..6c8d88a90e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,13 @@ +1.3.94.jcn1 +=========== + +* Added backend framework for arpeggios. + +* Fixes for les-nereides. Should we do asymmetric slurs...? + +1.3.94 +====== + 1.3.93.uu1 ========== diff --git a/VERSION b/VERSION index 38473d7230..b7cebea8a5 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=94 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=jcn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/les-nereides.ly b/input/les-nereides.ly index 0fe8249134..4c4500e90d 100644 --- a/input/les-nereides.ly +++ b/input/les-nereides.ly @@ -1,3 +1,8 @@ +%{ +cpp -P -traditional -o l.ly les-nereides.ly +cpp -P -traditional -o l-fake.ly -DFAKE_GRACE les-nereides.ly +%} + \header{ composer = "ARTHUR GRAY"; title = "LES N\\'ER\\'EIDES"; @@ -15,190 +20,184 @@ global = \notes{ \skip 2; \skip 1*2; - %\skip 1; - - % fake grace +#ifndef FAKE_GRACE + \skip 1; +#else % FAKE_GRACE \skip 2.; \partial 32*24; \skip 32*24; - %end fake grace +#endif % FAKE_GRACE \bar "||"; } treble = \context Voice=treble \notes\relative c''{ + % Broken? + \property Voice.NoteColumn \push #'horizontal-shift = #0 r2 %2 - \property basicStemProperties \pop #'direction - \property Voice.basicStemProperties \push #'direction = #1 + \property Voice.Stem \pop #'direction + \property Voice.Stem \push #'direction = #1 r4 r2 %3 r4 r8. \translator Staff=bass - cis,16^2^"m.g."( + cis,16^2^"m.d."( %4 <)dis,4 a' dis> \translator Staff=treble - \property basicSlurProperties \pop #'direction - \property Voice.basicSlurProperties \push #'direction = #1 + \property Voice.Slur \pop #'direction + \property Voice.Slur \push #'direction = #1 %% 8va - cis''''4 ( + cis''''4^"m.g." ( -%{ +#ifndef FAKE_GRACE - \property basicStemProperties \pop #'direction - % ugh - \property Voice.basicStemProperties \push #'direction = #0 + \property Voice.Stem \pop #'direction % grace is a mess % maybe we should fake this and put 5/4 in this bar? \grace { )cis8 - \property basicStemProperties \pop #'direction - \property Grace.basicStemProperties \push #'direction = #0 + \property Grace.Stem \pop #'direction + \property Grace.Stem \push #'direction = #0 %urg, dim. during grace dumps core here - %%[a16-5( fis dis] [cis'32 a-1 fis-4 dis\>] [cis a )\!fis-2] + %%[a16-5( fis dis] [cis'32 a-1 fis-4 dis] [cis a )fis-2] [a16-5( fis dis] [cis32 a-1 fis-4 dis] [cis a )fis-2] } -%} +#else % FAKE_GRACE - %% fake grace: - \property basicNoteHeadProperties \pop #'font-size - \property basicStemProperties \pop #'font-size - \property basicBeamProperties \pop #'font-size - \property basicTextScriptProperties \pop #'font-size - \property basicSlurProperties \pop #'font-size - \property basicLocalKeyProperties \pop #'font-size - - \property Voice.basicNoteHeadProperties \push #'font-size = #-1 - \property Voice.basicStemProperties \push #'font-size = #-1 - \property Voice.basicBeamProperties \push #'font-size = #-1 - \property Voice.basicTextScriptProperties \push #'font-size = #-1 - \property Voice.basicSlurProperties \push #'font-size = #-1 - \property Voice.basicLocalKeyProperties \push #'font-size = #-1 + \property Voice.NoteHead \push #'font-size = #-1 + \property Voice.Stem \push #'font-size = #-1 + \property Voice.Beam \push #'font-size = #-1 + \property Voice.TextScript \push #'font-size = #-1 + \property Voice.Slur \push #'font-size = #-1 + \property Voice.LocalKey \push #'font-size = #-1 )cis16 - \property basicStemProperties \pop #'direction - \property Voice.basicStemProperties \push #'direction = #0 - %%[a16^5( fis dis] [cis'32 a-1 fis-4 dis\>] [cis a )fis-2] s s s - [a16^5( fis dis] [cis32 a^1 fis^4 dis\>] [cis a )fis-2] s % s s - - \property basicNoteHeadProperties \pop #'font-size - \property basicStemProperties \pop #'font-size - \property basicBeamProperties \pop #'font-size - \property basicTextScriptProperties \pop #'font-size - \property basicSlurProperties \pop #'font-size - \property basicLocalKeyProperties \pop #'font-size - - %ugh ugh - \property Voice.basicNoteHeadProperties \push #'font-size = #0 - \property Voice.basicStemProperties \push #'font-size = #0 - \property Voice.basicBeamProperties \push #'font-size = #0 - \property Voice.basicTextScriptProperties \push #'font-size = #0 - \property Voice.basicSlurProperties \push #'font-size = #0 - \property Voice.basicLocalKeyProperties \push #'font-size = #0 - %% end fake grace + \property Voice.Stem \pop #'direction + \property Voice.Stem \push #'direction = #0 + %%[a16^5( fis dis] [cis'32 a-1 fis-4 dis] [cis a )fis-2] s s s + [a16^5( fis dis] [cis32 a^1 fis^4 dis] [cis a )fis-2] s % s s + \property Voice.NoteHead \pop #'font-size + \property Voice.Stem \pop #'font-size + \property Voice.Beam \pop #'font-size + \property Voice.TextScript \pop #'font-size + \property Voice.Slur \pop #'font-size + \property Voice.LocalKey \pop #'font-size +#endif % FAKE_GRACE - \property basicStemProperties \pop #'direction - \property Voice.basicStemProperties \push #'direction = #1 - \!cis'4()bis - r8\mf-"a tempo" - )e r| - r\mf )e r| + \property Voice.Stem \pop #'direction + \property Voice.Stem \push #'direction = #1 + cis'4()bis + r8 + )e^" "^1^4^5 r| + r )e r| } trebleTwo = \context Voice=trebleTwo \notes\relative c''{ - \skip 2; - \skip 1*2; - \skip 4; - \property basicStemProperties \pop #'direction - \property Voice.basicStemProperties \push #'direction = #-1 + % Broken? + \property Voice.NoteColumn \push #'horizontal-shift = #-1 + s2 + s1*2 + s4 + \property Voice.Stem \pop #'direction + \property Voice.Stem \push #'direction = #-1 - %% fake grace - \skip 32*16; - %% end fake grace +#ifdef FAKE_GRACE + s32*16 +#endif - + + %r8 cis4. d4 [ | r8 cis4. d4 [ | - <)a-2 cis,-1>] cis4. d4 [ e,> | - <\!)a cis,>] + <)a-2 cis,-1>] cis4. d4 [ | + <)a cis,>] } bass = \context Voice=bass \notes\relative c{ - \property Voice.basicSlurProperties \push #'details = - #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 5.0)) - \property basicStemProperties \pop #'direction - \property Voice.basicSlurProperties \push #'direction = #-1 + \property Voice.Slur \pop #'details + \property Voice.Slur \push #'details = +% #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 1.0)) + #'((height-limit . 6.0) (ratio . 0.333) (force-blowfit . 1.0) (beautiful . 0.1)) + \property Voice.Slur \pop #'de-uglify-parameters + \property Voice.Slur \push #'de-uglify-parameters = +% #'(1.5 0.8 -2.0) + #'(2.4 0.8 4.0) + \property Voice.Stem \pop #'direction + \property Voice.Slur \push #'direction = #-1 % huh, auto-beamer? - r8. e,16-2\f( [ ] | + r8. e,16-2( [ ] | %2 \translator Staff=treble - \property basicStemProperties \pop #'direction - \property Voice.basicStemProperties \push #'direction = #-1 + \property Voice.Stem \pop #'direction + \property Voice.Stem \push #'direction = #-1 \property Voice.slurEndAttachment = #'stem <)a''4 eis cis> %\stemboth \property Voice.slurEndAttachment = ##f \translator Staff=bass - \property basicStemProperties \pop #'direction - % ugh - \property Voice.basicStemProperties \push #'direction = #'0 - r8. cis,,16(\sustainup + \property Voice.Stem \pop #'direction + \property Voice.Slur \pop #'y-free + \property Voice.Slur \push #'y-free = #0.1 + r8. cis,,16( %3 - + \property Voice.Stem \pop #'length + \property Voice.Stem \push #'length = #5 + \translator Staff=treble - \property basicStemProperties \pop #'direction - \property Voice.basicStemProperties \push #'direction = #-1 + \property Voice.Stem \pop #'direction + \property Voice.Stem \push #'direction = #-1 <)a' fis cis> \translator Staff=bass - \property basicStemProperties \pop #'direction - % ugh - \property Voice.basicStemProperties \push #'direction = #'0 + \property Voice.Stem \pop #'direction r2 %4 - \property basicStemProperties \pop #'direction - \property Voice.basicStemProperties \push #'direction = #-1 - + \property Voice.Slur \pop #'details + \property Voice.Slur \push #'details = + #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 0.5)) + \property Voice.Stem \pop #'direction + \property Voice.Stem \push #'direction = #-1 + \clef treble; - \property basicStemProperties \pop #'direction - \property Voice.basicStemProperties \push #'direction = #0 + \property Voice.Stem \pop #'direction + \property Voice.Stem \push #'direction = #0 < %urg: staff-change: ! on dis -% { s8. \sustainup\clef bass;} +% { s8. \clef bass;} > - %\grace { s16 s s s s32 s s s s \clef bass; s } - %\clef bass; - %\grace { } <)gis'2 e> - %% fake grace - s4 s8 s32 s \sustainup s \clef bass; s - %% end fake grace +#ifndef FAKE_GRACE + %Hmm + %\grace { s16 s s s s32 s s s s \clef bass; s } + \clef bass; +#else + s4 s8 s32 s s \clef bass; s +#endif - \grace { } <)gis'2\sustaindown e> - %5 - \property basicSlurProperties \pop #'direction - \property Voice.basicSlurProperties \push #'direction = #1 - \property Staff.stopStartSustain = #"" - a,8\sustainup\sustaindown [e'-5(<)a-2 cis-3>] - \property Staff.stopStartSustain = #"-P" - r b,-5\sustainup\sustaindown - \property basicSlurProperties \pop #'direction - \property Voice.basicSlurProperties \push #'direction = #0 - [e,8-5(\sustainup| + \grace { } <)gis'2 e> + %5% + \property Voice.Slur \pop #'direction + \property Voice.Slur \push #'direction = #1 + a,8 [e'-5(<)a-2 cis-3>] + r b,-5 + \property Voice.Slur \pop #'direction + \property Voice.Slur \push #'direction = #0 + [e,8-5(| %6 - )a-2\sustaindown] - \property basicSlurProperties \pop #'direction - \property Voice.basicSlurProperties \push #'direction = #1 - [e'(<)a cis>] r b,\sustainup\sustaindown - \property basicSlurProperties \pop #'direction - \property Voice.basicSlurProperties \push #'direction = #0 - [e,8(\sustainup| + )a-2] + \property Voice.Slur \pop #'direction + \property Voice.Slur \push #'direction = #1 + [e'(<)a cis>] r b, + \property Voice.Slur \pop #'direction + \property Voice.Slur \push #'direction = #0 + [e,8(| %7 )a] } @@ -208,16 +207,73 @@ bassTwo = \context Voice=bassTwo \notes\relative c{ \skip 1*2; \skip 2; - %% fake grace +#ifdef FAKE_GRACE \skip 32*16; +#endif - \property basicStemProperties \pop #'direction - \property Voice.basicStemProperties \push #'direction = #1 - \property basicSlurProperties \pop #'direction - \property Voice.basicSlurProperties \push #'direction = #1 + \property Voice.Stem \pop #'direction + \property Voice.Stem \push #'direction = #1 + \property Voice.Slur \pop #'direction + \property Voice.Slur \push #'direction = #1 cis'4()bis } +middleDynamics = \context Dynamics=middle \notes{ + s8 s16 s\f s4 + s1*2 + %4 + s2 + +#ifdef FAKE_GRACE + s32*12 + s32\> s s \!s +#endif + + s32 s-"rall." s s + s8 s4 + + s1\mf-"a tempo" + s8 s8\mf s4 s4 s8\> s32 s s \!s +} + +lowerDynamics = \context Dynamics=lower \notes{ + s2 + %2 + s2\sustaindown s8. s16\sustainup s4 + %3 + s2\sustaindown s8. s16\sustainup s4 + %3 + +#ifndef FAKE_GRACE + s4\sustaindown s16 + s32 s s\sustainup s + s32\sustaindown s s s + s8 +#else + s2\sustaindown + s32*12 + s32 s s\sustainup s + s32\sustaindown s s s +#endif + + \property Dynamics.stopSustain = #"" + s4 s16. s32\sustainup + + %5 + s8\sustaindown s s + \property Dynamics.stopSustain = #"*" + \property Dynamics.stopStartSustain = #"-P" + s s\sustainup\sustaindown s s + s\sustainup + + %6 + \property Dynamics.stopStartSustain = #"" + s8\sustaindown s s + \property Dynamics.stopStartSustain = #"-P" + s s\sustainup\sustaindown s s + s\sustainup +} + \score{ \context PianoStaff < \context Staff=treble < @@ -225,21 +281,67 @@ bassTwo = \context Voice=bassTwo \notes\relative c{ \treble \trebleTwo > + \context Dynamics=middle < + \global + \middleDynamics + > \context Staff=bass < \clef bass; \global \bass \bassTwo > + \context Dynamics=lower < + \global + \lowerDynamics + > > \paper { \translator { \ScoreContext - basicTimeSignatureProperties \push #'style = #"C" + TimeSignature \push #'style = #"C" + } + \translator { + \type "Engraver_group_engraver"; + \name Dynamics; + Generic_property_list = #generic-lyrics-properties + \consists "Property_engraver"; + DynamicsMinimumVerticalExtent = #(cons -3 -3) + + startSustain = #"Ped." + stopSustain = #"*" + stopStartSustain = #"*Ped." + startUnaChorda = #"una chorda" + stopUnaChorda = #"tre chorde" + % should make separate lists for stopsustain and startsustain + + \consists "Piano_pedal_engraver"; + \consists "Script_engraver"; + \consists "Dynamic_engraver"; + \consists "Text_engraver"; + %GURGURGU, text is initialised using TextScript + TextScript \push #'style = #"italic" + TextScript \push #'font-size = #2 + \consists "Skip_req_swallow_translator"; + + \consistsend "Axis_group_engraver"; + } + + \translator { + \VoiceContext + TextScript \push #'style = #"italic" + } + \translator { + \PianoStaffContext + \accepts Dynamics; + % aarg, also separates Dynamics context... + %VerticalAlignment \push #'threshold = #'(12 . 12) + %VerticalAlignment \pop #'threshold + VerticalAlignment \push #'threshold = #'(1 . 10) } \translator { \GraceContext - basicStemProperties \push #'flag-style = #"" + Stem \push #'flag-style = #"" } } } diff --git a/input/test/arpeggio.ly b/input/test/arpeggio.ly new file mode 100644 index 0000000000..8b81878ad4 --- /dev/null +++ b/input/test/arpeggio.ly @@ -0,0 +1,20 @@ +\score{ + \context StaffGroup < + %< + \context Staff=one \notes\relative c''{ + f, + + } + \context Staff=two \notes\relative c{ + \clef bass; + g + + } + > + \paper{ + \translator{ + \StaffContext + \consists Arpeggio_engraver; + } + } +} diff --git a/lily/arpeggio-engraver.cc b/lily/arpeggio-engraver.cc new file mode 100644 index 0000000000..dccb27e6ba --- /dev/null +++ b/lily/arpeggio-engraver.cc @@ -0,0 +1,74 @@ +/* + arpeggio-engraver.cc -- implement Arpeggio_engraver + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen + */ + +#include "engraver.hh" +#include "group-interface.hh" +#include "item.hh" +#include "arpeggio.hh" +#include "stem.hh" + +class Arpeggio_engraver : public Engraver +{ +public: + VIRTUAL_COPY_CONS (Translator); + Arpeggio_engraver (); + +protected: + virtual void acknowledge_element (Score_element_info); + virtual void process_acknowledged (); + virtual void do_pre_move_processing (); + +private: + Item* arpeggio_; + Link_array stems_; +}; + +Arpeggio_engraver::Arpeggio_engraver () +{ + arpeggio_ = 0; +} + +void +Arpeggio_engraver::acknowledge_element (Score_element_info info) +{ + if (Stem::has_interface (info.elem_l_)) + { + stems_.push (info.elem_l_); + } +} + +void +Arpeggio_engraver::process_acknowledged () +{ + if (!arpeggio_ && !stems_.empty ()) + { + arpeggio_ = new Item (get_property ("Arpeggio")); + Pointer_group_interface pgi (arpeggio_, "stems"); + for (int i = 0; i < stems_.size (); i++) + { + pgi.add_element (stems_[i]); + arpeggio_->add_dependency (stems_[i]); + } + announce_element (arpeggio_, 0); + } +} + +void +Arpeggio_engraver::do_pre_move_processing () +{ + if (arpeggio_) + { + typeset_element (arpeggio_); + arpeggio_ = 0; + } + stems_.clear (); +} + + +ADD_THIS_TRANSLATOR (Arpeggio_engraver); + diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc new file mode 100644 index 0000000000..7500ef844b --- /dev/null +++ b/lily/arpeggio.cc @@ -0,0 +1,50 @@ +/* + arpegggio.cc -- implement Arpeggio + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen + */ + +#include "molecule.hh" +#include "paper-def.hh" +#include "lookup.hh" +#include "arpeggio.hh" +#include "score-element.hh" +#include "stem.hh" +#include "staff-symbol-referencer.hh" + +bool +Arpeggio::has_interface (Score_element* me) +{ + return me && me->has_interface (ly_symbol2scm ("arpeggio-interface")); +} + +MAKE_SCHEME_CALLBACK (Arpeggio, brew_molecule, 1); +SCM +Arpeggio::brew_molecule (SCM smob) +{ + Score_element *me = unsmob_element (smob); + + Interval iv; + for (SCM s = me->get_elt_property ("stems"); gh_pair_p (s); s = gh_cdr (s)) + { + Score_element *stem = unsmob_element (gh_car (s)); + iv.unite (Stem::head_positions (stem)); + } + + Molecule mol; + Molecule dot = me->paper_l ()->lookup_l (0)->afm_find ("dots-dot"); + Real half_space = Staff_symbol_referencer::staff_space (me) / 2; + for (Real i = iv[MIN]; i <= iv[MAX]; i++) + { + Molecule d (dot); + d.translate_axis (i * half_space, Y_AXIS); + mol.add_molecule (d); + } + mol.translate (Offset (-3, 0)); + + return mol.create_scheme (); +} + + diff --git a/lily/include/arpeggio.hh b/lily/include/arpeggio.hh new file mode 100644 index 0000000000..317027d999 --- /dev/null +++ b/lily/include/arpeggio.hh @@ -0,0 +1,23 @@ +/* + arpegio.hh -- declare Arpeggio + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen +*/ + +#ifndef ARPEGGIO_HH +#define ARPEGGIO_HH + +#include "lily-guile.hh" +#include "lily-proto.hh" + +class Arpeggio +{ +public: + DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); + static bool has_interface (Score_element*); +}; + +#endif /* ARPEGGIO_HH */ + diff --git a/lily/include/span-arpeggio.hh b/lily/include/span-arpeggio.hh new file mode 100644 index 0000000000..a494fbeb26 --- /dev/null +++ b/lily/include/span-arpeggio.hh @@ -0,0 +1,24 @@ +/* + span-arpegio.hh -- declare Span_arpeggio + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen +*/ + +#ifndef SPAN_ARPEGGIO_HH +#define SPAN_ARPEGGIO_HH + +#include "lily-guile.hh" +#include "lily-proto.hh" +#include "interval.hh" + +class Span_arpeggio +{ +public: + DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); + static bool has_interface (Score_element*); +}; + +#endif /* SPAN_ARPEGGIO_HH */ + diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc new file mode 100644 index 0000000000..8fb13aeb93 --- /dev/null +++ b/lily/span-arpeggio-engraver.cc @@ -0,0 +1,85 @@ +/* + span-arpeggio-engraver.cc -- implement Span_arpeggio_engraver + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen +*/ + +#include "engraver.hh" +#include "item.hh" +#include "arpeggio.hh" +#include "span-arpeggio.hh" +#include "group-interface.hh" + + +/** + + Make arpeggios that span multiple staffs. Catch arpeggios, and span a + Span_arpeggio over them if we find more than two arpeggios. + */ +class Span_arpeggio_engraver : public Engraver +{ +public: + VIRTUAL_COPY_CONS (Translator); + Span_arpeggio_engraver (); + +protected: + virtual void acknowledge_element (Score_element_info); + virtual void process_acknowledged (); + virtual void do_pre_move_processing (); + +private: + Item *span_arpeggio_; + Link_array arpeggios_; +}; + + +Span_arpeggio_engraver::Span_arpeggio_engraver () +{ + span_arpeggio_ = 0; +} + +void +Span_arpeggio_engraver::acknowledge_element (Score_element_info info) +{ + if (info.origin_trans_l_arr (this).size () + && Arpeggio::has_interface (info.elem_l_)) + { + arpeggios_.push (info.elem_l_); + } +} + +void +Span_arpeggio_engraver::process_acknowledged () +{ + if (arpeggios_.size () > 1 && !span_arpeggio_) + { + span_arpeggio_ = new Item (get_property ("SpanArpeggio")); + Pointer_group_interface pgi (span_arpeggio_, "arpeggios"); + for (int i = 0; i < arpeggios_.size () ; i++) + { + pgi.add_element (arpeggios_[i]); + span_arpeggio_->add_dependency (arpeggios_[i]); + } + + span_arpeggio_->set_parent (arpeggios_[0], Y_AXIS); + span_arpeggio_->set_parent (arpeggios_[0], X_AXIS); + + announce_element (span_arpeggio_, 0); + } +} + +void +Span_arpeggio_engraver::do_pre_move_processing () +{ + if (span_arpeggio_) + { + typeset_element (span_arpeggio_); + span_arpeggio_ = 0; + } + arpeggios_.clear (); +} + +ADD_THIS_TRANSLATOR (Span_arpeggio_engraver); + diff --git a/lily/span-arpeggio.cc b/lily/span-arpeggio.cc new file mode 100644 index 0000000000..5a574a8eb8 --- /dev/null +++ b/lily/span-arpeggio.cc @@ -0,0 +1,68 @@ +/* + span-arpeggio.cc -- implement Span_arpeggio + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen +*/ + +#include "axis-group-interface.hh" +#include "molecule.hh" +#include "paper-def.hh" +#include "lookup.hh" +#include "arpeggio.hh" +#include "span-arpeggio.hh" +#include "score-element.hh" +#include "stem.hh" +#include "staff-symbol-referencer.hh" + +bool +Span_arpeggio::has_interface (Score_element* me) +{ + return me && me->has_interface (ly_symbol2scm ("span-arpeggio-interface")); +} + +/* + We could collapse this with Arpeggio::brew_molecule, but that requires + hairy scm callback hacking. + */ +MAKE_SCHEME_CALLBACK (Span_arpeggio, brew_molecule, 1); +SCM +Span_arpeggio::brew_molecule (SCM smob) +{ + Score_element *me = unsmob_element (smob); + + Interval iv; + Score_element *common = me; + for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s)) + { + Score_element *arpeggio = unsmob_element (gh_car (s)); + common = arpeggio->common_refpoint (common, Y_AXIS); + } + // Hmm, nothing in common? + if (0) //(common) + for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s)) + { + Score_element *arpeggio = unsmob_element (gh_car (s)); + Real c = common->relative_coordinate (arpeggio, Y_AXIS); + //iv.unite (Arpeggio::head_positions (stem)); + iv.unite (Interval (c, c)); + } + else + iv = Interval (-23, 5); + + Molecule mol; + Molecule dot = me->paper_l ()->lookup_l (0)->afm_find ("dots-dot"); + Real half_space = Staff_symbol_referencer::staff_space (me) / 2; + for (Real i = iv[MIN]; i < iv[MAX]; i++) + { + Molecule d (dot); + d.translate_axis (i * half_space, Y_AXIS); + mol.add_molecule (d); + } + mol.translate (Offset (-6, 0)); + + return mol.create_scheme (); +} + + diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 6f04809e74..189b54ff99 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -145,6 +145,7 @@ Span_bar::get_bar_size (SCM smob) } return gh_double2scm (iv.length ()); } + void Span_bar::set_interface (Score_element *me) { diff --git a/ly/engraver.ly b/ly/engraver.ly index b5f51c2f0b..de43a4918e 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -34,6 +34,8 @@ StaffContext=\translator { \consists "Piano_pedal_engraver"; +% \consists "Arpeggio_engraver"; + \consistsend "Axis_group_engraver"; %{ @@ -191,6 +193,7 @@ GrandStaffContext=\translator{ \type "Engraver_group_engraver"; \name GrandStaff; \consists "Span_bar_engraver"; + \consists "Span_arpeggio_engraver"; \consists "System_start_delimiter_engraver"; systemStartDelimiterGlyph = #'brace @@ -212,11 +215,13 @@ PianoStaffContext = \translator{\GrandStaffContext StaffGroupContext= \translator { \type "Engraver_group_engraver"; + \name StaffGroup; + \consists "Span_bar_engraver"; + \consists "Span_arpeggio_engraver"; \consists "Output_property_engraver"; + systemStartDelimiterGlyph = #'bracket \consists "System_start_delimiter_engraver"; - systemStartDelimiterGlyph = #'bracket - \name StaffGroup; \accepts "Staff"; \accepts "RhythmicStaff"; \accepts "GrandStaff"; @@ -337,6 +342,7 @@ ScoreContext = \translator { \consists "Lyric_phrasing_engraver"; \consists "Bar_number_engraver"; + \consists "Span_arpeggio_engraver"; \accepts "Staff"; @@ -433,6 +439,11 @@ ScoreContext = \translator { % distances are given in stafflinethickness (thicknesses) and % staffspace (distances) % + Arpeggio = #`( + (interfaces . (arpeggio-interface)) + (molecule-callback . ,Arpeggio::brew_molecule) + (name . "arpeggio") + ) BarLine = #`( (interfaces . (bar-interface staff-bar-interface)) (break-align-symbol . Staff_bar) @@ -754,7 +765,11 @@ ScoreContext = \translator { (maximum-duration-for-spacing . ,(make-moment 1 8)) (name . "SpacingSpanner") ) - + SpanArpeggio = #`( + (interfaces . (span-arpeggio-interface)) + (molecule-callback . ,Span_arpeggio::brew_molecule) + (name . "SpanArpeggio") + ) SpanBar = #`( (interfaces . (bar-interface span-bar-interface)) (break-align-symbol . Staff_bar)