Merge with feature

--HG--
branch : develop
This commit is contained in:
dismine 2014-06-19 15:23:56 +03:00
commit 688eff1542
84 changed files with 1538 additions and 1972 deletions

View File

@ -142,7 +142,6 @@ CONFIG(debug, debug|release){
-Wlong-long \
-Wmissing-format-attribute \
-Wswitch-default \
-Wswitch-enum \
-Wuninitialized \
-Wvariadic-macros \
-Wlogical-op \

View File

@ -188,7 +188,7 @@ val VContainer::GetVariable(const QHash<key, val> &obj, key id) const
*/
const VMeasurement VContainer::GetMeasurement(const QString &name) const
{
Q_ASSERT(name.isEmpty()==false);
SCASSERT(name.isEmpty()==false);
return GetVariable(measurements, name);
}
@ -200,7 +200,7 @@ const VMeasurement VContainer::GetMeasurement(const QString &name) const
*/
const VIncrement VContainer::GetIncrement(const QString& name) const
{
Q_ASSERT(name.isEmpty()==false);
SCASSERT(name.isEmpty()==false);
return GetVariable(increments, name);
}
@ -212,7 +212,7 @@ const VIncrement VContainer::GetIncrement(const QString& name) const
*/
qreal VContainer::GetLine(const QString &name) const
{
Q_ASSERT(name.isEmpty()==false);
SCASSERT(name.isEmpty()==false);
return GetVariable(lengthLines, name);
}
@ -224,7 +224,7 @@ qreal VContainer::GetLine(const QString &name) const
*/
qreal VContainer::GetLengthArc(const QString &name) const
{
Q_ASSERT(name.isEmpty()==false);
SCASSERT(name.isEmpty()==false);
return GetVariable(lengthArcs, name);
}
@ -236,7 +236,7 @@ qreal VContainer::GetLengthArc(const QString &name) const
*/
qreal VContainer::GetLengthSpline(const QString &name) const
{
Q_ASSERT(name.isEmpty()==false);
SCASSERT(name.isEmpty()==false);
return GetVariable(lengthSplines, name);
}
@ -248,7 +248,7 @@ qreal VContainer::GetLengthSpline(const QString &name) const
*/
qreal VContainer::GetLineAngle(const QString &name) const
{
Q_ASSERT(name.isEmpty()==false);
SCASSERT(name.isEmpty()==false);
return GetVariable(lineAngles, name);
}
@ -352,7 +352,7 @@ void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val p
*/
void VContainer::AddLengthSpline(const QString &name, const qreal &value)
{
Q_ASSERT(name.isEmpty() == false);
SCASSERT(name.isEmpty() == false);
lengthSplines[name] = value;
}
@ -375,7 +375,7 @@ void VContainer::AddLengthArc(const quint32 &id)
*/
void VContainer::AddLineAngle(const QString &name, const qreal &value)
{
Q_ASSERT(name.isEmpty() == false);
SCASSERT(name.isEmpty() == false);
lineAngles[name] = value;
}
@ -560,6 +560,6 @@ void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
*/
void VContainer::AddLengthLine(const QString &name, const qreal &value)
{
Q_ASSERT(name.isEmpty() == false);
SCASSERT(name.isEmpty() == false);
lengthLines[name] = value;
}

View File

@ -127,7 +127,7 @@ bool DialogPatternXmlEdit::ApplyNodeChange(QDomNode domElement, QString name, QS
bool DialogPatternXmlEdit::ApplyNodeAdd(QDomNode domElement, VXMLTreeElement* treeElement, QString name, QString value)
{
QDomElement newnode = domElement.ownerDocument().createElement(name);
//Q_ASSERT(newnode != nullptr);
//SCASSERT(newnode != nullptr);
newnode.setNodeValue(value);
domElement.appendChild(newnode);
treeElement->SetDocNode(newnode);
@ -282,7 +282,7 @@ bool DialogPatternXmlEdit::DeleteNodeAndSons(VXMLTreeElement * currentNode, bool
}
if (index < 0)
{
Q_ASSERT(index==0);
SCASSERT(index==0);
return false;
}
parent->removeRow(index);
@ -318,7 +318,7 @@ DialogPatternXmlEdit::ChangesStackElement* DialogPatternXmlEdit::CreateStackElem
//---------------------------------------------------------------------------------------------------------------------
bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement* current)
{
Q_ASSERT(current != nullptr);
SCASSERT(current != nullptr);
VXMLTreeElement * currentNode = current->element;
@ -371,7 +371,7 @@ bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement*
}
if (index < 0)
{
Q_ASSERT(index==0);
SCASSERT(index==0);
return false;
}
parent->removeRow(index);
@ -621,7 +621,7 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt)
}
if (index->next == nullptr)
{
Q_ASSERT(index->next != nullptr);
SCASSERT(index->next != nullptr);
return;
}
if (index->next->newText != nullptr)
@ -834,7 +834,7 @@ void DialogPatternXmlEdit::ButtonSetClicked()
{ // If node was created or edited previously, rewrite
if (this->currentNodeEditedStatus == DialogPatternXmlEdit::ChangeTypeDelete)
{ // You shouldn't be able to edit a deleted node...
Q_ASSERT(this->currentNodeEditedStatus != DialogPatternXmlEdit::ChangeTypeDelete);
SCASSERT(this->currentNodeEditedStatus != DialogPatternXmlEdit::ChangeTypeDelete);
ClearEditData();
return;
}
@ -958,7 +958,7 @@ void DialogPatternXmlEdit::BaseSelectionChanged(int value)
ui->pushButton_Apply_Changes->setEnabled(false);
index = ui->comboBox_Base_Selection->itemData(value).toInt(); //.convert(QVariant::Int);
Q_ASSERT(value < rootBasesNum);
SCASSERT(value < rootBasesNum);
// QMessageBox::information(this, "test", QString("%1:%2").arg(value).arg(index));
// Clear all tree info and nodes
@ -1169,7 +1169,7 @@ void VXMLTreeView::appendchain(VXMLTreeElement* elmt)
current = new TreeElementchain;
if (current == nullptr)
{
Q_ASSERT(current != nullptr);
SCASSERT(current != nullptr);
// TODO : throw exception
}
current->elmt=elmt;
@ -1180,7 +1180,7 @@ void VXMLTreeView::appendchain(VXMLTreeElement* elmt)
TreeElementchain* temp= new TreeElementchain;
if (temp == nullptr)
{
Q_ASSERT(temp != nullptr);
SCASSERT(temp != nullptr);
// TODO : throw exception
}
temp->elmt=elmt;

View File

@ -42,33 +42,27 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(0)
{
ui->setupUi(this);
labelResultCalculation = ui->labelResultCalculation;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
this->formulaBaseHeight=ui->plainTextEditFormula->height();
InitVariables(ui);
InitFormulaUI(ui);
labelEditNamePoint = ui->labelEditNamePoint;
this->formulaBaseHeight = ui->plainTextEditFormula->height();
InitOkCancelApply(ui);
flagFormula = false;
flagName = false;
InitOkCancelApply(ui);
CheckState();
FillComboBoxTypeLine(ui->comboBoxLineType);
ui->comboBoxLineType->setCurrentIndex(0);
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
FillComboBoxTypeLine(ui->comboBoxLineType);
ui->comboBoxLineType->setCurrentIndex(0);
labelEditNamePoint = ui->labelEditNamePoint;
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogAlongLine::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogAlongLine::DeployFormulaTextEdit);
InitVariables(ui);
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogTool::PutVal);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -80,20 +74,7 @@ void DialogAlongLine::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGALONLINE_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGALONLINE_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGALONLINE_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogAlongLine;

View File

@ -160,6 +160,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -189,8 +195,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../share/resources/theme.qrc">
<normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
@ -468,7 +473,6 @@
</tabstops>
<resources>
<include location="../../share/resources/icon.qrc"/>
<include location="../../share/resources/theme.qrc"/>
</resources>
<connections>
<connection>

View File

@ -44,10 +44,17 @@
DialogArc::DialogArc(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()),
f2(QString()), formulaBaseHeight(0)
f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0)
{
ui->setupUi(this);
InitVariables(ui);
plainTextEditFormula = ui->plainTextEditFormula;
this->formulaBaseHeight = ui->plainTextEditFormula->height();
this->formulaBaseHeightF1 = ui->plainTextEditF1->height();
this->formulaBaseHeightF2 = ui->plainTextEditF2->height();
timerRadius = new QTimer(this);
connect(timerRadius, &QTimer::timeout, this, &DialogArc::EvalRadius);
@ -59,14 +66,10 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
InitOkCancelApply(ui);
this->formulaBaseHeight=ui->plainTextEditFormula->height();
FillComboBoxPoints(ui->comboBoxBasePoint);
CheckState();
InitVariables(ui);
connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius);
connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1);
connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2);
@ -76,31 +79,30 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
connect(ui->toolButtonEqualF2, &QPushButton::clicked, this, &DialogArc::EvalF2);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged);
connect(ui->lineEditF1, &QLineEdit::textChanged, this, &DialogArc::F1Changed);
connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogArc::DeployFormulaTextEdit);
connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogArc::F1Changed);
connect(ui->plainTextEditF2, &QPlainTextEdit::textChanged, this, &DialogArc::F2Changed);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogArc::DeployFormulaTextEdit);
connect(ui->pushButtonGrowLengthF1, &QPushButton::clicked, this, &DialogArc::DeployF1TextEdit);
connect(ui->pushButtonGrowLengthF2, &QPushButton::clicked, this, &DialogArc::DeployF2TextEdit);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGARC_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGARC_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::DeployF1TextEdit()
{
DeployFormula(ui->plainTextEditF1, ui->pushButtonGrowLengthF1, formulaBaseHeightF1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::DeployF2TextEdit()
{
DeployFormula(ui->plainTextEditF2, ui->pushButtonGrowLengthF2, formulaBaseHeightF2);
}
//---------------------------------------------------------------------------------------------------------------------
@ -127,8 +129,13 @@ void DialogArc::SetCenter(const quint32 &value)
*/
void DialogArc::SetF2(const QString &value)
{
f2 = value;
ui->lineEditF2->setText(f2);
f2 = qApp->FormulaToUser(value);
// increase height if needed.
if (f2.length() > 80)
{
this->DeployF2TextEdit();
}
ui->plainTextEditF2->setPlainText(f2);
}
//---------------------------------------------------------------------------------------------------------------------
@ -138,8 +145,13 @@ void DialogArc::SetF2(const QString &value)
*/
void DialogArc::SetF1(const QString &value)
{
f1 = value;
ui->lineEditF1->setText(f1);
f1 = qApp->FormulaToUser(value);
// increase height if needed.
if (f1.length() > 80)
{
this->DeployF1TextEdit();
}
ui->plainTextEditF1->setPlainText(f1);
}
//---------------------------------------------------------------------------------------------------------------------
@ -197,8 +209,10 @@ void DialogArc::SaveData()
{
radius = ui->plainTextEditFormula->toPlainText();
radius.replace("\n", " ");
f1 = ui->lineEditF1->text();
f2 = ui->lineEditF2->text();
f1 = ui->plainTextEditF1->toPlainText();
f1.replace("\n", " ");
f2 = ui->plainTextEditF2->toPlainText();
f2.replace("\n", " ");
center = getCurrentObjectId(ui->comboBoxBasePoint);
}
@ -239,7 +253,7 @@ void DialogArc::PutRadius()
*/
void DialogArc::PutF1()
{
PutValHere(ui->lineEditF1, ui->listWidget);
PutValHere(ui->plainTextEditF1, ui->listWidget);
}
//---------------------------------------------------------------------------------------------------------------------
@ -248,7 +262,7 @@ void DialogArc::PutF1()
*/
void DialogArc::PutF2()
{
PutValHere(ui->lineEditF2, ui->listWidget);
PutValHere(ui->plainTextEditF2, ui->listWidget);
}
//---------------------------------------------------------------------------------------------------------------------
@ -278,7 +292,7 @@ void DialogArc::RadiusChanged()
void DialogArc::F1Changed()
{
labelEditFormula = ui->labelEditF1;
ValFormulaChanged(flagF1, ui->lineEditF1, timerF1);
ValFormulaChanged(flagF1, ui->plainTextEditF1, timerF1);
}
//---------------------------------------------------------------------------------------------------------------------
@ -288,7 +302,7 @@ void DialogArc::F1Changed()
void DialogArc::F2Changed()
{
labelEditFormula = ui->labelEditF2;
ValFormulaChanged(flagF2, ui->lineEditF2, timerF2);
ValFormulaChanged(flagF2, ui->plainTextEditF2, timerF2);
}
//---------------------------------------------------------------------------------------------------------------------
@ -310,7 +324,7 @@ void DialogArc::CheckState()
void DialogArc::EvalRadius()
{
labelEditFormula = ui->labelEditRadius;
Eval(ui->plainTextEditFormula, flagRadius, timerRadius, ui->labelResultRadius);
Eval(ui->plainTextEditFormula->toPlainText(), flagRadius, timerRadius, ui->labelResultRadius);
}
//---------------------------------------------------------------------------------------------------------------------
@ -320,7 +334,7 @@ void DialogArc::EvalRadius()
void DialogArc::EvalF1()
{
labelEditFormula = ui->labelEditF1;
Eval(ui->lineEditF1, flagF1, timerF1, ui->labelResultF1);
Eval(ui->plainTextEditF1->toPlainText(), flagF1, timerF1, ui->labelResultF1);
}
//---------------------------------------------------------------------------------------------------------------------
@ -330,7 +344,7 @@ void DialogArc::EvalF1()
void DialogArc::EvalF2()
{
labelEditFormula = ui->labelEditF2;
Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2);
Eval(ui->plainTextEditF2->toPlainText(), flagF2, timerF2, ui->labelResultF2);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGARC_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogArc;
@ -69,6 +68,8 @@ public slots:
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
void DeployF1TextEdit();
void DeployF2TextEdit();
virtual void ValChenged(int row);
void PutRadius();
void PutF1();
@ -118,6 +119,8 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
int formulaBaseHeightF1;
int formulaBaseHeightF2;
void EvalRadius();
void EvalF1();

View File

@ -23,9 +23,6 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="labelEditRadius">
<property name="sizePolicy">
@ -77,50 +74,17 @@
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="maximumSize">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16777215</width>
<height>24</height>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereRadius">
@ -132,7 +96,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
<normaloff>:/icon/24x24/putHere.png</normaloff>:/icon/24x24/putHere.png</iconset>
</property>
<property name="iconSize">
<size>
@ -186,6 +150,62 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -239,17 +259,17 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditF1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="toolTip">
<string>First angle of arc counterclockwise</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF1">
@ -261,7 +281,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
<normaloff>:/icon/24x24/putHere.png</normaloff>:/icon/24x24/putHere.png</iconset>
</property>
<property name="iconSize">
<size>
@ -315,6 +335,62 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPlainTextEdit" name="plainTextEditF1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLengthF1">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@ -368,17 +444,17 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditF2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="toolTip">
<string>Second angle of arc counterclockwise</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF2">
@ -390,7 +466,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
<normaloff>:/icon/24x24/putHere.png</normaloff>:/icon/24x24/putHere.png</iconset>
</property>
<property name="iconSize">
<size>
@ -444,6 +520,62 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QPlainTextEdit" name="plainTextEditF2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLengthF2">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
@ -623,8 +755,6 @@
</layout>
</widget>
<tabstops>
<tabstop>lineEditF1</tabstop>
<tabstop>lineEditF2</tabstop>
<tabstop>comboBoxBasePoint</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandardTable</tabstop>

View File

@ -40,16 +40,14 @@
*/
DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), typeLine(QString()),
formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0), formulaBaseHeight(0)
formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0),
formulaBaseHeight(0)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
InitFormulaUI(ui);
labelEditNamePoint = ui->labelEditNamePoint;
this->formulaBaseHeight=ui->plainTextEditFormula->height();
this->formulaBaseHeight = ui->plainTextEditFormula->height();
InitOkCancelApply(ui);
flagFormula = false;
@ -58,8 +56,8 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
FillComboBoxPoints(ui->comboBoxThirdPoint);
FillComboBoxTypeLine(ui->comboBoxLineType);
FillComboBoxPoints(ui->comboBoxThirdPoint);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogBisector::PutHere);
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogBisector::PutVal);
@ -68,9 +66,6 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -82,20 +77,7 @@ void DialogBisector::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGBISECTOR_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGBISECTOR_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGBISECTOR_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogBisector;

