]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scripts/convert-ly.py (FatalConversionError.conv): fingering
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 30 Aug 2003 20:14:54 +0000 (20:14 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 30 Aug 2003 20:14:54 +0000 (20:14 +0000)
convert rule.

* Documentation/user/refman.itely (Fingering instructions): adjust manual.

* lily/new-fingering-engraver.cc (position_scripts): don't crash
for borderline cases (e.g. 1 fingering.)
(position_scripts): revise interface, use fingerOrientations to
set fingering positions.

ChangeLog
Documentation/user/refman.itely
input/regression/finger-chords.ly
lily/new-fingering-engraver.cc
ly/engraver-init.ly
scm/define-translator-properties.scm
scripts/convert-ly.py

index c8b0bcf7397915e49733e4fd1123d860dabcd7e4..26df67e1a8c77cfe3345f5278c8bf6b4bae37713 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,14 @@
 2003-08-30  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * scripts/convert-ly.py (FatalConversionError.conv): fingering
+       convert rule.
+
+       * Documentation/user/refman.itely (Fingering instructions): adjust manual.
+
        * lily/new-fingering-engraver.cc (position_scripts): don't crash
        for borderline cases (e.g. 1 fingering.)
+       (position_scripts): revise interface, use fingerOrientations to
+       set fingering positions.
 
        * scm/document-translation.scm (context-doc): add aliases to
        automated documentation.
index 1a1d93fe9bb9172d8d2b3586f4f5917285b81a66..8423e5c64e5fda2609f284429a6c91fb7e091afc 100644 (file)
@@ -2114,14 +2114,14 @@ of the chord by adding them after the pitches:
         << c-1  e-2 g-3 b-5 >> 4
 @end lilypond
 
-Setting @code{fingerHorizontalDirection} will put the fingerings next
-to the note head:
+Setting @code{fingeringOrientations} will put  fingerings next
+to note heads:
 
 @lilypond[verbatim,singleline,fragment,relative=1]
-       \property Voice.fingerHorizontalDirection = #LEFT
-       << c-1  es-2 g-4 bes-5 >> 4
-       \property Voice.fingerHorizontalDirection = #RIGHT
-       << c-1  es-2 g-4 bes-5 >> 4
+       \property Voice.fingeringOrientations = #'(left down)
+       <<c-1 es-2 g-4 bes-5 >> 4
+       \property Voice.fingeringOrientations = #'(up right down)
+       <<c-1 es-2 g-4 bes-5 >> 4
 @end lilypond
         
 @seealso
index de50af379fa6476f8f7df091037c0610f6d7fb5a..c803ff9fdb4c739927aefb4bb2b0231dc5ab2f1a 100644 (file)
@@ -12,21 +12,24 @@ easier to process."
 
 \score {
     \notes \relative c'{
-       <<g_0>> 4
-       <<g_1>> 4
-       <<c''^5>> 4
-       <<e,^6>> 4
-       <<f,_1>> 4
-       << c-1 e-3>> 4
-       <<c-1 e-3 g-5 >> 4
-       <<c-1 e-2 g-3 b-5 >> 4
-       <<c-1 e-2 g-3 b-5 d-6 f-7 a-8 c-9 >> 4  
-       \property Voice.fingerHorizontalDirection = #LEFT
-       << c-1  es-3 g-5 >> 4
-       \property Voice.fingerHorizontalDirection = #RIGHT
-       << c-1  e-2 g-3 b-5 >> 4\arpeggio
-       \property Voice.fingerHorizontalDirection = #LEFT
-       << c_1  e-2 g-3 b^5 >> 4
+       <<c-1 e-2 g-3 b-4 d-5 f-6 a-7 c-8 >> 4  
+
+       \property Voice.fingeringOrientations = #'(left)
+       << c-1  e-2 g-3 b-5 >> 4
+
+       \property Voice.fingeringOrientations = #'(down left)
+       << c-1  e-2 g-3 b-5 >> 4
+
+       \property Voice.fingeringOrientations = #'(down left up)
+       << c-1  e-2 g-3 b-5 >> 4
+
+       \property Voice.fingeringOrientations = #'(up left)
+       << c-1  e-2 g-3 b-5 >> 4
+
+       \property Voice.fingeringOrientations = #'(right)
+       << c-1  e-2 g-3 b-5 >> 4
+
+
        
 }
 
index 94b0614dde937def9f225aabf4a6696784c2469c..b58b6c962f8c14c3fe74d46dbff637bfd6280176 100644 (file)
@@ -169,8 +169,6 @@ New_fingering_engraver::position_scripts ()
       fingerings_[i].position_ = gh_scm2int (fingerings_[i].head_ -> get_grob_property( "staff-position"));
     }
 
-  SCM fhd = get_property ("fingerHorizontalDirection");
-
   for (int i = fingerings_.size(); i--;)
     for (int j = heads_.size() ; j--;)
       Side_position_interface::add_support (fingerings_[i].script_, heads_[j]);
