]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.67
authorfred <fred>
Tue, 26 Mar 2002 23:24:04 +0000 (23:24 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:24:04 +0000 (23:24 +0000)
43 files changed:
lily/auto-beam-engraver.cc
lily/beam-engraver.cc
lily/breathing-sign-engraver.cc
lily/breathing-sign.cc
lily/chord-tremolo-engraver.cc
lily/clef-engraver.cc
lily/collision.cc
lily/dot-column.cc
lily/dots.cc
lily/dynamic-engraver.cc
lily/grace-position-engraver.cc
lily/include/dot-column.hh
lily/include/dots.hh
lily/include/multi-measure-rest.hh
lily/include/note-column.hh
lily/include/note-head.hh
lily/include/rest.hh
lily/include/rhythmic-head.hh
lily/include/staff-symbol-referencer.hh
lily/include/stem.hh
lily/include/volta-spanner.hh
lily/line-number-engraver.cc
lily/local-key-engraver.cc
lily/local-key-item.cc
lily/multi-measure-rest.cc
lily/note-column.cc
lily/note-head.cc
lily/note-heads-engraver.cc
lily/piano-pedal-engraver.cc
lily/pitch-squash-engraver.cc
lily/rest-collision.cc
lily/rest-engraver.cc
lily/rhythmic-column-engraver.cc
lily/rhythmic-head.cc
lily/staff-symbol-referencer.cc
lily/stem-engraver.cc
lily/text-engraver.cc
lily/text-item.cc
lily/tie-column.cc
lily/tie-engraver.cc
lily/tie.cc
lily/tuplet-spanner.cc
lily/volta-spanner.cc

index 7e939e7c8e4ce4976b744087ec5f56558628bab7..1d88248b40a21fe50a316334860607a5612d5f30 100644 (file)
@@ -314,7 +314,7 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info)
        {
          end_beam ();
        }
-      else if (Rest* rest_l = dynamic_cast<Rest *> (info.elem_l_))
+      else if (to_boolean (info.elem_l_->get_elt_property ("rest-interface")))
        {
          end_beam ();
        }
