]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/separating-line-group-engraver.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / separating-line-group-engraver.cc
index 31bd53a2d53f39cb53a1ee78183b70fe5bc12db1..fba16bebb90e77ea730a180022673be4168adac1 100644 (file)
@@ -1,9 +1,20 @@
 /*
-  separating-line-group-engraver.cc -- implement Separating_line_group_engraver
+  This file is part of LilyPond, the GNU music typesetter.
 
-  source file of the GNU LilyPond music typesetter
+  Copyright (C) 1998--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
-  (c) 1998--2007 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 "engraver.hh"
@@ -24,7 +35,7 @@
 struct Spacings
 {
   Item *staff_spacing_;
-  vector<Item*> note_spacings_;
+  vector<Item *> note_spacings_;
 
   Spacings ()
   {
@@ -49,8 +60,11 @@ protected:
   Spacings last_spacings_;
 
   DECLARE_ACKNOWLEDGER (item);
+  DECLARE_ACKNOWLEDGER (break_aligned);
   void stop_translation_timestep ();
   void start_translation_timestep ();
+
+  vector<Grob *> break_aligned_;
 public:
   TRANSLATOR_DECLARATIONS (Separating_line_group_engraver);
 };
@@ -80,27 +94,33 @@ Separating_line_group_engraver::acknowledge_item (Grob_info i)
       context ()->set_property ("hasStaffSpacing", SCM_BOOL_T);
 
       Pointer_group_interface::add_grob (current_spacings_.staff_spacing_,
-                                        ly_symbol2scm ("left-items"),
-                                        col);
-      
+                                         ly_symbol2scm ("left-items"),
+                                         col);
+
       if (!last_spacings_.note_spacings_.size ()
-         && last_spacings_.staff_spacing_)
-       {
-         SCM ri = last_spacings_.staff_spacing_->get_object ("right-items");
-         Grob_array *ga = unsmob_grob_array (ri);
-         if (!ga)
-           {
-             SCM ga_scm = Grob_array::make_array ();
-             last_spacings_.staff_spacing_->set_object ("right-items", ga_scm);
-             ga = unsmob_grob_array (ga_scm);
-           }
-         
-         ga->clear ();
-         ga->add (col);
-       }
+          && last_spacings_.staff_spacing_)
+        {
+          SCM ri = last_spacings_.staff_spacing_->get_object ("right-items");
+          Grob_array *ga = unsmob_grob_array (ri);
+          if (!ga)
+            {
+              SCM ga_scm = Grob_array::make_array ();
+              last_spacings_.staff_spacing_->set_object ("right-items", ga_scm);
+              ga = unsmob_grob_array (ga_scm);
+            }
+
+          ga->clear ();
+          ga->add (col);
+        }
     }
 }
 
+void
+Separating_line_group_engraver::acknowledge_break_aligned (Grob_info gi)
+{
+  break_aligned_.push_back (gi.grob ());
+}
+
 void
 Separating_line_group_engraver::start_translation_timestep ()
 {
@@ -110,6 +130,18 @@ Separating_line_group_engraver::start_translation_timestep ()
 void
 Separating_line_group_engraver::stop_translation_timestep ()
 {
+  for (vsize i = 0; i < break_aligned_.size (); i++)
+    {
+      SCM smob = break_aligned_[i]->self_scm ();
+
+      if (Item *sp = current_spacings_.staff_spacing_)
+        Pointer_group_interface::add_grob (sp, ly_symbol2scm ("left-break-aligned"), smob);
+
+      for (vsize j = 0; j < last_spacings_.note_spacings_.size (); j++)
+        Pointer_group_interface::add_grob (last_spacings_.note_spacings_[j],
+                                           ly_symbol2scm ("right-break-aligned"), smob);
+    }
+
   if (!current_spacings_.is_empty ())
     last_spacings_ = current_spacings_;
 
@@ -118,13 +150,22 @@ Separating_line_group_engraver::stop_translation_timestep ()
       Pointer_group_interface::add_grob (sp, ly_symbol2scm ("right-items"), col);
 
   current_spacings_.clear ();
+  break_aligned_.clear ();
 }
 
 ADD_ACKNOWLEDGER (Separating_line_group_engraver, item);
+ADD_ACKNOWLEDGER (Separating_line_group_engraver, break_aligned);
+
 ADD_TRANSLATOR (Separating_line_group_engraver,
-               /* doc */ "Generates objects for computing spacing parameters.",
+                /* doc */
+                "Generate objects for computing spacing parameters.",
+
+                /* create */
+                "StaffSpacing ",
+
+                /* read */
+                "createSpacing ",
 
-               /* create */ "StaffSpacing",
-               /* read */ "createSpacing",
-               /* write */ "hasStaffSpacing"
-               );
+                /* write */
+                "hasStaffSpacing "
+               );