#include "qg_dialogfactory.h"
+#include "qg_layerwidget.h"
+#include "qg_mainwindowinterface.h"
+#include "rs_actiondimlinear.h"
+#include "rs_actioninterface.h"
+#include "rs_document.h"
#include "rs_patternlist.h"
#include "settings.h"
#include "rs_system.h"
-#include "rs_actioninterface.h"
-#include "rs_document.h"
-#include "rs_actiondimlinear.h"
+#include "rs_text.h"
#if 0
#include "ui/qg_arcoptions.h"
#include "rs_camdialog.h"
#endif
-#include "qg_layerwidget.h"
-#include "qg_mainwindowinterface.h"
-
//QG_DialogFactory* QG_DialogFactory::uniqueInstance = NULL;
/**
return false;
}
+/**
+ * Shows a dialog to edit the given entity.
+ */
bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
{
- return false;
+ if (entity == NULL)
+ return false;
+
+ bool ret = false;
+
+ switch (entity->rtti())
+ {
+//NOTE: These #if 0's are put here until these missing dialogs can be ported to Qt4.
+#if 0
+ case RS2::EntityPoint:
+ {
+ QG_DlgPoint dlg(parent);
+ dlg.setPoint(*((RS_Point *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updatePoint();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityLine:
+ {
+ QG_DlgLine dlg(parent);
+ dlg.setLine(*((RS_Line *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateLine();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityArc:
+ {
+ QG_DlgArc dlg(parent);
+ dlg.setArc(*((RS_Arc *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateArc();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityCircle:
+ {
+ QG_DlgCircle dlg(parent);
+ dlg.setCircle(*((RS_Circle *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateCircle();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityEllipse:
+ {
+ QG_DlgEllipse dlg(parent);
+ dlg.setEllipse(*((RS_Ellipse *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateEllipse();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntitySpline:
+ {
+ QG_DlgSpline dlg(parent);
+ dlg.setSpline(*((RS_Spline *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateSpline();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityInsert:
+ {
+ QG_DlgInsert dlg(parent);
+ dlg.setInsert(*((RS_Insert *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateInsert();
+ ret = true;
+ entity->update();
+ }
+ }
+ break;
+
+ case RS2::EntityDimAligned:
+ case RS2::EntityDimAngular:
+ case RS2::EntityDimDiametric:
+ case RS2::EntityDimRadial:
+ {
+ QG_DlgDimension dlg(parent);
+ dlg.setDim(*((RS_Dimension *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateDim();
+ ret = true;
+ ((RS_Dimension *)entity)->update(true);
+ }
+ }
+ break;
+
+ case RS2::EntityDimLinear:
+ {
+ QG_DlgDimLinear dlg(parent);
+ dlg.setDim(*((RS_DimLinear *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateDim();
+ ret = true;
+ ((RS_DimLinear *)entity)->update(true);
+ }
+ }
+ break;
+#endif
+
+ case RS2::EntityText:
+ {
+ DlgText dlg(parent);
+ dlg.setText(*((RS_Text *)entity), false);
+
+ if (dlg.exec())
+ {
+ dlg.updateText();
+ ret = true;
+ ((RS_Text *)entity)->update();
+ }
+ }
+ break;
+
+#if 0
+ case RS2::EntityHatch:
+ {
+ QG_DlgHatch dlg(parent);
+ dlg.setHatch(*((RS_Hatch *)entity), false);
+
+ if (dlg.exec())
+ {
+ dlg.updateHatch();
+ ret = true;
+ ((RS_Hatch *)entity)->update();
+ }
+ }
+ break;
+#endif
+
+ default:
+ break;
+ }
+
+ return ret;
}
/*
/**
* Shows a dialog for CAM options.
*/
-bool QG_DialogFactory::requestCamOptionsDialog(RS_Graphic& graphic)
+bool QG_DialogFactory::requestCamOptionsDialog(Drawing& graphic)
{
RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog");
RS_CamDialog dlg(graphic, parent);
/**
* Shows dialog for drawing options.
*/
-void QG_DialogFactory::requestOptionsDrawingDialog(RS_Graphic & graphic)
+void QG_DialogFactory::requestOptionsDrawingDialog(Drawing & graphic)
{
DlgOptionsDrawing dlg(parent);
dlg.setGraphic(&graphic);