From: Mike Solomon <mike@apollinemike.com>
Date: Sat, 26 Jan 2013 06:58:46 +0000 (+0100)
Subject: Deletes the Hara_kiri_engraver.
X-Git-Tag: release/2.17.11-1~6
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=80519507c1863ce885f9b28c36fd68fef4dbd85b;p=lilypond.git

Deletes the Hara_kiri_engraver.

Places this functionality in the Axis_group_engraver, simplifying
the code and making it easier to maintain.
---

diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc
index 3823c34984..a19ab52af8 100644
--- a/lily/axis-group-engraver.cc
+++ b/lily/axis-group-engraver.cc
@@ -17,9 +17,10 @@
   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "axis-group-engraver.hh"
+#include "engraver.hh"
 
 #include "axis-group-interface.hh"
+#include "hara-kiri-group-spanner.hh"
 #include "pointer-group-interface.hh"
 #include "context.hh"
 #include "international.hh"
@@ -28,11 +29,43 @@
 
 #include "translator.icc"
 
+/**
+   Put stuff in a Spanner with an Axis_group_interface.
+   Use as last element of a context.
+*/
+class Axis_group_engraver : public Engraver
+{
+protected:
+  Spanner *staffline_;
+  SCM interesting_;
+  vector<Grob *> elts_;
+  void process_music ();
+  virtual void finalize ();
+  DECLARE_ACKNOWLEDGER (grob);
+  void process_acknowledged ();
+  virtual Spanner *get_spanner ();
+  virtual void add_element (Grob *);
+  virtual bool must_be_last () const;
+  virtual void derived_mark () const;
+
+public:
+  TRANSLATOR_DECLARATIONS (Axis_group_engraver);
+};
+
+
 Axis_group_engraver::Axis_group_engraver ()
 {
   staffline_ = 0;
+  interesting_ = SCM_EOL;
+}
+
+void
+Axis_group_engraver::derived_mark () const
+{
+  scm_gc_mark (interesting_);
 }
 
+
 bool
 Axis_group_engraver::must_be_last () const
 {
@@ -48,6 +81,7 @@ Axis_group_engraver::process_music ()
       Grob *it = unsmob_grob (get_property ("currentCommandColumn"));
       staffline_->set_bound (LEFT, it);
     }
+  interesting_ = get_property ("keepAliveInterfaces");
 }
 
 Spanner *
@@ -82,6 +116,15 @@ Axis_group_engraver::acknowledge_grob (Grob_info i)
     return;
   }
   elts_.push_back (i.grob ());
+
+  if (staffline_ && to_boolean(staffline_->get_property("remove-empty")))
+    {
+      for (SCM s = interesting_; scm_is_pair (s); s = scm_cdr (s))
+        {
+          if (i.grob ()->internal_has_interface (scm_car (s)))
+            Hara_kiri_group_spanner::add_interesting_item (staffline_, i.grob ());
+        }
+    }
 }
 
 /*
@@ -131,7 +174,8 @@ ADD_TRANSLATOR (Axis_group_engraver,
                 "VerticalAxisGroup ",
 
                 /* read */
-                "currentCommandColumn ",
+                "currentCommandColumn "
+                "keepAliveInterfaces ",
 
                 /* write */
                 ""
