-// rs_actiondrawtext.cpp
+// actiondrawtext.cpp
//
// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// preview.
//
-#include "rs_actiondrawtext.h"
+#include "actiondrawtext.h"
#include "rs_commandevent.h"
#include "rs_dialogfactory.h"
#include "graphicview.h"
#include "rs_preview.h"
-RS_ActionDrawText::RS_ActionDrawText(RS_EntityContainer & container, GraphicView & graphicView): RS_PreviewActionInterface("Draw Text", container, graphicView)
+ActionDrawText::ActionDrawText(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Text", container, graphicView)
{
pos = Vector(false);
textChanged = true;
}
-RS_ActionDrawText::~RS_ActionDrawText()
+ActionDrawText::~ActionDrawText()
{
}
-/*virtual*/ RS2::ActionType RS_ActionDrawText::rtti()
+/*virtual*/ RS2::ActionType ActionDrawText::rtti()
{
return RS2::ActionDrawText;
}
-void RS_ActionDrawText::init(int status)
+void ActionDrawText::init(int status)
{
- RS_ActionInterface::init(status);
+ ActionInterface::init(status);
if (RS_DIALOGFACTORY == NULL)
return;
{
data = tmp.getData();
preparePreview();
- preview->setVisible(false);
+// preview->setVisible(false);
setStatus(SetPos);
showOptions();
}
}
-void RS_ActionDrawText::reset()
+void ActionDrawText::reset()
{
data = RS_TextData(Vector(0.0, 0.0), 1.0, 100.0, RS2::VAlignTop,
- RS2::HAlignLeft, RS2::LeftToRight, RS2::Exact, 1.0, data.text,
- "standard", 0.0, RS2::Update);
+ RS2::HAlignLeft, RS2::LeftToRight, RS2::Exact, 1.0, data.text,
+ "standard", 0.0, RS2::Update);
}
-void RS_ActionDrawText::trigger()
+void ActionDrawText::trigger()
{
- RS_DEBUG->print("RS_ActionDrawText::trigger()");
+ RS_DEBUG->print("ActionDrawText::trigger()");
if (pos.valid)
{
}
}
-void RS_ActionDrawText::preparePreview()
+void ActionDrawText::preparePreview()
{
- clearPreview();
+/* clearPreview();
data.insertionPoint = Vector(0.0, 0.0);
RS_Text * text = new RS_Text(preview, data);
text->update();
- //text->setVisible(false);
preview->addEntity(text);
- textChanged = false;
+ textChanged = false;*/
}
-void RS_ActionDrawText::mouseMoveEvent(QMouseEvent * e)
+void ActionDrawText::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("RS_ActionDrawText::mouseMoveEvent begin");
+ RS_DEBUG->print("ActionDrawText::mouseMoveEvent begin");
if (getStatus() == SetPos)
{
if (textChanged)
preparePreview();
- if (!preview->isVisible())
- preview->setVisible(true);
-
- offset = Vector(graphicView->toGuiDX(pos.x), -graphicView->toGuiDY(pos.y));
+// if (!preview->isVisible())
+// preview->setVisible(true);
+//
+// offset = Vector(graphicView->toGuiDX(pos.x), -graphicView->toGuiDY(pos.y));
drawPreview();
}
- RS_DEBUG->print("RS_ActionDrawText::mouseMoveEvent end");
+ RS_DEBUG->print("ActionDrawText::mouseMoveEvent end");
}
-void RS_ActionDrawText::mouseReleaseEvent(QMouseEvent * e)
+void ActionDrawText::mouseReleaseEvent(QMouseEvent * e)
{
if (e->button() == Qt::LeftButton)
{
}
}
-void RS_ActionDrawText::coordinateEvent(Vector * e)
+void ActionDrawText::coordinateEvent(Vector * e)
{
if (e == NULL)
return;
}
}
-void RS_ActionDrawText::commandEvent(RS_CommandEvent * e)
+void ActionDrawText::commandEvent(RS_CommandEvent * e)
{
QString c = e->getCommand().toLower();
case SetText:
setText(e->getCommand());
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestOptions(this, true, true);
graphicView->enableCoordinateInput();
}
}
-QStringList RS_ActionDrawText::getAvailableCommands()
+QStringList ActionDrawText::getAvailableCommands()
{
QStringList cmd;
return cmd;
}
-void RS_ActionDrawText::showOptions()
+void ActionDrawText::showOptions()
{
- RS_ActionInterface::showOptions();
+ ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestOptions(this, true, true);
}
-void RS_ActionDrawText::hideOptions()
+void ActionDrawText::hideOptions()
{
- RS_ActionInterface::hideOptions();
+ ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestOptions(this, false);
}
-void RS_ActionDrawText::updateMouseButtonHints()
+void ActionDrawText::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY == NULL)
+ if (!RS_DIALOGFACTORY)
return;
switch (getStatus())
}
}
-void RS_ActionDrawText::updateMouseCursor()
+void ActionDrawText::updateMouseCursor()
{
graphicView->setMouseCursor(RS2::CadCursor);
}
-void RS_ActionDrawText::updateToolBar()
+void ActionDrawText::updateToolBar()
{
- if (RS_DIALOGFACTORY == NULL)
+ if (!RS_DIALOGFACTORY)
return;
switch (getStatus())
}
}
-void RS_ActionDrawText::setText(const QString & t)
+void ActionDrawText::setText(const QString & t)
{
data.text = t;
textChanged = true;
}
-QString RS_ActionDrawText::getText()
+QString ActionDrawText::getText()
{
return data.text;
}
-void RS_ActionDrawText::setAngle(double a)
+void ActionDrawText::setAngle(double a)
{
data.angle = a;
textChanged = true;
}
-double RS_ActionDrawText::getAngle()
+double ActionDrawText::getAngle()
{
return data.angle;
}
-