View File

@ -151,6 +151,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -180,7 +186,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png"/>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>

View File

@ -44,16 +44,14 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
InitFormulaUI(ui);
labelEditNamePoint = ui->labelEditNamePoint;
this->formulaBaseHeight = ui->plainTextEditFormula->height();
InitOkCancelApply(ui);
flagFormula = false;
flagName = false;
CheckState();
this->formulaBaseHeight=ui->plainTextEditFormula->height();
FillComboBoxArcs(ui->comboBoxArc);
@ -64,9 +62,6 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutArc::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutArc::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -78,20 +73,7 @@ void DialogCutArc::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGCUTARC_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGCUTARC_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGCUTARC_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogCutArc;

View File

@ -144,6 +144,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -173,9 +179,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<normaloff/>
</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>

View File

@ -39,16 +39,16 @@
* @param parent parent widget
*/
DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0)
:DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0),
formulaBaseHeight(0)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
InitFormulaUI(ui);
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancel(ui);
this->formulaBaseHeight = ui->plainTextEditFormula->height();
InitOkCancel(ui);
flagFormula = false;
flagName = false;
CheckState();
@ -59,7 +59,8 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSpline::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSpline::FormulaChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutSpline::FormulaChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSpline::DeployFormulaTextEdit);
}
//---------------------------------------------------------------------------------------------------------------------
@ -87,7 +88,13 @@ void DialogCutSpline::setPointName(const QString &value)
void DialogCutSpline::setFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
ui->lineEditFormula->setText(formula);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
{
this->DeployFormulaTextEdit();
}
ui->plainTextEditFormula->setPlainText(formula);
}
//---------------------------------------------------------------------------------------------------------------------
@ -125,7 +132,14 @@ void DialogCutSpline::ChoosedObject(quint32 id, const SceneObject &type)
void DialogCutSpline::DialogAccepted()
{
pointName = ui->lineEditNamePoint->text();
formula = ui->lineEditFormula->text();
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
splineId = getCurrentObjectId(ui->comboBoxSpline);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::DeployFormulaTextEdit()
{
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}

View File

@ -61,6 +61,10 @@ public slots:
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
private:
Q_DISABLE_COPY(DialogCutSpline)
@ -75,6 +79,9 @@ private:
/** @brief splineId keep id of spline */
quint32 splineId;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<width>665</width>
<height>546</height>
</rect>
</property>
@ -67,17 +67,17 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="toolTip">
<string>Formula for the calculation of the spline</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
@ -140,6 +140,60 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>

View File

@ -40,14 +40,13 @@
*/
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()),
splinePathId(0)
splinePathId(0), formulaBaseHeight(0)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
InitFormulaUI(ui);
labelEditNamePoint = ui->labelEditNamePoint;
this->formulaBaseHeight = ui->plainTextEditFormula->height();
InitOkCancel(ui);
flagFormula = false;
@ -60,7 +59,8 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSplinePath::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSplinePath::DeployFormulaTextEdit);
}
//---------------------------------------------------------------------------------------------------------------------
@ -88,7 +88,13 @@ void DialogCutSplinePath::setPointName(const QString &value)
void DialogCutSplinePath::setFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
ui->lineEditFormula->setText(formula);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
{
this->DeployFormulaTextEdit();
}
ui->plainTextEditFormula->setPlainText(formula);
}
//---------------------------------------------------------------------------------------------------------------------
@ -126,7 +132,14 @@ void DialogCutSplinePath::ChoosedObject(quint32 id, const SceneObject &type)
void DialogCutSplinePath::DialogAccepted()
{
pointName = ui->lineEditNamePoint->text();
formula = ui->lineEditFormula->text();
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
splinePathId = getCurrentObjectId(ui->comboBoxSplinePath);
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::DeployFormulaTextEdit()
{
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}

View File

@ -61,6 +61,10 @@ public slots:
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
private:
Q_DISABLE_COPY(DialogCutSplinePath)
@ -75,6 +79,9 @@ private:
/** @brief splinePathId keep id of splinePath */
quint32 splinePathId;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>605</width>
<width>464</width>
<height>499</height>
</rect>
</property>
@ -67,17 +67,17 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="toolTip">
<string>Formula for the calculation of the curve length</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHere">
@ -140,6 +140,60 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>

View File

@ -170,27 +170,6 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
name = splPath->name();
break;
}
case (Tool::ArrowTool):
case (Tool::SinglePointTool):
case (Tool::EndLineTool):
case (Tool::LineTool):
case (Tool::AlongLineTool):
case (Tool::ShoulderPointTool):
case (Tool::NormalTool):
case (Tool::BisectorTool):
case (Tool::LineIntersectTool):
case (Tool::SplineTool):
case (Tool::CutSplineTool):
case (Tool::CutArcTool):
case (Tool::ArcTool):
case (Tool::SplinePathTool):
case (Tool::CutSplinePathTool):
case (Tool::PointOfContact):
case (Tool::DetailTool):
case (Tool::Height):
case (Tool::Triangle):
case (Tool::PointOfIntersection):
case (Tool::UnionDetails):
default:
qDebug()<<"Got wrong tools. Ignore.";
break;

View File

