#include "graphicview.h"
#include "information.h"
-ActionDrawHatch::ActionDrawHatch(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawHatch::ActionDrawHatch(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw Hatch", container, graphicView)
{
hatch = NULL;
void ActionDrawHatch::init(int status)
{
ActionInterface::init(status);
- clearPreview();
+// clearPreview();
- RS_Hatch tmp(container, data);
+ Hatch tmp(container, data);
tmp.setLayerToActive();
tmp.setPenToActive();
- if (RS_DIALOGFACTORY->requestHatchDialog(&tmp))
+ if (DIALOGFACTORY->requestHatchDialog(&tmp))
{
data = tmp.getData();
trigger();
void ActionDrawHatch::trigger()
{
- RS_DEBUG->print("ActionDrawHatch::trigger()");
+ DEBUG->print("ActionDrawHatch::trigger()");
- deleteSnapper();
- RS_Entity * e;
+// deleteSnapper();
+ Entity * e;
// deselect unhatchable entities:
for(e=container->firstEntity(RS2::ResolveNone); e!=NULL;
&& (e->rtti() == RS2::EntityHatch
|| e->rtti() == RS2::EntityEllipse || e->rtti() == RS2::EntityPoint
|| e->rtti() == RS2::EntityText
- || RS_Information::isDimension(e->rtti())))
+ || Information::isDimension(e->rtti())))
e->setSelected(false);
}
&& (e->rtti() == RS2::EntityHatch
|| e->rtti() == RS2::EntityEllipse || e->rtti() == RS2::EntityPoint
|| e->rtti() == RS2::EntityText
- || RS_Information::isDimension(e->rtti())))
+ || Information::isDimension(e->rtti())))
e->setSelected(false);
}
return;
}
- hatch = new RS_Hatch(container, data);
+ hatch = new Hatch(container, data);
hatch->setLayerToActive();
hatch->setPenToActive();
- RS_EntityContainer * loop = new RS_EntityContainer(hatch);
- loop->setPen(RS_Pen(RS2::FlagInvalid));
+ EntityContainer * loop = new EntityContainer(hatch);
+ loop->setPen(Pen(RS2::FlagInvalid));
// add selected contour:
- for(RS_Entity * e=container->firstEntity(RS2::ResolveAll); e!=NULL;
+ for(Entity * e=container->firstEntity(RS2::ResolveAll); e!=NULL;
e=container->nextEntity(RS2::ResolveAll))
{
if (e->isSelected())
|| e->getParent()->rtti() == RS2::EntityPolyline))
e->getParent()->setSelected(false);
- RS_Entity * cp = e->clone();
- cp->setPen(RS_Pen(RS2::FlagInvalid));
+ Entity * cp = e->clone();
+ cp->setPen(Pen(RS2::FlagInvalid));
cp->reparent(loop);
loop->addEntity(cp);
}
}
hatch->update();
- graphicView->drawEntity(hatch);
- RS_DIALOGFACTORY->commandMessage(tr("Hatch created successfully."));
+ DIALOGFACTORY->commandMessage(tr("Hatch created successfully."));
}
else
{
delete hatch;
hatch = NULL;
- RS_DIALOGFACTORY->commandMessage(tr("Invalid hatch area. Please check that "
+ DIALOGFACTORY->commandMessage(tr("Invalid hatch area. Please check that "
"the entities chosen form one or more closed contours."));
}
}
void ActionDrawHatch::mouseMoveEvent(QMouseEvent *)
{
- RS_DEBUG->print("ActionDrawHatch::mouseMoveEvent begin");
-
- /*if (getStatus()==SetPos) {
- Vector mouse = snapPoint(e);
- pos = mouse;
-
-
- deletePreview();
- if (hatch!=NULL && !hatch->isVisible()) {
- hatch->setVisible(true);
- }
- offset = Vector(graphicView->toGuiDX(pos.x),
- -graphicView->toGuiDY(pos.y));
- drawPreview();
- }*/
-
- RS_DEBUG->print("ActionDrawHatch::mouseMoveEvent end");
+ DEBUG->print("ActionDrawHatch::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawHatch::mouseMoveEvent end");
}
void ActionDrawHatch::mouseReleaseEvent(QMouseEvent * e)
}
else if (e->button() == Qt::RightButton)
{
- //deletePreview();
- deleteSnapper();
init(getStatus() - 1);
+//doesn't clear the preview or snapper.
+ graphicView->redraw(); // hm.
}
}
void ActionDrawHatch::updateMouseButtonHints()
{
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
}
void ActionDrawHatch::updateMouseCursor()
void ActionDrawHatch::updateToolBar()
{
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}