From a2b1b52453dfc35fd3faf16835e18675bd2b2b7f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 12 Apr 2004 14:52:21 +0000 Subject: [PATCH] * lily/include/context.hh (class Context): make members protected. (children_contexts): new accessor function. * lily/include/context.hh (class Context): make daddy_context_ private. * lily/lyric-engraver.cc (get_voice_to_lyrics): recursively go higher for finding Voice. (backportme) * lily/include/context.hh (class Context): remove find_context_below() as a method. --- lily/auto-change-iterator.cc | 2 +- lily/change-iterator.cc | 6 +++--- lily/context-scheme.cc | 2 +- lily/context.cc | 6 +++--- lily/include/context.hh | 3 ++- lily/lyric-engraver.cc | 2 +- lily/staff-performer.cc | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index 01a46fd93c..7b73db03ca 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -56,7 +56,7 @@ Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym, current = current->get_parent_context (); } - if (current && current->id_string_ == to_id) + if (current && current->id_string () == to_id) { String msg; msg += _ ("Can't switch translators, I'm there already"); diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc index 771be9b983..d36567b594 100644 --- a/lily/change-iterator.cc +++ b/lily/change-iterator.cc @@ -27,7 +27,7 @@ Change_iterator::error (String reason) */ String warn2= "Change_iterator::process (): " + get_outlet ()->context_name () + " = `" - + get_outlet ()->id_string_ + "': "; + + get_outlet ()->id_string () + "': "; warning (warn2); get_music ()->origin ()->warning (warn1); } @@ -55,7 +55,7 @@ Change_iterator::process (Moment m) current = current->get_parent_context (); } - if (current && current->id_string_ == to_id) + if (current && current->id_string () == to_id) { String msg; msg += _ ("Can't switch translators, I'm there already"); @@ -88,7 +88,7 @@ Change_iterator::process (Moment m) We could change the current translator's id, but that would make errors hard to catch - last->translator_id_string_ = get_change ()->change_to_id_string_; + last->translator_id_string () = get_change ()->change_to_id_string (); */ error (_ ("I'm one myself")); } diff --git a/lily/context-scheme.cc b/lily/context-scheme.cc index 6457482b20..f6a03404fd 100644 --- a/lily/context-scheme.cc +++ b/lily/context-scheme.cc @@ -19,7 +19,7 @@ LY_DEFINE (ly_context_id, "ly:context-id", Context *tr = unsmob_context (context); SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); - return scm_makfrom0str (tr->id_string_. to_str0 ()); + return scm_makfrom0str (tr->id_string (). to_str0 ()); } LY_DEFINE (ly_context_name, "ly:context-name", diff --git a/lily/context.cc b/lily/context.cc index fedc490c83..6f0d2fcffb 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -116,7 +116,7 @@ Context::find_create_context (SCM n, String id, if (n == ly_symbol2scm ("Bottom")) { Context* tg = get_default_interpreter (); - tg->id_string_ = id; + tg->id_string () = id; return tg; } @@ -140,7 +140,7 @@ Context::find_create_context (SCM n, String id, if (i == path.size () -1) { - new_group->id_string_ = id; + new_group->id_string () = id; } current->add_context (new_group); @@ -303,7 +303,7 @@ find_context_below (Context * where, { if (where->is_alias (type)) { - if (id == "" || where->id_string_ == id) + if (id == "" || where->id_string () == id) return where; } diff --git a/lily/include/context.hh b/lily/include/context.hh index f32e3e8378..6413d8b49f 100644 --- a/lily/include/context.hh +++ b/lily/include/context.hh @@ -35,9 +35,11 @@ protected: SCM accepts_list_; SCM aliases_; SCM implementation_; + String id_string_; friend class Context_def; public: + String id_string () const { return id_string_; } SCM children_contexts () const { return context_list_; } SCM default_child_context_name () const; @@ -78,7 +80,6 @@ public: Link_array path_to_acceptable_context (SCM alias, Music_output_def*) const; - String id_string_; }; /* diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index e32fca941a..b81897a819 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -74,7 +74,7 @@ get_voice_to_lyrics (Context *lyrics) return c; SCM voice_name = lyrics->get_property ("associatedVoice"); - String nm = lyrics->id_string_; + String nm = lyrics->id_string (); if (ly_c_string_p (voice_name)) nm = ly_scm2string (voice_name); diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 4264011e39..7cb78b5380 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -65,7 +65,7 @@ Staff_performer::initialize () audio_staff_ = new Audio_staff; announce_element (Audio_element_info (audio_staff_, 0)); - name_ = new Audio_text (Audio_text::TRACK_NAME, context ()->id_string_); + name_ = new Audio_text (Audio_text::TRACK_NAME, context ()->id_string ()); announce_element (Audio_element_info (name_, 0)); tempo_ = new Audio_tempo (get_tempo ()); -- 2.39.5