X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lily%2Fitem.cc;h=ff00630b5f8a739cc7719caf5ee87d84c29781f0;hb=51522dcf41e4178a0e16fada95a4e87cefd1d0b4;hp=c1069e87bf39f288442eff01530ff5bc479a87fa;hpb=75eebcb49e52d296b1da3e1074e0825d2c780db4;p=lilypond.git diff --git a/lily/item.cc b/lily/item.cc index c1069e87bf..ff00630b5f 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -8,6 +8,7 @@ #include "item.hh" +#include "axis-group-interface.hh" #include "paper-score.hh" #include "warn.hh" #include "paper-column.hh" @@ -37,16 +38,13 @@ Item::Item (Item const &s, int copy_count) } bool -Item::is_breakable (Grob *me) +Item::is_non_musical (Grob *me) { if (me->original ()) return false; - if (!dynamic_cast (me)) - me->programming_error ("only items can be breakable."); - Item *i = dynamic_cast (me->get_parent (X_AXIS)); - return (i) ? Item::is_breakable (i) : to_boolean (me->get_property ("breakable")); + return i ? Item::is_non_musical (i) : to_boolean (me->get_property ("non-musical")); } Paper_column * @@ -96,7 +94,7 @@ Item::discretionary_processing () if (is_broken ()) return; - if (Item::is_breakable (this)) + if (Item::is_non_musical (this)) copy_breakable_items (); } @@ -152,13 +150,37 @@ Item::handle_prebroken_dependencies () SCM vis = get_property ("break-visibility"); if (scm_is_vector (vis)) { - bool visible = to_boolean (scm_vector_ref (vis, scm_from_int (break_status_dir () + 1))); + bool visible = to_boolean (scm_c_vector_ref (vis, break_status_dir () + 1)); if (!visible) suicide (); } } +bool +Item::pure_is_visible (int start, int end) const +{ + SCM vis = get_property ("break-visibility"); + if (scm_is_vector (vis)) + { + int pos = 1; + int pc_rank = Paper_column::get_rank (get_column ()); + if (pc_rank == start) + pos = 2; + else if (pc_rank == end) + pos = 0; + return to_boolean (scm_vector_ref (vis, scm_from_int (pos))); + } + return true; +} + +Interval_t +Item::spanned_rank_iv () +{ + int c = get_column ()->get_rank (); + return Interval_t (c, c); +} + void Item::derived_mark () const { @@ -210,4 +232,8 @@ ADD_INTERFACE (Item, " end-of-line-invisible no yes yes\n" " center-invisible yes no yes\n" "@end example\n", - "no-spacing-rods break-visibility breakable") + + /* properties */ + "break-visibility " + "no-spacing-rods " + "non-musical")