From 6b695fac5717f92f37996f914fafb65d3e3a975d Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Wed, 28 May 2014 18:28:39 +0300
Subject: [PATCH 01/17] Fixed issue #84.

--HG--
branch : develop
---
 .../resources/tables/standard/GOST_man_ru.vst | 254 +++++++++---------
 src/app/xml/vstandardmeasurements.cpp         |   8 +-
 src/app/xml/vstandardmeasurements.h           |   2 +-
 3 files changed, 132 insertions(+), 132 deletions(-)

diff --git a/src/app/share/resources/tables/standard/GOST_man_ru.vst b/src/app/share/resources/tables/standard/GOST_man_ru.vst
index 0240a7df5..0174079d7 100644
--- a/src/app/share/resources/tables/standard/GOST_man_ru.vst
+++ b/src/app/share/resources/tables/standard/GOST_man_ru.vst
@@ -7,147 +7,147 @@
 	<height base="1760"/>
 	<body-measurements>
         <head_and_neck>
-            <head_girth value="576" size_increace="4" height_increase ="4"/><!--Огол(Обхват головы)--> 
-            <mid_neck_girth value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <neck_base_girth value="404" size_increace="8" height_increase ="2"/><!--Ош(Обхват шеи)-->
-            <head_and_neck_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
+            <head_girth value="576" size_increase="4" height_increase ="4"/><!--Огол(Обхват головы)--> 
+            <mid_neck_girth value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <neck_base_girth value="404" size_increase="8" height_increase ="2"/><!--Ош(Обхват шеи)-->
+            <head_and_neck_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
         </head_and_neck>
         <torso>
-            <center_front_waist_length value="0.0" size_increace="" height_increase=""/><!--Нету перевода-->
-            <center_back_waist_length value="438" size_increace="2" height_increase ="10"/><!--Дтс(Длина спины до талии с учетом выступа лопаток)-->
-            <shoulder_length value="160" size_increace="1" height_increase ="4"/><!--Шп(Длина плечевого ската)-->
-            <side_waist_length value="0.0" size_increace="0" height_increase="0"/><!--Дб(Длина боковой части)-->
-            <trunk_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <shoulder_girth value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <upper_chest_girth value="1034" size_increace="36" height_increase ="4"/><!--ОгI(Обхват груди первый)-->
-            <bust_girth value="1044" size_increace="38" height_increase ="2"/><!--ОгII(Обхват груди второй)-->
-            <under_bust_girth value="1000" size_increace="40" height_increase ="0"/><!--ОгIII(Обхват груди третий)-->
-            <waist_girth value="780" size_increace="40" height_increase ="0"/><!--От(Обхват талии)-->
-            <high_hip_girth value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <hip_girth value="984" size_increace="30" height_increase ="10"/><!--Об(Обхват бедер с учетом выступания живота)-->
-            <upper_front_chest_width value="0.0" size_increace="0" height_increase="0"/><!--Шг1(Ширина груди первая)-->
-            <front_chest_width value="0.0" size_increace="0" height_increase="0"/><!--Шг2(Ширина груди вторая)-->
-            <across_front_shoulder_width value="412" size_increace="5" height_increase ="8"/><!--dпл(Плечевой диаметр)-->
-            <across_back_shoulder_width value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <upper_back_width value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_width value="416" size_increace="10" height_increase ="2"/><!--Шс(Ширина спины)-->
-            <bustpoint_to_bustpoint value="224" size_increace="6" height_increase ="0"/><!--Цг(Расстояние между сосковыми точками)-->
-            <halter_bustpoint_to_bustpoint value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <neck_to_bustpoint value="262" size_increace="8" height_increase ="3"/><!--Вг(Расстояние от точки основания шеи сбоку до сосковой точки (высота груди))-->
-            <crotch_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <rise_height value="316" size_increace="4" height_increase ="7"/><!--Дпс(Расстояние от линии талии до подъягодичной складки)-->
-            <shoulder_drop value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <shoulder_slope_degrees value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <front_shoulder_slope_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_shoulder_slope_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <front_shoulder_to_waist_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_shoulder_to_waist_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <front_neck_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_neck_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <front_upper_chest_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_upper_chest_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <front_waist_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_waist_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <front_upper_hip_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_upper_hip_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <front_hip_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_hip_arc value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <chest_slope value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_slope value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <front_waist_slope value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <back_waist_slope value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <front_neck_to_upper_chest_height value="0.0" size_increace="0" height_increase=""/><!--Нету перевода-->
-            <front_neck_to_bust_height value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
+            <center_front_waist_length value="0.0" size_increase="" height_increase=""/><!--Нету перевода-->
+            <center_back_waist_length value="438" size_increase="2" height_increase ="10"/><!--Дтс(Длина спины до талии с учетом выступа лопаток)-->
+            <shoulder_length value="160" size_increase="1" height_increase ="4"/><!--Шп(Длина плечевого ската)-->
+            <side_waist_length value="0.0" size_increase="0" height_increase="0"/><!--Дб(Длина боковой части)-->
+            <trunk_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <shoulder_girth value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <upper_chest_girth value="1034" size_increase="36" height_increase ="4"/><!--ОгI(Обхват груди первый)-->
+            <bust_girth value="1044" size_increase="38" height_increase ="2"/><!--ОгII(Обхват груди второй)-->
+            <under_bust_girth value="1000" size_increase="40" height_increase ="0"/><!--ОгIII(Обхват груди третий)-->
+            <waist_girth value="780" size_increase="40" height_increase ="0"/><!--От(Обхват талии)-->
+            <high_hip_girth value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <hip_girth value="984" size_increase="30" height_increase ="10"/><!--Об(Обхват бедер с учетом выступания живота)-->
+            <upper_front_chest_width value="0.0" size_increase="0" height_increase="0"/><!--Шг1(Ширина груди первая)-->
+            <front_chest_width value="0.0" size_increase="0" height_increase="0"/><!--Шг2(Ширина груди вторая)-->
+            <across_front_shoulder_width value="412" size_increase="5" height_increase ="8"/><!--dпл(Плечевой диаметр)-->
+            <across_back_shoulder_width value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <upper_back_width value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_width value="416" size_increase="10" height_increase ="2"/><!--Шс(Ширина спины)-->
+            <bustpoint_to_bustpoint value="224" size_increase="6" height_increase ="0"/><!--Цг(Расстояние между сосковыми точками)-->
+            <halter_bustpoint_to_bustpoint value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <neck_to_bustpoint value="262" size_increase="8" height_increase ="3"/><!--Вг(Расстояние от точки основания шеи сбоку до сосковой точки (высота груди))-->
+            <crotch_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <rise_height value="316" size_increase="4" height_increase ="7"/><!--Дпс(Расстояние от линии талии до подъягодичной складки)-->
+            <shoulder_drop value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <shoulder_slope_degrees value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <front_shoulder_slope_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_shoulder_slope_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <front_shoulder_to_waist_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_shoulder_to_waist_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <front_neck_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_neck_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <front_upper_chest_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_upper_chest_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <front_waist_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_waist_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <front_upper_hip_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_upper_hip_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <front_hip_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_hip_arc value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <chest_slope value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_slope value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <front_waist_slope value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <back_waist_slope value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <front_neck_to_upper_chest_height value="0.0" size_increase="0" height_increase=""/><!--Нету перевода-->
+            <front_neck_to_bust_height value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
         </torso>
         <arm>
-            <armscye_girth value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <elbow_girth value="0.0" size_increace="0" height_increase="0"/><!--Олк(Обхват локтя)-->
-            <upper_arm_girth value="316" size_increace="12" height_increase ="0"/><!--Оп(Обхват плеча)-->
-            <wrist_girth value="180" size_increace="4" height_increase ="0"/><!--Озап(Обхват запястья)-->
-            <scye_depth value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <shoulder_and_arm_length value="768" size_increace="2" height_increase ="24"/><!--Дзап(Расстояние от точки основания шеи сбоку до линии обхвата запястья)-->
-            <underarm_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <cervicale_to_wrist_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <shoulder_to_elbow_length value="338" size_increace="2" height_increase ="12"/><!--Дрлок(Длина руки до локтя)-->
-            <arm_length value="594" size_increace="3" height_increase ="19"/><!--Дрзап(Длина рукава до линии обхвата запястья)-->
+            <armscye_girth value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <elbow_girth value="0.0" size_increase="0" height_increase="0"/><!--Олк(Обхват локтя)-->
+            <upper_arm_girth value="316" size_increase="12" height_increase ="0"/><!--Оп(Обхват плеча)-->
+            <wrist_girth value="180" size_increase="4" height_increase ="0"/><!--Озап(Обхват запястья)-->
+            <scye_depth value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <shoulder_and_arm_length value="768" size_increase="2" height_increase ="24"/><!--Дзап(Расстояние от точки основания шеи сбоку до линии обхвата запястья)-->
+            <underarm_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <cervicale_to_wrist_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <shoulder_to_elbow_length value="338" size_increase="2" height_increase ="12"/><!--Дрлок(Длина руки до локтя)-->
+            <arm_length value="594" size_increase="3" height_increase ="19"/><!--Дрзап(Длина рукава до линии обхвата запястья)-->
         </arm>
         <hand>
-            <hand_width value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <hand_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <hand_girth value="263" size_increace="3" height_increase ="3"/><!--Окис(Обхват кисти)-->
+            <hand_width value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <hand_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <hand_girth value="263" size_increase="3" height_increase ="3"/><!--Окис(Обхват кисти)-->
         </hand>
         <leg>
-            <thigh_girth value="566" size_increace="18" height_increase ="6"/><!--Обед(Обхват бедра)-->
-            <mid_thigh_girth value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <knee_girth value="386" size_increace="8" height_increase ="8"/><!--Ок(Обхват колена)-->
-            <calf_girth value="380" size_increace="8" height_increase ="6"/><!--Ои(Обхват икры)-->
-            <ankle_girth value="234" size_increace="4" height_increase ="4"/><!--Ощ(Обхват щиколотки)-->
-            <knee_height value="503" size_increace="0" height_increase ="22"/><!--Вк(Высота коленной точки)-->
-            <ankle_height value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
+            <thigh_girth value="566" size_increase="18" height_increase ="6"/><!--Обед(Обхват бедра)-->
+            <mid_thigh_girth value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <knee_girth value="386" size_increase="8" height_increase ="8"/><!--Ок(Обхват колена)-->
+            <calf_girth value="380" size_increase="8" height_increase ="6"/><!--Ои(Обхват икры)-->
+            <ankle_girth value="234" size_increase="4" height_increase ="4"/><!--Ощ(Обхват щиколотки)-->
+            <knee_height value="503" size_increase="0" height_increase ="22"/><!--Вк(Высота коленной точки)-->
+            <ankle_height value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
         </leg>
         <foot>
-            <foot_width value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <foot_length value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
+            <foot_width value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <foot_length value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
         </foot>
         <heights>
-            <cervicale_height value="1522" size_increace="2" height_increase ="54"/><!--Вшт(Высота точки основания шеи сзади)-->
-            <cervicale_to_knee_height value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <waist_height value="1102" size_increace="0" height_increase ="43"/><!--Влт(Высота линии талии)-->
-            <high_hip_height value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <hip_height value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <waist_to_hip_height value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <waist_to_knee_height value="0.0" size_increace="0" height_increase="0"/><!--Нету перевода-->
-            <crotch_height value="826" size_increace="-3" height_increase ="37"/><!--Дн(Длина ноги по внутренней поверхности)-->
+            <cervicale_height value="1522" size_increase="2" height_increase ="54"/><!--Вшт(Высота точки основания шеи сзади)-->
+            <cervicale_to_knee_height value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <waist_height value="1102" size_increase="0" height_increase ="43"/><!--Влт(Высота линии талии)-->
+            <high_hip_height value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <hip_height value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <waist_to_hip_height value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <waist_to_knee_height value="0.0" size_increase="0" height_increase="0"/><!--Нету перевода-->
+            <crotch_height value="826" size_increase="-3" height_increase ="37"/><!--Дн(Длина ноги по внутренней поверхности)-->
         </heights>
         <extended>
-			<height_front_neck_base_point value="1450" size_increace="2" height_increase ="51"/><!--Втос(Высота точки основания шеи спереди)-->
-			<height_base_neck_side_point value="1506" size_increace="2" height_increase ="54"/><!--Втош(Высота точки основания шеи сбоку)-->
-			<height_shoulder_point value="1438" size_increace="3" height_increase ="52"/><!--Впт(Высота плечевой точки)-->
-			<height_nipple_point value="1257" size_increace="-1" height_increase ="49"/><!--Вст(Высота сосковой точки)-->
-			<height_back_angle_axilla value="1328" size_increace="0" height_increase ="49"/><!--Взу(Высота заднего угла подмышечной впадины)-->
-			<height_scapular_point value="1320" size_increace="0" height_increase ="49"/><!--Влоп(Высота лопаточной точки)-->
-			<height_under_buttock_folds value="811" size_increace="-1" height_increase ="36"/><!--Впс(Высота подъягодичной складки)-->
-			<hips_excluding_protruding_abdomen value="964" size_increace="24" height_increase ="12"/><!--ОбI(Обхват бедер без учета выступания живота)-->
-			<girth_foot_instep value="350" size_increace="2" height_increase ="8"/><!--Ос(Обхват подъема стопы)-->
-			<side_waist_to_floor value="1120" size_increace="0" height_increase ="44"/><!--Дсб(Расстояние от линии талии до пола сбоку)-->
-			<front_waist_to_floor value="1110" size_increace="0" height_increase ="43"/><!--Дсп(Расстояние от линии талии до пола спереди)-->
-			<arc_through_groin_area value="783" size_increace="14" height_increase ="15"/><!--Дпоб(Дуга через паховую область)-->
-			<waist_to_plane_seat value="260" size_increace="1" height_increase ="6"/><!--Дс(Расстояние от линии талии до плоскости сидения)-->
-			<neck_to_radial_point value="500" size_increace="2" height_increase ="15"/><!--Длуч(Расстояние от точки основания шеи сбоку до лучевой точки)-->
-			<neck_to_third_finger value="970" size_increace="2" height_increase ="29"/><!--ДIIIп(Расстояние от точки основания шеи сбоку до конца третьего пальца)-->
-			<neck_to_first_line_chest_circumference value="214" size_increace="3" height_increase ="3"/><!--Впрп(Расстояние от точки основания шеи сбоку до линии обхвата груди первого спереди)-->
-			<front_waist_length value="460" size_increace="7" height_increase ="9"/><!--Дтп(Расстояние от точки основания шеи сбоку до линии талии спереди (длани талии спереди))-->
-			<arc_through_shoulder_joint value="355" size_increace="5" height_increase ="5"/><!--Дп(Дуга через высшую точку плечевого сустава)-->
-			<neck_to_back_line_chest_circumference value="208" size_increace="3" height_increase ="5"/><!--Впрз(Расстояние от точки основания шеи сзади до линии обхватов груди первого и второго с учетом выступа лопаток)-->
-			<waist_to_neck_side value="469" size_increace="2" height_increase ="10"/><!--ДтсI(Расстояние от линии талии сзади до точки основания шеи сбоку)-->
-			<arc_length_upper_body  value="929" size_increace="9" height_increase ="19"/><!--Двчт(Длина дуги верхней части туловища через точку основания шеи сбоку)-->
-			<chest_width value="370" size_increace="14" height_increase ="4"/><!--Шг(Ширина груди)-->
-			<anteroposterior_diameter_hands value="121" size_increace="6" height_increase ="0"/><!--dпзр(Передне-задний диаметр руки)-->
-			<height_clavicular_point value="1454" size_increace="2" height_increase ="52"/><!--Вкт(Высота ключичной точки)-->
-			<height_armhole_slash value="324" size_increace="7" height_increase ="2"/><!--Впрк(Расстояние от шейной точки до уровня заднего угла подмышечной впадины спереди (высота проймы косая))-->
-			<slash_shoulder_height value="495" size_increace="5" height_increase ="7"/><!--Впк(Высота плеча косая)-->
-			<half_girth_neck value="202" size_increace="4" height_increase ="2"/><!--Сш(Полуобхват шеи)-->
-			<half_girth_neck_for_shirts value="205" size_increace="5" height_increase ="0"/><!--Сш1(Полуобхват шеи для сорочек)-->
-			<half_girth_chest_first value="517" size_increace="18" height_increase ="2"/><!--СгI(Полуобхват груди первый)-->
-			<half_girth_chest_second value="522" size_increace="19" height_increase ="1"/><!--СгII(Полуобхват груди второй)-->
-			<half_girth_chest_third value="500" size_increace="20" height_increase ="0"/><!--СгIII(Полуобхват груди третий)-->
-			<half_girth_waist value="390" size_increace="20" height_increase ="0"/><!--Ст(Полуобхват талии)-->
-			<half_girth_hips_considering_protruding_abdomen value="492" size_increace="15" height_increase ="5"/><!--Сб(Полуобхват бедер с учетом выступания живота)-->
-			<half_girth_hips_excluding_protruding_abdomen value="482" size_increace="12" height_increase ="6"/><!--СбI(Полуобхват бедер без учета выступания живота)-->
-			<girth_knee_flexed_feet value="399" size_increace="9" height_increase ="8"/><!--Окс(Обхват колена в согнутом положении ноги)-->
-			<neck_transverse_diameter value="130" size_increace="2" height_increase ="2"/><!--dш(Поперечный диаметр шеи)-->
-			<front_slash_shoulder_height value="453" size_increace="7" height_increase ="8"/><!--Впкп(Высота плеча косая спереди)-->
-			<neck_to_front_waist_line value="449" size_increace="6" height_increase ="8"/><!--Дтн1(Расстояние от точки основания шеи до линии талии спереди)-->
-			<hand_vertical_diameter value="128" size_increace="2" height_increase ="2"/><!--dвр(Вертикальный диаметр руки)-->
-			<neck_to_knee_point value="1019" size_increace="0" height_increase ="34"/><!--Дшк(Расстояние от шейной точки до колена)-->
-			<waist_to_knee value="603" size_increace="-2" height_increase ="24"/><!--Дтк(Расстояние от линии талии до колена)-->
-			<shoulder_height value="67" size_increace="0" height_increase ="2"/><!--Вп(Высота плеча)-->
-			<head_height value="246" size_increace="-2" height_increase ="6"/><!--Вгол(Высота головы)-->
-			<body_position value="84" size_increace="0" height_increase ="3"/><!--Пкор(Положение корпуса)-->
-			<arc_behind_shoulder_girdle value="535" size_increace="7" height_increase ="7"/><!--Дпз(Дуга плечевого пояса сзади)-->
-			<neck_to_neck_base value="109" size_increace="1" height_increase ="0"/><!--Дшош(Расстояние от шейной точки до точки основания шеи сбоку по линии измерения обхвата шеи)-->
-			<depth_waist_first value="64" size_increace="-1" height_increase ="0"/><!--Гт1(Глубина талии первая)-->
-			<depth_waist_second value="37" size_increace="0" height_increase ="0"/><!--ГтII(Глубина талии вторая)-->
+			<height_front_neck_base_point value="1450" size_increase="2" height_increase ="51"/><!--Втос(Высота точки основания шеи спереди)-->
+			<height_base_neck_side_point value="1506" size_increase="2" height_increase ="54"/><!--Втош(Высота точки основания шеи сбоку)-->
+			<height_shoulder_point value="1438" size_increase="3" height_increase ="52"/><!--Впт(Высота плечевой точки)-->
+			<height_nipple_point value="1257" size_increase="-1" height_increase ="49"/><!--Вст(Высота сосковой точки)-->
+			<height_back_angle_axilla value="1328" size_increase="0" height_increase ="49"/><!--Взу(Высота заднего угла подмышечной впадины)-->
+			<height_scapular_point value="1320" size_increase="0" height_increase ="49"/><!--Влоп(Высота лопаточной точки)-->
+			<height_under_buttock_folds value="811" size_increase="-1" height_increase ="36"/><!--Впс(Высота подъягодичной складки)-->
+			<hips_excluding_protruding_abdomen value="964" size_increase="24" height_increase ="12"/><!--ОбI(Обхват бедер без учета выступания живота)-->
+			<girth_foot_instep value="350" size_increase="2" height_increase ="8"/><!--Ос(Обхват подъема стопы)-->
+			<side_waist_to_floor value="1120" size_increase="0" height_increase ="44"/><!--Дсб(Расстояние от линии талии до пола сбоку)-->
+			<front_waist_to_floor value="1110" size_increase="0" height_increase ="43"/><!--Дсп(Расстояние от линии талии до пола спереди)-->
+			<arc_through_groin_area value="783" size_increase="14" height_increase ="15"/><!--Дпоб(Дуга через паховую область)-->
+			<waist_to_plane_seat value="260" size_increase="1" height_increase ="6"/><!--Дс(Расстояние от линии талии до плоскости сидения)-->
+			<neck_to_radial_point value="500" size_increase="2" height_increase ="15"/><!--Длуч(Расстояние от точки основания шеи сбоку до лучевой точки)-->
+			<neck_to_third_finger value="970" size_increase="2" height_increase ="29"/><!--ДIIIп(Расстояние от точки основания шеи сбоку до конца третьего пальца)-->
+			<neck_to_first_line_chest_circumference value="214" size_increase="3" height_increase ="3"/><!--Впрп(Расстояние от точки основания шеи сбоку до линии обхвата груди первого спереди)-->
+			<front_waist_length value="460" size_increase="7" height_increase ="9"/><!--Дтп(Расстояние от точки основания шеи сбоку до линии талии спереди (длани талии спереди))-->
+			<arc_through_shoulder_joint value="355" size_increase="5" height_increase ="5"/><!--Дп(Дуга через высшую точку плечевого сустава)-->
+			<neck_to_back_line_chest_circumference value="208" size_increase="3" height_increase ="5"/><!--Впрз(Расстояние от точки основания шеи сзади до линии обхватов груди первого и второго с учетом выступа лопаток)-->
+			<waist_to_neck_side value="469" size_increase="2" height_increase ="10"/><!--ДтсI(Расстояние от линии талии сзади до точки основания шеи сбоку)-->
+			<arc_length_upper_body  value="929" size_increase="9" height_increase ="19"/><!--Двчт(Длина дуги верхней части туловища через точку основания шеи сбоку)-->
+			<chest_width value="370" size_increase="14" height_increase ="4"/><!--Шг(Ширина груди)-->
+			<anteroposterior_diameter_hands value="121" size_increase="6" height_increase ="0"/><!--dпзр(Передне-задний диаметр руки)-->
+			<height_clavicular_point value="1454" size_increase="2" height_increase ="52"/><!--Вкт(Высота ключичной точки)-->
+			<height_armhole_slash value="324" size_increase="7" height_increase ="2"/><!--Впрк(Расстояние от шейной точки до уровня заднего угла подмышечной впадины спереди (высота проймы косая))-->
+			<slash_shoulder_height value="495" size_increase="5" height_increase ="7"/><!--Впк(Высота плеча косая)-->
+			<half_girth_neck value="202" size_increase="4" height_increase ="2"/><!--Сш(Полуобхват шеи)-->
+			<half_girth_neck_for_shirts value="205" size_increase="5" height_increase ="0"/><!--Сш1(Полуобхват шеи для сорочек)-->
+			<half_girth_chest_first value="517" size_increase="18" height_increase ="2"/><!--СгI(Полуобхват груди первый)-->
+			<half_girth_chest_second value="522" size_increase="19" height_increase ="1"/><!--СгII(Полуобхват груди второй)-->
+			<half_girth_chest_third value="500" size_increase="20" height_increase ="0"/><!--СгIII(Полуобхват груди третий)-->
+			<half_girth_waist value="390" size_increase="20" height_increase ="0"/><!--Ст(Полуобхват талии)-->
+			<half_girth_hips_considering_protruding_abdomen value="492" size_increase="15" height_increase ="5"/><!--Сб(Полуобхват бедер с учетом выступания живота)-->
+			<half_girth_hips_excluding_protruding_abdomen value="482" size_increase="12" height_increase ="6"/><!--СбI(Полуобхват бедер без учета выступания живота)-->
+			<girth_knee_flexed_feet value="399" size_increase="9" height_increase ="8"/><!--Окс(Обхват колена в согнутом положении ноги)-->
+			<neck_transverse_diameter value="130" size_increase="2" height_increase ="2"/><!--dш(Поперечный диаметр шеи)-->
+			<front_slash_shoulder_height value="453" size_increase="7" height_increase ="8"/><!--Впкп(Высота плеча косая спереди)-->
+			<neck_to_front_waist_line value="449" size_increase="6" height_increase ="8"/><!--Дтн1(Расстояние от точки основания шеи до линии талии спереди)-->
+			<hand_vertical_diameter value="128" size_increase="2" height_increase ="2"/><!--dвр(Вертикальный диаметр руки)-->
+			<neck_to_knee_point value="1019" size_increase="0" height_increase ="34"/><!--Дшк(Расстояние от шейной точки до колена)-->
+			<waist_to_knee value="603" size_increase="-2" height_increase ="24"/><!--Дтк(Расстояние от линии талии до колена)-->
+			<shoulder_height value="67" size_increase="0" height_increase ="2"/><!--Вп(Высота плеча)-->
+			<head_height value="246" size_increase="-2" height_increase ="6"/><!--Вгол(Высота головы)-->
+			<body_position value="84" size_increase="0" height_increase ="3"/><!--Пкор(Положение корпуса)-->
+			<arc_behind_shoulder_girdle value="535" size_increase="7" height_increase ="7"/><!--Дпз(Дуга плечевого пояса сзади)-->
+			<neck_to_neck_base value="109" size_increase="1" height_increase ="0"/><!--Дшош(Расстояние от шейной точки до точки основания шеи сбоку по линии измерения обхвата шеи)-->
+			<depth_waist_first value="64" size_increase="-1" height_increase ="0"/><!--Гт1(Глубина талии первая)-->
+			<depth_waist_second value="37" size_increase="0" height_increase ="0"/><!--ГтII(Глубина талии вторая)-->
 		</extended>
     </body-measurements>
 </vst>
