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) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 SCM to_type, | 49 SCM to_type, |
50 const string &to_id) | 50 const string &to_id) |
51 { | 51 { |
52 string result; // error message | 52 string result; // error message |
53 | 53 |
54 // Find the context that should have its parent changed. | 54 // Find the context that should have its parent changed. |
55 Context *last = find_context_above_by_parent_type (it.get_outlet (), to_type); | 55 Context *last = find_context_above_by_parent_type (it.get_outlet (), to_type); |
56 if (last) | 56 if (last) |
57 { | 57 { |
58 // Find the new parent. | 58 // Find the new parent. |
| 59 Input *origin = it.get_music ()->origin (); |
59 Context *dest = find_context_near (it.get_outlet (), to_type, to_id); | 60 Context *dest = find_context_near (it.get_outlet (), to_type, to_id); |
60 if (dest) | 61 if (dest) |
61 { | 62 { |
62 send_stream_event (last, "ChangeParent", it.get_music ()->origin (), | 63 send_stream_event (last, "ChangeParent", origin, |
63 ly_symbol2scm ("context"), dest->self_scm ()); | 64 ly_symbol2scm ("context"), dest->self_scm ()); |
64 } | 65 } |
65 else | 66 else |
66 /* FIXME: constant error message. */ | 67 Context::warning_cannot_find (origin, to_type, to_id); |
67 it.get_music ()->origin ()->warning (_ ("cannot find context to switch t
o")); | |
68 } | 68 } |
69 else if (it.get_outlet ()->is_alias (to_type)) | 69 else if (it.get_outlet ()->is_alias (to_type)) |
70 { | 70 { |
71 // No enclosing context of the right kind was found | 71 // No enclosing context of the right kind was found |
72 // and the iterator's immediate context is the kind that was sought. | 72 // and the iterator's immediate context is the kind that was sought. |
73 | 73 |
74 result = _f ("not changing to same context type: %s", ly_symbol2string (to
_type).c_str ()); | 74 result = _f ("not changing to same context type: %s", ly_symbol2string (to
_type).c_str ()); |
75 } | 75 } |
76 else | 76 else |
77 /* FIXME: incomprehensible message */ | 77 /* FIXME: incomprehensible message */ |
(...skipping 12 matching lines...) Expand all Loading... |
90 string to_id = ly_scm2string (get_music ()->get_property ("change-to-id")); | 90 string to_id = ly_scm2string (get_music ()->get_property ("change-to-id")); |
91 | 91 |
92 string msg = change_to (*this, to_type, to_id); | 92 string msg = change_to (*this, to_type, to_id); |
93 if (!msg.empty ()) | 93 if (!msg.empty ()) |
94 error (msg); | 94 error (msg); |
95 | 95 |
96 Simple_music_iterator::process (m); | 96 Simple_music_iterator::process (m); |
97 } | 97 } |
98 | 98 |
99 IMPLEMENT_CTOR_CALLBACK (Change_iterator); | 99 IMPLEMENT_CTOR_CALLBACK (Change_iterator); |
OLD | NEW |