#include "actiondrawlinebisector.h"
-#include "rs_commandevent.h"
-#include "rs_creation.h"
-#include "rs_debug.h"
-#include "rs_dialogfactory.h"
+#include "commandevent.h"
+#include "creation.h"
+#include "debug.h"
+#include "dialogfactory.h"
#include "graphicview.h"
-#include "rs_preview.h"
+#include "preview.h"
-ActionDrawLineBisector::ActionDrawLineBisector(RS_EntityContainer & container,
+ActionDrawLineBisector::ActionDrawLineBisector(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Draw Bisectors", container, graphicView),
bisector(NULL), line1(NULL), line2(NULL), length(10.0), number(1),
void ActionDrawLineBisector::trigger()
{
ActionInterface::trigger();
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
creation.createBisector(coord1, coord2, length, number, line1, line2);
graphicView->redraw();
}
void ActionDrawLineBisector::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineBisector::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineBisector::mouseMoveEvent begin");
Vector mouse = Vector(graphicView->toGraphX(e->x()),
graphicView->toGraphY(e->y()));
case SetLine2:
{
coord2 = mouse;
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en && en->rtti() == RS2::EntityLine)
{
- line2 = (RS_Line *)en;
+ line2 = (Line *)en;
graphicView->preview.clear();
- RS_Creation creation(&(graphicView->preview), NULL, false);
+ Creation creation(&(graphicView->preview), NULL, false);
creation.createBisector(coord1, coord2, length, number, line1, line2);
}
}
}
graphicView->redraw();
- RS_DEBUG->print("ActionDrawLineBisector::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineBisector::mouseMoveEvent end");
}
void ActionDrawLineBisector::mouseReleaseEvent(QMouseEvent * e)
case SetLine1:
{
coord1 = mouse;
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en && en->rtti() == RS2::EntityLine)
{
- line1 = (RS_Line *)en;
+ line1 = (Line *)en;
setStatus(SetLine2);
}
}
}
}
-void ActionDrawLineBisector::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineBisector::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetLength:
{
bool ok;
- double l = RS_Math::eval(c, &ok);
+ double l = Math::eval(c, &ok);
if (ok)
length = l;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetNumber:
{
bool ok;
- int n = (int)RS_Math::eval(c, &ok);
+ int n = (int)Math::eval(c, &ok);
if (ok)
number = n;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
switch (getStatus())
{
case SetLine1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select first line"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Select first line"), tr("Cancel"));
break;
case SetLine2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select second line"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Select second line"), tr("Back"));
break;
case SetLength:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter bisector length:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Enter bisector length:"), tr("Back"));
break;
case SetNumber:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number of bisectors:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Enter number of bisectors:"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawLineBisector::showOptions()
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawLineBisector::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawLineBisector::updateMouseCursor()
void ActionDrawLineBisector::updateToolBar()
{
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
void ActionDrawLineBisector::setLength(double l)