X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fottava-engraver.cc;h=6296e8c8a2092c9adaf2732a9150d8d81c6e9f69;hb=0b544cfb7332615ef809b71b57ab656741311ae1;hp=f4a8a8b91c839bbaefeea66eabf1aedd81844ec7;hpb=8cab78caa0db1ba14f2e52e4c1ddbb541ea0e5cb;p=lilypond.git diff --git a/lily/ottava-engraver.cc b/lily/ottava-engraver.cc index f4a8a8b91c..6296e8c8a2 100644 --- a/lily/ottava-engraver.cc +++ b/lily/ottava-engraver.cc @@ -1,18 +1,29 @@ /* - ottava-engraver.cc -- implement Ottava_spanner_engraver + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2000--2014 Han-Wen Nienhuys - (c) 2000--2009 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ -#include "protected-scm.hh" +#include "engraver.hh" +#include "item.hh" #include "note-column.hh" +#include "protected-scm.hh" #include "side-position-interface.hh" -#include "engraver.hh" #include "spanner.hh" #include "text-interface.hh" -#include "item.hh" class Ottava_spanner_engraver : public Engraver { @@ -57,14 +68,14 @@ Ottava_spanner_engraver::process_music () finished_ = span_; span_ = 0; if (Text_interface::is_markup (ott)) - { - span_ = make_spanner ("OttavaBracket", SCM_EOL); - span_->set_property ("text", ott); - - SCM offset (get_property ("middleCOffset")); - if (robust_scm2double (offset, 0) > 0) - span_->set_property ("direction", scm_from_int (DOWN)); - } + { + span_ = make_spanner ("OttavaBracket", SCM_EOL); + span_->set_property ("text", ott); + + SCM offset (get_property ("middleCOffset")); + if (robust_scm2double (offset, 0) > 0) + span_->set_property ("direction", scm_from_int (DOWN)); + } } last_ottavation_ = ott; } @@ -78,7 +89,7 @@ Ottava_spanner_engraver::acknowledge_note_column (Grob_info info) Side_position_interface::add_support (span_, it); if (!span_->get_bound (LEFT)) - span_->set_bound (LEFT, it); + span_->set_bound (LEFT, it); span_->set_bound (RIGHT, it); } } @@ -88,16 +99,14 @@ Ottava_spanner_engraver::typeset_all () { if (finished_) { - Direction d = LEFT; - do - { - if (!finished_->get_bound (RIGHT)) - { - Grob *e = unsmob_grob (get_property ("currentMusicalColumn")); - finished_->set_bound (d, e); - } - } - while (flip (&d) != LEFT); + for (LEFT_and_RIGHT (d)) + { + if (!finished_->get_bound (RIGHT)) + { + Grob *e = unsmob_grob (get_property ("currentMusicalColumn")); + finished_->set_bound (d, e); + } + } finished_ = 0; } @@ -130,17 +139,17 @@ Ottava_spanner_engraver::finalize () ADD_ACKNOWLEDGER (Ottava_spanner_engraver, note_column); ADD_TRANSLATOR (Ottava_spanner_engraver, - /* doc */ - "Create a text spanner when the ottavation property changes.", - - /* create */ - "OttavaBracket ", - - /* read */ - "ottavation " - "originalMiddleCPosition " - "currentMusicalColumn ", - - /* write */ - "" - ); + /* doc */ + "Create a text spanner when the ottavation property changes.", + + /* create */ + "OttavaBracket ", + + /* read */ + "middleCOffset " + "ottavation " + "currentMusicalColumn ", + + /* write */ + "" + );