X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fwidgets%2Fqg_dialogfactory.cpp;h=aee82b4097f3668cec79c8b99265e49b3733ad96;hb=865303923fcb231a171992b75a73364ff469ff8c;hp=9c857a0cac00177a1f0ff38749df33def91ee963;hpb=27d4a138d23453e93a833e9347444b828a971cb4;p=architektonas diff --git a/src/widgets/qg_dialogfactory.cpp b/src/widgets/qg_dialogfactory.cpp index 9c857a0..aee82b4 100644 --- a/src/widgets/qg_dialogfactory.cpp +++ b/src/widgets/qg_dialogfactory.cpp @@ -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 // @@ -17,8 +19,8 @@ #include "graphicview.h" #include "qg_layerwidget.h" #include "qg_mainwindowinterface.h" -#include "rs_actiondimlinear.h" -#include "rs_actioninterface.h" +#include "actiondimlinear.h" +#include "actioninterface.h" #include "rs_blocklist.h" #include "rs_document.h" #include "rs_hatch.h" @@ -707,7 +709,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"); @@ -796,7 +798,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; @@ -843,7 +845,7 @@ 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; @@ -866,7 +868,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 @@ -899,7 +901,7 @@ them over and over. May need to do some more refactoring based on this idea... /** * 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 PolylineOptions * toolWidget = NULL; @@ -924,7 +926,7 @@ void QG_DialogFactory::requestPolylineOptions(RS_ActionInterface * action, bool /** * 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 LineParallelOptions * toolWidget = NULL; @@ -946,7 +948,7 @@ 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 LineParallelThroughOptions * toolWidget = NULL; @@ -965,7 +967,7 @@ void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface * ac /** * 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 LineAngleOptions * toolWidget = NULL; @@ -988,7 +990,7 @@ void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface * action, bool /** * 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 LineRelAngleOptions * toolWidget = NULL; @@ -1011,7 +1013,7 @@ void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface * action, b /** * 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 LineBisectorOptions * toolWidget = NULL; @@ -1030,7 +1032,7 @@ void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface * action, b /** * 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 LinePolygonOptions * toolWidget = NULL; @@ -1049,7 +1051,7 @@ void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface * action, bo /** * 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 LinePolygon2Options * toolWidget = NULL; @@ -1068,7 +1070,7 @@ void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface * action, b /** * 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 ArcOptions * toolWidget = NULL; @@ -1092,7 +1094,7 @@ void QG_DialogFactory::requestArcOptions(RS_ActionInterface * action, bool on, b /** * 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 ArcTangentialOptions * toolWidget = NULL; @@ -1116,7 +1118,7 @@ void QG_DialogFactory::requestArcTangentialOptions(RS_ActionInterface * action, /** * 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 CircleOptions * toolWidget = NULL; @@ -1139,26 +1141,30 @@ void QG_DialogFactory::requestCircleOptions(RS_ActionInterface * action, bool on /** * 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 SplineOptions * toolWidget = NULL; - if (optionWidget!=NULL) { - if (toolWidget!=NULL) { - delete toolWidget; - toolWidget = NULL; - } - if (on==true && toolWidget==NULL) { - toolWidget = new 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 TextOptions * toolWidget = NULL; @@ -1181,7 +1187,7 @@ void QG_DialogFactory::requestTextOptions(RS_ActionInterface * action, bool on, /** * 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 InsertOptions * toolWidget = NULL; @@ -1200,7 +1206,7 @@ void QG_DialogFactory::requestInsertOptions(RS_ActionInterface * action, bool on /** * 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 ImageOptions * toolWidget = NULL; @@ -1219,7 +1225,7 @@ void QG_DialogFactory::requestImageOptions(RS_ActionInterface * action, bool on, /** * 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 DimOptions * toolWidget = NULL; @@ -1238,7 +1244,7 @@ void QG_DialogFactory::requestDimensionOptions(RS_ActionInterface * action, bool /** * 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 DimLinearOptions * toolWidget = NULL; @@ -1284,7 +1290,7 @@ void QG_DialogFactory::requestSnapDistOptions(double & dist, bool on) /** * 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 MoveRotateOptions * toolWidget = NULL; @@ -1307,7 +1313,7 @@ void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface * action, boo /** * 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 TrimAmountOptions * toolWidget = NULL; @@ -1330,7 +1336,7 @@ void QG_DialogFactory::requestTrimAmountOptions(RS_ActionInterface * action, boo /** * Shows a widget for beveling options. */ -void QG_DialogFactory::requestBevelOptions(RS_ActionInterface * action, bool on, bool update) +void QG_DialogFactory::requestBevelOptions(ActionInterface * action, bool on, bool update) { static BevelOptions * toolWidget = NULL; @@ -1353,7 +1359,7 @@ void QG_DialogFactory::requestBevelOptions(RS_ActionInterface * action, bool on, /** * Shows a widget for rounding options. */ -void QG_DialogFactory::requestRoundOptions(RS_ActionInterface * action, bool on, bool update) +void QG_DialogFactory::requestRoundOptions(ActionInterface * action, bool on, bool update) { static RoundOptions * toolWidget = NULL; @@ -1376,7 +1382,7 @@ void QG_DialogFactory::requestRoundOptions(RS_ActionInterface * action, bool on, /** * Shows a widget for library insert options. */ -void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface * action, bool on, bool update) +void QG_DialogFactory::requestLibraryInsertOptions(ActionInterface * action, bool on, bool update) { static LibraryInsertOptions * toolWidget = NULL; @@ -1408,7 +1414,7 @@ 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) @@ -1836,10 +1842,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); }