Gui: modernize C++11
* use nullptr
This commit is contained in:
@@ -149,10 +149,10 @@ Document::Document(App::Document* pcDocument,Application * app)
|
||||
d->_isTransacting = false;
|
||||
d->_pcAppWnd = app;
|
||||
d->_pcDocument = pcDocument;
|
||||
d->_editViewProvider = 0;
|
||||
d->_editingObject = 0;
|
||||
d->_editViewProviderParent = 0;
|
||||
d->_editingViewer = 0;
|
||||
d->_editViewProvider = nullptr;
|
||||
d->_editingObject = nullptr;
|
||||
d->_editViewProviderParent = nullptr;
|
||||
d->_editingViewer = nullptr;
|
||||
d->_editMode = 0;
|
||||
|
||||
// Setup the connections
|
||||
@@ -298,7 +298,7 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname)
|
||||
// No subname reference is given, we try to extract one from the current
|
||||
// selection in order to obtain the correct transformation matrix below
|
||||
auto sels = Gui::Selection().getCompleteSelection(false);
|
||||
App::DocumentObject *parentObj = 0;
|
||||
App::DocumentObject *parentObj = nullptr;
|
||||
for(auto &sel : sels) {
|
||||
if(!sel.pObject || !sel.pObject->getNameInDocument())
|
||||
continue;
|
||||
@@ -306,13 +306,13 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname)
|
||||
parentObj = sel.pObject;
|
||||
else if(parentObj!=sel.pObject) {
|
||||
FC_LOG("Cannot deduce subname for editing, more than one parent?");
|
||||
parentObj = 0;
|
||||
parentObj = nullptr;
|
||||
break;
|
||||
}
|
||||
auto sobj = parentObj->getSubObject(sel.SubName);
|
||||
if(!sobj || (sobj!=obj && sobj->getLinkedObject(true)!= obj)) {
|
||||
FC_LOG("Cannot deduce subname for editing, subname mismatch");
|
||||
parentObj = 0;
|
||||
parentObj = nullptr;
|
||||
break;
|
||||
}
|
||||
_subname = sel.SubName;
|
||||
@@ -368,7 +368,7 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname)
|
||||
// d->_editingTransform = ext->globalGroupPlacement().toMatrix();
|
||||
// }
|
||||
// }
|
||||
auto sobj = obj->getSubObject(subname,0,&d->_editingTransform);
|
||||
auto sobj = obj->getSubObject(subname,nullptr,&d->_editingTransform);
|
||||
if(!sobj || !sobj->getNameInDocument()) {
|
||||
FC_ERR("Invalid sub object '" << obj->getFullName()
|
||||
<< '.' << (subname?subname:"") << "'");
|
||||
@@ -415,9 +415,9 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname)
|
||||
d->_editMode = ModNum;
|
||||
d->_editViewProvider = svp->startEditing(ModNum);
|
||||
if(!d->_editViewProvider) {
|
||||
d->_editViewProviderParent = 0;
|
||||
d->_editViewProviderParent = nullptr;
|
||||
d->_editObjs.clear();
|
||||
d->_editingObject = 0;
|
||||
d->_editingObject = nullptr;
|
||||
FC_LOG("object '" << sobj->getFullName() << "' refuse to edit");
|
||||
return false;
|
||||
}
|
||||
@@ -451,7 +451,7 @@ void Document::setEditingTransform(const Base::Matrix4D &mat) {
|
||||
}
|
||||
|
||||
void Document::resetEdit(void) {
|
||||
Application::Instance->setEditDocument(0);
|
||||
Application::Instance->setEditDocument(nullptr);
|
||||
}
|
||||
|
||||
void Document::_resetEdit(void)
|
||||
@@ -474,7 +474,7 @@ void Document::_resetEdit(void)
|
||||
auto vpd = static_cast<ViewProviderDocumentObject*>(d->_editViewProvider);
|
||||
vpd->getDocument()->signalResetEdit(*vpd);
|
||||
}
|
||||
d->_editViewProvider = 0;
|
||||
d->_editViewProvider = nullptr;
|
||||
|
||||
// The logic below is not necessary anymore, because this method is
|
||||
// changed into a private one, _resetEdit(). And the exposed
|
||||
@@ -493,12 +493,12 @@ void Document::_resetEdit(void)
|
||||
#endif
|
||||
App::GetApplication().closeActiveTransaction();
|
||||
}
|
||||
d->_editViewProviderParent = 0;
|
||||
d->_editingViewer = 0;
|
||||
d->_editViewProviderParent = nullptr;
|
||||
d->_editingViewer = nullptr;
|
||||
d->_editObjs.clear();
|
||||
d->_editingObject = 0;
|
||||
d->_editingObject = nullptr;
|
||||
if(Application::Instance->editDocument() == this)
|
||||
Application::Instance->setEditDocument(0);
|
||||
Application::Instance->setEditDocument(nullptr);
|
||||
}
|
||||
|
||||
ViewProvider *Document::getInEdit(ViewProviderDocumentObject **parentVp,
|
||||
@@ -516,7 +516,7 @@ ViewProvider *Document::getInEdit(ViewProviderDocumentObject **parentVp,
|
||||
return d->_editViewProvider;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Document::setInEdit(ViewProviderDocumentObject *parentVp, const char *subname) {
|
||||
@@ -607,7 +607,7 @@ ViewProvider *Document::getViewProviderByName(const char* name) const
|
||||
return it2->second;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Document::isShow(const char* name)
|
||||
@@ -671,7 +671,7 @@ void Document::slotNewObject(const App::DocumentObject& Obj)
|
||||
} else if (cName!=Obj.getViewProviderName() && !pcProvider->allowOverride(Obj)) {
|
||||
FC_WARN("View provider type '" << cName << "' does not support " << Obj.getFullName());
|
||||
delete base;
|
||||
pcProvider = 0;
|
||||
pcProvider = nullptr;
|
||||
cName = Obj.getViewProviderName();
|
||||
} else
|
||||
break;
|
||||
@@ -745,7 +745,7 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj)
|
||||
auto editDoc = Application::Instance->editDocument();
|
||||
if(editDoc->d->_editViewProvider==viewProvider ||
|
||||
editDoc->d->_editViewProviderParent==viewProvider)
|
||||
Application::Instance->setEditDocument(0);
|
||||
Application::Instance->setEditDocument(nullptr);
|
||||
}
|
||||
|
||||
handleChildren3D(viewProvider,true);
|
||||
@@ -778,7 +778,7 @@ void Document::beforeDelete() {
|
||||
(vp && vp->getDocument()==this) ||
|
||||
(vpp && vpp->getDocument()==this))
|
||||
{
|
||||
Application::Instance->setEditDocument(0);
|
||||
Application::Instance->setEditDocument(nullptr);
|
||||
}
|
||||
}
|
||||
for(auto &v : d->_ViewProviderMap)
|
||||
@@ -802,7 +802,7 @@ void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Prop
|
||||
{
|
||||
Base::Matrix4D mat;
|
||||
auto sobj = d->_editViewProviderParent->getObject()->getSubObject(
|
||||
d->_editSubname.c_str(),0,&mat);
|
||||
d->_editSubname.c_str(),nullptr,&mat);
|
||||
if(sobj == d->_editingObject && d->_editingTransform!=mat) {
|
||||
d->_editingTransform = mat;
|
||||
d->_editingViewer->setEditingTransform(d->_editingTransform);
|
||||
@@ -921,7 +921,7 @@ void Document::slotSkipRecompute(const App::Document& doc, const std::vector<App
|
||||
App::GetApplication().getActiveDocument()!=&doc ||
|
||||
!doc.testStatus(App::Document::AllowPartialRecompute))
|
||||
return;
|
||||
App::DocumentObject *obj = 0;
|
||||
App::DocumentObject *obj = nullptr;
|
||||
auto editDoc = Application::Instance->editDocument();
|
||||
if(editDoc) {
|
||||
auto vp = dynamic_cast<ViewProviderDocumentObject*>(editDoc->getInEdit());
|
||||
@@ -987,7 +987,7 @@ ViewProviderDocumentObject* Document::getViewProviderByPathFromTail(SoPath * pat
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ViewProviderDocumentObject* Document::getViewProviderByPathFromHead(SoPath * path) const
|
||||
@@ -1001,16 +1001,16 @@ ViewProviderDocumentObject* Document::getViewProviderByPathFromHead(SoPath * pat
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ViewProviderDocumentObject *Document::getViewProvider(SoNode *node) const {
|
||||
if(!node || !node->isOfType(SoSeparator::getClassTypeId()))
|
||||
return 0;
|
||||
return nullptr;
|
||||
auto it = d->_CoinMap.find(static_cast<SoSeparator*>(node));
|
||||
if(it!=d->_CoinMap.end())
|
||||
return it->second;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<std::pair<ViewProviderDocumentObject*,int> > Document::getViewProvidersByPath(SoPath * path) const
|
||||
@@ -1443,7 +1443,7 @@ void Document::RestoreDocFile(Base::Reader &reader)
|
||||
if(ppReturn && ppReturn[0]) {
|
||||
saveCameraSettings(ppReturn);
|
||||
try {
|
||||
const char** pReturnIgnore=0;
|
||||
const char** pReturnIgnore=nullptr;
|
||||
std::list<MDIView*> mdi = getMDIViews();
|
||||
for (std::list<MDIView*>::iterator it = mdi.begin(); it != mdi.end(); ++it) {
|
||||
if ((*it)->onHasMsg("SetCamera"))
|
||||
@@ -1565,7 +1565,7 @@ void Document::SaveDocFile (Base::Writer &writer) const
|
||||
std::list<MDIView*> mdi = getMDIViews();
|
||||
for (std::list<MDIView*>::iterator it = mdi.begin(); it != mdi.end(); ++it) {
|
||||
if ((*it)->onHasMsg("GetCamera")) {
|
||||
const char* ppReturn=0;
|
||||
const char* ppReturn=nullptr;
|
||||
(*it)->onMsg("GetCamera",&ppReturn);
|
||||
if(saveCameraSettings(ppReturn))
|
||||
break;
|
||||
@@ -1726,18 +1726,18 @@ void Document::addRootObjectsToGroup(const std::vector<App::DocumentObject*>& ob
|
||||
MDIView *Document::createView(const Base::Type& typeId)
|
||||
{
|
||||
if (!typeId.isDerivedFrom(MDIView::getClassTypeId()))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
std::list<MDIView*> theViews = this->getMDIViewsOfType(typeId);
|
||||
if (typeId == View3DInventor::getClassTypeId()) {
|
||||
|
||||
QtGLWidget* shareWidget = 0;
|
||||
QtGLWidget* shareWidget = nullptr;
|
||||
// VBO rendering doesn't work correctly when we don't share the OpenGL widgets
|
||||
if (!theViews.empty()) {
|
||||
View3DInventor* firstView = static_cast<View3DInventor*>(theViews.front());
|
||||
shareWidget = qobject_cast<QtGLWidget*>(firstView->getViewer()->getGLWidget());
|
||||
|
||||
const char *ppReturn = 0;
|
||||
const char *ppReturn = nullptr;
|
||||
firstView->onMsg("GetCamera",&ppReturn);
|
||||
saveCameraSettings(ppReturn);
|
||||
}
|
||||
@@ -1780,20 +1780,20 @@ MDIView *Document::createView(const Base::Type& typeId)
|
||||
view3D->getViewer()->redraw();
|
||||
|
||||
if (!cameraSettings.empty()) {
|
||||
const char *ppReturn = 0;
|
||||
const char *ppReturn = nullptr;
|
||||
view3D->onMsg(cameraSettings.c_str(),&ppReturn);
|
||||
}
|
||||
|
||||
getMainWindow()->addWindow(view3D);
|
||||
return view3D;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Gui::MDIView* Document::cloneView(Gui::MDIView* oldview)
|
||||
{
|
||||
if (!oldview)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if (oldview->getTypeId() == View3DInventor::getClassTypeId()) {
|
||||
View3DInventor* view3D = new View3DInventor(this, getMainWindow());
|
||||
@@ -1839,7 +1839,7 @@ Gui::MDIView* Document::cloneView(Gui::MDIView* oldview)
|
||||
return view3D;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *Document::getCameraSettings() const {
|
||||
@@ -1895,7 +1895,7 @@ void Document::detachView(Gui::BaseView* pcView, bool bPassiv)
|
||||
// decouple a passive view
|
||||
std::list<Gui::BaseView*>::iterator it = d->passiveViews.begin();
|
||||
while (it != d->passiveViews.end()) {
|
||||
(*it)->setDocument(0);
|
||||
(*it)->setDocument(nullptr);
|
||||
it = d->passiveViews.begin();
|
||||
}
|
||||
|
||||
@@ -2064,7 +2064,7 @@ std::list<MDIView*> Document::getMDIViewsOfType(const Base::Type& typeId) const
|
||||
bool Document::sendMsgToViews(const char* pMsg)
|
||||
{
|
||||
std::list<Gui::BaseView*>::iterator it;
|
||||
const char** pReturnIgnore=0;
|
||||
const char** pReturnIgnore=nullptr;
|
||||
|
||||
for (it = d->baseViews.begin();it != d->baseViews.end();++it) {
|
||||
if ((*it)->onMsg(pMsg,pReturnIgnore)) {
|
||||
@@ -2132,7 +2132,7 @@ MDIView* Document::getActiveView(void) const
|
||||
if(windows.contains(*rit) || (*rit)->isDerivedFrom(View3DInventor::getClassTypeId()))
|
||||
return *rit;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MDIView *Document::setActiveView(ViewProviderDocumentObject *vp, Base::Type typeId)
|
||||
@@ -2227,7 +2227,7 @@ Gui::MDIView* Document::getViewOfNode(SoNode* node) const
|
||||
return *it;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Gui::MDIView* Document::getViewOfViewProvider(Gui::ViewProvider* vp) const
|
||||
@@ -2246,7 +2246,7 @@ Gui::MDIView* Document::getEditingViewOfViewProvider(Gui::ViewProvider* vp) cons
|
||||
return *it;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user