]> Shamusworld >> Repos - architektonas/blobdiff - src/widgets/qg_dialogfactory.cpp
First steps in fixing/cleaning up preview/snapper rendering.
[architektonas] / src / widgets / qg_dialogfactory.cpp
index e267e6a3417678f75267381a025012d3b491d47c..6398633b6e61706cb555ff97f4db793d4f4325af 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 "graphicview.h"
+#include "layerwidget.h"
+#include "qg_mainwindowinterface.h"
+#include "actiondimlinear.h"
+#include "actioninterface.h"
+#include "rs_blocklist.h"
+#include "rs_document.h"
+#include "rs_hatch.h"
+#include "rs_layerlist.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 "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 "blockdialog.h"
 #include "cadtoolbar.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 "printpreviewoptions.h"
+#include "roundoptions.h"
 #include "selectionwidget.h"
+#include "snapdistoptions.h"
+#include "splineoptions.h"
 #include "textoptions.h"
+#include "trimamountoptions.h"
 
 #ifdef RS_PROF
 #include "qg_polylineoptions.h"
@@ -98,9 +90,6 @@
 #include "rs_camdialog.h"
 #endif
 
-#include "qg_layerwidget.h"
-#include "qg_mainwindowinterface.h"
-
 //QG_DialogFactory* QG_DialogFactory::uniqueInstance = NULL;
 
 /**
  * @param parent Pointer to parent widget which can host dialogs.
  * @param ow Pointer to widget that can host option widgets.
  */
-QG_DialogFactory::QG_DialogFactory(QWidget * parent, QWidget * ow):
+//QG_DialogFactory::QG_DialogFactory(QWidget * parent, QWidget * ow):
+QG_DialogFactory::QG_DialogFactory(QWidget * parent, QToolBar * ow):
        RS_DialogFactoryInterface()
 {
        RS_DEBUG->print("QG_DialogFactory::QG_DialogFactory");
@@ -138,7 +128,8 @@ QG_DialogFactory::~QG_DialogFactory()
 /**
  * Links factory to a widget that can host tool options.
  */
-/*virtual*/ void QG_DialogFactory::setOptionWidget(QWidget * ow)
+///*virtual*/ void QG_DialogFactory::setOptionWidget(QWidget * ow)
+/*virtual*/ void QG_DialogFactory::setOptionWidget(QToolBar * ow)
 {
        RS_DEBUG->print("QG_DialogFactory::setOptionWidget");
        optionWidget = ow;
@@ -221,7 +212,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, RS_Document * doc)
 {
        if (mainWindow != NULL)
        {
@@ -719,7 +710,7 @@ 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");
 
@@ -808,7 +799,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,45 +846,54 @@ void QG_DialogFactory::requestOptions(RS_ActionInterface * action, bool on, bool
 /**
  * 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;
 
-       if (optionWidget != NULL)
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
        {
-               if (toolWidget != NULL)
-               {
-                       delete toolWidget;
-                       toolWidget = NULL;
-               }
-               if (on && toolWidget == NULL)
-               {
-                       toolWidget = new PrintPreviewOptions(optionWidget);
-                       toolWidget->setAction(action, update);
-               }
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new PrintPreviewOptions(optionWidget);
+               toolWidget->setAction(action, update);
        }
 }
 
 /**
  * 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
+these objects all the time when we could create them once, and then reuse
+them over and over. May need to do some more refactoring based on this idea...
+*/
+       //ugh.
        static LineOptions * toolWidget = NULL;
 
-       if (optionWidget != NULL)
+       if (!optionWidget)
+               return;
+
+       // Get rid of the LineOptions object if it exists...
+       if (toolWidget)
        {
-               if (toolWidget != NULL)
-               {
-                       delete toolWidget;
-                       toolWidget = NULL;
-               }
+               delete toolWidget;
+               toolWidget = NULL;
+       }
 
-               if (on == true && toolWidget == NULL)
-               {
-                       toolWidget = new LineOptions(optionWidget);
-                       toolWidget->setAction(action);
-               }
+       // Create a new one for the passed in action
+       if (on)
+       {
+               toolWidget = new LineOptions(optionWidget);
+               toolWidget->setAction(action);
        }
 
        RS_DEBUG->print("QG_DialogFactory::requestLineOptions: OK");
@@ -902,42 +902,45 @@ void QG_DialogFactory::requestLineOptions(RS_ActionInterface * action, bool on)
 /**
  * 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);
         }
     }
@@ -946,10 +949,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) {
@@ -957,7 +959,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);
         }
     }
@@ -966,52 +968,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) {
@@ -1019,7 +1024,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);
         }
     }
@@ -1028,10 +1033,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) {
@@ -1039,7 +1043,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);
         }
     }
@@ -1048,10 +1052,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) {
@@ -1059,7 +1062,7 @@ 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);
         }
     }
@@ -1068,60 +1071,69 @@ void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action,
 /**
  * Shows a widget for arc options.
  */
-void QG_DialogFactory::requestArcOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestArcOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_ArcOptions* toolWidget = NULL;
+       static ArcOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_ArcOptions(optionWidget);
-            toolWidget->setAction(action, update);
-            //toolWidget->setData(&data);
-        }
-    }
+       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 tangential arc options.
  */
-void QG_DialogFactory::requestArcTangentialOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestArcTangentialOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_ArcTangentialOptions* toolWidget = NULL;
+       static ArcTangentialOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_ArcTangentialOptions(optionWidget);
-            toolWidget->setAction(action, update);
-            //toolWidget->setData(&data);
-        }
-    }
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new ArcTangentialOptions(optionWidget);
+               toolWidget->setAction(action, update);
+               //toolWidget->setData(&data);
+       }
 }
 
 /**
- * Shows a widget for arc options.
+ * Shows a widget for circle options.
  */
