]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/score-engraver.cc
* lily/grob.cc (Grob): idem. Plugs mem leaks.
[lilypond.git] / lily / score-engraver.cc
index 2227ee00ac0b17d014e7fc11940169ec54bfe6d0..221a32ec07fd4126aed3ad0aef2bbb8358359f40 100644 (file)
@@ -11,7 +11,6 @@
 #include "warn.hh"
 #include "main.hh"
 #include "system.hh"
-#include "item.hh"
 #include "score-engraver.hh"
 #include "paper-score.hh"
 #include "paper-column.hh"
 #include "context-def.hh"
 #include "staff-spacing.hh"
 #include "note-spacing.hh"
-#include "context.hh"
 #include "global-context.hh"
 
-
-
-
 /*
   TODO: the column creation logic is rather hairy. Revise it.
  */
@@ -49,10 +44,14 @@ Score_engraver::make_columns ()
       SCM nmp
        = updated_grob_properties (context (),
                                   ly_symbol2scm ("NonMusicalPaperColumn"));
+
+      Object_key const *key1 = context()->get_grob_key ("NonMusicalPaperColumn");
+      
       SCM pc = updated_grob_properties (context (),
                                        ly_symbol2scm ("PaperColumn"));
-      
-      set_columns (new Paper_column (nmp), new Paper_column (pc));
+      Object_key const *key2 = context()->get_grob_key ("PaperColumn");      
+      set_columns (new Paper_column (nmp, key1), new Paper_column (pc, key2));
+
 
       Grob_info i1;
       i1.grob_ = command_column_;
@@ -79,7 +78,7 @@ Score_engraver::prepare (Moment m)
   SCM w = m.smobbed_copy ();
   command_column_->set_property ("when", w);
   musical_column_->set_property ("when", w);
-  
+
   recurse_over_translators (context (), &Translator::start_translation_timestep, DOWN);
 }
 
@@ -100,22 +99,29 @@ Score_engraver::initialize ()
 {
   Font_metric *fm = all_fonts_global->find_afm ("feta20");
   if (!fm)
-    error (_f ("can't find `%s'", "feta20.afm")
-          + "\n" +_ ("Music font has not been installed properly.  Aborting"));
-
-  SCM pfa_path = ly_kpathsea_expand_path (scm_makfrom0str ("ecrm10.pfa"));
-  if (!scm_is_string (pfa_path))
-    error (_f ("can't find `%s'", "ecrm10.pfa")
-          + "\n" +_f ("Install the ec-mftraced package from %s. Aborting",
-                      "http://lilypond.org/download/fonts/"));
-   
-
+    error (_f ("cannot find `%s'", "feta20.afm")
+          + "\n"
+          + _ ("Music font has not been installed properly.")
+          + _ ("Aborting"));
+
+  if (!scm_is_string (ly_kpathsea_find_file (scm_makfrom0str ("ecrm10.pfa")))
+      && (!scm_is_string (ly_kpathsea_find_file (scm_makfrom0str ("lmr10.pfb")))))
+      error (_f ("cannot find `%s'", "ecrm10.pfa")
+            + "\n"
+            + _f ("cannot find `%s'", "lmr10.pfb")
+            + "\n"
+            + _f ("Install the ec-fonts-mftraced package from: %s.",
+                  "http://lilypond.org/download/fonts/")
+            + "\n"
+            + _ ("Aborting."));
+      
   pscore_ = new Paper_score;
-  pscore_->paper_ = dynamic_cast<Output_def*> (get_output_def ());
+  pscore_->layout_ = dynamic_cast<Output_def*> (get_output_def ());
 
   SCM props = updated_grob_properties (context (), ly_symbol2scm ("System"));
 
-  pscore_->typeset_line (new System (props));
+  Object_key const *sys_key = context()->get_grob_key ("System");
+  pscore_->typeset_line (new System (props, sys_key));
   
   make_columns ();
   system_ = pscore_->system_;
@@ -245,10 +251,10 @@ Score_engraver::try_music (Music *m)
   if (m->is_mus_type ("break-event"))
     {
       SCM pen = command_column_->get_property ("penalty");
-      Real total_penalty = ly_c_number_p (pen) ? scm_to_double (pen) : 0.0;
+      Real total_penalty = scm_is_number (pen) ? scm_to_double (pen) : 0.0;
 
       SCM mpen = m->get_property ("penalty");
-      if (ly_c_number_p (mpen))
+      if (scm_is_number (mpen))
        total_penalty += scm_to_double (mpen);
 
       command_column_->set_property ("penalty", scm_make_real (total_penalty));
@@ -258,9 +264,9 @@ Score_engraver::try_music (Music *m)
        forbid_breaks ();
 
       SCM page_pen = command_column_->get_property ("page-penalty");
-      Real total_pp = ly_c_number_p (page_pen) ? scm_to_double (page_pen) : 0.0;
+      Real total_pp = scm_is_number (page_pen) ? scm_to_double (page_pen) : 0.0;
       SCM mpage_pen = m->get_property ("page-penalty");
-      if (ly_c_number_p (mpage_pen))
+      if (scm_is_number (mpage_pen))
        total_pp += scm_to_double (mpage_pen);
       
       command_column_->set_property ("page-penalty", scm_make_real (total_pp));
@@ -291,6 +297,22 @@ Score_engraver::acknowledge_grob (Grob_info gi)
                                         ly_symbol2scm ("spacing-wishes"),
                                         gi.grob_);
     }
+
+  if (Axis_group_interface::has_interface (gi.grob_)
+      && gi.grob_->internal_has_interface (ly_symbol2scm ("vertically-spaceable-interface")))
+    {
+      SCM spaceable = get_property ("verticallySpacedContexts");
+      Context *orig = gi.origin_contexts (this)[0];
+      
+      if (scm_memq (ly_symbol2scm (orig->context_name ().to_str0()),
+                   spaceable) != SCM_BOOL_F)
+       {
+         Pointer_group_interface::add_grob (system_,
+                                            ly_symbol2scm ("spaceable-staves"),
+                                            gi.grob_);
+       }
+    }
+  
 }
 
 
@@ -307,6 +329,6 @@ ENTER_DESCRIPTION (Score_engraver,
 ,
 /* creats*/       "System PaperColumn NonMusicalPaperColumn", 
 /* accepts */     "break-event",
-/* acks  */       "note-spacing-interface staff-spacing-interface",
-/* reads */       "currentMusicalColumn currentCommandColumn",
+/* acks  */       "note-spacing-interface staff-spacing-interface axis-group-interface",
+/* reads */       "currentMusicalColumn currentCommandColumn verticallySpacedContexts",
 /* write */       "");