From d452f00742415cdda8ab0d086feb0317b0451e69 Mon Sep 17 00:00:00 2001
From: janneke <janneke>
Date: Tue, 9 Mar 2004 12:14:59 +0000
Subject: [PATCH] (get_line): Fix between-systems (NOT).

---
 ChangeLog              |  4 ++++
 lily/include/system.hh |  2 +-
 lily/system.cc         | 46 +++++++++++++++++++++++-------------------
 3 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3a05626927..a9bee9d47b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-03-09  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* lily/system.cc (get_line): Fix between-systems (NOT).
+
 2004-03-09  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
 	* ly/engraver-init.ly: don't remove slur engraver from DrumVoice.
diff --git a/lily/include/system.hh b/lily/include/system.hh
index 911aa0b792..515c9e1b1e 100644
--- a/lily/include/system.hh
+++ b/lily/include/system.hh
@@ -24,7 +24,7 @@ class System : public Spanner
 public:
   int rank_;
   void post_processing ();
-  SCM get_line ();
+  SCM get_line (bool);
   SCM get_lines ();
 
   System (SCM);
diff --git a/lily/system.cc b/lily/system.cc
index 2c221eefbf..5614b017df 100644
--- a/lily/system.cc
+++ b/lily/system.cc
@@ -187,34 +187,18 @@ System::get_lines ()
 
       if (verbose_global_b)
 	progress_indication ("[");
-      
-      // bool last = (i + 1 == line_count);
+
+      // urg between-systems hack
+      bool last = (i + 1 == line_count);
 
       system->post_processing ();
-      scm_vector_set_x (lines, scm_int2num (i), system->get_line ());
+      scm_vector_set_x (lines, scm_int2num (i), system->get_line (last));
 
       if (verbose_global_b)
 	{
 	  progress_indication (to_string (i));
 	  progress_indication ("]");
 	}
-
-#ifndef PAGE_LAYOUT
-      if (i < line_count - 1)
-	{
-	  SCM lastcol =  ly_car (system->get_property ("columns"));
-	  Grob*  e = unsmob_grob (lastcol);
-
-	  SCM between = ly_symbol2scm ("between-system-string");
-	  SCM inter = e->internal_get_property (between);
-	  if (gh_string_p (inter))
-	    {
-	      pscore_->outputter_
-		->output_scheme (scm_list_n (between, 
-					     inter, SCM_UNDEFINED));	      
-	    }
-	}
-#endif			
     }
    return lines;
 }
@@ -412,7 +396,7 @@ System::post_processing ()
    LINE: list of ((OFFSET-X . OFFSET-Y) . STENCIL)
    Maybe make clas/smob?  */
 SCM
-System::get_line ()
+System::get_line (bool is_last)
 {  
   static int const LAYER_COUNT = 3;
   SCM line = SCM_EOL;
@@ -420,6 +404,26 @@ System::get_line ()
     line = scm_cons (scm_cons (ly_offset2scm (Offset (0, 0)),
 			       me->smobbed_copy ()), line);
 
+  
+#ifndef PAGE_LAYOUT
+  // still does not work - do we really need this at all?
+  if (is_last)
+    {
+      SCM lastcol = ly_car (get_property ("columns"));
+      Grob *g = unsmob_grob (lastcol);
+      
+      SCM between = ly_symbol2scm ("between-system-string");
+      SCM inter = g->internal_get_property (between);
+      if (gh_string_p (inter))
+	{
+	  Stencil *stil = new Stencil (Box (), scm_list_2 (between, inter));
+	  line = scm_cons (scm_cons (ly_offset2scm (Offset (0, 0)),
+				     stil->smobbed_copy ()),
+			   line);
+	}
+    }
+#endif
+
   /* Output stencils in three layers: 0, 1, 2.  The default layer is
      1.  */
   for (int i = 0; i < LAYER_COUNT; i++)
-- 
2.39.5