LEFT | RIGHT |
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) 2011 Mike Solomon <mike@apollinemike.com> | 4 Copyright (C) 2011 Mike Solomon <mike@apollinemike.com> |
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 |
11 LilyPond is distributed in the hope that it will be useful, | 11 LilyPond is distributed in the hope that it will be useful, |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. | 17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. |
18 */ | 18 */ |
19 | 19 |
20 #include <map> | 20 #include <map> |
21 #include <algorithm> | 21 #include <algorithm> |
22 | 22 |
23 #include "grob.hh" | 23 #include "grob.hh" |
24 #include "item.hh" | 24 #include "item.hh" |
25 #include "pointer-group-interface.hh" | 25 #include "pointer-group-interface.hh" |
| 26 #include "pure-from-neighbor-interface.hh" |
26 #include "engraver.hh" | 27 #include "engraver.hh" |
27 | 28 |
28 class Pure_from_neighbor_engraver : public Engraver | 29 class Pure_from_neighbor_engraver : public Engraver |
29 { | 30 { |
30 vector<Grob *> items_then_; | 31 vector<Grob *> items_then_; |
31 vector<Grob *> items_now_; | 32 vector<Grob *> items_now_; |
32 vector<Grob *> pures_then_; | 33 vector<Grob *> pures_then_; |
33 vector<Grob *> pures_now_; | 34 vector<Grob *> pures_now_; |
34 SCM pure_relevant_p_; | |
35 | 35 |
36 public: | 36 public: |
37 TRANSLATOR_DECLARATIONS (Pure_from_neighbor_engraver); | 37 TRANSLATOR_DECLARATIONS (Pure_from_neighbor_engraver); |
38 protected: | 38 protected: |
39 DECLARE_ACKNOWLEDGER (pure_from_neighbor); | 39 DECLARE_ACKNOWLEDGER (pure_from_neighbor); |
40 DECLARE_ACKNOWLEDGER (item); | 40 DECLARE_ACKNOWLEDGER (item); |
41 void stop_translation_timestep (); | 41 void stop_translation_timestep (); |
42 }; | 42 }; |
43 | 43 |
44 Pure_from_neighbor_engraver::Pure_from_neighbor_engraver () | 44 Pure_from_neighbor_engraver::Pure_from_neighbor_engraver () |
45 { | 45 { |
46 pure_relevant_p_ = ly_lily_module_constant ("pure-relevant?"); | |
47 } | 46 } |
48 | 47 |
49 void | 48 void |
50 Pure_from_neighbor_engraver::acknowledge_item (Grob_info i) | 49 Pure_from_neighbor_engraver::acknowledge_item (Grob_info i) |
51 { | 50 { |
52 if (to_boolean (scm_apply_1 (pure_relevant_p_, i.item ()->self_scm (), SCM_EOL
)) | 51 SCM pure_relevant_p = ly_lily_module_constant ("pure-relevant?"); |
53 && !i.grob ()->internal_has_interface (ly_symbol2scm ("pure-from-neighbor-
interface"))) | 52 if (!Pure_from_neighbor_interface::has_interface (i.grob ()) |
| 53 && to_boolean (scm_call_1 (pure_relevant_p, i.item ()->self_scm ()))) |
54 items_now_.push_back (i.item ()); | 54 items_now_.push_back (i.item ()); |
55 } | 55 } |
56 | 56 |
57 // note that this can get outta hand if there are lots of vertical axis groups..
. | 57 // note that this can get out of hand if there are lots of vertical axis groups.
.. |
58 | 58 |
59 void | 59 void |
60 Pure_from_neighbor_engraver::acknowledge_pure_from_neighbor (Grob_info i) | 60 Pure_from_neighbor_engraver::acknowledge_pure_from_neighbor (Grob_info i) |
61 { | 61 { |
62 pures_now_.push_back (i.item ()); | 62 pures_now_.push_back (i.item ()); |
63 } | 63 } |
64 | 64 |
65 void | 65 void |
66 Pure_from_neighbor_engraver::stop_translation_timestep () | 66 Pure_from_neighbor_engraver::stop_translation_timestep () |
67 { | 67 { |
(...skipping 27 matching lines...) Expand all Loading... |
95 | 95 |
96 /* create */ | 96 /* create */ |
97 "", | 97 "", |
98 | 98 |
99 /* read */ | 99 /* read */ |
100 "", | 100 "", |
101 | 101 |
102 /* write */ | 102 /* write */ |
103 "" | 103 "" |
104 ); | 104 ); |
LEFT | RIGHT |