// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/22/2010 Added this text. :-)
+// JLH 08/19/2010 Fix rendering for new (correct) rendering path
//
#include "actiondrawlineparallel.h"
#include "actiondrawlineparallelthrough.h"
-#include "rs_commandevent.h"
+#include "commandevent.h"
#include "commands.h"
-#include "rs_creation.h"
-#include "rs_dialogfactory.h"
+#include "creation.h"
+#include "debug.h"
+#include "dialogfactory.h"
#include "graphicview.h"
-#include "rs_preview.h"
+#include "preview.h"
-ActionDrawLineParallel::ActionDrawLineParallel(RS_EntityContainer & container,
- GraphicView & graphicView): ActionInterface("Draw Parallels",
- container, graphicView)
+ActionDrawLineParallel::ActionDrawLineParallel(EntityContainer & container,
+ GraphicView & graphicView):
+ ActionInterface("Draw Parallels", container, graphicView),
+ parallel(NULL), distance(1.0), number(1), coord(Vector(false)), entity(NULL)
{
- parallel = NULL;
- entity = NULL;
- distance = 1.0;
- number = 1;
- coord = Vector(false);
+ graphicView.snapper.SetVisible(false);
}
ActionDrawLineParallel::~ActionDrawLineParallel()
void ActionDrawLineParallel::trigger()
{
ActionInterface::trigger();
-
- RS_Creation creation(container, graphicView);
- RS_Entity * e = creation.createParallel(coord, distance, number, entity);
+ Creation creation(container, graphicView);
+ Entity * e = creation.createParallel(coord, distance, number, entity);
if (!e)
- RS_DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n");
+ DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n");
+
+ graphicView->preview.clear();
+ graphicView->redraw();
}
void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin");
coord = Vector(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
entity = catchEntity(e, RS2::ResolveAll);
{
case SetEntity:
{
+#if 0
deletePreview();
clearPreview();
-// RS_Creation creation(preview, NULL, false);
-// creation.createParallel(coord, distance, number, entity);
+ Creation creation(preview, NULL, false);
+ creation.createParallel(coord, distance, number, entity);
drawPreview();
+#else
+ graphicView->preview.clear();
+ Creation creation(&(graphicView->preview), NULL, false);
+ creation.createParallel(coord, distance, number, entity);
+ graphicView->redraw();
+#endif
}
- break;
+ break;
default:
break;
}
- RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end");
}
void ActionDrawLineParallel::mouseReleaseEvent(QMouseEvent * e)
void ActionDrawLineParallel::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify Distance <%1> or select entity or [%2]")
- .arg(distance).arg(RS_COMMANDS->command("through")),
+ .arg(distance).arg(COMMANDS->command("through")),
tr("Cancel"));
break;
case SetNumber:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true);
updateMouseButtonHints();
}
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
-void ActionDrawLineParallel::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineParallel::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
{
finish();
graphicView->setCurrentAction(new ActionDrawLineParallelThrough(*container,
- *graphicView));
+ *graphicView));
}
else if (checkCommand("number", c))
{
- deleteSnapper();
- deletePreview();
- clearPreview();
+// deleteSnapper();
+// deletePreview();
+// clearPreview();
setStatus(SetNumber);
}
else
{
bool ok;
- double d = RS_Math::eval(c, &ok);
+ double d = Math::eval(c, &ok);
if (ok && d > 1.0e-10)
distance = d;
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY)
+ 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);
updateMouseButtonHints();
//setStatus(SetEntity);
}
+
break;
case SetNumber:
{
if (n > 0 && n < 100)
number = n;
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99"));
-
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99"));
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
-
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetEntity);
}
- break;
+ break;
default:
break;
void ActionDrawLineParallel::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
double ActionDrawLineParallel::getDistance()