]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.4
authorfred <fred>
Tue, 26 Mar 2002 22:43:08 +0000 (22:43 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:43:08 +0000 (22:43 +0000)
26 files changed:
input/test/staff-line-leading.ly
lily/beam.cc
lily/clef-item.cc
lily/directional-spanner.cc
lily/dot-column.cc
lily/dots.cc
lily/include/breathing-sign.hh
lily/include/clef-item.hh
lily/include/directional-spanner.hh
lily/include/dots.hh
lily/include/paper-def.hh
lily/include/rest.hh
lily/include/rhythmic-head.hh
lily/include/staff-bar.hh
lily/include/staff-side.hh
lily/include/staff-symbol-referencer.hh
lily/include/stem.hh
lily/note-head.cc
lily/note-heads-engraver.cc
lily/paper-outputter.cc
lily/pitch-squash-engraver.cc
lily/rest.cc
lily/rhythmic-head.cc
lily/spacing-spanner.cc
lily/staff-bar.cc
lily/staff-symbol-referencer.cc

index 03a5daf1d5f63b08a908f95958b0c33698e3aa2a..dbf97cf0712777a195c8a535feeac8cb13e3d36d 100644 (file)
@@ -2,7 +2,9 @@
   \notes \relative c'' \context GrandStaff <
        \context Staff = up { c4 c4  }
        \context Staff = down { \property Staff. staffLineLeading = #5.5 c4
-         <c8 d f g>
+         [<c8 d f g>
+          e]
+         [f c']
         }
 >
 }
index 0d7b93157f654be423184360cc1270220cad7835..64ab8ea41fdaa019027096c78d827251ac5a8478 100644 (file)
@@ -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 <stems_.size (); i++)
     {
       Stem *s = stems_[i];
index 168a1e45e9b58d7ab1b378a2fc1273cb53f73b29..6503c3a1d5eb7a744eedc35d020f1ac151a80738 100644 (file)
@@ -19,7 +19,7 @@
 void
 Clef_item::do_pre_processing()
 {
-  translate_axis (y_position_i_ * staff_line_leading_f () / 2.0, Y_AXIS);
+  Staff_symbol_referencer::do_pre_processing();
   SCM style_sym =get_elt_property ("style");
   String style;
   if (style_sym != SCM_UNDEFINED)
@@ -42,7 +42,7 @@ Clef_item::Clef_item()
   set_elt_property ("breakable", SCM_BOOL_T);
 
   symbol_ = "treble";
-  y_position_i_ = -2;
+  set_position(-2);
 }
 
 void
index be9676c4d1a31b015e45c6f6c416890dacde7c0b..1ef4574bd9536a0f3be262159150b4029b71dec7 100644 (file)
@@ -13,10 +13,6 @@ Directional_spanner::do_pre_processing()
     set_direction (get_default_dir());
 }
 
-Directional_spanner::Directional_spanner()
-{
-  set_direction (CENTER);
-}
 
 Offset
 Directional_spanner::center () const
index d510fba7f46850ae6151e2332455b0019c72b557..3d3f73f41045137a1988edd53d669a849791c8fc 100644 (file)
@@ -39,7 +39,7 @@ Dot_column::do_substitute_element_pointer (Score_element*o,Score_element*n)
 int
 Dot_column::compare (Dots * const &d1, Dots * const &d2)
 {
-  return d1->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  <dot_l_arr_.size (); pos += 2, i++)
     {
-      dot_l_arr_[i]->position_i_ = pos;
+      dot_l_arr_[i]->set_position(pos);
     }
 }
index 43dac770573bb6f8e8a486f282189601ea5a2e7a..d4c8e62eed53735aafb40035246bdd1619824909 100644 (file)
@@ -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 ();
index 6e861a905c06f46a8b71884df912d9ebfcb7ac09..0378d62078fd1ec46d2c3e87df2b700f4dd0a68c 100644 (file)
 #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
index c37277e312768ce32cd607c423f029dd54b9f47f..11362d72fa832aba713ab38d6bea0a5163b643d9 100644 (file)
@@ -31,7 +31,6 @@ protected:
 public:
   
   String symbol_;
-  int y_position_i_;
 
   VIRTUAL_COPY_CONS(Score_element);
   Clef_item();
