+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!
* 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.
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:
PACKAGE_NAME=LilyPond
MAJOR_VERSION=2
MINOR_VERSION=7
-PATCH_LEVEL=32
+PATCH_LEVEL=33
MY_PATCH_LEVEL=
--- /dev/null
+
+\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>
+
+}
Grob *
Accidental_engraver::make_standard_accidental (Music *note,
- Grob *support,
+ Grob *note_head,
Engraver *trans)
{
Grob *a
= make_grob_from_properties (trans,
ly_symbol2scm ("Accidental"),
- note->self_scm (),
+ note_head->self_scm (),
"Accidental");
/*
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);
}
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;
}
{
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",
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))
*/
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
(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)
"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"
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)
"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")
(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)
(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)))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
funcs)
value)
+