Drawing: modernize C++11
* use nullptr
This commit is contained in:
@@ -40,7 +40,7 @@ PyMOD_INIT_FUNC(Drawing)
|
||||
}
|
||||
catch(const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_ImportError, e.what());
|
||||
PyMOD_Return(0);
|
||||
PyMOD_Return(nullptr);
|
||||
}
|
||||
PyObject* mod = Drawing::initModule();
|
||||
Base::Console().Log("Loading Drawing module... done\n");
|
||||
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
Py::Object project(const Py::Tuple& args)
|
||||
{
|
||||
PyObject *pcObjShape;
|
||||
PyObject *pcObjDir=0;
|
||||
PyObject *pcObjDir=nullptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args.ptr(), "O!|O!",
|
||||
&(Part::TopoShapePy::Type), &pcObjShape,
|
||||
@@ -158,7 +158,7 @@ private:
|
||||
Py::Object projectEx(const Py::Tuple& args)
|
||||
{
|
||||
PyObject *pcObjShape;
|
||||
PyObject *pcObjDir=0;
|
||||
PyObject *pcObjDir=nullptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args.ptr(), "O!|O!",
|
||||
&(TopoShapePy::Type), &pcObjShape,
|
||||
@@ -189,23 +189,23 @@ private:
|
||||
|
||||
Py::Object projectToSVG(const Py::Tuple& args, const Py::Dict& keys)
|
||||
{
|
||||
static char* argNames[] = {"topoShape", "direction", "type", "tolerance", "vStyle", "v0Style", "v1Style", "hStyle", "h0Style", "h1Style", NULL};
|
||||
PyObject *pcObjShape = 0;
|
||||
PyObject *pcObjDir = 0;
|
||||
const char *extractionTypePy = 0;
|
||||
static char* argNames[] = {"topoShape", "direction", "type", "tolerance", "vStyle", "v0Style", "v1Style", "hStyle", "h0Style", "h1Style", nullptr};
|
||||
PyObject *pcObjShape = nullptr;
|
||||
PyObject *pcObjDir = nullptr;
|
||||
const char *extractionTypePy = nullptr;
|
||||
ProjectionAlgos::ExtractionType extractionType = ProjectionAlgos::Plain;
|
||||
const float tol = 0.1f;
|
||||
PyObject* vStylePy = 0;
|
||||
PyObject* vStylePy = nullptr;
|
||||
ProjectionAlgos::XmlAttributes vStyle;
|
||||
PyObject* v0StylePy = 0;
|
||||
PyObject* v0StylePy = nullptr;
|
||||
ProjectionAlgos::XmlAttributes v0Style;
|
||||
PyObject* v1StylePy = 0;
|
||||
PyObject* v1StylePy = nullptr;
|
||||
ProjectionAlgos::XmlAttributes v1Style;
|
||||
PyObject* hStylePy = 0;
|
||||
PyObject* hStylePy = nullptr;
|
||||
ProjectionAlgos::XmlAttributes hStyle;
|
||||
PyObject* h0StylePy = 0;
|
||||
PyObject* h0StylePy = nullptr;
|
||||
ProjectionAlgos::XmlAttributes h0Style;
|
||||
PyObject* h1StylePy = 0;
|
||||
PyObject* h1StylePy = nullptr;
|
||||
ProjectionAlgos::XmlAttributes h1Style;
|
||||
|
||||
// Get the arguments
|
||||
@@ -259,8 +259,8 @@ private:
|
||||
Py::Object projectToDXF(const Py::Tuple& args)
|
||||
{
|
||||
PyObject *pcObjShape;
|
||||
PyObject *pcObjDir=0;
|
||||
const char *type=0;
|
||||
PyObject *pcObjDir=nullptr;
|
||||
const char *type=nullptr;
|
||||
float scale=1.0f;
|
||||
float tol=0.1f;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ FeaturePage::FeaturePage(void) : numChildren(0)
|
||||
{
|
||||
static const char *group = "Drawing view";
|
||||
|
||||
ADD_PROPERTY_TYPE(PageResult, (0), group, App::Prop_Output, "Resulting SVG document of that page");
|
||||
ADD_PROPERTY_TYPE(PageResult, (nullptr), group, App::Prop_Output, "Resulting SVG document of that page");
|
||||
ADD_PROPERTY_TYPE(Template, (""), group, App::Prop_None, "Template for the page");
|
||||
ADD_PROPERTY_TYPE(EditableTexts, (""), group, App::Prop_None, "Substitution values for the editable strings in the template");
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ PROPERTY_SOURCE(Drawing::FeatureProjection, Part::Feature)
|
||||
FeatureProjection::FeatureProjection()
|
||||
{
|
||||
static const char *group = "Projection";
|
||||
ADD_PROPERTY_TYPE(Source ,(0),group,App::Prop_None,"Shape to project");
|
||||
ADD_PROPERTY_TYPE(Source ,(nullptr),group,App::Prop_None,"Shape to project");
|
||||
ADD_PROPERTY_TYPE(Direction ,(Base::Vector3d(0,0,1)),group,App::Prop_None,"Projection direction");
|
||||
ADD_PROPERTY_TYPE(VCompound ,(true),group,App::Prop_None,"Projection parameter");
|
||||
ADD_PROPERTY_TYPE(Rg1LineVCompound ,(true),group,App::Prop_None,"Projection parameter");
|
||||
|
||||
@@ -60,7 +60,7 @@ FeatureView::FeatureView(void)
|
||||
ADD_PROPERTY_TYPE(Visible, (true),group,propType,"Control whether view is visible in page object");
|
||||
|
||||
App::PropertyType type = (App::PropertyType)(App::Prop_Hidden);
|
||||
ADD_PROPERTY_TYPE(ViewResult ,(0),group,type,"Resulting SVG fragment of that view");
|
||||
ADD_PROPERTY_TYPE(ViewResult ,(nullptr),group,type,"Resulting SVG fragment of that view");
|
||||
}
|
||||
|
||||
FeatureView::~FeatureView()
|
||||
|
||||
@@ -80,7 +80,7 @@ FeatureViewPart::FeatureViewPart(void)
|
||||
static const char *vgroup = "Drawing view";
|
||||
|
||||
ADD_PROPERTY_TYPE(Direction ,(0,0,1.0),group,App::Prop_None,"Projection direction");
|
||||
ADD_PROPERTY_TYPE(Source ,(0),group,App::Prop_None,"Shape to view");
|
||||
ADD_PROPERTY_TYPE(Source ,(nullptr),group,App::Prop_None,"Shape to view");
|
||||
ADD_PROPERTY_TYPE(ShowHiddenLines ,(false),group,App::Prop_None,"Control the appearance of the dashed hidden lines");
|
||||
ADD_PROPERTY_TYPE(ShowSmoothLines ,(false),group,App::Prop_None,"Control the appearance of the smooth lines");
|
||||
ADD_PROPERTY_TYPE(LineWidth,(0.35),vgroup,App::Prop_None,"The thickness of the viewed lines");
|
||||
|
||||
@@ -55,7 +55,7 @@ FeatureViewSpreadsheet::FeatureViewSpreadsheet(void)
|
||||
ADD_PROPERTY_TYPE(CellEnd ,("B2"),vgroup,App::Prop_None,"The bottom right cell of the range to display");
|
||||
ADD_PROPERTY_TYPE(Font ,("Sans"),vgroup,App::Prop_None,"The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(Color,(0.0f,0.0f,0.0f),vgroup,App::Prop_None,"The default color of the text and lines");
|
||||
ADD_PROPERTY_TYPE(Source ,(0),vgroup,App::Prop_None,"Spreadsheet to view");
|
||||
ADD_PROPERTY_TYPE(Source ,(nullptr),vgroup,App::Prop_None,"Spreadsheet to view");
|
||||
ADD_PROPERTY_TYPE(LineWidth,(0.35),vgroup,App::Prop_None,"The thickness of the cell lines");
|
||||
ADD_PROPERTY_TYPE(FontSize,(12.0),vgroup,App::Prop_None,"The size of the text");
|
||||
}
|
||||
@@ -168,7 +168,7 @@ App::DocumentObjectExecReturn *FeatureViewSpreadsheet::execute(void)
|
||||
// get the text
|
||||
App::Property* prop = sheet->getPropertyByName(address.toString().c_str());
|
||||
std::stringstream field;
|
||||
if (prop != 0) {
|
||||
if (prop != nullptr) {
|
||||
if (prop->isDerivedFrom((App::PropertyQuantity::getClassTypeId())))
|
||||
field << static_cast<App::PropertyQuantity*>(prop)->getValue();
|
||||
else if (prop->isDerivedFrom((App::PropertyFloat::getClassTypeId())))
|
||||
|
||||
@@ -41,7 +41,7 @@ PROPERTY_SOURCE(Drawing::PageGroup, App::DocumentObjectGroup)
|
||||
PageGroup::PageGroup(void)
|
||||
{
|
||||
static const char *group = "Drawings";
|
||||
ADD_PROPERTY_TYPE(Pages,(0),group,App::Prop_None,"List of pages");
|
||||
ADD_PROPERTY_TYPE(Pages,(nullptr),group,App::Prop_None,"List of pages");
|
||||
}
|
||||
|
||||
PageGroup::~PageGroup()
|
||||
|
||||
@@ -51,7 +51,7 @@ PyMOD_INIT_FUNC(DrawingGui)
|
||||
{
|
||||
if (!Gui::Application::Instance) {
|
||||
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
|
||||
PyMOD_Return(0);
|
||||
PyMOD_Return(nullptr);
|
||||
}
|
||||
|
||||
PyObject* mod = DrawingGui::initModule();
|
||||
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
if (file.hasExtension("svg") || file.hasExtension("svgz")) {
|
||||
QString fileName = QString::fromUtf8(EncodedName.c_str());
|
||||
// Displaying the image in a view
|
||||
DrawingView* view = new DrawingView(0, Gui::getMainWindow());
|
||||
DrawingView* view = new DrawingView(nullptr, Gui::getMainWindow());
|
||||
view->load(fileName);
|
||||
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
|
||||
QFileInfo fi(fileName);
|
||||
@@ -117,7 +117,7 @@ private:
|
||||
if (file.hasExtension("svg") || file.hasExtension("svgz")) {
|
||||
QString fileName = QString::fromUtf8(EncodedName.c_str());
|
||||
// Displaying the image in a view
|
||||
DrawingView* view = new DrawingView(0, Gui::getMainWindow());
|
||||
DrawingView* view = new DrawingView(nullptr, Gui::getMainWindow());
|
||||
view->load(fileName);
|
||||
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
|
||||
QFileInfo fi(fileName);
|
||||
|
||||
@@ -128,7 +128,7 @@ Gui::Action * CmdDrawingNewPage::createAction(void)
|
||||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
|
||||
QAction* defaultAction = 0;
|
||||
QAction* defaultAction = nullptr;
|
||||
int defaultId = 0;
|
||||
|
||||
QString lastPaper;
|
||||
|
||||
@@ -70,9 +70,9 @@ using namespace DrawingGui;
|
||||
SvgView::SvgView(QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
, m_renderer(Native)
|
||||
, m_svgItem(0)
|
||||
, m_backgroundItem(0)
|
||||
, m_outlineItem(0)
|
||||
, m_svgItem(nullptr)
|
||||
, m_backgroundItem(nullptr)
|
||||
, m_outlineItem(nullptr)
|
||||
, m_invertZoom(false)
|
||||
{
|
||||
setScene(new QGraphicsScene(this));
|
||||
@@ -432,9 +432,9 @@ bool DrawingView::onHasMsg(const char* pMsg) const
|
||||
if (strcmp("ViewFit",pMsg) == 0)
|
||||
return true;
|
||||
else if (strcmp("Save",pMsg) == 0)
|
||||
return getGuiDocument() != 0;
|
||||
return getGuiDocument() != nullptr;
|
||||
else if (strcmp("SaveAs",pMsg) == 0)
|
||||
return getGuiDocument() != 0;
|
||||
return getGuiDocument() != nullptr;
|
||||
else if (strcmp("Undo",pMsg) == 0) {
|
||||
App::Document* doc = getAppDocument();
|
||||
return doc && doc->getAvailableUndos() > 0;
|
||||
|
||||
@@ -50,7 +50,7 @@ class DrawingGuiExport SvgView : public QGraphicsView
|
||||
public:
|
||||
enum RendererType { Native, OpenGL, Image };
|
||||
|
||||
SvgView(QWidget *parent = 0);
|
||||
SvgView(QWidget *parent = nullptr);
|
||||
|
||||
void openFile(const QFile &file);
|
||||
void setRenderer(RendererType type = Native);
|
||||
@@ -84,7 +84,7 @@ class DrawingGuiExport DrawingView : public Gui::MDIView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DrawingView(Gui::Document* doc, QWidget* parent = 0);
|
||||
DrawingView(Gui::Document* doc, QWidget* parent = nullptr);
|
||||
virtual ~DrawingView();
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
@@ -74,7 +74,7 @@ TaskProjection::TaskProjection()
|
||||
widget->setLayout(mainLayout);
|
||||
|
||||
taskbox = new Gui::TaskView::TaskBox(
|
||||
QPixmap(), tr("Project shapes"), false, 0);
|
||||
QPixmap(), tr("Project shapes"), false, nullptr);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
@@ -270,8 +270,8 @@ void orthoview::set_projection(const gp_Ax2& cs)
|
||||
|
||||
OrthoViews::OrthoViews(App::Document* doc, const char * pagename, const char * partname)
|
||||
{
|
||||
horiz = 0;
|
||||
vert = 0;
|
||||
horiz = nullptr;
|
||||
vert = nullptr;
|
||||
|
||||
parent_doc = doc;
|
||||
parent_doc->openTransaction("Create view");
|
||||
@@ -1325,7 +1325,7 @@ TaskDlgOrthoViews::TaskDlgOrthoViews()
|
||||
{
|
||||
widget = new TaskOrthoViews();
|
||||
taskbox = new Gui::TaskView::TaskBox(
|
||||
Gui::BitmapFactory().pixmap("actions/drawing-orthoviews"), widget->windowTitle(), true, 0);
|
||||
Gui::BitmapFactory().pixmap("actions/drawing-orthoviews"), widget->windowTitle(), true, nullptr);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class TaskOrthoViews : public QWidget//: public Gui::TaskView::TaskBox
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskOrthoViews(QWidget *parent = 0);
|
||||
TaskOrthoViews(QWidget *parent = nullptr);
|
||||
~TaskOrthoViews();
|
||||
bool user_input();
|
||||
void clean_up();
|
||||
|
||||
@@ -56,7 +56,7 @@ PROPERTY_SOURCE(DrawingGui::ViewProviderDrawingPage, Gui::ViewProviderDocumentOb
|
||||
// Construction/Destruction
|
||||
|
||||
ViewProviderDrawingPage::ViewProviderDrawingPage()
|
||||
: view(0)
|
||||
: view(nullptr)
|
||||
{
|
||||
sPixmap = "Page";
|
||||
ADD_PROPERTY(HintScale,(10.0));
|
||||
|
||||
Reference in New Issue
Block a user