Print layout.
This commit is contained in:
parent
f1e49a7fd6
commit
2306d4a67c
|
@ -93,7 +93,7 @@ void VPCarrousel::Refresh()
|
|||
QList<VPSheetPtr> sheets = layout->GetSheets();
|
||||
for (const auto &sheet : sheets)
|
||||
{
|
||||
if (not sheet.isNull() && sheet->IsVisible())
|
||||
if (not sheet.isNull())
|
||||
{
|
||||
VPCarrouselSheet carrouselSheet;
|
||||
carrouselSheet.unplaced = false;
|
||||
|
|
|
@ -58,7 +58,7 @@ auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
|
|||
|
||||
// create a standard sheet
|
||||
VPSheetPtr sheet(new VPSheet(layout));
|
||||
sheet->SetName(tr("Sheet %1").arg(layout->GetSheets().size()+1));
|
||||
sheet->SetName(tr("Sheet %1").arg(layout->GetAllSheets().size()+1));
|
||||
layout->AddSheet(sheet);
|
||||
layout->SetFocusedSheet(sheet);
|
||||
|
||||
|
@ -156,7 +156,7 @@ auto VPLayout::WatermarkData() const -> VWatermarkData
|
|||
watermark.setXMLContent(converter.Convert());
|
||||
data = watermark.GetWatermark();
|
||||
}
|
||||
catch (VException &e)
|
||||
catch (VException &)
|
||||
{
|
||||
data.invalidFile = true;
|
||||
data.opacity = 20;
|
||||
|
@ -170,6 +170,34 @@ auto VPLayout::WatermarkData() const -> VWatermarkData
|
|||
return data;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPLayout::IsSheetsUniform() const -> bool
|
||||
{
|
||||
QList<VPSheetPtr> sheets = GetSheets();
|
||||
if (sheets.size() < 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
VPSheetPtr sheet = sheets.first();
|
||||
if (sheet.isNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QSizeF sheetSize = sheet->GetSheetSize().toSize();
|
||||
|
||||
return std::all_of(sheets.begin(), sheets.end(), [sheetSize](const VPSheetPtr &sheet)
|
||||
{
|
||||
if (sheet.isNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
QSize size = sheet->GetSheetSize().toSize();
|
||||
return size == sheetSize || size.transposed() == sheetSize;
|
||||
});
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPLayout::GetPieces() const -> QList<VPPiecePtr>
|
||||
{
|
||||
|
@ -221,11 +249,27 @@ auto VPLayout::AddSheet(const VPSheetPtr &sheet) -> VPSheetPtr
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPLayout::GetSheets() const -> QList<VPSheetPtr>
|
||||
QList<VPSheetPtr> VPLayout::GetAllSheets() const
|
||||
{
|
||||
return m_sheets;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPLayout::GetSheets() const -> QList<VPSheetPtr>
|
||||
{
|
||||
QList<VPSheetPtr> sheets;
|
||||
sheets.reserve(m_sheets.size());
|
||||
|
||||
for (const auto &sheet : m_sheets)
|
||||
{
|
||||
if (not sheet.isNull() && sheet->IsVisible())
|
||||
{
|
||||
sheets.append(sheet);
|
||||
}
|
||||
}
|
||||
return sheets;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPLayout::GetSheet(const QUuid &uuid) -> VPSheetPtr
|
||||
{
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
auto GetTrashedPieces() const -> QList<VPPiecePtr>;
|
||||
|
||||
auto AddSheet(const VPSheetPtr &sheet) -> VPSheetPtr;
|
||||
auto GetAllSheets() const -> QList<VPSheetPtr>;
|
||||
auto GetSheets() const -> QList<VPSheetPtr>;
|
||||
auto GetSheet(const QUuid &uuid) -> VPSheetPtr;
|
||||
|
||||
|
@ -96,6 +97,8 @@ public:
|
|||
|
||||
auto WatermarkData() const -> VWatermarkData;
|
||||
|
||||
auto IsSheetsUniform() const -> bool;
|
||||
|
||||
signals:
|
||||
void PieceSheetChanged(const VPPiecePtr &piece);
|
||||
void ActiveSheetChanged(const VPSheetPtr &focusedSheet);
|
||||
|
|
|
@ -376,3 +376,15 @@ void VPLayoutSettings::SetShowWatermark(bool newShowWatermark)
|
|||
{
|
||||
m_showWatermark = newShowWatermark;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPLayoutSettings::GetPrintTilesScheme() const
|
||||
{
|
||||
return m_printTilesScheme;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPLayoutSettings::SetPrintTilesScheme(bool newPrintTilesScheme)
|
||||
{
|
||||
m_printTilesScheme = newPrintTilesScheme;
|
||||
}
|
||||
|
|
|
@ -312,6 +312,9 @@ public:
|
|||
auto GetShowWatermark() const -> bool;
|
||||
void SetShowWatermark(bool newShowWatermark);
|
||||
|
||||
bool GetPrintTilesScheme() const;
|
||||
void SetPrintTilesScheme(bool newPrintTilesScheme);
|
||||
|
||||
private:
|
||||
Unit m_unit{Unit::Cm};
|
||||
|
||||
|
@ -366,6 +369,8 @@ private:
|
|||
qreal m_verticalScale{1.0};
|
||||
|
||||
QString m_watermarkPath{};
|
||||
|
||||
bool m_printTilesScheme{false};
|
||||
};
|
||||
|
||||
#endif // VPLAYOUTSETTINGS_H
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -269,11 +269,17 @@ private slots:
|
|||
void on_actionPrintTiledLayout_triggered();
|
||||
void on_actionPrintPreviewTiledLayout_triggered();
|
||||
|
||||
void on_printLayoutSheets(QPrinter *printer);
|
||||
void on_printLayoutTiledPages(QPrinter *printer);
|
||||
|
||||
void on_actionPrintSheet_triggered();
|
||||
void on_actionPrintPreviewSheet_triggered();
|
||||
void on_actionPrintTiledSheet_triggered();
|
||||
void on_actionPrintPreviewTiledSheet_triggered();
|
||||
|
||||
void on_printLayoutSheet(QPrinter *printer);
|
||||
void on_printLayoutSheetTiledPages(QPrinter *printer);
|
||||
|
||||
void CreateWatermark();
|
||||
void EditCurrentWatermark();
|
||||
void LoadWatermark();
|
||||
|
@ -457,13 +463,20 @@ private:
|
|||
void ExportUnifiedPdfFile(const VPExportData &data);
|
||||
void GenerateUnifiedPdfFile(const VPExportData &data, const QString &name);
|
||||
void ExportPdfTiledFile(const VPExportData &data);
|
||||
void GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, QPainter *painter, QPrinter *printer,
|
||||
bool &firstPage);
|
||||
void GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, QPainter *painter,
|
||||
const QSharedPointer<QPrinter> &printer, bool &firstPage);
|
||||
|
||||
void UpdateScaleConnection() const;
|
||||
|
||||
void OpenWatermark(const QString &path = QString());
|
||||
void CleanWaterkmarkEditors();
|
||||
|
||||
void DrawTilesScheme(QPrinter *printer, QPainter *painter, const VPSheetPtr &sheet, bool &firstPage);
|
||||
|
||||
auto AskLayoutIsInvalid(const QList<VPSheetPtr> &sheets) -> bool;
|
||||
|
||||
void PrintLayoutSheets(QPrinter *printer, const QList<VPSheetPtr> &sheets);
|
||||
void PrintLayoutTiledSheets(QPrinter *printer, const QList<VPSheetPtr> &sheets);
|
||||
};
|
||||
|
||||
#endif // VPMAINWINDOW_H
|
||||
|
|
|
@ -1541,6 +1541,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxPrintTilesScheme">
|
||||
<property name="text">
|
||||
<string>Print tiles scheme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -2266,7 +2273,8 @@
|
|||
</action>
|
||||
<action name="actionWatermarkEditor">
|
||||
<property name="icon">
|
||||
<iconset theme="document-new"/>
|
||||
<iconset theme="document-new">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Editor</string>
|
||||
|
@ -2294,7 +2302,8 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-open"/>
|
||||
<iconset theme="document-open">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
|
@ -2308,7 +2317,8 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="edit-delete"/>
|
||||
<iconset theme="edit-delete">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
|
|
|
@ -320,6 +320,7 @@ void VPLayoutFileReader::ReadTiles(const VPLayoutPtr &layout)
|
|||
|
||||
QXmlStreamAttributes attribs = attributes();
|
||||
layout->LayoutSettings().SetShowTiles(ReadAttributeBool(attribs, ML::AttrVisible, falseStr));
|
||||
layout->LayoutSettings().SetPrintTilesScheme(ReadAttributeBool(attribs, ML::AttrPrintScheme, falseStr));
|
||||
// attribs.value(ML::AttrMatchingMarks); // TODO
|
||||
|
||||
const QStringList tags
|
||||
|
|
|
@ -201,7 +201,7 @@ void VPLayoutFileWriter::WriteSheets(const VPLayoutPtr &layout)
|
|||
QList<VPSheetPtr> sheets = layout->GetSheets();
|
||||
for (const auto &sheet : sheets)
|
||||
{
|
||||
if (not sheet.isNull() && sheet->IsVisible())
|
||||
if (not sheet.isNull())
|
||||
{
|
||||
WriteSheet(sheet);
|
||||
}
|
||||
|
@ -224,7 +224,6 @@ void VPLayoutFileWriter::WriteSheet(const VPSheetPtr &sheet)
|
|||
WritePieceList(sheet->GetPieces(), ML::TagPieces);
|
||||
|
||||
writeEndElement(); // sheet
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -235,6 +234,8 @@ void VPLayoutFileWriter::WriteTiles(const VPLayoutPtr &layout)
|
|||
writeStartElement(ML::TagTiles);
|
||||
SetAttribute(ML::AttrVisible, layout->LayoutSettings().GetShowTiles());
|
||||
SetAttribute(ML::AttrMatchingMarks, "standard"); // TODO / Fixme get the right value
|
||||
SetAttributeOrRemoveIf<bool>(ML::AttrPrintScheme, layout->LayoutSettings().GetPrintTilesScheme(),
|
||||
[](bool print){return not print;});
|
||||
|
||||
WriteSize(layout->LayoutSettings().GetTilesSize());
|
||||
WriteMargins(layout->LayoutSettings().GetTilesMargins(), layout->LayoutSettings().IgnoreTilesMargins());
|
||||
|
|
|
@ -104,6 +104,7 @@ const QString AttrXScale = QStringLiteral("xScale");
|
|||
const QString AttrYScale = QStringLiteral("yScale");
|
||||
const QString AttrIgnoreMargins = QStringLiteral("ignoreMargins");
|
||||
const QString AttrShowPreview = QStringLiteral("showPreview");
|
||||
const QString AttrPrintScheme = QStringLiteral("printScheme");
|
||||
|
||||
const QString atFrontStr = QStringLiteral("atFront");
|
||||
const QString atRearStr = QStringLiteral("atRear");
|
||||
|
|
|
@ -109,6 +109,7 @@ extern const QString AttrXScale;
|
|||
extern const QString AttrYScale;
|
||||
extern const QString AttrIgnoreMargins;
|
||||
extern const QString AttrShowPreview;
|
||||
extern const QString AttrPrintScheme;
|
||||
|
||||
extern const QString atFrontStr;
|
||||
extern const QString atRearStr;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
</xs:sequence>
|
||||
<xs:attribute type="xs:boolean" name="visible"/>
|
||||
<xs:attribute type="xs:string" name="matchingMarks"/>
|
||||
<xs:attribute type="xs:boolean" name="printScheme"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="scale">
|
||||
|
|
Loading…
Reference in New Issue
Block a user