]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/note-column.cc (dir): idem.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 20 Jul 2005 14:23:41 +0000 (14:23 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 20 Jul 2005 14:23:41 +0000 (14:23 +0000)
* lily/spacing-spanner.cc (Module): idem.

* lily/script-column.cc (before_line_breaking): use extract_grob_set()

* lily/include/paper-column.hh (class Paper_column): add
non-static get_rank() member.

13 files changed:
ChangeLog
lily/chord-name.cc
lily/grob-property.cc
lily/include/paper-column.hh
lily/ledger-line-spanner.cc
lily/note-column.cc
lily/script-column.cc
lily/slur-scoring.cc
lily/spacing-loose-columns.cc
lily/spacing-spanner.cc
lily/spanner.cc
lily/tie-column.cc
scm/output-socket.scm

index 4e83a7359c498e0d59f1b853b80e5f20a4953ae9..26138927a3b88081e296e2fb1b7d314c675bd19a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+
+2005-07-20  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * lily/note-column.cc (dir): idem.
+
+       * lily/spacing-spanner.cc (Module): idem.
+
+       * lily/script-column.cc (before_line_breaking): use extract_grob_set()
+
+       * lily/include/paper-column.hh (class Paper_column): add
+       non-static get_rank() member.
+
+       * scm/framework-null.scm: new file, used for benchmarking.
+
 2005-07-20  Heikki Junes  <hjunes@cc.hut.fi>
 
        * Documentation/topdocs/INSTALL.texi, configure.in: fix
@@ -9,10 +23,6 @@
 
        * stepmake/bin/add-html-footer.py: add missing </p>.
 
-2005-07-20  Han-Wen Nienhuys  <hanwen@xs4all.nl>
-
-       * scm/framework-null.scm: new file, used for benchmarking.
-
 2005-07-19  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
        * scm/define-markup-commands.scm (beam): use polygon in beam
@@ -28,7 +38,7 @@
        link to libstdc++
 
        * lily/GNUmakefile (static-gxx-libs): new target
-       static-gxx-libs. Create  link to libstdc++.a
+       static-gxx-libs. Create symlink to libstdc++.a
 
        * lily/new-lyric-combine-music-iterator.cc: rename to
        Lyric_combine_music_iterator
index ac7d92f4d7cba3d872e6bb80189590a734c2b7df..ffcfbd71e1e8d1206603ad1c9824bd8ee68ea68f 100644 (file)
@@ -25,7 +25,7 @@ Chord_name::after_line_breaking (SCM smob)
   SCM s = me->get_property ("begin-of-line-visible");
   if (to_boolean (s))
     {
-      if (Paper_column::get_rank (me->get_column ())
+      if (me->get_column ()->get_rank ()
          - me->get_system ()->spanned_rank_iv ()[LEFT] > 1)
        me->suicide ();
     }
index a6d57b4ce084dfb0463e5c2130aeac73a5adc265..84bea0c6bc3f6ace23c055d8275f834fefa30033 100644 (file)
@@ -93,6 +93,7 @@ Grob::internal_set_property (SCM sym, SCM v)
   mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, sym, v);
 }
 
