a.translate(Offset (-w, -w * sl));
for (int j = 0; j < lhalfs; j++) {
Atom b(a);
- b.translate_y( -dir_i_ * dy * (lwholebeams+j));
+ b.translate( -dir_i_ * dy * (lwholebeams+j), Y_AXIS);
leftbeams.add( b );
}
}
int j = 0;
for (; j < rwholebeams; j++) {
Atom b(a);
- b.translate_y( -dir_i_ * dy * j);
+ b.translate( -dir_i_ * dy * j, Y_AXIS);
rightbeams.add( b );
}
for (; j < rwholebeams + rhalfs; j++) {
Atom b(a);
- b.translate_y( -dir_i_ * dy * j);
+ b.translate( -dir_i_ * dy * j, Y_AXIS);
rightbeams.add(b );
}
sb.translate(Offset(x, (x * slope + left_pos)* inter_f));
mol_p->add(sb);
}
- mol_p->translate_x(x0 - left_col_l_->hpos_f_);
+ mol_p->translate(x0 - left_col_l_->hpos_f_, X_AXIS);
return mol_p;
}
Clef_item::Clef_item()
{
+ breakable_b_ =true;
default_b_ = false;
change_b_ = true;
read("violin");
t += "_change";
Symbol s = paper()->lookup_l()->clef(t);
Molecule*output = new Molecule(Atom(s));
- output->translate_y( paper()->internote_f() * y_off);
+ output->translate( paper()->internote_f() * y_off, Y_AXIS);
return output;
}
void add_bottom(const Molecule &m);
void add(Molecule const &m);
void translate(Offset);
- void translate_y(Real);
- void translate_x(Real);
+ void translate(Real,Axis);
void add(Atom const & a) ;
/// how big is #this#?
Box extent() const;
Link_array<Bar> spanning_l_arr_;
public:
+ Span_bar();
DECLARE_MY_RUNTIME_TYPEINFO;
SCORE_ELEM_CLONE(Span_bar);
void add(Bar* );
protected:
virtual Interval do_width()const;
virtual void do_pre_processing();
- virtual void translate_y(Real y);
virtual void do_substitute_dependency(Score_elem*,Score_elem*);
virtual Molecule * brew_molecule_p()const;
#include "score-elem.hh"
#include "interval.hh"
-/** A symbol which sits along a staff
+/** A symbol which sits along a staff.
- Should override translate_y() ?
*/
class Staff_side : virtual Score_elem {
Link_array<Score_elem> support_l_arr_;
void translate(Offset o) {
off_ += o;
}
- void translate_x(Real r){
- off_.x += r;
+ void translate(Real r,Axis a){
+ off_[a] += r;
}
- void translate_y(Real r) {
- off_.y += r;
- }
-
/// how big is #this#?
Box extent() const;
Atom(Symbol s);
+/*
+ key-item.cc -- implement Key_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+
+ keyplacement by Mats Bengtsson
+*/
+
#include "key-item.hh"
#include "key.hh"
#include "debug.hh"
#include "molecule.hh"
#include "paper-def.hh"
#include "lookup.hh"
-//#include "clef-grav.hh"
+
#include "key-grav.hh"
const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */
Key_item::Key_item(int c)
{
+ breakable_b_ =true;
default_b_ = false;
set_c_position(c);
}
for (int i =0; i < pitch.size(); i++) {
Symbol s= paper()->lookup_l()->accidental(acc[i]);
Atom a(s);
- a.translate_y((c_position + pitch[i]) * inter);
+ a.translate((c_position + pitch[i]) * inter, Y_AXIS);
Molecule m(a);
output->add_right(m);
}
if (accs[i].octave_i_ != lastoct) {
if (octmol){
Real dy =lastoct*7*paper()->internote_f();
- octmol->translate_y( dy);
+ octmol->translate( dy, Y_AXIS);
output->add(*octmol);
delete octmol;
}
Symbol s =paper()->lookup_l()->accidental(accs[i].accidental_i_);
Atom a(s);
Real dy = (accs[i].name_i_ + c0_position) * paper()->internote_f();
- a.translate_y(dy);
+ a.translate(dy, Y_AXIS);
octmol->add_right(a);
}
if (octmol){
Real dy =lastoct*7*paper()->internote_f();
- octmol->translate_y( dy);
+ octmol->translate( dy, Y_AXIS);
output->add(*octmol);
delete octmol;
}
Interval head_width=itemlist_width(support_items_);
- output->translate_x(-output->extent().x.right + head_width.left );
+ output->translate(-output->extent().x().right + head_width.left , X_AXIS);
return output;
}
if ( lreq_l_ ) {
lyric_item_p_ = new Text_item(lreq_l_->tdef_p_ );
- lyric_item_p_->translate_x( paper()->note_width()/2 );
+ lyric_item_p_->translate( paper()->note_width()/2 , X_AXIS);
lyric_item_p_->dir_i_ = -1;
lyric_item_p_->fat_b_ = true;
announce_element( Score_elem_info( lyric_item_p_, lreq_l_));
#include "debug.hh"
#include "tex.hh"
-
-/* *************** */
-
String
Molecule::TeX_string() const
{
}
void
-Molecule::translate_x(Real x)
-{
- translate(Offset(x,0));
-}
-
-void
-Molecule::translate_y(Real y)
+Molecule::translate(Real x,Axis a)
{
- translate(Offset(0,y));
+ for (iter_top(ats,c); c.ok(); c++)
+ c->translate(x,a);
}
void
add(m);
return;
}
- Real xof=extent().x.right - m.extent().x.left;
+ Real xof=extent().x().right - m.extent().x().left;
+
+
Molecule toadd(m);
toadd.translate(Offset(xof, 0.0));
add(toadd);
add(m);
return;
}
- Real xof=extent().x.left - m.extent().x.right;
+ Real xof=extent().x().left - m.extent().x().right;
+
Molecule toadd(m);
toadd.translate(Offset(xof, 0.0));
add(toadd);
add(m);
return;
}
- Real yof=extent().y.right - m.extent().y.left;
+ Real yof=extent().y().right - m.extent().y().left;
+
Molecule toadd(m);
- toadd.translate_y(yof);
+ toadd.translate(yof, Y_AXIS);
add(toadd);
}
add(m);
return;
}
- Real yof=extent().y.left- m.extent().y.right;
+ Real yof=extent().y().left- m.extent().y().right;
Molecule toadd(m);
- toadd.translate_y(yof);
+ toadd.translate(yof, Y_AXIS);
add(toadd);
}
s = p->lookup_l()->rest(balltype_i_, streepjes_b);
}
out = new Molecule(Atom(s));
- out->translate_x( x_dir_i_ * s.dim.x.length() );
+ out->translate( x_dir_i_ * s.dim.x().length() , X_AXIS);
if (dots_i_) {
Symbol d = p->lookup_l()->dots(dots_i_ );
Molecule dm;
dm.add(Atom(d));
- dm.translate_y( inter_f * dot_delta_y_i_ );
+ dm.translate( inter_f * dot_delta_y_i_ , Y_AXIS);
out->add_right(dm);
}
Molecule sm;
sm.add(Atom(str));
if (position_i_ % 2)
- sm.translate_y(-inter_f* dir);
+ sm.translate(-inter_f* dir, Y_AXIS);
out->add(sm);
}
- out->translate_y(inter_f*position_i_);
+ out->translate(inter_f*position_i_, Y_AXIS);
return out;
}
Interval
Script::do_width() const
{
- return specs_l_->get_atom(paper(), dir_i_).extent().x;
+ return specs_l_->get_atom(paper(), dir_i_).extent().x();
}
void
Script::do_pre_processing()
{
+ if (breakable_b_ && break_status_i() != 1) {
+ transparent_b_ = empty_b_ = true;
+ }
+
if (!dir_i_)
set_default_dir();
inside_staff_b_ = specs_l_->inside_b();
Interval
Script::symbol_height()const
{
- return specs_l_->get_atom(paper(), dir_i_).extent().y;
+ return specs_l_->get_atom(paper(), dir_i_).extent().y();
}
Molecule*
Real dy = paper()->internote_f();
Molecule*out = new Molecule(specs_l_->get_atom(paper(), dir_i_));
- out->translate_y(dy * pos_i_);
+ out->translate(dy * pos_i_, Y_AXIS);
return out;
}
if (!print_flag_b_ || abs(flag_i_) <= 4)
return Interval(0,0); // TODO!
Paper_def*p= paper();
- Interval r(p->lookup_l()->flag(flag_i_).dim.x);
+ Interval r(p->lookup_l()->flag(flag_i_).dim.x());
r+= stem_xoffset_f_;
return r;
}
assert(false);
}
- out->translate_x(stem_xoffset_f_);
+ out->translate(stem_xoffset_f_, X_AXIS);
return out;
}
Symbol s;
- s.dim.y = Interval(min(0,0), max(0,0)); // todo
- s.dim.x = Interval(0,dx);
+ s.dim.y() = Interval(min(0,0), max(0,0)); // todo
+ s.dim.x() = Interval(0,dx);
String f = String("\\hslurchar");
f += direction_char(0);
f+=String( "{" ) + String( idx ) + "}";
s.tex = f;
Atom a(s);
- a.translate_x(dx/2);
+ a.translate(dx/2, X_AXIS);
s.tex = a.TeX_string();
return s;
}
Symbol s;
- s.dim.x = Interval(0,dx);
- s.dim.y = Interval(min(0,dy), max(0,dy));
+ s.dim.x() = Interval(0,dx);
+ s.dim.y() = Interval(min(0,dy), max(0,dy));
String f = String("\\hslurchar");
}
Symbol s;
- s.dim.x = Interval(0,dx);
- s.dim.y = Interval(min(0,dy), max(0,dy));
+ s.dim.x() = Interval(0,dx);
+ s.dim.y() = Interval(min(0,dy), max(0,dy));
String f = String("\\slurchar") + String( direction_char(y_sign) );
s.tex = f;
Atom a(s);
- a.translate_x(dx/2);
+ a.translate(dx/2, X_AXIS);
s.dim = a.extent();
s.tex = a.TeX_string();
return s;
Molecule mol;
mol.add(l);
Atom a(m);
- a.translate_y(slur_extra * internote_f);
+ a.translate(slur_extra * internote_f, Y_AXIS);
mol.add_right(m);
mol.add_right(r);
- mol.translate_y( l_dy * internote_f);
+ mol.translate( l_dy * internote_f, Y_AXIS);
Symbol s;
s.tex = mol.TeX_string();
s.dim = mol.extent();
Interval
Text_item::symbol_height()const
{
- return tdef_p_->get_atom(paper(), dir_i_).sym_.dim.y;
+ return tdef_p_->get_atom(paper(), dir_i_).sym_.dim.y();
}
Molecule*
Molecule* mol_p = new Molecule(a);
if(dir_i_<0 ) // should do something better anyway.
- mol_p->translate_y( -mol_p->extent().y.left );
- mol_p->translate_y( pos_i_ * paper()->internote_f());
+ mol_p->translate( -mol_p->extent().y().left , Y_AXIS);
+ mol_p->translate( pos_i_ * paper()->internote_f(), Y_AXIS);
return mol_p;
}
else
elem_l_arr_.del(i);
}
+
+/**
+ Align elements top to bottom.
+ The first element has its top at y =0.0 afterwards
+
+ TODO configurable, like Horizontal_align_item
+ */
void
Vertical_align_element::do_post_processing()
{
Real where_f=0;
for ( int i=0 ; i < elem_l_arr_.size(); i++) {
- elem_l_arr_[i]->translate_y( - dims[i][1] - where_f);
+ elem_l_arr_[i]->translate( - dims[i][1] - where_f, Y_AXIS);
where_f += dims[i].length();
}
}