diff --git a/src/app/xml/vstandardmeasurements.cpp b/src/app/xml/vstandardmeasurements.cpp
index 5c82c89fa..1af4aa15a 100644
--- a/src/app/xml/vstandardmeasurements.cpp
+++ b/src/app/xml/vstandardmeasurements.cpp
@@ -34,7 +34,7 @@ const QString VStandardMeasurements::TagDescription      = QStringLiteral("descr
 const QString VStandardMeasurements::TagSize             = QStringLiteral("size");
 const QString VStandardMeasurements::TagHeight           = QStringLiteral("height");
 const QString VStandardMeasurements::AttrValue           = QStringLiteral("value");
-const QString VStandardMeasurements::AttrSize_increace   = QStringLiteral("size_increace");
+const QString VStandardMeasurements::AttrSize_increase   = QStringLiteral("size_increase");
 const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase");
 
 //---------------------------------------------------------------------------------------------------------------------
@@ -217,17 +217,17 @@ void VStandardMeasurements::Measurement(const QString &tag)
             if (domElement.isNull() == false)
             {
                 const qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
-                const qreal size_increace = GetParametrDouble(domElement, AttrSize_increace, "0.0");
+                const qreal size_increase = GetParametrDouble(domElement, AttrSize_increase, "0.0");
                 const qreal height_increase = GetParametrDouble(domElement, AttrHeight_increase, "0.0");
 
                 if (Unit() == Valentina::Mm)// Convert to Cm.
                 {
-                    data->AddMeasurement(tag, VMeasurement(value/10.0, size_increace/10.0, height_increase/10.0,
+                    data->AddMeasurement(tag, VMeasurement(value/10.0, size_increase/10.0, height_increase/10.0,
                                                            qApp->GuiText(tag), qApp->Description(tag), tag));
                 }
                 else// Cm or inch.
                 {
-                    data->AddMeasurement(tag, VMeasurement(value, size_increace, height_increase, qApp->GuiText(tag),
+                    data->AddMeasurement(tag, VMeasurement(value, size_increase, height_increase, qApp->GuiText(tag),
                                                            qApp->Description(tag), tag));
                 }
             }
diff --git a/src/app/xml/vstandardmeasurements.h b/src/app/xml/vstandardmeasurements.h
index a970f46c4..5b2b89c18 100644
--- a/src/app/xml/vstandardmeasurements.h
+++ b/src/app/xml/vstandardmeasurements.h
@@ -53,7 +53,7 @@ public:
     static const QString TagSize;
     static const QString TagHeight;
     static const QString AttrValue;
-    static const QString AttrSize_increace;
+    static const QString AttrSize_increase;
     static const QString AttrHeight_increase;
 private:
     void Measurement(const QString &tag);

From 8b6a140ebb573d0a0841e6dbe6bce122eacfd3a2 Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Wed, 28 May 2014 18:52:50 +0300
Subject: [PATCH 02/17] Issue #104.

--HG--
branch : develop
---
 src/app/tools/drawTools/vtoolshoulderpoint.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/app/tools/drawTools/vtoolshoulderpoint.cpp b/src/app/tools/drawTools/vtoolshoulderpoint.cpp
index b7da6c023..cd29ce3b1 100644
--- a/src/app/tools/drawTools/vtoolshoulderpoint.cpp
+++ b/src/app/tools/drawTools/vtoolshoulderpoint.cpp
@@ -65,6 +65,7 @@ void VToolShoulderPoint::setDialog()
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+//TODO find better way calculate point.
 QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder,
                                       const qreal &length)
 {

From 1fd6464884b8c794af052378223ffc667d984c70 Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Thu, 29 May 2014 10:08:54 +0300
Subject: [PATCH 03/17] New command line parser. New Qt requirements. Fix issue
 with build project.

--HG--
branch : develop
---
 README                             |  6 ++--
 Valentina.pro                      |  4 +--
 src/app/app.pro                    | 10 +++---
 src/app/main.cpp                   | 42 +++++++----------------
 src/app/mainwindow.cpp             | 28 +++++++++++----
 src/app/xml/vpattern.cpp           |  2 +-
 src/libs/libs.pro                  |  3 ++
 src/src.pro                        | 55 +++---------------------------
 src/test/ParserTest/ParserTest.pro | 11 +++---
 src/test/test.pro                  |  3 ++
 10 files changed, 61 insertions(+), 103 deletions(-)
 create mode 100644 src/libs/libs.pro
 create mode 100644 src/test/test.pro

diff --git a/README b/README
index 84349b95e..2cd83e0cf 100644
--- a/README
+++ b/README
@@ -13,14 +13,14 @@ Supported Platforms
 The standalone binary packages support the following platforms:
 
 Windows XP SP2 or later
-Ubuntu Linux 11.10 (32-bit) or later
+Ubuntu Linux 14.04 (32-bit) or later
 
-Building the sources requires Qt 5.1.0 or later.
+Building the sources requires Qt 5.2.1 or later.
 
 Compiling Valentina
 ====================
 Prerequisites:
-   * Qt 5.1.0 or later (On Unix development packages needed)
+   * Qt 5.2.1 or later (On Unix development packages needed)
    * mercurial
    * On Unix:
      - ccache
diff --git a/Valentina.pro b/Valentina.pro
index fc3aa522f..7134680c9 100644
--- a/Valentina.pro
+++ b/Valentina.pro
@@ -1,9 +1,9 @@
 include(Valentina.pri)
 
 #version check qt
-!minQtVersion(5, 1, 0) {
+!minQtVersion(5, 2, 1) {
     message("Cannot build Valentina with Qt version $${QT_VERSION}.")
-    error("Use at least Qt 5.1.0.")
+    error("Use at least Qt 5.2.1.")
 }
 
 TEMPLATE = subdirs
diff --git a/src/app/app.pro b/src/app/app.pro
index 909719a1e..bbc31238c 100644
--- a/src/app/app.pro
+++ b/src/app/app.pro
@@ -219,9 +219,9 @@ for(DIR, INSTALL_STANDARD_MEASHUREMENTS) {
 
 copyToDestdir($$st_path, $$shell_path($$OUT_PWD/$$DESTDIR/tables/standard))
 
-win32:CONFIG(release, debug|release): LIBS += -L../libs/qmuparser/bin -lqmuparser2
-else:win32:CONFIG(debug, debug|release): LIBS += -L../libs/qmuparser/bin -lqmuparser2
-else:unix: LIBS += -L../libs/qmuparser/bin -lqmuparser
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libs/qmuparser/bin -lqmuparser2
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libs/qmuparser/bin -lqmuparser2
+else:unix: LIBS += -L$$OUT_PWD/../libs/qmuparser/bin -lqmuparser
 
-INCLUDEPATH += ../libs/qmuparser
-DEPENDPATH += ../libs/qmuparser
+INCLUDEPATH += $$PWD/../libs/qmuparser
+DEPENDPATH += $$PWD/../libs/qmuparser
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 3f6a00fc3..52b453603 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
     Q_INIT_RESOURCE(schema);
     Q_INIT_RESOURCE(theme);
 
-    QT_REQUIRE_VERSION(argc, argv, "5.1.0");
+    QT_REQUIRE_VERSION(argc, argv, "5.2.1");
 
     VApplication app(argc, argv);
 #ifdef QT_DEBUG
@@ -175,36 +175,18 @@ int main(int argc, char *argv[])
     QObject::connect(&w, &MainWindow::ModelChosen, &table, &TableWindow::ModelChosen);
     QObject::connect(&table, &TableWindow::closed, &w, &MainWindow::tableClosed);
 
-    const QStringList args = app.arguments();
-    QString fileName;
-    QRegExp rxArgOpenFile("-o");//parameter open file
+    QCommandLineParser parser;
+    parser.setApplicationDescription(QCoreApplication::translate("main", "Pattern making program."));
+    parser.addHelpOption();
+    parser.addVersionOption();
+    parser.addPositionalArgument("filename", QCoreApplication::translate("main", "Pattern file."));
+    parser.process(app);
+    const QStringList args = parser.positionalArguments();
+    if (args.size() > 0)
+    {
+        w.LoadPattern(args.at(0));
 
-    if (args.size()>1)
-    {
-        for (int i = 1; i < args.size(); ++i)
-        {
-            if (rxArgOpenFile.indexIn(args.at(i)) != -1 )
-            {
-                if (args.at(i+1).isEmpty() == false)
-                {
-                    fileName =  args.at(i+1);
-                    qDebug() << args.at(i)<< ":" << fileName;
-                    w.LoadPattern(fileName);
-                }
-                w.show();
-                break;
-            }
-            else
-            {
-                qDebug() << "Uknown arg:" << args.at(i);
-                w.show();
-                break;
-            }
-        }
-    }
-    else
-    {
-        w.show();
     }
+    w.show();
     return app.exec();
 }
diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp
index f9ee3c4b8..b7f028a29 100644
--- a/src/app/mainwindow.cpp
+++ b/src/app/mainwindow.cpp
@@ -1249,12 +1249,23 @@ void MainWindow::Open()
             dir = QFileInfo(files.first()).absolutePath();
         }
         QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter);
-        if (fileName.isEmpty() == false)
+        if (fileName.isEmpty() == false && fileName != curFile)
         {
-            LoadPattern(fileName);
+            if (curFile.isEmpty())
+            {
+                LoadPattern(fileName);
 
-            VAbstractTool::NewSceneRect(sceneDraw, view);
-            VAbstractTool::NewSceneRect(sceneDetails, view);
+                VAbstractTool::NewSceneRect(sceneDraw, view);
+                VAbstractTool::NewSceneRect(sceneDetails, view);
+            }
+            else
+            {
+                QProcess *v = new QProcess(this);
+                QStringList arguments;
+                arguments << fileName;
+                v->startDetached(QCoreApplication::applicationFilePath(), arguments);
+                delete v;
+            }
         }
     }
 }
@@ -1303,9 +1314,12 @@ void MainWindow::Clear()
  */
 void MainWindow::NewPattern()
 {
-    QProcess *v = new QProcess(this);
-    v->startDetached(QCoreApplication::applicationFilePath ());
-    delete v;
+    if (doc->isPatternModified() || curFile.isEmpty() == false)
+    {
+        QProcess *v = new QProcess(this);
+        v->startDetached(QCoreApplication::applicationFilePath ());
+        delete v;
+    }
 }
 
 //---------------------------------------------------------------------------------------------------------------------
diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp
index a3a8834a4..380a74b15 100644
--- a/src/app/xml/vpattern.cpp
+++ b/src/app/xml/vpattern.cpp
@@ -39,7 +39,7 @@
 #include "vindividualmeasurements.h"
 
 #include <QMessageBox>
-#include <qmuparsererror.h>
+#include "../../libs/qmuparser/qmuparsererror.h"
 
 const QString VPattern::TagPattern      = QStringLiteral("pattern");
 const QString VPattern::TagCalculation  = QStringLiteral("calculation");
diff --git a/src/libs/libs.pro b/src/libs/libs.pro
new file mode 100644
index 000000000..5d08776e9
--- /dev/null
+++ b/src/libs/libs.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+CONFIG   += ordered
+SUBDIRS = qmuparser
diff --git a/src/src.pro b/src/src.pro
index 6e951fd25..dbc4d1aaa 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,52 +1,7 @@
 TEMPLATE = subdirs
+CONFIG   += ordered
+
 SUBDIRS = \
-    sub_app \
-    sub_lib_qmuparser \
-    test/ParserTest
-
-sub_lib_qmuparser.file = libs/qmuparser/qmuparser.pro
-sub_parser_tests.file = test/ParserTest/ParserTest.pro
-sub_parser_tests.depends = sub_lib_qmuparser
-sub_app.file = app/app.pro
-sub_app.depends = sub_lib_qmuparser
-
-
-#This makes it possible to use make -j 4 on your fancy quad-core system with a project that consists of several
-#components that depend on each other. To simplify the process a bit, the following test function can be defined:
-
-# addSubdirs(subdirs,deps): Adds directories to the project that depend on
-# other directories
-defineTest(addSubdirs) {
-    for(subdirs, 1) {
-        entries = $$files($$subdirs)
-        for(entry, entries) {
-            name = $$replace(entry, [/\\\\], _)
-            SUBDIRS += $$name
-            eval ($${name}.subdir = $$entry)
-            for(dep, 2):eval ($${name}.depends += $$replace(dep, [/\\\\], _))
-            export ($${name}.subdir)
-            export ($${name}.depends)
-        }
-    }
-    export (SUBDIRS)
-}
-#You can then use it like to define a project that has:
-
-#several contributed modules that should be compiled first
-#addSubdirs (contrib/*)
-
-#a kernel lib for non-gui related stuff that depends on some contrib modules
-#addSubdirs (src/lib/kernel, contrib/module1 contrib/module2)
-
-#a gui lib that depends on the kernel lib and some other contrib modules
-#addSubdirs (src/lib/gui, src/lib/kernel contrib/module3 contrib/module4)
-
-#test benches for the kernel and gui libs
-#addSubdirs (src/tests/kernel, src/lib/kernel)
-#addSubdirs (src/tests/gui, src/lib/gui)
-
-#a main program that uses the gui and kernel libs
-#addSubdirs (src/main, src/lib/gui src/lib/kernel)
-
-#several modules that only depend on the kernel lib
-#addSubdirs (src/modules/*, src/lib/kernel)
+    libs \
+    app \
+    test
diff --git a/src/test/ParserTest/ParserTest.pro b/src/test/ParserTest/ParserTest.pro
index e7da26428..3be053f5d 100644
--- a/src/test/ParserTest/ParserTest.pro
+++ b/src/test/ParserTest/ParserTest.pro
@@ -58,9 +58,10 @@ CONFIG(debug, debug|release){
 QMAKE_DISTCLEAN += $${DESTDIR}/* \
                    $${OBJECTS_DIR}/*
 
-win32:CONFIG(release, debug|release): LIBS += -L../../libs/qmuparser/bin -lqmuparser2
-else:win32:CONFIG(debug, debug|release): LIBS += -L../../libs/qmuparser/bin -lqmuparser2
-else:unix: LIBS += -L../../libs/qmuparser/bin -lqmuparser
 
-INCLUDEPATH += ../../libs/qmuparser
-DEPENDPATH += ../../libs/qmuparser
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../libs/qmuparser/bin/ -lqmuparser2
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../libs/qmuparser/bin/ -lqmuparser2
+else:unix: LIBS += -L$$OUT_PWD/../../libs/qmuparser/bin/ -lqmuparser
+
+INCLUDEPATH += $$PWD/../../libs/qmuparser
+DEPENDPATH += $$PWD/../../libs/qmuparser
diff --git a/src/test/test.pro b/src/test/test.pro
new file mode 100644
index 000000000..db8b1c7c4
--- /dev/null
+++ b/src/test/test.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+CONFIG   += ordered
+SUBDIRS = ParserTest

From 18f168da5eaf0ef531073fcfe9a5bfd089ee7652 Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Thu, 29 May 2014 10:30:32 +0300
Subject: [PATCH 04/17] Fixed issue #118.

--HG--
branch : develop
---
 dist/debian/valentina.1 | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/dist/debian/valentina.1 b/dist/debian/valentina.1
index 488473b7f..53996aa5c 100644
--- a/dist/debian/valentina.1
+++ b/dist/debian/valentina.1
@@ -1,13 +1,19 @@
 .\" Manpage for valentina.
 .\" Contact dismine@gmail.com.in to correct errors.
-.TH man 1 "25 Nov 2013" "1.0" "valentina man page"
+.TH man 1 "29 May 2014" "valentina man page"
 .SH NAME
 valentina \- Pattern making program.
 .SH SYNOPSIS
-valentina
+valentina [options] file
 .SH DESCRIPTION
 Open source project of creating a pattern making program, whose allow create and modeling patterns of clothing.
 .SH OPTIONS
-The valentina does not take any options. 
+-help Show summary of options.
+
+-version
+      Show version of program.
+
+file
+      Pattern file to load.
 .SH AUTHOR
-Roman Telezhinsky (dismine@gmail.com)
\ No newline at end of file
+This  manual  page  was  written  by Roman Telezhynskyi <dismine@gmail.com>

From 01ee27d33c66f8dd49466c051ea07677e96f6ef6 Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Thu, 29 May 2014 11:46:28 +0300
Subject: [PATCH 05/17] Setting decimal separator parts from OS oprions.

--HG--
branch : develop
---
 src/app/container/calculator.cpp     | 21 +++++++++++++++++----
 src/app/dialogs/app/pages.cpp        |  9 ++++-----
 src/app/dialogs/tools/dialogtool.cpp | 16 ++++++++++++++--
 src/app/widgets/vapplication.cpp     | 13 +++++++++++--
 4 files changed, 46 insertions(+), 13 deletions(-)

diff --git a/src/app/container/calculator.cpp b/src/app/container/calculator.cpp
index 238616e74..937547b71 100644
--- a/src/app/container/calculator.cpp
+++ b/src/app/container/calculator.cpp
@@ -28,6 +28,7 @@
 
 #include "calculator.h"
 #include <QDebug>
+#include <QSettings>
 #include "../widgets/vapplication.h"
 
 int Calculator::iVal = -1;
@@ -68,10 +69,22 @@ Calculator::Calculator(const QString &formula, bool fromUser)
         DefinePostfixOprt(qApp->PostfixOperator(mm_Oprt), MmUnit);
         DefinePostfixOprt(qApp->PostfixOperator(in_Oprt), InchUnit);
 
-        QLocale loc = QLocale::system();
-        SetDecSep(loc.decimalPoint().toLatin1());
-        SetThousandsSep(loc.groupSeparator().toLatin1());
-        SetArgSep(';');
+        QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
+                           QApplication::applicationName());
+        bool osSeparatorValue = settings.value("configuration/osSeparator", 1).toBool();
+
+        if (osSeparatorValue)
+        {
+            QLocale loc = QLocale::system();
+            SetDecSep(loc.decimalPoint().toLatin1());
+            SetThousandsSep(loc.groupSeparator().toLatin1());
+            SetArgSep(';');
+        }
+        else
+        {
+            SetArgSep(',');
+            SetDecSep('.');
+        }
     }
     else
     {
diff --git a/src/app/dialogs/app/pages.cpp b/src/app/dialogs/app/pages.cpp
index 476c941da..1e17fd272 100644
--- a/src/app/dialogs/app/pages.cpp
+++ b/src/app/dialogs/app/pages.cpp
@@ -51,7 +51,7 @@ void ConfigurationPage::Apply()
                        QApplication::applicationName());
     settings.setValue("configuration/autosave/state", autoSaveCheck->isChecked());
     settings.setValue("configuration/autosave/time", autoTime->value());
-    //settings.setValue("configuration/osSeparator", osOptionCheck->isChecked());
+    settings.setValue("configuration/osSeparator", osOptionCheck->isChecked());
     if (langChanged)
     {
         QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
@@ -157,10 +157,9 @@ QGroupBox *ConfigurationPage::LangGroup()
 
     QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
 
-    osOptionCheck = new QCheckBox(tr("With OS options (.)"));
-    //bool osOptionValue = settings.value("configuration/osSeparator", 1).toBool();
-    //osOptionCheck->setChecked(osOptionValue);
-    osOptionCheck->setEnabled(false);
+    osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
+    bool osOptionValue = settings.value("configuration/osSeparator", 1).toBool();
+    osOptionCheck->setChecked(osOptionValue);
 
     QHBoxLayout *separatorLayout = new QHBoxLayout;
     separatorLayout->addWidget(separatorLabel);
diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp
index d051e2d03..a4e00f419 100644
--- a/src/app/dialogs/tools/dialogtool.cpp
+++ b/src/app/dialogs/tools/dialogtool.cpp
@@ -336,8 +336,20 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
             Calculator cal(data);
             const qreal result = cal.EvalFormula(formula);
 
-            QLocale loc = QLocale::system();
-            label->setText(loc.toString(result));
+            QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
+                               QApplication::applicationName());
+            bool osSeparatorValue = settings.value("configuration/osSeparator", 1).toBool();
+
+            if (osSeparatorValue)
+            {
+                QLocale loc = QLocale::system();
+                label->setText(loc.toString(result));
+            }
+            else
+            {
+                QLocale loc = QLocale(QLocale::C);
+                label->setText(loc.toString(result));
+            }
             flag = true;
             palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
             emit ToolTip("");
diff --git a/src/app/widgets/vapplication.cpp b/src/app/widgets/vapplication.cpp
index 6718e9b1f..5fa41b309 100644
--- a/src/app/widgets/vapplication.cpp
+++ b/src/app/widgets/vapplication.cpp
@@ -36,6 +36,7 @@
 #include <QMessageBox>
 #include <QDebug>
 #include <QDir>
+#include <QSettings>
 
 #include <container/calculator.h>
 
@@ -1789,8 +1790,12 @@ QString VApplication::FormulaFromUser(const QString &formula)
         }
     }
 
+    QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
+                       QApplication::applicationName());
+    bool osSeparatorValue = settings.value("configuration/osSeparator", 1).toBool();
+
     QLocale loc = QLocale::system();
-    if(loc != QLocale(QLocale::C))
+    if(loc != QLocale(QLocale::C) && osSeparatorValue)
     {
         QList<int> nKeys = numbers.keys();
         QList<QString> nValues = numbers.values();
@@ -1903,8 +1908,12 @@ QString VApplication::FormulaToUser(const QString &formula)
         }
     }
 
+    QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
+                       QApplication::applicationName());
+    bool osSeparatorValue = settings.value("configuration/osSeparator", 1).toBool();
+
     QLocale loc = QLocale::system();
-    if(loc != QLocale::C)
+    if(loc != QLocale::C && osSeparatorValue)
     {
         QList<int> nKeys = numbers.keys();
         QList<QString> nValues = numbers.values();

From 381adf0ba058eeb274ec2cb46f6f235bf0c86d78 Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 11:32:40 +0300
Subject: [PATCH 06/17] Dialog edit wrong formula (only for toolendline now).

--HG--
branch : feature
---
 src/app/container/calculator.cpp              |  21 +-
 src/app/dialogs/dialogs.pri                   |   9 +-
 src/app/dialogs/tools/dialogcutarc.cpp        |  36 ++
 src/app/dialogs/tools/dialogcutarc.h          |  65 ++--
 .../dialogs/tools/dialogeditwrongformula.cpp  |  95 +++++
 .../dialogs/tools/dialogeditwrongformula.h    |  69 ++++
 .../dialogs/tools/dialogeditwrongformula.ui   | 347 ++++++++++++++++++
 src/app/dialogs/tools/dialogtool.cpp          |   5 +-
 src/app/main.cpp                              |   5 +-
 src/app/mainwindow.cpp                        |   7 +
 src/app/tools/drawTools/vtoolendline.cpp      |  31 +-
 src/app/tools/drawTools/vtoolendline.h        |   2 +-
 src/app/widgets/vapplication.cpp              |  32 +-
 src/app/xml/vpattern.cpp                      |  14 +-
 src/app/xml/vpattern.h                        |   2 +-
 src/libs/qmuparser/qmuparser.cpp              |   6 +-
 src/libs/qmuparser/qmuparsertokenreader.cpp   |   3 +-
 17 files changed, 649 insertions(+), 100 deletions(-)
 create mode 100644 src/app/dialogs/tools/dialogeditwrongformula.cpp
 create mode 100644 src/app/dialogs/tools/dialogeditwrongformula.h
 create mode 100644 src/app/dialogs/tools/dialogeditwrongformula.ui

diff --git a/src/app/container/calculator.cpp b/src/app/container/calculator.cpp
index 937547b71..4b8e56b6c 100644
--- a/src/app/container/calculator.cpp
+++ b/src/app/container/calculator.cpp
@@ -97,14 +97,7 @@ Calculator::Calculator(const QString &formula, bool fromUser)
     }
 
     SetExpr(formula);
-    try
-    {
-        Eval();//Need run for making tokens
-    }
-    catch(qmu::QmuParserError &e)
-    {
-        return;//Ignore all warnings
-    }
+    Eval();//Need run for making tokens
 }
 
 Calculator::~Calculator()
@@ -217,15 +210,13 @@ void Calculator::InitVariables(const VContainer *data)
             if (qApp->patternType() == Pattern::Standard)
             {
                 vVarVal[j] = i.value().GetValue(data->size(), data->height());
-                DefineVar(i.key(), &vVarVal[j]);
-                ++j;
             }
             else
             {
                 vVarVal[j] = i.value().GetValue();
-                DefineVar(i.key(), &vVarVal[j]);
-                ++j;
             }
+            DefineVar(i.key(), &vVarVal[j]);
+            ++j;
             ++i;
         }
     }
@@ -237,15 +228,13 @@ void Calculator::InitVariables(const VContainer *data)
             if (qApp->patternType() == Pattern::Standard)
             {
                 vVarVal[j] = i.value().GetValue(data->size(), data->height());
-                DefineVar(i.key(), &vVarVal[j]);
-                ++j;
             }
             else
             {
                 vVarVal[j] = i.value().GetValue();
-                DefineVar(i.key(), &vVarVal[j]);
-                ++j;
             }
+            DefineVar(i.key(), &vVarVal[j]);
+            ++j;
             ++i;
         }
     }
diff --git a/src/app/dialogs/dialogs.pri b/src/app/dialogs/dialogs.pri
index 62dd44ef5..01e895748 100644
--- a/src/app/dialogs/dialogs.pri
+++ b/src/app/dialogs/dialogs.pri
@@ -29,7 +29,8 @@ HEADERS += \
     dialogs/app/dialogmeasurements.h \
     dialogs/app/dialogstandardmeasurements.h \
     dialogs/app/dialogindividualmeasurements.h \
-	dialogs/app/dialogaboutapp.h
+	dialogs/app/dialogaboutapp.h \
+    dialogs/tools/dialogeditwrongformula.h
 
 SOURCES += \
     dialogs/tools/dialogtriangle.cpp \
@@ -61,7 +62,8 @@ SOURCES += \
     dialogs/app/dialogmeasurements.cpp \
     dialogs/app/dialogstandardmeasurements.cpp \
     dialogs/app/dialogindividualmeasurements.cpp \
-	dialogs/app/dialogaboutapp.cpp
+	dialogs/app/dialogaboutapp.cpp \
+    dialogs/tools/dialogeditwrongformula.cpp
 
 FORMS += \
     dialogs/tools/dialogtriangle.ui \
@@ -90,4 +92,5 @@ FORMS += \
     dialogs/app/dialogmeasurements.ui \
     dialogs/app/dialogstandardmeasurements.ui \
     dialogs/app/dialogindividualmeasurements.ui \
-	dialogs/app/dialogaboutapp.ui
+	dialogs/app/dialogaboutapp.ui \
+    dialogs/tools/dialogeditwrongformula.ui
diff --git a/src/app/dialogs/tools/dialogcutarc.cpp b/src/app/dialogs/tools/dialogcutarc.cpp
index 5ab00d16e..0a43e7e6d 100644
--- a/src/app/dialogs/tools/dialogcutarc.cpp
+++ b/src/app/dialogs/tools/dialogcutarc.cpp
@@ -30,6 +30,11 @@
 #include "ui_dialogcutarc.h"
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief DialogCutArc create dialog.
+ * @param data container with data
+ * @param parent parent widget
+ */
 DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
     DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0)
 {
@@ -62,6 +67,11 @@ DialogCutArc::~DialogCutArc()
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
+ * @param id id of point or detail
+ * @param type type of object
+ */
 void DialogCutArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
 {
     if (type == Valentina::Arc)
@@ -74,6 +84,9 @@ void DialogCutArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief DialogAccepted save data and emit signal about closed dialog.
+ */
 void DialogCutArc::DialogAccepted()
 {
     pointName = ui->lineEditNamePoint->text();
@@ -83,12 +96,21 @@ void DialogCutArc::DialogAccepted()
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief setArcId set id of arc
+ * @param value id
+ * @param id don't show this id in list
+ */
 void DialogCutArc::setArcId(const quint32 &value, const quint32 &id)
 {
     setCurrentArcId(ui->comboBoxArc, arcId, value, id, ComboMode::CutArc);
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief setFormula set string with formula length
+ * @param value string with formula
+ */
 void DialogCutArc::setFormula(const QString &value)
 {
     formula = qApp->FormulaToUser(value);
@@ -96,8 +118,22 @@ void DialogCutArc::setFormula(const QString &value)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief setPointName set name point on arc
+ * @param value name
+ */
 void DialogCutArc::setPointName(const QString &value)
 {
     pointName = value;
     ui->lineEditNamePoint->setText(pointName);
 }
+
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief getFormula return string with formula length
+ * @return formula
+ */
+QString DialogCutArc::getFormula() const
+{
+    return qApp->FormulaFromUser(formula);
+}
diff --git a/src/app/dialogs/tools/dialogcutarc.h b/src/app/dialogs/tools/dialogcutarc.h
index e9df0964d..306e28256 100644
--- a/src/app/dialogs/tools/dialogcutarc.h
+++ b/src/app/dialogs/tools/dialogcutarc.h
@@ -43,54 +43,17 @@ class DialogCutArc : public DialogTool
 {
     Q_OBJECT
 public:
-    /**
-     * @brief DialogCutArc create dialog.
-     * @param data container with data
-     * @param parent parent widget
-     */
+
     DialogCutArc(const VContainer *data, QWidget *parent = nullptr);
     ~DialogCutArc();
-    /**
-     * @brief getPointName return name point on arc
-     * @return name
-     */
-    QString           getPointName() const {return pointName;}
-    /**
-     * @brief setPointName set name point on arc
-     * @param value name
-     */
+    QString           getPointName() const;
     void              setPointName(const QString &value);
-    /**
-     * @brief getFormula return string with formula length
-     * @return formula
-     */
-    QString           getFormula() const {return qApp->FormulaFromUser(formula);}
-    /**
-     * @brief setFormula set string with formula length
-     * @param value string with formula
-     */
+    QString           getFormula() const;
     void              setFormula(const QString &value);
-    /**
-     * @brief getArcId return id of arc
-     * @return id
-     */
-    quint32            getArcId() const {return arcId;}
-    /**
-     * @brief setArcId set id of arc
-     * @param value id
-     * @param id don't show this id in list
-     */
+    quint32           getArcId() const;
     void              setArcId(const quint32 &value, const quint32 &id);
 public slots:
-    /**
-     * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
-     * @param id id of point or detail
-     * @param type type of object
-     */
     virtual void      ChoosedObject(quint32 id, const Valentina::Scenes &type);
-    /**
-     * @brief DialogAccepted save data and emit signal about closed dialog.
-     */
     virtual void      DialogAccepted();
 private:
     Q_DISABLE_COPY(DialogCutArc)
@@ -112,4 +75,24 @@ private:
     quint32            arcId;
 };
 
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief getPointName return name point on arc
+ * @return name
+ */
+inline QString DialogCutArc::getPointName() const
+{
+    return pointName;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief getArcId return id of arc
+ * @return id
+ */
+inline quint32 DialogCutArc::getArcId() const
+{
+    return arcId;
+}
+
 #endif // DIALOGCUTARC_H
diff --git a/src/app/dialogs/tools/dialogeditwrongformula.cpp b/src/app/dialogs/tools/dialogeditwrongformula.cpp
new file mode 100644
index 000000000..88d1e3bb8
--- /dev/null
+++ b/src/app/dialogs/tools/dialogeditwrongformula.cpp
@@ -0,0 +1,95 @@
+/************************************************************************
+ **
+ **  @file   dialogeditwrongformula.cpp
+ **  @author Roman Telezhynskyi <dismine(at)gmail.com>
+ **  @date   29 5, 2014
+ **
+ **  @brief
+ **  @copyright
+ **  This source code is part of the Valentine project, a pattern making
+ **  program, whose allow create and modeling patterns of clothing.
+ **  Copyright (C) 2014 Valentina project
+ **  <https://bitbucket.org/dismine/valentina> All Rights Reserved.
+ **
+ **  Valentina is free software: you can redistribute it and/or modify
+ **  it under the terms of the GNU General Public License as published by
+ **  the Free Software Foundation, either version 3 of the License, or
+ **  (at your option) any later version.
+ **
+ **  Valentina is distributed in the hope that it will be useful,
+ **  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ **  GNU General Public License for more details.
+ **
+ **  You should have received a copy of the GNU General Public License
+ **  along with Valentina.  If not, see <http://www.gnu.org/licenses/>.
+ **
+ *************************************************************************/
+
+#include "dialogeditwrongformula.h"
+#include "ui_dialogeditwrongformula.h"
+
+#include <container/calculator.h>
+
+//---------------------------------------------------------------------------------------------------------------------
+DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, QWidget *parent)
+    :DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString())
+{
+    ui->setupUi(this);
+    InitVariables(ui);
+    labelResultCalculation = ui->labelResult;
+    lineEditFormula = ui->lineEditFormula;
+    labelEditFormula = ui->labelFormula;
+
+    InitOkCansel(ui);
+    flagFormula = false;
+    CheckState();
+
+
+    connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEditWrongFormula::PutHere);
+    connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEditWrongFormula::PutVal);
+
+    connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEditWrongFormula::EvalFormula);
+    connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEditWrongFormula::FormulaChanged);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+DialogEditWrongFormula::~DialogEditWrongFormula()
+{
+    delete ui;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogEditWrongFormula::DialogAccepted()
+{
+    formula = ui->lineEditFormula->text();
+    emit DialogClosed(QDialog::Accepted);
+    accepted();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogEditWrongFormula::DialogRejected()
+{
+    emit DialogClosed(QDialog::Rejected);
+    rejected();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogEditWrongFormula::CheckState()
+{
+    Q_CHECK_PTR(bOk);
+    bOk->setEnabled(flagFormula);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogEditWrongFormula::setFormula(const QString &value)
+{
+    formula = qApp->FormulaToUser(value);
+    ui->lineEditFormula->setText(formula);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+QString DialogEditWrongFormula::getFormula() const
+{
+    return qApp->FormulaFromUser(formula);
+}
diff --git a/src/app/dialogs/tools/dialogeditwrongformula.h b/src/app/dialogs/tools/dialogeditwrongformula.h
new file mode 100644
index 000000000..d76873046
--- /dev/null
+++ b/src/app/dialogs/tools/dialogeditwrongformula.h
@@ -0,0 +1,69 @@
+/************************************************************************
+ **
+ **  @file   dialogeditwrongformula.h
+ **  @author Roman Telezhynskyi <dismine(at)gmail.com>
+ **  @date   29 5, 2014
+ **
+ **  @brief
+ **  @copyright
+ **  This source code is part of the Valentine project, a pattern making
+ **  program, whose allow create and modeling patterns of clothing.
+ **  Copyright (C) 2014 Valentina project
+ **  <https://bitbucket.org/dismine/valentina> All Rights Reserved.
+ **
+ **  Valentina is free software: you can redistribute it and/or modify
+ **  it under the terms of the GNU General Public License as published by
+ **  the Free Software Foundation, either version 3 of the License, or
+ **  (at your option) any later version.
+ **
+ **  Valentina is distributed in the hope that it will be useful,
+ **  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ **  GNU General Public License for more details.
+ **
+ **  You should have received a copy of the GNU General Public License
+ **  along with Valentina.  If not, see <http://www.gnu.org/licenses/>.
+ **
+ *************************************************************************/
+
+#ifndef DIALOGEDITWRONGFORMULA_H
+#define DIALOGEDITWRONGFORMULA_H
+
+#include "dialogtool.h"
+
+namespace Ui {
+class DialogEditWrongFormula;
+}
+
+/**
+ * @brief The DialogEditWrongFormula class dialog for editing wrong formula.
+ *
+ * When math parser find in formula error user can try fix issue. Dialog will show all variables that user can use in
+ * this formula. Dialog check fixed variant of formula.
+ *
+ * Don't implemant button "Apply" for this dialog!!
+ */
+class DialogEditWrongFormula : public DialogTool
+{
+    Q_OBJECT
+public:
+    explicit DialogEditWrongFormula(const VContainer *data, QWidget *parent = nullptr);
+    ~DialogEditWrongFormula();
+    QString      getFormula() const;
+    void         setFormula(const QString &value);
+public slots:
+    virtual void DialogAccepted();
+    virtual void DialogRejected();
+protected:
+    virtual void CheckState();
+private:
+    Q_DISABLE_COPY(DialogEditWrongFormula)
+    Ui::DialogEditWrongFormula *ui;
+    /**
+     * @brief formula string with formula
+     */
+    QString           formula;
+};
+
+
+#endif // DIALOGEDITWRONGFORMULA_H
diff --git a/src/app/dialogs/tools/dialogeditwrongformula.ui b/src/app/dialogs/tools/dialogeditwrongformula.ui
new file mode 100644
index 000000000..9d9501d78
--- /dev/null
+++ b/src/app/dialogs/tools/dialogeditwrongformula.ui
@@ -0,0 +1,347 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogEditWrongFormula</class>
+ <widget class="QDialog" name="DialogEditWrongFormula">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>607</width>
+    <height>535</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Edit wrong formula</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_4">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <item>
+        <widget class="QLabel" name="labelFormula">
+         <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>255</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </active>
+           <inactive>
+            <colorrole role="WindowText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</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>Formula</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLineEdit" name="lineEditFormula">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="toolTip">
+          <string>First angle of arc counterclockwise</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QToolButton" name="toolButtonPutHere">
+         <property name="toolTip">
+          <string>Insert variable into formula</string>
+         </property>
+         <property name="text">
+          <string>...</string>
+         </property>
+         <property name="icon">
+          <iconset resource="../../share/resources/icon.qrc">
+           <normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>24</width>
+           <height>24</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QToolButton" name="toolButtonEqual">
+         <property name="toolTip">
+          <string>Calculate value</string>
+         </property>
+         <property name="text">
+          <string>...</string>
+         </property>
+         <property name="icon">
+          <iconset resource="../../share/resources/icon.qrc">
+           <normaloff>:/icon/24x24/equal.png</normaloff>:/icon/24x24/equal.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>24</width>
+           <height>24</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLabel" name="labelResult">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>87</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="toolTip">
+          <string>Value of first angle</string>
+         </property>
+         <property name="text">
+          <string>_</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_4">
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_2">
+         <item>
+          <layout class="QVBoxLayout" name="verticalLayout_3">
+           <item>
+            <widget class="QLabel" name="label_8">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>Input data</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QRadioButton" name="radioButtonSizeGrowth">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>Size and height</string>
+             </property>
+             <property name="checked">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QRadioButton" name="radioButtonStandardTable">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>Standard table</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QRadioButton" name="radioButtonIncrements">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>Increments</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QRadioButton" name="radioButtonLengthLine">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>Length of lines</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QRadioButton" name="radioButtonLengthArc">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>Length of arcs</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QRadioButton" name="radioButtonLengthSpline">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>Length of curves</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QRadioButton" name="radioButtonLineAngles">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>Angle of lines</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QListWidget" name="listWidget">
+         <property name="toolTip">
+          <string>Variables</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <widget class="QLabel" name="labelDescription">
+       <property name="text">
+        <string/>
+       </property>
+       <property name="wordWrap">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDialogButtonBox" name="buttonBox">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="standardButtons">
+        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="../../share/resources/icon.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>DialogEditWrongFormula</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>DialogEditWrongFormula</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp
index a4e00f419..2338b476a 100644
--- a/src/app/dialogs/tools/dialogtool.cpp
+++ b/src/app/dialogs/tools/dialogtool.cpp
@@ -333,8 +333,9 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
         try
         {
             const QString formula = qApp->FormulaFromUser(edit->text());
-            Calculator cal(data);
-            const qreal result = cal.EvalFormula(formula);
+            Calculator *cal = new Calculator(data);
+            const qreal result = cal->EvalFormula(formula);
+            delete cal;
 
             QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
                                QApplication::applicationName());
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 52b453603..6a97593b0 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -74,9 +74,8 @@ void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, c
         switch (type)
         {
             case QtDebugMsg:
-                fprintf(stderr, "Debug: %s\n", localMsg.constData());
-//                fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line,
-//                        context.function);
+                fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line,
+                        context.function);
                 return;
             case QtWarningMsg:
                 messageBox.setIcon(QMessageBox::Warning);
diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp
index b7f028a29..85010b170 100644
--- a/src/app/mainwindow.cpp
+++ b/src/app/mainwindow.cpp
@@ -1905,7 +1905,14 @@ void MainWindow::LoadPattern(const QString &fileName)
     }
     SetEnableWidgets(true);
 
+    bool patternModified = doc->isPatternModified();
     setCurrentFile(fileName);
+    if (patternModified)
+    {
+        //For situation where was fixed wrong formula need return for document status was modified.
+        doc->setPatternModified(patternModified);
+        PatternWasModified();
+    }
     helpLabel->setText(tr("File loaded"));
 }
 
diff --git a/src/app/tools/drawTools/vtoolendline.cpp b/src/app/tools/drawTools/vtoolendline.cpp
index 22c9639cc..f210ed6a3 100644
--- a/src/app/tools/drawTools/vtoolendline.cpp
+++ b/src/app/tools/drawTools/vtoolendline.cpp
@@ -30,6 +30,7 @@
 #include "../../widgets/vmaingraphicsscene.h"
 #include "../../container/calculator.h"
 #include "../../dialogs/tools/dialogendline.h"
+#include "../../dialogs/tools/dialogeditwrongformula.h"
 
 const QString VToolEndLine::ToolType = QStringLiteral("endLine");
 
@@ -82,15 +83,39 @@ void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatter
 
 //---------------------------------------------------------------------------------------------------------------------
 void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
-                          const QString &formula, const qreal &angle, const quint32 &basePointId,
+                          QString &formula, const qreal &angle, const quint32 &basePointId,
                           const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
                           VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
 {
     const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
     QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
 
-    Calculator cal(data);
-    const qreal result = cal.EvalFormula(formula);
+    qreal result = 0;
+
+    try
+    {
+        Calculator *cal = new Calculator(data);
+        result = cal->EvalFormula(formula);
+        delete cal;
+    }
+    catch(qmu::QmuParserError &e)
+    {
+        DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data);
+        dialog->setFormula(formula);
+        if (dialog->exec() == QDialog::Accepted)
+        {
+            formula = dialog->getFormula();
+            delete dialog;
+            Calculator *cal = new Calculator(data);
+            result = cal->EvalFormula(formula);
+            delete cal;
+        }
+        else
+        {
+            delete dialog;
+            throw;
+        }
+    }
 
     line.setLength(qApp->toPixel(result));
     line.setAngle(angle);
diff --git a/src/app/tools/drawTools/vtoolendline.h b/src/app/tools/drawTools/vtoolendline.h
index acf0bcf20..17a272f19 100644
--- a/src/app/tools/drawTools/vtoolendline.h
+++ b/src/app/tools/drawTools/vtoolendline.h
@@ -82,7 +82,7 @@ public:
      * @param typeCreation way we create this tool.
      */
     static void  Create(const quint32 _id, const QString &pointName, const QString &typeLine,
-                        const QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx,
+                        QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx,
                         const qreal &my, VMainGraphicsScene  *scene, VPattern *doc, VContainer *data,
                         const Document::Documents &parse, const Valentina::Sources &typeCreation);
     static const QString ToolType;
diff --git a/src/app/widgets/vapplication.cpp b/src/app/widgets/vapplication.cpp
index 5fa41b309..36a246d13 100644
--- a/src/app/widgets/vapplication.cpp
+++ b/src/app/widgets/vapplication.cpp
@@ -1722,23 +1722,10 @@ QString VApplication::FormulaFromUser(const QString &formula)
 {
     QString newFormula = formula;
 
-    QMap<int, QString> tokens;
-    QMap<int, QString> numbers;
-    try
-    {
-        Calculator cal(formula);
-        tokens = cal.GetTokens();
-        numbers = cal.GetNumbers();
-    }
-    catch(qmu::QmuParserError &e)
-    {
-        qDebug() << "\nMath parser error:\n"
-                 << "--------------------------------------\n"
-                 << "Message:     " << e.GetMsg()  << "\n"
-                 << "Expression:  " << e.GetExpr() << "\n"
-                 << "--------------------------------------";
-        return newFormula;
-    }
+    Calculator *cal = new Calculator(formula);
+    QMap<int, QString> tokens = cal->GetTokens();
+    QMap<int, QString> numbers = cal->GetNumbers();
+    delete cal;
 
     QList<int> tKeys = tokens.keys();
     QList<QString> tValues = tokens.values();
@@ -1799,7 +1786,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
     {
         QList<int> nKeys = numbers.keys();
         QList<QString> nValues = numbers.values();
-        for (int i = 0; i < tKeys.size(); ++i)
+        for (int i = 0; i < nKeys.size(); ++i)
         {
             bool ok = false;
             qreal d = loc.toDouble(nValues.at(i), &ok);
@@ -1838,9 +1825,10 @@ QString VApplication::FormulaToUser(const QString &formula)
     QMap<int, QString> numbers;
     try
     {
-        Calculator cal(formula, false);
-        tokens = cal.GetTokens();
-        numbers = cal.GetNumbers();
+        Calculator *cal = new Calculator(formula, false);
+        tokens = cal->GetTokens();
+        numbers = cal->GetNumbers();
+        delete cal;
     }
     catch (qmu::QmuParserError &e)
     {
@@ -1917,7 +1905,7 @@ QString VApplication::FormulaToUser(const QString &formula)
     {
         QList<int> nKeys = numbers.keys();
         QList<QString> nValues = numbers.values();
-        for (int i = 0; i < tKeys.size(); ++i)
+        for (int i = 0; i < nKeys.size(); ++i)
         {
             QLocale loc = QLocale(QLocale::C);
             bool ok = false;
diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp
index 380a74b15..2f09edae4 100644
--- a/src/app/xml/vpattern.cpp
+++ b/src/app/xml/vpattern.cpp
@@ -656,7 +656,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
     const qint32 num = nodeList.size();
     for (qint32 i = 0; i < num; ++i)
     {
-        const QDomElement domElement = nodeList.at(i).toElement();
+        QDomElement domElement = nodeList.at(i).toElement();
         if (domElement.isNull() == false)
         {
             QStringList tags;
@@ -779,7 +779,7 @@ void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &domElement,
+void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
                                  const Document::Documents &parse, const QString &type)
 {
     Q_CHECK_PTR(scene);
@@ -842,11 +842,19 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
                 const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
                                                            VAbstractTool::TypeLineLine);
                 const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
+                QString f = formula;//need for saving fixed formula;
+
                 const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0");
                 const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0");
 
-                VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId,
+                VToolEndLine::Create(id, name, typeLine, f, angle, basePointId,
                                         mx, my, scene, this, data, parse, Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (f != formula)
+                {
+                    SetAttribute(domElement, VToolEndLine::AttrLength, f);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
diff --git a/src/app/xml/vpattern.h b/src/app/xml/vpattern.h
index 1c61de1f7..79ed6b197 100644
--- a/src/app/xml/vpattern.h
+++ b/src/app/xml/vpattern.h
@@ -334,7 +334,7 @@ private:
      * @param type type of point.
      * @param mode draw mode.
      */
-    void           ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
+    void           ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
                                      const Document::Documents &parse, const QString &type);
     /**
      * @brief ParseLineElement parse line tag.
diff --git a/src/libs/qmuparser/qmuparser.cpp b/src/libs/qmuparser/qmuparser.cpp
index 6180f2310..4772f42ec 100644
--- a/src/libs/qmuparser/qmuparser.cpp
+++ b/src/libs/qmuparser/qmuparser.cpp
@@ -245,9 +245,9 @@ QmuParser::QmuParser():QmuParserBase()
  */
 void QmuParser::InitCharSets()
 {
-    DefineNameChars( "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" );
-    DefineOprtChars( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-*^/?<>=#!$%&|~'_{}" );
-    DefineInfixOprtChars( "/+-*^?<>=#!$%&|~'_" );
+    DefineNameChars( QStringLiteral("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") );
+    DefineOprtChars( QStringLiteral("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-*^/?<>=#!$%&|~'_{}") );
+    DefineInfixOprtChars( QStringLiteral("/+-*^?<>=#!$%&|~'_") );
 }
 
 //---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/qmuparser/qmuparsertokenreader.cpp b/src/libs/qmuparser/qmuparsertokenreader.cpp
index d21bc93be..baff8cf16 100644
--- a/src/libs/qmuparser/qmuparsertokenreader.cpp
+++ b/src/libs/qmuparser/qmuparsertokenreader.cpp
@@ -541,8 +541,7 @@ bool QmuParserTokenReader::IsEOF ( token_type &a_Tok )
             }
             catch (qmu::QmuParserError &e)
             {
-                qDebug() << "\n  "
-                         << "  Code:" << e.GetCode() << "(" << e.GetMsg() << ")";
+                qDebug() << "  Code:" << e.GetCode() << "(" << e.GetMsg() << ")";
                 throw;
             }
         }

From 93f62d9ee9803bfc87ab82754b94e3a6f45dc96c Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 12:04:19 +0300
Subject: [PATCH 07/17] Disable Qt::WaitCursor.

--HG--
branch : feature
---
 src/app/dialogs/tools/dialogeditwrongformula.cpp | 8 ++++++++
 src/app/exception/vexception.cpp                 | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/src/app/dialogs/tools/dialogeditwrongformula.cpp b/src/app/dialogs/tools/dialogeditwrongformula.cpp
index 88d1e3bb8..f82e5ef4b 100644
--- a/src/app/dialogs/tools/dialogeditwrongformula.cpp
+++ b/src/app/dialogs/tools/dialogeditwrongformula.cpp
@@ -51,11 +51,19 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, QWidget *
 
     connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEditWrongFormula::EvalFormula);
     connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEditWrongFormula::FormulaChanged);
+
+    //Disable Qt::WaitCursor
+#ifndef QT_NO_CURSOR
+    QApplication::restoreOverrideCursor();
+#endif
 }
 
 //---------------------------------------------------------------------------------------------------------------------
 DialogEditWrongFormula::~DialogEditWrongFormula()
 {
+#ifndef QT_NO_CURSOR
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+#endif
     delete ui;
 }
 
diff --git a/src/app/exception/vexception.cpp b/src/app/exception/vexception.cpp
index 5cbc0192c..1812d7337 100644
--- a/src/app/exception/vexception.cpp
+++ b/src/app/exception/vexception.cpp
@@ -66,6 +66,10 @@ void VException::CriticalMessageBox(const QString &situation, QWidget * parent)
     QGridLayout* layout = static_cast<QGridLayout*>(msgBox.layout());
     Q_CHECK_PTR(layout);
     layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
+    //Disable Qt::WaitCursor for error message.
+#ifndef QT_NO_CURSOR
+    QApplication::restoreOverrideCursor();
+#endif
     msgBox.exec();
 }
 

From 1b877ca978a76de34500da97feefed61189f9665 Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 12:12:20 +0300
Subject: [PATCH 08/17] Move documentation to cpp file.

--HG--
branch : feature
---
 src/app/tools/drawTools/vdrawtool.cpp | 36 +++++++++++
 src/app/tools/drawTools/vdrawtool.h   | 90 +++++++++------------------
 2 files changed, 65 insertions(+), 61 deletions(-)

diff --git a/src/app/tools/drawTools/vdrawtool.cpp b/src/app/tools/drawTools/vdrawtool.cpp
index 25f329719..3626c5982 100644
--- a/src/app/tools/drawTools/vdrawtool.cpp
+++ b/src/app/tools/drawTools/vdrawtool.cpp
@@ -31,6 +31,13 @@
 qreal VDrawTool::factor = 1;
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief VDrawTool constructor.
+ * @param doc dom document container.
+ * @param data container with variables.
+ * @param id object id in container.
+ * @param parent parent object.
+ */
 VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id)
     :VAbstractTool(doc, data, id), ignoreContextMenuEvent(false), ignoreFullUpdate(false),
       nameActivDraw(doc->GetNameActivDraw()), dialog(nullptr)
@@ -46,7 +53,15 @@ VDrawTool::~VDrawTool()
     delete dialog;
 }
 
+
+
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief ShowTool  highlight tool.
+ * @param id object id in container.
+ * @param color highlight color.
+ * @param enable enable or disable highlight.
+ */
 void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
 {
     Q_UNUSED(id);
@@ -55,6 +70,10 @@ void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
+ * @param newName new name active pattern peace. name new active pattern peace.
+ */
 void VDrawTool::ChangedActivDraw(const QString &newName)
 {
     if (nameActivDraw == newName)
@@ -68,6 +87,11 @@ void VDrawTool::ChangedActivDraw(const QString &newName)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief ChangedNameDraw save new name active pattern peace.
+ * @param oldName old name.
+ * @param newName new name active pattern peace. new name.
+ */
 void VDrawTool::ChangedNameDraw(const QString &oldName, const QString &newName)
 {
     if (nameActivDraw == oldName)
@@ -77,6 +101,10 @@ void VDrawTool::ChangedNameDraw(const QString &oldName, const QString &newName)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief FullUpdateFromGui refresh tool data after change in options.
+ * @param result keep result working dialog.
+ */
 void VDrawTool::FullUpdateFromGui(int result)
 {
     if (result == QDialog::Accepted)
@@ -95,6 +123,10 @@ void VDrawTool::FullUpdateFromGui(int result)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief SetFactor set current scale factor of scene.
+ * @param factor scene scale factor.
+ */
 void VDrawTool::SetFactor(qreal factor)
 {
     if (factor <= 2 && factor >= 0.5)
@@ -104,6 +136,10 @@ void VDrawTool::SetFactor(qreal factor)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief AddToCalculation add tool to calculation tag in pattern file.
+ * @param domElement tag in xml tree.
+ */
 void VDrawTool::AddToCalculation(const QDomElement &domElement)
 {
     QDomElement calcElement;
diff --git a/src/app/tools/drawTools/vdrawtool.h b/src/app/tools/drawTools/vdrawtool.h
index af389a880..437798af4 100644
--- a/src/app/tools/drawTools/vdrawtool.h
+++ b/src/app/tools/drawTools/vdrawtool.h
@@ -42,83 +42,41 @@ class VDrawTool : public VAbstractTool
 {
     Q_OBJECT
 public:
-                 /**
-                  * @brief VDrawTool constructor.
-                  * @param doc dom document container.
-                  * @param data container with variables.
-                  * @param id object id in container.
-                  * @param parent parent object.
-                  */
-                 VDrawTool(VPattern *doc, VContainer *data, quint32 id);
+
+    VDrawTool(VPattern *doc, VContainer *data, quint32 id);
     virtual      ~VDrawTool();
-    /**
-     * @brief setDialog set dialog when user want change tool option.
-     */
+
+    /** @brief setDialog set dialog when user want change tool option. */
     virtual void setDialog() {}
-    /**
-     * @brief ignoreContextMenu set ignore contect menu tool.
-     * @param enable true - ignore.
-     */
-    void         ignoreContextMenu(bool enable) {ignoreContextMenuEvent = enable;}
+
+    void         ignoreContextMenu(bool enable);
 public slots:
-    /**
-     * @brief ShowTool  highlight tool.
-     * @param id object id in container.
-     * @param color highlight color.
-     * @param enable enable or disable highlight.
-     */
     virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
-    /**
-     * @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
-     * @param newName new name active pattern peace. name new active pattern peace.
-     */
     virtual void ChangedActivDraw(const QString &newName);
-    /**
-     * @brief ChangedNameDraw save new name active pattern peace.
-     * @param oldName old name.
-     * @param newName new name active pattern peace. new name.
-     */
     void         ChangedNameDraw(const QString &oldName, const QString &newName);
-    /**
-     * @brief FullUpdateFromGui refresh tool data after change in options.
-     * @param result keep result working dialog.
-     */
     virtual void FullUpdateFromGui(int result);
-    /**
-     * @brief SetFactor set current scale factor of scene.
-     * @param factor scene scale factor.
-     */
     virtual void SetFactor(qreal factor);
 protected:
-    /**
-     * @brief ignoreContextMenuEvent ignore or not context menu events.
-     */
+    /** @brief ignoreContextMenuEvent ignore or not context menu events. */
     bool         ignoreContextMenuEvent;
-    /**
-     * @brief ignoreFullUpdate ignore or not full updates.
-     */
+
+    /** @brief ignoreFullUpdate ignore or not full updates. */
     bool         ignoreFullUpdate;
-    /**
-     * @brief nameActivDraw name of tool's pattern peace.
-     */
+
+    /** @brief nameActivDraw name of tool's pattern peace. */
     QString      nameActivDraw;
-    /**
-     * @brief factor scene scale factor.
-     */
+
+    /** @brief factor scene scale factor. */
     static qreal factor;
-    /**
-     * @brief dialog dialog options.
-     */
+
+    /** @brief dialog dialog options.*/
     DialogTool *dialog;
-    /**
-     * @brief AddToCalculation add tool to calculation tag in pattern file.
-     * @param domElement tag in xml tree.
-     */
+
     void         AddToCalculation(const QDomElement &domElement);
-    /**
-     * @brief SaveDialog save options into file after change in dialog.
-     */
+
+    /** @brief SaveDialog save options into file after change in dialog. */
     virtual void SaveDialog(QDomElement &domElement)=0;
+
     template <typename Dialog, typename Tool>
     /**
      * @brief ContextMenu show context menu for tool.
@@ -203,4 +161,14 @@ private:
     Q_DISABLE_COPY(VDrawTool)
 };
 
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief ignoreContextMenu set ignore contect menu tool.
+ * @param enable true - ignore.
+ */
+inline void VDrawTool::ignoreContextMenu(bool enable)
+{
+    ignoreContextMenuEvent = enable;
+}
+
 #endif // VDRAWTOOL_H

From 18307e0a14440e40d7faefcfea1e385a713b8ba6 Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 12:33:30 +0300
Subject: [PATCH 09/17] New method CheckFormula.

--HG--
branch : feature
---
 src/app/tools/drawTools/vdrawtool.cpp    | 51 ++++++++++++++++++++++++
 src/app/tools/drawTools/vdrawtool.h      |  1 +
 src/app/tools/drawTools/vtoolendline.cpp | 27 +------------
 3 files changed, 53 insertions(+), 26 deletions(-)

diff --git a/src/app/tools/drawTools/vdrawtool.cpp b/src/app/tools/drawTools/vdrawtool.cpp
index 3626c5982..457de4522 100644
--- a/src/app/tools/drawTools/vdrawtool.cpp
+++ b/src/app/tools/drawTools/vdrawtool.cpp
@@ -28,6 +28,12 @@
 
 #include "vdrawtool.h"
 
+#include <qmuparsererror.h>
+
+#include <dialogs/tools/dialogeditwrongformula.h>
+
+#include <container/calculator.h>
+
 qreal VDrawTool::factor = 1;
 
 //---------------------------------------------------------------------------------------------------------------------
@@ -135,6 +141,51 @@ void VDrawTool::SetFactor(qreal factor)
     }
 }
 
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief CheckFormula check formula.
+ *
+ * Try calculate formula. If find error show dialog that allow user try fix formula. If user can't throw exception. In
+ * successes case return result calculation and fixed formula string. If formula ok don't touch formula.
+ * @param formula [in|out] string with formula.
+ * @param data [in] container with variables. Need for math parser.
+ * @throw QmuParserError.
+ * @return result of calculation formula.
+ */
+qreal VDrawTool::CheckFormula(QString &formula, VContainer *data)
+{
+    qreal result = 0;
+    Calculator *cal = nullptr;
+    try
+    {
+        cal = new Calculator(data);
+        result = cal->EvalFormula(formula);
+        delete cal;
+    }
+    catch(qmu::QmuParserError &e)
+    {
+        delete cal;
+        DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data);
+        dialog->setFormula(formula);
+        if (dialog->exec() == QDialog::Accepted)
+        {
+            formula = dialog->getFormula();
+            //Need delete dialog here because parser in dialog don't allow use correct separator for parsing here.
+            //Don't know why.
+            delete dialog;
+            Calculator *cal = new Calculator(data);
+            result = cal->EvalFormula(formula);
+            delete cal;//Here can be memory leak, but dialog already check this formula and probability very low.
+        }
+        else
+        {
+            delete dialog;
+            throw;
+        }
+    }
+    return result;
+}
+
 //---------------------------------------------------------------------------------------------------------------------
 /**
  * @brief AddToCalculation add tool to calculation tag in pattern file.
diff --git a/src/app/tools/drawTools/vdrawtool.h b/src/app/tools/drawTools/vdrawtool.h
index 437798af4..e665ba67f 100644
--- a/src/app/tools/drawTools/vdrawtool.h
+++ b/src/app/tools/drawTools/vdrawtool.h
@@ -50,6 +50,7 @@ public:
     virtual void setDialog() {}
 
     void         ignoreContextMenu(bool enable);
+    static qreal CheckFormula(QString &formula, VContainer *data);
 public slots:
     virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
     virtual void ChangedActivDraw(const QString &newName);
diff --git a/src/app/tools/drawTools/vtoolendline.cpp b/src/app/tools/drawTools/vtoolendline.cpp
index f210ed6a3..dbfece704 100644
--- a/src/app/tools/drawTools/vtoolendline.cpp
+++ b/src/app/tools/drawTools/vtoolendline.cpp
@@ -90,32 +90,7 @@ void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QSt
     const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
     QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
 
-    qreal result = 0;
-
-    try
-    {
-        Calculator *cal = new Calculator(data);
-        result = cal->EvalFormula(formula);
-        delete cal;
-    }
-    catch(qmu::QmuParserError &e)
-    {
-        DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data);
-        dialog->setFormula(formula);
-        if (dialog->exec() == QDialog::Accepted)
-        {
-            formula = dialog->getFormula();
-            delete dialog;
-            Calculator *cal = new Calculator(data);
-            result = cal->EvalFormula(formula);
-            delete cal;
-        }
-        else
-        {
-            delete dialog;
-            throw;
-        }
-    }
+    qreal result = CheckFormula(formula, data);
 
     line.setLength(qApp->toPixel(result));
     line.setAngle(angle);

From dce41a864f5d82c31d72829a66fac2b2a9c0f71d Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 12:52:19 +0300
Subject: [PATCH 10/17] The C++11 initializer list feature.

--HG--
branch : feature
---
 .../app/dialogstandardmeasurements.cpp        |  3 +-
 src/app/mainwindow.cpp                        |  5 +--
 src/app/tablewindow.cpp                       | 13 ++----
 src/app/tools/vabstracttool.cpp               |  5 +--
 src/app/xml/vdomdocument.cpp                  |  3 +-
 src/app/xml/vindividualmeasurements.cpp       |  3 +-
 src/app/xml/vpattern.cpp                      | 43 ++++++++-----------
 src/libs/qmuparser/qmuparserbase.cpp          |  5 +--
 8 files changed, 29 insertions(+), 51 deletions(-)

diff --git a/src/app/dialogs/app/dialogstandardmeasurements.cpp b/src/app/dialogs/app/dialogstandardmeasurements.cpp
index bc8a538c4..01d2b10dd 100644
--- a/src/app/dialogs/app/dialogstandardmeasurements.cpp
+++ b/src/app/dialogs/app/dialogstandardmeasurements.cpp
@@ -136,8 +136,7 @@ void DialogStandardMeasurements::CheckState()
 //---------------------------------------------------------------------------------------------------------------------
 void DialogStandardMeasurements::LoadStandardTables()
 {
-    QStringList filters;
-    filters << "*.vst";
+    QStringList filters{"*.vst"};
     QDir tablesDir(qApp->pathToTables());
     tablesDir.setNameFilters(filters);
     tablesDir.setCurrent(qApp->pathToTables());
diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp
index 85010b170..e0ed7f41f 100644
--- a/src/app/mainwindow.cpp
+++ b/src/app/mainwindow.cpp
@@ -784,9 +784,8 @@ void MainWindow::ToolBarOption()
     {
         ui->toolBarOption->addWidget(new QLabel(tr("Height: ")));
 
-        QStringList list;
-        list <<"92"<<"98"<<"104"<<"110"<<"116"<<"122"<<"128"<<"134"<<"140"<<"146"<<"152"<<"158"<<"164"<<"170"<<"176"
-             <<"182"<<"188";
+        QStringList list{"92", "98", "104", "110", "116", "122", "128", "134", "140", "146", "152", "158", "164", "170",
+                         "176", "182", "188"};
         QComboBox *comboBoxHeight = new QComboBox;
         comboBoxHeight->addItems(list);
         comboBoxHeight->setCurrentIndex(14);//176
diff --git a/src/app/tablewindow.cpp b/src/app/tablewindow.cpp
index 87c4801f0..64e5af6eb 100644
--- a/src/app/tablewindow.cpp
+++ b/src/app/tablewindow.cpp
@@ -228,8 +228,7 @@ void TableWindow::saveScene()
     shadowPaper->setVisible(false);
     paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
     QFileInfo fi( name );
-    QStringList suffix;
-    suffix << "svg" << "png" << "pdf" << "eps" << "ps";
+    QStringList suffix{"svg", "png", "pdf", "eps", "ps"};
     switch (suffix.indexOf(fi.suffix()))
     {
         case 0: //svg
@@ -510,10 +509,7 @@ void TableWindow::EpsFile(const QString &name) const
     if (tmp.open())
     {
         PdfFile(tmp.fileName());
-
-        QStringList params;
-        params << "-eps" << tmp.fileName() << name;
-
+        QStringList params{"-eps", tmp.fileName(), name};
         PdfToPs(params);
     }
 }
@@ -525,10 +521,7 @@ void TableWindow::PsFile(const QString &name) const
     if (tmp.open())
     {
         PdfFile(tmp.fileName());
-
-        QStringList params;
-        params << tmp.fileName() << name;
-
+        QStringList params{tmp.fileName(), name};
         PdfToPs(params);
     }
 }
diff --git a/src/app/tools/vabstracttool.cpp b/src/app/tools/vabstracttool.cpp
index 523d702fe..ce800920d 100644
--- a/src/app/tools/vabstracttool.cpp
+++ b/src/app/tools/vabstracttool.cpp
@@ -309,9 +309,8 @@ void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qre
 const QStringList VAbstractTool::Styles()
 {
     //Keep synchronize with DialogTool lineStyles list!!!
-    QStringList styles;
-    styles << TypeLineNone << TypeLineLine << TypeLineDashLine << TypeLineDotLine << TypeLineDashDotLine
-              << TypeLineDashDotDotLine;
+    QStringList styles{TypeLineNone, TypeLineLine, TypeLineDashLine, TypeLineDotLine, TypeLineDashDotLine,
+                TypeLineDashDotDotLine};
     return styles;
 }
 
diff --git a/src/app/xml/vdomdocument.cpp b/src/app/xml/vdomdocument.cpp
index c65e1b50c..28bed1d6b 100644
--- a/src/app/xml/vdomdocument.cpp
+++ b/src/app/xml/vdomdocument.cpp
@@ -338,8 +338,7 @@ void VDomDocument::setContent(const QString &fileName)
 //---------------------------------------------------------------------------------------------------------------------
 Valentina::Units VDomDocument::StrToUnits(const QString &unit)
 {
-    QStringList units;
-    units << UnitMM << UnitCM << UnitINCH;
+    QStringList units{UnitMM, UnitCM, UnitINCH};
     Valentina::Units result = Valentina::Cm;
     switch (units.indexOf(unit))
     {
diff --git a/src/app/xml/vindividualmeasurements.cpp b/src/app/xml/vindividualmeasurements.cpp
index 3ea2f8149..107784f50 100644
--- a/src/app/xml/vindividualmeasurements.cpp
+++ b/src/app/xml/vindividualmeasurements.cpp
@@ -305,8 +305,7 @@ QString VIndividualMeasurements::GenderToStr(const VIndividualMeasurements::Gend
 //---------------------------------------------------------------------------------------------------------------------
 VIndividualMeasurements::Genders VIndividualMeasurements::StrToGender(const QString &sex)
 {
-    QStringList genders;
-    genders << SexMale << SexFemale;
+    QStringList genders{SexMale, SexFemale};
     switch (genders.indexOf(sex))
     {
         case 0: // SexMale
diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp
index 2f09edae4..8a885a141 100644
--- a/src/app/xml/vpattern.cpp
+++ b/src/app/xml/vpattern.cpp
@@ -214,9 +214,8 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene
             const QDomElement domElement = domNode.toElement();
             if (domElement.isNull() == false)
             {
-                QStringList tags;
-                tags << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes << TagMeasurements
-                     << TagVersion;
+                QStringList tags{TagDraw, TagIncrements, TagAuthor, TagDescription, TagNotes, TagMeasurements,
+                            TagVersion};
                 switch (tags.indexOf(domElement.tagName()))
                 {
                     case 0: // TagDraw
@@ -487,8 +486,7 @@ Valentina::Units VPattern::MUnit() const
     QDomElement element = list.at(0).toElement();
     if (element.isElement())
     {
-        QStringList units;
-        units << "mm" << "cm" << "inch";
+        QStringList units{"mm", "cm", "inch"};
         QString unit = GetParametrString(element, AttrUnit);
         switch (units.indexOf(unit))
         {
@@ -520,8 +518,7 @@ Pattern::Measurements VPattern::MType() const
     if (element.isElement())
     {
         QString type = GetParametrString(element, AttrType);
-        QStringList types;
-        types << "standard" << "individual";
+        QStringList types{"standard", "individual"};
         switch (types.indexOf(type))
         {
             case 0:// standard
@@ -613,8 +610,7 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen
             const QDomElement domElement = domNode.toElement();
             if (domElement.isNull() == false)
             {
-                QStringList tags;
-                tags << TagCalculation << TagModeling << TagDetails;
+                QStringList tags{TagCalculation, TagModeling, TagDetails};
                 switch (tags.indexOf(domElement.tagName()))
                 {
                     case 0: // TagCalculation
@@ -659,8 +655,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
         QDomElement domElement = nodeList.at(i).toElement();
         if (domElement.isNull() == false)
         {
-            QStringList tags;
-            tags << TagPoint << TagLine << TagSpline << TagArc << TagTools;
+            QStringList tags{TagPoint, TagLine, TagSpline, TagArc, TagTools};
             switch (tags.indexOf(domElement.tagName()))
             {
                 case 0: // TagPoint
@@ -719,9 +714,8 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
 
                     const QString t = GetParametrString(element, AttrType, "NodePoint");
                     Valentina::Tools tool;
-                    QStringList types;
-                    types << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline <<
-                             VToolDetail::NodeSplinePath;
+                    QStringList types{VToolDetail::NodePoint, VToolDetail::NodeArc, VToolDetail::NodeSpline,
+                                VToolDetail::NodeSplinePath};
                     switch (types.indexOf(t))
                     {
                         case 0: // VToolDetail::NodePoint
@@ -787,12 +781,11 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
     Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty");
 
 
-    QStringList points;
-    points << VToolSinglePoint::ToolType << VToolEndLine::ToolType << VToolAlongLine::ToolType
-           << VToolShoulderPoint::ToolType << VToolNormal::ToolType << VToolBisector::ToolType
-           << VToolLineIntersect::ToolType << VToolPointOfContact::ToolType << VNodePoint::ToolType
-           << VToolHeight::ToolType << VToolTriangle::ToolType << VToolPointOfIntersection::ToolType
-           << VToolCutSpline::ToolType << VToolCutSplinePath::ToolType << VToolCutArc::ToolType;
+    QStringList points{VToolSinglePoint::ToolType, VToolEndLine::ToolType, VToolAlongLine::ToolType,
+                VToolShoulderPoint::ToolType, VToolNormal::ToolType, VToolBisector::ToolType,
+                VToolLineIntersect::ToolType, VToolPointOfContact::ToolType, VNodePoint::ToolType,
+                VToolHeight::ToolType, VToolTriangle::ToolType, VToolPointOfIntersection::ToolType,
+                VToolCutSpline::ToolType, VToolCutSplinePath::ToolType, VToolCutArc::ToolType};
     switch (points.indexOf(type))
     {
         case 0: //VToolSinglePoint::ToolType
@@ -1256,8 +1249,8 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
     Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
     Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
 
-    QStringList splines;
-    splines << VToolSpline::ToolType << VToolSplinePath::ToolType << VNodeSpline::ToolType << VNodeSplinePath::ToolType;
+    QStringList splines{VToolSpline::ToolType, VToolSplinePath::ToolType, VNodeSpline::ToolType,
+                VNodeSplinePath::ToolType};
     switch (splines.indexOf(type))
     {
         case 0: //VToolSpline::ToolType
@@ -1378,8 +1371,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom
     Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
     Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
 
-    QStringList arcs;
-    arcs << VToolArc::ToolType << VNodeArc::ToolType;
+    QStringList arcs{VToolArc::ToolType, VNodeArc::ToolType};
 
     switch (arcs.indexOf(type))
     {
@@ -1442,8 +1434,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
     Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
     Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
 
-    QStringList tools;
-    tools << VToolUnionDetails::ToolType;
+    QStringList tools{VToolUnionDetails::ToolType};
 
     switch (tools.indexOf(type))
     {
diff --git a/src/libs/qmuparser/qmuparserbase.cpp b/src/libs/qmuparser/qmuparserbase.cpp
index 21ff321df..6354c8b03 100644
--- a/src/libs/qmuparser/qmuparserbase.cpp
+++ b/src/libs/qmuparser/qmuparserbase.cpp
@@ -50,9 +50,8 @@ bool QmuParserBase::g_DbgDumpStack = false;
  * When defining custom binary operators with #AddOprt(...) make sure not to choose
  * names conflicting with these definitions.
  */
-const QStringList QmuParserBase::c_DefaultOprt = QStringList() << "<=" << ">=" << "!=" << "==" << "<"  << ">"
-                                                               << "+"  << "-"  << "*"  << "/"  << "^"  << "&&"
-                                                               << "||" << "="  << "("  << ")"  << "?"  << ":";
+const QStringList QmuParserBase::c_DefaultOprt{"<=", ">=", "!=", "==", "<", ">", "+", "-", "*", "/", "^", "&&", "||",
+                                               "=", "(", ")", "?", ":"};
 
 //---------------------------------------------------------------------------------------------------------------------
 /**

From 77b2344bfdf55226eb1fe99df1ef983e88cbed8e Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 12:59:14 +0300
Subject: [PATCH 11/17] Fix for dialogs empty window title.

--HG--
branch : feature
---
 src/app/dialogs/tools/dialogcutarc.ui              | 2 +-
 src/app/dialogs/tools/dialogcutspline.ui           | 2 +-
 src/app/dialogs/tools/dialogcutsplinepath.ui       | 2 +-
 src/app/dialogs/tools/dialogheight.ui              | 2 +-
 src/app/dialogs/tools/dialogpointofintersection.ui | 2 +-
 src/app/dialogs/tools/dialogtriangle.ui            | 2 +-
 src/app/dialogs/tools/dialoguniondetails.ui        | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/app/dialogs/tools/dialogcutarc.ui b/src/app/dialogs/tools/dialogcutarc.ui
index 6939c61d4..47d7a474f 100644
--- a/src/app/dialogs/tools/dialogcutarc.ui
+++ b/src/app/dialogs/tools/dialogcutarc.ui
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Cut arc</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
diff --git a/src/app/dialogs/tools/dialogcutspline.ui b/src/app/dialogs/tools/dialogcutspline.ui
index 658fcdb5a..cbe9591d5 100644
--- a/src/app/dialogs/tools/dialogcutspline.ui
+++ b/src/app/dialogs/tools/dialogcutspline.ui
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Cut curve</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
diff --git a/src/app/dialogs/tools/dialogcutsplinepath.ui b/src/app/dialogs/tools/dialogcutsplinepath.ui
index c37d9b06b..f28002b14 100644
--- a/src/app/dialogs/tools/dialogcutsplinepath.ui
+++ b/src/app/dialogs/tools/dialogcutsplinepath.ui
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Cut curve path</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
diff --git a/src/app/dialogs/tools/dialogheight.ui b/src/app/dialogs/tools/dialogheight.ui
index db3460197..305abeef7 100644
--- a/src/app/dialogs/tools/dialogheight.ui
+++ b/src/app/dialogs/tools/dialogheight.ui
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Height</string>
   </property>
   <property name="locale">
    <locale language="English" country="UnitedStates"/>
diff --git a/src/app/dialogs/tools/dialogpointofintersection.ui b/src/app/dialogs/tools/dialogpointofintersection.ui
index 9295f65ee..58595d555 100644
--- a/src/app/dialogs/tools/dialogpointofintersection.ui
+++ b/src/app/dialogs/tools/dialogpointofintersection.ui
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Point of intersection</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
diff --git a/src/app/dialogs/tools/dialogtriangle.ui b/src/app/dialogs/tools/dialogtriangle.ui
index 4121e7e01..129de36a1 100644
--- a/src/app/dialogs/tools/dialogtriangle.ui
+++ b/src/app/dialogs/tools/dialogtriangle.ui
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Triangle</string>
   </property>
   <property name="locale">
    <locale language="English" country="UnitedStates"/>
diff --git a/src/app/dialogs/tools/dialoguniondetails.ui b/src/app/dialogs/tools/dialoguniondetails.ui
index 24e84b14a..529030b1c 100644
--- a/src/app/dialogs/tools/dialoguniondetails.ui
+++ b/src/app/dialogs/tools/dialoguniondetails.ui
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Union details</string>
   </property>
   <widget class="QDialogButtonBox" name="buttonBox">
    <property name="geometry">

From 7c2c3558897d2fcbe08ae4208d4eed14dd334aad Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 13:13:34 +0300
Subject: [PATCH 12/17] Change Vertical Policy for radio buttons.

--HG--
branch : feature
---
 src/app/dialogs/tools/dialogalongline.ui      | 44 ++++++++++++++++++-
 src/app/dialogs/tools/dialogarc.ui            | 44 ++++++++++++++++++-
 src/app/dialogs/tools/dialogbisector.ui       | 38 +++++++++++++++-
 src/app/dialogs/tools/dialogcutarc.ui         | 38 +++++++++++++++-
 src/app/dialogs/tools/dialogcutspline.ui      | 36 +++++++++++++++
 src/app/dialogs/tools/dialogcutsplinepath.ui  | 36 +++++++++++++++
 .../dialogs/tools/dialogeditwrongformula.ui   | 14 +++---
 src/app/dialogs/tools/dialogendline.ui        | 12 ++---
 src/app/dialogs/tools/dialognormal.ui         | 36 +++++++++++++++
 src/app/dialogs/tools/dialogpointofcontact.ui | 36 +++++++++++++++
 src/app/dialogs/tools/dialogshoulderpoint.ui  | 36 +++++++++++++++
 11 files changed, 353 insertions(+), 17 deletions(-)

diff --git a/src/app/dialogs/tools/dialogalongline.ui b/src/app/dialogs/tools/dialogalongline.ui
index be82913a8..9113f9e04 100644
--- a/src/app/dialogs/tools/dialogalongline.ui
+++ b/src/app/dialogs/tools/dialogalongline.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>470</width>
-    <height>573</height>
+    <height>675</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -252,6 +252,12 @@
          </item>
          <item>
           <widget class="QComboBox" name="comboBoxLineType">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="toolTip">
             <string>Show line from first point to this point</string>
            </property>
@@ -270,6 +276,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Size and height</string>
            </property>
@@ -280,6 +292,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Standard table</string>
            </property>
@@ -287,6 +305,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Increments</string>
            </property>
@@ -294,6 +318,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonLengthLine">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -304,6 +334,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of arcs</string>
            </property>
@@ -314,6 +350,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of curves</string>
            </property>
diff --git a/src/app/dialogs/tools/dialogarc.ui b/src/app/dialogs/tools/dialogarc.ui
index c40c5a1c9..f5705908f 100644
--- a/src/app/dialogs/tools/dialogarc.ui
+++ b/src/app/dialogs/tools/dialogarc.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>501</width>
-    <height>538</height>
+    <height>705</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -447,6 +447,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Size and height</string>
            </property>
@@ -457,6 +463,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Standard table</string>
            </property>
@@ -464,6 +476,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Increments</string>
            </property>
@@ -474,6 +492,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -484,6 +508,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of arcs</string>
            </property>
@@ -494,6 +524,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of curves</string>
            </property>
@@ -504,6 +540,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Angle of lines</string>
            </property>
diff --git a/src/app/dialogs/tools/dialogbisector.ui b/src/app/dialogs/tools/dialogbisector.ui
index b6285890c..1c5221267 100644
--- a/src/app/dialogs/tools/dialogbisector.ui
+++ b/src/app/dialogs/tools/dialogbisector.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>480</width>
-    <height>587</height>
+    <height>686</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -309,6 +309,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Size and height</string>
            </property>
@@ -319,6 +325,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Standard table</string>
            </property>
@@ -326,6 +338,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Increments</string>
            </property>
@@ -336,6 +354,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -346,6 +370,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of arcs</string>
            </property>
@@ -356,6 +386,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of curves</string>
            </property>
diff --git a/src/app/dialogs/tools/dialogcutarc.ui b/src/app/dialogs/tools/dialogcutarc.ui
index 47d7a474f..bfbff85fa 100644
--- a/src/app/dialogs/tools/dialogcutarc.ui
+++ b/src/app/dialogs/tools/dialogcutarc.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>507</width>
-    <height>493</height>
+    <height>597</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -236,6 +236,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Size and height</string>
            </property>
@@ -246,6 +252,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Standard table</string>
            </property>
@@ -253,6 +265,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Increments</string>
            </property>
@@ -263,6 +281,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -273,6 +297,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of arcs</string>
            </property>
@@ -283,6 +313,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of curves</string>
            </property>
diff --git a/src/app/dialogs/tools/dialogcutspline.ui b/src/app/dialogs/tools/dialogcutspline.ui
index cbe9591d5..4fb194f59 100644
--- a/src/app/dialogs/tools/dialogcutspline.ui
+++ b/src/app/dialogs/tools/dialogcutspline.ui
@@ -236,6 +236,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Size and height</string>
            </property>
@@ -246,6 +252,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Standard table</string>
            </property>
@@ -253,6 +265,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Increments</string>
            </property>
@@ -263,6 +281,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -273,6 +297,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of arcs</string>
            </property>
@@ -283,6 +313,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of curves</string>
            </property>
diff --git a/src/app/dialogs/tools/dialogcutsplinepath.ui b/src/app/dialogs/tools/dialogcutsplinepath.ui
index f28002b14..26351262b 100644
--- a/src/app/dialogs/tools/dialogcutsplinepath.ui
+++ b/src/app/dialogs/tools/dialogcutsplinepath.ui
@@ -236,6 +236,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Size and height</string>
            </property>
@@ -246,6 +252,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Standard table</string>
            </property>
@@ -253,6 +265,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Increments</string>
            </property>
@@ -263,6 +281,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -273,6 +297,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of arcs</string>
            </property>
@@ -283,6 +313,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of curves</string>
            </property>
diff --git a/src/app/dialogs/tools/dialogeditwrongformula.ui b/src/app/dialogs/tools/dialogeditwrongformula.ui
index 9d9501d78..15e900f08 100644
--- a/src/app/dialogs/tools/dialogeditwrongformula.ui
+++ b/src/app/dialogs/tools/dialogeditwrongformula.ui
@@ -167,7 +167,7 @@
            <item>
             <widget class="QRadioButton" name="radioButtonSizeGrowth">
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+              <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -183,7 +183,7 @@
            <item>
             <widget class="QRadioButton" name="radioButtonStandardTable">
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+              <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -196,7 +196,7 @@
            <item>
             <widget class="QRadioButton" name="radioButtonIncrements">
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+              <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -212,7 +212,7 @@
               <bool>true</bool>
              </property>
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+              <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -228,7 +228,7 @@
               <bool>true</bool>
              </property>
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+              <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -244,7 +244,7 @@
               <bool>true</bool>
              </property>
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+              <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -260,7 +260,7 @@
               <bool>true</bool>
              </property>
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+              <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
diff --git a/src/app/dialogs/tools/dialogendline.ui b/src/app/dialogs/tools/dialogendline.ui
index 377942edb..1b88dd92b 100644
--- a/src/app/dialogs/tools/dialogendline.ui
+++ b/src/app/dialogs/tools/dialogendline.ui
@@ -472,7 +472,7 @@
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
            <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
              <horstretch>0</horstretch>
              <verstretch>0</verstretch>
             </sizepolicy>
@@ -488,7 +488,7 @@
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
            <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
              <horstretch>0</horstretch>
              <verstretch>0</verstretch>
             </sizepolicy>
@@ -501,7 +501,7 @@
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
            <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
              <horstretch>0</horstretch>
              <verstretch>0</verstretch>
             </sizepolicy>
@@ -517,7 +517,7 @@
             <bool>true</bool>
            </property>
            <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
              <horstretch>0</horstretch>
              <verstretch>0</verstretch>
             </sizepolicy>
@@ -533,7 +533,7 @@
             <bool>true</bool>
            </property>
            <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
              <horstretch>0</horstretch>
              <verstretch>0</verstretch>
             </sizepolicy>
@@ -549,7 +549,7 @@
             <bool>true</bool>
            </property>
            <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
              <horstretch>0</horstretch>
              <verstretch>0</verstretch>
             </sizepolicy>
diff --git a/src/app/dialogs/tools/dialognormal.ui b/src/app/dialogs/tools/dialognormal.ui
index b88a49da9..781fd810d 100644
--- a/src/app/dialogs/tools/dialognormal.ui
+++ b/src/app/dialogs/tools/dialognormal.ui
@@ -484,6 +484,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Size and height</string>
            </property>
@@ -494,6 +500,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Standard table</string>
            </property>
@@ -501,6 +513,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Increments</string>
            </property>
@@ -511,6 +529,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -521,6 +545,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of arcs</string>
            </property>
@@ -531,6 +561,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of curves</string>
            </property>
diff --git a/src/app/dialogs/tools/dialogpointofcontact.ui b/src/app/dialogs/tools/dialogpointofcontact.ui
index 17d34bba4..532648eeb 100644
--- a/src/app/dialogs/tools/dialogpointofcontact.ui
+++ b/src/app/dialogs/tools/dialogpointofcontact.ui
@@ -324,6 +324,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Size and height</string>
            </property>
@@ -334,6 +340,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Standard table</string>
            </property>
@@ -341,6 +353,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Increments</string>
            </property>
@@ -351,6 +369,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -361,6 +385,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of arcs</string>
            </property>
@@ -371,6 +401,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of curves</string>
            </property>
diff --git a/src/app/dialogs/tools/dialogshoulderpoint.ui b/src/app/dialogs/tools/dialogshoulderpoint.ui
index df2fe865c..27bd11328 100644
--- a/src/app/dialogs/tools/dialogshoulderpoint.ui
+++ b/src/app/dialogs/tools/dialogshoulderpoint.ui
@@ -345,6 +345,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonSizeGrowth">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Size and height</string>
            </property>
@@ -355,6 +361,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonStandardTable">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Standard table</string>
            </property>
@@ -362,6 +374,12 @@
          </item>
          <item>
           <widget class="QRadioButton" name="radioButtonIncrements">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Increments</string>
            </property>
@@ -372,6 +390,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -382,6 +406,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of lines</string>
            </property>
@@ -392,6 +422,12 @@
            <property name="enabled">
             <bool>true</bool>
            </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="text">
             <string>Length of curves</string>
            </property>

From 54dfd9457e6b9346d8855e1ad6e7c128409d28dc Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 14:50:41 +0300
Subject: [PATCH 13/17] Fixed issue #43.

--HG--
branch : feature
---
 src/app/tools/drawTools/vtoolalongline.cpp    | 20 ++--
 src/app/tools/drawTools/vtoolalongline.h      |  2 +-
 src/app/tools/drawTools/vtoolarc.cpp          | 20 ++--
 src/app/tools/drawTools/vtoolarc.h            |  6 +-
 src/app/tools/drawTools/vtoolbisector.cpp     | 15 ++-
 src/app/tools/drawTools/vtoolbisector.h       |  2 +-
 src/app/tools/drawTools/vtoolcutarc.cpp       |  9 +-
 src/app/tools/drawTools/vtoolcutarc.h         |  2 +-
 src/app/tools/drawTools/vtoolcutspline.cpp    | 14 ++-
 src/app/tools/drawTools/vtoolcutspline.h      |  5 +-
 .../tools/drawTools/vtoolcutsplinepath.cpp    |  9 +-
 src/app/tools/drawTools/vtoolcutsplinepath.h  |  7 +-
 src/app/tools/drawTools/vtoolendline.cpp      | 12 +--
 src/app/tools/drawTools/vtoolheight.cpp       | 10 +-
 src/app/tools/drawTools/vtoolline.cpp         |  6 +-
 .../tools/drawTools/vtoollineintersect.cpp    | 10 +-
 src/app/tools/drawTools/vtoolnormal.cpp       | 15 ++-
 src/app/tools/drawTools/vtoolnormal.h         |  2 +-
 .../tools/drawTools/vtoolpointofcontact.cpp   | 18 ++--
 src/app/tools/drawTools/vtoolpointofcontact.h |  2 +-
 .../drawTools/vtoolpointofintersection.cpp    |  6 +-
 .../tools/drawTools/vtoolshoulderpoint.cpp    | 15 ++-
 src/app/tools/drawTools/vtoolshoulderpoint.h  |  2 +-
 src/app/tools/drawTools/vtoolspline.cpp       | 14 +--
 src/app/tools/drawTools/vtooltriangle.cpp     | 10 +-
 src/app/xml/vpattern.cpp                      | 94 ++++++++++++++++---
 src/app/xml/vpattern.h                        |  2 +-
 27 files changed, 188 insertions(+), 141 deletions(-)

diff --git a/src/app/tools/drawTools/vtoolalongline.cpp b/src/app/tools/drawTools/vtoolalongline.cpp
index 1d8613d48..b6ca59ec2 100644
--- a/src/app/tools/drawTools/vtoolalongline.cpp
+++ b/src/app/tools/drawTools/vtoolalongline.cpp
@@ -164,27 +164,25 @@ void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatt
     DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
     Q_CHECK_PTR(dialogTool);
     QString formula = dialogTool->getFormula();
-    quint32 firstPointId = dialogTool->getFirstPointId();
-    quint32 secondPointId = dialogTool->getSecondPointId();
-    QString typeLine = dialogTool->getTypeLine();
-    QString pointName = dialogTool->getPointName();
+    const quint32 firstPointId = dialogTool->getFirstPointId();
+    const quint32 secondPointId = dialogTool->getSecondPointId();
+    const QString typeLine = dialogTool->getTypeLine();
+    const QString pointName = dialogTool->getPointName();
     Create(0, pointName, typeLine, formula, firstPointId, secondPointId, 5, 10, scene, doc, data,
            Document::FullParse, Valentina::FromGui);
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
-                            const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
-                            const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
-                            VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
+void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula,
+                            const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my,
+                            VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
+                            const Document::Documents &parse, const Valentina::Sources &typeCreation)
 {
     const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
     const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
     QLineF line = QLineF(firstPoint->toQPointF(), secondPoint->toQPointF());
 
-    Calculator cal(data);
-    const qreal result = cal.EvalFormula(formula);
-    line.setLength(qApp->toPixel(result));
+    line.setLength(qApp->toPixel(CheckFormula(formula, data)));
 
     quint32 id = _id;
     if (typeCreation == Valentina::FromGui)
diff --git a/src/app/tools/drawTools/vtoolalongline.h b/src/app/tools/drawTools/vtoolalongline.h
index f9a50f86e..8276c3954 100644
--- a/src/app/tools/drawTools/vtoolalongline.h
+++ b/src/app/tools/drawTools/vtoolalongline.h
@@ -81,7 +81,7 @@ public:
      * @param parse parser file mode.
      * @param typeCreation way we create this tool.
      */
-    static void  Create(const quint32 _id, const QString &pointName, const QString &typeLine, const QString &formula,
+    static void  Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula,
                         const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my,
                         VMainGraphicsScene  *scene, VPattern *doc, VContainer *data,
                         const Document::Documents &parse, const Valentina::Sources &typeCreation);
diff --git a/src/app/tools/drawTools/vtoolarc.cpp b/src/app/tools/drawTools/vtoolarc.cpp
index af9754b26..9664f2528 100644
--- a/src/app/tools/drawTools/vtoolarc.cpp
+++ b/src/app/tools/drawTools/vtoolarc.cpp
@@ -73,13 +73,12 @@ void VToolArc::setDialog()
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
-                      VContainer *data)
+void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
 {
     Q_CHECK_PTR(dialog);
     DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    quint32 center = dialogTool->GetCenter();
+    const quint32 center = dialogTool->GetCenter();
     QString radius = dialogTool->GetRadius();
     QString f1 = dialogTool->GetF1();
     QString f2 = dialogTool->GetF2();
@@ -87,19 +86,16 @@ void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *d
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolArc::Create(const quint32 _id, const quint32 &center, const QString &radius, const QString &f1,
-                      const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
-                      const Document::Documents &parse, const Valentina::Sources &typeCreation)
+void VToolArc::Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
+                      VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse,
+                      const Valentina::Sources &typeCreation)
 {
     qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
 
-    Calculator cal(data);
+    calcRadius = qApp->toPixel(CheckFormula(radius, data));
 
-    qreal result = cal.EvalFormula(radius);
-    calcRadius = qApp->toPixel(result);
-
-    calcF1 = cal.EvalFormula(f1);
-    calcF2 = cal.EvalFormula(f2);
+    calcF1 = CheckFormula(f1, data);
+    calcF2 = CheckFormula(f2, data);
 
     VPointF c = *data->GeometricObject<const VPointF *>(center);
     VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
diff --git a/src/app/tools/drawTools/vtoolarc.h b/src/app/tools/drawTools/vtoolarc.h
index f6ae530a9..b601a230a 100644
--- a/src/app/tools/drawTools/vtoolarc.h
+++ b/src/app/tools/drawTools/vtoolarc.h
@@ -75,9 +75,9 @@ public:
      * @param parse parser file mode.
      * @param typeCreation way we create this tool.
      */
-    static void  Create(const quint32 _id, const quint32 &center, const QString &radius, const QString &f1,
-                        const QString &f2, VMainGraphicsScene  *scene, VPattern *doc, VContainer *data,
-                        const Document::Documents &parse, const Valentina::Sources &typeCreation);
+    static void  Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
+                        VMainGraphicsScene  *scene, VPattern *doc, VContainer *data, const Document::Documents &parse,
+                        const Valentina::Sources &typeCreation);
     static const QString TagName;
     static const QString ToolType;
 public slots:
diff --git a/src/app/tools/drawTools/vtoolbisector.cpp b/src/app/tools/drawTools/vtoolbisector.cpp
index 36d3436e6..07a136106 100644
--- a/src/app/tools/drawTools/vtoolbisector.cpp
+++ b/src/app/tools/drawTools/vtoolbisector.cpp
@@ -94,17 +94,17 @@ void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatte
     DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
     Q_CHECK_PTR(dialogTool);
     QString formula = dialogTool->getFormula();
-    quint32 firstPointId = dialogTool->getFirstPointId();
-    quint32 secondPointId = dialogTool->getSecondPointId();
-    quint32 thirdPointId = dialogTool->getThirdPointId();
-    QString typeLine = dialogTool->getTypeLine();
-    QString pointName = dialogTool->getPointName();
+    const quint32 firstPointId = dialogTool->getFirstPointId();
+    const quint32 secondPointId = dialogTool->getSecondPointId();
+    const quint32 thirdPointId = dialogTool->getThirdPointId();
+    const QString typeLine = dialogTool->getTypeLine();
+    const QString pointName = dialogTool->getPointName();
     Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, pointName, 5, 10, scene, doc, data,
            Document::FullParse, Valentina::FromGui);
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolBisector::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId,
+void VToolBisector::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
                            const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
                            const QString &pointName, const qreal &mx, const qreal &my,
                            VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@@ -114,8 +114,7 @@ void VToolBisector::Create(const quint32 _id, const QString &formula, const quin
     const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
     const VPointF *thirdPoint = data->GeometricObject<const VPointF *>(thirdPointId);
 
-    Calculator cal(data);
-    const qreal result = cal.EvalFormula(formula);
+    const qreal result = CheckFormula(formula, data);
 
     QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
                                               thirdPoint->toQPointF(), qApp->toPixel(result));
diff --git a/src/app/tools/drawTools/vtoolbisector.h b/src/app/tools/drawTools/vtoolbisector.h
index 9af080e12..f49d6fa5b 100644
--- a/src/app/tools/drawTools/vtoolbisector.h
+++ b/src/app/tools/drawTools/vtoolbisector.h
@@ -93,7 +93,7 @@ public:
      * @param parse parser file mode.
      * @param typeCreation way we create this tool.
      */
-    static void    Create(const quint32 _id, const QString &formula, const quint32 &firstPointId,
+    static void    Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
                           const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
                           const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene  *scene,
                           VPattern *doc, VContainer *data, const Document::Documents &parse,
diff --git a/src/app/tools/drawTools/vtoolcutarc.cpp b/src/app/tools/drawTools/vtoolcutarc.cpp
index 2f1a8cf81..50521d867 100644
--- a/src/app/tools/drawTools/vtoolcutarc.cpp
+++ b/src/app/tools/drawTools/vtoolcutarc.cpp
@@ -83,21 +83,20 @@ void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
     Q_CHECK_PTR(dialog);
     DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    QString pointName = dialogTool->getPointName();
+    const QString pointName = dialogTool->getPointName();
     QString formula = dialogTool->getFormula();
-    quint32 arcId = dialogTool->getArcId();
+    const quint32 arcId = dialogTool->getArcId();
     Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &arcId,
+void VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
                          const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
                          VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
 {
     const VArc *arc = data->GeometricObject<const VArc *>(arcId);
 
-    Calculator cal(data);
-    const qreal result = cal.EvalFormula(formula);
+    const qreal result = CheckFormula(formula, data);
 
     VArc arc1;
     VArc arc2;
diff --git a/src/app/tools/drawTools/vtoolcutarc.h b/src/app/tools/drawTools/vtoolcutarc.h
index e9933f812..53dbcd740 100644
--- a/src/app/tools/drawTools/vtoolcutarc.h
+++ b/src/app/tools/drawTools/vtoolcutarc.h
@@ -80,7 +80,7 @@ public:
      * @param parse parser file mode.
      * @param typeCreation way we create this tool.
      */
-    static void  Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &arcId,
+    static void  Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
                         const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
                         VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation);
     static const QString ToolType;
diff --git a/src/app/tools/drawTools/vtoolcutspline.cpp b/src/app/tools/drawTools/vtoolcutspline.cpp
index 1f1f14c1f..4e74b31d6 100644
--- a/src/app/tools/drawTools/vtoolcutspline.cpp
+++ b/src/app/tools/drawTools/vtoolcutspline.cpp
@@ -83,22 +83,20 @@ void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
     Q_CHECK_PTR(dialog);
     DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    QString pointName = dialogTool->getPointName();
+    const QString pointName = dialogTool->getPointName();
     QString formula = dialogTool->getFormula();
-    quint32 splineId = dialogTool->getSplineId();
+    const quint32 splineId = dialogTool->getSplineId();
     Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolCutSpline::Create(const quint32 _id, const QString &pointName,
-                            const QString &formula, const quint32 &splineId, const qreal &mx, const qreal &my,
-                            VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
-                            const Document::Documents &parse, const Valentina::Sources &typeCreation)
+void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splineId,
+                            const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
+                            VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
 {
     const VSpline *spl = data->GeometricObject<const VSpline *>(splineId);
 
-    Calculator cal(data);
-    const qreal result = cal.EvalFormula(formula);
+    const qreal result = CheckFormula(formula, data);
 
     QPointF spl1p2, spl1p3, spl2p2, spl2p3;
     QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);
diff --git a/src/app/tools/drawTools/vtoolcutspline.h b/src/app/tools/drawTools/vtoolcutspline.h
index 0bff6ea89..b5cae8641 100644
--- a/src/app/tools/drawTools/vtoolcutspline.h
+++ b/src/app/tools/drawTools/vtoolcutspline.h
@@ -78,9 +78,8 @@ public:
      * @param parse parser file mode.
      * @param typeCreation way we create this tool.
      */
-    static void  Create(const quint32 _id, const QString &pointName,
-                        const QString &formula, const quint32 &splineId, const qreal &mx, const qreal &my,
-                        VMainGraphicsScene  *scene, VPattern *doc, VContainer *data,
+    static void  Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splineId,
+                        const qreal &mx, const qreal &my, VMainGraphicsScene  *scene, VPattern *doc, VContainer *data,
                         const Document::Documents &parse, const Valentina::Sources &typeCreation);
     static const QString ToolType;
     static const QString AttrSpline;
diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.cpp b/src/app/tools/drawTools/vtoolcutsplinepath.cpp
index 290aa92ef..e21db71cd 100644
--- a/src/app/tools/drawTools/vtoolcutsplinepath.cpp
+++ b/src/app/tools/drawTools/vtoolcutsplinepath.cpp
@@ -83,14 +83,14 @@ void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
     Q_CHECK_PTR(dialog);
     DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    QString pointName = dialogTool->getPointName();
+    const QString pointName = dialogTool->getPointName();
     QString formula = dialogTool->getFormula();
-    quint32 splinePathId = dialogTool->getSplinePathId();
+    const quint32 splinePathId = dialogTool->getSplinePathId();
     Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, const QString &formula,
+void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QString &formula,
                             const quint32 &splinePathId, const qreal &mx, const qreal &my,
                             VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
                             const Document::Documents &parse, const Valentina::Sources &typeCreation)
@@ -98,8 +98,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con
     const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
     Q_CHECK_PTR(splPath);
 
-    Calculator cal(data);
-    const qreal result = cal.EvalFormula(formula);
+    const qreal result = CheckFormula(formula, data);
 
     quint32 id = _id;
     QPointF spl1p2, spl1p3, spl2p2, spl2p3;
diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.h b/src/app/tools/drawTools/vtoolcutsplinepath.h
index e2c288291..9bd1c9dcd 100644
--- a/src/app/tools/drawTools/vtoolcutsplinepath.h
+++ b/src/app/tools/drawTools/vtoolcutsplinepath.h
@@ -81,10 +81,9 @@ public:
      * @param parse parser file mode.
      * @param typeCreation way we create this tool.
      */
-    static void  Create(const quint32 _id, const QString &pointName, const QString &formula,
-                        const quint32 &splinePathId, const qreal &mx, const qreal &my, VMainGraphicsScene  *scene,
-                        VPattern *doc, VContainer *data, const Document::Documents &parse,
-                        const Valentina::Sources &typeCreation);
+    static void  Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splinePathId,
+                        const qreal &mx, const qreal &my, VMainGraphicsScene  *scene, VPattern *doc, VContainer *data,
+                        const Document::Documents &parse, const Valentina::Sources &typeCreation);
     static const QString ToolType;
     static const QString AttrSplinePath;
 public slots:
diff --git a/src/app/tools/drawTools/vtoolendline.cpp b/src/app/tools/drawTools/vtoolendline.cpp
index dbfece704..107a6e107 100644
--- a/src/app/tools/drawTools/vtoolendline.cpp
+++ b/src/app/tools/drawTools/vtoolendline.cpp
@@ -72,11 +72,11 @@ void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatter
     Q_CHECK_PTR(dialog);
     DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    QString pointName = dialogTool->getPointName();
-    QString typeLine = dialogTool->getTypeLine();
+    const QString pointName = dialogTool->getPointName();
+    const QString typeLine = dialogTool->getTypeLine();
     QString formula = dialogTool->getFormula();
-    qreal angle = dialogTool->getAngle();
-    quint32 basePointId = dialogTool->getBasePointId();
+    const qreal angle = dialogTool->getAngle();
+    const quint32 basePointId = dialogTool->getBasePointId();
     Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse,
            Valentina::FromGui);
 }
@@ -90,9 +90,7 @@ void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QSt
     const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
     QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
 
-    qreal result = CheckFormula(formula, data);
-
-    line.setLength(qApp->toPixel(result));
+    line.setLength(qApp->toPixel(CheckFormula(formula, data)));
     line.setAngle(angle);
     quint32 id = _id;
     if (typeCreation == Valentina::FromGui)
diff --git a/src/app/tools/drawTools/vtoolheight.cpp b/src/app/tools/drawTools/vtoolheight.cpp
index ab1381ac0..88b92801e 100644
--- a/src/app/tools/drawTools/vtoolheight.cpp
+++ b/src/app/tools/drawTools/vtoolheight.cpp
@@ -70,11 +70,11 @@ void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
     DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
     Q_CHECK_PTR(dialogTool);
     disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList);
-    QString pointName = dialogTool->getPointName();
-    QString typeLine = dialogTool->getTypeLine();
-    quint32 basePointId = dialogTool->getBasePointId();
-    quint32 p1LineId = dialogTool->getP1LineId();
-    quint32 p2LineId = dialogTool->getP2LineId();
+    const QString pointName = dialogTool->getPointName();
+    const QString typeLine = dialogTool->getTypeLine();
+    const quint32 basePointId = dialogTool->getBasePointId();
+    const quint32 p1LineId = dialogTool->getP1LineId();
+    const quint32 p2LineId = dialogTool->getP2LineId();
     Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data,
            Document::FullParse, Valentina::FromGui);
 }
diff --git a/src/app/tools/drawTools/vtoolline.cpp b/src/app/tools/drawTools/vtoolline.cpp
index d4aab43df..49014357d 100644
--- a/src/app/tools/drawTools/vtoolline.cpp
+++ b/src/app/tools/drawTools/vtoolline.cpp
@@ -76,9 +76,9 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *
     Q_CHECK_PTR(dialog);
     DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    quint32 firstPoint = dialogTool->getFirstPoint();
-    quint32 secondPoint = dialogTool->getSecondPoint();
-    QString typeLine = dialogTool->getTypeLine();
+    const quint32 firstPoint = dialogTool->getFirstPoint();
+    const quint32 secondPoint = dialogTool->getSecondPoint();
+    const QString typeLine = dialogTool->getTypeLine();
     Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Valentina::FromGui);
 }
 
diff --git a/src/app/tools/drawTools/vtoollineintersect.cpp b/src/app/tools/drawTools/vtoollineintersect.cpp
index 1f737fe20..b73cafaf0 100644
--- a/src/app/tools/drawTools/vtoollineintersect.cpp
+++ b/src/app/tools/drawTools/vtoollineintersect.cpp
@@ -70,11 +70,11 @@ void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
     Q_CHECK_PTR(dialog);
     DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    quint32 p1Line1Id = dialogTool->getP1Line1();
-    quint32 p2Line1Id = dialogTool->getP2Line1();
-    quint32 p1Line2Id = dialogTool->getP1Line2();
-    quint32 p2Line2Id = dialogTool->getP2Line2();
-    QString pointName = dialogTool->getPointName();
+    const quint32 p1Line1Id = dialogTool->getP1Line1();
+    const quint32 p2Line1Id = dialogTool->getP2Line1();
+    const quint32 p1Line2Id = dialogTool->getP1Line2();
+    const quint32 p2Line2Id = dialogTool->getP2Line2();
+    const QString pointName = dialogTool->getPointName();
     Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc, data,
            Document::FullParse, Valentina::FromGui);
 }
