]> Shamusworld >> Repos - architektonas/blobdiff - src/widgets/qg_dialogfactory.cpp
Added more missing forms...
[architektonas] / src / widgets / qg_dialogfactory.cpp
index 1238d8e054e7dbb310fc2905ca6d04ecf63befeb..97b28e976ab8dc48a6dbd4c0c22d5a56b2cabd84 100644 (file)
 #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_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_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_moverotateoptions.h"
        #include "ui/qg_printpreviewoptions.h"
-#include "ui/qg_roundoptions.h"
+       #include "ui/qg_roundoptions.h"
        #include "ui/qg_selectionwidget.h"
-#include "ui/qg_snapdistoptions.h"
+       #include "ui/qg_snapdistoptions.h"
        #include "ui/qg_splineoptions.h"
        #include "ui/qg_textoptions.h"
        #include "ui/qg_trimamountoptions.h"
 #include "dlgtext.h"
 #include "imageoptions.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"
@@ -924,7 +934,7 @@ them over and over. May need to do some more refactoring based on this idea...
 void QG_DialogFactory::requestPolylineOptions(RS_ActionInterface * action, bool on, bool update)
 {
 #ifdef RS_PROF
-       static QG_PolylineOptions * toolWidget = NULL;
+       static PolylineOptions * toolWidget = NULL;
 
        if (optionWidget != NULL)
        {
@@ -935,7 +945,7 @@ void QG_DialogFactory::requestPolylineOptions(RS_ActionInterface * action, bool
                }
                if (on && toolWidget == NULL)
                {
-                       toolWidget = new QG_PolylineOptions(optionWidget);
+                       toolWidget = new PolylineOptions(optionWidget);
                        toolWidget->setAction(action, update);
                }
        }
@@ -944,31 +954,12 @@ void QG_DialogFactory::requestPolylineOptions(RS_ActionInterface * action, bool
 
 #if 0
 /**
- * Shows a widget for options for the action: "draw line parallel"
- */
-void QG_DialogFactory::requestLineParallelOptions(RS_ActionInterface * action, bool on, bool update)
-{
-    static QG_LineParallelOptions* toolWidget = NULL;
-
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LineParallelOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
-}
-
-/**
- * Shows a widget for options for the action: "draw line parallel through"
+ * Shows a widget for insert options.
  */
-void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* action,
-    bool on, bool update)
+void QG_DialogFactory::requestInsertOptions(RS_ActionInterface* action,
+        bool on, bool update)
 {
-    static QG_LineParallelThroughOptions* toolWidget = NULL;
+    static QG_InsertOptions* toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -976,19 +967,19 @@ void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* act
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LineParallelThroughOptions(optionWidget);
+            toolWidget = new QG_InsertOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for options for the action: "line angle"
+ * Shows a widget for image options.
  */
-void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface* action,
+void QG_DialogFactory::requestImageOptions(RS_ActionInterface* action,
         bool on, bool update)
 {
-    static QG_LineAngleOptions* toolWidget = NULL;
+    static QG_ImageOptions* toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -996,20 +987,19 @@ void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LineAngleOptions(optionWidget);
+            toolWidget = new QG_ImageOptions(optionWidget);
             toolWidget->setAction(action, update);
-            //toolWidget->setData(&angle, &length, fixedAngle, update);
         }
     }
 }
 
 /**
- * Shows a widget for options for the action: "line relative angle"
+ * Shows a widget for library insert options.
  */
-void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface* action,
+void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action,
         bool on, bool update)
 {
-    static QG_LineRelAngleOptions* toolWidget = NULL;
+    static QG_LibraryInsertOptions* toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1017,40 +1007,40 @@ void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LineRelAngleOptions(optionWidget);
+            toolWidget = new QG_LibraryInsertOptions(optionWidget);
             toolWidget->setAction(action, update);
-            //toolWidget->setData(&angle, &length, fixedAngle, update);
         }
     }
 }
-
+#else
 /**
- * Shows a widget for options for the action: "line angle"
+ * Shows a widget for options for the action: "draw line parallel"
  */
