]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/relocate.cc (prefix_relocation): allow "current"
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 9 Feb 2006 13:20:49 +0000 (13:20 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 9 Feb 2006 13:20:49 +0000 (13:20 +0000)
iso. TOPLEVEL_VERSION for share/lilypond/ suffix. This makes
changing VERSION in a lily tree less painful.

* input/regression/parenthesize.ly: new file.

* scm/output-lib.scm (parenthesize-element): new function.

* scm/define-grobs.scm (all-grob-descriptions): add ParenthesesItem.

* lily/accidental-engraver.cc (make_standard_accidental): reroute
cause: accidentals are caused by note heads, not note events.

14 files changed:
ChangeLog
Documentation/topdocs/NEWS.tely
GNUmakefile.in
VERSION
input/regression/parenthesize.ly [new file with mode: 0644]
lily/accidental-engraver.cc
lily/grob-scheme.cc
lily/relocate.cc
ly/music-functions-init.ly
scm/define-grob-interfaces.scm
scm/define-grobs.scm
scm/define-music-properties.scm
scm/lily-library.scm
scm/output-lib.scm

index 754226876d89958b25be0b61d60d085a44899976..1cd6a8138693edcf7908b092875e7b9013f7ab3c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-02-09  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * lily/relocate.cc (prefix_relocation): allow "current"
+       iso. TOPLEVEL_VERSION for share/lilypond/ suffix. This makes
+       changing VERSION in a lily tree less painful.
+
+       * input/regression/parenthesize.ly: new file. 
+
+       * scm/output-lib.scm (parenthesize-element): new function.
+
+       * scm/define-grobs.scm (all-grob-descriptions): add ParenthesesItem.
+
+       * lily/parenthesis-engraver.cc (acknowledge_grob): new file.
+
+       * lily/accidental-engraver.cc (make_standard_accidental): reroute
+       cause: accidentals are caused by note heads, not note events. 
+
 2006-02-08  Graham Percival  <gpermus@gmail.com>
 
        * darwin.patch: small patch from Erlend, thanks!
index f0ef4da85892f70d7129d3de3be266b0a110d5f9..ac12b49d3e777ff60d4f111f09f05d24f6c66781 100644 (file)
@@ -63,8 +63,17 @@ which scares away people.
 * only show user-visible changes. 
 
 @end ignore
+@item Items  directly connected with a music input element may be
+parenthesized, for example,
 
 
+@lilypond[verbatim,ragged-right,fragment]
+c4 -\parenthesize -.
+<d \parenthesize fis a> 
+@end lilypond
+
+This feature was sponsored by Ramana Kumar.
+
 @item Multi-word
  variables in the @code{\paper} and @code{\layout} block are now
  separated with dashes, i.e.
index 163297823feac6b8b520563883c65bf94d7336d9..00a3677909103fc6812b6c5e8358dd7e4cbee88b 100644 (file)
@@ -83,16 +83,16 @@ local-WWW-post:
                tar -C $(outdir)/web-root/ -xf -  
        cd $(outdir)/web-root/ &&  \
                for a in `find . -name out-www`; do \
-                       mv $$a/* $$a/.. ; \
-                       rmdir $$a ; \
+                       rsync -a  --link-dest $$a/ $$a/ $$a/.. ; \
+                       rm -rf $$a ; \
                done
 
 tree-prefix = $(outdir)
 tree-bin = $(tree-prefix)/bin
 tree-lib = $(tree-prefix)/lib
 tree-share = $(tree-prefix)/share
-tree-share-prefix = $(tree-share)/lilypond/$(TOPLEVEL_VERSION)
-tree-lib-prefix = $(tree-lib)/lilypond/$(TOPLEVEL_VERSION)
+tree-share-prefix = $(tree-share)/lilypond/current
+tree-lib-prefix = $(tree-lib)/lilypond/current
 
 C_DIRS = flower lily
 c-clean:
diff --git a/VERSION b/VERSION
index 585440a1805bcde931a68b7a93a770f106747bd0..b9d81808daf1cff6fb0e0bbbf6cf8a75b2440815 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=7
-PATCH_LEVEL=32
+PATCH_LEVEL=33
 MY_PATCH_LEVEL=
 
diff --git a/input/regression/parenthesize.ly b/input/regression/parenthesize.ly
new file mode 100644 (file)
index 0000000..e8b5050
--- /dev/null
@@ -0,0 +1,23 @@
+
+\header {
+
+
+  texidoc = "The parenthesize function is a special tweak that
+  encloses objects in parentheses. The associated grob is
+  @code{Score.ParenthesesItem}.
+
+" 
+}
+
+
+\paper {
+  ragged-right = ##t
+  }
+\version "2.7.32"
+
+\relative {
+  c4 -\parenthesize -.
+
+  <d \parenthesize fis a> 
+
+}
index bdd704da42c5198e5b19fc9a78d7975f5c0c5abc..1c626529cae3df8b3444309a31e4f1509c421566 100644 (file)
@@ -387,7 +387,7 @@ Accidental_engraver::create_accidental (Accidental_entry *entry,
 
 Grob *
 Accidental_engraver::make_standard_accidental (Music *note,
-                                              Grob *support,
+                                              Grob *note_head,
                                               Engraver *trans)
 {
 
@@ -399,7 +399,7 @@ Accidental_engraver::make_standard_accidental (Music *note,
   Grob *a
     = make_grob_from_properties (trans,
                                 ly_symbol2scm ("Accidental"),
-                                note->self_scm (),
+                                note_head->self_scm (),
                                 "Accidental");
 
   /*
@@ -411,27 +411,28 @@ Accidental_engraver::make_standard_accidental (Music *note,
   for (vsize i = 0; i < right_objects_.size (); i++)
     Side_position_interface::add_support (a, right_objects_[i]);
 
-  a->set_parent (support, Y_AXIS);
+  a->set_parent (note_head, Y_AXIS);
 
   if (!accidental_placement_)
     accidental_placement_ = make_item ("AccidentalPlacement",
                                       a->self_scm ());
   Accidental_placement::add_accidental (accidental_placement_, a);
 
-  support->set_object ("accidental-grob", a->self_scm ());
+  note_head->set_object ("accidental-grob", a->self_scm ());
 
   return a;
 }
 
 Grob *
 Accidental_engraver::make_suggested_accidental (Music *note,
-                                               Grob *note_head, Engraver *trans)
+                                               Grob *note_head,
+                                               Engraver *trans)
 {
 
   Grob *a
     = make_grob_from_properties (trans,
                                 ly_symbol2scm ("AccidentalSuggestion"),
-                                note->self_scm (),
+                                note_head->self_scm (),
                                 "AccidentalSuggestion");
 
   Side_position_interface::add_support (a, note_head);
index 1cfe52094bce606161fcd81c5003e0235d63c52f..4e44d8937dc2d50ded91cb71cc7bcf933f364a0f 100644 (file)
@@ -47,17 +47,23 @@ LY_DEFINE (ly_grob_set_property_x, "ly:grob-set-property!",
 }
 
 LY_DEFINE (ly_grob_property, "ly:grob-property",
-          2, 0, 0, (SCM grob, SCM sym),
+          2, 1, 0, (SCM grob, SCM sym, SCM deflt),
           "Return the value of a value in grob @var{g} of property @var{sym}. "
-          "It will return @code{'()} (end-of-list) "
+          "It will return @code{'()} or @var{deflt} (if specified) "
           "if  @var{sym} is undefined in @var{g}."
           "\n\n")
 {
   Grob *sc = unsmob_grob (grob);
   SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
   SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+  if (deflt == SCM_UNDEFINED)
+    deflt = SCM_EOL;
 
-  return sc->internal_get_property (sym);
+  SCM retval = sc->internal_get_property (sym);
+  if (retval == SCM_EOL)
+    retval = deflt;
+  
+  return retval;
 }
 
 
@@ -134,11 +140,20 @@ LY_DEFINE (ly_get_extent, "ly:grob-extent",
 {
   Grob *sc = unsmob_grob (grob);
   Grob *ref = unsmob_grob (refp);
+  
   SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
   SCM_ASSERT_TYPE (ref, refp, SCM_ARG2, __FUNCTION__, "grob");
   SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
 
-  return ly_interval2scm (sc->extent (ref, Axis (scm_to_int (axis))));
+  Axis a = Axis (scm_to_int (axis));
+
+    
+  if (ref->common_refpoint (sc, a) != ref)
+    {
+      // ugh. should use other error message
+      SCM_ASSERT_TYPE (false, refp, SCM_ARG2, __FUNCTION__, "common refpoint");
+    }
+  return ly_interval2scm (sc->extent (ref, a));
 }
 
 LY_DEFINE (ly_grob_parent, "ly:grob-parent",
index 4e5669c7aa9a13814620bc91a9e2ca5d81438e1e..fb3c89951b676e1210854911d57db9dac128a681 100644 (file)
@@ -108,8 +108,10 @@ prefix_relocation (std::string prefix)
   std::string localedir = datadir + "/locale";
   std::string lilypond_datadir = datadir + "/lilypond/" TOPLEVEL_VERSION;
 
-  if (is_dir (lilypond_datadir))
-    prefix_directory = lilypond_datadir;
+  if (is_dir (lilypond_datadir + "/" + TOPLEVEL_VERSION))
+    prefix_directory = lilypond_datadir + "/" + TOPLEVEL_VERSION;
+  else if (is_dir (lilypond_datadir + "/current"))
+    prefix_directory = lilypond_datadir + "/current";
 
 #if HAVE_GETTEXT
   if (is_dir (localedir))
@@ -261,9 +263,12 @@ setup_paths (char const *argv0_ptr)
   */
   
   struct stat statbuf;
-  std::string build_prefix = prefix_directory + "/share/lilypond/" TOPLEVEL_VERSION;
-  if (stat (build_prefix.c_str (), &statbuf) == 0)
-    prefix_directory = build_prefix;
+  std::string build_prefix_current = prefix_directory + "/share/lilypond/" "current";
+  std::string build_prefix_version = prefix_directory + "/share/lilypond/" TOPLEVEL_VERSION;
+  if (stat (build_prefix_version.c_str (), &statbuf) == 0)
+    prefix_directory = build_prefix_version;
+  else if (stat (build_prefix_current.c_str (), &statbuf) == 0)
+    prefix_directory = build_prefix_current;
 
   
   /* Adding mf/out make lilypond unchanged source directory, when setting
index 42deb27cb56e24d1f8da4932c30c77c3d21e466f..50b87caf21854b3ccc33444bba105121b995e31c 100644 (file)
@@ -423,3 +423,9 @@ addquote =
    (make-music 'SequentialMusic 'void #t))
 
    
+parenthesize =
+#(def-music-function (parser loc arg) (ly:music?)
+   "Tag @var{arg} to be parenthesized."
+
+   (set! (ly:music-property arg 'parenthesize) #t)
+   arg)
index baa3b70d7a85e75e8fcb4a4a2b0aa889d9d7c92f..db121eb7bde680f82c3bd4e52c16273f633fc91a 100644 (file)
  "Kill this grob after the line breaking process."
  '())
 
+(ly:add-interface
+ 'parentheses-interface
+ "Parentheses for other objects"
+ '())
+
 (ly:add-interface
  'piano-pedal-interface
  "A piano pedal sign"
index ffe24ab280665ebdec5b9d4ded62c0a5909b4580..54f1beb8c8025f51cf72a06b093db771e852a301 100644 (file)
                                axis-group-interface
                                spaceable-grob-interface))))))
 
+    (ParenthesesItem
+     . (
+       (stencil . ,parentheses-item::print)
+       (font-size . -6)
+       (padding . 0.2)
+       (meta . ((class . Item)
+                (interfaces . (parentheses-interface font-interface))))
+       
+             ))
     (PhrasingSlur
      . ((details . ,default-slur-details)
 
index ebd8b9a0ff95f54e682d67dc068c10de09739059..32f6bbdac4468cca47dbfc6279e65900c3077efb 100644 (file)
@@ -67,6 +67,7 @@ can only be defined as initializer in @file{define-music-types.scm}.")
                 "This pitch was octavated by how many octaves?
 For chord inversions, this is negative.")
      (origin ,ly:input-location? "where was this piece of music defined?")
+     (parenthesize ,boolean? "Enclose resulting objects in parentheses?")
      (page-penalty ,number? "Penalty for page break hint.")
      (penalty ,number? "Penalty for line break hint.")
      (pitch ,ly:pitch? "the pitch of this note")
index 2c364187b377e49e0eecd729b98989ed3103b7c4..3ad2d2764b865c17241e2d568315c5c7e8dee2ca 100644 (file)
@@ -325,7 +325,9 @@ found."
 
 (define-public (interval-center x)
   "Center the number-pair X, when an interval"
-  (/ (+ (car x) (cdr x)) 2))
+  (if (interval-empty? x)
+      0.0
+      (/ (+ (car x) (cdr x)) 2)))
 
 (define-public interval-start car)
 (define-public interval-end cdr)
index ee652b2533c05a5289b5e9e0c2c041357cf6253e..ade314be23dd90114525cd2ad8c365927387ac43 100644 (file)
@@ -268,22 +268,50 @@ centered, X==1 is at the right, X == -1 is at the left."
 (define-public darkyellow  '(0.0 0.5 0.5))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Pitch Trill Heads
+;; * Pitch Trill Heads
+;; * Parentheses
 
 (define (parenthesize-elements grob)
   (let*
       ((elts (ly:grob-object grob 'elements))
        (x-ext (ly:relative-group-extent elts grob X))
+
        (font (ly:grob-default-font grob))
        (lp (ly:font-get-glyph font "accidentals.leftparen"))
        (rp (ly:font-get-glyph font "accidentals.rightparen"))
-       (padding 0.1))
+       (padding (ly:grob-property grob 'padding 0.1))
 
     (ly:stencil-add
      (ly:stencil-translate-axis lp (- (car x-ext) padding) X)
      (ly:stencil-translate-axis rp (+ (cdr x-ext) padding) X))
+  )))
+
+
+(define (parenthesize-element me grob)
+  (let*
+      ((x-ext (ly:grob-extent grob grob X))
+       (y-center
+       (interval-center (ly:grob-extent grob grob Y)))
+       (font (ly:grob-default-font me))
+       (lp (ly:font-get-glyph font "accidentals.leftparen"))
+       (rp (ly:font-get-glyph font "accidentals.rightparen"))
+       (padding (ly:grob-property grob 'padding 0.1))
+       )
+
+    (ly:stencil-add
+     (ly:stencil-translate lp
+                          (cons
+                           (- (car x-ext) padding)
+                           y-center))
+     (ly:stencil-translate rp
+                          (cons
+                           (+ (cdr x-ext) padding)
+                           y-center)))
   ))
 
+(define (parentheses-item::print me)
+  (parenthesize-element me (ly:grob-parent me Y)))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; 
 
@@ -294,3 +322,4 @@ centered, X==1 is at the right, X == -1 is at the left."
    funcs)
 
   value)
+