summaryrefslogtreecommitdiff
path: root/lily/stanza-number-engraver.cc
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>2003-12-31 00:44:33 +0000
committerHan-Wen Nienhuys <hanwen@xs4all.nl>2003-12-31 00:44:33 +0000
commit366ac5a9c6dfb5a32111c8dd6ba40e49334402c3 (patch)
treed8f09828965dad3d061f7e3a3bcbb85fd8daed9c /lily/stanza-number-engraver.cc
parentcf47f46e677a1bf9ef1c08c40eb65938117d4953 (diff)
* lily/melisma-engraver.cc (try_music): use melisma_busy()
* lily/lyric-engraver.cc (process_music): remove alignment kludge * lily/lyric-combine-music-iterator.cc (melisma_busy): new function. * lily/stanza-number-engraver.cc (acknowledge_grob): rewrite * scm/define-grobs.scm (all-grob-descriptions): change StanzaNumber description: make side support, i.s.o. breakable. use Instrument_name_engraver for texts in the margin. * scm/define-translator-properties.scm: remove melismaEngraverBusy, stz property. * lily/self-aligment-interface.cc (aligned_on_parent): new function. * input/regression/lyric-phrasing-new.ly: new file. * lily/new-phrasing-engraver.cc (process_acknowledged_grobs): new engraver, redo lyric phrasing, but cleaner and simpler. Lyrics on melismata are now left-aligned.
Diffstat (limited to 'lily/stanza-number-engraver.cc')
-rw-r--r--lily/stanza-number-engraver.cc80
1 files changed, 33 insertions, 47 deletions
diff --git a/lily/stanza-number-engraver.cc b/lily/stanza-number-engraver.cc
index d9887cfefd..6d76b38041 100644
--- a/lily/stanza-number-engraver.cc
+++ b/lily/stanza-number-engraver.cc
@@ -4,97 +4,83 @@
source file of the GNU LilyPond music typesetter
(c) 2000--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>, Glen Prideaux <glenprideaux@iname.com>
-
- Similar to (and derived from) Instrument_name_engraver.
- */
+
+*/
#include "engraver.hh"
#include "item.hh"
-#include "bar-line.hh"
+#include "side-position-interface.hh"
class Stanza_number_engraver : public Engraver
{
Item *text_;
- bool bar_b_;
- void create_text (SCM s);
+ /*
+ This is naughty, since last_stanza_ may be GCd from under us. But
+ since we don't look at the contents, we are/should be (knock on
+ wood) OK.
+ */
+ SCM last_stanza_;
public:
TRANSLATOR_DECLARATIONS(Stanza_number_engraver);
-
virtual void process_music ();
virtual void stop_translation_timestep ();
+ virtual void acknowledge_grob (Grob_info);
};
+/*
+ TODO: should make engraver that collects all the stanzas on a higher
+ level, and then groups them to the side. Stanza numbers should be
+ all aligned.
+ */
Stanza_number_engraver::Stanza_number_engraver ()
{
text_ = 0;
- bar_b_ = false;
}
void
Stanza_number_engraver::process_music ()
{
- if (gh_string_p (get_property ("whichBar")))
+ SCM stanza = get_property ("stanza");
+
+ if (gh_string_p (stanza) && stanza != last_stanza_)
{
- SCM s = get_property ("stanza");
+ last_stanza_ = stanza;
- if (now_mom () > Moment (0))
- s = get_property ("stz");
-
-
- // TODO
- if (gh_string_p (s) || gh_pair_p (s))
-
- /*
- if (i.grob_->internal_has_interface (symbol ("lyric-syllable-interface")))
-
- Tried catching lyric items to generate stanza numbers, but it
- spoils lyric spacing.
-
- Works, but requires bar_engraver in LyricsVoice context apart
- from at beginning. Is there any score element we can catch
- that will do the trick?
-
- What happens if we try anything at all EXCEPT a lyric? Is
- there anything else? Not sure what it's catching, but it
- still mucks up lyrics.
-
- */
-
- create_text (s);
+ text_ = new Item (get_property ("StanzaNumber"));
+ text_->set_grob_property ("text", stanza);
+ announce_grob (text_, SCM_EOL);
}
}
+
void
-Stanza_number_engraver::stop_translation_timestep ()
+Stanza_number_engraver::acknowledge_grob (Grob_info inf)
{
- if (text_)
+ if (text_
+ && inf.grob_->internal_has_interface (ly_symbol2scm ("lyric-text-interface")))
{
- typeset_grob (text_);
- text_ = 0;
+ Side_position_interface::add_support (text_, inf.grob_);
}
}
void
-Stanza_number_engraver::create_text (SCM txt)
+Stanza_number_engraver::stop_translation_timestep ()
{
- if (!text_)
+ if (text_)
{
- text_ = new Item (get_property ("StanzaNumber"));
- text_->set_grob_property ("text", txt);
- announce_grob (text_, SCM_EOL);
+ typeset_grob (text_);
+ text_ = 0;
}
}
-
-
ENTER_DESCRIPTION(Stanza_number_engraver,
/* descr */ "",
/* creats*/ "StanzaNumber",
/* accepts */ "",
-/* acks */ "",
-/* reads */ "stz stanza",
+/* acks */ "lyric-syllable-interface",
+/* reads */ "stanza",
/* write */ "");