- junk Score_element::do_{width,height}: set callbacks directly.
- merge Score_element, Graphical_element
- merge Axis_group_element, Graphical_axis_group
- - junk pointer fields from
- * Single_malt_grouping_item
- * Separating_group_spanner
- * Stem_tremolo
- * Hara_kiri_vertical_group_spanner
- * Stem
- * Axis_group_element
- * Align_element
- * Beam
+ - junk pointer fields fromScore_element derived classes
+ - junk obsolete do_substitute_dependency code.
**********
Of course, our other friends in the `Eindhovens Jongeren Ensemble'
-(http://www.cs.uu.nl/~hanwen/eje/) cannot go unmentioned either.
+cannot go unmentioned either.
--- * ---
PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=3
-PATCH_LEVEL=9
-MY_PATCH_LEVEL=hwn2
+PATCH_LEVEL=10
+MY_PATCH_LEVEL=
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
Real where_f=0;
Real center_f = 0.0;
SCM scenter = get_elt_property ("center-element");
- Score_element *center_elt = (SMOB_IS_TYPE_B(Score_element,scenter))
- ? SMOB_TO_TYPE(Score_element,scenter) : 0;
+ Score_element *center_elt = unsmob_element (scenter);
for (int i=0 ; i < elems.size(); i++)
{
/*
Don't (start) auto-beam over empty stems; skips or rests
*/
- if (!stem_l->head_l_arr_.size ())
+ if (!stem_l->first_head ())
{
if (stem_l_arr_p_)
end_beam ();
for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
{
SCM e=gh_car (s);
- r.push (dynamic_cast<Score_element*>(SMOB_TO_TYPE (Score_element, e)));
+ r.push (unsmob_element (e));
}
return r;
for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
{
SCM e=gh_car (s);
- Score_element * se = dynamic_cast<Score_element*>(SMOB_TO_TYPE (Score_element, e));
+ Score_element * se = SMOB_TO_TYPE (Score_element, e);
Interval dims = se->extent (a);
if (!dims.empty_b ())
int
Beam::stem_count ()const
{
- Group_interface gi (this);
+ Group_interface gi (this, "stems");
return gi.count ();
}
void
Beam::add_stem (Stem*s)
{
- Group_interface gi (this);
+ Group_interface gi (this, "stems");
gi.add_element (s);
s->add_dependency (this);
// UGH
Real nw_f;
- if (!here->head_l_arr_.size ())
+ if (!here->first_head ())
nw_f = 0;
else if (here->type_i ()== 1)
nw_f = paper_l ()->get_var ("wholewidth");
void
Break_align_engraver::add_column (SCM smob)
{
- Score_element * e = SMOB_TO_TYPE (Score_element, smob);
+ Score_element * e = unsmob_element (smob);
align_l_->add_element (e);
typeset_element (e);
}
Axis_group_item * group = 0;
if (s != SCM_BOOL_F)
{
- Score_element *e = SMOB_TO_TYPE(Score_element, gh_cdr(s));
+ Score_element *e = unsmob_element (gh_cdr(s));
group = dynamic_cast<Axis_group_item*> (e);
}
else
Real interline= paper_l ()->get_var ("interline");
Link_array<Score_element> elems;
- for (int i=0; i < elem_l_arr_.size(); i++)
+ Link_array<Score_element> all_elems (elem_l_arr ());
+
+ for (int i=0; i < all_elems.size(); i++)
{
- Interval y = elem_l_arr_[i]->extent(axis ());
+ Interval y = all_elems[i]->extent(axis ());
if (!y.empty_b())
- elems.push (dynamic_cast<Score_element*> (elem_l_arr_[i]));
+ elems.push (dynamic_cast<Score_element*> (all_elems[i]));
}
if (!elems.size ())
#include "note-head.hh"
#include "paper-def.hh"
-#include "tuple.hh"
-
Collision::Collision()
{
set_axes (X_AXIS, Y_AXIS);
void
Collision::add_column (Note_column* ncol_l)
{
- clash_l_arr_.push (ncol_l);
add_element (ncol_l);
add_dependency (ncol_l);
}
+/*
+ UGH. junk Shift_tup .
+ */
+
void
Collision::do_pre_processing()
{
Array<Shift_tup> autos (automatic_shift ());
Array<Shift_tup> hand (forced_shift ());
- Link_array<Note_column> done;
+ Link_array<Score_element> done;
Real wid = paper_l ()->get_var ("collision_note_width");
for (int i=0; i < hand.size (); i++)
Drul_array<Array<int> > shifts;
Array<Shift_tup> tups;
-
- for (int i=0; i < clash_l_arr_.size(); i++)
+
+ SCM s = get_elt_property ("elements");
+ for (; gh_pair_p (s); s = gh_cdr (s))
{
- clash_groups[clash_l_arr_[i]->dir ()].push (clash_l_arr_[i]);
+ SCM car = gh_car (s);
+
+ Score_element * se = unsmob_element (car);
+ if (Note_column * col = dynamic_cast<Note_column*> (se))
+ clash_groups[col->dir ()].push (col);
}
{
Note_column *cu_l =clash_groups[UP][0];
Note_column *cd_l =clash_groups[DOWN][0];
- Note_head * nu_l= cu_l->head_l_arr_[0];
- Note_head * nd_l = cd_l->head_l_arr_.top();
+
+
+ /*
+ TODO.
+ */
+ Note_head * nu_l= cu_l->first_head(); // cu_l->head_l_arr_[0];
+ Note_head * nd_l = cd_l->first_head(); // cd_l->head_l_arr_.top();
+
+
+
int downpos = cd_l->head_positions_interval ()[BIGGER];
int uppos = cu_l->head_positions_interval ()[SMALLER];
{
Array<Shift_tup> tups;
- for (int i=0; i < clash_l_arr_.size (); i++)
+ SCM s = get_elt_property ("elements");
+ for (; gh_pair_p (s); s = gh_cdr (s))
{
- SCM force = clash_l_arr_[i]->remove_elt_property ("force-hshift");
+ Score_element * se = unsmob_element ( gh_car (s));
+
+ SCM force = se->remove_elt_property ("force-hshift");
if (force != SCM_UNDEFINED)
{
- tups. push (Shift_tup (clash_l_arr_[i], gh_scm2double (force)));
+ tups. push (Shift_tup (se, gh_scm2double (force)));
}
}
return tups;
}
-void
-Collision::do_substitute_element_pointer (Score_element*o_l,Score_element*n_l)
-{
- if (o_l)
- {
- clash_l_arr_.substitute (dynamic_cast<Note_column *> (o_l),
- dynamic_cast <Note_column *> (n_l));
-
- }
-}
Molecule
Crescendo::get_symbol () const
{
- Real w_dim = extent (X_AXIS).length () - get_broken_left_end_align ();
+ Real w_dim = spanner_length()- get_broken_left_end_align ();
Real absdyn_dim = paper_l ()-> get_var ("crescendo_shorten");
if (dyn_b_drul_[LEFT])
{
if (!h)
return;
- if (!h->dots_l_)
+ if (!h->dots_l ())
return;
if (!dotcol_p_)
#include "dots.hh"
#include "dot-column.hh"
#include "rhythmic-head.hh"
+#include "group-interface.hh"
void
Dot_column::add_dots (Dots *d)
{
- dot_l_arr_.push (d);
+ Group_interface gi (this, "dots");
+ gi.add_element (d);
+
add_dependency (d);
add_element (d);
}
void
Dot_column::add_head (Rhythmic_head *r)
{
- if (!r->dots_l_)
+ if (!r->dots_l ())
return ;
add_support (r);
- add_dots (r->dots_l_);
+ add_dots (r->dots_l ());
}
-void
-Dot_column::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
- Note_head_side::do_substitute_element_pointer (o,n);
- if (Dots * d = dynamic_cast<Dots*> (o))
- dot_l_arr_.substitute (d, dynamic_cast<Dots*> (n));
-}
int
Dot_column::compare (Dots * const &d1, Dots * const &d2)
return int (d1->position_f () - d2->position_f ());
}
-void
-Dot_column::do_pre_processing ()
-{
- dot_l_arr_.sort (Dot_column::compare);
- Note_head_side::do_pre_processing ();
-}
Dot_column::Dot_column ()
{
+ Group_interface gi (this, "dots");
+ gi.set_interface ();
+
set_direction (RIGHT);
set_axes(X_AXIS,X_AXIS);
}
void
Dot_column::do_post_processing ()
{
- if (dot_l_arr_.size () < 2)
+ Link_array<Dots> dots = Group_interface__extract_elements (this, (Dots*)0 , "dots");
+ dots.sort (Dot_column::compare);
+
+ if (dots.size () < 2)
return;
Slice s;
s.set_empty ();
Array<int> taken_posns;
int conflicts = 0;
- for (int i=0; i < dot_l_arr_.size (); i++)
+ for (int i=0; i < dots.size (); i++)
{
for (int j=0; j < taken_posns.size (); j++)
- if (taken_posns[j] == (int) dot_l_arr_[i]->position_f ())
+ if (taken_posns[j] == (int) dots[i]->position_f ())
conflicts++;
- taken_posns.push ((int)dot_l_arr_[i]->position_f ());
- s.unite (Slice ((int)dot_l_arr_[i]->position_f (),
- (int)dot_l_arr_[i]->position_f ()));
+ taken_posns.push ((int)dots[i]->position_f ());
+ s.unite (Slice ((int)dots[i]->position_f (),
+ (int)dots[i]->position_f ()));
}
if (!conflicts)
/*
+1 -> off by one
*/
- int pos = middle - dot_l_arr_.size () + 1;
+ int pos = middle - dots.size () + 1;
if (!(pos % 2))
pos ++; // center () rounds down.
- for (int i=0; i <dot_l_arr_.size (); pos += 2, i++)
+ for (int i=0; i <dots.size (); pos += 2, i++)
{
- dot_l_arr_[i]->set_position(pos);
+ dots[i]->set_position(pos);
}
}
{
Molecule* mol_p = new Molecule;
- Real w = extent (X_AXIS).length ();
+ Real w = spanner_length ();
w += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]);
Real h = paper_l ()->get_var ("extender_height");
#include "group-interface.hh"
#include "score-element.hh"
-Group_interface::Group_interface (Score_element* e)
+Group_interface::Group_interface (Score_element const* e)
{
- elt_l_ = e;
+ elt_l_ = (Score_element*)e;
name_ = "elements";
}
-Group_interface::Group_interface (Score_element *e, String s)
+Group_interface::Group_interface (Score_element const *e, String s)
{
- elt_l_ =e;
+ elt_l_ =(Score_element*)e;
name_ = s;
}
bool
int
Group_interface::count ()
{
- return scm_ilength (elt_l_->get_elt_property ("name"));
+ return scm_ilength (elt_l_->get_elt_property (name_));
}
void
{
Molecule* mol_p = new Molecule;
- Real w = extent (X_AXIS).length ();
+ Real w = spanner_length ();
w += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]);
*/
class Axis_group_element : public virtual Score_element
{
- Link_array<Score_element> extra_elems_;
-
/// modify fields of E for removal.
void do_remove (Score_element*e);
void purge_extra ();
public:
// keep array in order.
bool ordered_b_;
- Link_array<Score_element> elem_l_arr_;
Axis axes_[2];
Interval my_extent (Axis) const;
#include "tuple.hh"
-typedef Tuple<Note_column*, Real> Shift_tup;
+typedef Tuple<Score_element*, Real> Shift_tup;
/**
Resolve conflicts between various Note_columns (chords).
Array<Shift_tup> automatic_shift ();
Array<Shift_tup> forced_shift ();
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
virtual void do_pre_processing();
public:
- Link_array<Note_column> clash_l_arr_;
void add_column (Note_column*ncol_l);
Collision();
*/
class Dot_column : public Axis_group_item, public Note_head_side
{
- Link_array<Dots> dot_l_arr_;
static int compare (Dots * const&,Dots * const&);
+ void add_dots (Dots*);
public:
VIRTUAL_COPY_CONS (Score_element);
void add_head (Rhythmic_head*);
- void add_dots (Dots*);
Dot_column ();
protected:
-
- virtual void do_pre_processing ();
virtual void do_post_processing ();
- virtual void do_substitute_element_pointer (Score_element *o, Score_element*n);
};
#endif // DOT_COLUMN_HH
Score_element * elt_l_;
String name_;
public:
- Group_interface (Score_element*);
- Group_interface (Score_element*, String);
+ Group_interface (Score_element const*);
+ Group_interface (Score_element const*, String);
int count ();
bool supports_interface_b ();
void set_interface ();
*/
template<class T>
Link_array<T>
-Group_interface__extract_elements (Score_element *elt, T *, String name)
+Group_interface__extract_elements (Score_element const *elt, T *, String name)
{
Link_array<T> arr;
int measures_i_;
void add_column (Item*);
- Link_array<Item> column_arr_;
-
protected:
virtual Molecule *do_brew_molecule_p () const;
VIRTUAL_COPY_CONS (Score_element);
virtual void do_post_processing ();
virtual void do_print () const;
virtual Array<Rod> get_rods () const;
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
};
#endif /* MULTI_MEASURE_REST_HH */
class Note_column : public Axis_group_item {
protected:
virtual void do_post_processing () ;
- virtual void do_print () const;
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
public:
static int shift_compare (Note_column *const &, Note_column*const&);
JUNKME.
*/
Direction dir () const;
- Stem* stem_l_;
- Link_array<Note_head> head_l_arr_;
- Link_array<Rest> rest_l_arr_;
Interval_t<int> head_positions_interval() const;
// Interval width () const;
void translate_rests(int dy);
-
+ Note_head * first_head ()const;
+ Interval rest_dim ()const ;
Note_column ();
void set_stem (Stem*);
void set_dotcol (Dot_column*);
void add_head (Rhythmic_head*);
bool rest_b () const;
- void sort ();
+
+ Stem *stem_l()const;
};
#endif // NOTE_COLUMN_HH
#include "item.hh"
class Rest_collision : public Item {
- Link_array<Note_column> rest_l_arr_;
- Link_array<Note_column> ncol_l_arr_;
public:
- void add_column (Note_column*);
+ void add_column (Note_column*);
+ Interval rest_dim () const;
- Rest_collision();
+ Rest_collision();
protected:
- virtual void do_pre_processing();
- virtual void do_print() const;
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
+ virtual void do_pre_processing();
};
#endif // REST_COLLISION_HH
class Rest : public Rhythmic_head
{
public:
- void add_dots (Dots*);
+
protected:
virtual void do_add_processing ();
virtual void do_post_processing ();
class Rhythmic_head : public Item, public Staff_symbol_referencer
{
-public:
- Stem * stem_l_;
Dots * dots_l_;
- int balltype_i_;
+ Stem * stem_l_;
+public:
+
+ int balltype_i_;
void add_dots (Dots *);
Rhythmic_head ();
-
+ Stem * stem_l ()const;
+ Dots * dots_l ()const;
int dots_i ()const;
protected:
virtual void do_post_processing ();
virtual void do_print () const;
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
};
#endif // RHYTHMIC_HEAD_HH
void add_processing ();
- void substitute_dependency (Score_element*,Score_element*);
- void remove_dependency (Score_element*);
/**
add a dependency. It may be the 0 pointer, in which case, it is ignored.
*/
void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
static SCM handle_broken_smobs (SCM, SCM criterion);
+ void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)());
+
virtual Score_element *find_broken_piece (Line_of_score*) const;
protected:
/// do calculations after determining horizontal spacing
virtual void do_post_processing ();
- virtual void do_substitute_element_pointer (Score_element * , Score_element *);
virtual void do_break_processing ();
virtual Link_array<Score_element> get_extra_dependencies () const;
void fixup_refpoint ();
};
+Score_element * unsmob_element (SCM);
class Script_column : public Item
{
- /**
- Array of objects that are placed by staffsides
- */
- Link_array<Item> staff_sided_item_l_arr_;
public:
+ Script_column();
void add_staff_sided (Item*);
protected:
virtual void do_pre_processing ();
void add_column (Note_column*);
- Link_array<Note_column> encompass_arr_;
-
protected:
virtual Array<Offset> get_encompass_offset_arr () const;
virtual void do_post_processing ();
virtual void do_add_processing ();
virtual void do_pre_processing ();
- virtual void do_substitute_element_pointer (Score_element*, Score_element*);
Array<Rod> get_rods () const;
};
*/
class Span_bar : public Bar
{
- Link_array<Score_element> spanning_l_arr_;
Interval get_spanned_interval () const;
public:
Span_bar();
virtual void do_pre_processing();
virtual void do_post_processing();
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
virtual Molecule * do_brew_molecule_p() const;
};
virtual Direction get_default_direction ()const;
virtual void do_pre_processing ();
virtual void do_post_processing ();
- virtual void do_substitute_element_pointer (Score_element*o,Score_element*e);
};
#endif /* Stem_STAFF_SIDE_HH */
public:
- Link_array<Note_head> head_l_arr_;
- Link_array<Rest> rest_l_arr_;
/// log of the duration. Eg. 4 -> 16th note -> 2 flags
int flag_i_;
our beam, for aligning abbrev flags
*/
Beam* beam_l () const;
+ Note_head * first_head () const;
Drul_array<int> beams_i_drul_;
Stem ();
protected:
Molecule flag () const;
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
+
virtual void do_pre_processing();
static Interval dim_callback (Dimension_cache const*);
virtual Molecule* do_brew_molecule_p() const;
void set_head (Direction, Note_head*head_l);
VIRTUAL_COPY_CONS(Score_element);
- Drul_array<Note_head *> head_l_drul_;
+ Note_head* head (Direction) const;
protected:
virtual void do_add_processing ();
virtual void do_post_processing ();
virtual Direction get_default_dir() const;
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
+
virtual Array<Rod> get_rods () const;
Array<Offset> get_controls () const;
bool parallel_beam_b_;
protected:
- Link_array<Beam> beam_l_arr_;
- Link_array<Note_column> column_arr_;
-
virtual Molecule* do_brew_molecule_p () const;
VIRTUAL_COPY_CONS(Score_element);
virtual void do_add_processing ();
virtual void do_post_processing ();
virtual Direction get_default_dir () const;
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
};
#endif // Tuplet_spanner_HH
void add_bar (Bar*);
String number_str_;
- Link_array<Bar> bar_arr_;
- Link_array<Note_column> note_column_arr_;
bool last_b_;
virtual void do_add_processing ();
static Interval dim_callback (Dimension_cache const*);
virtual void do_post_processing ();
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
};
#endif // VOLTA_SPANNER_HH
broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] =0;
}
-#if 0
-void
-Item::handle_prebroken_dependents ()
-{
- Item * parent = dynamic_cast<Item*> (parent_l (X_AXIS));
- if (breakable_b () && parent)
- {
- if(!(broken_to_drul_[LEFT] || broken_to_drul_[RIGHT]))
- do_break ();
-
- Direction d = LEFT;
- do
- {
- Item * broken_self = find_broken_piece (d);
- Item * broken_parent = parent->find_broken_piece (d);
-
- broken_self->set_parent (broken_parent, X_AXIS);
-
- /*
- ugh. Should do this is after breaking?
- */
- if (!broken_self->parent_l (Y_AXIS))
- {
- Score_element * yparent =dynamic_cast<Score_element*>(parent_l (Y_AXIS));
- Item *yparenti = dynamic_cast<Item*> (yparent);
- Item *broken_yparent = yparenti ?
- yparenti->find_broken_piece (d) : 0;
-
- if (!yparent)
- programming_error ("Vertical refpoint lost!");
- else if (yparenti)
- {
- broken_self->set_parent (broken_yparent, Y_AXIS);
- }
- }
- }
- while ((flip (&d))!=LEFT);
- }
-}
-#endif
-
Direction
Item::break_status_dir () const
{
Line_of_score::Line_of_score()
{
+ set_elt_property ("columns", SCM_EOL);
set_axes (Y_AXIS,X_AXIS);
}
line_l->set_bounds(RIGHT,c.top ());
for (int j=0; j < c.size(); j++)
{
- c[i]->translate_axis (breaking[i].config_[j],X_AXIS);
- c[i]->line_l_ = line_l;
+ c[j]->translate_axis (breaking[i].config_[j],X_AXIS);
+ c[j]->line_l_ = line_l;
}
broken_into_l_arr_.push (line_l);
}
else if (Tie * tie_l = dynamic_cast<Tie *> (info.elem_l_))
{
- tied_l_arr_.push (tie_l-> head_l_drul_[RIGHT]);
+ tied_l_arr_.push (tie_l->head (RIGHT));
}
}
if (mmrest_p_ && (now >= rest_moments_[START])
&& !time->measure_position ()
- && (mmrest_p_->column_arr_.size () >= 2))
+ && (scm_ilength (mmrest_p_->get_elt_property ("columns")) >= 2))
{
typeset_element (mmrest_p_);
/*
#include "rest.hh"
#include "molecule.hh"
#include "misc.hh"
-
+#include "group-interface.hh"
+#include "stem.hh"
Multi_measure_rest::Multi_measure_rest ()
{
measures_i_ = 0;
+ set_elt_property ("columns", SCM_EOL);
}
void
}
else if (measures_i_ > 1)
{
- Molecule s ( lookup_l ()->text ("number", to_str (measures_i_), paper_l ()));
+ Molecule s (lookup_l ()->text ("number", to_str (measures_i_), paper_l ()));
s.align_to (X_AXIS, CENTER);
s.translate_axis (3.0 * interline_f, Y_AXIS);
mol_p->add_molecule (s);
return mol_p;
}
+/*
+ UGH. JUNKME elt prop "columns" isn't really needed.
+ */
+
void
Multi_measure_rest::do_add_processing ()
{
- if (column_arr_.size ())
+ if (gh_pair_p (get_elt_property ("columns")))
{
- set_bounds (LEFT, column_arr_[0 >? column_arr_.size () - 2]);
- set_bounds (RIGHT, column_arr_[column_arr_.size () - 1]);
+ Link_array<Item> column_arr (Group_interface__extract_elements (this, (Item*)0, "columns"));
+
+ set_bounds (LEFT, column_arr[0 >? column_arr.size () - 2]);
+ set_bounds (RIGHT, column_arr.top ());
}
}
void
Multi_measure_rest::do_post_processing ()
{
- if (!column_arr_.size ())
+ if (!gh_pair_p (get_elt_property ("columns")))
set_elt_property ("transparent", SCM_BOOL_T);
}
-void
-Multi_measure_rest::do_substitute_element_pointer (Score_element* o, Score_element* n)
-{
- Staff_symbol_referencer::do_substitute_element_pointer (o,n);
- if (Item* c = dynamic_cast <Item*> (o))
- column_arr_.substitute (c, dynamic_cast<Item*> (n));
-}
-
+
void
Multi_measure_rest::add_column (Item* c)
{
- column_arr_.push (c);
+ Group_interface gi (this, "columns");
+ gi.add_element (c);
+
+
add_dependency (c);
}
#include "rest.hh"
#include "debug.hh"
#include "paper-def.hh"
+#include "group-interface.hh"
bool
Note_column::rest_b () const
{
- return rest_l_arr_.size ();
+ SCM r = get_elt_property ("rests");
+
+ return gh_pair_p (r);
}
int
Note_column::Note_column()
{
+ set_elt_property ("rests", SCM_EOL);
+ set_elt_property ("note-heads", SCM_EOL);
set_axes (X_AXIS, Y_AXIS);
- stem_l_ = 0;
}
-void
-Note_column::sort()
+Stem *
+Note_column::stem_l () const
{
- head_l_arr_.sort (Note_head::compare);
+ SCM s = get_elt_property ("stem");
+ return dynamic_cast<Stem*> (unsmob_element (s));
+
}
+
Slice
Note_column::head_positions_interval() const
Slice iv;
iv.set_empty ();
- for (int i=0; i <head_l_arr_.size ();i ++)
+
+ SCM h = get_elt_property ("note-heads");
+ for (; gh_pair_p (h); h = gh_cdr (h))
{
- int j = int (head_l_arr_[i]->position_f ());
+ Score_element *se = unsmob_element (gh_car (h));
+
+ int j = int (dynamic_cast<Staff_symbol_referencer*> (se)->position_f ());
iv.unite (Slice (j,j));
}
return iv;
Direction
Note_column::dir () const
{
- if (stem_l_)
- return stem_l_->get_direction ();
- else if (head_l_arr_.size ())
+ if (stem_l ())
+ return stem_l ()->get_direction ();
+ else if (gh_pair_p (get_elt_property ("note-heads")))
return (Direction)sign (head_positions_interval().center ());
programming_error ("Note column without heads and stem!");
void
Note_column::set_stem (Stem * stem_l)
{
- stem_l_ = stem_l;
+ set_elt_property ("stem", stem_l->self_scm_);
+
add_dependency (stem_l);
add_element (stem_l);
}
-void
-Note_column::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
- if (stem_l_ == o)
- {
- stem_l_ = n ? dynamic_cast<Stem *> (n):0;
- }
- if (dynamic_cast<Note_head *> (o))
- {
- head_l_arr_.substitute (dynamic_cast<Note_head *> (o),
- (n)? dynamic_cast<Note_head *> (n) : 0);
- }
-
- if (dynamic_cast<Rest *> (o))
- {
- rest_l_arr_.substitute (dynamic_cast<Rest *> (o),
- (n)? dynamic_cast<Rest *> (n) : 0);
- }
-}
void
Note_column::add_head (Rhythmic_head *h)
{
if (Rest*r=dynamic_cast<Rest *> (h))
{
- rest_l_arr_.push (r);
+ Group_interface gi (this, "rests");
+ gi.add_element (h);
}
if (Note_head *nh=dynamic_cast<Note_head *> (h))
{
- head_l_arr_.push (nh);
+ Group_interface gi (this, "note-heads");
+ gi.add_element (nh);
}
add_element (h);
}
Note_column::translate_rests (int dy_i)
{
invalidate_cache (Y_AXIS);
- for (int i=0; i < rest_l_arr_.size(); i++)
- rest_l_arr_[i]->translate_axis (dy_i * rest_l_arr_[i]->staff_line_leading_f ()/2.0,
- Y_AXIS);
-}
-void
-Note_column::do_print() const
-{
-#ifndef NPRINT
- DEBUG_OUT << "rests: " << rest_l_arr_.size() << ", ";
- DEBUG_OUT << "heads: " << head_l_arr_.size();
-#endif
+ SCM s = get_elt_property ("rests");
+ for (; gh_pair_p (s); s = gh_cdr (s))
+ {
+ Score_element * se = unsmob_element ( gh_car (s));
+ Staff_symbol_referencer *str = dynamic_cast<Staff_symbol_referencer*> (se);
+ se->translate_axis (dy_i * str->staff_line_leading_f ()/2.0, Y_AXIS);
+ }
}
+
void
Note_column::set_dotcol (Dot_column *d)
{
void
Note_column::do_post_processing ()
{
- if (!stem_l_ || !rest_b ())
+ if (!stem_l () || !rest_b ())
return;
- Beam * b = stem_l_->beam_l ();
+ Beam * b = stem_l ()->beam_l ();
if (!b || !b->stem_count ())
return;
/* ugh. Should be done by beam. */
- Direction d = stem_l_->get_direction ();
- Real beamy = (stem_l_->hpos_f () - b->stem(0)->hpos_f ()) * b->slope_f_ + b->left_y_;
+ Direction d = stem_l ()->get_direction ();
+ Real beamy = (stem_l ()->hpos_f () - b->stem(0)->hpos_f ()) * b->slope_f_ + b->left_y_;
+
+ SCM s = get_elt_property ("rests");
+ Score_element * se = unsmob_element (gh_car (s));
+ Staff_symbol_referencer *str = dynamic_cast<Staff_symbol_referencer*> (se);
- Real staff_space = rest_l_arr_[0]->staff_line_leading_f ();
+ Real staff_space = str->staff_line_leading_f ();
Real rest_dim = extent (Y_AXIS)[d]*2.0 /staff_space ;
Real minimum_dist
Real dist =
minimum_dist + -d * (beamy - rest_dim) >? 0;
- int stafflines = rest_l_arr_[0]->lines_i ();
+ int stafflines = str->lines_i ();
// move discretely by half spaces.
int discrete_dist = int (ceil (dist ));
translate_rests (-d * discrete_dist);
}
+
+Interval
+Note_column::rest_dim () const
+{
+ Interval restdim;
+ SCM s = get_elt_property ("rests");
+ for (; gh_pair_p (s); s = gh_cdr (s))
+ {
+ Score_element * sc = unsmob_element ( gh_car (s));
+ restdim.unite (sc->extent (Y_AXIS));
+ }
+
+ return restdim;
+}
+
+Note_head*
+Note_column::first_head () const
+{
+ Stem * st = stem_l ();
+ return st? st->first_head (): 0;
+
+}
#include "lookup.hh"
#include "molecule.hh"
#include "musical-request.hh"
-#include "stem.hh"
#include "dimension-cache.hh"
void
if (balltype_i_ > 2 || type == "harmonic" || type == "cross")
balltype_i_ = 2;
- if (dots_l_) // move into Rhythmic_head?
- dots_l_->set_position(int (position_f ()));
+ if (dots_l ()) // move into Rhythmic_head?
+ dots_l ()->set_position(int (position_f ()));
}
if (note_req_l->duration_.dots_i_)
{
Dots * d = new Dots;
- note_p->dots_l_ = d;
+ note_p->add_dots (d);
d->dots_i_ = note_req_l->duration_.dots_i_;
announce_element (Score_element_info (d,0));
dot_p_arr_.push (d);
SCM e = gh_car (s);
if (SMOB_IS_TYPE_B(Score_element, e))
{
- Score_element * se = SMOB_TO_TYPE (Score_element,e );
+ Score_element * se = unsmob_element (e);
se->fixup_refpoint ();
}
}
#include "collision.hh"
#include "paper-def.hh"
#include "rest.hh"
+#include "group-interface.hh"
void
Rest_collision::add_column (Note_column *nc_l)
{
add_dependency (nc_l);
+ Group_interface gi (this);
if (nc_l->rest_b ())
- rest_l_arr_.push (nc_l);
+ gi.name_ = "rests";
else
- ncol_l_arr_.push (nc_l);
+ gi.name_ = "notes";
+
+ gi.add_element (nc_l);
}
void
Rest_collision::do_pre_processing()
{
+ Link_array<Note_column> rest_l_arr =
+ Group_interface__extract_elements (this, (Note_column*) 0, "rests");
+ Link_array<Note_column> ncol_l_arr =
+ Group_interface__extract_elements (this, (Note_column*) 0, "notes");
+
+
/*
handle rest-rest and rest-note collisions
*/
// no rests to collide
- if (!rest_l_arr_.size())
+ if (!rest_l_arr.size())
return;
// no partners to collide with
- if (rest_l_arr_.size() + ncol_l_arr_.size () < 2)
+ if (rest_l_arr.size() + ncol_l_arr.size () < 2)
return;
// meisjes met meisjes
- if (!ncol_l_arr_.size())
+ if (!ncol_l_arr.size())
{
/*
UGH. Should get dims from table. Should have minimum dist.
*/
- int dy = rest_l_arr_.size() > 2 ? 6 : 4;
+ int dy = rest_l_arr.size() > 2 ? 6 : 4;
- rest_l_arr_[0]->translate_rests (rest_l_arr_[0]->dir () *dy);
- rest_l_arr_.top()->translate_rests (rest_l_arr_.top ()->dir ()* dy);
+ rest_l_arr[0]->translate_rests (rest_l_arr[0]->dir () *dy);
+ rest_l_arr.top()->translate_rests (rest_l_arr.top ()->dir ()* dy);
}
// meisjes met jongetjes
else
{
- if (rest_l_arr_.size () > 1)
+ if (rest_l_arr.size () > 1)
{
warning (_("too many colliding rests"));
}
- if (ncol_l_arr_.size () > 1)
+ if (ncol_l_arr.size () > 1)
{
warning (_("too many notes for rest collision"));
}
- Note_column * rcol = rest_l_arr_[0];
+ Note_column * rcol = rest_l_arr[0];
// try to be opposite of noteheads.
- Direction dir = - ncol_l_arr_[0]->dir();
-
- Interval restdim;
- for (int i=0; i < rcol->rest_l_arr_.size(); i++)
- restdim.unite (rcol->rest_l_arr_[i]->extent (Y_AXIS));
+ Direction dir = - ncol_l_arr[0]->dir();
+ Interval restdim = rcol->rest_dim ();
if (restdim.empty_b ())
return;
// staff ref'd?
- Real staff_space = rcol->rest_l_arr_[0]->staff_line_leading_f ();
+ Real staff_space = paper_l()->get_var ("interline");
+
+ /* FIXME
+ staff_space = rcol->rest_l_arr[0]->staff_line_leading_f ();
+ */
Real internote_f = staff_space/2;
Real minimum_dist = paper_l ()->get_var ("restcollision_minimum_dist")
* internote_f;
assumption: ref points are the same.
*/
Interval notedim;
- for (int i = 0; i < ncol_l_arr_.size(); i++)
+ for (int i = 0; i < ncol_l_arr.size(); i++)
{
- notedim.unite (ncol_l_arr_[i]->extent (Y_AXIS));
+ notedim.unite (ncol_l_arr[i]->extent (Y_AXIS));
}
Interval inter (notedim);
minimum_dist + dir * (notedim[dir] - restdim[-dir]) >? 0;
- int stafflines = rcol->rest_l_arr_[0]->lines_i ();
+ // FIXME
+ int stafflines = 5; // rcol->rest_l_arr[0]->lines_i ();
// move discretely by half spaces.
}
}
-void
-Rest_collision::do_print() const
-{
-#ifndef NPRINT
- DEBUG_OUT << "rests: " << rest_l_arr_.size() << ", ";
- DEBUG_OUT << "cols: " << ncol_l_arr_.size();
-#endif
-}
-
-void
-Rest_collision::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
- if (Note_column *onl = dynamic_cast<Note_column *> (o))
- {
- Note_column *n_l = n?dynamic_cast<Note_column *> (n):0;
- rest_l_arr_.substitute (onl, n_l);
- ncol_l_arr_.substitute (onl, n_l);
- }
-}
Rest_collision::Rest_collision()
{
+ set_elt_property ("rests", SCM_EOL);
+ set_elt_property ("notes", SCM_EOL);
set_elt_property ("transparent", SCM_BOOL_T);
set_empty (X_AXIS);
set_empty (Y_AXIS);
if (rest_req_l_->duration_.dots_i_)
{
dot_p_ = new Dots;
- rest_p_->dots_l_ =dot_p_;
+ rest_p_->add_dots (dot_p_);
dot_p_->dots_i_ = rest_req_l_->duration_.dots_i_;
announce_element (Score_element_info (dot_p_,0));
}
/*
- rest.cc -- implement Rest
+ rest.cc -- implement Rest
source file of the GNU LilyPond music typesetter
Rest::do_post_processing ()
{
Rhythmic_head::do_post_processing ();
- if (dots_l_
+ if (dots_l ()
&& balltype_i_ > 4) // UGH.
{
/*
UGH.
*/
if (balltype_i_ == 7)
- dots_l_->set_position (4);
+ dots_l ()->set_position (4);
else
- dots_l_->set_position (3);
+ dots_l ()->set_position (3);
}
}
#include "stem.hh"
+Dots*
+Rhythmic_head::dots_l () const
+{
+ SCM s = get_elt_property ("dot");
+ return dynamic_cast<Dots*> (unsmob_element (s));
+}
+
+Stem*
+Rhythmic_head::stem_l () const
+{
+ SCM s = get_elt_property ("stem");
+ return dynamic_cast<Stem*> (unsmob_element (s));
+}
int
Rhythmic_head::dots_i () const
{
- return dots_l_ ? dots_l_->dots_i_ : 0;
+ return dots_l () ? dots_l ()->dots_i_ : 0;
}
void
Rhythmic_head::do_post_processing ()
{
- if (dots_l_)
+ if (dots_l ())
{
- dots_l_->set_position(int (position_f ()));
+ dots_l ()->set_position(int (position_f ()));
}
}
void
Rhythmic_head::add_dots (Dots *dot_l)
{
- dots_l_ = dot_l;
+ set_elt_property ("dot", dot_l->self_scm_);
dot_l->add_dependency (this);
}
Rhythmic_head::Rhythmic_head ()
{
- dots_l_ =0;
balltype_i_ =0;
- stem_l_ =0;
}
-void
-Rhythmic_head::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
- Staff_symbol_referencer::do_substitute_element_pointer (o,n);
- if (o == dots_l_)
- dots_l_ = dynamic_cast<Dots *> (n) ;
- else if (o == stem_l_)
- stem_l_ = dynamic_cast<Stem*>(n);
-}
void
pscore_l_ = s.pscore_l_;
smobify_self ();
-
-
}
Score_element::~Score_element()
{
}
-void
-Score_element::do_substitute_element_pointer (Score_element*,Score_element*)
-{
-}
Molecule*
programming_error ("Null dependency added");
}
-void
-Score_element::substitute_dependency (Score_element* old, Score_element* new_l)
-{
- do_substitute_element_pointer (old,new_l);
- old->do_substitute_element_pointer (this, 0);
-}
+
/**
SCM
Score_element::handle_broken_smobs (SCM s, SCM criterion)
{
- if (SMOB_IS_TYPE_B (Score_element, s))
+ Score_element *sc = unsmob_element ( s);
+ if (sc)
{
- Score_element *sc = SMOB_TO_TYPE (Score_element, s);
-
if (criterion == SCM_UNDEFINED)
return SCM_UNDEFINED;
else if (gh_number_p (criterion))
}
else
{
- Score_element * ln = SMOB_TO_TYPE (Score_element, criterion);
+ Score_element * ln = unsmob_element ( criterion);
Line_of_score * line = dynamic_cast<Line_of_score*> (ln);
Score_element * br =0;
Line_of_score * dep_line = sc->line_l ();
gh_set_car_x (s, handle_broken_smobs (gh_car (s), criterion));
gh_set_cdr_x (s, handle_broken_smobs (gh_cdr (s), criterion));
- if (gh_car (s) == SCM_UNDEFINED)
+ if (gh_car (s) == SCM_UNDEFINED && gh_list_p (gh_cdr(s)))
return gh_cdr (s);
}
return s;
}
+void
+Score_element::recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)())
+{
+ Score_element * sc = unsmob_element ( s);
+ if (sc)
+ {
+ (sc->*meth_ptr) ();
+ }
+ else if (gh_pair_p (s))
+ {
+ recurse_into_smobs (gh_car (s), meth_ptr);
+ recurse_into_smobs (gh_cdr (s), meth_ptr);
+ }
+}
+
void
Score_element::handle_broken_dependencies()
{
Line_of_score *line = line_l();
+
+ SCM rec = get_elt_property ("handle-broken-deps");
+ if (gh_boolean_p (rec) && gh_scm2bool (rec))
+ return;
+
+ set_elt_property ("handle-broken-deps", SCM_BOOL_T);
element_property_alist_ = handle_broken_smobs (element_property_alist_,
line ? line->self_scm_ : SCM_UNDEFINED);
+
+
+ recurse_into_smobs (element_property_alist_,
+ &Score_element::handle_broken_dependencies);
+
if (!line)
return;
if (elt->line_l() != line)
{
Score_element * broken = elt->find_broken_piece (line);
- substitute_dependency (elt, broken);
elt = broken ;
}
if (elt)
= handle_broken_smobs (element_property_alist_,
gh_int2scm (i->break_status_dir ()));
}
-
- Link_array<Score_element> old_arr, new_arr;
-
- for (int i=0; i < dependency_size(); i++)
- {
- Score_element * elt = dependency (i);
- Item *it_l = dynamic_cast <Item *> (elt);
- if (it_l && it_l->broken_original_b ())
- if (Item *me = dynamic_cast<Item*> (this) )
- {
- Score_element *new_l = it_l->find_broken_piece (me->break_status_dir ());
- if (new_l != elt)
- {
- new_arr.push (new_l);
- old_arr.push (elt);
- }
- }
- else
- {
- Direction d = LEFT;
- do {
- old_arr.push (0);
- new_arr.push (it_l->find_broken_piece (d));
- } while (flip(&d)!= LEFT);
- }
- }
-
- for (int i=0; i < old_arr.size(); i++)
- if (old_arr[i])
- substitute_dependency (old_arr[i], new_arr[i]);
}
-#if 0
-void
-Score_element::handle_prebroken_dependents()
-{
-}
-void
-Score_element::handle_broken_dependents()
-{
-}
-#endif
scm_puts ("#<Score_element ", port);
scm_puts ((char *)sc->name (), port);
-#if 0
- for (SCM s = sc->element_property_alist_; gh_pair_p (s); s = gh_cdr (s))
- {
- scm_display (gh_caar(s), port);
- SCM val = gh_cdar(s);
- if (SMOB_IS_TYPE_B (Score_element, val))
- {
- scm_puts ("#<:", port);
- scm_puts ((SMOB_TO_TYPE(Score_element,val))->name(), port);
- scm_puts (">", port);
- }
- else
- scm_display (val, port);
- }
-#endif
+
// scm_puts (" properties = ", port);
// scm_display (sc->element_property_alist_, port);
scm_puts (" >", port);
return d->get_dim ();
}
-
+Score_element*
+unsmob_element (SCM s)
+{
+ if (SMOB_IS_TYPE_B (Score_element, s))
+ return SMOB_TO_TYPE(Score_element,s);
+ else
+ return 0;
+}
/*
#include "script-column.hh"
#include "staff-side.hh"
#include "dimension-cache.hh"
-
+#include "group-interface.hh"
void
Script_column::add_staff_sided (Item *i)
if (p == SCM_UNDEFINED)
return;
- staff_sided_item_l_arr_.push (i);
+
+ Group_interface gi (this, "scripts");
+ gi.add_element (i);
+
add_dependency (i);
}
+Script_column::Script_column ()
+{
+ set_elt_property ("scripts", SCM_EOL);
+}
+
static int
staff_side_compare (Item * const &i1,
Item * const &i2)
Script_column::do_pre_processing ()
{
Drul_array<Link_array<Item> > arrs;
-
- for (int i=0; i < staff_sided_item_l_arr_.size (); i++)
+ Link_array<Item> staff_sided
+ = Group_interface__extract_elements (this, (Item*)0, "scripts");
+
+
+ for (int i=0; i < staff_sided.size (); i++)
{
- Side_position_interface st (staff_sided_item_l_arr_[i]);
- arrs[st.get_direction ()].push (staff_sided_item_l_arr_[i]);
+ Side_position_interface st (staff_sided[i]);
+ arrs[st.get_direction ()].push (staff_sided[i]);
}
Direction d = DOWN;
for (SCM s = get_elt_property ("elements"); gh_pair_p (s) && gh_pair_p (gh_cdr (s)); s = gh_cdr (s))
{
SCM elt = gh_car (s);
- if (!SMOB_IS_TYPE_B(Score_element, elt))
- continue;
-
SCM next_elt = gh_cadr (s);
- if (!SMOB_IS_TYPE_B(Score_element, next_elt))
- continue;
- Single_malt_grouping_item *l = dynamic_cast<Single_malt_grouping_item*> (SMOB_TO_TYPE(Score_element, elt));
+ Single_malt_grouping_item *l = dynamic_cast<Single_malt_grouping_item*> (unsmob_element (elt));
+ Single_malt_grouping_item *r = dynamic_cast<Single_malt_grouping_item*> (unsmob_element ( next_elt));
+
+ if (!r || !l)
+ continue;
+
Single_malt_grouping_item *lb
= dynamic_cast<Single_malt_grouping_item*>(l->find_broken_piece (RIGHT));
- Single_malt_grouping_item *r = dynamic_cast<Single_malt_grouping_item*> (SMOB_TO_TYPE(Score_element, next_elt));
+
Single_malt_grouping_item *rb
= dynamic_cast<Single_malt_grouping_item*>(r->find_broken_piece (LEFT));
* broken slur should have uniform trend
*/
+#include "group-interface.hh"
#include "slur.hh"
-
#include "lookup.hh"
#include "paper-def.hh"
#include "note-column.hh"
#include "bezier.hh"
#include "main.hh"
#include "cross-staff.hh"
+#include "group-interface.hh"
Slur::Slur ()
{
+ set_elt_property ("note-columns", SCM_EOL);
}
void
Slur::add_column (Note_column*n)
{
- if (!n->head_l_arr_.size ())
+ if (!gh_pair_p (n->get_elt_property ("note-heads")))
warning (_ ("Putting slur over rest. Ignoring."));
else
{
- encompass_arr_.push (n);
+ Group_interface gi (this, "note-columns");
+ gi.add_element (n);
add_dependency (n);
}
}
Direction
Slur::get_default_dir () const
{
+ Link_array<Note_column> encompass_arr =
+ Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+
Direction d = DOWN;
- for (int i=0; i < encompass_arr_.size (); i ++)
+ for (int i=0; i < encompass_arr.size (); i ++)
{
- if (encompass_arr_[i]->dir () < 0)
+ if (encompass_arr[i]->dir () < 0)
{
d = UP;
break;
void
Slur::do_add_processing ()
{
- set_bounds (LEFT, encompass_arr_[0]);
- if (encompass_arr_.size () > 1)
- set_bounds (RIGHT, encompass_arr_.top ());
+ Link_array<Note_column> encompass_arr =
+ Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+ set_bounds (LEFT, encompass_arr[0]);
+ if (encompass_arr.size () > 1)
+ set_bounds (RIGHT, encompass_arr.top ());
}
void
// don't set directions
}
-void
-Slur::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
- int i;
- while ((i = encompass_arr_.find_i (dynamic_cast<Note_column *> (o))) >=0)
- {
- if (n)
- encompass_arr_[i] = dynamic_cast<Note_column *> (n);
- else
- encompass_arr_.del (i);
- }
-}
static int
Note_column_compare (Note_column *const&n1 , Note_column* const&n2)
Slur::encompass_offset (Note_column const* col) const
{
Offset o;
- Stem* stem_l = col->stem_l_;
+ Stem* stem_l = col->stem_l ();
if (!stem_l)
{
warning (_ ("Slur over rest?"));
void
Slur::do_post_processing ()
{
- encompass_arr_.sort (Note_column_compare);
+ Link_array<Note_column> encompass_arr =
+ Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+
+ encompass_arr.sort (Note_column_compare);
if (!get_direction ())
set_direction (get_default_dir ());
Real y_gap_f = paper_l ()->get_var ("slur_y_gap");
Drul_array<Note_column*> note_column_drul;
- note_column_drul[LEFT] = encompass_arr_[0];
- note_column_drul[RIGHT] = encompass_arr_.top ();
+ note_column_drul[LEFT] = encompass_arr[0];
+ note_column_drul[RIGHT] = encompass_arr.top ();
bool fix_broken_b = false;
Direction d = LEFT;
{
dx_f_drul_[d] = dy_f_drul_[d] = 0;
if ((note_column_drul[d] == spanned_drul_[d])
- && note_column_drul[d]->head_l_arr_.size ()
- && (note_column_drul[d]->stem_l_))
+ && note_column_drul[d]->first_head ()
+ && (note_column_drul[d]->stem_l ()))
{
- Stem* stem_l = note_column_drul[d]->stem_l_;
+ Stem* stem_l = note_column_drul[d]->stem_l ();
/*
side directly attached to note head;
no beam getting in the way
while (flip (&d) != LEFT);
int cross_count = cross_staff_count ();
- bool interstaff_b = (0 < cross_count) && (cross_count < encompass_arr_.size ());
+ bool interstaff_b = (0 < cross_count) && (cross_count < encompass_arr.size ());
Drul_array<Offset> info_drul;
Drul_array<Real> interstaff_interval;
do
{
- info_drul[d] = encompass_offset (encompass_arr_.boundary (d, 0));
- interstaff_interval[d] = calc_interstaff_dist (encompass_arr_.boundary (d,0),
+ info_drul[d] = encompass_offset (encompass_arr.boundary (d, 0));
+ interstaff_interval[d] = calc_interstaff_dist (encompass_arr.boundary (d,0),
this);
}
while (flip (&d) != LEFT);
if (fix_broken_b)
{
- Direction d = (encompass_arr_.top () != spanned_drul_[RIGHT]) ?
+ Direction d = (encompass_arr.top () != spanned_drul_[RIGHT]) ?
RIGHT : LEFT;
dy_f_drul_[d] = info_drul[d][Y_AXIS];
if (!interstaff_b)
{
Note_column * nc = note_column_drul[d];
if (nc == spanned_drul_[d]
- && nc->stem_l_
- && nc->stem_l_->get_direction () == get_direction ()
- && abs (nc->stem_l_->extent (Y_AXIS)[get_direction ()]
+ && nc->stem_l ()
+ && nc->stem_l ()->get_direction () == get_direction ()
+ && abs (nc->stem_l ()->extent (Y_AXIS)[get_direction ()]
- dy_f_drul_[d] + (d == LEFT ? 0 : interstaff_f))
<= snap_f)
{
/*
prepare to attach to stem-end
*/
- snapx_f_drul[d] = nc->stem_l_->hpos_f ()
+ snapx_f_drul[d] = nc->stem_l ()->hpos_f ()
- spanned_drul_[d]->relative_coordinate (0, X_AXIS);
- snapy_f_drul[d] = nc->stem_l_->extent (Y_AXIS)[get_direction ()]
+ snapy_f_drul[d] = nc->stem_l ()->extent (Y_AXIS)[get_direction ()]
+ interstaff_interval[d]
+ get_direction () * 2 * y_gap_f;
int
Slur::cross_staff_count ()const
{
+ Link_array<Note_column> encompass_arr =
+ Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+
int k=0;
- for (int i = 0; i < encompass_arr_.size (); i++)
+ for (int i = 0; i < encompass_arr.size (); i++)
{
- if (calc_interstaff_dist (encompass_arr_[i], this))
+ if (calc_interstaff_dist (encompass_arr[i], this))
k++;
}
return k;
Array<Offset>
Slur::get_encompass_offset_arr () const
{
+ Link_array<Note_column> encompass_arr =
+ Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+
Array<Offset> offset_arr;
#if 0
/*
Offset origin (relative_coordinate (0, X_AXIS), 0);
int first = 1;
- int last = encompass_arr_.size () - 2;
+ int last = encompass_arr.size () - 2;
offset_arr.push (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
*/
int cross_count = cross_staff_count ();
- bool cross_b = cross_count && cross_count < encompass_arr_.size ();
- if (encompass_arr_[0] != spanned_drul_[LEFT])
+ bool cross_b = cross_count && cross_count < encompass_arr.size ();
+ if (encompass_arr[0] != spanned_drul_[LEFT])
{
first--;
- Real is = calc_interstaff_dist (encompass_arr_[0], this);
+ Real is = calc_interstaff_dist (encompass_arr[0], this);
if (cross_b)
offset_arr[0][Y_AXIS] += is;
}
/*
right is broken edge
*/
- if (encompass_arr_.top () != spanned_drul_[RIGHT])
+ if (encompass_arr.top () != spanned_drul_[RIGHT])
{
last++;
}
for (int i = first; i <= last; i++)
{
- Offset o (encompass_offset (encompass_arr_[i]));
+ Offset o (encompass_offset (encompass_arr[i]));
offset_arr.push (o - origin);
}
Array<Spring> meas_springs;
Real non_musical_space_strength = paper_l ()->get_var ("breakable_column_space_strength");
- for (int i= 0; i < cols.size (); i++)
+ for (int i= 0; i < cols.size () - 1; i++)
{
Item * l = cols[i];
Item * r = cols[i+1];
Link_array<Score_column> measure;
for (SCM s = last_col; gh_pair_p (s); s = gh_cdr (s))
{
- SCM elt = gh_car (s);
- Score_column* sc = dynamic_cast<Score_column*> (SMOB_TO_TYPE (Score_column, elt));
+ Score_element * elt = unsmob_element (gh_car (s));
+ Score_column* sc = dynamic_cast<Score_column*> (elt);
measure.push (sc);
if (sc->breakable_b ())
{
#include "molecule.hh"
#include "align-element.hh"
#include "warn.hh"
+#include "group-interface.hh"
+
void
Span_bar::add_bar (Score_element*b)
{
- spanning_l_arr_.push (b);
- add_dependency (b);
-}
+ Group_interface gi (this);
+ gi.add_element (b);
-void
-Span_bar::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
- spanning_l_arr_.unordered_substitute (o, n);
+ add_dependency (b);
}
void
Span_bar::evaluate_empty ()
{
- if (spanning_l_arr_.size () < 1)
+ if (!gh_pair_p (get_elt_property ("elements")))
{
set_elt_property ("transparent", SCM_BOOL_T);
set_empty (X_AXIS);
{
Interval y_int;
- for (int i=0; i < spanning_l_arr_.size (); i++)
+ for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
{
- Score_element*common = common_refpoint (spanning_l_arr_[i], Y_AXIS);
- Real y = spanning_l_arr_[i]->relative_coordinate (common, Y_AXIS)
- - relative_coordinate (common, Y_AXIS);
+ Score_element *bar = unsmob_element ( gh_car (s));
+
+ if (!bar)
+ continue;
+
+ Score_element*common = common_refpoint (bar, Y_AXIS);
+
+ Interval iv (bar->extent(Y_AXIS));
+ if (!iv.empty_b ())
+ {
+ Real y = bar->relative_coordinate (common, Y_AXIS)
+ - relative_coordinate (common, Y_AXIS);
- y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
+ y_int.unite (y + iv);
+ }
}
return y_int;
}
#include "paper-outputter.hh"
#include "score-column.hh"
#include "line-of-score.hh"
+#include "break-align-item.hh"
void
Spanner::break_into_pieces ()
}
}
-#if 0
-/*
- UGH.
- */
-void
-Spanner::handle_broken_dependents ()
-{
- Spanner *unbrok = dynamic_cast<Spanner*> (original_l_);
- if (!unbrok || parent_l(Y_AXIS))
- return;
-
- Spanner *refpoint = dynamic_cast<Spanner*> (unbrok->parent_l (Y_AXIS));
-
- if (refpoint)
- {
- Score_element * broken_refpoint = refpoint->find_broken_piece (line_l ());
- if (broken_refpoint)
- set_parent (broken_refpoint,Y_AXIS);
- else
- programming_error ("Spanner y -refpoint lost.");
- }
-}
-#endif
-
/*
If this is a broken spanner, return the amount the left end is to be
shifted horizontally so that the spanner starts after the initial
Real
Spanner::get_broken_left_end_align () const
{
- int i;
-
Score_column *sc = dynamic_cast<Score_column*> (spanned_drul_[LEFT]->column_l());
// Relevant only if left span point is first column in line
{
// We could possibly return the right edge of the whole Score_column here,
// but we do a full search for the Break_align_item.
- for(i = 0; i < sc->elem_l_arr_.size (); i++)
+
+ /*
+ In fact that doesn't make a difference, since the Score_column
+ is likely to contain only a Break_align_item.
+ */
+#if 0
+ for(SCM s = sc->get_elt_property ("elements"); gh_pair_p (s);
+ s = gh_cdr (s))
{
- if(0 == strcmp (classname (sc->elem_l_arr_[i]), "Break_align_item"))
+ Score_element *e = SMOB_TO_TYPE (Score_element, gh_car (s));
+ if(dynamic_cast<Break_align_item*> (e))
{
- return sc->elem_l_arr_[i]->extent (X_AXIS) [RIGHT];
+ return e->extent (X_AXIS) [RIGHT];
}
}
+#endif
+ return sc->extent (X_AXIS)[RIGHT];
}
return 0.0;
}
SCM other_elt = elt_l_->get_elt_property ("direction-source");
- if (SMOB_IS_TYPE_B (Score_element, other_elt))
+ Score_element * e = unsmob_element(other_elt);
+ if (e)
{
- Score_element * e = SMOB_TO_TYPE(Score_element,other_elt);
-
return relative_dir * Side_position_interface (e).get_direction ();
}
SCM support = me->get_elt_property ("side-support");
for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
- if (!SMOB_IS_TYPE_B (Score_element, gh_car (s)))
- continue;
-
- Score_element * e = SMOB_TO_TYPE(Score_element, gh_car (s));
- common = common->common_refpoint (e, axis);
+ Score_element * e = unsmob_element ( gh_car (s));
+ if (e)
+ common = common->common_refpoint (e, axis);
}
for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
- if (!SMOB_IS_TYPE_B (Score_element, gh_car (s)))
- continue;
- Score_element * e = SMOB_TO_TYPE(Score_element, gh_car (s));
- Real coord = e->relative_coordinate (common, axis);
+ Score_element * e = unsmob_element ( gh_car (s));
+ if (e)
+ {
+ Real coord = e->relative_coordinate (common, axis);
- dim.unite (coord + e->extent (axis));
+ dim.unite (coord + e->extent (axis));
+ }
}
-
if (dim.empty_b ())
{
dim = Interval(0,0);
Staff_symbol_referencer::staff_symbol_l () const
{
SCM st = get_elt_property ("staff-symbol");
- if (SMOB_IS_TYPE_B (Score_element, st))
- return dynamic_cast<Staff_symbol* > (SMOB_TO_TYPE (Score_element,st));
- else
- return 0;
+ return dynamic_cast<Staff_symbol* > (unsmob_element(st));
}
Real
{
if (Rhythmic_head * h = dynamic_cast<Rhythmic_head *> (i.elem_l_))
{
- if (h->stem_l_)
+ if (h->stem_l ())
return;
Rhythmic_req * r = dynamic_cast <Rhythmic_req *> (i.req_l_);
Stem_tremolo::stem_l ()const
{
SCM s = get_elt_property ("stem");
- if (SMOB_IS_TYPE_B (Score_element, s))
- {
- return dynamic_cast<Stem*> (SMOB_TO_TYPE (Score_element,s));
- }
- else
- return 0;
+
+ return dynamic_cast<Stem*> ( unsmob_element (s));
}
Interval
#include "misc.hh"
#include "beam.hh"
#include "rest.hh"
+#include "group-interface.hh"
Stem::Stem ()
{
trigger FP exceptions on FreeBSD. Fix: do not return infinity
*/
- if (!head_l_arr_.size ())
+ if (!first_head ())
{
return Interval_t<int> (100,-100);
}
+ Link_array<Note_head> head_l_arr =
+ Group_interface__extract_elements (this, (Note_head*)0, "heads");
+
Interval_t<int> r;
- for (int i =0; i < head_l_arr_.size (); i++)
+ for (int i =0; i < head_l_arr.size (); i++)
{
- int p = (int)head_l_arr_[i]->position_f ();
+ int p = (int)head_l_arr[i]->position_f ();
r[BIGGER] = r[BIGGER] >? p;
r[SMALLER] = r[SMALLER] <? p;
}
int
Stem::type_i () const
{
- return head_l_arr_[0]->balltype_i_;
+
+ return first_head ()->balltype_i_;
+}
+
+Note_head*
+Stem::first_head () const
+{
+ SCM h =get_elt_property ("heads");
+ if (!gh_pair_p (h))
+ return 0;
+
+ Score_element * sc = unsmob_element (gh_car (h));
+
+ return dynamic_cast<Note_head*> (sc);
}
void
Stem::add_head (Rhythmic_head *n)
{
- n->stem_l_ = this;
+ n->set_elt_property ("stem", this->self_scm_);
n->add_dependency (this); // ?
+
+
+ Group_interface gi (this);
if (Note_head *nh = dynamic_cast<Note_head *> (n))
- {
- head_l_arr_.push (nh);
- }
- else if (Rest *r = dynamic_cast<Rest *> (n))
- {
- rest_l_arr_.push (r);
- }
+ gi.name_ = "heads";
+ else
+ gi.name_ = "rests";
+
+ gi.add_element (n);
}
bool
Stem::invisible_b () const
{
- return (!head_l_arr_.size () ||
- head_l_arr_[0]->balltype_i_ <= 0);
+ return !(first_head () && first_head()->balltype_i_ >= 1);
}
int
void
Stem::set_noteheads ()
{
- if (!head_l_arr_.size ())
+ if (!first_head ())
return;
- head_l_arr_.sort (Note_head::compare);
+
+
+ Link_array<Note_head> head_l_arr =
+ Group_interface__extract_elements (this, (Note_head*)0, "heads");
+
+ head_l_arr.sort (Note_head::compare);
if (get_direction () < 0)
- head_l_arr_.reverse ();
+ head_l_arr.reverse ();
- Note_head * beginhead = head_l_arr_[0];
+ Note_head * beginhead = first_head ();
beginhead->set_elt_property ("extremal", SCM_BOOL_T);
- if (beginhead != head_l_arr_.top ())
- head_l_arr_.top ()->set_elt_property ("extremal", SCM_BOOL_T);
+ if (beginhead != head_l_arr.top ())
+ head_l_arr.top ()->set_elt_property ("extremal", SCM_BOOL_T);
int parity=1;
int lastpos = int (beginhead->position_f ());
- for (int i=1; i < head_l_arr_.size (); i ++)
+ for (int i=1; i < head_l_arr.size (); i ++)
{
- int dy =abs (lastpos- (int)head_l_arr_[i]->position_f ());
+ int dy =abs (lastpos- (int)head_l_arr[i]->position_f ());
if (dy <= 1)
{
if (parity)
- head_l_arr_[i]->flip_around_stem (get_direction ());
+ head_l_arr[i]->flip_around_stem (get_direction ());
parity = !parity;
}
else
parity = 1;
- lastpos = int (head_l_arr_[i]->position_f ());
+ lastpos = int (head_l_arr[i]->position_f ());
}
}
Real dy = staff_line_leading_f ()/2.0;
Real head_wid = 0;
- if (head_l_arr_.size ())
- head_wid = head_l_arr_[0]->extent (X_AXIS).length ();
+ if (first_head ())
+ head_wid = first_head ()->extent (X_AXIS).length ();
stem_y[Direction(-get_direction ())] += get_direction () * head_wid * tan(ANGLE)/(2*dy);
if (!invisible_b ())
mol_p->add_molecule (fl);
}
- if (head_l_arr_.size())
+ if (first_head ())
{
mol_p->translate_axis (note_delta_f (), X_AXIS);
}
Stem::note_delta_f () const
{
Real r=0;
- if (head_l_arr_.size())
+ if (first_head ())
{
- Interval head_wid(0, head_l_arr_[0]->extent (X_AXIS).length ());
+ Interval head_wid(0, first_head()->extent (X_AXIS).length ());
Real rule_thick = paper_l ()->get_var ("stemthickness");
Interval stem_wid(-rule_thick/2, rule_thick/2);
return note_delta_f () + Item::hpos_f ();
}
-void
-Stem::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
- if (Note_head*h=dynamic_cast<Note_head*> (o))
- head_l_arr_.substitute (h, dynamic_cast<Note_head*>(n));
- if (Rest *r=dynamic_cast<Rest*> (o))
- rest_l_arr_.substitute (r, dynamic_cast<Rest*>(n));
-}
Beam*
Stem::beam_l ()const
{
SCM b= get_elt_property ("beam");
- if (SMOB_IS_TYPE_B(Score_element, b))
- return dynamic_cast<Beam*> (SMOB_TO_TYPE(Score_element,b));
- else
- return 0;
+ return dynamic_cast<Beam*> (unsmob_element (b));
}
#include "note-head.hh"
#include "paper-column.hh"
#include "debug.hh"
+#include "group-interface.hh"
+
void
Tie::set_head (Direction d, Note_head * head_l)
{
- assert (!head_l_drul_[d]);
- head_l_drul_[d] = head_l;
+ assert (!head (d));
+ if (d == LEFT)
+ gh_set_car_x (get_elt_property ("heads"), head_l->self_scm_ );
+ else if (d == LEFT)
+ gh_set_cdr_x (get_elt_property ("heads"), head_l->self_scm_ );
+
set_bounds (d, head_l);
add_dependency (head_l);
Tie::Tie()
{
- head_l_drul_[RIGHT] =0;
- head_l_drul_[LEFT] =0;
+ set_elt_property ("heads", gh_cons (SCM_EOL, SCM_EOL));
+}
+
+Note_head*
+Tie::head (Direction d) const
+{
+ SCM c = get_elt_property ("heads");
+ c = index_cell (c, d);
+
+ return dynamic_cast<Note_head*> (unsmob_element (c));
}
Direction
Tie::get_default_dir () const
{
- int m = int (head_l_drul_[LEFT]->position_f ()
- + head_l_drul_[RIGHT]->position_f ()) /2;
+ int m = int (head (LEFT)->position_f ()
+ + head (RIGHT)->position_f ()) /2;
/*
If dir is not determined: inverse of stem: down
void
Tie::do_add_processing()
{
- if (!(head_l_drul_[LEFT] && head_l_drul_[RIGHT]))
+ if (!(head (LEFT) && head (RIGHT)))
warning (_ ("lonely tie"));
Direction d = LEFT;
- Drul_array<Note_head *> new_head_drul = head_l_drul_;
+ Drul_array<Note_head *> new_head_drul;
+ new_head_drul[LEFT] = head(LEFT);
+ new_head_drul[RIGHT] = head(RIGHT);
do {
- if (!head_l_drul_[d])
- new_head_drul[d] = head_l_drul_[(Direction)-d];
+ if (!head (d))
+ new_head_drul[d] = head((Direction)-d);
} while (flip(&d) != LEFT);
- head_l_drul_ = new_head_drul;
+
+ gh_set_car_x (get_elt_property ("heads"), new_head_drul[LEFT]->self_scm_ );
+ gh_set_cdr_x (get_elt_property ("heads"), new_head_drul[RIGHT]->self_scm_ );
}
void
Tie::do_post_processing()
{
- assert (head_l_drul_[LEFT] || head_l_drul_[RIGHT]);
+ assert (head (LEFT) || head (RIGHT));
Real interline_f = paper_l ()->get_var ("interline");
Real internote_f = interline_f / 2;
Direction d = LEFT;
do
{
- Real head_width_f = head_l_drul_[d]
- ? head_l_drul_[d]->extent (X_AXIS).length ()
+ Real head_width_f = head (d)
+ ? head (d)->extent (X_AXIS).length ()
: 0;
/*
side attached to outer (upper or lower) notehead of chord
*/
- if (head_l_drul_[d]
+ if (head (d)
/*
a~a~a;
Getting scared a bit by score-element's comment:
// is this a good idea?
*/
- && (head_l_drul_[d]->get_elt_property ("extremal")
+ && (head (d)->get_elt_property ("extremal")
!= SCM_UNDEFINED))
{
if (d == LEFT)
#else
- if (head_l_drul_[LEFT])
- dx_f_drul_[LEFT] = head_l_drul_[LEFT]->extent (X_AXIS).length ();
+ if (head (LEFT))
+ dx_f_drul_[LEFT] = head (LEFT)->extent (X_AXIS).length ();
else
dx_f_drul_[LEFT] = get_broken_left_end_align ();
dx_f_drul_[LEFT] += x_gap_f;
for smal slurs
*/
- Real ypos = head_l_drul_[LEFT] ? head_l_drul_[LEFT]->position_f ()
- : head_l_drul_[RIGHT]->position_f ();
+ Real ypos = head (LEFT) ? head (LEFT)->position_f ()
+ : head (RIGHT)->position_f ();
Real y_f = internote_f * ypos;
int ypos_i = int (ypos);
dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = y_f;
}
-void
-Tie::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
- Note_head *new_l = n ? dynamic_cast<Note_head *> (n) : 0;
- if (dynamic_cast <Item *> (o) == head_l_drul_[LEFT])
- head_l_drul_[LEFT] = new_l;
- else if (dynamic_cast <Item *> (o) == head_l_drul_[RIGHT])
- head_l_drul_[RIGHT] = new_l;
-}
Array<Rod>
#include "stem.hh"
#include "note-column.hh"
#include "dimensions.hh"
+#include "group-interface.hh"
+
Tuplet_spanner::Tuplet_spanner ()
-> GUILE
*/
parallel_beam_b_ = false;
+ set_elt_property ("beams", SCM_EOL);
+ set_elt_property ("columns", SCM_EOL);
}
/*
(value == 2 && !parallel_beam_b_));
}
- if (column_arr_.size ()){
- Real ncw = column_arr_.top ()->extent (X_AXIS).length ();
- Real w = extent (X_AXIS).length () + ncw;
- Molecule num (lookup_l ()->text ("italic",
- number_str_, paper_l ()));
- num.align_to (X_AXIS, CENTER);
- num.translate_axis (w/2, X_AXIS);
- Real interline = paper_l ()->get_var ("interline");
- Real dy = column_arr_.top ()->extent (Y_AXIS) [get_direction ()]
- - column_arr_[0]->extent (Y_AXIS) [get_direction ()];
- num.align_to (Y_AXIS, CENTER);
- num.translate_axis (get_direction () * interline, Y_AXIS);
+ if (gh_pair_p (get_elt_property ("columns")))
+ {
+ Link_array<Note_column> column_arr=
+ Group_interface__extract_elements (this, (Note_column*)0, "columns");
+
+ Real ncw = column_arr.top ()->extent(X_AXIS).length ();
+ Real w = spanner_length () + ncw;
+ Molecule num (lookup_l ()->text ("italic",
+ number_str_, paper_l ()));
+ num.align_to (X_AXIS, CENTER);
+ num.translate_axis (w/2, X_AXIS);
+ Real interline = paper_l ()->get_var ("interline");
+ Real dy = column_arr.top ()->extent (Y_AXIS) [get_direction ()]
+ - column_arr[0]->extent (Y_AXIS) [get_direction ()];
+ num.align_to (Y_AXIS, CENTER);
+ num.translate_axis (get_direction () * interline, Y_AXIS);
- num.translate_axis (dy/2, Y_AXIS);
+ num.translate_axis (dy/2, Y_AXIS);
- Real thick = paper_l ()->get_var ("tuplet_thick");
- if (bracket_visibility)
- {
- Real gap = paper_l () -> get_var ("tuplet_spanner_gap");
+ Real thick = paper_l ()->get_var ("tuplet_thick");
+ if (bracket_visibility)
+ {
+ Real gap = paper_l () -> get_var ("tuplet_spanner_gap");
- mol_p->add_molecule (lookup_l ()->tuplet_bracket (dy, w, thick, gap, interline, get_direction ()));
- }
-
- if (number_visibility)
- {
- mol_p->add_molecule (num);
- }
- mol_p->translate_axis (get_direction () * interline, Y_AXIS);
- }
+ mol_p->add_molecule (lookup_l ()->tuplet_bracket (dy, w, thick, gap, interline, get_direction ()));
+ }
+
+ if (number_visibility)
+ {
+ mol_p->add_molecule (num);
+ }
+ mol_p->translate_axis (get_direction () * interline, Y_AXIS);
+ }
return mol_p;
}
void
Tuplet_spanner::do_add_processing ()
{
- if (column_arr_.size ())
+ if (gh_pair_p (get_elt_property ("columns")))
{
- set_bounds (LEFT, column_arr_[0]);
- set_bounds (RIGHT, column_arr_.top ());
+ Link_array<Note_column> column_arr=
+ Group_interface__extract_elements (this, (Note_column*)0, "columns");
+
+ set_bounds (LEFT, column_arr[0]);
+ set_bounds (RIGHT, column_arr.top ());
}
}
void
Tuplet_spanner::do_post_processing ()
{
- if (column_arr_.size())
- translate_axis (column_arr_[0]->extent (Y_AXIS)[get_direction ()], Y_AXIS);
+ Link_array<Note_column> column_arr=
+ Group_interface__extract_elements (this, (Note_column*)0, "columns");
+
+
+ if (column_arr.size())
+ translate_axis (column_arr[0]->extent (Y_AXIS)[get_direction ()], Y_AXIS);
- if (beam_l_arr_.size () == 1)
+
+ if (scm_ilength (get_elt_property ("beams")) == 1)
{
- Beam * beam_l = beam_l_arr_[0];
+ SCM bs = get_elt_property ("beams");
+ Score_element *b = unsmob_element (gh_car (bs));
+ Beam * beam_l = dynamic_cast<Beam*> (b);
if (!broken_b ()
&& spanned_drul_[LEFT]->column_l () == beam_l->spanned_drul_[LEFT]->column_l ()
&& spanned_drul_[RIGHT]->column_l () == beam_l->spanned_drul_[RIGHT]->column_l ())
parallel_beam_b_ = true;
}
-
- // if (column_arr_.size () == 1)
- // bracket_visibility_b_ = false;
}
-void
-Tuplet_spanner::do_substitute_element_pointer (Score_element* o, Score_element* n)
-{
- if (Note_column *onc = dynamic_cast <Note_column *> (o))
- column_arr_.substitute (onc, dynamic_cast<Note_column*> (n));
- else if (Beam * b = dynamic_cast<Beam* > (o))
- {
- beam_l_arr_.substitute (b, dynamic_cast<Beam*> (n));
- }
-}
Direction
Tuplet_spanner::get_default_dir () const
return d;
}
- for (int i=0; i < column_arr_.size (); i ++)
+ for (SCM s = get_elt_property ("columns"); gh_pair_p (s); s = gh_cdr (s))
{
- if (column_arr_[i]->dir () < 0)
+ Score_element * sc = unsmob_element (gh_car (s));
+ Note_column * nc = dynamic_cast<Note_column*> (sc);
+ if (nc->dir () < 0)
{
d = DOWN;
break;
}
}
+
return d;
}
Tuplet_spanner::add_beam (Beam *b)
{
add_dependency (b);
- beam_l_arr_.push (b);
+ Group_interface gi (this, "beams");
+ gi.add_element (b);
}
void
Tuplet_spanner::add_column (Note_column*n)
{
- column_arr_.push (n);
+ Group_interface gi (this, "columns");
+ gi.add_element (n);
+
add_dependency (n);
}
#include "volta-spanner.hh"
#include "stem.hh"
#include "dimension-cache.hh"
-#include "pointer.tcc"
+#include "group-interface.hh"
Volta_spanner::Volta_spanner ()
{
last_b_ = false;
dim_cache_ [Y_AXIS]->set_callback (dim_callback);
+ set_elt_property ("bars", SCM_EOL);
+ set_elt_property ("note-columns", SCM_EOL);
}
Molecule*
{
Molecule* mol_p = new Molecule;
- if (!bar_arr_.size ())
+ Link_array<Bar> bar_arr
+ = Group_interface__extract_elements (this, (Bar*)0, "bars");
+
+ if (!bar_arr.size ())
return mol_p;
+
+ Link_array<Bar> note_column_arr
+ = Group_interface__extract_elements (this, (Bar*)0, "note-columns");
+
bool no_vertical_start = false;
bool no_vertical_end = last_b_;
no_vertical_start = true;
if (orig_span && (orig_span->broken_into_l_arr_.top () != (Spanner*)this))
no_vertical_end = true;
- if (bar_arr_.top ()->type_str_.length_i () > 1)
+ if (bar_arr.top ()->type_str_.length_i () > 1)
no_vertical_end = false;
Real interline_f = paper_l ()->get_var ("interline");
Real t = paper_l ()->get_var ("volta_thick");
Real dx = internote_f;
- Real w = extent (X_AXIS).length () - dx - get_broken_left_end_align ();
+ Real w = spanner_length() - dx - get_broken_left_end_align ();
Real h = paper_l()->get_var ("volta_spanner_height");
Molecule volta (lookup_l ()->volta (h, w, t, no_vertical_start, no_vertical_end));
Molecule num (lookup_l ()->text ("volta", number_str_, paper_l ()));
- Real dy = bar_arr_.top ()->extent (Y_AXIS) [UP] >
- bar_arr_[0]->extent (Y_AXIS) [UP];
+ Real dy = bar_arr.top ()->extent (Y_AXIS) [UP] >
+ bar_arr[0]->extent (Y_AXIS) [UP];
dy += 2 * h;
- for (int i = 0; i < note_column_arr_.size (); i++)
- dy = dy >? note_column_arr_[i]->extent (Y_AXIS)[BIGGER];
+ for (int i = 0; i < note_column_arr.size (); i++)
+ dy = dy >? note_column_arr[i]->extent (Y_AXIS)[BIGGER];
dy -= h;
Molecule two (lookup_l ()->text ("number", "2", paper_l ()));
void
Volta_spanner::do_add_processing ()
{
- if (bar_arr_.size ())
+
+ Link_array<Bar> bar_arr
+ = Group_interface__extract_elements (this, (Bar*)0, "bars");
+
+ if (bar_arr.size ())
{
- set_bounds (LEFT, bar_arr_[0]);
- set_bounds (RIGHT, bar_arr_.top ());
+ set_bounds (LEFT, bar_arr[0]);
+ set_bounds (RIGHT, bar_arr.top ());
}
}
void
Volta_spanner::do_post_processing ()
{
- if (bar_arr_.size())
- translate_axis (bar_arr_[0]->extent (Y_AXIS)[UP], Y_AXIS);
+
+ Link_array<Bar> bar_arr
+ = Group_interface__extract_elements (this, (Bar*)0, "bars");
+
+ if (bar_arr.size())
+ translate_axis (bar_arr[0]->extent (Y_AXIS)[UP], Y_AXIS);
translate_axis (get_broken_left_end_align (), X_AXIS);
}
-void
-Volta_spanner::do_substitute_element_pointer (Score_element* o, Score_element* n)
-{
- if (Note_column* c = dynamic_cast <Note_column*> (o))
- note_column_arr_.substitute (c, dynamic_cast<Note_column*> (n));
- else if (Bar* c = dynamic_cast <Bar*> (o))
- bar_arr_.substitute (c, dynamic_cast<Bar*> (n));
-}
+
void
Volta_spanner::add_bar (Bar* c)
{
- bar_arr_.push (c);
+ Group_interface gi(this, "bars");
+ gi.add_element (c);
+
add_dependency (c);
}
void
Volta_spanner::add_column (Note_column* c)
{
- note_column_arr_.push (c);
+ Group_interface gi(this, "note-columns");
+ gi.add_element (c);
+
add_dependency (c);
}
Begin3
Title: LilyPond
-Version: 1.3.9
-Entered-date: 02DEC99
+Version: 1.3.10
+Entered-date: 08DEC99
Description:
Keywords: music notation typesetting midi fonts engraving
Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
janneke@gnu.org (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
- 1000k lilypond-1.3.9.tar.gz
+ 1000k lilypond-1.3.10.tar.gz
Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
- 1000k lilypond-1.3.9.tar.gz
+ 1000k lilypond-1.3.10.tar.gz
Copying-policy: GPL
End
Name: lilypond
-Version: 1.3.9
+Version: 1.3.10
Release: 1
Copyright: GPL
Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.9.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.10.tar.gz
Summary: A program for printing sheet music.
URL: http://www.cs.uu.nl/~hanwen/lilypond
# get Packager from (undocumented?) ~/.rpmmacros!