From b86e726c4538146f842ec7606db7c815ccf365f3 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:12:32 +0000 Subject: [PATCH] lilypond-1.0.1 --- lily/local-key-item.cc | 26 ++++++------- lily/staff-side.cc | 83 ++++++++++++++++++++++++++++++------------ 2 files changed, 72 insertions(+), 37 deletions(-) diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index c4041f0b92..3791f48b97 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -3,9 +3,9 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ -#include "dimen.hh" +#include "dimension.hh" #include "local-key-item.hh" #include "molecule.hh" #include "scalar.hh" @@ -15,9 +15,9 @@ #include "note-head.hh" #include "misc.hh" -Local_key_item::Local_key_item (int i) +Local_key_item::Local_key_item () { - c0_position = i; + c0_position_i_ = 0; } void @@ -61,14 +61,14 @@ Local_key_item::brew_molecule_p() const { Real dy =lastoct*7*paper()->internote_f (); octave_mol_p->translate_axis (dy, Y_AXIS); - output->add (*octave_mol_p); + output->add_molecule (*octave_mol_p); delete octave_mol_p; } octave_mol_p= new Molecule; } lastoct = accs[i].octave_i_; - Real dy = (accs[i].notename_i_ + c0_position) * paper()->internote_f (); - Atom a (paper()->lookup_l ()->accidental (accs[i].accidental_i_)); + Real dy = (accs[i].notename_i_ + c0_position_i_) * paper()->internote_f (); + Atom a (lookup_l ()->accidental (accs[i].accidental_i_)); a.translate_axis (dy, Y_AXIS); Molecule m(a); @@ -79,21 +79,21 @@ Local_key_item::brew_molecule_p() const { Real dy =lastoct*7*paper()->internote_f (); octave_mol_p->translate_axis (dy, Y_AXIS); - output->add (*octave_mol_p); + output->add_molecule (*octave_mol_p); delete octave_mol_p; } if (accs.size()) { Box b(Interval (0, paper()->internote_f ()), Interval (0,0)); - Molecule m (paper()->lookup_l ()->fill (b)); + Molecule m (lookup_l ()->fill (b)); output->add_at_edge (X_AXIS, RIGHT, m); } Interval x_int; for (int i=0; i < support_items_.size(); i++) { - Axis_group_element *common = + Graphical_axis_group *common = common_group (support_items_[i], X_AXIS); Real x = support_items_[i]->relative_coordinate (common, X_AXIS) @@ -112,10 +112,10 @@ Local_key_item::brew_molecule_p() const IMPLEMENT_IS_TYPE_B1(Local_key_item,Item); void -Local_key_item::do_substitute_dependency (Score_elem*o,Score_elem*n) +Local_key_item::do_substitute_dependency (Score_element*o,Score_element*n) { - Item* o_l = o->item(); - Item* n_l = n?n->item():0; + Item* o_l = o->access_Item (); + Item* n_l = n?n->access_Item ():0; support_items_.substitute (o_l, n_l); } diff --git a/lily/staff-side.cc b/lily/staff-side.cc index 7b99d06f99..ec82d64aad 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -3,12 +3,12 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ #include "interval.hh" #include "paper-def.hh" -#include "dimen.hh" +#include "dimension.hh" #include "staff-side.hh" #include "staff-sym.hh" #include "debug.hh" @@ -16,37 +16,38 @@ Staff_side::Staff_side() { - y_=0; + coordinate_offset_f_=0; sym_int_ = Interval (0,0); + padding_f_ = 0.0; dir_ = CENTER; + axis_ = Y_AXIS; } Interval -Staff_side::support_height() const +Staff_side::support_extent() const { Interval y_int; for (int i=0; i < support_l_arr_.size(); i++) { - Axis_group_element *common = - common_group (support_l_arr_[i], Y_AXIS); + Graphical_axis_group *common = + common_group (support_l_arr_[i], axis_); - Real y = support_l_arr_[i]->relative_coordinate (common, Y_AXIS) - -relative_coordinate (common,Y_AXIS); + Real y = support_l_arr_[i]->relative_coordinate (common, axis_) + -relative_coordinate (common,axis_); - y_int.unite (y + support_l_arr_[i]->height()); + y_int.unite (y + support_l_arr_[i]->extent(axis_)); } - if (y_int.empty_b()) { y_int = Interval (0,0); } - return y_int; + return Interval(y_int[LEFT] - padding_f_, y_int[RIGHT] + padding_f_); } void -Staff_side::add_support (Score_elem*i) +Staff_side::add_support (Score_element*i) { support_l_arr_.push (i); add_dependency (i); @@ -57,8 +58,8 @@ Staff_side::get_position_f () const { if (!dir_) { - warning (_("Staff_side::get_position_f(): " - "somebody forgot to set my vertical direction, returning -20")); + warning (_ ("Staff_side::get_position_f(): " + "somebody forgot to set my direction, returning -20")); return -20; } @@ -66,16 +67,16 @@ Staff_side::get_position_f () const Real y = 0; Real inter_f = paper()-> internote_f (); - Interval v = support_height(); + Interval v = support_extent(); // ugh, dim[y] = PT over here y = v[dir_] + 1 * dir_ * inter_f; - int y_i = (int)rint (y / inter_f); + int coordinate_offset_f_i = (int)rint (y / inter_f); // ugh: 5 -> staff_lines - if (abs (y_i) < 5) + if (axis_ == Y_AXIS && abs (coordinate_offset_f_i) < 5) { - if (!(abs (y_i) % 2)) + if (!(abs (coordinate_offset_f_i) % 2)) y += (Real)dir_ * inter_f; } // else @@ -90,20 +91,54 @@ Staff_side::symbol_height() const return Interval (0,0); } +Interval +Staff_side::symbol_width () const +{ + return Interval (0,0); +} + void -Staff_side::do_post_processing() +Staff_side::do_pre_processing () +{ + if (axis_== X_AXIS) + do_side_processing (); +} + +void +Staff_side::do_side_processing () { - sym_int_ = symbol_height(); - y_ = get_position_f(); + sym_int_ = symbol_extent(); + coordinate_offset_f_ = get_position_f(); if (dir_) - y_ += - sym_int_[-dir_]; + coordinate_offset_f_ += - sym_int_[-dir_]; + +} + +/* + ugh should use do_width (), do_height (), get_extent () + */ +Interval +Staff_side::symbol_extent () const +{ + if (axis_ == Y_AXIS) + return symbol_height (); + else + return symbol_width (); +} + + +void +Staff_side::do_post_processing() +{ + if (axis_ == Y_AXIS) + do_side_processing (); } void -Staff_side::do_substitute_dependency (Score_elem*o, Score_elem*n) +Staff_side::do_substitute_dependency (Score_element*o, Score_element*n) { support_l_arr_.unordered_substitute (o,n); } -IMPLEMENT_IS_TYPE_B1(Staff_side, Score_elem); +IMPLEMENT_IS_TYPE_B1(Staff_side, Score_element); -- 2.39.5