X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpercent-repeat-item.cc;h=7b09d44601769e52db5efa96deeda6605e3cd83c;hb=292ac10aee40154613568fc4805e02124793e91d;hp=25d71ef3fad568036c3fdc8743dfb7f4193f3516;hpb=eb72c0f066957c3e71d336db0f72814e34d3964d;p=lilypond.git diff --git a/lily/percent-repeat-item.cc b/lily/percent-repeat-item.cc index 25d71ef3fa..7b09d44601 100644 --- a/lily/percent-repeat-item.cc +++ b/lily/percent-repeat-item.cc @@ -1,14 +1,24 @@ /* - percent-repeat-item.cc -- implement Percent_repeat_item_interface + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2001--2010 Han-Wen Nienhuys - (c) 2001--2005 Han-Wen Nienhuys -*/ + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. -#include "percent-repeat-item.hh" + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . +*/ +#include "percent-repeat-item.hh" +#include "item.hh" #include "lookup.hh" #include "font-interface.hh" @@ -27,27 +37,28 @@ Percent_repeat_item_interface::brew_slash (Grob *me) return m; } -/* - todo: use grob props for dot_neg_kern, slash_neg_kern? -*/ Stencil -Percent_repeat_item_interface::x_percent (Grob *me, int count, - Real dot_neg_kern, - Real slash_neg_kern) +Percent_repeat_item_interface::x_percent (Grob *me, int count) { Stencil m; Stencil s = brew_slash (me); + Real dot_neg_kern = + robust_scm2double (me->get_property ("dot-negative-kern"), 0.75); + Real slash_neg_kern = + robust_scm2double (me->get_property ("slash-negative-kern"), 1.6); + for (int i = count; i--;) - m.add_at_edge (X_AXIS, RIGHT, s, -slash_neg_kern, 0); + m.add_at_edge (X_AXIS, RIGHT, s, -slash_neg_kern); 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, 0); - m.add_at_edge (X_AXIS, RIGHT, d2, -dot_neg_kern, 0); + m.add_at_edge (X_AXIS, LEFT, d1, -dot_neg_kern); + m.add_at_edge (X_AXIS, RIGHT, d2, -dot_neg_kern); + m.translate_axis (- m.extent (X_AXIS).center (), X_AXIS); return m; } @@ -56,8 +67,7 @@ SCM Percent_repeat_item_interface::double_percent (SCM grob) { Grob *me = unsmob_grob (grob); - Stencil m = x_percent (me, 2, 0.75, 1.6); - m.translate_axis (- m.extent (X_AXIS).center (), X_AXIS); + Stencil m = x_percent (me, 2); return m.smobbed_copy (); } @@ -71,7 +81,13 @@ Percent_repeat_item_interface::beat_slash (SCM grob) 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.", + + /* properties */ + "dot-negative-kern " + "slash-negative-kern " + "slope " + "thickness " + );