array for staves found.
* lily/metronome-engraver.cc (stop_translation_timestep): set grob
array for stavesFound.
* lily/staff-spacing.cc (next_note_correction): add fixed and
space to calling convention. This fixes spacing of accidentals
after barlines.
* input/regression/spacing-accidental-stretch.ly: add barline -
accidental case.
2005-08-15 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/mark-engraver.cc (stop_translation_timestep): set grob
+ array for staves found.
+
+ * lily/metronome-engraver.cc (stop_translation_timestep): set grob
+ array for stavesFound.
+
+ * lily/staff-spacing.cc (next_note_correction): add fixed and
+ space to calling convention. This fixes spacing of accidentals
+ after barlines.
+
+ * input/regression/spacing-accidental-stretch.ly: add barline -
+ accidental case.
+
* scm/framework-ps.scm (page-header): add version number to
creator
(eps-header): idem.
\score {
\relative c'' \context GrandStaff {
#(set-accidental-style 'piano-cautionary)
- d16 d d d d d cis d
+ \time 2/4
+ d16 d d d d d cis d dis dis dis dis
}
%% not raggedright!!
- \layout { linewidth = 14.\cm
+ \layout { linewidth = 18.\cm
}
}
class Staff_spacing
{
public:
- static Real next_notes_correction (Grob *, Grob *);
- static Real next_note_correction (Grob *, Grob *, Interval);
+ static void next_notes_correction (Grob *, Grob *, Real *, Real *);
+ static void next_note_correction (Grob *, Grob *, Interval, Real*, Real *);
static bool has_interface (Grob *);
static void get_spacing_params (Grob *, Real *, Real *);
#include "item.hh"
#include "warn.hh"
#include "text-interface.hh"
+#include "grob-array.hh"
/**
put stuff over or next to bars. Examples: bar numbers, marginal notes,
{
if (text_)
{
- SCM lst = get_property ("stavesFound");
- text_->set_object ("side-support-elements", lst);
+ text_->set_object ("side-support-elements",
+ grob_list_to_grob_array (get_property ("stavesFound")));
text_ = 0;
}
mark_ev_ = 0;
#include <cctype>
+#include "engraver.hh"
+
#include "note-column.hh"
-#include "bar-line.hh"
-#include "time-signature.hh"
-#include "engraver-group-engraver.hh"
#include "context.hh"
+#include "grob-array.hh"
/**
put stuff over or next to bars. Examples: bar numbers, marginal notes,
{
Grob *mc = unsmob_grob (get_property ("currentMusicalColumn"));
text_->set_parent (mc, X_AXIS);
- text_->set_object ("side-support-elements", get_property ("stavesFound"));
+ text_->set_object ("side-support-elements",
+ grob_list_to_grob_array (get_property ("stavesFound")));
text_ = 0;
}
}
ADD_INTERFACE (Paper_column, "paper-column-interface",
- "@code{Paper_column} objects form the top-most X-parents for items. "
+ "@code{Paper_column} objects form the top-most X-parents for items."
" The are two types of columns: musical columns, where are attached to, and "
" non-musical columns, where bar-lines, clefs etc. are attached to. "
" The spacing engine determines the X-positions of these objects."
+
"\n\n"
"They are\n"
" numbered, the first (leftmost) is column 0. Numbering happens before\n"
" line-breaking, and columns are not renumbered after line breaking.\n"
" Since many columns go unused, you should only use the rank field to\n"
" get ordering information. Two adjacent columns may have\n"
- " non-adjacent numbers.\n"
- "\n",
- "between-cols when bounded-by-me "
- "page-penalty shortest-playing-duration shortest-starter-duration");
+ " non-adjacent numbers.\n",
+
+
+ "between-cols "
+ "bounded-by-me "
+ "page-penalty "
+ "shortest-playing-duration "
+ "shortest-starter-duration "
+ "when ");
void
Paper_column::do_break_processing ()
extract_grob_set (me, "bounded-by-me", bbm);
if (bbm.size ())
return true;
+
return Item::is_breakable (me);
}
Insert some more space for the next note, in case it has a stem in
the wrong direction
*/
-Real
+void
Staff_spacing::next_note_correction (Grob *me,
Grob *g,
- Interval bar_size)
+ Interval bar_size,
+ Real *space,
+ Real *fix)
{
+ (void)space;
+
if (!g || !Note_column::has_interface (g))
- return 0.0;
+ return ;
Item *col = dynamic_cast<Item *> (g)->get_column ();
Real max_corr = max (0., (- g->extent (col, X_AXIS)[LEFT]));
max_corr = max (max_corr, corr);
}
}
- return max_corr;
+
+ *fix += max_corr;
}
/*
pointers to the separation-items, not the note-columns or
note-spacings.
*/
-Real
-Staff_spacing::next_notes_correction (Grob *me, Grob *last_grob)
+void
+Staff_spacing::next_notes_correction (Grob *me, Grob *last_grob,
+ Real *compound_space, Real *compound_fixed
+ )
{
Interval bar_size = bar_y_positions (last_grob);
- Real max_corr = 0.0;
extract_grob_set (me, "right-items", right_items);
+
+ *compound_fixed = 0.0;
+ *compound_space = 0.0;
+ int wishes;
+
for (int i = right_items.size (); i--;)
{
Grob *g = right_items[i];
- max_corr = max (max_corr, next_note_correction (me, g, bar_size));
+ Real space = 0.0;
+ Real fixed = 0.0;
+
+ next_note_correction (me, g, bar_size, &space, &fixed);
+
+ *compound_space += space;
+ *compound_fixed += fixed;
+ wishes ++;
+
extract_grob_set (g, "elements", elts);
for (int j = elts.size (); j--;)
- max_corr = max (max_corr, next_note_correction (me, elts[j], bar_size));
+ {
+ Real space = 0.0;
+ Real fixed = 0.0;
+ next_note_correction (me, elts[j], bar_size, &space, &fixed);
+ *compound_fixed += fixed;
+ *compound_space += space;
+ wishes ++;
+ }
}
- return max_corr;
+ if (wishes)
+ {
+ *compound_space /= wishes;
+ *compound_fixed /= wishes;
+ }
}
void
}
// printf ("doing col %d\n" , Paper_column::get_rank (left_col));
-
if (!separation_item)
{
programming_error ("no sep item");
*fixed = *space;
}
- *space += next_notes_correction (me, last_grob);
+ Real correction_fixed, correction_space;
+ next_notes_correction (me, last_grob, &correction_space, &correction_fixed );
+ *space += correction_space;
+ *fixed += correction_fixed;
}
ADD_INTERFACE (Staff_spacing, "staff-spacing-interface",