--- /dev/null
+\version "2.11.64"
+\header {
+ texidoc = "
+Percent repeat counters can be shown at regular
+intervals by setting @code{repeatCountVisibility}.
+"
+}
+
+\relative c'' {
+ \set countPercentRepeats = ##t
+ \set repeatCountVisibility = #(every-nth-repeat-count-visible 5)
+ \repeat percent 10 { c1 } \break
+ \set repeatCountVisibility = #(every-nth-repeat-count-visible 2)
+ \repeat percent 6 { c1 d1 }
+}
/*
- new-chord-tremolo-engraver.cc -- implement Chord_tremolo_engraver
+ percent-repeat-engraver.cc -- implement Percent_repeat_engraver
source file of the GNU LilyPond music typesetter
class Percent_repeat_engraver : public Engraver
{
void typeset_perc ();
+ bool check_count_visibility (SCM count);
public:
TRANSLATOR_DECLARATIONS (Percent_repeat_engraver);
/*
don't warn about percent repeats: slash repeats are not
exactly 1 or 2 measures long.
- */
+ */
return;
}
percent_event_ = ev;
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 ());
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 ());
}
}
+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
/* read */
"countPercentRepeats "
"currentCommandColumn "
- "measureLength ",
+ "measureLength "
+ "repeatCountVisibility ",
/* write */
"forbidBreak "
explicitKeySignatureVisibility = #all-visible
implicitTimeSignatureVisibility = #end-of-line-invisible
+ repeatCountVisibility = #all-repeat-counts-visible
+
autoBeamSettings = #default-auto-beam-settings
autoBeaming = ##t
autoBeamCheck = #default-auto-beam-check
(repeatCommands ,list? "This property is a list of commands
of the form @code{(list 'volta @var{x})}, where @var{x} is a string or
@code{#f}. @code{'end-repeat} is also accepted as a command.")
+ (repeatCountVisibility ,procedure? "A procedure taking as
+arguments an integer and context, returning whether the corresponding
+percent repeat number should be printed when @code{countPercentRepeats}
+is set.")
(restNumberThreshold ,number? "If a multimeasure rest has more
measures than this, a number is printed.")
(define-public (first-bar-number-invisible barnum) (> barnum 1))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; percent repeat counters
+
+(define-public ((every-nth-repeat-count-visible n) count context) (= 0 (modulo count n)))
+
+(define-public (all-repeat-counts-visible count context) #t)
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; break visibility