]> git.donarmstrong.com Git - lilypond.git/commitdiff
* buildscripts/lilypond-profile.sh: error message if script is not
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 23 Jul 2003 13:18:25 +0000 (13:18 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 23 Jul 2003 13:18:25 +0000 (13:18 +0000)
sourced.

* lily/tuplet-bracket.cc (make_bracket): change edge-widen to
bracket-flare
(make_bracket): simplify code.

* lily/parser.yy (verbose_command_req): catch typos in \key scale
argument.

* python/lilylib.py (lilypond_version_check): new function

* scripts/lilypond-book.py (TexiPaper.incl_opt): idem

* scripts/ly2dvi.py (run_lilypond): add version check.

* scripts/lilypond-book.py (option_definitions): typo

* scripts/ly2dvi.py (include_path): typo

* Documentation/user/refman.itely: updates, fixes.

13 files changed:
ChangeLog
Documentation/user/refman.itely
buildscripts/lilypond-profile.sh
input/regression/tup.ly [deleted file]
lily/lookup.cc
lily/parser.yy
lily/piano-pedal-engraver.cc
lily/text-spanner.cc
lily/tuplet-bracket.cc
python/lilylib.py
scm/define-grob-properties.scm
scripts/lilypond-book.py
scripts/ly2dvi.py

index 2b449c53a58e7d330bf9480fe0eff9888e7f4bec..49345f56fcbe724e6f06d6fa87f4b49e436d1f59 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2003-07-23  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * buildscripts/lilypond-profile.sh: error message if script is not
+       sourced.
+
+       * lily/tuplet-bracket.cc (make_bracket): change edge-widen to
+       bracket-flare
+       (make_bracket): simplify code.
+
+       * lily/parser.yy (verbose_command_req): catch typos in \key scale
+       argument.
+
+       * python/lilylib.py (lilypond_version_check): new function
+
+       * scripts/lilypond-book.py (TexiPaper.incl_opt): idem
+
+       * scripts/ly2dvi.py (run_lilypond): add version check.
+
        * scripts/lilypond-book.py (option_definitions): typo
 
        * scripts/ly2dvi.py (include_path): typo
index 06e7ef03699efcf6907fab7274fc41b427143a13..38ef0b1cfe8080b433ba18ff082377727007988f 100644 (file)
@@ -2614,7 +2614,7 @@ staff are squashed, and the staff itself has a single line:
 
 @menu
 * Percussion staves::           
-* Percussion midi output::      
+* Percussion MIDI output::      
 @end menu
 
 @node Percussion staves
index f1a941c411c6b95692e2d875b5b9ad2a140a3159..bc05e399795e5a1984b5604eb5ddec6a3b0c955c 100644 (file)
@@ -6,8 +6,14 @@
 
 # If run by hand or from you .profile, run as follows
 #   . lilypond-profile
-
-
+if [ `basename "$0"` = "lilypond-profile" ] ; then
+    echo "This script must be sourced, i.e."
+    echo ""
+    echo "  . lilypond-profile"
+    echo ""
+    
+    exit 2 
+fi 
 if [ -z "$LILYPONDPREFIX" ]; then
     datadir=`echo "@local_lilypond_datadir@" | sed 's!//!/!g'`
 else
diff --git a/input/regression/tup.ly b/input/regression/tup.ly
deleted file mode 100644 (file)
index 0d6ef52..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-\version "1.7.18"
-\header{
-    
-texidoc="
-Tuplets are indicated by a bracket with a number.  There should be no
-bracket if there is a beam exactly  matching  the length of the tuplet.
-The bracket does not interfere with the stafflines, and the number is
-centered in the gap in the bracket.
-
-The bracket stops at the end of the stems, if the stems have the same
-direction as the
-
-
-"
-
-}
-\paper { raggedright= ##t }
-
-\score{
-       \notes \context Voice \relative c'' {
-                \times 2/3 { \times 2/3 { a8 b c}  c }
-                \times 2/3 { r8  b-[ f] }
-                \times 2/3 { r8 b r8 }
-                c4 |
-                
-                \times 3/4 { c4 c4 c4 c4 } c4 | 
-                
-                \time 6/8
-                \times 6/9 { c8 c c c c c c c c }
-
-                }
-}
-
-
-
index 0f7d9b8d767c47ac2d6c51b262afa085a0c417c6..b439d28c9148c928cedb3fcd9d2e0864936b179c 100644 (file)
@@ -81,19 +81,19 @@ Lookup::dashed_slur (Bezier b, Real thick, Real dash)
 }
 
 Molecule
-Lookup::line (Real th, Offset f, Offset t)
+Lookup::line (Real th, Offset from, Offset to)
 {
   SCM at = scm_list_n (ly_symbol2scm ("draw-line"),
                        gh_double2scm (th), 
-                       gh_double2scm (f[X_AXIS]),
-                       gh_double2scm (f[Y_AXIS]),
-                       gh_double2scm (t[X_AXIS]),
-                       gh_double2scm (t[Y_AXIS]),
+                       gh_double2scm (from[X_AXIS]),
+                       gh_double2scm (from[Y_AXIS]),
+                       gh_double2scm (to[X_AXIS]),
+                       gh_double2scm (to[Y_AXIS]),
                        SCM_UNDEFINED);
 
   Box box;
-  box.add_point (f);
-  box.add_point (t);
+  box.add_point (from);
+  box.add_point (to);
 
   box[X_AXIS].widen (th/2);
   box[Y_AXIS].widen (th/2);  
index cb9d8f14cec7b6ec25228aeb148e073e934b0117..7b8ba1f0cbda86d26cbbbbc3cf5a91753dcd3b37 100644 (file)
@@ -1433,11 +1433,16 @@ verbose_command_req:
                $$ = key;
        }
        | KEY NOTENAME_PITCH SCM_IDENTIFIER     {
+
                Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
-               
-               key->set_mus_property ("pitch-alist", $3);
-               key->set_mus_property ("tonic", Pitch (0,0,0).smobbed_copy());
-               ((Music*)key)->transpose (* unsmob_pitch ($2));
+               if (scm_ilength ($3) > 0)
+               {               
+                       key->set_mus_property ("pitch-alist", $3);
+                       key->set_mus_property ("tonic", Pitch (0,0,0).smobbed_copy());
+                       ((Music*)key)->transpose (* unsmob_pitch ($2));
+               } else {
+                       THIS->parser_error (_("Second argument must be pitch list."));
+               }
 
                $$ = key;
        }
index 60c93793217bfe23e146cba8addf4c6f0744cd8a..5781110d76dfdc258293575abbe1c4f1c9869528 100644 (file)
@@ -219,7 +219,6 @@ Piano_pedal_engraver::process_acknowledged_grobs ()
 void
 Piano_pedal_engraver::create_text_grobs (Pedal_info *p, SCM pedaltype)
 {
-  SCM b;
   SCM s = SCM_EOL;
   SCM strings = get_property ( ("pedal" + String (p->name_) + "Strings").to_str0 ());
 
@@ -293,7 +292,8 @@ Piano_pedal_engraver::create_text_grobs (Pedal_info *p, SCM pedaltype)
   if (gh_string_p (s))
     {
       String propname = String (p->name_) + "Pedal";
-      b = get_property (propname.to_str0 ());
+
+      SCM b = get_property (propname.to_str0 ());
       p->item_ = new Item (b);
       p->item_->set_grob_property ("text", s);
       Axis_group_interface::add_element (p->line_spanner_, p->item_);
@@ -381,11 +381,11 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype)
       /* Set this property for 'mixed style' pedals,    Ped._______/\ ,  
         so the molecule function will shorten the ____ line by the length of the Ped. text.
       */
-      
+
       p->bracket_->set_grob_property ("text-start", 
-                                      pedaltype == ly_symbol2scm ("mixed") ? 
-                                      gh_bool2scm ( (bool) ! p->req_l_drul_[STOP]) :
-                                      gh_bool2scm (false));
+                                     pedaltype == ly_symbol2scm ("mixed")
+                                     ? gh_bool2scm ( (bool) ! p->req_l_drul_[STOP])
+                                     : gh_bool2scm (false));
 
       /*
        Mixed style: Store a pointer to the preceding text for use in
index 8432a6cd760d0ac791989b28705d21dc816fe5ab..5161d1bf2aa13d645e803f6eabe9d7740f3f7575 100644 (file)
@@ -75,13 +75,6 @@ Text_spanner::brew_molecule (SCM smob)
   while (flip (&d) != LEFT);
 
 
-#if 0
-  /*
-    FIXME. - this switch   sucks. --hwn
-   */
-  // FIXME: ecs tells us -- only for (de)cresc. spanners
-  width += gh_scm2double (me->get_grob_property ("width-correct"));
-#endif
 
   SCM properties = Font_interface::font_alist_chain (me);
   SCM edge_text = me->get_grob_property ("edge-text");
@@ -113,12 +106,18 @@ Text_spanner::brew_molecule (SCM smob)
   shorten[LEFT] = 0;
   shorten[RIGHT] = 0;
 
+  SCM ew = me->get_grob_property ("edge-flare");
   SCM s = me->get_grob_property ("shorten-pair");
   if (gh_pair_p (s))
     {
       span_points[LEFT] += gh_scm2double (ly_car (s));
       span_points[RIGHT] -= gh_scm2double (ly_cdr (s));
     }
+  if (gh_pair_p (ew))
+    {
+      span_points[LEFT] += gh_scm2double (ly_car (ew));
+      span_points[RIGHT] -= gh_scm2double (ly_cdr (ew));
+    }
   
   Real thick = me->get_paper ()->get_var ("linethickness");  
   SCM st = me->get_grob_property ("thickness");
@@ -129,7 +128,6 @@ Text_spanner::brew_molecule (SCM smob)
   
   Drul_array<Molecule> edge_line;
   s = me->get_grob_property ("edge-height");
-  SCM ew = me->get_grob_property ("edge-widen");
   if (gh_pair_p (s))
     {
       Direction d = LEFT;
@@ -212,7 +210,6 @@ Text_spanner::setup_pedal_bracket(Spanner *me)
   Drul_array<Real> height, width, shorten, r;
 
   SCM pa = me->get_grob_property ("if-text-padding");
-  SCM ew = me->get_grob_property ("edge-widen");
   SCM eh = me->get_grob_property ("edge-height");
   SCM sp = me->get_grob_property ("shorten-pair");
   
@@ -235,8 +232,6 @@ Text_spanner::setup_pedal_bracket(Spanner *me)
       width[d]  =  0;
       height[d] =  0;
       shorten[d] = 0;
-      if (ly_number_pair_p (ew))
-       width[d] +=  gh_scm2double (index_get_cell (ew, d));
       if (!broken[d] && (ly_number_pair_p (eh)))
        height[d] += gh_scm2double (index_get_cell (eh, d));
       if (ly_number_pair_p (sp))
@@ -245,6 +240,7 @@ Text_spanner::setup_pedal_bracket(Spanner *me)
   while (flip (&d) != LEFT);
   
   Real extra_short = 0;
+  
   // For 'Mixed' style pedals, i.e.  a bracket preceded by text:  Ped._____|
   // need to shorten by the extent of the text grob
   if (to_boolean (me->get_grob_property ("text-start")))
@@ -286,7 +282,6 @@ Text_spanner::setup_pedal_bracket(Spanner *me)
     }
 
   me->set_grob_property ("edge-height", ly_interval2scm (height));
-  me->set_grob_property ("edge-widen",  ly_interval2scm(width));
   me->set_grob_property ("shorten-pair", ly_interval2scm (shorten));
 }
 