diff --git a/src/app/tools/drawTools/vtoolnormal.cpp b/src/app/tools/drawTools/vtoolnormal.cpp
index 93f8a3efa..ef5b9ba9b 100644
--- a/src/app/tools/drawTools/vtoolnormal.cpp
+++ b/src/app/tools/drawTools/vtoolnormal.cpp
@@ -72,17 +72,17 @@ void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
     DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
     Q_CHECK_PTR(dialogTool);
     QString formula = dialogTool->getFormula();
-    quint32 firstPointId = dialogTool->getFirstPointId();
-    quint32 secondPointId = dialogTool->getSecondPointId();
-    QString typeLine = dialogTool->getTypeLine();
-    QString pointName = dialogTool->getPointName();
-    qreal angle = dialogTool->getAngle();
+    const quint32 firstPointId = dialogTool->getFirstPointId();
+    const quint32 secondPointId = dialogTool->getSecondPointId();
+    const QString typeLine = dialogTool->getTypeLine();
+    const QString pointName = dialogTool->getPointName();
+    const qreal angle = dialogTool->getAngle();
     Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, scene, doc, data,
            Document::FullParse, Valentina::FromGui);
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolNormal::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId,
+void VToolNormal::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
                          const quint32 &secondPointId, const QString &typeLine, const QString &pointName,
                          const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
                          VPattern *doc, VContainer *data, const Document::Documents &parse,
