From: hanwen <hanwen>
Date: Sun, 28 Sep 2003 22:27:52 +0000 (+0000)
Subject: * lily/skyline.cc (merge_skyline): new function
X-Git-Tag: release/2.1.3~48
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d050f469677410c9c64f927bcf3bcfe5e8bf4ece;p=lilypond.git

* lily/skyline.cc (merge_skyline): new function
(heighten_skyline): new function

* lily/accidental-placement.cc (position_accidentals)
(position_accidentals): fix todo.
---

diff --git a/ChangeLog b/ChangeLog
index b6440f55d5..a9fdd433e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
+2003-09-29  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+	* lily/skyline.cc (merge_skyline): new function
+	(heighten_skyline): new function
+
+	* lily/accidental-placement.cc (position_accidentals) 
+	(position_accidentals): fix todo.
+
 2003-09-28  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+	* input/test/+.ly (texidoc): put version number inline.
+
+	* GNUmakefile.in: remove rsync-web target.
+	
+	* input/regression/bar-scripts.ly (onestaff): raggedright
+
+v/pri2003-09-28  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
 	* lily/*.cc: remove #if 0'd code in couple of places.
 
 	* lily/midi-stream.cc (operator <<): rewrite.
diff --git a/GNUmakefile.in b/GNUmakefile.in
index c69edbf9d9..5b2716a8e8 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -147,12 +147,3 @@ $(config_h): config.hh.in
 	@false
 
 
-# maybe move into private script?
-rsync-web:
-	cd out-www &&  mkdir web && tar  -xzf web.tar.gz -C web
-	cd out-www/web && \
-	chgrp -R lilypond . && \
-	chmod -R g+w .  && \
-	chmod 2775 `find -type d` . && \
-	rsync --delete --stats --progress -gorltvu -e ssh . x:/var/www/lilypond/doc/v$(MAJOR_VERSION).$(MINOR_VERSION)/
-	cd out-www && rm -rf web/
diff --git a/input/regression/+.ly b/input/regression/+.ly
index 6bb1c3596b..75438d20b4 100644
--- a/input/regression/+.ly
+++ b/input/regression/+.ly
@@ -5,30 +5,21 @@
 
 
 \header{
-texidoc = "
-@section Introduction
+texidoc =
 
-This document presents a brief overview of LilyPond features.  When the
+#(string-append "@section Introduction
+
+This document presents a feature test for
+LilyPond " (lilypond-version) ".  When the
 text correspond with the shown notation, we consider LilyPond Officially
 BugFree (tm).  This document is intended for finding bugs, and
 documenting bugfixes.
 
 TODO: order of tests (file names!), test only one feature per test.
 Smaller and neater tests.
-
-
-"
+")
 
 }
 
-\score { \context Lyrics \notes {
-    \property Score.RehearsalMark \set #'self-alignment-X = #LEFT
+\score { \context Lyrics \lyrics { " " }}
 
-\mark #(ly:export    (string-append "(For LilyPond version "
-(lilypond-version) ")"))
-s2
- }
- \paper { indent = 0.0\pt
- raggedright   = ##t 
- }
-}
diff --git a/input/regression/accidental-placement.ly b/input/regression/accidental-placement.ly
index 2bc6cfbc79..8de4a256c9 100644
--- a/input/regression/accidental-placement.ly
+++ b/input/regression/accidental-placement.ly
@@ -21,7 +21,7 @@ flats in a sixth should be staggered.  "
   <g! des'>
   <ges! es'!>
 }    
-    <cis d es fis gis ases bes ces d dis >4
+    <cis d es fis gis ases bes ces d e! >4
     <bes'! fis!>     
     <bes! cis!>
     <c! es ges beses>
diff --git a/input/regression/bar-scripts.ly b/input/regression/bar-scripts.ly
index c72b9482bc..8b55ed541b 100644
--- a/input/regression/bar-scripts.ly
+++ b/input/regression/bar-scripts.ly
@@ -1,4 +1,3 @@
-#(ly:set-option 'old-relative)
 \version "1.9.8"
 \header{
 texidoc="
@@ -9,6 +8,7 @@ knowing it.  Consequently, they fall over  often.
 "
 }
 
+\paper { raggedright = ##t }
 
 onestaff =  \new Staff\notes\relative c''  {
 	\property Staff.instr = instr
diff --git a/input/test/+.ly b/input/test/+.ly
index c764fabfbf..4440e73cbd 100644
--- a/input/test/+.ly
+++ b/input/test/+.ly
@@ -4,28 +4,16 @@
 %% other .texi documents too?
 
 \header{
-texidoc = "
+texidoc = #(string-append "
 @section Introduction
 
-This document tests all kinds of features, from simple to advanced,
-that are not really suited for the reference manual, and are not
-needed as a regression test.
-
-Here you may also find dirty tricks, or very the very latest features
-that have not been documented or fully implemented yet.
-
-"
+This document shows all kinds of tips and tricks, from simple to
+advanced.  Here you may also find dirty tricks, or very the very
+latest features that have not been documented or fully implemented
+yet. 
+This document is for LilyPond version 
+" (lilypond-version) ".")
 }
 
 
-\score { \context Lyrics \notes {
-    \property Score.RehearsalMark \set #'self-alignment-X = #LEFT
-
-\mark #(ly:export    (string-append "(For LilyPond version "
-(lilypond-version) ")"))
-s2
- }
- \paper { indent = 0.0\pt
- raggedright   = ##t 
- }
-}
+\score { \context Lyrics \lyrics {  " " } }
diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc
index db4d5cb438..763d6ea095 100644
--- a/lily/accidental-placement.cc
+++ b/lily/accidental-placement.cc
@@ -244,7 +244,7 @@ Accidental_placement::position_accidentals (Grob * me)
 
   /*
     TODO: there is a bug in this code. If two accs are on the same
-    Y-position, they share an Ape, and will be pritned in overstrike.
+    Y-position, they share an Ape, and will be printed in overstrike.
    */
   Link_array<Accidental_placement_entry> apes;
   for (SCM s = accs; gh_pair_p (s); s =gh_cdr (s))
