]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/engraver-group.cc
Run grand replace for 2015.
[lilypond.git] / lily / engraver-group.cc
index eaa025dd174517e2b9ed8d30162ee6ee0aaa3f02..3fc8cf2f85c11f7d324d3261cd3c722e900bca7e 100644 (file)
@@ -1,15 +1,27 @@
 /*
-  engraver-group.cc -- implement Engraver_group
+  This file is part of LilyPond, the GNU music typesetter.
 
-  source file of the GNU LilyPond music typesetter
+  Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
-  (c) 1997--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 "context.hh"
 #include "dispatcher.hh"
 #include "engraver-group.hh"
 #include "grob.hh"
+#include "grob-properties.hh"
 #include "paper-score.hh"
 #include "translator-dispatch-list.hh"
 #include "warn.hh"
@@ -18,24 +30,21 @@ IMPLEMENT_LISTENER (Engraver_group, override);
 void
 Engraver_group::override (SCM sev)
 {
-  Stream_event *ev = unsmob_stream_event (sev);
-  
-  execute_general_pushpop_property (context (),
-                                   ev->get_property ("symbol"),
-                                   ev->get_property ("property-path"),
-                                   ev->get_property ("value"));
+  Stream_event *ev = Stream_event::unsmob (sev);
+
+  Grob_property_info (context (), ev->get_property ("symbol"))
+    .push (ev->get_property ("property-path"),
+           ev->get_property ("value"));
 }
 
 IMPLEMENT_LISTENER (Engraver_group, revert);
 void
 Engraver_group::revert (SCM sev)
 {
-  Stream_event *ev = unsmob_stream_event (sev);
-  
-  execute_general_pushpop_property (context (),
-                                   ev->get_property ("symbol"),
-                                   ev->get_property ("property-path"),
-                                   SCM_UNDEFINED);
+  Stream_event *ev = Stream_event::unsmob (sev);
+
+  Grob_property_info (context (), ev->get_property ("symbol"))
+    .pop (ev->get_property ("property-path"));
 }
 
 void
@@ -59,10 +68,17 @@ Engraver_group::announce_grob (Grob_info info)
 {
   announce_infos_.push_back (info);
 
+  Context *dad_con = context_->get_parent_context ();
+  if (info.rerouting_daddy_context_)
+    {
+      dad_con = info.rerouting_daddy_context_;
+      info.rerouting_daddy_context_ = 0;
+    }
+
   Engraver_group *dad_eng
-    = context_->get_parent_context ()
-    ? dynamic_cast<Engraver_group *> (context_->get_parent_context ()->implementation ())
-    : 0;
+    = dad_con
+      ? dynamic_cast<Engraver_group *> (dad_con->implementation ())
+      : 0;
 
   if (dad_eng)
     dad_eng->announce_grob (info);
@@ -75,40 +91,39 @@ Engraver_group::acknowledge_grobs ()
     return;
 
   SCM name_sym = ly_symbol2scm ("name");
-  SCM meta_sym = ly_symbol2scm ("meta");
 
   for (vsize j = 0; j < announce_infos_.size (); j++)
     {
       Grob_info info = announce_infos_[j];
-      
-      SCM meta = info.grob ()->internal_get_property (meta_sym);
+
+      SCM meta = info.grob ()->get_property ("meta");
       SCM nm = scm_assoc (name_sym, meta);
       if (scm_is_pair (nm))
-       nm = scm_cdr (nm);
+        nm = scm_cdr (nm);
       else
-       continue;
+        continue;
 
       SCM acklist = scm_hashq_ref (acknowledge_hash_table_drul_[info.start_end ()],
-                                  nm, SCM_BOOL_F);
-      
+                                   nm, SCM_BOOL_F);
+
       Engraver_dispatch_list *dispatch
-       = Engraver_dispatch_list::unsmob (acklist);
+        = Engraver_dispatch_list::unsmob (acklist);
 
       if (acklist == SCM_BOOL_F)
-       {
-         SCM ifaces
-           = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta));
-         acklist = Engraver_dispatch_list::create (get_simple_trans_list (),
-                                                   ifaces, info.start_end ());
+        {
+          SCM ifaces
+            = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta));
+          acklist = Engraver_dispatch_list::create (get_simple_trans_list (),
+                                                    ifaces, info.start_end ());
 
-         dispatch
-           = Engraver_dispatch_list::unsmob (acklist);
+          dispatch
+            = Engraver_dispatch_list::unsmob (acklist);
 
-         scm_hashq_set_x (acknowledge_hash_table_drul_[info.start_end ()], nm, acklist);
-       }
+          scm_hashq_set_x (acknowledge_hash_table_drul_[info.start_end ()], nm, acklist);
+        }
 
       if (dispatch)
-       dispatch->apply (info);
+        dispatch->apply (info);
     }
 }
 
@@ -123,12 +138,12 @@ Engraver_group::pending_grob_count () const
   for (SCM s = context_->children_contexts ();
        scm_is_pair (s); s = scm_cdr (s))
     {
-      Context *c = unsmob_context (scm_car (s));
+      Context *c = Context::unsmob (scm_car (s));
       Engraver_group *group
-       = dynamic_cast<Engraver_group *> (c->implementation ());
+        = dynamic_cast<Engraver_group *> (c->implementation ());
 
       if (group)
-       count += group->pending_grob_count ();
+        count += group->pending_grob_count ();
     }
   return count;
 }
@@ -139,38 +154,37 @@ Engraver_group::do_announces ()
   do
     {
       /*
-       DOCME: why is this inside the loop? 
+        DOCME: why is this inside the loop?
        */
       for (SCM s = context ()->children_contexts ();
-          scm_is_pair (s); s = scm_cdr (s))
-       {
-         Context *c = unsmob_context (scm_car (s));
-         Engraver_group *group
-           = dynamic_cast<Engraver_group *> (c->implementation ());
-         if (group)
-           group->do_announces ();
-       }
-
-      
+           scm_is_pair (s); s = scm_cdr (s))
+        {
+          Context *c = Context::unsmob (scm_car (s));
+          Engraver_group *group
+            = dynamic_cast<Engraver_group *> (c->implementation ());
+          if (group)
+            group->do_announces ();
+        }
+
       while (1)