index cdc56a4ed1ee63722e981568fde8d227ddd59ce5..93d226fdaa5b07716930629f2baacc23c846fec2 100644 (file)
@@ -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;
index 29e1bd5b114d7a59a3adcb0926d5621573556aea..2806cb1cc4a749d4c918902b11b1e96929f63046 100644 (file)
@@ -23,7 +23,6 @@ protected:
   virtual void do_post_processing ();
 public:
   int dots_i_;
-  int position_i_;
   Direction resolve_dir_;
   
   Dots ();
index f9393470943728b4f81112537d994015b400d83f..310cfd29d09513eecf93c8ae2686e98ae2d6701e 100644 (file)
@@ -54,6 +54,9 @@ public:
   virtual ~Paper_def ();
 
   Array<Interval> shape_int_a_;
+  /*
+    JUNKME
+   */
   Real get_realvar (SCM symbol) const;
   Real get_var (String id) const;
 
index 611ddd7103466fd85ce660c6e53426ac43f1108a..39b6bb2b203c0cfc213a74eddb7b67128780ced1 100644 (file)
@@ -15,7 +15,6 @@
 class  Rest : public Rhythmic_head
 {
 public:
-  Rest ();
   void add_dots (Dots*);
 protected:
   virtual void do_add_processing ();
index 7f792787dba2555b682333ec1560970598d8e2f0..3d912e0cb0cd8791445eba9e19e4e0f88e111f25 100644 (file)
@@ -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*);
 };
index 4f604ad080b6029beb17143687b480b66397b4a4..171ec1ddc062e21f15dfa71b12d2ce4708bbc2f6 100644 (file)
    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;
 };
index 36441beefa5e90793f861b1b3595b1d0d1ebb854..81510632aa429d7acfd1f0c910bade5f94576cba 100644 (file)
@@ -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
 
     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<Score_element> support_l_arr_;
   Axis axis_;
index 255c57abcca1f1c9227a41013bc5046c6826c135..5fc62e0ed02a2832e8e51c86498aaa9ac6918457 100644 (file)
@@ -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;
 };
 
index 2d91e441e9c0a8d6d07abda450ff207a2396411f..411848696b843cac8d8ba4db0e8df5da1d59a553 100644 (file)
@@ -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:
   */
 // 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<Real> yextent_drul_;
 
-  /// direction stem (that's me)
-  Direction dir_;
-
 public:
-  void set_direction (Direction d);
-  Direction get_direction () const { return dir_; }
 
   Link_array<Note_head> head_l_arr_;
   Link_array<Rest> rest_l_arr_;
index faad35629763a484d80bc55d3829cc64be66b728..a8ee5f3f9a66a35102bd17e11616f7bdba8c75fc 100644 (file)
@@ -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);
index 74168092d48e8c50543d6a0c0ce94fd01ee5443f..3ce360fed0d0417a1baf9f56827c1e2c91f1b6c1 100644 (file)
@@ -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.
index 9dd7d28729a0e156418e04608e0e9c5ee1e0fe69..14316cad02ffe988354719563f33fca8b51db90d 100644 (file)
@@ -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);
index eb3e1bc16b872727a6c3a3ecda697b82c6e1e193..8218ff66c9d29f50edefb81cd93108185aa0a91d 100644 (file)
@@ -15,7 +15,7 @@ Pitch_squash_engraver::acknowledge_element (Score_element_info i)
 {
   if (Note_head *nh = dynamic_cast<Note_head *> (i.elem_l_))
     {
-      nh->position_i_  =0;
+      nh->set_position(0);
     }
 }
 
index 7a3e5fab03c1b445e1fb4e339b7c549928b9f3a7..a7974c5ead393a78206aa057c0b456130525cfd5 100644 (file)
@@ -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; 
index 2f1a10197d4be7a4586e8f3952ae5ebcf6968943..0698b0c3cf2578626f19e5926c92ad06fff8d5db 100644 (file)
@@ -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
index cb7eb9b4d4d3ff1781010b5fd8fc4337a6fefa2e..ece98451f7f44b7042563aba873d156b6c540c95 100644 (file)
@@ -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)
index 00e71d2282e89e59750d20b67ed5f9bca4a3947b..55167bbd3266f5edafe562d547ca8083f7818da7 100644 (file)
@@ -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 ();
+}
index 2af11bc5f7b98aec50b358c04baa5e182f79abdf..2c6a3a17bc5c1451621e4b683d8f1e227f681f27 100644 (file)
@@ -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;
+  
+}