]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #259.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 31 Jan 2007 17:55:54 +0000 (18:55 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 31 Jan 2007 17:55:54 +0000 (18:55 +0100)
Change attach dir for left bound if we start on a text dynamic.

input/regression/dynamics-text-spanner-abs-dynamic.ly [new file with mode: 0644]
lily/dynamic-engraver.cc
lily/grob-property.cc
lily/include/grob.hh

diff --git a/input/regression/dynamics-text-spanner-abs-dynamic.ly b/input/regression/dynamics-text-spanner-abs-dynamic.ly
new file mode 100644 (file)
index 0000000..199320e
--- /dev/null
@@ -0,0 +1,16 @@
+\header
+{
+
+  texidoc = "left attach dir for text crescendi starting on an
+  absolute dynamic is changed, so cresc. and the absolute dynamic
+  don't overstrike."
+  
+}
+
+\version "2.11.14"
+\paper { ragged-right = ##t }
+
+\relative c' {
+  \setTextCresc
+  c4\p\< c c c\!
+}
index caef2ce4c4231a8fb0d22893be4160a5504f44a5..7a5b5762789ef6f6d144d5f9f18031cbf53fb325 100644 (file)
@@ -259,6 +259,16 @@ Dynamic_engraver::process_music ()
                  context ()->set_property ((start_type + "Text").c_str (),
                                            SCM_EOL);
                }
+
+             if (script_)
+               {
+                 set_nested_property (cresc_,
+                                      scm_list_3 (ly_symbol2scm ("attach-dir"),
+                                                  ly_symbol2scm ("left"),
+                                                  ly_symbol2scm ("bound-details")
+                                                  ),
+                                      scm_from_int (RIGHT));
+               }
            }
 
          if (script_)
index 702206186f36f0dda56670c16833ca5130d078a7..7bf13062a59d38523ba31cf8b8da99fb8ced07e7 100644 (file)
@@ -280,3 +280,38 @@ call_pure_function (SCM unpure, SCM args, int start, int end)
   return scm_apply_0 (scm_call_pure_function,
                      scm_list_4 (unpure, args, scm_from_int (start), scm_from_int (end)));
 }
+
+
+/*
+  PROP_PATH should be big-to-small ordering
+ */
+SCM 
+nested_property_alist (SCM alist, SCM prop_path, SCM value)
+{
+  SCM new_value = SCM_BOOL_F;
+  if (scm_is_pair (scm_cdr (prop_path)))
+    {
+      SCM sub_alist = ly_assoc_get (scm_car (prop_path), alist, SCM_EOL);
+      new_value = nested_property_alist (sub_alist, scm_cdr (prop_path), value);
+    }
+  else
+    {
+      new_value = value;
+    }
+  
+  return scm_acons (scm_car (prop_path), new_value, alist);
+}
+
+
+void
+set_nested_property (Grob *me, SCM property_path, SCM value)
+{
+  SCM big_to_small = scm_reverse (property_path);
+  SCM alist = me->get_property (scm_car (big_to_small));
+
+  alist = nested_property_alist (alist, scm_cdr (big_to_small), value);
+  
+  me->set_property (scm_car (big_to_small),
+                   alist);
+}
+
index 3b5f19d97e77f8db8af88a799d801f4623450e71..d134068568b6810e271203eb1d7b7fac1749a572 100644 (file)
@@ -150,4 +150,7 @@ SCM axis_parent_positioning (Axis a);
 
 SCM call_pure_function (SCM unpure, SCM args, int start, int end);
 
+void set_nested_property (Grob *, SCM property_path, SCM value);
+
+
 #endif /* GROB_HH */