Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(13)

Side by Side Diff: lily/fingering-engraver.cc

Issue 573670043: Refactor get/set_property to take the item as first argument
Patch Set: Manual completion of patch set Created 4 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lily/fingering-column-engraver.cc ('k') | lily/flag.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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) 1998--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> 4 Copyright (C) 1998--2020 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 void 79 void
80 Fingering_engraver::acknowledge_note_column (Grob_info inf) 80 Fingering_engraver::acknowledge_note_column (Grob_info inf)
81 { 81 {
82 /* set NoteColumn as parent */ 82 /* set NoteColumn as parent */
83 /* and X-align on main noteheads */ 83 /* and X-align on main noteheads */
84 for (vsize i = 0; i < fingerings_.size (); i++) 84 for (vsize i = 0; i < fingerings_.size (); i++)
85 { 85 {
86 Grob *t = fingerings_[i]; 86 Grob *t = fingerings_[i];
87 t->set_parent (inf.grob (), X_AXIS); 87 t->set_parent (inf.grob (), X_AXIS);
88 t->set_property ("X-align-on-main-noteheads", SCM_BOOL_T); 88 set_property (t, "X-align-on-main-noteheads", SCM_BOOL_T);
89 } 89 }
90 } 90 }
91 91
92 void 92 void
93 Fingering_engraver::process_music () 93 Fingering_engraver::process_music ()
94 { 94 {
95 for (vsize i = events_.size (); i--;) 95 for (vsize i = events_.size (); i--;)
96 { 96 {
97 SCM dir = events_[i]->get_property ("direction"); 97 SCM dir = get_property (events_[i], "direction");
98 make_script (to_dir (dir), events_[i], i); 98 make_script (to_dir (dir), events_[i], i);
99 } 99 }
100 } 100 }
101 101
102 void 102 void
103 Fingering_engraver::make_script (Direction d, Stream_event *r, size_t i) 103 Fingering_engraver::make_script (Direction d, Stream_event *r, size_t i)
104 { 104 {
105 Item *fingering = make_item ("Fingering", r->self_scm ()); 105 Item *fingering = make_item ("Fingering", r->self_scm ());
106 106
107 /* 107 /*
108 We can't fold these definitions into define-grobs since 108 We can't fold these definitions into define-grobs since
109 fingerings for chords need different settings. 109 fingerings for chords need different settings.
110 */ 110 */
111 Side_position_interface::set_axis (fingering, Y_AXIS); 111 Side_position_interface::set_axis (fingering, Y_AXIS);
112 Self_alignment_interface::set_aligned_on_parent (fingering, X_AXIS); 112 Self_alignment_interface::set_aligned_on_parent (fingering, X_AXIS);
113 113
114 /* See script-engraver.cc */ 114 /* See script-engraver.cc */
115 SCM priority = fingering->get_property ("script-priority"); 115 SCM priority = get_property (fingering, "script-priority");
116 if (!scm_is_number (priority)) 116 if (!scm_is_number (priority))
117 priority = scm_from_int (200); // TODO: Explain magic. 117 priority = scm_from_int (200); // TODO: Explain magic.
118 priority = scm_sum (priority, scm_from_size_t (i)); 118 priority = scm_sum (priority, scm_from_size_t (i));
119 fingering->set_property ("script-priority", priority); 119 set_property (fingering, "script-priority", priority);
120 120
121 if (d) 121 if (d)
122 fingering->set_property ("direction", scm_from_int (d)); 122 set_property (fingering, "direction", scm_from_int (d));
123 else if (!is_direction (fingering->get_property_data ("direction"))) 123 else if (!is_direction (get_property_data (fingering, "direction")))
124 fingering->set_property ("direction", scm_from_int (UP)); 124 set_property (fingering, "direction", scm_from_int (UP));
125 125
126 fingerings_.push_back (fingering); 126 fingerings_.push_back (fingering);
127 } 127 }
128 128
129 void 129 void
130 Fingering_engraver::stop_translation_timestep () 130 Fingering_engraver::stop_translation_timestep ()
131 { 131 {
132 fingerings_.clear (); 132 fingerings_.clear ();
133 events_.clear (); 133 events_.clear ();
134 } 134 }
(...skipping 19 matching lines...) Expand all
154 154
155 /* create */ 155 /* create */
156 "Fingering ", 156 "Fingering ",
157 157
158 /* read */ 158 /* read */
159 "", 159 "",
160 160
161 /* write */ 161 /* write */
162 "" 162 ""
163 ); 163 );
OLDNEW
« no previous file with comments | « lily/fingering-column-engraver.cc ('k') | lily/flag.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b