@@ -91,8 +91,7 @@ void VToolNormal::Create(const quint32 _id, const QString &formula, const quint3
     const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
     const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
 
-    Calculator cal(data);
-    const qreal result = cal.EvalFormula(formula);
+    const qreal result = CheckFormula(formula, data);
 
     QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
                                             qApp->toPixel(result), angle);
diff --git a/src/app/tools/drawTools/vtoolnormal.h b/src/app/tools/drawTools/vtoolnormal.h
index 415b70e33..f054b3280 100644
--- a/src/app/tools/drawTools/vtoolnormal.h
+++ b/src/app/tools/drawTools/vtoolnormal.h
@@ -84,7 +84,7 @@ public:
      * @param parse parser file mode.
      * @param typeCreation way we create this tool.
      */
-    static void    Create(const quint32 _id, const QString &formula, const quint32 &firstPointId,
+    static void    Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
                           const quint32 &secondPointId, const QString &typeLine, const QString &pointName,
                           const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene  *scene,
                           VPattern *doc, VContainer *data, const Document::Documents &parse,
diff --git a/src/app/tools/drawTools/vtoolpointofcontact.cpp b/src/app/tools/drawTools/vtoolpointofcontact.cpp
index ae836dea3..25d942d7c 100644
--- a/src/app/tools/drawTools/vtoolpointofcontact.cpp
+++ b/src/app/tools/drawTools/vtoolpointofcontact.cpp
@@ -98,27 +98,25 @@ void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene,
     DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
     Q_CHECK_PTR(dialogTool);
     QString radius = dialogTool->getRadius();
-    quint32 center = dialogTool->getCenter();
-    quint32 firstPointId = dialogTool->getFirstPoint();
-    quint32 secondPointId = dialogTool->getSecondPoint();
-    QString pointName = dialogTool->getPointName();
+    const quint32 center = dialogTool->getCenter();
+    const quint32 firstPointId = dialogTool->getFirstPoint();
+    const quint32 secondPointId = dialogTool->getSecondPoint();
+    const QString pointName = dialogTool->getPointName();
     Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data,
            Document::FullParse, Valentina::FromGui);
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const quint32 &center,
-                                 const quint32 &firstPointId, const quint32 &secondPointId,
-                                 const QString &pointName, const qreal &mx, const qreal &my,
-                                 VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
+void VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint32 &center, const quint32 &firstPointId,
+                                 const quint32 &secondPointId, const QString &pointName, const qreal &mx,
+                                 const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
                                  const Document::Documents &parse, const Valentina::Sources &typeCreation)
 {
     const VPointF *centerP = data->GeometricObject<const VPointF *>(center);
     const VPointF *firstP = data->GeometricObject<const VPointF *>(firstPointId);
     const VPointF *secondP = data->GeometricObject<const VPointF *>(secondPointId);
 
-    Calculator cal(data);
-    const qreal result = cal.EvalFormula(radius);
+    const qreal result = CheckFormula(radius, data);
 
     QPointF fPoint = VToolPointOfContact::FindPoint(qApp->toPixel(result), centerP->toQPointF(),
                                                      firstP->toQPointF(), secondP->toQPointF());
diff --git a/src/app/tools/drawTools/vtoolpointofcontact.h b/src/app/tools/drawTools/vtoolpointofcontact.h
index b283f238a..ce02fdd50 100644
--- a/src/app/tools/drawTools/vtoolpointofcontact.h
+++ b/src/app/tools/drawTools/vtoolpointofcontact.h
@@ -91,7 +91,7 @@ public:
      * @param parse parser file mode.
      * @param typeCreation way we create this tool.
      */
-    static void    Create(const quint32 _id, const QString &arcRadius, const quint32 &center,
+    static void    Create(const quint32 _id, QString &arcRadius, const quint32 &center,
                           const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName,
                           const qreal &mx, const qreal &my, VMainGraphicsScene  *scene, VPattern *doc,
                           VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation);
diff --git a/src/app/tools/drawTools/vtoolpointofintersection.cpp b/src/app/tools/drawTools/vtoolpointofintersection.cpp
index 8d0a35a14..9ff688a39 100644
--- a/src/app/tools/drawTools/vtoolpointofintersection.cpp
+++ b/src/app/tools/drawTools/vtoolpointofintersection.cpp
@@ -67,9 +67,9 @@ void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *sc
     Q_CHECK_PTR(dialog);
     DialogPointOfIntersection *dialogTool = qobject_cast<DialogPointOfIntersection*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    quint32 firstPointId = dialogTool->getFirstPointId();
-    quint32 secondPointId = dialogTool->getSecondPointId();
-    QString pointName = dialogTool->getPointName();
+    const quint32 firstPointId = dialogTool->getFirstPointId();
+    const quint32 secondPointId = dialogTool->getSecondPointId();
+    const QString pointName = dialogTool->getPointName();
     Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
 }
 
diff --git a/src/app/tools/drawTools/vtoolshoulderpoint.cpp b/src/app/tools/drawTools/vtoolshoulderpoint.cpp
index cd29ce3b1..354aec712 100644
--- a/src/app/tools/drawTools/vtoolshoulderpoint.cpp
+++ b/src/app/tools/drawTools/vtoolshoulderpoint.cpp
@@ -100,17 +100,17 @@ void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
     DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
     Q_CHECK_PTR(dialogTool);
     QString formula = dialogTool->getFormula();
-    quint32 p1Line = dialogTool->getP1Line();
-    quint32 p2Line = dialogTool->getP2Line();
-    quint32 pShoulder = dialogTool->getPShoulder();
-    QString typeLine = dialogTool->getTypeLine();
-    QString pointName = dialogTool->getPointName();
+    const quint32 p1Line = dialogTool->getP1Line();
+    const quint32 p2Line = dialogTool->getP2Line();
+    const quint32 pShoulder = dialogTool->getPShoulder();
+    const QString typeLine = dialogTool->getTypeLine();
+    const QString pointName = dialogTool->getPointName();
     Create(0, formula, p1Line, p2Line, pShoulder, typeLine, pointName, 5, 10, scene, doc, data,
            Document::FullParse, Valentina::FromGui);
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const quint32 &p1Line,
+void VToolShoulderPoint::Create(const quint32 _id, QString &formula, const quint32 &p1Line,
                                 const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine,
                                 const QString &pointName, const qreal &mx, const qreal &my,
                                 VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@@ -120,8 +120,7 @@ void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const
     const VPointF *secondPoint = data->GeometricObject<const VPointF *>(p2Line);
     const VPointF *shoulderPoint = data->GeometricObject<const VPointF *>(pShoulder);
 
-    Calculator cal(data);
-    const qreal result = cal.EvalFormula(formula);
+    const qreal result = CheckFormula(formula, data);
 
     QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
                                                    shoulderPoint->toQPointF(), qApp->toPixel(result));
diff --git a/src/app/tools/drawTools/vtoolshoulderpoint.h b/src/app/tools/drawTools/vtoolshoulderpoint.h
index ba5e2b96f..9e9462d9d 100644
--- a/src/app/tools/drawTools/vtoolshoulderpoint.h
+++ b/src/app/tools/drawTools/vtoolshoulderpoint.h
@@ -94,7 +94,7 @@ public:
      * @param parse parser file mode.
      * @param typeCreation way we create this tool.
      */
-    static void    Create(const quint32 _id, const QString &formula, const quint32 &p1Line, const quint32 &p2Line,
+    static void    Create(const quint32 _id, QString &formula, const quint32 &p1Line, const quint32 &p2Line,
                           const quint32 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx,
                           const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
                           const Document::Documents &parse, const Valentina::Sources &typeCreation);
diff --git a/src/app/tools/drawTools/vtoolspline.cpp b/src/app/tools/drawTools/vtoolspline.cpp
index ca87c745a..0e0a5e844 100644
--- a/src/app/tools/drawTools/vtoolspline.cpp
+++ b/src/app/tools/drawTools/vtoolspline.cpp
@@ -95,13 +95,13 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
     Q_CHECK_PTR(dialog);
     DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    quint32 p1 = dialogTool->getP1();
-    quint32 p4 = dialogTool->getP4();
-    qreal kAsm1 = dialogTool->getKAsm1();
-    qreal kAsm2 = dialogTool->getKAsm2();
-    qreal angle1 = dialogTool->getAngle1();
-    qreal angle2 = dialogTool->getAngle2();
-    qreal kCurve = dialogTool->getKCurve();
+    const quint32 p1 = dialogTool->getP1();
+    const quint32 p4 = dialogTool->getP4();
+    const qreal kAsm1 = dialogTool->getKAsm1();
+    const qreal kAsm2 = dialogTool->getKAsm2();
+    const qreal angle1 = dialogTool->getAngle1();
+    const qreal angle2 = dialogTool->getAngle2();
+    const qreal kCurve = dialogTool->getKCurve();
     Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, doc, data, Document::FullParse,
            Valentina::FromGui);
 }
