Skip to content

Commit

Permalink
Init ChordList before importing
Browse files Browse the repository at this point in the history
  • Loading branch information
cbjeukendrup committed Jul 21, 2023
1 parent 684be7c commit c055595
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/project/internal/notationproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,26 +286,34 @@ mu::Ret NotationProject::doImport(const io::path_t& path, const io::path_t& styl
options[INotationReader::OptionKey::ForceMode] = Val(forceMode);
}

// Read(import) master score
// Setup engraving project
mu::engraving::ScoreLoad sl;
m_engravingProject->setFileInfoProvider(std::make_shared<ProjectFileInfoProvider>(this));
mu::engraving::MasterScore* score = m_engravingProject->masterScore();

// The order of the steps matches the order in MS3
// (see https://github.com/musescore/MuseScore/blob/2513676e512d29d554cb6c4d37d3efaf53ea2c5b/mscore/file.cpp#L2260)

// Load style if present
if (!stylePath.empty()) {
score->loadStyle(stylePath.toQString());
}

// Init ChordList
score->checkChordList();

// Read (import) master score
Ret ret = scoreReader->read(score, path, options);
if (!ret) {
return ret;
}

// Setup master score
// Setup master score post-reading
ret = m_engravingProject->setupMasterScore(forceMode);
if (!ret) {
return ret;
}

// Load style if present
if (!stylePath.empty()) {
score->loadStyle(stylePath.toQString());
}

// Setup audio settings
m_projectAudioSettings->makeDefault();

Expand Down

0 comments on commit c055595

Please sign in to comment.