-// rs_actionmodifydeletefree.cpp
+// actionmodifydeletefree.cpp
//
// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// JLH 06/04/2010 Added this text. :-)
//
-#include "rs_actionmodifydeletefree.h"
+#include "actionmodifydeletefree.h"
#include "rs_dialogfactory.h"
#include "graphicview.h"
#include "rs_polyline.h"
#include "rs_undo.h"
-RS_ActionModifyDeleteFree::RS_ActionModifyDeleteFree(
- RS_EntityContainer & container, GraphicView & graphicView):
- RS_ActionInterface("Delete Entities Freehand",
- container, graphicView)
+ActionModifyDeleteFree::ActionModifyDeleteFree(RS_EntityContainer & container,
+ GraphicView & graphicView):
+ ActionInterface("Delete Entities Freehand", container, graphicView)
{
}
-RS_ActionModifyDeleteFree::~RS_ActionModifyDeleteFree()
+ActionModifyDeleteFree::~ActionModifyDeleteFree()
{
}
-void RS_ActionModifyDeleteFree::init(int status)
+void ActionModifyDeleteFree::init(int status)
{
- RS_ActionInterface::init(status);
+ ActionInterface::init(status);
polyline = NULL;
e1 = e2 = NULL;
v1 = v2 = Vector(false);
- setSnapMode(RS2::SnapOnEntity);
+// setSnapMode(RS2::SnapOnEntity);
}
-void RS_ActionModifyDeleteFree::trigger()
+void ActionModifyDeleteFree::trigger()
{
- if (e1 != NULL && e2 != NULL)
+ if (e1 && e2)
{
RS_EntityContainer * parent = e2->getParent();
- if (parent != NULL)
+ if (parent)
{
if (parent->rtti() == RS2::EntityPolyline)
{
RS_Polyline * pl1;
RS_Polyline * pl2;
RS_Modification m(*container);
- m.splitPolyline(*polyline,
- *e1, v1,
- *e2, v2,
- &pl1, &pl2);
+ m.splitPolyline(*polyline, *e1, v1, *e2, v2, &pl1, &pl2);
if (document)
{
RS_DIALOGFACTORY->commandMessage(tr("One of the chosen entities is NULL"));
}
-void RS_ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
+void ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
{
if (e->button() == Qt::RightButton)
init(getStatus() - 1);
{
case 0:
v1 = snapPoint(e);
- e1 = getKeyEntity();
+// e1 = getKeyEntity();
+ e1 = graphicView->snapper.getKeyEntity();
- if (e1 != NULL)
+ if (e1)
{
RS_EntityContainer * parent = e1->getParent();
- if (parent != NULL)
+ if (parent)
{
if (parent->rtti() == RS2::EntityPolyline)
{
case 1:
v2 = snapPoint(e);
- e2 = getKeyEntity();
+// e2 = getKeyEntity();
+ e2 = graphicView->snapper.getKeyEntity();
- if (e2 != NULL)
+ if (e2)
trigger();
else
RS_DIALOGFACTORY->commandMessage(tr("Second entity is NULL"));
}
}
-void RS_ActionModifyDeleteFree::updateMouseButtonHints()
+void ActionModifyDeleteFree::updateMouseButtonHints()
{
switch (getStatus())
{
case 0:
RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first break point "
- "on a polyline"), tr("Cancel"));
+ "on a polyline"), tr("Cancel"));
break;
case 1:
RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second break point "
- "on the same polyline"),
- tr("Back"));
+ "on the same polyline"), tr("Back"));
break;
default:
break;
}
}
-