First build.

--HG--
branch : feature
This commit is contained in:
dismine 2014-08-26 21:31:28 +03:00
parent 988be1732f
commit bdfd292386
67 changed files with 218 additions and 88 deletions

View File

@ -213,44 +213,44 @@ QString DialogHistory::Record(const VToolRecord &tool)
{ {
switch ( tool.getTypeTool() ) switch ( tool.getTypeTool() )
{ {
case Tool::ArrowTool: case Tool::Arrow:
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
case Tool::SinglePointTool: case Tool::SinglePoint:
{ {
return QString(tr("%1 - Base point")).arg(PointName(tool.getId())); return QString(tr("%1 - Base point")).arg(PointName(tool.getId()));
} }
case Tool::EndLineTool: case Tool::EndLine:
{ {
return QString(tr("%1_%2 - Line from point %1 to point %2")) return QString(tr("%1_%2 - Line from point %1 to point %2"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrBasePoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrBasePoint)))
.arg(PointName(tool.getId())); .arg(PointName(tool.getId()));
} }
case Tool::LineTool: case Tool::Line:
{ {
return QString(tr("%1_%2 - Line from point %1 to point %2")) return QString(tr("%1_%2 - Line from point %1 to point %2"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint))); .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint)));
} }
case Tool::AlongLineTool: case Tool::AlongLine:
{ {
return QString(tr("%3 - Point along line %1_%2")) return QString(tr("%3 - Point along line %1_%2"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint)))
.arg(PointName(tool.getId())); .arg(PointName(tool.getId()));
} }
case Tool::ShoulderPointTool: case Tool::ShoulderPoint:
{ {
return QString(tr("%1 - Point of shoulder")).arg(PointName(tool.getId())); return QString(tr("%1 - Point of shoulder")).arg(PointName(tool.getId()));
} }
case Tool::NormalTool: case Tool::Normal:
{ {
return QString(tr("%3 - normal to line %1_%2")) return QString(tr("%3 - normal to line %1_%2"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint)))
.arg(PointName(tool.getId())); .arg(PointName(tool.getId()));
} }
case Tool::BisectorTool: case Tool::Bisector:
{ {
return QString(tr("%4 - bisector of angle %1_%2_%3")) return QString(tr("%4 - bisector of angle %1_%2_%3"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint)))
@ -258,7 +258,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrThirdPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrThirdPoint)))
.arg(PointName(tool.getId())); .arg(PointName(tool.getId()));
} }
case Tool::LineIntersectTool: case Tool::LineIntersect:
{ {
return QString(tr("%5 - intersection of lines %1_%2 and %3_%4")) return QString(tr("%5 - intersection of lines %1_%2 and %3_%4"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP1Line1))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP1Line1)))
@ -267,19 +267,19 @@ QString DialogHistory::Record(const VToolRecord &tool)
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP2Line2))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP2Line2)))
.arg(PointName(tool.getId())); .arg(PointName(tool.getId()));
} }
case Tool::SplineTool: case Tool::Spline:
{ {
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId()); const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId());
SCASSERT(spl != nullptr); SCASSERT(spl != nullptr);
return QString(tr("Curve %1_%2")).arg(PointName(spl->GetP1().id())).arg(PointName(spl->GetP4().id())); return QString(tr("Curve %1_%2")).arg(PointName(spl->GetP1().id())).arg(PointName(spl->GetP4().id()));
} }
case Tool::ArcTool: case Tool::Arc:
{ {
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId()); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
SCASSERT(arc != nullptr); SCASSERT(arc != nullptr);
return QString(tr("Arc with center in point %1")).arg(PointName(arc->GetCenter().id())); return QString(tr("Arc with center in point %1")).arg(PointName(arc->GetCenter().id()));
} }
case Tool::SplinePathTool: case Tool::SplinePath:
{ {
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId()); const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId());
SCASSERT(splPath != nullptr); SCASSERT(splPath != nullptr);
@ -331,7 +331,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint))); .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint)));
} }
case Tool::CutArcTool: case Tool::CutArc:
{ {
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, VToolCutArc::AttrArc)); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, VToolCutArc::AttrArc));
SCASSERT(arc != nullptr); SCASSERT(arc != nullptr);
@ -339,7 +339,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
.arg(PointName(tool.getId())) .arg(PointName(tool.getId()))
.arg(PointName(arc->GetCenter().id())); .arg(PointName(arc->GetCenter().id()));
} }
case Tool::CutSplineTool: case Tool::CutSpline:
{ {
const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline); const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline);
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(splineId); const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(splineId);
@ -349,7 +349,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
.arg(PointName(spl->GetP1().id())) .arg(PointName(spl->GetP1().id()))
.arg(PointName(spl->GetP4().id())); .arg(PointName(spl->GetP4().id()));
} }
case Tool::CutSplinePathTool: case Tool::CutSplinePath:
{ {
const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath); const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath);
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(splinePathId); const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(splinePathId);
@ -375,7 +375,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
} }
//Because "history" not only show history of pattern, but help restore current data for each pattern's //Because "history" not only show history of pattern, but help restore current data for each pattern's
//piece, we need add record about details and nodes, but don't show them. //piece, we need add record about details and nodes, but don't show them.
case Tool::DetailTool: case Tool::Detail:
break; break;
case Tool::UnionDetails: case Tool::UnionDetails:
break; break;

View File

