#include "actiondrawtext.h"
-#include "rs_commandevent.h"
-#include "rs_debug.h"
-#include "rs_dialogfactory.h"
+#include "commandevent.h"
+#include "debug.h"
+#include "dialogfactory.h"
#include "graphicview.h"
-#include "rs_preview.h"
+#include "preview.h"
-ActionDrawText::ActionDrawText(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Text", container, graphicView)
+ActionDrawText::ActionDrawText(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Text", container, graphicView)
{
pos = Vector(false);
textChanged = true;
{
ActionInterface::init(status);
- if (RS_DIALOGFACTORY == NULL)
+ if (DIALOGFACTORY == NULL)
return;
switch (status)
clearPreview();
reset();
- RS_Text tmp(NULL, data);
+ Text tmp(NULL, data);
- if (RS_DIALOGFACTORY->requestTextDialog(&tmp))
+ if (DIALOGFACTORY->requestTextDialog(&tmp))
{
data = tmp.getData();
preparePreview();
break;
case SetPos:
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
break;
default:
void ActionDrawText::reset()
{
- data = RS_TextData(Vector(0.0, 0.0), 1.0, 100.0, RS2::VAlignTop,
+ data = 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 ActionDrawText::trigger()
{
- RS_DEBUG->print("ActionDrawText::trigger()");
+ DEBUG->print("ActionDrawText::trigger()");
if (pos.valid)
{
clearPreview();
deleteSnapper();
- RS_Text * text = new RS_Text(container, data);
+ Text * text = new Text(container, data);
text->update();
container->addEntity(text);
{
/* clearPreview();
data.insertionPoint = Vector(0.0, 0.0);
- RS_Text * text = new RS_Text(preview, data);
+ Text * text = new Text(preview, data);
text->update();
preview->addEntity(text);
textChanged = false;*/
void ActionDrawText::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawText::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawText::mouseMoveEvent begin");
if (getStatus() == SetPos)
{
drawPreview();
}
- RS_DEBUG->print("ActionDrawText::mouseMoveEvent end");
+ DEBUG->print("ActionDrawText::mouseMoveEvent end");
}
void ActionDrawText::mouseReleaseEvent(QMouseEvent * e)
}
}
-void ActionDrawText::commandEvent(RS_CommandEvent * e)
+void ActionDrawText::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 SetText:
setText(e->getCommand());
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
graphicView->enableCoordinateInput();
setStatus(SetPos);
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDrawText::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawText::updateMouseButtonHints()
{
- if (!RS_DIALOGFACTORY)
+ if (!DIALOGFACTORY)
return;
switch (getStatus())
{
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify insertion point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify insertion point"), tr("Cancel"));
break;
case SetText:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter text:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Enter text:"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawText::updateToolBar()
{
- if (!RS_DIALOGFACTORY)
+ if (!DIALOGFACTORY)
return;
switch (getStatus())
{
case SetPos:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
break;
}
}