Skip to content

Commit

Permalink
remove export EPS and PS, change fotomode dragmode to SVG
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Jul 17, 2013
1 parent 88e4ac8 commit c728166
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 41 deletions.
20 changes: 6 additions & 14 deletions mscore/file.cpp
Expand Up @@ -1455,7 +1455,6 @@ bool MuseScore::exportFile()
fl.append(tr("Compressed MusicXML Format (*.mxl)"));
fl.append(tr("Standard MIDI File (*.mid)"));
fl.append(tr("PDF File (*.pdf)"));
fl.append(tr("PostScript File (*.ps)"));
fl.append(tr("PNG Bitmap Graphic (*.png)"));
fl.append(tr("Scalable Vector Graphic (*.svg)"));
#ifdef HAS_AUDIOFILE
Expand Down Expand Up @@ -1509,7 +1508,6 @@ bool MuseScore::exportParts()
fl.append(tr("Compressed MusicXML Format (*.mxl)"));
fl.append(tr("Standard MIDI File (*.mid)"));
fl.append(tr("PDF File (*.pdf)"));
fl.append(tr("PostScript File (*.ps)"));
fl.append(tr("PNG Bitmap Graphic (*.png)"));
fl.append(tr("Scalable Vector Graphic (*.svg)"));
#ifdef HAS_AUDIOFILE
Expand Down Expand Up @@ -1615,14 +1613,8 @@ bool MuseScore::saveAs(Score* cs, bool saveCopy, const QString& path, const QStr
}
else if (ext == "pdf") {
// save as pdf file *.pdf
rv = savePsPdf(cs, fn, QPrinter::PdfFormat);
rv = savePdf(cs, fn);
}
#if QT_VERSION < 0x050000
else if (ext == "ps") {
// save as postscript file *.ps
rv = savePsPdf(cs, fn, QPrinter::PostScriptFormat);
}
#endif
else if (ext == "png") {
// save as png file *.png
rv = savePng(cs, fn);
Expand Down Expand Up @@ -1666,15 +1658,15 @@ bool MuseScore::saveMidi(Score* score, const QString& name)
}

//---------------------------------------------------------
// savePsPdf
// savePdf
//---------------------------------------------------------

bool MuseScore::savePsPdf(const QString& saveName, QPrinter::OutputFormat format)
bool MuseScore::savePdf(const QString& saveName)
{
return savePsPdf(cs, saveName, format);
return savePdf(cs, saveName);
}

