Merged develop into feature

--HG--
branch : feature
This commit is contained in:
Bojan Kverh 2016-09-06 20:07:40 +02:00
commit 7e70c3a8f5
30 changed files with 989 additions and 113 deletions

View File

@ -37,6 +37,8 @@
- [#520] Improve Union tool. An option to select about original pieces.
- [#262] Automatic Update notification.
- [#424] Improve Formula Wizard dialog.
- Added "All/None" menu in detail list area for easier handling of many parts.
- [#560] Flipped pattern pieces in Layout.
# Version 0.4.5
- [#435] Valentina doesn't change the cursor.

View File

@ -6,6 +6,13 @@ include(common.pri)
error("Use at least Qt 5.0.0.")
}
#These checks need because we can quote all paths that contain space.
LIST = $$split(PWD,' ')
count(LIST, 1, >): error("The build will fail. Path '$${PWD}' contains space!!!")
LIST = $$split(OUT_PWD,' ')
count(LIST, 1, >): error("The build will fail. Path '$${OUT_PWD}' contains space!!!")
unix {
*-g++ {
GCC_VERSION = $$system("g++ -dumpversion")

74
code_of_conduct.md Normal file
View File

@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [contact@valentina-project.org]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@ -1,5 +1,15 @@
rem script helps create installer
rem detect windows version
ver | find "6.1" > nul
IF ERRORLEVEL = 1 GOTO ARCHITECTURE
IF ERRORLEVEL = 0 GOTO WIN7
:WIN7
chcp 65001
:ARCHITECTURE
rem find target architecture
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set ARCHITECTURE=32BIT || set ARCHITECTURE=64BIT
@ -8,6 +18,7 @@ if %ARCHITECTURE%==32BIT set nsis_path="C:/Program Files/Inno Setup 5/iscc.exe"
if %ARCHITECTURE%==64BIT set nsis_path="C:/Program Files (x86)/Inno Setup 5/iscc.exe"
if not exist %nsis_path% (
SET package_error="Package was not created!"
SET /P promt="Coudn't find Inno Setup. Do you want to continue?[Y\N]"
IF "%promt%" == "Y" GOTO PREPARE
IF "%promt%" == "y" GOTO PREPARE
@ -19,7 +30,11 @@ cd ..
cd
rem force qmake create new qm files
del /Q share\translations\*.qm
mkdir build
IF exist build (
echo Build exists. Clearing.
rd /s /q build
)
mkdir build && echo build created
cd build
cd
@ -54,5 +69,6 @@ echo Failed to make the first run qmake!
@pause
exit /b 1
:ONEXIT
echo Done!
echo Done! %package_error%
@pause

View File

@ -54,18 +54,22 @@ PatternPage::PatternPage(QWidget *parent):
undoCount(nullptr),
countStepsLabel(nullptr),
userMaterialsGroup(nullptr),
userMaterialClearButton(nullptr)
userMaterialClearButton(nullptr),
workpieceGroup(nullptr),
forbidFlippingCheck(nullptr)
{
QGroupBox *userGroup = UserGroup();
QGroupBox *graphOutputGroup = GraphOutputGroup();
QGroupBox *undoGroup = UndoGroup();
QGroupBox *userMatGroup = UserMaterialGroup();
QGroupBox *workpieceGroup = UserWorkpieceGroup();
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(userGroup);
mainLayout->addWidget(graphOutputGroup);
mainLayout->addWidget(undoGroup);
mainLayout->addWidget(userMatGroup);
mainLayout->addWidget(workpieceGroup);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
@ -85,6 +89,8 @@ void PatternPage::Apply()
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
* prints a warning and does nothing.*/
settings->SetUndoCount(undoCount->value());
settings->SetForbidWorkpieceFlipping(forbidFlippingCheck->isChecked());
}
//---------------------------------------------------------------------------------------------------------------------
@ -183,6 +189,22 @@ QGroupBox *PatternPage::UserMaterialGroup()
return userMaterialsGroup;
}
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *PatternPage::UserWorkpieceGroup()
{
workpieceGroup = new QGroupBox(tr("Workpiece"));
forbidFlippingCheck = new QCheckBox(tr("Forbid flipping"));
forbidFlippingCheck->setToolTip(tr("By default forbid flipping for all workpieces"));
forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping());
QVBoxLayout *editLayout = new QVBoxLayout;
editLayout->addWidget(forbidFlippingCheck);
workpieceGroup->setLayout(editLayout);
return workpieceGroup;
}
//---------------------------------------------------------------------------------------------------------------------
void PatternPage::RetranslateUi()
{

View File

@ -61,11 +61,14 @@ private:
QLabel *countStepsLabel;
QGroupBox *userMaterialsGroup;
QPushButton* userMaterialClearButton;
QGroupBox *workpieceGroup;
QCheckBox *forbidFlippingCheck;
QGroupBox *UserGroup() Q_REQUIRED_RESULT;
QGroupBox *GraphOutputGroup() Q_REQUIRED_RESULT;
QGroupBox *UndoGroup() Q_REQUIRED_RESULT;
QGroupBox *UserMaterialGroup() Q_REQUIRED_RESULT;
QGroupBox *UserWorkpieceGroup() Q_REQUIRED_RESULT;
void RetranslateUi();
};

View File

@ -33,6 +33,7 @@
#include "../vmisc/vabstractapplication.h"
#include "../vtools/undocommands/toggledetailinlayout.h"
#include <QMenu>
#include <QUndoStack>
//---------------------------------------------------------------------------------------------------------------------
@ -46,7 +47,10 @@ VWidgetDetails::VWidgetDetails(VContainer *data, VAbstractPattern *doc, QWidget
FillTable(m_data->DataDetails());
ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->tableWidget, &QTableWidget::cellClicked, this, &VWidgetDetails::InLayoutStateChanged);
connect(ui->tableWidget, &QTableWidget::customContextMenuRequested, this, &VWidgetDetails::ShowContextMenu);
}
//---------------------------------------------------------------------------------------------------------------------
@ -132,3 +136,70 @@ void VWidgetDetails::FillTable(const QHash<quint32, VDetail> *details)
ui->tableWidget->setCurrentCell(selectedRow, 0);
}
//---------------------------------------------------------------------------------------------------------------------
void VWidgetDetails::ShowContextMenu(const QPoint &pos)
{
QMenu *menu = new QMenu;
QAction *actionSelectAll = menu->addAction(tr("Select all"));
QAction *actionSelectNone = menu->addAction(tr("Select none"));
const QHash<quint32, VDetail> *allDetails = m_data->DataDetails();
if (not allDetails->count() == 0)
{
int selectedDetails = 0;
QHash<quint32, VDetail>::const_iterator iter = allDetails->constBegin();
while (iter != allDetails->constEnd())
{
if(iter.value().IsInLayout())
{
selectedDetails++;
}
++iter;
}
if (selectedDetails == 0)
{
actionSelectNone->setDisabled(true);
}
else if (selectedDetails == allDetails->size())
{
actionSelectAll->setDisabled(true);
}
QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos));
bool select;
if (selectedAction == actionSelectAll)
{
select = true;
qApp->getUndoStack()->beginMacro(tr("select all details"));
}
else if (selectedAction == actionSelectNone)
{
select = false;
qApp->getUndoStack()->beginMacro(tr("select none details"));
}
else
{
return;
}
for (int i = 0; i<ui->tableWidget->rowCount(); ++i)
{
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
const quint32 id = item->data(Qt::UserRole).toUInt();
if (not select == m_data->DataDetails()->value(id).IsInLayout())
{
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc);
connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(togglePrint);
}
}
qApp->getUndoStack()->endMacro();
}
else
{
return;
}
}

