]> git.donarmstrong.com Git - lilypond.git/commitdiff
Move rotated_box () from Stem_tremolo:: to Lookup::
authorErlend Aasland <erlenda@gmail.com>
Tue, 18 Apr 2006 09:15:46 +0000 (09:15 +0000)
committerErlend Aasland <erlenda@gmail.com>
Tue, 18 Apr 2006 09:15:46 +0000 (09:15 +0000)
ChangeLog
lily/include/lookup.hh
lily/include/stem-tremolo.hh
lily/lookup.cc
lily/stem-tremolo.cc

index 0a2b6c46f4b30f4fcc6f8cc5f45ce8b2238d0cb5..0f97b589d2f69f3379289d8e7a18b90f16f7d1e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-04-18  Erlend Aasland <erlenda@gmail.com>
+
+       * lily/include/stem-tremolo.hh:
+       * lily/stem-tremolo.cc: move rotated_box () to Lookup:: and update
+       callers.
+
+       * lily/lookup.cc: add rotated_box ()
+       * lily/include/lookup.hh:
+
 2006-04-18  Heikki Junes  <hjunes@cc.hut.fi>
 
        * scripts/GNUmakefile: bugfix: run help2man only after scripts have 
index 54ad282f9f23fb61782690f782d84969dc7a0113..db5f2d9cc78a631edcf8bcd480c695f35ed82448 100644 (file)
@@ -18,6 +18,7 @@ struct Lookup
   static Stencil dot (Offset p, Real radius);
   static Stencil bracket (Axis a, Interval iv, Real thick, Real protude, Real blot);
   static Stencil accordion (SCM arg, Real interline_f, Font_metric *fm);
+  static Stencil rotated_box (Real slope, Real width, Real thick, Real blot);
   static Stencil round_filled_polygon (vector<Offset> const &points, Real blotdiameter);
   static Stencil frame (Box b, Real thick, Real blot);
   static Stencil slur (Bezier controls, Real cthick, Real thick);
index fb8f57ff5e21e0a0a91a07aa37fd2b977979abd3..731d2462d355f864363c7f8800c588b10abe35ae 100644 (file)
@@ -22,7 +22,6 @@ public:
   DECLARE_SCHEME_CALLBACK (print, (SCM));
   DECLARE_SCHEME_CALLBACK (height, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_style, (SCM));
-  static Stencil rotated_box (Real slope, Real width, Real thick, Real blot);
   static Stencil raw_stencil (Grob *, Real, Direction stemdir);
   static Real get_beam_translation (Grob *me);
 };
index fb64bc16041861d9afdc3c47123677c57d022279..d8c20c044fcd871b36f831b83adf022ed28c0c54 100644 (file)
@@ -110,6 +110,22 @@ Lookup::dashed_slur (Bezier b, Real thick, Real dash_period, Real dash_fraction)
   return Stencil (box, at);
 }
 
+Stencil
+Lookup::rotated_box (Real slope, Real width, Real thick, Real blot)
+{
+  vector<Offset> pts;
+  Offset rot (1, slope);
+
+  thick -= 2*blot;
+  width -= 2*blot;
+  rot /= sqrt (1 + slope*slope);
+  pts.push_back (Offset (0, -thick / 2) * rot);
+  pts.push_back (Offset (width, -thick / 2) * rot);
+  pts.push_back (Offset (width, thick / 2) * rot);
+  pts.push_back (Offset (0, thick / 2) * rot);
+  return Lookup::round_filled_polygon (pts, blot);
+}
+
 Stencil
 Lookup::horizontal_line (Interval w, Real th)
 {
index b3ea13d30d1f0fac3992b4ae9391e10b76e9f99f..cec65cbcafc030db87367f41025fc67d8e59403f 100644 (file)
@@ -86,23 +86,6 @@ Stem_tremolo::get_beam_translation (Grob *me)
   return  beam ? Beam::get_beam_translation (beam) : 0.81;
 }
 
-/* FIXME: move to Lookup? */
-Stencil
-Stem_tremolo::rotated_box (Real slope, Real width, Real thick, Real blot)
-{
-  vector<Offset> pts;
-  Offset rot (1, slope);
-
-  thick -= 2*blot;
-  width -= 2*blot;
-  rot /= sqrt (1 + slope*slope);
-  pts.push_back (Offset (0, -thick / 2) * rot);
-  pts.push_back (Offset (width, -thick / 2) * rot);
-  pts.push_back (Offset (width, thick / 2) * rot);
-  pts.push_back (Offset (0, thick / 2) * rot);
-  return Lookup::round_filled_polygon (pts, blot);
-}
-
 Stencil
 Stem_tremolo::raw_stencil (Grob *me, Real slope, Direction stemdir)
 {
@@ -117,9 +100,12 @@ Stem_tremolo::raw_stencil (Grob *me, Real slope, Direction stemdir)
   width *= ss;
   thick *= ss;
 
-  Stencil a = style == ly_symbol2scm ("rectangle") ?
-    rotated_box (slope, width, thick, blot) :
-    Lookup::beam (slope, width, thick, blot);
+  Stencil a;
+  if (style == ly_symbol2scm ("rectangle"))
+    a = Lookup::rotated_box (slope, width, thick, blot);
+  else
+    a = Lookup::beam (slope, width, thick, blot);
+
   a.align_to (X_AXIS, CENTER);
   a.align_to (Y_AXIS, CENTER);