bool MuseScore::savePsPdf(Score* cs, const QString& saveName, QPrinter::OutputFormat format)
bool MuseScore::savePdf(Score* cs, const QString& saveName)
{
QPrinter printerDev(QPrinter::HighResolution);
const PageFormat* pf = cs->pageFormat();
Expand All @@ -1685,7 +1677,7 @@ bool MuseScore::savePsPdf(Score* cs, const QString& saveName, QPrinter::OutputFo
printerDev.setColorMode(QPrinter::Color);
printerDev.setDocName(cs->name());
printerDev.setDoubleSidedPrinting(pf->twosided());
printerDev.setOutputFormat(format);
printerDev.setOutputFormat(QPrinter::PdfFormat);

printerDev.setOutputFileName(saveName);
QPainter p(&printerDev);
Expand Down
32 changes: 12 additions & 20 deletions mscore/fotomode.cpp
Expand Up @@ -705,7 +705,6 @@ bool ScoreView::saveFotoAs(bool printMode, const QRectF& r)
QStringList fl;
fl.append(tr("PNG Bitmap Graphic (*.png)"));
fl.append(tr("PDF File (*.pdf)"));
fl.append(tr("Encapsulated PostScript File (*.eps)"));
fl.append(tr("Scalable Vector Graphic (*.svg)"));

QString selectedFilter;
Expand All @@ -726,7 +725,7 @@ bool ScoreView::saveFotoAs(bool printMode, const QRectF& r)
int idx = fl.indexOf(selectedFilter);
if (idx != -1) {
static const char* extensions[] = {
"png", "pdf", "eps", "svg"
"png", "pdf", "svg"
};
ext = extensions[idx];
}
Expand All @@ -748,7 +747,7 @@ bool ScoreView::saveFotoAs(bool printMode, const QRectF& r)
int w = lrint(r.width() * mag);
int h = lrint(r.height() * mag);

if (ext == "pdf" || ext == "eps") {
if (ext == "pdf") {
QPrinter printer(QPrinter::HighResolution);
mag = printer.logicalDpiX() / MScore::DPI;
printer.setPaperSize(QSizeF(r.width() * mag, r.height() * mag) , QPrinter::DevicePixel);
Expand All @@ -759,10 +758,6 @@ bool ScoreView::saveFotoAs(bool printMode, const QRectF& r)
printer.setOutputFileName(fn);
if (ext == "pdf")
printer.setOutputFormat(QPrinter::PdfFormat);
#if QT_VERSION < 0x050000
else
printer.setOutputFormat(QPrinter::PostScriptFormat);
#endif
QPainter p(&printer);
paintRect(printMode, p, r, mag);
}
Expand Down Expand Up @@ -833,7 +828,7 @@ void ScoreView::fotoDragDrop(QMouseEvent*)
bool printMode = true;
QRectF r(_foto->rect());

QTemporaryFile tf(QDir::tempPath() + QString("/imgXXXXXX.eps"));
QTemporaryFile tf(QDir::tempPath() + QString("/imgXXXXXX.svg"));
tf.setAutoRemove(false);
tf.open();
tf.close();
Expand All @@ -842,18 +837,15 @@ void ScoreView::fotoDragDrop(QMouseEvent*)
// QString fn = "/home/ws/mops.eps";
QString fn = tf.fileName();

QPrinter printer(QPrinter::HighResolution);
double mag = printer.logicalDpiX() / MScore::DPI;
printer.setPaperSize(QSizeF(r.width() * mag, r.height() * mag) , QPrinter::DevicePixel);

printer.setCreator("MuseScore Version: " VERSION);
printer.setFullPage(true);
printer.setColorMode(QPrinter::Color);
printer.setDocName(fn);
printer.setOutputFileName(fn);
#if QT_VERSION < 0x050000
printer.setOutputFormat(QPrinter::PostScriptFormat);
#endif
SvgGenerator printer;
double convDpi = preferences.pngResolution;
double mag = convDpi / MScore::DPI;
printer.setResolution(int(convDpi));
printer.setFileName(fn);
printer.setSize(QSize(r.width() * mag, r.height() * mag));
printer.setViewBox(QRect(0, 0, r.width() * mag, r.height() * mag));
printer.setDescription("created with MuseScore " VERSION);

QPainter p(&printer);
paintRect(printMode, p, r, mag);

Expand Down
6 changes: 1 addition & 5 deletions mscore/musescore.cpp
Expand Up @@ -2099,11 +2099,7 @@ static bool processNonGui()
if (fn.endsWith(".mid"))
return mscore->saveMidi(cs, fn);
if (fn.endsWith(".pdf"))
return mscore->savePsPdf(fn, QPrinter::PdfFormat);
#if QT_VERSION < 0x050000
if (fn.endsWith(".ps"))
return mscore->savePsPdf(fn, QPrinter::PostScriptFormat);
#endif
return mscore->savePdf(fn);
if (fn.endsWith(".png"))
return mscore->savePng(cs, fn);
if (fn.endsWith(".svg"))
Expand Down
4 changes: 2 additions & 2 deletions mscore/musescore.h
Expand Up @@ -576,8 +576,8 @@ class MuseScore : public QMainWindow, public MuseScoreCore {
bool exportFile();
bool exportParts();
bool saveAs(Score*, bool saveCopy, const QString& path, const QString& ext);
bool savePsPdf(const QString& saveName, QPrinter::OutputFormat format);
bool savePsPdf(Score* cs, const QString& saveName, QPrinter::OutputFormat format);
bool savePdf(const QString& saveName);
bool savePdf(Score* cs, const QString& saveName);

Score* readScore(const QString& name);

Expand Down

0 comments on commit c728166

Please sign in to comment.