]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/slash-repeat-engraver.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / slash-repeat-engraver.cc
index 37595526c55afe19b13429dcb27d7f91b0ee7106..a6b3faa56c42c76e3a9ad0d24b5fe66ddaa95f81 100644 (file)
@@ -1,28 +1,32 @@
 /*
-  slash-repeat-engraver.cc -- implement Slash_repeat_engraver
+  This file is part of LilyPond, the GNU music typesetter.
 
-  source file of the GNU LilyPond music typesetter
+  Copyright (C) 2000--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>, Erik Sandberg
+  <mandolaerik@gmail.com>
 
-  (c) 2000--2006 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/>.
 */
 
-#include "bar-line.hh"
-#include "global-context.hh"
-#include "international.hh"
 #include "item.hh"
-#include "misc.hh"
-#include "percent-repeat-iterator.hh"
-#include "repeated-music.hh"
-#include "score-engraver.hh"
-#include "spanner.hh"
+#include "engraver.hh"
 #include "stream-event.hh"
-#include "warn.hh"
 
 #include "translator.icc"
 
-/**
-   This acknowledges repeated music with "percent" style.  It typesets
-   a slash sign.
+/*
+  This acknowledges repeated music with "percent" style.  It typesets
+  a slash sign or double percent sign.
 */
 class Slash_repeat_engraver : public Engraver
 {
@@ -31,7 +35,7 @@ public:
 protected:
   Stream_event *slash_;
 protected:
-  DECLARE_TRANSLATOR_LISTENER (percent);
+  DECLARE_TRANSLATOR_LISTENER (repeat_slash);
   void process_music ();
 };
 
@@ -40,18 +44,11 @@ Slash_repeat_engraver::Slash_repeat_engraver ()
   slash_ = 0;
 }
 
-IMPLEMENT_TRANSLATOR_LISTENER (Slash_repeat_engraver, percent);
+IMPLEMENT_TRANSLATOR_LISTENER (Slash_repeat_engraver, repeat_slash);
 void
-Slash_repeat_engraver::listen_percent (Stream_event *ev)
+Slash_repeat_engraver::listen_repeat_slash (Stream_event *ev)
 {
-  /*todo: separate events for percent and slash */
-  Moment meas_length
-    = robust_scm2moment (get_property ("measureLength"), Moment (0));
-  
-  if (get_event_length (ev) < meas_length)
-    ASSIGN_EVENT_ONCE (slash_, ev);
-  else
-    ev->origin ()->warning (_ ("Slash repeat doesn't fit in one measure, junking"));
+  ASSIGN_EVENT_ONCE (slash_, ev);
 }
 
 void
@@ -59,14 +56,26 @@ Slash_repeat_engraver::process_music ()
 {
   if (slash_)
     {
-      make_item ("RepeatSlash", slash_->self_scm ());
+      SCM count = slash_->get_property ("slash-count");
+      if (scm_to_int (count) == 0)
+        make_item ("DoubleRepeatSlash", slash_->self_scm ());
+      else
+        make_item ("RepeatSlash", slash_->self_scm ());
       slash_ = 0;
     }
 }
 
 ADD_TRANSLATOR (Slash_repeat_engraver,
-               /* doc */ "Make beat repeats.",
-               /* create */ "RepeatSlash",
-               /* accept */ "percent-event",
-               /* read */ "measureLength",
-               /* write */ "");
+                /* doc */
+                "Make beat repeats.",
+
+                /* create */
+                "DoubleRepeatSlash "
+                "RepeatSlash ",
+
+                /* read */
+                "",
+
+                /* write */
+                ""
+               );