From 6577d82771db104d5960442169d9d2e96d18aa2b Mon Sep 17 00:00:00 2001
From: BojanKverh <bojan.kverh@gmail.com>
Date: Mon, 27 Jun 2016 17:18:43 +0200
Subject: [PATCH] Added new schema to accomodate for new parameters and did
 some other minor changes. There is a bug with Undo on details label, will
 check that later

--HG--
branch : feature
---
 src/app/valentina/xml/vpattern.cpp            |  16 +-
 src/libs/ifc/schema.qrc                       |   1 +
 src/libs/ifc/schema/pattern/v0.3.3.xsd        | 545 ++++++++++++++++++
 src/libs/ifc/xml/vabstractpattern.cpp         |  32 +-
 src/libs/ifc/xml/vabstractpattern.h           |   6 +-
 src/libs/ifc/xml/vpatternconverter.cpp        |   6 +-
 src/libs/vpatterndb/vpatternpiecedata.cpp     |  12 +
 src/libs/vpatterndb/vpatternpiecedata.h       |   5 +
 src/libs/vtools/tools/vtextgraphicsitem.cpp   |  68 ++-
 src/libs/vtools/tools/vtextgraphicsitem.h     |   6 +-
 src/libs/vtools/tools/vtooldetail.cpp         |  18 +-
 src/libs/vtools/tools/vtooldetail.h           |   1 +
 .../vtools/undocommands/savedetailoptions.cpp |   1 +
 13 files changed, 649 insertions(+), 68 deletions(-)
 create mode 100644 src/libs/ifc/schema/pattern/v0.3.3.xsd

diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp
index fa5141149..63e75885b 100644
--- a/src/app/valentina/xml/vpattern.cpp
+++ b/src/app/valentina/xml/vpattern.cpp
@@ -138,7 +138,7 @@ void VPattern::Parse(const Document &parse)
     QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes
                                      << TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit
                                      << TagPatternName << TagPatternNum << TagCompanyName << TagCustomerName
-                                     << TagCreationDate << TagLabelPos << TagLabelWidth << TagLabelFont;
+                                     << TagCreationDate << TagLabelPos << TagLabelSize << TagLabelFont;
     PrepareForParse(parse);
     QDomNode domNode = documentElement().firstChild();
     while (domNode.isNull() == false)
@@ -216,8 +216,8 @@ void VPattern::Parse(const Document &parse)
                     case 15: // TagLabelPos
                         qCDebug(vXML, "Label position.");
                         break;
-                    case 16: // TagLabelWidth
-                        qCDebug(vXML, "Label width.");
+                    case 16: // TagLabelSize
+                        qCDebug(vXML, "Label size.");
                         break;
                     case 17: // TagLabelFont
                         qCDebug(vXML, "Label font size.");