View File

@ -53,6 +53,7 @@ public slots:
private slots:
void InLayoutStateChanged(int row, int column);
void ShowContextMenu(const QPoint &pos);
private:
Q_DISABLE_COPY(VWidgetDetails)

View File

@ -476,6 +476,7 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *de
}
det.setWidth(qApp->toPixel(d.getWidth()));
det.CreateTextItems();
det.setForbidFlipping(d.getForbidFlipping());
listDetails.append(det);
++i;

View File

@ -616,6 +616,8 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1"));
detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1"));
detail.setForbidFlipping(GetParametrUInt(domElement, VToolDetail::AttrForbidFlipping,
QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
QStringList types = QStringList() << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline

View File

@ -17,6 +17,7 @@
<file>schema/pattern/v0.3.1.xsd</file>
<file>schema/pattern/v0.3.2.xsd</file>
<file>schema/pattern/v0.3.3.xsd</file>
<file>schema/pattern/v0.3.4.xsd</file>
<file>schema/standard_measurements/v0.3.0.xsd</file>
<file>schema/standard_measurements/v0.4.0.xsd</file>
<file>schema/standard_measurements/v0.4.1.xsd</file>

View File

@ -0,0 +1,572 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- XML Schema Generated from XML Document-->
<xs:element name="pattern">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="version" type="formatVersion"></xs:element>
<xs:element name="unit" type="units"></xs:element>
<xs:element name="image" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="extension" type="imageExtension"></xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="author" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="gradation" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="heights">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
<xs:attribute name="h92" type="xs:boolean"></xs:attribute>
<xs:attribute name="h98" type="xs:boolean"></xs:attribute>
<xs:attribute name="h104" type="xs:boolean"></xs:attribute>
<xs:attribute name="h110" type="xs:boolean"></xs:attribute>
<xs:attribute name="h116" type="xs:boolean"></xs:attribute>
<xs:attribute name="h122" type="xs:boolean"></xs:attribute>
<xs:attribute name="h128" type="xs:boolean"></xs:attribute>
<xs:attribute name="h134" type="xs:boolean"></xs:attribute>
<xs:attribute name="h140" type="xs:boolean"></xs:attribute>
<xs:attribute name="h146" type="xs:boolean"></xs:attribute>
<xs:attribute name="h152" type="xs:boolean"></xs:attribute>
<xs:attribute name="h158" type="xs:boolean"></xs:attribute>
<xs:attribute name="h164" type="xs:boolean"></xs:attribute>
<xs:attribute name="h170" type="xs:boolean"></xs:attribute>
<xs:attribute name="h176" type="xs:boolean"></xs:attribute>
<xs:attribute name="h182" type="xs:boolean"></xs:attribute>
<xs:attribute name="h188" type="xs:boolean"></xs:attribute>
<xs:attribute name="h194" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="sizes">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
<xs:attribute name="s22" type="xs:boolean"></xs:attribute>
<xs:attribute name="s24" type="xs:boolean"></xs:attribute>
<xs:attribute name="s26" type="xs:boolean"></xs:attribute>
<xs:attribute name="s28" type="xs:boolean"></xs:attribute>
<xs:attribute name="s30" type="xs:boolean"></xs:attribute>
<xs:attribute name="s32" type="xs:boolean"></xs:attribute>
<xs:attribute name="s34" type="xs:boolean"></xs:attribute>
<xs:attribute name="s36" type="xs:boolean"></xs:attribute>
<xs:attribute name="s38" type="xs:boolean"></xs:attribute>
<xs:attribute name="s40" type="xs:boolean"></xs:attribute>
<xs:attribute name="s42" type="xs:boolean"></xs:attribute>
<xs:attribute name="s44" type="xs:boolean"></xs:attribute>
<xs:attribute name="s46" type="xs:boolean"></xs:attribute>
<xs:attribute name="s48" type="xs:boolean"></xs:attribute>
<xs:attribute name="s50" type="xs:boolean"></xs:attribute>
<xs:attribute name="s52" type="xs:boolean"></xs:attribute>
<xs:attribute name="s54" type="xs:boolean"></xs:attribute>
<xs:attribute name="s56" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="custom" type="xs:boolean"></xs:attribute>
<xs:attribute name="defHeight" type="baseHeight"></xs:attribute>
<xs:attribute name="defSize" type="baseSize"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="patternName" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="patternNumber" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="company" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="customer" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="size" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="showDate" type="xs:boolean" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="showMeasurements" type="xs:boolean" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="measurements" type="xs:string"></xs:element>
<xs:element name="increments" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="description" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="name" type="shortName" use="required"></xs:attribute>
<xs:attribute name="formula" type="xs:string" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="incrementName">
<xs:selector xpath="increment"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:element name="draw" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="calculation" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="x" type="xs:double"></xs:attribute>
<xs:attribute name="y" type="xs:double"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="name" type="shortName"></xs:attribute>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="thirdPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="basePoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="pShoulder" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
<xs:attribute name="splinePath" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="spline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="axisP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="axisP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="arc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="lineColor" type="colors"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="firstArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="crossPoint" type="crossType"></xs:attribute>
<xs:attribute name="vCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="hCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="c1Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c2Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c1Radius" type="xs:string"></xs:attribute>
<xs:attribute name="c2Radius" type="xs:string"></xs:attribute>
<xs:attribute name="cRadius" type="xs:string"></xs:attribute>
<xs:attribute name="tangent" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="cCenter" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="name1" type="shortName"></xs:attribute>
<xs:attribute name="mx1" type="xs:double"></xs:attribute>
<xs:attribute name="my1" type="xs:double"></xs:attribute>
<xs:attribute name="name2" type="shortName"></xs:attribute>
<xs:attribute name="mx2" type="xs:double"></xs:attribute>
<xs:attribute name="my2" type="xs:double"></xs:attribute>
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP3" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="baseLineP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="baseLineP2" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
<xs:attribute name="lineColor" type="colors"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="operation" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="source" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="destination" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="suffix" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="pathPoint" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="kAsm2" type="xs:string"></xs:attribute>
<xs:attribute name="pSpline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="length1" type="xs:string"></xs:attribute>
<xs:attribute name="length2" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="kCurve" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:double"></xs:attribute>
<xs:attribute name="kAsm2" type="xs:double"></xs:attribute>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="length1" type="xs:string"></xs:attribute>
<xs:attribute name="length2" type="xs:string"></xs:attribute>
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point3" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point4" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="duplicate" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="modeling" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="tools" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="det" minOccurs="2" maxOccurs="2">
<xs:complexType>
<xs:sequence>
<xs:element name="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="children" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="indexD1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="indexD2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="details" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="data" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="mcp" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="cutNumber" type="xs:unsignedInt"/>
<xs:attribute name="userDef" type="xs:string"/>
<xs:attribute name="material" type="materialType"/>
<xs:attribute name="placement" type="placementType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="letter" type="xs:string"></xs:attribute>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="height" type="xs:double"></xs:attribute>
<xs:attribute name="rotation" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="height" type="xs:double"></xs:attribute>
<xs:attribute name="rotation" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="supplement" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="closed" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="forbidFlipping" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inLayout" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="groups" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="group" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="object" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="tool" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="readOnly" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="^([^0-9*/^+\-=\s()?%:;!.,`'\&quot;]){1,1}([^*/^+\-=\s()?%:;!.,`'\&quot;]){0,}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">
<xs:restriction base="xs:string">
<xs:enumeration value="mm"/>
<xs:enumeration value="cm"/>
<xs:enumeration value="inch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="measurementsTypes">
<xs:restriction base="xs:string">
<xs:enumeration value="standard"/>
<xs:enumeration value="individual"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">
<xs:restriction base="xs:string">
<xs:pattern value="^(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="imageExtension">
<xs:restriction base="xs:string">
<xs:enumeration value="PNG"/>
<xs:enumeration value="JPG"/>
<xs:enumeration value="BMP"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="colors">
<xs:restriction base="xs:string">
<xs:enumeration value="black"/>
<xs:enumeration value="green"/>
<xs:enumeration value="blue"/>
<xs:enumeration value="darkRed"/>
<xs:enumeration value="darkGreen"/>
<xs:enumeration value="darkBlue"/>
<xs:enumeration value="yellow"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseHeight">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="92"/>
<xs:enumeration value="98"/>
<xs:enumeration value="104"/>
<xs:enumeration value="110"/>
<xs:enumeration value="116"/>
<xs:enumeration value="122"/>
<xs:enumeration value="128"/>
<xs:enumeration value="134"/>
<xs:enumeration value="140"/>
<xs:enumeration value="146"/>
<xs:enumeration value="152"/>
<xs:enumeration value="158"/>
<xs:enumeration value="164"/>
<xs:enumeration value="170"/>
<xs:enumeration value="176"/>
<xs:enumeration value="182"/>
<xs:enumeration value="188"/>
<xs:enumeration value="194"/>
<xs:enumeration value="920"/>
<xs:enumeration value="980"/>
<xs:enumeration value="1040"/>
<xs:enumeration value="1100"/>
<xs:enumeration value="1160"/>
<xs:enumeration value="1220"/>
<xs:enumeration value="1280"/>
<xs:enumeration value="1340"/>
<xs:enumeration value="1400"/>
<xs:enumeration value="1460"/>
<xs:enumeration value="1520"/>
<xs:enumeration value="1580"/>
<xs:enumeration value="1640"/>
<xs:enumeration value="1700"/>
<xs:enumeration value="1760"/>
<xs:enumeration value="1820"/>
<xs:enumeration value="1880"/>
<xs:enumeration value="1940"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseSize">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="22"/>
<xs:enumeration value="24"/>
<xs:enumeration value="26"/>
<xs:enumeration value="28"/>
<xs:enumeration value="30"/>
<xs:enumeration value="32"/>
<xs:enumeration value="34"/>
<xs:enumeration value="36"/>
<xs:enumeration value="38"/>
<xs:enumeration value="40"/>
<xs:enumeration value="42"/>
<xs:enumeration value="44"/>
<xs:enumeration value="46"/>
<xs:enumeration value="48"/>
<xs:enumeration value="50"/>
<xs:enumeration value="52"/>
<xs:enumeration value="54"/>
<xs:enumeration value="56"/>
<xs:enumeration value="220"/>
<xs:enumeration value="240"/>
<xs:enumeration value="260"/>
<xs:enumeration value="280"/>
<xs:enumeration value="300"/>
<xs:enumeration value="320"/>
<xs:enumeration value="340"/>
<xs:enumeration value="360"/>
<xs:enumeration value="380"/>
<xs:enumeration value="400"/>
<xs:enumeration value="420"/>
<xs:enumeration value="440"/>
<xs:enumeration value="460"/>
<xs:enumeration value="480"/>
<xs:enumeration value="500"/>
<xs:enumeration value="520"/>
<xs:enumeration value="540"/>
<xs:enumeration value="560"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="crossType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="materialType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--Fabric-->
<xs:enumeration value="1"/><!--Lining-->
<xs:enumeration value="2"/><!--Interfacing-->
<xs:enumeration value="3"/><!--Interlining-->
<xs:enumeration value="4"/><!--UserDefined-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="placementType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--No placement-->
<xs:enumeration value="1"/><!--Cut on Fold-->
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -58,8 +58,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.3");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.3.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.4");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.4.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -165,6 +165,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000302):
return QStringLiteral("://schema/pattern/v0.3.2.xsd");
case (0x000303):
return QStringLiteral("://schema/pattern/v0.3.3.xsd");
case (0x000304):
return CurrentSchema;
default:
InvalidVersion(ver);
@ -244,6 +246,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000303), fileName);
V_FALLTHROUGH
case (0x000303):
ToV0_3_4();
ValidateXML(XSDSchema(0x000304), fileName);
V_FALLTHROUGH
case (0x000304):
break;
default:
break;
@ -397,6 +403,13 @@ void VPatternConverter::ToV0_3_3()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_3_4()
{
SetVersion(QStringLiteral("0.3.4"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{

View File

@ -55,10 +55,10 @@ public:
// GCC 4.6 doesn't allow constexpr and const together
#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406
static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3);
static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 4);
#else
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 4);
#endif
protected:
@ -92,6 +92,7 @@ private:
void ToV0_3_1();
void ToV0_3_2();
void ToV0_3_3();
void ToV0_3_4();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View File

@ -39,34 +39,6 @@
#endif // _MSC_VER > 1000
#endif // Q_CC_MSVC
#if defined(__OS2__)||defined(__EMX__)
#define strcasecmp(s,t) stricmp(s,t)
#endif
#if defined(_WIN32)&&!defined(strcasecmp)
#define strcasecmp(s,t) _stricmp(s,t)
#endif
#ifdef _WIN32
#undef M_PI
#define M_PI 3.14159265358979323846
QT_WARNING_DISABLE_MSVC(4800)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif
#ifndef M_2PI
#define M_2PI 6.28318530717958647692 /* 2*pi */
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#endif
#define DL_DXF_MAXLINE 1024
#define DL_DXF_MAXGROUPCODE 1100

View File

@ -38,15 +38,12 @@
#include <QtGlobal>
#include "../ifc/ifcdef.h"
#include "../vmisc/vmath.h"
#include "vgeometrydef.h"
#include "vgobject.h"
class QPointF;
#ifndef M_2PI
#define M_2PI 6.28318530717958647692528676655900576
#endif
enum class PathDirection : char { Hide, Show };
class QLineF;

View File

@ -178,6 +178,18 @@ void VAbstractDetail::setWidth(const qreal &value)
d->width = value;
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractDetail::getForbidFlipping() const
{
return d->forbidFlipping;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractDetail::setForbidFlipping(bool value)
{
d->forbidFlipping = value;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractDetail::Equidistant(const QVector<QPointF> &points, const EquidistantType &eqv, qreal width)
{

View File

@ -67,6 +67,9 @@ public:
qreal getWidth() const;
void setWidth(const qreal &value);
bool getForbidFlipping() const;
void setForbidFlipping(bool value);
static QVector<QPointF> Equidistant(const QVector<QPointF> &points, const EquidistantType &eqv, qreal width);
static qreal SumTrapezoids(const QVector<QPointF> &points);
static QVector<QPointF> CheckLoops(const QVector<QPointF> &points);

View File

@ -41,16 +41,16 @@ class VAbstractDetailData : public QSharedData
{
public:
VAbstractDetailData()
:name(QString()), seamAllowance(false), closed(true), width(0)
:name(QString()), seamAllowance(false), closed(true), width(0), forbidFlipping(false)
{}
explicit VAbstractDetailData(const QString &name)
:name(name), seamAllowance(false), closed(true), width(0)
:name(name), seamAllowance(false), closed(true), width(0), forbidFlipping(false)
{}
VAbstractDetailData(const VAbstractDetailData &detail)
:QSharedData(detail), name(detail.name), seamAllowance(detail.seamAllowance), closed(detail.closed),
width(detail.width)
width(detail.width), forbidFlipping(detail.forbidFlipping)
{}
~VAbstractDetailData() {}
@ -63,6 +63,8 @@ public:
bool closed;
/** @brief width value seamAllowance in mm. */
qreal width;
/** @brief forbidFlipping forbid piece be mirrored in a layout. */
bool forbidFlipping;
private:
VAbstractDetailData &operator=(const VAbstractDetailData &) Q_DECL_EQ_DELETE;

View File

@ -135,30 +135,35 @@ void VLayoutPaper::SetShift(quint32 shift)
//---------------------------------------------------------------------------------------------------------------------
bool VLayoutPaper::GetRotate() const
{
return d->rotate;
return d->globalRotate;
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutPaper::SetRotate(bool value)
{
d->rotate = value;
d->globalRotate = value;
d->localRotate = d->globalRotate;
}
//---------------------------------------------------------------------------------------------------------------------
int VLayoutPaper::GetRotationIncrease() const
{
return d->rotationIncrease;
return d->globalRotationIncrease;
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutPaper::SetRotationIncrease(int value)
{
d->rotationIncrease = value;
d->globalRotationIncrease = value;
if ((d->rotationIncrease >= 1 && d->rotationIncrease <= 180 && 360 % d->rotationIncrease == 0) == false)
if ((d->globalRotationIncrease >= 1
&& d->globalRotationIncrease <= 180
&& 360 % d->globalRotationIncrease == 0) == false)
{
d->rotationIncrease = 180;
d->globalRotationIncrease = 180;
}
d->localRotationIncrease = d->globalRotationIncrease;
}
//---------------------------------------------------------------------------------------------------------------------
@ -193,6 +198,17 @@ bool VLayoutPaper::ArrangeDetail(const VLayoutDetail &detail, volatile bool &sto
return false;//Not enough edges
}
if (detail.getForbidFlipping() && not d->globalRotate)
{ // Compensate forbidden flipping by rotating. 180 degree will be enough.
d->localRotate = true;
d->localRotationIncrease = 180;
}
else
{ // Return to global values if was changed
d->localRotate = d->globalRotate;
d->localRotationIncrease = d->globalRotationIncrease;
}
d->frame = 0;
return AddToSheet(detail, stop);
@ -216,7 +232,8 @@ bool VLayoutPaper::AddToSheet(const VLayoutDetail &detail, volatile bool &stop)
{
for (int i=1; i<= detail.EdgesCount(); ++i)
{
VPosition *thread = new VPosition(d->globalContour, j, detail, i, &stop, d->rotate, d->rotationIncrease,
VPosition *thread = new VPosition(d->globalContour, j, detail, i, &stop, d->localRotate,
d->localRotationIncrease,
d->saveLength);
//Info for debug
#ifdef LAYOUT_DEBUG
@ -230,7 +247,7 @@ bool VLayoutPaper::AddToSheet(const VLayoutDetail &detail, volatile bool &stop)
threads.append(thread);
thread_pool->start(thread);
d->frame = d->frame + 3 + static_cast<quint32>(360/d->rotationIncrease*2);
d->frame = d->frame + 3 + static_cast<quint32>(360/d->localRotationIncrease*2);
}
}

View File

@ -43,19 +43,44 @@ class VLayoutPaperData : public QSharedData
{
public:
VLayoutPaperData()
:details(QVector<VLayoutDetail>()), globalContour(VContour()), paperIndex(0), frame(0), layoutWidth(0),
rotate(true), rotationIncrease(180), saveLength(false)
: details(QVector<VLayoutDetail>()),
globalContour(VContour()),
paperIndex(0),
frame(0),
layoutWidth(0),
globalRotate(true),
localRotate(true),
globalRotationIncrease(180),
localRotationIncrease(180),
saveLength(false)
{}
VLayoutPaperData(int height, int width)
:details(QVector<VLayoutDetail>()), globalContour(VContour(height, width)), paperIndex(0), frame(0),
layoutWidth(0), rotate(true), rotationIncrease(180), saveLength(false)
VLayoutPaperData(int height,
int width)
: details(QVector<VLayoutDetail>()),
globalContour(VContour(height, width)),
paperIndex(0),
frame(0),
layoutWidth(0),
globalRotate(true),
localRotate(true),
globalRotationIncrease(180),
localRotationIncrease(180),
saveLength(false)
{}
VLayoutPaperData(const VLayoutPaperData &paper)
:QSharedData(paper), details(paper.details), globalContour(paper.globalContour), paperIndex(paper.paperIndex),
frame(paper.frame), layoutWidth(paper.layoutWidth), rotate(paper.rotate),
rotationIncrease(paper.rotationIncrease), saveLength(paper.saveLength)
: QSharedData(paper),
details(paper.details),
globalContour(paper.globalContour),
paperIndex(paper.paperIndex),
frame(paper.frame),
layoutWidth(paper.layoutWidth),
globalRotate(paper.globalRotate),
localRotate(paper.localRotate),
globalRotationIncrease(paper.globalRotationIncrease),
localRotationIncrease(paper.localRotationIncrease),
saveLength(paper.saveLength)
{}
~VLayoutPaperData() {}
@ -69,8 +94,10 @@ public:
quint32 paperIndex;
quint32 frame;
qreal layoutWidth;
bool rotate;
int rotationIncrease;
bool globalRotate;
bool localRotate;
int globalRotationIncrease;
int localRotationIncrease;
bool saveLength;
private:

View File

@ -294,7 +294,7 @@ bool VPosition::CheckCombineEdges(VLayoutDetail &detail, int j, int &dEdge)
break;
}
if (flagMirror)
if (flagMirror && not detail.getForbidFlipping())
{
#ifdef LAYOUT_DEBUG
#ifdef SHOW_MIRROR

View File

@ -61,6 +61,7 @@ const QString VCommonSettings::SettingConfigurationToolBarStyle = QString
const QString VCommonSettings::SettingPatternUser = QStringLiteral("pattern/user");
const QString VCommonSettings::SettingPatternUndo = QStringLiteral("pattern/undo");
const QString VCommonSettings::SettingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping");
const QString VCommonSettings::SettingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString VCommonSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList");
@ -486,3 +487,15 @@ void VCommonSettings::ClearUserDefinedMaterial()
QStringList qsl;
setValue(SettingUserDefinedMaterials, qsl);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetForbidWorkpieceFlipping() const
{
return value(SettingPatternForbidFlipping, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetForbidWorkpieceFlipping(bool value)
{
setValue(SettingPatternForbidFlipping, value);
}

View File

@ -122,6 +122,9 @@ public:
void AddUserDefinedMaterial(QString qsMaterial);
void ClearUserDefinedMaterial();
bool GetForbidWorkpieceFlipping() const;
void SetForbidWorkpieceFlipping(bool value);
private:
Q_DISABLE_COPY(VCommonSettings)
@ -141,6 +144,7 @@ private:
static const QString SettingPatternUser;
static const QString SettingPatternUndo;
static const QString SettingPatternForbidFlipping;
static const QString SettingGeneralRecentFileList;
static const QString SettingGeneralRestoreFileList;

View File

@ -48,5 +48,33 @@ Q_DECL_CONSTEXPR inline double qRadiansToDegrees(double radians)
#endif // QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
#ifndef M_2PI
#define M_2PI (6.28318530717958647692) /* 2*pi */
#endif
#ifndef M_3PI_4
#define M_3PI_4 (2.35619449019234492884) /* 3*pi/4 */
#endif
#ifndef M_3PI_8
#define M_3PI_8 (1.17809724509617246442) /* 3*pi/8 */
#endif
#ifndef M_PI_8
#define M_PI_8 (0.39269908169872415480) /* pi/8 */
#endif
#ifndef M_4_PI
#define M_4_PI (1.27323954473516268615) /* 4/pi */
#endif
#ifndef M_1_SQRT2
#define M_1_SQRT2 (0.70710678118654752440) /* 1/sqrt(2) */
#endif
#ifndef M_EULER
#define M_EULER (0.57721566490153286060)
#endif
#endif // VMATH_H

View File

@ -85,6 +85,8 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
ui.lineEditLetter->setClearButtonEnabled(true);
#endif
ui.checkBoxForbidFlipping->setChecked(qApp->Settings()->GetForbidWorkpieceFlipping());
labelEditNamePoint = ui.labelEditName;
ui.labelUnit->setText( VDomDocument::UnitsToStr(qApp->patternUnit(), true));
ui.labelUnitX->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
@ -442,6 +444,7 @@ VDetail DialogDetail::CreateDetail() const
detail.setName(ui.lineEditName->text());
detail.setSeamAllowance(supplement);
detail.setClosed(closed);
detail.setForbidFlipping(ui.checkBoxForbidFlipping->isChecked());
detail.GetPatternPieceData().SetLetter(ui.lineEditLetter->text());
@ -510,6 +513,7 @@ void DialogDetail::setDetail(const VDetail &value)
ui.lineEditName->setText(detail.getName());
ui.checkBoxSeams->setChecked(detail.getSeamAllowance());
ui.checkBoxClosed->setChecked(detail.getClosed());
ui.checkBoxForbidFlipping->setChecked(detail.getForbidFlipping());
ClickedClosed(detail.getClosed());
ClickedSeams(detail.getSeamAllowance());
ui.doubleSpinBoxSeams->setValue(detail.getWidth());

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>581</width>
<height>442</height>
<height>468</height>
</rect>
</property>
<property name="windowTitle">
@ -24,7 +24,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -66,7 +66,7 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
@ -186,6 +186,16 @@
<string>Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxForbidFlipping">
<property name="toolTip">
<string>Forbid piece be mirrored in a layout.</string>
</property>
<property name="text">
<string>Forbid flipping</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSeams">
<property name="text">
@ -361,7 +371,7 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget1">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QFormLayout" name="formLayout">

View File

@ -116,6 +116,7 @@ const QString VToolDetail::TagNode = QStringLiteral("node");
const QString VToolDetail::AttrSupplement = QStringLiteral("supplement");
const QString VToolDetail::AttrClosed = QStringLiteral("closed");
const QString VToolDetail::AttrForbidFlipping = QStringLiteral("forbidFlipping");
const QString VToolDetail::AttrWidth = QStringLiteral("width");
const QString VToolDetail::AttrHeight = QStringLiteral("height");
const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType");
@ -306,6 +307,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac
det.setWidth(detail.getWidth());
det.setClosed(detail.getClosed());
det.setSeamAllowance(detail.getSeamAllowance());
det.setForbidFlipping(detail.getForbidFlipping());
Create(0, det, scene, doc, data, Document::FullParse, Source::FromGui);
}
@ -431,6 +433,7 @@ void VToolDetail::AddToFile()
doc->SetAttribute(domElement, AttrSupplement, static_cast<quint8>(detail.getSeamAllowance()));
doc->SetAttribute(domElement, AttrClosed, static_cast<quint8>(detail.getClosed()));
doc->SetAttribute(domElement, AttrWidth, detail.getWidth());
doc->SetAttribute(domElement, AttrForbidFlipping, static_cast<quint8>(detail.getForbidFlipping()));
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
const VPatternPieceData& data = detail.GetPatternPieceData();
@ -452,10 +455,6 @@ void VToolDetail::AddToFile()
{
doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef);
}
else
{
domMCP.removeAttribute(VAbstractPattern::AttrUserDefined);
}
doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber);
doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement));
domData.appendChild(domMCP);

View File

@ -72,6 +72,7 @@ public:
static const QString TagNode;
static const QString AttrSupplement;
static const QString AttrClosed;
static const QString AttrForbidFlipping;
static const QString AttrWidth;
static const QString AttrHeight;
static const QString AttrNodeType;

View File

@ -140,6 +140,7 @@ void SaveDetailOptions::SaveDet(QDomElement &domElement, const VDetail &det)
doc->SetAttribute(domElement, VToolDetail::AttrSupplement, QString().setNum(det.getSeamAllowance()));
doc->SetAttribute(domElement, VToolDetail::AttrClosed, QString().setNum(det.getClosed()));
doc->SetAttribute(domElement, VToolDetail::AttrWidth, QString().setNum(det.getWidth()));
doc->SetAttribute(domElement, VToolDetail::AttrForbidFlipping, QString().setNum(det.getForbidFlipping()));
}
//---------------------------------------------------------------------------------------------------------------------