@ -31,24 +31,23 @@
//---------------------------------------------------------------------------------------------------------------------
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString())
:DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString()), formulaBaseHeight(0)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResult;
lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelFormula;
InitFormulaUI(ui);
this->formulaBaseHeight = ui->plainTextEditFormula->height();
InitOkCancel(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);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEditWrongFormula::FormulaChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEditWrongFormula::DeployFormulaTextEdit);
//Disable Qt::WaitCursor
#ifndef QT_NO_CURSOR
@ -68,7 +67,8 @@ DialogEditWrongFormula::~DialogEditWrongFormula()
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::DialogAccepted()
{
formula = ui->lineEditFormula->text();
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
emit DialogClosed(QDialog::Accepted);
accepted();
}
@ -80,6 +80,12 @@ void DialogEditWrongFormula::DialogRejected()
rejected();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::DeployFormulaTextEdit()
{
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::CheckState()
{
@ -91,7 +97,13 @@ void DialogEditWrongFormula::CheckState()
void DialogEditWrongFormula::setFormula(const QString &value)
{
formula = qApp->FormulaToUser(value);
ui->lineEditFormula->setText(formula);
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
{
this->DeployFormulaTextEdit();
}
ui->plainTextEditFormula->setPlainText(formula);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -56,6 +56,10 @@ public:
public slots:
virtual void DialogAccepted();
virtual void DialogRejected();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
protected:
virtual void CheckState();
private:
@ -64,6 +68,9 @@ private:
/** @brief formula string with formula */
QString formula;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
};

View File

@ -6,305 +6,357 @@
<rect>
<x>0</x>
<y>0</y>
<width>607</width>
<width>507</width>
<height>535</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit wrong formula</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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/>
<widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wordWrap">
<bool>true</bool>
<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="QDialogButtonBox" name="buttonBox">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</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>
<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="labelResultCalculation">
<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">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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="MinimumExpanding">
<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>
</widget>
<resources>

View File

@ -44,12 +44,9 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
InitFormulaUI(ui);
labelEditNamePoint = ui->labelEditNamePoint;
this->formulaBaseHeight=ui->plainTextEditFormula->height();
this->formulaBaseHeight = ui->plainTextEditFormula->height();
InitOkCancelApply(ui);
flagFormula = false;
@ -67,10 +64,6 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEndLine::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEndLine::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -82,20 +75,7 @@ void DialogEndLine::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGENDLINE_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGENDLINE_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -31,8 +31,6 @@
#include "dialogtool.h"
#define DIALOGENDLINE_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogEndLine;

View File

@ -189,8 +189,9 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../share/resources/theme.qrc">
<normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</normaloff>:/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png</iconset>
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
@ -331,7 +332,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowRightUp.png</normaloff>:/icon/24x24/arrowRightUp.png</iconset>
<normaloff>:/icon/32x32/arrowRightUp.png</normaloff>:/icon/32x32/arrowRightUp.png</iconset>
</property>
<property name="iconSize">
<size>
@ -348,7 +349,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowLeftUp.png</normaloff>:/icon/24x24/arrowLeftUp.png</iconset>
<normaloff>:/icon/32x32/arrowLeftUp.png</normaloff>:/icon/32x32/arrowLeftUp.png</iconset>
</property>
<property name="iconSize">
<size>
@ -365,7 +366,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowLeft.png</normaloff>:/icon/24x24/arrowLeft.png</iconset>
<normaloff>:/icon/32x32/arrowLeft.png</normaloff>:/icon/32x32/arrowLeft.png</iconset>
</property>
<property name="iconSize">
<size>
@ -382,7 +383,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowRight.png</normaloff>:/icon/24x24/arrowRight.png</iconset>
<normaloff>:/icon/32x32/arrowRight.png</normaloff>:/icon/32x32/arrowRight.png</iconset>
</property>
<property name="iconSize">
<size>
@ -405,7 +406,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowUp.png</normaloff>:/icon/24x24/arrowUp.png</iconset>
<normaloff>:/icon/32x32/arrowUp.png</normaloff>:/icon/32x32/arrowUp.png</iconset>
</property>
<property name="iconSize">
<size>
@ -422,7 +423,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowDown.png</normaloff>:/icon/24x24/arrowDown.png</iconset>
<normaloff>:/icon/32x32/arrowDown.png</normaloff>:/icon/32x32/arrowDown.png</iconset>
</property>
<property name="iconSize">
<size>
@ -439,7 +440,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowLeftDown.png</normaloff>:/icon/24x24/arrowLeftDown.png</iconset>
<normaloff>:/icon/32x32/arrowLeftDown.png</normaloff>:/icon/32x32/arrowLeftDown.png</iconset>
</property>
<property name="iconSize">
<size>
@ -456,7 +457,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowRightDown.png</normaloff>:/icon/24x24/arrowRightDown.png</iconset>
<normaloff>:/icon/32x32/arrowRightDown.png</normaloff>:/icon/32x32/arrowRightDown.png</iconset>
</property>
<property name="iconSize">
<size>
@ -677,7 +678,6 @@
</tabstops>
<resources>
<include location="../../share/resources/icon.qrc"/>
<include location="../../share/resources/theme.qrc"/>
</resources>
<connections>
<connection>

View File

@ -41,14 +41,11 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
{
ui->setupUi(this);
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
InitFormulaUI(ui);
labelEditNamePoint = ui->labelEditNamePoint;
this->formulaBaseHeight = ui->plainTextEditFormula->height();
InitOkCancelApply(ui);
this->formulaBaseHeight=ui->plainTextEditFormula->height();
flagFormula = false;
flagName = false;
CheckState();
@ -65,9 +62,6 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogNormal::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogNormal::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -79,18 +73,7 @@ void DialogNormal::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGNORMAL_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGNORMAL_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next"));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down"));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGNORMAL_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogNormal;

View File

@ -154,6 +154,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -183,7 +189,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
@ -345,7 +351,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowRightUp.png</normaloff>:/icon/24x24/arrowRightUp.png</iconset>
<normaloff>:/icon/32x32/arrowRightUp.png</normaloff>:/icon/32x32/arrowRightUp.png</iconset>
</property>
<property name="iconSize">
<size>
@ -362,7 +368,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowLeftUp.png</normaloff>:/icon/24x24/arrowLeftUp.png</iconset>
<normaloff>:/icon/32x32/arrowLeftUp.png</normaloff>:/icon/32x32/arrowLeftUp.png</iconset>
</property>
<property name="iconSize">
<size>
@ -379,7 +385,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowLeft.png</normaloff>:/icon/24x24/arrowLeft.png</iconset>
<normaloff>:/icon/32x32/arrowLeft.png</normaloff>:/icon/32x32/arrowLeft.png</iconset>
</property>
<property name="iconSize">
<size>
@ -396,7 +402,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowRight.png</normaloff>:/icon/24x24/arrowRight.png</iconset>
<normaloff>:/icon/32x32/arrowRight.png</normaloff>:/icon/32x32/arrowRight.png</iconset>
</property>
<property name="iconSize">
<size>
@ -419,7 +425,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowUp.png</normaloff>:/icon/24x24/arrowUp.png</iconset>
<normaloff>:/icon/32x32/arrowUp.png</normaloff>:/icon/32x32/arrowUp.png</iconset>
</property>
<property name="iconSize">
<size>
@ -436,7 +442,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowDown.png</normaloff>:/icon/24x24/arrowDown.png</iconset>
<normaloff>:/icon/32x32/arrowDown.png</normaloff>:/icon/32x32/arrowDown.png</iconset>
</property>
<property name="iconSize">
<size>
@ -453,7 +459,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowLeftDown.png</normaloff>:/icon/24x24/arrowLeftDown.png</iconset>
<normaloff>:/icon/32x32/arrowLeftDown.png</normaloff>:/icon/32x32/arrowLeftDown.png</iconset>
</property>
<property name="iconSize">
<size>
@ -470,7 +476,7 @@
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/arrowRightDown.png</normaloff>:/icon/24x24/arrowRightDown.png</iconset>
<normaloff>:/icon/32x32/arrowRightDown.png</normaloff>:/icon/32x32/arrowRightDown.png</iconset>
</property>
<property name="iconSize">
<size>

View File

@ -43,36 +43,18 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
{
ui->setupUi(this);
InitVariables(ui);
listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandardTable = ui->radioButtonStandardTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
InitFormulaUI(ui);
labelEditNamePoint = ui->labelEditNamePoint;
this->formulaBaseHeight = ui->plainTextEditFormula->height();
this->formulaBaseHeight=ui->plainTextEditFormula->height();
InitOkCancelApply(ui);
/* bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCansel != nullptr);
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
*/
flagFormula = false;
flagName = false;
CheckState();
FillComboBoxPoints(ui->comboBoxCenter);
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
FillComboBoxPoints(ui->comboBoxCenter);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogPointOfContact::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal);
@ -97,9 +79,6 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogPointOfContact::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogPointOfContact::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -111,20 +90,7 @@ void DialogPointOfContact::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -32,7 +32,6 @@
#include "ui_dialogpointofcontact.h"
#include "dialogtool.h"
#define DIALOGPOINTOFCONTACT_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogPointOfContact;

View File

@ -154,6 +154,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -183,9 +189,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<normaloff/>
</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>

View File

@ -44,6 +44,7 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWi
{
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancel(ui);
flagName = false;
CheckState();

View File

@ -43,16 +43,12 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0)
{
ui->setupUi(this);
number = 0;
InitVariables(ui);
labelResultCalculation = ui->labelResultCalculation;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
InitFormulaUI(ui);
labelEditNamePoint = ui->labelEditNamePoint;
this->formulaBaseHeight = ui->plainTextEditFormula->height();
InitOkCancelApply(ui);
this->formulaBaseHeight=ui->plainTextEditFormula->height();
flagFormula = false;
flagName = false;
CheckState();
@ -68,9 +64,6 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogShoulderPoint::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogShoulderPoint::DeployFormulaTextEdit);
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
//---------------------------------------------------------------------------------------------------------------------
@ -82,20 +75,7 @@ void DialogShoulderPoint::FormulaTextChanged()
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::DeployFormulaTextEdit()
{
if (ui->plainTextEditFormula->height() < DIALOGSHOULDERPOINT_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOGSHOULDERPOINT_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(this->formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/icons/win.icon.theme/16x16/actions/go-down.png")));
}
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -31,7 +31,6 @@
#include "dialogtool.h"
#define DIALOGSHOULDERPOINT_MAX_FORMULA_HEIGHT 64
namespace Ui
{
class DialogShoulderPoint;

View File

@ -154,6 +154,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_formula">
<item>
<widget class="QPlainTextEdit" name="plainTextEditFormula">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -183,9 +189,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down.png">
<normaloff/>
</iconset>
<iconset theme="go-down"/>
</property>
<property name="iconSize">
<size>

View File

@ -36,8 +36,7 @@
* @param parent parent widget
*/
DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSinglePoint), name(QString()),
point(QPointF())
:DialogTool(data, parent), ui(new Ui::DialogSinglePoint), name(QString()), point(QPointF())
{
ui->setupUi(this);
ui->doubleSpinBoxX->setRange(0, qApp->fromPixel(SceneSize));

View File

@ -39,8 +39,8 @@
* @param parent parent widget
*/
DialogSpline::DialogSpline(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0),
kAsm1(1), kAsm2(1), kCurve(1)
:DialogTool(data, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0), kAsm1(1),
kAsm2(1), kCurve(1)
{
ui->setupUi(this);
InitOkCancel(ui);

View File

@ -41,7 +41,6 @@
#include <QShowEvent>
#include <QComboBox>
#include <QListWidgetItem>
#include <QLineEdit>
#include <QTextCursor>
#include <QPlainTextEdit>
#include <QLabel>
@ -51,6 +50,8 @@
#include <QListWidget>
#include <QRadioButton>
#define DIALOGARC_MAX_FORMULA_HEIGHT 64
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogTool create dialog
@ -59,7 +60,7 @@
*/
DialogTool::DialogTool(const VContainer *data, QWidget *parent)
:QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(nullptr),
bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), lineEditFormula(nullptr), plainTextEditFormula(nullptr),
bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), plainTextEditFormula(nullptr),
listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr),
labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr),
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
@ -385,12 +386,6 @@ void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidg
QTextCursor cursor = plainTextEdit->textCursor();
cursor.insertText(item->text());
plainTextEdit->setTextCursor(cursor);
/*
int pos = lineEdit->cursorPosition();
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
lineEdit->setFocus();
lineEdit->setCursorPosition(pos + item->text().size());
*/
}
//---------------------------------------------------------------------------------------------------------------------
@ -437,19 +432,18 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Eval evaluate formula and show result
* @param edit lineEdit of formula
* @param text formula
* @param flag flag state of formula
* @param timer timer of formula
* @param label label for signal error
*/
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label)
{
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(label != nullptr);
SCASSERT(labelEditFormula != nullptr);
QPalette palette = labelEditFormula->palette();
if (edit->text().isEmpty())
if (text.isEmpty())
{
flag = false;
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
@ -458,66 +452,8 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
{
try
{
const QString formula = qApp->FormulaFromUser(edit->text());
Calculator *cal = new Calculator(data);
const qreal result = cal->EvalFormula(formula);
delete cal;
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) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
}
else
{
QLocale loc = QLocale(QLocale::C);
label->setText(loc.toString(result) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
}
flag = true;
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
emit ToolTip("");
}
catch (qmu::QmuParserError &e)
{
label->setText(tr("Error"));
flag = false;
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
emit ToolTip("Parser error: "+e.GetMsg());
qDebug() << "\nMath parser error:\n"
<< "--------------------------------------\n"
<< "Message: " << e.GetMsg() << "\n"
<< "Expression: " << e.GetExpr() << "\n"
<< "--------------------------------------";
}
}
CheckState();
timer->stop();
labelEditFormula->setPalette(palette);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *label)
{
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(label != nullptr);
SCASSERT(labelEditFormula != nullptr);
QPalette palette = labelEditFormula->palette();
if (edit->toPlainText().isEmpty())
{
flag = false;
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
}
else
{
try
{
// Replace line return with spaces for calc
QString formula = edit->toPlainText();
// Replace line return with spaces for calc if exist
QString formula = text;
formula.replace("\n", " ");
formula = qApp->FormulaFromUser(formula);
Calculator *cal = new Calculator(data);
@ -633,7 +569,7 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
{
SCASSERT(box != nullptr);
qint32 index = box->currentIndex();
Q_ASSERT(index != -1);
SCASSERT(index != -1);
if (index != -1)
{
return qvariant_cast<quint32>(box->itemData(index));
@ -660,6 +596,27 @@ bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &
return false;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight)
{
SCASSERT(formula != nullptr);
SCASSERT(buttonGrowLength != nullptr)
if (formula->height() < DIALOGARC_MAX_FORMULA_HEIGHT)
{
formula->setFixedHeight(DIALOGARC_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
buttonGrowLength->setIcon(QIcon::fromTheme("go-next",
QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
}
else
{
formula->setFixedHeight(formulaBaseHeight);
//Set icon from theme (internal for Windows system)
buttonGrowLength->setIcon(QIcon::fromTheme("go-down",
QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief FillList fill combobox list
@ -759,7 +716,7 @@ void DialogTool::DialogRejected()
*/
void DialogTool::FormulaChanged()
{
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
QPlainTextEdit* edit = qobject_cast<QPlainTextEdit*>(sender());
if (edit)
{
ValFormulaChanged(flagFormula, edit, timerFormula);
@ -863,7 +820,7 @@ void DialogTool::EvalFormula()
{
SCASSERT(plainTextEditFormula != nullptr);
SCASSERT(labelResultCalculation != nullptr);
Eval(plainTextEditFormula, flagFormula, timerFormula, labelResultCalculation);
Eval(plainTextEditFormula->toPlainText(), flagFormula, timerFormula, labelResultCalculation);
}
//---------------------------------------------------------------------------------------------------------------------
@ -956,12 +913,6 @@ void DialogTool::PutVal(QListWidgetItem *item)
QTextCursor cursor = plainTextEditFormula->textCursor();
cursor.insertText(item->text());
plainTextEditFormula->setTextCursor(cursor);
/*int pos = plainTextEditFormula->cursorPosition();
lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(),
item->text()));
lineEditFormula->setFocus();
lineEditFormula->setCursorPosition(pos + item->text().size());
*/
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -39,7 +39,6 @@ class QLabel;
class QRadioButton;
class QComboBox;
class QListWidgetItem;
class QLineEdit;
class QListWidget;
class VContainer;
class QPlainTextEdit;
@ -134,8 +133,7 @@ protected:
/** @brief spinBoxAngle spinbox for angle */
QDoubleSpinBox *spinBoxAngle;
/** @brief lineEditFormula linEdit for formula */
QLineEdit *lineEditFormula;
/** @brief plainTextEditFormula formula */
QPlainTextEdit *plainTextEditFormula;
/** @brief listWidget listWidget with variables */
QListWidget *listWidget;
@ -194,8 +192,7 @@ protected:
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer);
void Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *label);
void Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label);
void Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label);
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const;
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id,
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
@ -206,6 +203,7 @@ protected:
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
quint32 getCurrentObjectId(QComboBox *box) const;
bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip);
void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight);
template <typename T>
void InitArrow(T *ui)
{
@ -278,6 +276,17 @@ protected:
SCASSERT(bCancel != nullptr);
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
}
template <typename T>
/**
* @brief InitFormulaUI initialise ui object for formula fild
* @param ui Dialog container
*/
void InitFormulaUI(T *ui)
{
labelResultCalculation = ui->labelResultCalculation;
plainTextEditFormula = ui->plainTextEditFormula;
labelEditFormula = ui->labelEditFormula;
}
/**
* @brief associatedTool vdrawtool associated with opened dialog.
*/

View File

@ -43,6 +43,7 @@ DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
{
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancel(ui);
flagName = false;
CheckState();

View File

@ -132,27 +132,6 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
}
}
break;
case (Tool::ArrowTool):
case (Tool::SinglePointTool):
case (Tool::EndLineTool):
case (Tool::LineTool):
case (Tool::AlongLineTool):
case (Tool::ShoulderPointTool):
case (Tool::NormalTool):
case (Tool::BisectorTool):
case (Tool::LineIntersectTool):
case (Tool::SplineTool):
case (Tool::CutSplineTool):
case (Tool::CutArcTool):
case (Tool::ArcTool):
case (Tool::SplinePathTool):
case (Tool::CutSplinePathTool):
case (Tool::PointOfContact):
case (Tool::DetailTool):
case (Tool::Height):
case (Tool::Triangle):
case (Tool::PointOfIntersection):
case (Tool::UnionDetails):
default:
qDebug()<<"Get wrong tool type. Ignore."<< static_cast<char>(detail.at(i).getTypeTool());
break;
@ -395,7 +374,7 @@ QVector<QPointF> VEquidistant::CheckLoops(const QVector<QPointF> &points)
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VEquidistant::GetReversePoint(const QVector<QPointF> &points)
{
Q_ASSERT(points.size() > 0);
SCASSERT(points.size() > 0);
QVector<QPointF> reversePoints;
for (qint32 i = points.size() - 1; i >= 0; --i)
{
@ -407,7 +386,7 @@ QVector<QPointF> VEquidistant::GetReversePoint(const QVector<QPointF> &points)
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)
{
Q_ASSERT(width > 0);
SCASSERT(width > 0);
QVector<QPointF> points;
if (line1.p2() != line2.p2())
{
@ -457,7 +436,7 @@ QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2
//---------------------------------------------------------------------------------------------------------------------
QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width)
{
Q_ASSERT(width > 0);
SCASSERT(width > 0);
QLineF paralel = QLineF (SingleParallelPoint(line, 90, width), SingleParallelPoint(QLineF(line.p2(), line.p1()),
-90, width));
return paralel;
@ -466,7 +445,7 @@ QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width)
//---------------------------------------------------------------------------------------------------------------------
QPointF VEquidistant::SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width)
{
Q_ASSERT(width > 0);
SCASSERT(width > 0);
QLineF pLine = line;
pLine.setAngle( pLine.angle() + angle );
pLine.setLength( width );

View File

@ -96,6 +96,7 @@ MainWindow::MainWindow(QWidget *parent)
doc = new VPattern(pattern, &mode, sceneDraw, sceneDetails);
connect(doc, &VPattern::ClearMainWindow, this, &MainWindow::Clear);
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile);
connect(qApp->getUndoStack(), &QUndoStack::cleanChanged, this, &MainWindow::PatternWasModified);
@ -1565,14 +1566,8 @@ void MainWindow::FullParseFile()
#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();
QMessageBox::critical(this, tr("Critical error!"), tr("Error parsing file (std::bad_alloc)."), QMessageBox::Ok,
QMessageBox::Ok);
#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(Qt::WaitCursor);
#endif

View File

@ -8,14 +8,6 @@
<file>icon/32x32/option_draw.png</file>
<file>icon/32x32/table.png</file>
<file>icon/24x24/putHere.png</file>
<file>icon/24x24/arrowDown.png</file>
<file>icon/24x24/arrowUp.png</file>
<file>icon/24x24/arrowRightUp.png</file>
<file>icon/24x24/arrowRightDown.png</file>
<file>icon/24x24/arrowRight.png</file>
<file>icon/24x24/arrowLeftUp.png</file>
<file>icon/24x24/arrowLeftDown.png</file>
<file>icon/24x24/arrowLeft.png</file>
<file>icon/24x24/equal.png</file>
<file>icon/32x32/segment.png</file>
<file>icon/32x32/line.png</file>
@ -26,7 +18,6 @@
<file>icon/32x32/intersect.png</file>
<file>icon/32x32/spline.png</file>
<file>icon/32x32/arc.png</file>
<file>icon/24x24/putHereLeft.png</file>
<file>icon/32x32/splinePath.png</file>
<file>icon/32x32/history.png</file>
<file>icon/32x32/put_after.png</file>
@ -55,5 +46,14 @@
<file>icon/flags/nl.png</file>
<file>icon/flags/it.png</file>
<file>icon/community_config.png</file>
<file>icon/32x32/arrowLeft.png</file>
<file>icon/32x32/arrowRight.png</file>
<file>icon/32x32/arrowRightDown.png</file>
<file>icon/32x32/arrowDown.png</file>
<file>icon/32x32/arrowRightUp.png</file>
<file>icon/32x32/arrowLeftDown.png</file>
<file>icon/32x32/arrowUp.png</file>
<file>icon/32x32/arrowLeftUp.png</file>
<file>icon/32x32/putHereLeft.png</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 893 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -40,5 +40,8 @@
<file alias="24x24/actions/edit-redo.png">icons/win.icon.theme/24x24/actions/edit-redo.png</file>
<file alias="32x32/actions/edit-redo.png">icons/win.icon.theme/32x32/actions/edit-redo.png</file>
<file alias="32x32/actions/edit-undo.png">icons/win.icon.theme/32x32/actions/edit-undo.png</file>
<file alias="16x16/actions/go-down.png">icons/win.icon.theme/16x16/actions/go-down.png</file>
<file alias="24x24/actions/go-down.png">icons/win.icon.theme/24x24/actions/go-down.png</file>
<file alias="32x32/actions/go-down.png">icons/win.icon.theme/32x32/actions/go-down.png</file>
</qresource>
</RCC>

View File

@ -164,41 +164,51 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
VSplinePath *splPath1 = new VSplinePath();
VSplinePath *splPath2 = new VSplinePath();
for (qint32 i = 0; i < splPath->CountPoint(); i++)
{
if (i <= p1 && i < p2)
{
if (i == p1)
{
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(),
spl1.GetAngle1()));
VSplinePoint cutPoint;
if (typeCreation == Source::FromGui)
{
cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(), spl1.GetAngle2()+180,
spl1.GetAngle2());
}
else
{
cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(), spl2.GetKasm1(),
spl1.GetAngle2()+180);
}
splPath1->append(cutPoint);
continue;
}
splPath1->append(splPath->at(i));
}
else
{
if (i == p2)
{
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180,
spl2.GetKasm1(), spl2.GetAngle1());
splPath2->append(cutPoint);
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(),
spl2.GetAngle2()+180));
continue;
}
splPath2->append(splPath->at(i));
}
}
splPath1->setMaxCountPoints(splPath->CountPoint());
splPath2->setMaxCountPoints(splPath->CountPoint());
if (typeCreation == Source::FromGui)
{
for (qint32 i = 0; i < splPath->CountPoint(); i++)
{
if (i <= p1 && i < p2)
{
if (i == p1)
{
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(),
spl1.GetAngle1()));
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(),
spl1.GetAngle2()+180, spl1.GetAngle2());
splPath1->append(cutPoint);
continue;
}
splPath1->append(splPath->at(i));
}
else
{
if (i == p2)
{
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180,
spl2.GetKasm1(), spl2.GetAngle1());
splPath2->append(cutPoint);
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(),
spl2.GetAngle2()+180));
continue;
}
splPath2->append(splPath->at(i));
}
}
splPath1->setMaxCountPoints(splPath->CountPoint());
splPath2->setMaxCountPoints(splPath->CountPoint());
splPath1id = data->AddGObject(splPath1);
data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength()));
@ -207,39 +217,6 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
}
else
{
for (qint32 i = 0; i < splPath->CountPoint(); i++)
{
if (i <= p1 && i < p2)
{
if (i == p1)
{
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(),
spl1.GetAngle1()));
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(),
spl2.GetKasm1(), spl1.GetAngle2()+180);
splPath1->append(cutPoint);
continue;
}
splPath1->append(splPath->at(i));
}
else
{
if (i == p2)
{
const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180,
spl2.GetKasm1(), spl2.GetAngle1());
splPath2->append(cutPoint);
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(),
spl2.GetAngle2()+180));
continue;
}
splPath2->append(splPath->at(i));
}
}
splPath1->setMaxCountPoints(splPath->CountPoint());
splPath2->setMaxCountPoints(splPath->CountPoint());
data->UpdateGObject(splPath1id, splPath1);
data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength()));
@ -251,6 +228,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
doc->UpdateToolData(id, data);
}
}
VDrawTool::AddRecord(id, Tool::CutSplinePathTool, doc);
if (parse == Document::FullParse)
{

View File

@ -92,27 +92,6 @@ VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, con
case (Tool::NodeSplinePath):
InitTool<VNodeSplinePath>(scene, detail.at(i));
break;
case (Tool::ArrowTool):
case (Tool::SinglePointTool):
case (Tool::EndLineTool):
case (Tool::LineTool):
case (Tool::AlongLineTool):
case (Tool::ShoulderPointTool):
case (Tool::NormalTool):
case (Tool::BisectorTool):
case (Tool::LineIntersectTool):
case (Tool::SplineTool):
case (Tool::CutSplineTool):
case (Tool::CutArcTool):
case (Tool::ArcTool):
case (Tool::SplinePathTool):
case (Tool::CutSplinePathTool):
case (Tool::PointOfContact):
case (Tool::DetailTool):
case (Tool::Height):
case (Tool::Triangle):
case (Tool::PointOfIntersection):
case (Tool::UnionDetails):
default:
qDebug()<<"Get wrong tool type. Ignore.";
break;
@ -198,27 +177,6 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
VNodeSplinePath::Create(doc, data, id, detail.at(i).getId(), Document::FullParse, Source::FromGui);
}
break;
case (Tool::ArrowTool):
case (Tool::SinglePointTool):
case (Tool::EndLineTool):
case (Tool::LineTool):
case (Tool::AlongLineTool):
case (Tool::ShoulderPointTool):
case (Tool::NormalTool):
case (Tool::BisectorTool):
case (Tool::LineIntersectTool):
case (Tool::SplineTool):
case (Tool::CutSplineTool):
case (Tool::CutArcTool):
case (Tool::ArcTool):
case (Tool::SplinePathTool):
case (Tool::CutSplinePathTool):
case (Tool::PointOfContact):
case (Tool::DetailTool):
case (Tool::Height):
case (Tool::Triangle):
case (Tool::PointOfIntersection):
case (Tool::UnionDetails):
default:
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
break;
@ -511,27 +469,6 @@ void VToolDetail::AddNode(VPattern *doc, QDomElement &domElement, const VNodeDet
case (Tool::NodeSplinePath):
doc->SetAttribute(nod, AttrType, NodeSplinePath);
break;
case (Tool::ArrowTool):
case (Tool::SinglePointTool):
case (Tool::EndLineTool):
case (Tool::LineTool):
case (Tool::AlongLineTool):
case (Tool::ShoulderPointTool):
case (Tool::NormalTool):
case (Tool::BisectorTool):
case (Tool::LineIntersectTool):
case (Tool::SplineTool):
case (Tool::CutSplineTool):
case (Tool::CutArcTool):
case (Tool::ArcTool):
case (Tool::SplinePathTool):
case (Tool::CutSplinePathTool):
case (Tool::PointOfContact):
case (Tool::DetailTool):
case (Tool::Height):
case (Tool::Triangle):
case (Tool::PointOfIntersection):
case (Tool::UnionDetails):
default:
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
break;

View File

@ -248,27 +248,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
}
}
break;
case (Tool::ArrowTool):
case (Tool::SinglePointTool):
case (Tool::EndLineTool):
case (Tool::LineTool):
case (Tool::AlongLineTool):
case (Tool::ShoulderPointTool):
case (Tool::NormalTool):
case (Tool::BisectorTool):
case (Tool::LineIntersectTool):
case (Tool::SplineTool):
case (Tool::CutSplineTool):
case (Tool::CutArcTool):
case (Tool::ArcTool):
case (Tool::SplinePathTool):
case (Tool::CutSplinePathTool):
case (Tool::PointOfContact):
case (Tool::DetailTool):
case (Tool::Height):
case (Tool::Triangle):
case (Tool::PointOfIntersection):
case (Tool::UnionDetails):
default:
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
break;
@ -430,27 +409,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
}
}
break;
case (Tool::ArrowTool):
case (Tool::SinglePointTool):
case (Tool::EndLineTool):
case (Tool::LineTool):
case (Tool::AlongLineTool):
case (Tool::ShoulderPointTool):
case (Tool::NormalTool):
case (Tool::BisectorTool):
case (Tool::LineIntersectTool):
case (Tool::SplineTool):
case (Tool::CutSplineTool):
case (Tool::CutArcTool):
case (Tool::ArcTool):
case (Tool::SplinePathTool):
case (Tool::CutSplinePathTool):
case (Tool::PointOfContact):
case (Tool::DetailTool):
case (Tool::Height):
case (Tool::Triangle):
case (Tool::PointOfIntersection):
case (Tool::UnionDetails):
default:
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
break;
@ -835,27 +793,6 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node
case (Tool::NodeSplinePath):
doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
break;
case (Tool::ArrowTool):
case (Tool::SinglePointTool):
case (Tool::EndLineTool):
case (Tool::LineTool):
case (Tool::AlongLineTool):
case (Tool::ShoulderPointTool):
case (Tool::NormalTool):
case (Tool::BisectorTool):
case (Tool::LineIntersectTool):
case (Tool::SplineTool):
case (Tool::CutSplineTool):
case (Tool::CutArcTool):
case (Tool::ArcTool):
case (Tool::SplinePathTool):
case (Tool::CutSplinePathTool):
case (Tool::PointOfContact):
case (Tool::DetailTool):
case (Tool::Height):
case (Tool::Triangle):
case (Tool::PointOfIntersection):
case (Tool::UnionDetails):
default:
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
break;

