]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/simple-spacer.cc (add_columns): use binary search for
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 28 Nov 2004 12:12:07 +0000 (12:12 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 28 Nov 2004 12:12:07 +0000 (12:12 +0000)
setting column rods. Changes O(n^2) to O(n log(n)) for
constructing spacing problem from columns.
(add_columns): read allow-outside-line to make sure no texts stick
out.
(solve): Simple_spacer::is_active() only determines
satisfies_constraints_ for non-ragged typesetting.

* lily/simultaneous-music.cc (to_relative_octave): only set
old_relative_used if return pitch actually changed.

* scm/define-context-properties.scm
(all-user-translation-properties): change to match implementation.

* python/lilylib.py: Replace re.match by re.search and adds "-c
showpage" to the gs command line (Johannes Schindelin)

22 files changed:
ChangeLog
THANKS
flower/include/parray.hh
lily/accidental-placement.cc
lily/axis-group-engraver.cc
lily/axis-group-interface.cc
lily/bar-line.cc
lily/beam.cc
lily/bezier.cc
lily/binary-source-file.cc
lily/break-align-interface.cc
lily/custos.cc
lily/dimension-cache.cc
lily/grob.cc
lily/include/grob.hh
lily/score-engraver.cc
lily/simple-spacer.cc
lily/simultaneous-music.cc
mf/feta-test-generic.mf
python/lilylib.py
scm/define-context-properties.scm
scm/define-grob-properties.scm

index 7ab7307e708f1cea8f028ebb5594f6b6b2df8289..24489e3e89c00d8fcf00fe03fcc4c6f32c5839f1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2004-11-28  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * input/regression/spacing-stick-out.ly: new file.
+
+       * lily/simple-spacer.cc (add_columns): use binary search for
+       setting column rods. Changes O(n^2) to O(n log(n)) for
+       constructing spacing problem from columns.
+       (add_columns): read allow-outside-line to make sure no texts stick
+       out.
+       (solve): Simple_spacer::is_active() only determines
+       satisfies_constraints_ for non-ragged typesetting.
+
+       * lily/simultaneous-music.cc (to_relative_octave): only set
+       old_relative_used if return pitch actually changed.
+
+       * scm/define-context-properties.scm
+       (all-user-translation-properties): change to match implementation.
+
+       * python/lilylib.py: Replace re.match by re.search and adds "-c
+       showpage" to the gs command line (Johannes Schindelin)
+
+       * scm/framework-ps.scm (output-preview-framework): sanitize bbox
+       before processing. Prevents crash when inf is in the extent.
+
        * scm/define-markup-commands.scm (note-by-number): add "s" to
        "noteheads-" glyphname.
  
diff --git a/THANKS b/THANKS
index 54320d25a057644f5855f75952233255f0b2266b..c421f10db8effff4f531d922188cc8d790fde6d1 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -23,6 +23,7 @@ Jonathan Walther
 
 BUG HUNTERS/SUGGESTIONS
 
+Johannes Schindelin
 Andreas Scherer
 Arjan Bos
 Fernando Pablo Lopez-Lezcano
index f70d2197b29915a938db8709926d2dbe89374683..67ce868a7068c2c31e84d30fd431e30413a7d18d 100644 (file)
@@ -235,7 +235,7 @@ junk_pointers (Link_array<T> &a)
 */
 template<class T>
 int
-binsearchs (Array<T> const &arr, T t, int (*compare) (T const&,T const&))
+binsearch (Array<T> const &arr, T t, int (*compare) (T const&,T const&))
 {
   int lo;
   int hi;
index b88e6f94cae5d5fefb000a02f6ca55cf494c8424..8845454aa172dc21c29eb4796583cd10f3d75f01 100644 (file)
@@ -7,10 +7,10 @@
 
 */
 
-#include "accidental-placement.hh"
-
 #include <cmath>
 
+
+#include "accidental-placement.hh"
 #include "libc-extension.hh"   // isinf
 #include "skyline.hh"
 #include "music.hh"
index c4967edfd3a134f3f3b3c0552d3b37440d02b85f..76f1fda1b2b0ac9901057ed886097c6dfb9903e3 100644 (file)
@@ -44,9 +44,7 @@ Axis_group_engraver::process_music ()
   if (!staffline_)
     {
       staffline_ = get_spanner ();
-
       Grob *  it = unsmob_grob (get_property ("currentCommandColumn"));
-
       staffline_->set_bound (LEFT,it);
     }
 } 
@@ -106,9 +104,7 @@ Axis_group_engraver::process_acknowledged_grobs ()
   
   for (int i=0; i < elts_.size (); i++)
     {
-      Grob *par = elts_[i]->get_parent (Y_AXIS);
-
-      if (!par || !Axis_group_interface::has_interface (par))
+      if  (!unsmob_grob (elts_[i]->get_property ("axis-group-parent-Y")))
        {
          if (staffline_->get_parent (Y_AXIS)
              && staffline_->get_parent (Y_AXIS) == elts_[i])
index fbac83ee5bcb152af29540b746e04bd5f2404cf2..6a336f1efe448f0f79573e4593509e398647cdec 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #include "axis-group-interface.hh"
-
 #include "hara-kiri-group-spanner.hh"
 
 void
@@ -20,8 +19,14 @@ Axis_group_interface::add_element (Grob*me,Grob *e)
       
       if (!e->get_parent (a))
        e->set_parent (me, a);
-    }
 
+      e->internal_set_property ((a == X_AXIS)
+                               ? ly_symbol2scm ("axis-group-parent-X")
+                               : ly_symbol2scm ("axis-group-parent-Y"),
+                               me->self_scm ()
+                               );
+    }
+    
   Pointer_group_interface::add_grob (me, ly_symbol2scm ("elements"), e);
   me->add_dependency (e);
 }
