X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpercent-repeat-item.cc;h=705d9394b200b34423413f1f1863c91021875dd2;hb=ce593a5d9614d463ac0255eac17ceb50ce3bcc29;hp=47b219927073c3d8e7b0e88c2dd811757f48c851;hpb=c380a7abde14a60ebd6d8a6eab91ae4e13677a23;p=lilypond.git diff --git a/lily/percent-repeat-item.cc b/lily/percent-repeat-item.cc index 47b2199270..705d9394b2 100644 --- a/lily/percent-repeat-item.cc +++ b/lily/percent-repeat-item.cc @@ -1,85 +1,78 @@ -/* - percent-repeat-item.cc -- implement Percent_repeat_item_interface - +/* + percent-repeat-item.cc -- implement Percent_repeat_item_interface + source file of the GNU LilyPond music typesetter - - (c) 2001--2002 Han-Wen Nienhuys - - */ -#include -#include "grob.hh" + (c) 2001--2006 Han-Wen Nienhuys +*/ + +#include "percent-repeat-item.hh" +#include "item.hh" #include "lookup.hh" -#include "molecule.hh" #include "font-interface.hh" -#include "font-metric.hh" -#include "percent-repeat-item.hh" - -Molecule -Percent_repeat_item_interface::brew_slash ( Grob *me) +Stencil +Percent_repeat_item_interface::brew_slash (Grob *me) { - Real slope = gh_scm2double (me->get_grob_property ("slope")); + Real slope = robust_scm2double (me->get_property ("slope"), 1); Real wid = 2.0 / slope; /* todo: check out if in staff-rule thickness normally. - */ - Real thick = gh_scm2double (me->get_grob_property ("thickness")); - Molecule m = Lookup::repeat_slash (wid, slope, thick); + */ + Real thick = robust_scm2double (me->get_property ("thickness"), 1); + Stencil m = Lookup::repeat_slash (wid, slope, thick); m.translate_axis (-m.extent (Y_AXIS).center (), Y_AXIS); return m; } /* todo: use grob props for dot_neg_kern, slash_neg_kern? - */ -Molecule +*/ +Stencil Percent_repeat_item_interface::x_percent (Grob *me, int count, Real dot_neg_kern, Real slash_neg_kern) { - Molecule m ; - Molecule s = brew_slash (me); + Stencil m; + Stencil s = brew_slash (me); - for (int i = count; i--;) - { - m.add_at_edge (X_AXIS, RIGHT, s, -slash_neg_kern); - } - Molecule d1 = Font_interface::get_default_font (me)->find_by_name ("dots-dot"); - Molecule d2 = d1; - d1.translate_axis (0.5, Y_AXIS ); + for (int i = count; i--;) + m.add_at_edge (X_AXIS, RIGHT, s, -slash_neg_kern, 0); + Stencil d1 = Font_interface::get_default_font (me)->find_by_name ("dots.dot"); + Stencil d2 = d1; + d1.translate_axis (0.5, Y_AXIS); d2.translate_axis (-0.5, Y_AXIS); - - m.add_at_edge (X_AXIS, LEFT, d1, -dot_neg_kern); - m.add_at_edge (X_AXIS, RIGHT, d2, -dot_neg_kern); + + m.add_at_edge (X_AXIS, LEFT, d1, -dot_neg_kern, 0); + m.add_at_edge (X_AXIS, RIGHT, d2, -dot_neg_kern, 0); return m; } -MAKE_SCHEME_CALLBACK(Percent_repeat_item_interface,double_percent,1); +MAKE_SCHEME_CALLBACK (Percent_repeat_item_interface, double_percent, 1); SCM Percent_repeat_item_interface::double_percent (SCM grob) { Grob *me = unsmob_grob (grob); - Molecule m = x_percent (me, 2, 0.75, 1.6); + Stencil m = x_percent (me, 2, 0.75, 1.6); m.translate_axis (- m.extent (X_AXIS).center (), X_AXIS); return m.smobbed_copy (); } -MAKE_SCHEME_CALLBACK(Percent_repeat_item_interface,beat_slash,1); +MAKE_SCHEME_CALLBACK (Percent_repeat_item_interface, beat_slash, 1); SCM Percent_repeat_item_interface::beat_slash (SCM grob) { Grob *me = unsmob_grob (grob); - Molecule m = brew_slash (me); + Stencil m = brew_slash (me); return m.smobbed_copy (); } -ADD_INTERFACE (Percent_repeat_item_interface,"percent-repeat-interface", - "Repeats that look like percent signs", - "slope thickness"); - - +ADD_INTERFACE (Percent_repeat_item_interface, + "Repeats that look like percent signs", + + "slope " + "thickness ");