junk class, make {get,set}_grob_direction functions.
* lily/slur.cc (get_attachment): do something sensible when
attaching to stem without heads (eg. a rest).
* lily/stem.cc: remove #'up-to-staff ; use #'stem-end for forcing
up to staff. Add #'rests.
remove #'support-head property
(brew_molecule): small cleanup.
(flag): remove #'grace property.
2003-09-30 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * lily/include/directional-element-interface.hh:
+ junk class, make {get,set}_grob_direction functions.
+
* lily/slur.cc (get_attachment): do something sensible when
attaching to stem without heads (eg. a rest).
Grob *this_stem = stems[i];
SCM this_beaming = this_stem->get_grob_property ("beaming");
- Direction this_dir = Directional_element_interface::get(this_stem);
+ Direction this_dir = get_grob_direction (this_stem);
if (gh_pair_p (last_beaming) && gh_pair_p (this_beaming))
{
int start_point = position_with_maximal_common_beams
for (int i=0; i <stems.size (); i++)
do {
Grob *s = stems[i];
- Direction sd = Directional_element_interface::get (s);
+ Direction sd = get_grob_direction (s);
int center_distance = int(- d * Stem::head_positions (s) [-d]) >? 0;
int current = sd ? (1 + d * sd)/2 : center_distance;
SCM forcedir = s->get_grob_property ("direction");
if (!to_dir (forcedir))
- Directional_element_interface::set (s, d);
+ set_grob_direction (s, d);
}
}
* dy
: 0) + pos[LEFT];
- Direction my_dir = Directional_element_interface::get (s);
+ Direction my_dir = get_grob_direction (s);
SCM beaming = s->get_grob_property ("beaming");
Real stem_y = stem_y_beam0;
for normal beams, but for tremolo beams it looks silly otherwise.
*/
if (gap)
- stem_y += thick * 0.5 * Directional_element_interface::get(s);
+ stem_y += thick * 0.5 * get_grob_direction (s);
Stem::set_stemend (s, 2* stem_y / staff_space);
}
int d = 0;
for (SCM s = me->get_grob_property ("stems"); gh_pair_p (s); s = ly_cdr (s))
{
- Direction dir = Directional_element_interface::get
- (unsmob_grob (ly_car (s)));
+ Direction dir = get_grob_direction (unsmob_grob (ly_car (s)));
if (d && d != dir)
{
knee = true;
{
Grob *me = unsmob_grob (element_smob);
- Direction d = Directional_element_interface::get (me);
+ Direction d = get_grob_direction (me);
if (!d)
{
d = UP;
- Directional_element_interface::set (me, d);
+ set_grob_direction (me, d);
}
Real inter_f = Staff_symbol_referencer::staff_space (me)/2;
#include "directional-element-interface.hh"
-
-
-bool
-Directional_element_interface::has_interface (Grob*me)
-{
- return is_direction (me->get_grob_property ("direction"));
-}
-
Direction
-Directional_element_interface::get (Grob*me)
+get_grob_direction (Grob*me)
{
- // return dir_;
SCM d= me->get_grob_property ("direction");
if (!is_direction (d))
return CENTER;
}
void
-Directional_element_interface::set (Grob*me, Direction d)
+set_grob_direction (Grob*me, Direction d)
{
SCM sd = gh_int2scm (d);
-
- /*
- Vain attempt to save some conses.
- */
- if (me->get_grob_property ("direction") != sd)
- me->set_grob_property ("direction", sd);
+ me->set_grob_property ("direction", sd);
}
SCM d= me->get_grob_property ("dot-count");
if (gh_number_p (d) && gh_scm2int (d))
{
- if (!Directional_element_interface::get (me))
- Directional_element_interface::set (me, UP);
+ if (!get_grob_direction (me))
+ set_grob_direction (me, UP);
if (Staff_symbol_referencer::on_staffline (me))
- return gh_double2scm (Staff_symbol_referencer::staff_space (me) / 2.0 * Directional_element_interface::get (me));
+ return gh_double2scm (Staff_symbol_referencer::staff_space (me) / 2.0 * get_grob_direction (me));
}
return gh_double2scm (0.0);
if (Direction d = to_dir (script_ev_->get_mus_property ("direction")))
- Directional_element_interface::set (line_spanner_, d);
+ set_grob_direction (line_spanner_, d);
Axis_group_interface::add_element (line_spanner_, script_);
current_cresc_ev_ = accepted_spanreqs_drul_[START];
if (Direction d = to_dir (current_cresc_ev_->get_mus_property ("direction")))
- Directional_element_interface::set (line_spanner_, d);
+ set_grob_direction (line_spanner_, d);
/*
TODO: Use symbols.
Interval ext = gs.top()->extent (cx, X_AXIS);
ext.unite (gs[0]->extent (cx, X_AXIS));
- Direction d = Directional_element_interface::get (me);
+ Direction d = get_grob_direction (me);
Real t = me->get_paper()->get_realvar (ly_symbol2scm ("linethickness"));
SCM lthick = me->get_grob_property ("thickness");
#include "grob.hh"
-struct Directional_element_interface
-{
-public:
-
- static void set (Grob*,Direction d);
- static Direction get (Grob*) ;
- static bool has_interface (Grob*) ;
-};
-
+void set_grob_direction (Grob*, Direction);
+Direction get_grob_direction (Grob*);
#endif /* DIRECTIONAL_ELEMENT_HH */
Grob * e = unsmob_grob (other_elt);
if (e)
{
- return (Direction) (relative_dir * Directional_element_interface::get (e));
+ return (Direction) (relative_dir * get_grob_direction (e));
}
return CENTER;
o[RIGHT] = ly_scm2offset (index_get_cell (a, RIGHT));
o[d][Y_AXIS] -= (limit - slope) * dx * dir / staff_space;
- o[d][Y_AXIS] *= Directional_element_interface::get (me);
+ o[d][Y_AXIS] *= get_grob_direction (me);
me->set_grob_property ("attachment-offset",
gh_cons (ly_offset2scm (o[LEFT]),
SCM
Slur::set_extremities (Grob *me)
{
- if (!Directional_element_interface::get (me))
- Directional_element_interface::set (me, get_default_dir (me));
+ if (!get_grob_direction (me))
+ set_grob_direction (me, get_default_dir (me));
SCM att = me->get_grob_property ("attachment");
/*
Offset o;
Grob* stem = unsmob_grob (col->get_grob_property ("stem"));
- Direction dir = Directional_element_interface::get (me);
+ Direction dir = get_grob_direction (me);
if (!stem)
{
o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS);
return o;
}
- Direction stem_dir = Directional_element_interface::get (stem);
+ Direction stem_dir = get_grob_direction (stem);
o[X_AXIS] = stem->relative_coordinate (0, X_AXIS);
/*
if (gh_number_p (d))
a = Lookup::dashed_slur (one, thick, thick * gh_scm2double (d));
else
- a = Lookup::slur (one, Directional_element_interface::get (me) * thick, thick);
+ a = Lookup::slur (one, get_grob_direction (me) * thick, thick);
return a.smobbed_copy ();
}
Real h_inf = staff_space * gh_scm2double (h_inf_scm);
Slur_bezier_bow bb (get_encompass_offsets (me),
- Directional_element_interface::get (me),
+ get_grob_direction (me),
h_inf, r_0);
attach = set_extremities(me);
- if (!Directional_element_interface::get (me)
+ if (!get_grob_direction (me)
|| ! gh_symbol_p (index_get_cell (attach, LEFT))
|| ! gh_symbol_p (index_get_cell (attach, RIGHT)))
set_extremities (me);
}
Array<Offset> enc (get_encompass_offsets (me));
- Direction dir = Directional_element_interface::get (me);
+ Direction dir = get_grob_direction (me);
Real x1 = enc[0][X_AXIS];
Real x2 = enc.top ()[X_AXIS];
Direction
Stem::get_direction (Grob*me)
{
- Direction d = Directional_element_interface::get (me);
+ Direction d = get_grob_direction (me);
if (!d)
{
d = get_default_dir (me);
// urg, AAARGH!
- Directional_element_interface::set (me, d);
+ set_grob_direction (me, d);
}
return d ;
}
if (!dir)
{
dir = get_default_dir (me);
- Directional_element_interface::set (me, dir);
+ set_grob_direction (me, dir);
}
}
Stem_info si;
- si.dir_ = Directional_element_interface::get (me);
+ si.dir_ = get_grob_direction (me);
si.ideal_y_ = gh_scm2double (gh_car (scm_info));
si.shortest_y_ = gh_scm2double (gh_cadr (scm_info));
return si;
void
Stem::calc_stem_info (Grob *me)
{
- Direction my_dir = Directional_element_interface::get (me);
+ Direction my_dir = get_grob_direction (me);
Real staff_space = Staff_symbol_referencer::staff_space (me);
Grob *beam = get_beam (me);
Real beam_translation = Beam::get_beam_translation (beam);
Pointer_group_interface__extract_grobs (me, (Grob*)0, "ties");
for (int i = ties.size (); i--;)
- if (Directional_element_interface::get (ties[i]))
+ if (get_grob_direction (ties[i]))
ties.del (i);
return ;
- Direction d = Directional_element_interface::get (me);
+ Direction d = get_grob_direction (me);
if (d)
{
for (int i = ties.size (); i--;)
{
Grob * t = ties[i];
- Directional_element_interface::set (t, d);
+ set_grob_direction (t, d);
}
return;
}
if (ties.size () == 1)
{
Grob * t = ties[0];
- Directional_element_interface::set (t,Tie::get_default_dir (t));
+ set_grob_direction (t,Tie::get_default_dir (t));
return;
}
ties.sort (tie_compare);
- Directional_element_interface::set (ties[0], DOWN);
+ set_grob_direction (ties[0], DOWN);
ties.del (0);
- Directional_element_interface ::set (ties.pop (), UP);
+ set_grob_direction (ties.pop (), UP);
for (int i=ties.size (); i--;)
{
Grob * t = ties[i];
Direction d = (Direction) sign (p);
if (!d)
d = UP;
- Directional_element_interface::set (t, d);
+ set_grob_direction (t, d);
}
}
if (sl && sr)
{
- if (Directional_element_interface::get (sl) == UP
- && Directional_element_interface::get (sr) == UP)
+ if (get_grob_direction (sl) == UP
+ && get_grob_direction (sr) == UP)
return DOWN;
}
else if (sl || sr)
{
Item *s = sl ? sl : sr;
- return - Directional_element_interface::get (s);
+ return - get_grob_direction (s);
}
}
- if (!Directional_element_interface::get (me))
- Directional_element_interface::set (me, Tie::get_default_dir (me));
- Direction dir = Directional_element_interface::get (me);
+ if (!get_grob_direction (me))
+ set_grob_direction (me, Tie::get_default_dir (me));
+ Direction dir = get_grob_direction (me);
Real staff_space = Staff_symbol_referencer::staff_space (me);
i++;
}
- Molecule a = Lookup::slur (b, Directional_element_interface::get (me) * thick, thick);
+ Molecule a = Lookup::slur (b, get_grob_direction (me) * thick, thick);
return a.smobbed_copy ();
}
commonx = commonx->common_refpoint (sp->get_bound(LEFT), X_AXIS);
commonx = commonx->common_refpoint (sp->get_bound(RIGHT), X_AXIS);
- Direction dir = Directional_element_interface::get (me);
+ Direction dir = get_grob_direction (me);
Grob * lgr = get_x_bound_grob (columns[0], dir);
Grob * rgr = get_x_bound_grob (columns.top(), dir);
Grob * commony = common_refpoint_of_list (cols, me, Y_AXIS);
Grob * commonx = common_refpoint_of_list (cols, me, X_AXIS);
- Direction dir = Directional_element_interface::get (me);
+ Direction dir = get_grob_direction (me);
/*
Use outer non-rest columns to determine slope
/*
ugh. refps.
*/
- Direction d = Directional_element_interface::get (me);
+ Direction d = get_grob_direction (me);
*dy = columns.top ()->extent (columns.top (), Y_AXIS) [d]
- columns[0]->extent (columns[0], Y_AXIS) [d];
}
return SCM_UNSPECIFIED;
}
- Direction dir = Directional_element_interface::get (me);
+ Direction dir = get_grob_direction (me);
if (!dir)
{
dir = Tuplet_bracket::get_default_dir (me);
- Directional_element_interface::set (me, dir);
+ set_grob_direction (me, dir);
}
bool equally_long = false;
*/
Real dy, offset;
if (!par_beam
- || Directional_element_interface::get (par_beam) != dir)
+ || get_grob_direction (par_beam) != dir)
{
calc_position_and_height (me,&offset,&dy);
}