From 21cd56463c0fc57eb0da939bc508920f4bd57c10 Mon Sep 17 00:00:00 2001
From: BojanKverh <bojan.kverh@gmail.com>
Date: Tue, 25 Oct 2016 00:53:01 +0200
Subject: [PATCH 1/2] User can now turn on/off grainline arrows

--HG--
branch : feature
---
 src/app/valentina/xml/vpattern.cpp            |   2 +
 src/libs/ifc/schema.qrc                       |   1 +
 src/libs/ifc/schema/pattern/v0.3.8.xsd        | 603 ++++++++++++++++++
 src/libs/ifc/xml/vabstractpattern.cpp         |   2 +
 src/libs/ifc/xml/vabstractpattern.h           |   2 +
 src/libs/ifc/xml/vpatternconverter.cpp        |  17 +-
 src/libs/ifc/xml/vpatternconverter.h          |   5 +-
 src/libs/vlayout/vlayoutdetail.cpp            |  41 +-
 src/libs/vpatterndb/vgrainlinegeometry.cpp    |  30 +-
 src/libs/vpatterndb/vgrainlinegeometry.h      |  12 +
 .../vtools/dialogs/tools/dialogdetail.cpp     |   7 +
 src/libs/vtools/dialogs/tools/dialogdetail.ui |  38 ++
 src/libs/vtools/tools/vgrainlineitem.cpp      |  53 +-
 src/libs/vtools/tools/vgrainlineitem.h        |   4 +-
 src/libs/vtools/tools/vtooldetail.cpp         |   9 +-
 .../vtools/undocommands/savedetailoptions.cpp |   2 +
 16 files changed, 781 insertions(+), 47 deletions(-)
 create mode 100644 src/libs/ifc/schema/pattern/v0.3.8.xsd

diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp
index 8dc43e38e..e7fc7f246 100644
--- a/src/app/valentina/xml/vpattern.cpp
+++ b/src/app/valentina/xml/vpattern.cpp
@@ -730,6 +730,8 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
                     detail.GetGrainlineGeometry().SetLength(qsLength);
                     QString qsRot = GetParametrString(element, VToolDetail::AttrRotation, "90");
                     detail.GetGrainlineGeometry().SetRotation(qsRot);
+                    detail.GetGrainlineGeometry().SetFrontArrow(GetParametrBool(element, AttrFront, trueStr));
+                    detail.GetGrainlineGeometry().SetRearArrow(GetParametrBool(element, AttrRear, trueStr));
                 }
             }
         }
diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc
index 65b00335b..bcc912f3c 100644
--- a/src/libs/ifc/schema.qrc
+++ b/src/libs/ifc/schema.qrc
@@ -21,6 +21,7 @@
         <file>schema/pattern/v0.3.5.xsd</file>
         <file>schema/pattern/v0.3.6.xsd</file>
         <file>schema/pattern/v0.3.7.xsd</file>
+        <file>schema/pattern/v0.3.8.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>
diff --git a/src/libs/ifc/schema/pattern/v0.3.8.xsd b/src/libs/ifc/schema/pattern/v0.3.8.xsd
new file mode 100644
index 000000000..5ea1157ca
--- /dev/null
+++ b/src/libs/ifc/schema/pattern/v0.3.8.xsd
@@ -0,0 +1,603 @@
+<?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="length" 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:attribute name="p1Line" type="xs:unsignedInt"></xs:attribute>
+                                                                                 <xs:attribute name="p2Line" type="xs:unsignedInt"></xs:attribute>
+                                                                                 <xs:attribute name="axisType" type="axisType"></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="grainline" minOccurs="0" maxOccurs="1">
+                                                                                   <xs:complexType>
+                                                                                       <xs:attribute name="visible" type="xs:boolean"></xs:attribute>
+                                                                                       <xs:attribute name="mx" type="xs:double"></xs:attribute>
+                                                                                       <xs:attribute name="my" type="xs:double"></xs:attribute>
+                                                                                       <xs:attribute name="length" type="xs:string"></xs:attribute>
+                                                                                       <xs:attribute name="rotation" type="xs:string"></xs:attribute>
+                                                                                       <xs:attribute name="front" type="xs:boolean"></xs:attribute>
+                                                                                       <xs:attribute name="rear" type="xs:boolean"></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:enumeration value="lightsalmon"/>
+            <xs:enumeration value="goldenrod"/>
+            <xs:enumeration value="orange"/>
+            <xs:enumeration value="deeppink"/>
+            <xs:enumeration value="violet"/>
+            <xs:enumeration value="darkviolet"/>
+            <xs:enumeration value="mediumseagreen"/>
+            <xs:enumeration value="lime"/>
+            <xs:enumeration value="deepskyblue"/>
+            <xs:enumeration value="cornflowerblue"/>
+        </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="axisType">
+        <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>
diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp
index bade5069f..2287bbffb 100644
--- a/src/libs/ifc/xml/vabstractpattern.cpp
+++ b/src/libs/ifc/xml/vabstractpattern.cpp
@@ -100,6 +100,8 @@ const QString VAbstractPattern::AttrMaterial        = QStringLiteral("material")
 const QString VAbstractPattern::AttrUserDefined     = QStringLiteral("userDef");
 const QString VAbstractPattern::AttrCutNumber       = QStringLiteral("cutNumber");
 const QString VAbstractPattern::AttrPlacement       = QStringLiteral("placement");
+const QString VAbstractPattern::AttrFront           = QStringLiteral("front");
+const QString VAbstractPattern::AttrRear            = QStringLiteral("rear");
 
 const QString VAbstractPattern::AttrAll             = QStringLiteral("all");
 
diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h
index 9c2ba8003..abe023c69 100644
--- a/src/libs/ifc/xml/vabstractpattern.h
+++ b/src/libs/ifc/xml/vabstractpattern.h
@@ -205,6 +205,8 @@ public:
     static const QString AttrUserDefined;
     static const QString AttrCutNumber;
     static const QString AttrPlacement;
