From 4b40ecf0af9b4ff3fcf4287ae685ac1a9cc89523 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Fri, 8 Dec 2000 14:26:00 +0100
Subject: [PATCH] patch::: 1.3.115.jcn2

1.3.115.jcn2
============

* Bugfix: lilypond-book.py: only include exisisting .texidoc files.

* Lilypond: don't write empty header field file if header field does
not exist (ie, empty .texidoc files).

* Turn on info generation.

* Fixes to dynamic placement and crescendo spanners.  Incomprehensible
``width-correct'' hack remains.

---
Generated by janneke@gnu.org,
From = lilypond-1.3.115.jcn1, To = lilypond-1.3.115.jcn2

usage

    cd lilypond-source-dir; patch -E -p1 < lilypond-1.3.115.jcn2.diff

Patches do not contain automatically generated files
or (urg) empty directories,
i.e., you should rerun autoconf, configure
---
 CHANGES                                   | 20 +++++++-
 Documentation/GNUmakefile                 |  4 ++
 Documentation/regression-test.tely        |  2 +
 Documentation/user/GNUmakefile            |  2 +-
 Documentation/user/refman.itely           |  1 +
 VERSION                                   |  2 +-
 lily/dynamic-engraver.cc                  | 37 ++++++++-------
 lily/{crescendo.cc => hairpin.cc}         | 40 ++++++++++------
 lily/include/{crescendo.hh => hairpin.hh} |  8 ++--
 lily/paper-outputter.cc                   |  9 ++--
 lily/text-spanner.cc                      | 56 ++++++++++++++---------
 scm/element-descriptions.scm              | 10 ++--
 scm/translator-description.scm            |  2 +-
 scripts/lilypond-book.py                  | 15 +++---
 14 files changed, 134 insertions(+), 74 deletions(-)
 rename lily/{crescendo.cc => hairpin.cc} (80%)
 rename lily/include/{crescendo.hh => hairpin.hh} (74%)

diff --git a/CHANGES b/CHANGES
index 274109bda4..f88149221f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,22 @@
---- ../lilypond-1.3.115/CHANGES	Mon Dec  4 17:42:18 2000
+--- ../lilypond-1.3.115.jcn1/CHANGES	Thu Dec  7 22:22:26 2000
+++ b/CHANGES	Fri Dec  8 14:26:00 2000
+@@ -1,3 +1,16 @@
+1.3.115.jcn2
+============
+
+* Bugfix: lilypond-book.py: only include exisisting .texidoc files.
+
+* Lilypond: don't write empty header field file if header field does
+not exist (ie, empty .texidoc files).
+
+* Turn on info generation.
+
+* Fixes to dynamic placement and crescendo spanners.  Incomprehensible
+``width-correct'' hack remains.
+
+ 1.3.115.jcn1
+ ============
+ --- ../lilypond-1.3.115/CHANGES	Mon Dec  4 17:42:18 2000
 ++ b/CHANGES	Thu Dec  7 22:22:26 2000
 @@ -1,3 +1,9 @@
 1.3.115.jcn1
diff --git a/Documentation/GNUmakefile b/Documentation/GNUmakefile
index 1b3462f693..3a21d70c30 100644
--- a/Documentation/GNUmakefile
+++ b/Documentation/GNUmakefile
@@ -12,6 +12,10 @@ include $(depth)/make/stepmake.make
 
 default: local-doc
 
+test-reg:
+	rm -f out-www/regression-test.html out-www/regression-test.texi 
+	$(MAKE) out=www out-www/regression-test.html
+
 local-WWW: copy-for-me txt-to-html $(outdir)/regression-test.ps.gz $(outdir)/regression-test.html footify
 
 copy-for-me:
diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely
index b1b43938ac..98d6a1b34d 100644
--- a/Documentation/regression-test.tely
+++ b/Documentation/regression-test.tely
@@ -87,6 +87,8 @@ and documenting bugfixes.
 
 @lilypondfile{auto-beam-bar.ly}
 
