Skip to content

Commit

Permalink
Merge pull request #2837 from Jojo-Schmitz/print
Browse files Browse the repository at this point in the history
fix #125791: in continuous mode only first page of score gets printed
  • Loading branch information
lasconic committed Sep 23, 2016
2 parents d5950ac + 8746d18 commit 37dff57
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions mscore/file.cpp
Expand Up @@ -1470,6 +1470,12 @@ QString MuseScore::getDrumsetFilename(bool open)

void MuseScore::printFile()
{
LayoutMode layoutMode = cs->layoutMode();
if (layoutMode != LayoutMode::PAGE) {
cs->setLayoutMode(LayoutMode::PAGE);
cs->doLayout();
}

QPrinter printerDev(QPrinter::HighResolution);
const PageFormat* pf = cs->pageFormat();
QPageSize ps(QPageSize::id(pf->size(), QPageSize::Inch));
Expand Down Expand Up @@ -1498,42 +1504,36 @@ void MuseScore::printFile()

QPrintDialog pd(&printerDev, 0);

if (!pd.exec())
return;

LayoutMode layoutMode = cs->layoutMode();
if (layoutMode != LayoutMode::PAGE) {
cs->setLayoutMode(LayoutMode::PAGE);
cs->doLayout();
}

QPainter p(&printerDev);
p.setRenderHint(QPainter::Antialiasing, true);
p.setRenderHint(QPainter::TextAntialiasing, true);
double mag = printerDev.logicalDpiX() / DPI;

p.scale(mag, mag);

int fromPage = printerDev.fromPage() - 1;
int toPage = printerDev.toPage() - 1;
if (fromPage < 0)
fromPage = 0;
if ((toPage < 0) || (toPage >= pages))
toPage = pages - 1;
if (pd.exec()) {
QPainter p(&printerDev);
p.setRenderHint(QPainter::Antialiasing, true);
p.setRenderHint(QPainter::TextAntialiasing, true);
double mag = printerDev.logicalDpiX() / DPI;

for (int copy = 0; copy < printerDev.numCopies(); ++copy) {
bool firstPage = true;
for (int n = fromPage; n <= toPage; ++n) {
if (!firstPage)
printerDev.newPage();
firstPage = false;
p.scale(mag, mag);

cs->print(&p, n);
if ((copy + 1) < printerDev.numCopies())
printerDev.newPage();
int fromPage = printerDev.fromPage() - 1;
int toPage = printerDev.toPage() - 1;
if (fromPage < 0)
fromPage = 0;
if ((toPage < 0) || (toPage >= pages))
toPage = pages - 1;

for (int copy = 0; copy < printerDev.numCopies(); ++copy) {
bool firstPage = true;
for (int n = fromPage; n <= toPage; ++n) {
if (!firstPage)
printerDev.newPage();
firstPage = false;

cs->print(&p, n);
if ((copy + 1) < printerDev.numCopies())
printerDev.newPage();
}
}
p.end();
}
p.end();

if (layoutMode != cs->layoutMode()) {
cs->setLayoutMode(layoutMode);
cs->doLayout();
Expand Down

0 comments on commit 37dff57

Please sign in to comment.