+2006-02-10 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * lily/parenthesis-engraver.cc (acknowledge_grob): don't do
+ set_parent() for parentheses. This will make it show up in bbox
+ calculations.
+
+ * scm/output-lib.scm (parentheses-item::print): rewrite, using
+ ly:grob-common* functions.
+
+ * lily/grob-scheme.cc (LY_DEFINE):
+ ly:grob-common-refpoint-of-array: new function
+ ly:grob-common-refpoint: new function
+ ly:grob-relative-coordinate: new function
+
+ * lily/instrument-name-engraver.cc (process_music): use
+ Text_interface::is_markup(). This fixes \markup on instrument names.
+
+ * scm/define-grobs.scm (all-grob-descriptions): set line-thickness
+ for ties and slurs.
+
+ * lily/slur.cc (print): idem.
+
+ * lily/tie.cc: add line-thickness for ties.
+
2006-02-10 Jan Nieuwenhuizen <janneke@gnu.org>
* scm/output-svg.scm: Document diversion from GNU coding standards
2006-02-10 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/instrument-name-engraver.cc (process_music): use
+ is_markup() iso. is_string()
+
* Documentation/user/changing-defaults.itely (Module): add menu entry.
* lily/percent-repeat-engraver.cc (process_music): only look at
* only show user-visible changes.
@end ignore
-@item Items directly connected with a music input element may be
-parenthesized, for example,
+
+@item Items directly connected with a music input element may be
+parenthesized, for example,
+
@lilypond[verbatim,ragged-right,fragment,relative=2]
-c4 -\parenthesize -.
+c4-\parenthesize -.
<d \parenthesize fis a>
@end lilypond
texidoc = "The parenthesize function is a special tweak that
encloses objects in parentheses. The associated grob is
- @code{Score.ParenthesesItem}.
-
-"
+ @code{Score.ParenthesesItem}."
}
\paper {
ragged-right = ##t
- }
+}
+
\version "2.7.32"
\relative {
c4 -\parenthesize -.
+ \override ParenthesesItem #'padding = #0.1
<d \parenthesize fis a>
}
return ly_interval2scm (sc->extent (ref, a));
}
+
+LY_DEFINE (ly_grob_relative_coordinate, "ly:grob-relative-coordinate",
+ 3, 0, 0, (SCM grob, SCM refp, SCM axis),
+ "Get the coordinate in @var{axis} direction of @var{grob} relative to "
+ "the grob @var{refp}")
+{
+ 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");
+
+ 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 scm_from_double (sc->relative_coordinate (ref,a));
+}
+
+
LY_DEFINE (ly_grob_parent, "ly:grob-parent",
2, 0, 0, (SCM grob, SCM axis),
"Get the parent of @var{grob}. @var{axis} is 0 for the X-axis, "
return Font_interface::get_default_font (gr)->self_scm ();
}
+
+LY_DEFINE (ly_grob_common_refpoint, "ly:grob-common-refpoint",
+ 3, 0, 0, (SCM grob, SCM other, SCM axis),
+ "Find the common refpoint of @var{grob} and @var{other} for @var{axis}."
+ )
+{
+
+ Grob *gr = unsmob_grob (grob);
+ SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ Grob *o = unsmob_grob (other);
+ SCM_ASSERT_TYPE (o, other, SCM_ARG2, __FUNCTION__, "grob");
+
+ SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+
+ Grob *refp = gr->common_refpoint (o, Axis (scm_to_int (axis)));
+ return refp ? refp->self_scm () : SCM_BOOL_F;
+}
+
+LY_DEFINE (ly_grob_common_refpoint_of_array, "ly:grob-common-refpoint-of-array",
+ 3, 0, 0, (SCM grob, SCM others, SCM axis),
+ "Find the common refpoint of @var{grob} and @var{others} "
+ "(a grob-array) for @var{axis}."
+ )
+{
+ Grob *gr = unsmob_grob (grob);
+ SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ Grob_array *ga = unsmob_grob_array (others);
+ SCM_ASSERT_TYPE (ga, others, SCM_ARG2, __FUNCTION__, "grob array");
+ SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+
+ Grob *refp = common_refpoint_of_array (ga->array (), gr, Axis (scm_to_int (axis)));
+ return refp ? refp->self_scm () : SCM_BOOL_F;
+}
#include "side-position-interface.hh"
#include "axis-group-interface.hh"
#include "align-interface.hh"
+#include "text-interface.hh"
#include "translator.icc"
SCM long_text = get_property ("instrument");
SCM short_text = get_property ("instr");
- if (! (scm_is_string (long_text)
- || scm_is_string (short_text)))
+ if (!(Text_interface::is_markup (long_text)
+ || Text_interface::is_markup (short_text)))
{
long_text = get_property ("vocalName");
short_text = get_property ("vocNam");
}
- if (scm_is_string (long_text)
- || scm_is_string (short_text))
+ if (Text_interface::is_markup (long_text)
+ || Text_interface::is_markup (short_text))
{
text_spanner_ = make_spanner ("InstrumentName", SCM_EOL);
- text_spanner_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
+ text_spanner_->set_bound (LEFT,
+ unsmob_grob (get_property ("currentCommandColumn")));
text_spanner_->set_property ("text", short_text);
text_spanner_->set_property ("long-text", long_text);
}
#include "music.hh"
#include "grob.hh"
#include "item.hh"
+#include "pointer-group-interface.hh"
#include "translator.icc"
{
}
-
-
void
Parenthesis_engraver::acknowledge_grob (Grob_info info)
{
victim->self_scm (),
"ParenthesesItem");
- paren->set_parent (victim, Y_AXIS);
- paren->set_parent (victim, X_AXIS);
+ Pointer_group_interface::add_grob (paren, ly_symbol2scm ("elements"), victim);
+
Real size = robust_scm2double (paren->get_property ("font-size"), 0.0)
+ robust_scm2double (victim->get_property ("font-size"), 0.0);
paren->set_property ("font-size", scm_from_double (size));
}
Real staff_thick = Staff_symbol_referencer::line_thickness (me);
- Real base_thick = robust_scm2double (me->get_property ("thickness"), 1);
- Real thick = base_thick * staff_thick;
+ Real base_thick = staff_thick
+ * robust_scm2double (me->get_property ("thickness"), 1);
+ Real line_thick = staff_thick
+ * robust_scm2double (me->get_property ("line-thickness"), 1);
+
Bezier one = get_curve (me);
Stencil a;
SCM p = me->get_property ("dash-period");
SCM f = me->get_property ("dash-fraction");
if (scm_is_number (p) && scm_is_number (f))
- a = Lookup::dashed_slur (one, thick, robust_scm2double (p, 1.0),
+ a = Lookup::dashed_slur (one, line_thick, robust_scm2double (p, 1.0),
robust_scm2double (f, 0));
else
a = Lookup::slur (one,
- get_grob_direction (me) * staff_thick * 1.0,
- thick);
+ get_grob_direction (me) * base_thick,
+ line_thick);
#if DEBUG_SLUR_SCORING
SCM quant_score = me->get_property ("quant-score");
return SCM_UNSPECIFIED;
}
-
+/*
+ TODO: merge witnh Slur::print.
+ */
MAKE_SCHEME_CALLBACK (Tie, print, 1);
SCM
Tie::print (SCM smob)
SCM cp = me->get_property ("control-points");
Real staff_thick = Staff_symbol_referencer::line_thickness (me);
- Real base_thick = robust_scm2double (me->get_property ("thickness"), 1);
- Real thick = base_thick * staff_thick;
+ Real base_thick = staff_thick * robust_scm2double (me->get_property ("thickness"), 1);
+ Real line_thick = staff_thick * robust_scm2double (me->get_property ("line-thickness"), 1);
Bezier b;
int i = 0;
SCM f = me->get_property ("dash-fraction");
if (scm_is_number (p) && scm_is_number (f))
a = Lookup::dashed_slur (b,
- thick,
+ line_thick,
robust_scm2double (p, 1.0),
robust_scm2double (f, 0));
else
a = Lookup::slur (b,
- get_grob_direction (me) * staff_thick,
- thick);
+ get_grob_direction (me) * base_thick,
+ line_thick);
return a.smobbed_copy ();
}
"dash-period "
"details "
"direction "
+ "line-thickness "
"thickness "
);
(line-count ,integer? "The number of staff lines.")
(line-positions ,list? "Vertical positions of staff lines.")
+ (line-thickness ,number? "The thickness of the tie/slur contour.")
(long-text ,markup? "Text markup. See @usermanref{Text markup}.")
(measure-length ,ly:moment? "Length of a
measure. Used in some spacing situations.")
(Y-extent . ,ly:slur::height)
(stencil . ,ly:slur::print)
- (thickness . 1.0)
+ (thickness . 1.2)
+ (line-thickness . 0.8)
(minimum-length . 1.5)
; ly:slur::height)
(height-limit . 2.0)
(outer-tie-vertical-distance-symmetry-penalty-factor . 10)
(outer-tie-length-symmetry-penalty-factor . 10)
(between-length-limit . 1.0)))
- (thickness . 1.0)
+ (thickness . 1.2)
+ (line-thickness . 0.8)
(meta . ((class . Spanner)
(interfaces . (tie-interface))))
))
;; * Pitch Trill Heads
;; * Parentheses
-(define (parenthesize-elements grob)
+(define (parenthesize-elements grob . rest)
(let*
- ((elts (ly:grob-object grob 'elements))
- (x-ext (ly:relative-group-extent elts grob X))
+ (
+ (refp (if (null? rest)
+ grob
+ (car rest)))
+ (elts (ly:grob-object grob 'elements))
+ (x-ext (ly:relative-group-extent elts refp X))
(font (ly:grob-default-font grob))
(lp (ly:font-get-glyph font "accidentals.leftparen"))
(rp (ly:font-get-glyph font "accidentals.rightparen"))
- (padding (ly:grob-property grob '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)))
+ (let*
+ ((elts (ly:grob-object me 'elements))
+ (y-ref (ly:grob-common-refpoint-of-array me elts Y))
+ (x-ref (ly:grob-common-refpoint-of-array me elts X))
+ (stencil (parenthesize-elements me x-ref))
+ (elt-y-ext (ly:relative-group-extent elts y-ref Y))
+ (y-center (interval-center elt-y-ext)))
+
+ (ly:stencil-translate
+ stencil
+ (cons
+ (-
+ (ly:grob-relative-coordinate me x-ref X))
+ (-
+ y-center
+ (ly:grob-relative-coordinate me y-ref Y))))
+ ))
+
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;