Refactoring.

--HG--
branch : develop
This commit is contained in:
dismine 2014-08-17 21:49:29 +03:00
parent b72f5511b4
commit fcffc03649
18 changed files with 379 additions and 450 deletions

View File

@ -137,30 +137,27 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
{
if (number == 0)
switch (number)
{
if (ChoosedPoint(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
{
number++;
line->VisualMode(id);
return;
}
}
if (number == 1)
{
if (ChoosedPoint(id, ui->comboBoxSecondPoint, ""))
{
number = 0;
if (isInitialized == false)
case 0:
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
{
number++;
line->VisualMode(id);
}
break;
case 1:
if (SetObject(id, ui->comboBoxSecondPoint, ""))
{
line->setPoint2Id(id);
line->RefreshGeometry();
prepare = true;
this->setModal(true);
this->show();
}
}
break;
default:
break;
}
}
}

View File

@ -187,16 +187,18 @@ void DialogArc::SetRadius(const QString &value)
*/
void DialogArc::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
if (prepare == false)// After first choose we ignore all objects
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
ChangeCurrentText(ui->comboBoxBasePoint, point->name());
path->VisualMode(id);
prepare = true;
emit ToolTip("");
this->setModal(true);
this->show();
if (type == SceneObject::Point)
{
if (SetObject(id, ui->comboBoxBasePoint, ""))
{
path->VisualMode(id);
prepare = true;
this->setModal(true);
this->show();
}
}
}
}

View File

@ -147,49 +147,35 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
if (number == 0)
switch (number)
{
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
line->VisualMode(id);
emit ToolTip(tr("Select second point of angle"));
return;
}
}
if (number == 1)
{
qint32 index = ui->comboBoxSecondPoint->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
number++;
line->setPoint2Id(id);
line->RefreshGeometry();
emit ToolTip(tr("Select third point of angle"));
return;
}
}
if (number == 2)
{
qint32 index = ui->comboBoxThirdPoint->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxThirdPoint->setCurrentIndex(index);
number = 0;
line->setPoint3Id(id);
line->RefreshGeometry();
prepare = true;
emit ToolTip("");
}
if (isInitialized == false)
{
this->setModal(true);
this->show();
}
case 0:
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point of angle")))
{
number++;
line->VisualMode(id);
}
break;
case 1:
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle")))
{
number++;
line->setPoint2Id(id);
line->RefreshGeometry();
}
break;
case 2:
if (SetObject(id, ui->comboBoxThirdPoint, ""))
{
line->setPoint3Id(id);
line->RefreshGeometry();
prepare = true;
this->setModal(true);
this->show();
}
break;
default:
break;
}
}
}

View File

@ -107,15 +107,18 @@ DialogCutArc::~DialogCutArc()
*/
void DialogCutArc::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Arc)
if (prepare == false)// After first choose we ignore all objects
{
const VArc *arc = data->GeometricObject<const VArc *>(id);
ChangeCurrentText(ui->comboBoxArc, arc->name());
path->VisualMode(id);
prepare = true;
emit ToolTip("");
this->setModal(true);
this->show();
if (type == SceneObject::Arc)
{
if (SetObject(id, ui->comboBoxArc, ""))
{
path->VisualMode(id);
prepare = true;
this->setModal(true);
this->show();
}
}
}
}

View File

@ -115,13 +115,16 @@ void DialogCutSpline::setSplineId(const quint32 &value)
*/
void DialogCutSpline::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Spline)
if (prepare == false)// After first choose we ignore all objects
{
const VSpline *spl = data->GeometricObject<const VSpline *>(id);
ChangeCurrentText(ui->comboBoxSpline, spl->name());
emit ToolTip("");
this->setModal(true);
this->show();
if (type == SceneObject::Spline)
{
if (SetObject(id, ui->comboBoxSpline, ""))
{
this->setModal(true);
this->show();
}
}
}
}

View File