index 3832249a0722550c8d6d8c11bec253d80724c8cb..56f9585c8fc6fe029297cd08cb5b0ed87f620385 100644 (file)
@@ -69,7 +69,7 @@ Tuplet_bracket::parallel_beam (Grob *me, Link_array<Grob> const &cols, bool *equ
   Spanner*sp = dynamic_cast<Spanner*> (me);  
 
   *equally_long= false;
-  if (! ( b1 && (b1 == b2) && !sp->broken_b() ))
+  if (! (b1 && (b1 == b2) && !sp->broken_b()))
       return 0;
 
   Link_array<Grob> beam_stems = Pointer_group_interface__extract_grobs
@@ -177,19 +177,19 @@ Tuplet_bracket::brew_molecule (SCM smob)
        lt *= gh_scm2double (thick);
       
       SCM gap = me->get_grob_property ("gap");
-      SCM ew = me->get_grob_property ("edge-widen");
+      SCM fl = me->get_grob_property ("bracket-flare");
       SCM eh = me->get_grob_property ("edge-height");
       SCM sp = me->get_grob_property ("shorten-pair");
       
       Direction d = LEFT;
-      Drul_array<Real> height, width, shorten;
+      Drul_array<Real> height, flare, shorten;
       do {
-       width[d] =  height[d] = shorten[d] = 0.0;
-       if ( ly_number_pair_p (ew) )
-         width[d] +=  gh_scm2double (index_get_cell (ew, d));
-       if ( ly_number_pair_p (eh) )
+       flare[d] =  height[d] = shorten[d] = 0.0;
+       if (ly_number_pair_p (fl))
+         flare[d] +=  gh_scm2double (index_get_cell (fl, d));
+       if (ly_number_pair_p (eh))
          height[d] += gh_scm2double (index_get_cell (eh, d)) * - dir;
-       if ( ly_number_pair_p (sp) )
+       if (ly_number_pair_p (sp))
          shorten[d] +=  gh_scm2double (index_get_cell (sp, d));
       }
       while (flip (&d) != LEFT);
@@ -198,7 +198,7 @@ Tuplet_bracket::brew_molecule (SCM smob)
                                     w, ry - ly, lt,
                                     height,
                                     gh_scm2double (gap),
-                                    width,
+                                    flare,
                                     shorten);
       mol.add_molecule (brack);
     }
