X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fitem.cc;h=521b285d52d86aa89d7c4ed014a39ac2ace40fd9;hb=f0e8911e5a86748a9c70afcee42b6a3618dbef10;hp=ff00630b5f8a739cc7719caf5ee87d84c29781f0;hpb=920dccaf627f00ec2d5bbd49ffeb9ad01236da3b;p=lilypond.git diff --git a/lily/item.cc b/lily/item.cc index ff00630b5f..521b285d52 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--2006 Han-Wen Nienhuys + (c) 1997--2007 Han-Wen Nienhuys */ #include "item.hh" @@ -16,14 +16,17 @@ #include "system.hh" #include "pointer-group-interface.hh" +#include "moment.hh" + + Grob * -Item::clone (int count) const +Item::clone () const { - return new Item (*this, count); + return new Item (*this); } -Item::Item (SCM s, Object_key const *key) - : Grob (s, key) +Item::Item (SCM s) + : Grob (s) { broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] = 0; } @@ -31,8 +34,8 @@ Item::Item (SCM s, Object_key const *key) /** Item copy ctor. Copy nothing: everything should be a elt property or a special purpose pointer (such as broken_to_drul_[]) */ -Item::Item (Item const &s, int copy_count) - : Grob (s, copy_count) +Item::Item (Item const &s) + : Grob (s) { broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] = 0; } @@ -66,10 +69,9 @@ Item::copy_breakable_items () { Drul_array new_copies; Direction i = LEFT; - int count = 0; do { - Grob *dolly = clone (count++); + Grob *dolly = clone (); Item *item = dynamic_cast (dolly); get_root_system (this)->typeset_grob (item); new_copies[i] = item; @@ -175,12 +177,39 @@ Item::pure_is_visible (int start, int end) const } Interval_t -Item::spanned_rank_iv () +Item::spanned_rank_iv () const { int c = get_column ()->get_rank (); return Interval_t (c, c); } +Interval_t +spanned_time_interval (Item *l, Item *r) +{ + Drul_array bounds (l, r); + Interval_t iv; + + Direction d = LEFT; + do + { + if (bounds[d] && bounds[d]->get_column ()) + iv[d] = robust_scm2moment (bounds[d]->get_column ()->get_property ("when"), + iv[d]); + } + while (flip (&d) != LEFT); + + do + { + if (!bounds[d] || !bounds[d]->get_column ()) + iv[d] = iv[-d]; + } + while (flip (&d) != LEFT); + + + return iv; +} + + void Item::derived_mark () const { @@ -197,9 +226,7 @@ unsmob_item (SCM s) } ADD_INTERFACE (Item, - "item-interface", - "\n" - "\n" + "Grobs can be distinguished in their role in the horizontal spacing.\n" "Many grobs define constraints on the spacing by their sizes. For\n" "example, note heads, clefs, stems, and all other symbols with a fixed\n" @@ -235,5 +262,6 @@ ADD_INTERFACE (Item, /* properties */ "break-visibility " - "no-spacing-rods " + "extra-spacing-width " + "infinite-spacing-height " "non-musical")