Skip to content

Commit

Permalink
Merge pull request musescore#18377 from cbjeukendrup/export_pngsvg_fi…
Browse files Browse the repository at this point in the history
…x_filename_pagenumber

Fix exporting PNG or SVG files with multiple pages
  • Loading branch information
RomanPudashkin authored Jul 4, 2023
2 parents 10df39a + c4add76 commit 4012e0a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/project/internal/exportprojectscenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,24 @@ bool ExportProjectScenario::guessIsCreatingOnlyOneFile(const notation::INotation
switch (unitType) {
case INotationWriter::UnitType::PER_PAGE: {
if (notations.size() == 1) {
INotationPtr notation = notations.front();

// Check if it is not a potential (not-yet-initialized) excerpt
ExcerptNotationList potentialExcerpts = masterNotation()->potentialExcerpts();

auto it
= std::find_if(potentialExcerpts.cbegin(), potentialExcerpts.cend(),
[notation = notations.front()](const IExcerptNotationPtr& excerpt) {
auto it = std::find_if(potentialExcerpts.cbegin(), potentialExcerpts.cend(), [notation](const IExcerptNotationPtr& excerpt) {
return excerpt->notation() == notation;
});

if (it == potentialExcerpts.cend()) {
return notations.front()->elements()->pages().size();
ViewMode viewMode = notation->painting()->viewMode();
notation->painting()->setViewMode(ViewMode::PAGE);

bool onePage = notations.front()->elements()->pages().size() == 1;

notation->painting()->setViewMode(viewMode);

return onePage;
}
}

Expand Down

0 comments on commit 4012e0a

Please sign in to comment.