From 01b4b1373e2492e16717b943897d4f6a44552d62 Mon Sep 17 00:00:00 2001
From: hanwen <hanwen>
Date: Tue, 16 Apr 2002 11:58:59 +0000
Subject: [PATCH] juergen, heikki, chris patch.

---
 ChangeLog                         | 16 ++++++++++
 VERSION                           |  2 +-
 input/mozart-hrn-3.ly             | 50 -------------------------------
 input/mozart-hrn3-romanze.ly      |  1 +
 lily/include/my-lily-parser.hh    |  4 ++-
 lily/lexer.ll                     |  4 +++
 lily/parser.yy                    | 16 +++++++++-
 lily/staff-symbol.cc              | 40 +++++++++++++++++--------
 lilypond-indent.el                |  2 +-
 lilypond-mode.el                  |  4 ++-
 ly/engraver-init.ly               |  3 +-
 make/lilypond-vars.make           |  2 +-
 scm/grob-description.scm          |  8 +++++
 scm/grob-property-description.scm |  1 +
 14 files changed, 84 insertions(+), 69 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ca396a11e7..5c3b969439 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2002-04-16  Heikki Junes <hjunes@cc.hut.fi>
+
+	* lilypond-mode.el: "C-c f" does font-lock-fontify-buffer.
+
+2002-04-15  Juergen Reuter  <reuter@ipd.uka.de>
+
+	* scm/grob-description.scm, lily/staff-symbol.cc: added properties
+	to control width of staff symbol in ragged-right mode (by request
+	of Han-Wen)
+
+	* ly/engraver-init.ly, lily/include/my-lily-parser.hh,
+	lily/include/ligature-bracket.hh, lily/lexer.ll, lily/parser.yy,
+	lily/ligature-bracket.cc, lily/ligature-bracket-engraver.cc:
+	added support for ligature brackets (needed when transcribing
+	mensural music)
+
 2002-04-15  Heikki Junes <hjunes@cc.hut.fi>
 
 	* lilypond-font-lock.el: Handle scheme-slurs up to seventh level.
diff --git a/VERSION b/VERSION
index e0fc8089cc..c6813374c0 100644
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=52
-MY_PATCH_LEVEL=hjj3
+MY_PATCH_LEVEL=hjj4
 
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
diff --git a/input/mozart-hrn-3.ly b/input/mozart-hrn-3.ly
index 044c5b6c9a..f55d7d328b 100644
--- a/input/mozart-hrn-3.ly
+++ b/input/mozart-hrn-3.ly
@@ -30,56 +30,6 @@ virtuoso that taught in Geneva.
 %}
 
 
-% #(set! point-and-click line-column-location)
-
-longgrace = \property Voice.Stem \override #'flag-style = #'()
-endlonggrace = \property Voice.Stem \revert #'flag-style
-ritenuto = \textscript #'(italic  "rit.")
-
-\version "1.5.47"
-
-#(define italic-bf '((font-shape . italic) (font-series . bold)))
-
-%% burp
-%% the very idea of a style sheet, is that it's easy to override
-#(define (set-style! sheet name style)
-  (set-cdr! (assoc 'mark-letter (cdr (assoc 'style-alist sheet))) style))
-
-#(define my-sheet (make-style-sheet 'paper20))
-#(set-style! my-sheet 'mark-letter '((font-family . roman)
-				     (font-series . bold)
-				     (font-shape . upright)
-				     (font-relative-size . 3)))
-  
-cresc = \notes {
-    \commandspanrequest \start "crescendo" 
-    \property Voice.crescendoText = #`(,italic-bf "cresc.")
-    \property Voice.crescendoSpanner = #'dashed-line
-}
-
-\paper{
-    \stylesheet #my-sheet
-    \translator {
-	\ScoreContext
-    	skipBars = ##t
-	midiInstrument = #"french horn"
-	%% try to mimic Breitkopf
-	RehearsalMark \override #'padding = #1
-	MultiMeasureRest \override #'padding = #0.5
-	MultiMeasureRest \override #'number-threshold = #1
-	
-	Beam \override #'thickness = #0.6
-	Beam \override #'beam-space = #0.8
-	Slur \override #'beautiful = #0.3
-    }
-    \translator {
-	\StaffContext
-	MinimumVerticalExtent = #'(-4.5 . 4.5)
-    }
-    indent = 10. \mm
-    linewidth = 189. \mm
-}
-
 \include "mozart-hrn3-allegro.ly"
 \include "mozart-hrn3-romanze.ly"
 \include "mozart-hrn3-rondo.ly"
diff --git a/input/mozart-hrn3-romanze.ly b/input/mozart-hrn3-romanze.ly
index c6dccf0f54..43491a17df 100644
--- a/input/mozart-hrn3-romanze.ly
+++ b/input/mozart-hrn3-romanze.ly
@@ -1,5 +1,6 @@
 
 \version "1.3.146"
+\include  "mozart-hrn3-defs.ly"
 
 romanze = \notes \relative c' {
 	\key f \major
diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh
index 47b85c5799..979fd0bfe1 100644
--- a/lily/include/my-lily-parser.hh
+++ b/lily/include/my-lily-parser.hh
@@ -51,7 +51,9 @@ public:
 
   SCM last_beam_start_;
   void beam_check (SCM); 
-  
+
+  SCM last_ligature_start_;
+
   Input here_input () const;
   void push_spot ();
   Input pop_spot ();
diff --git a/lily/lexer.ll b/lily/lexer.ll
index 423e437b20..fef2c28b82 100644
--- a/lily/lexer.ll
+++ b/lily/lexer.ll
@@ -460,6 +460,10 @@ HYPHEN		--
 	return E_OPEN;
     case ')':
 	return E_CLOSE;
+    case '[':
+	return E_LEFTSQUARE;
+    case ']':
+	return E_RIGHTSQUARE;
     case '~':
 	return E_TILDE;
     case '\\':
diff --git a/lily/parser.yy b/lily/parser.yy
index ae165c9c21..cc0c23b87f 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -244,7 +244,8 @@ yylex (YYSTYPE *s,  void * v_l)
 %token REST
 
 /* escaped */
-%token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE E_TILDE
+%token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
+%token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
 %token E_BACKSLASH
 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
 %token FIGURE_SPACE
@@ -1238,6 +1239,19 @@ shorthand_command_req:
 		b->set_mus_property ("span-type", ly_str02scm ("beam"));
 		$$ = b;
 	}
+	| E_LEFTSQUARE {
+		Span_req *b = new Span_req;
+		b->set_span_dir (START);
+		b->set_mus_property ("span-type", ly_str02scm ("ligature-bracket"));
+		$$ = b;
+		THIS->last_ligature_start_ = b->self_scm ();
+	}
+	| E_RIGHTSQUARE {
+		Span_req *b = new Span_req;
+		b->set_span_dir (STOP);
+		b->set_mus_property ("span-type", ly_str02scm ("ligature-bracket"));
+		$$ = b;
+	}
 	| BREATHE {
 		$$ = new Breathing_sign_req;
 	}
diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc
index 75bb907c14..5f5d916118 100644
--- a/lily/staff-symbol.cc
+++ b/lily/staff-symbol.cc
@@ -13,6 +13,7 @@
 #include "debug.hh"
 #include "item.hh"
 #include "staff-symbol.hh"
+#include "staff-symbol-referencer.hh"
 #include "spanner.hh"
 
 
@@ -27,23 +28,38 @@ Staff_symbol::brew_molecule (SCM smob)
   Grob * common
     = sp->get_bound (LEFT)->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
   
-  bool ragged = to_boolean (me->paper_l ()->get_scmvar ("raggedright"));
+  bool paper_raggedright = to_boolean (me->paper_l ()->get_scmvar ("raggedright"));
+  bool grob_raggedright = to_boolean (me->get_grob_property ("ragged-right"));
   Real width;
-  if (ragged)
+
+  SCM width_scm = me->get_grob_property ("width");
+  if (gh_number_p (width_scm)) // user-defined width
     {
-      // *prevent* staff symbol from being ragged right
       width =
-	me->paper_l ()->get_var ("linewidth")
-	- sp->get_bound (LEFT)->relative_coordinate (common, X_AXIS)
-	;
+	gh_scm2double (width_scm) *
+	Staff_symbol_referencer::staff_space (me);
     }
-  else
+  else // determine width automatically
     {
-      width =
-	// right_shift     - left_shift
-	+ sp->get_bound (RIGHT)->relative_coordinate (common , X_AXIS)
-	- sp->get_bound (LEFT)->relative_coordinate (common, X_AXIS)
-	;
+      if (paper_raggedright && !grob_raggedright)
+	{
+	  // *prevent* staff symbol from being ragged right; instead, use
+	  // paper variable "linewidth"
+	  width = me->paper_l ()->get_var ("linewidth");
+	}
+      else // determine width from my own bounds
+	{
+	  width = sp->get_bound (RIGHT)->relative_coordinate (common , X_AXIS);
+	}
+    }
+
+  // respect indentation, if any
+  width -= sp->get_bound (LEFT)->relative_coordinate (common, X_AXIS);
+
+  if (width < 0)
+    {
+      warning (_f ("staff symbol: indentation yields beyond end of line"));
+      width = 0;
     }
 
   Real t = me->paper_l ()->get_var ("linethickness");