@@ -614,11 +614,6 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
     Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
     try
     {
-        QString qs;
-        QTextStream ts(&qs, QIODevice::WriteOnly);
-        domElement.save(ts, 2);
-        qDebug() << "Parse detail" << qs;
-
         VDetail detail;
         const quint32 id = GetParametrId(domElement);
         detail.setName(GetParametrString(domElement, AttrName, ""));
@@ -681,6 +676,11 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
                     detail.GetPatternPieceData().SetPos(ptPos);
                     qreal dLW = element.attribute(VToolDetail::AttrWidth, "0").toDouble();
                     detail.GetPatternPieceData().SetLabelWidth(dLW);
+                    qreal dLH = element.attribute(VToolDetail::AttrHeight, "0").toDouble();
+                    detail.GetPatternPieceData().SetLabelHeight(dLH);
+                    qDebug() << "HEIGHT" <<
+                                detail.GetPatternPieceData().GetPos() <<
+                                detail.GetPatternPieceData().GetLabelHeight();
                     int iFS = element.attribute(VToolDetail::AttrFont, "0").toInt();
                     detail.GetPatternPieceData().SetFontSize(iFS);
 
diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc
index fe077d4dc..04fbb08f5 100644
--- a/src/libs/ifc/schema.qrc
+++ b/src/libs/ifc/schema.qrc
@@ -25,5 +25,6 @@
         <file>schema/individual_measurements/v0.3.1.xsd</file>
         <file>schema/individual_measurements/v0.3.2.xsd</file>
         <file>schema/individual_measurements/v0.3.3.xsd</file>
+        <file>schema/pattern/v0.3.3.xsd</file>
     </qresource>
 </RCC>
diff --git a/src/libs/ifc/schema/pattern/v0.3.3.xsd b/src/libs/ifc/schema/pattern/v0.3.3.xsd
new file mode 100644
index 000000000..64d1650d6
--- /dev/null
+++ b/src/libs/ifc/schema/pattern/v0.3.3.xsd
@@ -0,0 +1,545 @@
+<?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="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="created" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
+                            <xs:element name="labelPosition" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
+                            <xs:element name="labelSize" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
+                            <xs:element name="fontSize" type="xs:unsignedInt" 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="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" maxOccurs="1">
+                                                                                   <xs:complexType>
+                                                                                       <xs:sequence>
+                                                                                           <xs:element name="mcp" maxOccurs="1">
+                                                                                               <xs:complexType>
+                                                                                                   <xs:attribute name="cutNumber" type="xs:unsignedInt"/>
+                                                                                                   <xs:attribute name="userDef" type="xs:string"/>
+                                                                                                   <xs:attribute name="material" type="xs:unsignedInt"/>
+                                                                                                   <xs:attribute name="placement" type="xs:unsignedInt"/>
+                                                                                               </xs:complexType>
+                                                                                           </xs:element>
+                                                                                       </xs:sequence>
+                                                                                       <xs:attribute name="name" type="xs:string"></xs:attribute>
+                                                                                       <xs:attribute name="letter" type="xs:string"></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: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="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:schema>
diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp
index fc9a8e0ae..ca24447e5 100644
--- a/src/libs/ifc/xml/vabstractpattern.cpp
+++ b/src/libs/ifc/xml/vabstractpattern.cpp
@@ -68,7 +68,7 @@ const QString VAbstractPattern::TagCustomerName = QStringLiteral("customer");
 const QString VAbstractPattern::TagCompanyName  = QStringLiteral("company");
 const QString VAbstractPattern::TagCreationDate = QStringLiteral("created");
 const QString VAbstractPattern::TagLabelPos     = QStringLiteral("labelPosition");
-const QString VAbstractPattern::TagLabelWidth   = QStringLiteral("labelWidth");
+const QString VAbstractPattern::TagLabelSize   = QStringLiteral("labelSize");
 const QString VAbstractPattern::TagLabelFont    = QStringLiteral("fontSize");
 
 const QString VAbstractPattern::AttrName        = QStringLiteral("name");
@@ -1108,22 +1108,30 @@ void VAbstractPattern::SetLabelPosition(const QPointF& ptPos)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-qreal VAbstractPattern::GetLabelWidth() const
+QSizeF VAbstractPattern::GetLabelSize() const
 {
-    bool bOK;
-    qreal fW = UniqueTagText(TagLabelWidth).toDouble(&bOK);
-    if (bOK == false)
+    QStringList qsl = UniqueTagText(TagLabelSize).split(",");
+    QSizeF sz(0, 0);
+    if (qsl.count() == 2)
     {
-        fW = 0;
+        bool bOKW;
+        bool bOKH;
+        double fW = qsl[0].toDouble(&bOKW);
+        double fH = qsl[1].toDouble(&bOKH);
+        if (bOKW == true && bOKH == true)
+        {
+            sz.setWidth(fW);
+            sz.setHeight(fH);
+        }
     }
-    return fW;
+    return sz;
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VAbstractPattern::SetLabelWidth(qreal fW)
+void VAbstractPattern::SetLabelSize(QSizeF sz)
 {
-    CheckTagExists(TagLabelWidth);
-    setTagText(TagLabelWidth, QString::number(fW, 'f', 3));
+    CheckTagExists(TagLabelSize);
+    setTagText(TagLabelSize, QString::number(sz.width(), 'f', 3) + "," + QString::number(sz.height(), 'f', 3));
     modified = true;
     emit patternChanged(false);
 }
@@ -1274,7 +1282,7 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
     {
         const QStringList tags = QStringList() << TagUnit << TagImage << TagAuthor << TagDescription << TagNotes
                                          << TagGradation << TagPatternName << TagPatternNum << TagCompanyName
-                                            << TagCustomerName << TagCreationDate << TagLabelPos << TagLabelWidth
+                                            << TagCustomerName << TagCreationDate << TagLabelPos << TagLabelSize
                                                << TagLabelFont;
         switch (tags.indexOf(tag))
         {
@@ -1348,7 +1356,7 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
             }
             case 12:
             {
-                element = createElement(TagLabelWidth);
+                element = createElement(TagLabelSize);
                 break;
             }
             case 13:
diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h
index fe6a44094..f0dc2dcf0 100644
--- a/src/libs/ifc/xml/vabstractpattern.h
+++ b/src/libs/ifc/xml/vabstractpattern.h
@@ -119,8 +119,8 @@ public:
     QDate          GetCreationDate() const;
     QPointF        GetLabelPosition() const;
     void           SetLabelPosition(const QPointF& ptPos);
-    qreal          GetLabelWidth() const;
-    void           SetLabelWidth(qreal fW);
+    QSizeF         GetLabelSize() const;
+    void           SetLabelSize(QSizeF sz);
     int            GetFontSize() const;
     void           SetFontSize(int iFS);
 
@@ -180,7 +180,7 @@ public:
     static const QString TagCustomerName;
     static const QString TagCreationDate;
     static const QString TagLabelPos;
-    static const QString TagLabelWidth;
+    static const QString TagLabelSize;
     static const QString TagLabelFont;
 
     static const QString AttrName;
diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp
index cb16a65fc..2e9fe11d1 100644
--- a/src/libs/ifc/xml/vpatternconverter.cpp
+++ b/src/libs/ifc/xml/vpatternconverter.cpp
@@ -43,8 +43,8 @@
  */
 
 const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
-const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.2");
-const QString VPatternConverter::CurrentSchema    = QStringLiteral("://schema/pattern/v0.3.2.xsd");
+const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.3");
+const QString VPatternConverter::CurrentSchema    = QStringLiteral("://schema/pattern/v0.3.3.xsd");
 
 //---------------------------------------------------------------------------------------------------------------------
 VPatternConverter::VPatternConverter(const QString &fileName)
@@ -117,6 +117,8 @@ QString VPatternConverter::XSDSchema(int ver) const
         case (0x000301):
             return QStringLiteral("://schema/pattern/v0.3.1.xsd");
         case (0x000302):
+            return QStringLiteral("://schema/pattern/v0.3.2.xsd");
+        case (0x000303):
             return CurrentSchema;
         default:
             InvalidVersion(ver);
diff --git a/src/libs/vpatterndb/vpatternpiecedata.cpp b/src/libs/vpatterndb/vpatternpiecedata.cpp
index 560d776a6..7b939a770 100644
--- a/src/libs/vpatterndb/vpatternpiecedata.cpp
+++ b/src/libs/vpatterndb/vpatternpiecedata.cpp
@@ -141,6 +141,18 @@ void VPatternPieceData::SetLabelWidth(qreal dLabelW)
     m_dLabelWidth = dLabelW;
 }
 
+//---------------------------------------------------------------------------------------------------------------------
+qreal VPatternPieceData::GetLabelHeight() const
+{
+    return m_dLabelHeight;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void VPatternPieceData::SetLabelHeight(qreal dLabelH)
+{
+    m_dLabelHeight = dLabelH;
+}
+
 //---------------------------------------------------------------------------------------------------------------------
 int VPatternPieceData::GetFontSize() const
 {
diff --git a/src/libs/vpatterndb/vpatternpiecedata.h b/src/libs/vpatterndb/vpatternpiecedata.h
index aee873fbb..ab0295d82 100644
--- a/src/libs/vpatterndb/vpatternpiecedata.h
+++ b/src/libs/vpatterndb/vpatternpiecedata.h
@@ -89,6 +89,8 @@ public:
     void                        SetPos(const QPointF& ptPos);
     qreal                       GetLabelWidth() const;
     void                        SetLabelWidth(qreal dLabelW);
+    qreal                       GetLabelHeight() const;
+    void                        SetLabelHeight(qreal dLabelH);
     int                         GetFontSize() const;
     void                        SetFontSize(int iSize);
 
@@ -108,6 +110,9 @@ private:
     /** @brief Label width
      */
     qreal               m_dLabelWidth;
+    /** @brief Label height
+     */
+    qreal               m_dLabelHeight;
     /** @brief Label font size
      */
     int                 m_iFontSize;
diff --git a/src/libs/vtools/tools/vtextgraphicsitem.cpp b/src/libs/vtools/tools/vtextgraphicsitem.cpp
index 1d27cc508..121e6c6f5 100644
--- a/src/libs/vtools/tools/vtextgraphicsitem.cpp
+++ b/src/libs/vtools/tools/vtextgraphicsitem.cpp
@@ -50,7 +50,7 @@ VTextGraphicsItem::VTextGraphicsItem(QGraphicsItem* pParent)
     m_eMode = mNormal;
     m_rectBoundingBox.setTopLeft(QPointF(0, 0));
     m_iMinH = MIN_H;
-    Resize(MIN_W, m_iMinH);
+    SetSize(MIN_W, m_iMinH);
     setZValue(2);
 }
 
@@ -71,7 +71,7 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
 
     // draw text lines
     int iY = 0;
-    int iH;
+    int iH = 0;
     painter->setPen(Qt::black);
     QFont fnt = m_font;
     for (int i = 0; i < m_liOutput.count(); ++i)
@@ -104,6 +104,14 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
     }
 }
 
+//---------------------------------------------------------------------------------------------------------------------
+void VTextGraphicsItem::Reset()
+{
+    m_eMode = mNormal;
+    Update();
+    setZValue(2);
+}
+
 //---------------------------------------------------------------------------------------------------------------------
 void VTextGraphicsItem::AddLine(const TextLine& tl)
 {
@@ -114,7 +122,7 @@ void VTextGraphicsItem::AddLine(const TextLine& tl)
     }
     if (m_rectBoundingBox.height() < m_iMinH)
     {
-        Resize(m_rectBoundingBox.width(), m_iMinH);
+        SetSize(m_rectBoundingBox.width(), m_iMinH);
     }
 }
 