@ -61,7 +61,7 @@
* @param parent parent widget. * @param parent parent widget.
*/ */
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Tool::ArrowTool), :QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Tool::Arrow),
currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr),
isInitialized(false), dialogTable(nullptr), dialogTool(nullptr), dialogHistory(nullptr), isInitialized(false), dialogTable(nullptr), dialogTool(nullptr), dialogHistory(nullptr),
comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0),
@ -202,7 +202,7 @@ void MainWindow::ActionNewPP()
QHash<quint32, VDataTool*>* tools = doc->getTools(); QHash<quint32, VDataTool*>* tools = doc->getTools();
SCASSERT(tools != nullptr); SCASSERT(tools != nullptr);
tools->insert(id, spoint); tools->insert(id, spoint);
VDrawTool::AddRecord(id, Tool::SinglePointTool, doc); VDrawTool::AddRecord(id, Tool::SinglePoint, doc);
SetEnableTool(true); SetEnableTool(true);
SetEnableWidgets(true); SetEnableWidgets(true);
@ -387,7 +387,7 @@ void MainWindow::ApplyDialog()
*/ */
void MainWindow::ToolEndLine(bool checked) void MainWindow::ToolEndLine(bool checked)
{ {
SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLine, ":/cursor/endline_cursor.png", tr("Select point"),
&MainWindow::ClosedDialogWithApply<VToolEndLine>, &MainWindow::ClosedDialogWithApply<VToolEndLine>,
&MainWindow::ApplyDialog<VToolEndLine>); &MainWindow::ApplyDialog<VToolEndLine>);
} }
@ -399,7 +399,7 @@ void MainWindow::ToolEndLine(bool checked)
*/ */
void MainWindow::ToolLine(bool checked) void MainWindow::ToolLine(bool checked)
{ {
SetToolButtonWithApply<DialogLine>(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"), SetToolButtonWithApply<DialogLine>(checked, Tool::Line, ":/cursor/line_cursor.png", tr("Select first point"),
&MainWindow::ClosedDialogWithApply<VToolLine>, &MainWindow::ClosedDialogWithApply<VToolLine>,
&MainWindow::ApplyDialog<VToolLine>); &MainWindow::ApplyDialog<VToolLine>);
} }
@ -411,7 +411,7 @@ void MainWindow::ToolLine(bool checked)
*/ */
void MainWindow::ToolAlongLine(bool checked) void MainWindow::ToolAlongLine(bool checked)
{ {
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png", SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLine, ":/cursor/alongline_cursor.png",
tr("Select point"), &MainWindow::ClosedDialogWithApply<VToolAlongLine>, tr("Select point"), &MainWindow::ClosedDialogWithApply<VToolAlongLine>,
&MainWindow::ApplyDialog<VToolAlongLine>); &MainWindow::ApplyDialog<VToolAlongLine>);
} }
@ -423,7 +423,7 @@ void MainWindow::ToolAlongLine(bool checked)
*/ */
void MainWindow::ToolShoulderPoint(bool checked) void MainWindow::ToolShoulderPoint(bool checked)
{ {
SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png", SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPoint, ":/cursor/shoulder_cursor.png",
tr("Select point of shoulder"), tr("Select point of shoulder"),
&MainWindow::ClosedDialogWithApply<VToolShoulderPoint>, &MainWindow::ClosedDialogWithApply<VToolShoulderPoint>,
&MainWindow::ApplyDialog<VToolShoulderPoint>); &MainWindow::ApplyDialog<VToolShoulderPoint>);
@ -436,7 +436,7 @@ void MainWindow::ToolShoulderPoint(bool checked)
*/ */
void MainWindow::ToolNormal(bool checked) void MainWindow::ToolNormal(bool checked)
{ {
SetToolButtonWithApply<DialogNormal>(checked, Tool::NormalTool, ":/cursor/normal_cursor.png", SetToolButtonWithApply<DialogNormal>(checked, Tool::Normal, ":/cursor/normal_cursor.png",
tr("Select first point of line"), tr("Select first point of line"),
&MainWindow::ClosedDialogWithApply<VToolNormal>, &MainWindow::ClosedDialogWithApply<VToolNormal>,
&MainWindow::ApplyDialog<VToolNormal>); &MainWindow::ApplyDialog<VToolNormal>);
@ -449,7 +449,7 @@ void MainWindow::ToolNormal(bool checked)
*/ */
void MainWindow::ToolBisector(bool checked) void MainWindow::ToolBisector(bool checked)
{ {
SetToolButtonWithApply<DialogBisector>(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png", SetToolButtonWithApply<DialogBisector>(checked, Tool::Bisector, ":/cursor/bisector_cursor.png",
tr("Select first point of angle"), tr("Select first point of angle"),
&MainWindow::ClosedDialogWithApply<VToolBisector>, &MainWindow::ClosedDialogWithApply<VToolBisector>,
&MainWindow::ApplyDialog<VToolBisector>); &MainWindow::ApplyDialog<VToolBisector>);
@ -462,7 +462,7 @@ void MainWindow::ToolBisector(bool checked)
*/ */
void MainWindow::ToolLineIntersect(bool checked) void MainWindow::ToolLineIntersect(bool checked)
{ {
SetToolButtonWithApply<DialogLineIntersect>(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png", SetToolButtonWithApply<DialogLineIntersect>(checked, Tool::LineIntersect, ":/cursor/intersect_cursor.png",
tr("Select first point of first line"), tr("Select first point of first line"),
&MainWindow::ClosedDialogWithApply<VToolLineIntersect>, &MainWindow::ClosedDialogWithApply<VToolLineIntersect>,
&MainWindow::ApplyDialog<VToolLineIntersect>); &MainWindow::ApplyDialog<VToolLineIntersect>);
@ -475,7 +475,7 @@ void MainWindow::ToolLineIntersect(bool checked)
*/ */
void MainWindow::ToolSpline(bool checked) void MainWindow::ToolSpline(bool checked)
{ {
SetToolButtonWithApply<DialogSpline>(checked, Tool::SplineTool, ":/cursor/spline_cursor.png", SetToolButtonWithApply<DialogSpline>(checked, Tool::Spline, ":/cursor/spline_cursor.png",
tr("Select first point curve"), tr("Select first point curve"),
&MainWindow::ClosedDialogWithApply<VToolSpline>, &MainWindow::ClosedDialogWithApply<VToolSpline>,
&MainWindow::ApplyDialog<VToolSpline>); &MainWindow::ApplyDialog<VToolSpline>);
@ -488,7 +488,7 @@ void MainWindow::ToolSpline(bool checked)
*/ */
void MainWindow::ToolCutSpline(bool checked) void MainWindow::ToolCutSpline(bool checked)
{ {
SetToolButton<DialogCutSpline>(checked, Tool::CutSplineTool, ":/cursor/spline_cut_point_cursor.png", SetToolButton<DialogCutSpline>(checked, Tool::CutSpline, ":/cursor/spline_cut_point_cursor.png",
tr("Select simple curve"), &MainWindow::ClosedDialog<VToolCutSpline>); tr("Select simple curve"), &MainWindow::ClosedDialog<VToolCutSpline>);
} }
@ -499,7 +499,7 @@ void MainWindow::ToolCutSpline(bool checked)
*/ */
void MainWindow::ToolArc(bool checked) void MainWindow::ToolArc(bool checked)
{ {
SetToolButtonWithApply<DialogArc>(checked, Tool::ArcTool, ":/cursor/arc_cursor.png", SetToolButtonWithApply<DialogArc>(checked, Tool::Arc, ":/cursor/arc_cursor.png",
tr("Select point of center of arc"), &MainWindow::ClosedDialogWithApply<VToolArc>, tr("Select point of center of arc"), &MainWindow::ClosedDialogWithApply<VToolArc>,
&MainWindow::ApplyDialog<VToolArc>); &MainWindow::ApplyDialog<VToolArc>);
} }
@ -511,7 +511,7 @@ void MainWindow::ToolArc(bool checked)
*/ */
void MainWindow::ToolSplinePath(bool checked) void MainWindow::ToolSplinePath(bool checked)
{ {
SetToolButton<DialogSplinePath>(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png", SetToolButton<DialogSplinePath>(checked, Tool::SplinePath, ":/cursor/splinepath_cursor.png",
tr("Select point of curve path"), &MainWindow::ClosedDialog<VToolSplinePath>); tr("Select point of curve path"), &MainWindow::ClosedDialog<VToolSplinePath>);
} }
@ -522,7 +522,7 @@ void MainWindow::ToolSplinePath(bool checked)
*/ */
void MainWindow::ToolCutSplinePath(bool checked) void MainWindow::ToolCutSplinePath(bool checked)
{ {
SetToolButton<DialogCutSplinePath>(checked, Tool::CutSplinePathTool, SetToolButton<DialogCutSplinePath>(checked, Tool::CutSplinePath,
":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"), ":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"),
&MainWindow::ClosedDialog<VToolCutSplinePath>); &MainWindow::ClosedDialog<VToolCutSplinePath>);
} }
@ -547,7 +547,7 @@ void MainWindow::ToolPointOfContact(bool checked)
*/ */
void MainWindow::ToolDetail(bool checked) void MainWindow::ToolDetail(bool checked)
{ {
SetToolButton<DialogDetail>(checked, Tool::DetailTool, "://cursor/new_detail_cursor.png", SetToolButton<DialogDetail>(checked, Tool::Detail, "://cursor/new_detail_cursor.png",
tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail); tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail);
} }
@ -636,7 +636,7 @@ void MainWindow::ClosedDialogUnionDetails(int result)
*/ */
void MainWindow::ToolCutArc(bool checked) void MainWindow::ToolCutArc(bool checked)
{ {
SetToolButtonWithApply<DialogCutArc>(checked, Tool::CutArcTool, ":/cursor/arc_cut_cursor.png", SetToolButtonWithApply<DialogCutArc>(checked, Tool::CutArc, ":/cursor/arc_cut_cursor.png",
tr("Select arc"), &MainWindow::ClosedDialogWithApply<VToolCutArc>, tr("Select arc"), &MainWindow::ClosedDialogWithApply<VToolCutArc>,
&MainWindow::ApplyDialog<VToolCutArc>); &MainWindow::ApplyDialog<VToolCutArc>);
} }
@ -944,60 +944,60 @@ void MainWindow::CancelTool()
dialogTool = nullptr; dialogTool = nullptr;
switch ( tool ) switch ( tool )
{ {
case Tool::ArrowTool: case Tool::Arrow:
ui->actionArrowTool->setChecked(false); ui->actionArrowTool->setChecked(false);
helpLabel->setText(""); helpLabel->setText("");
break; break;
case Tool::SinglePointTool: case Tool::SinglePoint:
Q_UNREACHABLE(); Q_UNREACHABLE();
//Nothing to do here because we can't create this tool from main window. //Nothing to do here because we can't create this tool from main window.
break; break;
case Tool::EndLineTool: case Tool::EndLine:
ui->toolButtonEndLine->setChecked(false); ui->toolButtonEndLine->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::LineTool: case Tool::Line:
ui->toolButtonLine->setChecked(false); ui->toolButtonLine->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearFocus(); currentScene->clearFocus();
break; break;
case Tool::AlongLineTool: case Tool::AlongLine:
ui->toolButtonAlongLine->setChecked(false); ui->toolButtonAlongLine->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::ShoulderPointTool: case Tool::ShoulderPoint:
ui->toolButtonShoulderPoint->setChecked(false); ui->toolButtonShoulderPoint->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::NormalTool: case Tool::Normal:
ui->toolButtonNormal->setChecked(false); ui->toolButtonNormal->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::BisectorTool: case Tool::Bisector:
ui->toolButtonBisector->setChecked(false); ui->toolButtonBisector->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::LineIntersectTool: case Tool::LineIntersect:
ui->toolButtonLineIntersect->setChecked(false); ui->toolButtonLineIntersect->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::SplineTool: case Tool::Spline:
ui->toolButtonSpline->setChecked(false); ui->toolButtonSpline->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::ArcTool: case Tool::Arc:
ui->toolButtonArc->setChecked(false); ui->toolButtonArc->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::SplinePathTool: case Tool::SplinePath:
ui->toolButtonSplinePath->setChecked(false); ui->toolButtonSplinePath->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
@ -1007,7 +1007,7 @@ void MainWindow::CancelTool()
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::DetailTool: case Tool::Detail:
ui->toolButtonNewDetail->setChecked(false); ui->toolButtonNewDetail->setChecked(false);
break; break;
case Tool::Height: case Tool::Height:
@ -1025,12 +1025,12 @@ void MainWindow::CancelTool()
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::CutSplineTool: case Tool::CutSpline:
ui->toolButtonSplineCutPoint->setChecked(false); ui->toolButtonSplineCutPoint->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::CutSplinePathTool: case Tool::CutSplinePath:
ui->toolButtonSplinePathCutPoint->setChecked(false); ui->toolButtonSplinePathCutPoint->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
@ -1040,7 +1040,7 @@ void MainWindow::CancelTool()
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
break; break;
case Tool::CutArcTool: case Tool::CutArc:
ui->toolButtonArcCutPoint->setChecked(false); ui->toolButtonArcCutPoint->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
@ -1063,7 +1063,7 @@ void MainWindow::ArrowTool()
{ {
CancelTool(); CancelTool();
ui->actionArrowTool->setChecked(true); ui->actionArrowTool->setChecked(true);
tool = Tool::ArrowTool; tool = Tool::Arrow;
QCursor cur(Qt::ArrowCursor); QCursor cur(Qt::ArrowCursor);
ui->view->setCursor(cur); ui->view->setCursor(cur);
helpLabel->setText(""); helpLabel->setText("");

View File

@ -40,6 +40,8 @@ public:
VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr); VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr);
static const QString TagName; static const QString TagName;
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::AbstractSpline)};
public slots: public slots:
virtual void FullUpdateFromFile (); virtual void FullUpdateFromFile ();
void Disable(bool disable); void Disable(bool disable);

View File

@ -272,7 +272,7 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::AlongLineTool, doc); VDrawTool::AddRecord(id, Tool::AlongLine, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId, VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId,

View File

@ -49,6 +49,8 @@ public:
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::AlongLine)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);

View File

@ -149,7 +149,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::ArcTool, doc); VDrawTool::AddRecord(id, Tool::Arc, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);

