Option "Use last tool" worked incorrect in case of tool "Arc intersect axis".

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-06-23 20:45:45 +03:00
parent 7eaadf1761
commit e7455cdabc
6 changed files with 21 additions and 12 deletions

View File

@ -75,7 +75,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser()
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used in switch."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used in switch.");
switch (item->type()) switch (item->type())
{ {
@ -199,7 +199,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
} }
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used in switch."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used in switch.");
switch (currentItem->type()) switch (currentItem->type())
{ {
@ -334,7 +334,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
} }
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used in switch."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used in switch.");
switch (currentItem->type()) switch (currentItem->type())
{ {

View File

@ -208,7 +208,7 @@ void DialogHistory::FillTable()
QString DialogHistory::Record(const VToolRecord &tool) QString DialogHistory::Record(const VToolRecord &tool)
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used in history."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used in history.");
const QDomElement domElem = doc->elementById(tool.getId()); const QDomElement domElem = doc->elementById(tool.getId());
if (domElem.isElement() == false) if (domElem.isElement() == false)
@ -227,6 +227,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::AbstractSpline: case Tool::AbstractSpline:
case Tool::Cut: case Tool::Cut:
case Tool::Midpoint:// Same as Tool::AlongLine, but tool will never has such type case Tool::Midpoint:// Same as Tool::AlongLine, but tool will never has such type
case Tool::ArcIntersectAxis:// Same as Tool::CurveIntersectAxis, but tool will never has such type
case Tool::LAST_ONE_DO_NOT_USE: case Tool::LAST_ONE_DO_NOT_USE:
Q_UNREACHABLE(); //-V501 Q_UNREACHABLE(); //-V501
break; break;

View File

@ -1096,7 +1096,7 @@ void MainWindow::ToolArcIntersectAxis(bool checked)
{ {
ToolSelectAllDrawObjects(); ToolSelectAllDrawObjects();
// Reuse ToolCurveIntersectAxis but with different cursor and tool tip // Reuse ToolCurveIntersectAxis but with different cursor and tool tip
SetToolButtonWithApply<DialogCurveIntersectAxis>(checked, Tool::CurveIntersectAxis, SetToolButtonWithApply<DialogCurveIntersectAxis>(checked, Tool::ArcIntersectAxis,
":/cursor/arc_intersect_axis_cursor.png", ":/cursor/arc_intersect_axis_cursor.png",
tr("Select arc"), tr("Select arc"),
&MainWindow::ClosedDialogWithApply<VToolCurveIntersectAxis>, &MainWindow::ClosedDialogWithApply<VToolCurveIntersectAxis>,
@ -1806,7 +1806,7 @@ void MainWindow::mouseMove(const QPointF &scenePos)
void MainWindow::CancelTool() void MainWindow::CancelTool()
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was handled."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was handled.");
qCDebug(vMainWindow, "Canceling tool."); qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool; delete dialogTool;
@ -1917,6 +1917,8 @@ void MainWindow::CancelTool()
break; break;
case Tool::CurveIntersectAxis: case Tool::CurveIntersectAxis:
ui->toolButtonCurveIntersectAxis->setChecked(false); ui->toolButtonCurveIntersectAxis->setChecked(false);
break;
case Tool::ArcIntersectAxis:
ui->toolButtonArcIntersectAxis->setChecked(false); ui->toolButtonArcIntersectAxis->setChecked(false);
break; break;
case Tool::PointOfIntersectionArcs: case Tool::PointOfIntersectionArcs:
@ -3432,7 +3434,7 @@ void MainWindow::CreateMenus()
void MainWindow::LastUsedTool() void MainWindow::LastUsedTool()
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was handled."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was handled.");
if (currentTool == lastUsedTool) if (currentTool == lastUsedTool)
{ {
@ -3559,6 +3561,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonCurveIntersectAxis->setChecked(true); ui->toolButtonCurveIntersectAxis->setChecked(true);
ToolCurveIntersectAxis(true); ToolCurveIntersectAxis(true);
break; break;
case Tool::ArcIntersectAxis:
ui->toolButtonArcIntersectAxis->setChecked(true);
ToolArcIntersectAxis(true);
break;
case Tool::PointOfIntersectionCircles: case Tool::PointOfIntersectionCircles:
ui->toolButtonPointOfIntersectionCircles->setChecked(true); ui->toolButtonPointOfIntersectionCircles->setChecked(true);
ToolPointOfIntersectionCircles(true); ToolPointOfIntersectionCircles(true);

View File

@ -3206,7 +3206,7 @@ void VPattern::ToolsCommonAttributes(const QDomElement &domElement, quint32 &id)
QRectF VPattern::ActiveDrawBoundingRect() const QRectF VPattern::ActiveDrawBoundingRect() const
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used.");
QRectF rec; QRectF rec;
@ -3224,6 +3224,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
case Tool::AbstractSpline: case Tool::AbstractSpline:
case Tool::Cut: case Tool::Cut:
case Tool::Midpoint:// Same as Tool::AlongLine, but tool will never has such type case Tool::Midpoint:// Same as Tool::AlongLine, but tool will never has such type
case Tool::ArcIntersectAxis:// Same as Tool::CurveIntersectAxis, but tool will never has such type
case Tool::LAST_ONE_DO_NOT_USE: case Tool::LAST_ONE_DO_NOT_USE:
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;

View File

@ -1235,7 +1235,7 @@ QStringList VAbstractPattern::ListPointExpressions() const
{ {
// Check if new tool doesn't bring new attribute with a formula. // Check if new tool doesn't bring new attribute with a formula.
// If no just increment number // If no just increment number
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagPoint); const QDomNodeList list = elementsByTagName(TagPoint);
@ -1306,7 +1306,7 @@ QStringList VAbstractPattern::ListArcExpressions() const
{ {
// Check if new tool doesn't bring new attribute with a formula. // Check if new tool doesn't bring new attribute with a formula.
// If no just increment number // If no just increment number
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagArc); const QDomNodeList list = elementsByTagName(TagArc);
@ -1367,7 +1367,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const
{ {
// Check if new tool doesn't bring new attribute with a formula. // Check if new tool doesn't bring new attribute with a formula.
// If no just increment number // If no just increment number
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(AttrPathPoint); const QDomNodeList list = elementsByTagName(AttrPathPoint);
@ -1433,7 +1433,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const
{ {
// Check if new tool doesn't bring new attribute with a formula. // Check if new tool doesn't bring new attribute with a formula.
// If no just increment number // If no just increment number
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagOperation); const QDomNodeList list = elementsByTagName(TagOperation);

View File

@ -96,6 +96,7 @@ enum class Tool : ToolVisHolderType
PointOfIntersectionCircles, PointOfIntersectionCircles,
PointOfIntersectionCurves, PointOfIntersectionCurves,
CurveIntersectAxis, CurveIntersectAxis,
ArcIntersectAxis,
PointOfIntersection, PointOfIntersection,
PointFromCircleAndTangent, PointFromCircleAndTangent,
PointFromArcAndTangent, PointFromArcAndTangent,