]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/tab-staff-symbol-engraver.cc: derive from Engraver, not
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 19 Jun 2006 10:37:09 +0000 (10:37 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 19 Jun 2006 10:37:09 +0000 (10:37 +0000)
Staff_symbol_engraver

* ly/engraver-init.ly (AncientRemoveEmptyStaffContext): don't
replace staff_engraver

* lily/staff-symbol-engraver.cc (stop_spanner): announce end of
spanner.

* lily/staff-collecting-engraver.cc
(acknowledge_end_staff_symbol): new function

* lily/volta-engraver.cc (acknowledge_end_staff_symbol): new function.

* lily/staff-collecting-engraver.cc
(acknowledge_end_staff_symbol): new function.

* lily/main.cc: switch on relocation by default.

ChangeLog
lily/include/staff-symbol-engraver.hh
lily/main.cc
lily/staff-collecting-engraver.cc
lily/staff-symbol-engraver.cc
lily/tab-staff-symbol-engraver.cc
lily/volta-engraver.cc
ly/engraver-init.ly

index 6322fde1b7bf4f3ac6df91e48f0494d9f384bce0..2c5fd123b21d0e3d3d4e1a3fa6694c4ce6a88e8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2006-06-19  Han-Wen Nienhuys  <hanwen@lilypond.org>
+
+       * lily/tab-staff-symbol-engraver.cc: derive from Engraver, not
+       Staff_symbol_engraver
+
+       * ly/engraver-init.ly (AncientRemoveEmptyStaffContext): don't
+       replace staff_engraver
+
+       * lily/staff-symbol-engraver.cc (stop_spanner): announce end of
+       spanner.
+
+       * lily/staff-collecting-engraver.cc
+       (acknowledge_end_staff_symbol): new function
+
+       * lily/volta-engraver.cc (acknowledge_end_staff_symbol): new function. 
+
+       * lily/staff-collecting-engraver.cc
+       (acknowledge_end_staff_symbol): new function.
+
+       * lily/main.cc: switch on relocation by default.
+
 2006-06-18  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
        * lily/spacing-spanner.cc (musical_column_spacing): set
index 08bdc23bd5f4143172bc30378f2c8c448cbb1b16..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,40 +0,0 @@
-/*
-  staff-symbol-engraver.hh -- declare Staff_symbol_engraver
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
-*/
-
-#ifndef STAFF_SYMBOL_ENGRAVER_HH
-#define STAFF_SYMBOL_ENGRAVER_HH
-
-#include "engraver.hh"
-#include "drul-array.hh"
-
-class Staff_symbol_engraver : public Engraver
-{
-public:
-  TRANSLATOR_DECLARATIONS (Staff_symbol_engraver);
-
-private:
-
-protected:
-  Drul_array<Music *> span_events_;
-  Spanner *span_;
-  Spanner *finished_span_;
-  bool first_start_;
-
-protected:
-  virtual void start_spanner ();
-  virtual void stop_spanner ();
-
-  void stop_translation_timestep ();
-  virtual bool try_music (Music *);
-  virtual ~Staff_symbol_engraver ();
-  DECLARE_ACKNOWLEDGER (grob);
-  virtual void finalize ();
-  void process_music ();
-};
-
-#endif /* STAFF_SYMBOL_ENGRAVER_HH */
index f640801b84a647ecffec6878d371c6b4a3706915..5f9b2a77f657f3e4c02dd68518e8a7d39cf66c31 100644 (file)
@@ -89,7 +89,7 @@ bool make_print = true;
 
 
 bool relocate_binary =
-#if ARGV0_RELOCATION
+#if 1
   true;
 #else
   false
index fe522a049747284eb8efd91dbf59442173a5e533..95e9b1c30530252c27e93f662d6761b9b2e9465e 100644 (file)
@@ -16,6 +16,7 @@ class Staff_collecting_engraver : public Engraver
 public:
   TRANSLATOR_DECLARATIONS (Staff_collecting_engraver);
   DECLARE_ACKNOWLEDGER (staff_symbol);
+  DECLARE_END_ACKNOWLEDGER (staff_symbol);
 };
 
 Staff_collecting_engraver::Staff_collecting_engraver ()
@@ -31,8 +32,18 @@ Staff_collecting_engraver::acknowledge_staff_symbol (Grob_info gi)
   context ()->set_property ("stavesFound", staffs);
 }
 
+void
+Staff_collecting_engraver::acknowledge_end_staff_symbol (Grob_info gi)
+{
+  SCM staffs = get_property ("stavesFound");
+  staffs = scm_delq (gi.grob ()->self_scm (), staffs);
+
+  context ()->set_property ("stavesFound", staffs);
+}
+
 #include "translator.icc"
 ADD_ACKNOWLEDGER (Staff_collecting_engraver, staff_symbol);
