#include "rs_actiondrawtext.h"
-#include "rs_graphicview.h"
-#include "rs_snapper.h"
+#include "rs_commandevent.h"
+#include "rs_dialogfactory.h"
+#include "graphicview.h"
+#include "rs_preview.h"
-RS_ActionDrawText::RS_ActionDrawText(RS_EntityContainer & container,
- RS_GraphicView & graphicView): RS_PreviewActionInterface("Draw Text", container, graphicView)
+RS_ActionDrawText::RS_ActionDrawText(RS_EntityContainer & container, GraphicView & graphicView): RS_PreviewActionInterface("Draw Text", container, graphicView)
{
pos = Vector(false);
textChanged = true;
graphicView->redraw();
}
- break;
+ break;
case SetPos:
RS_DIALOGFACTORY->requestOptions(this, true, true);
void RS_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);
+ 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);
}
void RS_ActionDrawText::trigger()
{
if (e->button() == Qt::LeftButton)
{
- RS_CoordinateEvent ce(snapPoint(e));
+ Vector ce(snapPoint(e));
coordinateEvent(&ce);
}
else if (e->button() == Qt::RightButton)
}
}
-void RS_ActionDrawText::coordinateEvent(RS_CoordinateEvent * e)
+void RS_ActionDrawText::coordinateEvent(Vector * e)
{
if (e == NULL)
return;
- Vector mouse = e->getCoordinate();
+ Vector mouse = *e;
switch (getStatus())
{
if (checkCommand("help", c))
{
if (RS_DIALOGFACTORY != NULL)
- {
RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
- }
return;
}
switch (getStatus())
{
case SetPos:
+
if (checkCommand("text", c))
{
deleteSnapper();
case SetPos:
RS_DIALOGFACTORY->updateMouseWidget(tr("Specify insertion point"), tr("Cancel"));
break;
+
case SetText:
RS_DIALOGFACTORY->updateMouseWidget(tr("Enter text:"), tr("Back"));
break;
+
default:
RS_DIALOGFACTORY->updateMouseWidget("", "");
break;
void RS_ActionDrawText::updateMouseCursor()
{
- graphicView->setMouseCursor(RS2::CadCursor);
+ graphicView->setMouseCursor(RS2::CadCursor);
}
void RS_ActionDrawText::updateToolBar()
{
- if (RS_DIALOGFACTORY == NULL)
+ if (RS_DIALOGFACTORY == NULL)
return;
switch (getStatus())
case SetPos:
RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
+
default:
RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
break;
void RS_ActionDrawText::setText(const QString & t)
{
- data.text = t;
- textChanged = true;
+ data.text = t;
+ textChanged = true;
}
QString RS_ActionDrawText::getText()
{
- return data.text;
+ return data.text;
}
void RS_ActionDrawText::setAngle(double a)
{
- data.angle = a;
- textChanged = true;
+ data.angle = a;
+ textChanged = true;
}
double RS_ActionDrawText::getAngle()
{
- return data.angle;
+ return data.angle;
}
+