+    static const QString AttrFront;
+    static const QString AttrRear;
 
     static const QString AttrAll;
 
diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp
index 75f592e4d..deff9a092 100644
--- a/src/libs/ifc/xml/vpatternconverter.cpp
+++ b/src/libs/ifc/xml/vpatternconverter.cpp
@@ -58,8 +58,8 @@ class QDomElement;
  */
 
 const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
-const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.7");
-const QString VPatternConverter::CurrentSchema    = QStringLiteral("://schema/pattern/v0.3.7.xsd");
+const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.8");
+const QString VPatternConverter::CurrentSchema    = QStringLiteral("://schema/pattern/v0.3.8.xsd");
 
 //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
 //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@@ -173,6 +173,8 @@ QString VPatternConverter::XSDSchema(int ver) const
         case (0x000306):
             return QStringLiteral("://schema/pattern/v0.3.6.xsd");
         case (0x000307):
+            return QStringLiteral("://schema/pattern/v0.3.7.xsd");
+        case (0x000308):
             return CurrentSchema;
         default:
             InvalidVersion(ver);
@@ -268,6 +270,10 @@ void VPatternConverter::ApplyPatches()
                 ValidateXML(XSDSchema(0x000307), fileName);
                 V_FALLTHROUGH
             case (0x000307):
+                ToV0_3_8();
+                ValidateXML(XSDSchema(0x000308), fileName);
+                V_FALLTHROUGH
+            case (0x000308):
                 break;
             default:
                 break;
@@ -449,6 +455,13 @@ void VPatternConverter::ToV0_3_7()
     Save();
 }
 
+//---------------------------------------------------------------------------------------------------------------------
+void VPatternConverter::ToV0_3_8()
+{
+    SetVersion(QStringLiteral("0.3.8"));
+    Save();
+}
+
 //---------------------------------------------------------------------------------------------------------------------
 void VPatternConverter::TagUnitToV0_2_0()
 {
diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h
index e7fea3f78..267bbbfd5 100644
--- a/src/libs/ifc/xml/vpatternconverter.h
+++ b/src/libs/ifc/xml/vpatternconverter.h
@@ -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, 7);
+    static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 8);
 #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, 7);
+    static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 8);
 #endif
 
 protected:
@@ -96,6 +96,7 @@ private:
     void ToV0_3_5();
     void ToV0_3_6();
     void ToV0_3_7();
+    void ToV0_3_8();
 
     void          TagUnitToV0_2_0();
     void          TagIncrementToV0_2_0();
diff --git a/src/libs/vlayout/vlayoutdetail.cpp b/src/libs/vlayout/vlayoutdetail.cpp
index dc666987f..8f746bc48 100644
--- a/src/libs/vlayout/vlayoutdetail.cpp
+++ b/src/libs/vlayout/vlayoutdetail.cpp
@@ -220,26 +220,33 @@ void VLayoutDetail::SetGrainline(const VGrainlineGeometry& geom, const VContaine
 
     v << pt1;
 
-    pt.setX(pt1.x() + dArrowLen * qCos(dAng + dArrowAng));
-    pt.setY(pt1.y() - dArrowLen * qSin(dAng + dArrowAng));
-    v << pt;
-    pt.setX(pt1.x() + dArrowLen * qCos(dAng - dArrowAng));
-    pt.setY(pt1.y() - dArrowLen * qSin(dAng - dArrowAng));
-    v << pt;
+    if (geom.HasFrontArrow() == true) {
+        pt.setX(pt1.x() + dArrowLen * qCos(dAng + dArrowAng));
+        pt.setY(pt1.y() - dArrowLen * qSin(dAng + dArrowAng));
+        v << pt;
+        pt.setX(pt1.x() + dArrowLen * qCos(dAng - dArrowAng));
+        pt.setY(pt1.y() - dArrowLen * qSin(dAng - dArrowAng));
+        v << pt;
 
-    v << pt1 << pt2;
-
-    dAng += M_PI;
-
-    pt.setX(pt2.x() + dArrowLen * qCos(dAng + dArrowAng));
-    pt.setY(pt2.y() - dArrowLen * qSin(dAng + dArrowAng));
-    v << pt;
-    pt.setX(pt2.x() + dArrowLen * qCos(dAng - dArrowAng));
-    pt.setY(pt2.y() - dArrowLen * qSin(dAng - dArrowAng));
-    v << pt;
+        v << pt1;
+    }
 
     v << pt2;
 
+    if (geom.HasRearArrow() == true)
+    {
+        dAng += M_PI;
+
+        pt.setX(pt2.x() + dArrowLen * qCos(dAng + dArrowAng));
+        pt.setY(pt2.y() - dArrowLen * qSin(dAng + dArrowAng));
+        v << pt;
+        pt.setX(pt2.x() + dArrowLen * qCos(dAng - dArrowAng));
+        pt.setY(pt2.y() - dArrowLen * qSin(dAng - dArrowAng));
+        v << pt;
+
+        v << pt2;
+    }
+
     d->grainlinePoints = RoundPoints(v);
 }
 
@@ -739,7 +746,7 @@ QGraphicsItem *VLayoutDetail::GetItem() const
 //---------------------------------------------------------------------------------------------------------------------
 QGraphicsItem* VLayoutDetail::GetGrainlineItem() const
 {
-    if (d->grainlinePoints.count() < 6)
+    if (d->grainlinePoints.count() < 2)
     {
         return 0;
     }
diff --git a/src/libs/vpatterndb/vgrainlinegeometry.cpp b/src/libs/vpatterndb/vgrainlinegeometry.cpp
index 336d5da76..bd9557ab0 100644
--- a/src/libs/vpatterndb/vgrainlinegeometry.cpp
+++ b/src/libs/vpatterndb/vgrainlinegeometry.cpp
@@ -33,7 +33,7 @@
 //---------------------------------------------------------------------------------------------------------------------
 
 VGrainlineGeometry::VGrainlineGeometry()
-    :m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false)
+    :m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false), m_bFrontArrow(true), m_bRearArrow(true)
 {}
 
 //---------------------------------------------------------------------------------------------------------------------
