X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpercent-repeat-engraver.cc;h=398fbe9aa0f19f7652792b8d6ff392b40cfca75a;hb=d770aef543262c29157842e46ac775bced34aa90;hp=fc3d2a727a119aa95c39190dfe5c4fb323d439b9;hpb=ade2bb7da653fbd9d670590afd67376fe69c59dd;p=lilypond.git diff --git a/lily/percent-repeat-engraver.cc b/lily/percent-repeat-engraver.cc index fc3d2a727a..398fbe9aa0 100644 --- a/lily/percent-repeat-engraver.cc +++ b/lily/percent-repeat-engraver.cc @@ -1,9 +1,20 @@ /* - new-chord-tremolo-engraver.cc -- implement Chord_tremolo_engraver + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2000--2010 Han-Wen Nienhuys , Erik Sandberg - (c) 2000--2007 Han-Wen Nienhuys , Erik Sandberg + 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. + + 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 . */ @@ -30,6 +41,7 @@ class Percent_repeat_engraver : public Engraver { void typeset_perc (); + bool check_count_visibility (SCM count); public: TRANSLATOR_DECLARATIONS (Percent_repeat_engraver); @@ -120,7 +132,7 @@ Percent_repeat_engraver::listen_percent (Stream_event *ev) /* don't warn about percent repeats: slash repeats are not exactly 1 or 2 measures long. - */ + */ return; } percent_event_ = ev; @@ -147,7 +159,8 @@ Percent_repeat_engraver::process_music () percent_->set_bound (LEFT, col); SCM count = percent_event_->get_property ("repeat-count"); - if (count != SCM_EOL && to_boolean (get_property ("countPercentRepeats"))) + if (count != SCM_EOL && to_boolean (get_property ("countPercentRepeats")) + && check_count_visibility (count)) { percent_counter_ = make_spanner ("PercentRepeatCounter", percent_event_->self_scm ()); @@ -167,8 +180,8 @@ Percent_repeat_engraver::process_music () Item *double_percent = make_item ("DoublePercentRepeat", percent_event_->self_scm ()); SCM count = percent_event_->get_property ("repeat-count"); - if (count != SCM_EOL - && to_boolean (get_property ("countPercentRepeats"))) + if (count != SCM_EOL && to_boolean (get_property ("countPercentRepeats")) + && check_count_visibility (count)) { Item *double_percent_counter = make_item ("DoublePercentRepeatCounter", percent_event_->self_scm ()); @@ -219,6 +232,14 @@ Percent_repeat_engraver::typeset_perc () } } +bool +Percent_repeat_engraver::check_count_visibility (SCM count) +{ + SCM proc = get_property ("repeatCountVisibility"); + return (ly_is_procedure (proc) && to_boolean (scm_call_2 (proc, + count, + context ()->self_scm ()))); +} void @@ -239,7 +260,8 @@ ADD_TRANSLATOR (Percent_repeat_engraver, /* read */ "countPercentRepeats " "currentCommandColumn " - "measureLength ", + "measureLength " + "repeatCountVisibility ", /* write */ "forbidBreak "