View File

@ -46,6 +46,8 @@ public:
const Source &typeCreation); const Source &typeCreation);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Arc)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
protected: protected:

View File

@ -196,7 +196,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::BisectorTool, doc); VDrawTool::AddRecord(id, Tool::Bisector, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId, VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId,

View File

@ -53,6 +53,8 @@ public:
VPattern *doc, VContainer *data, const Document &parse, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation); const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Bisector)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);

View File

@ -38,6 +38,8 @@ class VToolCut : public VToolPoint
public: public:
VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &curveCutId, VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &curveCutId,
const quint32 &curve1id, const quint32 &curve2id, QGraphicsItem * parent = nullptr); const quint32 &curve1id, const quint32 &curve2id, QGraphicsItem * parent = nullptr);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Cut)};
public slots: public slots:
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
virtual void CurveChoosed(quint32 id)=0; virtual void CurveChoosed(quint32 id)=0;

View File

@ -163,7 +163,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
} }
} }
VDrawTool::AddRecord(id, Tool::CutArcTool, doc); VDrawTool::AddRecord(id, Tool::CutArc, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, typeCreation); VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, typeCreation);

View File

@ -48,6 +48,8 @@ public:
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
static const QString AttrArc; static const QString AttrArc;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::CutArc)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void CurveChoosed(quint32 id); virtual void CurveChoosed(quint32 id);

