]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/engraver-group.cc
unsmob_pitch -> Pitch::unsmob and related
[lilypond.git] / lily / engraver-group.cc
index 4c5a5864c3badc0553ed13588a35b64a3fd93b85..0eedd8a2ad3e1bd0f6bbc6d2d7ef23c0904ba483 100644 (file)
@@ -1,9 +1,20 @@
 /*
-  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--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
-  (c) 1997--2006 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"
@@ -19,11 +30,11 @@ 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"));
+
+  sloppy_general_pushpop_property (context (),
+                                   ev->get_property ("symbol"),
+                                   ev->get_property ("property-path"),
+                                   ev->get_property ("value"));
 }
 
 IMPLEMENT_LISTENER (Engraver_group, revert);
@@ -31,11 +42,11 @@ 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);
+
+  sloppy_general_pushpop_property (context (),
+                                   ev->get_property ("symbol"),
+                                   ev->get_property ("property-path"),
+                                   SCM_UNDEFINED);
 }
 
 void
@@ -59,10 +70,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);
@@ -80,35 +98,35 @@ Engraver_group::acknowledge_grobs ()
   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 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);
 
-      SCM acklist = scm_hashq_ref (acknowledge_hash_table_drul_[info.start_end()],
-                                  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 +141,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 +157,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,10 +195,18 @@ Engraver_group::Engraver_group ()
 #include "translator.icc"
 
 ADD_TRANSLATOR_GROUP (Engraver_group,
-                     /* doc */ "A group of engravers taken together",
-                     /* create */ "",
-                     /* read */ "",
-                     /* write */ "");
+                      /* doc */
+                      "A group of engravers taken together.",
+
+                      /* create */
+                      "",
+
+                      /* read */
+                      "",
+
+                      /* write */
+                      ""
+                     );
 
 void
 Engraver_group::derived_mark () const