]> git.donarmstrong.com Git - lilypond.git/commitdiff
(internal_print): only call
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 19 Jul 2005 10:37:52 +0000 (10:37 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 19 Jul 2005 10:37:52 +0000 (10:37 +0000)
glyph-name-procedure if  style != default. 3 %  speed increase (wtk2-fugue1).

ChangeLog
lily/default-bar-line-engraver.cc [new file with mode: 0644]
lily/fingering-engraver.cc
lily/key-engraver.cc
lily/note-head.cc
lily/rest-engraver.cc
lily/separating-line-group-engraver.cc
lily/slash-repeat-engraver.cc
lily/timing-engraver.cc [deleted file]

index ea146f8047849429df1b23f825e6523415f6e90e..7cd9ac07203abf5826c5cf5783c81ea11329995e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2005-07-19  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/*-engraver.cc (various): remove double use of
+       PRECOMPUTED_VIRTUAL function: only use
+       start_translation_timestep() and stop_translation_timestep(), not
+       both.
+
        * lily/break-substitution.cc (fast_substitute_grob_array): do
        fast_substitute_grob_array for all unordered grob_arrays.
        (substitute_grob): return Grob *. Saves packing/unpacking SCMs.
diff --git a/lily/default-bar-line-engraver.cc b/lily/default-bar-line-engraver.cc
new file mode 100644 (file)
index 0000000..54c3543
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+  timing-engraver.cc -- implement Default_bar_line_engraver
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "engraver.hh"
+#include "context.hh"
+#include "multi-measure-rest.hh"
+#include "grob.hh"
+#include "warn.hh"
+
+
+class Default_bar_line_engraver : public Engraver
+{
+protected:
+  /* Need to know whether we're advancing in grace notes, or not. */
+  Moment last_moment_;
+
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+
+public:
+  TRANSLATOR_DECLARATIONS (Default_bar_line_engraver);
+};
+
+#include "translator.icc"
+
+ADD_TRANSLATOR (Default_bar_line_engraver,
+               "This engraver determines what kind of automatic bar lines should be produced, "
+               "and sets @code{whichBar} accordingly. It should be at the same "
+               "level as @ref{Timing_translator}. ",  
+               /* creats*/ "",
+               /* accepts */ "",
+               /* acks  */ "",
+               /* reads */
+               "measurePosition automaticBars whichBar barAlways defaultBarType "
+               "measureLength",
+               /* write */ "automaticBars");
+
+
+Default_bar_line_engraver::Default_bar_line_engraver ()
+{
+  last_moment_.main_part_ = Rational (-1);
+}
+
+void
+Default_bar_line_engraver::start_translation_timestep ()
+{
+  SCM automatic_bars = get_property ("automaticBars");
+  Moment now = now_mom ();
+  SCM which = get_property ("whichBar");
+
+  /* Set the first bar of the score? */
+  if (!scm_is_string (which))
+    which = SCM_EOL;
+
+  Moment mp = measure_position (context ());
+  bool start_of_measure = (last_moment_.main_part_ != now.main_part_
+                          && !mp.main_part_);
+
+  if (!scm_is_string (which) && to_boolean (automatic_bars))
+    {
+      SCM always = get_property ("barAlways");
+
+      if ((start_of_measure && last_moment_.main_part_ >= Moment (0))
+         || to_boolean (always))
+       {
+         /* should this work, or be junked?  See input/bugs/no-bars.ly */
+         which = get_property ("defaultBarType");
+       }
+    }
+
+  context ()->set_property ("whichBar", which);
+}
+
+void
+Default_bar_line_engraver::stop_translation_timestep ()
+{
+  context ()->set_property ("whichBar", SCM_EOL);
+  last_moment_ = now_mom ();
+}
index c2db873a77ef88ef89bd0d400b33068c4e8c53d2..245202faa17ba076b969c1b4819b5f5e4c906b4e 100644 (file)
@@ -16,7 +16,7 @@
 
 class Fingering_engraver : public Engraver
 {
-  Link_array<Music> reqs_;
+  Link_array<Music> events_;
   Link_array<Item> fingerings_;
 
 public:
@@ -24,7 +24,6 @@ public:
 protected:
   virtual bool try_music (Music *m);
   PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
-  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
 
@@ -37,7 +36,7 @@ Fingering_engraver::try_music (Music *m)
 {
   if (m->is_mus_type ("fingering-event"))
     {
-      reqs_.push (m);
+      events_.push (m);
       return true;
     }
   return false;
@@ -68,10 +67,10 @@ Fingering_engraver::acknowledge_grob (Grob_info inf)
 void
 Fingering_engraver::process_music ()
 {
-  for (int i = reqs_.size (); i--;)
+  for (int i = events_.size (); i--;)
     {
-      SCM dir = reqs_[i]->get_property ("direction");
-      make_script (to_dir (dir), reqs_[i], i);
+      SCM dir = events_[i]->get_property ("direction");
+      make_script (to_dir (dir), events_[i], i);
     }
 }
 
@@ -131,12 +130,7 @@ Fingering_engraver::stop_translation_timestep ()
     return;
 
   fingerings_.clear ();
-}
-
-void
-Fingering_engraver::start_translation_timestep ()
-{
-  reqs_.clear ();
+  events_.clear ();
 }
 
 Fingering_engraver::Fingering_engraver ()
index 2ccdef5ec12ac84527d62afe9f7fd696e42d200a..c1a973f4a0eb7d6e2eb66cdc572c6370c10c044f 100644 (file)
@@ -38,7 +38,6 @@ protected:
   virtual void finalize ();
   virtual bool try_music (Music *ev);
   PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
-  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
 };