@@ -210,49 +210,50 @@ Tuplet_bracket::brew_molecule (SCM smob)
 
 /*
   should move to lookup?
+
+  TODO: this will fail for very short (shorter than the flare)
+  brackets.
  */
 Molecule
 Tuplet_bracket::make_bracket (Axis protusion_axis,
                              Real dx, Real dy, Real thick, Drul_array<Real> height,
                              Real gap,
-                             Drul_array<Real> widen,
+                             Drul_array<Real> flare,
                              Drul_array<Real> shorten)
 {
-  Real len = Offset (dx,dy).length ();
-  Real gapx = dx * (gap /  len);
-  Real gapy = dy * (gap /  len);
-  Drul_array<Real> shortx, shorty;
+  Offset dz = Offset (dx,dy);
+  Drul_array<Offset> corners (Offset(0,0), dz);
+  
+  Real length = dz.length ();
+  Drul_array<Offset> gap_corners;
+
+  
+  Axis bracket_axis = other_axis (protusion_axis);
+
+  Drul_array<Offset> straight_corners = corners;
+
   Direction d = LEFT;
   do {
-    shortx[d] = dx * (shorten[d] /  len);
-    shorty[d] = dy * (shorten[d] /  len);
-  }
-  while (flip (&d) != LEFT);
-  Axis other = other_axis (protusion_axis);
-  
-  Molecule l1 = Lookup::line (thick, Offset(shortx[LEFT], shorty[LEFT]),
-                             Offset ( (dx - gapx)/2, (dy - gapy)/2 ));
-
-  Molecule l2 = Lookup::line (thick, Offset((dx + gapx) / 2,(dy + gapy) / 2),
-                             Offset (dx - shortx[RIGHT], dy - shorty[RIGHT]));
-
-  Offset protusion;
-  protusion[other] = -widen[LEFT];
-  protusion[protusion_axis] = height[LEFT];
-  Molecule p1 = Lookup::line (thick, 
-                             Offset(shortx[LEFT], shorty[LEFT]), 
-                             Offset(shortx[LEFT], shorty[LEFT]) + protusion);
-  protusion[other] = widen[RIGHT];
-  protusion[protusion_axis] = height[RIGHT];
-  Molecule p2 = Lookup::line (thick, 
-                             Offset(dx - shortx[RIGHT], dy - shorty[RIGHT]), 
-                             Offset(dx - shortx[RIGHT], dy - shorty[RIGHT]) + protusion);  
+    straight_corners[d] += - d * shorten[d] /length * dz;
+    gap_corners[d] = (dz * 0.5) + d * gap / length * dz;
+  } while (flip (&d) != LEFT);
+
+  Drul_array<Offset> flare_corners = straight_corners;
+  do {
+    flare_corners[d][bracket_axis] = straight_corners[d][bracket_axis];
+    flare_corners[d][protusion_axis] += height[d];
+    straight_corners[d][bracket_axis] += - d * flare[d];
+  } while (flip (&d) != LEFT);
 
   Molecule m;
