#include "information.h"
#include "preview.h"
-ActionModifyRound::ActionModifyRound(RS_EntityContainer & container, GraphicView & graphicView):
+ActionModifyRound::ActionModifyRound(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Round Entities", container, graphicView)
{
entity1 = NULL;
void ActionModifyRound::trigger()
{
- RS_DEBUG->print("ActionModifyRound::trigger()");
+ DEBUG->print("ActionModifyRound::trigger()");
if (entity1 != NULL && entity1->isAtomic()
&& entity2 != NULL && entity2->isAtomic())
{
deletePreview();
- RS_Modification m(*container, graphicView);
- m.round(coord2, coord1, (RS_AtomicEntity *)entity1, coord2,
- (RS_AtomicEntity *)entity2, data);
+ Modification m(*container, graphicView);
+ m.round(coord2, coord1, (AtomicEntity *)entity1, coord2,
+ (AtomicEntity *)entity2, data);
coord1 = Vector(false);
entity1 = NULL;
clearPreview();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
}
void ActionModifyRound::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyRound::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyRound::mouseMoveEvent begin");
Vector mouse = graphicView->toGraph(e->x(), e->y());
- RS_Entity * se = catchEntity(e, RS2::ResolveAll);
+ Entity * se = catchEntity(e, RS2::ResolveAll);
switch (getStatus())
{
coord2 = mouse;
if (entity1 != NULL && entity2 != NULL && entity2->isAtomic()
- && RS_Information::isTrimmable(entity1, entity2))
+ && Information::isTrimmable(entity1, entity2))
{
deletePreview();
clearPreview();
-/* RS_Entity * tmp1 = entity1->clone();
- RS_Entity * tmp2 = entity2->clone();*/
+/* Entity * tmp1 = entity1->clone();
+ Entity * tmp2 = entity2->clone();*/
// tmp1->reparent(preview);
// tmp2->reparent(preview);
// preview->addEntity(tmp1);
/* bool trim = data.trim;
data.trim = false;
- RS_Modification m(*preview, NULL, false);
- m.round(coord2, coord1, (RS_AtomicEntity *)tmp1, coord2,
- (RS_AtomicEntity *)tmp2, data);
+ Modification m(*preview, NULL, false);
+ m.round(coord2, coord1, (AtomicEntity *)tmp1, coord2,
+ (AtomicEntity *)tmp2, data);
data.trim = trim;
preview->removeEntity(tmp1);
break;
}
- RS_DEBUG->print("ActionModifyRound::mouseMoveEvent end");
+ DEBUG->print("ActionModifyRound::mouseMoveEvent end");
}
void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e)
{
Vector mouse = graphicView->toGraph(e->x(), e->y());
- RS_Entity * se = catchEntity(e, RS2::ResolveAll);
+ Entity * se = catchEntity(e, RS2::ResolveAll);
if (e->button() == Qt::LeftButton)
{
coord1 = mouse;
if (entity1 != NULL && entity1->isAtomic()
- && RS_Information::isTrimmable(entity1))
+ && Information::isTrimmable(entity1))
setStatus(SetEntity2);
break;
coord2 = mouse;
if (entity2 != NULL && entity2->isAtomic()
- && RS_Information::isTrimmable(entity1, entity2))
+ && Information::isTrimmable(entity1, entity2))
//setStatus(ChooseRounding);
trigger();
break;
}
}
-void ActionModifyRound::commandEvent(RS_CommandEvent * e)
+void ActionModifyRound::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;
}
*/
data.trim = !data.trim;
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
}
break;
case SetRadius: {
bool ok;
- double r = RS_Math::eval(c, &ok);
+ double r = Math::eval(c, &ok);
if (ok == true)
data.radius = r;
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ 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);
setStatus(lastStatus);
}
break;
} else if (c==cmdNo.toLower() || c==cmdNo2) {
data.trim = false;
} else {
- RS_DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' "
+ DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' "
"or 'No'"));
}
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;*/
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionModifyRound::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionModifyRound::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetEntity1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first entity"),
tr("Back"));
break;
case SetEntity2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second entity"),
tr("Back"));
break;
case SetRadius:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter radius:"),
+ DIALOGFACTORY->updateMouseWidget(tr("Enter radius:"),
tr("Cancel"));
break;
/*case SetTrim:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"),
+ DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"),
"");
break;*/
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyRound::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
}
void ActionModifyRound::setRadius(double r)