@@ -134,6 +133,7 @@ Key_engraver::stop_translation_timestep ()
   item_ = 0;
   context ()->set_property ("lastKeySignature", get_property ("keySignature"));
   cancellation_ = 0;
+  key_ev_ = 0;
 }
 
 void
@@ -164,12 +164,6 @@ Key_engraver::read_ev (Music const *r)
                            r->get_property ("tonic"));
 }
 
-void
-Key_engraver::start_translation_timestep ()
-{
-  key_ev_ = 0;
-}
-
 void
 Key_engraver::initialize ()
 {
index a106fd2ab0d24eb35595120cce2cac30d2f97d35..b2e451e54c977619553a43198e10fb79cb8e21ca 100644 (file)
@@ -39,13 +39,13 @@ internal_print (Grob *me, String *font_char)
     }
 
   SCM log = scm_int2num (Note_head::get_balltype (me));
-  SCM proc = me->get_property ("glyph-name-procedure");
-
   String suffix =  to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2));
-  if (style != ly_symbol2scm ("default")
-      && ly_is_procedure (proc))
-    suffix = ly_scm2string (scm_call_2 (proc, log, style));
-  
+  if (style != ly_symbol2scm ("default"))
+    {
+      SCM proc = me->get_property ("glyph-name-procedure");
+      if (ly_is_procedure (proc))
+       suffix = ly_scm2string (scm_call_2 (proc, log, style));
+    }  
   Font_metric *fm = Font_interface::get_default_font (me);
 
   String idx = "noteheads.s" + suffix;
