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) 2000--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 2000--2012 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 At the start of a piece, we don't print any repeat bars. | 73 At the start of a piece, we don't print any repeat bars. |
74 */ | 74 */ |
75 if (!now_mom ().main_part_) | 75 if (!now_mom ().main_part_) |
76 return; | 76 return; |
77 | 77 |
78 SCM cs = get_property ("repeatCommands"); | 78 SCM cs = get_property ("repeatCommands"); |
79 | 79 |
80 string s = ""; | 80 string s = ""; |
81 bool start = false; | 81 bool start = false; |
82 bool end = false; | 82 bool end = false; |
| 83 bool segno = false; |
83 bool volta_found = false; | 84 bool volta_found = false; |
84 while (scm_is_pair (cs)) | 85 while (scm_is_pair (cs)) |
85 { | 86 { |
86 SCM command = scm_car (cs); | 87 SCM command = scm_car (cs); |
87 if (command == ly_symbol2scm ("start-repeat")) | 88 if (command == ly_symbol2scm ("start-repeat")) |
88 start = true; | 89 start = true; |
89 else if (command == ly_symbol2scm ("end-repeat")) | 90 else if (command == ly_symbol2scm ("end-repeat")) |
90 end = true; | 91 end = true; |
| 92 else if (command == ly_symbol2scm ("segno-display")) |
| 93 segno = true; |
91 else if (scm_is_pair (command) && scm_car (command) == ly_symbol2scm ("vol
ta")) | 94 else if (scm_is_pair (command) && scm_car (command) == ly_symbol2scm ("vol
ta")) |
92 volta_found = true; | 95 volta_found = true; |
93 cs = scm_cdr (cs); | 96 cs = scm_cdr (cs); |
94 } | 97 } |
95 | 98 |
96 if (start && end) | 99 /* |
97 s = robust_scm2string (get_property ("doubleRepeatType"), ":|:"); | 100 Select which bar type to set |
98 else if (start) | 101 */ |
99 s = robust_scm2string (get_property ("startRepeatType"), "|:"); | 102 if (segno) |
100 else if (end) | 103 if (start) |
101 s = robust_scm2string (get_property ("endRepeatType"), ":|"); | 104 if (end) // { segno, start, end } |
| 105 s = robust_scm2string (get_property ("doubleRepeatSegnoType"), ":|S|:"); |
| 106 else // { segno, start } |
| 107 s = robust_scm2string (get_property ("startRepeatSegnoType"), ".S|:"); |
| 108 else |
| 109 if (end) // { segno, end } |
| 110 s = robust_scm2string (get_property ("endRepeatSegnoType"), ":|S"); |
| 111 else // { segno } |
| 112 s = robust_scm2string (get_property ("segnoType"), "S"); |
| 113 else |
| 114 if (start) |
| 115 if (end) // { start, end } |
| 116 s = robust_scm2string (get_property ("doubleRepeatType"), ":|:"); |
| 117 else // { start } |
| 118 s = robust_scm2string (get_property ("startRepeatType"), "|:"); |
| 119 else |
| 120 if (end) // { end } |
| 121 s = robust_scm2string (get_property ("endRepeatType"), ":|"); |
102 | 122 |
103 /* | 123 /* |
104 TODO: line breaks might be allowed if we set whichBar to "". | 124 TODO: line breaks might be allowed if we set whichBar to "". |
105 */ | 125 */ |
106 | 126 |
107 /* | 127 /* |
108 We only set the barline if we wouldn't overwrite a previously set | 128 We only set the barline if we wouldn't overwrite a previously set |
109 barline. | 129 barline. |
110 */ | 130 */ |
111 SCM wb = get_property ("whichBar"); | 131 SCM wb = get_property ("whichBar"); |
112 SCM db = get_property ("defaultBarType"); | 132 SCM db = get_property ("defaultBarType"); |
113 if (!scm_is_string (wb) || ly_is_equal (db, wb)) | 133 if (!scm_is_string (wb) || ly_is_equal (db, wb)) |
114 { | 134 { |
115 if (s != "" || (volta_found && !scm_is_string (wb))) | 135 if (s != "" || (volta_found && !scm_is_string (wb))) |
116 context ()->set_property ("whichBar", ly_string2scm (s)); | 136 context ()->set_property ("whichBar", ly_string2scm (s)); |
117 } | 137 } |
118 } | 138 } |
119 | 139 |
120 ADD_TRANSLATOR (Repeat_acknowledge_engraver, | 140 ADD_TRANSLATOR (Repeat_acknowledge_engraver, |
121 /* doc */ | 141 /* doc */ |
122 "Acknowledge repeated music, and convert the contents of" | 142 "Acknowledge repeated music, and convert the contents of" |
123 " @code{repeatCommands} into an appropriate setting for" | 143 " @code{repeatCommands} into an appropriate setting for" |
124 " @code{whichBar}.", | 144 " @code{whichBar}.", |
125 | 145 |
126 /* create */ | 146 /* create */ |
127 "", | 147 "", |
128 | 148 |
129 /* read */ | 149 /* read */ |
130 "doubleRepeatType " | 150 "doubleRepeatType " |
| 151 "startRepeatType " |
| 152 "endRepeatType " |
| 153 "doubleRepeatSegnoType " |
| 154 "startRepeatSegnoType " |
| 155 "endRepeatSegnoType " |
| 156 "segnoType " |
131 "repeatCommands " | 157 "repeatCommands " |
132 "whichBar ", | 158 "whichBar ", |
133 | 159 |
134 /* write */ | 160 /* write */ |
135 "" | 161 "" |
136 ); | 162 ); |
OLD | NEW |