+@lilypondfile{beam-rest.ly}
+
 @lilypondfile{slur-nice.ly}
 @lilypondfile{slur-symmetry.ly}
 @lilypondfile{slur-symmetry-1.ly}
diff --git a/Documentation/user/GNUmakefile b/Documentation/user/GNUmakefile
index 906ea48fb5..e1b1d32f0d 100644
--- a/Documentation/user/GNUmakefile
+++ b/Documentation/user/GNUmakefile
@@ -18,7 +18,7 @@ PS_FILES = $(DVI_FILES:.dvi=.ps)  $(OUTDOC_FILES:.doc=.ps) $(OUTTEX_FILES:.tex=.
 
 PS_GZ_FILES= $(addsuffix .gz, $(PS_FILES))
 
-# INFO_FILES = $(addprefix $(outdir)/, lilypond.info lilypond-internals.info)
+INFO_FILES = $(addprefix $(outdir)/, lilypond.info lilypond-internals.info)
 
 STEPMAKE_TEMPLATES=tex texinfo documentation
 LOCALSTEPMAKE_TEMPLATES=lilypond ly
diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely
index 92b5299069..42a19282cf 100644
--- a/Documentation/user/refman.itely
+++ b/Documentation/user/refman.itely
@@ -40,6 +40,7 @@
 * Sound output::                   Sound output
 * midilist::                       midilist
 * Grobs::                          Graphical objects
+* Molecule::                       Molecule
 * Pre-defined Identifiers::        Pre-defined Identifiers
 @c May be fragile.  Better make single link to generated doco?
 * Interpretation contexts:(lilypond-internals)LilyPond interpretation contexts.
diff --git a/VERSION b/VERSION
index e47a31ef02..7b2c184b5b 100644
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=115
-MY_PATCH_LEVEL=jcn1
+MY_PATCH_LEVEL=jcn2
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc
index 15b6561b1b..98e7d17c5f 100644
--- a/lily/dynamic-engraver.cc
+++ b/lily/dynamic-engraver.cc
@@ -7,7 +7,7 @@
 */
 #include "debug.hh"
 #include "dimensions.hh"
-#include "crescendo.hh"
+#include "hairpin.hh"
 #include "musical-request.hh"
 #include "paper-column.hh"
 #include "note-column.hh"
@@ -163,16 +163,7 @@ Dynamic_engraver::create_grobs ()
 	and a line-spanner will always be created, as \< \! are already
 	two requests.
 
-	Maybe always creating a line-spanner for a (de)crescendo (see
-	below) is not a good idea:
-
-	    a\< b\p \!c
-
-	the \p will be centred on the line-spanner, and thus clash
-	with the hairpin.  When axis-group code is in place, the \p
-	should move below the hairpin, which is probably better?
-
-	Urg, but line-spanner must always have at least same duration
+	Note: line-spanner must always have at least same duration
 	as (de)crecsendo, b.o. line-breaking.
 	*/
 
@@ -187,6 +178,10 @@ Dynamic_engraver::create_grobs ()
       script_p_ = new Item (get_property ("DynamicText"));
       script_p_->set_grob_property ("text",
 				   script_req_l_->get_mus_property ("text"));
+      
+      Side_position::set_direction (script_p_, LEFT);
+      Side_position::set_axis (script_p_, X_AXIS);
+      
       if (Direction d = script_req_l_->get_direction ())
 	Directional_element_interface::set (line_spanner_, d);
 
@@ -205,9 +200,10 @@ Dynamic_engraver::create_grobs ()
       else
 	{
 	  assert (!finished_cresc_p_);
-	  Grob* cc = unsmob_grob (get_property ("currentMusicalColumn"));
-	  
-	  cresc_p_->set_bound (RIGHT, cc);
+
+	  cresc_p_->set_bound (RIGHT, script_p_
+			   ? script_p_
+			   : unsmob_grob (get_property ("currentMusicalColumn")));
 
 	  finished_cresc_p_ = cresc_p_;
 	  cresc_p_ = 0;
@@ -240,7 +236,7 @@ Dynamic_engraver::create_grobs ()
 	  SCM s = get_property ((start_type + "Spanner").ch_C());
 	  if (!gh_symbol_p (s) || s == ly_symbol2scm ("hairpin"))
 	    {
-	      cresc_p_  = new Spanner (get_property ("Crescendo"));
+	      cresc_p_  = new Spanner (get_property ("Hairpin"));
 	      cresc_p_->set_grob_property ("grow-direction",
 					  gh_int2scm ((start_type == "crescendo")
 						      ? BIGGER : SMALLER));
@@ -255,6 +251,11 @@ Dynamic_engraver::create_grobs ()
 	    {
 	      cresc_p_  = new Spanner (get_property ("TextSpanner"));
 	      cresc_p_->set_grob_property ("type", s);
+	      
+	      // urg.  Can't set this into Text_spanner, because we
+	      // only want this for (de)crescendi spanners.
+	      cresc_p_->set_grob_property ("padding", gh_double2scm (1));
+	      
 	      daddy_trans_l_->set_property (start_type
 					    + "Spanner", SCM_UNDEFINED);
 	      s = get_property ((start_type + "Text").ch_C());
@@ -266,10 +267,11 @@ Dynamic_engraver::create_grobs ()
 						SCM_UNDEFINED);
 		}
 	    }
+
 	  cresc_p_->set_bound (LEFT, script_p_
 			       ? script_p_
 			       : unsmob_grob (get_property ("currentMusicalColumn")));
-	  
+
 	  Axis_group_interface::add_element (line_spanner_, cresc_p_);
 	  announce_grob (cresc_p_, accepted_spanreqs_drul_[START]);
 	}
