-void RS_ActionDrawLineRelAngle::commandEvent(RS_CommandEvent* e) {
- QString c = e->getCommand().toLower();
-
- if (checkCommand("help", c)) {
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
- + getAvailableCommands().join(", "));
- }
- return;
- }
-
- switch (getStatus()) {
- case SetEntity:
- case SetPos:
- if (!fixedAngle && checkCommand("angle", c)) {
- deleteSnapper();
- deletePreview();
- clearPreview();
- setStatus(SetAngle);
- } else if (checkCommand("length", c)) {
- deleteSnapper();
- deletePreview();
- clearPreview();
- setStatus(SetLength);
- }
- break;
-
- case SetAngle: {
- bool ok;
- double a = RS_Math::eval(c, &ok);
- if (ok==true) {
- angle = RS_Math::deg2rad(a);
- } else {
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- }
- }
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->requestOptions(this, true, true);
- }
- setStatus(SetPos);
- }
- break;
-
- case SetLength: {
- bool ok;
- double l = RS_Math::eval(c, &ok);
- if (ok==true) {
- length = l;
- } else {
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- }
- }
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->requestOptions(this, true, true);
- }
- setStatus(SetPos);
- }
- break;
-
- default:
- break;
- }