X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fscript-column-engraver.cc;h=e94e233882ab45d4b87aeb20575604db8755611b;hb=90e4d7057f3857da049dfda3d130017d4719bd6b;hp=53b50336a5d6316f994702454e7eb18f84c1e240;hpb=75eebcb49e52d296b1da3e1074e0825d2c780db4;p=lilypond.git diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index 53b50336a5..e94e233882 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -1,14 +1,26 @@ /* - script-column-engraver.cc -- implement Script_column_engraver + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 1999--2015 Han-Wen Nienhuys - (c) 1999--2006 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 "engraver.hh" #include "script-column.hh" #include "side-position-interface.hh" +#include "item.hh" #include "translator.icc" @@ -17,33 +29,34 @@ Script_column, that will fix the collisions. */ class Script_column_engraver : public Engraver { - Grob *scol_; - Link_array scripts_; + Grob *script_column_; + vector scripts_; public: TRANSLATOR_DECLARATIONS (Script_column_engraver); protected: - DECLARE_ACKNOWLEDGER (side_position); + void acknowledge_side_position (Grob_info); void process_acknowledged (); void stop_translation_timestep (); }; -Script_column_engraver::Script_column_engraver () +Script_column_engraver::Script_column_engraver (Context *c) + : Engraver (c) { - scol_ = 0; + script_column_ = 0; } void Script_column_engraver::stop_translation_timestep () { - if (scol_) + if (script_column_) { - for (int i = 0; i < scripts_.size (); i++) - if (Side_position_interface::get_axis (scripts_[i]) == Y_AXIS) - Script_column::add_staff_sided (scol_, scripts_[i]); + for (vsize i = 0; i < scripts_.size (); i++) + if (Side_position_interface::get_axis (scripts_[i]) == Y_AXIS) + Script_column::add_side_positioned (script_column_, scripts_[i]); } - scol_ = 0; + script_column_ = 0; scripts_.clear (); } @@ -53,22 +66,35 @@ Script_column_engraver::acknowledge_side_position (Grob_info inf) Item *thing = dynamic_cast (inf.grob ()); if (thing) { - if (!Item::is_breakable (thing)) - scripts_.push (thing); + if (!Item::is_non_musical (thing)) + scripts_.push_back (thing); } } void Script_column_engraver::process_acknowledged () { - if (!scol_ && scripts_.size () > 1) - scol_ = make_item ("ScriptColumn", SCM_EOL); + if (!script_column_ && scripts_.size () > 1) + script_column_ = make_item ("ScriptColumn", SCM_EOL); +} + +void +Script_column_engraver::boot () +{ + ADD_ACKNOWLEDGER (Script_column_engraver, side_position); } -ADD_ACKNOWLEDGER (Script_column_engraver, side_position); ADD_TRANSLATOR (Script_column_engraver, - /* doc */ "", - /* create */ "ScriptColumn", - /* accept */ "", - /* read */ "", - /* write */ ""); + /* doc */ + "Find potentially colliding scripts and put them into a" + " @code{ScriptColumn} object; that will fix the collisions.", + + /* create */ + "ScriptColumn ", + + /* read */ + "", + + /* write */ + "" + );