-       {
-         precomputed_translator_foreach (PROCESS_ACKNOWLEDGED);
-         if (announce_infos_.size () == 0)
-           break;
-
-         acknowledge_grobs ();
-         announce_infos_.clear ();
-       }
+        {
+          precomputed_translator_foreach (PROCESS_ACKNOWLEDGED);
+          if (announce_infos_.size () == 0)
+            break;
+
+          acknowledge_grobs ();
+          announce_infos_.clear ();
+        }
     }
   while (pending_grob_count () > 0);
 }
 
 Engraver_group::Engraver_group ()
 {
-  acknowledge_hash_table_drul_[LEFT] 
-    = acknowledge_hash_table_drul_[RIGHT] 
-    = SCM_EOL;
-  
+  acknowledge_hash_table_drul_[LEFT]
+    = acknowledge_hash_table_drul_[RIGHT]
+      = SCM_EOL;
+
   acknowledge_hash_table_drul_[LEFT] = scm_c_make_hash_table (61);
   acknowledge_hash_table_drul_[RIGHT] = scm_c_make_hash_table (61);
 }
@@ -178,18 +192,18 @@ Engraver_group::Engraver_group ()
 #include "translator.icc"
 
 ADD_TRANSLATOR_GROUP (Engraver_group,
-                     /* doc */
-                     "A group of engravers taken together.",
+                      /* doc */
+                      "A group of engravers taken together.",
 
-                     /* create */
-                     "",
+                      /* create */
+                      "",
 
-                     /* read */
-                     "",
+                      /* read */
+                      "",
 
-                     /* write */
-                     ""
-                     );
+                      /* write */
+                      ""
+                     );
 
 void
 Engraver_group::derived_mark () const