On Wed, Jun 17, 2009 at 10:41:24PM +0100, Neil Puttock wrote:
> 2009/6/17 Han-Wen Nienhuys <hanw...@gmail.com>:
> > I think this can be neater.  By tracking the 'cause property
> > backwards, this could simply be a grob property callback, and the C++
> > does not need to touch the
> > 'dot-count property.
> 
> We already have the callback, as I pointed out in the other thread:
> dots::calc-dot-count.
> 
> Patrick, all you need to do is remove this line, since the callback
> will furnish the correct value for 'dot-count as required:
> 
>       d->set_property ("dot-count", scm_from_int (dur->dot_count ()));
> 
> A regression test would be useful to show that the override actually works.

Okay, thanks for the guidance.  Attached is a revised patch.

Thanks,
-Patrick
>From 16aa49c7ab1695a6dc3b33bbc38913580378e51e Mon Sep 17 00:00:00 2001
From: Patrick McCarty <pnor...@gmail.com>
Date: Mon, 15 Jun 2009 18:35:47 -0700
Subject: [PATCH] Fix #778

* Do not set 'dot-count in Dots_engraver, since
  Dots already has a callback for this property.

  This also permits user overrides to 'dot-count.

Signed-off-by: Patrick McCarty <pnor...@gmail.com>
---
 input/regression/dot-dot-count-override.ly |   15 +++++++++++++++
 lily/dots-engraver.cc                      |    1 -
 2 files changed, 15 insertions(+), 1 deletions(-)
 create mode 100644 input/regression/dot-dot-count-override.ly

diff --git a/input/regression/dot-dot-count-override.ly 
b/input/regression/dot-dot-count-override.ly
new file mode 100644
index 0000000..f44e88b
--- /dev/null
+++ b/input/regression/dot-dot-count-override.ly
@@ -0,0 +1,15 @@
+\version "2.13.1"
+
+\header {
+  texidoc = "The @code{dot-count} property
+for @code{Dots} can be modified by the user."
+
+}
+
+\relative c'' {
+  c4.. a16
+  \override Dots #'dot-count = #4
+  g4.. e16
+  \override Dots #'dot-count = #0
+  c4. r8 r2
+}
diff --git a/lily/dots-engraver.cc b/lily/dots-engraver.cc
index 9d1af77..11b3847 100644
--- a/lily/dots-engraver.cc
+++ b/lily/dots-engraver.cc
@@ -43,7 +43,6 @@ Dots_engraver::acknowledge_rhythmic_head (Grob_info gi)
       Item *d = make_item ("Dots", note->self_scm ());
       Rhythmic_head::set_dots (note, d);
 
-      d->set_property ("dot-count", scm_from_int (dur->dot_count ()));
       d->set_parent (note, Y_AXIS);
     }
 }
-- 
1.6.3.2

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to