X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbeam-engraver.cc;h=753a05644922e72f453bd14d2aef5b02e9b4f4a0;hb=cb0b407e567feca71cbc5f9479a06b266c69a26c;hp=a89435de6871a6ff391ac34075cea7e3c3f44527;hpb=ebe492ca408fb0d9abf80b94c56197eef8dc2f09;p=lilypond.git diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index a89435de68..753a056449 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1998--2012 Han-Wen Nienhuys + Copyright (C) 1998--2015 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ #include "spanner.hh" #include "stream-event.hh" #include "stem.hh" +#include "unpure-pure-container.hh" #include "warn.hh" #include "translator.icc" @@ -176,14 +177,18 @@ Beam_engraver::typeset_beam () { if (finished_beam_) { - if (!finished_beam_->get_bound (RIGHT)) - finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT)); - if (forced_direction_) + Grob *stem = finished_beam_->get_bound (RIGHT); + if (!stem) { - Grob *stem = finished_beam_->get_bound (RIGHT); - set_grob_direction (stem, forced_direction_); - forced_direction_ = CENTER; + stem = finished_beam_->get_bound (LEFT); + if (stem) + finished_beam_->set_bound (RIGHT, stem); } + + if (stem && forced_direction_) + set_grob_direction (stem, forced_direction_); + + forced_direction_ = CENTER; finished_beam_info_->beamify (finished_beaming_options_); Beam::set_beaming (finished_beam_, finished_beam_info_); @@ -243,7 +248,10 @@ Beam_engraver::acknowledge_rest (Grob_info info) if (beam_ && !scm_is_number (info.grob ()->get_property_data ("staff-position"))) chain_offset_callback (info.grob (), - Beam::rest_collision_callback_proc, Y_AXIS); + Unpure_pure_container::make_smob + (Beam::rest_collision_callback_proc, + Beam::pure_rest_collision_callback_proc), + Y_AXIS); } void @@ -256,6 +264,14 @@ Beam_engraver::acknowledge_stem (Grob_info info) if (!valid_start_point ()) return; + // It's suboptimal that we don't support callbacks returning ##f, + // but this makes beams have no effect on "stems" reliably in + // TabStaff when \tabFullNotation is switched off: the real stencil + // callback for beams is called quite late in the process, and we + // don't want to trigger it early. + if (scm_is_false (beam_->get_property_data ("stencil"))) + return; + Item *stem = dynamic_cast (info.grob ()); if (Stem::get_beam (stem)) return; @@ -269,9 +285,9 @@ Beam_engraver::acknowledge_stem (Grob_info info) last_stem_added_at_ = now; - Duration *stem_duration = unsmob_duration (ev->get_property ("duration")); + Duration *stem_duration = unsmob (ev->get_property ("duration")); int durlog = stem_duration->duration_log (); - //int durlog = unsmob_duration (ev->get_property ("duration"))->duration_log (); + //int durlog = unsmob (ev->get_property ("duration"))->duration_log (); if (durlog <= 2) { ev->origin ()->warning (_ ("stem does not fit in beam")); @@ -289,10 +305,10 @@ Beam_engraver::acknowledge_stem (Grob_info info) stem->set_property ("duration-log", scm_from_int (durlog)); Moment stem_location = now - beam_start_mom_ + beam_start_location_; beam_info_->add_stem (stem_location, - max (durlog - 2, 0), + std::max (durlog - 2, 0), Stem::is_invisible (stem), stem_duration->factor (), - (stem->get_property ("tuplet-start") == SCM_BOOL_T)); + (to_boolean (stem->get_property ("tuplet-start")))); Beam::add_stem (beam_, stem); }