]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.37
authorfred <fred>
Tue, 26 Mar 2002 23:09:52 +0000 (23:09 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:09:52 +0000 (23:09 +0000)
16 files changed:
lily/collision.cc
lily/dot-column.cc
lily/include/axis-group-item.hh
lily/include/axis-group-spanner.hh
lily/include/collision.hh
lily/include/dot-column.hh
lily/include/hara-kiri-vertical-group-spanner.hh
lily/include/item.hh
lily/include/lily-proto.hh
lily/include/line-of-score.hh
lily/include/note-column.hh
lily/include/paper-column.hh
lily/include/spanner.hh
lily/include/super-element.hh
lily/line-of-score.cc
lily/note-column.cc

index f423d2a4a2dda420b43fe5c3c9e4d8889cd94633..c25f45d05c728d8ed5c2f24dc261af92defe695b 100644 (file)
 
 Collision::Collision()
 {
-  axis_group (this).set_axes (X_AXIS, Y_AXIS);
+  Axis_group_interface (this).set_interface ();
+  Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS);
 }
 
 void
 Collision::add_column (Note_column* ncol_l)
 {
-  axis_group (this).add_element (ncol_l);
+  Axis_group_interface (this).add_element (ncol_l);
   add_dependency (ncol_l);
 }
 
index 29a5789a22a6d043b8a922d73a2e754f941cdd83..2dc724e9f60cf22c4dad131de8eadf041361c4b1 100644 (file)
@@ -16,6 +16,7 @@
 #include "axis-group-interface.hh"
 
 
+// todo: dots and elements duplicate each other.
 void
 Dot_column::add_dots (Dots *d)
 {
@@ -23,7 +24,7 @@ Dot_column::add_dots (Dots *d)
   gi.add_element (d);
 
   add_dependency (d);
-  axis_group (this).add_element (d);
+  Axis_group_interface (this).add_element (d);
 }
 
 void
@@ -51,9 +52,10 @@ Dot_column::Dot_column ()
 {
   Group_interface gi (this, "dots");
   gi.set_interface ();
-  
   directional_element (this).set (RIGHT);
-  axis_group (this).set_axes(X_AXIS,X_AXIS);
+  
+  Axis_group_interface (this).set_interface ();
+  Axis_group_interface (this).set_axes(X_AXIS,X_AXIS);
 }
 
 /*
index aa2e6392bc670a77444e91539edee6cab5971d01..09c7cfafd0cb2ee13152e399db7d99198272b2fd 100644 (file)
@@ -1,22 +1 @@
-/*
-  axis-item.hh -- declare Axis_group_item
-
-  source file of the GNU LilyPond music typesetter
-
-  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef AXIS_ITEM_HH
-#define AXIS_ITEM_HH
-
-#include "item.hh"
-
-class Axis_group_item :  public virtual Item
-{
-public:
-  Axis_group_item ();
-  VIRTUAL_COPY_CONS(Score_element);
-};
-
-#endif // AXIS_ITEM_HH
+#error
index 9d48108c2ee9c6a2e8d45402a7113d2451910ef7..65296f81060baccd891380179b283fc7515acef0 100644 (file)
@@ -1,27 +1,2 @@
-/*
-  axis-group-spanner.hh -- declare Axis_group_spanner
 
-  source file of the GNU LilyPond music typesetter
-
-  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef AXIS_GROUP_SPANNER_HH
-#define AXIS_GROUP_SPANNER_HH
-
-#include "spanner.hh"
-
-/**
-   An element which groups a line in a certain direction. The most
-   useful example of this is the Vertical_group_spanner
-*/
-class Axis_group_spanner : public virtual Spanner
-
-{
-public:
-  Axis_group_spanner ();
-  VIRTUAL_COPY_CONS(Score_element);
-};
-
-#endif // SPAN_AXIS_GROUP_HH
+#error
index f64db66504f06871fd42884481852415bcb219cc..64052db5e013f9415145a2ae5b5e0d0d47f6d11c 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef COLLISION_HH
 #define COLLISION_HH
 #include "lily-proto.hh"