@@ -378,43 +378,27 @@ Accidental_placement::position_accidentals (Grob * me)
   if (gh_number_p (spad))
     padding = gh_scm2double (spad);
 
-
+  Array<Skyline_entry> left_skyline = head_ape->left_skyline_;
   /*
-    TODO:
-
-    There is a bug in this code: the left_skylines should be
-    accumulated, otherwise the b will collide with bb in
-
-      bb
-    b 
-      n 
-    
+    Add accs entries right-to-left.
    */
-  apes.push (head_ape);
-  for (int i= apes.size () -1 ; i-- > 0;)
+  for (int i= apes.size (); i-- > 0;)
     {
-      Accidental_placement_entry *ape = apes[i];
-      Real d = 0.0;
-      int j = i+1;
-      do {
-	d = - skyline_meshing_distance (ape->right_skyline_,
-					apes[j]->left_skyline_);
-
-	if (!isinf(d)
-	    || j + 1 == apes.size())
-	  break;
-	
-	j = j+ 1;
-      } while (1);
-
-      if (isinf(d))
-	d = 0.0;
-      
-      d -= padding;
-      ape->offset_ += apes[j]->offset_ + d;
-    }
+      Real offset =
+	-skyline_meshing_distance (apes[i]->right_skyline_, left_skyline);
+      if (isinf (offset))
+	offset = (i < apes.size ()) ? apes[i+1]->offset_ : 0.0;
+      else
+	offset -= padding;
+
+      apes[i]->offset_ = offset;
+
+      Array<Skyline_entry> new_left_skyline = apes[i]->left_skyline_;
+      heighten_skyline (&new_left_skyline, apes[i]->offset_);
+      merge_skyline (&new_left_skyline, left_skyline, LEFT);
+      left_skyline = new_left_skyline;
+    }      
 
-  apes.pop();
   for (int i = apes.size(); i--;)
     {
       Accidental_placement_entry* ape = apes[i];
diff --git a/lily/accidental.cc b/lily/accidental.cc
index fa4c08407c..3daa6f26c2 100644
--- a/lily/accidental.cc
+++ b/lily/accidental.cc
@@ -85,6 +85,7 @@ Accidental_interface::accurate_boxes (Grob *a,Grob**common)
 	  boxes.push (bulb);
 	  boxes.push (stem);
 	}
+      
       /*
 	TODO: add support for natural, double flat.
        */
diff --git a/lily/include/skyline.hh b/lily/include/skyline.hh
index 9577755233..8d8a640c7b 100644
--- a/lily/include/skyline.hh
+++ b/lily/include/skyline.hh
@@ -21,11 +21,16 @@ struct Skyline_entry
 };
 
 
+
+void
+merge_skyline (Array<Skyline_entry> *a1, Array<Skyline_entry> const  & a2,
+	       Direction);
 void insert_extent_into_skyline (Array<Skyline_entry> *line, Box b, Axis line_axis,
 				 Direction d);
 Array<Skyline_entry>
 extents_to_skyline (Array<Box> const & extents, Axis a, Direction d);
 Array<Skyline_entry> empty_skyline (Direction d);
+void heighten_skyline (Array<Skyline_entry> *buildings, Real ground);
 Real
 skyline_meshing_distance (Array<Skyline_entry> const &buildings,
 			  Array<Skyline_entry> const &clouds);
diff --git a/lily/skyline.cc b/lily/skyline.cc
index 65f267aa17..1cc6b6877e 100644
--- a/lily/skyline.cc
+++ b/lily/skyline.cc
@@ -89,6 +89,22 @@ insert_extent_into_skyline (Array<Skyline_entry> *line, Box b, Axis line_axis,
     }
 }
 
+void
+merge_skyline (Array<Skyline_entry> * a1,
+	       Array<Skyline_entry> const  & a2,
+	       Direction dir)
+{
+  for (int i = 0; i < a2.size(); i++)
+    {
+      Box b;
+      b[X_AXIS] = a2[i].width_;
+      b[Y_AXIS][dir] = a2[i].height_;
+      b[Y_AXIS][-dir] = dir * infinity_f ;
+
+      insert_extent_into_skyline (a1, b, X_AXIS, dir);
+    }
+}
+
 
 Array<Skyline_entry>
 empty_skyline (Direction d)
@@ -125,6 +141,7 @@ extents_to_skyline (Array<Box> const &extents, Axis a, Direction d)
 }
 
 
+
 /*
   minimum distance that can be achieved between baselines. "Clouds" is
   a skyline pointing down.
@@ -172,3 +189,10 @@ Skyline_entry::Skyline_entry (Interval i, Real r)
   height_ = r;
   
 }
+
+void
+heighten_skyline (Array<Skyline_entry> *buildings, Real ground)
+{
+  for (int i = 0; i < buildings->size (); i++)
+    buildings->elem_ref (i).height_ += ground; 
+}