+2002-04-02 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * lily/stem.cc (duration_log): change from flag_i (); better
+ naming.
+ (get_default_stem_end_position): fix dot/flag collision code.
+
2002-04-02 Han-Wen <hanwen@cs.uu.nl>
* VERSION: release 1.5.50
@section Notes and rests
-@lilypondfile[printfilename]{rest.ly}
-
-@lilypondfile[printfilename]{rest-ledger.ly}
-
@lilypondfile[printfilename]{note-head-style.ly}
@lilypondfile[printfilename]{mensural.ly}
@lilypondfile[printfilename]{easy-notation.ly}
-@lilypondfile[printfilename]{dots.ly}
+@section Rests
+
+@lilypondfile[printfilename]{rest-ledger.ly}
+
+@lilypondfile[printfilename]{rest.ly}
@lilypondfile[printfilename]{multi-measure-rest.ly}
@lilypondfile[printfilename]{rest-pitch.ly}
+
+@section Dots
+
+@lilypondfile[printfilename]{dots.ly}
+
+@lilypondfile[printfilename]{dot-flag-collision.ly}
+
+
@section Accidentals
Accidentals are currently in a development stage.
+\header {
+ texidoc = "Dots move to the right when a collision with the (up)flag happens"
+}
-\header { texidoc = "Dots are moved right if flags and dots
-collide. This doesn't happens when the dot fits beneath the flag " }
-
-\score{
- \notes\relative c'{ f8. g f16. g f32. g}
+\score {
+ \notes\relative c''
+ {
+ \time 8/4
+ \property Staff.autoBeaming = ##f
+ a,16.
+ g''16.
+ a,4. a8 a8. a16. c,16. g16.
+ }
+ \paper { linewidth = -1. }
}
Beam::calc_stem_y (Grob *me, Grob* s, Interval pos)
{
int beam_multiplicity = get_multiplicity (me);
- int stem_multiplicity = (Stem::flag_i (s) - 2) >? 0;
+ int stem_multiplicity = (Stem::duration_log (s) - 2) >? 0;
Real thick = gh_scm2double (me->get_grob_property ("thickness"));
Real interbeam = get_interbeam (me);
if (Stem::has_interface (info.grob_l_))
{
Grob * s = info.grob_l_;
- int f = Stem::flag_i (s);
+ int f = Stem::duration_log (s);
f = (f > 2) ? f - 2 : 1;
Stem::set_beaming (s, f, LEFT);
Stem::set_beaming (s, f, RIGHT);
SCM d = s->get_grob_property ("direction");
if (Stem::type_i (s) != 1)
{
- int gap_i =Stem::flag_i (s) - ((Stem::type_i (s) >? 2) - 2);
+ int gap_i =Stem::duration_log (s) - ((Stem::type_i (s) >? 2) - 2);
beam_p_->set_grob_property ("gap", gh_int2scm (gap_i));
}
s->set_grob_property ("direction", d);
Grob * stem = unsmob_grob (me->get_grob_property ("stem"));
if (stem
&& !Stem::beam_l (stem)
- && Stem::flag_i (stem))
+ && Stem::duration_log (stem) > 2)
{
/*
trigger stem end & direction calculation.
/*
we need to add a real blank box, to assure that
side-positioning doth not cancel the left-most padding. */
+
+ /*
+ TODO: this should be handled by side-position padding.
+ */
mol = Lookup::blank (Box (Interval (0,0),
Interval (0,0)));
DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static Array<int> note_head_positions (Grob*);
- static int flag_i (Grob*) ;
+ static int duration_log (Grob*) ;
static int beam_count (Grob*,Direction) ;
static void set_beaming (Grob*,int, Direction d);
static Grob * beam_l (Grob*);
hanging from the note.
*/
if (d == LEFT
- && Stem::flag_i (stem) && !Stem::beam_l (stem))
+ && Stem::duration_log (stem) > 2 && !Stem::beam_l (stem))
{
correct = false;
goto exit_func;
announce_grob(stem_p_, i.music_cause ()->self_scm());
}
- if (Stem::flag_i (stem_p_) != duration_log)
+ if (Stem::duration_log (stem_p_) != duration_log)
{
- i.music_cause ()->origin ()->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << Stem::flag_i (stem_p_)));
+ i.music_cause ()->origin ()->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << Stem::duration_log (stem_p_)));
}
Stem::add_head (stem_p_,h);
#include "staff-symbol-referencer.hh"
#include "spanner.hh"
#include "side-position-interface.hh"
+#include "dot-column.hh"
void
Stem::set_beaming (Grob*me ,int i, Direction d)
a.push (gh_scm2double (ly_car (q)));
// stem uses half-spaces
- length_f = a[ ((flag_i (me) - 2) >? 0) <? (a.size () - 1)] * 2;
+ length_f = a[ ((duration_log (me) - 2) >? 0) <? (a.size () - 1)] * 2;
}
// stem uses half-spaces
// fixme: use scm_list_n_ref () iso. array[]
- Real shorten_f = a[ ((flag_i (me) - 2) >? 0) <? (a.size () - 1)] * 2;
+ Real shorten_f = a[ ((duration_log (me) - 2) >? 0) <? (a.size () - 1)] * 2;
/* On boundary: shorten only half */
if (abs (chord_start_f (me)) == 0.5)
Interval hp = head_positions (me);
Real st = hp[dir] + dir * length_f;
-
-
+ bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
+ if (!grace_b && !no_extend_b && dir * st < 0) // junkme?
+ st = 0.0;
/*
- Make a little room if we have a flag and there is a dot.
-
- TODO:
-
- maybe we should consider moving the dot to the right?
+ Make a little room if we have a upflag and there is a dot.
+ previous approach was to lengthen the stem. This is not
+ good typesetting practice.
+
*/
- if (!beam_l (me)
- && flag_i (me))
+ if (!beam_l (me) && dir == UP
+ && duration_log (me) > 2)
{
Grob * closest_to_flag = extremal_heads (me)[dir];
Grob * dots = closest_to_flag
if (dots)
{
Real dp = Staff_symbol_referencer::position_f (dots);
- Real flagy = flag (me).extent (Y_AXIS)[-dir] * 2; // should divide by staffspace
+ Real flagy = flag (me).extent (Y_AXIS)[-dir] * 2
+ / Staff_symbol_referencer::staff_space (me);
/*
Very gory: add myself to the X-support of the parent,
which should be a dot-column.
*/
if (dir * (st + flagy - dp) < 0.5)
- Side_position_interface::add_support (dots->get_parent (X_AXIS), me);
-
- /*
- previous approach was to lengthen the stem. This is not
- good typesetting practice. */
+ {
+ Grob *par = dots->get_parent (X_AXIS);
+
+ if (Dot_column::has_interface (par))
+ {
+ Side_position_interface::add_support (par, me);
+
+ /*
+ TODO: apply some better logic here. The flag is
+ curved inwards, so this will typically be too
+ much.
+ */
+ }
+ }
}
}
- bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
- if (!grace_b && !no_extend_b && dir * st < 0) // junkme?
- st = 0.0;
-
return st;
}
/*
- Number of hooks on the flag, ie. the log of the duration.
+
+ the log of the duration (Number of hooks on the flag minus two)
*/
int
-Stem::flag_i (Grob*me)
+Stem::duration_log (Grob*me)
{
SCM s = me->get_grob_property ("duration-log");
return (gh_number_p (s)) ? gh_scm2int (s) : 2;
looks slightly misplaced, but that will usually be the
programmer's fault (e.g. when trying to attach multiple
note heads to a single stem in mensural notation). */
+
+ /*
+ perhaps the detection whether this correction is needed should
+ happen in a different place to avoid the recursion.
+
+ --hwn.
+ */
Grob *first = first_head(me);
int sz = Staff_symbol_referencer::line_count (me)-1;
int p = (int)rint (Staff_symbol_referencer::position_f (first));
}
char c = (get_direction (me) == UP) ? 'u' : 'd';
String index_str
- = String ("flags-") + style + to_str (c) + staffline_offs + to_str (flag_i (me));
+ = String ("flags-") + style + to_str (c) + staffline_offs + to_str (duration_log (me));
Molecule m
= Font_interface::get_default_font (me)->find_by_name (index_str);
if (!fstyle.empty_b ())
assert (a == X_AXIS);
Grob *se = unsmob_grob (e);
Interval r (0, 0);
- if (unsmob_grob (se->get_grob_property ("beam")) || abs (flag_i (se)) <= 2)
+ if (unsmob_grob (se->get_grob_property ("beam")) || abs (duration_log (se)) <= 2)
; // TODO!
else
{
mol.add_molecule (ss);
}
- if (!beam_l (me) && abs (flag_i (me)) > 2)
+ if (!beam_l (me) && abs (duration_log (me)) > 2)
{
Molecule fl = flag (me);
fl.translate_axis (stem_y[d]*dy, Y_AXIS);
. (
(molecule-callback . ,Dots::brew_molecule)
(dot-count . 1)
- (staff-position . 0.0)
(Y-offset-callbacks . (,Dots::quantised_position_callback ,Staff_symbol_referencer::callback))
(meta . ((interfaces . (font-interface staff-symbol-referencer-interface dots-interface))))
))