@@ -99,3 +99,31 @@ void VGrainlineGeometry::SetVisible(bool bVisible)
 
 //---------------------------------------------------------------------------------------------------------------------
 
+bool VGrainlineGeometry::HasFrontArrow() const
+{
+    return m_bFrontArrow;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+
+void VGrainlineGeometry::SetFrontArrow(bool bVal)
+{
+    m_bFrontArrow = bVal;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+
+bool VGrainlineGeometry::HasRearArrow() const
+{
+    return m_bRearArrow;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+
+void VGrainlineGeometry::SetRearArrow(bool bVal)
+{
+    m_bRearArrow = bVal;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+
diff --git a/src/libs/vpatterndb/vgrainlinegeometry.h b/src/libs/vpatterndb/vgrainlinegeometry.h
index 0b27c3adf..9cd38eada 100644
--- a/src/libs/vpatterndb/vgrainlinegeometry.h
+++ b/src/libs/vpatterndb/vgrainlinegeometry.h
@@ -53,6 +53,10 @@ public:
     void                    SetRotation(const QString& qsRot);
     bool                    IsVisible() const;
     void                    SetVisible(bool bVisible);
+    bool                    HasFrontArrow() const;
+    void                    SetFrontArrow(bool bVal);
+    bool                    HasRearArrow() const;
+    void                    SetRearArrow(bool bVal);
 
 private:
     /**
@@ -71,6 +75,14 @@ private:
      * @brief m_bVisible visibility flag
      */
     bool                    m_bVisible;
+    /**
+     * @brief m_bFrontArrow front arrow flag
+     */
+    bool                    m_bFrontArrow;
+    /**
+     * @brief m_bRearArrow back arrow flag
+     */
+    bool                    m_bRearArrow;
 };
 
 #endif // VGRAINLINEGEOMETRY_H
diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp
index 189c4ea7d..08a27e264 100644
--- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp
@@ -486,6 +486,11 @@ VDetail DialogDetail::CreateDetail() const
     detail.GetGrainlineGeometry().SetVisible(ui.checkBoxGrainline->isChecked());
     detail.GetGrainlineGeometry().SetRotation(ui.lineEditRotFormula->toPlainText());
     detail.GetGrainlineGeometry().SetLength(ui.lineEditLenFormula->toPlainText());
+    detail.GetGrainlineGeometry().SetFrontArrow(ui.checkBoxFrontArrow->isChecked());
+    detail.GetGrainlineGeometry().SetRearArrow(ui.checkBoxRearArrow->isChecked());
+
+    qDebug() << "DIALOG ARROWS" << detail.GetGrainlineGeometry().HasFrontArrow()
+                << detail.GetGrainlineGeometry().HasRearArrow();
     return detail;
 }
 
@@ -559,6 +564,8 @@ void DialogDetail::setDetail(const VDetail &value)
     ui.checkBoxGrainline->setChecked(detail.GetGrainlineGeometry().IsVisible());
     ui.lineEditRotFormula->setPlainText(detail.GetGrainlineGeometry().GetRotation());
     ui.lineEditLenFormula->setPlainText(detail.GetGrainlineGeometry().GetLength());
+    ui.checkBoxFrontArrow->setChecked(detail.GetGrainlineGeometry().HasFrontArrow());
+    ui.checkBoxRearArrow->setChecked(detail.GetGrainlineGeometry().HasRearArrow());
 
     m_oldData = detail.GetPatternPieceData();
     m_oldGeom = detail.GetPatternInfo();
diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.ui b/src/libs/vtools/dialogs/tools/dialogdetail.ui
index 9adf0b18d..3cc061acf 100644
--- a/src/libs/vtools/dialogs/tools/dialogdetail.ui
+++ b/src/libs/vtools/dialogs/tools/dialogdetail.ui
@@ -966,6 +966,44 @@
         </item>
        </layout>
       </widget>
+      <widget class="QWidget" name="horizontalLayoutWidget_2">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>260</y>
+         <width>541</width>
+         <height>41</height>
+        </rect>
+       </property>
+       <layout class="QHBoxLayout" name="horizontalLayout_5">
+        <item>
+         <widget class="QCheckBox" name="checkBoxFrontArrow">
+          <property name="text">
+           <string>Front arrow</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="horizontalLayoutWidget_3">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>310</y>
+         <width>541</width>
+         <height>41</height>
+        </rect>
+       </property>
+       <layout class="QHBoxLayout" name="horizontalLayout_7">
+        <item>
+         <widget class="QCheckBox" name="checkBoxRearArrow">
+          <property name="text">
+           <string>Rear arrow</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
      </widget>
     </widget>
    </item>
diff --git a/src/libs/vtools/tools/vgrainlineitem.cpp b/src/libs/vtools/tools/vgrainlineitem.cpp
index ff4ae9bed..f368d2f9f 100644
--- a/src/libs/vtools/tools/vgrainlineitem.cpp
+++ b/src/libs/vtools/tools/vgrainlineitem.cpp
@@ -54,7 +54,7 @@
 VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent)
     :QGraphicsObject(pParent), m_eMode(VGrainlineItem::mNormal), m_bReleased(false), m_dRotation(0), m_dStartRotation(0),
       m_dLength(0), m_rectBoundingBox(), m_polyBound(), m_ptStartPos(), m_ptStartMove(), m_dScale(1), m_polyResize(),
-      m_ptStart(), m_ptFinish(), m_ptCenter(), m_dAngle(0)
+      m_ptStart(), m_ptFinish(), m_ptCenter(), m_dAngle(0), m_bFrontArrow(false), m_bRearArrow(false)
 {
     m_rectBoundingBox.setTopLeft(QPointF(0, 0));
     setAcceptHoverEvents(true);
@@ -93,29 +93,35 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
     // line
     pP->drawLine(pt1, pt2);
 
-    // first arrow
+    pP->setBrush(clr);
     QPolygonF poly;
-    poly << pt1;
     QPointF ptA;
     qreal dArrLen = ARROW_LENGTH*m_dScale;
-    ptA.setX(pt1.x() + dArrLen*cos(m_dRotation + ARROW_ANGLE));
-    ptA.setY(pt1.y() - dArrLen*sin(m_dRotation + ARROW_ANGLE));
-    poly << ptA;
-    ptA.setX(pt1.x() + dArrLen*cos(m_dRotation - ARROW_ANGLE));
-    ptA.setY(pt1.y() - dArrLen*sin(m_dRotation - ARROW_ANGLE));
-    poly << ptA;
-    pP->setBrush(clr);
-    pP->drawPolygon(poly);
-    // second arrow
-    poly.clear();
-    poly << pt2;
-    ptA.setX(pt2.x() + dArrLen*cos(M_PI + m_dRotation + ARROW_ANGLE));
-    ptA.setY(pt2.y() - dArrLen*sin(M_PI + m_dRotation + ARROW_ANGLE));
-    poly << ptA;
-    ptA.setX(pt2.x() + dArrLen*cos(M_PI + m_dRotation - ARROW_ANGLE));
-    ptA.setY(pt2.y() - dArrLen*sin(M_PI + m_dRotation - ARROW_ANGLE));
-    poly << ptA;
-    pP->drawPolygon(poly);
+    if (m_bFrontArrow == true)
+    {
+        // first arrow
+        poly << pt1;
+        ptA.setX(pt1.x() + dArrLen*cos(m_dRotation + ARROW_ANGLE));
+        ptA.setY(pt1.y() - dArrLen*sin(m_dRotation + ARROW_ANGLE));
+        poly << ptA;
+        ptA.setX(pt1.x() + dArrLen*cos(m_dRotation - ARROW_ANGLE));
+        ptA.setY(pt1.y() - dArrLen*sin(m_dRotation - ARROW_ANGLE));
+        poly << ptA;
+        pP->drawPolygon(poly);
+    }
+    if (m_bRearArrow == true)
+    {
+        // second arrow
+        poly.clear();
+        poly << pt2;
+        ptA.setX(pt2.x() + dArrLen*cos(M_PI + m_dRotation + ARROW_ANGLE));
+        ptA.setY(pt2.y() - dArrLen*sin(M_PI + m_dRotation + ARROW_ANGLE));
+        poly << ptA;
+        ptA.setX(pt2.x() + dArrLen*cos(M_PI + m_dRotation - ARROW_ANGLE));
+        ptA.setY(pt2.y() - dArrLen*sin(M_PI + m_dRotation - ARROW_ANGLE));
+        poly << ptA;
+        pP->drawPolygon(poly);
+    }
 
     if (m_eMode != mNormal)
     {
@@ -171,7 +177,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
  * @param dRotation rotation of the grainline in [degrees]
  * @param dLength length of the grainline in user's units
  */
-void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength)
+void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, bool bFA, bool bRA)
 {
     m_dRotation = qDegreesToRadians(dRotation);
     m_dLength = dLength;
@@ -185,6 +191,9 @@ void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal
         pt.setY(pt.y() + dY);
     }
     setPos(pt);
+    m_bFrontArrow = bFA;
+    m_bRearArrow = bRA;
+
     UpdateRectangle();
     UpdateBox();
 }
