]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/clef-engraver.cc
release: 1.5.19
[lilypond.git] / lily / clef-engraver.cc
index d16cb8a20b5db7a4058e5ac061b73c10bc45c429..6a4646f6cde93219227690a4ef66c1706d0b54fe 100644 (file)
@@ -24,8 +24,7 @@
 class Clef_engraver : public  Engraver
 {
 public:
-  VIRTUAL_COPY_CONS (Translator);
-  Clef_engraver ();
+  TRANSLATOR_DECLARATIONS(Clef_engraver);
 
   Direction octave_dir_;
 
@@ -34,7 +33,6 @@ protected:
   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_;
@@ -78,23 +76,13 @@ 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"));
-       }
     } 
 }
 
@@ -110,8 +98,10 @@ Clef_engraver::create_clef ()
       
       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))
@@ -135,18 +125,6 @@ Clef_engraver::process_music ()
   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 ()
 {
@@ -213,5 +191,11 @@ Clef_engraver::start_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 */       "");