index c037c00923be70e8c641466f7b2595db769b69de..61fbd4997e8e514136c1246d7c25312f97886261 100644 (file)
@@ -183,16 +183,16 @@ Beam_engraver::acknowledge_element (Score_element_info info)
 {
   if (beam_p_)
     {
-      if (Rest* r = dynamic_cast<Rest* > (info.elem_l_))
+      if (to_boolean (info.elem_l_->get_elt_property("rest-interface")))
        {
-         r->add_offset_callback (Beam::rest_collision_callback, Y_AXIS);
+         info.elem_l_->add_offset_callback (Beam::rest_collision_callback, Y_AXIS);
        }
-      else if (Stem* stem_l = dynamic_cast<Stem *> (info.elem_l_))
+      else if (to_boolean (info.elem_l_->get_elt_property ("stem-interface")))
        {
+         Stem *stem_l = dynamic_cast<Stem*> (info.elem_l_);
          if (stem_l->beam_l ())
            return;
 
-
          bool stem_grace = stem_l->get_elt_property ("grace") == SCM_BOOL_T;
 
          SCM wg =get_property ("weAreGraceContext");
index f72e5b2b9716a68f6d2c6e92c31296bea76a7011..151fbbff79a917432a22d905880da57d64aa2797 100644 (file)
@@ -14,14 +14,30 @@ TODO:
 */
 
 #include "staff-symbol-referencer.hh"
-#include "breathing-sign-engraver.hh"
 #include "breathing-sign.hh"
 #include "musical-request.hh"
 #include "command-request.hh"
 #include "engraver-group-engraver.hh"
-#include "note-head.hh"
 #include "local-key-item.hh"
+#include "engraver.hh"
+#include "command-request.hh"
+
+class Breathing_sign_engraver : public Engraver {
+public:
+  Breathing_sign_engraver();
+  VIRTUAL_COPY_CONS(Translator);
+  
+protected:
+  virtual bool do_try_music (Music *req_l);
+  virtual void do_process_music();
+
+  virtual void do_pre_move_processing();
+  virtual void do_post_move_processing();
 
+private:
+  Breathing_sign_req * breathing_sign_req_l_;
+  Breathing_sign * breathing_sign_p_;
+};
 
 Breathing_sign_engraver::Breathing_sign_engraver()
 {
index c8a7a0c1a2f14db0065b734d9997c14c525fbd0c..cc743c5a28be79faf0d74f243bc12c716c18c650 100644 (file)
@@ -49,7 +49,7 @@ GLUE_SCORE_ELEMENT(Breathing_sign,after_line_breaking);
 SCM
 Breathing_sign::member_after_line_breaking ()
 {
-  Real space = staff_symbol_referencer (this).staff_space();
+  Real space = Staff_symbol_referencer_interface (this).staff_space();
   Direction d = Directional_element_interface (this). get ();
   if (!d)
     {
index 5ab38f6f853025be68c40af6dc1c1282e7f1617a..3445d1277e27a466fd0ee789419bec1ea80d8b23 100644 (file)
@@ -11,7 +11,7 @@
 #include "beam.hh"
 #include "repeated-music.hh"
 #include "stem.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "engraver-group-engraver.hh"
 #include "musical-request.hh"
 #include "warn.hh"
@@ -171,9 +171,9 @@ Chord_tremolo_engraver::acknowledge_element (Score_element_info info)
                ::warning (s);
            }
        }
-      if (Note_head *nh = dynamic_cast<Note_head*> (info.elem_l_))
+      if (to_boolean (info.elem_l_->get_elt_property ("note-head-interface")))
        {
-         nh->set_elt_property ("duration-log", gh_int2scm (intlog2 (note_head_i_)));
+         info.elem_l_->set_elt_property ("duration-log", gh_int2scm (intlog2 (note_head_i_)));
        }
     }
 }
index 616e4c55f6d8353c9d2b14731437ef9f2400d3bb..def1a6262200431376c7c954fb1d1ea41d993712 100644 (file)
@@ -16,7 +16,7 @@
 #include "debug.hh"
 #include "command-request.hh"
 #include "timing-translator.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "key-item.hh"
 #include "local-key-item.hh"
 #include "array.hh"
@@ -133,7 +133,7 @@ Clef_engraver::acknowledge_element (Score_element_info info)
   Item * it_l =dynamic_cast <Item *> (info.elem_l_);
   if (it_l)
     {
-      if (dynamic_cast<Note_head*>(it_l)
+      if (to_boolean (it_l->get_elt_property("note-head-interface"))
          || dynamic_cast<Local_key_item*> (it_l))
        {
          Staff_symbol_referencer_interface si (it_l);
index 01cb443dd5f98346cff51a25300d94e213b33e53..9cedc344799fd404ccfa8c23f0ec0c5ecb910677 100644 (file)
@@ -8,7 +8,7 @@
 #include "debug.hh"
 #include "collision.hh"
 #include "note-column.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "paper-def.hh"
 #include "axis-group-interface.hh"
 #include "item.hh"
@@ -164,8 +164,8 @@ Collision::automatic_shift (Score_element *me)
       /*
        TODO.
        */
-      Note_head * nu_l= cu_l->first_head();
-      Note_head * nd_l = cd_l->first_head();
+      Rhythmic_head * nu_l= cu_l->first_head();
+      Rhythmic_head * nd_l = cd_l->first_head();
       
       int downpos = Note_column::head_positions_interval (cd_l)[BIGGER];
       int uppos = Note_column::head_positions_interval (cu_l)[SMALLER];      
index ce660a24a287549ae3550f090d78dd96468d3b8c..a725998bcfc69462404eeaef29d9addd9a95bf88 100644 (file)
 #include "axis-group-interface.hh"
 
 
-// todo: dots and elements duplicate each other.
-void
-Dot_column::add_dots (Item *d)
-{
-  Pointer_group_interface gi (this, "dots");
-  gi.add_element (d);
-
-  add_dependency (d);
-  Axis_group_interface (this).add_element (d);
-}
 
 void
 Dot_column::add_head (Rhythmic_head *r)
@@ -34,12 +24,20 @@ Dot_column::add_head (Rhythmic_head *r)
     return ;
 
   Side_position_interface (this).add_support (r);
-  add_dots (r->dots_l ());
+  Item * d = r->dots_l ();
+  if (d)
+    {
+      Pointer_group_interface gi (this, "dots");
+      gi.add_element (d);
+      
+      d->add_offset_callback (force_shift_callback , Y_AXIS);
+      Axis_group_interface (this).add_element (d);
+    }
 }
 
 
 int
-Dot_column::compare (Item * const &d1, Item * const &d2)
+Dot_column::compare (Score_element * const &d1, Score_element * const &d2)
 {
   Staff_symbol_referencer_interface s1(d1);
   Staff_symbol_referencer_interface s2(d2);  
@@ -51,8 +49,7 @@ Dot_column::compare (Item * const &d1, Item * const &d2)
 Dot_column::Dot_column (SCM s)
   : Item (s)
 {
-  Pointer_group_interface gi (this, "dots");
-  gi.set_interface ();
+  this->set_elt_pointer  ("dots", SCM_EOL);
   Directional_element_interface (this).set (RIGHT);
   
   Axis_group_interface (this).set_interface ();
@@ -75,11 +72,27 @@ Dot_column::Dot_column (SCM s)
    Should be smarter.
  */
 
-GLUE_SCORE_ELEMENT(Dot_column,after_line_breaking);
+
+Real
+Dot_column::force_shift_callback (Score_element const * dot, Axis a)
+{
+  assert (a == Y_AXIS);
+  Score_element * me = dot->parent_l (X_AXIS);
+  SCM dots = me->get_elt_pointer ("dots");
+  do_shifts (dots);
+  return 0.0;
+}
+
 SCM
-Dot_column::member_after_line_breaking ()
+Dot_column::do_shifts (SCM l)
 {
-  Link_array<Item> dots = Pointer_group_interface__extract_elements (this, (Item*)0 , "dots"); 
+  Link_array<Score_element> dots;
+  while (gh_pair_p (l))
+    {
+      dots.push (unsmob_element (gh_car (l)));
+      l = gh_cdr (l);
+    }
+  
   dots.sort (Dot_column::compare);
   
   if (dots.size () < 2)
@@ -103,8 +116,7 @@ Dot_column::member_after_line_breaking ()
     }
 
   if (!conflicts)
-  return SCM_UNDEFINED;
-
+    return SCM_UNDEFINED;
   
   int  middle = s.center ();
   /*
@@ -116,7 +128,8 @@ Dot_column::member_after_line_breaking ()
 
   for (int i=0; i < dots.size (); pos += 2, i++)
     {
-      staff_symbol_referencer (dots[i]).set_position(pos);
+      Score_element * d = dots[i];
+      Staff_symbol_referencer_interface (d).set_position(pos);
     }
 
   return SCM_UNDEFINED;
index ccd29ae3b61a04843be48771f2eb31a665dac3d3..6a037d9f803d83504700db58d2871e042e0a14f8 100644 (file)
 #include "staff-symbol-referencer.hh"
 #include "directional-element-interface.hh"
 
-MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Dots,after_line_breaking);
 
-SCM
-Dots::after_line_breaking (SCM smob)
+Real
+Dots::quantised_position_callback (Score_element const* me, Axis a)
 {
-  Item * p = dynamic_cast<Item*> (unsmob_element (smob));
-  
-  SCM d= p->get_elt_property ("dot-count");
+  assert (a == Y_AXIS);
+    
+  SCM d= me->get_elt_property ("dot-count");
   if (gh_number_p (d) && gh_scm2int (d))
     {
-      if (!Directional_element_interface (p).get ())
-       Directional_element_interface (p).set (UP);
+      if (!Directional_element_interface (me).get ())
+       Directional_element_interface (me).set (UP);
 
-      Staff_symbol_referencer_interface si (p);
+      Staff_symbol_referencer_interface si (me);
       int pos = int (si.position_f ());
       if (!(pos % 2))
-       si.set_position (pos  + Directional_element_interface (p).get ());
+       return si.staff_space () / 2.0 * Directional_element_interface (me).get ();
     }
 
-  return SCM_UNDEFINED;
+  return  0.0;
 }
 
-MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Dots,brew_molecule);
 
+MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Dots,brew_molecule);
 SCM  
 Dots::brew_molecule (SCM d)
 {
index 739f03f7ebcd57870c948bbb499ca327454fe754..8224b1f6f6939f39d2691f2c9764fd4b213ea6d9 100644 (file)
@@ -19,7 +19,7 @@
 #include "side-position-interface.hh"
 #include "engraver.hh"
 #include "stem.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "group-interface.hh"
 #include "directional-element-interface.hh"
 #include "staff-symbol-referencer.hh"
index bbfa5392de8bce06005e1a4f1f0d6611a996b2b4..bdf58af7e8eca864923b783e016450e6f9e9235a 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "engraver.hh"
 #include "grace-align-item.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "local-key-item.hh"
 #include "paper-column.hh"
 #include "dimension-cache.hh"
@@ -46,10 +46,10 @@ Grace_position_engraver::acknowledge_element (Score_element_info i)
     {
       align_l_ = g;
     }
-  else if (Note_head * n = dynamic_cast <Note_head*> (i.elem_l_))
+  else if (to_boolean (i.elem_l_->get_elt_property ("note-head-interface")))
     {
-      if (!to_boolean (n->get_elt_property ("grace")))
-       support_.push (n);
+      if (!to_boolean (i.elem_l_->get_elt_property ("grace")))
+       support_.push (dynamic_cast<Item*> (i.elem_l_));
     }
   else if (Local_key_item*it = dynamic_cast<Local_key_item*>(i.elem_l_))
     {
index 0a71a1466d580c83e0141b9e16faeef55ca14e8e..e812875e99da32328b45a0b9064f39c88e173fd6 100644 (file)
  */
 class Dot_column : public Item
 {
-  static int compare (Item * const&,Item * const&);
-  void add_dots (Item*);
+  static int compare (Score_element * const&,Score_element * const&);
 public:
   VIRTUAL_COPY_CONS (Score_element);
   void add_head (Rhythmic_head*);
   Dot_column (SCM);
-
-
-  SCM member_after_line_breaking ();
-  static SCM after_line_breaking (SCM);
+  
+  static Real force_shift_callback (Score_element const* , Axis);
+  static SCM do_shifts (SCM dotlist);
 };
 #endif // DOT_COLUMN_HH
index 3333cd26b78d4e26fa36f9e14661391bd0ed55dd..21be4f774761090e2192a6c3018d7eee061edd8b 100644 (file)
@@ -27,7 +27,7 @@
 class Dots                     // interface
 {
 public:
-  static SCM after_line_breaking (SCM);
+  static Real quantised_position_callback(Score_element const*, Axis);
   static SCM brew_molecule (SCM);
 };
 
index 50ab957bb359c47bcca821949b48cc7c246fdc01..6a9b31be68849afe5153751286d24f122d61d21f 100644 (file)
@@ -26,7 +26,6 @@ public:
   SCM member_brew_molecule () const;
   VIRTUAL_COPY_CONS (Score_element);
 
-  virtual void do_add_processing ();
   SCM member_after_line_breaking ();
   static SCM after_line_breaking (SCM);
   virtual Array<Rod> get_rods () const;
index dc6d665f774ce275bd0fdc0d3957c72d2b042000..ddd691232d46ca9f94a10d95a33312c38e183c38 100644 (file)
@@ -34,7 +34,7 @@ public:
   static Slice head_positions_interval(Score_element* me) ;
   static Direction static_dir (Score_element*);
   void translate_rests(int dy);
-  Note_head * first_head ()const;
+  Rhythmic_head * first_head ()const;
   Interval rest_dim ()const ;
   Note_column (SCM);
   void set_stem (Score_element*);
index 272ed3da9521488112f45ba36e758a74ea0ac40f..b945d3a28a88d5d953a0f7f7e1aa1b8616284e35 100644 (file)
@@ -7,7 +7,8 @@
 #ifndef NOTEHEAD_HH
 #define NOTEHEAD_HH
 
-#include "rhythmic-head.hh"
+#include "lily-guile.hh"
+#include "molecule.hh"
 
 /** ball at the end of the stem. Takes care of:
 
 
   */
 
-class Note_head : public Rhythmic_head
+class Note_head 
 {
 public:
-  static int compare (Note_head * const &a, Note_head *const &b) ;
- static SCM brew_molecule (SCM);
-  
-
-  Molecule ledger_line (Interval) const;
-  Note_head (SCM);
-
-  SCM member_before_line_breaking ();
-  static SCM before_line_breaking (SCM);
-  SCM member_brew_molecule() const;
+  static SCM brew_molecule (SCM);
+  static Molecule ledger_line (Interval, Score_element*) ;
 };
 #endif // NOTEHEAD_HH
 
index db36065f0ce919bbaca019f445d17540b321f2de..dc3706005b86c85bbf6237581e9be047252e92d8 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef REST_HH
 #define REST_HH
 
-#include "rhythmic-head.hh"
+#include "lily-guile.hh"
 
 /**
    A pause.
 
    style -- string specifying glyph style
  */
-class  Rest : public Rhythmic_head
+class  Rest
 {
 public:
-  SCM member_after_line_breaking ();
   static SCM after_line_breaking (SCM);
-  SCM member_brew_molecule () const;
-
-   static SCM brew_molecule (SCM);
-  
-Rest (SCM s);
+  static SCM brew_molecule (SCM);
 };
 #endif // REST_HH
index 33e7bb279b6baa5e8c688b168201eb32c79f6868..cb005547144729ea89215de96e8e794a7fda530b 100644 (file)
@@ -30,7 +30,7 @@ public:
   VIRTUAL_COPY_CONS(Rhythmic_head);
   int balltype_i () const;
 
-  void add_dots (Item *);
+  void set_dots (Item *);
   Stem * stem_l () const;
   Item * dots_l () const;
   int dot_count () const;
index 20311c8abb53fcd4f280b5a360e6d9d845fd7be0..9734cf17afb7d77378ee67837b99745e85eae328 100644 (file)
@@ -40,9 +40,5 @@ public:
 };
 
 int compare_position (Score_element *const&,Score_element *const&); 
-
-
-Staff_symbol_referencer_interface staff_symbol_referencer  (Score_element const*);
-
 #endif /* STAFF_SYMBOL_REFERENCER_HH */
 
index 24e0630c76d748a7937a238c3284d6da07e273c9..ed0f619d0fdf5d4b77b5e2af18171a07717d6fe1 100644 (file)
@@ -57,8 +57,8 @@ public:
     our beam, for aligning abbrev flags
    */
   Beam* beam_l () const;
-  Note_head * first_head () const;
-  Drul_array<Note_head*> extremal_heads () const;
+  Rhythmic_head * first_head () const;
+  Drul_array<Rhythmic_head*> extremal_heads () const;
 
   Score_element * support_head () const;
   Stem (SCM);
index ede918a767e5ed8c8044eba767c7a4e6b2a09a77..ba28f37e6a10d54b37989db30dd80bc7755190af 100644 (file)
@@ -23,7 +23,7 @@ public:
   SCM member_brew_molecule () const;
   VIRTUAL_COPY_CONS (Score_element);
 
-  virtual void do_add_processing ();
+
   SCM member_after_line_breaking ();
   static SCM after_line_breaking (SCM);
 };
index 2c235080e31cc76b2dee5cd7cc9c29705f0094cc..dc08a787a9989eeb7d6b3fa37bf7737bbf5eeda0 100644 (file)
@@ -10,7 +10,7 @@
 #include "engraver.hh"
 #include "item.hh"
 #include "side-position-interface.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "stem.hh"
 
 /**
@@ -49,12 +49,12 @@ Line_number_engraver::process_acknowledged ()
 void
 Line_number_engraver::acknowledge_element (Score_element_info inf)
 {
-  if (dynamic_cast<Note_head*> (inf.elem_l_))
+  if (to_boolean (inf.elem_l_->get_elt_property ("note-head-interface")))
     {
       interesting_.push (inf);
       support_.push (inf.elem_l_);
     }
-  if (dynamic_cast<Stem*> (inf.elem_l_))
+  else if (to_boolean (inf.elem_l_->get_elt_property ("stem-interface")))
     {
       support_.push (inf.elem_l_);
     }
index 55dd16c0b4fbf0f9d99fa27b161be53e377dee0d..9fcde99872787e0bb7492586bd5f083da5222c9e 100644 (file)
@@ -9,7 +9,7 @@
 #include "local-key-item.hh"
 #include "key-item.hh"
 #include "tie.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "timing-translator.hh"
 #include "engraver-group-engraver.hh"
 #include "grace-align-item.hh"
@@ -100,7 +100,7 @@ Local_key_engraver::process_acknowledged ()
                  key_item_p_ = new Local_key_item (get_property ("basicLocalKeyProperties"));
                  Side_position_interface (key_item_p_).set_axis (X_AXIS);
                  Side_position_interface (key_item_p_).set_direction (LEFT);
-                 staff_symbol_referencer(key_item_p_).set_interface ();
+                 Staff_symbol_referencer_interface (key_item_p_).set_interface ();
                         
                  announce_element (Score_element_info (key_item_p_, 0));
                }
@@ -193,7 +193,7 @@ Local_key_engraver::acknowledge_element (Score_element_info info)
       grace_align_l_ = gai;
     }
   Note_req * note_l =  dynamic_cast <Note_req *> (info.req_l_);
-  Note_head * note_head = dynamic_cast<Note_head *> (info.elem_l_);
+  Rhythmic_head * note_head = dynamic_cast<Rhythmic_head *> (info.elem_l_);
 
   if (he_gr != selfgr)
     return;
index 0c1ec92137f530c59e871a16897203a891785fc0..2dd00710957a86f9414448c92be645025c89f9a9 100644 (file)
@@ -11,7 +11,7 @@
 #include "lookup.hh"
 #include "paper-def.hh"
 #include "musical-request.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "misc.hh"
 
 void
index 27dfeebf5c8657f65798a30f8a356609980e990b..97d1401c17ae56e16e61396e7f8f8f4a1dde88a5 100644 (file)
@@ -38,7 +38,7 @@ SCM
 Multi_measure_rest::member_brew_molecule () const
 {
   Real staff_space
-    = staff_symbol_referencer (this).staff_space ();
+    = Staff_symbol_referencer_interface (this).staff_space ();
 
   Interval sp_iv;
   Direction d = LEFT;
@@ -140,32 +140,6 @@ Multi_measure_rest::member_brew_molecule () const
   UGH. JUNKME elt prop "columns" isn't really needed. 
  */
 
-void
-Multi_measure_rest::do_add_processing ()
-{
-#if 0
-  if (gh_pair_p (get_elt_pointer ("columns")))
-    {
-      Link_array<Item> column_arr (Pointer_group_interface__extract_elements (this, (Item*)0, "columns"));
-                                   
-      set_bound (LEFT, column_arr[0 >? column_arr.size () - 2]);
-      set_bound (RIGHT, column_arr.top ());
-    }
-#endif
-  // set columns to SCM_EOL?
-}
-  
-GLUE_SCORE_ELEMENT(Multi_measure_rest,after_line_breaking);
-SCM
-Multi_measure_rest::member_after_line_breaking ()
-{
-  if (!gh_pair_p (get_elt_pointer ("columns")))
-    {
-      suicide ();
-    }
-
-  return SCM_UNDEFINED;
-}
 
 
  
index 613a9bae8254dde8bf1387cb0d11ba65b9092ead..2d20c48a190229032bb98897a24f6bccb28794ea 100644 (file)
@@ -142,7 +142,7 @@ Note_column::rest_dim () const
   return r->extent (Y_AXIS);
 }
 
-Note_head*
+Rhythmic_head*
 Note_column::first_head () const
 {
   Stem * st = stem_l ();
index 5c4e1b690578a8c0e3c8c62e529915da425ebd9e..c072d2f461b505c0e3a9c03bd761efa85d8f38e5 100644 (file)
   build a ledger line for small pieces.
  */
 Molecule
-Note_head::ledger_line (Interval xwid) const
+Note_head::ledger_line (Interval xwid, Score_element *me) 
 {
   Drul_array<Molecule> endings;
-  endings[LEFT] = lookup_l()->afm_find ("noteheads-ledgerending");
+  endings[LEFT] = me->lookup_l()->afm_find ("noteheads-ledgerending");
   Molecule *e = &endings[LEFT];
   endings[RIGHT] = *e;
   
@@ -52,34 +52,15 @@ Note_head::ledger_line (Interval xwid) const
 }
 
 
-GLUE_SCORE_ELEMENT(Note_head,before_line_breaking);
-SCM
-Note_head::member_before_line_breaking ()
-{
-  // 8 ball looks the same as 4 ball:
-  
-  if (balltype_i () > 2)
-    set_elt_property ("duration-log", gh_int2scm (2));
-
-  if (Item *d = dots_l ())
-    { // move into Rhythmic_head?
-      Staff_symbol_referencer_interface si (d);
-      Staff_symbol_referencer_interface me (this);      
-      
-      si.set_position(int (me.position_f ()));
-    }
-
-  return SCM_UNDEFINED;
-}
-
 
 
-GLUE_SCORE_ELEMENT(Note_head,brew_molecule);
+MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Note_head,brew_molecule);
 
 SCM
-Note_head::member_brew_molecule () const 
+Note_head::brew_molecule (SCM smob)  
 {
-  Staff_symbol_referencer_interface si (this);
+  Score_element *me = unsmob_element (smob);
+  Staff_symbol_referencer_interface si (me);
   
   Real inter_f = si.staff_space ()/2;
   int sz = si.line_count ()-1;
@@ -88,15 +69,15 @@ Note_head::member_brew_molecule () const
     ? 0
     : (abs((int)p) - sz) /2;
 
-  SCM style  = get_elt_property ("style");
+  SCM style  = me->get_elt_property ("style");
   if (style == SCM_UNDEFINED)
     {
       style = ly_symbol2scm("default");
     }
   
-  Molecule out = lookup_l()->afm_find (String ("noteheads-") + 
+  Molecule out = me->lookup_l()->afm_find (String ("noteheads-") + 
                ly_scm2string (scm_eval (gh_list (ly_symbol2scm("find-notehead-symbol"),
-                                                 gh_int2scm(balltype_i ()),
+                                                 me->get_elt_property ("duration-log"),
                                                  ly_quote_scm(style),
                                                  SCM_UNDEFINED))));
 
@@ -106,7 +87,7 @@ Note_head::member_brew_molecule () const
       Interval hd = out.extent (X_AXIS);
       Real hw = hd.length ()/4;
       Molecule ledger (ledger_line  (Interval (hd[LEFT] - hw,
-                                              hd[RIGHT] + hw)));
+                                              hd[RIGHT] + hw), me));
       
 
       ledger.set_empty (true);
@@ -122,10 +103,3 @@ Note_head::member_brew_molecule () const
     }
   return out.create_scheme();
 }