diff --git a/src/app/tools/drawTools/vtooltriangle.cpp b/src/app/tools/drawTools/vtooltriangle.cpp
index d9c679201..28ca05b8c 100644
--- a/src/app/tools/drawTools/vtooltriangle.cpp
+++ b/src/app/tools/drawTools/vtooltriangle.cpp
@@ -70,11 +70,11 @@ void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene,
     Q_CHECK_PTR(dialog);
     DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
     Q_CHECK_PTR(dialogTool);
-    quint32 axisP1Id = dialogTool->getAxisP1Id();
-    quint32 axisP2Id = dialogTool->getAxisP2Id();
-    quint32 firstPointId = dialogTool->getFirstPointId();
-    quint32 secondPointId = dialogTool->getSecondPointId();
-    QString pointName = dialogTool->getPointName();
+    const quint32 axisP1Id = dialogTool->getAxisP1Id();
+    const quint32 axisP2Id = dialogTool->getAxisP2Id();
+    const quint32 firstPointId = dialogTool->getFirstPointId();
+    const quint32 secondPointId = dialogTool->getSecondPointId();
+    const QString pointName = dialogTool->getPointName();
     Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, scene, doc, data,
            Document::FullParse, Valentina::FromGui);
 }
diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp
index 8a885a141..67fb89c45 100644
--- a/src/app/xml/vpattern.cpp
+++ b/src/app/xml/vpattern.cpp
@@ -845,7 +845,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
                 //Rewrite attribute formula. Need for situation when we have wrong formula.
                 if (f != formula)
                 {
-                    SetAttribute(domElement, VToolEndLine::AttrLength, f);
+                    SetAttribute(domElement, VAbstractTool::AttrLength, f);
                     haveLiteChange();
                 }
             }