@@ -308,10 +310,11 @@ Dynamic_engraver::typeset_all ()
 {  
   if (finished_cresc_p_)
     {
+#if 1
       finished_cresc_p_->set_bound (RIGHT, script_p_
 			   ? script_p_
 			   : unsmob_grob (get_property ("currentMusicalColumn")));
-	        
+#endif	        
       typeset_grob (finished_cresc_p_);
       finished_cresc_p_ =0;
     }
diff --git a/lily/crescendo.cc b/lily/hairpin.cc
similarity index 80%
rename from lily/crescendo.cc
rename to lily/hairpin.cc
index 897f6861d6..cf81fd6ba4 100644
--- a/lily/crescendo.cc
+++ b/lily/hairpin.cc
@@ -1,5 +1,5 @@
 /*
-  crescendo.cc -- implement Hairpin
+  hairpin.cc -- implement Hairpin
 
   source file of the GNU LilyPond music typesetter
 
@@ -7,7 +7,7 @@
 */
 
 #include "molecule.hh"
-#include "crescendo.hh"
+#include "hairpin.hh"
 #include "spanner.hh"
 #include "font-interface.hh"
 #include "dimensions.hh"
@@ -21,12 +21,10 @@ SCM
 Hairpin::brew_molecule (SCM smob) 
 {
   Grob *me= unsmob_grob (smob);
-  Spanner *span = dynamic_cast<Spanner*>(me);
+  Spanner *spanner = dynamic_cast<Spanner*>(me);
 
   Real line = me->paper_l ()->get_var ("stafflinethickness");  
   
-  Real broken_left =  span->get_broken_left_end_align ();
-
   SCM s = me->get_grob_property("grow-direction");
   if (!isdir_b (s))
     {
@@ -35,23 +33,20 @@ Hairpin::brew_molecule (SCM smob)
     }
   
   Direction grow_dir = to_dir (s);
-  Real padding = gh_scm2double (me->get_grob_property ("padding"));
-  Real width = span->spanner_length ();
-  width -= span->get_broken_left_end_align ();
 
-  if (width < 0)
-    {
-      warning (_ ((grow_dir < 0) ? "decrescendo too small"
-		  : "crescendo too small"));
-      width = 0;
-    }
+
+  /* Ugh, must be same as Text_spanner::brew_molecule.  */  
+  Real padding = gh_scm2double (me->get_grob_property ("padding"));
+  Real broken_left =  spanner->get_broken_left_end_align ();
+  Real width = spanner->spanner_length ();
+  width -= broken_left;
 
   Drul_array<bool> broken;
   Drul_array<Real> extra_off;
   Direction d = LEFT;
   do
     {
-      Item *b = span->get_bound (d);
+      Item *b = spanner->get_bound (d);
       broken[d] = b->break_status_dir () != CENTER;
 
       if (!broken [d])
@@ -66,7 +61,22 @@ Hairpin::brew_molecule (SCM smob)
 	}
     }
   while (flip (&d) != LEFT);
+
+  // FIXME: ecs tells us
+  width += gh_scm2double (me->get_grob_property ("width-correct"));
+  /* /Ugh */
+
+
+
+
   
+  if (width < 0)
+    {
+      warning (_ ((grow_dir < 0) ? "decrescendo too small"
+		  : "crescendo too small"));
+      width = 0;
+    }
+
   bool continued = broken[Direction (-grow_dir)];
   Real height = gh_scm2double (me->get_grob_property ("height"));
   Real thick = line * gh_scm2double (me->get_grob_property ("thickness"));
diff --git a/lily/include/crescendo.hh b/lily/include/hairpin.hh
similarity index 74%
rename from lily/include/crescendo.hh
rename to lily/include/hairpin.hh
index 37f36f6c28..30578b643a 100644
--- a/lily/include/crescendo.hh
+++ b/lily/include/hairpin.hh
@@ -1,5 +1,5 @@
 /*
-  crescendo.hh -- declare Hairpin
+  hairpin.hh -- declare Hairpin
 
   source file of the GNU LilyPond music typesetter
 
@@ -7,8 +7,8 @@
 */
 
 
-#ifndef CRESCENDO_HH
-#define CRESCENDO_HH
+#ifndef HAIRPIN_HH
+#define HAIRPIN_HH
 
 #include "lily-guile.hh"
 /**
@@ -21,4 +21,4 @@ public:
   static bool has_interface (Grob*);
 };
 
-#endif // CRESCENDO_HH
+#endif // HAIRPIN_HH
diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc
index 781215c200..0bf6c9db98 100644
--- a/lily/paper-outputter.cc
+++ b/lily/paper-outputter.cc
@@ -273,12 +273,15 @@ Paper_outputter::output_score_header_fields (Paper_def *paper)
       for (int i = 0; i < global_score_header_fields.size (); i++)
 	{
 	  String key = global_score_header_fields[i];
-	  //	  SCM val = gh_assoc (ly_str02scm (key.ch_C ()), fields);
 	  SCM val = gh_assoc (ly_symbol2scm (key.ch_C ()), fields);
 	  String s;
+	  /* Only write header field to file if it exists */
 	  if (gh_pair_p (val))
-	    s = ly_scm2string (gh_cdr (val));
-	  output_score_header_field (base, key, s);
+	    {
+	      s = ly_scm2string (gh_cdr (val));
+	      /* Always write header field file, even if string is empty ... */
+	      output_score_header_field (base, key, s);
+	    }
 	}
     }
 }
diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc
index c83551e556..5280703bad 100644
--- a/lily/text-spanner.cc
+++ b/lily/text-spanner.cc
@@ -24,7 +24,6 @@
     - contination types (vert. star, vert. end)  |-> eat volta-spanner
     - more styles
     - more texts/positions
-    - style: hairpin ?
  */
 
 MAKE_SCHEME_CALLBACK (Text_spanner, brew_molecule, 1);
@@ -35,22 +34,42 @@ Text_spanner::brew_molecule (SCM smob)
   Grob *me= unsmob_grob (smob);
   Spanner *spanner = dynamic_cast<Spanner*> (me);
 
-  Real staff_space = Staff_symbol_referencer::staff_space (me);
-  
+
+
+  /* Ugh, must be same as Hairpin::brew_molecule.  */
+  Real padding = gh_scm2double (me->get_grob_property ("padding"));
+  Real broken_left =  spanner->get_broken_left_end_align ();
+  Real width = spanner->spanner_length ();
+  width -= broken_left;
+
   Drul_array<bool> broken;
+  Drul_array<Real> extra_off;
   Direction d = LEFT;
   do
     {
-      Paper_column* s = dynamic_cast<Paper_column*>(spanner->get_bound (d)); // UGH
-      if (s && s->musical_b ())
-	broken[d] = false;
-      else
-	broken[d] = true;
+      Item *b = spanner->get_bound (d);
+      broken[d] = b->break_status_dir () != CENTER;
+
+      if (!broken [d])
+	{
+
+	  Interval e = b->extent (b, X_AXIS);
+	  Real r = 0.0;
+	  if (!e.empty_b ())
+	    r = e[-d] + padding;
+	  width += d * r;
+	  extra_off[d] = r;
+	}
     }
   while (flip (&d) != LEFT);