View File

@ -163,7 +163,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::CutSplineTool, doc); VDrawTool::AddRecord(id, Tool::CutSpline, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, typeCreation); VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, typeCreation);

View File

@ -49,6 +49,8 @@ public:
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
static const QString AttrSpline; static const QString AttrSpline;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::CutSpline)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void CurveChoosed(quint32 id); virtual void CurveChoosed(quint32 id);

View File

@ -217,7 +217,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
} }
} }
VDrawTool::AddRecord(id, Tool::CutSplinePathTool, doc); VDrawTool::AddRecord(id, Tool::CutSplinePath, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id, VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,

View File

@ -50,6 +50,8 @@ public:
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
static const QString AttrSplinePath; static const QString AttrSplinePath;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::CutSplinePath)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void CurveChoosed(quint32 id); virtual void CurveChoosed(quint32 id);

View File

@ -154,7 +154,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::EndLineTool, doc); VDrawTool::AddRecord(id, Tool::EndLine, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formulaLength, formulaAngle, basePointId, VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formulaLength, formulaAngle, basePointId,

View File

@ -49,6 +49,8 @@ public:
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::EndLine)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);

View File

@ -50,6 +50,8 @@ public:
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static QPointF FindPoint(const QLineF &line, const QPointF &point); static QPointF FindPoint(const QLineF &line, const QPointF &point);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Height)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);

