#include "actiondimdiametric.h"
-#include "rs_commandevent.h"
-#include "rs_debug.h"
-#include "rs_dialogfactory.h"
+#include "commandevent.h"
+#include "debug.h"
+#include "dialogfactory.h"
#include "graphicview.h"
-#include "rs_preview.h"
+#include "preview.h"
-ActionDimDiametric::ActionDimDiametric(RS_EntityContainer & container,
+ActionDimDiametric::ActionDimDiametric(EntityContainer & container,
GraphicView & graphicView): ActionDimension("Draw Diametric Dimensions",
container, graphicView)
{
void ActionDimDiametric::reset()
{
ActionDimension::reset();
- edata = RS_DimDiametricData(Vector(false), 0.0);
+ edata = DimDiametricData(Vector(false), 0.0);
entity = NULL;
pos = Vector(false);
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDimDiametric::trigger()
if (entity)
{
- RS_DimDiametric * newEntity = NULL;
+ DimDiametric * newEntity = NULL;
- newEntity = new RS_DimDiametric(container,
+ newEntity = new DimDiametric(container,
data,
edata);
graphicView->moveRelativeZero(rz);
}
else
- RS_DEBUG->print("ActionDimDiametric::trigger: Entity is NULL\n");
+ DEBUG->print("ActionDimDiametric::trigger: Entity is NULL\n");
}
void ActionDimDiametric::preparePreview()
if (entity->rtti() == RS2::EntityArc)
{
- radius = ((RS_Arc *)entity)->getRadius();
- center = ((RS_Arc *)entity)->getCenter();
+ radius = ((Arc *)entity)->getRadius();
+ center = ((Arc *)entity)->getCenter();
}
else if (entity->rtti() == RS2::EntityCircle)
{
- radius = ((RS_Circle *)entity)->getRadius();
- center = ((RS_Circle *)entity)->getCenter();
+ radius = ((Circle *)entity)->getRadius();
+ center = ((Circle *)entity)->getCenter();
}
double angle = center.angleTo(pos);
void ActionDimDiametric::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDimDiametric::mouseMoveEvent begin");
+ DEBUG->print("ActionDimDiametric::mouseMoveEvent begin");
Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
pos = snapPoint(e);
preparePreview();
-// RS_DimDiametric * d = new RS_DimDiametric(preview, data, edata);
+// DimDiametric * d = new DimDiametric(preview, data, edata);
// d->update();
//
// deletePreview();
break;
}
- RS_DEBUG->print("ActionDimDiametric::mouseMoveEvent end");
+ DEBUG->print("ActionDimDiametric::mouseMoveEvent end");
}
void ActionDimDiametric::mouseReleaseEvent(QMouseEvent * e)
switch (getStatus())
{
case SetEntity: {
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en != NULL)
{
if (entity->rtti() == RS2::EntityArc)
center =
- ((RS_Arc *)entity)->getCenter();
+ ((Arc *)entity)->getCenter();
else if (entity->rtti() == RS2::EntityCircle)
center =
- ((RS_Circle *)entity)->getCenter();
+ ((Circle *)entity)->getCenter();
graphicView->moveRelativeZero(center);
setStatus(SetPos);
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a circle "
+ DIALOGFACTORY->commandMessage(tr("Not a circle "
"or arc entity"));
}
}
}
}
-void ActionDimDiametric::commandEvent(RS_CommandEvent * e)
+void ActionDimDiametric::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
if (getStatus() == SetText)
{
setText(c);
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
graphicView->enableCoordinateInput();
setStatus(lastStatus);
return;
if (getStatus() == SetPos)
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok == true)
{
- pos.setPolar(1.0, RS_Math::deg2rad(a));
+ pos.setPolar(1.0, Math::deg2rad(a));
pos += data.definitionPoint;
trigger();
reset();
setStatus(SetEntity);
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
return;
}
}
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"),
tr("Cancel"));
break;
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify dimension line location"), tr("Cancel"));
break;
case SetText:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDimDiametric::hideOptions()
{
ActionInterface::hideOptions();
- //RS_DIALOGFACTORY->requestDimDiametricOptions(edata, false);
- RS_DIALOGFACTORY->requestOptions(this, false);
+ //DIALOGFACTORY->requestDimDiametricOptions(edata, false);
+ DIALOGFACTORY->requestOptions(this, false);
}