OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1999--2015 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 1999--2015 Jan Nieuwenhuizen <janneke@gnu.org> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 "subdivideBeams ", | 573 "subdivideBeams ", |
574 | 574 |
575 /* write */ | 575 /* write */ |
576 "" | 576 "" |
577 ); | 577 ); |
578 | 578 |
579 class Grace_auto_beam_engraver : public Auto_beam_engraver | 579 class Grace_auto_beam_engraver : public Auto_beam_engraver |
580 { | 580 { |
581 TRANSLATOR_DECLARATIONS (Grace_auto_beam_engraver); | 581 TRANSLATOR_DECLARATIONS (Grace_auto_beam_engraver); |
582 TRANSLATOR_INHERIT (Auto_beam_engraver) | 582 TRANSLATOR_INHERIT (Auto_beam_engraver) |
583 DECLARE_TRANSLATOR_LISTENER (beam_forbid); | |
584 | 583 |
585 private: | 584 private: |
586 Moment last_grace_start_; // Full starting time of last grace group | 585 Moment last_grace_start_; // Full starting time of last grace group |
587 Moment last_grace_position_; // Measure position of same | 586 Moment last_grace_position_; // Measure position of same |
588 virtual void process_music (); | 587 virtual void process_music (); |
589 virtual bool is_same_grace_state (Moment, Moment); | 588 virtual bool is_same_grace_state (Moment, Moment); |
590 virtual bool test_moment (Direction, Moment, Moment); | 589 virtual bool test_moment (Direction, Moment, Moment); |
591 }; | 590 }; |
592 | 591 |
593 Grace_auto_beam_engraver::Grace_auto_beam_engraver () | 592 Grace_auto_beam_engraver::Grace_auto_beam_engraver () |
594 { | 593 { |
595 last_grace_start_.main_part_.set_infinite (-1); | 594 last_grace_start_.main_part_.set_infinite (-1); |
596 // grace_part_ is zero -> test_moment is false, last_grace_position_ | 595 // grace_part_ is zero -> test_moment is false, last_grace_position_ |
597 // not considered. | 596 // not considered. |
598 } | 597 } |
599 | 598 |
600 void | |
601 Grace_auto_beam_engraver::listen_beam_forbid (Stream_event *ev) | |
602 { | |
603 Auto_beam_engraver::listen_beam_forbid (ev); | |
604 } | |
605 | |
606 bool | 599 bool |
607 Grace_auto_beam_engraver::is_same_grace_state (Moment, Moment) | 600 Grace_auto_beam_engraver::is_same_grace_state (Moment, Moment) |
608 { | 601 { |
609 // This is for ignoring interspersed grace notes in main note | 602 // This is for ignoring interspersed grace notes in main note |
610 // beaming. We never want to ignore something inside of grace note | 603 // beaming. We never want to ignore something inside of grace note |
611 // beaming, so return true. | 604 // beaming, so return true. |
612 return true; | 605 return true; |
613 } | 606 } |
614 | 607 |
615 void | 608 void |
(...skipping 22 matching lines...) Expand all Loading... |
638 // Autobeam start only when at the start of the grace group. | 631 // Autobeam start only when at the start of the grace group. |
639 if (dir == START) | 632 if (dir == START) |
640 return last_grace_position_ == test_mom; | 633 return last_grace_position_ == test_mom; |
641 // Autobeam end only when the grace part is finished. | 634 // Autobeam end only when the grace part is finished. |
642 return !test_mom.grace_part_; | 635 return !test_mom.grace_part_; |
643 } | 636 } |
644 | 637 |
645 void | 638 void |
646 Grace_auto_beam_engraver::boot () | 639 Grace_auto_beam_engraver::boot () |
647 { | 640 { |
648 ADD_LISTENER (Grace_auto_beam_engraver, beam_forbid); | 641 ADD_LISTENER (Auto_beam_engraver, beam_forbid); |
649 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, stem); | 642 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, stem); |
650 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, bar_line); | 643 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, bar_line); |
651 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, beam); | 644 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, beam); |
652 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, breathing_sign); | 645 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, breathing_sign); |
653 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, rest); | 646 ADD_ACKNOWLEDGER (Grace_auto_beam_engraver, rest); |
654 } | 647 } |
655 | 648 |
656 ADD_TRANSLATOR (Grace_auto_beam_engraver, | 649 ADD_TRANSLATOR (Grace_auto_beam_engraver, |
657 /* doc */ | 650 /* doc */ |
658 "Generates one autobeam group across an entire grace phrase. " | 651 "Generates one autobeam group across an entire grace phrase. " |
659 " As usual, any manual beaming or @code{\\noBeam} will block" | 652 " As usual, any manual beaming or @code{\\noBeam} will block" |
660 " autobeaming, just like setting the context property" | 653 " autobeaming, just like setting the context property" |
661 " @samp{autoBeaming} to @code{##f}.", | 654 " @samp{autoBeaming} to @code{##f}.", |
662 | 655 |
663 /* create */ | 656 /* create */ |
664 "Beam ", | 657 "Beam ", |
665 | 658 |
666 /* read */ | 659 /* read */ |
667 "autoBeaming ", | 660 "autoBeaming ", |
668 | 661 |
669 /* write */ | 662 /* write */ |
670 "" | 663 "" |
671 ); | 664 ); |
OLD | NEW |