@ -115,13 +115,16 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value)
*/
void DialogCutSplinePath::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::SplinePath)
if (prepare == false)// After first choose we ignore all objects
{
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(id);
ChangeCurrentText(ui->comboBoxSplinePath, splPath->name());
emit ToolTip("");
this->setModal(true);
this->show();
if (type == SceneObject::SplinePath)
{
if (SetObject(id, ui->comboBoxSplinePath, ""))
{
this->setModal(true);
this->show();
}
}
}
}

View File

@ -140,15 +140,13 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
basePointId = id;
ChangeCurrentText(ui->comboBoxBasePoint, point->name());
line->VisualMode(id);
connect(line, &VisToolEndLine::ToolTip, this, &DialogTool::ShowVisToolTip);
emit ToolTip("");
prepare = true;
if (SetObject(id, ui->comboBoxBasePoint, ""))
{
basePointId = id;
line->VisualMode(id);
connect(line, &VisToolEndLine::ToolTip, this, &DialogTool::ShowVisToolTip);
prepare = true;
}
}
}
}

View File

@ -137,39 +137,40 @@ void DialogHeight::setP2LineId(const quint32 &value)
*/
void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
if (prepare == false)// After first choose we ignore all objects
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
switch (number)
if (type == SceneObject::Point)
{
case (0):
ChangeCurrentText(ui->comboBoxBasePoint, point->name());
number++;
line->VisualMode(id);
emit ToolTip(tr("Select first point of line"));
break;
case (1):
ChangeCurrentText(ui->comboBoxP1Line, point->name());
number++;
line->setLineP1Id(id);
line->RefreshGeometry();
emit ToolTip(tr("Select second point of line"));
break;
case (2):
ChangeCurrentText(ui->comboBoxP2Line, point->name());
number = 0;
emit ToolTip("");
line->setLineP2Id(id);
line->RefreshGeometry();
prepare = true;
if (isInitialized == false)
{
this->setModal(true);
this->show();
}
break;
default:
break;
switch (number)
{
case (0):
if (SetObject(id, ui->comboBoxBasePoint, tr("Select first point of line")))
{
number++;
line->VisualMode(id);
}
break;
case (1):
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
{
number++;
line->setLineP1Id(id);
line->RefreshGeometry();
}
break;
case (2):
if (SetObject(id, ui->comboBoxP2Line, ""))
{
line->setLineP2Id(id);
line->RefreshGeometry();
prepare = true;
this->setModal(true);
this->show();
}
break;
default:
break;
}
}
}
}

View File

@ -167,34 +167,32 @@ void DialogLine::SaveData()
*/
void DialogLine::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
if (prepare == false)// After first choose we ignore all objects
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
if (number == 0)
if (type == SceneObject::Point)
{
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
if ( index != -1 )
{ // -1 for not found
line->VisualMode(id);
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select second point"));
return;
}
}
if (number == 1)
{
qint32 index = ui->comboBoxSecondPoint->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
if (flagError)
{
number = 0;
prepare = true;
emit ToolTip("");
DialogAccepted();
}
switch (number)
{
case 0:
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point")))
{
number++;
line->VisualMode(id);
}
break;
case 1:
if (SetObject(id, ui->comboBoxSecondPoint, ""))
{
if (flagError)
{
number = 0;
prepare = true;
DialogAccepted();
}
}
break;
default:
break;
}
}
}

View File

