+2002-06-17 Chris Jackson <chris@fluffhouse.org.uk>
+
+ * lily/tuplet-bracket.cc:
+ * lily/text-spanner.cc:
+ * lily/piano-pedal-engraver.cc:
+ * scm/grob-description.scm:
+ * scm/grob-property-description.scm: Changed the
+ edge-width property of brackets to edge-widen. Changed the sign of
+ the left element of edge-widen so a pair of equal numbers produces
+ a symmetrical bracket.
+
2002-06-17 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* ly/espanol.ly: added.
DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
static Molecule make_bracket (Axis protusion_axis,
- Real dx, Real dy, Real thick, Real left_height,
- Real right_height, Real gap, Real left_widen,
- Real right_widen, Real left_shorten,
- Real right_shorten);
+ Real dx, Real dy, Real thick, Drul_array<Real> height,
+ Real gap, Drul_array<Real> widen,
+ Drul_array<Real> shorten);
static Direction get_default_dir (Grob*);
};
/*
Left and right flare widths of a \___/, as specified by the grob
- property edge-width.
+ property edge-widen.
*/
Drul_array<SCM> edge_width_drul_;
Set properties so that the molecule-creating function will
know whether the right edge should be flared ___/
*/
- SCM eleft = ly_car (p->bracket_p_->get_grob_property ("edge-width"));
+ SCM eleft = ly_car (p->bracket_p_->get_grob_property ("edge-widen"));
SCM eright = (p->req_l_drul_[START] ? edge_width_drul_[RIGHT] : gh_double2scm (0));
- p->bracket_p_->set_grob_property ("edge-width", gh_cons (eleft, eright));
+ p->bracket_p_->set_grob_property ("edge-widen", gh_cons (eleft, eright));
p->finished_bracket_p_ = p->bracket_p_;
p->bracket_p_ = 0;
know whether the left edge should be flared \___
*/
- SCM ew = p->bracket_p_->get_grob_property ("edge-width");
+ SCM ew = p->bracket_p_->get_grob_property ("edge-widen");
edge_width_drul_[LEFT] = ly_car (ew);
edge_width_drul_[RIGHT] = ly_cdr (ew);
edge_width_drul_[LEFT] :
gh_double2scm (0));
SCM eright = gh_double2scm (0);
- p->bracket_p_->set_grob_property ("edge-width", gh_cons (eleft, eright));
+ p->bracket_p_->set_grob_property ("edge-widen", gh_cons (eleft, eright));
/* Set this property for 'mixed style' pedals, Ped._______/\ ,
so the molecule function will shorten the ____ line by the length of the Ped. text.
Drul_array<Molecule> edge_line;
s = me->get_grob_property ("edge-height");
- SCM ew = me->get_grob_property ("edge-width");
+ SCM ew = me->get_grob_property ("edge-widen");
if (gh_pair_p (s))
{
Direction d = LEFT;
do
{
Real dx = ( gh_pair_p (ew) ?
- gh_scm2double (index_cell (ew, d)) * - dir :
+ gh_scm2double (index_cell (ew, d)) * d :
0 );
Real dy = gh_scm2double (index_cell (s, d)) * - dir;
if (dy)
Drul_array<Real> height, width, shorten, r;
SCM pa = me->get_grob_property ("if-text-padding");
- SCM ew = me->get_grob_property ("edge-width");
+ SCM ew = me->get_grob_property ("edge-widen");
SCM eh = me->get_grob_property ("edge-height");
SCM sp = me->get_grob_property ("shorten-pair");
height[d] = 0;
shorten[d] = 0;
if ( ly_number_pair_p (ew) )
- width[d] += gh_scm2double (index_cell (ew, d)) * d;
+ width[d] += gh_scm2double (index_cell (ew, d));
if ( !broken[d] && (ly_number_pair_p (eh) ) )
height[d] += gh_scm2double (index_cell (eh, d));
if ( ly_number_pair_p (sp) )
}
me->set_grob_property ("edge-height", ly_interval2scm (height));
- me->set_grob_property ("edge-width", ly_interval2scm(width));
+ me->set_grob_property ("edge-widen", ly_interval2scm(width));
me->set_grob_property ("shorten-pair", ly_interval2scm (shorten));
}
};
ADD_INTERFACE (Pianopedal,"piano-pedal-interface",
"",
- "pedal-type edge-width edge-height shorten-pair text-start left-widen right-widen");
+ "pedal-type edge-widen edge-height shorten-pair text-start left-widen right-widen");
ADD_INTERFACE (Text_spanner,"text-spanner-interface",
"generic text spanner",
- "dash-period if-text-padding dash-length edge-height edge-width edge-text shorten-pair type");
+ "dash-period if-text-padding dash-length edge-height edge-widen edge-text shorten-pair type");
lt *= gh_scm2double (thick);
SCM gap = me->get_grob_property ("gap");
- SCM ew = me->get_grob_property ("edge-width");
+ SCM ew = me->get_grob_property ("edge-widen");
SCM eh = me->get_grob_property ("edge-height");
SCM sp = me->get_grob_property ("shorten-pair");
do {
width[d] = height[d] = shorten[d] = 0.0;
if ( ly_number_pair_p (ew) )
- width[d] += gh_scm2double (index_cell (ew, d)) * d;
+ width[d] += gh_scm2double (index_cell (ew, d));
if ( ly_number_pair_p (eh) )
- height[d] += gh_scm2double (index_cell (eh, d));
+ height[d] += gh_scm2double (index_cell (eh, d)) * - dir;
if ( ly_number_pair_p (sp) )
shorten[d] += gh_scm2double (index_cell (sp, d));
}
Molecule brack = make_bracket (Y_AXIS,
w, ry - ly, lt,
- -height[LEFT]*dir, -height[RIGHT]*dir,
+ height,
gh_scm2double (gap),
- width[LEFT], width[RIGHT],
- shorten[LEFT], shorten[RIGHT]);
+ width,
+ shorten);
mol.add_molecule (brack);
}
/*
should move to lookup?
-
- argh. this interface is confusing : we have a shorten as well as a
- widen.
-
- arg. should use drul_arrays here.
*/
Molecule
Tuplet_bracket::make_bracket (Axis protusion_axis,
- Real dx, Real dy, Real thick, Real left_height,
- Real right_height,
+ Real dx, Real dy, Real thick, Drul_array<Real> height,
Real gap,
- Real left_widen, Real right_widen,
- Real left_shorten, Real right_shorten)
+ Drul_array<Real> widen,
+ Drul_array<Real> shorten)
{
Real len = Offset (dx,dy).length ();
Real gapx = dx * (gap / len);
Real gapy = dy * (gap / len);
- Real lshortx = dx * (left_shorten / len);
- Real lshorty = dy * (left_shorten / len);
- Real rshortx = dx * (right_shorten / len);
- Real rshorty = dy * (right_shorten / len);
+ Drul_array<Real> shortx, shorty;
+ 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(lshortx, lshorty),
+ 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 - rshortx, dy - rshorty));
+ Offset (dx - shortx[RIGHT], dy - shorty[RIGHT]));
Offset protusion;
- protusion[other] = -left_widen;
- protusion[protusion_axis] = left_height;
+ protusion[other] = -widen[LEFT];
+ protusion[protusion_axis] = height[LEFT];
Molecule p1 = Lookup::line (thick,
- Offset(lshortx, lshorty),
- Offset(lshortx, lshorty) + protusion);
- protusion[other] = right_widen;
- protusion[protusion_axis] = right_height;
+ 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 - rshortx, dy - rshorty),
- Offset(dx - rshortx, dy - rshorty) + protusion);
+ Offset(dx - shortx[RIGHT], dy - shorty[RIGHT]),
+ Offset(dx - shortx[RIGHT], dy - shorty[RIGHT]) + protusion);
Molecule m;
m.add_molecule (p1);
ADD_INTERFACE (Tuplet_bracket,"tuplet-bracket-interface",
"A bracket with a number in the middle, used for tuplets.",
- "note-columns edge-width edge-height shorten-pair padding gap left-position right-position bracket-visibility number-visibility thickness direction");
+ "note-columns edge-widen edge-height shorten-pair padding gap left-position right-position bracket-visibility number-visibility thickness direction");
(width-correct . 0)
(outer . #t)
(direction . -1)
- (edge-width . (0.5 . 0.5))
+ (edge-widen . (0.5 . 0.5))
(edge-height . (1.0 . 1.0))
(shorten-pair . (0.0 . 0.0))
(thickness . 1.0)
(gap . 2.0)
(padding . 0.9)
(thickness . 1.6)
- (edge-width . (0.0 . 0.0))
+ (edge-widen . (0.0 . 0.0))
(edge-height . (0.7 . 0.7))
(shorten-pair . (-0.2 . -0.2))
(before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking)
(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-width pair? "a cons that specifies the widths of the slanted edges '(LEFT-width . RIGHT-width).")
+(grob-property-description 'edge-widen pair? "a cons that specifies the widths of the slanted edges '(LEFT-width . RIGHT-width).")
(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 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.")
(grob-property-description 'right-head ly-grob? "")
(grob-property-description 'left-head ly-grob? "")
-(grob-property-description 'left-widen boolean? "Whether the left edge of a piano pedal bracket should be widened by the first element of edge-width.")
+(grob-property-description 'left-widen boolean? "Whether the left edge of a piano pedal bracket should be widened by the first element of edge-widen.")
(grob-property-description 'length number? "Stem length for unbeamed stems, only for user override.")
(grob-property-description 'lengths list? "Stem length given multiplicity of flag.")
(grob-property-description 'raise number? "height for text to be raised (a negative value lowers the text.")
(grob-property-description 'right-padding number? "space right of accs.")
(grob-property-description 'right-trim-amount number? "shortening of the lyric extender on the right.")
-(grob-property-description 'right-widen boolean? "Whether the right edge of a piano pedal bracket should be widened by the second element of edge-width")
+(grob-property-description 'right-widen boolean? "Whether the right edge of a piano pedal bracket should be widened by the second element of edge-widen")
(grob-property-description 'script-priority number? "A sorting key that determines in what order a script is within a stack of scripts.")
(grob-property-description 'self-alignment-X number-or-grob? "real number: -1 =
left aligned, 0 = center, 1 right-aligned in X direction.