From a301f4bb549bcab4d722c829dcd60933914f4814 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:00:14 +0000 Subject: [PATCH] lilypond-0.1.22 --- lily/Stable.make | 2 +- lily/abbreviation-beam.cc | 2 +- lily/bar.cc | 4 +++- lily/beam.cc | 8 ++++---- lily/clef-item.cc | 10 +++++----- lily/include/atom.hh | 2 +- lily/include/graphical-element.hh | 2 +- lily/include/molecule.hh | 2 +- lily/local-key-item.cc | 29 ++++++++++++++++++++++------- lily/lookup.cc | 10 ++++++---- lily/lyric-grav.cc | 2 +- lily/meter.cc | 1 + lily/rest.cc | 17 +++++++---------- lily/script.cc | 4 ++-- lily/span-bar.cc | 2 +- lily/tex-slur.cc | 6 +++--- lily/text-item.cc | 4 ++-- lily/vertical-align-elem.cc | 20 ++++++++++---------- 18 files changed, 72 insertions(+), 55 deletions(-) diff --git a/lily/Stable.make b/lily/Stable.make index 9214c7fb0b..6aebc2b0a5 100644 --- a/lily/Stable.make +++ b/lily/Stable.make @@ -1,7 +1,7 @@ # 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\ diff --git a/lily/abbreviation-beam.cc b/lily/abbreviation-beam.cc index 309337dffb..ac36ae99d0 100644 --- a/lily/abbreviation-beam.cc +++ b/lily/abbreviation-beam.cc @@ -54,7 +54,7 @@ Abbreviation_beam::brew_molecule_p () const 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 } diff --git a/lily/bar.cc b/lily/bar.cc index 05a8557148..8fb5728314 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -35,7 +35,9 @@ Bar::brew_molecule_p() const { 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; } diff --git a/lily/beam.cc b/lily/beam.cc index d2b5e1e3c6..b1dae43061 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -71,7 +71,7 @@ Beam::brew_molecule_p() const 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; } @@ -311,7 +311,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const 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); } } @@ -332,7 +332,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const 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 @@ -355,7 +355,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const 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); } diff --git a/lily/clef-item.cc b/lily/clef-item.cc index a0ca99bcc5..d6c02e542c 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -39,13 +39,13 @@ Clef_item::read (String t) { 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) @@ -61,7 +61,7 @@ Clef_item::brew_molecule_p() const 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; } diff --git a/lily/include/atom.hh b/lily/include/atom.hh index 66c4a6cbba..22b4cec972 100644 --- a/lily/include/atom.hh +++ b/lily/include/atom.hh @@ -24,7 +24,7 @@ struct Atom { 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; diff --git a/lily/include/graphical-element.hh b/lily/include/graphical-element.hh index fae403280c..f5057a0c63 100644 --- a/lily/include/graphical-element.hh +++ b/lily/include/graphical-element.hh @@ -57,7 +57,7 @@ public: 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; diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index f83eda517b..ddea093d0e 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -28,7 +28,7 @@ struct Molecule { 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; diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 2d24d07959..a2ddd1b43e 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -25,6 +25,8 @@ Local_key_item::Local_key_item (int i) 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); } @@ -70,18 +72,17 @@ Local_key_item::brew_molecule_p() const 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); } @@ -89,7 +90,7 @@ Local_key_item::brew_molecule_p() const 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; } @@ -100,8 +101,22 @@ Local_key_item::brew_molecule_p() const 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; } diff --git a/lily/lookup.cc b/lily/lookup.cc index 64153dc8e7..38e31d9000 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -132,7 +132,7 @@ Lookup::clef (String s) const } Atom -Lookup::dots (int j) const +Lookup::dots () const { return (*symtables_)("dots")->lookup ("dot"); } @@ -193,11 +193,10 @@ Lookup::hairpin (Real &wid, bool decresc) const } 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 a; @@ -207,6 +206,9 @@ Lookup::linestaff (int lines, Real wid) const 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; } diff --git a/lily/lyric-grav.cc b/lily/lyric-grav.cc index 346ade0301..182658cd5f 100644 --- a/lily/lyric-grav.cc +++ b/lily/lyric-grav.cc @@ -37,7 +37,7 @@ Lyric_engraver::do_process_requests() { 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_)); diff --git a/lily/meter.cc b/lily/meter.cc index 0c4d4e0ad1..97df812358 100644 --- a/lily/meter.cc +++ b/lily/meter.cc @@ -14,6 +14,7 @@ Molecule* 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)); } diff --git a/lily/rest.cc b/lily/rest.cc index 6dc7dab858..d186608b26 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -1,5 +1,5 @@ /* - rest.cc -- implement + rest.cc -- implement Rest source file of the GNU LilyPond music typesetter @@ -17,10 +17,9 @@ 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_; @@ -34,14 +33,12 @@ Rest::Rest () 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; } diff --git a/lily/script.cc b/lily/script.cc index df80dabd37..2ac9930199 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -102,8 +102,8 @@ Script::brew_molecule_p() const 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; } diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 6076dd7d86..a73c27df42 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -110,7 +110,7 @@ Span_bar::brew_molecule_p() const 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; } diff --git a/lily/tex-slur.cc b/lily/tex-slur.cc index 58783600f5..8ea4ba4a5d 100644 --- a/lily/tex-slur.cc +++ b/lily/tex-slur.cc @@ -69,7 +69,7 @@ Lookup::half_slur_middlepart (Real &dx, Direction dir) const f +=String ("{") + String (idx) + "}"; s.tex_ = f; - s.translate (dx/2, X_AXIS); + s.translate_axis (dx/2, X_AXIS); return s; } @@ -206,7 +206,7 @@ Lookup::slur (int dy , Real &dx, Direction dir) const s.tex_ = f; - s.translate (dx/2, X_AXIS); + s.translate_axis (dx/2, X_AXIS); return s; } @@ -239,7 +239,7 @@ Lookup::big_slur (int dy , Real &dx, Direction dir) const 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(); diff --git a/lily/text-item.cc b/lily/text-item.cc index 4701f2b109..8d62ea7289 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -51,8 +51,8 @@ Text_item::brew_molecule_p() const 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; } diff --git a/lily/vertical-align-elem.cc b/lily/vertical-align-elem.cc index 4f83ba1b7b..8cc0ecfd49 100644 --- a/lily/vertical-align-elem.cc +++ b/lily/vertical-align-elem.cc @@ -22,10 +22,10 @@ Vertical_align_element::do_substitute_dependency (Score_elem*o,Score_elem*n) { 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); } /** @@ -40,18 +40,18 @@ Vertical_align_element::do_post_processing() Array 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(); } } -- 2.39.5