#include "graphicview.h"
#include "preview.h"
-ActionDrawLineParallel::ActionDrawLineParallel(RS_EntityContainer & container,
+ActionDrawLineParallel::ActionDrawLineParallel(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Draw Parallels", container, graphicView),
parallel(NULL), distance(1.0), number(1), coord(Vector(false)), entity(NULL)
void ActionDrawLineParallel::trigger()
{
ActionInterface::trigger();
- RS_Creation creation(container, graphicView);
- RS_Entity * e = creation.createParallel(coord, distance, number, entity);
+ Creation creation(container, graphicView);
+ Entity * e = creation.createParallel(coord, distance, number, entity);
if (!e)
- RS_DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n");
+ DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n");
graphicView->preview.clear();
graphicView->redraw();
void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin");
coord = Vector(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
entity = catchEntity(e, RS2::ResolveAll);
#if 0
deletePreview();
clearPreview();
- RS_Creation creation(preview, NULL, false);
+ Creation creation(preview, NULL, false);
creation.createParallel(coord, distance, number, entity);
drawPreview();
#else
graphicView->preview.clear();
- RS_Creation creation(&(graphicView->preview), NULL, false);
+ Creation creation(&(graphicView->preview), NULL, false);
creation.createParallel(coord, distance, number, entity);
graphicView->redraw();
#endif
break;
}
- RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end");
}
void ActionDrawLineParallel::mouseReleaseEvent(QMouseEvent * e)
void ActionDrawLineParallel::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify Distance <%1> or select entity or [%2]")
- .arg(distance).arg(RS_COMMANDS->command("through")),
+ .arg(distance).arg(COMMANDS->command("through")),
tr("Cancel"));
break;
case SetNumber:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true);
updateMouseButtonHints();
}
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
-void ActionDrawLineParallel::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineParallel::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
else
{
bool ok;
- double d = RS_Math::eval(c, &ok);
+ double d = Math::eval(c, &ok);
if (ok && d > 1.0e-10)
distance = d;
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
updateMouseButtonHints();
//setStatus(SetEntity);
{
if (n > 0 && n < 100)
number = n;
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99"));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99"));
}
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetEntity);
}
void ActionDrawLineParallel::updateToolBar()
{
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
double ActionDrawLineParallel::getDistance()