// 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 "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"
/**
* 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)
{
{
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;
- }
- }
- */
- if (layerList == NULL)
+ if (!layerList)
{
RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestEditLayerDialog(): "
"layerList is NULL");
}
// Layer for parameter livery
- if (layerList->getActive() != NULL)
+ if (layerList->getActive())
{
layer = new RS_Layer(*layerList->getActive());
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");
case RS2::ActionDimLinear:
requestDimensionOptions(action, on, update);
- if (((RS_ActionDimLinear *)action)->hasFixedAngle() == false)
+ if (((ActionDimLinear *)action)->hasFixedAngle() == false)
requestDimLinearOptions(action, on, update);
break;
/**
* 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;
/**
* 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
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
*/
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)
*/
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);
}