@@ -125,31 +133,7 @@ void VTextGraphicsItem::Clear()
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VTextGraphicsItem::SetWidth(qreal fW)
-{
-    if (fW < MIN_W)
-    {
-        fW = MIN_W;
-    }
-    m_rectBoundingBox.setWidth(fW);
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void VTextGraphicsItem::Reset()
-{
-    m_eMode = mNormal;
-    UpdateFont();
-    setZValue(2);
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-QRectF VTextGraphicsItem::boundingRect() const
-{
-    return m_rectBoundingBox;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void VTextGraphicsItem::Resize(qreal fW, qreal fH)
+void VTextGraphicsItem::SetSize(qreal fW, qreal fH)
 {
     // don't allow resize under specific size
     if (fW < MIN_W || fH < m_iMinH)
@@ -162,6 +146,19 @@ void VTextGraphicsItem::Resize(qreal fW, qreal fH)
     m_rectResize.setHeight(RESIZE_SQUARE);
 }
 
+//---------------------------------------------------------------------------------------------------------------------
+void VTextGraphicsItem::Update()
+{
+    UpdateFont();
+    UpdateBox();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+QRectF VTextGraphicsItem::boundingRect() const
+{
+    return m_rectBoundingBox;
+}
+
 //---------------------------------------------------------------------------------------------------------------------
 void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
 {
@@ -176,7 +173,7 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
         m_eMode = mMove;
     }
     setZValue(3);
-    Update();
+    UpdateBox();
 }
 
 //---------------------------------------------------------------------------------------------------------------------
@@ -186,12 +183,12 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
     if (m_eMode == mMove)
     {
         moveBy(ptDiff.x(), ptDiff.y());
-        Update();
+        UpdateBox();
     }
     else if (m_eMode == mResize)
     {
-        Resize(m_szStart.width() + ptDiff.x(), m_szStart.height() + ptDiff.y());
-        UpdateFont();
+        SetSize(m_szStart.width() + ptDiff.x(), m_szStart.height() + ptDiff.y());
+        Update();
         emit SignalShrink();
     }
 }
@@ -202,17 +199,18 @@ void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME)
     if (m_eMode == mMove)
     {
         emit SignalMoved(pos());
+        UpdateBox();
     }
     else
     {
         emit SignalResized(m_rectBoundingBox.width(), m_font.pixelSize());
+        Update();
     }
     m_eMode = mActivated;
-    Update();
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VTextGraphicsItem::Update()
+void VTextGraphicsItem::UpdateBox()
 {
     update(m_rectBoundingBox);
 }
@@ -233,7 +231,7 @@ void VTextGraphicsItem::UpdateFont()
         --iFS;
     }
     m_font.setPixelSize(iFS);