-  m.add_molecule (p1);
-  m.add_molecule (p2);
-  m.add_molecule (l1);
-  m.add_molecule (l2);
+  do {
+
+    m.add_molecule (Lookup::line (thick, straight_corners[d],
+                                 gap_corners[d]));
+    
+    m.add_molecule (Lookup::line (thick, straight_corners[d],
+                                 flare_corners[d]));
+  } while (flip (&d) != LEFT);
 
   return m;  
 }
@@ -403,7 +404,7 @@ Tuplet_bracket::after_line_breaking (SCM smob)
     }
   if (dynamic_cast<Spanner*> (me)->broken_b ())
     {
-      me->warning ( "Tuplet_bracket was across linebreak. Farewell cruel world.");
+      me->warning ("Tuplet_bracket was across linebreak. Farewell cruel world.");
       me->suicide();
       return SCM_UNSPECIFIED;
     }
@@ -501,5 +502,5 @@ Tuplet_bracket::add_column (Grob*me, Item*n)
 
 ADD_INTERFACE (Tuplet_bracket,"tuplet-bracket-interface",
   "A bracket with a number in the middle, used for tuplets.",
-  "note-columns edge-widen edge-height shorten-pair padding gap left-position right-position bracket-visibility number-visibility thickness direction");
+  "note-columns bracket-flare edge-height shorten-pair padding gap left-position right-position bracket-visibility number-visibility thickness direction");
 