@ -1,4 +1,4 @@
/************************************************************************
/************************************************************************
**
** @file dialoglineintersect.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
@ -83,81 +83,65 @@ DialogLineIntersect::~DialogLineIntersect()
*/
void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
if (prepare == false)// After first choose we ignore all objects
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
if (number == 0)
if (type == SceneObject::Point)
{
qint32 index = ui->comboBoxP1Line1->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxP1Line1->setCurrentIndex(index);
p1Line1 = id;
number++;
line->VisualMode(id);
emit ToolTip(tr("Select second point of first line"));
return;
}
}
if (number == 1)
{
qint32 index = ui->comboBoxP2Line1->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxP2Line1->setCurrentIndex(index);
p2Line1 = id;
number++;
line->setLine1P2Id(p2Line1);
line->RefreshGeometry();
emit ToolTip(tr("Select first point of second line"));
return;
}
}
if (number == 2)
{
qint32 index = ui->comboBoxP1Line2->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxP1Line2->setCurrentIndex(index);
p1Line2 = id;
number++;
line->setLine2P1Id(p1Line2);
line->RefreshGeometry();
emit ToolTip(tr("Select second point of second line"));
return;
}
}
if (number == 3)
{
qint32 index = ui->comboBoxP2Line2->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxP2Line2->setCurrentIndex(index);
p2Line2 = id;
number = 0;
line->setLine2P2Id(p2Line2);
line->RefreshGeometry();
prepare = true;
emit ToolTip("");
}
if (isInitialized == false)
switch (number)
{
flagPoint = CheckIntersecion();
CheckState();
this->setModal(true);
this->show();
connect(ui->comboBoxP1Line1,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P1Line1Changed);
connect(ui->comboBoxP2Line1,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P2Line1Changed);
connect(ui->comboBoxP1Line2,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P1Line2Changed);
connect(ui->comboBoxP2Line2,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P2Line2Changed);
case 0:
if (SetObject(id, ui->comboBoxP1Line1, tr("Select second point of first line")))
{
number++;
p1Line1 = id;
line->VisualMode(id);
}
break;
case 1:
if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line")))
{
number++;
p2Line1 = id;
line->setLine1P2Id(id);
line->RefreshGeometry();
}
break;
case 2:
if (SetObject(id, ui->comboBoxP1Line2, tr("Select second point of second line")))
{
number++;
p1Line2 = id;
line->setLine2P1Id(id);
line->RefreshGeometry();
}
break;
case 3:
if (SetObject(id, ui->comboBoxP2Line2, ""))
{
p2Line2 = id;
line->setLine2P2Id(id);
line->RefreshGeometry();
prepare = true;
flagPoint = CheckIntersecion();
CheckState();
this->setModal(true);
this->show();
connect(ui->comboBoxP1Line1,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P1Line1Changed);
connect(ui->comboBoxP2Line1,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P2Line1Changed);
connect(ui->comboBoxP1Line2,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P1Line2Changed);
connect(ui->comboBoxP2Line2,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogLineIntersect::P2Line2Changed);
}
break;
default:
break;
}
}
}

View File

@ -135,29 +135,27 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
{
if (number == 0)
switch (number)
{
if (ChoosedPoint(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
{
number++;
line->VisualMode(id);
return;
}
}
if (number == 1)
{
if (ChoosedPoint(id, ui->comboBoxSecondPoint, ""))
{
number = 0;
line->setPoint2Id(id);
line->RefreshGeometry();
prepare = true;
if (isInitialized == false)
case 0:
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
{
number++;
line->VisualMode(id);
}
break;
case 1:
if (SetObject(id, ui->comboBoxSecondPoint, ""))
{
line->setPoint2Id(id);
line->RefreshGeometry();
prepare = true;
this->setModal(true);
this->show();
}
}
break;
default:
break;
}
}
}

View File

@ -155,50 +155,39 @@ void DialogPointOfContact::DeployFormulaTextEdit()
*/
void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
if (prepare == false)// After first choose we ignore all objects
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
if (number == 0)
if (type == SceneObject::Point)
{
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
line->VisualMode(id);
emit ToolTip(tr("Select second point of line"));
return;
}
}
if (number == 1)
{
qint32 index = ui->comboBoxSecondPoint->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
number++;
line->setLineP2Id(id);
line->RefreshGeometry();
emit ToolTip(tr("Select point of center of arc"));
return;
}
}
if (number == 2)
{
qint32 index = ui->comboBoxCenter->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxCenter->setCurrentIndex(index);
number = 0;
line->setRadiusId(id);
line->RefreshGeometry();
prepare = true;
emit ToolTip("");
}
if (isInitialized == false)
switch (number)
{
this->setModal(true);
this->show();
case 0:
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
{
number++;
line->VisualMode(id);
}
break;
case 1:
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select point of center of arc")))
{
number++;
line->setLineP2Id(id);
line->RefreshGeometry();
}
break;
case 2:
if (SetObject(id, ui->comboBoxCenter, ""))
{
line->setRadiusId(id);
line->RefreshGeometry();
prepare = true;
this->setModal(true);
this->show();
}
break;
default:
break;
}
}
}

