]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/stencil.cc
Issue 5167/6: Changes: show \markup xxx = ... \etc assignments
[lilypond.git] / lily / stencil.cc
index 7c1c918655c1d05b87aae6b0c3f682d508323c18..dc5549f6314393a0c3393fd088d62cee50db1b70 100644 (file)
@@ -25,7 +25,6 @@
 #include "string-convert.hh"
 #include "warn.hh"
 
-using std::vector;
 
 Stencil::Stencil ()
 {
@@ -45,7 +44,7 @@ Stencil::mark_smob () const
   return expr_;
 }
 
-const char Stencil::type_p_name_[] = "ly:stencil?";
+const char * const Stencil::type_p_name_ = "ly:stencil?";
 
 Interval
 Stencil::extent (Axis a) const
@@ -81,7 +80,7 @@ Stencil::extent_box () const
 void
 Stencil::rotate (Real a, Offset off)
 {
-  rotate_degrees (a * 180 / M_PI, off);
+  rotate_degrees (a, off);
 }
 
 /*
@@ -105,10 +104,10 @@ Stencil::rotate_degrees_absolute (Real a, Offset absolute_off)
    *         *this = rotated()
    */
 
-  expr_ = scm_list_n (ly_symbol2scm ("rotate-stencil"),
+  expr_ = scm_list_3 (ly_symbol2scm ("rotate-stencil"),
                       scm_list_2 (scm_from_double (a),
                                   scm_cons (scm_from_double (x), scm_from_double (y))),
-                      expr_, SCM_UNDEFINED);
+                      expr_);
 
   /*
    * Calculate the new bounding box
@@ -122,7 +121,7 @@ Stencil::rotate_degrees_absolute (Real a, Offset absolute_off)
   pts.push_back (Offset (shifted_box.x ().at (RIGHT), shifted_box.y ().at (UP)));
   pts.push_back (Offset (shifted_box.x ().at (LEFT), shifted_box.y ().at (UP)));
 
-  const Offset rot = complex_exp (Offset (0, a * M_PI / 180.0));
+  const Offset rot (offset_directed (a));
   dim_.set_empty ();
   for (vsize i = 0; i < pts.size (); i++)
     dim_.add_point (pts[i] * rot + absolute_off);
@@ -168,9 +167,9 @@ Stencil::translate (Offset o)
     }
 
   if (!scm_is_null (expr_))
-    expr_ = scm_list_n (ly_symbol2scm ("translate-stencil"),
+    expr_ = scm_list_3 (ly_symbol2scm ("translate-stencil"),
                         ly_offset2scm (o),
-                        expr_, SCM_UNDEFINED);
+                        expr_);
   dim_.translate (o);
 }
 
@@ -249,7 +248,7 @@ Stencil::align_to (Axis a, Real x)
 /*  See scheme Function.  */
 
 // Any stencil that is empty in the orthogonal axis is spacing.
-// Spacing is not subjected to the std::max (0) rule and can thus be
+// Spacing is not subjected to the max (0) rule and can thus be
 // negative.
 
 void
@@ -416,3 +415,13 @@ Stencil::translated (Offset z) const
   s.translate (z);
   return s;
 }
+
+Stencil
+Stencil::with_outline (Stencil const &ol) const
+{
+  Stencil new_stencil (ol.extent_box (),
+                       scm_list_3 (ly_symbol2scm ("with-outline"),
+                                   ol.expr (),
+                                   expr ()));
+  return new_stencil;
+}