View File

@ -147,7 +147,7 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::LineTool, doc); VDrawTool::AddRecord(id, Tool::Line, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation); VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation);

View File

@ -48,6 +48,8 @@ public:
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString TagName; static const QString TagName;
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Line)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);

View File

@ -166,7 +166,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::LineIntersectTool, doc); VDrawTool::AddRecord(id, Tool::LineIntersect, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id, VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id,

View File

@ -48,6 +48,8 @@ public:
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::LineIntersect)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);

View File

@ -40,6 +40,8 @@ class VToolLinePoint : public VToolPoint
public: public:
VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
const quint32 &basePointId, const qreal &angle, QGraphicsItem * parent = nullptr); const quint32 &basePointId, const qreal &angle, QGraphicsItem * parent = nullptr);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::LinePoint)};
public slots: public slots:
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);

View File

@ -157,7 +157,7 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::NormalTool, doc); VDrawTool::AddRecord(id, Tool::Normal, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle, VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle,

View File

@ -50,6 +50,8 @@ public:
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length,
const qreal &angle = 0); const qreal &angle = 0);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Normal)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);

View File

@ -51,6 +51,8 @@ public:
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::PointOfContact) };
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);

View File

@ -49,6 +49,8 @@ public:
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::PointOfIntersection) };
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);

View File

@ -199,7 +199,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::ShoulderPointTool, doc); VDrawTool::AddRecord(id, Tool::ShoulderPoint, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula, VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula,

View File

@ -51,6 +51,8 @@ public:
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::ShoulderPoint) };
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);

View File

@ -82,6 +82,24 @@ void VToolSinglePoint::setDialog()
dialogTool->setData(p->name(), p->toQPointF()); dialogTool->setData(p->name(), p->toQPointF());
} }
//---------------------------------------------------------------------------------------------------------------------
QString VToolSinglePoint::name() const
{
return VAbstractTool::data.GeometricObject<VPointF>(id)->name();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::setName(const QString &name)
{
}
//---------------------------------------------------------------------------------------------------------------------
int VToolSinglePoint::type() const
{
return Type;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief AddToFile add tag with informations about tool into file. * @brief AddToFile add tag with informations about tool into file.

View File

@ -43,6 +43,10 @@ public:
const QString &namePP, const QString &mPath, QGraphicsItem * parent = nullptr ); const QString &namePP, const QString &mPath, QGraphicsItem * parent = nullptr );
virtual void setDialog(); virtual void setDialog();
static const QString ToolType; static const QString ToolType;
QString name() const;
void setName(const QString &name);
virtual int type()const;
enum { Type = UserType + static_cast<int>(Tool::SinglePoint)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);

View File

@ -172,7 +172,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, const quint32 &p1, const qui
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::SplineTool, doc); VDrawTool::AddRecord(id, Tool::Spline, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation); VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation);

View File

@ -48,6 +48,8 @@ public:
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation); const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Spline)};
public slots: public slots:
void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position, void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position,
const QPointF &pos); const QPointF &pos);

View File

@ -146,7 +146,7 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VDrawTool::AddRecord(id, Tool::SplinePathTool, doc); VDrawTool::AddRecord(id, Tool::SplinePath, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation); VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);

View File