View File

@ -89,37 +89,31 @@ void DialogPointOfIntersection::setSecondPointId(const quint32 &value)
*/
void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
if (prepare == false)// After first choose we ignore all objects
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
if (number == 0)
if (type == SceneObject::Point)
{
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
line->VisualMode(id);
emit ToolTip(tr("Select point horizontally"));
return;
}
}
if (number == 1)
{
qint32 index = ui->comboBoxSecondPoint->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
number = 0;
line->setPoint2Id(id);
line->RefreshGeometry();
prepare = true;
emit ToolTip("");
}
if (isInitialized == false)
switch (number)
{
this->setModal(true);
this->show();
case 0:
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select point horizontally")))
{
number++;
line->VisualMode(id);
}
break;
case 1:
if (SetObject(id, ui->comboBoxSecondPoint, ""))
{
line->setPoint2Id(id);
line->RefreshGeometry();
prepare = true;
this->setModal(true);
this->show();
}
break;
default:
break;
}
}
}

View File

@ -146,50 +146,35 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
if (number == 0)
switch (number)
{
qint32 index = ui->comboBoxPShoulder->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxPShoulder->setCurrentIndex(index);
number++;
line->VisualMode(id);
emit ToolTip(tr("Select first point of line"));
return;
}
}
if (number == 1)
{
qint32 index = ui->comboBoxP1Line->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxP1Line->setCurrentIndex(index);
number++;
line->setLineP1Id(id);
line->RefreshGeometry();
emit ToolTip(tr("Select second point of line"));
return;
}
}
if (number == 2)
{
qint32 index = ui->comboBoxP2Line->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxP2Line->setCurrentIndex(index);
number = 0;
line->setLineP2Id(id);
line->RefreshGeometry();
prepare = true;
emit ToolTip("");
}
if (isInitialized == false)
{
this->setModal(true);
this->show();
}
case 0:
if (SetObject(id, ui->comboBoxPShoulder, tr("Select first point of line")))
{
number++;
line->VisualMode(id);
}
break;
case 1:
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
{
number++;
line->setLineP1Id(id);
line->RefreshGeometry();
}
break;
case 2:
if (SetObject(id, ui->comboBoxP2Line, ""))
{
line->setLineP2Id(id);
line->RefreshGeometry();
prepare = true;
this->setModal(true);
this->show();
}
break;
default:
break;
}
}
}

View File

@ -79,40 +79,42 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
if (number == 0)
switch (number)
{
qint32 index = ui->comboBoxP1->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxP1->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select last point of curve"));
return;
}
}
if (number == 1)
{
qint32 index = ui->comboBoxP4->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxP4->setCurrentIndex(index);
number = 0;
emit ToolTip("");
index = ui->comboBoxP1->currentIndex();
quint32 p1Id = qvariant_cast<quint32>(ui->comboBoxP1->itemData(index));
QPointF p1 = data->GeometricObject<const VPointF *>(p1Id)->toQPointF();
QPointF p4 = data->GeometricObject<const VPointF *>(id)->toQPointF();
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
}
if (isInitialized == false)
case 0:
if (SetObject(id, ui->comboBoxP1, tr("Select last point of curve")))
{
number++;
}
break;
case 1:
{
this->setModal(true);
this->show();
const VPointF *point = data->GeometricObject<const VPointF *>(id);
qint32 index = ui->comboBoxP4->findText(point->name());
if ( index != -1 )
{ // -1 for not found
ui->comboBoxP4->setCurrentIndex(index);
emit ToolTip("");
index = ui->comboBoxP1->currentIndex();
quint32 p1Id = qvariant_cast<quint32>(ui->comboBoxP1->itemData(index));
QPointF p1 = data->GeometricObject<const VPointF *>(p1Id)->toQPointF();
QPointF p4 = data->GeometricObject<const VPointF *>(id)->toQPointF();
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
this->setModal(true);
this->show();
}
else
{
qWarning()<<"Can't find object by name"<<point->name();
}
break;
}
default:
break;
}
}
}

