From f84fa056117227739b77c1c50efc06e6ef4f32da Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 28 Sep 2003 22:27:52 +0000 Subject: [PATCH] * lily/skyline.cc (merge_skyline): new function (heighten_skyline): new function * lily/accidental-placement.cc (position_accidentals) (position_accidentals): fix todo. --- ChangeLog | 16 ++++++++ GNUmakefile.in | 9 ---- input/regression/+.ly | 23 ++++------- input/regression/accidental-placement.ly | 2 +- input/regression/bar-scripts.ly | 2 +- input/test/+.ly | 28 ++++--------- lily/accidental-placement.cc | 52 ++++++++---------------- lily/accidental.cc | 1 + lily/include/skyline.hh | 5 +++ lily/skyline.cc | 24 +++++++++++ 10 files changed, 81 insertions(+), 81 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6440f55d5..a9fdd433e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ +2003-09-29 Han-Wen Nienhuys + + * 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 + * 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 + * 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. " } - 4 + 4 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 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 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 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 *a1, Array const & a2, + Direction); void insert_extent_into_skyline (Array *line, Box b, Axis line_axis, Direction d); Array extents_to_skyline (Array const & extents, Axis a, Direction d); Array empty_skyline (Direction d); +void heighten_skyline (Array *buildings, Real ground); Real skyline_meshing_distance (Array const &buildings, Array 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 *line, Box b, Axis line_axis, } } +void +merge_skyline (Array * a1, + Array 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 empty_skyline (Direction d) @@ -125,6 +141,7 @@ extents_to_skyline (Array 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 *buildings, Real ground) +{ + for (int i = 0; i < buildings->size (); i++) + buildings->elem_ref (i).height_ += ground; +} -- 2.39.2