source file of the GNU LilyPond music typesetter
- (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>,
+ (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>,
Mats Bengtsson <matsb@s3.kth.se>
*/
#include <ctype.h>
#include "translator-group.hh"
-
#include "bar-line.hh"
#include "staff-symbol-referencer.hh"
-
#include "engraver.hh"
#include "direction.hh"
#include "side-position-interface.hh"
#include "item.hh"
-
class Clef_engraver : public Engraver
{
public:
protected:
virtual void stop_translation_timestep ();
- virtual void start_translation_timestep ();
virtual void process_music ();
virtual void acknowledge_grob (Grob_info);
private:
SCM basic = ly_symbol2scm ("Clef");
- daddy_trans_->execute_single_pushpop_property (basic, glyph_sym, SCM_UNDEFINED);
- daddy_trans_->execute_single_pushpop_property (basic, glyph_sym, glyph);
+ execute_pushpop_property (daddy_trans_, basic, glyph_sym, SCM_UNDEFINED);
+ execute_pushpop_property (daddy_trans_, basic, glyph_sym, glyph);
}
/**
if (Bar_line::has_interface (info.grob_)
&& gh_string_p (get_property ("clefGlyph")))
create_clef ();
-
}
}
{
if (!clef_)
{
- Item *c= new Item (get_property ("Clef"));
+ Item *c= make_item ("Clef");
announce_grob(c, SCM_EOL);
clef_ = c;
- }
- SCM cpos = get_property ("clefPosition");
-
- if (gh_number_p (cpos))
- Staff_symbol_referencer::set_position (clef_, gh_scm2int (cpos));
-
- SCM oct = get_property ("clefOctavation");
- if (gh_number_p (oct) && gh_scm2int (oct))
- {
- Item * g = new Item (get_property ("OctavateEight"));
+ SCM cpos = get_property ("clefPosition");
- Side_position_interface::add_support (g,clef_);
+ if (gh_number_p (cpos))
+ Staff_symbol_referencer::set_position (clef_, gh_scm2int (cpos));
- g->set_parent (clef_, Y_AXIS);
- g->set_parent (clef_, X_AXIS);
-
- g->set_grob_property ("direction", scm_int2num (sign (gh_scm2int (oct))));
- octavate_ = g;
- announce_grob(octavate_, SCM_EOL);
+ SCM oct = get_property ("clefOctavation");
+ if (gh_number_p (oct) && gh_scm2int (oct))
+ {
+ Item * g = make_item ("OctavateEight");
+
+ int abs_oct = gh_scm2int (oct) ;
+ int dir = sign (abs_oct);
+ abs_oct = abs (abs_oct) + 1;
+
+ g->set_grob_property ("text",
+ scm_number_to_string (gh_int2scm (abs_oct),
+ SCM_MAKINUM (10)));
+ Side_position_interface::add_support (g,clef_);
+
+ g->set_parent (clef_, Y_AXIS);
+ g->set_parent (clef_, X_AXIS);
+ g->set_grob_property ("direction", scm_int2num (dir));
+ octavate_ = g;
+ announce_grob(octavate_, SCM_EOL);
+ }
}
}
-
void
Clef_engraver::process_music ()
{
|| scm_equal_p (glyph, prev_glyph_) == SCM_BOOL_F
|| scm_equal_p (clefpos, prev_cpos_) == SCM_BOOL_F
|| scm_equal_p (octavation, prev_octavation_) == SCM_BOOL_F
- || to_boolean (force_clef)
-)
+ || to_boolean (force_clef))
{
set_glyph ();
create_clef ();
if (octavate_)
{
- Side_position_interface::add_staff_support (octavate_);
typeset_grob (octavate_);
}
}
}
-void
-Clef_engraver::start_translation_timestep ()
-{
-}
-
ENTER_DESCRIPTION(Clef_engraver,
/* descr */ "Determine and set reference point for pitches",
/* creats*/ "Clef OctavateEight",
-/* acks */ "bar-line-interface",
+/* accepts */ "",
+/* acks */ "bar-line-interface",
/* reads */ "clefPosition clefGlyph centralCPosition clefOctavation explicitClefVisibility",
/* write */ "");