]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/time-signature-engraver.cc
release: 1.3.83
[lilypond.git] / lily / time-signature-engraver.cc
index 965ecbf3c4431f53ef2df6750c7b4a70699bbef9..8eeb7e3109cf91529865ed8e6b65bdfdbaa46490 100644 (file)
@@ -6,47 +6,51 @@
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "time-signature-engraver.hh"
 #include "time-signature.hh"
 #include "command-request.hh"
-#include "timing-engraver.hh"
+#include "engraver.hh"
+
+
 #include "engraver-group-engraver.hh"
 
+
+/**
+  generate time_signatures. 
+  */
+class Time_signature_engraver : public Engraver {
+protected:
+  virtual void do_process_music();
+  virtual void do_pre_move_processing();
+public:
+  VIRTUAL_COPY_CONS(Translator);
+  Item * time_signature_p_;
+  SCM last_time_fraction_;
+  Time_signature_engraver();
+};
+
+
 Time_signature_engraver::Time_signature_engraver()
 { 
   time_signature_p_ =0;
+  last_time_fraction_ = SCM_EOL;
 }
 
 void
-Time_signature_engraver::do_process_requests()
+Time_signature_engraver::do_process_music()
 {
-  Translator * result =
-    daddy_grav_l()->get_simple_translator ("Timing_engraver"); // ugh
-
-  if (!result)
+  /*
+    not rigorously safe, since the value might get GC'd and
+    reallocated in the same spot */
+  SCM fr= get_property ("timeSignatureFraction");
+  if (last_time_fraction_ != fr)
     {
-      warning (_ ("lost in time:"));
-      warning (_f ("Can't find: `%s'", " Timing_translator"));
-      return ;
+      last_time_fraction_ = fr; 
+      time_signature_p_ = new Item (get_property ("basicTimeSignatureProperties"));
+      time_signature_p_->set_elt_property ("fraction",fr);
     }
   
-  Timing_engraver * timing_grav_l= dynamic_cast<Timing_engraver *> (result);
-  
-  Time_signature_change_req *req = timing_grav_l->time_signature_req_l();
-  if (req)
-    {
-      Array<int> args;
-      args.push (req->beats_i_);
-      args.push (req->one_beat_i_);
-       
-      time_signature_p_ = new Time_signature;
-      time_signature_p_->args_ = args;
-      time_signature_p_->set_elt_property ("break-aligned", SCM_BOOL_T);
-    }
-
-  
   if (time_signature_p_)
-    announce_element (Score_element_info (time_signature_p_, req));
+    announce_element (time_signature_p_, 0);
 }
 
 void