New command line option --cropWidth. Helps to crop unused width of paper.
--HG-- branch : develop
This commit is contained in:
parent
b3cc614789
commit
ea75af2f46
|
@ -31,6 +31,7 @@
|
||||||
- [#558] New export: Export pattern as step-by-step text.
|
- [#558] New export: Export pattern as step-by-step text.
|
||||||
- Added options to control passmark angle type and passmark mark type.
|
- Added options to control passmark angle type and passmark mark type.
|
||||||
- Improve for recent files list. Show duplicate file names with unique path section.
|
- Improve for recent files list. Show duplicate file names with unique path section.
|
||||||
|
- New command line option --cropWidth. Helps to crop unused width of paper.
|
||||||
|
|
||||||
# Version 0.6.2 (unreleased)
|
# Version 0.6.2 (unreleased)
|
||||||
- [#903] Bug in tool Cut Spline path.
|
- [#903] Bug in tool Cut Spline path.
|
||||||
|
|
4
dist/debian/valentina.1
vendored
4
dist/debian/valentina.1
vendored
|
@ -1,6 +1,6 @@
|
||||||
.\" Manpage for valentina.
|
.\" Manpage for valentina.
|
||||||
.\" Contact dismine@gmail.com to correct errors.
|
.\" Contact dismine@gmail.com to correct errors.
|
||||||
.TH valentina 1 "21 July, 2019" "valentina man page"
|
.TH valentina 1 "17 October, 2019" "valentina man page"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Valentina \- Pattern making program.
|
Valentina \- Pattern making program.
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -194,6 +194,8 @@ The path to output destination folder. By default the directory at which the app
|
||||||
.RB "Nest quantity copies of each piece (" "export mode" ").
|
.RB "Nest quantity copies of each piece (" "export mode" ").
|
||||||
.IP "-c, --crop"
|
.IP "-c, --crop"
|
||||||
.RB "Auto crop unused length (" "export mode" ")."
|
.RB "Auto crop unused length (" "export mode" ")."
|
||||||
|
.IP "--cropWidth"
|
||||||
|
.RB "Auto crop unused width (" "export mode" ")."
|
||||||
.IP "-u, --unite"
|
.IP "-u, --unite"
|
||||||
.RB "Unite pages if possible (" "export mode" "). Maximum value limited by QImage that supports only a maximum of " "32768x32768 px" " images."
|
.RB "Unite pages if possible (" "export mode" "). Maximum value limited by QImage that supports only a maximum of " "32768x32768 px" " images."
|
||||||
.IP "-S, --savelen"
|
.IP "-S, --savelen"
|
||||||
|
|
|
@ -200,7 +200,8 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
|
||||||
diag.SetLayoutWidth(Lo2Px(OptionValue(LONG_OPTION_GAPWIDTH), diag));
|
diag.SetLayoutWidth(Lo2Px(OptionValue(LONG_OPTION_GAPWIDTH), diag));
|
||||||
}
|
}
|
||||||
|
|
||||||
diag.SetAutoCrop(IsOptionSet(LONG_OPTION_CROP));
|
diag.SetAutoCropLength(IsOptionSet(LONG_OPTION_CROP_LENGTH));
|
||||||
|
diag.SetAutoCropWidth(IsOptionSet(LONG_OPTION_CROP_WIDTH));
|
||||||
diag.SetUnitePages(IsOptionSet(LONG_OPTION_UNITE));
|
diag.SetUnitePages(IsOptionSet(LONG_OPTION_UNITE));
|
||||||
diag.SetSaveLength(IsOptionSet(LONG_OPTION_SAVELENGTH));
|
diag.SetSaveLength(IsOptionSet(LONG_OPTION_SAVELENGTH));
|
||||||
diag.SetGroup(OptGroup());
|
diag.SetGroup(OptGroup());
|
||||||
|
@ -670,8 +671,10 @@ void VCommandLine::InitCommandLineOptions()
|
||||||
translate("VCommandLine", "Follow manual priority over priority by square (export mode).")},
|
translate("VCommandLine", "Follow manual priority over priority by square (export mode).")},
|
||||||
{LONG_OPTION_NEST_QUANTITY,
|
{LONG_OPTION_NEST_QUANTITY,
|
||||||
translate("VCommandLine", "Nest quantity copies of each piece (export mode).")},
|
translate("VCommandLine", "Nest quantity copies of each piece (export mode).")},
|
||||||
{{SINGLE_OPTION_CROP, LONG_OPTION_CROP},
|
{{SINGLE_OPTION_CROP_LENGTH, LONG_OPTION_CROP_LENGTH},
|
||||||
translate("VCommandLine", "Auto crop unused length (export mode).")},
|
translate("VCommandLine", "Auto crop unused length (export mode).")},
|
||||||
|
{{LONG_OPTION_CROP_WIDTH},
|
||||||
|
translate("VCommandLine", "Auto crop unused width (export mode).")},
|
||||||
{{SINGLE_OPTION_UNITE, LONG_OPTION_UNITE},
|
{{SINGLE_OPTION_UNITE, LONG_OPTION_UNITE},
|
||||||
translate("VCommandLine", "Unite pages if possible (export mode). Maximum value limited by QImage that "
|
translate("VCommandLine", "Unite pages if possible (export mode). Maximum value limited by QImage that "
|
||||||
"supports only a maximum of 32768x32768 px images.")},
|
"supports only a maximum of 32768x32768 px images.")},
|
||||||
|
|
|
@ -257,15 +257,27 @@ void DialogLayoutSettings::SetManualPriority(bool state)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool DialogLayoutSettings::GetAutoCrop() const
|
bool DialogLayoutSettings::GetAutoCropLength() const
|
||||||
{
|
{
|
||||||
return ui->checkBoxAutoCrop->isChecked();
|
return ui->checkBoxAutoCropLength->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::SetAutoCrop(bool autoCrop)
|
void DialogLayoutSettings::SetAutoCropLength(bool autoCropLength)
|
||||||
{
|
{
|
||||||
ui->checkBoxAutoCrop->setChecked(autoCrop);
|
ui->checkBoxAutoCropLength->setChecked(autoCropLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool DialogLayoutSettings::GetAutoCropWidth() const
|
||||||
|
{
|
||||||
|
return ui->checkBoxAutoCropWidth->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::SetAutoCropWidth(bool autoCropWidth)
|
||||||
|
{
|
||||||
|
ui->checkBoxAutoCropWidth->setChecked(autoCropWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -585,7 +597,8 @@ void DialogLayoutSettings::DialogAccepted()
|
||||||
generator->SetEfficiencyCoefficient(GetEfficiencyCoefficient());
|
generator->SetEfficiencyCoefficient(GetEfficiencyCoefficient());
|
||||||
generator->SetFollowGrainline(GetFollowGrainline());
|
generator->SetFollowGrainline(GetFollowGrainline());
|
||||||
generator->SetManualPriority(GetManualPriority());
|
generator->SetManualPriority(GetManualPriority());
|
||||||
generator->SetAutoCrop(GetAutoCrop());
|
generator->SetAutoCropLength(GetAutoCropLength());
|
||||||
|
generator->SetAutoCropWidth(GetAutoCropWidth());
|
||||||
generator->SetSaveLength(IsSaveLength());
|
generator->SetSaveLength(IsSaveLength());
|
||||||
generator->SetUnitePages(IsUnitePages());
|
generator->SetUnitePages(IsUnitePages());
|
||||||
generator->SetStripOptimization(IsStripOptimization());
|
generator->SetStripOptimization(IsStripOptimization());
|
||||||
|
@ -1003,7 +1016,8 @@ void DialogLayoutSettings::ReadSettings()
|
||||||
SetGroup(settings->GetLayoutGroup());
|
SetGroup(settings->GetLayoutGroup());
|
||||||
SetFollowGrainline(settings->GetLayoutFollowGrainline());
|
SetFollowGrainline(settings->GetLayoutFollowGrainline());
|
||||||
SetManualPriority(settings->GetLayoutManualPriority());
|
SetManualPriority(settings->GetLayoutManualPriority());
|
||||||
SetAutoCrop(settings->GetLayoutAutoCrop());
|
SetAutoCropLength(settings->GetLayoutAutoCropLength());
|
||||||
|
SetAutoCropWidth(settings->GetLayoutAutoCropWidth());
|
||||||
SetSaveLength(settings->GetLayoutSaveLength());
|
SetSaveLength(settings->GetLayoutSaveLength());
|
||||||
SetUnitePages(settings->GetLayoutUnitePages());
|
SetUnitePages(settings->GetLayoutUnitePages());
|
||||||
SetFields(settings->GetFields(GetDefPrinterFields()));
|
SetFields(settings->GetFields(GetDefPrinterFields()));
|
||||||
|
@ -1029,7 +1043,8 @@ void DialogLayoutSettings::WriteSettings() const
|
||||||
settings->SetLayoutPaperWidth(GetPaperWidth());
|
settings->SetLayoutPaperWidth(GetPaperWidth());
|
||||||
settings->SetLayoutFollowGrainline(GetFollowGrainline());
|
settings->SetLayoutFollowGrainline(GetFollowGrainline());
|
||||||
settings->SetLayoutManualPriority(GetManualPriority());
|
settings->SetLayoutManualPriority(GetManualPriority());
|
||||||
settings->SetLayoutAutoCrop(GetAutoCrop());
|
settings->SetLayoutAutoCropLength(GetAutoCropLength());
|
||||||
|
settings->SetLayoutAutoCropWidth(GetAutoCropWidth());
|
||||||
settings->SetLayoutSaveLength(IsSaveLength());
|
settings->SetLayoutSaveLength(IsSaveLength());
|
||||||
settings->SetLayoutUnitePages(IsUnitePages());
|
settings->SetLayoutUnitePages(IsUnitePages());
|
||||||
settings->SetFields(GetFields());
|
settings->SetFields(GetFields());
|
||||||
|
@ -1059,7 +1074,8 @@ void DialogLayoutSettings::SheetSize(const QSizeF &size)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::SetAdditionalOptions(bool value)
|
void DialogLayoutSettings::SetAdditionalOptions(bool value)
|
||||||
{
|
{
|
||||||
SetAutoCrop(value);
|
SetAutoCropLength(value);
|
||||||
|
SetAutoCropWidth(value);
|
||||||
SetSaveLength(value);
|
SetSaveLength(value);
|
||||||
SetUnitePages(value);
|
SetUnitePages(value);
|
||||||
SetStripOptimization(value);
|
SetStripOptimization(value);
|
||||||
|
|
|
@ -76,8 +76,11 @@ public:
|
||||||
bool GetManualPriority() const;
|
bool GetManualPriority() const;
|
||||||
void SetManualPriority(bool state);
|
void SetManualPriority(bool state);
|
||||||
|
|
||||||
bool GetAutoCrop() const;
|
bool GetAutoCropLength() const;
|
||||||
void SetAutoCrop(bool autoCrop);
|
void SetAutoCropLength(bool autoCropLength);
|
||||||
|
|
||||||
|
bool GetAutoCropWidth() const;
|
||||||
|
void SetAutoCropWidth(bool autoCropWidth);
|
||||||
|
|
||||||
bool IsSaveLength() const;
|
bool IsSaveLength() const;
|
||||||
void SetSaveLength(bool save);
|
void SetSaveLength(bool save);
|
||||||
|
|
|
@ -543,12 +543,19 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxAutoCrop">
|
<widget class="QCheckBox" name="checkBoxAutoCropLength">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Auto crop unused length</string>
|
<string>Auto crop unused length</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxAutoCropWidth">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto crop unused width</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxUnitePages">
|
<widget class="QCheckBox" name="checkBoxUnitePages">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -157,7 +157,8 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
||||||
m_taskbarProgress(nullptr),
|
m_taskbarProgress(nullptr),
|
||||||
#endif
|
#endif
|
||||||
isTiled(false),
|
isTiled(false),
|
||||||
isAutoCrop(false),
|
isAutoCropLength(false),
|
||||||
|
isAutoCropWidth(false),
|
||||||
isUnitePages(false),
|
isUnitePages(false),
|
||||||
layoutPrinterName()
|
layoutPrinterName()
|
||||||
{
|
{
|
||||||
|
@ -334,7 +335,8 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
|
||||||
ignorePrinterFields = not lGenerator.IsUsePrinterFields();
|
ignorePrinterFields = not lGenerator.IsUsePrinterFields();
|
||||||
margins = lGenerator.GetPrinterFields();
|
margins = lGenerator.GetPrinterFields();
|
||||||
paperSize = QSizeF(lGenerator.GetPaperWidth(), lGenerator.GetPaperHeight());
|
paperSize = QSizeF(lGenerator.GetPaperWidth(), lGenerator.GetPaperHeight());
|
||||||
isAutoCrop = lGenerator.GetAutoCrop();
|
isAutoCropLength = lGenerator.GetAutoCropLength();
|
||||||
|
isAutoCropWidth = lGenerator.GetAutoCropWidth();
|
||||||
isUnitePages = lGenerator.IsUnitePages();
|
isUnitePages = lGenerator.IsUnitePages();
|
||||||
isLayoutStale = false;
|
isLayoutStale = false;
|
||||||
papersCount = lGenerator.PapersCount();
|
papersCount = lGenerator.PapersCount();
|
||||||
|
@ -1563,25 +1565,43 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
|
||||||
|
|
||||||
if (not isTiled)
|
if (not isTiled)
|
||||||
{
|
{
|
||||||
QSizeF size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paperSize.height(), Unit::Mm));
|
qreal width = FromPixel(paperSize.width(), Unit::Mm);
|
||||||
if (isAutoCrop || isUnitePages)
|
qreal height = FromPixel(paperSize.height(), Unit::Mm);
|
||||||
|
|
||||||
|
if (isAutoCropLength || isUnitePages)
|
||||||
{
|
{
|
||||||
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
|
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
|
||||||
if (paper)
|
if (paper)
|
||||||
{
|
{
|
||||||
if (isLayoutPortrait)
|
if (isLayoutPortrait)
|
||||||
{
|
{
|
||||||
size = QSizeF(FromPixel(paperSize.width(), Unit::Mm),
|
height = FromPixel(paper->rect().height() + margins.top() + margins.bottom(), Unit::Mm);
|
||||||
FromPixel(paper->rect().height() + margins.top() + margins.bottom(), Unit::Mm));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size = QSizeF(FromPixel(paper->rect().width() + margins.left() + margins.right(), Unit::Mm),
|
width = FromPixel(paper->rect().width() + margins.left() + margins.right(), Unit::Mm);
|
||||||
FromPixel(paperSize.height(), Unit::Mm));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isAutoCropWidth)
|
||||||
|
{
|
||||||
|
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
|
||||||
|
if (paper)
|
||||||
|
{
|
||||||
|
if (isLayoutPortrait)
|
||||||
|
{
|
||||||
|
width = FromPixel(paper->rect().width() + margins.left() + margins.right(), Unit::Mm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
height = FromPixel(paper->rect().height() + margins.top() + margins.bottom(), Unit::Mm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QSizeF size = QSizeF(width, height);
|
||||||
|
|
||||||
if (not isLayoutPortrait)
|
if (not isLayoutPortrait)
|
||||||
{
|
{
|
||||||
size.transpose(); // QPrinter reverse this for landscape orientation
|
size.transpose(); // QPrinter reverse this for landscape orientation
|
||||||
|
|
|
@ -154,7 +154,8 @@ private:
|
||||||
Q_DISABLE_COPY(MainWindowsNoGUI)
|
Q_DISABLE_COPY(MainWindowsNoGUI)
|
||||||
|
|
||||||
bool isTiled;
|
bool isTiled;
|
||||||
bool isAutoCrop;
|
bool isAutoCropLength;
|
||||||
|
bool isAutoCropWidth;
|
||||||
bool isUnitePages;
|
bool isUnitePages;
|
||||||
|
|
||||||
QString layoutPrinterName;
|
QString layoutPrinterName;
|
||||||
|
|
|
@ -59,7 +59,8 @@ VLayoutGenerator::VLayoutGenerator(QObject *parent)
|
||||||
rotate(true),
|
rotate(true),
|
||||||
followGrainline(false),
|
followGrainline(false),
|
||||||
rotationNumber(2),
|
rotationNumber(2),
|
||||||
autoCrop(false),
|
autoCropLength(false),
|
||||||
|
autoCropWidth(false),
|
||||||
saveLength(false),
|
saveLength(false),
|
||||||
unitePages(false),
|
unitePages(false),
|
||||||
stripOptimizationEnabled(false),
|
stripOptimizationEnabled(false),
|
||||||
|
@ -289,7 +290,7 @@ QList<QGraphicsItem *> VLayoutGenerator::GetPapersItems() const
|
||||||
QList<QGraphicsItem *> list;
|
QList<QGraphicsItem *> list;
|
||||||
for (auto &paper : papers)
|
for (auto &paper : papers)
|
||||||
{
|
{
|
||||||
list.append(paper.GetPaperItem(autoCrop, IsTestAsPaths()));
|
list.append(paper.GetPaperItem(autoCropLength, autoCropWidth, IsTestAsPaths()));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -518,7 +519,7 @@ void VLayoutGenerator::UnitePages()
|
||||||
if (IsPortrait())
|
if (IsPortrait())
|
||||||
{
|
{
|
||||||
int paperHeight = 0;
|
int paperHeight = 0;
|
||||||
if (autoCrop)
|
if (autoCropLength)
|
||||||
{
|
{
|
||||||
const QRectF rec = papers.at(i).DetailsBoundingRect();
|
const QRectF rec = papers.at(i).DetailsBoundingRect();
|
||||||
paperHeight = qRound(rec.y() + rec.height());
|
paperHeight = qRound(rec.y() + rec.height());
|
||||||
|
@ -551,7 +552,7 @@ void VLayoutGenerator::UnitePages()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int paperWidth = 0;
|
int paperWidth = 0;
|
||||||
if (autoCrop)
|
if (autoCropLength)
|
||||||
{
|
{
|
||||||
const QRectF rec = papers.at(i).DetailsBoundingRect();
|
const QRectF rec = papers.at(i).DetailsBoundingRect();
|
||||||
paperWidth = qRound(rec.x() + rec.width());
|
paperWidth = qRound(rec.x() + rec.width());
|
||||||
|
@ -675,15 +676,26 @@ void VLayoutGenerator::SetSaveLength(bool value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VLayoutGenerator::GetAutoCrop() const
|
bool VLayoutGenerator::GetAutoCropLength() const
|
||||||
{
|
{
|
||||||
return autoCrop;
|
return autoCropLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VLayoutGenerator::SetAutoCrop(bool value)
|
void VLayoutGenerator::SetAutoCropLength(bool value)
|
||||||
{
|
{
|
||||||
autoCrop = value;
|
autoCropLength = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VLayoutGenerator::GetAutoCropWidth() const
|
||||||
|
{
|
||||||
|
return autoCropWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VLayoutGenerator::SetAutoCropWidth(bool value)
|
||||||
|
{
|
||||||
|
autoCropWidth = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -108,8 +108,11 @@ public:
|
||||||
int GetRotationNumber() const;
|
int GetRotationNumber() const;
|
||||||
void SetRotationNumber(int value);
|
void SetRotationNumber(int value);
|
||||||
|
|
||||||
bool GetAutoCrop() const;
|
bool GetAutoCropLength() const;
|
||||||
void SetAutoCrop(bool value);
|
void SetAutoCropLength(bool value);
|
||||||
|
|
||||||
|
bool GetAutoCropWidth() const;
|
||||||
|
void SetAutoCropWidth(bool value);
|
||||||
|
|
||||||
bool IsSaveLength() const;
|
bool IsSaveLength() const;
|
||||||
void SetSaveLength(bool value);
|
void SetSaveLength(bool value);
|
||||||
|
@ -148,7 +151,8 @@ private:
|
||||||
bool rotate;
|
bool rotate;
|
||||||
bool followGrainline;
|
bool followGrainline;
|
||||||
int rotationNumber;
|
int rotationNumber;
|
||||||
bool autoCrop;
|
bool autoCropLength;
|
||||||
|
bool autoCropWidth;
|
||||||
bool saveLength;
|
bool saveLength;
|
||||||
bool unitePages;
|
bool unitePages;
|
||||||
bool stripOptimizationEnabled;
|
bool stripOptimizationEnabled;
|
||||||
|
|
|
@ -282,10 +282,12 @@ bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop, bool textAsPaths) const
|
QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCropLength, bool autoCropWidth, bool textAsPaths) const
|
||||||
{
|
{
|
||||||
QGraphicsRectItem *paper;
|
int height = d->globalContour.GetHeight();
|
||||||
if (autoCrop)
|
int width = d->globalContour.GetWidth();
|
||||||
|
|
||||||
|
if (autoCropLength || autoCropWidth)
|
||||||
{
|
{
|
||||||
QScopedPointer<QGraphicsScene> scene(new QGraphicsScene());
|
QScopedPointer<QGraphicsScene> scene(new QGraphicsScene());
|
||||||
QList<QGraphicsItem *> list = GetItemDetails(textAsPaths);
|
QList<QGraphicsItem *> list = GetItemDetails(textAsPaths);
|
||||||
|
@ -295,21 +297,33 @@ QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop, bool textAsPaths) c
|
||||||
}
|
}
|
||||||
|
|
||||||
const QRect boundingRect = scene->itemsBoundingRect().toRect();
|
const QRect boundingRect = scene->itemsBoundingRect().toRect();
|
||||||
|
|
||||||
|
if (autoCropLength)
|
||||||
|
{
|
||||||
if (d->globalContour.IsPortrait())
|
if (d->globalContour.IsPortrait())
|
||||||
{
|
{
|
||||||
const int height = boundingRect.height() + boundingRect.y() + 1;
|
height = boundingRect.height() + boundingRect.y() + 1;
|
||||||
paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), height));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int width = boundingRect.width() + boundingRect.x() + 1;
|
width = boundingRect.width() + boundingRect.x() + 1;
|
||||||
paper = new QGraphicsRectItem(QRectF(0, 0, width, d->globalContour.GetHeight()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (autoCropWidth)
|
||||||
|
{
|
||||||
|
if (d->globalContour.IsPortrait())
|
||||||
|
{
|
||||||
|
width = boundingRect.width() + boundingRect.x() + 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), d->globalContour.GetHeight()));
|
height = boundingRect.height() + boundingRect.y() + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto *paper = new QGraphicsRectItem(QRectF(0, 0, width, height));
|
||||||
paper->setPen(QPen(Qt::black, 1));
|
paper->setPen(QPen(Qt::black, 1));
|
||||||
paper->setBrush(QBrush(Qt::white));
|
paper->setBrush(QBrush(Qt::white));
|
||||||
return paper;
|
return paper;
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
|
|
||||||
bool ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &stop);
|
bool ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &stop);
|
||||||
int Count() const;
|
int Count() const;
|
||||||
Q_REQUIRED_RESULT QGraphicsRectItem *GetPaperItem(bool autoCrop, bool textAsPaths) const;
|
Q_REQUIRED_RESULT QGraphicsRectItem *GetPaperItem(bool autoCropLength, bool autoCropWidth, bool textAsPaths) const;
|
||||||
Q_REQUIRED_RESULT QGraphicsPathItem *GetGlobalContour() const;
|
Q_REQUIRED_RESULT QGraphicsPathItem *GetGlobalContour() const;
|
||||||
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetItemDetails(bool textAsPaths) const;
|
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetItemDetails(bool textAsPaths) const;
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,10 @@ const QString LONG_OPTION_TEXT2PATHS = QStringLiteral("text2paths");
|
||||||
const QString LONG_OPTION_EXPORTONLYDETAILS = QStringLiteral("exportOnlyDetails");
|
const QString LONG_OPTION_EXPORTONLYDETAILS = QStringLiteral("exportOnlyDetails");
|
||||||
const QString LONG_OPTION_EXPORTSUCHDETAILS = QStringLiteral("exportSuchDetails");
|
const QString LONG_OPTION_EXPORTSUCHDETAILS = QStringLiteral("exportSuchDetails");
|
||||||
|
|
||||||
const QString LONG_OPTION_CROP = QStringLiteral("crop");
|
const QString LONG_OPTION_CROP_LENGTH = QStringLiteral("crop");
|
||||||
const QString SINGLE_OPTION_CROP = QStringLiteral("c");
|
const QString SINGLE_OPTION_CROP_LENGTH = QStringLiteral("c");
|
||||||
|
|
||||||
|
const QString LONG_OPTION_CROP_WIDTH = QStringLiteral("cropWidth");
|
||||||
|
|
||||||
const QString LONG_OPTION_UNITE = QStringLiteral("unite");
|
const QString LONG_OPTION_UNITE = QStringLiteral("unite");
|
||||||
const QString SINGLE_OPTION_UNITE = QStringLiteral("u");
|
const QString SINGLE_OPTION_UNITE = QStringLiteral("u");
|
||||||
|
@ -151,7 +153,8 @@ QStringList AllKeys()
|
||||||
LONG_OPTION_TEXT2PATHS,
|
LONG_OPTION_TEXT2PATHS,
|
||||||
LONG_OPTION_EXPORTONLYDETAILS,
|
LONG_OPTION_EXPORTONLYDETAILS,
|
||||||
LONG_OPTION_EXPORTSUCHDETAILS,
|
LONG_OPTION_EXPORTSUCHDETAILS,
|
||||||
LONG_OPTION_CROP, SINGLE_OPTION_CROP,
|
LONG_OPTION_CROP_LENGTH, SINGLE_OPTION_CROP_LENGTH,
|
||||||
|
LONG_OPTION_CROP_WIDTH,
|
||||||
LONG_OPTION_UNITE, SINGLE_OPTION_UNITE,
|
LONG_OPTION_UNITE, SINGLE_OPTION_UNITE,
|
||||||
LONG_OPTION_PAGEW, SINGLE_OPTION_PAGEW,
|
LONG_OPTION_PAGEW, SINGLE_OPTION_PAGEW,
|
||||||
LONG_OPTION_PAGEH, SINGLE_OPTION_PAGEH,
|
LONG_OPTION_PAGEH, SINGLE_OPTION_PAGEH,
|
||||||
|
|
|
@ -51,8 +51,10 @@ extern const QString LONG_OPTION_TEXT2PATHS;
|
||||||
extern const QString LONG_OPTION_EXPORTONLYDETAILS;
|
extern const QString LONG_OPTION_EXPORTONLYDETAILS;
|
||||||
extern const QString LONG_OPTION_EXPORTSUCHDETAILS;
|
extern const QString LONG_OPTION_EXPORTSUCHDETAILS;
|
||||||
|
|
||||||
extern const QString LONG_OPTION_CROP;
|
extern const QString LONG_OPTION_CROP_LENGTH;
|
||||||
extern const QString SINGLE_OPTION_CROP;
|
extern const QString SINGLE_OPTION_CROP_LENGTH;
|
||||||
|
|
||||||
|
extern const QString LONG_OPTION_CROP_WIDTH;
|
||||||
|
|
||||||
extern const QString LONG_OPTION_UNITE;
|
extern const QString LONG_OPTION_UNITE;
|
||||||
extern const QString SINGLE_OPTION_UNITE;
|
extern const QString SINGLE_OPTION_UNITE;
|
||||||
|
|
|
@ -86,7 +86,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, (QLatin1String
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutManualPriority, (QLatin1String("layout/manualPriority")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutManualPriority, (QLatin1String("layout/manualPriority")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutNestQuantity, (QLatin1String("layout/nestQuantity")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutNestQuantity, (QLatin1String("layout/nestQuantity")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCrop, (QLatin1String("layout/autoCrop")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropLength, (QLatin1String("layout/autoCropLength")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropWidth, (QLatin1String("layout/autoCropWidth")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, (QLatin1String("layout/fields")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, (QLatin1String("layout/fields")))
|
||||||
|
@ -356,23 +357,38 @@ void VSettings::SetLayoutNestQuantity(bool value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VSettings::GetLayoutAutoCrop() const
|
bool VSettings::GetLayoutAutoCropLength() const
|
||||||
{
|
{
|
||||||
return value(*settingLayoutAutoCrop, GetDefLayoutAutoCrop()).toBool();
|
return value(*settingLayoutAutoCropLength, GetDefLayoutAutoCropLength()).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VSettings::GetDefLayoutAutoCrop()
|
bool VSettings::GetDefLayoutAutoCropLength()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetLayoutAutoCropLength(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutAutoCropLength, value);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VSettings::GetLayoutAutoCropWidth() const
|
||||||
|
{
|
||||||
|
return value(*settingLayoutAutoCropWidth, GetDefLayoutAutoCropWidth()).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VSettings::GetDefLayoutAutoCropWidth()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VSettings::SetLayoutAutoCrop(bool value)
|
void VSettings::SetLayoutAutoCropWidth(bool value)
|
||||||
{
|
{
|
||||||
setValue(*settingLayoutAutoCrop, value);
|
setValue(*settingLayoutAutoCropWidth, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VSettings::GetLayoutSaveLength() const
|
bool VSettings::GetLayoutSaveLength() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,9 +97,13 @@ public:
|
||||||
static bool GetDefLayoutNestQuantity();
|
static bool GetDefLayoutNestQuantity();
|
||||||
void SetLayoutNestQuantity(bool value);
|
void SetLayoutNestQuantity(bool value);
|
||||||
|
|
||||||
bool GetLayoutAutoCrop() const;
|
bool GetLayoutAutoCropLength() const;
|
||||||
static bool GetDefLayoutAutoCrop();
|
static bool GetDefLayoutAutoCropLength();
|
||||||
void SetLayoutAutoCrop(bool value);
|
void SetLayoutAutoCropLength(bool value);
|
||||||
|
|
||||||
|
bool GetLayoutAutoCropWidth() const;
|
||||||
|
static bool GetDefLayoutAutoCropWidth();
|
||||||
|
void SetLayoutAutoCropWidth(bool value);
|
||||||
|
|
||||||
bool GetLayoutSaveLength() const;
|
bool GetLayoutSaveLength() const;
|
||||||
static bool GetDefLayoutSaveLength();
|
static bool GetDefLayoutSaveLength();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user