diff --git a/src/libs/vtools/tools/vgrainlineitem.h b/src/libs/vtools/tools/vgrainlineitem.h
index 30b4f36c6..d020697c5 100644
--- a/src/libs/vtools/tools/vgrainlineitem.h
+++ b/src/libs/vtools/tools/vgrainlineitem.h
@@ -54,7 +54,7 @@ public:
     virtual ~VGrainlineItem();
 
     void                    paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget);
-    void                    UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength);
+    void                    UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, bool bFA, bool bRA);
 
     QRectF                  boundingRect() const;
     void                    Reset();
@@ -96,6 +96,8 @@ private:
     QPointF                 m_ptCenter;
     QPointF                 m_ptRotCenter;
     qreal                   m_dAngle;
+    bool                    m_bFrontArrow;
+    bool                    m_bRearArrow;
 };
 
 #endif // VGRAINLINEITEM_H
diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp
index f3579fcc8..7b732dc0d 100644
--- a/src/libs/vtools/tools/vtooldetail.cpp
+++ b/src/libs/vtools/tools/vtooldetail.cpp
@@ -509,6 +509,8 @@ void VToolDetail::AddToFile()
     doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
     doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
     doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation());
+    doc->SetAttribute(domData, VAbstractPattern::AttrFront, glGeom.HasFrontArrow() == true? trueStr : falseStr);
+    doc->SetAttribute(domData, VAbstractPattern::AttrRear, glGeom.HasRearArrow() == true? trueStr : falseStr);
     qDebug() << "XML ROTATION" << glGeom.GetRotation();
 
     // nodes
@@ -588,7 +590,8 @@ void VToolDetail::RefreshDataInFile()
         doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
         doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
         doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation());
-        qDebug() << "XML ROTATION2" << glGeom.GetRotation();
+        doc->SetAttribute(domData, VAbstractPattern::AttrFront, glGeom.HasFrontArrow() == true? trueStr : falseStr);
+        doc->SetAttribute(domData, VAbstractPattern::AttrRear, glGeom.HasRearArrow() == true? trueStr : falseStr);
 
         // nodes
         for (int i = 0; i < det.CountNode(); ++i)