-    Update();
+    UpdateBox();
 }
 
 //---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/tools/vtextgraphicsitem.h b/src/libs/vtools/tools/vtextgraphicsitem.h
index caed2f7c8..62991aba4 100644
--- a/src/libs/vtools/tools/vtextgraphicsitem.h
+++ b/src/libs/vtools/tools/vtextgraphicsitem.h
@@ -66,14 +66,14 @@ public:
     QRectF              boundingRect() const;
     void                AddLine(const TextLine& tl);
     void                Clear();
-    void                SetWidth(qreal fW);
+    void                SetSize(qreal fW, qreal fH);
+    void                Update();
 
 protected:
-    void                Resize(qreal fW, qreal fH);
     void                mousePressEvent(QGraphicsSceneMouseEvent* pME);
     void                mouseMoveEvent(QGraphicsSceneMouseEvent* pME);
     void                mouseReleaseEvent(QGraphicsSceneMouseEvent* pME);
-    void                Update();
+    void                UpdateBox();
     void                UpdateFont();
     bool                IsBigEnough(qreal fW, qreal fH, int iFontSize);
     QStringList         SplitString(const QString& qs, qreal fW, const QFontMetrics& fm);
diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp
index f4430d494..cc80d74a4 100644
--- a/src/libs/vtools/tools/vtooldetail.cpp
+++ b/src/libs/vtools/tools/vtooldetail.cpp
@@ -53,6 +53,7 @@ const QString VToolDetail::TagNode          = QStringLiteral("node");
 const QString VToolDetail::AttrSupplement   = QStringLiteral("supplement");
 const QString VToolDetail::AttrClosed       = QStringLiteral("closed");
 const QString VToolDetail::AttrWidth        = QStringLiteral("width");
