lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sets spanner length as a spanner property. (issue4641085)


From: mtsolo
Subject: Sets spanner length as a spanner property. (issue4641085)
Date: Thu, 30 Jun 2011 14:21:00 +0000

Reviewers: ,

Message:
Hey all,

This patch simplifies a lot of code duping I'm doing to get spanner
lengths in various scheme functions.  Please lemme know if it's OK!

Cheers,
MS

Description:
Sets spanner length as a spanner property.

Please review this at http://codereview.appspot.com/4641085/

Affected files:
  M lily/lyric-hyphen.cc
  M lily/spanner.cc
  M scm/define-grobs.scm


Index: lily/lyric-hyphen.cc
diff --git a/lily/lyric-hyphen.cc b/lily/lyric-hyphen.cc
index 5fae21fc34f9e4704d6561ad0637158c193b56fc..7c389024aba966eae0c8427629ce469469f01ed2 100644
--- a/lily/lyric-hyphen.cc
+++ b/lily/lyric-hyphen.cc
@@ -68,7 +68,7 @@ Lyric_hyphen::print (SCM smob)
   // interval?

Real dash_period = robust_scm2double (me->get_property ("dash-period"), 1.0);
-  Real dash_length = robust_scm2double (me->get_property ("length"), .5);
+ Real dash_length = robust_scm2double (me->get_property ("hyphen-length"), .5);
   Real padding = robust_scm2double (me->get_property ("padding"), 0.1);

   if (dash_period < dash_length)
@@ -147,7 +147,7 @@ ADD_INTERFACE (Lyric_hyphen,
               /* properties */
               "dash-period "
               "height "
-              "length "
+              "hyphen-length "
               "minimum-distance "
               "minimum-length "
               "padding "
Index: lily/spanner.cc
diff --git a/lily/spanner.cc b/lily/spanner.cc
index 30638bfed44d64f7c44743b8a2a465d0b543ee47..dc389822887cd119273ea84665f269bfed57c781 100644
--- a/lily/spanner.cc
+++ b/lily/spanner.cc
@@ -443,9 +443,11 @@ Spanner::calc_normalized_endpoints (SCM smob)
           total_width += span_data[i];
         }

+      orig->set_property ("length", scm_from_double (total_width));
       for (vsize i = 0; i < unnormalized_endpoints.size (); i++)
         {
SCM t = ly_interval2scm (1 / total_width * unnormalized_endpoints[i]); + orig->broken_intos_[i]->set_property ("length", scm_from_double (unnormalized_endpoints[i].length ()));
           orig->broken_intos_[i]->set_property ("normalized-endpoints", t);
           if (me->get_break_index () == i)
             result = t;
@@ -546,6 +548,7 @@ ADD_INTERFACE (Spanner,

               /* properties */
               "normalized-endpoints "
+              "length "
               "minimum-length "
               "to-barline "
               );
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index ecfeee3d6bf35bd3f7ebeb5e113420bf2e821e2d..7581606e3b4c6ecfd60e4260aec20b54417d7324 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1196,7 +1196,7 @@
        (after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
        (dash-period . 10.0)
        (height . 0.42)
-       (length . 0.66)
+       (hyphen-length . 0.66)
        (minimum-distance . 0.1)
        (minimum-length . 0.3)
        (padding . 0.07)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]