]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/figured-bass-engraver.cc
* lily/include/translator.hh (ENTER_DESCRIPTION): add
[lilypond.git] / lily / figured-bass-engraver.cc
index 87894fcdd5bc879f1680a288b903cf34a3e12809..1cf1cc5cf26b62babd4e18f5ec6cd817b6a6cb01 100644 (file)
@@ -5,12 +5,10 @@
 
 class Figured_bass_engraver : public Engraver
 {
-public:
-  VIRTUAL_COPY_CONS(Translator);
-  Figured_bass_engraver();
-
+  
+  TRANSLATOR_DECLARATIONS(Figured_bass_engraver);
 protected:
-  Link_array<Note_req> figures_;
+  Link_array<Bass_figure_req> figures_;
   Rest_req * rest_req_;
 
   Grob * figure_;
@@ -33,18 +31,19 @@ Figured_bass_engraver::stop_translation_timestep ()
   if (figure_)
     {
       typeset_grob (figure_);
-      figure_ =00;
+      figure_ = 0;
     }
 
   figures_.clear ();
+  rest_req_ = 0;
 }
 
 bool
 Figured_bass_engraver::try_music (Music*m)
 {
-  if (Note_req* n = dynamic_cast<Note_req*> (m))
+  if (Bass_figure_req* bfr = dynamic_cast<Bass_figure_req*> (m))
     {
-      figures_.push (n);
+      figures_.push (bfr);
       return true;
     }
   else if (Rest_req * r = dynamic_cast<Rest_req*> (m))
@@ -61,44 +60,27 @@ Figured_bass_engraver::process_music ()
   if (rest_req_)
     {
       figure_ = new Item (get_property ("BassFigure"));
-      announce_grob (figure_, rest_req_); // todo
-      figure_->set_grob_property ("text" , gh_str02scm ("-"));
+      announce_grob(figure_, rest_req_->self_scm()); // todo
+      figure_->set_grob_property ("text" , scm_makfrom0str ("-"));
     }
   else if (figures_.size ())
     {
       figure_ = new Item (get_property ("BassFigure"));
-      announce_grob (figure_, figures_[0]); // todo
-      SCM flist = SCM_EOL;
-      for (int i = 0; i < figures_.size (); i++)
-       {
-         Note_req * n = figures_[i];
-         Pitch *p = unsmob_pitch (n->get_mus_property ("pitch"));
-         
-         String fstr = to_str (p->steps ()+ 1);
-         
-         SCM one_fig = ly_str02scm(fstr.ch_C ());
-
-         if (p->alteration_i_ || to_boolean (n->get_mus_property ("force-accidental") ))
-           {
-             SCM alter = scm_assoc (gh_int2scm (p->alteration_i_),
-                                    figure_->get_grob_property ("accidental-alist"));
-             if (gh_pair_p (alter))
-               {
-                 one_fig = gh_list (ly_symbol2scm ("columns"),
-                                    one_fig,
-                                    gh_cdr(alter),
-                                    SCM_UNDEFINED);
-               }
-           }
-         
-         flist = gh_cons (one_fig, flist);
-       }
-
-      flist = gh_cons (ly_symbol2scm ("lines"), flist);
+      SCM l = SCM_EOL;
 
-      figure_-> set_grob_property ("text", flist);
+      for (int i = 0; i <figures_.size (); i++)
+       l = gh_cons (figures_[i]->self_scm(), l);
+      figure_->set_grob_property ("causes", l);
+      
+      announce_grob(figure_, figures_[0]->self_scm()); // todo
     }
 }
 
   
-ADD_THIS_TRANSLATOR(Figured_bass_engraver);
+ENTER_DESCRIPTION(Figured_bass_engraver,
+/* descr */       "Make figured bass numbers.",
+/* creats*/       "BassFigure",
+/* accepts */     "general-music",
+/* acks  */      "",
+/* reads */       "",
+/* write */       "");