From: hanwen Date: Wed, 20 Jul 2005 14:23:41 +0000 (+0000) Subject: * lily/note-column.cc (dir): idem. X-Git-Tag: release/2.7.2~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=342c0e51cea6d886e475b64b4b86ec6053540400;p=lilypond.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 4e83a7359c..26138927a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ + +2005-07-20 Han-Wen Nienhuys + + * 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 * Documentation/topdocs/INSTALL.texi, configure.in: fix @@ -9,10 +23,6 @@ * stepmake/bin/add-html-footer.py: add missing

. -2005-07-20 Han-Wen Nienhuys - - * scm/framework-null.scm: new file, used for benchmarking. - 2005-07-19 Han-Wen Nienhuys * 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 diff --git a/lily/chord-name.cc b/lily/chord-name.cc index ac7d92f4d7..ffcfbd71e1 100644 --- a/lily/chord-name.cc +++ b/lily/chord-name.cc @@ -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 (); } diff --git a/lily/grob-property.cc b/lily/grob-property.cc index a6d57b4ce0..84bea0c6bc 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -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); diff --git a/lily/include/paper-column.hh b/lily/include/paper-column.hh index bb9cdfefb1..70c1d17823 100644 --- a/lily/include/paper-column.hh +++ b/lily/include/paper-column.hh @@ -14,11 +14,15 @@ 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)); diff --git a/lily/ledger-line-spanner.cc b/lily/ledger-line-spanner.cc index 9e2a79a4aa..85ff9e5d29 100644 --- a/lily/ledger-line-spanner.cc +++ b/lily/ledger-line-spanner.cc @@ -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; diff --git a/lily/note-column.cc b/lily/note-column.cc index 4c81e4af06..458e60aad4 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -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; } diff --git a/lily/script-column.cc b/lily/script-column.cc index 6e03fa6f72..71cfd4119a 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -42,12 +42,13 @@ SCM Script_column::before_line_breaking (SCM smob) { Grob *me = unsmob_grob (smob); - Drul_array scripts (SCM_EOL, SCM_EOL); + Drul_array scripts_drul (SCM_EOL, SCM_EOL); Link_array 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; diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index a5b81c0e95..d25b72a35e 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -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); diff --git a/lily/spacing-loose-columns.cc b/lily/spacing-loose-columns.cc index e97547d602..ab28747734 100644 --- a/lily/spacing-loose-columns.cc +++ b/lily/spacing-loose-columns.cc @@ -25,7 +25,7 @@ set_loose_columns (System *which, Column_x_positions const *posns) Item *loose = dynamic_cast (posns->loose_cols_[i]); Paper_column *col = dynamic_cast (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) system_ = which; diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 541704eef7..f67cf4d2fb 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -510,7 +510,6 @@ void Spacing_spanner::do_measure (Rational global_shortest, Grob *me, Link_array *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 (l); Paper_column *rc = dynamic_cast (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 (unsmob_grob (scm_car (s))); + Item *spacing_grob = dynamic_cast (wishes[i]); if (!spacing_grob || !Staff_spacing::has_interface (spacing_grob)) continue; diff --git a/lily/spanner.cc b/lily/spanner.cc index a015e0355b..590c4d9473 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -153,9 +153,9 @@ Spanner::spanned_rank_iv () Interval_t 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; } diff --git a/lily/tie-column.cc b/lily/tie-column.cc index e2e33530d4..1caf7851a9 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -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)); } diff --git a/scm/output-socket.scm b/scm/output-socket.scm index 20a16b3bff..f9b4478196 100644 --- a/scm/output-socket.scm +++ b/scm/output-socket.scm @@ -54,7 +54,7 @@ (cond ((ly:music? cause) cause) - ((ly:grob? cause) (music-cause cause)) +; ((ly:grob? cause) (music-cause cause)) (else #f))))