+2006-09-17 Joe Neeman <joeneeman@gmail.com>
+
+ * scm/define-music-types.scm (music-descriptions): remove
+ BreakEvent and fix {Page,Line}{Break,Turn}Event so
+ Music::to_event doesn't complain.
+
+ * lily/accidental-placement.cc (ape_compare):
+ * lily/semi-tie.cc (compare):
+ * lily/note-column.cc (shift_compare): replace by XXX_less
+
+ * lily/tie-formatting-problem.cc (set_chord_outline):
+ * lily/tie-column.cc (calc_positioning_done):
+ * lily/system.cc (post_processing)
+ (get_paper_system):
+ * lily/stem.cc (note_head_positions)
+ (calc_positioning_done):
+ * lily/spanner.cc (do_break_processing)
+ (find_broken_piece):
+ * lily/span-bar.cc (print):
+ * lily/semi-tie-column.cc (calc_positioning_done):
+ * lily/rest-collision.cc (calc_positioning_done):
+ * lily/program-option.cc (get_help_string):
+ * lily/note-collision.cc (get_clash_groups):
+ * lily/new-fingering-engraver.cc (position_scripts):
+ * lily/keyword.cc (Keyword_table):
+ * lily/hara-kiri-group-spanner.cc (request_suicide):
+ * lily/grob-pq-engraver.cc (stop_translation_timestep):
+ * lily/accidental-placement.cc (calc_positioning_done):
+ (stagger_apes):
+ * lily/beam.cc (get_beam_segments):
+ * lily/grob-array.cc (remove_duplicates):
+ use new vector_sort
+
+ * input/mutopia/W.A.Mozart/mozart-hrn3-defs.ily:
+ ragged-last-bottom = ##f (test the new page breaker)
+
+ * flower/include/std-vector.hh (vector_sort): use STL sort stuff
+
+ * scm/define-context-properties.scm
+ (all-internal-translation-properties): remove properties that
+ were used to communicate page-turn stuff to the paper-column
+ engraver.
+
+ * lily/lily-guile.cc (robust_scm2string): new function
+
+ * lily/paper-column-engraver.cc: Clean up page turn stuff
+
+ * lily/page-turn-engraver.cc: Re-write the page turn logic here
+ instead of cluttering up paper-column-engraver.cc
+
2006-09-17 Nicolas Sceaux <nicolas.sceaux@free.fr>
* scm/layout-page-dump.scm (scm): export utility function names,
at (RIGHT) = t;
}
- static int left_comparison (Interval_t<T> const &a, Interval_t<T> const &b)
+ static bool left_less (Interval_t<T> const &a, Interval_t<T> const &b)
{
- return sign (a[LEFT] - b[RIGHT]);
+ return a[LEFT] < b[RIGHT];
}
};
return lb;
}
-#if 0
-/* FIXME: the COMPARE functionality is broken? */
-template<typename T>
+template<typename T, typename Compare>
void
-vector_sort (vector<T> &v, int (*compare) (T const &, T const &),
- vsize lower=VPOS, vsize upper=VPOS)
+vector_sort (vector<T> &v,
+ Compare less,
+ vsize b=0, vsize e=VPOS)
{
- typename vector<T>::iterator b = v.begin ();
- typename vector<T>::iterator e = v.begin ();
- if (lower == VPOS)
- {
- lower = 0;
- upper = v.size ();
- }
- sort (b + lower, e + upper, compare);
-}
-#else
+ if (e == VPOS)
+ e = v.size ();
-// ugh, c&p
-template<typename T> void
-vector_sort (vector<T> &v, int (*compare) (T const &, T const &),
- vsize lower=VPOS, vsize upper=VPOS)
-{
- if (lower == VPOS)
- {
- lower = 0;
- upper = v.size () - 1;
- }
- if (upper == VPOS || lower >= upper)
- return;
- swap (v[lower], v[(lower + upper) / 2]);
- vsize last = lower;
- for (vsize i = lower +1; i <= upper; i++)
- if (compare (v[i], v[lower]) < 0)
- swap (v[++last], v[i]);
- swap (v[lower], v[last]);
- vector_sort (v, compare, lower, last - 1);
- vector_sort (v, compare, last + 1, upper);
+ sort (v.begin () + b, v.begin () + e, less);
}
-#endif
template<typename T>
void
indent = 10. \mm
line-width = 189. \mm
+ ragged-last-bottom = ##f
}
return sign (ape_priority (a) - ape_priority (b));
}
+bool ape_less (Accidental_placement_entry *const &a,
+ Accidental_placement_entry *const &b)
+{
+ return ape_priority (a) < ape_priority (b);
+}
+
int ape_rcompare (Accidental_placement_entry *const &a,
Accidental_placement_entry *const &b)
{
{
vector<Accidental_placement_entry*> asc = *apes;
- vector_sort (asc, &ape_compare);
+ vector_sort (asc, &ape_less);
apes->clear ();
for (vsize i = note_cols.size (); i--;)
concat (heads, extract_grob_array (note_cols[i], "note-heads"));
- vector_sort (heads, default_compare);
+ vector_sort (heads, less<Grob*> ());
uniq (heads);
common[Y_AXIS] = common_refpoint_of_array (heads, common[Y_AXIS], Y_AXIS);
i != stem_segments.end (); i++)
{
vector<Beam_stem_segment> segs = (*i).second;
- vector_sort (segs, default_compare);
+ vector_sort (segs, less<Beam_stem_segment> ());
Beam_segment current;
}
}
- vector_sort (dots, &compare_position);
+ vector_sort (dots, position_less);
for (vsize i = dots.size (); i--;)
if (!dots[i]->is_live ())
dots.erase (dots.begin () + i);
{
assert (!ordered_);
- vector_sort (grobs_, default_compare);
+ vector_sort (grobs_, less<Grob*> ());
::uniq (grobs_);
}
{
Grob *grob_;
Moment end_;
- static int compare (Grob_pq_entry const &a,
- Grob_pq_entry const &b)
- {
- return Moment::compare (a.end_, b.end_);
- }
};
+bool
+operator< (Grob_pq_entry const &a, Grob_pq_entry const &b)
+{
+ return a.end_ < b.end_;
+}
+
class Grob_pq_engraver : public Engraver
{
public:
while (scm_is_pair (busy) && *unsmob_moment (scm_caar (busy)) == now)
busy = scm_cdr (busy);
- vector_sort (started_now_, Grob_pq_entry::compare);
+ vector_sort (started_now_, less<Grob_pq_entry> ());
SCM lst = SCM_EOL;
SCM *tail = &lst;
for (vsize i = 0; i < started_now_.size (); i++)
for (int j = iv[LEFT]; j <= iv[RIGHT]; j++)
ranks.push_back (j);
}
- vector_sort (ranks, default_compare);
+ vector_sort (ranks, less<int> ());
uniq (ranks);
SCM scm_vec = scm_c_make_vector (ranks.size (), SCM_EOL);
Drul_array<bool> robust_scm2booldrul (SCM, Drul_array<bool>);
Interval robust_scm2interval (SCM, Drul_array<Real>);
Offset robust_scm2offset (SCM, Offset);
+string robust_scm2string (SCM, string);
SCM ly_quote_scm (SCM s);
bool type_check_assignment (SCM val, SCM sym, SCM type_symbol);
class Note_column
{
public:
- static int shift_compare (Grob *const &, Grob *const &);
+ static bool shift_less (Grob *const &, Grob *const &);
static Direction dir (Grob *me);
static Grob *accidentals (Grob *me);
static Grob *arpeggio (Grob *me);
bool first_;
Moment last_moment_;
- Paper_column *last_special_barline_column_;
- Paper_column *last_breakable_column_;
- vector<Paper_column*> page_turnable_columns_;
public:
};
DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM));
- static int compare (Grob *const &s1,
- Grob *const &s2);
+ static bool less (Grob *const &s1,
+ Grob *const &s2);
static int get_position (Grob *);
};
Real spanner_length () const;
static int compare (Spanner *const &, Spanner *const &);
- static bool less_than (Spanner *const &, Spanner *const &);
+ static bool less (Spanner *const &, Spanner *const &);
virtual Grob *find_broken_piece (System *) const;
virtual void derived_mark () const;
static bool has_interface (Grob *);
static int get_rounded_position (Grob *);
};
-int compare_position (Grob *const &, Grob *const &);
+int compare_position (Grob *const &, Grob *const &);\
+bool position_less (Grob *const &, Grob *const &);
#endif /* STAFF_SYMBOL_REFERENCER_HH */
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM));
- static int compare (Grob *const &s1,
- Grob *const &s2);
+ static bool less (Grob *const &s1,
+ Grob *const &s2);
};
return strcmp (p1.name_, p2.name_) < 0;
}
-int tabcmp (Keyword_ent const &p1, Keyword_ent const &p2)
-{
- return strcmp (p1.name_, p2.name_);
-}
-
Keyword_table::Keyword_table (Keyword_ent *tab)
{
while (tab->name_)
table_.push_back (*tab++);
- vector_sort (table_, tabcmp);
+ vector_sort (table_, tab_less);
}
vsize
return o;
}
+string
+robust_scm2string (SCM k, string s)
+{
+ if (scm_is_string (k))
+ s = ly_scm2string (k);
+ return s;
+}
+
int
robust_scm2int (SCM k, int o)
{
note_event_ = finger_event_ = 0;
follow_into_staff_ = false;
}
- static int compare (Finger_tuple const &c1, Finger_tuple const &c2)
- {
- return c1.position_- c2.position_;
- }
};
+bool
+operator< (Finger_tuple const &a, Finger_tuple const &b)
+{
+ return a.position_ < b.position_;
+}
+
class New_fingering_engraver : public Engraver
{
vector<Finger_tuple> fingerings_;
}
}
- vector_sort (*scripts, Finger_tuple::compare);
+ vector_sort (*scripts, less<Finger_tuple> ());
bool up_p = scm_c_memq (ly_symbol2scm ("up"), orientations) != SCM_BOOL_F;
bool down_p = scm_c_memq (ly_symbol2scm ("down"), orientations) != SCM_BOOL_F;
do
{
vector<Grob*> &clashes (clash_groups[d]);
- vector_sort (clashes, Note_column::shift_compare);
+ vector_sort (clashes, Note_column::shift_less);
}
while ((flip (&d)) != UP);
return unsmob_grob (me->get_object ("rest"));
}
-int
-Note_column::shift_compare (Grob *const &p1, Grob *const &p2)
+bool
+Note_column::shift_less (Grob *const &p1, Grob *const &p2)
{
SCM s1 = p1->get_property ("horizontal-shift");
SCM s2 = p2->get_property ("horizontal-shift");
int h1 = (scm_is_number (s1)) ? scm_to_int (s1) : 0;
int h2 = (scm_is_number (s2)) ? scm_to_int (s2) : 0;
- return h1 - h2;
+ return h1 < h2;
}
Item *
#include "grob.hh"
#include "international.hh"
#include "moment.hh"
+#include "paper-column.hh"
+#include "stream-event.hh"
#include "warn.hh"
+#include "translator.icc"
+
+class Page_turn_event {
+public:
+ SCM permission_;
+ Real penalty_;
+ Interval_t<Rational> duration_;
+
+ Page_turn_event (Rational start, Rational end, SCM perm, Real pen)
+ {
+ duration_[LEFT] = start;
+ duration_[RIGHT] = end;
+ permission_ = perm;
+ penalty_ = pen;
+ }
+
+ /* Suppose we have decided on a possible page turn, only to change
+ out mind later (for example, if there is a volta repeat and it
+ would be difficult to turn the page back). Then we need to
+ re-penalize a region of the piece. Depending on how the events
+ intersect, we may have to split it into as many as 3 pieces.
+ */
+ vector<Page_turn_event> penalize (Page_turn_event const &penalty)
+ {
+ Interval_t<Rational> intersect = intersection (duration_, penalty.duration_);
+ vector<Page_turn_event> ret;
+
+ if (intersect.is_empty ())
+ {
+ ret.push_back (*this);
+ return ret;
+ }
+
+ Real new_pen = max (penalty_, penalty.penalty_);
+
+ if (duration_[LEFT] < penalty.duration_[LEFT])
+ ret.push_back (Page_turn_event (duration_[LEFT], penalty.duration_[LEFT], permission_, penalty_));
+
+ if (penalty.permission_ != SCM_EOL)
+ ret.push_back (Page_turn_event (intersect[LEFT], intersect[RIGHT], permission_, new_pen));
+
+ if (penalty.duration_[RIGHT] < duration_[RIGHT])
+ ret.push_back (Page_turn_event (penalty.duration_[RIGHT], duration_[LEFT], permission_, penalty_));
+
+ return ret;
+ }
+};
+
class Page_turn_engraver : public Engraver
{
Moment rest_begin_;
Moment note_end_;
Rational repeat_begin_rest_length_;
+ vector<Page_turn_event> forced_breaks_;
+ vector<Page_turn_event> automatic_breaks_;
+ vector<Page_turn_event> repeat_penalties_;
+
+ /* the next 3 are in sync (ie. same number of elements, etc.) */
+ vector<Rational> breakable_moments_;
+ vector<Grob*> breakable_columns_;
+ vector<bool> special_barlines_;
+
+ SCM max_permission (SCM perm1, SCM perm2);
Real penalty (Rational rest_len);
+ Grob *breakable_column (Page_turn_event const &);
protected:
+ DECLARE_TRANSLATOR_LISTENER (break);
DECLARE_ACKNOWLEDGER (note_head);
public:
TRANSLATOR_DECLARATIONS (Page_turn_engraver);
void stop_translation_timestep ();
+ void start_translation_timestep ();
+ void finalize ();
};
Page_turn_engraver::Page_turn_engraver ()
note_end_ = 0;
}
+Grob*
+Page_turn_engraver::breakable_column (Page_turn_event const &brk)
+{
+ vsize start = lower_bound (breakable_moments_, brk.duration_[LEFT], less<Rational> ());
+ vsize end = upper_bound (breakable_moments_, brk.duration_[RIGHT], less<Rational> ());
+
+ if (start == breakable_moments_.size ())
+ return NULL;
+ if (end == breakable_moments_.size () || breakable_moments_[end] > brk.duration_[RIGHT])
+ {
+ if (end == 0)
+ return NULL;
+ end--;
+ }
+
+ for (vsize i = end + 1; i-- > start;)
+ if (special_barlines_[i])
+ return breakable_columns_[i];
+
+ return breakable_columns_[end];
+}
+
Real
Page_turn_engraver::penalty (Rational rest_len)
{
- Rational min_turn = robust_scm2moment (get_property ("minPageTurnLength"), Moment (1)).main_part_;
+ Rational min_turn = robust_scm2moment (get_property ("minimumPageTurnLength"), Moment (1)).main_part_;
return (rest_len < min_turn) ? infinity_f : 0;
}
{
Real pen = penalty ((now_mom () - rest_begin_).main_part_);
if (!isinf (pen))
- {
- SCM val = scm_cons (rest_begin_.smobbed_copy (), scm_from_double (pen));
- context ()->get_score_context ()->set_property ("allowPageTurn", val);
- }
+ automatic_breaks_.push_back (Page_turn_event (rest_begin_.main_part_,
+ now_mom ().main_part_,
+ ly_symbol2scm ("allow"), 0));
}
if (rest_begin_ <= repeat_begin_)
note_end_ = now_mom () + Moment (Duration (dur_log, dot_count).get_length ());
}
+IMPLEMENT_TRANSLATOR_LISTENER (Page_turn_engraver, break);
+void
+Page_turn_engraver::listen_break (Stream_event *ev)
+{
+ string name = ly_scm2string (scm_symbol_to_string (ev->get_property ("class")));
+
+ if (name == "page-turn-event")
+ {
+ SCM permission = ev->get_property ("break-permission");
+ Real penalty = robust_scm2double (ev->get_property ("break-penalty"), 0);
+ Rational now = now_mom ().main_part_;
+
+ forced_breaks_.push_back (Page_turn_event (now, now, permission, penalty));
+ }
+}
+
+void
+Page_turn_engraver::start_translation_timestep ()
+{
+ /* What we want to do is to build a list of all the
+ breakable paper columns. In general, paper-columns won't be marked as
+ such until the Paper_column_engraver has done stop_translation_timestep.
+
+ Therefore, we just grab /all/ paper columns (in the
+ stop_translation_timestep, since they're not created here yet)
+ and remove the non-breakable ones at the beginning of the following
+ timestep.
+ */
+
+ if (breakable_columns_.size () && !Paper_column::is_breakable (breakable_columns_.back ()))
+ {
+ breakable_columns_.pop_back ();
+ breakable_moments_.pop_back ();
+ special_barlines_.pop_back ();
+ }
+}
+
void
Page_turn_engraver::stop_translation_timestep ()
{
+ Grob *pc = unsmob_grob (get_property ("currentCommandColumn"));
+
+ if (pc)
+ {
+ breakable_columns_.push_back (pc);
+ breakable_moments_.push_back (now_mom ().main_part_);
+
+ SCM bar_scm = get_property ("whichBar");
+ string bar = robust_scm2string (bar_scm, "");
+
+ special_barlines_.push_back (bar != "" && bar != "|");
+ }
+
/* C&P from Repeat_acknowledge_engraver */
SCM cs = get_property ("repeatCommands");
bool start = false;
if (end && repeat_begin_.main_part_ >= Moment (0))
{
+ Rational now = now_mom ().main_part_;
Real pen = penalty ((now_mom () - rest_begin_).main_part_ + repeat_begin_rest_length_);
Moment *m = unsmob_moment (get_property ("minimumRepeatLengthForPageTurn"));
if (m && *m > (now_mom () - repeat_begin_))
pen = infinity_f;
- if (pen > 0)
- {
- SCM val = scm_cons (repeat_begin_.smobbed_copy (), scm_from_double (pen));
- context ()->get_score_context ()->set_property ("revokePageTurns", val);
- }
+
+ if (pen == infinity_f)
+ repeat_penalties_.push_back (Page_turn_event (repeat_begin_.main_part_, now, SCM_EOL, -infinity_f));
+ else
+ repeat_penalties_.push_back (Page_turn_event (repeat_begin_.main_part_, now, ly_symbol2scm ("allow"), pen));
+
repeat_begin_ = Moment (-1);
}
+
if (start)
{
repeat_begin_ = now_mom ();
rest_begin_ = note_end_;
}
-#include "translator.icc"
+/* return the most permissive symbol (where force is the most permissive and
+ forbid is the least
+*/
+SCM
+Page_turn_engraver::max_permission (SCM perm1, SCM perm2)
+{
+ if (perm1 == SCM_EOL)
+ return perm2;
+ if (perm1 == ly_symbol2scm ("allow") && perm2 == ly_symbol2scm ("force"))
+ return perm2;
+ return perm1;
+}
+
+void
+Page_turn_engraver::finalize ()
+{
+ vsize rep_index = 0;
+ vector<Page_turn_event> auto_breaks;
+
+ /* filter the automatic breaks through the repeat penalties */
+ for (vsize i = 0; i < automatic_breaks_.size (); i++)
+ {
+ Page_turn_event &brk = automatic_breaks_[i];
+
+ /* find the next applicable repeat penalty */
+ for (;
+ rep_index < repeat_penalties_.size ()
+ && repeat_penalties_[rep_index].duration_[RIGHT] <= brk.duration_[LEFT];
+ rep_index++)
+ ;
+
+ if (rep_index >= repeat_penalties_.size ()
+ || brk.duration_[RIGHT] <= repeat_penalties_[rep_index].duration_[LEFT])
+ auto_breaks.push_back (brk);
+ else
+ {
+ vector<Page_turn_event> split = brk.penalize (repeat_penalties_[rep_index]);
+
+ /* it's possible that the last of my newly-split events overlaps the next repeat_penalty,
+ in which case we need to refilter that event */
+ if (rep_index < repeat_penalties_.size () - 1
+ && split.size ()
+ && split.back ().duration_[RIGHT] > repeat_penalties_[rep_index+1].duration_[LEFT])
+ {
+ automatic_breaks_[i] = split.back ();
+ split.pop_back ();
+ i--;
+ }
+ auto_breaks.insert (auto_breaks.end (), split.begin (), split.end ());
+ }
+ }
+
+ /* apply the automatic breaks */
+ for (vsize i = 0; i < auto_breaks.size (); i++)
+ {
+ Page_turn_event const &brk = auto_breaks[i];
+ Grob *pc = breakable_column (auto_breaks[i]);
+ if (pc)
+ {
+ SCM perm = max_permission (pc->get_property ("page-turn-permission"), brk.permission_);
+ Real pen = min (robust_scm2double (pc->get_property ("page-turn-penalty"), infinity_f), brk.penalty_);
+ pc->set_property ("page-turn-permission", perm);
+ pc->set_property ("page-turn-penalty", scm_from_double (pen));
+ }
+ }
+
+ /* apply the manual breaks */
+ for (vsize i = 0; i < forced_breaks_.size (); i++)
+ {
+ Page_turn_event const &brk = forced_breaks_[i];
+ Grob *pc = breakable_column (forced_breaks_[i]);
+ if (pc)
+ {
+ pc->set_property ("page-turn-permission", brk.permission_);
+ pc->set_property ("page-turn-penalty", scm_from_double (brk.penalty_));
+ }
+ }
+}
ADD_ACKNOWLEDGER (Page_turn_engraver, note_head);
ADD_TRANSLATOR (Page_turn_engraver,
/* doc */ "Decide where page turns are allowed to go",
/* create */ "",
/* accept */ "",
- /* read */ "",
- /* write */
- "allowPageTurn "
- "revokePageTurns "
+ /* read */
+ "minimumPageTurnLength "
+ "minimumRepeatLengthForPageTurn ",
+ /* write */ ""
);
musical_column_ = 0;
breaks_ = 0;
system_ = 0;
- last_special_barline_column_ = 0;
- last_breakable_column_ = 0;
first_ = true;
}
}
}
-/* return either
- - the last column with a special (ie. not "|" or "") barline
- - the last column
- after the given moment
-*/
-Paper_column*
-Paper_column_engraver::find_turnable_column (Moment after_this)
-{
- if (last_special_barline_column_)
- {
- Moment m = *unsmob_moment (last_special_barline_column_->get_property ("when"));
- if (m >= after_this)
- return last_special_barline_column_;
- }
- if (last_breakable_column_)
- {
- Moment m = *unsmob_moment (last_breakable_column_->get_property ("when"));
- if (m >= after_this)
- return last_breakable_column_;
- }
- return 0;
-}
-
-void
-Paper_column_engraver::revoke_page_turns (Moment after_this, Real new_penalty)
-{
- if (!page_turnable_columns_.size ())
- return;
-
- for (vsize i = page_turnable_columns_.size () - 1; i--;)
- {
- Paper_column *col = page_turnable_columns_[i];
- Moment mom = *unsmob_moment (col->get_property ("when"));
- if (mom >= after_this)
- {
- if (isinf (new_penalty))
- {
- col->del_property ( ly_symbol2scm ("page-turn-permission"));
- page_turnable_columns_.erase (page_turnable_columns_.begin () + i);
- }
- else
- {
- Real prev_pen = robust_scm2double (col->get_property ("page-turn-penalty"), 0);
- if (new_penalty > prev_pen)
- col->set_property ("page-turn-penalty", scm_from_double (new_penalty));
- }
- }
- }
-}
-
void
Paper_column_engraver::stop_translation_timestep ()
{
else if (Paper_column::is_breakable (command_column_))
{
breaks_++;
- last_breakable_column_ = command_column_;
-
- SCM which_bar = get_property ("whichBar");
- if (scm_is_string (which_bar))
- {
- string bar = ly_scm2string (which_bar);
- if (bar != "" && bar != "|")
- last_special_barline_column_ = command_column_;
- }
if (! (breaks_%8))
progress_indication ("[" + to_string (breaks_) + "]");
}
- SCM page_br = get_property ("allowPageTurn");
- if (scm_is_pair (page_br) && last_breakable_column_)
- {
- SCM pen = scm_cdr (page_br);
- Moment *m = unsmob_moment (scm_car (page_br));
- if (m)
- {
- Paper_column *turn = find_turnable_column (*m);
- if (turn)
- {
- turn->set_property ("page-turn-permission", ly_symbol2scm ("allow"));
- turn->set_property ("page-turn-penalty", pen);
- page_turnable_columns_.push_back (turn);
- }
- }
- }
-
- /* The page-turn-engraver is allowed to change its mind and revoke previously-allowed
- page turns (for example if there is a volta repeat where a turn is inconvenient) */
- SCM revokes = get_property ("revokePageTurns");
- if (scm_is_pair (revokes))
- {
- Moment *start = unsmob_moment (scm_car (revokes));
- Real pen = robust_scm2double (scm_cdr (revokes), infinity_f);
- if (start)
- revoke_page_turns (*start, pen);
- }
-
context ()->get_score_context ()->unset_property (ly_symbol2scm ("forbidBreak"));
- context ()->get_score_context ()->unset_property (ly_symbol2scm ("allowPageTurn"));
- context ()->get_score_context ()->unset_property (ly_symbol2scm ("revokePageTurns"));
first_ = false;
break_events_.clear ();
/* accept */ "break-event",
/* read */
"forbidBreak "
- "allowPageTurn "
- "revokePageTurns "
,
/* write */
"forbidBreak "
- "allowPageTurn "
- "revokePageTurns "
"currentCommandColumn "
"currentMusicalColumn "
);
}
string help ("Options supported by ly:set-option\n\n");
- vector_sort (opts, string_compare);
+ vector_sort (opts, less<string> ());
for (vsize i = 0; i < opts.size (); i++)
help += opts[i];
Direction d = LEFT;
do
- vector_sort (ordered_rests[d], Note_column::shift_compare);
+ vector_sort (ordered_rests[d], Note_column::shift_less);
while (flip (&d) != LEFT)
;
extract_grob_set (me, "ties", lv_ro_ties);
vector<Grob*> lv_ties (lv_ro_ties);
- vector_sort (lv_ties, &Semi_tie::compare);
+ vector_sort (lv_ties, Semi_tie::less);
Ties_configuration ties_config;
return (int) rint (Staff_symbol_referencer::get_position (h));
}
-int
-Semi_tie::compare (Grob *const &s1,
- Grob *const &s2)
+bool
+Semi_tie::less (Grob *const &s1,
+ Grob *const &s2)
{
- return sign (get_position (s1) - get_position (s2));
+ return get_position (s1) < get_position (s2);
}
if (!model_bar)
model_bar = me;
- vector_sort (extents, Interval::left_comparison);
+ vector_sort (extents, Interval::left_less);
Stencil span_bar;
for (vsize i = 1; i < extents.size (); i++)
}
}
}
- vector_sort (broken_intos_, Spanner::compare);
+ vector_sort (broken_intos_, Spanner::less);
for (vsize i = broken_intos_.size (); i--;)
broken_intos_[i]->break_index_ = i;
}
Grob *
Spanner::find_broken_piece (System *l) const
{
- vsize idx = binary_search (broken_intos_, (Spanner *)l, Spanner::less_than);
+ vsize idx = binary_search (broken_intos_, (Spanner *)l, Spanner::less);
if (idx != VPOS)
return broken_intos_ [idx];
return 0;
}
bool
-Spanner::less_than (Spanner *const &a, Spanner *const &b)
+Spanner::less (Spanner *const &a, Spanner *const &b)
{
return a->get_system ()->get_rank () < b->get_system ()->get_rank ();
}
- Staff_symbol_referencer::get_position ((Grob *) b));
}
+bool
+position_less (Grob *const &a, Grob *const &b)
+{
+ return Staff_symbol_referencer::get_position (a)
+ < Staff_symbol_referencer::get_position (b);
+}
+
ADD_INTERFACE (Staff_symbol_referencer, "staff-symbol-referencer-interface",
"An object whose Y position is meant relative to a staff "
"symbol. "
return exthead;
}
-static int
-integer_compare (int const &a, int const &b)
-{
- return a - b;
-}
-
/* The positions, in ascending order. */
vector<int>
Stem::note_head_positions (Grob *me)
ps.push_back (p);
}
- vector_sort (ps, integer_compare);
+ vector_sort (ps, less<int> ());
return ps;
}
extract_grob_set (me, "note-heads", ro_heads);
vector<Grob*> heads (ro_heads);
- vector_sort (heads, compare_position);
+ vector_sort (heads, position_less);
Direction dir = get_grob_direction (me);
if (dir < 0)
anyway. */
vector<Grob*> all_elts_sorted (all_elements_->array ());
- vector_sort (all_elts_sorted, default_compare);
+ vector_sort (all_elts_sorted, std::less<Grob*> ());
uniq (all_elts_sorted);
this->get_stencil ();
for (vsize i = all_elts_sorted.size (); i--;)
entries.push_back (e);
}
- vector_sort (entries, default_compare);
+ vector_sort (entries, std::less<Layer_entry> ());
for (vsize j = 0; j < entries.size (); j++)
{
Grob *g = entries[j].grob_;
return SCM_BOOL_T;
}
- vector_sort (ties, &Tie::compare);
+ vector_sort (ties, Tie::less);
Tie_formatting_problem problem;
problem.from_ties (ties);
for (vsize i = 0; i < bounds.size (); i++)
ranks.push_back (bounds[i]->get_column ()->get_rank ());
- vector_sort (ranks, default_compare);
+ vector_sort (ranks, less<int> ());
uniq (ranks);
for (vsize i = 0; i < ranks.size (); i++)
#include "warn.hh"
-int
-Tie::compare (Grob *const &s1,
- Grob *const &s2)
+bool
+Tie::less (Grob *const &s1,
+ Grob *const &s2)
{
- return sign (Tie::get_position (s1) - Tie::get_position (s2));
+ return Tie::get_position (s1) < Tie::get_position (s2);
}
void
"If true, then the accidentals are aligned in bass figure context.")
(allowBeamBreak ,boolean? "If true allow line breaks for beams over bar lines.")
- (allowPageTurn ,pair? "In the form (moment-start . penalty). Allow a page turn
-at the most recent breakpoint if it was after moment-start.")
(associatedVoice ,string? "Name of the
@code{Voice} that has the melody for this @code{Lyrics} line.")
(autoBeamSettings ,list? "Specifies
(midiMaximumVolume ,number? "Analogous to @code{midiMinimumVolume}.")
(minimumFret ,number? "The tablature auto string-selecting mechanism
selects the highest string with a fret at least @code{minimumFret}")
+ (minimumPageTurnLength ,ly:moment? "Minimum length of a rest for a page turn to be allowed")
+ (minimumRepeatLengthForPageTurn ,ly:moment? "Minimum length of a repeated section for a page
+turn to be allowed within that section")
(minimumVerticalExtent ,number-pair? "minimum vertical extent, same
format as @var{verticalExtent}")
(output ,ly:music-output? "The output produced by a score-level translator during music interpretation")
(restNumberThreshold ,number?
"If a multimeasure rest has more measures
than this, a number is printed. ")
- (revokePageTurns ,pair? "Signals to the paper-column-engraver to revoke (or increase the penalties for) all the page turns within a time interval. Used to disable page turns that occur within an unturnable volta repeat.")
(shapeNoteStyles ,vector? "Vector of symbols, listing style for each note
head relative to the tonic (qv.) of the scale.")
(shortInstrumentName ,markup? "See @code{instrument}")
c8-[ c c-] c8")
(types . (general-music event beam-event span-event))
))
-
(BendAfterEvent
. ((description . "A drop/fall/doit jazz articulation")
(types . (general-music bend-after-event event))))
- (BreakEvent
- . (
- (description . "Create a line break, Syntax: \\break or page break, Syntax: \\pagebreak.")
-
- (types . (general-music break-event event))
- ))
(BreathingEvent
. (
(description . "Creates a `breath mark' or `comma'.
(PageBreakEvent
. (
(description . "Allow, forbid or force a page break.")
- (types . (general-music break-event event))
+ (types . (general-music break-event page-break-event event))
))
(PageTurnEvent
. (
(description . "Allow, forbid or force a page turn.")
- (types . (general-music break-event event))
+ (types . (general-music break-event page-turn-event event))
))
(PartCombineMusic
. (