void RS_ActionDimAligned::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetText: { setText(c); RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); graphicView->enableCoordinateInput(); } break; default: if (checkCommand("text", c)) { lastStatus = (Status)getStatus(); graphicView->disableCoordinateInput(); setStatus(SetText); } break; } }
void RS_ActionDimAngular::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } // setting new text label: if (getStatus()==SetText) { setText(c); RS_DIALOGFACTORY->requestOptions(this, true, true); graphicView->enableCoordinateInput(); setStatus(lastStatus); return; } // command: text if (checkCommand("text", c)) { lastStatus = (Status)getStatus(); graphicView->disableCoordinateInput(); setStatus(SetText); } }
void RS_ActionDrawSpline::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); switch (getStatus()) { case SetStartpoint: if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } break; case SetNextPoint: /*if (checkCommand("close", c)) { close(); updateMouseButtonHints(); return; }*/ if (checkCommand("undo", c)) { undo(); updateMouseButtonHints(); return; } break; default: break; } }
void RS_ActionModifyMoveRotate::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetReferencePoint: case SetTargetPoint: // RVT_PORT changed from if (c==checkCommand("angle", c)) { if (checkCommand("angle", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetAngle); } break; case SetAngle: { bool ok; double a = RS_Math::eval(c, &ok); if (ok) { e->accept(); pPoints->data.angle = RS_Math::deg2rad(a); } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; } }
void RS_ActionDrawText::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { if (RS_DIALOGFACTORY) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); } return; } switch (getStatus()) { case SetPos: if (checkCommand("text", c)) { deletePreview(); graphicView->disableCoordinateInput(); setStatus(SetText); } break; case SetText: { setText(e->getCommand()); if (RS_DIALOGFACTORY) { RS_DIALOGFACTORY->requestOptions(this, true, true); } graphicView->enableCoordinateInput(); setStatus(SetPos); } break; default: break; } }
void RS_ActionDrawCircleCR::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetCenter: if (checkCommand("radius", c)) { deletePreview(); setStatus(SetRadius); } break; case SetRadius: { bool ok; double r = RS_Math::eval(c, &ok); if (ok==true) { data.radius = r; e->accept(); trigger(); } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); } break; default: break; } }
void RS_ActionModifyTrimAmount::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case ChooseTrimEntity: { bool ok; double d = RS_Math::eval(c, &ok); if (ok) { e->accept(); distance = d; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(ChooseTrimEntity); } break; default: break; } }
void RS_ActionDrawCircle::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetRadius: { bool ok; double r = RS_Math::eval(c, &ok); if (ok) { data->radius = r; e->accept(); trigger(); } else RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); //setStatus(SetCenter); } default: break; } }
void RS_ActionDrawLineBisector::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetLine1: case SetLine2: lastStatus = (Status)getStatus(); if (checkCommand("length", c)) { deletePreview(); setStatus(SetLength); } else if (checkCommand("number", c)) { deletePreview(); setStatus(SetNumber); } break; case SetLength: { bool ok; double l = RS_Math::eval(c, &ok); if (ok) { e->accept(); length = l; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; case SetNumber: { bool ok; int n = (int)RS_Math::eval(c, &ok); if (ok) { e->accept(); if(n>0 && n<=200) number = n; else RS_DIALOGFACTORY->commandMessage(tr("Number sector lines not in range: ", "number of bisector to create must be in [1, 200]")+QString::number(n)); } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; default: break; } }
void RS_ActionDrawLineRectangle::commandEvent(RS_CommandEvent* e) { QString const& c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } }
void LC_ActionDrawCircle2PR::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } }
void RS_ActionDrawFlower::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 SetCenter: if (checkCommand("radius", c)) { deletePreview(); setStatus(SetRadius); } break; case SetRadius: { bool ok; double r = RS_Math::eval(c, &ok); if (ok==true) { data.radius = r; } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage( tr("Not a valid expression")); } } setStatus(SetPetal); } break; case SetPetal:{ bool ok; int r = RS_Math::eval(c, &ok); if (ok==true) { petal=r; }else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage( tr("Not a valid expression")); } } trigger(); setStatus(SetCenter); } break; default: break; } }
void RS_ActionDrawNephroid::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); } return; } }
void RS_ActionDrawImage::commandEvent(RS_CommandEvent* e) { RS_String c = e->getCommand().lower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetTargetPoint: if (checkCommand("angle", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetAngle); } else if (checkCommand("factor", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetFactor); } break; case SetAngle: { bool ok; double a = RS_Math::eval(c, &ok); if (ok==true) { setAngle(RS_Math::deg2rad(a)); } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; case SetFactor: { bool ok; double f = RS_Math::eval(c, &ok); if (ok==true) { setFactor(f); } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; default: break; } }
void RS_ActionDrawLineAngle::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetPos: if (!fixedAngle && checkCommand("angle", c)) { deletePreview(); setStatus(SetAngle); } else if (checkCommand("length", c)) { deletePreview(); setStatus(SetLength); } break; case SetAngle: { bool ok; double a = RS_Math::eval(c, &ok); if (ok) { e->accept(); angle = RS_Math::deg2rad(a); } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetPos); } break; case SetLength: { bool ok; double l = RS_Math::eval(c, &ok); if (ok) { e->accept(); length = l; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetPos); } break; default: break; } }
void RS_ActionDimLinear::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 SetText: setText(c); if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->requestOptions(this, true, true); } graphicView->enableCoordinateInput(); setStatus(lastStatus); break; case SetAngle: { bool ok; double a = RS_Math::eval(c, &ok); if (ok==true) { setAngle(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(lastStatus); } break; default: lastStatus = (Status)getStatus(); deletePreview(); if (checkCommand("text", c)) { graphicView->disableCoordinateInput(); setStatus(SetText); return; } else if (!fixedAngle && (checkCommand("angle", c))) { setStatus(SetAngle); } break; } }
void RS_ActionDrawLinePolygon2::commandEvent(RS_CommandEvent* e) { RS_String c = e->getCommand().lower(); if (checkCommand("help", c)) { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); } return; } switch (getStatus()) { case SetCorner1: case SetCorner2: if (checkCommand("number", c)) { deleteSnapper(); deletePreview(); clearPreview(); lastStatus = (Status)getStatus(); setStatus(SetNumber); } break; case SetNumber: { bool ok; int n = c.toInt(&ok); if (ok==true) { if (n>0 && n<10000) { number = n; } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. " "Try 1..9999")); } } } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression.")); } } if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->requestOptions(this, true, true); } setStatus(lastStatus); } break; default: break; } }
void RS_ActionPrintPreview::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().trimmed().toLower(); // qDebug()<<"cmd="<<c; if (checkCommand("blackwhite", c)) { setBlackWhite(true); RS_DIALOGFACTORY->commandMessage(tr("Printout in Black/White")); e->accept(); return; } else if (checkCommand("color", c)) { setBlackWhite(false); RS_DIALOGFACTORY->commandMessage(tr("Printout in color")); e->accept(); return; } else if (checkCommand("graphoffset", c)) { m_bPaperOffset=false; RS_DIALOGFACTORY->commandMessage(tr("Printout offset in graph coordinates")); e->accept(); return; } else if (checkCommand("paperoffset", c)) { m_bPaperOffset=true; RS_DIALOGFACTORY->commandMessage(tr("Printout offset in paper coordinates")); e->accept(); return; } else if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")+tr(": select printout offset coordinates")+ "\n"+tr("type in offset from command line to offset printout") ); e->accept(); return; } //coordinate event if (c.contains(',')) { if(c.startsWith('@')) { RS_DIALOGFACTORY->commandMessage(tr("Printout offset ignores relative zero. Ignoring '@'")); c.remove(0, 1); } // qDebug()<<"offset by absolute coordinate: "; const int commaPos = c.indexOf(','); bool ok1, ok2; double x = RS_Math::eval(c.left(commaPos), &ok1); double y = RS_Math::eval(c.mid(commaPos+1), &ok2); if (ok1 && ok2) { RS_CoordinateEvent ce(RS_Vector(x,y)); this->coordinateEvent(&ce); e->accept(); } } }
void RS_ActionDrawArc3P::commandEvent(RS_CommandEvent* e) { RS_String c = e->getCommand().lower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } if (RS_COMMANDS->checkCommand("center", c, rtti())) { finish(); graphicView->setCurrentAction( new RS_ActionDrawArc(*container, *graphicView)); } }
void RS_ActionDimLeader::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { if (RS_DIALOGFACTORY) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); } return; } // enter to finish if (c=="") { trigger(); reset(); setStatus(SetStartpoint); //finish(); } }
void RS_ActionDrawLineParallelThrough::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetEntity: case SetPos: { if (checkCommand("number", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetNumber); } } break; case SetNumber: { bool ok; int n = c.toInt(&ok); if (ok) { e->accept(); if (n>0 && n<100) { number = n; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. " "Try 1..99")); } } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; default: break; } }
void RS_ActionDimDiametric::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } // setting new text label: if (getStatus()==SetText) { setText(c); RS_DIALOGFACTORY->requestOptions(this, true, true); graphicView->enableCoordinateInput(); setStatus(lastStatus); return; } // command: text if (checkCommand("text", c)) { lastStatus = (Status)getStatus(); graphicView->disableCoordinateInput(); setStatus(SetText); } // setting angle if (getStatus()==SetPos) { bool ok; double a = RS_Math::eval(c, &ok); if (ok) { pos->setPolar(1.0, RS_Math::deg2rad(a)); *pos += data->definitionPoint; trigger(); reset(); setStatus(SetEntity); } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } return; } }
void RS_ActionDrawLine::commandEvent(RS_CommandEvent* e) { RS_DEBUG->print("RS_ActionDrawLine::commandEvent"); QString c = e->getCommand().toLower(); switch (getStatus()) { case SetStartpoint: if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); e->accept(); return; } break; case SetEndpoint: if (checkCommand("close", c)) { close(); e->accept(); updateMouseButtonHints(); return; } if (checkCommand("undo", c)) { undo(); e->accept(); updateMouseButtonHints(); return; } break; default: return; } if (checkCommand("redo", c)) { redo(); e->accept(); updateMouseButtonHints(); } // RS_DEBUG->print("RS_ActionDrawLine::commandEvent: OK"); }
void RS_ActionDrawEllipseAxis::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 SetMinor: { bool ok; double m = RS_Math::eval(c, &ok); if (ok==true) { ratio = m / major.magnitude(); if (!isArc) { trigger(); } else { setStatus(SetAngle1); } } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } } break; case SetAngle1: { bool ok; double a = RS_Math::eval(c, &ok); if (ok==true) { angle1 = RS_Math::deg2rad(a); setStatus(SetAngle2); } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } } break; case SetAngle2: { bool ok; double a = RS_Math::eval(c, &ok); if (ok==true) { angle2 = RS_Math::deg2rad(a); trigger(); } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } } break; default: break; } }
void RS_ActionModifyRound::commandEvent(RS_CommandEvent* e) { RS_String c = e->getCommand().lower(); if (checkCommand("help", c)) { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); } return; } switch (getStatus()) { case SetEntity1: case SetEntity2: if (checkCommand("radius", c)) { deleteSnapper(); deletePreview(); clearPreview(); lastStatus = (Status)getStatus(); setStatus(SetRadius); } else if (checkCommand("trim", c)) { /*deleteSnapper(); deletePreview(); clearPreview(); lastStatus = (Status)getStatus(); setStatus(SetTrim); */ data.trim = !data.trim; if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->requestOptions(this, true, true); } } break; case SetRadius: { bool ok; double r = RS_Math::eval(c, &ok); if (ok==true) { data.radius = r; } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->requestOptions(this, true, true); } setStatus(lastStatus); } break; /*case SetTrim: { if (c==cmdYes.lower() || c==cmdYes2) { data.trim = true; } else if (c==cmdNo.lower() || c==cmdNo2) { data.trim = false; } else { RS_DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' " "or 'No'")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break;*/ default: break; } }
void RS_ActionDrawArc::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (RS_COMMANDS->checkCommand("help", c)) { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); } return; } if (RS_COMMANDS->checkCommand("reversed", c)) { e->accept(); setReversed(!isReversed()); if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->requestOptions(this, true, true); } return; } switch (getStatus()) { case SetRadius: { bool ok; double r = RS_Math::eval(c, &ok); if (ok) { data.radius = r; setStatus(SetAngle1); e->accept(); } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } } break; case SetAngle1: { bool ok; double a = RS_Math::eval(c, &ok); if (ok) { data.angle1 = RS_Math::deg2rad(a); e->accept(); setStatus(SetAngle2); } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } } break; case SetAngle2: { if (RS_COMMANDS->checkCommand("angle", c)) { setStatus(SetIncAngle); } else if (RS_COMMANDS->checkCommand("chord length", c)) { setStatus(SetChordLength); } else { bool ok; double a = RS_Math::eval(c, &ok); if (ok) { data.angle2 = RS_Math::deg2rad(a); e->accept(); trigger(); } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } } } break; case SetIncAngle: { bool ok; double a = RS_Math::eval(c, &ok); if (ok) { data.angle2 = data.angle1 + RS_Math::deg2rad(a); e->accept(); trigger(); } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } } break; case SetChordLength: { bool ok; double l = RS_Math::eval(c, &ok); if (ok) { if (fabs(l/(2*data.radius))<=1.0) { data.angle2 = data.angle1 + asin(l/(2*data.radius)) * 2; trigger(); } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage( tr("Not a valid chord length")); } } e->accept(); } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } } break; default: break; } }
void RS_ActionDrawEllipseFociPoint::commandEvent(RS_CommandEvent* e) { QString cmd = e->getCommand().toLower(); if (checkCommand("help", cmd)) { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); } return; } switch (getStatus()) { // case SetFocus1: { // bool ok; // double m = RS_Math::eval(c, &ok); // if (ok) { // ratio = m / major.magnitude(); // if (!isArc) { // trigger(); // } else { // setStatus(SetAngle1); // } // } else { // if (RS_DIALOGFACTORY!=NULL) { // RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); // } // } // } // break; // case SetFocus2: { // bool ok; // double a = RS_Math::eval(c, &ok); // if (ok) { // angle1 = RS_Math::deg2rad(a); // setStatus(SetAngle2); // } else { // if (RS_DIALOGFACTORY!=NULL) { // RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); // } // } // } // break; case SetPoint: { bool ok; double a = RS_Math::eval(cmd, &ok); if (ok) { e->accept(); // std::cout<<"e->isAccepted()="<<e->isAccepted()<<std::endl; d=0.5*fabs(a); if (d > c + RS_TOLERANCE) { trigger(); }else{ RS_DIALOGFACTORY->commandMessage(QString::number(fabs(a))+" is smaller than distance between foci"); } } else { if (RS_DIALOGFACTORY!=NULL) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } } break; default: break; } }
void RS_ActionBlocksInsert::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetTargetPoint: if (checkCommand("angle", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetAngle); } else if (checkCommand("factor", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetFactor); } else if (checkCommand("columns", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetColumns); } else if (checkCommand("rows", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetRows); } else if (checkCommand("columnspacing", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetColumnSpacing); } else if (checkCommand("rowspacing", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetRowSpacing); } break; case SetAngle: { bool ok; double a = RS_Math::eval(c, &ok); if (ok) { data->angle = RS_Math::deg2rad(a); } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; case SetFactor: { bool ok; double f = RS_Math::eval(c, &ok); if (ok) { setFactor(f); } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; case SetColumns: { bool ok; int cols = (int)RS_Math::eval(c, &ok); if (ok) { data->cols = cols; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; case SetRows: { bool ok; int rows = (int)RS_Math::eval(c, &ok); if (ok) { data->rows = rows; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; case SetColumnSpacing: { bool ok; double cs = (int)RS_Math::eval(c, &ok); if (ok) { data->spacing.x = cs; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; case SetRowSpacing: { bool ok; int rs = (int)RS_Math::eval(c, &ok); if (ok) { data->spacing.y = rs; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; default: break; } }
void RS_ActionDrawLineParallel::commandEvent(RS_CommandEvent* e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { if (RS_DIALOGFACTORY) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); } return; } switch (getStatus()) { case SetEntity: { if (checkCommand("through", c)) { finish(false); graphicView->setCurrentAction( new RS_ActionDrawLineParallelThrough(*container, *graphicView)); } else if (checkCommand("number", c)) { deletePreview(); setStatus(SetNumber); } else { bool ok; double d = RS_Math::eval(c, &ok); if(ok) e->accept(); if (ok && d>1.0e-10) { distance = d; } else { if (RS_DIALOGFACTORY) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } if (RS_DIALOGFACTORY) { RS_DIALOGFACTORY->requestOptions(this, true, true); } updateMouseButtonHints(); //setStatus(SetEntity); } } break; case SetNumber: { bool ok; int n = c.toInt(&ok); if (ok) { e->accept(); if (n>0 && n<100) { number = n; } else { if (RS_DIALOGFACTORY) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. " "Try 1..99")); } } } else { if (RS_DIALOGFACTORY) { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } } if (RS_DIALOGFACTORY) { RS_DIALOGFACTORY->requestOptions(this, true, true); } setStatus(SetEntity); } break; default: break; } }
void RS_ActionModifyBevel::commandEvent(RS_CommandEvent* e) { RS_String c = e->getCommand().lower(); if (checkCommand("help", c)) { RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } switch (getStatus()) { case SetEntity1: case SetEntity2: if (checkCommand("length1", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetLength1); } else if (checkCommand("length2", c)) { deletePreview(); lastStatus = (Status)getStatus(); setStatus(SetLength2); } else if (checkCommand("trim", c)) { //deletePreview(); //lastStatus = (Status)getStatus(); //setStatus(SetTrim); data.trim = !data.trim; RS_DIALOGFACTORY->requestOptions(this, true, true); } break; case SetLength1: { bool ok; double l = RS_Math::eval(c, &ok); if (ok==true) { data.length1 = l; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; case SetLength2: { bool ok; double l = RS_Math::eval(c, &ok); if (ok==true) { data.length2 = l; } else { RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; /*case SetTrim: { if (checkCommand()) { data.trim = true; } else if (c==cmdNo.lower() || c==cmdNo2) { data.trim = false; } else { RS_DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' " "or 'No'")); } RS_DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break;*/ default: break; } }