]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/engraver-group.cc
apply Julian's patch to fix install-info warnings
[lilypond.git] / lily / engraver-group.cc
index 71533cd116cd8e353d853285578ed287fc3344c6..a5782d23b0b8fbbcb8fa5272fb2cbdef77b389d2 100644 (file)
@@ -1,27 +1,85 @@
 /*
-  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--2011 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"
+#include "dispatcher.hh"
 #include "engraver-group.hh"
-
-#include "warn.hh"
-#include "paper-score.hh"
 #include "grob.hh"
-#include "context.hh"
+#include "paper-score.hh"
 #include "translator-dispatch-list.hh"
+#include "warn.hh"
+
+IMPLEMENT_LISTENER (Engraver_group, override);
+void
+Engraver_group::override (SCM sev)
+{
+  Stream_event *ev = unsmob_stream_event (sev);
+  
+  sloppy_general_pushpop_property (context (),
+                                  ev->get_property ("symbol"),
+                                  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);
+  
+  sloppy_general_pushpop_property (context (),
+                                  ev->get_property ("symbol"),
+                                  ev->get_property ("property-path"),
+                                  SCM_UNDEFINED);
+}
+
+void
+Engraver_group::connect_to_context (Context *c)
+{
+  Translator_group::connect_to_context (c);
+  c->event_source ()->add_listener (GET_LISTENER (override), ly_symbol2scm ("Override"));
+  c->event_source ()->add_listener (GET_LISTENER (revert), ly_symbol2scm ("Revert"));
+}
+
+void
+Engraver_group::disconnect_from_context ()
+{
+  context ()->event_source ()->remove_listener (GET_LISTENER (override), ly_symbol2scm ("Override"));
+  context ()->event_source ()->remove_listener (GET_LISTENER (revert), ly_symbol2scm ("Revert"));
+  Translator_group::disconnect_from_context ();
+}
 
 void
 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 ())
+    = dad_con
+    ? dynamic_cast<Engraver_group *> (dad_con->implementation ())
     : 0;
 
   if (dad_eng)
@@ -48,7 +106,7 @@ Engraver_group::acknowledge_grobs ()
       else
        continue;
 
-      SCM acklist = scm_hashq_ref (acknowledge_hash_table_drul_[info.start_end()],
+      SCM acklist = scm_hashq_ref (acknowledge_hash_table_drul_[info.start_end ()],
                                   nm, SCM_BOOL_F);
       
       Engraver_dispatch_list *dispatch
@@ -138,11 +196,18 @@ Engraver_group::Engraver_group ()
 #include "translator.icc"
 
 ADD_TRANSLATOR_GROUP (Engraver_group,
-                     /* doc */ "A group of engravers taken together",
-                     /* create */ "",
-                     /* accept */ "",
-                     /* read */ "",
-                     /* write */ "");
+                     /* doc */
+                     "A group of engravers taken together.",
+
+                     /* create */
+                     "",
+
+                     /* read */
+                     "",
+
+                     /* write */
+                     ""
+                     );
 
 void
 Engraver_group::derived_mark () const