# a hack to keep exec size under control.
-stablecc= offset.cc meter.cc boxes.cc \
+stablecc=meter.cc boxes.cc \
keyword.cc leastsquares.cc \
lookup.cc meter.cc\
parser.cc notename-table.cc lexer.cc\
sb.translate (Offset (x, (x * slope + left_pos)* inter_f));
mol_p->add (sb);
}
- mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate (X_AXIS), X_AXIS);
+ mol_p->translate_axis (x0 - spanned_drul_[LEFT]->absolute_coordinate (X_AXIS), X_AXIS);
return mol_p;
#endif
}
{
Paper_def *p = paper();
Atom s = p->lookup_l()->bar (type_str_,
- p->get_var ("bar_size"));
+ p->get_var ("bar_size"));
+ s.translate_axis (-s.extent()[Y_AXIS].center (), Y_AXIS);
+
Molecule*output = new Molecule (Atom (s));
return output;
}
sb.translate (Offset (x, (x * slope + left_pos)* inter_f));
mol_p->add (sb);
}
- mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), X_AXIS);
+ mol_p->translate_axis (x0 - spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), X_AXIS);
return mol_p;
}
for (int j = 0; j < lhalfs; j++)
{
Atom b (a);
- b.translate (-dir_ * dy * (lwholebeams+j), Y_AXIS);
+ b.translate_axis (-dir_ * dy * (lwholebeams+j), Y_AXIS);
leftbeams.add (b);
}
}
for (; j < nogap; j++)
{
Atom b (a);
- b.translate (-dir_ * dy * j, Y_AXIS);
+ b.translate_axis (-dir_ * dy * j, Y_AXIS);
rightbeams.add (b);
}
// TODO: notehead widths differ for different types
for (; j < rwholebeams + rhalfs; j++)
{
Atom b (a);
- b.translate (-dir_ * dy * j, Y_AXIS);
+ b.translate_axis (-dir_ * dy * j, Y_AXIS);
rightbeams.add (b);
}
{
type_= t;
if (type_ == "violin")
- y_off = 2;
+ y_position_i_ = -2;
if (type_ == "alto")
- y_off = 4;
+ y_position_i_ = 0;
if (type_ == "tenor")
- y_off = 6;
+ y_position_i_ = 2;
if (type_ == "bass")
- y_off = 6;
+ y_position_i_ = 2;
}
void
Clef_item::read (Clef_engraver const &k)
t += "_change";
Atom s = paper()->lookup_l ()->clef (t);
Molecule*output = new Molecule (Atom (s));
- output->translate (paper()->internote_f () * y_off, Y_AXIS);
+ output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS);
return output;
}
Atom (String, Box);
Atom ();
void translate (Offset o);
- void translate (Real r,Axis a);
+ void translate_axis (Real r,Axis a);
/// how big is #this#?
Box extent() const;
void print() const;
translate in one direction
*/
- void translate (Real, Axis);
+ void translate_axis (Real, Axis);
Real relative_coordinate (Axis_group_element*group, Axis) const;
Offset absolute_offset() const;
void add (Molecule const &m);
void translate (Offset);
- void translate (Real,Axis);
+ void translate_axis (Real,Axis);
void add (Atom const & a) ;
/// how big is #this#?
Box extent() const;
void
Local_key_item::add_support (Item*head_l)
{
+ if (support_items_.find_l(head_l))
+ return ;
support_items_.push (head_l);
add_dependency (head_l);
}
if (octave_mol_p)
{
Real dy =lastoct*7*paper()->internote_f ();
- octave_mol_p->translate (dy, Y_AXIS);
+ octave_mol_p->translate_axis (dy, Y_AXIS);
output->add (*octave_mol_p);
delete octave_mol_p;
}
octave_mol_p= new Molecule;
}
lastoct = accs[i].octave_i_;
-
Real dy = (accs[i].name_i_ + c0_position) * paper()->internote_f ();
Atom a (paper()->lookup_l ()->accidental (accs[i].accidental_i_));
- a.dim_[X_AXIS] += 1 PT; // todo
- a.translate (dy, Y_AXIS);
+
+ a.translate_axis (dy, Y_AXIS);
Molecule m(a);
octave_mol_p->add_at_edge (X_AXIS, RIGHT, m);
}
if (octave_mol_p)
{
Real dy =lastoct*7*paper()->internote_f ();
- octave_mol_p->translate (dy, Y_AXIS);
+ octave_mol_p->translate_axis (dy, Y_AXIS);
output->add (*octave_mol_p);
delete octave_mol_p;
}
Molecule m (paper()->lookup_l ()->fill (b));
output->add_at_edge (X_AXIS, RIGHT, m);
}
- Interval head_width=itemlist_width (support_items_);
- output->translate (-output->extent().x ().right + head_width.left , X_AXIS);
+
+ Interval x_int;
+ for (int i=0; i < support_items_.size(); i++)
+ {
+ Axis_group_element *common =
+ common_group (support_items_[i], X_AXIS);
+
+ Real x = support_items_[i]->relative_coordinate (common, X_AXIS)
+ -relative_coordinate (common, X_AXIS);
+
+ x_int.unite (x + support_items_[i]->width());
+ }
+ if (x_int.empty_b ())
+ x_int = Interval(0,0);
+
+ output->translate_axis (-output->extent()[X_AXIS][RIGHT] + x_int[LEFT], X_AXIS);
return output;
}
}
Atom
-Lookup::dots (int j) const
+Lookup::dots () const
{
return (*symtables_)("dots")->lookup ("dot");
}
}
Atom
-Lookup::linestaff (int lines, Real wid) const
+Lookup::linestaff (int lines, Real interline_f, Real wid) const
{
- Real internote_f = paper_l_ ->internote_f();
Atom s;
- Real dy = (lines >0) ? (lines-1)*internote_f : 0;
+ Real dy = (lines >0) ? (lines-1)*interline_f : 0;
s.dim_ = Box (Interval (0,wid), Interval (0,dy));
Array<String> a;
s.tex_ = (*symtables_)("param")->lookup ("linestaf").tex_;
s.tex_ = substitute_args (s.tex_, a);
+
+ s.translate_axis (-s.extent ()[Y_AXIS].center (), Y_AXIS);
+
return s;
}
{
lyric_item_p_ = new Text_item (lreq_l_->tdef_p_);
- lyric_item_p_->translate (paper()->note_width ()/2 , X_AXIS);
+ lyric_item_p_->translate_axis (paper()->note_width ()/2 , X_AXIS);
lyric_item_p_->dir_ = DOWN;
lyric_item_p_->fat_b_ = true;
announce_element (Score_elem_info (lyric_item_p_, lreq_l_));
Meter::brew_molecule_p() const
{
Atom s = paper()->lookup_l ()->meter (args);
+ s.translate_axis (-s.extent()[Y_AXIS].center (), Y_AXIS);
return new Molecule (Atom (s));
}
/*
- rest.cc -- implement
+ rest.cc -- implement Rest
source file of the GNU LilyPond music typesetter
void
Rest::do_add_processing ()
{
- if (balltype_i_ == 0)
- position_i_ += 4;
- else if (balltype_i_ == 1)
- position_i_ += 4;
+ if (balltype_i_ != 0 && balltype_i_ != 1)
+ position_i_ -= 4;
+
Rhythmic_head::do_add_processing ();
if (dots_l_)
dots_l_->position_i_ = position_i_;
Molecule *
Rest::brew_molecule_p () const
{
- int staff_size_i_ =8;
- bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1);
- if (balltype_i_ < 0 || balltype_i_ > 1)
- streepjes_b = false;
+ int staff_size_i_ = 8;
+ bool streepjes_b = abs(position_i_) > staff_size_i_ /2 && (balltype_i_ == 0 || balltype_i_ == 1);
Atom s(paper ()->lookup_l()->rest (balltype_i_, streepjes_b));
Molecule * m = new Molecule ( Atom (s));
- m->translate (position_i_ * paper ()->internote_f (), Y_AXIS);
+ m->translate_axis (position_i_ * paper ()->internote_f (), Y_AXIS);
return m;
}
Real dx = paper()->note_width()/2;
Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_));
- out->translate (dy * pos_i_, Y_AXIS);
- out->translate (dx, X_AXIS); // FIXME! ugh
+ out->translate_axis (dy * pos_i_, Y_AXIS);
+ out->translate_axis (dx, X_AXIS); // FIXME! ugh
return out;
}
Atom s = get_bar_sym (y_int.length());
Molecule*output = new Molecule (Atom (s));
- output->translate (y_int[-1], Y_AXIS);
+ output->translate_axis (y_int[-1], Y_AXIS);
return output;
}
f +=String ("{") + String (idx) + "}";
s.tex_ = f;
- s.translate (dx/2, X_AXIS);
+ s.translate_axis (dx/2, X_AXIS);
return s;
}
s.tex_ = f;
- s.translate (dx/2, X_AXIS);
+ s.translate_axis (dx/2, X_AXIS);
return s;
}
mol.add_at_edge (X_AXIS, RIGHT, a);
mol.add_at_edge (X_AXIS, RIGHT, r);
- mol.translate (l_dy * internote_f, Y_AXIS);
+ mol.translate_axis (l_dy * internote_f, Y_AXIS);
Atom s;
s.tex_ = mol.TeX_string();
s.dim_ = mol.extent();
Molecule* mol_p = new Molecule (a);
if (dir_<0) // should do something better anyway.
- mol_p->translate (-mol_p->extent().y ().left , Y_AXIS);
- mol_p->translate (pos_i_ * paper()->internote_f (), Y_AXIS);
+ mol_p->translate_axis (-mol_p->extent().y ().left , Y_AXIS);
+ mol_p->translate_axis (pos_i_ * paper()->internote_f (), Y_AXIS);
return mol_p;
}
{
int i;
while ((i = elem_l_arr_.find_i (o))>=0)
- if (n)
- elem_l_arr_[i] = n;
- else
- elem_l_arr_.del (i);
+ if (n)
+ elem_l_arr_[i] = n;
+ else
+ elem_l_arr_.del (i);
}
/**
Array<Interval> dims;
for (int i=0; i < elem_l_arr_.size(); i++)
{
- Interval y = elem_l_arr_[i]->height() ;
- if (y.empty_b())
- y = Interval (0,0);
+ Interval y = elem_l_arr_[i]->height() ;
+ if (y.empty_b())
+ y = Interval (0,0);
- dims.push (y);
+ dims.push (y);
}
Real where_f=0;
for (int i=0 ; i < elem_l_arr_.size(); i++)
{
- elem_l_arr_[i]->translate (- dims[i][1] - where_f, Y_AXIS);
- where_f += dims[i].length();
+ elem_l_arr_[i]->translate_axis (- dims[i][1] - where_f, Y_AXIS);
+ where_f += dims[i].length();
}
}