Gui: clean-up Selection API

Replace the int of the 'resolve' argument of several functions with a proper enum class.
* This avoids the inconsistencies in client code where often true/false is passed when an int is expected
* This avoids the use of magic numbers like 0, 1, 2 or the undocumented 3
This commit is contained in:
wmayer
2022-04-09 17:03:43 +02:00
parent 2d266a75cd
commit 0b2c73cf32
24 changed files with 365 additions and 274 deletions

View File

@@ -297,7 +297,7 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname)
if(!subname || !subname[0]) {
// 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);
auto sels = Gui::Selection().getCompleteSelection(ResolveMode::NoResolve);
App::DocumentObject *parentObj = nullptr;
for(auto &sel : sels) {
if(!sel.pObject || !sel.pObject->getNameInDocument())
@@ -737,7 +737,7 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj)
// cycling to all views of the document
ViewProvider* viewProvider = getViewProvider(&Obj);
if(!viewProvider)
if(!viewProvider)
return;
if (d->_editViewProvider==viewProvider || d->_editViewProviderParent==viewProvider)