From a78bd178d765bd810f13de68d21956a481980fad Mon Sep 17 00:00:00 2001
From: hanwen <hanwen>
Date: Fri, 11 Oct 2002 09:36:19 +0000
Subject: [PATCH] use breve rests for measure lengths longer than 4/4. Patch
 courtesy Kim Shrier <kim@tinker.com>.

---
 ChangeLog                           | 12 ++++
 THANKS                              |  3 +-
 VERSION                             |  2 +-
 input/regression/bar-scripts.ly     | 10 +++
 lily/multi-measure-rest-engraver.cc | 17 ++++-
 lily/multi-measure-rest.cc          | 97 ++++++++++++++++++++---------
 lily/parser.yy                      |  4 +-
 scm/grob-description.scm            |  1 +
 scm/grob-property-description.scm   |  1 +
 9 files changed, 111 insertions(+), 36 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0eff07a9d7..ef724a04c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-10-11  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+	* lily/multi-measure-rest.cc: use breve rests for measure lengths
+	longer than 4/4. Patch courtesy Kim Shrier <kim@tinker.com>.
+
+2002-10-10  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* stepmake/stepmake/c++-rules.make: Fixes for bison 1.50.
+
+	* lily/lexer.ll (My_lily_lexer): Avoid silly flex induced gcc warnings.
+
 2002-10-11  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
 	* lily/my-lily-lexer.cc (prepare_for_next_token): use previous
@@ -22,6 +33,7 @@
 
 	* lily/lexer.ll (My_lily_lexer): Avoid silly flex induced gcc warnings.
 
+
 2002-10-07  Jan Nieuwenhuizen  <janneke@gnu.org>
 
 	* input/regression/bar-scripts.ly: Blunt documentation build fix.
diff --git a/THANKS b/THANKS
index d9cb3c915c..505ed74f14 100644
--- a/THANKS
+++ b/THANKS
@@ -5,6 +5,7 @@ Graham Percival
 Rune Zedeler
 Jeremie Lumbroso
 Juergen Reuter
+Kim Shrier
 
 
 BUG HUNTERS
@@ -15,4 +16,4 @@ Jeremie Lumbroso
 Karl-Johan Karlsson 
 Karl Berry
 Werner Lemberg
-
+Thomas Rijniers
diff --git a/VERSION b/VERSION
index 6acfe3a8d0..6a809df4f5 100644
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=7
-PATCH_LEVEL=2
+PATCH_LEVEL=3
 MY_PATCH_LEVEL=
 
 # Use the above to send patches: MY_PATCH_LEVEL is always empty for a
diff --git a/input/regression/bar-scripts.ly b/input/regression/bar-scripts.ly
index f6595cb40d..7d72f24972 100644
--- a/input/regression/bar-scripts.ly
+++ b/input/regression/bar-scripts.ly
@@ -32,14 +32,24 @@ scpaper =  \paper {\translator {\OrchestralScoreContext}}
 % stpaper =  \paper{ \translator {\BarNumberingStaffContext }}
 stpaper =  \paper{ }
 
+
 scscore =  \score { \grstaff \paper {
 \scpaper
 }}
 
+scscore =  \score { \grstaff \paper {
+\scpaper
+}}
 
 stscore =  \score { \onestaff \paper {
  \stpaper
 }}
 
+
 %\score {\stscore}
 \score {\scscore}
+
+
+\score{\notes c''}
+\score {\scscore}
+
diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc
index ae355daed5..97056febf2 100644
--- a/lily/multi-measure-rest-engraver.cc
+++ b/lily/multi-measure-rest-engraver.cc
@@ -158,6 +158,17 @@ Multi_measure_rest_engraver::start_translation_timestep ()
       int cur = gh_scm2int (get_property ("currentBarNumber"));
       lastrest_->set_grob_property ("measure-count",
 				     gh_int2scm (cur - start_measure_));
+      SCM sml = get_property ("measureLength");
+      Rational ml = (unsmob_moment (sml)) ? unsmob_moment (sml)->main_part_ : Rational (1);
+      if (ml < Rational (2))
+	{
+	  lastrest_->set_grob_property ("use-breve-rest", SCM_BOOL_F);
+	}
+      else
+	{
+	  lastrest_->set_grob_property ("use-breve-rest", SCM_BOOL_T);
+	}
+
       mmrest_ = 0;
     }
 }
@@ -174,10 +185,12 @@ Multi_measure_rest_engraver::finalize ()
 
 ENTER_DESCRIPTION(Multi_measure_rest_engraver,
 /* descr */       "Engraves multi-measure rests that are produced with @code{R}.  Reads
-measurePosition and currentBarNumber to determine what number to print over the MultiMeasureRest
+measurePosition and currentBarNumber to determine what number to print over the MultiMeasureRest.
+Reads measureLength to determine if it should use a whole rest or a breve rest to represent 1 measure
+
 ",
 /* creats*/       "MultiMeasureRest",
 /* accepts */     "multi-measure-rest-event",
 /* acks  */      "",
-/* reads */       "currentBarNumber currentCommandColumn measurePosition",
+/* reads */       "currentBarNumber currentCommandColumn measurePosition measureLength",
 /* write */       "");
diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc
index 69d9ec64fe..926dfc6110 100644
--- a/lily/multi-measure-rest.cc
+++ b/lily/multi-measure-rest.cc
@@ -163,19 +163,32 @@ Multi_measure_rest::symbol_molecule (Grob *me, Real space)
   Font_metric *musfont
     = Font_interface::get_font (me,style_chain);
 
