55 #include "../vpatterndb/vcontainer.h"
56 #include "../vobj/vobjpaintdevice.h"
57 #include "../vdxf/vdxfpaintdevice.h"
59 #include "../vwidgets/vmaingraphicsscene.h"
60 #include "../vlayout/vlayoutgenerator.h"
63 #include "../vlayout/vposter.h"
64 #include "../vpatterndb/floatItemData/vpiecelabeldata.h"
65 #include "../vpatterndb/floatItemData/vpatternlabeldata.h"
66 #include "../vpatterndb/floatItemData/vgrainlinedata.h"
67 #include "../vpatterndb/measurements.h"
68 #include "../vtools/tools/vabstracttool.h"
69 #include "../vtools/tools/pattern_piece_tool.h"
71 #include <QFileDialog>
73 #include <QGraphicsScene>
74 #include <QMessageBox>
76 #include <QToolButton>
78 #include <QPrintPreviewDialog>
79 #include <QPrintDialog>
80 #include <QPrinterInfo>
81 #include <QImageWriter>
84 # define PDFTOPS "pdftops.exe"
86 # define PDFTOPS "pdftops"
93 bool usedNotExistedDir =
true;
96 if (not dir.exists(path))
98 usedNotExistedDir = dir.mkpath(
".");
100 return usedNotExistedDir;
105 if (usedNotExistedDir)
117 currentScene(nullptr),
118 tempSceneLayout(nullptr),
128 actionDockWidgetToolOptions(nullptr),
129 actionDockWidgetGroups(nullptr),
130 actionDockWidgetLayouts(nullptr),
131 actionDockWidgetToolbox(nullptr),
134 ignoreMargins(false),
164 if (layout.exec() == QDialog::Rejected)
166 tButton->setChecked(
false);
171 tButton->setChecked(
false);
175 tButton->setChecked(
true);
198 switch (lGenerator.
State())
216 QApplication::alert(
this);
224 QApplication::alert(
this);
241 qCritical() << tr(
"Couldn't prepare data for creation layout");
244 qCritical() << tr(
"One or more pattern pieces are bigger than the paper format you selected. Please select a bigger paper format.");
273 const QString name = QString(
"%1/%2_0%3%4")
276 .arg(QString::number(i+1))
279 QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(i));
307 const QMarginsF &margins)
309 const QString path = dialog.
path();
311 if (not usedNotExistedDir)
313 qCritical() << tr(
"Can't create a path");
317 qApp->Seamly2DSettings()->SetPathLayout(path);
322 const QString name = QString(
"%1/%2%3")
346 QScopedPointer<QGraphicsScene> scene(
new QGraphicsScene());
349 for (
int i=0; i <
pieceList.count(); ++i)
356 for (
int i=0; i < list.size(); ++i)
358 scene->addItem(list.at(i));
362 QRect rect = scene->itemsBoundingRect().toRect();
364 const int mx = rect.x();
365 const int my = rect.y();
367 QTransform transform;
368 transform = transform.translate(-mx, -my);
370 for (
int i=0; i < list.size(); ++i)
372 list.at(i)->setTransform(transform);
375 rect = scene->itemsBoundingRect().toRect();
377 QGraphicsRectItem *paper =
new QGraphicsRectItem(rect);
378 paper->setPen(QPen(Qt::black, 1));
379 paper->setBrush(QBrush(Qt::white));
391 QMarginsF(margin, margin, margin, margin));
398 const QString &name,
const QSize &size)
const
400 const QString path = dialog.
path();
402 if (not usedNotExistedDir)
404 qCritical() << tr(
"Can't create a path");
408 qApp->Seamly2DSettings()->SetPathLayout(path);
452 qDebug() <<
"Can't recognize file type." << Q_FUNC_INFO;
468 QScopedPointer<QGraphicsScene> scene(
new QGraphicsScene());
471 for (
int i=0; i <
pieceList.count(); ++i)
478 for (
int i=0; i < list.size(); ++i)
480 scene->addItem(list.at(i));
483 QRect rect = scene->itemsBoundingRect().toRect();
485 const int mx = rect.x();
486 const int my = rect.y();
488 QTransform transform;
489 transform = transform.translate(-mx, -my);
491 for (
int i=0; i < list.size(); ++i)
493 list.at(i)->setTransform(transform);
496 rect = scene->itemsBoundingRect().toRect();
498 for (
int i=0; i <
pieceList.count(); ++i)
500 QTransform moveTransform =
pieceList[i].getTransform();
501 moveTransform = moveTransform.translate(
pieceList.at(i).GetMx(),
pieceList.at(i).GetMy());
502 moveTransform = moveTransform.translate(-mx, -my);
503 pieceList[i].setTransform(moveTransform);
506 QString increment = QStringLiteral(
"");
509 increment = QStringLiteral(
"_01");
512 const QString name = QString(
"%1/%2%3%4")
528 const QRectF printerPageRect(0, 0,
ToPixel(printer->pageRect(QPrinter::Millimeter).width(),
Unit::Mm),
530 QRect pageRect = printer->pageLayout().paintRectPixels(printer->resolution());
531 const double xscale = pageRect.width() / printerPageRect.width();
532 const double yscale = pageRect.height() / printerPageRect.height();
533 const double scale = qMin(xscale, yscale);
536 if (not painter.begin(printer))
538 qWarning(
"failed to open file, is it writable?");
542 painter.setFont( QFont(
"Arial", 8, QFont::Normal ) );
543 painter.setRenderHint(QPainter::Antialiasing,
true);
544 painter.setPen(QPen(Qt::black,
widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
545 painter.setBrush ( QBrush ( Qt::NoBrush ) );
558 painter.translate(-
ToPixel(printer->pageRect(QPrinter::Millimeter).height(),
Unit::Mm), 0);
564 for (
int i=0; i <
scenes.size(); ++i)
567 auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(i));
575 count = poster->size();
583 int firstPage = printer->fromPage() - 1;
584 if (firstPage >= count)
593 int lastPage = printer->toPage() - 1;
594 if (lastPage == -1 || lastPage >= count)
596 lastPage = count - 1;
599 const int numPages = lastPage - firstPage + 1;
601 if (not printer->supportsMultipleCopies())
603 copyCount = printer->copyCount();
606 for (
int i = 0; i < copyCount; ++i)
608 for (
int j = 0; j < numPages; ++j)
610 if (i != 0 || j != 0)
612 if (not printer->newPage())
614 qWarning(
"failed in flushing page to disk, disk full?");
619 if (printer->pageOrder() == QPrinter::FirstPageFirst)
621 index = firstPage + j;
625 index = lastPage - j;
629 isTiled ? paperIndex =
static_cast<int>(poster->at(index).index) : paperIndex = index;
631 auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(paperIndex));
638 posterData = posterazor->Borders(paper, poster->at(index),
scenes.size());
645 isTiled ? source = poster->at(index).rect : source = paper->rect();
648 if(printer->fullPage())
650 QMarginsF printerMargins = printer->pageLayout().margins();
659 QRectF target(x * scale, y * scale, source.width() * scale, source.height() * scale);
661 scenes.at(paperIndex)->render(&painter, target, source, Qt::IgnoreAspectRatio);
666 qDeleteAll(posterData);
683 qCritical()<<tr(
"For previewing multipage document all sheet should have the same size.");
703 qCritical()<<tr(
"For printing multipages document all sheet should have the same size.");
726 while (i != list->constEnd())
730 tool->UpdatePatternLabel();
731 tool->UpdatePieceLabel();
745 while (i != list->constEnd())
749 tool->UpdateGrainline();
763 while (i != list->constEnd())
767 tool->RefreshGeometry();
780 while (i !=
pieces.constEnd())
796 tempSceneLayout->setBackgroundBrush( QBrush(QColor(Qt::gray), Qt::SolidPattern) );
803 QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(i));
806 const QRectF r = paper->rect();
808 image = QImage(QSize(
static_cast<qint32
>(r.width()),
static_cast<qint32
>(r.height())), QImage::Format_RGB32);
810 if (not image.isNull())
812 image.fill(Qt::white);
813 QPainter painter(&image);
814 painter.setFont( QFont(
"Arial", 8, QFont::Normal ) );
815 painter.setRenderHint(QPainter::Antialiasing,
true);
816 painter.setPen(QPen(Qt::black,
widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
817 painter.setBrush ( QBrush ( Qt::NoBrush ) );
818 scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
823 qWarning()<<
"Cannot create image. Size too big";
828 image = QImage(QSize(101, 146), QImage::Format_RGB32);
829 image.fill(Qt::white);
831 return QIcon(QBitmap::fromImage(image));
839 for (
int i=0; i<
papers.size(); ++i)
841 qreal x1=0, y1=0, x2=0, y2=0;
842 QGraphicsRectItem *item = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(i));
845 item->rect().getCoords(&x1, &y1, &x2, &y2);
846 QGraphicsRectItem *shadowPaper =
new QGraphicsRectItem(QRectF(x1+4, y1+4, x2+4, y2+4));
847 shadowPaper->setBrush(QBrush(Qt::black));
865 for (
int i=0; i<
papers.size(); ++i)
868 scene->setBackgroundBrush(QBrush(QColor(Qt::gray), Qt::SolidPattern));
870 scene->addItem(
papers.at(i));
873 for (
int i=0; i < item.size(); ++i)
875 scene->addItem(item.at(i));
891 QSvgGenerator generator;
892 generator.setFileName(name);
893 generator.setSize(paper->rect().size().toSize());
894 generator.setViewBox(paper->rect());
895 generator.setTitle(tr(
"Pattern"));
897 generator.setResolution(
static_cast<int>(
PrintDPI));
899 painter.begin(&generator);
900 painter.setFont( QFont(
"Arial", 8, QFont::Normal ) );
901 painter.setRenderHint(QPainter::Antialiasing,
true);
903 painter.setBrush ( QBrush ( Qt::NoBrush ) );
904 scene->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
915 QImage image(scene->sceneRect().size().toSize(), QImage::Format_ARGB32);
916 image.fill(Qt::transparent);
917 QPainter painter(&image);
918 painter.setFont(
qApp->Seamly2DSettings()->getLabelFont());
919 painter.setRenderHint(QPainter::Antialiasing,
true);
920 painter.setBrush ( QBrush ( Qt::NoBrush ) );
921 scene->render(&painter);
922 image.save(fileName,
"PNG",
qApp->Seamly2DSettings()->getExportQuality());
932 QImage image(scene->sceneRect().size().toSize(), QImage::Format_ARGB32);
933 image.fill(Qt::transparent);
934 QPainter painter(&image);
935 painter.setFont(
qApp->Seamly2DSettings()->getLabelFont());
936 painter.setRenderHint(QPainter::Antialiasing,
true);
937 painter.setBrush ( QBrush ( Qt::NoBrush ) );
938 scene->render(&painter);
941 writer.setFormat(
"TIF");
942 writer.setCompression(1);
943 writer.setFileName(fileName);
954 QImage image(scene->sceneRect().size().toSize(), QImage::Format_ARGB32);
955 image.fill(Qt::white);
956 QPainter painter(&image);
957 painter.setFont(
qApp->Seamly2DSettings()->getLabelFont());
958 painter.setRenderHint(QPainter::Antialiasing,
true);
959 painter.setBrush ( QBrush ( Qt::NoBrush ) );
960 scene->render(&painter);
961 image.save(fileName,
"JPG",
qApp->Seamly2DSettings()->getExportQuality());
971 QImage image(scene->sceneRect().size().toSize(), QImage::Format_ARGB32);
972 image.fill(Qt::white);
973 QPainter painter(&image);
974 painter.setFont(
qApp->Seamly2DSettings()->getLabelFont());
975 painter.setRenderHint(QPainter::Antialiasing,
true);
976 painter.setBrush ( QBrush ( Qt::NoBrush ) );
977 scene->render(&painter);
978 image.save(fileName,
"BMP",
qApp->Seamly2DSettings()->getExportQuality());
988 QImage image(scene->sceneRect().size().toSize(), QImage::Format_ARGB32);
989 image.fill(Qt::transparent);
990 QPainter painter(&image);
991 painter.setFont(
qApp->Seamly2DSettings()->getLabelFont());
992 painter.setRenderHint(QPainter::Antialiasing,
true);
993 painter.setBrush ( QBrush ( Qt::NoBrush ) );
994 scene->render(&painter);
995 image.save(fileName,
"PPM",
qApp->Seamly2DSettings()->getExportQuality());
1004 bool ignoreMargins,
const QMarginsF &margins)
const
1007 printer.setCreator(QGuiApplication::applicationDisplayName()+QLatin1String(
" ")+
1008 QCoreApplication::applicationVersion());
1009 printer.setOutputFormat(QPrinter::PdfFormat);
1010 printer.setOutputFileName(name);
1012 printer.setResolution(
static_cast<int>(
PrintDPI));
1013 printer.setPageOrientation(QPageLayout::Portrait);
1016 const QRectF sourceRect = paper->rect();
1017 const QRectF targetRect = QRectF(QPoint(0,0), QPoint(sourceRect.width(),sourceRect.height()));
1020 QPageSize pageSize(size, QPageSize::Unit::Millimeter);
1021 printer.setPageSize(pageSize);
1030 const bool success = printer.setPageMargins(QMarginsF(left, top, right, bottom), QPageLayout::Millimeter);
1033 qWarning() << tr(
"Cannot set printer margins");
1038 if (painter.begin(&printer) ==
false)
1040 qCritical(
"%s", qUtf8Printable(tr(
"Can't open printer %1").arg(name)));
1043 painter.setFont(QFont(
"Arial", 8, QFont::Normal));
1044 painter.setRenderHint(QPainter::Antialiasing,
true);
1045 painter.setPen(QPen(Qt::black,
widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
1046 painter.setBrush(QBrush(Qt::NoBrush));
1047 scene->render(&painter, targetRect, sourceRect, Qt::KeepAspectRatio);
1067 if (not
isTiled && not
IsPagesFit(printer.pageLayout().fullRectPixels(printer.resolution()).size()))
1069 qWarning()<<tr(
"Pages will be cropped because they do not fit printer paper size.");
1072 printer.setOutputFileName(name);
1073 printer.setResolution(
static_cast<int>(
PrintDPI));
1083 bool ignoreMargins,
const QMarginsF &margins)
const
1089 QStringList params = QStringList() <<
"-eps" << tmp.fileName() << name;
1100 ignoreMargins,
const QMarginsF &margins)
const
1106 QStringList params = QStringList() << tmp.fileName() << name;
1119 #ifndef QT_NO_CURSOR
1120 QGuiApplication::setOverrideCursor(Qt::WaitCursor);
1123 #if defined(Q_OS_MAC)
1125 proc.setWorkingDirectory(
qApp->applicationDirPath());
1126 proc.start(QLatin1String(
"./") +
PDFTOPS, params);
1130 if (proc.waitForStarted(15000))
1132 proc.waitForFinished(15000);
1134 #ifndef QT_NO_CURSOR
1135 QGuiApplication::restoreOverrideCursor();
1138 QFile f(params.last());
1139 if (f.exists() ==
false)
1141 const QString msg = tr(
"Creating file '%1' failed! %2").arg(params.last()).arg(proc.errorString());
1142 QMessageBox msgBox(QMessageBox::Critical, tr(
"Critical error!"), msg, QMessageBox::Ok | QMessageBox::Default);
1152 generator.
setSize(paper->rect().size().toSize());
1155 painter.begin(&generator);
1156 scene->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
1162 QT_WARNING_DISABLE_GCC(
"-Wswitch-default")
1164 void
MainWindowsNoGUI::FlatDxfFile(const QString &name,
int version,
bool binary, QGraphicsRectItem *paper,
1165 QGraphicsScene *scene, const
QList<
QList<QGraphicsItem *> > &pieces)
const
1170 generator.
setSize(paper->rect().size().toSize());
1172 generator.
SetVersion(
static_cast<DRW::Version
>(version));
1177 if (painter.begin(&generator))
1179 scene->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
1193 generator.
SetVersion(
static_cast<DRW::Version
>(version));
1204 auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(index));
1207 QBrush brush(Qt::white);
1208 scenes.at(index)->setBackgroundBrush(brush);
1209 shadows.at(index)->setVisible(
false);
1210 paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
1218 auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(index));
1223 QBrush brush(Qt::gray);
1224 scenes.at(index)->setBackgroundBrush(brush);
1225 shadows.at(index)->setVisible(
true);
1241 for (
int i = 0; i <
pieces.size(); ++i)
1244 for (
int j = 0; j < paperItems.size(); ++j)
1247 for (
int k = 0; k < pieceChildren.size(); ++k)
1249 QGraphicsItem *item = pieceChildren.at(k);
1250 if (item->type() == QGraphicsSimpleTextItem::Type)
1252 if(QGraphicsSimpleTextItem *textItem = qgraphicsitem_cast<QGraphicsSimpleTextItem *>(item))
1254 textItem->setText(textItem->text() + placeholder);
1274 for (
int i = 0; i <
pieces.size(); ++i)
1277 for (
int j = 0; j < paperItems.size(); ++j)
1280 for (
int k = 0; k < pieceChildren.size(); ++k)
1282 QGraphicsItem *item = pieceChildren.at(k);
1283 if (item->type() == QGraphicsSimpleTextItem::Type)
1285 if(QGraphicsSimpleTextItem *textItem = qgraphicsitem_cast<QGraphicsSimpleTextItem *>(item))
1287 QString text = textItem->text();
1288 text.replace(placeholder,
"");
1289 textItem->setText(text);
1309 if(info.isNull() || info.printerName().isEmpty())
1311 info = QPrinterInfo::defaultPrinter();
1314 if (printer.isNull())
1316 qCritical(
"%s\n\n%s", qUtf8Printable(tr(
"Print error")),
1317 qUtf8Printable(tr(
"Cannot proceed because there are no available printers in your system.")));
1322 printer->setResolution(
static_cast<int>(
PrintDPI));
1324 QPrintPreviewDialog preview(printer.data());
1341 if(info.isNull() || info.printerName().isEmpty())
1343 info = QPrinterInfo::defaultPrinter();
1346 if (printer.isNull())
1348 qCritical(
"%s\n\n%s", qUtf8Printable(tr(
"Print error")),
1349 qUtf8Printable(tr(
"Cannot proceed because there are no available printers in your system.")));
1354 QPrintDialog dialog(printer.data(),
this );
1356 dialog.setOption(QPrintDialog::PrintCurrentPage,
false);
1357 if ( dialog.exec() == QDialog::Accepted )
1359 printer->setResolution(
static_cast<int>(
PrintDPI));
1368 printer->setCreator(QGuiApplication::applicationDisplayName()+
" "+QCoreApplication::applicationVersion());
1369 printer->setPageOrientation(QPageLayout::Orientation::Portrait);
1376 auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(0));
1387 QPageSize pageSize(size, QPageSize::Unit::Millimeter);
1388 printer->setPageSize (pageSize);
1392 printer->setPageSize (pSZ);
1398 QSizeF size = QSizeF(
1404 printer->setPageSize(pSZ);
1409 printer->setFullPage(
true);
1412 qreal left, top, right, bottom;
1417 left = pageMargin.left();
1418 top = pageMargin.top();
1419 right = pageMargin.right();
1420 bottom = pageMargin.bottom();
1430 left = pageMargin.bottom();
1431 top = pageMargin.left();
1432 right = pageMargin.top();
1433 bottom = pageMargin.right();
1437 left = pageMargin.left();
1438 top = pageMargin.top();
1439 right = pageMargin.right();
1440 bottom = pageMargin.bottom();
1444 const bool success = printer->setPageMargins(QMarginsF(left, top, right, bottom), QPageLayout::Millimeter);
1447 qWarning() << tr(
"Cannot set printer margins");
1454 const QString outputFileName = QDir::homePath() + QDir::separator() +
FileName();
1456 printer->setOutputFileName(outputFileName);
1458 printer->setOutputFileName(outputFileName + QLatin1String(
".pdf"));
1462 printer->setOutputFormat(QPrinter::NativeFormat);
1464 printer->setOutputFormat(QPrinter::PdfFormat);
1469 printer->setOutputFileName(
"");
1470 printer->setOutputFormat(QPrinter::NativeFormat);
1479 IsLayoutGrayscale() ? printer->setColorMode(QPrinter::GrayScale) : printer->setColorMode(QPrinter::Color);
1485 const QRect target = QRect(0, 0, 100, 100);
1487 for (
int i=0; i <
scenes.size(); ++i)
1489 auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(i));
1496 QImage image(target.size(), QImage::Format_RGB32);
1497 image.fill(Qt::white);
1498 QPainter painter(&image);
1499 painter.setPen(QPen(Qt::black,
widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
1500 painter.setBrush ( QBrush ( Qt::NoBrush ) );
1501 scenes.at(i)->render(&painter, target, paper->rect(), Qt::KeepAspectRatio);
1507 if (not image.isGrayscale())
1525 if (size == QSizeF(841, 1189))
1527 return QPageSize(QPageSize::A0);
1530 if (size == QSizeF(594, 841))
1532 return QPageSize(QPageSize::A1);
1535 if (size == QSizeF(420, 594))
1537 return QPageSize(QPageSize::A2);
1540 if (size == QSizeF(297, 420))
1542 return QPageSize(QPageSize::A3);
1545 if (size == QSizeF(210, 297))
1547 return QPageSize(QPageSize::A4);
1550 if (size == QSizeF(215.9, 355.6))
1552 return QPageSize(QPageSize::Legal);
1555 if (size == QSizeF(215.9, 279.4))
1557 return QPageSize(QPageSize::Letter);
1572 auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(0));
1574 for (
int i=1; i <
papers.size(); ++i)
1576 auto *p = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(i));
1578 if (paper->rect() != p->rect())
1592 QGraphicsRectItem *p = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(0));
1594 const QSizeF pSize = p->rect().size();
1595 if (pSize.height() <= printPaper.height() && pSize.width() <= printPaper.width())
1607 const QMarginsF &margins)
const
1609 for (
int i=0; i <
scenes.size(); ++i)
1611 QString increment = QStringLiteral(
"");
1612 QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
papers.at(i));
1617 increment = QStringLiteral(
"_0") + QString::number(i+1);
1619 const QString name = QString(
"%1/%2%3%4")
1625 QBrush *brush =
new QBrush();
1626 brush->setColor( QColor( Qt::white ) );
1627 QGraphicsScene *scene =
scenes.at(i);
1628 scene->setBackgroundBrush( *brush );
1629 shadows[i]->setVisible(
false);
1630 paper->setPen(QPen(QBrush(Qt::white, Qt::NoBrush), 0.1, Qt::NoPen));
1635 paper->setVisible(
false);
1637 paper->setVisible(
true);
1658 paper->setVisible(
false);
1660 paper->setVisible(
true);
1669 paper->setVisible(
false);
1671 paper->setVisible(
true);
1674 paper->setVisible(
false);
1676 paper->setVisible(
true);
1679 paper->setVisible(
false);
1681 paper->setVisible(
true);
1684 paper->setVisible(
false);
1686 paper->setVisible(
true);
1689 paper->setVisible(
false);
1691 paper->setVisible(
true);
1694 paper->setVisible(
false);
1696 paper->setVisible(
true);
1699 paper->setVisible(
false);
1701 paper->setVisible(
true);
1704 paper->setVisible(
false);
1706 paper->setVisible(
true);
1709 paper->setVisible(
false);
1711 paper->setVisible(
true);
1714 qDebug() <<
"Can't recognize file type." << Q_FUNC_INFO;
1717 paper->setPen(QPen(Qt::black, 1));
1718 brush->setColor( QColor( Qt::gray ) );
1719 brush->setStyle( Qt::SolidPattern );
1720 scenes[i]->setBackgroundBrush( *brush );
1731 qApp->getFilePath().isEmpty() ? fileName = tr(
"unnamed") : fileName =
qApp->getFilePath();
1732 return QFileInfo(fileName).baseName();
1740 if (vars->contains(
size_M))
1765 QMessageBox msgBox(
this);
1766 msgBox.setIcon(QMessageBox::Question);
1767 msgBox.setWindowTitle(tr(
"The layout is stale."));
1768 msgBox.setText(tr(
"The layout was not updated since last pattern modification. Do you want to continue?"));
1769 msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
1770 msgBox.setDefaultButton(QMessageBox::No);
1771 QSpacerItem* horizontalSpacer =
new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
1772 QGridLayout* layout =
static_cast<QGridLayout*
>(msgBox.layout());
1774 layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
1775 return msgBox.exec();
void Error(const LayoutErrors &state)
QString SelectedPrinter() const
LayoutExportFormat format() const
bool isTextAsPaths() const
static QString exportFormatSuffix(LayoutExportFormat format)
bool isBinaryDXFFormat() const
void ExportApparelLayout(const ExportLayoutDialog &dialog, const QVector< VLayoutPiece > &pieces, const QString &name, const QSize &size) const
QGraphicsScene * tempSceneLayout
currentScene pointer to current scene.
virtual ~MainWindowsNoGUI() Q_DECL_OVERRIDE
void exportPPM(const QString &name, QGraphicsScene *scene) const
exportPPM save layout to gif file.
void PrepareTextForDXF(const QString &placeholder, const QList< QList< QGraphicsItem * > > &pieces) const
PrepareTextForDXF prepare QGraphicsSimpleTextItem items for export to flat dxf.
void exportSVG(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene) const
exportSVG save layout to svg file.
VContainer * pattern
pattern container with data (points, arcs, splines, spline paths, variables)
bool IsPagesFit(const QSizeF &printPaper) const
void ExportData(const QVector< VLayoutPiece > &pieceList, const ExportLayoutDialog &dialog)
void refreshLabels()
refreshLabels call to recalculate piece labels. For example after changing a font.
QVector< QVector< VLayoutPiece > > piecesOnLayout
void convertPdfToPs(const QStringList ¶ms) const
convertPdfToPs use external tool "pdftops" for converting pdf to eps or ps format.
MainWindowsNoGUI(QWidget *parent=nullptr)
void AAMADxfFile(const QString &name, int version, bool binary, const QSize &size, const QVector< VLayoutPiece > &pieces) const
void exportTIF(const QString &name, QGraphicsScene *scene) const
exportTIF save layout to tif file.
void exportJPG(const QString &name, QGraphicsScene *scene) const
exportJPG save layout to jpg file.
void FlatDxfFile(const QString &name, int version, bool binary, QGraphicsRectItem *paper, QGraphicsScene *scene, const QList< QList< QGraphicsItem * > > &pieces) const
void PreparePaper(int index) const
void ObjFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene) const
void exportEPS(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool ignoreMargins, const QMarginsF &margins) const
exportEPS( save layout to eps file.
void InitTempLayoutScene()
QList< QList< QGraphicsItem * > > pieces
QList< QGraphicsItem * > shadows
bool isPagesUniform() const
virtual void PrepareSceneList()=0
QPageSize FindQPrinterPageSize(const QSizeF &size) const
MainWindowsNoGUI::FindTemplate.
static QVector< VLayoutPiece > preparePiecesForLayout(const QHash< quint32, VPiece > &pieces)
void ExportFlatLayout(const ExportLayoutDialog &dialog, const QList< QGraphicsScene * > &scenes, const QList< QGraphicsItem * > &papers, const QList< QGraphicsItem * > &shadows, const QList< QList< QGraphicsItem * > > &pieces, bool ignoreMargins, const QMarginsF &margins)
QList< QGraphicsItem * > papers
doc dom document container
int ContinueIfLayoutStale()
QIcon ScenePreview(int i) const
void PrintPreviewOrigin()
void exportBMP(const QString &name, QGraphicsScene *scene) const
exportBMP save layout to bmp file.
bool IsLayoutGrayscale() const
void exportPNG(const QString &name, QGraphicsScene *scene) const
exportPNG save layout to png file.
QString layoutPrinterName
virtual void CleanLayout()=0
void exportPDF(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool ignoreMargins, const QMarginsF &margins) const
exportPDF save layout to pdf file.
QVector< VLayoutPiece > pieceList
void SetSizeHeightForIndividualM() const
void exportPiecesAsApparelLayout(const ExportLayoutDialog &dialog, QVector< VLayoutPiece > pieceList)
void RestorePaper(int index) const
void exportPS(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool ignoreMargins, const QMarginsF &margins) const
exportPS save layout to ps file.
void ErrorConsoleMode(const LayoutErrors &state)
void PrintPages(QPrinter *printer)
static QList< QGraphicsScene * > CreateScenes(const QList< QGraphicsItem * > &papers, const QList< QGraphicsItem * > &shadows, const QList< QList< QGraphicsItem * > > &pieces)
void exportPiecesAsFlatLayout(const ExportLayoutDialog &dialog, const QVector< VLayoutPiece > &pieceList)
bool LayoutSettings(VLayoutGenerator &lGenerator)
void toolLayoutSettings(QToolButton *tButton, bool checked)
void SetPrinterSettings(QPrinter *printer, const PrintType &printType)
QList< QGraphicsScene * > scenes
VPattern * doc
pattern container with data (points, arcs, splines, spline paths, variables)
void refreshSeamAllowances()
refreshSeamAllowances call to show / hide seam allowances.
static QList< QGraphicsItem * > CreateShadows(const QList< QGraphicsItem * > &papers)
void refreshGrainLines()
refreshGrainLines call to recalculate piece grainlines. For example after show / hide grainlines.
void ExportScene(const ExportLayoutDialog &dialog, const QList< QGraphicsScene * > &scenes, const QList< QGraphicsItem * > &papers, const QList< QGraphicsItem * > &shadows, const QList< QList< QGraphicsItem * > > &pieces, bool ignoreMargins, const QMarginsF &margins) const
void PdfTiledFile(const QString &name)
void RestoreTextAfterDXF(const QString &placeholder, const QList< QList< QGraphicsItem * > > &pieces) const
MainWindowsNoGUI::RestoreTextAfterDXF restore QGraphicsSimpleTextItem items after export to flat dxf.
void SetPatternWasChanged(bool changed)
QString GetDescription() const
void UpdatePatternLabel()
static VDataTool * getTool(quint32 id)
getTool return tool from tool list.
The VContainer class container of all variables.
static void SetSize(qreal size)
SetSize set value of size.
const QHash< quint32, VPiece > * DataPieces() const
const QHash< QString, QSharedPointer< VInternalVariable > > * DataVariables() const
static void SetHeight(qreal height)
SetGrowth set value of growth.
void setInsunits(const VarInsunits &var)
bool ExportToAAMA(const QVector< VLayoutPiece > &details) const
void setFileName(const QString &value)
void SetBinaryFormat(bool binary)
void setResolution(double dpi)
void SetVersion(DRW::Version version)
void setSize(const QSize &size)
qreal GetPaperHeight() const
Q_REQUIRED_RESULT QList< QGraphicsItem * > GetPapersItems() const
void setPieces(const QVector< VLayoutPiece > &details)
Q_REQUIRED_RESULT QList< QList< QGraphicsItem * > > getAllPieceItems() const
bool IsUnitePages() const
qreal GetPaperWidth() const
QMarginsF GetPrinterFields() const
LayoutErrors State() const
void Error(const LayoutErrors &state)
QVector< QVector< VLayoutPiece > > getAllPieces() const
bool IsUsePrinterFields() const
static VLayoutPiece Create(const VPiece &piece, const VContainer *pattern)
The VMainGraphicsScene class main scene.
void setResolution(int dpi)
void setSize(const QSize &size)
void setFileName(const QString &value)
qreal getTiledPDFPaperWidth(const Unit &unit) const
VSettings::getTiledPDFPaperWidth returns the paper height of tiled pdf in the desired unit.
QMarginsF GetTiledPDFMargins(const Unit &unit) const
VSettings::GetTiledPDFMargins returns the tiled pdf margins in the given unit. When the setting is ca...
qreal getTiledPDFPaperHeight(const Unit &unit) const
VSettings::getTiledPDFPaperHeight returns the paper height of tiled pdf in the desired unit.
PageOrientation getTiledPDFOrientation() const
double ToPixel(double val, const Unit &unit)
QSharedPointer< QPrinter > PreparePrinter(const QPrinterInfo &info, QPrinter::PrinterMode mode)
double FromPixel(double pix, const Unit &unit)
qreal UnitConvertor(qreal value, const Unit &from, const Unit &to)
const QString endStringPlaceholder
const qreal widthMainLine
void RemoveLayoutPath(const QString &path, bool usedNotExistedDir)
bool CreateLayoutPath(const QString &path)
static const auto V_EX_DATAERR