-  
-  SCM properties = Font_interface::font_alist_chain (me);
 
+  // FIXME: ecs tells us
+  width += gh_scm2double (me->get_grob_property ("width-correct"));
+  /* /Ugh */
+
+
+  SCM properties = Font_interface::font_alist_chain (me);
+  
   SCM edge_text = me->get_grob_property ("edge-text");
   Drul_array<Molecule> edge;
   if (gh_pair_p (edge_text))
@@ -65,6 +84,8 @@ Text_spanner::brew_molecule (SCM smob)
 	}
       while (flip (&d) != LEFT);
     }
+  width -= edge[LEFT].extent (X_AXIS).length ()
+    + edge[RIGHT].extent (X_AXIS).length ();
 
   Drul_array<Real> shorten;
   shorten[LEFT] = 0;
@@ -73,19 +94,12 @@ Text_spanner::brew_molecule (SCM smob)
   SCM s = me->get_grob_property ("shorten");
   if (gh_pair_p (s))
     {
-      shorten[LEFT] = gh_scm2double (gh_car (s)) * staff_space;
-      shorten[RIGHT] = gh_scm2double (gh_cdr (s)) * staff_space;
+      shorten[LEFT] = gh_scm2double (gh_car (s));
+      shorten[RIGHT] = gh_scm2double (gh_cdr (s));
     }
 
-  Real broken_left =  spanner->get_broken_left_end_align ();
-  Real width = spanner->spanner_length ();
-  Grob *bnd = spanner->get_bound (RIGHT);
-  width += bnd->extent (bnd, X_AXIS).length ();
-  width -= broken_left;
   width -= shorten[LEFT] + shorten[RIGHT];
-  width -= edge[LEFT].extent (X_AXIS).length ()
-    + edge[RIGHT].extent (X_AXIS).length ();
-
+  
   if (width < 0)
     {
       warning (_ ("Text_spanner too small"));
@@ -138,7 +152,7 @@ Text_spanner::brew_molecule (SCM smob)
     m.add_at_edge (X_AXIS, RIGHT, edge_line[RIGHT], 0);
   if (!edge[RIGHT].empty_b ())
     m.add_at_edge (X_AXIS, RIGHT, edge[RIGHT], 0);
-  m.translate_axis (broken_left, X_AXIS);
+  m.translate_axis (broken_left + extra_off[LEFT], X_AXIS);
 
   return m.smobbed_copy ();
 }
diff --git a/scm/element-descriptions.scm b/scm/element-descriptions.scm
index af2869cbff..ade660a1eb 100644
--- a/scm/element-descriptions.scm
+++ b/scm/element-descriptions.scm
@@ -123,16 +123,17 @@
                (meta . ,(element-description "Custos" custos-interface staff-symbol-interface break-aligned-interface) )
        ))
 	