+  SCM sml = me->get_grob_property ("use-breve-rest");
+
   if (measures == 1)
     {
-      Molecule s = musfont->find_by_name (Rest::glyph_name (me, 0, ""));
+      if (sml == SCM_BOOL_T)
+	{
+	  Molecule s = musfont->find_by_name (Rest::glyph_name (me, -1, ""));
+
+	  s.translate_axis ((space - s.extent (X_AXIS).length ())/2, X_AXIS);
+      
+	  return s ;
+	}
+      else
+	{
+	  Molecule s = musfont->find_by_name (Rest::glyph_name (me, 0, ""));
 
-      /*
-	ugh.
-       */
-      if (Staff_symbol_referencer::get_position (me) == 0.0)
-	s.translate_axis (staff_space, Y_AXIS);
+	  /*
+	    ugh.
+	   */
+	  if (Staff_symbol_referencer::get_position (me) == 0.0)
+	    s.translate_axis (staff_space, Y_AXIS);
 
-      s.translate_axis ((space - s.extent (X_AXIS).length ())/2, X_AXIS);
+	  s.translate_axis ((space - s.extent (X_AXIS).length ())/2, X_AXIS);
       
-      return s ;
+	  return s ;
+        }
     }
   else
     {
@@ -222,33 +235,57 @@ Multi_measure_rest::church_rest (Grob*me, Font_metric *musfont, int measures,
   int l = measures;
   int count = 0;
   Real symbols_width = 0.0;
+
+  SCM sml = me->get_grob_property ("use-breve-rest");
+
   while (l)
     {
-      int k;
-      if (l >= 4)
-	{
-	  l-=4;
-	  k = -2;
-	}
-      else if (l>= 2)
+      if (sml == SCM_BOOL_T)
 	{
-	  l -= 2;
-	  k = -1;
+	  int k;
+	  if (l >= 2)
+	    {
+	      l-=2;
+	      k = -2;
+	    }
+	  else
+	    {
+	      l -= 1;
+	      k = -1;
+	    }
+
+	  Molecule r (musfont->find_by_name ("rests-" + to_string (k)));
+	  symbols_width += r.extent (X_AXIS).length ();
+	  mols = gh_cons (r.smobbed_copy (), mols);
 	}
-      else
-	{
-	  k = 0;
-	  l --;
-	}
-
-      Molecule r (musfont->find_by_name ("rests-" + to_string (k)));
-      if (k == 0)
+       else
 	{
-	  Real staff_space = Staff_symbol_referencer::staff_space (me);
-	  r.translate_axis (staff_space, Y_AXIS);
+	  int k;
+	  if (l >= 4)
+	    {
+	      l-=4;
+	      k = -2;
+	    }
+	  else if (l>= 2)
+	    {
+	      l -= 2;
+	      k = -1;
+	    }
+	  else
+	    {
+	      k = 0;
+	      l --;
+	    }
+
+	  Molecule r (musfont->find_by_name ("rests-" + to_string (k)));
+	  if (k == 0)
+	    {
+	      Real staff_space = Staff_symbol_referencer::staff_space (me);
+	      r.translate_axis (staff_space, Y_AXIS);
+	    }
+	  symbols_width += r.extent (X_AXIS).length ();
+	  mols = gh_cons (r.smobbed_copy (), mols);
 	}
-      symbols_width += r.extent (X_AXIS).length ();
-      mols = gh_cons (r.smobbed_copy (), mols);
       count ++;
     }
 
@@ -333,4 +370,4 @@ numbers, fields from font-interface may be used.
 
 
 ",
-  "expand-limit measure-count number-threshold padding thickness");
+  "expand-limit measure-count number-threshold padding thickness use-breve-rest");
diff --git a/lily/parser.yy b/lily/parser.yy
index 1d25c9de50..f65f428162 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -1436,10 +1436,10 @@ verbose_event:
 	;
 
 sup_quotes:
-	'\'' {
+	"'" {
 		$$ = 1;
 	}
-	| sup_quotes '\'' {
+	| sup_quotes "'" {
 		$$ ++;
 	}
 	;
diff --git a/scm/grob-description.scm b/scm/grob-description.scm
index d6e3fa8536..3a36728971 100644
--- a/scm/grob-description.scm
+++ b/scm/grob-description.scm
@@ -538,6 +538,7 @@
 	(number-threshold . 1)
 	(padding . 1)
 	(thickness . 6.6)
+	(use-breve-rest . #f)
 	(font-family . number)
 	(padding . 1)
 	(meta . ((interfaces . (multi-measure-rest-interface rest-interface font-interface staff-symbol-referencer-interface spanner-interface))))
diff --git a/scm/grob-property-description.scm b/scm/grob-property-description.scm
index c8608e25c8..a48c1f61f7 100644
--- a/scm/grob-property-description.scm
+++ b/scm/grob-property-description.scm
@@ -599,3 +599,4 @@ functions set spanner positions.")
 
 (grob-property-description 'avoid-note-head boolean? "if set, the stem of a chord does not pass through all note head, but start at the last note head. Used by tablature.")
 (grob-property-description 'up-to-staff boolean? "if set, stems' lengths are set so as stems end out of the staff. Used by tablature.")
+(grob-property-description 'use-breve-rest boolean? "boolean that tells multi-measure-rest to use a breve rest to represent the duration of 1 measure instead of w whole rest.  It defaults to false.  It is set to true when the duration of a measure is a breve or longer.")
-- 
2.39.5