[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bars
From: |
Han-Wen Nienhuys |
Subject: |
Re: Bars |
Date: |
Tue, 1 May 2001 00:30:39 +0200 |
address@hidden writes:
> Though I did not investigate it in that detail, it seems the main
> problem is that the existing code in span_bar.cc depends on the
> existence of a bar_engraver in the staff context.
that's no problem, you can simply make the bars disappear by setting
#'transparent to ##t in the BarLine grob. (you also suggest this
yourself)
> when creating a span_bar. Another solution would be, as I already
> proposed, to introduce a visibility property for the bar engraver.
> Then, one would set the visibility rather than removing or adding a
> bar_engraver to whatever context.
See above.
> By the way, I would like to propose renaming bar* and span_bar* into
> staff_bar* and interstaff_bar*.
Do you mean files or variable names?
> +
> + // first walk: compute axis_group parent via common_refpoint () on all bars
> + Grob *refpoint = 0;
init this with me, the translation of the me grob should be
filtered. this also removes the need for checking below.
> + /* assert: refpoint is an axis-group object */
Incorrect. The refpoint may be any grob.
> + // compute extent of axis_group
> + Real last_staff_bar_length;
> + Real *interstaff_bar_length = new Real[staff_bar_count];
I prefer that an Array<Real> be used.
> + for (SCM elts = first_elt;
> + elts != SCM_EOL;
> + elts = gh_cdr (elts))
> + {
> + SCM smobbed_staff_bar = gh_car (elts);
> + SCM smobbed_staff_bar_molecule =
> + Bar::brew_molecule (smobbed_staff_bar);
> + Grob *staff_bar = unsmob_grob (smobbed_staff_bar);
> + interstaff_bar_yoffs[staff_bar_count] =
> + staff_bar->relative_coordinate (axis_group, (Axis)Y_AXIS);
this is overly complicated. Use Grob::extent (axis_group, Y_AXIS) to
find out the size of the bar lines.
> + interstaff_bar_molecule[staff_bar_count] =
> + *unsmob_molecule (smobbed_interstaff_bar_molecule);
don't do this -- you're storing a molecule on the heap, hiding it from
GUILE GC. This code is bound to crash in ugly ways.
I think you're code is on the lengthy side, and the above points must
be addressed before I consider putting the patch in. The code
shouldn't have to be so difficult. Roughly, it should be like:
Grob * last_bar = 0;
for (SCM s = elements ; gh_pair (s) ; s =gh_cdr (s))
{
Grob *m = unsmob_grob (gh_car (s))
if (last_bar){
Interval l; l[LEFT] = last_bar->extent (refp, y_axis)[DOWN]
l[RIGHT] = m->extent (refp, y_axis)[UP]
span_bar_mol.add (make_bar_molecule (l));
}
last_bar = m;
}
return span_bar_mol;
--
Han-Wen Nienhuys | address@hidden | http://www.cs.uu.nl/~hanwen/
- Bars, Juergen Reuter, 2001/04/20
- Bars, Han-Wen Nienhuys, 2001/04/22
- Re: Bars, Rune Zedeler, 2001/04/22
- Re: Bars, Juergen Reuter, 2001/04/24
- Re: Bars, Han-Wen Nienhuys, 2001/04/24
- Re: Bars, Juergen Reuter, 2001/04/29
- Re: Bars, Jan Nieuwenhuizen, 2001/04/30
- Re: Bars,
Han-Wen Nienhuys <=