@@ -950,7 +953,9 @@ void VToolDetail::UpdateGrainline()
             return;
         }
 
-        grainLine->UpdateGeometry(geom.GetPos(), dRotation, ToPixel(dLength, *VDataTool::data.GetPatternUnit()));
+        grainLine->UpdateGeometry(geom.GetPos(), dRotation, ToPixel(dLength, *VDataTool::data.GetPatternUnit()),
+                                  geom.HasFrontArrow(), geom.HasRearArrow());
+        qDebug() << "ARROWS" << geom.HasFrontArrow() << geom.HasRearArrow();
         grainLine->show();
     }
     else
diff --git a/src/libs/vtools/undocommands/savedetailoptions.cpp b/src/libs/vtools/undocommands/savedetailoptions.cpp
index 5cc0c525d..612180025 100644
--- a/src/libs/vtools/undocommands/savedetailoptions.cpp
+++ b/src/libs/vtools/undocommands/savedetailoptions.cpp
@@ -210,6 +210,8 @@ void SaveDetailOptions::SaveGrainline(QDomElement &domElement, const VDetail &de
     doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
     doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
     doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation());
+    doc->SetAttribute(domData, VAbstractPattern::AttrFront, glGeom.HasFrontArrow() == true? trueStr : falseStr);
+    doc->SetAttribute(domData, VAbstractPattern::AttrRear, glGeom.HasRearArrow() == true? trueStr : falseStr);
 
     domElement.appendChild(domData);
 }

From 96cfc52202fdf58a8445a83707d25cc99fe30a69 Mon Sep 17 00:00:00 2001
From: BojanKverh <bojan.kverh@gmail.com>
Date: Tue, 25 Oct 2016 23:00:42 +0200
Subject: [PATCH 2/2] At least one arrow has to be present on a grainline

--HG--
branch : feature
---
 src/app/valentina/xml/vpattern.cpp            |  5 +-
 src/libs/ifc/schema/pattern/v0.3.8.xsd        | 12 ++-
 src/libs/ifc/xml/vabstractpattern.cpp         |  3 +-
 src/libs/ifc/xml/vabstractpattern.h           |  3 +-
 src/libs/vlayout/vlayoutdetail.cpp            |  4 +-
 src/libs/vpatterndb/vgrainlinegeometry.cpp    | 24 ++----
 src/libs/vpatterndb/vgrainlinegeometry.h      | 23 +++---
 .../vtools/dialogs/tools/dialogdetail.cpp     | 13 ++--
 src/libs/vtools/dialogs/tools/dialogdetail.ui | 76 ++++++++++++++-----
 src/libs/vtools/tools/vgrainlineitem.cpp      | 12 +--
 src/libs/vtools/tools/vgrainlineitem.h        | 40 +++++-----
 src/libs/vtools/tools/vtooldetail.cpp         |  9 +--
 .../vtools/undocommands/savedetailoptions.cpp |  3 +-
 13 files changed, 129 insertions(+), 98 deletions(-)

diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp
index e7fc7f246..a83835fb7 100644
--- a/src/app/valentina/xml/vpattern.cpp
+++ b/src/app/valentina/xml/vpattern.cpp
@@ -730,8 +730,9 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
                     detail.GetGrainlineGeometry().SetLength(qsLength);
                     QString qsRot = GetParametrString(element, VToolDetail::AttrRotation, "90");
                     detail.GetGrainlineGeometry().SetRotation(qsRot);
-                    detail.GetGrainlineGeometry().SetFrontArrow(GetParametrBool(element, AttrFront, trueStr));
-                    detail.GetGrainlineGeometry().SetRearArrow(GetParametrBool(element, AttrRear, trueStr));
+                    VGrainlineGeometry::ArrowType eAT =
+                            VGrainlineGeometry::ArrowType(GetParametrUInt(element, AttrArrows, "0"));
+                    detail.GetGrainlineGeometry().SetArrowType(eAT);
                 }
             }
         }
diff --git a/src/libs/ifc/schema/pattern/v0.3.8.xsd b/src/libs/ifc/schema/pattern/v0.3.8.xsd
index 5ea1157ca..7533631a6 100644
--- a/src/libs/ifc/schema/pattern/v0.3.8.xsd
+++ b/src/libs/ifc/schema/pattern/v0.3.8.xsd
@@ -384,9 +384,8 @@
                                                                                        <xs:attribute name="my" type="xs:double"></xs:attribute>
                                                                                        <xs:attribute name="length" type="xs:string"></xs:attribute>
                                                                                        <xs:attribute name="rotation" type="xs:string"></xs:attribute>
-                                                                                       <xs:attribute name="front" type="xs:boolean"></xs:attribute>
-                                                                                       <xs:attribute name="rear" type="xs:boolean"></xs:attribute>
-                                                                                   </xs:complexType>
+										       <xs:attribute name="arrows" type="arrowType"></xs:attribute>
+                                                                                    </xs:complexType>
                                                                                </xs:element>
                                                                                <xs:element name="node" maxOccurs="unbounded">
                                                                                        <xs:complexType>
@@ -600,4 +599,11 @@
        <xs:enumeration value="1"/><!--Cut on Fold-->
      </xs:restriction>
    </xs:simpleType>
+   <xs:simpleType name="arrowType">
+     <xs:restriction base="xs:unsignedInt">
+       <xs:enumeration value="0"/><!--Both-->
+       <xs:enumeration value="1"/><!--Front-->
+       <xs:enumeration value="2"/><!--Rear-->
+     </xs:restriction>
+   </xs:simpleType>
    </xs:schema>
diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp
index 2287bbffb..4246c9091 100644
--- a/src/libs/ifc/xml/vabstractpattern.cpp
+++ b/src/libs/ifc/xml/vabstractpattern.cpp
@@ -100,8 +100,7 @@ const QString VAbstractPattern::AttrMaterial        = QStringLiteral("material")
 const QString VAbstractPattern::AttrUserDefined     = QStringLiteral("userDef");
 const QString VAbstractPattern::AttrCutNumber       = QStringLiteral("cutNumber");
 const QString VAbstractPattern::AttrPlacement       = QStringLiteral("placement");
