// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
//
// JLH = James L. Hammons <jlhamm@acm.org>
//
#include "actiondrawlinerelangle.h"
-#include "rs_commandevent.h"
-#include "rs_creation.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"
-ActionDrawLineRelAngle::ActionDrawLineRelAngle(RS_EntityContainer & container,
+ActionDrawLineRelAngle::ActionDrawLineRelAngle(EntityContainer & container,
GraphicView & graphicView, double angle, bool fixedAngle):
ActionInterface("Draw Lines with relative angles", container, graphicView)
{
deletePreview();
clearPreview();
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
creation.createLineRelAngle(pos, entity, angle, length);
}
void ActionDrawLineRelAngle::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent begin");
Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
switch (getStatus())
deletePreview();
clearPreview();
-// RS_Creation creation(preview, NULL, false);
+// Creation creation(preview, NULL, false);
// creation.createLineRelAngle(pos, entity, angle, length);
drawPreview();
break;
}
- RS_DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent end");
}
void ActionDrawLineRelAngle::mouseReleaseEvent(QMouseEvent * e)
{
case SetEntity:
{
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en != NULL
&& (en->rtti() == RS2::EntityLine
}
}
-void ActionDrawLineRelAngle::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineRelAngle::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetAngle:
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok)
- angle = RS_Math::deg2rad(a);
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ angle = Math::deg2rad(a);
+ 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(SetPos);
}
case SetLength:
{
bool ok;
- double l = RS_Math::eval(c, &ok);
+ double l = Math::eval(c, &ok);
if (ok)
length = l;
- 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(SetPos);
}
void ActionDrawLineRelAngle::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select base entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select base entity"),
tr("Cancel"));
break;
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify position"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify position"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawLineRelAngle::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawLineRelAngle::updateMouseCursor()
void ActionDrawLineRelAngle::updateToolBar()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
}