]> Shamusworld >> Repos - architektonas/blobdiff - src/widgets/qg_dialogfactory.cpp
Phase two of adding polyline functionality...
[architektonas] / src / widgets / qg_dialogfactory.cpp
index 632ce8dc174b21c78bfe7e92a1b79b77c58db9ea..b0a9248535322c4d68ee2b421b380acb50768d84 100644 (file)
@@ -3,7 +3,9 @@
 // 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 "qg_dialogfactory.h"
 
-#include "qg_layerwidget.h"
+#include "graphicview.h"
+#include "layerwidget.h"
 #include "qg_mainwindowinterface.h"
-#include "rs_actiondimlinear.h"
-#include "rs_actioninterface.h"
-#include "rs_document.h"
-#include "rs_patternlist.h"
+#include "actiondimlinear.h"
+#include "actioninterface.h"
+#include "blocklist.h"
+#include "document.h"
+#include "hatch.h"
+#include "layerlist.h"
+#include "patternlist.h"
 #include "settings.h"
-#include "rs_system.h"
-#include "rs_text.h"
+#include "system.h"
+#include "text.h"
 
-#if 0
-       #include "ui/qg_arcoptions.h"
-       #include "ui/qg_arctangentialoptions.h"
-       #include "ui/qg_beveloptions.h"
-       #include "ui/qg_blockdialog.h"
-       #include "ui/qg_cadtoolbar.h"
-       #include "ui/qg_circleoptions.h"
-       #include "ui/qg_commandwidget.h"
-       #include "ui/qg_coordinatewidget.h"
-#include "ui/qg_dimlinearoptions.h"
-#include "ui/qg_dimoptions.h"
-#include "ui/qg_dlgarc.h"
-       #include "ui/qg_dlgattributes.h"
-#include "ui/qg_dlgcircle.h"
-#include "ui/qg_dlgdimension.h"
-#include "ui/qg_dlgdimlinear.h"
-#include "ui/qg_dlgellipse.h"
-#include "ui/qg_dlghatch.h"
-#include "ui/qg_dlginsert.h"
-#include "ui/qg_dlgline.h"
-#include "ui/qg_dlgmirror.h"
-#include "ui/qg_dlgmove.h"
-#include "ui/qg_dlgmoverotate.h"
-       #include "ui/qg_dlgoptionsdrawing.h"
-       #include "ui/qg_dlgoptionsgeneral.h"
-#include "ui/qg_dlgpoint.h"
-#include "ui/qg_dlgrotate.h"
-#include "ui/qg_dlgrotate2.h"
-#include "ui/qg_dlgscale.h"
-#include "ui/qg_dlgspline.h"
-       #include "ui/qg_dlgtext.h"
-       #include "ui/qg_imageoptions.h"
-#include "ui/qg_insertoptions.h"
-       #include "ui/qg_layerdialog.h"
-#include "ui/qg_libraryinsertoptions.h"
-#include "ui/qg_lineangleoptions.h"
-#include "ui/qg_linebisectoroptions.h"
-       #include "ui/qg_lineoptions.h"
-#include "ui/qg_lineparalleloptions.h"
-#include "ui/qg_lineparallelthroughoptions.h"
-#include "ui/qg_linepolygon2options.h"
-#include "ui/qg_linepolygonoptions.h"
-#include "ui/qg_linerelangleoptions.h"
-       #include "ui/qg_mousewidget.h"
-#include "ui/qg_moverotateoptions.h"
-       #include "ui/qg_printpreviewoptions.h"
-#include "ui/qg_roundoptions.h"
-       #include "ui/qg_selectionwidget.h"
-#include "ui/qg_snapdistoptions.h"
-#include "ui/qg_splineoptions.h"
-       #include "ui/qg_textoptions.h"
-#include "ui/qg_trimamountoptions.h"
-#endif
 #include "arcoptions.h"
 #include "arctangentialoptions.h"
 #include "beveloptions.h"
 #include "circleoptions.h"
 #include "commandwidget.h"
 #include "coordinatewidget.h"
+#include "dimlinearoptions.h"
+#include "dimoptions.h"
+#include "dlgarc.h"
 #include "dlgattributes.h"
+#include "dlgcircle.h"
+#include "dlgdimension.h"
+#include "dlgdimlinear.h"
+#include "dlgellipse.h"
+#include "dlghatch.h"
+#include "dlginsert.h"
+#include "dlgline.h"
+#include "dlgmirror.h"
+#include "dlgmove.h"
+#include "dlgmoverotate.h"
 #include "dlgoptionsdrawing.h"
 #include "dlgoptionsgeneral.h"
+#include "dlgpoint.h"
+#include "dlgrotate.h"
+#include "dlgrotate2.h"
+#include "dlgscale.h"
+#include "dlgspline.h"
 #include "dlgtext.h"
+#include "libraryinsertoptions.h"
 #include "imageoptions.h"
+#include "insertoptions.h"
 #include "layerdialog.h"
+#include "lineangleoptions.h"
+#include "linebisectoroptions.h"
 #include "lineoptions.h"
+#include "lineparalleloptions.h"
+#include "lineparallelthroughoptions.h"
+#include "linepolygon2options.h"
+#include "linepolygonoptions.h"
+#include "linerelangleoptions.h"
 #include "mousewidget.h"
+#include "moverotateoptions.h"
+#include "polylineoptions.h"
 #include "printpreviewoptions.h"
+#include "roundoptions.h"
 #include "selectionwidget.h"
+#include "snapdistoptions.h"
+#include "splineoptions.h"
 #include "textoptions.h"
-
-#ifdef RS_PROF
-#include "qg_polylineoptions.h"
-#endif
+#include "trimamountoptions.h"
 
 #ifdef RS_CAM
