using 6 systems, like the original.
* lily/spanner.cc (get_broken_into):
* lily/grob.cc (original_scm, line_scm): New function.
* lily/include/grob.hh (ly_scm2grob_array): Moved from
group-interface.hh and renamed.
(ly_grob_array2scm): New function.
+2002-07-23 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * input/mutopia/J.S.Bach/baerenreiter-sarabande.ly: Warn when not
+ using 6 systems, like the original.
+
+ * input/test/count-systems.ly: New file.
+
+ * lily/spanner.cc (get_broken_into):
+ * lily/grob.cc (original_scm, line_scm): New function.
+
+ * lily/include/grob.hh (ly_scm2grob_array): Moved from
+ group-interface.hh and renamed.
+ (ly_grob_array2scm): New function.
+
2002-07-23 Juergen Reuter <reuter@ipd.uka.de>
* lily/ambitus-engraver.cc: bugfix: create ambitus grob during
%% #(set! point-and-click line-column-location)
+%% We want this to perfectly match the Baerenreiter spacing.
+%% If we're not using 6 systems, there's definately a problem.
+#(define (assert-system-count smob n)
+ (let ((systems (length (Spanner::get_broken_into
+ (Grob::original_scm
+ (Grob::line_scm smob))))))
+ (if (not (equal? n systems))
+ ;; Can't use error yet, as we know that we're not using 6...
+ ;;(error
+ (warn
+ (string-append "Got " (number->string systems)
+ " systems (expecting " (number->string n))))))
+
\header {
title = "Solo Cello Suite II"
piece ="Sarabande"
[a,8 e']
\oneVoice
[d' cis] |
- d4 d,,2 |
+ %% d4 d,,2 |
+ d4
+ \property Thread.NoteHead
+ \override #'after-line-breaking-callback
+ = #(lambda (smob) (assert-system-count smob 6))
+ d,,2 |
}
return 0;
}
+MAKE_SCHEME_CALLBACK (Grob, line_scm, 1);
+SCM
+Grob::line_scm (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ if (Grob *g = me->line_l ())
+ return g->self_scm ();
+
+ return SCM_EOL;
+}
+
+MAKE_SCHEME_CALLBACK (Grob, original_scm, 1);
+SCM
+Grob::original_scm (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ if (me->original_l_)
+ return me->original_l_->self_scm ();
+
+ return SCM_EOL;
+}
+
void
Grob::add_dependency (Grob*e)
{
Grob *get_parent (Axis a) const { return dim_cache_[a].parent_l_; }
DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM));
+ DECLARE_SCHEME_CALLBACK (original_scm, (SCM smob));
+ DECLARE_SCHEME_CALLBACK (line_scm, (SCM smob));
};
DECLARE_UNSMOB(Grob,grob);
SCM substitute_mutable_property_alist (SCM alist);
+/** Return Array of Grobs in SCM list L */
+inline Link_array<Grob>
+ly_scm2grob_array (SCM l)
+{
+ Link_array<Grob> arr;
+
+ for (SCM s = l; gh_pair_p (s); s = gh_cdr (s))
+ {
+ SCM e = gh_car (s);
+ arr.push (unsmob_grob (e));
+ }
+
+ arr.reverse ();
+ return arr;
+}
+
+#if 0
+/** Return SCM list of Grob array A */
+inline SCM
+ly_grob_array2scm (Link_array<Grob> a)
+{
+ SCM s = SCM_EOL;
+ for (int i = a.size (); i; i--)
+ s = gh_cons (a[i-1]->self_scm (), s);
+
+ return s;
+}
+#endif
+
#endif // STAFFELEM_HH
public:
static void add_grob (Grob*, SCM nm, Grob*e);
};
-/**
- Put all score elements of ELT's property called NAME into an array,
- and return it. */
-
-inline Link_array<Grob>
-list_to_grob_array (SCM l)
-{
- Link_array<Grob> arr;
-
- for (SCM s = l; gh_pair_p (s); s = gh_cdr (s))
- {
- SCM e = gh_car (s);
- arr.push (unsmob_grob (e));
- }
-
- arr.reverse ();
- return arr;
-}
template<class T>
Link_array<T>
Drul_array<Item*> spanned_drul_;
public:
- DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
+ DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
+ DECLARE_SCHEME_CALLBACK (get_broken_into, (SCM));
Link_array<Spanner> broken_into_l_arr_;
common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (LEFT), X_AXIS);
- Link_array<Grob> encompass_arr = list_to_grob_array (eltlist);
+ Link_array<Grob> encompass_arr = ly_scm2grob_array (eltlist);
Array<Offset> offset_arr;
Offset origin (me->relative_coordinate (common[X_AXIS], X_AXIS),
#include "system.hh"
#include "group-interface.hh"
+
+MAKE_SCHEME_CALLBACK (Spanner, get_broken_into, 1);
+SCM
+Spanner::get_broken_into (SCM smob)
+{
+ if (Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (smob)))
+#if 0
+ return ly_grob_array2scm (me->broken_into_l_arr_);
+#else
+ {
+ SCM s = SCM_EOL;
+ for (int i = me->broken_into_l_arr_.size (); i; i--)
+ s = gh_cons (me->broken_into_l_arr_[i-1]->self_scm (), s);
+ return s;
+ }
+#endif
+
+ return SCM_EOL;
+}
+
void
Spanner::do_break_processing ()
{