]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/crescendo.cc
release: 1.3.32
[lilypond.git] / lily / crescendo.cc
index bdf26864df3bb5b7f5358906a2580a8e58e5703e..36bdcbdbec6a308431b2dd4cb560907aee1f99d1 100644 (file)
@@ -22,6 +22,7 @@ Crescendo::Crescendo ()
 
 
 
+
 Molecule 
 Crescendo::do_brew_molecule () const
 {
@@ -69,31 +70,67 @@ Crescendo::do_brew_molecule () const
 
   Drul_array<bool> broken;
   Direction d = LEFT;
-  do {
-    Paper_column* s = dynamic_cast<Paper_column*>(spanned_drul_[d]); // UGH
-    broken[d] = (!s->musical_b ());
-  } while (flip (&d) != LEFT);
+  do
+    {
+      Paper_column* s = dynamic_cast<Paper_column*>(spanned_drul_[d]); // UGH
+      broken[d] = (!s->musical_b ());
+    }
+  while (flip (&d) != LEFT);
   
+  Molecule m;
+  
+  Real pad = 0;
+  SCM s = get_elt_property ("start-text");
+  if (gh_string_p (s))
+    {
+      Molecule start_text (lookup_l ()->text ("italic",
+                                             ly_scm2string (s),
+                                             paper_l ()));
+      m.add_molecule (start_text);
 
-  bool continued = broken[Direction (-gd)];
-  Real height = paper_l()->get_var ("crescendo_height");
-  Real thick = paper_l ()->get_var ("crescendo_thickness");
-
-  const char* hairpin = (gd < 0)? "decrescendo" :  "crescendo";
+      pad = paper_l ()->get_var ("interline") / 2;
 
-  Box b (Interval (0, width),
-        Interval (-2*height, 2*height));
+      width -= start_text.extent ()[X_AXIS].length ();
+      width -= pad;
+      width = width >? 0;
+    }
 
-  SCM at = gh_list (ly_symbol2scm (hairpin),
-                    gh_double2scm (thick),
-                    gh_double2scm (width),
-                    gh_double2scm (height),
-                    gh_double2scm (continued ? height/2 : 0.0),
-                    SCM_UNDEFINED);
+  SCM at;
+  s = get_elt_property ("spanner");
+  Real height;
+  if (gh_string_p (s) && ly_scm2string (s) == "dashed-line")
+    {
+      Real thick = paper_l ()->get_var ("crescendo_dash_thickness");
+      Real dash = paper_l ()->get_var ("crescendo_dash");
+      height = thick;
+      at = gh_list (ly_symbol2scm (ly_scm2string (s).ch_C ()),
+                   gh_double2scm (thick),
+                   gh_double2scm (dash),
+                   gh_double2scm (width),
+                   SCM_UNDEFINED);
+    }
+  else
+    {
+      bool continued = broken[Direction (-gd)];
+      height = paper_l()->get_var ("crescendo_height");
+      Real thick = paper_l ()->get_var ("crescendo_thickness");
+      
+      const char* hairpin = (gd < 0)? "decrescendo" :  "crescendo";
+
+      at = gh_list (ly_symbol2scm (hairpin),
+                   gh_double2scm (thick),
+                   gh_double2scm (width),
+                   gh_double2scm (height),
+                   gh_double2scm (continued ? height/2 : 0.0),
+                   SCM_UNDEFINED);
+    }
+  Box b (Interval (0, width), Interval (-2*height, 2*height));
+  Molecule span (b, at);
 
-  Molecule m (b, at);
-  
+  m.add_at_edge (X_AXIS, RIGHT, span, pad);
   m.translate_axis (extra_left, X_AXIS);
+
   return m;
 }