@@ -181,23 +179,25 @@ New_fingering_engraver::position_scripts ()
       SCM d = fingerings_[i].finger_event_->get_mus_property ("direction");
       if (to_dir (d))
        {
-         if (to_dir (d) == UP)
-           {
-             up.push (fingerings_[i]);
-           }
-         else
-           down.push (fingerings_[i]);
+         ((to_dir (d) == UP) ? up : down ).push (fingerings_[i]);
          fingerings_.del (i);
        }
     }
   
   fingerings_.sort (&Finger_tuple::compare);
-  
-  if (ly_dir_p (fhd))
+  SCM orientations = get_property ("fingeringOrientations");
+
+  bool up_p = scm_memq (ly_symbol2scm ("up"), orientations) != SCM_BOOL_F;
+  bool down_p = scm_memq (ly_symbol2scm ("down"), orientations) != SCM_BOOL_F;
+  bool left_p = scm_memq (ly_symbol2scm ("left"), orientations) != SCM_BOOL_F;
+  bool right_p = scm_memq (ly_symbol2scm ("right"), orientations) != SCM_BOOL_F;
+  Direction hordir = (right_p) ? RIGHT : LEFT;
+  if (left_p || right_p)
     {
-      if (!up.size())
+      if (up_p && !up.size () && fingerings_.size ())
        up.push (fingerings_.pop());
-      if (fingerings_.size () && !down.size())
+
+      if (down_p && !down.size () && fingerings_.size())
        {
          down.push (fingerings_[0]);
          fingerings_.del(0);
@@ -205,13 +205,25 @@ New_fingering_engraver::position_scripts ()
 
       horiz.concat (fingerings_);
     }
-  else
+  else if (up_p && down_p)
     {
       int center = fingerings_.size() / 2;
       down.concat (fingerings_.slice (0,center));
       up.concat (fingerings_.slice (center, fingerings_.size()));
     }
-
+  else if (up_p)
+    {
+      up.concat (fingerings_);
+      fingerings_ .clear ();
+    }
+  else
+    {
+      if (!down_p)
+       warning(_ ("Fingerings are also not down?! Putting them down anyway."));
+      down.concat (fingerings_);
+      fingerings_.clear();
+    }
+  
   for (int i = 0; i < horiz.size(); i++)
     {
       Finger_tuple ft = horiz[i];
@@ -222,7 +234,7 @@ New_fingering_engraver::position_scripts ()
       f->add_offset_callback (Self_alignment_interface::aligned_on_self_proc, Y_AXIS);
       f->add_offset_callback (Side_position_interface::aligned_side_proc, X_AXIS);
 
-      f->set_grob_property ("direction", fhd);
+      f->set_grob_property ("direction", gh_int2scm (hordir));
       typeset_grob (f);
     }
 
index a7c1d73b26e955c9bdc1041a3a978efb4871ec06..3081189ee9b18b52c919d5c5634e07e5dd542297 100644 (file)
@@ -468,7 +468,7 @@ ScoreContext = \translator {
        pedalSostenutoStrings = #'("Sost. Ped." "*Sost. Ped." "*") 
        pedalSostenutoStyle = #'mixed
 
-       
+       fingeringOrientations = #'(up down)
        tupletNumberFormatFunction = #denominator-tuplet-formatter
        
        subdivideBeams = ##f
@@ -495,7 +495,7 @@ ScoreContext = \translator {
          custos
        )
        barCheckSynchronize = ##t
-
+       
        %% chord names:
        chordNameFunction = #ignatzek-chord-names
        majorSevenSymbol = #whiteTriangleMarkup
index c027af626870bf71e925a9dc6e9f9dafdce403fc..f343076f0b9ab8fc7c2bcaa5af0f4b640ef6d68e 100644 (file)
@@ -262,9 +262,9 @@ another non-natural.
                                 "Used to set the relative size of all grobs
 in a context. This is done using the @code{Font_size_engraver}.")
 
-(translator-property-description 'fingerHorizontalDirection integer?
-                                "If set, put the middle fingerings to
-the side of the note head. Use LEFT, RIGHT or unset.")
+(translator-property-description
+ 'fingeringOrientations list?
+ "List of symbols, containing left, right, up and/or down. This list determines where fingerings are put wrt. to the chord being fingered.")
 
 (translator-property-description 'forceClef boolean? "Show clef symbol, even if it hasn't changed. Only active for the first clef after the property is set, not for the full staff.")
 
index 7e9c2d78fa6a002ae6a30bc12a2c1b2340e522fc..646f042ece4f73da2ce68d0734d5d78ec6ff433d 100644 (file)
@@ -1449,9 +1449,18 @@ if 1:
                        sys.stderr.write ("context-spec-music takes a symbol for the context now. Update by hand."
                        raise FatalConversionError()
 
+               str = re.sub ('fingerHorizontalDirection *= *#(LEFT|-1)',
+                             "fingeringOrientations = #'(up down left)", str)
+               str = re.sub ('fingerHorizontalDirection *= *#(RIGHT|1)',
+                             "fingeringOrientations = #'(up down right)", str)
+
                return str
        
-       conversions.append (((1,9,3), conv, """\acciaccatura misspelling"""))
+       conversions.append (((1,9,3), conv,
+                            """\acciaccatura misspelling, fingerHorizontalDirection -> fingeringOrientations"""))
+
+
+                       
 
 ################################
 #      END OF CONVERSIONS