index a7b6411babe05505385897458dd90493b3a4a68e..ccd5ab842ea2a83083e8f46b0640e11cb6c8e391 100644 (file)
@@ -101,12 +101,8 @@ except:
                return s
 underscore = _
 
-program_version = '@TOPLEVEL_VERSION@'
-if program_version == '@' + 'TOPLEVEL_VERSION' + '@':
-       program_version = '1.7.14'
-
 def identify (port):
-       port.write ('%s (GNU LilyPond) %s\n' % (__main__.program_name, program_version))
+       port.write ('%s (GNU LilyPond) %s\n' % (__main__.program_name, __main__.program_version))
 
 def warranty ():
        identify (sys.stdout)
@@ -202,6 +198,25 @@ def help ():
              (_ ("Report bugs to %s") % 'bug-lilypond@gnu.org'),
              ('\n')]
        map (sys.stdout.write, ls)
+
+def lilypond_version (binary):
+       p = read_pipe ('%s --version ' % binary)
+       x = []
+       def catch_version (match):
+               x.append (match.group (1))
+       re.sub ('GNU LilyPond ([^\n]+)\n', catch_version, p)
+       x.append ('not found')
+       
+       return x[0]
+       
+def lilypond_version_check (binary, req):
+       if req[0] <> '@' :
+               v = lilypond_version (binary)
+               if v <> req:
+                       error (_("Binary %s has version %s, looking for version %s") % \
+                              (binary, v, req))
+                       sys.exit (1)
+       
        
 def setup_temp ():
        
