From: fred Date: Tue, 26 Mar 2002 22:43:08 +0000 (+0000) Subject: lilypond-1.3.4 X-Git-Tag: release/1.5.59~2005 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5e5397d2d30de06ac7c6434b2d9e92cb26c4808b;p=lilypond.git lilypond-1.3.4 --- diff --git a/input/test/staff-line-leading.ly b/input/test/staff-line-leading.ly index 03a5daf1d5..dbf97cf071 100644 --- a/input/test/staff-line-leading.ly +++ b/input/test/staff-line-leading.ly @@ -2,7 +2,9 @@ \notes \relative c'' \context GrandStaff < \context Staff = up { c4 c4 } \context Staff = down { \property Staff. staffLineLeading = #5.5 c4 - + [ + e] + [f c'] } > } diff --git a/lily/beam.cc b/lily/beam.cc index 0d7b93157f..64ab8ea41f 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -312,7 +312,7 @@ Beam::get_default_dir () const void Beam::set_direction (Direction d) { - set_direction ( d); + Directional_spanner::set_direction (d); for (int i=0; i position_i_ - d2->position_i_; + return int (d1->position_f () - d2->position_f ()); } void @@ -83,10 +83,11 @@ Dot_column::do_post_processing () for (int i=0; i < dot_l_arr_.size (); i++) { for (int j=0; j < taken_posns.size (); j++) - if (taken_posns[j] == dot_l_arr_[i]->position_i_) + if (taken_posns[j] == (int) dot_l_arr_[i]->position_f ()) conflicts++; - taken_posns.push (dot_l_arr_[i]->position_i_); - s.unite (Slice (dot_l_arr_[i]->position_i_,dot_l_arr_[i]->position_i_)); + taken_posns.push ((int)dot_l_arr_[i]->position_f ()); + s.unite (Slice ((int)dot_l_arr_[i]->position_f (), + (int)dot_l_arr_[i]->position_f ())); } if (!conflicts) @@ -102,6 +103,6 @@ Dot_column::do_post_processing () for (int i=0; i position_i_ = pos; + dot_l_arr_[i]->set_position(pos); } } diff --git a/lily/dots.cc b/lily/dots.cc index 43dac77057..d4c8e62eed 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -14,7 +14,6 @@ Dots::Dots () { dots_i_ =0; - position_i_ =0; resolve_dir_ =CENTER; } @@ -39,7 +38,7 @@ Dots::do_brew_molecule_p () const { Molecule *out = new Molecule; Molecule fill = lookup_l ()->fill (Box (Interval (0,0), - Interval (0,0))); + Interval (0,0))); out->add_molecule (fill); Molecule d = lookup_l ()->dots (); diff --git a/lily/include/breathing-sign.hh b/lily/include/breathing-sign.hh index 6e861a905c..0378d62078 100644 --- a/lily/include/breathing-sign.hh +++ b/lily/include/breathing-sign.hh @@ -13,23 +13,24 @@ #include "item.hh" #include "staff-symbol-referencer.hh" #include "parray.hh" +#include "directional-element.hh" -class Breathing_sign : public Item, public Staff_symbol_referencer { +class Breathing_sign : public Item, + public Staff_symbol_referencer, + public Directional_element +{ public: VIRTUAL_COPY_CONS(Score_element); Breathing_sign (); void set_vertical_position (Direction); - void set_direction (Direction d ) { dir_ = d; } - Direction get_direction () const { return dir_; } protected: virtual void do_post_processing (); virtual Molecule* do_brew_molecule_p () const; - -private: - Direction dir_; }; + + #endif // BREATHING_SIGN_HH diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index c37277e312..11362d72fa 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -31,7 +31,6 @@ protected: public: String symbol_; - int y_position_i_; VIRTUAL_COPY_CONS(Score_element); Clef_item(); diff --git a/lily/include/directional-spanner.hh b/lily/include/directional-spanner.hh index cdc56a4ed1..93d226fdaa 100644 --- a/lily/include/directional-spanner.hh +++ b/lily/include/directional-spanner.hh @@ -8,20 +8,14 @@ #define DIRECTIONALSPANNER_HH #include "spanner.hh" +#include "directional-element.hh" /** a spanner which can be pointing "up" or "down". JUNKME? */ -class Directional_spanner : public Spanner{ - /// -1 below heads, +1 above heads. - Direction dir_; - +class Directional_spanner : public Spanner, public Directional_element { public: - Directional_spanner(); - - void set_direction (Direction d ) { dir_ = d; } - Direction get_direction () const { return dir_; } /// offset of "center" relative to left-column/0-pos of staff virtual Offset center() const; diff --git a/lily/include/dots.hh b/lily/include/dots.hh index 29e1bd5b11..2806cb1cc4 100644 --- a/lily/include/dots.hh +++ b/lily/include/dots.hh @@ -23,7 +23,6 @@ protected: virtual void do_post_processing (); public: int dots_i_; - int position_i_; Direction resolve_dir_; Dots (); diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index f939347094..310cfd29d0 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -54,6 +54,9 @@ public: virtual ~Paper_def (); Array shape_int_a_; + /* + JUNKME + */ Real get_realvar (SCM symbol) const; Real get_var (String id) const; diff --git a/lily/include/rest.hh b/lily/include/rest.hh index 611ddd7103..39b6bb2b20 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -15,7 +15,6 @@ class Rest : public Rhythmic_head { public: - Rest (); void add_dots (Dots*); protected: virtual void do_add_processing (); diff --git a/lily/include/rhythmic-head.hh b/lily/include/rhythmic-head.hh index 7f792787db..3d912e0cb0 100644 --- a/lily/include/rhythmic-head.hh +++ b/lily/include/rhythmic-head.hh @@ -18,7 +18,6 @@ class Rhythmic_head : public Item, public Staff_symbol_referencer public: Stem * stem_l_; int balltype_i_; - int position_i_; Dots * dots_l_; @@ -26,10 +25,9 @@ public: Rhythmic_head (); int dots_i ()const; - virtual Real position_f () const; protected: virtual void do_post_processing (); - virtual void do_pre_processing (); + virtual void do_print () const; virtual void do_substitute_element_pointer (Score_element*,Score_element*); }; diff --git a/lily/include/staff-bar.hh b/lily/include/staff-bar.hh index 4f604ad080..171ec1ddc0 100644 --- a/lily/include/staff-bar.hh +++ b/lily/include/staff-bar.hh @@ -17,9 +17,10 @@ A bar that is on a staff. Ugh. Entita non multiplicandum ... */ -class Staff_bar : public Bar , public Staff_symbol_referencer +class Staff_bar : public Bar, public Staff_symbol_referencer { public: + virtual void do_pre_processing (); VIRTUAL_COPY_CONS(Score_element); virtual Real get_bar_size () const; }; diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index 36441beefa..81510632aa 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -14,6 +14,7 @@ #include "spanner.hh" #include "item.hh" #include "staff-symbol-referencer.hh" +#include "directional-element.hh" /** Position myself next to a set of elements. Configurable in axis @@ -25,16 +26,14 @@ Amount of extra space to add. */ -class Staff_side_element : public Staff_symbol_referencer +class Staff_side_element : public Staff_symbol_referencer, + public Directional_element { void position_self (); - Direction dir_; + public: Score_element * to_position_l_; - void set_direction (Direction d ) { dir_ = d; } - Direction get_direction () const { return dir_; } - Link_array support_l_arr_; Axis axis_; diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index 255c57abcc..5fc62e0ed0 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -21,9 +21,11 @@ class Staff_symbol_referencer : public virtual Score_element { protected: Staff_symbol * staff_sym_l_; - + int position_i_; public: Staff_symbol_referencer (); + void set_position (int); + void set_staff_symbol (Staff_symbol*); /** Leading are the lead strips between the sticks (lines) of @@ -34,7 +36,7 @@ public: Staff_symbol * staff_symbol_l () const; int lines_i () const; virtual void do_substitute_element_pointer (Score_element*,Score_element*); - + virtual void do_pre_processing (); virtual Real position_f () const; }; diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 2d91e441e9..411848696b 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -11,6 +11,7 @@ #include "moment.hh" #include "molecule.hh" #include "staff-symbol-referencer.hh" +#include "directional-element.hh" /**the rule attached to the ball. takes care of: @@ -41,19 +42,16 @@ */ // todo: remove baseclass Staff_symbol_referencer, since stem // can be across a staff. -class Stem : public Item, public Staff_symbol_referencer { +class Stem : public Item, public Staff_symbol_referencer, + public Directional_element +{ /**extent of the stem (positions). fractional, since Beam has to adapt them. */ Drul_array yextent_drul_; - /// direction stem (that's me) - Direction dir_; - public: - void set_direction (Direction d); - Direction get_direction () const { return dir_; } Link_array head_l_arr_; Link_array rest_l_arr_; diff --git a/lily/note-head.cc b/lily/note-head.cc index faad356297..a8ee5f3f9a 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -33,7 +33,7 @@ Note_head::do_pre_processing () if (balltype_i_ > 2) balltype_i_ = 2; if (dots_l_) // move into Rhythmic_head? - dots_l_->position_i_ = int (position_f ()); + dots_l_->set_position(int (position_f ())); } @@ -67,7 +67,7 @@ Note_head::do_brew_molecule_p() const String type; - SCM style =get_elt_property ("style"); + SCM style = get_elt_property ("style"); if (style != SCM_UNDEFINED) { type = ly_scm2string (style); diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index 74168092d4..3ce360fed0 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -79,7 +79,7 @@ Note_heads_engraver::do_process_requests() announce_element (Score_element_info (d,0)); dot_p_arr_.push (d); } - note_p->position_i_ = note_req_l->pitch_.steps (); + note_p->set_position(note_req_l->pitch_.steps ()); /* TODO: transparent note heads. diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 9dd7d28729..14316cad02 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -127,12 +127,12 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) if (a_off.length () > 100 CM) { - warning (_f ("improbable offset for object type: `%s'", nm)); + programming_error ("improbable offset for object"); Axis a =X_AXIS; while (a < NO_AXES) { - if (abs(a_off[a]) > 50 CM) - a_off[a] = 50 CM; + if (abs(a_off[a]) > 30 CM) + a_off[a] = 30 CM; incr (a); } } @@ -230,6 +230,11 @@ Paper_outputter::output_version () void Paper_outputter::start_line (Real height) { + if (height > 50 CM) + { + programming_error ("Improbable system height"); + height = 50 CM; + } SCM scm = gh_list (ly_symbol ("start-line"), gh_double2scm (height), SCM_UNDEFINED); diff --git a/lily/pitch-squash-engraver.cc b/lily/pitch-squash-engraver.cc index eb3e1bc16b..8218ff66c9 100644 --- a/lily/pitch-squash-engraver.cc +++ b/lily/pitch-squash-engraver.cc @@ -15,7 +15,7 @@ Pitch_squash_engraver::acknowledge_element (Score_element_info i) { if (Note_head *nh = dynamic_cast (i.elem_l_)) { - nh->position_i_ =0; + nh->set_position(0); } } diff --git a/lily/rest.cc b/lily/rest.cc index 7a3e5fab03..a7974c5ead 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -18,7 +18,7 @@ void Rest::do_add_processing () { if (balltype_i_ == 0) - position_i_ += 2; + position_i_ += 2; // guh. Rhythmic_head::do_add_processing (); } @@ -27,18 +27,19 @@ void Rest::do_post_processing () { Rhythmic_head::do_post_processing (); - if (dots_l_ && balltype_i_ > 4) + if (dots_l_ + && balltype_i_ > 4) // UGH. { - dots_l_->position_i_ += 3; + /* + UGH. + */ if (balltype_i_ == 7) - dots_l_->position_i_++; + dots_l_->set_position (4); + else + dots_l_->set_position (3); } } -Rest::Rest () -{ - position_i_ =0; -} Molecule * Rest::do_brew_molecule_p () const @@ -47,7 +48,6 @@ Rest::do_brew_molecule_p () const if (balltype_i_ == 0 || balltype_i_ == 1) ledger_b = abs(position_f () - (2* balltype_i_ - 1)) > lines_i (); - String style; diff --git a/lily/rhythmic-head.cc b/lily/rhythmic-head.cc index 2f1a10197d..0698b0c3cf 100644 --- a/lily/rhythmic-head.cc +++ b/lily/rhythmic-head.cc @@ -30,23 +30,10 @@ Rhythmic_head::do_post_processing () { if (dots_l_) { - dots_l_->position_i_ = int (position_f ()); + dots_l_->set_position(int (position_f ())); } } -void -Rhythmic_head::do_pre_processing () -{ - translate_axis (position_i_ * staff_line_leading_f () /2.0, Y_AXIS); - position_i_ = 0; -} - -Real -Rhythmic_head::position_f () const -{ - return position_i_ + Staff_symbol_referencer::position_f (); -} - void Rhythmic_head::add_dots (Dots *dot_l) @@ -60,7 +47,6 @@ Rhythmic_head::Rhythmic_head () dots_l_ =0; balltype_i_ =0; stem_l_ =0; - position_i_ =0; } void diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index cb7eb9b4d4..ece98451f7 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -269,7 +269,7 @@ Spacing_spanner::stem_dir_correction (Score_column*l, Score_column*r) const bool err = false; Real correction = 0.0; - Real ssc = paper_l ()->get_realvar(ly_symbol ("stemSpacingCorrection")); + Real ssc = paper_l ()->get_var("stemSpacingCorrection"); if (d1 && d2) diff --git a/lily/staff-bar.cc b/lily/staff-bar.cc index 00e71d2282..55167bbd32 100644 --- a/lily/staff-bar.cc +++ b/lily/staff-bar.cc @@ -19,3 +19,9 @@ Staff_bar::get_bar_size () const return (lines_i () -1) * staff_line_leading_f (); } +void +Staff_bar::do_pre_processing () +{ + Bar::do_pre_processing (); + Staff_symbol_referencer::do_pre_processing (); +} diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 2af11bc5f7..2c6a3a17bc 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -16,6 +16,7 @@ Staff_symbol_referencer::Staff_symbol_referencer () { staff_sym_l_ =0; + position_i_ =0; } void @@ -55,12 +56,33 @@ Staff_symbol_referencer::staff_line_leading_f () const Real Staff_symbol_referencer::position_f () const { - if (!staff_sym_l_ ) - return 0; + Real p = position_i_; + if (staff_sym_l_ ) + { + Graphical_element * c = common_refpoint (staff_sym_l_, Y_AXIS); + Real y = relative_coordinate (c, Y_AXIS) - staff_sym_l_->relative_coordinate (c, Y_AXIS); + + p += 2.0 * y / staff_line_leading_f (); + } + return p; +} + - Graphical_element * c = common_refpoint (staff_sym_l_, Y_AXIS); - Real y = relative_coordinate (c, Y_AXIS) - staff_sym_l_->relative_coordinate (c, Y_AXIS); - return 2.0 * y / staff_line_leading_f (); +void +Staff_symbol_referencer::do_pre_processing () +{ + translate_axis (position_i_ * staff_line_leading_f () /2.0, Y_AXIS); + position_i_ =0; } + +void +Staff_symbol_referencer::set_position (int p) +{ + /* + UGH. Use position_f() as well. + */ + position_i_ = p; + +}