]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/key-engraver.cc
''
[lilypond.git] / lily / key-engraver.cc
index 566516d297583764ec17369c0a2fadd891965768..8cbd43b105ca4d7494d5e569630e04b142ee7ab7 100644 (file)
@@ -6,11 +6,11 @@
   (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   */
 
-#include "key-item.hh"
+
 #include "command-request.hh"
 #include "musical-request.hh"
 #include "item.hh"
-#include "bar.hh"
+#include "bar-line.hh"
 #include "staff-symbol-referencer.hh"
 #include "translator-group.hh"
 #include "engraver.hh"
@@ -37,7 +37,7 @@ protected:
   virtual bool try_music (Music *req_l);
   virtual void stop_translation_timestep ();
   virtual void start_translation_timestep ();
-  virtual void create_grobs ();
+  virtual void process_music ();
   virtual void acknowledge_grob (Grob_info);
 };
 
@@ -69,16 +69,14 @@ Key_engraver::create_key (bool def)
       item_p_->set_grob_property ("old-accidentals", get_property ("lastKeySignature"));
       item_p_->set_grob_property ("new-accidentals", get_property ("keySignature"));
 
-      Staff_symbol_referencer::set_interface (item_p_);
-      Key_item::set_interface (item_p_);
-      announce_grob (item_p_,keyreq_l_);
+      announce_grob(item_p_, keyreq_l_ ? keyreq_l_->self_scm() : SCM_EOL);
     }
 
   if (!def)
     {
       SCM vis = get_property ("explicitKeySignatureVisibility"); 
       if (gh_procedure_p (vis))
-       item_p_->set_grob_property ("visibility-lambda",vis);
+       item_p_->set_grob_property ("break-visibility",vis);
     }
 }      
 
@@ -94,9 +92,16 @@ Key_engraver::try_music (Music * req_l)
          keyreq_l_->origin ()->warning (_ ("This was the other key definition."));       
          return false;
        }
-      keyreq_l_ = kc;
-      read_req (keyreq_l_);
 
+      if (!keyreq_l_)
+       {
+         /*
+           do this only once, just to be on the safe side.
+           */      
+         keyreq_l_ = kc;
+         read_req (keyreq_l_);
+       }
+      
       return true;
     }   
   return  false;
@@ -114,7 +119,7 @@ Key_engraver::acknowledge_grob (Grob_info info)
          create_key (false);
        }
     }
-  else if (Bar::has_interface (info.grob_l_)
+  else if (Bar_line::has_interface (info.grob_l_)
           && gh_pair_p (get_property ("keySignature")))
     {
       create_key (true);
@@ -123,7 +128,7 @@ Key_engraver::acknowledge_grob (Grob_info info)
 
 
 void
-Key_engraver::create_grobs ()
+Key_engraver::process_music ()
 {
   if (keyreq_l_ ||
       get_property ("lastKeySignature") != get_property ("keySignature"))
@@ -165,8 +170,11 @@ Key_engraver::read_req (Key_change_req const * r)
     if (gh_scm2int (ly_cdar (s)))
       accs = gh_cons (ly_car (s), accs);
 
+#if 0
   daddy_trans_l_->set_property ("lastKeySignature",
                                get_property ("keySignature"));
+#endif
+  
   daddy_trans_l_->set_property ("keySignature", accs);
 }