summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Puttock <n.puttock@gmail.com>2010-06-30 01:03:54 +0100
committerNeil Puttock <n.puttock@gmail.com>2010-06-30 01:03:54 +0100
commit51a4daa57965b1dc627943393467d65237acd852 (patch)
tree8aeeeaf508f78e181142f5ea9fb299f3cac22fa2
parentd2ad2a1a19ce018d741466a108caf2f87bf147fc (diff)
Ensure scripts inside chords obey manual directions.
* input/regression/chord-scripts.ly: tweak directions for last chord so both scripts are forced down * lily/new-fingering-engraver.cc (add_script): read event property 'direction and copy to Script grob if set * scm/define-grobs.scm (all-grob-descriptions): set 'add-stem-support default for Script
-rw-r--r--input/regression/chord-scripts.ly25
-rw-r--r--lily/new-fingering-engraver.cc24
-rw-r--r--scm/define-grobs.scm1
3 files changed, 24 insertions, 26 deletions
diff --git a/input/regression/chord-scripts.ly b/input/regression/chord-scripts.ly
index 3131997945..1e0f454b20 100644
--- a/input/regression/chord-scripts.ly
+++ b/input/regression/chord-scripts.ly
@@ -1,19 +1,16 @@
-
\version "2.12.0"
-\header {
-
-texidoc = "Scripts can also be attached to chord elements."
+\header {
+ texidoc = "Scripts can also be attached to chord elements.
+They obey manual direction indicators."
}
-\relative c''{
- < c-. > 4
- < c-> > 4
- < c-. e-. g-. b-. >
- < c^^ > 4
- < c_^ > 4
- < c_^ e^^ > 4
- < c^^ e_^ > 4
-
-
+\relative c'' {
+ < c-. >4
+ < c-> >4
+ < c-. e-. g-. b-. >4
+ < c^^ >4
+ < c_^ >4
+ < c_^ e^^ >4
+ < c_^ e_^ >4
}
diff --git a/lily/new-fingering-engraver.cc b/lily/new-fingering-engraver.cc
index 445af8fafe..8a5d74f426 100644
--- a/lily/new-fingering-engraver.cc
+++ b/lily/new-fingering-engraver.cc
@@ -20,19 +20,18 @@
#include "engraver.hh"
#include "international.hh"
+#include "item.hh"
#include "rhythmic-head.hh"
#include "script-interface.hh"
#include "self-alignment-interface.hh"
#include "side-position-interface.hh"
#include "stem.hh"
#include "stream-event.hh"
-#include "item.hh"
#include "warn.hh"
#include "translator.icc"
-
struct Finger_tuple
{
Grob *head_;
@@ -64,7 +63,7 @@ class New_fingering_engraver : public Engraver
vector<Finger_tuple> articulations_;
vector<Finger_tuple> string_numbers_;
- vector<Grob*> heads_;
+ vector<Grob *> heads_;
Grob *stem_;
void position_all ();
@@ -145,7 +144,11 @@ New_fingering_engraver::add_script (Grob *head,
event->get_property ("articulation-type"), 0);
ft.script_ = g;
ft.script_->set_parent (head, X_AXIS);
-
+
+ SCM forced_dir = event->get_property ("direction");
+ if (to_dir (forced_dir))
+ ft.script_->set_property ("direction", forced_dir);
+
articulations_.push_back (ft);
}
@@ -160,8 +163,7 @@ New_fingering_engraver::add_fingering (Grob *head,
ft.script_ = internal_make_item (grob_sym, event->self_scm (),
ly_symbol2string (grob_sym).c_str (),
- __FILE__, __LINE__, __FUNCTION__
- );
+ __FILE__, __LINE__, __FUNCTION__);
Side_position_interface::add_support (ft.script_, head);
@@ -266,7 +268,7 @@ New_fingering_engraver::position_scripts (SCM orientations,
else if (unsmob_grob (ft.head_->get_object ("dot")))
Side_position_interface::add_support (f,
unsmob_grob (ft.head_->get_object ("dot")));
-
+
Self_alignment_interface::set_align_self (f, Y_AXIS);
Self_alignment_interface::set_center_parent (f, Y_AXIS);
Side_position_interface::set_axis (f, X_AXIS);
@@ -290,7 +292,7 @@ New_fingering_engraver::position_scripts (SCM orientations,
Self_alignment_interface::set_align_self (f, X_AXIS);
Self_alignment_interface::set_center_parent (f, X_AXIS);
Side_position_interface::set_axis (f, Y_AXIS);
-
+
f->set_property ("direction", scm_from_int (d));
}
}
@@ -305,7 +307,6 @@ New_fingering_engraver::stop_translation_timestep ()
heads_.clear ();
}
-
void
New_fingering_engraver::position_all ()
{
@@ -329,7 +330,7 @@ New_fingering_engraver::position_all ()
&stroke_fingerings_);
stroke_fingerings_.clear ();
}
-
+
for (vsize i = articulations_.size (); i--;)
{
Grob *script = articulations_[i].script_;
@@ -351,7 +352,6 @@ New_fingering_engraver::New_fingering_engraver ()
stem_ = 0;
}
-
ADD_ACKNOWLEDGER (New_fingering_engraver, rhythmic_head);
ADD_ACKNOWLEDGER (New_fingering_engraver, stem);
@@ -372,7 +372,7 @@ ADD_TRANSLATOR (New_fingering_engraver,
"harmonicDots "
"strokeFingerOrientations "
"stringNumberOrientations ",
-
+
/* write */
""
);
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 3f3bcc6410..174ad039bf 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1565,6 +1565,7 @@
(Script
. (
+ (add-stem-support . #t)
(cross-staff . ,ly:script-interface::calc-cross-staff)
(direction . ,ly:script-interface::calc-direction)
(font-encoding . fetaMusic)