@@ -874,11 +874,18 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
                 const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
                                                            VAbstractTool::TypeLineLine);
                 const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
+                QString f = formula;//need for saving fixed formula;
                 const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
                 const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
 
-                VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, scene, this,
+                VToolAlongLine::Create(id, name, typeLine, f, firstPointId, secondPointId, mx, my, scene, this,
                                        data, parse, Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (f != formula)
+                {
+                    SetAttribute(domElement, VAbstractTool::AttrLength, f);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
@@ -905,12 +912,19 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
                 const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
                                                            VAbstractTool::TypeLineLine);
                 const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
+                QString f = formula;//need for saving fixed formula;
                 const quint32 p1Line = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0");
                 const quint32 p2Line = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0");
                 const quint32 pShoulder = GetParametrUInt(domElement, VAbstractTool::AttrPShoulder, "0");
 
-                VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this,
+                VToolShoulderPoint::Create(id, f, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this,
                                        data, parse, Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (f != formula)
+                {
+                    SetAttribute(domElement, VAbstractTool::AttrLength, f);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
@@ -937,12 +951,19 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
                 const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
                                                            VAbstractTool::TypeLineLine);
                 const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
+                QString f = formula;//need for saving fixed formula;
                 const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
                 const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
                 const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0");
 
-                VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene,
+                VToolNormal::Create(id, f, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene,
                                     this, data, parse, Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (f != formula)
+                {
+                    SetAttribute(domElement, VAbstractTool::AttrLength, f);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
@@ -969,12 +990,19 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
                 const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
                                                            VAbstractTool::TypeLineLine);
                 const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
+                QString f = formula;//need for saving fixed formula;
                 const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
                 const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
                 const quint32 thirdPointId = GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, "0");
 
-                VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId,
+                VToolBisector::Create(id, f, firstPointId, secondPointId, thirdPointId,
                                     typeLine, name, mx, my, scene, this, data, parse, Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (f != formula)
+                {
+                    SetAttribute(domElement, VAbstractTool::AttrLength, f);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
@@ -1021,12 +1049,19 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
                 const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
                 const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
                 const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0");
+                QString f = radius;//need for saving fixed formula;
                 const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0");
                 const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
                 const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
 
-                VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, scene, this,
+                VToolPointOfContact::Create(id, f, center, firstPointId, secondPointId, name, mx, my, scene, this,
                                             data, parse, Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (f != radius)
+                {
+                    SetAttribute(domElement, VAbstractTool::AttrRadius, f);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
@@ -1136,10 +1171,16 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
                 const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
                 const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
                 const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
+                QString f = formula;//need for saving fixed formula;
                 const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0");
 
-                VToolCutSpline::Create(id, name, formula, splineId, mx, my, scene, this, data, parse,
-                                       Valentina::FromFile);
+                VToolCutSpline::Create(id, name, f, splineId, mx, my, scene, this, data, parse, Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (f != formula)
+                {
+                    SetAttribute(domElement, VAbstractTool::AttrLength, f);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
@@ -1164,10 +1205,17 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
                 const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
                 const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
                 const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
+                QString f = formula;//need for saving fixed formula;
                 const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0");
 
-                VToolCutSplinePath::Create(id, name, formula, splinePathId, mx, my,
-                                            scene, this, data, parse, Valentina::FromFile);
+                VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, scene, this, data, parse,
+                                           Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (f != formula)
+                {
+                    SetAttribute(domElement, VAbstractTool::AttrLength, f);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
@@ -1192,9 +1240,16 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
                 const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
                 const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
                 const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
+                QString f = formula;//need for saving fixed formula;
                 const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, "0");
 
-                VToolCutArc::Create(id, name, formula, arcId, mx, my, scene, this, data, parse, Valentina::FromFile);
+                VToolCutArc::Create(id, name, f, arcId, mx, my, scene, this, data, parse, Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (f != formula)
+                {
+                    SetAttribute(domElement, VAbstractTool::AttrLength, f);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
@@ -1364,8 +1419,8 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement,
-                               const Document::Documents &parse, const QString &type)
+void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document::Documents &parse,
+                               const QString &type)
 {
     Q_CHECK_PTR(scene);
     Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
@@ -1381,10 +1436,21 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom
                 const quint32 id = GetParametrId(domElement);
                 const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0");
                 const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "10");
+                QString r = radius;//need for saving fixed formula;
                 const QString f1 = GetParametrString(domElement, VAbstractTool::AttrAngle1, "180");
+                QString f1Fix = f1;//need for saving fixed formula;
                 const QString f2 = GetParametrString(domElement, VAbstractTool::AttrAngle2, "270");
+                QString f2Fix = f2;//need for saving fixed formula;
 
-                VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Valentina::FromFile);
+                VToolArc::Create(id, center, r, f1Fix, f2Fix, scene, this, data, parse, Valentina::FromFile);
+                //Rewrite attribute formula. Need for situation when we have wrong formula.
+                if (r != radius || f1Fix != f1 || f2Fix != f2)
+                {
+                    SetAttribute(domElement, VAbstractTool::AttrRadius, r);
+                    SetAttribute(domElement, VAbstractTool::AttrAngle1, f1Fix);
+                    SetAttribute(domElement, VAbstractTool::AttrAngle2, f2Fix);
+                    haveLiteChange();
+                }
             }
             catch (const VExceptionBadId &e)
             {
diff --git a/src/app/xml/vpattern.h b/src/app/xml/vpattern.h
index 79ed6b197..8d32ed97a 100644
--- a/src/app/xml/vpattern.h
+++ b/src/app/xml/vpattern.h
@@ -363,7 +363,7 @@ private:
      * @param type type of spline.
      * @param mode draw mode.
      */
-    void           ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement,
+    void           ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement,
                                    const Document::Documents &parse, const QString& type);
     /**
      * @brief ParseToolsElement parse tools tag.

From faa858a0325319e72f8e211fc67264ccb323821a Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 15:04:21 +0300
Subject: [PATCH 14/17] Make list of methods more readable.

--HG--
branch : develop
---
 src/app/mainwindow.h | 118 +++++++++++++++++++++----------------------
 1 file changed, 57 insertions(+), 61 deletions(-)

diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h
index dfeb43174..fcbde5283 100644
--- a/src/app/mainwindow.h
+++ b/src/app/mainwindow.h
@@ -56,25 +56,32 @@ public:
     void               LoadPattern(const QString &curFile);
 public slots:
     void               mouseMove(const QPointF &scenePos);
+
     void               ActionAroowTool();
     void               ActionDraw(bool checked);
     void               ActionDetails(bool checked);
     void               ActionNewDraw();
+    void               ActionLayout(bool checked);
+    void               ActionTable(bool checked);
+    void               ActionHistory(bool checked);
+
+    void               tableClosed();
+    void               ClosedActionTable();
+    void               ClosedActionHistory();
+
     bool               SaveAs();
     bool               Save();
     void               Open();
     void               Options();
     void               NewPattern();
-    void               ActionTable(bool checked);
-    void               ActionHistory(bool checked);
-    void               ActionLayout(bool checked);
+
     void               currentDrawChanged( int index );
     void               OptionDraw();
-    void               PatternWasModified();
     void               ChangedSize(const QString &text);
     void               ChangedHeight(const QString & text);
-    void               ClosedActionTable();
-    void               ClosedActionHistory();
+
+    void               PatternWasModified();
+
     void               ToolEndLine(bool checked);
     void               ToolLine(bool checked);
     void               ToolAlongLine(bool checked);
@@ -94,6 +101,7 @@ public slots:
     void               ToolPointOfIntersection(bool checked);
     void               ToolUnionDetails(bool checked);
     void               ToolCutArc(bool checked);
+
     void               ClosedDialogEndLine(int result);
     void               ClosedDialogLine(int result);
     void               ClosedDialogAlongLine(int result);
@@ -113,12 +121,13 @@ public slots:
     void               ClosedDialogUnionDetails(int result);
     void               ClosedDialogCutSpline(int result);
     void               ClosedDialogCutArc(int result);
+
     void               About();
     void               AboutQt();
-    void               ShowToolTip(const QString &toolTip);
-    void               tableClosed();
-    void               OpenRecentFile();
     void               PatternProperties();
+
+    void               ShowToolTip(const QString &toolTip);
+    void               OpenRecentFile();
 signals:
     /**
      * @brief ModelChosen emit after calculation all details.
@@ -133,77 +142,61 @@ protected:
     void               Clear();
 private:
     Q_DISABLE_COPY(MainWindow)
-    /**
-     * @brief ui keeps information about user interface
-     */
+    /** @brief ui keeps information about user interface */
     Ui::MainWindow     *ui;
-    /**
-     * @brief pattern container with data (points, arcs, splines, spline paths, variables)
-     */
+
+    /** @brief pattern container with data (points, arcs, splines, spline paths, variables) */
     VContainer        *pattern;
-    /**
-     * @brief doc dom document container
-     */
+
+    /** @brief doc dom document container */
     VPattern          *doc;
-    /**
-     * @brief tool current tool
-     */
+
+    /** @brief tool current tool */
     Valentina::Tools        tool;
-    /**
-     * @brief currentScene pointer to current scene.
-     */
+
+    /** @brief currentScene pointer to current scene. */
     VMainGraphicsScene *currentScene;
-    /**
-     * @brief sceneDraw draw scene.
-     */
+
+    /** @brief sceneDraw draw scene. */
     VMainGraphicsScene *sceneDraw;
-    /**
-     * @brief sceneDetails details scene.
-     */
+
+    /** @brief sceneDetails details scene. */
     VMainGraphicsScene *sceneDetails;
-    /**
-     * @brief mouseCoordinate pointer to label who show mouse coordinate.
-     */
+
+    /** @brief mouseCoordinate pointer to label who show mouse coordinate. */
     QLabel             *mouseCoordinate;
-    /**
-     * @brief helpLabel help show tooltip.
-     */
+
+    /** @brief helpLabel help show tooltip. */
     QLabel             *helpLabel;
-    /**
-     * @brief view show current scene.
-     */
+
+    /** @brief view show current scene. */
     VMainGraphicsView  *view;
-    /**
-     * @brief isInitialized true after first show window.
-     */
+
+    /** @brief isInitialized true after first show window. */
     bool               isInitialized;
+
     DialogIncrements   *dialogTable;
     DialogTool         *dialogTool;
     DialogHistory      *dialogHistory;
-    /**
-     * @brief comboBoxDraws comboc who show name of pattern peaces.
-     */
+
+    /** @brief comboBoxDraws comboc who show name of pattern peaces. */
     QComboBox          *comboBoxDraws;
-    /**
-     * @brief fileName name current pattern file.
-     */
+
+    /** @brief fileName name current pattern file. */
     QString            curFile;
-    /**
-     * @brief mode keep current draw mode.
-     */
+
+    /** @brief mode keep current draw mode. */
     Valentina::Draws        mode;
-    /**
-     * @brief currentDrawIndex save current selected pattern peace.
-     */
+
+    /** @brief currentDrawIndex save current selected pattern peace. */
     qint32             currentDrawIndex;
-    /**
-     * @brief currentToolBoxIndex save current set of tools.
-     */
+
+    /** @brief currentToolBoxIndex save current set of tools. */
     qint32             currentToolBoxIndex;
-    /**
-     * @brief drawMode true if we current draw scene.
-     */
+
+    /** @brief drawMode true if we current draw scene. */
     bool               drawMode;
+
     enum { MaxRecentFiles = 5 };
     QAction            *recentFileActs[MaxRecentFiles];
     QAction            *separatorAct;
@@ -217,12 +210,15 @@ private:
     void               SetEnableTool(bool enable);
     void               SaveCurrentScene();
     void               RestoreCurrentScene();
+    void               MinimumScrollBar();
+
     template <typename Dialog, typename Func>
     void               SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
                                      Func closeDialogSlot);
-    void               MinimumScrollBar();
+
     template <typename DrawTool>
     void               ClosedDialog(int result);
+
     bool               SavePattern(const QString &curFile);
     void               AutoSavePattern();
     void               setCurrentFile(const QString &fileName);

From bf152372962ca18186c9a3e75322b1b944ce7cac Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 16:04:38 +0300
Subject: [PATCH 15/17] Update documentation for Calculator class.

--HG--
branch : develop
---
 src/app/container/calculator.cpp      | 31 +++++++++++++++++++++++++--
 src/app/container/calculator.h        | 19 ++++++++++++++++
 src/app/tools/drawTools/vdrawtool.cpp |  2 --
 3 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/src/app/container/calculator.cpp b/src/app/container/calculator.cpp
index 4b8e56b6c..df87bea96 100644
--- a/src/app/container/calculator.cpp
+++ b/src/app/container/calculator.cpp
@@ -35,7 +35,17 @@ int Calculator::iVal = -1;
 
 //---------------------------------------------------------------------------------------------------------------------
 /**
- * @brief Calculator class constructor.
+ * @brief Calculator class constructor. Make easy initialization math parser.
+ *
+ * This constructor hide initialization variables, operators, character sets.
+ * Use this constuctor for evaluation formula. All formulas must be converted to internal look.
+ * Example:
+ *
+ * const QString formula = qApp->FormulaFromUser(edit->text());
+ * Calculator *cal = new Calculator(data);
+ * const qreal result = cal->EvalFormula(formula);
+ * delete cal;
+ *
  * @param data pointer to a variable container.
  */
 Calculator::Calculator(const VContainer *data)
@@ -56,6 +66,21 @@ Calculator::Calculator(const VContainer *data)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief Calculator class constructor. Make easy initialization math parser.
+ *
+ * This constructor hide initialization variables, operators, character sets.
+ * Use this constuctor to get tokens from formula. All formulas must be converted to external look.
+ * Example:
+ *
+ * Calculator *cal = new Calculator(formula, false);
+ * tokens = cal->GetTokens();
+ * numbers = cal->GetNumbers();
+ * delete cal;
+ *
+ * @param data pointer to a variable container.
+ * @param fromUser true if we parse formula from user
+ */
 Calculator::Calculator(const QString &formula, bool fromUser)
     :QmuParser(), vVarVal(nullptr)
 {
@@ -97,7 +122,8 @@ Calculator::Calculator(const QString &formula, bool fromUser)
     }
 
     SetExpr(formula);
-    Eval();//Need run for making tokens
+    //Need run for making tokens. Don't catch exception here, because it will show us in dialog that formula has error.
+    Eval();
 }
 
 Calculator::~Calculator()
@@ -240,6 +266,7 @@ void Calculator::InitVariables(const VContainer *data)
     }
 }
 
+//---------------------------------------------------------------------------------------------------------------------
 void Calculator::InitCharacterSets()
 {
     //String with all unique symbols for supported alpabets.
diff --git a/src/app/container/calculator.h b/src/app/container/calculator.h
index 2961f6498..f9eb9e297 100644
--- a/src/app/container/calculator.h
+++ b/src/app/container/calculator.h
@@ -34,6 +34,25 @@
 #include "../../libs/qmuparser/qmuparser.h"
 using namespace qmu;
 
+/**
+ * @brief The Calculator class for calculation formula.
+ *
+ * Main purpose make easy evaluate value of formula and get tokens.
+ * Note. If created to many parser for different purpes in the same time parser can work wrong.
+ * Example:
+ * DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data);
+ * dialog->setFormula(formula);
+ * if (dialog->exec() == QDialog::Accepted)
+ * {
+ *     formula = dialog->getFormula();
+ *     //Need delete dialog here because parser in dialog don't allow use correct separator for parsing here.
+ *     //Don't know why.
+ *     delete dialog;
+ *     Calculator *cal = new Calculator(data);
+ *     result = cal->EvalFormula(formula);
+ *     delete cal;//Here can be memory leak, but dialog already check this formula and probability very low.
+ * }
+ */
 class Calculator:public QmuParser
 {
 public:
diff --git a/src/app/tools/drawTools/vdrawtool.cpp b/src/app/tools/drawTools/vdrawtool.cpp
index 457de4522..e6637040d 100644
--- a/src/app/tools/drawTools/vdrawtool.cpp
+++ b/src/app/tools/drawTools/vdrawtool.cpp
@@ -59,8 +59,6 @@ VDrawTool::~VDrawTool()
     delete dialog;
 }
 
-
-
 //---------------------------------------------------------------------------------------------------------------------
 /**
  * @brief ShowTool  highlight tool.

From db8cf12d491349c6d062a37481e2c7d6ea15dc7b Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 16:22:03 +0300
Subject: [PATCH 16/17] Catch exceptions in lite parsing.

--HG--
branch : develop
---
 src/app/mainwindow.cpp   |  2 ++
 src/app/mainwindow.h     |  2 +-
 src/app/xml/vpattern.cpp | 45 ++++++++++++++++++++++++++++++++++------
 src/app/xml/vpattern.h   |  1 +
 4 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp
index e0ed7f41f..a51f09f18 100644
--- a/src/app/mainwindow.cpp
+++ b/src/app/mainwindow.cpp
@@ -89,6 +89,7 @@ MainWindow::MainWindow(QWidget *parent)
 
     doc = new VPattern(pattern, comboBoxDraws, &mode);
     connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
+    connect(doc, &VPattern::ClearMainWindow, this, &MainWindow::Clear);
 
     InitAutoSave();
 
@@ -1291,6 +1292,7 @@ void MainWindow::Clear()
     setCurrentFile("");
     pattern->Clear();
     doc->clear();
+    doc->setPatternModified(false);
     sceneDraw->clear();
     sceneDetails->clear();
     CancelTool();
diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h
index fcbde5283..df9eb14b3 100644
--- a/src/app/mainwindow.h
+++ b/src/app/mainwindow.h
@@ -128,6 +128,7 @@ public slots:
 
     void               ShowToolTip(const QString &toolTip);
     void               OpenRecentFile();
+    void               Clear();
 signals:
     /**
      * @brief ModelChosen emit after calculation all details.
@@ -139,7 +140,6 @@ protected:
     virtual void       keyPressEvent ( QKeyEvent * event );
     virtual void       showEvent( QShowEvent *event );
     virtual void       closeEvent( QCloseEvent * event );
-    void               Clear();
 private:
     Q_DISABLE_COPY(MainWindow)
     /** @brief ui keeps information about user interface */
diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp
index 67fb89c45..0594b0563 100644
--- a/src/app/xml/vpattern.cpp
+++ b/src/app/xml/vpattern.cpp
@@ -40,6 +40,7 @@
 
 #include <QMessageBox>
 #include "../../libs/qmuparser/qmuparsererror.h"
+#include <exception/vexceptionemptyparameter.h>
 
 const QString VPattern::TagPattern      = QStringLiteral("pattern");
 const QString VPattern::TagCalculation  = QStringLiteral("calculation");
@@ -556,11 +557,47 @@ bool VPattern::SaveDocument(const QString &fileName)
 //---------------------------------------------------------------------------------------------------------------------
 void VPattern::FullUpdateTree()
 {
-    VMainGraphicsScene *scene = new VMainGraphicsScene();
+    VMainGraphicsScene *scene = nullptr;
     try
     {
+        scene = new VMainGraphicsScene();
         Parse(Document::LiteParse, scene, scene);
     }
+    catch (const VExceptionObjectError &e)
+    {
+        delete scene;
+        e.CriticalMessageBox(tr("Error parsing file."));
+        emit ClearMainWindow();
+        return;
+    }
+    catch (const VExceptionConversionError &e)
+    {
+        delete scene;
+        e.CriticalMessageBox(tr("Error can't convert value."));
+        emit ClearMainWindow();
+        return;
+    }
+    catch (const VExceptionEmptyParameter &e)
+    {
+        delete scene;
+        e.CriticalMessageBox(tr("Error empty parameter."));
+        emit ClearMainWindow();
+        return;
+    }
+    catch (const VExceptionWrongId &e)
+    {
+        delete scene;
+        e.CriticalMessageBox(tr("Error wrong id."));
+        emit ClearMainWindow();
+        return;
+    }
+    catch (VException &e)
+    {
+        delete scene;
+        e.CriticalMessageBox(tr("Error parsing file."));
+        emit ClearMainWindow();
+        return;
+    }
     catch (const std::bad_alloc &)
     {
         delete scene;
@@ -572,13 +609,9 @@ void VPattern::FullUpdateTree()
         msgBox.setDefaultButton(QMessageBox::Ok);
         msgBox.setIcon(QMessageBox::Warning);
         msgBox.exec();
+        emit ClearMainWindow();
         return;
     }
-    catch (...)
-    {
-        delete scene;
-        throw;
-    }
 
     delete scene;
     setCurrentData();
diff --git a/src/app/xml/vpattern.h b/src/app/xml/vpattern.h
index 8d32ed97a..ac8546813 100644
--- a/src/app/xml/vpattern.h
+++ b/src/app/xml/vpattern.h
@@ -236,6 +236,7 @@ signals:
      * @param id tool id.
      */
     void           ChangedCursor(quint32 id);
+    void           ClearMainWindow();
 public slots:
     /**
      * @brief FullUpdateTree lite parse file.

From 07f75f72128f90417b087a8262f46e06a9b86d35 Mon Sep 17 00:00:00 2001
From: dismine <dismine@gmail.com>
Date: Fri, 30 May 2014 17:31:48 +0300
Subject: [PATCH 17/17] Catch std::bad_alloc exception.

--HG--
branch : develop
---
 src/app/mainwindow.cpp   | 19 +++++++++++++++++++
 src/app/xml/vpattern.cpp |  6 ++++++
 2 files changed, 25 insertions(+)

diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp
index a51f09f18..b7e24a78b 100644
--- a/src/app/mainwindow.cpp
+++ b/src/app/mainwindow.cpp
@@ -1888,6 +1888,25 @@ void MainWindow::LoadPattern(const QString &fileName)
         Clear();
         return;
     }
+    catch (const std::bad_alloc &)
+    {
+#ifndef QT_NO_CURSOR
+        QApplication::restoreOverrideCursor();
+#endif
+        QMessageBox msgBox;
+        msgBox.setWindowTitle(tr("Error!"));
+        msgBox.setText(tr("Error parsing file."));
+        msgBox.setInformativeText("std::bad_alloc");
+        msgBox.setStandardButtons(QMessageBox::Ok);
+        msgBox.setDefaultButton(QMessageBox::Ok);
+        msgBox.setIcon(QMessageBox::Warning);
+        msgBox.exec();
+#ifndef QT_NO_CURSOR
+        QApplication::setOverrideCursor(Qt::WaitCursor);
+#endif
+        Clear();
+        return;
+    }
     connect(comboBoxDraws,  static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
             this, &MainWindow::currentDrawChanged);
     QString nameDraw = doc->GetNameActivDraw();
diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp
index 0594b0563..67bd9edc1 100644
--- a/src/app/xml/vpattern.cpp
+++ b/src/app/xml/vpattern.cpp
@@ -601,6 +601,9 @@ void VPattern::FullUpdateTree()
     catch (const std::bad_alloc &)
     {
         delete scene;
+#ifndef QT_NO_CURSOR
+        QApplication::restoreOverrideCursor();
+#endif
         QMessageBox msgBox;
         msgBox.setWindowTitle(tr("Error!"));
         msgBox.setText(tr("Error parsing file."));
@@ -609,6 +612,9 @@ void VPattern::FullUpdateTree()
         msgBox.setDefaultButton(QMessageBox::Ok);
         msgBox.setIcon(QMessageBox::Warning);
         msgBox.exec();
+#ifndef QT_NO_CURSOR
+        QApplication::setOverrideCursor(Qt::WaitCursor);
+#endif
         emit ClearMainWindow();
         return;
     }