-#include "rs_camdialog.h"
+#include "camdialog.h"
 #endif
 
 //QG_DialogFactory* QG_DialogFactory::uniqueInstance = NULL;
  */
 //QG_DialogFactory::QG_DialogFactory(QWidget * parent, QWidget * ow):
 QG_DialogFactory::QG_DialogFactory(QWidget * parent, QToolBar * ow):
-       RS_DialogFactoryInterface()
+       DialogFactoryInterface()
 {
-       RS_DEBUG->print("QG_DialogFactory::QG_DialogFactory");
+       DEBUG->print("QG_DialogFactory::QG_DialogFactory");
 
        this->parent = parent;
        setOptionWidget(ow);
@@ -128,7 +110,7 @@ QG_DialogFactory::QG_DialogFactory(QWidget * parent, QToolBar * ow):
        cadToolBar = NULL;
        commandWidget = NULL;
        mainWindow = NULL;
-       RS_DEBUG->print("QG_DialogFactory::QG_DialogFactory: OK");
+       DEBUG->print("QG_DialogFactory::QG_DialogFactory: OK");
 }
 
 /**
@@ -136,8 +118,8 @@ QG_DialogFactory::QG_DialogFactory(QWidget * parent, QToolBar * ow):
  */
 QG_DialogFactory::~QG_DialogFactory()
 {
-       RS_DEBUG->print("QG_DialogFactory::~QG_DialogFactory");
-       RS_DEBUG->print("QG_DialogFactory::~QG_DialogFactory: OK");
+       DEBUG->print("QG_DialogFactory::~QG_DialogFactory");
+       DEBUG->print("QG_DialogFactory::~QG_DialogFactory: OK");
 }
 
 /**
@@ -146,9 +128,9 @@ QG_DialogFactory::~QG_DialogFactory()
 ///*virtual*/ void QG_DialogFactory::setOptionWidget(QWidget * ow)
 /*virtual*/ void QG_DialogFactory::setOptionWidget(QToolBar * ow)
 {
-       RS_DEBUG->print("QG_DialogFactory::setOptionWidget");
+       DEBUG->print("QG_DialogFactory::setOptionWidget");
        optionWidget = ow;
-       RS_DEBUG->print("QG_DialogFactory::setOptionWidget: OK");
+       DEBUG->print("QG_DialogFactory::setOptionWidget: OK");
 }
 
 /**
@@ -227,7 +209,7 @@ void QG_DialogFactory::requestWarningDialog(const QString & warning)
 /**
  * Requests a new document from the main window.
  */