diff --git a/lilypond-indent.el b/lilypond-indent.el
index 06cfd50e3a..4e11faae60 100644
--- a/lilypond-indent.el
+++ b/lilypond-indent.el
@@ -255,7 +255,7 @@ Argument LIM limit."
 ;; are handled by the syntax table
 
 (defconst LilyPond-parens-regexp-alist
-  `( ( ?>  .  ("[^\\]<" . "[^ \\n\\t_^-]\\s-*>\\|[_^-]\\s-*[-^]\\s-*>"))
+  `( ( ?>  .  ("\\([^\\]\\|^\\)<" . "[^ \\n\\t_^-]\\s-*>\\|[_^-]\\s-*[-^]\\s-*>"))
      ;; a b c->, a b c^> and a b c_> are not close-angle-brackets, they're accents
      ;; but a b c^-> and a b c^^> are close brackets with tenuto/marcato before them
      ;; also \> and \< are hairpins
diff --git a/lilypond-mode.el b/lilypond-mode.el
index 1e93d4cbcd..54efc565dc 100644
--- a/lilypond-mode.el
+++ b/lilypond-mode.el
@@ -509,6 +509,7 @@ command."
   (define-key LilyPond-mode-map "\C-c\C-v" 'LilyPond-command-view)
   (define-key LilyPond-mode-map "\C-c\C-p" 'LilyPond-command-viewps)
   (define-key LilyPond-mode-map "\C-c\C-m" 'LilyPond-command-next-midi)
+  (define-key LilyPond-mode-map "\C-cf" 'font-lock-fontify-buffer)
   (define-key LilyPond-mode-map "\C-cn" 'LilyPond-insert-tag-notes)
   (define-key LilyPond-mode-map "\C-cs" 'LilyPond-insert-tag-score)
   (define-key LilyPond-mode-map "\C-c:" 'LilyPond-un-comment-region)
@@ -604,7 +605,8 @@ command."
 	  '(("Miscellaneous"
 	     ["Uncomment Region" LilyPond-un-comment-region t]
 	     ["Comment Region" comment-region t]
-	     ))
+	     ["Refontify buffer" font-lock-fontify-buffer t]
+ 	     ))
 	  ))
 
 (defconst LilyPond-imenu-generic-re "^\\([a-zA-Z_][a-zA-Z0-9_]*\\) *="
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index 08bc3fd780..60c6bd9725 100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -131,7 +131,8 @@ VoiceContext = \translator {
 	\consists "Arpeggio_engraver"
 	\consists "Multi_measure_rest_engraver"
 	\consists "Text_spanner_engraver"
-	
+
+	\consists "Ligature_bracket_engraver"
 	\consists "Breathing_sign_engraver"
  	% \consists "Rest_engraver"
 	\consists "Stem_engraver"
diff --git a/make/lilypond-vars.make b/make/lilypond-vars.make
index b7ddebfa75..d4af803425 100644
--- a/make/lilypond-vars.make
+++ b/make/lilypond-vars.make
@@ -37,7 +37,7 @@ ABC2LY = $(script-dir)/abc2ly.py
 CONVERT_LY = $(script-dir)/convert-ly.py
 LILYPOND = $(depth)/$(builddir)/lily/$(outconfbase)/lilypond
 LILYPOND_BOOK = $(script-dir)/lilypond-book.py
-LILYPOND_BOOK_INCLUDES = -I $(pwd) -I $(outdir) -I$(input-dir) -I $(input-dir)/tricks/ -I $(input-dir)/regression/ -I $(input-dir)/test/ -I $(input-dir)/tutorial/ -I $(topdir)/mf/out
+LILYPOND_BOOK_INCLUDES = -I $(pwd) -I $(outdir) -I$(input-dir) -I $(input-dir)/tricks/ -I $(input-dir)/regression/ -I $(input-dir)/test/ -I $(input-dir)/tutorial/ -I $(topdir)/mf/out -I $(topdir)/mf/$(outdir)/
 LY2DVI = $(script-dir)/ly2dvi.py
 LYS_TO_TELY = $(buildscript-dir)/lys-to-tely.py
 PS_TO_GIFS = $(buildscript-dir)/ps-to-gifs.sh
diff --git a/scm/grob-description.scm b/scm/grob-description.scm
index 2e848c7cdc..7bcdb1182f 100644
--- a/scm/grob-description.scm
+++ b/scm/grob-description.scm
@@ -358,6 +358,13 @@
 	(meta . ((interfaces . (key-signature-interface  font-interface  break-aligned-interface))))
 	))
 
+    (LigatureBracket
+     . (
+	(width . 0.75)
+	(height . 0.5)
+	(molecule-callback . ,Ligature_bracket::brew_molecule)
+	(meta . ((interfaces . (ligature-bracket-interface))))
+	))
 
     (LyricHyphen
      . (
@@ -702,6 +709,7 @@
      . (
 	(molecule-callback . ,Staff_symbol::brew_molecule)
 	(line-count . 5)
+	(ragged-right . #f)
 	(layer . 0)
 	(meta . ((interfaces . (staff-symbol-interface))))
 	))
diff --git a/scm/grob-property-description.scm b/scm/grob-property-description.scm
index b44ba232d5..98ef948989 100644
--- a/scm/grob-property-description.scm
+++ b/scm/grob-property-description.scm
@@ -271,6 +271,7 @@ as a real penalty.")
 
 (grob-property-description 'pitches list? "list of musical-pitch.")
 (grob-property-description 'positions pair? "cons of staff positions (LEFT . RIGHT")
+(grob-property-description 'ragged-right boolean? "In ragged alignment mode (i.e. if paper variable @code{raggedright} is set), rag staff symbols only if this staff symbol grob property is also set.")
 (grob-property-description 'raise number? "height for text to be raised (a negative value lowers the text.")
 (grob-property-description 'right-padding number? "space right of accs.")
 (grob-property-description 'right-trim-amount number? "shortening of the lyric extender on the right.")
-- 
2.39.5