-void QG_DialogFactory::requestCircleOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestCircleOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_CircleOptions* 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_CircleOptions(optionWidget);
+
+        if (on && toolWidget == NULL)
+               {
+            toolWidget = new CircleOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
@@ -1130,50 +1142,55 @@ void QG_DialogFactory::requestCircleOptions(RS_ActionInterface* action,
 /**
  * Shows a widget for spline options.
  */
-void QG_DialogFactory::requestSplineOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestSplineOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_SplineOptions* toolWidget = NULL;
+       static SplineOptions * 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)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new SplineOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
  * Shows a widget for text options.
  */
-void QG_DialogFactory::requestTextOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestTextOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_TextOptions* toolWidget = NULL;
+       static TextOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_TextOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new TextOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
  * Shows a widget for insert options.
  */
-void QG_DialogFactory::requestInsertOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestInsertOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_InsertOptions* toolWidget = NULL;
+    static InsertOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1181,7 +1198,7 @@ void QG_DialogFactory::requestInsertOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_InsertOptions(optionWidget);
+            toolWidget = new InsertOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
@@ -1190,10 +1207,9 @@ void QG_DialogFactory::requestInsertOptions(RS_ActionInterface* action,
 /**
  * Shows a widget for image options.
  */
-void QG_DialogFactory::requestImageOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestImageOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_ImageOptions* toolWidget = NULL;
+    static ImageOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1201,7 +1217,7 @@ void QG_DialogFactory::requestImageOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_ImageOptions(optionWidget);
+            toolWidget = new ImageOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
@@ -1210,11 +1226,9 @@ void QG_DialogFactory::requestImageOptions(RS_ActionInterface* action,
 /**
  * Shows a widget for dimension options.
  */
-void QG_DialogFactory::requestDimensionOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestDimensionOptions(ActionInterface * action, bool on, bool update)
 {
-    //static QLabel* l = NULL;
-    static QG_DimOptions* toolWidget = NULL;
+    static DimOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1222,7 +1236,7 @@ void QG_DialogFactory::requestDimensionOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_DimOptions(optionWidget);
+            toolWidget = new DimOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
@@ -1231,251 +1245,164 @@ void QG_DialogFactory::requestDimensionOptions(RS_ActionInterface* action,
 /**
  * Shows a widget for linear dimension options.
  */
-void QG_DialogFactory::requestDimLinearOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestDimLinearOptions(ActionInterface * action, bool on, bool update)
 {
-    //static QLabel* l = NULL;
-    static QG_DimLinearOptions* toolWidget = NULL;
+       static DimLinearOptions * 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 DimLinearOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
  * Shows a widget for 'snap to a point with a given distance' options.
  */
-void QG_DialogFactory::requestSnapDistOptions(double& dist, bool on)
+void QG_DialogFactory::requestSnapDistOptions(double & dist, bool on)
 {
-    static QG_SnapDistOptions* toolWidget = NULL;
+       static SnapDistOptions * 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 SnapDistOptions(optionWidget);
+               toolWidget->setDist(&dist);
+       }
 }
 
 /**
  * Shows a widget for 'snap to a point with a given distance' options.
  */
-void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestMoveRotateOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_MoveRotateOptions* toolWidget = NULL;
+       static MoveRotateOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_MoveRotateOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new MoveRotateOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
  * Shows a widget for 'trim amount' options.
  */
-void QG_DialogFactory::requestTrimAmountOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestTrimAmountOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_TrimAmountOptions* toolWidget = NULL;
+       static TrimAmountOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_TrimAmountOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
-}
+       if (!optionWidget)
+               return;
 
-/**
- * Shows a widget for beveling options.
- */
-void QG_DialogFactory::requestBevelOptions(RS_ActionInterface* action,
-        bool on, bool update)
-{
-    static QG_BevelOptions* 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_BevelOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
+       if (on)
+       {
+               toolWidget = new TrimAmountOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
- * Shows a widget for rounding options.
+ * Shows a widget for beveling options.
  */
-void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestBevelOptions(ActionInterface * action, bool on, bool update)
 {
-    static QG_RoundOptions* toolWidget = NULL;
+    static BevelOptions * 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_RoundOptions(optionWidget);
+
+               if (on && toolWidget == NULL)
+               {
+            toolWidget = new BevelOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for library insert options.
+ * Shows a widget for rounding 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::requestRoundOptions(ActionInterface * action, bool on, bool update)
 {
-}
+       static RoundOptions * toolWidget = NULL;
 
-void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
+       if (!optionWidget)
+               return;
 
-void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestArcOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestArcTangentialOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestCircleOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
 
-void QG_DialogFactory::requestSplineOptions(RS_ActionInterface* action, bool on, bool update)
-{
+       if (on)
+       {
+               toolWidget = new RoundOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
- * Shows a widget for text options.
+ * Shows a widget for library insert options.
  */
-void QG_DialogFactory::requestTextOptions(RS_ActionInterface * action, bool on, bool update)
+void QG_DialogFactory::requestLibraryInsertOptions(ActionInterface * action, bool on, bool update)
 {
-       static TextOptions * toolWidget = NULL;
+       static LibraryInsertOptions * toolWidget = NULL;
 
-       if (optionWidget != NULL)
-       {
-               if (toolWidget != NULL)
-               {
-                       delete toolWidget;
-                       toolWidget = NULL;
-               }
+       if (!optionWidget)
+               return;
 
-               if (on == true && toolWidget == NULL)
-               {
-                       toolWidget = new TextOptions(optionWidget);
-                       toolWidget->setAction(action, update);
-               }
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
        }
-}
-
-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)
-{
-}
-
-void QG_DialogFactory::requestBevelOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action, bool on, bool update)
-{
+       if (on)
+       {
+               toolWidget = new LibraryInsertOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
-void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-#endif
-
 /**
  * Shows the given toolbar.
  */
@@ -1488,20 +1415,56 @@ void QG_DialogFactory::requestToolBar(RS2::ToolBarId 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(RS_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(RS_AttributesData & data, RS_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)
 {
-       QG_DlgMove dlg(parent);
+       DlgMove dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1518,7 +1481,7 @@ bool QG_DialogFactory::requestMoveDialog(RS_MoveData & data)
  */
 bool QG_DialogFactory::requestRotateDialog(RS_RotateData & data)
 {
-       QG_DlgRotate dlg(parent);
+       DlgRotate dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1535,7 +1498,7 @@ bool QG_DialogFactory::requestRotateDialog(RS_RotateData & data)
  */
 bool QG_DialogFactory::requestScaleDialog(RS_ScaleData & data)
 {
-       QG_DlgScale dlg(parent);
+       DlgScale dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1552,7 +1515,7 @@ bool QG_DialogFactory::requestScaleDialog(RS_ScaleData & data)
  */
 bool QG_DialogFactory::requestMirrorDialog(RS_MirrorData & data)
 {
-       QG_DlgMirror dlg(parent);
+       DlgMirror dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1569,7 +1532,7 @@ bool QG_DialogFactory::requestMirrorDialog(RS_MirrorData & data)
  */
 bool QG_DialogFactory::requestMoveRotateDialog(RS_MoveRotateData & data)
 {
-       QG_DlgMoveRotate dlg(parent);
+       DlgMoveRotate dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1586,7 +1549,7 @@ bool QG_DialogFactory::requestMoveRotateDialog(RS_MoveRotateData & data)
  */
 bool QG_DialogFactory::requestRotate2Dialog(RS_Rotate2Data & data)
 {
-       QG_DlgRotate2 dlg(parent);
+       DlgRotate2 dlg(parent);
        dlg.setData(&data);
 
        if (dlg.exec())
@@ -1612,7 +1575,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
        {
        case RS2::EntityPoint:
        {
-               QG_DlgPoint dlg(parent);
+               DlgPoint dlg(parent);
                dlg.setPoint(*((RS_Point *)entity));
 
                if (dlg.exec())
@@ -1625,7 +1588,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityLine:
        {
-               QG_DlgLine dlg(parent);
+               DlgLine dlg(parent);
                dlg.setLine(*((RS_Line *)entity));
 
                if (dlg.exec())
@@ -1638,7 +1601,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityArc:
        {
-               QG_DlgArc dlg(parent);
+               DlgArc dlg(parent);
                dlg.setArc(*((RS_Arc *)entity));
 
                if (dlg.exec())
@@ -1651,7 +1614,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityCircle:
        {
-               QG_DlgCircle dlg(parent);
+               DlgCircle dlg(parent);
                dlg.setCircle(*((RS_Circle *)entity));
 
                if (dlg.exec())
@@ -1664,7 +1627,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityEllipse:
        {
-               QG_DlgEllipse dlg(parent);
+               DlgEllipse dlg(parent);
                dlg.setEllipse(*((RS_Ellipse *)entity));
 
                if (dlg.exec())
@@ -1677,7 +1640,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntitySpline:
        {
-               QG_DlgSpline dlg(parent);
+               DlgSpline dlg(parent);
                dlg.setSpline(*((RS_Spline *)entity));
 
                if (dlg.exec())
@@ -1690,7 +1653,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityInsert:
        {
-               QG_DlgInsert dlg(parent);
+               DlgInsert dlg(parent);
                dlg.setInsert(*((RS_Insert *)entity));
 
                if (dlg.exec())
@@ -1707,7 +1670,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
        case RS2::EntityDimDiametric:
        case RS2::EntityDimRadial:
        {
-               QG_DlgDimension dlg(parent);
+               DlgDimension dlg(parent);
                dlg.setDim(*((RS_Dimension *)entity));
 
                if (dlg.exec())
@@ -1721,7 +1684,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityDimLinear:
        {
-               QG_DlgDimLinear dlg(parent);
+               DlgDimLinear dlg(parent);
                dlg.setDim(*((RS_DimLinear *)entity));
 
                if (dlg.exec())
@@ -1735,7 +1698,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityText:
        {
-               QG_DlgText dlg(parent);
+               DlgText dlg(parent);
                dlg.setText(*((RS_Text *)entity), false);
 
                if (dlg.exec())
@@ -1749,7 +1712,7 @@ bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
 
        case RS2::EntityHatch:
        {
-               QG_DlgHatch dlg(parent);
+               DlgHatch dlg(parent);
                dlg.setHatch(*((RS_Hatch *)entity), false);
 
                if (dlg.exec())
@@ -1768,22 +1731,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;
-    }
-
     return false;
 }
 */
@@ -1796,7 +1745,7 @@ bool QG_DialogFactory::requestTextDialog(RS_Text * text)
        if (text == NULL)
                return false;
 
-       QG_DlgText dlg(parent);
+       DlgText dlg(parent);
        dlg.setText(*text, true);
 
        if (dlg.exec())
@@ -1818,7 +1767,7 @@ bool QG_DialogFactory::requestHatchDialog(RS_Hatch * hatch)
 
        RS_PATTERNLIST->init();
 
-       QG_DlgHatch dlg(parent);
+       DlgHatch dlg(parent);
        dlg.setHatch(*hatch, true);
 
        if (dlg.exec())
@@ -1829,96 +1778,12 @@ 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;
-}
-
-bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
-{
-       return false;
-}
-
- /*
-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
 /**
  * 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);
@@ -1947,7 +1812,7 @@ void QG_DialogFactory::requestOptionsGeneralDialog()
 /**
  * Shows dialog for drawing options.
  */
-void QG_DialogFactory::requestOptionsDrawingDialog(RS_Graphic & graphic)
+void QG_DialogFactory::requestOptionsDrawingDialog(Drawing & graphic)
 {
        DlgOptionsDrawing dlg(parent);
        dlg.setGraphic(&graphic);
@@ -1978,10 +1843,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);
 }