+const QString VToolDetail::AttrHeight       = QStringLiteral("height");
 const QString VToolDetail::AttrNodeType     = QStringLiteral("nodeType");
 const QString VToolDetail::AttrReverse      = QStringLiteral("reverse");
 const QString VToolDetail::AttrFont         = QStringLiteral("fontSize");
@@ -351,6 +352,7 @@ void VToolDetail::AddToFile()
     doc->SetAttribute(domData, AttrMx, data.GetPos().x());
     doc->SetAttribute(domData, AttrMy, data.GetPos().y());
     doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
+    doc->SetAttribute(domData, AttrHeight, data.GetLabelHeight());
     doc->SetAttribute(domData, AttrFont, data.GetFontSize());
 
     for (int i = 0; i < data.GetMCPCount(); ++i)
@@ -398,6 +400,7 @@ void VToolDetail::RefreshDataInFile()
         doc->SetAttribute(domData, AttrMx, data.GetPos().x());
         doc->SetAttribute(domData, AttrMy, data.GetPos().y());
         doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
+        doc->SetAttribute(domData, AttrHeight, data.GetLabelHeight());
         doc->SetAttribute(domData, AttrFont, data.GetFontSize());
 
         for (int i = 0; i < data.GetMCPCount(); ++i)
@@ -648,12 +651,15 @@ void VToolDetail::UpdateLabel()
     const VPatternPieceData& data = detail.GetPatternPieceData();
     if (data.GetLetter().isEmpty() == false || data.GetName().isEmpty() == false || data.GetMCPCount() > 0)
     {
+        dataLabel->Reset();
+
         QString qsText = "Cut %1 of %2%3";
         QStringList qslPlace;
         qslPlace << "" << " on Fold";
         QFont fnt = qApp->font();
         fnt.setPixelSize(data.GetFontSize());
         dataLabel->SetFont(fnt);
+        dataLabel->SetSize(data.GetLabelWidth(), data.GetLabelHeight());
         dataLabel->Clear();
         TextLine tl;
         // letter
@@ -679,7 +685,7 @@ void VToolDetail::UpdateLabel()
         }
 
         dataLabel->setPos(data.GetPos());