-
-
-Note_head::Note_head (SCM s)
-  : Rhythmic_head (s)
-{
-  
-}
index c12f28df1144a663b816d967720882e2d140461a..fa72a59e2f55a6779d4b9f3382854987d849fed5 100644 (file)
@@ -4,13 +4,38 @@
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "note-head.hh"
-#include "note-heads-engraver.hh"
+#include "rhythmic-head.hh"
+#include "engraver.hh"
 #include "paper-def.hh"
 #include "musical-request.hh"
 #include "dots.hh"
 #include "dot-column.hh"
 #include "staff-symbol-referencer.hh"
+#include "engraver.hh"
+#include "pqueue.hh"
+
+/**
+  make balls and rests
+ */
+class Note_heads_engraver : public Engraver
+{
+  Link_array<Rhythmic_head> note_p_arr_;
+  Link_array<Item> dot_p_arr_;
+  Link_array<Note_req> note_req_l_arr_;
+  Moment note_end_mom_;
+public:
+  VIRTUAL_COPY_CONS(Translator);
+  Note_heads_engraver();
+  
+protected:
+  virtual bool do_try_music (Music *req_l) ;
+  virtual void do_process_music();
+  virtual void do_pre_move_processing();
+};
+
+
+
+
 
 Note_heads_engraver::Note_heads_engraver()
 {
@@ -60,7 +85,7 @@ Note_heads_engraver::do_process_music()
   
   for (int i=0; i < note_req_l_arr_.size (); i++)
     {
-      Note_head *note_p  = new Note_head (get_property ("basicNoteHeadProperties"));
+      Rhythmic_head *note_p  = new Rhythmic_head (get_property ("basicNoteHeadProperties"));
       
       Staff_symbol_referencer_interface si (note_p);
       si.set_interface ();
@@ -73,17 +98,19 @@ Note_heads_engraver::do_process_music()
 
       if (note_req_l->duration_.dots_i_)
        {
-          Item * d = new Item (get_property ("basicDotsProperties"));
+         Item * d = new Item (get_property ("basicDotsProperties"));
 
          Staff_symbol_referencer_interface sd (d);
          sd.set_interface ();
          
-         note_p->add_dots (d);
+         note_p->set_dots (d);
          
          if (note_req_l->duration_.dots_i_
              != gh_scm2int (d->get_elt_property ("dot-count")))
            d->set_elt_property ("dot-count", gh_int2scm (note_req_l->duration_.dots_i_));
-         
+
+         d->set_parent (note_p, Y_AXIS);
+         d->add_offset_callback (Dots::quantised_position_callback, Y_AXIS);
          announce_element (Score_element_info (d,0));
          dot_p_arr_.push (d);
        }
index 8f43379ba51bede70572e67fd85c967d54e9e04e..2058358a9ee0dc511ffcaae718287dffe510c19b 100644 (file)
@@ -12,7 +12,7 @@
 #include "item.hh"
 #include "lookup.hh"
 #include "lily-guile.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "stem.hh"
 #include "side-position-interface.hh"
 #include "staff-symbol-referencer.hh"
@@ -111,7 +111,7 @@ Piano_pedal_engraver::acknowledge_element (Score_element_info info)
     {
       if (p->item_p_)
        {
-         if (Note_head* n = dynamic_cast<Note_head*> (info.elem_l_))
+         if (Rhythmic_head* n = dynamic_cast<Rhythmic_head*> (info.elem_l_))
            {
              Side_position_interface st (p->item_p_);
              st.add_support (n);
index 21774fb3af887d3d29dc0fb013428a9005ab7da4..fbe88a330090db0677dc5c4f24c4880199abd755 100644 (file)
@@ -9,14 +9,14 @@
 #include "staff-symbol-referencer.hh"
 
 #include "pitch-squash-engraver.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 
 void
 Pitch_squash_engraver::acknowledge_element (Score_element_info i)
 {
-  if (Note_head *nh = dynamic_cast<Note_head *> (i.elem_l_))
+  if (to_boolean (i.elem_l_->get_elt_property ("note-head-interface")))
     {
-      Staff_symbol_referencer_interface (nh).set_position(0);
+      Staff_symbol_referencer_interface (i.elem_l_).set_position(0);
     }
 }
 
index 69f1ff0eed4e832dfb3455b3e5d9e7c88bdac5f1..2a38b27d2ba391b1bf294eb6ba68d5f0609bcfc9 100644 (file)
@@ -5,13 +5,14 @@
 
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
+
 #include <math.h>              // ceil.
 
 #include "debug.hh"
 #include "rest-collision.hh"
 #include "note-column.hh"
 #include "stem.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "paper-def.hh"
 #include "rest.hh"
 #include "group-interface.hh"
index 96f34bfe961eab776a46db7a0f52970f130870f4..ccc80a3f82de05f2f6fe3916280e4cb485cf3aae 100644 (file)
@@ -6,10 +6,27 @@
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 #include "staff-symbol-referencer.hh"
-#include "rest-engraver.hh"
 #include "musical-request.hh"
 #include "dots.hh"
-#include "rest.hh"
+#include "rhythmic-head.hh"
+#include "engraver.hh"
+
+class Rest_engraver : public Engraver
+{
+  Rest_req *rest_req_l_;
+  Item * dot_p_;
+  Rhythmic_head * rest_p_;
+protected:
+  virtual bool do_try_music (Music *);
+  virtual void do_pre_move_processing ();
+  virtual void do_post_move_processing ();
+  virtual void do_process_music ();
+public:
+  
+  VIRTUAL_COPY_CONS(Translator);
+  Rest_engraver ();
+};
+
 
 /*
   Should merge with Note_head_engraver
@@ -47,7 +64,7 @@ Rest_engraver::do_process_music ()
 {
   if (rest_req_l_ && !rest_p_) 
     {
-      rest_p_ = new Rest (get_property ("basicRestProperties"));
+      rest_p_ = new Rhythmic_head (get_property ("basicRestProperties"));
       Staff_symbol_referencer_interface si (rest_p_);
       si.set_interface ();
       
@@ -61,7 +78,9 @@ Rest_engraver::do_process_music ()
          Staff_symbol_referencer_interface si (dot_p_);
          si.set_interface ();
          
-         rest_p_->add_dots (dot_p_);
+         rest_p_->set_dots (dot_p_);
+         dot_p_->set_parent (rest_p_, Y_AXIS);
+         dot_p_->add_offset_callback (Dots::quantised_position_callback, Y_AXIS);
          dot_p_->set_elt_property ("dot-count",
                                    gh_int2scm (rest_req_l_->duration_.dots_i_));
          announce_element (Score_element_info (dot_p_,0));
index 06a67569ccd2950c3ccee833e4d72e218aeafd2d..dba6143faaac850313e3a107105a8368f78beb85 100644 (file)
@@ -9,7 +9,7 @@
 #include "dimension-cache.hh"
 #include "slur.hh"
 #include "engraver.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "stem.hh"
 #include "note-column.hh"
 #include "dot-column.hh"
index 76a2d698a0c3c9147cea9ff09f5208d4858909b2..b443e3d6122383736d047da334b16d73c536295c 100644 (file)
@@ -46,27 +46,11 @@ Rhythmic_head::dot_count () const
   return dots_l ()
     ? gh_scm2int (dots_l ()->get_elt_property ("dot-count")) : 0;
 }
-  
-GLUE_SCORE_ELEMENT(Rhythmic_head,after_line_breaking);
-SCM
-Rhythmic_head::member_after_line_breaking ()
-{
-  if (Item *d = dots_l ())
-    {
-      Staff_symbol_referencer_interface si (d);
-      Staff_symbol_referencer_interface me (d);      
-      si.set_position(int (me.position_f ()));
-    }
-
-  return SCM_UNDEFINED;
-}
-
 
 void
-Rhythmic_head::add_dots (Item *dot_l)
+Rhythmic_head::set_dots (Item *dot_l)
 {
   set_elt_pointer ("dot", dot_l->self_scm_);
-  dot_l->add_dependency (this);  
 }
 
 
index ba6d15a7d8b75a838164a87960442bcf0c85be49..ca3c938ed85733ebf423d246035af23056143841 100644 (file)
@@ -99,7 +99,7 @@ Staff_symbol_referencer_interface::callback (Score_element const* sc,Axis )
   Real off =0.0;
   if (gh_number_p (pos))
     {
-      Real space = staff_symbol_referencer (sc).staff_space ();
+      Real space = Staff_symbol_referencer_interface (sc).staff_space ();
       off = gh_scm2double (pos) * space/2.0;
     }
 
@@ -145,11 +145,6 @@ Staff_symbol_referencer_interface::set_position (Real p)
   elt_l_->add_offset_callback (callback, Y_AXIS);
 }
 
-Staff_symbol_referencer_interface
-staff_symbol_referencer (Score_element const*e)
-{
-  return e;                    // gee, I'm so smart!
-}
 
 int
 compare_position (Score_element *const  &a, Score_element * const &b)
index 18c6669187ceb3255a62da854e1f2c19dd8be49c..0deb53ab44b0b2c8a972a4f9cf499dabe584ca84 100644 (file)
@@ -7,7 +7,7 @@
 */
 
 #include "staff-symbol-referencer.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "stem.hh"
 #include "musical-request.hh"
 #include "misc.hh"
index 3611f59dcc3da87a46a0d325d63a5db490097c93..7e2a394326808504c1a69f031e409a6f7ea1ba86 100644 (file)
@@ -12,7 +12,7 @@
 #include "side-position-interface.hh"
 #include "item.hh"
 #include "musical-request.hh"
-#include "note-head.hh"
+
 #include "stem.hh"
 #include "staff-symbol.hh"
 
@@ -24,7 +24,6 @@ class Text_engraver : public Engraver
   Link_array<Text_script_req> reqs_;
   Link_array<Item> texts_;
 public:
-
   VIRTUAL_COPY_CONS(Translator);
 protected:
   virtual bool do_try_music (Music* m);
@@ -48,20 +47,20 @@ Text_engraver::do_try_music (Music *m)
 
 
 void
-Text_engraver::acknowledge_element (Score_element_info i)
+Text_engraver::acknowledge_element (Score_element_info inf)
 {
-  if (Note_head *n = dynamic_cast<Note_head*> (i.elem_l_))
+  if (to_boolean (inf.elem_l_->get_elt_property ("note-head-interface")))
     {
       for (int i=0; i < texts_.size (); i++)
        {
          Side_position_interface st (texts_[i]);
-         st.add_support (n);
+         st.add_support (inf.elem_l_);
          if (st.get_axis( ) == X_AXIS
              && !texts_[i]->parent_l (Y_AXIS))
-           texts_[i]->set_parent (n, Y_AXIS);
+           texts_[i]->set_parent (inf.elem_l_, Y_AXIS);
        }
     }
-  if (Stem *n = dynamic_cast<Stem*> (i.elem_l_))
+  if (Stem *n = dynamic_cast<Stem*> (inf.elem_l_))
     {
       for (int i=0; i < texts_.size (); i++)
        {
index 777706f0bff1e0f9ae84995471be70aa3cd8d699..84a006243daf7f0a90053dc2a229d6c247f48031 100644 (file)
@@ -39,7 +39,7 @@ Text_item::brew_molecule (SCM sm)
       Molecule m;
       m.set_empty (false);
       mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)*
-                      staff_symbol_referencer  (s).staff_space ());
+                      Staff_symbol_referencer_interface (s).staff_space ());
     }
   return mol.create_scheme (); 
 }
index a1910eeabc4c69e7426a5c1cfb11b3102527377c..63e3d2a465e13460b590976671086c9e7daf7aa7 100644 (file)
@@ -11,7 +11,7 @@
 #include "group-interface.hh"
 #include "tie.hh"
 #include "directional-element-interface.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 
 Tie_column::Tie_column (SCM s)
   : Spanner (s)
index 6d07edd4532458478b203a3c6352f15ec96ca607..020779e4827586206e986ea58c96dcfecd6e7271 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "tie-engraver.hh"
 #include "command-request.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "musical-request.hh"
 #include "tie.hh"
 #include "translator-group.hh"
 
 struct CHead_melodic_tuple {
   Melodic_req *req_l_ ;
-  Note_head *head_l_;
+  Rhythmic_head *head_l_;
   Moment end_;
   CHead_melodic_tuple ();
-  CHead_melodic_tuple (Note_head*, Melodic_req*, Moment);
+  CHead_melodic_tuple (Rhythmic_head*, Melodic_req*, Moment);
   static int pitch_compare (CHead_melodic_tuple const &, CHead_melodic_tuple const &);
   static int time_compare (CHead_melodic_tuple const &, CHead_melodic_tuple const &);  
 };
@@ -100,7 +100,7 @@ Tie_engraver::set_melisma (bool m)
 void
 Tie_engraver::acknowledge_element (Score_element_info i)
 {
-  if (Note_head *nh = dynamic_cast<Note_head *> (i.elem_l_))
+  if (Rhythmic_head *nh = dynamic_cast<Rhythmic_head *> (i.elem_l_))
     {
       Note_req * m = dynamic_cast<Note_req* > (i.req_l_);
       if (!m)
@@ -250,7 +250,7 @@ CHead_melodic_tuple::CHead_melodic_tuple ()
   end_ = 0;
 }
 
-CHead_melodic_tuple::CHead_melodic_tuple (Note_head *h, Melodic_req*m, Moment mom)
+CHead_melodic_tuple::CHead_melodic_tuple (Rhythmic_head *h, Melodic_req*m, Moment mom)
 {
   head_l_ = h;
   req_l_ = m;
index 02dd922b2daa39e73e5835a0d7849b01fe22b9d9..e777a74fba696cb586a6b4580f07bba0732ab92c 100644 (file)
@@ -10,7 +10,7 @@
 #include "lookup.hh"
 #include "paper-def.hh"
 #include "tie.hh"
-#include "note-head.hh"
+#include "rhythmic-head.hh"
 #include "bezier.hh"
 #include "paper-column.hh"
 #include "debug.hh"
@@ -39,21 +39,21 @@ Tie::Tie(SCM s)
 
 }
 
-Note_head* 
+Rhythmic_head* 
 Tie::head (Direction d) const
 {
   SCM c = get_elt_pointer ("heads");
   c = index_cell (c, d);
 
-  return dynamic_cast<Note_head*> (unsmob_element (c));  
+  return dynamic_cast<Rhythmic_head*> (unsmob_element (c));  
 }
 
 Real
 Tie::position_f () const
 {
   return head (LEFT)
-    ? staff_symbol_referencer (head (LEFT)).position_f ()
-    : staff_symbol_referencer (head (RIGHT)).position_f () ;  
+    ? Staff_symbol_referencer_interface (head (LEFT)).position_f ()
+    : Staff_symbol_referencer_interface (head (RIGHT)).position_f () ;  
 }
 
 
@@ -84,7 +84,7 @@ Tie::do_add_processing()
     warning (_ ("lonely tie"));
 
   Direction d = LEFT;
-  Drul_array<Note_head *> new_head_drul;
+  Drul_array<Rhythmic_head *> new_head_drul;
   new_head_drul[LEFT] = head(LEFT);
   new_head_drul[RIGHT] = head(RIGHT);  
   do {
@@ -110,7 +110,7 @@ Tie::member_after_line_breaking ()
   if (!Directional_element_interface (this).get ())
     Directional_element_interface (this).set (get_default_dir ());
   
-  Real staff_space = staff_symbol_referencer (this).staff_space ();
+  Real staff_space = Staff_symbol_referencer_interface (this).staff_space ();
   Real half_space = staff_space / 2;
   Real x_gap_f = paper_l ()->get_var ("tie_x_gap");
   Real y_gap_f = paper_l ()->get_var ("tie_y_gap");
@@ -220,7 +220,7 @@ Tie::get_curve () const
   Direction d (Directional_element_interface (this).get ());
   Bezier_bow b (get_encompass_offset_arr (), d);
 
-  Real staff_space = staff_symbol_referencer (this).staff_space ();
+  Real staff_space = Staff_symbol_referencer_interface (this).staff_space ();
   Real h_inf = paper_l ()->get_var ("tie_height_limit_factor") * staff_space;
   Real r_0 = paper_l ()->get_var ("tie_ratio");
 
index 0f9badfc34e5f97723c4d9173c212988219409e6..3acb6c68f3432e037cbd3e392e453a5265f98595 100644 (file)
@@ -114,21 +114,7 @@ Tuplet_spanner::member_brew_molecule () const
     }
   return mol.create_scheme();
 }
-  
-void
-Tuplet_spanner::do_add_processing ()
-{
-#if 0
-  if (gh_pair_p (get_elt_pointer ("columns")))
-    {
-      Link_array<Note_column> column_arr=
-       Pointer_group_interface__extract_elements (this, (Note_column*)0, "columns");
-      
-      set_bound (LEFT, column_arr[0]);
-      set_bound (RIGHT, column_arr.top ());  
-    }
-#endif
-}
+
 
 
 
index bf7eb05c05dc22dce7cf3469c66352146d132cf1..6e99afdb84463b06c135632dd5557904b9110326 100644 (file)
@@ -93,21 +93,7 @@ Volta_spanner::member_brew_molecule () const
   mol.translate_axis (left, X_AXIS);
   return mol.create_scheme();
 }
-  
-void
-Volta_spanner::do_add_processing ()
-{
-#if 0
-  Link_array<Bar> bar_arr
-    = Pointer_group_interface__extract_elements (this, (Bar*)0, "bars");
 
-  if (bar_arr.size ())
-    {
-      set_bound (LEFT, bar_arr[0]);
-      set_bound (RIGHT, bar_arr.top ());  
-    }
-#endif
-}
 
 GLUE_SCORE_ELEMENT(Volta_spanner,after_line_breaking);
 SCM