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

@@ -144,7 +144,7 @@ void ViewProviderShapeBinder::highlightReferences(const bool on, bool /*auxiliar
PartGui::ViewProviderPart* svp = dynamic_cast<PartGui::ViewProviderPart*>(
Gui::Application::Instance->getViewProvider(obj));
if (svp == nullptr)
if (svp == nullptr)
return;
if (on) {
@@ -271,7 +271,7 @@ std::string ViewProviderSubShapeBinder::dropObjectEx(App::DocumentObject* obj, A
const char* subname, const std::vector<std::string>& elements)
{
auto self = dynamic_cast<PartDesign::SubShapeBinder*>(getObject());
if (!self)
if (!self)
return std::string();
std::map<App::DocumentObject*, std::vector<std::string> > values;
if (!subname) subname = "";
@@ -356,7 +356,7 @@ void ViewProviderSubShapeBinder::updatePlacement(bool transaction) {
App::DocumentObject* parent = nullptr;
std::string parentSub;
if (relative && self->getParents().size()) {
const auto& sel = Gui::Selection().getSelection("", 0);
const auto& sel = Gui::Selection().getSelection("", Gui::ResolveMode::NoResolve);
if (sel.size() != 1 || !sel[0].pObject ||
sel[0].pObject->getSubObject(sel[0].SubName) != self)
{