-        dataLabel->Reset();
+        dataLabel->Update();
         dataLabel->show();
     }
     else
@@ -694,6 +700,7 @@ void VToolDetail::UpdateLabel()
  */
 void VToolDetail::UpdatePatternInfo()
 {
+    patternInfo->Reset();
     QFont fnt = qApp->font();
     int iFS = doc->GetFontSize();
     if (iFS < MIN_FONT_SIZE)
@@ -702,7 +709,8 @@ void VToolDetail::UpdatePatternInfo()
     }
     fnt.setPixelSize(iFS);
     patternInfo->SetFont(fnt);
-    patternInfo->SetWidth(doc->GetLabelWidth());
+    QSizeF sz = doc->GetLabelSize();
+    patternInfo->SetSize(sz.width(), sz.height());
     patternInfo->Clear();
     TextLine tl;
 
@@ -736,9 +744,8 @@ void VToolDetail::UpdatePatternInfo()
     tl.m_qsText = qslDate.last();
     patternInfo->AddLine(tl);
 
-    qDebug() << "UpdatePatternInfo" << doc->GetLabelPosition() << sender();
     patternInfo->setPos(doc->GetLabelPosition());
-    patternInfo->Reset();
+    patternInfo->Update();
 }
 
 //---------------------------------------------------------------------------------------------------------------------
@@ -766,6 +773,7 @@ void VToolDetail::SaveResizeDetail(qreal dLabelW, int iFontSize)
     VDetail oldDet = VAbstractTool::data.GetDetail(id);
     VDetail newDet = oldDet;
     newDet.GetPatternPieceData().SetLabelWidth(dLabelW);
+    newDet.GetPatternPieceData().SetLabelHeight(dataLabel->boundingRect().height());
     newDet.GetPatternPieceData().SetFontSize(iFontSize);
     SaveDetailOptions* resizeCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene());
     resizeCommand->setText(tr("resize pattern piece label"));
@@ -789,7 +797,7 @@ void VToolDetail::SaveMovePattern(QPointF ptPos)
  */
 void VToolDetail::SaveResizePattern(qreal dLabelW, int iFontSize)
 {
-    doc->SetLabelWidth(dLabelW);
+    doc->SetLabelSize(QSizeF(dLabelW, patternInfo->boundingRect().height()));
     doc->SetFontSize(iFontSize);
 }
 
diff --git a/src/libs/vtools/tools/vtooldetail.h b/src/libs/vtools/tools/vtooldetail.h
index a68891276..eed34865f 100644
--- a/src/libs/vtools/tools/vtooldetail.h
+++ b/src/libs/vtools/tools/vtooldetail.h
@@ -69,6 +69,7 @@ public:
     static const QString AttrSupplement;
     static const QString AttrClosed;
     static const QString AttrWidth;
+    static const QString AttrHeight;
     static const QString AttrNodeType;
     static const QString AttrReverse;
     static const QString AttrFont;
diff --git a/src/libs/vtools/undocommands/savedetailoptions.cpp b/src/libs/vtools/undocommands/savedetailoptions.cpp
index 47e94f147..bc30cdca8 100644
--- a/src/libs/vtools/undocommands/savedetailoptions.cpp
+++ b/src/libs/vtools/undocommands/savedetailoptions.cpp
@@ -140,6 +140,7 @@ void SaveDetailOptions::SavePatternPieceData(QDomElement &domElement, const VDet
     doc->SetAttribute(domData, AttrMx, data.GetPos().x());
     doc->SetAttribute(domData, AttrMy, data.GetPos().y());
     doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth());
+    doc->SetAttribute(domData, VToolDetail::AttrHeight, data.GetLabelHeight());
     doc->SetAttribute(domData, VToolDetail::AttrFont, data.GetFontSize());
     for (int i = 0; i < data.GetMCPCount(); ++i)
     {