-
-void RS_ActionModifyCut::mouseReleaseEvent(QMouseEvent* e) {
- if (RS2::qtToRsButtonState(e->button())==RS2::LeftButton) {
- switch (getStatus()) {
- case ChooseCutEntity:
- cutEntity = catchEntity(e);
- if (cutEntity==NULL) {
- RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
- } else if (cutEntity->rtti()!=RS2::EntityLine &&
- cutEntity->rtti()!=RS2::EntityArc &&
- cutEntity->rtti()!=RS2::EntityCircle &&
- cutEntity->rtti()!=RS2::EntityEllipse) {
-
- RS_DIALOGFACTORY->commandMessage(
- tr("Entity must be a line, arc, circle or ellipse."));
- } else {
- cutEntity->setHighlighted(true);
- graphicView->drawEntity(cutEntity);
- setStatus(SetCutCoord);
- }
- break;
-
- case SetCutCoord:
- cutCoord = snapPoint(e);
- if (cutEntity==NULL) {
- RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
- } else if (!cutCoord.valid) {
- RS_DIALOGFACTORY->commandMessage(tr("Cutting point is invalid."));
- } else if (!cutEntity->isPointOnEntity(cutCoord)) {
- RS_DIALOGFACTORY->commandMessage(
- tr("Cutting point is not on entity."));
- } else {
- deleteSnapper();
- trigger();
- }
- break;
-
- default:
- break;
- }
- } else if (RS2::qtToRsButtonState(e->button())==RS2::RightButton) {
- deleteSnapper();
- if (cutEntity!=NULL) {
- cutEntity->setHighlighted(false);
- graphicView->drawEntity(cutEntity);
- }
- init(getStatus()-1);
- }
+void RS_ActionModifyCut::mouseReleaseEvent(QMouseEvent * e)
+{
+ if (e->button() == Qt::LeftButton)
+ {
+ switch (getStatus())
+ {
+ case ChooseCutEntity:
+ cutEntity = catchEntity(e);
+
+ if (cutEntity == NULL)
+ RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
+ else if (cutEntity->rtti() != RS2::EntityLine
+ && cutEntity->rtti() != RS2::EntityArc
+ && cutEntity->rtti() != RS2::EntityCircle
+ && cutEntity->rtti() != RS2::EntityEllipse)
+
+ RS_DIALOGFACTORY->commandMessage(
+ tr("Entity must be a line, arc, circle or ellipse."));
+ else
+ {
+ cutEntity->setHighlighted(true);
+ graphicView->drawEntity(cutEntity);
+ setStatus(SetCutCoord);
+ }
+ break;
+
+ case SetCutCoord:
+ cutCoord = snapPoint(e);
+
+ if (cutEntity == NULL)
+ RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
+ else if (!cutCoord.valid)
+ RS_DIALOGFACTORY->commandMessage(tr("Cutting point is invalid."));
+ else if (!cutEntity->isPointOnEntity(cutCoord))
+ RS_DIALOGFACTORY->commandMessage(
+ tr("Cutting point is not on entity."));
+ else
+ {
+ deleteSnapper();
+ trigger();
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ else if (e->button() == Qt::RightButton)
+ {
+ deleteSnapper();
+
+ if (cutEntity != NULL)
+ {
+ cutEntity->setHighlighted(false);
+ graphicView->drawEntity(cutEntity);
+ }
+ init(getStatus() - 1);
+ }