+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,
}
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);
}
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));
}
void stop_translation_timestep ();
void process_music ();
DECLARE_TRANSLATOR_LISTENER (fingering);
+ DECLARE_TRANSLATOR_LISTENER (string_finger);
DECLARE_ACKNOWLEDGER (rhythmic_head);
DECLARE_ACKNOWLEDGER (stem);
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)
{
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 */ "");
class New_fingering_engraver : public Engraver
{
vector<Finger_tuple> fingerings_;
+ vector<Finger_tuple> string_fingerings_;
vector<Finger_tuple> articulations_;
vector<Finger_tuple> string_numbers_;
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> *);
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"));
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
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_;
"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 "
,
harmonicAccidentals = ##t
fingeringOrientations = #'(up down)
stringNumberOrientations = #'(up down)
+ stringFingerOrientations = #'(up down)
+
markFormatter = #format-mark-letters
rehearsalMark = #1
subdivideBeams = ##f
\version "2.9.12"
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% this file is alphabetically sorted.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
%% need SRFI-1 filter
#(use-modules (srfi srfi-1))
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."
(set! (ly:music-property music sym) val)
music)
+
segno = #(make-articulation "segno")
coda = #(make-articulation "coda")
varcoda = #(make-articulation "varcoda")
+
include $(depth)/make/stepmake.make
-AF_FILES = $(call src-wildcard,*.af)
# hangs on feta23
MFTRACE_FLAGS= --simplify
#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
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.")
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
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)
(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 . "")
(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)