-#include "axis-group-item.hh"
+#include "item.hh"
 #include "tuple.hh"
 
 //junkme, use SCM conses.
@@ -24,7 +24,8 @@ typedef Tuple<Score_element*, Real> Shift_tup;
   multistaff support (see Chlapik: equal noteheads should be on the
   same hpos.)  
 */
-class Collision : public Axis_group_item {
+class Collision : public Item
+{
 protected:
   Array<Shift_tup> automatic_shift ();
   Array<Shift_tup> forced_shift ();
index 9679bf32a4a28f325a1bf74d5775ae1c0a7606b2..4c3a211557d197a175ac8f91959104308a99c1bc 100644 (file)
 #ifndef DOT_COLUMN_HH
 #define DOT_COLUMN_HH
 
-#include "axis-group-item.hh"
+#include "item.hh"
 
 
 /**
   Group dots.  This is needed because, the dots have to be aligned per voice
  */
-class Dot_column : public Axis_group_item
+class Dot_column : public Item
 {
   static int compare (Dots * const&,Dots * const&);
   void add_dots (Dots*);
index e3e34c2a00d6c686a4ce174044484a8570430054..aeb77bf9b8386f32dd1dac29ab9eaeea03ef71d2 100644 (file)
 #ifndef HARA_KIRI_VERTICAL_GROUP_SPANNER_HH
 #define HARA_KIRI_VERTICAL_GROUP_SPANNER_HH
 
-#include "axis-group-spanner.hh"
+#include "spanner.hh"
 
 /** 
   As Vertical_group_spanner, but keep track of interesting items.  If
   we don't contain any interesting items after linebreaking, then
   gracefully commit suicide.  Objective: don't disgrace Lily by
   typesetting empty lines in orchestral scores.  */
-class Hara_kiri_group_spanner : public Axis_group_spanner
+class Hara_kiri_group_spanner : public Spanner
 {
 public:
   Hara_kiri_group_spanner ();
index c4b3dfbad3d6ca56efe42be084b1de3def0a7e2b..0f2c951ca4c51d106831eef22b5d1c4c2b7393a5 100644 (file)
   NB. This doesn't mean an Item has to initialize the output field before
   spacing calculation. 
   
-
   
-  @signature
-  visibility_lambda :: int -> (bool . bool)
-     
-  @in
-  break direction
-     
-  @out
-  (transparent, empty) cons
-     
-   */
-class Item : public virtual Score_element {
-  void do_break ();
-  void try_visibility_lambda ();
-public:
-  /*
-    ugh.
+  Element properties
+  
+  visibility-lambda -- a function that takes the break
+  direction and returns a (transparent, empty) cons
+
+  breakable -- boolean indicating if this is a breakable item (clef,
+  barline, key sig, etc.)
+
    */
+class Item : public Score_element
+{
   Drul_array<Item*> broken_to_drul_;
 
-
+  void do_break ();
+  void try_visibility_lambda ();
 public:
+  VIRTUAL_COPY_CONS(Score_element);
+  Item();
+  Item (Item const &);
 
-  /// I am really to be broken?
   bool breakable_b () const;
   bool broken_b () const;
   
@@ -57,18 +53,10 @@ public:
   Item * find_broken_piece (Direction) const;
   Score_element * find_broken_piece (Line_of_score*) const;    
 
-  Item();
-  Real hpos_f() const;
-  
   virtual Line_of_score * line_l() const;
   virtual Paper_column * column_l () const;
-    
-  static int left_right_compare (Item const *, Item const*);
-  
-  Item (Item const &);
 protected:
   virtual void do_breakable_col_processing();
-
   void copy_breakable_items();
 };
 
index 8309d245a93783f3bd60f7257d01268ecb0f7f51..1b85d39f98006865e39f512ab9f1b1732b44cc9b 100644 (file)
@@ -34,10 +34,6 @@ struct Audio_tie;
 struct Audio_time_signature;
 struct Auto_beam_engraver;
 struct Axis_align_item;
-struct Axis_group;
-struct Axis_group_element;
-struct Axis_group_item;
-struct Axis_group_spanner;
 struct Bar;
 struct Bar_column;
 struct Bar_column_engraver;
@@ -273,7 +269,6 @@ struct Tremolo_req;
 struct Tuplet_spanner;
 struct Unfolded_repeat_iterator;
 struct Vertical_brace;
-struct Vertical_spanner;
 struct Volta_spanner;
 struct Moment;
 
index 994a50b20d7fb42550602f1b944bd454312699cc..a5a0174d1990612160d42097379534f8a82898f2 100644 (file)
@@ -8,13 +8,34 @@
 #define SCORELINE_HH
 
 #include "column-x-positions.hh"
-#include "axis-group-spanner.hh"
-#include "super-element.hh"
+#include "spanner.hh"
 
 /// the columns of a score that form one line. FIXME: multiple inheritance
-class Line_of_score : public Axis_group_spanner, public Super_element
+class Line_of_score : public Spanner
 {
 public:
+
+  
+/*
+  imported the following  from Super_element
+  
+  The toplevel element. The Paper_score contains this element, and any
+  element shoud be a dependency for the super element.
+
+  It is the entry point for the "constraint solver"/ dependency
+  tracker.  Every XXXX_processing () call traverses the entire
+  dependency graph, and calls the appropriate
+  Score_element::do_XXX_processing function on each Score_element it encounters.
+  
+
+  FIXME: remove this class, to eliminate multiple inheritance. Merge
+  with Line_of_score ?  */
+  void space_processing ();
+  void pre_processing();
+  void breakable_col_processing();
+  void post_processing();
+  void output_all ();
+
   int rank_i_;
   
   Line_of_score();
@@ -30,7 +51,6 @@ public:
   void add_column (Paper_column*);
   
 protected:
-  virtual void do_print() const;
   VIRTUAL_COPY_CONS(Score_element);
 };
 
index df0876b598d7e17f41da28daa0ddd06e673755f7..0d81e99399cb99ef18b93b8c1672769a83aa57aa 100644 (file)
 #define NOTE_COLUMN_HH
 
 #include "item.hh"
-#include "axis-group-item.hh"
 
 /** a struct for treating a group of noteheads (noteheads, stem
-  (chord) and scripts) as a single entity.  */
-class Note_column : public Axis_group_item {
+  (chord) and scripts) as a single entity.
+*/
+class Note_column : public Item
+{
 protected:
   virtual void after_line_breaking () ;
 public:
-
   static int shift_compare (Note_column *const &, Note_column*const&);
   
   /** The relative position of the "voice" containing this
index 16b05850577f51cff1266e9c54a771ef24e8ee38..e0510bc7f8c6070b99d0a0a44fb45bc2565d0f6c 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef P_COL_HH
 #define P_COL_HH
 
-#include "axis-group-item.hh"
+#include "item.hh"
 #include "rod.hh"
 #include "spring.hh"
 
@@ -27,7 +27,8 @@
     \end{itemize}
   */
 
-class Paper_column : public Axis_group_item { 
+class Paper_column : public Item
+{ 
 public:
   VIRTUAL_COPY_CONS(Score_element);
   Drul_array<Array<Column_rod> > minimal_dists_arr_drul_;
index 130604b86303cdfc1b4dedcbf960471b29580d7b..b67d63d7dc134b199deed55443b5a340438a9e5a 100644 (file)
@@ -20,13 +20,10 @@ class Axis_group_spanner;
 
   Examples
 
-  \begin{itemize}
-  \item (de)crescendo
-  \item slur
-  \item beam
-  \item bracket
-  \end{itemize}
-  
+  * (de)crescendo
+  * slur
+  * beam
+  * bracket
 
   Spanner should know about the items which it should consider:
   e.g. slurs should be steep enough to "enclose" all those items. This
@@ -34,7 +31,7 @@ class Axis_group_spanner;
   length of stems of notes they encompass.
 
   */
-class Spanner : public virtual Score_element {
+class Spanner : public  Score_element {
   Drul_array<Item*> spanned_drul_;
 
 public:
index 8c574bb68330911343baddd4fa1b28ec29320763..3ae4480ba416e2a76f71c0f102b1c3b20f820e32 100644 (file)
 #ifndef Super_element_HH
 #define Super_element_HH
 
+#error
 #include "score-element.hh"
-/** The toplevel element. The Paper_score contains this element, and any
-  element shoud be a dependency for the super element.
-
-  It is the entry point for the "constraint solver"/ dependency
-  tracker.  Every XXXX_processing () call traverses the entire
-  dependency graph, and calls the appropriate
-  Score_element::do_XXX_processing function on each Score_element it encounters.
-  
-
-  FIXME: remove this class, to eliminate multiple inheritance. Merge
-  with Line_of_score ?  */
-class Super_element : public virtual Score_element {
-public:
-  void space_processing ();
-  void pre_processing();
-  void breakable_col_processing();
-  void post_processing();
-  void output_all ();
-};
 
 #endif // Super_element_HH
index 478a07289d7fd26a55ded33594ef2f9e397218ff..89d6de0dd42aed901ce63ee957d5bdd9bbbbfddb 100644 (file)
@@ -6,21 +6,23 @@
   (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+#include "axis-group-interface.hh"
+#include "debug.hh"
 #include "line-of-score.hh"
+#include "main.hh"
+#include "paper-column.hh"
 #include "paper-def.hh"
 #include "paper-outputter.hh"
-#include "paper-column.hh"
 #include "paper-score.hh"
+#include "string.hh"
 #include "warn.hh"
-#include "main.hh"
-#include "debug.hh"
-#include "axis-group-interface.hh"
 
 
 Line_of_score::Line_of_score()
 {
   set_elt_property ("columns", SCM_EOL);
-  axis_group (this).set_axes (Y_AXIS,X_AXIS);
+  Axis_group_interface (this).set_interface ();
+  Axis_group_interface (this).set_axes (Y_AXIS,X_AXIS);
 }
 
 
@@ -67,15 +69,9 @@ Line_of_score::add_column (Paper_column*p)
 {
   set_elt_property ("columns",
                    gh_cons (p->self_scm_, get_elt_property ("columns")));
-  axis_group (this).add_element (p);
+  Axis_group_interface (this).add_element (p);
 }
 
-void
-Line_of_score::do_print() const
-{
-  Spanner::do_print();
-  Axis_group_spanner::do_print ();
-}
 
 void
 Line_of_score::output_line (bool last_line)
@@ -87,7 +83,7 @@ Line_of_score::output_line (bool last_line)
     translate_axis (- i[MAX], Y_AXIS);
   
   pscore_l_->outputter_l_->start_line (i.length ());
-  Super_element::output_all ();
+  output_all ();
   if (last_line)
     pscore_l_->outputter_l_->stop_last_line();
   else
@@ -99,3 +95,67 @@ Line_of_score::compare (Line_of_score* const &p1,Line_of_score* const &p2)
 {
   return p1->rank_i_ - p2->rank_i_;
 }
+
+
+
+/**
+    for administration of what was done already
+    */
+enum Score_element_status {
+  ORPHAN=0,                    // not yet added to pstaff
+  VIRGIN,                      // added to pstaff
+  PREBROKEN,
+  PREBROKEN_SECOND,
+  PRECALCING,
+  PRECALCED,           // calcs before spacing done
+  SPACING,
+  SPACED,
+  BROKEN,
+  BROKEN_SECOND,
+  POSTCALCING,         // busy calculating. This is used to trap cyclic deps.
+  POSTCALCED,          // after spacing calcs done
+  BREWING,
+  BREWED,
+};
+
+void
+Line_of_score::pre_processing ()
+{
+  calculate_dependencies (PRECALCED, PRECALCING, &Score_element::before_line_breaking);
+}
+
+void
+Line_of_score::space_processing ()
+{
+  calculate_dependencies (SPACED, SPACING, &Score_element::do_space_processing);
+}
+
+/* for break processing, use only one status, because copies have to
+  have correct status. (Previously,
+  Score_element::handle_[pre]broken_dependencies assigned to status_i_
+  */
+void
+Line_of_score::breakable_col_processing ()
+{
+  calculate_dependencies (PREBROKEN, PREBROKEN, &Score_element::do_breakable_col_processing);
+  //  calculate_dependencies (PREBROKEN_SECOND, PREBROKEN_SECOND, &Score_element::handle_prebroken_dependents);
+}
+
+
+void
+Line_of_score::post_processing ()
+{
+  //  calculate_dependencies (BROKEN_SECOND, BROKEN_SECOND,
+  //             &Score_element::handle_broken_dependents);
+  calculate_dependencies (POSTCALCED, POSTCALCING, &Score_element::after_line_breaking);
+}
+
+void
+Line_of_score::output_all () 
+{
+  calculate_dependencies (BREWED, BREWING, &Score_element::output_processing);
+}
+
+
+
+
index 3b9a26e89b230cffcfbcc72019846a33a293de1d..909629921cf1781571166e685764e92c8d7543c0 100644 (file)
@@ -42,7 +42,8 @@ Note_column::Note_column()
 {
   set_elt_property ("rests", SCM_EOL);
   set_elt_property ("note-heads", SCM_EOL);  
-  axis_group (this).set_axes (X_AXIS, Y_AXIS);
+  Axis_group_interface (this).set_interface ();
+  Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS);
 }
 
 Stem *
@@ -92,7 +93,7 @@ Note_column::set_stem (Stem * stem_l)
   set_elt_property ("stem", stem_l->self_scm_);
 
   add_dependency (stem_l);
-  axis_group (this).add_element (stem_l);
+  Axis_group_interface (this).add_element (stem_l);
 }
 
 
@@ -110,7 +111,7 @@ Note_column::add_head (Rhythmic_head *h)
       Group_interface gi (this, "note-heads");
       gi.add_element (nh);
     }
-  axis_group (this).add_element (h);
+  Axis_group_interface (this).add_element (h);
 }
 
 /**
@@ -133,7 +134,7 @@ Note_column::translate_rests (int dy_i)
 void
 Note_column::set_dotcol (Dot_column *d)
 {
-  axis_group (this).add_element (d);
+  Axis_group_interface (this).add_element (d);
 }
 
 /*
@@ -172,12 +173,12 @@ Note_column::after_line_breaking ()
     beam_y = gh_scm2double (s);
 
   
-  Real x0 = b->first_visible_stem ()->hpos_f ();
-  Real dx = b->last_visible_stem ()->hpos_f () - x0;
+  Real x0 = b->first_visible_stem ()->relative_coordinate (0, X_AXIS);
+  Real dx = b->last_visible_stem ()->relative_coordinate (0, X_AXIS) - x0;
   Real dydx = beam_dy && dx ? beam_dy/dx : 0;
 
   Direction d = stem_l ()->get_direction ();
-  Real beamy = (stem_l ()->hpos_f () - x0) * dydx + beam_y;
+  Real beamy = (stem_l ()->relative_coordinate (0, X_AXIS) - x0) * dydx + beam_y;
 
   s = get_elt_property ("rests");
   Score_element * se = unsmob_element (gh_car (s));