-const QString VAbstractPattern::AttrFront           = QStringLiteral("front");
-const QString VAbstractPattern::AttrRear            = QStringLiteral("rear");
+const QString VAbstractPattern::AttrArrows          = QStringLiteral("arrows");
 
 const QString VAbstractPattern::AttrAll             = QStringLiteral("all");
 
diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h
index abe023c69..50aeb8521 100644
--- a/src/libs/ifc/xml/vabstractpattern.h
+++ b/src/libs/ifc/xml/vabstractpattern.h
@@ -205,8 +205,7 @@ public:
     static const QString AttrUserDefined;
     static const QString AttrCutNumber;
     static const QString AttrPlacement;
-    static const QString AttrFront;
-    static const QString AttrRear;
+    static const QString AttrArrows;
 
     static const QString AttrAll;
 
diff --git a/src/libs/vlayout/vlayoutdetail.cpp b/src/libs/vlayout/vlayoutdetail.cpp
index 8f746bc48..8aadd1ea3 100644
--- a/src/libs/vlayout/vlayoutdetail.cpp
+++ b/src/libs/vlayout/vlayoutdetail.cpp
@@ -220,7 +220,7 @@ void VLayoutDetail::SetGrainline(const VGrainlineGeometry& geom, const VContaine
 
     v << pt1;
 
-    if (geom.HasFrontArrow() == true) {
+    if (geom.GetArrowType() != VGrainlineGeometry::atRear) {
         pt.setX(pt1.x() + dArrowLen * qCos(dAng + dArrowAng));
         pt.setY(pt1.y() - dArrowLen * qSin(dAng + dArrowAng));
         v << pt;
@@ -233,7 +233,7 @@ void VLayoutDetail::SetGrainline(const VGrainlineGeometry& geom, const VContaine
 
     v << pt2;
 
-    if (geom.HasRearArrow() == true)
+    if (geom.GetArrowType() != VGrainlineGeometry::atFront)
     {
         dAng += M_PI;
 
diff --git a/src/libs/vpatterndb/vgrainlinegeometry.cpp b/src/libs/vpatterndb/vgrainlinegeometry.cpp
index bd9557ab0..da8f32a90 100644
--- a/src/libs/vpatterndb/vgrainlinegeometry.cpp
+++ b/src/libs/vpatterndb/vgrainlinegeometry.cpp
@@ -33,7 +33,7 @@
 //---------------------------------------------------------------------------------------------------------------------
 
 VGrainlineGeometry::VGrainlineGeometry()
-    :m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false), m_bFrontArrow(true), m_bRearArrow(true)
+    :m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false), m_eArrowType(atBoth)
 {}
 
 //---------------------------------------------------------------------------------------------------------------------
@@ -99,30 +99,16 @@ void VGrainlineGeometry::SetVisible(bool bVisible)
 
 //---------------------------------------------------------------------------------------------------------------------
 
-bool VGrainlineGeometry::HasFrontArrow() const
+VGrainlineGeometry::ArrowType VGrainlineGeometry::GetArrowType() const
 {
-    return m_bFrontArrow;
+    return m_eArrowType;
 }
 
 //---------------------------------------------------------------------------------------------------------------------
 
-void VGrainlineGeometry::SetFrontArrow(bool bVal)
+void VGrainlineGeometry::SetArrowType(ArrowType eAT)
 {
-    m_bFrontArrow = bVal;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-
-bool VGrainlineGeometry::HasRearArrow() const
-{
-    return m_bRearArrow;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-
-void VGrainlineGeometry::SetRearArrow(bool bVal)
-{
-    m_bRearArrow = bVal;
+    m_eArrowType = eAT;
 }
 
 //---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vpatterndb/vgrainlinegeometry.h b/src/libs/vpatterndb/vgrainlinegeometry.h
index 9cd38eada..f556331db 100644
--- a/src/libs/vpatterndb/vgrainlinegeometry.h
+++ b/src/libs/vpatterndb/vgrainlinegeometry.h
@@ -40,6 +40,15 @@ class QPointF;
  */
 class VGrainlineGeometry
 {
+public:
+    // denotes the type of arrow for the grainline
+    enum ArrowType
+    {
+        atBoth,
+        atFront,
+        atRear
+    };
+
 public:
     VGrainlineGeometry();
     ~VGrainlineGeometry();
@@ -53,10 +62,8 @@ public:
     void                    SetRotation(const QString& qsRot);
     bool                    IsVisible() const;
     void                    SetVisible(bool bVisible);
-    bool                    HasFrontArrow() const;
-    void                    SetFrontArrow(bool bVal);
-    bool                    HasRearArrow() const;
-    void                    SetRearArrow(bool bVal);
+    ArrowType               GetArrowType() const;
+    void                    SetArrowType(ArrowType eAT);
 
 private:
     /**
@@ -76,13 +83,9 @@ private:
      */
     bool                    m_bVisible;
     /**
-     * @brief m_bFrontArrow front arrow flag
+     * @brief m_eArrowType type of arrow on the grainline
      */
-    bool                    m_bFrontArrow;
-    /**
-     * @brief m_bRearArrow back arrow flag
-     */
-    bool                    m_bRearArrow;
+    ArrowType                m_eArrowType;
 };
 
 #endif // VGRAINLINEGEOMETRY_H
diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp
index 08a27e264..6b0a6333c 100644
--- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp
@@ -168,6 +168,10 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
     SetAddMode();
     EnableGrainlineRotation();
 
+    ui.comboBoxArrow->addItem(tr("Both"));
+    ui.comboBoxArrow->addItem(tr("Just front"));
+    ui.comboBoxArrow->addItem(tr("Just rear"));
+
     ui.tabWidget->setCurrentIndex(0);
 
     m_iRotBaseHeight = ui.lineEditRotFormula->height();
@@ -486,11 +490,9 @@ VDetail DialogDetail::CreateDetail() const
     detail.GetGrainlineGeometry().SetVisible(ui.checkBoxGrainline->isChecked());
     detail.GetGrainlineGeometry().SetRotation(ui.lineEditRotFormula->toPlainText());
     detail.GetGrainlineGeometry().SetLength(ui.lineEditLenFormula->toPlainText());
-    detail.GetGrainlineGeometry().SetFrontArrow(ui.checkBoxFrontArrow->isChecked());
-    detail.GetGrainlineGeometry().SetRearArrow(ui.checkBoxRearArrow->isChecked());
+    VGrainlineGeometry::ArrowType eAT = VGrainlineGeometry::ArrowType(ui.comboBoxArrow->currentIndex());
+    detail.GetGrainlineGeometry().SetArrowType(eAT);
 
-    qDebug() << "DIALOG ARROWS" << detail.GetGrainlineGeometry().HasFrontArrow()
-                << detail.GetGrainlineGeometry().HasRearArrow();
     return detail;
 }
 
@@ -564,8 +566,7 @@ void DialogDetail::setDetail(const VDetail &value)
     ui.checkBoxGrainline->setChecked(detail.GetGrainlineGeometry().IsVisible());
     ui.lineEditRotFormula->setPlainText(detail.GetGrainlineGeometry().GetRotation());
     ui.lineEditLenFormula->setPlainText(detail.GetGrainlineGeometry().GetLength());
-    ui.checkBoxFrontArrow->setChecked(detail.GetGrainlineGeometry().HasFrontArrow());
-    ui.checkBoxRearArrow->setChecked(detail.GetGrainlineGeometry().HasRearArrow());
+    ui.comboBoxArrow->setCurrentIndex(int(detail.GetGrainlineGeometry().GetArrowType()));
 
     m_oldData = detail.GetPatternPieceData();
     m_oldGeom = detail.GetPatternInfo();
diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.ui b/src/libs/vtools/dialogs/tools/dialogdetail.ui
index 3cc061acf..7198fcea0 100644
--- a/src/libs/vtools/dialogs/tools/dialogdetail.ui
+++ b/src/libs/vtools/dialogs/tools/dialogdetail.ui
@@ -977,30 +977,70 @@
        </property>
        <layout class="QHBoxLayout" name="horizontalLayout_5">
         <item>
-         <widget class="QCheckBox" name="checkBoxFrontArrow">
+         <widget class="QLabel" name="labelEditLen_2">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="palette">
+           <palette>
+            <active>
+             <colorrole role="WindowText">
+              <brush brushstyle="SolidPattern">
+               <color alpha="255">
+                <red>0</red>
+                <green>0</green>
+                <blue>0</blue>
+               </color>
+              </brush>
+             </colorrole>
+            </active>
+            <inactive>
+             <colorrole role="WindowText">
+              <brush brushstyle="SolidPattern">
+               <color alpha="255">
+                <red>0</red>
+                <green>0</green>
+                <blue>0</blue>
+               </color>
+              </brush>
+             </colorrole>
+            </inactive>
+            <disabled>
+             <colorrole role="WindowText">
+              <brush brushstyle="SolidPattern">
+               <color alpha="255">
+                <red>159</red>
+                <green>158</green>
+                <blue>158</blue>
+               </color>
+              </brush>
+             </colorrole>
+            </disabled>
+           </palette>
+          </property>
           <property name="text">
-           <string>Front arrow</string>
+           <string>Arrows:</string>
           </property>
          </widget>
         </item>
-       </layout>
-      </widget>
-      <widget class="QWidget" name="horizontalLayoutWidget_3">
-       <property name="geometry">
-        <rect>
-         <x>10</x>
-         <y>310</y>
-         <width>541</width>
-         <height>41</height>
-        </rect>
-       </property>
-       <layout class="QHBoxLayout" name="horizontalLayout_7">
         <item>
-         <widget class="QCheckBox" name="checkBoxRearArrow">
-          <property name="text">
-           <string>Rear arrow</string>
+         <widget class="QComboBox" name="comboBoxArrow"/>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
           </property>
-         </widget>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
         </item>
        </layout>
       </widget>
diff --git a/src/libs/vtools/tools/vgrainlineitem.cpp b/src/libs/vtools/tools/vgrainlineitem.cpp
index f368d2f9f..48b8fc9bd 100644
--- a/src/libs/vtools/tools/vgrainlineitem.cpp
+++ b/src/libs/vtools/tools/vgrainlineitem.cpp
@@ -54,7 +54,7 @@
 VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent)
     :QGraphicsObject(pParent), m_eMode(VGrainlineItem::mNormal), m_bReleased(false), m_dRotation(0), m_dStartRotation(0),
       m_dLength(0), m_rectBoundingBox(), m_polyBound(), m_ptStartPos(), m_ptStartMove(), m_dScale(1), m_polyResize(),
-      m_ptStart(), m_ptFinish(), m_ptCenter(), m_dAngle(0), m_bFrontArrow(false), m_bRearArrow(false)
+      m_ptStart(), m_ptFinish(), m_ptCenter(), m_dAngle(0), m_eArrowType(VGrainlineGeometry::atBoth)
 {
     m_rectBoundingBox.setTopLeft(QPointF(0, 0));
     setAcceptHoverEvents(true);
@@ -97,7 +97,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
     QPolygonF poly;
     QPointF ptA;
     qreal dArrLen = ARROW_LENGTH*m_dScale;
-    if (m_bFrontArrow == true)
+    if (m_eArrowType != VGrainlineGeometry::atRear)
     {
         // first arrow
         poly << pt1;
@@ -109,7 +109,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
         poly << ptA;
         pP->drawPolygon(poly);
     }
-    if (m_bRearArrow == true)
+    if (m_eArrowType != VGrainlineGeometry::atFront)
     {
         // second arrow
         poly.clear();
@@ -177,7 +177,8 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
  * @param dRotation rotation of the grainline in [degrees]
  * @param dLength length of the grainline in user's units
  */
-void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, bool bFA, bool bRA)
+void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength,
+                                    VGrainlineGeometry::ArrowType eAT)
 {
     m_dRotation = qDegreesToRadians(dRotation);
     m_dLength = dLength;
@@ -191,8 +192,7 @@ void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal
         pt.setY(pt.y() + dY);
     }
     setPos(pt);
-    m_bFrontArrow = bFA;
-    m_bRearArrow = bRA;
+    m_eArrowType = eAT;
 
     UpdateRectangle();
     UpdateBox();
diff --git a/src/libs/vtools/tools/vgrainlineitem.h b/src/libs/vtools/tools/vgrainlineitem.h
index d020697c5..41ea59eb5 100644
--- a/src/libs/vtools/tools/vgrainlineitem.h
+++ b/src/libs/vtools/tools/vgrainlineitem.h
@@ -54,7 +54,8 @@ public:
     virtual ~VGrainlineItem();
 
     void                    paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget);
-    void                    UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, bool bFA, bool bRA);
+    void                    UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength,
+                                           VGrainlineGeometry::ArrowType eAT);
 
     QRectF                  boundingRect() const;
     void                    Reset();
