#include "separation-item.hh"
#include "spacing-interface.hh"
#include "staff-spacing.hh"
#include "separation-item.hh"
#include "spacing-interface.hh"
#include "staff-spacing.hh"
-#include "accidental-placement.hh"
-#include "output-def.hh"
-#include "pointer-group-interface.hh"
-
-static bool
-non_empty_barline (Grob *me)
-{
- return Bar_line::has_interface (me) && !me->extent (me, X_AXIS).is_empty ();
-}
+#include "stem.hh"
+#include "warn.hh"
- SCM r = note_columns[i]->get_object ("rest");
- Grob *g = unsmob_grob (r);
- Grob *col = note_columns[i]->get_column ();
-
- if (!g)
- g = Note_column::first_head (note_columns[i]);
-
- /*
- Ugh. If Stem is switched off, we don't know what the
- first note head will be.
- */
- if (g)
- {
- if (g->common_refpoint (col, X_AXIS) != col)
- programming_error ("Note_spacing::get_spacing (): Common refpoint incorrect");
- else
- left_head_end = g->extent (col, X_AXIS)[RIGHT];
- }
+ SCM r = note_columns[i]->get_object ("rest");
+ Grob *g = unsmob_grob (r);
+ Grob *col = note_columns[i]->get_column ();
+
+ if (!g)
+ g = Note_column::first_head (note_columns[i]);
+
+ /*
+ Ugh. If Stem is switched off, we don't know what the
+ first note head will be.
+ */
+ if (g)
+ {
+ if (g->common_refpoint (col, X_AXIS) != col)
+ programming_error ("Note_spacing::get_spacing (): Common refpoint incorrect");
+ else
+ left_head_end = g->extent (col, X_AXIS)[RIGHT];
+ }
&& to_boolean (me->get_property ("space-to-barline")))
{
Grob *bar = Pointer_group_interface::find_grob (right_col,
&& to_boolean (me->get_property ("space-to-barline")))
{
Grob *bar = Pointer_group_interface::find_grob (right_col,
- {
- Real shift = bar->extent (right_col, X_AXIS)[LEFT];
- ideal -= shift;
- min_desired_space -= max (shift, 0.0);
- }
+ {
+ Real shift = bar->extent (right_col, X_AXIS)[LEFT];
+ ideal -= shift;
+ min_desired_space -= max (shift, 0.0);
+ }
head_extent = head->extent (rcolumn, X_AXIS);
if (!head_extent.is_empty ())
head_extent = head->extent (rcolumn, X_AXIS);
if (!head_extent.is_empty ())
- Drul_array<Interval> stem_posns,
- Direction left_stem_dir)
+ Drul_array<Interval> stem_posns,
+ Direction left_stem_dir)
this effect seems to be much more subtle than the
stem-direction stuff (why?), and also does not scale with the
difference in stem length.
this effect seems to be much more subtle than the
stem-direction stuff (why?), and also does not scale with the
difference in stem length.
Real delta = head_posns[-lowest][DOWN] - head_posns[lowest][UP];
Real corr = robust_scm2double (note_spacing->get_property ("same-direction-correction"), 0);
Real delta = head_posns[-lowest][DOWN] - head_posns[lowest][UP];
Real corr = robust_scm2double (note_spacing->get_property ("same-direction-correction"), 0);
- Correct for optical illusions. See [Wanske] p. 138. The combination
- up-stem + down-stem should get extra space, the combination
- down-stem + up-stem less.
+ Correct for optical illusions. See [Wanske] p. 138. The combination
+ up-stem + down-stem should get extra space, the combination
+ down-stem + up-stem less.
{
Drul_array<Direction> stem_dirs (CENTER, CENTER);
Drul_array<Interval> stem_posns;
Drul_array<Interval> head_posns;
Drul_array<SCM> props (me->get_object ("left-items"),
{
Drul_array<Direction> stem_dirs (CENTER, CENTER);
Drul_array<Interval> stem_posns;
Drul_array<Interval> head_posns;
Drul_array<SCM> props (me->get_object ("left-items"),
Drul_array<Spanner *> beams_drul (0, 0);
Drul_array<Grob *> stems_drul (0, 0);
Drul_array<Spanner *> beams_drul (0, 0);
Drul_array<Grob *> stems_drul (0, 0);
- rcolumn->break_status_dir (),
- &bar_xextent);
- if (bar && dynamic_cast<Item*> (bar)->get_column () == rcolumn)
+ rcolumn->break_status_dir (),
+ &bar_xextent);
+ if (bar && dynamic_cast<Item *> (bar)->get_column () == rcolumn)
- {
- Item *it = dynamic_cast<Item *> (items[i]);
- if (!Note_column::has_interface (it))
- continue;
- if (d == RIGHT && it->get_column () != rcolumn)
- continue;
-
- /*
- Find accidentals which are sticking out of the right side.
- */
- if (d == RIGHT)
+ {
+ Item *it = dynamic_cast<Item *> (items[i]);
+ if (!Note_column::has_interface (it))
+ continue;
+ if (d == RIGHT && it->get_column () != rcolumn)
+ continue;
+
+ /*
+ Find accidentals which are sticking out of the right side.
+ */
+ if (d == RIGHT)
- Grob *stem = Note_column::get_stem (it);
-
- if (!stem || !stem->is_live () || Stem::is_invisible (stem))
- return;
-
- stems_drul[d] = stem;
- beams_drul[d] = Stem::get_beam (stem);
-
- Direction stem_dir = get_grob_direction (stem);
- if (stem_dirs[d] && stem_dirs[d] != stem_dir)
- return;
-
- stem_dirs[d] = stem_dir;
-
- /*
- Correction doesn't seem appropriate when there is a large flag
- hanging from the note.
- */
- if (d == LEFT
- && Stem::duration_log (stem) > 2 && !Stem::get_beam (stem))
- return;
-
- Interval hp = Stem::head_positions (stem);
- if (!hp.is_empty ())
- {
- Real chord_start = hp[stem_dir];
-
- /*
- can't look at stem-end-position, since that triggers
- beam slope computations.
- */
- Real stem_end = hp[stem_dir] +
- stem_dir * robust_scm2double (stem->get_property ("length"), 7);
-
- stem_posns[d] = Interval (min (chord_start, stem_end),
- max (chord_start, stem_end));
- head_posns[d].unite (hp);
- }
- }
+ Grob *stem = Note_column::get_stem (it);
+
+ if (!stem || !stem->is_live () || Stem::is_invisible (stem))
+ return;
+
+ stems_drul[d] = stem;
+ beams_drul[d] = Stem::get_beam (stem);
+
+ Direction stem_dir = get_grob_direction (stem);
+ if (stem_dirs[d] && stem_dirs[d] != stem_dir)
+ return;
+
+ stem_dirs[d] = stem_dir;
+
+ /*
+ Correction doesn't seem appropriate when there is a large flag
+ hanging from the note.
+ */
+ if (d == LEFT
+ && Stem::duration_log (stem) > 2 && !Stem::get_beam (stem))
+ return;
+
+ Interval hp = Stem::head_positions (stem);
+ if (!hp.is_empty ())
+ {
+ Real chord_start = hp[stem_dir];
+
+ /*
+ can't look at stem-end-position, since that triggers
+ beam slope computations.
+ */
+ Real stem_end = hp[stem_dir]
+ + stem_dir * robust_scm2double (stem->get_property ("length"), 7);
+
+ stem_posns[d] = Interval (min (chord_start, stem_end),
+ max (chord_start, stem_end));
+ head_posns[d].unite (hp);
+ }
+ }
}
/*
Only apply same direction correction if there are no
accidentals sticking out of the right hand side.
*/
else if (stem_dirs[LEFT] * stem_dirs[RIGHT] == 1
}
/*
Only apply same direction correction if there are no
accidentals sticking out of the right hand side.
*/
else if (stem_dirs[LEFT] * stem_dirs[RIGHT] == 1
- "This object calculates spacing wishes for individual voices.",
-
- /* properties */
- "knee-spacing-correction "
- "left-items "
- "right-items "
- "same-direction-correction "
- "stem-spacing-correction "
- "space-to-barline "
- );
+ "This object calculates spacing wishes for individual voices.",
+
+ /* properties */
+ "knee-spacing-correction "
+ "left-items "
+ "right-items "
+ "same-direction-correction "
+ "stem-spacing-correction "
+ "space-to-barline "
+ );