-	(Crescendo . (
+	(Hairpin . (
 		(molecule-callback . ,Hairpin::brew_molecule)
 		(thickness . 1.0)
-		(padding . 1.0)
+		(padding . 1.0) 
+		(width-correct . -1) ;ughr
 		(height . 0.6666)
 		(dash-thickness . 1.2)
 		(dash-length . 4.0)
 		(self-alignment-Y . 0)
 		(Y-offset-callbacks . (,Side_position::aligned_on_self))
-		(meta . ,(element-description "Crescendo" hairpin-interface))
+		(meta . ,(element-description "Hairpin" hairpin-interface))
 	))
 
 	(DotColumn . (
@@ -552,6 +553,9 @@
 		(molecule-callback . ,Text_spanner::brew_molecule)
                 (font-shape . italic)
 		(type . "line")
+		;;; urg
+		;;;(padding . 1.0)
+		(width-correct . -1) ;ughr
 		(direction . 1)
 		(meta . ,(element-description "TextSpanner" text-spanner-interface  font-interface))		
 	))
diff --git a/scm/translator-description.scm b/scm/translator-description.scm
index 879b4ff090..ffb0e485e1 100644
--- a/scm/translator-description.scm
+++ b/scm/translator-description.scm
@@ -285,7 +285,7 @@ If omitted, then dots appear on top of the notes.
      "Dynamic_engraver"
      ""
      '(DynamicLineSpanner
-       DynamicText Crescendo
+       DynamicText Hairpin
        TextSpanner)
      '(
       )))
diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py
index 763aa79fa1..4d6b0e58f8 100644
--- a/scripts/lilypond-book.py
+++ b/scripts/lilypond-book.py
@@ -348,7 +348,6 @@ output_dict= {
 # should also support fragment in
 		  
 		  'output-all': r"""
-@include %(fn)s.texidoc
 @tex
 \catcode`\@=12
 \input lilyponddefs
@@ -776,7 +775,7 @@ def schedule_lilypond_block (chunk):
 		needed_filetypes.append('png')
 	if 'eps' in opts and not ('eps' in needed_filetypes):
 		needed_filetypes.append('eps')
-	outname = os.path.join(g_outdir, basename)
+	pathbase = os.path.join (g_outdir, basename)
 	def f(base, ext1, ext2):
 		a = os.path.isfile(base + ext2)
 		if (os.path.isfile(base + ext1) and
@@ -786,11 +785,11 @@ def schedule_lilypond_block (chunk):
 				not os.path.isfile(base + ext2):
 			return 1
 	todo = []
-	if 'tex' in needed_filetypes and f(outname, '.ly', '.tex'):
+	if 'tex' in needed_filetypes and f(pathbase, '.ly', '.tex'):
 		todo.append('tex')
-	if 'eps' in needed_filetypes and f(outname, '.tex', '.eps'):
+	if 'eps' in needed_filetypes and f(pathbase, '.tex', '.eps'):
 		todo.append('eps')
-	if 'png' in needed_filetypes and f(outname, '.eps', '.png'):
+	if 'png' in needed_filetypes and f(pathbase, '.eps', '.png'):
 		todo.append('png')
 	newbody = ''
 	if 'verbatim' in opts:
@@ -806,8 +805,10 @@ def schedule_lilypond_block (chunk):
 		else:
 			s = 'output-tex'
 	else: # format == 'texi'
-		s = 'output-all'
-	newbody = newbody + get_output(s) % {'fn': basename }
+		if os.path.isfile (pathbase + '.texidoc'):
+			newbody = newbody + '\n@include %s.texidoc' % basename
+ 		s = 'output-all'
+	newbody = newbody + get_output (s) % {'fn': basename }
 	return ('lilypond', newbody, opts, todo, basename)
 
 def process_lilypond_blocks(outname, chunks):#ugh rename
-- 
2.39.5