+#ifdef DEBUG_PROFILE_ACCESSES
 Protected_scm property_lookup_table;
 LY_DEFINE(ly_property_lookup_stats, "ly:property-lookup-stats",
          0,0,0, (),
@@ -100,7 +101,7 @@ LY_DEFINE(ly_property_lookup_stats, "ly:property-lookup-stats",
 {
   return (SCM) property_lookup_table;
 }
-
+#endif
 
 SCM
 Grob::internal_get_property (SCM sym) const
@@ -118,7 +119,7 @@ Grob::internal_get_property (SCM sym) const
     }
 #endif
 
-#if 0
+#ifdef DEBUG_PROFILE_ACCESSES
   /*
     Statistics: which properties are looked up? 
   */
@@ -137,7 +138,6 @@ Grob::internal_get_property (SCM sym) const
   scm_set_cdr_x (hashhandle, scm_from_int (scm_to_int (scm_cdr (hashhandle)) + 1));
 #endif
   
-  
   SCM s = scm_sloppy_assq (sym, mutable_property_alist_);
   if (s != SCM_BOOL_F)
     return scm_cdr (s);
index bb9cdfefb131a92af9802878ce50fe5b43207e5e..70c1d178238b5a0c05b997ce45d0e4ec97308bdd 100644 (file)
 
 class Paper_column : public Item
 {
-public:
   int rank_;
   /// if lines are broken then this column is in #line#
   System *system_;
 
+
+  // ugh: friend declarations.
+  friend void set_loose_columns (System *which, Column_x_positions const *posns);
+  friend class System;
+public:
   Paper_column (SCM, Object_key const *);
   Paper_column (Paper_column const &, int count);
 
@@ -30,7 +34,8 @@ public:
   virtual System *get_system () const;
 
   static int get_rank (Grob *);
-
+  int get_rank () const { return rank_; }
+  
   DECLARE_SCHEME_CALLBACK (print, (SCM));
   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
 
index 9e2a79a4aa6baf95fa74a79260af56c5b3a73005..85ff9e5d29c7c8bb84c6abec9ae954d5eef2e5a1 100644 (file)
@@ -242,7 +242,7 @@ Ledger_line_spanner::print (SCM smob)
          ledger_extent.widen (length_fraction * head_extent.length ());
 
          Direction vdir = Direction (sign (pos));
-         int rank = Paper_column::get_rank (h->get_column ());
+         int rank = h->get_column ()->get_rank ();
 
          reqs[rank][vdir].ledger_extent_.unite (ledger_extent);
          reqs[rank][vdir].head_extent_.unite (head_extent);
@@ -307,7 +307,7 @@ Ledger_line_spanner::print (SCM smob)
          Interval ledger_size = head_size;
          ledger_size.widen (ledger_size.length () * length_fraction);
 
-         Interval max_size = reqs[Paper_column::get_rank (h->get_column ())][Direction (sign (pos))].ledger_extent_;
+         Interval max_size = reqs[h->get_column ()->get_rank ()][Direction (sign (pos))].ledger_extent_;
 
          ledger_size.intersect (max_size);
          Real left_shorten = 0.0;
index 4c81e4af067df13f5657ae214161e379a484076c..458e60aad40b91cb0f4789f14dceac9303f19027 100644 (file)
@@ -73,9 +73,13 @@ Note_column::dir (Grob *me)
   Grob *stem = unsmob_grob (me->get_object ("stem"));
   if (stem && Stem::has_interface (stem))
     return Stem::get_direction (stem);
-  else if (scm_is_pair (me->get_object ("note-heads")))
-    return (Direction)sign (head_positions_interval (me).center ());
-
+  else
+    {
+      extract_grob_set (me, "note-heads", heads);
+      if (heads.size ())
+       return (Direction)sign (head_positions_interval (me).center ());
+    }
+  
   programming_error ("note column without heads and stem");
   return CENTER;
 }
index 6e03fa6f726e3ff76ed20f8e13a8821ee08d1f90..71cfd4119acb640810be6773e8d545f9f8ec9b15 100644 (file)
@@ -42,12 +42,13 @@ SCM
 Script_column::before_line_breaking (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  Drul_array<SCM> scripts (SCM_EOL, SCM_EOL);
+  Drul_array<SCM> scripts_drul (SCM_EOL, SCM_EOL);
   Link_array<Grob> staff_sided;
 
-  for (SCM s = me->get_property ("scripts"); scm_is_pair (s); s = scm_cdr (s))
+  extract_grob_set (me, "scripts", scripts);
+  for (int i = 0; i < scripts.size (); i++)
     {
-      Grob *sc = unsmob_grob (scm_car (s));
+      Grob *sc = scripts[i];
 
       /*
        Don't want to consider scripts horizontally next to notes.
@@ -68,13 +69,13 @@ Script_column::before_line_breaking (SCM smob)
          g->set_property ("direction", scm_int2num (d));
        }
 
-      scripts[d] = scm_cons (g->self_scm (), scripts[d]);
+      scripts_drul[d] = scm_cons (g->self_scm (), scripts_drul[d]);
     }
 
   Direction d = DOWN;
   do
     {
-      SCM ss = scm_reverse_x (scripts[d], SCM_EOL);
+      SCM ss = scm_reverse_x (scripts_drul[d], SCM_EOL);
       ss = scm_stable_sort_x (ss, ly_grob_script_priority_less_proc);
 
       Grob *last = 0;
index a5b81c0e95f8523a10ae9a3545a273f17a698986..d25b72a35ef792ee904de738eb0bf1edeecc65ec 100644 (file)
@@ -498,8 +498,8 @@ spanner_less (Spanner *s1, Spanner *s2)
   Direction d = LEFT;
   do
     {
-      b1[d] = s1->get_bound (d)->get_column ()->rank_;
-      b2[d] = s2->get_bound (d)->get_column ()->rank_;
+      b1[d] = s1->get_bound (d)->get_column ()->get_rank ();
+      b2[d] = s2->get_bound (d)->get_column ()->get_rank ();
     }
   while (flip (&d) != LEFT);
 
index e97547d602ce96d6cbe2c9ff016bcf2090c0594a..ab287477349afb8cee54183aa1139c20ded175df 100644 (file)
@@ -25,7 +25,7 @@ set_loose_columns (System *which, Column_x_positions const *posns)
       Item *loose = dynamic_cast<Item *> (posns->loose_cols_[i]);
       Paper_column *col = dynamic_cast<Paper_column *> (loose);
 
-      if (col->system_)
+      if (col->get_system ())
        continue;
 
       Item *left = 0;
@@ -94,17 +94,7 @@ set_loose_columns (System *which, Column_x_positions const *posns)
          distance_to_next = my_extent[RIGHT] + 1.0;
          right_point = right->extent (common, X_AXIS)[LEFT];
        }
-#if 0
-      Real left_point = left->extent (common, X_AXIS)[RIGHT];
 
-      Real space_left = ((right_point - left_point) >? 0.0)
-       - (my_extent.is_empty () ? 0.0 : my_extent.length ());
-
-      Real padding = (space_left / 2) <? 1.0;
-      /*
-       Put it just left of the right column, with a bit of extra space
-      */
-#endif
       Real my_offset = right_point - distance_to_next;
 
       col->system_ = which;
index 541704eef7c2a569aa8361e6a5dedf3dd29971c6..f67cf4d2fb9b734f206eee8d9113a976c79743ee 100644 (file)
@@ -510,7 +510,6 @@ void
 Spacing_spanner::do_measure (Rational global_shortest, Grob *me,
                             Link_array<Grob> *cols)
 {
-
   Real headwid = robust_scm2double (me->get_property ("spacing-increment"), 1);
   for (int i = 0; i < cols->size () - 1; i++)
     {
@@ -520,33 +519,37 @@ Spacing_spanner::do_measure (Rational global_shortest, Grob *me,
       Paper_column *lc = dynamic_cast<Paper_column *> (l);
       Paper_column *rc = dynamic_cast<Paper_column *> (r);
 
-      if (!Paper_column::is_musical (l))
+      if (Paper_column::is_musical (l))
+       {
+         musical_column_spacing (me, lc, rc, headwid, global_shortest);
+         if (Item *rb = r->find_prebroken_piece (LEFT))
+           musical_column_spacing (me, lc, rb, headwid, global_shortest);
+       }
+      else
        {
-         breakable_column_spacing (me, l, r, global_shortest);
-
          /*
            The case that the right part is broken as well is rather
            rare, but it is possible, eg. with a single empty measure,
            or if one staff finishes a tad earlier than the rest.
-
          */
          Item *lb = l->find_prebroken_piece (RIGHT);
          Item *rb = r->find_prebroken_piece (LEFT);
 
-         if (lb)
+         if (i == 0 && Paper_column::get_rank (l) == 0)
+           l = 0;
+
+         if (l && r)
+           breakable_column_spacing (me, l, r, global_shortest);
+         
+         if (lb && r)
            breakable_column_spacing (me, lb, r, global_shortest);
 
-         if (rb)
+         if (l && rb)
            breakable_column_spacing (me, l, rb, global_shortest);
+
          if (lb && rb)
            breakable_column_spacing (me, lb, rb, global_shortest);
        }
-      else
-       {
-         musical_column_spacing (me, lc, rc, headwid, global_shortest);
-         if (Item *rb = r->find_prebroken_piece (LEFT))
-           musical_column_spacing (me, lc, rb, headwid, global_shortest);
-       }
     }
 }
 
@@ -564,16 +567,16 @@ Spacing_spanner::musical_column_spacing (Grob *me, Item *lc, Item *rc, Real incr
   Real compound_fixed_note_space = 0.0;
   int wish_count = 0;
 
-  SCM seq = lc->get_object ("right-neighbors");
+  extract_grob_set (lc, "right-neighbors", neighbors);
 
   /*
     We adjust the space following a note only if the next note
     happens after the current note (this is set in the grob
     property SPACING-SEQUENCE.
   */
-  for (SCM s = seq; scm_is_pair (s); s = scm_cdr (s))
+  for (int i = 0; i < neighbors.size (); i++)
     {
-      Grob *wish = unsmob_grob (scm_car (s));
+      Grob *wish = neighbors[i];
 
       Item *wish_rcol = Note_spacing::right_column (wish);
       if (Note_spacing::left_column (wish) != lc
@@ -728,10 +731,11 @@ Spacing_spanner::breakable_column_spacing (Grob *me, Item *l, Item *r, Moment sh
 
   if (dt == Moment (0, 0))
     {
-      for (SCM s = l->get_object ("spacing-wishes");
-          scm_is_pair (s); s = scm_cdr (s))
+      extract_grob_set (l, "spacing-wishes", wishes);
+
+      for (int i = 0; i < wishes.size (); i++)
        {
-         Item *spacing_grob = dynamic_cast<Item *> (unsmob_grob (scm_car (s)));
+         Item *spacing_grob = dynamic_cast<Item *> (wishes[i]);
 
          if (!spacing_grob || !Staff_spacing::has_interface (spacing_grob))
            continue;
index a015e0355beeaf877b6207a903d5929c9acce95d..590c4d9473678009630ea353dc503f99632daa22 100644 (file)
@@ -153,9 +153,9 @@ Spanner::spanned_rank_iv ()
   Interval_t<int> iv (0, 0);
 
   if (spanned_drul_[LEFT] && spanned_drul_[LEFT]->get_column ())
-    iv[LEFT] = Paper_column::get_rank (spanned_drul_[LEFT]->get_column ());
+    iv[LEFT] = spanned_drul_[LEFT]->get_column ()->get_rank ();
   if (spanned_drul_[RIGHT] && spanned_drul_[RIGHT]->get_column ())
-    iv[RIGHT] = Paper_column::get_rank (spanned_drul_[RIGHT]->get_column ());
+    iv[RIGHT] = spanned_drul_[RIGHT]->get_column ()->get_rank ();
   return iv;
 }
 
index e2e33530d40c306e455329b3cb5f58444b8191e5..1caf7851a9842f82ac5314b7e6d78928b81fba6c 100644 (file)
@@ -162,8 +162,8 @@ Tie_column::before_line_breaking (SCM smob)
       Direction dir = LEFT;
       do
        {
-         if (dir * Paper_column::get_rank (tie->get_bound (dir)->get_column ())
-             > dir * Paper_column::get_rank (me->get_bound (dir)->get_column ()))
+         if (dir * tie->get_bound (dir)->get_column ()->get_rank ()
+             > dir * me->get_bound (dir)->get_column ()->get_rank ())
            {
              me->set_bound (dir, Tie::head (tie, dir));
            }
index 20a16b3bfff361c26da8fa991a3f1f761620f4fd..f9b4478196cd78c1f707b4128281b4fbf0ba4148 100644 (file)
@@ -54,7 +54,7 @@
 
     (cond
      ((ly:music? cause) cause)
-     ((ly:grob? cause) (music-cause cause))
+;     ((ly:grob? cause) (music-cause cause))
      (else
       #f))))