]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/timing-engraver.cc
release: 1.3.107
[lilypond.git] / lily / timing-engraver.cc
index ac2373da6a0c39d8a0d23cb41bae1185e15d022b..7643a2cfa71018ca1bef21054533e7b54907a611 100644 (file)
@@ -3,66 +3,61 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
+#include <iostream.h>
 
-#include "score-engraver.hh"
-#include "timing-engraver.hh"
+#include "translator-group.hh"
 #include "command-request.hh"
 #include "score-element-info.hh"
 #include "multi-measure-rest.hh"
-
-
+#include "timing-translator.hh"
+#include "engraver.hh"
+
+/**
+  Do time bookkeeping
+ */
+class Timing_engraver : public Timing_translator, public Engraver
+{   
+protected:
+  virtual void do_post_move_processing ();
+  virtual void do_pre_move_processing ();
+public:
+  VIRTUAL_COPY_CONS(Translator);
+};
 
 ADD_THIS_TRANSLATOR(Timing_engraver);
 
-
 void
 Timing_engraver::do_post_move_processing( )
 {
-  bar_req_l_ = 0;
   Timing_translator::do_post_move_processing ();
-}
-
-bool
-Timing_engraver::do_try_music (Music*m)
-{
-  if (Bar_req  * b= dynamic_cast <Bar_req *> (m))
-    {
-      if (bar_req_l_ && bar_req_l_->equal_b (b)) // huh?
-       return false;
-      
-      bar_req_l_ = b;
-      return true;
-    }
-  
-  return Timing_translator::do_try_music (m);
-}
 
+  SCM nonauto = get_property ("barNonAuto");
 
-String
-Timing_engraver::which_bar ()
-{
-  if (!bar_req_l_)
+  SCM which = get_property ("whichBar");
+  if (!gh_string_p (which))
+    which = now_mom () ? SCM_EOL : ly_str02scm ("|");
+  
+  if (!gh_string_p (which) && !to_boolean (nonauto))
     {
-      if (!now_mom ())
-       return "|";
-
-      SCM nonauto = get_property ("barNonAuto", 0);
-      if (!gh_boolean_p (nonauto) && gh_scm2bool (nonauto))
+      SCM always = get_property ("barAlways");
+      if (!measure_position ()
+         || (to_boolean (always)))
        {
-         SCM always = get_property ("barAlways", 0);
-         if (!measure_position ()
-             || (gh_boolean_p (always) && gh_scm2bool (always)))
-           {
-             SCM def=get_property ("defaultBarType" ,0);
-             return (gh_string_p (def))? ly_scm2string (def) : "";
-           }
+         which=get_property ("defaultBarType" );
        }
-      return "";
-    }
-  else
-    {
-      return bar_req_l_->type_str_;
     }
+
+  daddy_trans_l_->set_property ("whichBar", which);
 }
+
+void
+Timing_engraver::do_pre_move_processing ()
+{
+  Timing_translator::do_pre_move_processing ();
+  daddy_trans_l_->set_property ("whichBar", SCM_EOL);  
+}
+
+
+