View File

@ -322,25 +322,6 @@ void DialogTool::SetupTypeLine(QComboBox *box, const QString &value)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangeCurrentText select item in combobox by name
* @param box combobox
* @param value name of item
*/
void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value)
{
qint32 index = box->findText(value);
if (index != -1)
{
box->setCurrentIndex(index);
}
else
{
qDebug()<<"Can't find object by name"<<value;
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangeCurrentData select item in combobox by id
@ -579,18 +560,22 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip)
bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &toolTip)
{
SCASSERT(box != nullptr);
const VPointF *point = data->GeometricObject<const VPointF *>(id);
SCASSERT(point != nullptr);
const qint32 index = box->findText(point->name());
const VGObject *obj = data->GetGObject(id);
SCASSERT(obj != nullptr);
const qint32 index = box->findText(obj->name());
if ( index != -1 )
{ // -1 for not found
box->setCurrentIndex(index);
emit ToolTip(toolTip);
return true;
}
else
{
qWarning()<<"Can't find object by name"<<obj->name();
}
return false;
}

View File

@ -213,7 +213,6 @@ protected:
template <class key, class val>
void ShowVariable(const QMap<key, val> var);
void SetupTypeLine(QComboBox *box, const QString &value);
void ChangeCurrentText(QComboBox *box, const QString &value);
void ChangeCurrentData(QComboBox *box, const quint32 &value) const;
void PutValHere(QLineEdit *lineEdit, QListWidget *listWidget);
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
@ -229,7 +228,7 @@ protected:
void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value,
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
quint32 getCurrentObjectId(QComboBox *box) const;
bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip);
bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip);
void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight);
template <typename T>
void InitArrow(T *ui)

View File

@ -83,46 +83,48 @@ DialogTriangle::~DialogTriangle()
*/
void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
{
if (type == SceneObject::Point)
if (prepare == false)// After first choose we ignore all objects
{
const VPointF *point = data->GeometricObject<const VPointF *>(id);
switch (number)
if (type == SceneObject::Point)
{
case (0):
ChangeCurrentText(ui->comboBoxAxisP1, point->name());
number++;
line->VisualMode(id);
emit ToolTip(tr("Select second point of axis"));
break;
case (1):
ChangeCurrentText(ui->comboBoxAxisP2, point->name());
number++;
line->setPoint2Id(id);
line->RefreshGeometry();
emit ToolTip(tr("Select first point"));
break;
case (2):
ChangeCurrentText(ui->comboBoxFirstPoint, point->name());
number++;
line->setHypotenuseP1Id(id);
line->RefreshGeometry();
emit ToolTip(tr("Select second point"));
break;
case (3):
ChangeCurrentText(ui->comboBoxSecondPoint, point->name());
number = 0;
line->setHypotenuseP2Id(id);
line->RefreshGeometry();
prepare = true;
emit ToolTip(tr(""));
if (isInitialized == false)
{
this->setModal(true);
this->show();
}
break;
default:
break;
switch (number)
{
case (0):
if (SetObject(id, ui->comboBoxAxisP1, tr("Select second point of axis")))
{
number++;
line->VisualMode(id);
}
break;
case (1):
if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point")))
{
number++;
line->setPoint2Id(id);
line->RefreshGeometry();
}
break;
case (2):
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point")))
{
number++;
line->setHypotenuseP1Id(id);
line->RefreshGeometry();
}
break;
case (3):
if (SetObject(id, ui->comboBoxSecondPoint, ""))
{
line->setHypotenuseP2Id(id);
line->RefreshGeometry();
prepare = true;
this->setModal(true);
this->show();
}
break;
default:
break;
}
}
}
}