View File

@ -34,9 +34,9 @@ AddPatternPiece::AddPatternPiece(const QDomElement &xml, VPattern *doc, const QS
QUndoCommand *parent)
: QObject(), QUndoCommand(parent), xml(xml), doc(doc), namePP(namePP), redoFlag(false), mPath(mPath)
{
Q_ASSERT(xml.isNull() == false);
Q_ASSERT(namePP.isEmpty() == false);
Q_ASSERT(mPath.isEmpty() == false);
SCASSERT(xml.isNull() == false);
SCASSERT(namePP.isEmpty() == false);
SCASSERT(mPath.isEmpty() == false);
setText(tr("Add pattern piece %1").arg(namePP));
}

View File

@ -0,0 +1,219 @@
/************************************************************************
**
** @file vabstractmeasurements.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 18 6, 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 "vabstractmeasurements.h"
const QString VAbstractMeasurements::TagUnit = QStringLiteral("unit");
const QString VAbstractMeasurements::AttrValue = QStringLiteral("value");
//---------------------------------------------------------------------------------------------------------------------
VAbstractMeasurements::VAbstractMeasurements(VContainer *data)
:VDomDocument(data)
{
SCASSERT(data != nullptr)
}
//---------------------------------------------------------------------------------------------------------------------
VAbstractMeasurements::~VAbstractMeasurements()
{}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Measurements help read all measurements.
*
* Virtual method that keep all common measurements name. Measurements height and size create in different way in
* individual and standard measurements, see VIndividualMeasurements::Measurements().
*/
void VAbstractMeasurements::Measurements()
{
//head and neck
Measurement(headGirth_M);
Measurement(midNeckGirth_M);
Measurement(neckBaseGirth_M);
Measurement(headAndNeckLength_M);
//torso
Measurement(centerFrontWaistLength_M);
Measurement(centerBackWaistLength_M);
Measurement(shoulderLength_M);
Measurement(sideWaistLength_M);
Measurement(trunkLength_M);
Measurement(shoulderGirth_M);
Measurement(upperChestGirth_M);
Measurement(bustGirth_M);
Measurement(underBustGirth_M);
Measurement(waistGirth_M);
Measurement(highHipGirth_M);
Measurement(hipGirth_M);
Measurement(upperFrontChestWidth_M);
Measurement(frontChestWidth_M);
Measurement(acrossFrontShoulderWidth_M);
Measurement(acrossBackShoulderWidth_M);
Measurement(upperBackWidth_M);
Measurement(backWidth_M);
Measurement(bustpointToBustpoint_M);
Measurement(halterBustpointToBustpoint_M);
Measurement(neckToBustpoint_M);
Measurement(crotchLength_M);
Measurement(riseHeight_M);
Measurement(shoulderDrop_M);
Measurement(shoulderSlopeDegrees_M);
Measurement(frontShoulderSlopeLength_M);
Measurement(backShoulderSlopeLength_M);
Measurement(frontShoulderToWaistLength_M);
Measurement(backShoulderToWaistLength_M);
Measurement(frontNeckArc_M);
Measurement(backNeckArc_M);
Measurement(frontUpperChestArc_M);
Measurement(backUpperChestArc_M);
Measurement(frontWaistArc_M);
Measurement(backWaistArc_M);
Measurement(frontUpperHipArc_M);
Measurement(backUpperHipArc_M);
Measurement(frontHipArc_M);
Measurement(backHipArc_M);
Measurement(chestSlope_M);
Measurement(backSlope_M);
Measurement(frontWaistSlope_M);
Measurement(backWaistSlope_M);
Measurement(frontNeckToUpperChestHeight_M);
Measurement(frontNeckToBustHeight_M);
//arm
Measurement(armscyeGirth_M);
Measurement(elbowGirth_M);
Measurement(upperArmGirth_M);
Measurement(wristGirth_M);
Measurement(scyeDepth_M);
Measurement(shoulderAndArmLength_M);
Measurement(underarmLength_M);
Measurement(cervicaleToWristLength_M);
Measurement(shoulderToElbowLength_M);
Measurement(armLength_M);
//hand
Measurement(handWidth_M);
Measurement(handLength_M);
Measurement(handGirth_M);
//leg
Measurement(thighGirth_M);
Measurement(midThighGirth_M);
Measurement(kneeGirth_M);
Measurement(calfGirth_M);
Measurement(ankleGirth_M);
Measurement(kneeHeight_M);
Measurement(ankleHeight_M);
//foot
Measurement(footWidth_M);
Measurement(footLength_M);
//heights
Measurement(cervicaleHeight_M);
Measurement(cervicaleToKneeHeight_M);
Measurement(waistHeight_M);
Measurement(highHipHeight_M);
Measurement(hipHeight_M);
Measurement(waistToHipHeight_M);
Measurement(waistToKneeHeight_M);
Measurement(crotchHeight_M);
//extended
Measurement(heightFrontNeckBasePoint_M);
Measurement(heightBaseNeckSidePoint_M);
Measurement(heightShoulderPoint_M);
Measurement(heightNipplePoint_M);
Measurement(heightBackAngleAxilla_M);
Measurement(heightScapularPoint_M);
Measurement(heightUnderButtockFolds_M);
Measurement(hipsExcludingProtrudingAbdomen_M);
Measurement(girthFootInstep_M);
Measurement(sideWaistToFloor_M);
Measurement(frontWaistToFloor_M);
Measurement(arcThroughGroinArea_M);
Measurement(waistToPlaneSeat_M);
Measurement(neckToRadialPoint_M);
Measurement(neckToThirdFinger_M);
Measurement(neckToFirstLineChestCircumference_M);
Measurement(frontWaistLength_M);
Measurement(arcThroughShoulderJoint_M);
Measurement(neckToBackLineChestCircumference_M);
Measurement(waistToNeckSide_M);
Measurement(arcLengthUpperBody_M);
Measurement(chestWidth_M);
Measurement(anteroposteriorDiameterHands_M);
Measurement(heightClavicularPoint_M);
Measurement(heightArmholeSlash_M);
Measurement(slashShoulderHeight_M);
Measurement(halfGirthNeck_M);
Measurement(halfGirthNeckForShirts_M);
Measurement(halfGirthChestFirst_M);
Measurement(halfGirthChestSecond_M);
Measurement(halfGirthChestThird_M);
Measurement(halfGirthWaist_M);
Measurement(halfGirthHipsConsideringProtrudingAbdomen_M);
Measurement(halfGirthHipsExcludingProtrudingAbdomen_M);
Measurement(girthKneeFlexedFeet_M);
Measurement(neckTransverseDiameter_M);
Measurement(frontSlashShoulderHeight_M);
Measurement(neckToFrontWaistLine_M);
Measurement(handVerticalDiameter_M);
Measurement(neckToKneePoint_M);
Measurement(waistToKnee_M);
Measurement(shoulderHeight_M);
Measurement(headHeight_M);
Measurement(bodyPosition_M);
Measurement(arcBehindShoulderGirdle_M);
Measurement(neckToNeckBase_M);
Measurement(depthWaistFirst_M);
Measurement(depthWaistSecond_M);
}
//---------------------------------------------------------------------------------------------------------------------
Unit VAbstractMeasurements::MUnit() const
{
const QString unit = UniqueTagText(TagUnit, UnitCM);
return VDomDocument::StrToUnits(unit);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractMeasurements::Measurement(const QString &tag)
{
const QDomNodeList nodeList = this->elementsByTagName(tag);
if (nodeList.isEmpty())
{
qDebug()<<"Measurement" << tag <<"doesn't exist"<<Q_FUNC_INFO;
return;
}
else
{
const QDomNode domNode = nodeList.at(0);
if (domNode.isNull() == false && domNode.isElement())
{
const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false)
{
ReadMeasurement(domElement, tag);
}
}
}
}