-void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLineParallelOptions(RS_ActionInterface * action, bool on, bool update)
 {
-    static QG_LineBisectorOptions* 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_LineBisectorOptions(optionWidget);
+        if (on==true && toolWidget==NULL)
+               {
+            toolWidget = new LineParallelOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for options for the action: "draw polygon"
+ * Shows a widget for options for the action: "draw line parallel through"
  */
-void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface * action, bool on, bool update)
 {
-    static QG_LinePolygonOptions* toolWidget = NULL;
+    static LineParallelThroughOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1058,98 +1048,64 @@ void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LinePolygonOptions(optionWidget);
+            toolWidget = new LineParallelThroughOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for options for the action: "draw polygon2"
+ * Shows a widget for options for the action: "line angle"
  */
-void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface * action, bool on, bool update)
 {
-    static QG_LinePolygon2Options* toolWidget = NULL;
+       static LineAngleOptions * toolWidget = NULL;
 
-    if (optionWidget!=NULL) {
-        if (toolWidget!=NULL) {
-            delete toolWidget;
-            toolWidget = NULL;
-        }
-        if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LinePolygon2Options(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
-}
+       if (!optionWidget)
+               return;
 
-/**
- * Shows a widget for insert options.
- */
-void QG_DialogFactory::requestInsertOptions(RS_ActionInterface* action,
-        bool on, bool update)
-{
-    static QG_InsertOptions* 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_InsertOptions(optionWidget);
-            toolWidget->setAction(action, update);
-        }
-    }
+       if (on)
+       {
+               toolWidget = new LineAngleOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
- * Shows a widget for image options.
+ * Shows a widget for options for the action: "line relative angle"
  */
-void QG_DialogFactory::requestImageOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface * action, bool on, bool update)
 {
-    static QG_ImageOptions* toolWidget = NULL;
+       static LineRelAngleOptions * 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 (!optionWidget)
+               return;
 
-/**
- * Shows a widget for 'snap to a point with a given distance' options.
- */
-void QG_DialogFactory::requestSnapDistOptions(double& dist, bool on)
-{
-    static QG_SnapDistOptions* 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_SnapDistOptions(optionWidget);
-            toolWidget->setDist(&dist);
-        }
-    }
+       if (on)
+       {
+               toolWidget = new LineRelAngleOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
- * Shows a widget for 'snap to a point with a given distance' options.
+ * Shows a widget for options for the action: "line angle"
  */
-void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface * action, bool on, bool update)
 {
-    static QG_MoveRotateOptions* toolWidget = NULL;
+    static LineBisectorOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1157,19 +1113,18 @@ void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_MoveRotateOptions(optionWidget);
+            toolWidget = new LineBisectorOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for rounding options.
+ * Shows a widget for options for the action: "draw polygon"
  */
-void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface * action, bool on, bool update)
 {
-    static QG_RoundOptions* toolWidget = NULL;
+    static LinePolygonOptions * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1177,19 +1132,18 @@ void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_RoundOptions(optionWidget);
+            toolWidget = new LinePolygonOptions(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
 
 /**
- * Shows a widget for library insert options.
+ * Shows a widget for options for the action: "draw polygon2"
  */
-void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action,
-        bool on, bool update)
+void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface * action, bool on, bool update)
 {
-    static QG_LibraryInsertOptions* toolWidget = NULL;
+    static LinePolygon2Options * toolWidget = NULL;
 
     if (optionWidget!=NULL) {
         if (toolWidget!=NULL) {
@@ -1197,39 +1151,11 @@ void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action,
             toolWidget = NULL;
         }
         if (on==true && toolWidget==NULL) {
-            toolWidget = new QG_LibraryInsertOptions(optionWidget);
+            toolWidget = new LinePolygon2Options(optionWidget);
             toolWidget->setAction(action, update);
         }
     }
 }
-#else
-void QG_DialogFactory::requestLineParallelOptions(RS_ActionInterface * action, bool on, bool update)
-{
-}
-
-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)
-{
-}
-
-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)
-{
-}
 
 /**
  * Shows a widget for arc options.
@@ -1394,12 +1320,50 @@ void QG_DialogFactory::requestDimLinearOptions(RS_ActionInterface * action, bool
        }
 }
 
-void QG_DialogFactory::requestSnapDistOptions(double& dist, bool on)
+/**
+ * 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;
+
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new SnapDistOptions(optionWidget);
+               toolWidget->setDist(&dist);
+       }
 }
 
-void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action, bool on, bool update)
+/**
+ * Shows a widget for 'snap to a point with a given distance' options.
+ */
+void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface * action, bool on, bool update)
 {
+       static MoveRotateOptions * toolWidget = NULL;
+
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new MoveRotateOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 /**
@@ -1448,8 +1412,27 @@ void QG_DialogFactory::requestBevelOptions(RS_ActionInterface * action, bool on,
     }
 }
 
-void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action, bool on, bool update)
+/**
+ * Shows a widget for rounding options.
+ */
+void QG_DialogFactory::requestRoundOptions(RS_ActionInterface * action, bool on, bool update)
 {
+       static RoundOptions * toolWidget = NULL;
+
+       if (!optionWidget)
+               return;
+
+       if (toolWidget)
+       {
+               delete toolWidget;
+               toolWidget = NULL;
+       }
+
+       if (on)
+       {
+               toolWidget = new RoundOptions(optionWidget);
+               toolWidget->setAction(action, update);
+       }
 }
 
 void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action, bool on, bool update)