-void RS_ActionDrawLineParallel::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: {
- if (checkCommand("through", c)) {
- finish();
- graphicView->setCurrentAction(
- new RS_ActionDrawLineParallelThrough(*container,
- *graphicView));
- } else if (checkCommand("number", c)) {
- deleteSnapper();
- deletePreview();
- clearPreview();
- setStatus(SetNumber);
- } else {
- bool ok;
- double d = RS_Math::eval(c, &ok);
- if (ok==true && d>1.0e-10) {
- distance = d;
- } else {
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- }
- }
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->requestOptions(this, true, true);
- }
- updateMouseButtonHints();
- //setStatus(SetEntity);
- }
- }
- break;
-
- case SetNumber: {
- bool ok;
- int n = c.toInt(&ok);
- if (ok==true) {
- if (n>0 && n<100) {
- number = n;
- } else {
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. "
- "Try 1..99"));
- }
- }
- } else {
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- }
- }
- if (RS_DIALOGFACTORY!=NULL) {
- RS_DIALOGFACTORY->requestOptions(this, true, true);
- }
- setStatus(SetEntity);
- }
- break;
-
- default:
- break;
- }