diff options
author | Nathan Chou <starrynte@gmail.com> | 2016-07-25 17:45:29 -0700 |
---|---|---|
committer | David Kastrup <dak@gnu.org> | 2016-08-13 19:07:35 +0200 |
commit | 12b68a3172f040e768b7d229aa14fb4838e75742 (patch) | |
tree | 34958b013f03e4b9e95c7b43bd7d411224cf10f2 /lily | |
parent | bd455870308f261a3b87c47a4a0077ea56a4e6fe (diff) |
Issue 4954/1: Change spanner-id to be a key instead of a string
Also changes argument \= to be a key.
Backport-by: David Kastrup <dak@gnu.org>
Diffstat (limited to 'lily')
-rw-r--r-- | lily/include/slur-engraver.hh | 4 | ||||
-rw-r--r-- | lily/slur-engraver.cc | 22 |
2 files changed, 12 insertions, 14 deletions
diff --git a/lily/include/slur-engraver.hh b/lily/include/slur-engraver.hh index 572e7ea023..1885625ed9 100644 --- a/lily/include/slur-engraver.hh +++ b/lily/include/slur-engraver.hh @@ -60,8 +60,8 @@ protected: void stop_translation_timestep (); void process_music (); - bool can_create_slur (const string&, vsize, vsize *, Stream_event *); - void create_slur (const string &spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken); + bool can_create_slur (SCM, vsize, vsize *, Stream_event *); + void create_slur (SCM spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken); bool try_to_end (Event_info evi); virtual void set_melisma (bool); diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 1a06ca6422..80ceb5f431 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -189,14 +189,14 @@ Slur_engraver::finalize () } void -Slur_engraver::create_slur (const string &spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken) +Slur_engraver::create_slur (SCM spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken) { Grob *ccc = left_broken ? unsmob<Grob> (get_property ("currentCommandColumn")) : 0; // efficiency SCM cause = evi.slur_ ? evi.slur_->self_scm () : g_cause->self_scm (); Spanner *slur = make_spanner (grob_symbol (), cause); - slur->set_property ("spanner-id", ly_string2scm (spanner_id)); + slur->set_property ("spanner-id", spanner_id); if (dir) set_grob_direction (slur, dir); if (left_broken) @@ -209,7 +209,7 @@ Slur_engraver::create_slur (const string &spanner_id, Event_info evi, Grob *g_ca { set_grob_direction (slur, DOWN); slur = make_spanner (grob_symbol (), cause); - slur->set_property ("spanner-id", ly_string2scm (spanner_id)); + slur->set_property ("spanner-id", spanner_id); set_grob_direction (slur, UP); if (left_broken) slur->set_bound (LEFT, ccc); @@ -221,7 +221,7 @@ Slur_engraver::create_slur (const string &spanner_id, Event_info evi, Grob *g_ca } bool -Slur_engraver::can_create_slur (const string &id, vsize old_slurs, vsize *event_idx, Stream_event *ev) +Slur_engraver::can_create_slur (SCM id, vsize old_slurs, vsize *event_idx, Stream_event *ev) { for (vsize j = slurs_.size (); j--;) { @@ -229,7 +229,7 @@ Slur_engraver::can_create_slur (const string &id, vsize old_slurs, vsize *event_ Direction updown = to_dir (ev->get_property ("direction")); // Check if we already have a slur with the same spanner-id. - if (id == robust_scm2string (slur->get_property ("spanner-id"), "")) + if (ly_is_equal (id, slur->get_property ("spanner-id"))) { if (j < old_slurs) { @@ -280,13 +280,13 @@ Slur_engraver::can_create_slur (const string &id, vsize old_slurs, vsize *event_ bool Slur_engraver::try_to_end (Event_info evi) { - string id = robust_scm2string (evi.slur_->get_property ("spanner-id"), ""); + SCM id = evi.slur_->get_property ("spanner-id"); // Find the slurs that are ended with this event (by checking the spanner-id) bool ended = false; for (vsize j = slurs_.size (); j--;) { - if (id == robust_scm2string (slurs_[j]->get_property ("spanner-id"), "")) + if (ly_is_equal (id, slurs_[j]->get_property ("spanner-id"))) { ended = true; end_slurs_.push_back (slurs_[j]); @@ -305,16 +305,14 @@ Slur_engraver::process_music () { for (vsize i = 0; i < stop_events_.size (); i++) { - string id = robust_scm2string - (stop_events_[i].slur_->get_property ("spanner-id"), ""); + SCM id = stop_events_[i].slur_->get_property ("spanner-id"); bool ended = try_to_end (stop_events_[i]); if (ended) { // Ignore redundant stop events for this id for (vsize j = stop_events_.size (); --j > i;) { - if (id == robust_scm2string - (stop_events_[j].slur_->get_property ("spanner-id"), "")) + if (ly_is_equal (id, stop_events_[j].slur_->get_property ("spanner-id"))) stop_events_.erase (stop_events_.begin () + j); } } @@ -326,7 +324,7 @@ Slur_engraver::process_music () for (vsize i = start_events_.size (); i--;) { Stream_event *ev = start_events_[i].slur_; - string id = robust_scm2string (ev->get_property ("spanner-id"), ""); + SCM id = ev->get_property ("spanner-id"); Direction updown = to_dir (ev->get_property ("direction")); if (can_create_slur (id, old_slurs, &i, ev)) |