]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lookup.cc
* lily/lookup.cc (triangle): rewrite, obviating symmetric_x_triangle().
[lilypond.git] / lily / lookup.cc
index 37a3da0b10a2f958143a2cbc91964458a7d94e01..08444bfd8d17adfbf26f8fbdf9d5e8832b003678 100644 (file)
@@ -166,12 +166,10 @@ Lookup::round_filled_box (Box b, Real blotdiameter)
 {
   if (b.x ().length () < blotdiameter)
     {
-      programming_error (_f ("round filled box horizontal extent smaller than blot; decreasing blot"));
       blotdiameter = b.x ().length ();
     }
   if (b.y ().length () < blotdiameter)
     {
-      programming_error (_f ("round filled box vertical extent smaller than blot; decreasing blot"));
       blotdiameter = b.y ().length ();
     }
 
@@ -454,8 +452,8 @@ Stencil
 Lookup::accordion (SCM s, Real staff_space, Font_metric *fm) 
 {
   Stencil m;
-  String sym = ly_scm2string (ly_car (s));
-  String reg = ly_scm2string (ly_car (ly_cdr (s)));
+  String sym = ly_scm2string (scm_car (s));
+  String reg = ly_scm2string (scm_car (scm_cdr (s)));
 
   if (sym == "Discant")
     {
@@ -689,15 +687,22 @@ Stencil
 Lookup::triangle (Interval iv, Real thick, Real protude)
 {
   Box b ;
-  b[X_AXIS] = iv;
+  b[X_AXIS] = Interval (0, iv.length());
   b[Y_AXIS] = Interval (0 <? protude , 0 >? protude);
 
-  SCM s = scm_list_n (ly_symbol2scm ("symmetric-x-triangle"),
-                     scm_make_real (thick),
-                     scm_make_real (iv.length ()), 
-                     scm_make_real (protude), SCM_UNDEFINED);
 
-  return Stencil (b, s);
+  Offset z1(iv[LEFT], 0);
+  Offset z2(iv[RIGHT], 0);
+  Offset z3(z2[X_AXIS]/2, protude);
+
+  /*
+    TODO: move Triangle to Line_interface ?
+   */
+  Stencil tri = Line_interface::make_line (thick, z1, z2);
+  tri.add_stencil (Line_interface::make_line (thick, z2, z3));
+  tri.add_stencil (Line_interface::make_line (thick, z3, z1));
+
+  return tri;
 }
 
 
@@ -710,14 +715,14 @@ LY_DEFINE (ly_bracket ,"ly:bracket",
 {
   SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG1, __FUNCTION__, "axis") ;
   SCM_ASSERT_TYPE (is_number_pair (iv), iv, SCM_ARG2, __FUNCTION__, "number pair") ;
-  SCM_ASSERT_TYPE (ly_number_p (t), a, SCM_ARG3, __FUNCTION__, "number") ;
-  SCM_ASSERT_TYPE (ly_number_p (p), a, SCM_ARG4, __FUNCTION__, "number") ;
+  SCM_ASSERT_TYPE (scm_is_number (t), a, SCM_ARG3, __FUNCTION__, "number") ;
+  SCM_ASSERT_TYPE (scm_is_number (p), a, SCM_ARG4, __FUNCTION__, "number") ;
 
 
-  return Lookup::bracket ((Axis)ly_scm2int (a), ly_scm2interval (iv),
-                         ly_scm2double (t),
-                         ly_scm2double (p),
-                         0.95 * ly_scm2double (t)).smobbed_copy ();
+  return Lookup::bracket ((Axis)scm_to_int (a), ly_scm2interval (iv),
+                         scm_to_double (t),
+                         scm_to_double (p),
+                         0.95 * scm_to_double (t)).smobbed_copy ();
 }
 
 
@@ -732,9 +737,9 @@ LY_DEFINE (ly_filled_box ,"ly:round-filled-box",
 {
   SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG1, __FUNCTION__, "number pair") ;
   SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG2, __FUNCTION__, "number pair") ;
-  SCM_ASSERT_TYPE (ly_number_p (blot), blot, SCM_ARG3, __FUNCTION__, "number") ;
+  SCM_ASSERT_TYPE (scm_is_number (blot), blot, SCM_ARG3, __FUNCTION__, "number") ;
 
   return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)),
-                                  ly_scm2double (blot)).smobbed_copy ();
+                                  scm_to_double (blot)).smobbed_copy ();
 }