index cf6484e9add38a7defcdecbe9ff6f7252595aae7..a7f4818082fbb2244c291139cdbf090ed0d625e2 100644 (file)
@@ -177,7 +177,10 @@ mean centre distance weighted per note
 (grob-property-description 'dot-count integer? "number of dots.")
 (grob-property-description 'duration-log integer? "2-log of the notehead duration, i.e. 0=whole note, 1 = half note, etc.")
 (grob-property-description 'edge-height pair? "a cons that specifies the heights of the vertical edges '(LEFT-height . RIGHT-height).")
-(grob-property-description 'edge-widen pair? "a cons that specifies the widths of the slanted edges '(LEFT-width . RIGHT-width).")
+(grob-property-description 'bracket-flare number-pair? "a pair
+ that specifies how much edges of brackets  should slant outward.
+ Value 0.0 means straight edges")
+
 (grob-property-description 'edge-text pair? "a cons that specifies the texts to be set at the edges '(LEFT-text . RIGHT-text).")
 (grob-property-description 'elements grob-list? "list of grobs, type depending on the Grob where this is set in.")
 (grob-property-description 'expand-limit integer? "maximum number of measures expanded in church rests.")
index df3aba4508d816b92d25ea2e3f7692573e3de7c7..54a70d3847da10441db0b8a39f5e285120100944 100644 (file)
@@ -103,6 +103,7 @@ global _;_=ly._
 global re;re = ly.re
 
 # lilylib globals
+program_version = '@TOPLEVEL_VERSION@'
 program_name = 'lilypond-book'
 verbose_p = 0
 pseudo_filter_p = 0
@@ -1371,6 +1372,9 @@ def compile_all_files (chunks):
                texfiles = string.join (tex)
                cmd = string.join ((lilypond_binary, lilyopts, g_extra_opts,
                                    texfiles))
+
+               ly.lilypond_version_check (lilypond_binary, '@TOPLEVEL_VERSION@')
+               
                ly.system (cmd, ignore_error = 0, progress_p = 1)
 
                #
index d8133ee21427e244d5a27b0cf500e974d3113b9f..dc3725b11700494696dd73f0eb48df99edfee554 100644 (file)
@@ -95,6 +95,7 @@ if os.environ.has_key ('LILYPONDPREFIX') :
        while datadir[-1] == os.sep:
                datadir= datadir[:-1]
 
+
 sys.path.insert (0, os.path.join (datadir, 'python'))
 
 # Customize these
@@ -106,6 +107,7 @@ global re;re = ly.re
 
 # lilylib globals
 program_name = 'ly2dvi'
+program_version = '@TOPLEVEL_VERSION@'
 verbose_p = 0
 pseudo_filter_p = 0
 original_dir = os.getcwd ()
@@ -262,7 +264,7 @@ def run_lilypond (files, dep_prefix):
 
        if debug_p:
                ly.print_environment ()
-
+               
        cmd = string.join ((lilypond_binary, opts, fs))
        status = ly.system (cmd, ignore_error = 1, progress_p = 1)
        signal = 0x0f & status
@@ -779,6 +781,8 @@ if not files:
 
 if 1:
        ly.identify (sys.stderr)
+       ly.lilypond_version_check (lilypond_binary, '@TOPLEVEL_VERSION@')
+       
        original_output = output_name
        
        # Ugh, maybe make a setup () function