2 #include "text-item.hh"
3 #include "musical-request.hh"
6 class Figured_bass_engraver : public Engraver
9 VIRTUAL_COPY_CONS(Translator);
10 Figured_bass_engraver();
13 Link_array<Note_req> figures_;
18 virtual bool try_music (Music*);
19 virtual void stop_translation_timestep ();
20 virtual void process_music ();
24 Figured_bass_engraver::Figured_bass_engraver()
31 Figured_bass_engraver::stop_translation_timestep ()
35 typeset_grob (figure_);
43 Figured_bass_engraver::try_music (Music*m)
45 if (Note_req* n = dynamic_cast<Note_req*> (m))
50 else if (Rest_req * r = dynamic_cast<Rest_req*> (m))
59 Figured_bass_engraver::process_music ()
63 figure_ = new Item (get_property ("BassFigure"));
64 announce_grob (figure_, rest_req_); // todo
65 figure_->set_grob_property ("text" , gh_str02scm ("-"));
67 else if (figures_.size ())
69 figure_ = new Item (get_property ("BassFigure"));
70 announce_grob (figure_, figures_[0]); // todo
72 for (int i = 0; i < figures_.size (); i++)
74 Note_req * n = figures_[i];
75 Pitch *p = unsmob_pitch (n->get_mus_property ("pitch"));
77 String fstr = to_str (p->steps ()+ 1);
79 SCM one_fig = ly_str02scm(fstr.ch_C ());
81 if (p->alteration_i_ || to_boolean (n->get_mus_property ("force-accidental") ))
83 SCM alter = scm_assoc (gh_int2scm (p->alteration_i_),
84 figure_->get_grob_property ("accidental-alist"));
85 if (gh_pair_p (alter))
87 one_fig = gh_list (ly_symbol2scm ("columns"),
94 flist = gh_cons (one_fig, flist);
97 flist = gh_cons (ly_symbol2scm ("lines"), flist);
99 figure_-> set_grob_property ("text", flist);
104 ADD_THIS_TRANSLATOR(Figured_bass_engraver);