// 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 "actionlibraryinsert.h"
-#include "rs_commandevent.h"
-#include "rs_dialogfactory.h"
+#include "commandevent.h"
+#include "dialogfactory.h"
#include "graphicview.h"
-#include "rs_preview.h"
-#include "rs_units.h"
+#include "preview.h"
+#include "units.h"
/**
* Constructor.
*/
-ActionLibraryInsert::ActionLibraryInsert(RS_EntityContainer & container, GraphicView & graphicView):
+ActionLibraryInsert::ActionLibraryInsert(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Library Insert", container, graphicView)
{
}
data.file = file;
if (!prev.open(file, RS2::FormatUnknown))
- RS_DIALOGFACTORY->commandMessage(tr("Cannot open file '%1'").arg(file));
+ DIALOGFACTORY->commandMessage(tr("Cannot open file '%1'").arg(file));
}
void ActionLibraryInsert::reset()
{
- /*data = RS_InsertData("",
+ /*data = InsertData("",
Vector(0.0,0.0),
Vector(1.0,1.0),
0.0,
deletePreview();
clearPreview();
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
creation.createLibraryInsert(data);
graphicView->redraw();
// unit conversion:
if (graphic)
{
- double uf = RS_Units::convert(1.0, prev.getUnit(), graphic->getUnit());
+ double uf = Units::convert(1.0, prev.getUnit(), graphic->getUnit());
// preview->scale(data.insertionPoint, Vector(uf, uf));
}
trigger();
}
-void ActionLibraryInsert::commandEvent(RS_CommandEvent * e)
+void ActionLibraryInsert::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", "));
+ 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 == true)
- data.angle = RS_Math::deg2rad(a);
+ data.angle = Math::deg2rad(a);
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 SetFactor:
{
bool ok;
- double f = RS_Math::eval(c, &ok);
+ double f = Math::eval(c, &ok);
if (ok == true)
setFactor(f);
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;
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionLibraryInsert::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionLibraryInsert::updateMouseButtonHints()
switch (getStatus())
{
case SetTargetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
break;
case SetAngle:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), "");
break;
case SetFactor:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionLibraryInsert::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
double ActionLibraryInsert::getAngle()