From ea75af2f46babccf9364e684d0fe0b1591876b68 Mon Sep 17 00:00:00 2001 From: Andrey Ushakov Date: Wed, 16 Oct 2019 11:16:16 +0300 Subject: [PATCH] New command line option --cropWidth. Helps to crop unused width of paper. --HG-- branch : develop --- ChangeLog.txt | 1 + dist/debian/valentina.1 | 4 +- src/app/valentina/core/vcmdexport.cpp | 7 +++- .../dialogs/dialoglayoutsettings.cpp | 32 +++++++++++---- .../valentina/dialogs/dialoglayoutsettings.h | 7 +++- .../valentina/dialogs/dialoglayoutsettings.ui | 9 ++++- src/app/valentina/mainwindowsnogui.cpp | 36 +++++++++++++---- src/app/valentina/mainwindowsnogui.h | 3 +- src/libs/vlayout/vlayoutgenerator.cpp | 28 +++++++++---- src/libs/vlayout/vlayoutgenerator.h | 10 +++-- src/libs/vlayout/vlayoutpaper.cpp | 40 +++++++++++++------ src/libs/vlayout/vlayoutpaper.h | 2 +- src/libs/vmisc/commandoptions.cpp | 9 +++-- src/libs/vmisc/commandoptions.h | 6 ++- src/libs/vmisc/vsettings.cpp | 30 ++++++++++---- src/libs/vmisc/vsettings.h | 10 +++-- 16 files changed, 171 insertions(+), 63 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index c1d3471cd..37af7f9f6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -31,6 +31,7 @@ - [#558] New export: Export pattern as step-by-step text. - Added options to control passmark angle type and passmark mark type. - 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) - [#903] Bug in tool Cut Spline path. diff --git a/dist/debian/valentina.1 b/dist/debian/valentina.1 index 715019661..18664147b 100644 --- a/dist/debian/valentina.1 +++ b/dist/debian/valentina.1 @@ -1,6 +1,6 @@ .\" Manpage for valentina. .\" 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 Valentina \- Pattern making program. .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" "). .IP "-c, --crop" .RB "Auto crop unused length (" "export mode" ")." +.IP "--cropWidth" +.RB "Auto crop unused width (" "export mode" ")." .IP "-u, --unite" .RB "Unite pages if possible (" "export mode" "). Maximum value limited by QImage that supports only a maximum of " "32768x32768 px" " images." .IP "-S, --savelen" diff --git a/src/app/valentina/core/vcmdexport.cpp b/src/app/valentina/core/vcmdexport.cpp index dcebaa3c2..2dec6431e 100644 --- a/src/app/valentina/core/vcmdexport.cpp +++ b/src/app/valentina/core/vcmdexport.cpp @@ -200,7 +200,8 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const 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.SetSaveLength(IsOptionSet(LONG_OPTION_SAVELENGTH)); diag.SetGroup(OptGroup()); @@ -670,8 +671,10 @@ void VCommandLine::InitCommandLineOptions() translate("VCommandLine", "Follow manual priority over priority by square (export mode).")}, {LONG_OPTION_NEST_QUANTITY, 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).")}, + {{LONG_OPTION_CROP_WIDTH}, + translate("VCommandLine", "Auto crop unused width (export mode).")}, {{SINGLE_OPTION_UNITE, LONG_OPTION_UNITE}, translate("VCommandLine", "Unite pages if possible (export mode). Maximum value limited by QImage that " "supports only a maximum of 32768x32768 px images.")}, diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index 707ff2e1e..b8ab8c3fd 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -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->SetFollowGrainline(GetFollowGrainline()); generator->SetManualPriority(GetManualPriority()); - generator->SetAutoCrop(GetAutoCrop()); + generator->SetAutoCropLength(GetAutoCropLength()); + generator->SetAutoCropWidth(GetAutoCropWidth()); generator->SetSaveLength(IsSaveLength()); generator->SetUnitePages(IsUnitePages()); generator->SetStripOptimization(IsStripOptimization()); @@ -1003,7 +1016,8 @@ void DialogLayoutSettings::ReadSettings() SetGroup(settings->GetLayoutGroup()); SetFollowGrainline(settings->GetLayoutFollowGrainline()); SetManualPriority(settings->GetLayoutManualPriority()); - SetAutoCrop(settings->GetLayoutAutoCrop()); + SetAutoCropLength(settings->GetLayoutAutoCropLength()); + SetAutoCropWidth(settings->GetLayoutAutoCropWidth()); SetSaveLength(settings->GetLayoutSaveLength()); SetUnitePages(settings->GetLayoutUnitePages()); SetFields(settings->GetFields(GetDefPrinterFields())); @@ -1029,7 +1043,8 @@ void DialogLayoutSettings::WriteSettings() const settings->SetLayoutPaperWidth(GetPaperWidth()); settings->SetLayoutFollowGrainline(GetFollowGrainline()); settings->SetLayoutManualPriority(GetManualPriority()); - settings->SetLayoutAutoCrop(GetAutoCrop()); + settings->SetLayoutAutoCropLength(GetAutoCropLength()); + settings->SetLayoutAutoCropWidth(GetAutoCropWidth()); settings->SetLayoutSaveLength(IsSaveLength()); settings->SetLayoutUnitePages(IsUnitePages()); settings->SetFields(GetFields()); @@ -1059,7 +1074,8 @@ void DialogLayoutSettings::SheetSize(const QSizeF &size) //--------------------------------------------------------------------------------------------------------------------- void DialogLayoutSettings::SetAdditionalOptions(bool value) { - SetAutoCrop(value); + SetAutoCropLength(value); + SetAutoCropWidth(value); SetSaveLength(value); SetUnitePages(value); SetStripOptimization(value); diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.h b/src/app/valentina/dialogs/dialoglayoutsettings.h index 55d13e1b4..0dfc54af7 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.h +++ b/src/app/valentina/dialogs/dialoglayoutsettings.h @@ -76,8 +76,11 @@ public: bool GetManualPriority() const; void SetManualPriority(bool state); - bool GetAutoCrop() const; - void SetAutoCrop(bool autoCrop); + bool GetAutoCropLength() const; + void SetAutoCropLength(bool autoCropLength); + + bool GetAutoCropWidth() const; + void SetAutoCropWidth(bool autoCropWidth); bool IsSaveLength() const; void SetSaveLength(bool save); diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.ui b/src/app/valentina/dialogs/dialoglayoutsettings.ui index 364547983..648e09b5a 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.ui +++ b/src/app/valentina/dialogs/dialoglayoutsettings.ui @@ -543,12 +543,19 @@ - + Auto crop unused length + + + + Auto crop unused width + + + diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index ab6182826..6fa99c329 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -157,7 +157,8 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent) m_taskbarProgress(nullptr), #endif isTiled(false), - isAutoCrop(false), + isAutoCropLength(false), + isAutoCropWidth(false), isUnitePages(false), layoutPrinterName() { @@ -334,7 +335,8 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator) ignorePrinterFields = not lGenerator.IsUsePrinterFields(); margins = lGenerator.GetPrinterFields(); paperSize = QSizeF(lGenerator.GetPaperWidth(), lGenerator.GetPaperHeight()); - isAutoCrop = lGenerator.GetAutoCrop(); + isAutoCropLength = lGenerator.GetAutoCropLength(); + isAutoCropWidth = lGenerator.GetAutoCropWidth(); isUnitePages = lGenerator.IsUnitePages(); isLayoutStale = false; papersCount = lGenerator.PapersCount(); @@ -1563,25 +1565,43 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr if (not isTiled) { - QSizeF size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paperSize.height(), Unit::Mm)); - if (isAutoCrop || isUnitePages) + qreal width = FromPixel(paperSize.width(), Unit::Mm); + qreal height = FromPixel(paperSize.height(), Unit::Mm); + + if (isAutoCropLength || isUnitePages) { auto *paper = qgraphicsitem_cast(papers.at(0)); if (paper) { if (isLayoutPortrait) { - size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), - FromPixel(paper->rect().height() + margins.top() + margins.bottom(), Unit::Mm)); + height = FromPixel(paper->rect().height() + margins.top() + margins.bottom(), Unit::Mm); } else { - size = QSizeF(FromPixel(paper->rect().width() + margins.left() + margins.right(), Unit::Mm), - FromPixel(paperSize.height(), Unit::Mm)); + width = FromPixel(paper->rect().width() + margins.left() + margins.right(), Unit::Mm); } } } + if (isAutoCropWidth) + { + auto *paper = qgraphicsitem_cast(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) { size.transpose(); // QPrinter reverse this for landscape orientation diff --git a/src/app/valentina/mainwindowsnogui.h b/src/app/valentina/mainwindowsnogui.h index 599fe384c..9eb3e3a0e 100644 --- a/src/app/valentina/mainwindowsnogui.h +++ b/src/app/valentina/mainwindowsnogui.h @@ -154,7 +154,8 @@ private: Q_DISABLE_COPY(MainWindowsNoGUI) bool isTiled; - bool isAutoCrop; + bool isAutoCropLength; + bool isAutoCropWidth; bool isUnitePages; QString layoutPrinterName; diff --git a/src/libs/vlayout/vlayoutgenerator.cpp b/src/libs/vlayout/vlayoutgenerator.cpp index 627a159ee..c7e113c6b 100644 --- a/src/libs/vlayout/vlayoutgenerator.cpp +++ b/src/libs/vlayout/vlayoutgenerator.cpp @@ -59,7 +59,8 @@ VLayoutGenerator::VLayoutGenerator(QObject *parent) rotate(true), followGrainline(false), rotationNumber(2), - autoCrop(false), + autoCropLength(false), + autoCropWidth(false), saveLength(false), unitePages(false), stripOptimizationEnabled(false), @@ -289,7 +290,7 @@ QList VLayoutGenerator::GetPapersItems() const QList list; for (auto &paper : papers) { - list.append(paper.GetPaperItem(autoCrop, IsTestAsPaths())); + list.append(paper.GetPaperItem(autoCropLength, autoCropWidth, IsTestAsPaths())); } return list; } @@ -518,7 +519,7 @@ void VLayoutGenerator::UnitePages() if (IsPortrait()) { int paperHeight = 0; - if (autoCrop) + if (autoCropLength) { const QRectF rec = papers.at(i).DetailsBoundingRect(); paperHeight = qRound(rec.y() + rec.height()); @@ -551,7 +552,7 @@ void VLayoutGenerator::UnitePages() else { int paperWidth = 0; - if (autoCrop) + if (autoCropLength) { const QRectF rec = papers.at(i).DetailsBoundingRect(); 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; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vlayout/vlayoutgenerator.h b/src/libs/vlayout/vlayoutgenerator.h index 43e7c261a..014e254a7 100644 --- a/src/libs/vlayout/vlayoutgenerator.h +++ b/src/libs/vlayout/vlayoutgenerator.h @@ -108,8 +108,11 @@ public: int GetRotationNumber() const; void SetRotationNumber(int value); - bool GetAutoCrop() const; - void SetAutoCrop(bool value); + bool GetAutoCropLength() const; + void SetAutoCropLength(bool value); + + bool GetAutoCropWidth() const; + void SetAutoCropWidth(bool value); bool IsSaveLength() const; void SetSaveLength(bool value); @@ -148,7 +151,8 @@ private: bool rotate; bool followGrainline; int rotationNumber; - bool autoCrop; + bool autoCropLength; + bool autoCropWidth; bool saveLength; bool unitePages; bool stripOptimizationEnabled; diff --git a/src/libs/vlayout/vlayoutpaper.cpp b/src/libs/vlayout/vlayoutpaper.cpp index 8a0b4b6b5..ceba7d986 100644 --- a/src/libs/vlayout/vlayoutpaper.cpp +++ b/src/libs/vlayout/vlayoutpaper.cpp @@ -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; - if (autoCrop) + int height = d->globalContour.GetHeight(); + int width = d->globalContour.GetWidth(); + + if (autoCropLength || autoCropWidth) { QScopedPointer scene(new QGraphicsScene()); QList list = GetItemDetails(textAsPaths); @@ -295,21 +297,33 @@ QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop, bool textAsPaths) c } const QRect boundingRect = scene->itemsBoundingRect().toRect(); - if (d->globalContour.IsPortrait()) + + if (autoCropLength) { - const int height = boundingRect.height() + boundingRect.y() + 1; - paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), height)); + if (d->globalContour.IsPortrait()) + { + height = boundingRect.height() + boundingRect.y() + 1; + } + else + { + width = boundingRect.width() + boundingRect.x() + 1; + } } - else + + if (autoCropWidth) { - const int width = boundingRect.width() + boundingRect.x() + 1; - paper = new QGraphicsRectItem(QRectF(0, 0, width, d->globalContour.GetHeight())); + if (d->globalContour.IsPortrait()) + { + width = boundingRect.width() + boundingRect.x() + 1; + } + else + { + height = boundingRect.height() + boundingRect.y() + 1; + } } } - else - { - paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), d->globalContour.GetHeight())); - } + + auto *paper = new QGraphicsRectItem(QRectF(0, 0, width, height)); paper->setPen(QPen(Qt::black, 1)); paper->setBrush(QBrush(Qt::white)); return paper; diff --git a/src/libs/vlayout/vlayoutpaper.h b/src/libs/vlayout/vlayoutpaper.h index dc0cb6751..9dd752f93 100644 --- a/src/libs/vlayout/vlayoutpaper.h +++ b/src/libs/vlayout/vlayoutpaper.h @@ -95,7 +95,7 @@ public: bool ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &stop); 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 QList GetItemDetails(bool textAsPaths) const; diff --git a/src/libs/vmisc/commandoptions.cpp b/src/libs/vmisc/commandoptions.cpp index 0fdab48c4..3fa0b9445 100644 --- a/src/libs/vmisc/commandoptions.cpp +++ b/src/libs/vmisc/commandoptions.cpp @@ -54,8 +54,10 @@ const QString LONG_OPTION_TEXT2PATHS = QStringLiteral("text2paths"); const QString LONG_OPTION_EXPORTONLYDETAILS = QStringLiteral("exportOnlyDetails"); const QString LONG_OPTION_EXPORTSUCHDETAILS = QStringLiteral("exportSuchDetails"); -const QString LONG_OPTION_CROP = QStringLiteral("crop"); -const QString SINGLE_OPTION_CROP = QStringLiteral("c"); +const QString LONG_OPTION_CROP_LENGTH = QStringLiteral("crop"); +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 SINGLE_OPTION_UNITE = QStringLiteral("u"); @@ -151,7 +153,8 @@ QStringList AllKeys() LONG_OPTION_TEXT2PATHS, LONG_OPTION_EXPORTONLYDETAILS, 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_PAGEW, SINGLE_OPTION_PAGEW, LONG_OPTION_PAGEH, SINGLE_OPTION_PAGEH, diff --git a/src/libs/vmisc/commandoptions.h b/src/libs/vmisc/commandoptions.h index c3be2c6ca..be9b8faf5 100644 --- a/src/libs/vmisc/commandoptions.h +++ b/src/libs/vmisc/commandoptions.h @@ -51,8 +51,10 @@ extern const QString LONG_OPTION_TEXT2PATHS; extern const QString LONG_OPTION_EXPORTONLYDETAILS; extern const QString LONG_OPTION_EXPORTSUCHDETAILS; -extern const QString LONG_OPTION_CROP; -extern const QString SINGLE_OPTION_CROP; +extern const QString LONG_OPTION_CROP_LENGTH; +extern const QString SINGLE_OPTION_CROP_LENGTH; + +extern const QString LONG_OPTION_CROP_WIDTH; extern const QString LONG_OPTION_UNITE; extern const QString SINGLE_OPTION_UNITE; diff --git a/src/libs/vmisc/vsettings.cpp b/src/libs/vmisc/vsettings.cpp index bad24291a..63f656c47 100644 --- a/src/libs/vmisc/vsettings.cpp +++ b/src/libs/vmisc/vsettings.cpp @@ -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, settingLayoutManualPriority, (QLatin1String("layout/manualPriority"))) 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, settingLayoutUnitePages, (QLatin1String("layout/unitePages"))) 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; } //--------------------------------------------------------------------------------------------------------------------- -void VSettings::SetLayoutAutoCrop(bool value) +void VSettings::SetLayoutAutoCropWidth(bool value) { - setValue(*settingLayoutAutoCrop, value); + setValue(*settingLayoutAutoCropWidth, value); } - //--------------------------------------------------------------------------------------------------------------------- bool VSettings::GetLayoutSaveLength() const { diff --git a/src/libs/vmisc/vsettings.h b/src/libs/vmisc/vsettings.h index 2408162f2..82a5f07c7 100644 --- a/src/libs/vmisc/vsettings.h +++ b/src/libs/vmisc/vsettings.h @@ -97,9 +97,13 @@ public: static bool GetDefLayoutNestQuantity(); void SetLayoutNestQuantity(bool value); - bool GetLayoutAutoCrop() const; - static bool GetDefLayoutAutoCrop(); - void SetLayoutAutoCrop(bool value); + bool GetLayoutAutoCropLength() const; + static bool GetDefLayoutAutoCropLength(); + void SetLayoutAutoCropLength(bool value); + + bool GetLayoutAutoCropWidth() const; + static bool GetDefLayoutAutoCropWidth(); + void SetLayoutAutoCropWidth(bool value); bool GetLayoutSaveLength() const; static bool GetDefLayoutSaveLength();