6565#include " pghead.h"
6666#include " reh.h"
6767#include " rend.h"
68+ #include " repeatmark.h"
6869#include " rest.h"
6970#include " sb.h"
7071#include " score.h"
@@ -2275,27 +2276,6 @@ void MusicXmlInput::ReadMusicXmlDirection(
22752276 }
22762277 }
22772278
2278- // Coda
2279- pugi::xml_node xmlCoda = typeNode.child (" coda" );
2280- if (xmlCoda) {
2281- Dir *dir = new Dir ();
2282- dir->SetPlace (dir->AttPlacementRelStaff ::StrToStaffrel (placeStr.c_str ()));
2283- dir->SetTstamp (timeStamp - 1.0 );
2284- dir->SetType (" coda" );
2285- dir->SetStaff (dir->AttStaffIdent ::StrToXsdPositiveIntegerList (" 1" ));
2286- if (xmlCoda.attribute (" id" )) dir->SetID (xmlCoda.attribute (" id" ).as_string ());
2287- Rend *rend = new Rend;
2288- rend->SetGlyphAuth (" smufl" );
2289- rend->SetFontstyle (FONTSTYLE_normal);
2290- rend->SetHalign (HORIZONTALALIGNMENT_center);
2291- Text *text = new Text ();
2292- std::u32string codaSign = UTF8to32 (" \xF0\x9D\x84\x8C " );
2293- text->SetText (codaSign);
2294- rend->AddChild (text);
2295- dir->AddChild (rend);
2296- m_controlElements.push_back ({ measureNum, dir });
2297- }
2298-
22992279 // Dashes (to be connected with previous <dir> or <dynam> as @extender and @tstamp2 attribute
23002280 pugi::xpath_node dashes = typeNode.select_node (" bracket|dashes" );
23012281 if (dashes) {
@@ -2425,6 +2405,22 @@ void MusicXmlInput::ReadMusicXmlDirection(
24252405 }
24262406 }
24272407
2408+ // Coda & Segno
2409+ pugi::xpath_node xmlJump = typeNode.select_node (" coda|segno" );
2410+ if (xmlJump && !containsWords) {
2411+ RepeatMark *mark = new RepeatMark ();
2412+ mark->SetPlace (mark->AttPlacementRelStaff ::StrToStaffrel (placeStr.c_str ()));
2413+ mark->SetTstamp (timeStamp);
2414+ mark->SetFunc (ConvertJumpType (xmlJump.node ().name ()));
2415+ mark->SetStaff (mark->AttStaffIdent ::StrToXsdPositiveIntegerList (" 1" ));
2416+ if (xmlJump.node ().attribute (" smufl" )) {
2417+ mark->SetGlyphAuth (" smufl" );
2418+ mark->SetGlyphName (xmlJump.node ().attribute (" smufl" ).as_string ());
2419+ }
2420+ if (xmlJump.node ().attribute (" id" )) mark->SetID (xmlJump.node ().attribute (" id" ).as_string ());
2421+ m_controlElements.push_back ({ measureNum, mark });
2422+ }
2423+
24282424 // Dynamics
24292425 if (containsDynamics) {
24302426 pugi::xpath_node_set dynamics = node.select_nodes (
@@ -2726,27 +2722,6 @@ void MusicXmlInput::ReadMusicXmlDirection(
27262722 m_controlElements.push_back ({ measureNum, reh });
27272723 }
27282724
2729- // Segno
2730- pugi::xml_node xmlSegno = typeNode.child (" segno" );
2731- if (xmlSegno) {
2732- Dir *dir = new Dir ();
2733- dir->SetPlace (dir->AttPlacementRelStaff ::StrToStaffrel (placeStr.c_str ()));
2734- dir->SetTstamp (timeStamp - 1.0 );
2735- dir->SetType (" segno" );
2736- dir->SetStaff (dir->AttStaffIdent ::StrToXsdPositiveIntegerList (" 1" ));
2737- if (xmlSegno.attribute (" id" )) dir->SetID (xmlSegno.attribute (" id" ).as_string ());
2738- Rend *rend = new Rend;
2739- rend->SetGlyphAuth (" smufl" );
2740- rend->SetFontstyle (FONTSTYLE_normal);
2741- rend->SetHalign (HORIZONTALALIGNMENT_center);
2742- Text *text = new Text ();
2743- std::u32string segnoSign = UTF8to32 (" \xF0\x9D\x84\x8B " );
2744- text->SetText (segnoSign);
2745- rend->AddChild (text);
2746- dir->AddChild (rend);
2747- m_controlElements.push_back ({ measureNum, dir });
2748- }
2749-
27502725 // Tempo
27512726 if (containsTempo) {
27522727 Tempo *tempo = new Tempo ();
@@ -2773,8 +2748,8 @@ void MusicXmlInput::ReadMusicXmlDirection(
27732748 }
27742749
27752750 // other cases
2776- if (!containsDynamics && !containsTempo && !containsWords && !xmlCoda && !bracket && !lead && !xmlSegno && !xmlShift
2777- && !xmlPedal && wedges.empty () && !dashes && !rehearsal) {
2751+ if (!containsDynamics && !containsTempo && !containsWords && !xmlJump && !bracket && !lead && !xmlShift && !xmlPedal
2752+ && wedges.empty () && !dashes && !rehearsal) {
27782753 LogWarning (" MusicXML import: Unsupported direction-type '%s'" , typeNode.first_child ().name ());
27792754 }
27802755
@@ -4559,6 +4534,21 @@ data_DURATION MusicXmlInput::ConvertTypeToDur(const std::string &value)
45594534 return DURATION_NONE;
45604535}
45614536
4537+ repeatMarkLog_FUNC MusicXmlInput::ConvertJumpType (const std::string &value)
4538+ {
4539+ static const std::map<std::string, repeatMarkLog_FUNC> Name2Jump{
4540+ { " coda" , repeatMarkLog_FUNC_coda }, //
4541+ { " segno" , repeatMarkLog_FUNC_segno }, //
4542+ };
4543+
4544+ const auto result = Name2Jump.find (value);
4545+ if (result != Name2Jump.end ()) {
4546+ return result->second ;
4547+ }
4548+
4549+ return repeatMarkLog_FUNC_NONE;
4550+ }
4551+
45624552data_TEXTRENDITION MusicXmlInput::ConvertEnclosure (const std::string &value)
45634553{
45644554 static const std::map<std::string, data_TEXTRENDITION> Enclosure2Id{
0 commit comments