View File

@ -0,0 +1,50 @@
/************************************************************************
**
** @file vabstractmeasurements.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 18 6, 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 VABSTRACTMEASUREMENTS_H
#define VABSTRACTMEASUREMENTS_H
#include "vdomdocument.h"
class VAbstractMeasurements : public VDomDocument
{
public:
VAbstractMeasurements(VContainer *data);
virtual ~VAbstractMeasurements();
virtual void Measurements();
Unit MUnit() const;
static const QString TagUnit;
static const QString AttrValue;
protected:
void Measurement(const QString &tag);
virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag) = 0;
private:
Q_DISABLE_COPY(VAbstractMeasurements)
};
#endif // VABSTRACTMEASUREMENTS_H

View File

@ -30,31 +30,25 @@
#include "../widgets/vapplication.h"
#include <QDate>
const QString VIndividualMeasurements::AttrValue = QStringLiteral("value");
const QString VIndividualMeasurements::TagFamily_name = QStringLiteral("family-name");
const QString VIndividualMeasurements::TagGiven_name = QStringLiteral("given-name");
const QString VIndividualMeasurements::TagBirth_date = QStringLiteral("birth-date");
const QString VIndividualMeasurements::TagSex = QStringLiteral("sex");
const QString VIndividualMeasurements::TagUnit = QStringLiteral("unit");
const QString VIndividualMeasurements::TagEmail = QStringLiteral("email");
const QString VIndividualMeasurements::SexMale = QStringLiteral("male");
const QString VIndividualMeasurements::SexFemale = QStringLiteral("female");
//---------------------------------------------------------------------------------------------------------------------
VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data)
{}
VIndividualMeasurements::VIndividualMeasurements(VContainer *data)
:VAbstractMeasurements(data)
{
SCASSERT(data != nullptr)
}
//---------------------------------------------------------------------------------------------------------------------
VIndividualMeasurements::~VIndividualMeasurements()
{}
//---------------------------------------------------------------------------------------------------------------------
Unit VIndividualMeasurements::MUnit() const
{
const QString unit = UniqueTagText(TagUnit, UnitCM);
return VDomDocument::StrToUnits(unit);
}
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::setUnit(const Unit &unit)
{
@ -64,172 +58,23 @@ void VIndividualMeasurements::setUnit(const Unit &unit)
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::Measurements()
{
//head and neck
Measurement(headGirth_M);
Measurement(midNeckGirth_M);
Measurement(neckBaseGirth_M);
Measurement(headAndNeckLength_M);
//torso
Measurement(centerFrontWaistLength_M);
Measurement(centerBackWaistLength_M);
Measurement(shoulderLength_M);
Measurement(sideWaistLength_M);
Measurement(trunkLength_M);
Measurement(shoulderGirth_M);
Measurement(upperChestGirth_M);
Measurement(bustGirth_M);
Measurement(underBustGirth_M);
Measurement(waistGirth_M);
Measurement(highHipGirth_M);
Measurement(hipGirth_M);
Measurement(upperFrontChestWidth_M);
Measurement(frontChestWidth_M);
Measurement(acrossFrontShoulderWidth_M);
Measurement(acrossBackShoulderWidth_M);
Measurement(upperBackWidth_M);
Measurement(backWidth_M);
Measurement(bustpointToBustpoint_M);
Measurement(halterBustpointToBustpoint_M);
Measurement(neckToBustpoint_M);
Measurement(crotchLength_M);
Measurement(riseHeight_M);
Measurement(shoulderDrop_M);
Measurement(shoulderSlopeDegrees_M);
Measurement(frontShoulderSlopeLength_M);
Measurement(backShoulderSlopeLength_M);
Measurement(frontShoulderToWaistLength_M);
Measurement(backShoulderToWaistLength_M);
Measurement(frontNeckArc_M);
Measurement(backNeckArc_M);
Measurement(frontUpperChestArc_M);
Measurement(backUpperChestArc_M);
Measurement(frontWaistArc_M);
Measurement(backWaistArc_M);
Measurement(frontUpperHipArc_M);
Measurement(backUpperHipArc_M);
Measurement(frontHipArc_M);
Measurement(backHipArc_M);
Measurement(chestSlope_M);
Measurement(backSlope_M);
Measurement(frontWaistSlope_M);
Measurement(backWaistSlope_M);
Measurement(frontNeckToUpperChestHeight_M);
Measurement(frontNeckToBustHeight_M);
//arm
Measurement(armscyeGirth_M);
Measurement(elbowGirth_M);
Measurement(upperArmGirth_M);
Measurement(wristGirth_M);
Measurement(scyeDepth_M);
Measurement(shoulderAndArmLength_M);
Measurement(underarmLength_M);
Measurement(cervicaleToWristLength_M);
Measurement(shoulderToElbowLength_M);
Measurement(armLength_M);
//hand
Measurement(handWidth_M);
Measurement(handLength_M);
Measurement(handGirth_M);
//leg
Measurement(thighGirth_M);
Measurement(midThighGirth_M);
Measurement(kneeGirth_M);
Measurement(calfGirth_M);
Measurement(ankleGirth_M);
Measurement(kneeHeight_M);
Measurement(ankleHeight_M);
//foot
Measurement(footWidth_M);
Measurement(footLength_M);
VAbstractMeasurements::Measurements();
//heights
Measurement(height_M);
Measurement(cervicaleHeight_M);
Measurement(cervicaleToKneeHeight_M);
Measurement(waistHeight_M);
Measurement(highHipHeight_M);
Measurement(hipHeight_M);
Measurement(waistToHipHeight_M);
Measurement(waistToKneeHeight_M);
Measurement(crotchHeight_M);
//extended
Measurement(size_M);
Measurement(heightFrontNeckBasePoint_M);
Measurement(heightBaseNeckSidePoint_M);
Measurement(heightShoulderPoint_M);
Measurement(heightNipplePoint_M);
Measurement(heightBackAngleAxilla_M);
Measurement(heightScapularPoint_M);
Measurement(heightUnderButtockFolds_M);
Measurement(hipsExcludingProtrudingAbdomen_M);
Measurement(girthFootInstep_M);
Measurement(sideWaistToFloor_M);
Measurement(frontWaistToFloor_M);
Measurement(arcThroughGroinArea_M);
Measurement(waistToPlaneSeat_M);
Measurement(neckToRadialPoint_M);
Measurement(neckToThirdFinger_M);
Measurement(neckToFirstLineChestCircumference_M);
Measurement(frontWaistLength_M);
Measurement(arcThroughShoulderJoint_M);
Measurement(neckToBackLineChestCircumference_M);
Measurement(waistToNeckSide_M);
Measurement(arcLengthUpperBody_M);
Measurement(chestWidth_M);
Measurement(anteroposteriorDiameterHands_M);
Measurement(heightClavicularPoint_M);
Measurement(heightArmholeSlash_M);
Measurement(slashShoulderHeight_M);
Measurement(halfGirthNeck_M);
Measurement(halfGirthNeckForShirts_M);
Measurement(halfGirthChestFirst_M);
Measurement(halfGirthChestSecond_M);
Measurement(halfGirthChestThird_M);
Measurement(halfGirthWaist_M);
Measurement(halfGirthHipsConsideringProtrudingAbdomen_M);
Measurement(halfGirthHipsExcludingProtrudingAbdomen_M);
Measurement(girthKneeFlexedFeet_M);
Measurement(neckTransverseDiameter_M);
Measurement(frontSlashShoulderHeight_M);
Measurement(neckToFrontWaistLine_M);
Measurement(handVerticalDiameter_M);
Measurement(neckToKneePoint_M);
Measurement(waistToKnee_M);
Measurement(shoulderHeight_M);
Measurement(headHeight_M);
Measurement(bodyPosition_M);
Measurement(arcBehindShoulderGirdle_M);
Measurement(neckToNeckBase_M);
Measurement(depthWaistFirst_M);
Measurement(depthWaistSecond_M);
}
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::Measurement(const QString &tag)
void VIndividualMeasurements::ReadMeasurement(const QDomElement &domElement, const QString &tag)
{
const QDomNodeList nodeList = this->elementsByTagName(tag);
if (nodeList.isEmpty())
{
qDebug()<<"Measurement" << tag <<"doesn't exist"<<Q_FUNC_INFO;
return;
}
else
{
const QDomNode domNode = nodeList.at(0);
if (domNode.isNull() == false && domNode.isElement())
{
const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false)
{
qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
if (MUnit() == Unit::Mm)//Convert to Cm.
{
value = value / 10.0;
}
data->AddMeasurement(tag, VMeasurement(value, qApp->GuiText(tag), qApp->Description(tag), tag));
}
}
if (MUnit() == Unit::Mm)//Convert to Cm.
{
value = value / 10.0;
}
data->AddMeasurement(tag, VMeasurement(value, qApp->GuiText(tag), qApp->Description(tag), tag));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@
#ifndef VINDIVIDUALMEASUREMENTS_H
#define VINDIVIDUALMEASUREMENTS_H
#include "vdomdocument.h"
#include "vabstractmeasurements.h"
/*
VIT_VERSION is (major << 16) + (minor << 8) + patch.
@ -41,39 +41,38 @@
enum class SexType : char { Male, Female };
class VIndividualMeasurements:public VDomDocument
class VIndividualMeasurements:public VAbstractMeasurements
{
public:
VIndividualMeasurements(VContainer *data);
virtual ~VIndividualMeasurements();
Unit MUnit() const;
void setUnit(const Unit &unit);
void Measurements();
QString FamilyName() const;
void setFamilyName(const QString &text);
QString GivenName() const;
void setGivenName(const QString &text);
QDate BirthDate() const;
void setBirthDate(const QDate &date);
SexType Sex() const;
void setSex(const SexType &sex);
QString Mail() const;
void setMail(const QString &text);
static const QString AttrValue;
void setUnit(const Unit &unit);
virtual void Measurements();
QString FamilyName() const;
void setFamilyName(const QString &text);
QString GivenName() const;
void setGivenName(const QString &text);
QDate BirthDate() const;
void setBirthDate(const QDate &date);
SexType Sex() const;
void setSex(const SexType &sex);
QString Mail() const;
void setMail(const QString &text);
static const QString TagFamily_name;
static const QString TagGiven_name;
static const QString TagBirth_date;
static const QString TagSex;
static const QString TagUnit;
static const QString TagEmail;
static const QString SexMale;
static const QString SexFemale;
static QString GenderToStr(const SexType &sex);
static SexType StrToGender(const QString &sex);
protected:
virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag);
private:
Q_DISABLE_COPY(VIndividualMeasurements)
void Measurement(const QString &tag);
};
#endif // VINDIVIDUALMEASUREMENTS_H

View File

@ -214,7 +214,7 @@ bool VPattern::SetNameDraw(const QString &name)
{
nameActivDraw = name;
element.setAttribute(AttrName, nameActivDraw);
emit patternChanged();
emit patternChanged(false);
emit ChangedNameDraw(oldName, nameActivDraw);
return true;
}
@ -558,7 +558,7 @@ void VPattern::SetPath(const QString &path)
if (element.isElement())
{
SetAttribute(element, AttrPath, path);
emit patternChanged();
emit patternChanged(false);
}
else
{
@ -687,14 +687,8 @@ void VPattern::LiteParseTree()
#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();
QMessageBox::critical(nullptr, tr("Critical error!"), tr("Error parsing file (std::bad_alloc)."), QMessageBox::Ok,
QMessageBox::Ok);
#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(Qt::WaitCursor);
#endif
@ -712,7 +706,7 @@ void VPattern::LiteParseTree()
*/
void VPattern::haveLiteChange()
{
emit patternChanged();
emit patternChanged(false);
}
//---------------------------------------------------------------------------------------------------------------------
@ -942,6 +936,29 @@ void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx, qreal &my,
QString &typeLine)
{
PointsCommonAttributes(domElement, id, name, mx, my);
typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx, qreal &my)
{
PointsCommonAttributes(domElement, id, mx, my);
name = GetParametrString(domElement, VAbstractTool::AttrName, "A");
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my)
{
ToolsCommonAttributes(domElement, id);
mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ParsePointElement parse point tag.
@ -957,6 +974,11 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QStringList points{VToolSinglePoint::ToolType, VToolEndLine::ToolType, VToolAlongLine::ToolType,
VToolShoulderPoint::ToolType, VToolNormal::ToolType, VToolBisector::ToolType,
@ -970,12 +992,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
VToolSinglePoint *spoint = 0;
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "A");
PointsCommonAttributes(domElement, id, name, mx, my);
const qreal x = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrX, "10.0"));
const qreal y = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0"));
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
data->UpdateGObject(id, new VPointF(x, y, name, mx, my));
VDrawTool::AddRecord(id, Tool::SinglePointTool, this);
@ -1005,12 +1024,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 1: //VToolEndLine::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
@ -1035,21 +1049,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of end line"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
case 2: //VToolAlongLine::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
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");
@ -1073,21 +1080,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point along line"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
case 3: //VToolShoulderPoint::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
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");
@ -1112,21 +1112,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of shoulder"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
case 4: //VToolNormal::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
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");
@ -1151,21 +1144,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of normal"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
case 5: //VToolBisector::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
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");
@ -1190,19 +1176,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of bisector"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
case 6: //VToolLineIntersect::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 p1Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0");
const quint32 p2Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0");
const quint32 p1Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0");
@ -1221,10 +1202,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 7: //VToolPointOfContact::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
PointsCommonAttributes(domElement, id, name, mx, my);
const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0");
QString f = radius;//need for saving fixed formula;
const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0");
@ -1249,21 +1227,17 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of contact"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
case 8: //VNodePoint::ToolType
try
{
const quint32 id = GetParametrId(domElement);
PointsCommonAttributes(domElement, id, mx, my);
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
const VPointF *point = data->GeometricObject<const VPointF *>(idObject );
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), mx, my, idObject,
Draw::Modeling));
VNodePoint::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
@ -1278,12 +1252,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 9: //VToolHeight::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0");
const quint32 p1LineId = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0");
const quint32 p2LineId = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0");
@ -1301,10 +1270,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 10: //VToolTriangle::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 axisP1Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0");
const quint32 axisP2Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0");
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
@ -1323,10 +1289,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 11: //VToolPointOfIntersection::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
@ -1343,10 +1306,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 12: //VToolCutSpline::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
PointsCommonAttributes(domElement, id, name, mx, my);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0");
@ -1368,19 +1328,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating cut spline point"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
case 13: //VToolCutSplinePath::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
PointsCommonAttributes(domElement, id, name, mx, my);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0");
@ -1403,19 +1358,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating cut spline path point"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
case 14: //VToolCutArc::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
PointsCommonAttributes(domElement, id, name, mx, my);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, "0");
@ -1437,9 +1387,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating cut arc point"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
@ -1461,9 +1409,10 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
{
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
try
{
const quint32 id = GetParametrId(domElement);
ToolsCommonAttributes(domElement, id);
const quint32 firstPoint = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
const quint32 secondPoint = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
@ -1479,6 +1428,14 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, quint32 &idTool)
{
ToolsCommonAttributes(domElement, id);
idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ParseSplineElement parse spline tag.
@ -1494,6 +1451,10 @@ 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");
quint32 id = 0;
quint32 idObject = 0;
quint32 idTool = 0;
QStringList splines{VToolSpline::ToolType, VToolSplinePath::ToolType, VNodeSpline::ToolType,
VNodeSplinePath::ToolType};
switch (splines.indexOf(type))
@ -1501,7 +1462,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
case 0: //VToolSpline::ToolType
try
{
const quint32 id = GetParametrId(domElement);
ToolsCommonAttributes(domElement, id);
const quint32 point1 = GetParametrUInt(domElement, VAbstractTool::AttrPoint1, "0");
const quint32 point4 = GetParametrUInt(domElement, VAbstractTool::AttrPoint4, "0");
const qreal angle1 = GetParametrDouble(domElement, VAbstractTool::AttrAngle1, "270.0");
@ -1523,7 +1484,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
case 1: //VToolSplinePath::ToolType
try
{
const quint32 id = GetParametrId(domElement);
ToolsCommonAttributes(domElement, id);
const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0");
VSplinePath *path = new VSplinePath(kCurve);
@ -1567,9 +1528,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
case 2: //VNodeSpline::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
SplinesCommonAttributes(domElement, id, idObject, idTool);
VSpline *spl = new VSpline(*data->GeometricObject<const VSpline *>(idObject));
spl->setIdObject(idObject);
spl->setMode(Draw::Modeling);
@ -1586,9 +1545,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
case 3: //VNodeSplinePath::ToolType
try
{
const quint32 id = GetParametrId(domElement);
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
SplinesCommonAttributes(domElement, id, idObject, idTool);
VSplinePath *path = new VSplinePath(*data->GeometricObject<const VSplinePath *>(idObject));
path->setIdObject(idObject);
path->setMode(Draw::Modeling);
@ -1623,6 +1580,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
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");
quint32 id = 0;
QStringList arcs{VToolArc::ToolType, VNodeArc::ToolType};
switch (arcs.indexOf(type))
@ -1630,7 +1588,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
case 0: //VToolArc::ToolType
try
{
const quint32 id = GetParametrId(domElement);
ToolsCommonAttributes(domElement, id);
const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0");
const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "10");
QString r = radius;//need for saving fixed formula;
@ -1658,16 +1616,14 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating simple arc"), domElement);
QString message("Message: " + e.GetMsg() + "\n"+
"Expression: " + e.GetExpr());
excep.AddMoreInformation(message);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
break;
case 1: //VNodeArc::ToolType
try
{
const quint32 id = GetParametrId(domElement);
ToolsCommonAttributes(domElement, id);
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
VArc *arc = new VArc(*data->GeometricObject<const VArc *>(idObject));
@ -1704,6 +1660,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");
quint32 id = 0;
QStringList tools{VToolUnionDetails::ToolType};
switch (tools.indexOf(type))
@ -1711,7 +1668,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
case 0: //VToolUnionDetails::ToolType
try
{
const quint32 id = GetParametrId(domElement);
ToolsCommonAttributes(domElement, id);
const quint32 indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, "-1");
const quint32 indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, "-1");
@ -1889,6 +1846,12 @@ void VPattern::GarbageCollector()
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ToolsCommonAttributes(const QDomElement &domElement, quint32 &id)
{
id = GetParametrId(domElement);
}
//---------------------------------------------------------------------------------------------------------------------
QDomElement VPattern::GetPPElement(const QString &name)
{

View File

@ -130,7 +130,7 @@ signals:
/**
* @brief patternChanged emit if we have unsaved change.
*/
void patternChanged();
void patternChanged(bool saved);
/**
* @brief ShowTool highlight tool.
* @param id tool id.
@ -199,6 +199,14 @@ private:
void PrepareForParse(const Document &parse);
void UpdateMeasurements();
void GarbageCollector();
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx,
qreal &my, QString &typeLine);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx,
qreal &my);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my);
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject,
quint32 &idTool);
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -33,25 +33,20 @@
const QString VStandardMeasurements::TagDescription = QStringLiteral("description");
const QString VStandardMeasurements::TagSize = QStringLiteral("size");
const QString VStandardMeasurements::TagHeight = QStringLiteral("height");
const QString VStandardMeasurements::AttrValue = QStringLiteral("value");
const QString VStandardMeasurements::AttrSize_increase = QStringLiteral("size_increase");
const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase");
//---------------------------------------------------------------------------------------------------------------------
VStandardMeasurements::VStandardMeasurements(VContainer *data):VDomDocument(data)
{}
VStandardMeasurements::VStandardMeasurements(VContainer *data)
:VAbstractMeasurements(data)
{
SCASSERT(data != nullptr)
}
//---------------------------------------------------------------------------------------------------------------------
VStandardMeasurements::~VStandardMeasurements()
{}
//---------------------------------------------------------------------------------------------------------------------
Unit VStandardMeasurements::MUnit()
{
const QString unit = UniqueTagText(AttrUnit, UnitCM);
return VDomDocument::StrToUnits(unit);
}
//---------------------------------------------------------------------------------------------------------------------
QString VStandardMeasurements::Description()
{
@ -64,178 +59,21 @@ QString VStandardMeasurements::Description()
}
//---------------------------------------------------------------------------------------------------------------------
void VStandardMeasurements::Measurements()
void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const QString &tag)
{
//head and neck
Measurement(headGirth_M);
Measurement(midNeckGirth_M);
Measurement(neckBaseGirth_M);
Measurement(headAndNeckLength_M);
//torso
Measurement(centerFrontWaistLength_M);
Measurement(centerBackWaistLength_M);
Measurement(shoulderLength_M);
Measurement(sideWaistLength_M);
Measurement(trunkLength_M);
Measurement(shoulderGirth_M);
Measurement(upperChestGirth_M);
Measurement(bustGirth_M);
Measurement(underBustGirth_M);
Measurement(waistGirth_M);
Measurement(highHipGirth_M);
Measurement(hipGirth_M);
Measurement(upperFrontChestWidth_M);
Measurement(frontChestWidth_M);
Measurement(acrossFrontShoulderWidth_M);
Measurement(acrossBackShoulderWidth_M);
Measurement(upperBackWidth_M);
Measurement(backWidth_M);
Measurement(bustpointToBustpoint_M);
Measurement(halterBustpointToBustpoint_M);
Measurement(neckToBustpoint_M);
Measurement(crotchLength_M);
Measurement(riseHeight_M);
Measurement(shoulderDrop_M);
Measurement(shoulderSlopeDegrees_M);
Measurement(frontShoulderSlopeLength_M);
Measurement(backShoulderSlopeLength_M);
Measurement(frontShoulderToWaistLength_M);
Measurement(backShoulderToWaistLength_M);
Measurement(frontNeckArc_M);
Measurement(backNeckArc_M);
Measurement(frontUpperChestArc_M);
Measurement(backUpperChestArc_M);
Measurement(frontWaistArc_M);
Measurement(backWaistArc_M);
Measurement(frontUpperHipArc_M);
Measurement(backUpperHipArc_M);
Measurement(frontHipArc_M);
Measurement(backHipArc_M);
Measurement(chestSlope_M);
Measurement(backSlope_M);
Measurement(frontWaistSlope_M);
Measurement(backWaistSlope_M);
Measurement(frontNeckToUpperChestHeight_M);
Measurement(frontNeckToBustHeight_M);
//arm
Measurement(armscyeGirth_M);
Measurement(elbowGirth_M);
Measurement(upperArmGirth_M);
Measurement(wristGirth_M);
Measurement(scyeDepth_M);
Measurement(shoulderAndArmLength_M);
Measurement(underarmLength_M);
Measurement(cervicaleToWristLength_M);
Measurement(shoulderToElbowLength_M);
Measurement(armLength_M);
//hand
Measurement(handWidth_M);
Measurement(handLength_M);
Measurement(handGirth_M);
//leg
Measurement(thighGirth_M);
Measurement(midThighGirth_M);
Measurement(kneeGirth_M);
Measurement(calfGirth_M);
Measurement(ankleGirth_M);
Measurement(kneeHeight_M);
Measurement(ankleHeight_M);
//foot
Measurement(footWidth_M);
Measurement(footLength_M);
//heights
Measurement(cervicaleHeight_M);
Measurement(cervicaleToKneeHeight_M);
Measurement(waistHeight_M);
Measurement(highHipHeight_M);
Measurement(hipHeight_M);
Measurement(waistToHipHeight_M);
Measurement(waistToKneeHeight_M);
Measurement(crotchHeight_M);
//extended
Measurement(heightFrontNeckBasePoint_M);
Measurement(heightBaseNeckSidePoint_M);
Measurement(heightShoulderPoint_M);
Measurement(heightNipplePoint_M);
Measurement(heightBackAngleAxilla_M);
Measurement(heightScapularPoint_M);
Measurement(heightUnderButtockFolds_M);
Measurement(hipsExcludingProtrudingAbdomen_M);
Measurement(girthFootInstep_M);
Measurement(sideWaistToFloor_M);
Measurement(frontWaistToFloor_M);
Measurement(arcThroughGroinArea_M);
Measurement(waistToPlaneSeat_M);
Measurement(neckToRadialPoint_M);
Measurement(neckToThirdFinger_M);
Measurement(neckToFirstLineChestCircumference_M);
Measurement(frontWaistLength_M);
Measurement(arcThroughShoulderJoint_M);
Measurement(neckToBackLineChestCircumference_M);
Measurement(waistToNeckSide_M);
Measurement(arcLengthUpperBody_M);
Measurement(chestWidth_M);
Measurement(anteroposteriorDiameterHands_M);
Measurement(heightClavicularPoint_M);
Measurement(heightArmholeSlash_M);
Measurement(slashShoulderHeight_M);
Measurement(halfGirthNeck_M);
Measurement(halfGirthNeckForShirts_M);
Measurement(halfGirthChestFirst_M);
Measurement(halfGirthChestSecond_M);
Measurement(halfGirthChestThird_M);
Measurement(halfGirthWaist_M);
Measurement(halfGirthHipsConsideringProtrudingAbdomen_M);
Measurement(halfGirthHipsExcludingProtrudingAbdomen_M);
Measurement(girthKneeFlexedFeet_M);
Measurement(neckTransverseDiameter_M);
Measurement(frontSlashShoulderHeight_M);
Measurement(neckToFrontWaistLine_M);
Measurement(handVerticalDiameter_M);
Measurement(neckToKneePoint_M);
Measurement(waistToKnee_M);
Measurement(shoulderHeight_M);
Measurement(headHeight_M);
Measurement(bodyPosition_M);
Measurement(arcBehindShoulderGirdle_M);
Measurement(neckToNeckBase_M);
Measurement(depthWaistFirst_M);
Measurement(depthWaistSecond_M);
}
const qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
const qreal size_increase = GetParametrDouble(domElement, AttrSize_increase, "0.0");
const qreal height_increase = GetParametrDouble(domElement, AttrHeight_increase, "0.0");
//---------------------------------------------------------------------------------------------------------------------
void VStandardMeasurements::Measurement(const QString &tag)
{
const QDomNodeList nodeList = this->elementsByTagName(tag);
if (nodeList.isEmpty())
if (MUnit() == Unit::Mm)// Convert to Cm.
{
qDebug()<<"Measurement" << tag <<"doesn't exist"<<Q_FUNC_INFO;
return;
data->AddMeasurement(tag, VMeasurement(value/10.0, size_increase/10.0, height_increase/10.0,
qApp->GuiText(tag), qApp->Description(tag), tag));
}
else
else// Cm or inch.
{
const QDomNode domNode = nodeList.at(0);
if (domNode.isNull() == false && domNode.isElement())
{
const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false)
{
const qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
const qreal size_increase = GetParametrDouble(domElement, AttrSize_increase, "0.0");
const qreal height_increase = GetParametrDouble(domElement, AttrHeight_increase, "0.0");
if (MUnit() == Unit::Mm)// Convert to Cm.
{
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_increase, height_increase, qApp->GuiText(tag),
qApp->Description(tag), tag));
}
}
}
data->AddMeasurement(tag, VMeasurement(value, size_increase, height_increase, qApp->GuiText(tag),
qApp->Description(tag), tag));
}
}

View File

@ -29,7 +29,7 @@
#ifndef VSTANDARDMEASUREMENTS_H
#define VSTANDARDMEASUREMENTS_H
#include "vdomdocument.h"
#include "vabstractmeasurements.h"
/*
VST_VERSION is (major << 16) + (minor << 8) + patch.
@ -39,26 +39,24 @@
// max support version of format
#define VST_VERSION 0x000100
class VStandardMeasurements:public VDomDocument
class VStandardMeasurements:public VAbstractMeasurements
{
public:
VStandardMeasurements(VContainer *data);
virtual ~VStandardMeasurements();
Unit MUnit();
QString Description();
void Measurements();
void SetSize();
void SetHeight();
QString Description();
void SetSize();
void SetHeight();
static const QString TagMeasurement;
static const QString TagDescription;
static const QString TagSize;
static const QString TagHeight;
static const QString AttrValue;
static const QString AttrSize_increase;
static const QString AttrHeight_increase;
protected:
virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag);
private:
Q_DISABLE_COPY(VStandardMeasurements)
void Measurement(const QString &tag);
};
#endif // VSTANDARDMEASUREMENTS_H

View File

@ -3,11 +3,13 @@ HEADERS += \
xml/vdomdocument.h \
xml/vpattern.h \
xml/vstandardmeasurements.h \
xml/vindividualmeasurements.h
xml/vindividualmeasurements.h \
xml/vabstractmeasurements.h
SOURCES += \
xml/vtoolrecord.cpp \
xml/vdomdocument.cpp \
xml/vpattern.cpp \
xml/vstandardmeasurements.cpp \
xml/vindividualmeasurements.cpp
xml/vindividualmeasurements.cpp \
xml/vabstractmeasurements.cpp

View File

@ -80,7 +80,7 @@ CONFIG(debug, debug|release){
-Wformat=2 -Wimport \
-Winvalid-pch -Wunsafe-loop-optimizations -Wlong-long -Wmissing-format-attribute \
-Wmissing-include-dirs -Wpacked -Wredundant-decls -Winline \
-Wswitch-default -Wswitch-enum -Wuninitialized -Wvariadic-macros \
-Wswitch-default -Wuninitialized -Wvariadic-macros \
-Wlogical-op -Wnoexcept -Wmissing-noreturn -Wpointer-arith\
-Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -gdwarf-3 \
-ftrapv

View File

@ -335,40 +335,6 @@ void QmuParserBase::CheckOprt(const QString &a_sName, const QmuParserCallback &a
case cmOPRT_INFIX:
Error(ecINVALID_INFIX_IDENT, -1, a_sName);
break;
case cmLE:
case cmGE:
case cmNEQ:
case cmEQ:
case cmLT:
case cmGT:
case cmADD:
case cmSUB:
case cmMUL:
case cmDIV:
case cmPOW:
case cmLAND:
case cmLOR:
case cmASSIGN:
case cmBO:
case cmBC:
case cmIF:
case cmELSE:
case cmENDIF:
case cmARG_SEP:
case cmVAR:
case cmVAL:
case cmVARPOW2:
case cmVARPOW3:
case cmVARPOW4:
case cmVARMUL:
case cmPOW2:
case cmFUNC:
case cmFUNC_STR:
case cmFUNC_BULK:
case cmSTRING:
case cmOPRT_BIN:
case cmEND:
case cmUNKNOWN:
default:
Error(ecINVALID_NAME, -1, a_sName);
break;
@ -629,22 +595,6 @@ int QmuParserBase::GetOprtPrecedence(const token_type &a_Tok) const
case cmOPRT_INFIX:
case cmOPRT_BIN:
return a_Tok.GetPri();
case cmBO:
case cmBC:
case cmENDIF:
case cmVAR:
case cmVAL:
case cmVARPOW2:
case cmVARPOW3:
case cmVARPOW4:
case cmVARMUL:
case cmPOW2:
case cmFUNC:
case cmFUNC_STR:
case cmFUNC_BULK:
case cmSTRING:
case cmOPRT_POSTFIX:
case cmUNKNOWN:
default:
Error(ecINTERNAL_ERROR, 5);
return 999;
@ -678,27 +628,6 @@ EOprtAssociativity QmuParserBase::GetOprtAssociativity(const token_type &a_Tok)
return oaRIGHT;
case cmOPRT_BIN:
return a_Tok.GetAssociativity();
case cmBO:
case cmBC:
case cmIF:
case cmELSE:
case cmENDIF:
case cmARG_SEP:
case cmVAR:
case cmVAL:
case cmVARPOW2:
case cmVARPOW3:
case cmVARPOW4:
case cmVARMUL:
case cmPOW2:
case cmFUNC:
case cmFUNC_STR:
case cmFUNC_BULK:
case cmSTRING:
case cmOPRT_POSTFIX:
case cmOPRT_INFIX:
case cmEND:
case cmUNKNOWN:
default:
return oaNONE;
}
@ -875,96 +804,6 @@ void QmuParserBase::ApplyFunc( QStack<token_type> &a_stOpt, QStack<token_type> &
m_vRPN.AddFun(funTok.GetFuncAddr(), (funTok.GetArgCount()==-1) ? -iArgNumerical : iArgNumerical);
break;
case cmLE:
Q_UNREACHABLE();
break;
case cmGE:
Q_UNREACHABLE();
break;
case cmNEQ:
Q_UNREACHABLE();
break;
case cmEQ:
Q_UNREACHABLE();
break;
case cmLT:
Q_UNREACHABLE();
break;
case cmGT:
Q_UNREACHABLE();
break;
case cmADD:
Q_UNREACHABLE();
break;
case cmSUB:
Q_UNREACHABLE();
break;
case cmMUL:
Q_UNREACHABLE();
break;
case cmDIV:
Q_UNREACHABLE();
break;
case cmPOW:
Q_UNREACHABLE();
break;
case cmLAND:
Q_UNREACHABLE();
break;
case cmLOR:
Q_UNREACHABLE();
break;
case cmASSIGN:
Q_UNREACHABLE();
break;
case cmBO:
Q_UNREACHABLE();
break;
case cmBC:
Q_UNREACHABLE();
break;
case cmIF:
Q_UNREACHABLE();
break;
case cmELSE:
Q_UNREACHABLE();
break;
case cmENDIF:
Q_UNREACHABLE();
break;
case cmARG_SEP:
Q_UNREACHABLE();
break;
case cmVAR:
Q_UNREACHABLE();
break;
case cmVAL:
Q_UNREACHABLE();
break;
case cmVARPOW2:
Q_UNREACHABLE();
break;
case cmVARPOW3:
Q_UNREACHABLE();
break;
case cmVARPOW4:
Q_UNREACHABLE();
break;
case cmVARMUL:
Q_UNREACHABLE();
break;
case cmPOW2:
Q_UNREACHABLE();
break;
case cmSTRING:
Q_UNREACHABLE();
break;
case cmEND:
Q_UNREACHABLE();
break;
case cmUNKNOWN:
Q_UNREACHABLE();
break;
default:
break;
}
@ -1056,58 +895,26 @@ void QmuParserBase::ApplyRemainingOprt(QStack<token_type> &stOpt, QStack<token_t
while (stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmIF)
{
token_type tok = stOpt.top();
switch (tok.GetCode())
const ECmdCode code = tok.GetCode();
if ((code >= cmLE && code <= cmASSIGN) || code == cmOPRT_INFIX || code == cmOPRT_BIN)
{
case cmOPRT_INFIX:
case cmOPRT_BIN:
case cmLE:
case cmGE:
case cmNEQ:
case cmEQ:
case cmLT:
case cmGT:
case cmADD:
case cmSUB:
case cmMUL:
case cmDIV:
case cmPOW:
case cmLAND:
case cmLOR:
case cmASSIGN:
if (stOpt.top().GetCode()==cmOPRT_INFIX)
{
ApplyFunc(stOpt, stVal, 1);
}
else
{
ApplyBinOprt(stOpt, stVal);
}
break;
case cmELSE:
ApplyIfElse(stOpt, stVal);
break;
case cmBO:
case cmBC:
case cmIF:
case cmENDIF:
case cmARG_SEP:
case cmVAR:
case cmVAL:
case cmVARPOW2:
case cmVARPOW3:
case cmVARPOW4:
case cmVARMUL:
case cmPOW2:
case cmFUNC:
case cmFUNC_STR:
case cmFUNC_BULK:
case cmSTRING:
case cmOPRT_POSTFIX:
case cmEND:
case cmUNKNOWN:
default:
Error(ecINTERNAL_ERROR);
break;
if (stOpt.top().GetCode()==cmOPRT_INFIX)
{
ApplyFunc(stOpt, stVal, 1);
}
else
{
ApplyBinOprt(stOpt, stVal);
}
}
else if (code == cmELSE)
{
ApplyIfElse(stOpt, stVal);
}
else
{
Error(ecINTERNAL_ERROR);
}
}
}
@ -1574,19 +1381,19 @@ void QmuParserBase::CreateRPN() const
case cmIF:
m_nIfElseCounter++;
// fallthrough intentional (no break!)
case cmLAND:
case cmLOR:
case cmLT:
case cmGT:
case cmLE:
case cmGE:
case cmNEQ:
case cmEQ:
case cmLT:
case cmGT:
case cmADD:
case cmSUB:
case cmMUL:
case cmDIV:
case cmPOW:
case cmLAND:
case cmLOR:
case cmASSIGN:
case cmOPRT_BIN:
// A binary operator (user defined or built in) has been found.
@ -1982,28 +1789,6 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
case cmENDIF:
qDebug() << "ENDIF\n";
break;
case cmLE:
case cmGE:
case cmNEQ:
case cmEQ:
case cmLT:
case cmGT:
case cmADD:
case cmSUB:
case cmMUL:
case cmDIV:
case cmPOW:
case cmLAND:
case cmLOR:
case cmASSIGN:
case cmARG_SEP:
case cmVARPOW2:
case cmVARPOW3:
case cmVARPOW4:
case cmVARMUL:
case cmPOW2:
case cmSTRING:
case cmOPRT_POSTFIX:
default:
qDebug() << stOprt.top().GetCode() << " ";
break;

View File

@ -207,75 +207,6 @@ void QmuParserByteCode::ConstantFolding(ECmdCode a_Oprt)
x = qPow(x, y);
m_vRPN.pop_back();
break;
case cmASSIGN:
Q_UNREACHABLE();
break;
case cmBO:
Q_UNREACHABLE();
break;
case cmBC:
Q_UNREACHABLE();
break;
case cmIF:
Q_UNREACHABLE();
break;
case cmELSE:
Q_UNREACHABLE();
break;
case cmENDIF:
Q_UNREACHABLE();
break;
case cmARG_SEP:
Q_UNREACHABLE();
break;
case cmVAR:
Q_UNREACHABLE();
break;
case cmVAL:
Q_UNREACHABLE();
break;
case cmVARPOW2:
Q_UNREACHABLE();
break;
case cmVARPOW3:
Q_UNREACHABLE();
break;
case cmVARPOW4:
Q_UNREACHABLE();
break;
case cmVARMUL:
Q_UNREACHABLE();
break;
case cmPOW2:
Q_UNREACHABLE();
break;
case cmFUNC:
Q_UNREACHABLE();
break;
case cmFUNC_STR:
Q_UNREACHABLE();
break;
case cmFUNC_BULK:
Q_UNREACHABLE();
break;
case cmSTRING:
Q_UNREACHABLE();
break;
case cmOPRT_BIN:
Q_UNREACHABLE();
break;
case cmOPRT_POSTFIX:
Q_UNREACHABLE();
break;
case cmOPRT_INFIX:
Q_UNREACHABLE();
break;
case cmEND:
Q_UNREACHABLE();
break;
case cmUNKNOWN:
Q_UNREACHABLE();
break;
default:
break;
} // switch opcode
@ -424,37 +355,6 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
bOptimized = true;
}
break;
case cmNEQ:
case cmEQ:
case cmLOR:
case cmASSIGN:
case cmBO:
case cmBC:
case cmIF:
case cmELSE:
case cmENDIF:
case cmARG_SEP:
case cmVAR:
case cmVAL:
case cmVARPOW2:
case cmVARPOW3:
case cmVARPOW4:
case cmVARMUL:
case cmPOW2:
case cmFUNC:
case cmFUNC_STR:
case cmFUNC_BULK:
case cmSTRING:
case cmOPRT_BIN:
case cmOPRT_POSTFIX:
case cmOPRT_INFIX:
case cmEND:
case cmUNKNOWN:
case cmLE:
case cmGE:
case cmLT:
case cmGT:
case cmLAND:
default:
break;
@ -602,39 +502,6 @@ void QmuParserByteCode::Finalize()
idx = stElse.pop();
m_vRPN[idx].Oprt.offset = i - idx;
break;
case cmLE:
case cmGE:
case cmNEQ:
case cmEQ:
case cmLT:
case cmGT:
case cmADD:
case cmSUB:
case cmMUL:
case cmDIV:
case cmPOW:
case cmLAND:
case cmLOR:
case cmASSIGN:
case cmBO:
case cmBC:
case cmARG_SEP:
case cmVAR:
case cmVAL:
case cmVARPOW2:
case cmVARPOW3:
case cmVARPOW4:
case cmVARMUL:
case cmPOW2:
case cmFUNC:
case cmFUNC_STR:
case cmFUNC_BULK:
case cmSTRING:
case cmOPRT_BIN:
case cmOPRT_POSTFIX:
case cmOPRT_INFIX:
case cmEND:
case cmUNKNOWN:
default:
break;
}

View File

@ -384,108 +384,91 @@ bool QmuParserTokenReader::IsBuiltIn ( token_type &a_Tok )
int len = pOprtDef.at ( i ).length();
if ( pOprtDef.at ( i ) == m_strFormula.mid ( m_iPos, len ) )
{
switch ( i )
if (i >= cmLE && i <= cmASSIGN)
{
//case cmAND:
//case cmOR:
//case cmXOR:
case cmLAND:
case cmLOR:
case cmLT:
case cmGT:
case cmLE:
case cmGE:
case cmNEQ:
case cmEQ:
case cmADD:
case cmSUB:
case cmMUL:
case cmDIV:
case cmPOW:
case cmASSIGN:
//if (len!=sTok.length())
// continue;
//if (len!=sTok.length())
// continue;
// The assignement operator need special treatment
if ( i == cmASSIGN && m_iSynFlags & noASSIGN )
// The assignement operator need special treatment
if ( i == cmASSIGN && m_iSynFlags & noASSIGN )
{
Error ( ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef.at ( i ) );
}
if ( m_pParser->HasBuiltInOprt() == false)
{
continue;
}
if ( m_iSynFlags & noOPT )
{
// Maybe its an infix operator not an operator
// Both operator types can share characters in
// their identifiers
if ( IsInfixOpTok ( a_Tok ) )
{
Error ( ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef.at ( i ) );
return true;
}
if ( m_pParser->HasBuiltInOprt() == false)
{
continue;
}
if ( m_iSynFlags & noOPT )
{
// Maybe its an infix operator not an operator
// Both operator types can share characters in
// their identifiers
if ( IsInfixOpTok ( a_Tok ) )
{
return true;
}
Error ( ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef.at ( i ) );
}
Error ( ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef.at ( i ) );
}
m_iSynFlags = noBC | noOPT | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
m_iSynFlags |= ( ( i != cmEND ) && ( i != cmBC ) ) ? noEND : 0;
}
else if (i == cmBO)
{
if ( m_iSynFlags & noBO )
{
Error ( ecUNEXPECTED_PARENS, m_iPos, pOprtDef.at ( i ) );
}
m_iSynFlags = noBC | noOPT | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
m_iSynFlags |= ( ( i != cmEND ) && ( i != cmBC ) ) ? noEND : 0;
break;
if ( m_lastTok.GetCode() == cmFUNC )
{
m_iSynFlags = noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
}
else
{
m_iSynFlags = noBC | noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
}
case cmBO:
if ( m_iSynFlags & noBO )
{
Error ( ecUNEXPECTED_PARENS, m_iPos, pOprtDef.at ( i ) );
}
++m_iBrackets;
}
else if (i == cmBC)
{
if ( m_iSynFlags & noBC )
{
Error ( ecUNEXPECTED_PARENS, m_iPos, pOprtDef.at ( i ) );
}
if ( m_lastTok.GetCode() == cmFUNC )
{
m_iSynFlags = noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
}
else
{
m_iSynFlags = noBC | noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
}
m_iSynFlags = noBO | noVAR | noVAL | noFUN | noINFIXOP | noSTR | noASSIGN;
++m_iBrackets;
break;
if ( --m_iBrackets < 0 )
{
Error ( ecUNEXPECTED_PARENS, m_iPos, pOprtDef.at ( i ) );
}
}
else if (i == cmELSE)
{
if ( m_iSynFlags & noELSE )
{
Error ( ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef.at ( i ) );
}
case cmBC:
if ( m_iSynFlags & noBC )
{
Error ( ecUNEXPECTED_PARENS, m_iPos, pOprtDef.at ( i ) );
}
m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
}
else if (i == cmIF)
{
if ( m_iSynFlags & noIF )
{
Error ( ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef.at ( i ) );
}
m_iSynFlags = noBO | noVAR | noVAL | noFUN | noINFIXOP | noSTR | noASSIGN;
if ( --m_iBrackets < 0 )
{
Error ( ecUNEXPECTED_PARENS, m_iPos, pOprtDef.at ( i ) );
}
break;
case cmELSE:
if ( m_iSynFlags & noELSE )
{
Error ( ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef.at ( i ) );
}
m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
break;
case cmIF:
if ( m_iSynFlags & noIF )
{
Error ( ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef.at ( i ) );
}
m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
break;
default: // The operator is listed in c_DefaultOprt, but not here. This is a bad thing...
Error ( ecINTERNAL_ERROR );
} // switch operator id
m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
}
else // The operator is listed in c_DefaultOprt, but not here. This is a bad thing...
{
Error ( ecINTERNAL_ERROR );
}
m_iPos += len;
a_Tok.Set ( static_cast<ECmdCode>(i), pOprtDef.at ( i ) );