]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/output-lib.scm (string-finger::calc-text): new function
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 11 Oct 2006 22:17:26 +0000 (22:17 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 11 Oct 2006 22:17:26 +0000 (22:17 +0000)
* lily/new-fingering-engraver.cc (add_fingering): refactor; make
generic for fingering & string number. Use for string-finger.

* scm/define-music-types.scm (music-descriptions): add StringFingerEvent

* lily/fingering-engraver.cc (listen_string_finger): new function

* scm/define-grobs.scm (all-grob-descriptions): add StringFinger

* scm/define-context-properties.scm
(all-user-translation-properties): add stringFingerOrientations

13 files changed:
ChangeLog
lily/engraver.cc
lily/fingering-engraver.cc
lily/new-fingering-engraver.cc
ly/engraver-init.ly
ly/music-functions-init.ly
ly/script-init.ly
mf/GNUmakefile
scm/define-context-properties.scm
scm/define-event-classes.scm
scm/define-grobs.scm
scm/define-music-types.scm
scm/output-lib.scm

index 9202d2fa20c34fa7b782ac6313ffc3db2103331b..92448e58118f4b9b367d63b067ec17954460e27f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2006-10-12  Han-Wen Nienhuys  <hanwen@lilypond.org>
+
+       * scm/output-lib.scm (string-finger::calc-text): new function
+
+       * lily/new-fingering-engraver.cc (add_fingering): refactor; make
+       generic for fingering & string number. Use for string-finger. 
+
+       * scm/define-music-types.scm (music-descriptions): add StringFingerEvent
+
+       * lily/fingering-engraver.cc (listen_string_finger): new function
+
+       * scm/define-grobs.scm (all-grob-descriptions): add StringFinger
+
+       * scm/define-context-properties.scm
+       (all-user-translation-properties): add stringFingerOrientations
+
 2006-10-11  Jürgen Reuter  <reuter@ipd.uka.de>
 
        * mf/parmesan-dots.mf (new), mf/parmesan-generic.mf,
index 2453188fff76d573dc0584b024b039def46dacd8..ef13351c2ef4c0f19d80796d6ffc60310e27c064 100644 (file)
@@ -139,7 +139,9 @@ Engraver::internal_make_grob (SCM symbol, SCM cause, char const *name, char cons
 }
 
 Item *
-Engraver::internal_make_item (SCM x, SCM cause, char const *name, char const *file, int line, char const *fun)
+Engraver::internal_make_item (SCM x, SCM cause,
+                             char const *name,
+                             char const *file, int line, char const *fun)
 {
   Item *it = dynamic_cast<Item *> (internal_make_grob (x, cause, name, file, line, fun));
   assert (it);
@@ -147,7 +149,8 @@ Engraver::internal_make_item (SCM x, SCM cause, char const *name, char const *fi
 }
 
 Paper_column *
-Engraver::internal_make_column (SCM x, char const *name, char const *file, int line, char const *fun)
+Engraver::internal_make_column (SCM x, char const *name,
+                               char const *file, int line, char const *fun)
 {
   return dynamic_cast<Paper_column *> (internal_make_grob (x, SCM_EOL, name, file, line, fun));
 }
index f469df8139484e59fa2619ee8ac38bcf5ab8e4f2..c6a6a9b0fb9318da6279a871ba498ad30a1214a7 100644 (file)
@@ -27,6 +27,7 @@ protected:
   void stop_translation_timestep ();
   void process_music ();
   DECLARE_TRANSLATOR_LISTENER (fingering);
+  DECLARE_TRANSLATOR_LISTENER (string_finger);
   DECLARE_ACKNOWLEDGER (rhythmic_head);
   DECLARE_ACKNOWLEDGER (stem);
 
@@ -41,6 +42,18 @@ Fingering_engraver::listen_fingering (Stream_event *ev)
   events_.push_back (ev);
 }
 
+IMPLEMENT_TRANSLATOR_LISTENER (Fingering_engraver, string_finger);
+void
+Fingering_engraver::listen_string_finger (Stream_event *ev)
+{
+  /*
+    FIXME: should do something.
+    
+    This function is mainly here to shut up a warning
+   */
+  (void)ev;
+}
+
 void
 Fingering_engraver::acknowledge_stem (Grob_info inf)
 {
@@ -130,9 +143,13 @@ Fingering_engraver::Fingering_engraver ()
 
 ADD_ACKNOWLEDGER (Fingering_engraver, rhythmic_head);
 ADD_ACKNOWLEDGER (Fingering_engraver, stem);
+
 ADD_TRANSLATOR (Fingering_engraver,
-               /* doc */ "Create fingering-scripts",
-               /* create */ "Fingering",
-               /* accept */ "fingering-event",
+               /* doc */
+               "Create fingering-scripts",
+               /* create */
+               "Fingering",
+               /* accept */
+               "fingering-event",
                /* read */ "",
                /* write */ "");
index 03eecc480d8c128201ad9ecc91939b01dde19c72..ed69676ec62aba4bc9a5c849518fc2ed587934e2 100644 (file)
@@ -46,6 +46,7 @@ operator< (Finger_tuple const &a, Finger_tuple const &b)
 class New_fingering_engraver : public Engraver
 {
   vector<Finger_tuple> fingerings_;
+  vector<Finger_tuple> string_fingerings_;
   vector<Finger_tuple> articulations_;
   vector<Finger_tuple> string_numbers_;
 
@@ -59,7 +60,9 @@ protected:
   void stop_translation_timestep ();
   DECLARE_ACKNOWLEDGER (rhythmic_head);
   DECLARE_ACKNOWLEDGER (stem);
-  void add_fingering (Grob *, Stream_event *, Stream_event *);
+  void add_fingering (Grob *, SCM,
+                     vector<Finger_tuple> *,
+                     Stream_event *, Stream_event *);
   void add_script (Grob *, Stream_event *, Stream_event *);
   void add_string (Grob *, Stream_event *, Stream_event *);
   void position_scripts (SCM orientations, vector<Finger_tuple> *);
@@ -82,13 +85,22 @@ New_fingering_engraver::acknowledge_rhythmic_head (Grob_info inf)
        continue;
 
       if (ev->in_event_class ("fingering-event"))
-       add_fingering (inf.grob (), ev, note_ev);
+       add_fingering (inf.grob (),
+                      ly_symbol2scm ("Fingering"),
+                      &fingerings_,
+                      ev, note_ev);
       else if (ev->in_event_class ("text-script-event"))
        ev->origin ()->warning (_ ("can't add text scripts to individual note heads"));
       else if (ev->in_event_class ("script-event"))
        add_script (inf.grob (), ev, note_ev);
       else if (ev->in_event_class ("string-number-event"))
-       add_string (inf.grob (), ev, note_ev);
+       add_fingering (inf.grob (),
+                      ly_symbol2scm ("StringNumber"), &string_numbers_,
+                      ev, note_ev);
+      else if (ev->in_event_class ("string-finger-event"))
+       add_fingering (inf.grob (),
+                      ly_symbol2scm ("StringFinger"), &string_fingerings_,
+                      ev, note_ev);
       else if (ev->in_event_class ("harmonic-event"))
        {
          inf.grob ()->set_property ("style", ly_symbol2scm ("harmonic"));
@@ -117,57 +129,35 @@ New_fingering_engraver::add_script (Grob *head,
   Finger_tuple ft;
 
   Grob *g = make_item ("Script", event->self_scm ());
-  make_script_from_event (g, context (), event->get_property ("articulation-type"), 0);
-  if (g)
-    {
-      ft.script_ = g;
-      ft.script_->set_parent (head, X_AXIS);
-
-      articulations_.push_back (ft);
-    }
+  make_script_from_event (g, context (),
+                         event->get_property ("articulation-type"), 0);
+  ft.script_ = g;
+  ft.script_->set_parent (head, X_AXIS);
+  
+  articulations_.push_back (ft);
 }
 
 void
 New_fingering_engraver::add_fingering (Grob *head,
+                                      SCM grob_sym,
+                                      vector<Finger_tuple> *tuple_vector,
                                       Stream_event *event,
                                       Stream_event *hevent)
 {
   Finger_tuple ft;
 
-  ft.script_ = make_item ("Fingering", event->self_scm ());
+  ft.script_ = internal_make_item (grob_sym, event->self_scm (),
+                                  ly_symbol2string (grob_sym).c_str (),
+                                  __FILE__, __LINE__, __FUNCTION__
+                                  );
 
   Side_position_interface::add_support (ft.script_, head);
 
-  /*
-    TODO:
-
-    Should add support for thumb.  It's a little involved, since
-    the thumb lives in a different font. Maybe it should be moved?
-  */
-
   ft.finger_event_ = event;
   ft.note_event_ = hevent;
   ft.head_ = head;
 
-  fingerings_.push_back (ft);
-}
-
-void
-New_fingering_engraver::add_string (Grob *head,
-                                   Stream_event *event,
-                                   Stream_event *hevent)
-{
-  Finger_tuple ft;
-
-  ft.script_ = make_item ("StringNumber", event->self_scm ());
-
-  Side_position_interface::add_support (ft.script_, head);
-
-  ft.finger_event_ = event;
-  ft.note_event_ = hevent;
-  ft.head_ = head;
-
-  string_numbers_.push_back (ft);
+  tuple_vector->push_back (ft);
 }
 
 void
@@ -314,6 +304,13 @@ New_fingering_engraver::position_all ()
       string_numbers_.clear ();
     }
 
+  if (string_fingerings_.size ())
+    {
+      position_scripts (get_property ("stringFingerOrientations"),
+                       &string_fingerings_);
+      string_fingerings_.clear ();
+    }
+  
   for (vsize i = articulations_.size (); i--;)
     {
       Grob *script = articulations_[i].script_;
@@ -344,11 +341,17 @@ ADD_TRANSLATOR (New_fingering_engraver,
                "This engraver is ill-named, since it "
                "also takes care of articulations and harmonic note heads",
                /* create */
-               "Fingering",
+               "Fingering "
+               "StringNumber "
+               "StringFinger "
+               "Script "
+               ,
+               
                /* accept */ "",
                /* read */
                
                "fingeringOrientations "
+               "stringFingerOrientations "
                "stringNumberOrientations "
                ,
                
index 03e4d54f5a9d56aea0bc4dc466ea3c7c3a78ef6b..991cc7f2aa1bcd0554979391f6f7a7a4142cf213 100644 (file)
@@ -531,6 +531,8 @@ AncientRemoveEmptyStaffContext = \context {
   harmonicAccidentals = ##t 
   fingeringOrientations = #'(up down)
   stringNumberOrientations = #'(up down)
+  stringFingerOrientations = #'(up down)
+  
   markFormatter = #format-mark-letters
   rehearsalMark = #1
   subdivideBeams = ##f
index b910223f68ea87604c3b25edf85fc50814f9f71e..5f425fc717a7d0d0dfddc6fc997ba221e0d087ff 100644 (file)
@@ -2,6 +2,11 @@
 
 \version "2.9.12"
 
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% this file is alphabetically sorted.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 %% need SRFI-1 filter 
 
 #(use-modules (srfi srfi-1))  
@@ -532,6 +537,14 @@ includePageLayoutFile =
                                                tweak-filename))))))
    (make-music 'SequentialMusic 'void #t))
 
+
+rightHandFinger =
+#(define-music-function (parser location finger) (string?)
+   "Define a StringFingerEvent"
+   (make-music 'StringFingerEvent
+              'origin location
+              'text finger))
+
 scoreTweak =
 #(define-music-function (parser location name) (string?)
    "Include the score tweak, if exists."
@@ -612,3 +625,4 @@ withMusicProperty =
    (set! (ly:music-property music sym) val)
    music)
 
+
index 68d4de9d9a827f1daf2f80791fcec41b0210eb59..00e49f1814a83ae56a437d447a5613a982e13bf7 100644 (file)
@@ -52,3 +52,4 @@ downprall = #(make-articulation "downprall")
 segno = #(make-articulation "segno")
 coda = #(make-articulation "coda")
 varcoda = #(make-articulation "varcoda")
+
index 6a8fa110f5d8e2639fac58f36c32415715ffd6dd..46ea6446306eb109cb0f4b949ed16fe2e41712ad 100644 (file)
@@ -5,7 +5,6 @@ LOCALSTEPMAKE_TEMPLATES=lilypond
 
 include $(depth)/make/stepmake.make
 
-AF_FILES = $(call src-wildcard,*.af)
 
 # hangs on feta23
 MFTRACE_FLAGS=  --simplify
@@ -106,7 +105,7 @@ ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES)
 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
 
 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
-INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
+INSTALLATION_FILES=$(MF_FILES)
 
 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6
 
index 85e4ece2bad3659527b75f3700da859ff786da36..81fab196552b28067c8bc4635efb1b4b7f0eb86d 100644 (file)
@@ -377,6 +377,7 @@ up the interpretation phase. This speeds up debugging large scores.")
 squashing for @internalsref{Pitch_squash_engraver}.")
 
      (stringNumberOrientations ,list? "See @code{fingeringOrientations}")
+     (stringFingerOrientations ,list? "See @code{fingeringOrientations}")
      (stringOneTopmost ,boolean? "Whether the 1st string is printed on the
 top line of the tablature.")
 
index 808fcf716c00c7d21d355a97ea664040655adcbc..7a9bb402a1685b1ae2c24a10590d8696d0706bd4 100644 (file)
@@ -16,7 +16,7 @@
                                OneTimeStep Finish))
     (music-event . (arpeggio-event breathing-event extender-event span-event
       rhythmic-event dynamic-event break-event percent-event
-      key-change-event string-number-event tie-event part-combine-event
+      key-change-event string-number-event string-finger-event tie-event part-combine-event
       beam-forbid-event script-event
       tremolo-event bend-after-event fingering-event glissando-event
       harmonic-event hyphen-event laissez-vibrer-event mark-event
index 7e633bc1261c60b49dcadaf76e124fcfc5efe078..5dc860bd275f6ba5586b0eaf2ed9b315a256b5b6 100644 (file)
                                self-alignment-interface
                                item-interface))))))
     