index 54c1321ac3e2e290870e811f1f2d4b3e1faf0d9d..3489aff6bed436bb05e199ff5c035b0f5a62d1a1 100644 (file)
@@ -6,10 +6,10 @@
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "bar-line.hh"
 
 #include <cmath>
 
+#include "bar-line.hh"
 #include "lookup.hh"
 #include "paper-column.hh"
 #include "output-def.hh"
index d5ee204fd0c58298aadb6b27c081418afcc95709..92d9f4979efb1b0cfe3d8bf725caccd6a1cb79ee 100644 (file)
@@ -26,10 +26,10 @@ Notes:
 */
 
 
-#include "beam.hh"
 
 #include <cmath> // tanh.
 
+#include "beam.hh"
 #include "interval-set.hh"
 #include "directional-element-interface.hh"
 #include "beaming.hh"
index 40fd5f7ac0e6eba179365b9e6cbbd7e187460f75..806d3855310c840d9372e7fd961d408b8434d99a 100644 (file)
@@ -6,10 +6,10 @@
   (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#include "bezier.hh"
 
 #include <cmath>
 
+#include "bezier.hh"
 #include "warn.hh"
 #include "libc-extension.hh"
 
index 2e45fb557c93e9b2e12e631d6c3446675fc688dc..403547222786e55e2ecf70ccd3d44b7061f1579a 100644 (file)
@@ -6,11 +6,9 @@
   (c) 1997--2004 Jan Nieuwenhuizen
 */
 
-
-#include "binary-source-file.hh"
-
 #include <climits>             // INT_MAX
 
+#include "binary-source-file.hh"
 #include "string-convert.hh"
 
 Binary_source_file::Binary_source_file (String& file_name_string)
index c8ed412989304970bbba112465bdde5266285a29..b3f5a786a91ce99a36e862d4506490ada186753e 100644 (file)
@@ -6,10 +6,10 @@
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "break-align-interface.hh"
 
 #include <cmath>
 
+#include "break-align-interface.hh"
 #include <libc-extension.hh>   // isinf
 
 #include "self-alignment-interface.hh"
index 8ea02b4b1cd69352b2291f407d18949e90fce6e0..758890fdf1460d3558e0224a75222db7fe518367 100644 (file)
 
 */
 
-#include "custos.hh"
-
 #include <cstdio>
 #include <cmath> // rint
 
+#include "custos.hh"
 #include "direction.hh"
 #include "staff-symbol-referencer.hh"
 #include "warn.hh"
index 8a1140c290b14431c365e518d840cd05af61fd2b..052764232585b7efbbd661cb6bca62f64f5bbf68 100644 (file)
@@ -6,10 +6,10 @@
   (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
  */
 
-#include "dimension-cache.hh"
 
 #include <cmath>
 
+#include "dimension-cache.hh"
 #include "warn.hh"
 #include "grob.hh"
 
index c2d6a2d049f71a521f6f2c368b8d597103d7ebc8..030ce6ce6bc787773e45dd33d161a904d0d512d0 100644 (file)
@@ -660,6 +660,13 @@ Grob::internal_has_interface (SCM k)
   return scm_c_memq (k, ifs) != SCM_BOOL_F;
 }
 
+Grob*
+Grob::get_parent (Axis a) const
+{
+  return  dim_cache_[a].parent_;
+}
+
+
 /** Return Array of Grobs in SCM list LST */
 Link_array<Grob>
 ly_scm2grobs (SCM lst)
@@ -731,8 +738,11 @@ ADD_INTERFACE (Grob, "grob-interface",
               "Y-extent-callback print-function extra-offset spacing-procedure "
               "context staff-symbol interfaces dependencies X-extent Y-extent extra-X-extent "
               "meta layer before-line-breaking-callback "
+              "axis-group-parent-X "
+              "axis-group-parent-Y "
               "after-line-breaking-callback extra-Y-extent minimum-X-extent "
               "minimum-Y-extent transparent tweak-count tweak-rank"
               );
 
 
+
index 503f5c307b330173d37cf7c1ceeda2a6b44fbb84..f77bd094800fe85269b8aaf44ac06cb0d26bcc96 100644 (file)
@@ -125,11 +125,7 @@ public:
   void set_parent (Grob* e, Axis);
 
   // URG
-  Grob *get_parent (Axis a) const
-  {
-    return  dim_cache_[a].parent_;
-  }
-
+  Grob *get_parent (Axis a) const;
   DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM));
 };
 
