]> git.donarmstrong.com Git - lilypond.git/commitdiff
Support properties on articulations.
authorDevon Schudy <dschudy@gmail.com>
Sun, 24 Nov 2013 03:39:50 +0000 (22:39 -0500)
committerJanek Warchoł <lemniskata.bernoullego@gmail.com>
Thu, 5 Dec 2013 21:02:45 +0000 (22:02 +0100)
Shorthand articulations like -. can now be ArticulationEvents, not just
articulation names. Previously a shorthand created a new ArticulationEvent
with its name, so there was no way to give it properties. Now it can be (and
is, by default) an ArticulationEvent.

Note that redefining a shorthand to a string (e.g. dashDot = "staccatissimo")
still creates propertyless articulations, regardless of \staccatissimo.

lily/parser.yy
ly/script-init.ly
scm/music-functions.scm

index e8fec3de2aa988551577d2289c2e797ca3559a43..1c8e527b4e46ae56d1a26b418edcb530a6021838 100644 (file)
@@ -2814,11 +2814,18 @@ direction_reqd_event:
        }
        | script_abbreviation {
                SCM s = parser->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
-               Music *a = MY_MAKE_MUSIC ("ArticulationEvent", @$);
-               if (scm_is_string (s))
+               if (scm_is_string (s)) {
+                       Music *a = MY_MAKE_MUSIC ("ArticulationEvent", @$);
                        a->set_property ("articulation-type", s);
-               else parser->parser_error (@1, _ ("expecting string as script definition"));
-               $$ = a->unprotect ();
+                       $$ = a->unprotect ();
+               } else if (ly_prob_type_p (s, ly_symbol2scm ("ArticulationEvent"))) {
+                       $$ = s;
+                       if (Music *original = unsmob_music (s)) {
+                               Music *a = original->clone ();
+                               a->set_spot (parser->lexer_->override_input (@$));
+                               $$ = a->unprotect ();
+                       }
+               } else parser->parser_error (@1, _ ("expecting string or ArticulationEvent as script definition"));
        }
        ;
 
index 0cb37947e7294cb1f98b97a4a83dbe26d059ac31..89c1f5802bd37b91fc6d42b2801f5b96cdf1722c 100644 (file)
@@ -2,15 +2,6 @@
 
 \version "2.17.25"
 
-% code char abbreviations
-dashHat = "marcato"
-dashPlus = "stopped"
-dashDash = "tenuto"
-dashBang = "staccatissimo"
-dashLarger = "accent"
-dashDot = "staccato"
-dashUnderscore = "portato"
-
 harmonic = #(make-music 'HarmonicEvent)
 
 accent = #(make-articulation "accent")
@@ -55,3 +46,12 @@ upmordent = #(make-articulation "upmordent")
 upprall = #(make-articulation "upprall")
 varcoda = #(make-articulation "varcoda")
 verylongfermata = #(make-articulation "verylongfermata")
+
+% code char abbreviations
+dashHat = \marcato
+dashPlus = \stopped
+dashDash = \tenuto
+dashBang = \staccatissimo
+dashLarger = \accent
+dashDot = \staccato
+dashUnderscore = \portato
index a5aa02fdd1fd1e996b22b9053145b96878b0b6fe..9bf47d408e5f8ae36f2512e616c5729eda95bbd9 100644 (file)
@@ -637,9 +637,10 @@ in @var{grob}."
   (make-music 'PropertyUnset
               'symbol sym))
 
-(define-safe-public (make-articulation name)
-  (make-music 'ArticulationEvent
-              'articulation-type name))
+(define-safe-public (make-articulation name . properties)
+  (apply make-music 'ArticulationEvent
+         'articulation-type name
+         properties))
 
 (define-public (make-lyric-event string duration)
   (make-music 'LyricEvent