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) 2005--2015 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 2005--2015 Han-Wen Nienhuys <hanwen@xs4all.nl> |
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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 Grid_line_span_engraver::Grid_line_span_engraver (Context *c) | 38 Grid_line_span_engraver::Grid_line_span_engraver (Context *c) |
39 : Engraver (c) | 39 : Engraver (c) |
40 { | 40 { |
41 spanline_ = 0; | 41 spanline_ = 0; |
42 } | 42 } |
43 | 43 |
44 void | 44 void |
45 Grid_line_span_engraver::acknowledge_grid_point (Grob_info i) | 45 Grid_line_span_engraver::acknowledge_grid_point (Grob_info i) |
46 { | 46 { |
47 int depth = i.origin_contexts (this).size (); | 47 Item *it = dynamic_cast<Item *> (i.grob ()); |
48 if (depth) | 48 lines_.push_back (it); |
| 49 |
| 50 if (lines_.size () >= 2 && !spanline_) |
49 { | 51 { |
50 Item *it = dynamic_cast<Item *> (i.grob ()); | 52 spanline_ = make_item ("GridLine", SCM_EOL); |
51 lines_.push_back (it); | 53 spanline_->set_parent (lines_[0], X_AXIS); |
52 | |
53 if (lines_.size () >= 2 && !spanline_) | |
54 { | |
55 spanline_ = make_item ("GridLine", SCM_EOL); | |
56 spanline_->set_parent (lines_[0], X_AXIS); | |
57 } | |
58 } | 54 } |
59 } | 55 } |
60 | 56 |
61 void | 57 void |
62 Grid_line_span_engraver::stop_translation_timestep () | 58 Grid_line_span_engraver::stop_translation_timestep () |
63 { | 59 { |
64 if (spanline_) | 60 if (spanline_) |
65 { | 61 { |
66 for (vsize i = 0; i < lines_.size (); i++) | 62 for (vsize i = 0; i < lines_.size (); i++) |
67 Grid_line_interface::add_grid_point (spanline_, lines_[i]); | 63 Grid_line_interface::add_grid_point (spanline_, lines_[i]); |
(...skipping 16 matching lines...) Expand all Loading... |
84 | 80 |
85 /* create */ | 81 /* create */ |
86 "GridLine ", | 82 "GridLine ", |
87 | 83 |
88 /* read */ | 84 /* read */ |
89 "", | 85 "", |
90 | 86 |
91 /* write */ | 87 /* write */ |
92 "" | 88 "" |
93 ); | 89 ); |
OLD | NEW |