diff --git a/lily/hara-kiri-engraver.cc b/lily/hara-kiri-engraver.cc
deleted file mode 100644
index 243d9cbaf5..0000000000
--- a/lily/hara-kiri-engraver.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-  This file is part of LilyPond, the GNU music typesetter.
-
-  Copyright (C) 2005--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
-  LilyPond is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LilyPond is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "axis-group-engraver.hh"
-#include "hara-kiri-group-spanner.hh"
-#include "rhythmic-head.hh"
-#include "spanner.hh"
-
-#include "translator.icc"
-
-/*
-  TODO: fold together with axis_group_engraver?
- */
-
-class Hara_kiri_engraver : public Axis_group_engraver
-{
-protected:
-  virtual Spanner *get_spanner ();
-  DECLARE_ACKNOWLEDGER (grob);
-  virtual void add_element (Grob *e);
-  void process_music ();
-  virtual void derived_mark () const;
-  SCM interesting_;
-public:
-  TRANSLATOR_DECLARATIONS (Hara_kiri_engraver);
-};
-
-Hara_kiri_engraver::Hara_kiri_engraver ()
-{
-  interesting_ = SCM_EOL;
-}
-
-void
-Hara_kiri_engraver::derived_mark () const
-{
-  scm_gc_mark (interesting_);
-}
-
-void
-Hara_kiri_engraver::process_music ()
-{
-  Axis_group_engraver::process_music ();
-  interesting_ = get_property ("keepAliveInterfaces");
-}
-
-void
-Hara_kiri_engraver::add_element (Grob *e)
-{
-  Axis_group_engraver::add_element (e);
-}
-
-Spanner *
-Hara_kiri_engraver::get_spanner ()
-{
-  Spanner *sp = make_spanner ("VerticalAxisGroup", SCM_EOL);
-  return sp;
-}
-
-void
-Hara_kiri_engraver::acknowledge_grob (Grob_info i)
-{
-  Axis_group_engraver::acknowledge_grob (i);
-  if (staffline_)
-    {
-      for (SCM s = interesting_; scm_is_pair (s); s = scm_cdr (s))
-        {
-          if (i.grob ()->internal_has_interface (scm_car (s)))
-            Hara_kiri_group_spanner::add_interesting_item (staffline_, i.grob ());
-        }
-    }
-}
-
-ADD_ACKNOWLEDGER (Hara_kiri_engraver, grob);
-ADD_TRANSLATOR (Hara_kiri_engraver,
-                /* doc */
-                "Like @code{Axis_group_engraver}, but make a hara-kiri"
-                " spanner, and add interesting items (i.e., note heads, lyric"
-                " syllables, and normal rests).",
-
-                /* create */
-                "VerticalAxisGroup ",
-
-                /* read */
-                "keepAliveInterfaces ",
-
-                /* write */
-                ""
-               );
-
diff --git a/lily/include/axis-group-engraver.hh b/lily/include/axis-group-engraver.hh
deleted file mode 100644
index 9f87aa3e52..0000000000
--- a/lily/include/axis-group-engraver.hh
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  This file is part of LilyPond, the GNU music typesetter.
-
-  Copyright (C) 2005--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
-  LilyPond is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LilyPond is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef AXIS_GROUP_ENGRAVER_HH
-#define AXIS_GROUP_ENGRAVER_HH
-
-#include "engraver.hh"
-
-/**
-   Put stuff in a Spanner with an Axis_group_interface.
-   Use as last element of a context.
-*/
-class Axis_group_engraver : public Engraver
-{
-protected:
-  Spanner *staffline_;
-  vector<Grob *> elts_;
-  void process_music ();
-  virtual void finalize ();
-  DECLARE_ACKNOWLEDGER (grob);
-  void process_acknowledged ();
-  virtual Spanner *get_spanner ();
-  virtual void add_element (Grob *);
-  virtual bool must_be_last () const;
-
-public:
-  TRANSLATOR_DECLARATIONS (Axis_group_engraver);
-};
-#endif /* AXIS_GROUP_ENGRAVER_HH */
diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh
index 9ecb1b44aa..e726c4abe5 100644
--- a/lily/include/lily-proto.hh
+++ b/lily/include/lily-proto.hh
@@ -80,7 +80,6 @@ class Grace_music;
 class Grob;
 class Grob_array;
 class Grob_info;
-class Hara_kiri_engraver;
 class Hara_kiri_line_group_engraver;
 class Includable_lexer;
 class Input;
diff --git a/ly/context-mods-init.ly b/ly/context-mods-init.ly
index c4378a8e66..b57fd71337 100644
--- a/ly/context-mods-init.ly
+++ b/ly/context-mods-init.ly
@@ -19,14 +19,6 @@
 \version "2.17.6"
 
 RemoveEmptyStaves = \with {
-  \remove "Axis_group_engraver"
-  % If RemoveEmptyStaves is called twice, two
-  % Hara_kiri_engravers would be added, which leads to a
-  % warning.
-  % This code makes sure that no previous Hara_kiri_engraver
-  % is left before adding a new one.
-  \remove "Hara_kiri_engraver"
-  \consists "Hara_kiri_engraver"
   \override VerticalAxisGroup.remove-empty = ##t
   \description "Remove staves which are considered to be empty according
 to the list of interfaces set by @code{keepAliveInterfaces}."
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index a786ebcb7e..cd25300e3f 100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -37,7 +37,7 @@
 
   \consists "Fretboard_engraver"
   \consists "Output_property_engraver"
-  \consists "Hara_kiri_engraver"
+  \consists "Axis_group_engraver"
   \consists "Separating_line_group_engraver"
   \consists "Font_size_engraver"
   \consists "Instrument_name_engraver"
@@ -441,7 +441,7 @@ printing of a single line of lyrics."
   \consists "Stanza_number_engraver"
   \consists "Instrument_name_engraver"
   \consists "Font_size_engraver"
-  \consists "Hara_kiri_engraver"
+  \consists "Axis_group_engraver"
   \consists "Pure_from_neighbor_engraver"
   searchForVoice = ##f
   %% explicitly set instrument, so it is not inherited from the parent
@@ -503,8 +503,9 @@ printing of a single line of lyrics."
   \consists "Output_property_engraver"
   \consists "Separating_line_group_engraver"
   \consists "Chord_name_engraver"
-  \consists "Hara_kiri_engraver"
+  \consists "Axis_group_engraver"
 %  \consists "Note_spacing_engraver"
+
   \override VerticalAxisGroup.remove-first = ##t
   \override VerticalAxisGroup.remove-empty = ##t
   \override VerticalAxisGroup.staff-affinity = #DOWN
@@ -767,7 +768,7 @@ automatically when an output definition (a @code{\\score} or
 
   \consists "Figured_bass_engraver"
   \consists "Separating_line_group_engraver"
-  \consists "Hara_kiri_engraver"
+  \consists "Axis_group_engraver"
 
   \override VerticalAxisGroup.remove-empty = ##t
   \override VerticalAxisGroup.remove-first = ##t
diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm
index 1aaf582cd7..f58237a708 100644
--- a/scm/define-context-properties.scm
+++ b/scm/define-context-properties.scm
@@ -635,7 +635,6 @@ proceeding to next time step.  This is an internal variable.")
      (graceSettings ,list? "Overrides for grace notes.  This property
 should be manipulated through the @code{add-grace-property} function.")
 
-
      (hasStaffSpacing ,boolean? "True if the current
 @code{CommandColumn} contains items that will affect spacing.")