From: Han-Wen Nienhuys Date: Fri, 4 Feb 2005 16:13:33 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release/2.5.14~173 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f7c05a7a378068b91970df686d68731bbe1a76aa;p=lilypond.git *** empty log message *** --- diff --git a/lily/dimension-cache.cc b/lily/dimension-cache.cc index e7ec1ea658..3d5a1a012c 100644 --- a/lily/dimension-cache.cc +++ b/lily/dimension-cache.cc @@ -17,7 +17,7 @@ Dimension_cache::Dimension_cache (Dimension_cache const &d) { init (); dimension_ = d.dimension_; - + dimension_callback_ = d.dimension_callback_; offset_ = d.offset_; offset_callbacks_ = d.offset_callbacks_; offsets_left_ = d.offsets_left_; diff --git a/lily/grob.cc b/lily/grob.cc index a85266d427..2ba0e24317 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -109,6 +109,7 @@ Grob::Grob (SCM basicprops, && ly_c_procedure_p (get_property ("print-function"))) cb = stencil_extent_proc; + dim_cache_[a].dimension_callback_ = cb; dim_cache_[a].dimension_ = cb; } } @@ -410,10 +411,11 @@ Grob::extent (Grob *refp, Axis a) const Dimension_cache *d = (Dimension_cache *) &dim_cache_[a]; Interval ext; - if (scm_is_pair (d->dimension_)) + + SCM dimpair = d->dimension_; + if (scm_is_pair (dimpair)) ; else if (ly_c_procedure_p (d->dimension_)) - /* FIXME: add doco on types, and should typecheck maybe? */ d->dimension_ = scm_call_2 (d->dimension_, self_scm (), scm_int2num (a)); else return ext; @@ -610,6 +612,7 @@ Grob::mark_smob (SCM ses) { scm_gc_mark (s->dim_cache_[a].offset_callbacks_); scm_gc_mark (s->dim_cache_[a].dimension_); + scm_gc_mark (s->dim_cache_[a].dimension_callback_); /* Do not mark the parents. The pointers in the mutable property list form two tree like structures (one for X diff --git a/lily/include/dimension-cache.hh b/lily/include/dimension-cache.hh index 9f1da394fc..970b33db9c 100644 --- a/lily/include/dimension-cache.hh +++ b/lily/include/dimension-cache.hh @@ -24,7 +24,7 @@ struct Dimension_cache Multi typed: - cons: interval - - procedure: callback + - procedure: callback - else: empty */ SCM dimension_; diff --git a/lily/include/rest-collision.hh b/lily/include/rest-collision.hh index 3da35e3764..a54a526a77 100644 --- a/lily/include/rest-collision.hh +++ b/lily/include/rest-collision.hh @@ -23,6 +23,7 @@ public: static bool has_interface (Grob*); DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element, SCM axis)); + DECLARE_SCHEME_CALLBACK (force_shift_callback_rest, (SCM element, SCM axis)); static SCM do_shift (Grob*); }; #endif // REST_COLLISION_HH diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 81c477f4ba..7dd7c4cc3e 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -43,6 +43,20 @@ Rest_collision::force_shift_callback (SCM element_smob, SCM axis) } +MAKE_SCHEME_CALLBACK (Rest_collision, force_shift_callback_rest, 2); +SCM +Rest_collision::force_shift_callback_rest (SCM rest, SCM axis) +{ + Grob *rest_grob = unsmob_grob (rest); + assert ((Axis) scm_to_int (axis) == Y_AXIS); + + Grob *parent = rest_grob->get_parent (X_AXIS); + if (Note_column::has_interface (parent)) + return force_shift_callback (parent->self_scm(), axis); + else + return scm_make_real (0.0); +} + void Rest_collision::add_column (Grob*me, Grob *p) @@ -58,9 +72,14 @@ Rest_collision::add_column (Grob*me, Grob *p) */ p->add_offset_callback (Rest_collision::force_shift_callback_proc, Y_AXIS); p->set_property ("rest-collision", me->self_scm ()); -} - + Grob *rest = unsmob_grob (p->get_property ("rest")); + if (rest) + { + rest->add_offset_callback (Rest_collision::force_shift_callback_rest_proc, + Y_AXIS); + } +} /* TODO: look at horizontal-shift to determine ordering between rests @@ -153,7 +172,7 @@ Rest_collision::do_shift (Grob *me) Real diff = (ordered_rests[DOWN].top ()->extent (common, Y_AXIS)[UP] - - ordered_rests[UP].top ()->extent (common, Y_AXIS)[DOWN]) /staff_space; + - ordered_rests[UP].top ()->extent (common, Y_AXIS)[DOWN]) / staff_space; if (diff > 0) { diff --git a/lily/rest.cc b/lily/rest.cc index 80062cfca2..80b473eb10 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -41,12 +41,12 @@ Rest::after_line_breaking (SCM smob) if (d && bt > 4) // UGH. { d->set_property ("staff-position", - scm_int2num ((bt == 7) ? 4 : 3)); + scm_int2num ((bt == 7) ? 4 : 3)); } if (d && bt >= -1 && bt <= 1) // UGH again. { d->set_property ("staff-position", - scm_int2num ((bt == 0) ? -1 : 1)); + scm_int2num ((bt == 0) ? -1 : 1)); } return SCM_UNSPECIFIED; } @@ -74,39 +74,42 @@ Rest::glyph_name (Grob *me, int balltype, String style, bool try_ledgers) String actual_style (style.to_str0 ()); - if ((style == "mensural") || (style == "neomensural")) { - - /* - FIXME: Currently, ancient font does not provide ledgered rests; - hence the "o" suffix in the glyph name is bogus. But do we need - ledgered rests at all now that we can draw ledger lines with - variable width, length and blotdiameter? -- jr - */ - ledgered_b = 0; - - /* - There are no 32th/64th/128th mensural/neomensural rests. In - these cases, revert back to default style. - */ - if (balltype > 4) + if ((style == "mensural") || (style == "neomensural")) + { + + /* + FIXME: Currently, ancient font does not provide ledgered rests; + hence the "o" suffix in the glyph name is bogus. But do we need + ledgered rests at all now that we can draw ledger lines with + variable width, length and blotdiameter? -- jr + */ + ledgered_b = 0; + + /* + There are no 32th/64th/128th mensural/neomensural rests. In + these cases, revert back to default style. + */ + if (balltype > 4) + actual_style = ""; + } + + if ((style == "classical") && (balltype != 2)) + { + /* + classical style: revert back to default style for any rest other + than quarter rest + */ actual_style = ""; - } - - if ((style == "classical") && (balltype != 2)) { - /* - classical style: revert back to default style for any rest other - than quarter rest - */ - actual_style = ""; - } - - if (style == "default") { - /* - Some parts of lily still prefer style "default" over "". - Correct this here. -- jr - */ - actual_style = ""; - } + } + + if (style == "default") + { + /* + Some parts of lily still prefer style "default" over "". + Correct this here. -- jr + */ + actual_style = ""; + } return ("rests." + to_string (balltype) + (ledgered_b ? "o" : "") + actual_style); @@ -145,6 +148,7 @@ Rest::print (SCM smob) { return brew_internal_stencil (smob, true); } + MAKE_SCHEME_CALLBACK (Rest, extent_callback, 2); /* We need the callback. The real stencil has ledgers depending on @@ -175,9 +179,10 @@ Rest::polyphonic_offset_callback (SCM smob, SCM) return scm_make_real (0); Direction d = get_grob_direction (me); - Real off = 2* d ; + Real off = 2 * d ; if (off) off *= Staff_symbol_referencer::staff_space (me); + return scm_make_real (off); } diff --git a/mf/GNUmakefile b/mf/GNUmakefile index dbeb90b881..f03f63d2a4 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -1,7 +1,7 @@ depth = .. STEPMAKE_TEMPLATES=metafont install install-out -LOCAL_STEPMAKE_TEMPLATES=lilypond +LOCALSTEPMAKE_TEMPLATES=lilypond include $(depth)/make/stepmake.make