+    (StringFinger
+     . (
+       (stencil . ,ly:text-interface::print)
+       (text . ,string-finger::calc-text)
+       (padding . 0.5)
+       (staff-padding . 0.5)
+       (self-alignment-X . 0)
+       (self-alignment-Y . 0)
+       (script-priority . 100)
+       (font-shape . italic)
+       (font-size . -5)                ; don't overlap when next to heads.
+       (meta . ((class . Item)
+                (interfaces . (string-number-interface
+                               font-interface
+                               text-script-interface
+                               text-interface
+                               side-position-interface
+                               self-alignment-interface
+                               item-interface))))))
+    
+
     (SustainPedal
      . (
        (no-spacing-rods . #t)
index fb0cc99d258917ff97fe15f00a8821a40721d249..61f53d40a7a92555c9fdb932fcacf2b8e6ce9ecb 100644 (file)
@@ -623,6 +623,15 @@ Syntax: @code{\\@var{number}}.")
        (types . (general-music string-number-event event))
        )) 
 
+    (StringFingerEvent
+     . (
+       (description .  "Specify with which finger to pluck a string. 
+
+Syntax: @code{\\rightHandFinger @var{text}}.")
+
+       (types . (general-music string-finger-event event))
+       )) 
+    
     (TextScriptEvent
      . (
        (description .  "")
index 9a5bc4d8d890408247f2a7c52c5891fd13a7e3c9..7c7f64811c580468ba95c4311500c85df5aeed44 100644 (file)
@@ -424,6 +424,12 @@ centered, X==1 is at the right, X == -1 is at the left."
     (number->string digit 10)
   ))
 
+(define-public (string-finger::calc-text grob)
+  (let*
+      ((text (ly:event-property (event-cause  grob) 'text)))
+
+    text))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; dynamics
 (define-public (hairpin::calc-grow-direction grob)