]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/percent-repeat-engraver.cc
Update translation instructions in the Contribuotrs' Guide
[lilypond.git] / lily / percent-repeat-engraver.cc
index fc3d2a727a119aa95c39190dfe5c4fb323d439b9..e7ac2a9ece2e9ea4776ddd5bb5e0439d8ede5238 100644 (file)
@@ -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--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>, Erik Sandberg <mandolaerik@gmail.com>
 
-  (c) 2000--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>, Erik Sandberg <mandolaerik@gmail.com>
+  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 <http://www.gnu.org/licenses/>.
 */
 
 
@@ -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 "