index 221a32ec07fd4126aed3ad0aef2bbb8358359f40..bfd7c065c674a0541962a46bfdf69e233aef2723 100644 (file)
@@ -177,7 +177,9 @@ Score_engraver::typeset_all ()
       
       if (dynamic_cast<Item*> (elem)) 
        {
-         if (!elem->get_parent (X_AXIS)
+         if (
+             (!elem->get_parent (X_AXIS)
+              || !unsmob_grob  (elem->get_property ("axis-group-parent-X")))
              && elem != command_column_
              && elem != musical_column_
              )
index 5a03cbb483f9f4c2199a0cc9dbe9d6701e5cd821..cada127e14cdd28f334c4268b7f6adc32ced487c 100644 (file)
@@ -408,12 +408,11 @@ Simple_spacer_wrapper::solve (Column_x_positions *positions, bool ragged)
       positions->satisfies_constraints_ = 
        positions->config_.top () < spacer_->line_len_ ;
     }
-
+  else
+    positions->satisfies_constraints_ = spacer_->is_active ();
 
   positions->cols_ = spaced_cols_;
   positions->loose_cols_ = loose_cols_;
-  positions->satisfies_constraints_ =
-    positions->satisfies_constraints_ && spacer_->is_active ();
 
   /*
     Check if breaking constraints are met.
@@ -468,6 +467,13 @@ Simple_spacer::add_spring (Real ideal, Real hooke)
   springs_.push (desc);
 }
 
+static int
+compare_paper_column_rank (Grob  *const &a,
+                          Grob  *const &b)
+{
+  return Paper_column::get_rank (a) - Paper_column::get_rank (b); 
+}
+
 void
 Simple_spacer_wrapper::add_columns (Link_array<Grob> const &icols)
 {
@@ -513,12 +519,20 @@ Simple_spacer_wrapper::add_columns (Link_array<Grob> const &icols)
           scm_is_pair (s); s = scm_cdr (s))
        {
          Grob * other = unsmob_grob (scm_caar (s));
-         int oi = cols.find_index (other);
+         int oi = binsearch_links (cols, other, &compare_paper_column_rank);
          if (oi >= 0)
            {
              spacer_->add_rod (i, oi, scm_to_double (scm_cdar (s)));
            }
        }
+
+      if (i
+         && !to_boolean  (cols[i]->get_property ("allow-outside-line")))
+       {
+         Interval e = cols[i]->extent (cols[i], X_AXIS);
+         spacer_->add_rod (i, cols.size()-1, e[RIGHT]);
+         spacer_->add_rod (0, i, e[LEFT]);
+       }
     }
 }
 
index 7e2a480e5460825005146264bf6cc3e07c742b66..ccf3287ab511202b73d61e397522acc1e7909834 100644 (file)
@@ -32,10 +32,17 @@ Simultaneous_music::Simultaneous_music ()
 Pitch
 Simultaneous_music::to_relative_octave (Pitch p)
 {
+  Pitch retval = music_list_to_relative (music_list (), p, false);
   if (lily_1_8_relative)
-    lily_1_8_compatibility_used = true;
-  
-  return music_list_to_relative (music_list (), p, lily_1_8_relative);
+    {
+      Pitch retval_1_8 = music_list_to_relative (music_list (), p, true);
+      if (retval_1_8 != retval)
+       lily_1_8_compatibility_used = true;
+
+      retval = retval_1_8;
+    }
+
+  return retval;
 }
 
 ADD_MUSIC (Simultaneous_music);
index e14b4e6cc3d4a6da977a3935db29e6c53ab3adfc..ae432902d8b57bce1405410b429e760d4f5f4e60 100644 (file)
@@ -3,44 +3,64 @@
 % in a separate file to avoid tainting non-test font files for testing.
 %
 %
-
-
-fet_beginchar("espr", "espr", "espressivo")
+fet_beginchar("> accent", "sforzato", "sforzatoaccent")
        set_char_box(.9 staff_space#, .9 staff_space#, .5 staff_space#, .5 staff_space#);
        save thickness, diminish;
+
        thickness = 0.05 staff_space + linethickness;
        pickup pencircle scaled thickness;
-       t = thickness;
-       diminish = .75;
-       top z1 =(0.2 staff_space,h);
-       rt z3 =(w*2,0);
-       bot y5 =-h;
-       x5 = x1;
-       x2 = .5[x1,x3];
-       x4 = .5[x5,x3];
-       z2 = whatever[z1,z3];
-       z4 = whatever[z5,z3];
-       penpos1(t,90);
-       penpos2(t,90);
-       penpos5(t,90);
-       penpos4(t,90);
-       penpos3(diminish*t,90);
-       draw z1 .. z2;
-       draw z5 .. z4;
-       penstroke z4e .. z3e;
-       penstroke z2e .. z3e;
-       draw (z1 .. z2) xscaled -1;
-       draw (z5 .. z4) xscaled -1;
-       penstroke (z4e .. z3e) xscaled -1;
-       penstroke (z2e .. z3e) xscaled -1;
-       penlabels(1,2,3,4,5);
-       pickup pencircle scaled (diminish* thickness);
-       draw z3;
-       draw z3 xscaled -1;
 
+       % prevent blobs at crossing lines
+       diminish = 1.0;
+
+       top y1 = h;
+       lft x1 = -b;
+       rt x2 = w;
+       y2 = .25 thickness* diminish;
+
+       rt z4 = (w,0);
+       x3 = - linethickness + 0.1 staff_space;
+       z3 = whatever [z1, z4];
+
+       penpos2(thickness*(2 - diminish)/2 , 90);
+       penpos1(thickness, 90);
+       penpos3(thickness, 90);
+
+       draw z1 .. z3;
+       draw (z1 .. z3) yscaled -1;
+       draw z4;
+       penstroke z3e .. z2e;
+       penstroke (z3e .. z2e) yscaled -1;
+
+       penlabels(1,2,3);
+       labels(4);
 fet_endchar;
 
 
+fet_beginchar("espr", "espr", "espressivo")
+       set_char_box(1.9 staff_space#, 1.9 staff_space#, .5 staff_space#, .5 staff_space#);
+       save thickness, diminish;
+       thickness = 0.05 staff_space + linethickness;
+       pickup pencircle scaled thickness;
+       t = thickness;
+       diminish = .1;
+       top z1 =(0.2 staff_space,h);
+       rt z3 =(w,0);
+       x2 = .5[x1,x3];
+       z2 = whatever[z1,z3];
+       penpos1(t,90);
+       penpos2(t,90);
+       penpos3(diminish*t,90);
+       draw z1 .. z2;
+       penstroke z2e .. z3e;
+       penlabels(1,2,3);
+       pickup pencircle scaled (diminish* thickness);
+       draw z3;
+       addto currentpicture also currentpicture xscaled -1;
+       addto currentpicture also currentpicture yscaled -1;
+
+fet_endchar;
+
 input feta-bolletjes;  
 %input feta-banier;
 %input feta-slag;
index 0718cb64dbbafddedf01d8b55bdcc4fb0e0cdf6f..04efae76b1f87d6bb2b985a3f119c2e1d82bd894 100644 (file)
@@ -447,7 +447,7 @@ BOUNDING_BOX_RE = '^%%BoundingBox: (-?[0-9]+) (-?[0-9]+) (-?[0-9]+) (-?[0-9]+)'
 def get_bbox (filename):
        bbox = filename + '.bbox'
        ## -sOutputFile does not work with bbox?
-       cmd = 'gs -sDEVICE=bbox -q -dNOPAUSE %s -c quit 2>%s' % \
+       cmd = 'gs -sDEVICE=bbox -q -dNOPAUSE %s -c showpage -c quit 2>%s' % \
              (filename, bbox)
        system (cmd, progress_p = 1)
        box = open (bbox).read ()
@@ -467,7 +467,7 @@ def make_ps_images (ps_name, resolution = 90):
        
        header = open (ps_name).read (1024)
 
-       match = re.match (BOUNDING_BOX_RE, header)
+       match = re.search (BOUNDING_BOX_RE, header, re.MULTILINE)
        bbox = []
        if match:
                bbox = map (string.atoi, match.groups ())
@@ -501,7 +501,7 @@ def make_ps_images (ps_name, resolution = 90):
                if y == 0:
                        y = 1
 
-               cmd = r'''gs -g%dx%d -sDEVICE=pnggray  -dTextAlphaBits=4 -dGraphicsAlphaBits=4  -q -sOutputFile=%s -r%d -dNOPAUSE %s %s -c quit ''' % \
+               cmd = r'''gs -g%dx%d -sDEVICE=pnggray  -dTextAlphaBits=4 -dGraphicsAlphaBits=4  -q -sOutputFile=%s -r%d -dNOPAUSE %s %s -c showpage -c quit ''' % \
                      (x, y, output_file, resolution, trans_ps, ps_name)
 
                rms = glob.glob (base + '-page*.png')
@@ -513,7 +513,7 @@ def make_ps_images (ps_name, resolution = 90):
                if os.path.isfile (rmfile):
                        os.unlink (rmfile)
                
-               cmd = r'''gs -s  -sDEVICE=pnggray  -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=%s -dNOPAUSE -r%d %s -c quit''' % (output_file,
+               cmd = r'''gs -s  -sDEVICE=pnggray  -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=%s -dNOPAUSE -r%d %s -c showpage -c quit''' % (output_file,
                                                                                                                                      resolution, ps_name)
 
        status = system (cmd)
index 04334c50e53525a11f0fb4ccd9a54a0683e67add..3d13d2fe1f178ea150c5f43b36f405d725e37fc5 100644 (file)
@@ -300,8 +300,8 @@ context.")
      (rehearsalMark ,integer? "The last rehearsal mark printed.")
      (repeatCommands ,list? "This property is read to find any command of the form @code{(volta . @var{x})}, where @var{x} is a string or @code{#f}")
      (restNumberThreshold ,number?
-                         "If a multimeasure rest takes less
-than this number of measures, no number is printed. ")
+                         "If a multimeasure rest has more measures
+than this, a number is printed. ")
      (shapeNoteStyles ,vector? "Vector of symbols, listing style for each note
 head relative to the tonic (qv.) of the scale.")
      (skipBars ,boolean? "If set to true, then
index 757d91279fb4abe2e09865c5c099f725a1ff7b71..fca647c368230ae84916486fe7bd968e7b2d08d2 100644 (file)
@@ -268,7 +268,9 @@ slur. If set to false, the script places itself around the slur. If
 unset, script and slur ignore each other ")
      (inspect-quants ,number-pair? "If debugging is set,
 set beam quant to this position, and print the respective scores.")
-     
+
+     (allow-outside-line ,boolean? "If set, allow this column to
+things sticking into the margin.")
      (kern ,ly:dimension? "Amount of extra white space to add. For
 bar line, this is the amount of space after a thick line.")
      (knee ,boolean? "Is this beam kneed?")
@@ -516,7 +518,8 @@ sizes (like the dynamic @b{p} and @b{f}) on their baselines.")
      (apply define-internal-grob-property x))
    
    `(
-     
+     (axis-group-parent-X ,ly:grob? "Containing X axis group")
+     (axis-group-parent-Y ,ly:grob? "Containing Y axis group")
      (accidental-grobs ,list? "Alist with (NOTENAME . GROBLIST) entries")
      (adjacent-hairpins ,grob-list? "List of directly neighboring hairpins")
      (after-line-breaking-callback ,procedure? "This procedure is called after line breaking. Its return value is ignored.")