@@ -79,25 +80,24 @@ signals:
     void                    SignalRotated(qreal dRot, const QPointF& ptNewPos);
 
 private:
-    Mode                    m_eMode;
-    bool                    m_bReleased;
-    qreal                   m_dRotation;
-    qreal                   m_dStartRotation;
-    qreal                   m_dLength;
-    QRectF                  m_rectBoundingBox;
-    QPolygonF               m_polyBound;
-    QPointF                 m_ptStartPos;
-    QPointF                 m_ptStartMove;
-    qreal                   m_dScale;
-    QPolygonF               m_polyResize;
-    qreal                   m_dStartLength;
-    QPointF                 m_ptStart;
-    QPointF                 m_ptFinish;
-    QPointF                 m_ptCenter;
-    QPointF                 m_ptRotCenter;
-    qreal                   m_dAngle;
-    bool                    m_bFrontArrow;
-    bool                    m_bRearArrow;
+    Mode                            m_eMode;
+    bool                            m_bReleased;
+    qreal                           m_dRotation;
+    qreal                           m_dStartRotation;
+    qreal                           m_dLength;
+    QRectF                          m_rectBoundingBox;
+    QPolygonF                       m_polyBound;
+    QPointF                         m_ptStartPos;
+    QPointF                         m_ptStartMove;
+    qreal                           m_dScale;
+    QPolygonF                       m_polyResize;
+    qreal                           m_dStartLength;
+    QPointF                         m_ptStart;
+    QPointF                         m_ptFinish;
+    QPointF                         m_ptCenter;
+    QPointF                         m_ptRotCenter;
+    qreal                           m_dAngle;
+    VGrainlineGeometry::ArrowType   m_eArrowType;
 };
 
 #endif // VGRAINLINEITEM_H
diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp
index 7b732dc0d..912f81f7e 100644
--- a/src/libs/vtools/tools/vtooldetail.cpp
+++ b/src/libs/vtools/tools/vtooldetail.cpp
@@ -509,8 +509,7 @@ void VToolDetail::AddToFile()
     doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
     doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
     doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation());
-    doc->SetAttribute(domData, VAbstractPattern::AttrFront, glGeom.HasFrontArrow() == true? trueStr : falseStr);
-    doc->SetAttribute(domData, VAbstractPattern::AttrRear, glGeom.HasRearArrow() == true? trueStr : falseStr);
+    doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType()));
     qDebug() << "XML ROTATION" << glGeom.GetRotation();
 
     // nodes
@@ -590,8 +589,7 @@ void VToolDetail::RefreshDataInFile()
         doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
         doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
         doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation());
-        doc->SetAttribute(domData, VAbstractPattern::AttrFront, glGeom.HasFrontArrow() == true? trueStr : falseStr);
-        doc->SetAttribute(domData, VAbstractPattern::AttrRear, glGeom.HasRearArrow() == true? trueStr : falseStr);
+        doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType()));
 
         // nodes
         for (int i = 0; i < det.CountNode(); ++i)
@@ -954,8 +952,7 @@ void VToolDetail::UpdateGrainline()
         }
 
         grainLine->UpdateGeometry(geom.GetPos(), dRotation, ToPixel(dLength, *VDataTool::data.GetPatternUnit()),
-                                  geom.HasFrontArrow(), geom.HasRearArrow());
-        qDebug() << "ARROWS" << geom.HasFrontArrow() << geom.HasRearArrow();
+                                  geom.GetArrowType());
         grainLine->show();
     }
     else
diff --git a/src/libs/vtools/undocommands/savedetailoptions.cpp b/src/libs/vtools/undocommands/savedetailoptions.cpp
index 612180025..032db725e 100644
--- a/src/libs/vtools/undocommands/savedetailoptions.cpp
+++ b/src/libs/vtools/undocommands/savedetailoptions.cpp
@@ -210,8 +210,7 @@ void SaveDetailOptions::SaveGrainline(QDomElement &domElement, const VDetail &de
     doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
     doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
     doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation());
-    doc->SetAttribute(domData, VAbstractPattern::AttrFront, glGeom.HasFrontArrow() == true? trueStr : falseStr);
-    doc->SetAttribute(domData, VAbstractPattern::AttrRear, glGeom.HasRearArrow() == true? trueStr : falseStr);
+    doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType()));
 
     domElement.appendChild(domData);
 }