// 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 "actiondrawlinepolygon2.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"
-ActionDrawLinePolygon2::ActionDrawLinePolygon2(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Polygons",
+ActionDrawLinePolygon2::ActionDrawLinePolygon2(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Polygons",
container, graphicView)
{
corner1 = Vector(false);
deletePreview();
clearPreview();
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
bool ok = creation.createPolygon2(corner1, corner2, number);
if (!ok)
- RS_DEBUG->print("ActionDrawLinePolygon2::trigger: No polygon added\n");
+ DEBUG->print("ActionDrawLinePolygon2::trigger: No polygon added\n");
}
void ActionDrawLinePolygon2::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLinePolygon2::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLinePolygon2::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
deletePreview();
clearPreview();
-// RS_Creation creation(preview, NULL, false);
+// Creation creation(preview, NULL, false);
// creation.createPolygon2(corner1, corner2, number);
drawPreview();
void ActionDrawLinePolygon2::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetCorner1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"),
tr("Cancel"));
break;
case SetCorner2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"),
tr("Back"));
break;
case SetNumber:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawLinePolygon2::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, false);
}
-void ActionDrawLinePolygon2::commandEvent(RS_CommandEvent * e)
+void ActionDrawLinePolygon2::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;
}
{
if (n > 0 && n < 10000)
number = n;
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. "
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid number. "
"Try 1..9999"));
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression."));
+ else if (DIALOGFACTORY != NULL)
+ 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);
setStatus(lastStatus);
}
break;
void ActionDrawLinePolygon2::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
}