// 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 "rs_preview.h"
ActionDrawLineParallel::ActionDrawLineParallel(RS_EntityContainer & container,
- GraphicView & graphicView): ActionInterface("Draw Parallels",
- container, graphicView)
+ 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);
if (!e)
RS_DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n");
+
+ graphicView->preview.clear();
+ graphicView->redraw();
}
void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e)
{
case SetEntity:
{
+#if 0
deletePreview();
clearPreview();
-// RS_Creation creation(preview, NULL, false);
-// creation.createParallel(coord, distance, number, entity);
+ RS_Creation creation(preview, NULL, false);
+ creation.createParallel(coord, distance, number, entity);
drawPreview();
+#else
+ graphicView->preview.clear();
+ RS_Creation creation(&(graphicView->preview), NULL, false);
+ creation.createParallel(coord, distance, number, entity);
+ graphicView->redraw();
+#endif
}
- break;
+ break;
default:
break;
void ActionDrawLineParallel::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
{
switch (getStatus())
{
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestOptions(this, true);
updateMouseButtonHints();
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestOptions(this, false);
}
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
{
finish();
graphicView->setCurrentAction(new ActionDrawLineParallelThrough(*container,
- *graphicView));
+ *graphicView));
}
else if (checkCommand("number", c))
{
- deleteSnapper();
- deletePreview();
- clearPreview();
+// deleteSnapper();
+// deletePreview();
+// clearPreview();
setStatus(SetNumber);
}
else
if (ok && d > 1.0e-10)
distance = d;
- else if (RS_DIALOGFACTORY != NULL)
+ else if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
updateMouseButtonHints();
//setStatus(SetEntity);
}
+
break;
case SetNumber:
{
if (n > 0 && n < 100)
number = n;
- else if (RS_DIALOGFACTORY != NULL)
+ else if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99"));
-
}
- else if (RS_DIALOGFACTORY != NULL)
+ else if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
-
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetEntity);
}
- break;
+ break;
default:
break;
void ActionDrawLineParallel::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}