-RS_GraphicView * QG_DialogFactory::requestNewDocument(const QString & fileName, RS_Document * doc)
+GraphicView * QG_DialogFactory::requestNewDocument(const QString & fileName, Document * doc)
 {
        if (mainWindow != NULL)
        {
@@ -256,9 +238,9 @@ void QG_DialogFactory::requestSimulationControls()
  * @return a pointer to the newly created layer that
  * should be added.
  */
-RS_Layer * QG_DialogFactory::requestNewLayerDialog(RS_LayerList * layerList)
+Layer * QG_DialogFactory::requestNewLayerDialog(LayerList * layerList)
 {
-       RS_Layer * layer = NULL;
+       Layer * layer = NULL;
        QString layer_name = "noname";
        int i = 2;
 
@@ -269,7 +251,7 @@ RS_Layer * QG_DialogFactory::requestNewLayerDialog(RS_LayerList * layerList)
        }
 
        // Layer for parameter livery
-       layer = new RS_Layer(layer_name);
+       layer = new Layer(layer_name);
 
 //     QG_LayerDialog dlg(parent, "Layer Dialog");
        LayerDialog dlg(parent);
@@ -293,13 +275,13 @@ RS_Layer * QG_DialogFactory::requestNewLayerDialog(RS_LayerList * layerList)
  *
  * @return a pointer to the layer that should be removed.
  */
-RS_Layer * QG_DialogFactory::requestLayerRemovalDialog(RS_LayerList * layerList)
+Layer * QG_DialogFactory::requestLayerRemovalDialog(LayerList * layerList)
 {
-    RS_Layer * layer = NULL;
+    Layer * layer = NULL;
 
        if (layerList == NULL)
        {
-        RS_DEBUG->print(RS_Debug::D_WARNING,
+        DEBUG->print(Debug::D_WARNING,
                "QG_DialogFactory::requestLayerRemovalDialog(): layerList is NULL");
 
         return NULL;
@@ -307,7 +289,7 @@ RS_Layer * QG_DialogFactory::requestLayerRemovalDialog(RS_LayerList * layerList)
     /*
        if (layerList==NULL) {
            if (container!=NULL && container->rtti()==RS2::EntityGraphic) {
-               layerList = (RS_LayerList*)container;
+               layerList = (LayerList*)container;
            } else {
                return NULL;
            }
@@ -350,31 +332,22 @@ RS_Layer * QG_DialogFactory::requestLayerRemovalDialog(RS_LayerList * layerList)
  * @return A pointer to a new layer with the changed attributes
  *         or NULL if the dialog was cancelled.
  */
-RS_Layer * QG_DialogFactory::requestEditLayerDialog(RS_LayerList * layerList)
+Layer * QG_DialogFactory::requestEditLayerDialog(LayerList * layerList)
 {
-       RS_DEBUG->print("QG_DialogFactory::requestEditLayerDialog");
-       RS_Layer * layer = NULL;
-       /*
-       if (layerList==NULL) {
-               if (container!=NULL && container->rtti()==RS2::EntityGraphic) {
-                       layerList = (RS_LayerList*)container;
-               } else {
-                       return NULL;
-               }
-       }
-       */
+       DEBUG->print("QG_DialogFactory::requestEditLayerDialog");
+       Layer * layer = NULL;
 
-       if (layerList == NULL)
+       if (!layerList)
        {
-               RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestEditLayerDialog(): "
+               DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestEditLayerDialog(): "
                        "layerList is NULL");
                return NULL;
        }
 
        // Layer for parameter livery
-       if (layerList->getActive() != NULL)
+       if (layerList->getActive())
        {
-               layer = new RS_Layer(*layerList->getActive());
+               layer = new Layer(*layerList->getActive());
 
 //        QG_LayerDialog dlg(parent, QMessageBox::tr("Layer Dialog"));
                LayerDialog dlg(parent);
@@ -401,21 +374,21 @@ RS_Layer * QG_DialogFactory::requestEditLayerDialog(RS_LayerList * layerList)
  * @return a pointer to the newly created block that
  * should be added.
  */
-RS_BlockData QG_DialogFactory::requestNewBlockDialog(RS_BlockList * blockList)
+BlockData QG_DialogFactory::requestNewBlockDialog(BlockList * blockList)
 {
-       //RS_Block* block = NULL;
-       RS_BlockData ret;
-       ret = RS_BlockData("", Vector(false), false);
+       //Block* block = NULL;
+       BlockData ret;
+       ret = BlockData("", Vector(false), false);
 
        if (blockList == NULL)
        {
-               RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestNewBlockDialog(): "
+               DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestNewBlockDialog(): "
                        "blockList is NULL");
                return ret;
        }
 
        // Block for parameter livery
-       //block = new RS_Block(container, "noname", Vector(0.0,0.0));
+       //block = new Block(container, "noname", Vector(0.0,0.0));
 
        BlockDialog dlg(parent);
        dlg.setBlockList(blockList);
@@ -431,22 +404,22 @@ RS_BlockData QG_DialogFactory::requestNewBlockDialog(RS_BlockList * blockList)
  *
  * @return a pointer to the modified block or NULL on cancellation.
  */
-RS_BlockData QG_DialogFactory::requestBlockAttributesDialog(RS_BlockList * blockList)
+BlockData QG_DialogFactory::requestBlockAttributesDialog(BlockList * blockList)
 {
-       //RS_Block* block = NULL;
-       RS_BlockData ret;
-       ret = RS_BlockData("", Vector(false), false);
+       //Block* block = NULL;
+       BlockData ret;
+       ret = BlockData("", Vector(false), false);
 
        if (blockList == NULL)
        {
-               RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestBlockAttributesDialog(): "
+               DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestBlockAttributesDialog(): "
                        "blockList is NULL");
                return ret;
        }
        /*
                if (blockList==NULL) {
                        if (container!=NULL && container->rtti()==RS2::EntityGraphic) {
-                               blockList = (RS_BlockList*)container;
+                               blockList = (BlockList*)container;
                        } else {
                                return NULL;
                        }
@@ -467,17 +440,17 @@ RS_BlockData QG_DialogFactory::requestBlockAttributesDialog(RS_BlockList * block
                ret = dlg.getBlockData();
        }
        //else {
-       //      ret = RS_BlockData("", Vector(false));
+       //      ret = BlockData("", Vector(false));
        //}
 
        return ret;
 }
 
-/*virtual*/ void QG_DialogFactory::requestEditBlockWindow(RS_BlockList * /*blockList*/)
+/*virtual*/ void QG_DialogFactory::requestEditBlockWindow(BlockList * /*blockList*/)
 {
 }
 
-/*virtual*/ void QG_DialogFactory::closeEditBlockWindow(RS_Block * /*blockList*/)
+/*virtual*/ void QG_DialogFactory::closeEditBlockWindow(Block * /*blockList*/)
 {
 }
 
@@ -487,13 +460,13 @@ RS_BlockData QG_DialogFactory::requestBlockAttributesDialog(RS_BlockList * block
  *
  * @return a pointer to the block that should be removed.
  */
-RS_Block * QG_DialogFactory::requestBlockRemovalDialog(RS_BlockList * blockList)
+Block * QG_DialogFactory::requestBlockRemovalDialog(BlockList * blockList)
 {
-       RS_Block * block = NULL;
+       Block * block = NULL;
 
        if (blockList == NULL)
        {
-               RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestBlockRemovalDialog(): "
+               DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestBlockRemovalDialog(): "
                        "blockList is NULL");
                return NULL;
        }
@@ -531,7 +504,7 @@ QString QG_DialogFactory::requestFileSaveAsDialog() {
     // read default settings:
     RS_SETTINGS->beginGroup("/Paths");
     QString defDir = RS_SETTINGS->readEntry("/Save",
-                       RS_SYSTEM->getHomeDir());
+                       SYSTEM->getHomeDir());
     QString defFilter = RS_SETTINGS->readEntry("/SaveFilter",
                           "Drawing Exchange (*.dxf)");
     RS_SETTINGS->endGroup();
@@ -623,7 +596,7 @@ QString QG_DialogFactory::requestImageOpenDialog()
 
        // read default settings:
        settings.beginGroup("Paths");
-       QString defDir = settings.value("OpenImage", RS_SYSTEM->getHomeDir()).toString();
+       QString defDir = settings.value("OpenImage", SYSTEM->getHomeDir()).toString();
        QString defFilter = settings.value("ImageFilter", "Portable Network Graphic (*.png)").toString();
        settings.endGroup();
 
@@ -725,13 +698,13 @@ QString QG_DialogFactory::requestImageOpenDialog()
        return fn;
 }
 
-void QG_DialogFactory::requestOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestOptions(ActionInterface * action, bool on, bool update)
 {
-       RS_DEBUG->print("QG_DialogFactory::requestOptions");
+       DEBUG->print("QG_DialogFactory::requestOptions");
 
     if (action == NULL)
        {
-        RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestOptions: action is NULL");
+        DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestOptions: action is NULL");
         return;
     }
 
@@ -742,9 +715,9 @@ void QG_DialogFactory::requestOptions(RS_ActionInterface * action, bool on, bool
         break;
 
     case RS2::ActionDrawLine:
-               RS_DEBUG->print("QG_DialogFactory::requestOptions: line");
+               DEBUG->print("QG_DialogFactory::requestOptions: line");
         requestLineOptions(action, on);
-               RS_DEBUG->print("QG_DialogFactory::requestOptions: line: OK");
+               DEBUG->print("QG_DialogFactory::requestOptions: line: OK");
         break;
 
     case RS2::ActionDrawPolyline:
@@ -814,7 +787,7 @@ void QG_DialogFactory::requestOptions(RS_ActionInterface * action, bool on, bool
     case RS2::ActionDimLinear:
         requestDimensionOptions(action, on, update);
 
-               if (((RS_ActionDimLinear *)action)->hasFixedAngle() == false)
+               if (((ActionDimLinear *)action)->hasFixedAngle() == false)
             requestDimLinearOptions(action, on, update);
 
                break;
@@ -855,13 +828,13 @@ void QG_DialogFactory::requestOptions(RS_ActionInterface * action, bool on, bool
         break;
     }
 
-       RS_DEBUG->print("QG_DialogFactory::requestOptions: OK");
+       DEBUG->print("QG_DialogFactory::requestOptions: OK");
 }
 
 /**
  * Shows a widget for options for the action: "print preview"
  */
-void QG_DialogFactory::requestPrintPreviewOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestPrintPreviewOptions(ActionInterface * action, bool on, bool update)
 {
        static PrintPreviewOptions * toolWidget = NULL;
 
@@ -884,7 +857,7 @@ void QG_DialogFactory::requestPrintPreviewOptions(RS_ActionInterface * action, b
 /**
  * Shows a widget for options for the action: "draw line"
  */
-void QG_DialogFactory::requestLineOptions(RS_ActionInterface * action, bool on)
+void QG_DialogFactory::requestLineOptions(ActionInterface * action, bool on)
 {
 /*
 The way I see it, this is failure. We're constantly creating & deleting
@@ -911,48 +884,49 @@ them over and over. May need to do some more refactoring based on this idea...
                toolWidget->setAction(action);
        }
 
-       RS_DEBUG->print("QG_DialogFactory::requestLineOptions: OK");
+       DEBUG->print("QG_DialogFactory::requestLineOptions: OK");
 }
 
 /**
  * Shows a widget for options for the action: "draw polyline"
  */
-void QG_DialogFactory::requestPolylineOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestPolylineOptions(ActionInterface * action, bool on, bool update)
 {
-#ifdef RS_PROF
-       static QG_PolylineOptions * toolWidget = NULL;
+       static PolylineOptions * toolWidget = NULL;
 
-       if (optionWidget != NULL)
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
        {
-               if (toolWidget != NULL)
-               {
-                       delete toolWidget;
-                       toolWidget = NULL;
-               }
-               if (on && toolWidget == NULL)
-               {
-                       toolWidget = new QG_PolylineOptions(optionWidget);
-                       toolWidget->setAction(action, update);
-               }
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new PolylineOptions(optionWidget);
+               toolWidget->setAction(action, update);
        }
-#endif
 }
 
-#if 0
 /**
  * Shows a widget for options for the action: "draw line parallel"
  */
-void QG_DialogFactory::requestLineParallelOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestLineParallelOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_LineParallelOptions* toolWidget = NULL;
+    static LineParallelOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
+    if (optionWidget!=NULL)
+       {
+        if (toolWidget!=NULL)
+               {
             delete toolWidget;
             toolWidget = NULL;
         }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LineParallelOptions(optionWidget);
+        if (on==true && toolWidget==NULL)
+               {
+            toolWidget = new LineParallelOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
@@ -961,10 +935,9 @@ void QG_DialogFactory::requestLineParallelOptions(RS_ActionInterface * action, b
 /**
  * Shows a widget for options for the action: "draw line parallel through"
  */
-void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* action,
-    bool on, bool update)
+void QG_DialogFactory::requestLineParallelThroughOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_LineParallelThroughOptions* toolWidget = NULL;
+    static LineParallelThroughOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -972,7 +945,7 @@ void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* act
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LineParallelThroughOptions(optionWidget);
+            toolWidget = new LineParallelThroughOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
@@ -981,52 +954,55 @@ void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* act
 /**
  * Shows a widget for options for the action: "line angle"
  */
-void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLineAngleOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_LineAngleOptions* toolWidget = NULL;
+       static LineAngleOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LineAngleOptions(optionWidget);
-            toolWidget->setAction(action, update);
-            //toolWidget->setData(&angle, &length, fixedAngle, update);
-        }
-    }
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new LineAngleOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
  * Shows a widget for options for the action: "line relative angle"
  */
-void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLineRelAngleOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_LineRelAngleOptions* toolWidget = NULL;
+       static LineRelAngleOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LineRelAngleOptions(optionWidget);
-            toolWidget->setAction(action, update);
-            //toolWidget->setData(&angle, &length, fixedAngle, update);
-        }
-    }
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new LineRelAngleOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
  * Shows a widget for options for the action: "line angle"
  */
-void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLineBisectorOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_LineBisectorOptions* toolWidget = NULL;
+    static LineBisectorOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1034,7 +1010,7 @@ void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LineBisectorOptions(optionWidget);
+            toolWidget = new LineBisectorOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
@@ -1043,10 +1019,9 @@ void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface* action,
 /**
  * Shows a widget for options for the action: "draw polygon"
  */
-void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLinePolygonOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_LinePolygonOptions* toolWidget = NULL;
+    static LinePolygonOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1054,7 +1029,7 @@ void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LinePolygonOptions(optionWidget);
+            toolWidget = new LinePolygonOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
@@ -1063,10 +1038,9 @@ void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action,
 /**
  * Shows a widget for options for the action: "draw polygon2"
  */
-void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLinePolygon2Options(ActionInterface * action, bool on, bool update)
 {
-    static QG_LinePolygon2Options* toolWidget = NULL;
+    static LinePolygon2Options * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1074,140 +1048,135 @@ void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LinePolygon2Options(optionWidget);
+            toolWidget = new LinePolygon2Options(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for spline options.
+ * Shows a widget for arc options.
  */
-void QG_DialogFactory::requestSplineOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestArcOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_SplineOptions* toolWidget = NULL;
+       static ArcOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_SplineOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
+       if (optionWidget != NULL)
+       {
+               if (toolWidget != NULL)
+               {
+                       delete toolWidget;
+                       toolWidget = NULL;
+               }
+
+               if (on && toolWidget == NULL)
+               {
+                       toolWidget = new ArcOptions(optionWidget);
+                       toolWidget->setAction(action, update);
+                       //toolWidget->setData(&data);
+               }
+       }
 }
 
 /**
- * Shows a widget for insert options.
+ * Shows a widget for tangential arc options.
  */
-void QG_DialogFactory::requestInsertOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestArcTangentialOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_InsertOptions* toolWidget = NULL;
+       static ArcTangentialOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_InsertOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
-}
+       if (!optionWidget)
+               return;
 
-/**
- * Shows a widget for image options.
- */
-void QG_DialogFactory::requestImageOptions(RS_ActionInterface* action,
-        bool on, bool update)
-{
-    static QG_ImageOptions* toolWidget = NULL;
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_ImageOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
+       if (on)
+       {
+               toolWidget = new ArcTangentialOptions(optionWidget);
+               toolWidget->setAction(action, update);
+               //toolWidget->setData(&data);
+       }
 }
 
 /**
- * Shows a widget for dimension options.
+ * Shows a widget for circle options.
  */
-void QG_DialogFactory::requestDimensionOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestCircleOptions(ActionInterface * action, bool on, bool update)
 {
-    //static QLabel* l = NULL;
-    static QG_DimOptions* toolWidget = NULL;
+    static CircleOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
+    if (optionWidget)
+       {
+        if (toolWidget)
+               {
             delete toolWidget;
             toolWidget = NULL;
         }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_DimOptions(optionWidget);
+
+        if (on && toolWidget == NULL)
+               {
+            toolWidget = new CircleOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for linear dimension options.
+ * Shows a widget for spline options.
  */
-void QG_DialogFactory::requestDimLinearOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestSplineOptions(ActionInterface * action, bool on, bool update)
 {
-    //static QLabel* l = NULL;
-    static QG_DimLinearOptions* toolWidget = NULL;
+       static SplineOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_DimLinearOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new SplineOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
- * Shows a widget for 'snap to a point with a given distance' options.
+ * Shows a widget for text options.
  */
-void QG_DialogFactory::requestSnapDistOptions(double& dist, bool on)
+void QG_DialogFactory::requestTextOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_SnapDistOptions* toolWidget = NULL;
+       static TextOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_SnapDistOptions(optionWidget);
-            toolWidget->setDist(&dist);
-        }
-    }
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new TextOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
- * Shows a widget for 'snap to a point with a given distance' options.
+ * Shows a widget for insert options.
  */
-void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestInsertOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_MoveRotateOptions* toolWidget = NULL;
+    static InsertOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1215,19 +1184,18 @@ void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_MoveRotateOptions(optionWidget);
+            toolWidget = new InsertOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for 'trim amount' options.
+ * Shows a widget for image options.
  */
-void QG_DialogFactory::requestTrimAmountOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestImageOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_TrimAmountOptions* toolWidget = NULL;
+    static ImageOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1235,19 +1203,18 @@ void QG_DialogFactory::requestTrimAmountOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_TrimAmountOptions(optionWidget);
+            toolWidget = new ImageOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for rounding options.
+ * Shows a widget for dimension options.
  */
-void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestDimensionOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_RoundOptions* toolWidget = NULL;
+    static DimOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1255,90 +1222,87 @@ void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_RoundOptions(optionWidget);
+            toolWidget = new DimOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for library insert options.
+ * Shows a widget for linear dimension options.
  */
-void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action,
-        bool on, bool update)
-{
-    static QG_LibraryInsertOptions* toolWidget = NULL;
-
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LibraryInsertOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
-}
-#else
-void QG_DialogFactory::requestLineParallelOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestDimLinearOptions(ActionInterface * action, bool on, bool update)
 {
-}
+       static DimLinearOptions * toolWidget = NULL;
 
-void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
+       if (!optionWidget)
+               return;
 
-void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
 
-void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface* action, bool on, bool update)
-{
+       if (on)
+       {
+               toolWidget = new DimLinearOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
-void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface* action, bool on, bool update)
+/**
+ * Shows a widget for 'snap to a point with a given distance' options.
+ */
+void QG_DialogFactory::requestSnapDistOptions(double & dist, bool on)
 {
-}
+       static SnapDistOptions * toolWidget = NULL;
 
-void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
+       if (!optionWidget)
+               return;
 
-void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action, bool on, bool update)
-{
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new SnapDistOptions(optionWidget);
+               toolWidget->setDist(&dist);
+       }
 }
 
 /**
- * Shows a widget for arc options.
+ * Shows a widget for 'snap to a point with a given distance' options.
  */
-void QG_DialogFactory::requestArcOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestMoveRotateOptions(ActionInterface * action, bool on, bool update)
 {
-       static ArcOptions * toolWidget = NULL;
+       static MoveRotateOptions * toolWidget = NULL;
 
-       if (optionWidget != NULL)
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
        {
-               if (toolWidget != NULL)
-               {
-                       delete toolWidget;
-                       toolWidget = NULL;
-               }
+               delete toolWidget;
+               toolWidget = NULL;
+       }
 
-               if (on && toolWidget == NULL)
-               {
-                       toolWidget = new ArcOptions(optionWidget);
-                       toolWidget->setAction(action, update);
-                       //toolWidget->setData(&data);
-               }
+       if (on)
+       {
+               toolWidget = new MoveRotateOptions(optionWidget);
+               toolWidget->setAction(action, update);
        }
 }
 
 /**
- * Shows a widget for tangential arc options.
+ * Shows a widget for 'trim amount' options.
  */
-void QG_DialogFactory::requestArcTangentialOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestTrimAmountOptions(ActionInterface * action, bool on, bool update)
 {
-       static ArcTangentialOptions * toolWidget = NULL;
+       static TrimAmountOptions * toolWidget = NULL;
 
        if (!optionWidget)
                return;
@@ -1351,45 +1315,40 @@ void QG_DialogFactory::requestArcTangentialOptions(RS_ActionInterface * action,
 
        if (on)
        {
-               toolWidget = new ArcTangentialOptions(optionWidget);
+               toolWidget = new TrimAmountOptions(optionWidget);
                toolWidget->setAction(action, update);
-               //toolWidget->setData(&data);
        }
 }
 
 /**
- * Shows a widget for circle options.
+ * Shows a widget for beveling options.
  */
-void QG_DialogFactory::requestCircleOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestBevelOptions(ActionInterface * action, bool on, bool update)
 {
-    static CircleOptions * toolWidget = NULL;
+    static BevelOptions * toolWidget = NULL;
 
-    if (optionWidget)
+    if (optionWidget != NULL)
        {
-        if (toolWidget)
+        if (toolWidget != NULL)
                {
             delete toolWidget;
             toolWidget = NULL;
         }
 
-        if (on && toolWidget == NULL)
+               if (on && toolWidget == NULL)
                {
-            toolWidget = new CircleOptions(optionWidget);
+            toolWidget = new BevelOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
-void QG_DialogFactory::requestSplineOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
 /**
- * Shows a widget for text options.
+ * Shows a widget for rounding options.
  */
-void QG_DialogFactory::requestTextOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestRoundOptions(ActionInterface * action, bool on, bool update)
 {
-       static TextOptions * toolWidget = NULL;
+       static RoundOptions * toolWidget = NULL;
 
        if (!optionWidget)
                return;
@@ -1402,97 +1361,96 @@ void QG_DialogFactory::requestTextOptions(RS_ActionInterface * action, bool on,
 
        if (on)
        {
-               toolWidget = new TextOptions(optionWidget);
+               toolWidget = new RoundOptions(optionWidget);
                toolWidget->setAction(action, update);
        }
 }
 
-void QG_DialogFactory::requestInsertOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestImageOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestDimensionOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestDimLinearOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestSnapDistOptions(double& dist, bool on)
-{
-}
-
-void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestTrimAmountOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
 /**
- * Shows a widget for beveling options.
+ * Shows a widget for library insert options.
  */
-void QG_DialogFactory::requestBevelOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestLibraryInsertOptions(ActionInterface * action, bool on, bool update)
 {
-    static BevelOptions * toolWidget = NULL;
-
-    if (optionWidget != NULL)
-       {
-        if (toolWidget != NULL)
-               {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
+       static LibraryInsertOptions * toolWidget = NULL;
 
-               if (on && toolWidget == NULL)
-               {
-            toolWidget = new BevelOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
-}
+       if (!optionWidget)
+               return;
 
-void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
 
-void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action, bool on, bool update)
-{
+       if (on)
+       {
+               toolWidget = new LibraryInsertOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
-#endif
 
 /**
  * Shows the given toolbar.
  */
 void QG_DialogFactory::requestToolBar(RS2::ToolBarId id)
 {
-       if (cadToolBar != NULL)
+       if (cadToolBar)
                cadToolBar->showToolBar(id);
 }
 
 /**
  * Shows the select toolbar with the given action to launch.
  */
-void QG_DialogFactory::requestToolBarSelect(RS_ActionInterface * selectAction,
+void QG_DialogFactory::requestToolBarSelect(ActionInterface * selectAction,
         RS2::ActionType nextAction)
 {
        if (cadToolBar != NULL)
                cadToolBar->showToolBarSelect(selectAction, nextAction);
 }
 
-#if 0
+/**
+ * Shows a dialog to edit the attributes of the given dimension entity.
+ */
+ /*
+bool QG_DialogFactory::requestDimAlignedDialog(DimAligned* dim) {
+    if (dim==NULL) {
+        return false;
+    }
+
+    QG_DlgDimAligned dlg(parent);
+    dlg.setDim(*dim, true);
+    if (dlg.exec()) {
+        dlg.updateDim();
+        return true;
+    }
+
+    return false;
+}
+*/
+
+/**
+ * Shows attributes options dialog presenting the given data.
+ */
+bool QG_DialogFactory::requestAttributesDialog(AttributesData & data, LayerList & layerList)
+{
+       DlgAttributes dlg(parent);
+       dlg.setData(&data, layerList);
+
+       if (dlg.exec())
+       {
+               dlg.updateData();
+               return true;
+       }
+
+       return false;
+}
+
 /**
  * Shows move options dialog presenting the given data.
  */
-bool QG_DialogFactory::requestMoveDialog(RS_MoveData & data)
+bool QG_DialogFactory::requestMoveDialog(MoveData & data)
 {
-       QG_DlgMove dlg(parent);
+       DlgMove dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1507,9 +1465,9 @@ bool QG_DialogFactory::requestMoveDialog(RS_MoveData & data)
 /**
  * Shows rotate options dialog presenting the given data.
  */
-bool QG_DialogFactory::requestRotateDialog(RS_RotateData & data)
+bool QG_DialogFactory::requestRotateDialog(RotateData & data)
 {
-       QG_DlgRotate dlg(parent);
+       DlgRotate dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1524,9 +1482,9 @@ bool QG_DialogFactory::requestRotateDialog(RS_RotateData & data)
 /**
  * Shows scale options dialog presenting the given data.
  */
-bool QG_DialogFactory::requestScaleDialog(RS_ScaleData & data)
+bool QG_DialogFactory::requestScaleDialog(ScaleData & data)
 {
-       QG_DlgScale dlg(parent);
+       DlgScale dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1541,9 +1499,9 @@ bool QG_DialogFactory::requestScaleDialog(RS_ScaleData & data)
 /**
  * Shows mirror options dialog presenting the given data.
  */
-bool QG_DialogFactory::requestMirrorDialog(RS_MirrorData & data)
+bool QG_DialogFactory::requestMirrorDialog(MirrorData & data)
 {
-       QG_DlgMirror dlg(parent);
+       DlgMirror dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1558,9 +1516,9 @@ bool QG_DialogFactory::requestMirrorDialog(RS_MirrorData & data)
 /**
  * Shows move/rotate options dialog presenting the given data.
  */
-bool QG_DialogFactory::requestMoveRotateDialog(RS_MoveRotateData & data)
+bool QG_DialogFactory::requestMoveRotateDialog(MoveRotateData & data)
 {
-       QG_DlgMoveRotate dlg(parent);
+       DlgMoveRotate dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1575,9 +1533,9 @@ bool QG_DialogFactory::requestMoveRotateDialog(RS_MoveRotateData & data)
 /**
  * Shows rotate around two centers options dialog presenting the given data.
  */
-bool QG_DialogFactory::requestRotate2Dialog(RS_Rotate2Data & data)
+bool QG_DialogFactory::requestRotate2Dialog(Rotate2Data & data)
 {
-       QG_DlgRotate2 dlg(parent);
+       DlgRotate2 dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1592,7 +1550,7 @@ bool QG_DialogFactory::requestRotate2Dialog(RS_Rotate2Data & data)
 /**
  * Shows a dialog to edit the given entity.
  */
-bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
+bool QG_DialogFactory::requestModifyEntityDialog(Entity * entity)
 {
        if (entity == NULL)
                return false;
@@ -1603,8 +1561,8 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
        {
        case RS2::EntityPoint:
        {
-               QG_DlgPoint dlg(parent);
-               dlg.setPoint(*((RS_Point *)entity));
+               DlgPoint dlg(parent);
+               dlg.setPoint(*((Point *)entity));
 
                if (dlg.exec())
                {
@@ -1616,8 +1574,8 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityLine:
        {
-               QG_DlgLine dlg(parent);
-               dlg.setLine(*((RS_Line *)entity));
+               DlgLine dlg(parent);
+               dlg.setLine(*((Line *)entity));
 
                if (dlg.exec())
                {
@@ -1629,8 +1587,8 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityArc:
        {
-               QG_DlgArc dlg(parent);
-               dlg.setArc(*((RS_Arc *)entity));
+               DlgArc dlg(parent);
+               dlg.setArc(*((Arc *)entity));
 
                if (dlg.exec())
                {
@@ -1642,8 +1600,8 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityCircle:
        {
-               QG_DlgCircle dlg(parent);
-               dlg.setCircle(*((RS_Circle *)entity));
+               DlgCircle dlg(parent);
+               dlg.setCircle(*((Circle *)entity));
 
                if (dlg.exec())
                {
@@ -1655,8 +1613,8 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityEllipse:
        {
-               QG_DlgEllipse dlg(parent);
-               dlg.setEllipse(*((RS_Ellipse *)entity));
+               DlgEllipse dlg(parent);
+               dlg.setEllipse(*((Ellipse *)entity));
 
                if (dlg.exec())
                {
@@ -1668,8 +1626,8 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntitySpline:
        {
-               QG_DlgSpline dlg(parent);
-               dlg.setSpline(*((RS_Spline *)entity));
+               DlgSpline dlg(parent);
+               dlg.setSpline(*((Spline *)entity));
 
                if (dlg.exec())
                {
@@ -1681,8 +1639,8 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityInsert:
        {
-               QG_DlgInsert dlg(parent);
-               dlg.setInsert(*((RS_Insert *)entity));
+               DlgInsert dlg(parent);
+               dlg.setInsert(*((Insert *)entity));
 
                if (dlg.exec())
                {
@@ -1698,56 +1656,56 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
        case RS2::EntityDimDiametric:
        case RS2::EntityDimRadial:
        {
-               QG_DlgDimension dlg(parent);
-               dlg.setDim(*((RS_Dimension *)entity));
+               DlgDimension dlg(parent);
+               dlg.setDim(*((Dimension *)entity));
 
                if (dlg.exec())
                {
                        dlg.updateDim();
                        ret = true;
-                       ((RS_Dimension *)entity)->update(true);
+                       ((Dimension *)entity)->update(true);
                }
        }
                break;
 
        case RS2::EntityDimLinear:
        {
-               QG_DlgDimLinear dlg(parent);
-               dlg.setDim(*((RS_DimLinear *)entity));
+               DlgDimLinear dlg(parent);
+               dlg.setDim(*((DimLinear *)entity));
 
                if (dlg.exec())
                {
                        dlg.updateDim();
                        ret = true;
-                       ((RS_DimLinear *)entity)->update(true);
+                       ((DimLinear *)entity)->update(true);
                }
        }
                break;
 
        case RS2::EntityText:
        {
-               QG_DlgText dlg(parent);
-               dlg.setText(*((RS_Text *)entity), false);
+               DlgText dlg(parent);
+               dlg.setText(*((Text *)entity), false);
 
                if (dlg.exec())
                {
                        dlg.updateText();
                        ret = true;
-                       ((RS_Text *)entity)->update();
+                       ((Text *)entity)->update();
                }
        }
                break;
 
        case RS2::EntityHatch:
        {
-               QG_DlgHatch dlg(parent);
-               dlg.setHatch(*((RS_Hatch *)entity), false);
+               DlgHatch dlg(parent);
+               dlg.setHatch(*((Hatch *)entity), false);
 
                if (dlg.exec())
                {
                        dlg.updateHatch();
                        ret = true;
-                       ((RS_Hatch *)entity)->update();
+                       ((Hatch *)entity)->update();
                }
        }
                break;
@@ -1759,22 +1717,8 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
        return ret;
 }
 
-/**
- * Shows a dialog to edit the attributes of the given dimension entity.
- */
  /*
-bool QG_DialogFactory::requestDimAlignedDialog(RS_DimAligned* dim) {
-    if (dim==NULL) {
-        return false;
-    }
-
-    QG_DlgDimAligned dlg(parent);
-    dlg.setDim(*dim, true);
-    if (dlg.exec()) {
-        dlg.updateDim();
-        return true;
-    }
-
+bool QG_DialogFactory::requestDimAlignedDialog(DimAligned* dim) {
     return false;
 }
 */
@@ -1782,12 +1726,12 @@ bool QG_DialogFactory::requestDimAlignedDialog(RS_DimAligned* dim) {
 /**
  * Shows a dialog to edit the attributes of the given text entity.
  */
-bool QG_DialogFactory::requestTextDialog(RS_Text * text)
+bool QG_DialogFactory::requestTextDialog(Text * text)
 {
        if (text == NULL)
                return false;
 
-       QG_DlgText dlg(parent);
+       DlgText dlg(parent);
        dlg.setText(*text, true);
 
        if (dlg.exec())
@@ -1802,14 +1746,14 @@ bool QG_DialogFactory::requestTextDialog(RS_Text * text)
 /**
  * Shows a dialog to edit pattern / hatch attributes of the given entity.
  */
-bool QG_DialogFactory::requestHatchDialog(RS_Hatch * hatch)
+bool QG_DialogFactory::requestHatchDialog(Hatch * hatch)
 {
        if (hatch == NULL)
                return false;
 
-       RS_PATTERNLIST->init();
+       PATTERNLIST->init();
 
-       QG_DlgHatch dlg(parent);
+       DlgHatch dlg(parent);
        dlg.setHatch(*hatch, true);
 
        if (dlg.exec())
@@ -1820,260 +1764,6 @@ bool QG_DialogFactory::requestHatchDialog(RS_Hatch * hatch)
 
        return false;
 }
-#else
-/**
- * Shows attributes options dialog presenting the given data.
- */
-bool QG_DialogFactory::requestAttributesDialog(RS_AttributesData & data, RS_LayerList & layerList)
-{
-       DlgAttributes dlg(parent);
-       dlg.setData(&data, layerList);
-
-       if (dlg.exec())
-       {
-               dlg.updateData();
-               return true;
-       }
-
-       return false;
-}
-
-bool QG_DialogFactory::requestMoveDialog(RS_MoveData & data)
-{
-       return false;
-}
-
-bool QG_DialogFactory::requestRotateDialog(RS_RotateData & data)
-{
-       return false;
-}
-
-bool QG_DialogFactory::requestScaleDialog(RS_ScaleData & data)
-{
-       return false;
-}
-
-bool QG_DialogFactory::requestMirrorDialog(RS_MirrorData & data)
-{
-       return false;
-}
-
-bool QG_DialogFactory::requestMoveRotateDialog(RS_MoveRotateData & data)
-{
-       return false;
-}
-
-bool QG_DialogFactory::requestRotate2Dialog(RS_Rotate2Data & data)
-{
-       return false;
-}
-
-/**
- * Shows a dialog to edit the given entity.
- */
-bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
-{
-       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;
-}
-
- /*
-bool QG_DialogFactory::requestDimAlignedDialog(RS_DimAligned* dim) {
-    return false;
-}
-*/
-
-/**
- * Shows a dialog to edit the attributes of the given text entity.
- */
-bool QG_DialogFactory::requestTextDialog(RS_Text * text)
-{
-       if (text == NULL)
-               return false;
-
-       DlgText dlg(parent);
-       dlg.setText(*text, true);
-
-       if (dlg.exec())
-       {
-               dlg.updateText();
-               return true;
-       }
-
-       return false;
-}
-
-bool QG_DialogFactory::requestHatchDialog(RS_Hatch * hatch)
-{
-       return false;
-}
-#endif
 
 #ifdef RS_CAM
 /**
@@ -2081,17 +1771,17 @@ bool QG_DialogFactory::requestHatchDialog(RS_Hatch * hatch)
  */
 bool QG_DialogFactory::requestCamOptionsDialog(Drawing& graphic)
 {
-       RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog");
+       DEBUG->print("QG_DialogFactory::requestCamOptionsDialog");
        RS_CamDialog dlg(graphic, parent);
-       RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: exec");
+       DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: exec");
 
        if (dlg.exec())
        {
-               RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: OK");
+               DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: OK");
                return true;
        }
 
-       RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: Cancel");
+       DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: Cancel");
        return false;
 }
 #endif
@@ -2139,10 +1829,10 @@ void QG_DialogFactory::updateCoordinateWidget(const Vector & abs,
  */
 void QG_DialogFactory::updateMouseWidget(const QString & left, const QString & right)
 {
-       if (mouseWidget != NULL)
+       if (mouseWidget)
                mouseWidget->setHelp(left, right);
 
-       if (commandWidget != NULL)
+       if (commandWidget)
                commandWidget->setCommand(left);
 }
 
@@ -2160,12 +1850,12 @@ void QG_DialogFactory::updateSelectionWidget(int num)
  */
 void QG_DialogFactory::commandMessage(const QString& message)
 {
-       RS_DEBUG->print("QG_DialogFactory::commandMessage");
+       DEBUG->print("QG_DialogFactory::commandMessage");
 
        if (commandWidget != NULL)
                commandWidget->appendHistory(message);
 
-       RS_DEBUG->print("QG_DialogFactory::commandMessage: OK");
+       DEBUG->print("QG_DialogFactory::commandMessage: OK");
 }
 
 /*virtual*/ bool QG_DialogFactory::isAdapter()