@ -46,6 +46,8 @@ public:
VContainer *data, const Document &parse, const Source &typeCreation); VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType; static const QString ToolType;
static void UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path); static void UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::SplinePath)};
signals: signals:
/** /**
* @brief RefreshLine refresh control line. * @brief RefreshLine refresh control line.

View File

@ -51,6 +51,8 @@ public:
static QPointF FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint, static QPointF FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint,
const QPointF &secondPoint); const QPointF &secondPoint);
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Triangle)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);

View File

@ -49,6 +49,8 @@ public:
static const QString ToolType; static const QString ToolType;
virtual void DeleteNode(); virtual void DeleteNode();
virtual void RestoreNode(); virtual void RestoreNode();
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::NodeArc)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
protected: protected:

View File

@ -55,6 +55,8 @@ public:
static const QString ToolType; static const QString ToolType;
virtual void DeleteNode(); virtual void DeleteNode();
virtual void RestoreNode(); virtual void RestoreNode();
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::NodePoint)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
void NameChangePosition(const QPointF &pos); void NameChangePosition(const QPointF &pos);

View File

@ -49,6 +49,8 @@ public:
static const QString ToolType; static const QString ToolType;
virtual void DeleteNode(); virtual void DeleteNode();
virtual void RestoreNode(); virtual void RestoreNode();
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::NodeSpline)};
public slots: public slots:
virtual void FullUpdateFromFile (); virtual void FullUpdateFromFile ();
protected: protected:

View File

@ -48,6 +48,8 @@ public:
static const QString ToolType; static const QString ToolType;
virtual void DeleteNode(); virtual void DeleteNode();
virtual void RestoreNode(); virtual void RestoreNode();
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::SplinePath)};
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
protected: protected:

View File

@ -216,7 +216,7 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
VAbstractTool::AddRecord(id, Tool::DetailTool, doc); VAbstractTool::AddRecord(id, Tool::Detail, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene); VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene);

View File

@ -82,6 +82,8 @@ public:
static const QString NodeSplinePath; static const QString NodeSplinePath;
void Remove(bool ask); void Remove(bool ask);
static void AddNode(VPattern *doc, QDomElement &domElement, const VNodeDetail &node); static void AddNode(VPattern *doc, QDomElement &domElement, const VNodeDetail &node);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Detail)};
public slots: public slots:
virtual void FullUpdateFromFile (); virtual void FullUpdateFromFile ();
virtual void FullUpdateFromGuiOk(int result); virtual void FullUpdateFromGuiOk(int result);

View File

@ -43,6 +43,8 @@ public:
VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, const QPointF &controlPoint, VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, const QPointF &controlPoint,
const QPointF &splinePoint, QGraphicsItem * parent = nullptr); const QPointF &splinePoint, QGraphicsItem * parent = nullptr);
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ControlPointSpline)};
signals: signals:
/** /**
* @brief ControlPointChangePosition emit when control point change position. * @brief ControlPointChangePosition emit when control point change position.

View File

@ -31,6 +31,7 @@
#include <QGraphicsSimpleTextItem> #include <QGraphicsSimpleTextItem>
#include <QObject> #include <QObject>
#include "../options.h"
/** /**
* @brief The VGraphicsSimpleTextItem class pointer label. * @brief The VGraphicsSimpleTextItem class pointer label.
@ -44,6 +45,8 @@ public:
qint32 FontSize()const; qint32 FontSize()const;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::GraphicsSimpleTextItem)};
signals: signals:
/** /**
* @brief NameChangePosition emit when label change position. * @brief NameChangePosition emit when label change position.

View File

@ -42,6 +42,8 @@ public:
VisLine(const VContainer *data, QGraphicsItem *parent = 0); VisLine(const VContainer *data, QGraphicsItem *parent = 0);
virtual ~VisLine(); virtual ~VisLine();
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::Line)};
protected: protected:
QLineF Line(const QPointF &p1, const qreal& length, const qreal &angle); QLineF Line(const QPointF &p1, const qreal& length, const qreal &angle);
qreal CorrectAngle(const qreal &angle) const; qreal CorrectAngle(const qreal &angle) const;

View File

@ -39,6 +39,8 @@ public:
VisPath(const VContainer *data, QGraphicsItem *parent = 0); VisPath(const VContainer *data, QGraphicsItem *parent = 0);
virtual ~VisPath(); virtual ~VisPath();
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::Path)};
protected: protected:
virtual void InitPen(); virtual void InitPen();
virtual void AddOnScene(); virtual void AddOnScene();

View File

@ -43,6 +43,8 @@ public:
virtual void RefreshGeometry(); virtual void RefreshGeometry();
void setPoint2Id(const quint32 &value); void setPoint2Id(const quint32 &value);
void setLength(const QString &expression); void setLength(const QString &expression);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolAlongLine)};
private: private:
Q_DISABLE_COPY(VisToolAlongLine) Q_DISABLE_COPY(VisToolAlongLine)
quint32 point2Id; quint32 point2Id;

View File

@ -43,6 +43,8 @@ public:
void setRadius(const QString &expression); void setRadius(const QString &expression);
void setF1(const QString &expression); void setF1(const QString &expression);
void setF2(const QString &expression); void setF2(const QString &expression);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolArc)};
private: private:
Q_DISABLE_COPY(VisToolArc) Q_DISABLE_COPY(VisToolArc)
QGraphicsEllipseItem *arcCenter; QGraphicsEllipseItem *arcCenter;

View File

@ -42,6 +42,8 @@ public:
void setPoint2Id(const quint32 &value); void setPoint2Id(const quint32 &value);
void setPoint3Id(const quint32 &value); void setPoint3Id(const quint32 &value);
void setLength(const QString &expression); void setLength(const QString &expression);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolBisector)};
private: private:
Q_DISABLE_COPY(VisToolBisector) Q_DISABLE_COPY(VisToolBisector)
quint32 point2Id; quint32 point2Id;

View File

@ -40,6 +40,8 @@ public:
virtual void RefreshGeometry(); virtual void RefreshGeometry();
void setLength(const QString &expression); void setLength(const QString &expression);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolCutArc)};
protected: protected:
Q_DISABLE_COPY(VisToolCutArc) Q_DISABLE_COPY(VisToolCutArc)
QGraphicsEllipseItem *point; QGraphicsEllipseItem *point;

View File

@ -44,6 +44,8 @@ public:
QString Angle() const; QString Angle() const;
void setAngle(const QString &expression); void setAngle(const QString &expression);
void setLength(const QString &expression); void setLength(const QString &expression);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolEndLine)};
private: private:
Q_DISABLE_COPY(VisToolEndLine) Q_DISABLE_COPY(VisToolEndLine)
qreal length; qreal length;

View File

@ -42,6 +42,8 @@ public:
void setLineP1Id(const quint32 &value); void setLineP1Id(const quint32 &value);
void setLineP2Id(const quint32 &value); void setLineP2Id(const quint32 &value);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolHeight)};
private: private:
Q_DISABLE_COPY(VisToolHeight) Q_DISABLE_COPY(VisToolHeight)
//base point in parent class //base point in parent class

View File

@ -40,6 +40,8 @@ public:
virtual void RefreshGeometry(); virtual void RefreshGeometry();
void setPoint2Id(const quint32 &value); void setPoint2Id(const quint32 &value);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolLine)};
private: private:
Q_DISABLE_COPY(VisToolLine) Q_DISABLE_COPY(VisToolLine)
quint32 point2Id; quint32 point2Id;

View File

@ -43,6 +43,8 @@ public:
void setLine1P2Id(const quint32 &value); void setLine1P2Id(const quint32 &value);
void setLine2P1Id(const quint32 &value); void setLine2P1Id(const quint32 &value);
void setLine2P2Id(const quint32 &value); void setLine2P2Id(const quint32 &value);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolLineIntersect)};
private: private:
Q_DISABLE_COPY(VisToolLineIntersect) Q_DISABLE_COPY(VisToolLineIntersect)
quint32 line1P2Id; quint32 line1P2Id;

View File

@ -44,6 +44,8 @@ public:
void setLength(const QString &expression); void setLength(const QString &expression);
qreal getAngle() const; qreal getAngle() const;
void setAngle(const qreal &value); void setAngle(const qreal &value);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolNormal)};
private: private:
Q_DISABLE_COPY(VisToolNormal) Q_DISABLE_COPY(VisToolNormal)
quint32 point2Id; quint32 point2Id;

View File

@ -42,6 +42,8 @@ public:
void setLineP2Id(const quint32 &value); void setLineP2Id(const quint32 &value);
void setRadiusId(const quint32 &value); void setRadiusId(const quint32 &value);
void setRadius(const QString &expression); void setRadius(const QString &expression);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfContact)};
private: private:
Q_DISABLE_COPY(VisToolPointOfContact) Q_DISABLE_COPY(VisToolPointOfContact)
quint32 lineP2Id; quint32 lineP2Id;

View File

@ -41,6 +41,8 @@ public:
virtual void RefreshGeometry(); virtual void RefreshGeometry();
void setPoint2Id(const quint32 &value); void setPoint2Id(const quint32 &value);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersection)};
private: private:
Q_DISABLE_COPY(VisToolPointOfIntersection) Q_DISABLE_COPY(VisToolPointOfIntersection)
quint32 point2Id; quint32 point2Id;

View File

@ -42,6 +42,8 @@ public:
void setLineP1Id(const quint32 &value); void setLineP1Id(const quint32 &value);
void setLineP2Id(const quint32 &value); void setLineP2Id(const quint32 &value);
void setLength(const QString &expression); void setLength(const QString &expression);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolShoulderPoint)};
private: private:
Q_DISABLE_COPY(VisToolShoulderPoint) Q_DISABLE_COPY(VisToolShoulderPoint)
quint32 lineP1Id; quint32 lineP1Id;

View File

@ -46,6 +46,9 @@ public:
void setKAsm1(const qreal &value); void setKAsm1(const qreal &value);
void setKAsm2(const qreal &value); void setKAsm2(const qreal &value);
void setKCurve(const qreal &value); void setKCurve(const qreal &value);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolSpline)};
protected: protected:
Q_DISABLE_COPY(VisToolSpline) Q_DISABLE_COPY(VisToolSpline)
quint32 point4Id; quint32 point4Id;

View File

@ -43,6 +43,9 @@ public:
void setPoint2Id(const quint32 &value); void setPoint2Id(const quint32 &value);
void setHypotenuseP1Id(const quint32 &value); void setHypotenuseP1Id(const quint32 &value);
void setHypotenuseP2Id(const quint32 &value); void setHypotenuseP2Id(const quint32 &value);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolTriangle)};
private: private:
Q_DISABLE_COPY(VisToolTriangle) Q_DISABLE_COPY(VisToolTriangle)
quint32 point2Id;//axis second point quint32 point2Id;//axis second point

View File

@ -45,6 +45,9 @@ public:
qreal *factor = nullptr, QObject *parent = 0); qreal *factor = nullptr, QObject *parent = 0);
void ChangedActivDraw(const bool &flag); void ChangedActivDraw(const bool &flag);
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::SimpleCurvePoint)};
signals: signals:
/** /**
* @brief Choosed send id when clicked. * @brief Choosed send id when clicked.

View File

@ -42,6 +42,9 @@ class VSimpleSplinePath : public VAbstractTool, public QGraphicsPathItem
public: public:
VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor); VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor);
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Vis::SimpleSplinePath)};
protected: protected:
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );

View File

@ -46,18 +46,20 @@ VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent)
idToProperty(QMap<QString, VProperty *>()) idToProperty(QMap<QString, VProperty *>())
{ {
PropertyModel = new VPropertyModel(this); PropertyModel = new VPropertyModel(this);
TreeView = new VPropertyFormView(PropertyModel); TreeView = new VPropertyFormView(PropertyModel, parent);
TreeView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); TreeView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QScrollArea *scroll = new QScrollArea(); QScrollArea *scroll = new QScrollArea(parent);
scroll->setWidgetResizable(true); scroll->setWidgetResizable(true);
scroll->setWidget(TreeView); scroll->setWidget(TreeView);
QHBoxLayout* layout = new QHBoxLayout(); // QLayout* layout = parent->layout();
parent->setLayout(layout); // layout->setSpacing(5);
layout->setSpacing(5); // layout->setMargin(0);
layout->setMargin(0); // layout->addWidget(scroll);
layout->addWidget(scroll); // parent->setLayout(layout);
parent->setWidget(scroll);
connect(PropertyModel, SIGNAL(onDataChangedByEditor(VProperty*)), this, SLOT(userChangedData(VProperty*))); connect(PropertyModel, SIGNAL(onDataChangedByEditor(VProperty*)), this, SLOT(userChangedData(VProperty*)));
} }

View File

@ -1095,7 +1095,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const qreal y = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0")); const qreal y = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0"));
data->UpdateGObject(id, new VPointF(x, y, name, mx, my)); data->UpdateGObject(id, new VPointF(x, y, name, mx, my));
VDrawTool::AddRecord(id, Tool::SinglePointTool, this); VDrawTool::AddRecord(id, Tool::SinglePoint, this);
if (parse != Document::FullParse) if (parse != Document::FullParse)
{ {
UpdateToolData(id, data); UpdateToolData(id, data);
@ -2424,40 +2424,40 @@ QRectF VPattern::ActiveDrawBoundingRect() const
{ {
switch ( tool.getTypeTool() ) switch ( tool.getTypeTool() )
{ {
case Tool::ArrowTool: case Tool::Arrow:
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
case Tool::SinglePointTool: case Tool::SinglePoint:
rec = ToolBoundingRect<VToolSinglePoint>(rec, tool.getId()); rec = ToolBoundingRect<VToolSinglePoint>(rec, tool.getId());
break; break;
case Tool::EndLineTool: case Tool::EndLine:
rec = ToolBoundingRect<VToolEndLine>(rec, tool.getId()); rec = ToolBoundingRect<VToolEndLine>(rec, tool.getId());
break; break;
case Tool::LineTool: case Tool::Line:
rec = ToolBoundingRect<VToolLine>(rec, tool.getId()); rec = ToolBoundingRect<VToolLine>(rec, tool.getId());
break; break;
case Tool::AlongLineTool: case Tool::AlongLine:
rec = ToolBoundingRect<VToolAlongLine>(rec, tool.getId()); rec = ToolBoundingRect<VToolAlongLine>(rec, tool.getId());
break; break;
case Tool::ShoulderPointTool: case Tool::ShoulderPoint:
rec = ToolBoundingRect<VToolShoulderPoint>(rec, tool.getId()); rec = ToolBoundingRect<VToolShoulderPoint>(rec, tool.getId());
break; break;
case Tool::NormalTool: case Tool::Normal:
rec = ToolBoundingRect<VToolNormal>(rec, tool.getId()); rec = ToolBoundingRect<VToolNormal>(rec, tool.getId());
break; break;
case Tool::BisectorTool: case Tool::Bisector:
rec = ToolBoundingRect<VToolBisector>(rec, tool.getId()); rec = ToolBoundingRect<VToolBisector>(rec, tool.getId());
break; break;
case Tool::LineIntersectTool: case Tool::LineIntersect:
rec = ToolBoundingRect<VToolLineIntersect>(rec, tool.getId()); rec = ToolBoundingRect<VToolLineIntersect>(rec, tool.getId());
break; break;
case Tool::SplineTool: case Tool::Spline:
rec = ToolBoundingRect<VToolSpline>(rec, tool.getId()); rec = ToolBoundingRect<VToolSpline>(rec, tool.getId());
break; break;
case Tool::ArcTool: case Tool::Arc:
rec = ToolBoundingRect<VToolArc>(rec, tool.getId()); rec = ToolBoundingRect<VToolArc>(rec, tool.getId());
break; break;
case Tool::SplinePathTool: case Tool::SplinePath:
rec = ToolBoundingRect<VToolSplinePath>(rec, tool.getId()); rec = ToolBoundingRect<VToolSplinePath>(rec, tool.getId());
break; break;
case Tool::PointOfContact: case Tool::PointOfContact:
@ -2472,18 +2472,18 @@ QRectF VPattern::ActiveDrawBoundingRect() const
case Tool::PointOfIntersection: case Tool::PointOfIntersection:
rec = ToolBoundingRect<VToolPointOfIntersection>(rec, tool.getId()); rec = ToolBoundingRect<VToolPointOfIntersection>(rec, tool.getId());
break; break;
case Tool::CutArcTool: case Tool::CutArc:
rec = ToolBoundingRect<VToolCutArc>(rec, tool.getId()); rec = ToolBoundingRect<VToolCutArc>(rec, tool.getId());
break; break;
case Tool::CutSplineTool: case Tool::CutSpline:
rec = ToolBoundingRect<VToolCutSpline>(rec, tool.getId()); rec = ToolBoundingRect<VToolCutSpline>(rec, tool.getId());
break; break;
case Tool::CutSplinePathTool: case Tool::CutSplinePath:
rec = ToolBoundingRect<VToolCutSplinePath>(rec, tool.getId()); rec = ToolBoundingRect<VToolCutSplinePath>(rec, tool.getId());
break; break;
//Because "history" not only show history of pattern, but help restore current data for each pattern's //Because "history" not only show history of pattern, but help restore current data for each pattern's
//piece, we need add record about details and nodes, but don't show them. //piece, we need add record about details and nodes, but don't show them.
case Tool::DetailTool: case Tool::Detail:
break; break;
case Tool::UnionDetails: case Tool::UnionDetails:
break; break;

View File

@ -33,7 +33,7 @@
* @brief VToolRecord default constructor. * @brief VToolRecord default constructor.
*/ */
VToolRecord::VToolRecord() VToolRecord::VToolRecord()
:id(NULL_ID), typeTool(Tool::ArrowTool), nameDraw(QString()) :id(NULL_ID), typeTool(Tool::Arrow), nameDraw(QString())
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -15,6 +15,15 @@ CONFIG += c++11
DEFINES += VPROPERTYEXPLORER_LIBRARY DEFINES += VPROPERTYEXPLORER_LIBRARY
# directory for executable file
DESTDIR = bin
# files created moc
MOC_DIR = moc
# objecs files
OBJECTS_DIR = obj
SOURCES += \ SOURCES += \
vproperty.cpp \ vproperty.cpp \
vpropertydelegate.cpp \ vpropertydelegate.cpp \
@ -78,3 +87,5 @@ unix {
target.path = /usr/lib target.path = /usr/lib
INSTALLS += target INSTALLS += target
} }
QMAKE_CXXFLAGS += -gdwarf-3