2 item.cc -- implement Item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "dimension-cache.hh"
10 #include "paper-score.hh"
13 #include "paper-column.hh"
15 #include "lily-guile.hh"
16 #include "line-of-score.hh"
20 broken_to_drul_[LEFT] = broken_to_drul_[RIGHT]=0;
24 Item copy ctor. Copy nothing: everything should be a elt property
25 or a special purpose pointer (such as broken_to_drul_[]) */
26 Item::Item (Item const &s)
29 broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] =0;
35 Item::breakable_b () const
40 Item * i =dynamic_cast<Item*> (parent_l (X_AXIS));
41 return (i) ? i->breakable_b () : to_boolean (get_elt_property ("breakable"));
47 Score_element *g = parent_l (X_AXIS);
48 return g ? g->line_l () : 0;
53 Item::copy_breakable_items()
55 Drul_array<Item *> new_copies;
59 Score_element * dolly = clone();
60 Item * item_p = dynamic_cast<Item*>(dolly);
61 pscore_l_->line_l_->typeset_element (item_p);
62 new_copies[i] =item_p;
64 while (flip(&i) != LEFT);
65 broken_to_drul_= new_copies;
70 Item::broken_b () const
72 return broken_to_drul_[LEFT] || broken_to_drul_[RIGHT];
76 Item::do_breakable_col_processing()
82 copy_breakable_items();
86 Item::find_broken_piece (Line_of_score*l) const
93 Score_element *s = broken_to_drul_[d];
94 if (s && s->line_l () == l)
97 while (flip (&d) != LEFT);
104 Item::find_prebroken_piece (Direction d) const
106 Item * me = (Item *) (this);
109 return dynamic_cast<Item*> (broken_to_drul_[d]);
113 Item::column_l () const
115 return dynamic_cast<Item*> (parent_l (X_AXIS))->column_l ();
119 Item::break_status_dir () const
123 Item * i = dynamic_cast<Item*> (original_l_);
125 return (i->broken_to_drul_[LEFT] == this) ? LEFT : RIGHT;
132 Item::handle_prebroken_dependencies ()
136 element_property_alist_
137 = handle_broken_smobs (original_l_->element_property_alist_,
138 gh_int2scm (break_status_dir ()));
142 Can't do this earlier, because try_visibility_lambda () might set
143 the elt property transparent, which would then be copied.
145 SCM vis = remove_elt_property ("visibility-lambda");
146 if (gh_procedure_p (vis))
148 SCM args = scm_listify (gh_int2scm (break_status_dir ()), SCM_UNDEFINED);
149 SCM result = gh_apply (vis, args);
150 bool trans = gh_scm2bool (gh_car (result));
151 bool empty = gh_scm2bool (gh_cdr (result));
155 set_extent_callback (0, X_AXIS);
156 set_extent_callback (0, Y_AXIS);
159 set_elt_property ("transparent", SCM_BOOL_T);