Resolved issue #716. Command line option to create *tiled* export.
--HG-- branch : develop
This commit is contained in:
parent
e56e59dec1
commit
c074318d65
|
@ -9,6 +9,7 @@
|
||||||
- [#712] Default seam allowance setting.
|
- [#712] Default seam allowance setting.
|
||||||
- [#630] Improve export: upgrade to DXF r14 format.
|
- [#630] Improve export: upgrade to DXF r14 format.
|
||||||
- [#669] Improve export: export labels as text in DXF.
|
- [#669] Improve export: export labels as text in DXF.
|
||||||
|
- [#716] Command line option to create *tiled* export.
|
||||||
|
|
||||||
# Version 0.5.1
|
# Version 0.5.1
|
||||||
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
||||||
|
|
5
dist/OBS_debian/debian.valentina.1
vendored
5
dist/OBS_debian/debian.valentina.1
vendored
|
@ -68,7 +68,10 @@ The path to output destination folder. By default the directory at which the app
|
||||||
.BR "*" " AutoCAD DXF 2010 (flat) files (*.dxf) = 13,"
|
.BR "*" " AutoCAD DXF 2010 (flat) files (*.dxf) = 13,"
|
||||||
.RE
|
.RE
|
||||||
.RS
|
.RS
|
||||||
.BR "*" " AutoCAD DXF 2013 (flat) files (*.dxf) = 14."
|
.BR "*" " AutoCAD DXF 2013 (flat) files (*.dxf) = 14,"
|
||||||
|
.RE
|
||||||
|
.RS
|
||||||
|
.BR "*" " PDF tiled files (*.pdf) = 33."
|
||||||
.RE
|
.RE
|
||||||
.IP "--bdxf"
|
.IP "--bdxf"
|
||||||
.RB "Export dxf in binary form."
|
.RB "Export dxf in binary form."
|
||||||
|
|
5
dist/debian/valentina.1
vendored
5
dist/debian/valentina.1
vendored
|
@ -68,7 +68,10 @@ The path to output destination folder. By default the directory at which the app
|
||||||
.BR "*" " AutoCAD DXF 2010 (flat) files (*.dxf) = 13,"
|
.BR "*" " AutoCAD DXF 2010 (flat) files (*.dxf) = 13,"
|
||||||
.RE
|
.RE
|
||||||
.RS
|
.RS
|
||||||
.BR "*" " AutoCAD DXF 2013 (flat) files (*.dxf) = 14."
|
.BR "*" " AutoCAD DXF 2013 (flat) files (*.dxf) = 14,"
|
||||||
|
.RE
|
||||||
|
.RS
|
||||||
|
.BR "*" " PDF tiled files (*.pdf) = 33."
|
||||||
.RE
|
.RE
|
||||||
.IP "--bdxf"
|
.IP "--bdxf"
|
||||||
.RB "Export dxf in binary form."
|
.RB "Export dxf in binary form."
|
||||||
|
|
|
@ -87,6 +87,13 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
|
||||||
{
|
{
|
||||||
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
||||||
}
|
}
|
||||||
|
#ifdef V_NO_ASSERT // Temporarily unavailable
|
||||||
|
const int index = ui->comboBoxFormat->findData(LayoutExportFormats::OBJ);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxFormat->removeItem(index);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
|
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
|
||||||
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
|
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
|
||||||
connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
|
@ -176,6 +183,7 @@ void DialogSaveLayout::SetBinaryDXFFormat(bool binary)
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::SVG:
|
case LayoutExportFormats::SVG:
|
||||||
case LayoutExportFormats::PDF:
|
case LayoutExportFormats::PDF:
|
||||||
|
case LayoutExportFormats::PDFTiled:
|
||||||
case LayoutExportFormats::PNG:
|
case LayoutExportFormats::PNG:
|
||||||
case LayoutExportFormats::OBJ:
|
case LayoutExportFormats::OBJ:
|
||||||
case LayoutExportFormats::PS:
|
case LayoutExportFormats::PS:
|
||||||
|
@ -221,6 +229,7 @@ bool DialogSaveLayout::IsBinaryDXFFormat() const
|
||||||
return ui->checkBoxBinaryDXF->isChecked();
|
return ui->checkBoxBinaryDXF->isChecked();
|
||||||
case LayoutExportFormats::SVG:
|
case LayoutExportFormats::SVG:
|
||||||
case LayoutExportFormats::PDF:
|
case LayoutExportFormats::PDF:
|
||||||
|
case LayoutExportFormats::PDFTiled:
|
||||||
case LayoutExportFormats::PNG:
|
case LayoutExportFormats::PNG:
|
||||||
case LayoutExportFormats::OBJ:
|
case LayoutExportFormats::OBJ:
|
||||||
case LayoutExportFormats::PS:
|
case LayoutExportFormats::PS:
|
||||||
|
@ -344,6 +353,8 @@ QString DialogSaveLayout::ExportFormatDescription(LayoutExportFormats format)
|
||||||
return QString("AutoCAD DXF 2010 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
return QString("AutoCAD DXF 2010 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||||
return QString("AutoCAD DXF 2013 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
return QString("AutoCAD DXF 2013 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||||
|
case LayoutExportFormats::PDFTiled:
|
||||||
|
return QString("PDF tiled %1 (*.pdf)").arg(filesStr);
|
||||||
default:
|
default:
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
@ -357,6 +368,7 @@ QString DialogSaveLayout::ExportFromatSuffix(LayoutExportFormats format)
|
||||||
case LayoutExportFormats::SVG:
|
case LayoutExportFormats::SVG:
|
||||||
return ".svg";
|
return ".svg";
|
||||||
case LayoutExportFormats::PDF:
|
case LayoutExportFormats::PDF:
|
||||||
|
case LayoutExportFormats::PDFTiled:
|
||||||
return ".pdf";
|
return ".pdf";
|
||||||
case LayoutExportFormats::PNG:
|
case LayoutExportFormats::PNG:
|
||||||
return ".png";
|
return ".png";
|
||||||
|
@ -511,6 +523,7 @@ void DialogSaveLayout::ShowExample()
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::SVG:
|
case LayoutExportFormats::SVG:
|
||||||
case LayoutExportFormats::PDF:
|
case LayoutExportFormats::PDF:
|
||||||
|
case LayoutExportFormats::PDFTiled:
|
||||||
case LayoutExportFormats::PNG:
|
case LayoutExportFormats::PNG:
|
||||||
case LayoutExportFormats::OBJ:
|
case LayoutExportFormats::OBJ:
|
||||||
case LayoutExportFormats::PS:
|
case LayoutExportFormats::PS:
|
||||||
|
@ -588,9 +601,7 @@ QVector<std::pair<QString, LayoutExportFormats> > DialogSaveLayout::InitFormats(
|
||||||
InitFormat(LayoutExportFormats::SVG);
|
InitFormat(LayoutExportFormats::SVG);
|
||||||
InitFormat(LayoutExportFormats::PDF);
|
InitFormat(LayoutExportFormats::PDF);
|
||||||
InitFormat(LayoutExportFormats::PNG);
|
InitFormat(LayoutExportFormats::PNG);
|
||||||
#ifndef V_NO_ASSERT // Temporarily unavailable
|
|
||||||
InitFormat(LayoutExportFormats::OBJ);
|
InitFormat(LayoutExportFormats::OBJ);
|
||||||
#endif
|
|
||||||
if (SupportPSTest())
|
if (SupportPSTest())
|
||||||
{
|
{
|
||||||
InitFormat(LayoutExportFormats::PS);
|
InitFormat(LayoutExportFormats::PS);
|
||||||
|
@ -625,6 +636,7 @@ QVector<std::pair<QString, LayoutExportFormats> > DialogSaveLayout::InitFormats(
|
||||||
// InitFormat(LayoutExportFormats::DXF_AC1021_ASTM);
|
// InitFormat(LayoutExportFormats::DXF_AC1021_ASTM);
|
||||||
// InitFormat(LayoutExportFormats::DXF_AC1024_ASTM);
|
// InitFormat(LayoutExportFormats::DXF_AC1024_ASTM);
|
||||||
// InitFormat(LayoutExportFormats::DXF_AC1027_ASTM);
|
// InitFormat(LayoutExportFormats::DXF_AC1027_ASTM);
|
||||||
|
InitFormat(LayoutExportFormats::PDFTiled);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ enum class LayoutExportFormats : char
|
||||||
DXF_AC1021_ASTM = 30, /* ACAD 2007. */
|
DXF_AC1021_ASTM = 30, /* ACAD 2007. */
|
||||||
DXF_AC1024_ASTM = 31, /* ACAD 2010. */
|
DXF_AC1024_ASTM = 31, /* ACAD 2010. */
|
||||||
DXF_AC1027_ASTM = 32, /* ACAD 2013. */
|
DXF_AC1027_ASTM = 32, /* ACAD 2013. */
|
||||||
|
PDFTiled = 33,
|
||||||
COUNT /*Use only for validation*/
|
COUNT /*Use only for validation*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3343,7 +3343,6 @@ void MainWindow::SetLayoutModeActions()
|
||||||
ui->actionExportAs->setEnabled(enabled);
|
ui->actionExportAs->setEnabled(enabled);
|
||||||
ui->actionPrintPreview->setEnabled(enabled);
|
ui->actionPrintPreview->setEnabled(enabled);
|
||||||
ui->actionPrintPreviewTiled->setEnabled(enabled);
|
ui->actionPrintPreviewTiled->setEnabled(enabled);
|
||||||
ui->actionSaveAsTiledPDF->setEnabled(enabled);
|
|
||||||
ui->actionPrint->setEnabled(enabled);
|
ui->actionPrint->setEnabled(enabled);
|
||||||
ui->actionPrintTiled->setEnabled(enabled);
|
ui->actionPrintTiled->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
@ -4013,7 +4012,6 @@ void MainWindow::CreateActions()
|
||||||
connect(ui->actionExportAs, &QAction::triggered, this, &MainWindow::ExportLayoutAs);
|
connect(ui->actionExportAs, &QAction::triggered, this, &MainWindow::ExportLayoutAs);
|
||||||
connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin);
|
connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin);
|
||||||
connect(ui->actionPrintPreviewTiled, &QAction::triggered, this, &MainWindow::PrintPreviewTiled);
|
connect(ui->actionPrintPreviewTiled, &QAction::triggered, this, &MainWindow::PrintPreviewTiled);
|
||||||
connect(ui->actionSaveAsTiledPDF, &QAction::triggered, this, &MainWindow::SaveAsTiledPDF);
|
|
||||||
connect(ui->actionPrint, &QAction::triggered, this, &MainWindow::PrintOrigin);
|
connect(ui->actionPrint, &QAction::triggered, this, &MainWindow::PrintOrigin);
|
||||||
connect(ui->actionPrintTiled, &QAction::triggered, this, &MainWindow::PrintTiled);
|
connect(ui->actionPrintTiled, &QAction::triggered, this, &MainWindow::PrintTiled);
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-32</y>
|
<y>0</y>
|
||||||
<width>127</width>
|
<width>127</width>
|
||||||
<height>358</height>
|
<height>358</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -401,7 +401,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>127</width>
|
<width>140</width>
|
||||||
<height>110</height>
|
<height>110</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -510,7 +510,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>127</width>
|
<width>140</width>
|
||||||
<height>248</height>
|
<height>248</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -772,7 +772,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>127</width>
|
<width>140</width>
|
||||||
<height>248</height>
|
<height>248</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1121,7 +1121,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>326</height>
|
<height>328</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
@ -1512,7 +1512,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>326</height>
|
<height>328</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
@ -1626,7 +1626,6 @@
|
||||||
<addaction name="actionPrintPreview"/>
|
<addaction name="actionPrintPreview"/>
|
||||||
<addaction name="actionPrint"/>
|
<addaction name="actionPrint"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionSaveAsTiledPDF"/>
|
|
||||||
<addaction name="actionPrintPreviewTiled"/>
|
<addaction name="actionPrintPreviewTiled"/>
|
||||||
<addaction name="actionPrintTiled"/>
|
<addaction name="actionPrintTiled"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
@ -2420,24 +2419,6 @@
|
||||||
<enum>QAction::NoRole</enum>
|
<enum>QAction::NoRole</enum>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSaveAsTiledPDF">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/pdf.png</normaloff>:/icon/32x32/pdf.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Save as tiled PDF</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Split and save a layout into smaller pages</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionPrint">
|
<action name="actionPrint">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -2674,8 +2655,8 @@
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="share/resources/toolicon.qrc"/>
|
|
||||||
<include location="../../libs/vmisc/share/resources/icon.qrc"/>
|
<include location="../../libs/vmisc/share/resources/icon.qrc"/>
|
||||||
|
<include location="share/resources/toolicon.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -202,13 +202,15 @@ void MainWindowsNoGUI::ErrorConsoleMode(const LayoutErrors &state)
|
||||||
void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
||||||
{
|
{
|
||||||
const QString path = dialog.Path();
|
const QString path = dialog.Path();
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
dir.setPath(path);
|
dir.setPath(path);
|
||||||
if (not dir.exists(path))
|
if (not dir.exists(path))
|
||||||
{
|
{
|
||||||
if (not dir.mkpath(path))
|
usedNotExistedDir = dir.mkpath(".");
|
||||||
|
if (not usedNotExistedDir)
|
||||||
{
|
{
|
||||||
qCritical() << tr("Can't create path");
|
qCritical() << tr("Can't create a path");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,126 +218,135 @@ void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
||||||
const QString mask = dialog.FileName();
|
const QString mask = dialog.FileName();
|
||||||
const LayoutExportFormats format = dialog.Format();
|
const LayoutExportFormats format = dialog.Format();
|
||||||
|
|
||||||
for (int i=0; i < scenes.size(); ++i)
|
if (format == LayoutExportFormats::PDFTiled)
|
||||||
{
|
{
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
const QString name = path + QLatin1String("/") + mask + QString::number(1)
|
||||||
if (paper)
|
+ DialogSaveLayout::ExportFromatSuffix(format);
|
||||||
|
PdfTiledFile(name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i=0; i < scenes.size(); ++i)
|
||||||
{
|
{
|
||||||
const QString name = path + QLatin1String("/") + mask+QString::number(i+1)
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
+ DialogSaveLayout::ExportFromatSuffix(format);
|
if (paper)
|
||||||
QBrush *brush = new QBrush();
|
|
||||||
brush->setColor( QColor( Qt::white ) );
|
|
||||||
scenes[i]->setBackgroundBrush( *brush );
|
|
||||||
shadows[i]->setVisible(false);
|
|
||||||
paper->setPen(QPen(QBrush(Qt::white, Qt::NoBrush), 0.1, Qt::NoPen));
|
|
||||||
|
|
||||||
switch (format)
|
|
||||||
{
|
{
|
||||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
const QString name = path + QLatin1String("/") + mask+QString::number(i+1)
|
||||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
+ DialogSaveLayout::ExportFromatSuffix(format);
|
||||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
QBrush *brush = new QBrush();
|
||||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
brush->setColor( QColor( Qt::white ) );
|
||||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
scenes[i]->setBackgroundBrush( *brush );
|
||||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
shadows[i]->setVisible(false);
|
||||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
paper->setPen(QPen(QBrush(Qt::white, Qt::NoBrush), 0.1, Qt::NoPen));
|
||||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
switch (format)
|
||||||
case LayoutExportFormats::DXF_AC1006_ASTM:
|
{
|
||||||
case LayoutExportFormats::DXF_AC1009_ASTM:
|
case LayoutExportFormats::PDFTiled: // Handled separately
|
||||||
case LayoutExportFormats::DXF_AC1012_ASTM:
|
case LayoutExportFormats::DXF_AC1006_AAMA:
|
||||||
case LayoutExportFormats::DXF_AC1014_ASTM:
|
case LayoutExportFormats::DXF_AC1009_AAMA:
|
||||||
case LayoutExportFormats::DXF_AC1015_ASTM:
|
case LayoutExportFormats::DXF_AC1012_AAMA:
|
||||||
case LayoutExportFormats::DXF_AC1018_ASTM:
|
case LayoutExportFormats::DXF_AC1014_AAMA:
|
||||||
case LayoutExportFormats::DXF_AC1021_ASTM:
|
case LayoutExportFormats::DXF_AC1015_AAMA:
|
||||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
case LayoutExportFormats::DXF_AC1018_AAMA:
|
||||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
case LayoutExportFormats::DXF_AC1021_AAMA:
|
||||||
Q_UNREACHABLE(); // For now not supported
|
case LayoutExportFormats::DXF_AC1024_AAMA:
|
||||||
case LayoutExportFormats::SVG:
|
case LayoutExportFormats::DXF_AC1027_AAMA:
|
||||||
paper->setVisible(false);
|
case LayoutExportFormats::DXF_AC1006_ASTM:
|
||||||
SvgFile(name, i);
|
case LayoutExportFormats::DXF_AC1009_ASTM:
|
||||||
paper->setVisible(true);
|
case LayoutExportFormats::DXF_AC1012_ASTM:
|
||||||
break;
|
case LayoutExportFormats::DXF_AC1014_ASTM:
|
||||||
case LayoutExportFormats::PDF:
|
case LayoutExportFormats::DXF_AC1015_ASTM:
|
||||||
PdfFile(name, i);
|
case LayoutExportFormats::DXF_AC1018_ASTM:
|
||||||
break;
|
case LayoutExportFormats::DXF_AC1021_ASTM:
|
||||||
case LayoutExportFormats::PNG:
|
case LayoutExportFormats::DXF_AC1024_ASTM:
|
||||||
PngFile(name, i);
|
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||||
break;
|
Q_UNREACHABLE(); // For now not supported
|
||||||
case LayoutExportFormats::OBJ:
|
case LayoutExportFormats::SVG:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
ObjFile(name, i);
|
SvgFile(name, i);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PS:
|
case LayoutExportFormats::PDF:
|
||||||
PsFile(name, i);
|
PdfFile(name, i);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::EPS:
|
case LayoutExportFormats::PNG:
|
||||||
EpsFile(name, i);
|
PngFile(name, i);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
case LayoutExportFormats::OBJ:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1006, dialog.IsBinaryDXFFormat(), i);
|
ObjFile(name, i);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
case LayoutExportFormats::PS:
|
||||||
paper->setVisible(false);
|
PsFile(name, i);
|
||||||
DxfFile(name, DRW::AC1009, dialog.IsBinaryDXFFormat(), i);
|
break;
|
||||||
paper->setVisible(true);
|
case LayoutExportFormats::EPS:
|
||||||
break;
|
EpsFile(name, i);
|
||||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
break;
|
||||||
paper->setVisible(false);
|
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||||
DxfFile(name, DRW::AC1012, dialog.IsBinaryDXFFormat(), i);
|
paper->setVisible(false);
|
||||||
paper->setVisible(true);
|
DxfFile(name, DRW::AC1006, dialog.IsBinaryDXFFormat(), i);
|
||||||
break;
|
paper->setVisible(true);
|
||||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
break;
|
||||||
paper->setVisible(false);
|
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||||
DxfFile(name, DRW::AC1014, dialog.IsBinaryDXFFormat(), i);
|
paper->setVisible(false);
|
||||||
paper->setVisible(true);
|
DxfFile(name, DRW::AC1009, dialog.IsBinaryDXFFormat(), i);
|
||||||
break;
|
paper->setVisible(true);
|
||||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
break;
|
||||||
paper->setVisible(false);
|
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||||
DxfFile(name, DRW::AC1015, dialog.IsBinaryDXFFormat(), i);
|
paper->setVisible(false);
|
||||||
paper->setVisible(true);
|
DxfFile(name, DRW::AC1012, dialog.IsBinaryDXFFormat(), i);
|
||||||
break;
|
paper->setVisible(true);
|
||||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
break;
|
||||||
paper->setVisible(false);
|
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||||
DxfFile(name, DRW::AC1018, dialog.IsBinaryDXFFormat(), i);
|
paper->setVisible(false);
|
||||||
paper->setVisible(true);
|
DxfFile(name, DRW::AC1014, dialog.IsBinaryDXFFormat(), i);
|
||||||
break;
|
paper->setVisible(true);
|
||||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
break;
|
||||||
paper->setVisible(false);
|
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||||
DxfFile(name, DRW::AC1021, dialog.IsBinaryDXFFormat(), i);
|
paper->setVisible(false);
|
||||||
paper->setVisible(true);
|
DxfFile(name, DRW::AC1015, dialog.IsBinaryDXFFormat(), i);
|
||||||
break;
|
paper->setVisible(true);
|
||||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
break;
|
||||||
paper->setVisible(false);
|
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||||
DxfFile(name, DRW::AC1024, dialog.IsBinaryDXFFormat(), i);
|
paper->setVisible(false);
|
||||||
paper->setVisible(true);
|
DxfFile(name, DRW::AC1018, dialog.IsBinaryDXFFormat(), i);
|
||||||
break;
|
paper->setVisible(true);
|
||||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
break;
|
||||||
paper->setVisible(false);
|
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||||
DxfFile(name, DRW::AC1027, dialog.IsBinaryDXFFormat(), i);
|
paper->setVisible(false);
|
||||||
paper->setVisible(true);
|
DxfFile(name, DRW::AC1021, dialog.IsBinaryDXFFormat(), i);
|
||||||
break;
|
paper->setVisible(true);
|
||||||
default:
|
break;
|
||||||
qDebug() << "Can't recognize file suffix." << Q_FUNC_INFO;
|
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||||
break;
|
paper->setVisible(false);
|
||||||
|
DxfFile(name, DRW::AC1024, dialog.IsBinaryDXFFormat(), i);
|
||||||
|
paper->setVisible(true);
|
||||||
|
break;
|
||||||
|
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||||
|
paper->setVisible(false);
|
||||||
|
DxfFile(name, DRW::AC1027, dialog.IsBinaryDXFFormat(), i);
|
||||||
|
paper->setVisible(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qDebug() << "Can't recognize file suffix." << Q_FUNC_INFO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
paper->setPen(QPen(Qt::black, 1));
|
||||||
|
brush->setColor( QColor( Qt::gray ) );
|
||||||
|
brush->setStyle( Qt::SolidPattern );
|
||||||
|
scenes[i]->setBackgroundBrush( *brush );
|
||||||
|
shadows[i]->setVisible(true);
|
||||||
|
delete brush;
|
||||||
}
|
}
|
||||||
paper->setPen(QPen(Qt::black, 1));
|
|
||||||
brush->setColor( QColor( Qt::gray ) );
|
|
||||||
brush->setStyle( Qt::SolidPattern );
|
|
||||||
scenes[i]->setBackgroundBrush( *brush );
|
|
||||||
shadows[i]->setVisible(true);
|
|
||||||
delete brush;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
if (usedNotExistedDir)
|
||||||
void MainWindowsNoGUI::SaveAsTiledPDF()
|
{
|
||||||
{
|
QDir directory(dir);
|
||||||
isTiled = true;
|
directory.rmpath(".");
|
||||||
SaveLayoutAs();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -749,6 +760,33 @@ void MainWindowsNoGUI::PdfFile(const QString &name, int i) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindowsNoGUI::PdfTiledFile(const QString &name)
|
||||||
|
{
|
||||||
|
isTiled = true;
|
||||||
|
|
||||||
|
if (isLayoutStale)
|
||||||
|
{
|
||||||
|
if (ContinueIfLayoutStale() == QMessageBox::No)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QPrinter printer;
|
||||||
|
SetPrinterSettings(&printer, PrintType::PrintPDF);
|
||||||
|
printer.setPageSize(QPrinter::A4);// Want to be sure that page size is correct.
|
||||||
|
|
||||||
|
// Call IsPagesFit after setting a printer settings and check if pages is not bigger than printer's paper size
|
||||||
|
if (not isTiled && not IsPagesFit(printer.paperRect().size()))
|
||||||
|
{
|
||||||
|
qWarning()<<tr("Pages will be cropped because they do not fit printer paper size.");
|
||||||
|
}
|
||||||
|
|
||||||
|
printer.setOutputFileName(name);
|
||||||
|
printer.setResolution(static_cast<int>(PrintDPI));
|
||||||
|
PrintPages( &printer );
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief EpsFile save layout to eps file.
|
* @brief EpsFile save layout to eps file.
|
||||||
|
@ -974,58 +1012,6 @@ void MainWindowsNoGUI::RestoreTextAfterDXF(const QString &placeholder) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void MainWindowsNoGUI::SaveLayoutAs()
|
|
||||||
{
|
|
||||||
if (isLayoutStale)
|
|
||||||
{
|
|
||||||
if (ContinueIfLayoutStale() == QMessageBox::No)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QPrinter printer;
|
|
||||||
SetPrinterSettings(&printer, PrintType::PrintPDF);
|
|
||||||
printer.setPageSize(QPrinter::A4);// Want to be sure that page size is correct.
|
|
||||||
|
|
||||||
// Call IsPagesFit after setting a printer settings and check if pages is not bigger than printer's paper size
|
|
||||||
if (not isTiled && not IsPagesFit(printer.paperRect().size()))
|
|
||||||
{
|
|
||||||
qWarning()<<tr("Pages will be cropped because they do not fit printer paper size.");
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString dir = qApp->ValentinaSettings()->GetPathLayout();
|
|
||||||
bool usedNotExistedDir = false;
|
|
||||||
QDir directory(dir);
|
|
||||||
if (not directory.exists())
|
|
||||||
{
|
|
||||||
usedNotExistedDir = directory.mkpath(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
|
|
||||||
dir + QLatin1String("/") + FileName() + QLatin1String(".pdf"),
|
|
||||||
tr("PDF file (*.pdf)"), nullptr, QFileDialog::DontUseNativeDialog);
|
|
||||||
if (not fileName.isEmpty())
|
|
||||||
{
|
|
||||||
QFileInfo f( fileName );
|
|
||||||
if(f.suffix().isEmpty())
|
|
||||||
{
|
|
||||||
fileName.append(".pdf");
|
|
||||||
}
|
|
||||||
qApp->ValentinaSettings()->SetPathLayout(f.absolutePath());
|
|
||||||
|
|
||||||
printer.setOutputFileName(fileName);
|
|
||||||
printer.setResolution(static_cast<int>(PrintDPI));
|
|
||||||
PrintPages( &printer );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usedNotExistedDir)
|
|
||||||
{
|
|
||||||
QDir directory(dir);
|
|
||||||
directory.rmpath(".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::PrintPreview()
|
void MainWindowsNoGUI::PrintPreview()
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,6 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ToolLayoutSettings(bool checked);
|
void ToolLayoutSettings(bool checked);
|
||||||
void SaveAsTiledPDF();
|
|
||||||
void PrintPreviewOrigin();
|
void PrintPreviewOrigin();
|
||||||
void PrintPreviewTiled();
|
void PrintPreviewTiled();
|
||||||
void PrintOrigin();
|
void PrintOrigin();
|
||||||
|
@ -117,6 +116,7 @@ private:
|
||||||
void SvgFile(const QString &name, int i)const;
|
void SvgFile(const QString &name, int i)const;
|
||||||
void PngFile(const QString &name, int i)const;
|
void PngFile(const QString &name, int i)const;
|
||||||
void PdfFile(const QString &name, int i)const;
|
void PdfFile(const QString &name, int i)const;
|
||||||
|
void PdfTiledFile(const QString &name);
|
||||||
void EpsFile(const QString &name, int i)const;
|
void EpsFile(const QString &name, int i)const;
|
||||||
void PsFile(const QString &name, int i)const;
|
void PsFile(const QString &name, int i)const;
|
||||||
void PdfToPs(const QStringList ¶ms)const;
|
void PdfToPs(const QStringList ¶ms)const;
|
||||||
|
@ -129,7 +129,6 @@ private:
|
||||||
void PrepareTextForDXF(const QString &placeholder) const;
|
void PrepareTextForDXF(const QString &placeholder) const;
|
||||||
void RestoreTextAfterDXF(const QString &placeholder) const;
|
void RestoreTextAfterDXF(const QString &placeholder) const;
|
||||||
|
|
||||||
void SaveLayoutAs();
|
|
||||||
void PrintPreview();
|
void PrintPreview();
|
||||||
void LayoutPrint();
|
void LayoutPrint();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user