index e276d303c8015439c50049070d6c2088e626f9eb..2a90b776ce7e5b8598493ec0979d1af8bb48c897 100644 (file)
 
 class Rest_engraver : public Engraver
 {
-  Music *rest_req_;
+  Music *rest_event_;
   Item *dot_;
   Grob *rest_;
 protected:
   virtual bool try_music (Music *);
-  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   PRECOMPUTED_VIRTUAL void process_music ();
 
@@ -36,7 +35,7 @@ public:
 */
 Rest_engraver::Rest_engraver ()
 {
-  rest_req_ = 0;
+  rest_event_ = 0;
   rest_ = 0;
   dot_ = 0;
 }
@@ -44,29 +43,25 @@ Rest_engraver::Rest_engraver ()
 void
 Rest_engraver::start_translation_timestep ()
 {
-  rest_req_ = 0;
-}
-
-void
-Rest_engraver::stop_translation_timestep ()
-{
+  rest_event_ = 0;
   rest_ = 0;
   dot_ = 0;
 }
 
+
 void
 Rest_engraver::process_music ()
 {
-  if (rest_req_ && !rest_)
+  if (rest_event_ && !rest_)
     {
-      rest_ = make_item ("Rest", rest_req_->self_scm ());
+      rest_ = make_item ("Rest", rest_event_->self_scm ());
 
-      int durlog = unsmob_duration (rest_req_->get_property ("duration"))->duration_log ();
+      int durlog = unsmob_duration (rest_event_->get_property ("duration"))->duration_log ();
 
       rest_->set_property ("duration-log",
                           scm_int2num (durlog));
 
-      int dots = unsmob_duration (rest_req_->get_property ("duration"))->dot_count ();
+      int dots = unsmob_duration (rest_event_->get_property ("duration"))->dot_count ();
 
       if (dots)
        {
@@ -77,7 +72,7 @@ Rest_engraver::process_music ()
          dot_->set_property ("dot-count", scm_int2num (dots));
        }
 
-      Pitch *p = unsmob_pitch (rest_req_->get_property ("pitch"));
+      Pitch *p = unsmob_pitch (rest_event_->get_property ("pitch"));
 
       /*
        This is ridiculous -- rests don't have pitch, but we act as if
@@ -100,7 +95,7 @@ Rest_engraver::try_music (Music *m)
 {
   if (m->is_mus_type ("rest-event"))
     {
-      rest_req_ = m;
+      rest_event_ = m;
       return true;
     }
   return false;
index b8b36943f303112f9ab4f39cb0d73cf682e0f2f6..415f3aa3f5d011a01eabbe2ee94e7e893781a3cb 100644 (file)
@@ -181,8 +181,10 @@ void
 Separating_line_group_engraver::start_translation_timestep ()
 {
   if (break_item_)
-    context ()->unset_property (ly_symbol2scm ("breakableSeparationItem"));
-  break_item_ = 0;
+    {
+      context ()->unset_property (ly_symbol2scm ("breakableSeparationItem"));
+      break_item_ = 0;
+    }
 }
 
 void
index 74d1f52b9f57c0c3067ae1efb63b8917a0503bab..42f622699ef3e428629b3fa928a07f780aff483d 100644 (file)
@@ -46,7 +46,6 @@ protected:
   Item *double_percent_;
 protected:
   virtual bool try_music (Music *);
-  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   PRECOMPUTED_VIRTUAL void process_music ();
 };
@@ -111,14 +110,10 @@ Slash_repeat_engraver::start_translation_timestep ()
     {
       repeat_ = 0;
     }
-}
-
-void
-Slash_repeat_engraver::stop_translation_timestep ()
-{
   beat_slash_ = 0;
 }
 
+
 #include "translator.icc"
 
 ADD_TRANSLATOR (Slash_repeat_engraver,
diff --git a/lily/timing-engraver.cc b/lily/timing-engraver.cc
deleted file mode 100644 (file)
index 54c3543..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-  timing-engraver.cc -- implement Default_bar_line_engraver
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "engraver.hh"
-#include "context.hh"
-#include "multi-measure-rest.hh"
-#include "grob.hh"
-#include "warn.hh"
-
-
-class Default_bar_line_engraver : public Engraver
-{
-protected:
-  /* Need to know whether we're advancing in grace notes, or not. */
-  Moment last_moment_;
-
-  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
-  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
-
-public:
-  TRANSLATOR_DECLARATIONS (Default_bar_line_engraver);
-};
-
-#include "translator.icc"
-
-ADD_TRANSLATOR (Default_bar_line_engraver,
-               "This engraver determines what kind of automatic bar lines should be produced, "
-               "and sets @code{whichBar} accordingly. It should be at the same "
-               "level as @ref{Timing_translator}. ",  
-               /* creats*/ "",
-               /* accepts */ "",
-               /* acks  */ "",
-               /* reads */
-               "measurePosition automaticBars whichBar barAlways defaultBarType "
-               "measureLength",
-               /* write */ "automaticBars");
-
-
-Default_bar_line_engraver::Default_bar_line_engraver ()
-{
-  last_moment_.main_part_ = Rational (-1);
-}
-
-void
-Default_bar_line_engraver::start_translation_timestep ()
-{
-  SCM automatic_bars = get_property ("automaticBars");
-  Moment now = now_mom ();
-  SCM which = get_property ("whichBar");
-
-  /* Set the first bar of the score? */
-  if (!scm_is_string (which))
-    which = SCM_EOL;
-
-  Moment mp = measure_position (context ());
-  bool start_of_measure = (last_moment_.main_part_ != now.main_part_
-                          && !mp.main_part_);
-
-  if (!scm_is_string (which) && to_boolean (automatic_bars))
-    {
-      SCM always = get_property ("barAlways");
-
-      if ((start_of_measure && last_moment_.main_part_ >= Moment (0))
-         || to_boolean (always))
-       {
-         /* should this work, or be junked?  See input/bugs/no-bars.ly */
-         which = get_property ("defaultBarType");
-       }
-    }
-
-  context ()->set_property ("whichBar", which);
-}
-
-void
-Default_bar_line_engraver::stop_translation_timestep ()
-{
-  context ()->set_property ("whichBar", SCM_EOL);
-  last_moment_ = now_mom ();
-}