+ADD_END_ACKNOWLEDGER (Staff_collecting_engraver, staff_symbol);
 
 ADD_TRANSLATOR (Staff_collecting_engraver,
                /* doc */ "Maintain the stavesFound variable",
index 849b063861f2f06f21af313fea1533fd408ce3c5..c147d54dfff9bd1f7430c1ab5959bd21c4c12ca2 100644 (file)
@@ -6,8 +6,31 @@
   (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
-#include "staff-symbol-engraver.hh"
 #include "spanner.hh"
+#include "engraver.hh"
+
+class Staff_symbol_engraver : public Engraver
+{
+public:
+  TRANSLATOR_DECLARATIONS (Staff_symbol_engraver);
+
+protected:
+  Drul_array<Music *> span_events_;
+  Spanner *span_;
+  Spanner *finished_span_;
+  bool first_start_;
+
+protected:
+  virtual void start_spanner ();
+  virtual void stop_spanner ();
+
+  void stop_translation_timestep ();
+  virtual bool try_music (Music *);
+  virtual ~Staff_symbol_engraver ();
+  DECLARE_ACKNOWLEDGER (grob);
+  virtual void finalize ();
+  void process_music ();
+};
 
 Staff_symbol_engraver::~Staff_symbol_engraver ()
 {
@@ -66,8 +89,17 @@ Staff_symbol_engraver::start_spanner ()
 void
 Staff_symbol_engraver::stop_spanner ()
 {
-  if (finished_span_ && !finished_span_->get_bound (RIGHT))
+  if (!finished_span_)
+    return;
+
+  if (!finished_span_->get_bound (RIGHT))
     finished_span_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
+  
+  announce_end_grob (finished_span_,
+                    span_events_[STOP]
+                    ? span_events_[STOP]->self_scm ()
+                    : SCM_EOL);
+  
   finished_span_ = 0;
 }
 
index 3483cb86f795b6fb76002aa22fce643f4a544433..538223bfe8c5562e9044fe714b8a3e353964683e 100644 (file)
@@ -6,28 +6,23 @@
   (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
-#include "staff-symbol-engraver.hh"
+#include "engraver.hh"
 #include "spanner.hh"
 
-class Tab_staff_symbol_engraver : public Staff_symbol_engraver
+class Tab_staff_symbol_engraver : public Engraver
 {
 public:
   TRANSLATOR_DECLARATIONS (Tab_staff_symbol_engraver);
 protected:
-  virtual void start_spanner ();
+  DECLARE_ACKNOWLEDGER(staff_symbol);
 };
 
 void
-Tab_staff_symbol_engraver::start_spanner ()
+Tab_staff_symbol_engraver::acknowledge_staff_symbol (Grob_info gi)
 {
-  bool init = !span_;
-  Staff_symbol_engraver::start_spanner ();
-  if (init)
-    {
-      int k = scm_ilength (get_property ("stringTunings"));
-      if (k >= 0)
-       span_->set_property ("line-count", scm_from_int (k));
-    }
+  int k = scm_ilength (get_property ("stringTunings"));
+  if (k >= 0)
+    gi.grob ()->set_property ("line-count", scm_from_int (k));
 }
 
 Tab_staff_symbol_engraver::Tab_staff_symbol_engraver ()
@@ -36,10 +31,12 @@ Tab_staff_symbol_engraver::Tab_staff_symbol_engraver ()
 
 #include "translator.icc"
 
-ADD_ACKNOWLEDGER (Tab_staff_symbol_engraver, grob);
+ADD_ACKNOWLEDGER (Tab_staff_symbol_engraver, staff_symbol);
 ADD_TRANSLATOR (Tab_staff_symbol_engraver,
-               /* doc */ "Create a staff-symbol, but look at stringTunings for the number of lines."
-               "staff lines.",
+               /* doc */
+               "Create a staff-symbol, but look at "
+               "stringTunings for the number of lines. "
+               ,
                /* create */ "StaffSymbol",
                /* accept */ "staff-span-event",
                /* read */ "stringTunings",
index fefc68e7f3ef460887c5cb7aa21e2fa0e083ae32..9439d6f6d710f0ea6c4ca8cc269b003f877f707b 100644 (file)
@@ -30,6 +30,7 @@ public:
   TRANSLATOR_DECLARATIONS (Volta_engraver);
 protected:
 
+  DECLARE_END_ACKNOWLEDGER (staff_symbol);
   DECLARE_ACKNOWLEDGER (staff_symbol);
   DECLARE_ACKNOWLEDGER (note_column);
   DECLARE_ACKNOWLEDGER (bar_line);
@@ -189,6 +190,13 @@ Volta_engraver::acknowledge_bar_line (Grob_info i)
     Volta_bracket_interface::add_bar (end_volta_span_, i.item ());
 }
 
+void
+Volta_engraver::acknowledge_end_staff_symbol (Grob_info i)
+{
+  if (i.grob ()->self_scm () == staff_)
+    staff_ = SCM_EOL;
+}
+
 void
 Volta_engraver::acknowledge_staff_symbol (Grob_info i)
 {
@@ -202,6 +210,7 @@ Volta_engraver::acknowledge_staff_symbol (Grob_info i)
     staff_ = i.grob ()->self_scm ();
 }
 
+
 void
 Volta_engraver::finalize ()
 {
@@ -244,6 +253,7 @@ Volta_engraver::stop_translation_timestep ()
   TODO: should attach volta to paper-column if no bar is found.
 */
 ADD_ACKNOWLEDGER (Volta_engraver, staff_symbol);
+ADD_END_ACKNOWLEDGER (Volta_engraver, staff_symbol);
 ADD_ACKNOWLEDGER (Volta_engraver, note_column);
 ADD_ACKNOWLEDGER (Volta_engraver, bar_line);
 ADD_TRANSLATOR (Volta_engraver,
index eccde2b154d664cd379cd669eeb5ebc1faf85820..70466e82cf30a2b123a038c24cb1775bc1ceedbc 100644 (file)
@@ -649,7 +649,6 @@ AncientRemoveEmptyStaffContext = \context {
   \alias "Staff"
   \name "TabStaff"
   \denies "Voice"
-  \remove "Staff_symbol_engraver"
   \consists "Tab_staff_symbol_engraver"
   
   \description "Context for generating tablature. [DOCME]"