// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
//
// JLH = James L. Hammons <jlhamm@acm.org>
//
#include "actionmodifymirror.h"
-#include "rs_dialogfactory.h"
-#include "rs_preview.h"
+#include "debug.h"
+#include "dialogfactory.h"
+#include "preview.h"
-ActionModifyMirror::ActionModifyMirror(RS_EntityContainer & container, GraphicView & graphicView):
+ActionModifyMirror::ActionModifyMirror(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Mirror Entities", container, graphicView)
{
}
void ActionModifyMirror::trigger()
{
- RS_DEBUG->print("ActionModifyMirror::trigger()");
+ DEBUG->print("ActionModifyMirror::trigger()");
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.mirror(data);
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyMirror::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyMirror::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyMirror::mouseMoveEvent begin");
if (getStatus() == SetAxisPoint1 || getStatus() == SetAxisPoint2)
{
{
axisPoint2 = mouse;
- deletePreview();
- clearPreview();
+// deletePreview();
+// clearPreview();
/* preview->addSelectionFrom(*container);
preview->mirror(axisPoint1, axisPoint2);
- preview->addEntity(new RS_Line(preview,RS_LineData(axisPoint1, axisPoint2)));*/
- drawPreview();
+ preview->addEntity(new Line(preview,LineData(axisPoint1, axisPoint2)));*/
+// drawPreview();
+ graphicView->preview.clear();
+ graphicView->preview.addSelectionFrom(*container);
+ graphicView->preview.mirror(axisPoint1, axisPoint2);
+ graphicView->preview.addEntity(new Line(&(graphicView->preview), LineData(axisPoint1, axisPoint2)));
+ graphicView->redraw();
}
break;
default:
break;
}
+
+ graphicView->redraw();
}
- RS_DEBUG->print("ActionModifyMirror::mouseMoveEvent end");
+ DEBUG->print("ActionModifyMirror::mouseMoveEvent end");
}
void ActionModifyMirror::mouseReleaseEvent(QMouseEvent * e)
}
else if (e->button() == Qt::RightButton)
{
- deletePreview();
- deleteSnapper();
+// deletePreview();
+// deleteSnapper();
init(getStatus() - 1);
+ graphicView->redraw(); //hm.
}
}
setStatus(ShowDialog);
graphicView->moveRelativeZero(mouse);
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
- if (RS_DIALOGFACTORY->requestMirrorDialog(data))
+ if (DIALOGFACTORY->requestMirrorDialog(data))
{
data.axisPoint1 = axisPoint1;
data.axisPoint2 = axisPoint2;
- deletePreview();
- clearPreview();
+// deletePreview();
+// clearPreview();
trigger();
finish();
+ graphicView->redraw(); //hm.
}
}
break;
void ActionModifyMirror::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
/*case Select:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"),
+ DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"),
tr("Cancel"));
break;*/
case SetAxisPoint1:
- RS_DIALOGFACTORY->updateMouseWidget(
- tr("Specify first point of mirror line"),
- tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(
+ tr("Specify first point of mirror line"), tr("Cancel"));
break;
case SetAxisPoint2:
- RS_DIALOGFACTORY->updateMouseWidget(
- tr("Specify second point of mirror line"),
- tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(
+ tr("Specify second point of mirror line"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyMirror::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
case SetAxisPoint1:
case SetAxisPoint2:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
break;
}
}