source file of the GNU LilyPond music typesetter
- (C) 2002 Juergen Reuter <reuter@ipd.uka.de>
+ (c) 2002--2004 Juergen Reuter <reuter@ipd.uka.de>
*/
#include "engraver.hh"
#include "event.hh"
#include "pitch.hh"
+
+/*
+ UGH UGH UGH .
+
+ rewrite this complely. --hwn
+ */
+
/*
* This class implements an engraver for ambitus grobs.
*
class Ambitus_engraver : public Engraver
{
public:
-TRANSLATOR_DECLARATIONS(Ambitus_engraver);
+TRANSLATOR_DECLARATIONS (Ambitus_engraver);
virtual void process_music ();
virtual void acknowledge_grob (Grob_info);
virtual void stop_translation_timestep ();
private:
void create_ambitus ();
Item *ambitus_;
- int/*bool*/ is_typeset;
+ bool is_typeset;
Pitch pitch_min, pitch_max;
};
* (pitch_min > pitch_max) means that pitches are not yet
* initialized
*/
- pitch_min = Pitch (0, 0, +1);
- pitch_max = Pitch (0, 0, -1);
+ pitch_min = Pitch (0, 0, SHARP);
+ pitch_max = Pitch (0, 0, FLAT);
}
void
if (ambitus_ && !is_typeset)
{
/*
- * Evaluate centralCPosition not until now, since otherwise we
+ * Evaluate middleCPosition not until now, since otherwise we
* may then oversee a clef that is defined in a staff context if
- * we are in a voice context; centralCPosition would then be
+ * we are in a voice context; middleCPosition would then be
* assumed to be 0.
*/
- SCM c0 = get_property ("centralCPosition");
- ambitus_->set_grob_property ("c0-position", c0);
+ SCM c0 = get_property ("middleCPosition");
+ ambitus_->set_property ("c0-position", c0);
/*
* Similar for keySignature.
*/
SCM key_signature = get_property ("keySignature");
- ambitus_->set_grob_property ("accidentals", key_signature);
+ ambitus_->set_property ("accidentals", key_signature);
typeset_grob (ambitus_);
- is_typeset = 1;
+ is_typeset = true;
}
}
Music *nr = info.music_cause ();
if (nr && nr->is_mus_type ("note-event"))
{
- Pitch pitch = *unsmob_pitch (nr->get_mus_property ("pitch"));
+ Pitch pitch = *unsmob_pitch (nr->get_property ("pitch"));
if (Pitch::compare (pitch_min, pitch_max) > 0) // already init'd?
{
// not yet init'd; use current pitch to init min/max
void
Ambitus_engraver::create_ambitus ()
{
- SCM basicProperties = get_property ("Ambitus");
- ambitus_ = new Item (basicProperties); is_typeset = 0;
+ ambitus_ = make_item ("Ambitus");
+ is_typeset = false;
announce_grob (ambitus_, SCM_EOL);
}
if (ambitus_)
{
if (Pitch::compare (pitch_min, pitch_max) <= 0)
- {
- ambitus_->set_grob_property ("pitch-min",
- pitch_min.smobbed_copy ());
- ambitus_->set_grob_property ("pitch-max",
- pitch_max.smobbed_copy ());
- }
+ {
+ ambitus_->set_property ("pitch-min",
+ pitch_min.smobbed_copy ());
+ ambitus_->set_property ("pitch-max",
+ pitch_max.smobbed_copy ());
+ }
else // have not seen any pitch, so forget about the ambitus
{
/*
* most probably arises from an empty voice, such as shared
* global timesig/clef definitions.
*/
-#if 0
- ambitus_->warning("empty ambitus range [ignored]");
-#endif
- ambitus_->suicide();
+ ambitus_->suicide ();
}
}
}
-ENTER_DESCRIPTION(Ambitus_engraver,
+ENTER_DESCRIPTION (Ambitus_engraver,
/* descr */ "",
/* creats*/ "Ambitus",
/* accepts */ "",