class Clef_engraver : public Engraver
{
public:
- VIRTUAL_COPY_CONS (Translator);
- Clef_engraver ();
+ TRANSLATOR_DECLARATIONS(Clef_engraver);
Direction octave_dir_;
virtual void start_translation_timestep ();
virtual void process_music ();
virtual void acknowledge_grob (Grob_info);
- virtual void do_creation_processing ();
private:
Item * clef_p_;
Item * octavate_p_;
SCM prev_cpos_;
SCM prev_octavation_;
void create_clef ();
- void set_central_c (SCM, SCM, SCM);
void set_glyph ();
void inspect_clef_properties ();
};
prev_cpos_ = prev_glyph_ = SCM_BOOL_F;
}
-void
-Clef_engraver::set_central_c (SCM glyph,SCM clefpos, SCM octavation)
-{
- prev_cpos_ = clefpos;
- prev_glyph_ = glyph;
- prev_octavation_ = octavation;
-
- SCM p = get_property ("clefPitches");
- int c0_position = 0;
- if (gh_list_p (p))
- {
- SCM found = scm_assoc (glyph, p);
- if (found == SCM_BOOL_F)
- {
- c0_position =0;
- }
- else
- {
- c0_position = gh_scm2int (gh_cdr (found));
-
- if (gh_number_p (octavation))
- c0_position -= gh_scm2int (octavation);
-
- if (gh_number_p (clefpos))
- c0_position += gh_scm2int (clefpos);
- }
-
- }
- daddy_trans_l_->set_property ("centralCPosition", gh_int2scm (c0_position));
-}
-
void
Clef_engraver::set_glyph ()
{
void
Clef_engraver::acknowledge_grob (Grob_info info)
{
- Item * item =dynamic_cast <Item *> (info.elem_l_);
+ Item * item =dynamic_cast <Item *> (info.grob_l_);
if (item)
{
- if (Bar::has_interface (info.elem_l_)
+ if (Bar::has_interface (info.grob_l_)
&& gh_string_p (get_property ("clefGlyph")))
create_clef ();
- if (Key_item::has_interface (item))
- {
- /*
- Key_item adapts its formatting to make sure that the
- accidentals stay in the upper half of the staff. It needs
- to know c0-pos for this. (?)
- */
-
- item->set_grob_property ("c0-position", get_property ("centralCPosition"));
- }
}
}
clef_p_ = c;
}
- Staff_symbol_referencer::set_position (clef_p_,
- gh_scm2int (get_property ("clefPosition")));
+ SCM cpos = get_property ("clefPosition");
+
+ if (gh_number_p (cpos))
+ Staff_symbol_referencer::set_position (clef_p_, gh_scm2int (cpos));
SCM oct = get_property ("clefOctavation");
if (gh_number_p (oct) && gh_scm2int (oct))
inspect_clef_properties ();
}
-/*
- this must be done in creation_proc() since grace notes will be
- processed before Clef_engraver::prcoess_music()
-
- Grace notes and clef changes are still broken.
-*/
-void
-Clef_engraver::do_creation_processing ()
-{
- inspect_clef_properties ();
-}
-
void
Clef_engraver::inspect_clef_properties ()
{
)
{
set_glyph ();
- set_central_c (glyph, clefpos, octavation);
-
create_clef ();
clef_p_->set_grob_property ("non-default", SCM_BOOL_T);
+
+ prev_cpos_ = clefpos;
+ prev_glyph_ = glyph;
+ prev_octavation_ = octavation;
}
if (to_boolean (force_clef))
}
}
+
void
Clef_engraver::stop_translation_timestep ()
{
{
}
-ADD_THIS_TRANSLATOR (Clef_engraver);
+
+ENTER_DESCRIPTION(Clef_engraver,
+/* descr */ "Determine and set reference point for pitches",
+/* creats*/ "Clef OctavateEight",
+/* acks */ "bar-line-interface",
+/* reads */ "clefPosition clefGlyph centralCPosition clefOctavation explicitClefVisibility",
+/* write */ "");