From 3ccda71ed138fbb059bf25404b0cd2467916fe80 Mon Sep 17 00:00:00 2001 From: hanwen Date: Tue, 2 Apr 2002 12:27:37 +0000 Subject: [PATCH] '' --- ChangeLog | 6 +++ Documentation/regression-test.tely | 18 +++++-- input/regression/dot-flag-collision.ly | 18 +++++-- lily/beam.cc | 2 +- lily/chord-tremolo-engraver.cc | 4 +- lily/dot-column.cc | 2 +- lily/dots.cc | 4 ++ lily/include/stem.hh | 2 +- lily/note-spacing.cc | 2 +- lily/stem-engraver.cc | 4 +- lily/stem.cc | 67 ++++++++++++++++---------- scm/grob-description.scm | 1 - 12 files changed, 85 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b1a0f09ac..68b331b8fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-04-02 Han-Wen Nienhuys + + * 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 * VERSION: release 1.5.50 diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index fb74d544cd..c730a88366 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -23,17 +23,17 @@ documenting bugfixes. @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} @@ -41,6 +41,14 @@ documenting bugfixes. @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. diff --git a/input/regression/dot-flag-collision.ly b/input/regression/dot-flag-collision.ly index 267ffde42a..049d030bf9 100644 --- a/input/regression/dot-flag-collision.ly +++ b/input/regression/dot-flag-collision.ly @@ -1,8 +1,16 @@ +\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. } } diff --git a/lily/beam.cc b/lily/beam.cc index 82491cd972..0e8bf56f34 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -905,7 +905,7 @@ Real 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); diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 99711b84af..8f0b97500c 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -158,7 +158,7 @@ Chord_tremolo_engraver::acknowledge_grob (Grob_info info) 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); @@ -177,7 +177,7 @@ Chord_tremolo_engraver::acknowledge_grob (Grob_info info) 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); diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 584b3616e6..b37a995b1d 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -44,7 +44,7 @@ Dot_column::side_position (SCM element_smob, SCM axis) 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. diff --git a/lily/dots.cc b/lily/dots.cc index 0e1b6912a7..1af6f64c4e 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -56,6 +56,10 @@ Dots::brew_molecule (SCM d) /* 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))); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index fcda40ed7b..70051bed6b 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -18,7 +18,7 @@ public: DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM )); static Array 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*); diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 9126fc728a..314d2dd5bd 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -277,7 +277,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, 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; diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index da011fd60e..37f8ac7a8b 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -109,9 +109,9 @@ Stem_engraver::acknowledge_grob (Grob_info i) 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); diff --git a/lily/stem.cc b/lily/stem.cc index 752a0baef2..726f71a2ab 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -28,6 +28,7 @@ #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) @@ -277,7 +278,7 @@ Stem::get_default_stem_end_position (Grob*me) a.push (gh_scm2double (ly_car (q))); // stem uses half-spaces - length_f = a[ ((flag_i (me) - 2) >? 0) ? 0) ? 0) ? 0) 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 @@ -335,36 +336,43 @@ Stem::get_default_stem_end_position (Grob*me) 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; @@ -508,6 +516,13 @@ Stem::flag (Grob*me) 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)); @@ -524,7 +539,7 @@ Stem::flag (Grob*me) } 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 ()) @@ -540,7 +555,7 @@ Stem::dim_callback (SCM e, SCM ax) 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 { @@ -593,7 +608,7 @@ Stem::brew_molecule (SCM smob) 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); diff --git a/scm/grob-description.scm b/scm/grob-description.scm index d48295cd4e..45644a2fd3 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -223,7 +223,6 @@ . ( (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)))) )) -- 2.39.5